Remove node_modules from tracking, add .gitignore
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
node_modules/
|
||||||
|
maps.zip
|
||||||
|
maps.backup.*
|
||||||
-16
@@ -1,16 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*|*MINGW*|*MSYS*)
|
|
||||||
if command -v cygpath > /dev/null 2>&1; then
|
|
||||||
basedir=`cygpath -w "$basedir"`
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
exec "$basedir/node" "$basedir/../nanoid/bin/nanoid.cjs" "$@"
|
|
||||||
else
|
|
||||||
exec node "$basedir/../nanoid/bin/nanoid.cjs" "$@"
|
|
||||||
fi
|
|
||||||
-17
@@ -1,17 +0,0 @@
|
|||||||
@ECHO off
|
|
||||||
GOTO start
|
|
||||||
:find_dp0
|
|
||||||
SET dp0=%~dp0
|
|
||||||
EXIT /b
|
|
||||||
:start
|
|
||||||
SETLOCAL
|
|
||||||
CALL :find_dp0
|
|
||||||
|
|
||||||
IF EXIST "%dp0%\node.exe" (
|
|
||||||
SET "_prog=%dp0%\node.exe"
|
|
||||||
) ELSE (
|
|
||||||
SET "_prog=node"
|
|
||||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
||||||
)
|
|
||||||
|
|
||||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\nanoid\bin\nanoid.cjs" %*
|
|
||||||
-28
@@ -1,28 +0,0 @@
|
|||||||
#!/usr/bin/env pwsh
|
|
||||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
|
||||||
|
|
||||||
$exe=""
|
|
||||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
|
||||||
# Fix case when both the Windows and Linux builds of Node
|
|
||||||
# are installed in the same directory
|
|
||||||
$exe=".exe"
|
|
||||||
}
|
|
||||||
$ret=0
|
|
||||||
if (Test-Path "$basedir/node$exe") {
|
|
||||||
# Support pipeline input
|
|
||||||
if ($MyInvocation.ExpectingInput) {
|
|
||||||
$input | & "$basedir/node$exe" "$basedir/../nanoid/bin/nanoid.cjs" $args
|
|
||||||
} else {
|
|
||||||
& "$basedir/node$exe" "$basedir/../nanoid/bin/nanoid.cjs" $args
|
|
||||||
}
|
|
||||||
$ret=$LASTEXITCODE
|
|
||||||
} else {
|
|
||||||
# Support pipeline input
|
|
||||||
if ($MyInvocation.ExpectingInput) {
|
|
||||||
$input | & "node$exe" "$basedir/../nanoid/bin/nanoid.cjs" $args
|
|
||||||
} else {
|
|
||||||
& "node$exe" "$basedir/../nanoid/bin/nanoid.cjs" $args
|
|
||||||
}
|
|
||||||
$ret=$LASTEXITCODE
|
|
||||||
}
|
|
||||||
exit $ret
|
|
||||||
-16
@@ -1,16 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*|*MINGW*|*MSYS*)
|
|
||||||
if command -v cygpath > /dev/null 2>&1; then
|
|
||||||
basedir=`cygpath -w "$basedir"`
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
exec "$basedir/node" "$basedir/../rolldown/bin/cli.mjs" "$@"
|
|
||||||
else
|
|
||||||
exec node "$basedir/../rolldown/bin/cli.mjs" "$@"
|
|
||||||
fi
|
|
||||||
-17
@@ -1,17 +0,0 @@
|
|||||||
@ECHO off
|
|
||||||
GOTO start
|
|
||||||
:find_dp0
|
|
||||||
SET dp0=%~dp0
|
|
||||||
EXIT /b
|
|
||||||
:start
|
|
||||||
SETLOCAL
|
|
||||||
CALL :find_dp0
|
|
||||||
|
|
||||||
IF EXIST "%dp0%\node.exe" (
|
|
||||||
SET "_prog=%dp0%\node.exe"
|
|
||||||
) ELSE (
|
|
||||||
SET "_prog=node"
|
|
||||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
||||||
)
|
|
||||||
|
|
||||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\rolldown\bin\cli.mjs" %*
|
|
||||||
-28
@@ -1,28 +0,0 @@
|
|||||||
#!/usr/bin/env pwsh
|
|
||||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
|
||||||
|
|
||||||
$exe=""
|
|
||||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
|
||||||
# Fix case when both the Windows and Linux builds of Node
|
|
||||||
# are installed in the same directory
|
|
||||||
$exe=".exe"
|
|
||||||
}
|
|
||||||
$ret=0
|
|
||||||
if (Test-Path "$basedir/node$exe") {
|
|
||||||
# Support pipeline input
|
|
||||||
if ($MyInvocation.ExpectingInput) {
|
|
||||||
$input | & "$basedir/node$exe" "$basedir/../rolldown/bin/cli.mjs" $args
|
|
||||||
} else {
|
|
||||||
& "$basedir/node$exe" "$basedir/../rolldown/bin/cli.mjs" $args
|
|
||||||
}
|
|
||||||
$ret=$LASTEXITCODE
|
|
||||||
} else {
|
|
||||||
# Support pipeline input
|
|
||||||
if ($MyInvocation.ExpectingInput) {
|
|
||||||
$input | & "node$exe" "$basedir/../rolldown/bin/cli.mjs" $args
|
|
||||||
} else {
|
|
||||||
& "node$exe" "$basedir/../rolldown/bin/cli.mjs" $args
|
|
||||||
}
|
|
||||||
$ret=$LASTEXITCODE
|
|
||||||
}
|
|
||||||
exit $ret
|
|
||||||
-16
@@ -1,16 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*|*MINGW*|*MSYS*)
|
|
||||||
if command -v cygpath > /dev/null 2>&1; then
|
|
||||||
basedir=`cygpath -w "$basedir"`
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
exec "$basedir/node" "$basedir/../vite/bin/vite.js" "$@"
|
|
||||||
else
|
|
||||||
exec node "$basedir/../vite/bin/vite.js" "$@"
|
|
||||||
fi
|
|
||||||
-17
@@ -1,17 +0,0 @@
|
|||||||
@ECHO off
|
|
||||||
GOTO start
|
|
||||||
:find_dp0
|
|
||||||
SET dp0=%~dp0
|
|
||||||
EXIT /b
|
|
||||||
:start
|
|
||||||
SETLOCAL
|
|
||||||
CALL :find_dp0
|
|
||||||
|
|
||||||
IF EXIST "%dp0%\node.exe" (
|
|
||||||
SET "_prog=%dp0%\node.exe"
|
|
||||||
) ELSE (
|
|
||||||
SET "_prog=node"
|
|
||||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
||||||
)
|
|
||||||
|
|
||||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\vite\bin\vite.js" %*
|
|
||||||
-28
@@ -1,28 +0,0 @@
|
|||||||
#!/usr/bin/env pwsh
|
|
||||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
|
||||||
|
|
||||||
$exe=""
|
|
||||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
|
||||||
# Fix case when both the Windows and Linux builds of Node
|
|
||||||
# are installed in the same directory
|
|
||||||
$exe=".exe"
|
|
||||||
}
|
|
||||||
$ret=0
|
|
||||||
if (Test-Path "$basedir/node$exe") {
|
|
||||||
# Support pipeline input
|
|
||||||
if ($MyInvocation.ExpectingInput) {
|
|
||||||
$input | & "$basedir/node$exe" "$basedir/../vite/bin/vite.js" $args
|
|
||||||
} else {
|
|
||||||
& "$basedir/node$exe" "$basedir/../vite/bin/vite.js" $args
|
|
||||||
}
|
|
||||||
$ret=$LASTEXITCODE
|
|
||||||
} else {
|
|
||||||
# Support pipeline input
|
|
||||||
if ($MyInvocation.ExpectingInput) {
|
|
||||||
$input | & "node$exe" "$basedir/../vite/bin/vite.js" $args
|
|
||||||
} else {
|
|
||||||
& "node$exe" "$basedir/../vite/bin/vite.js" $args
|
|
||||||
}
|
|
||||||
$ret=$LASTEXITCODE
|
|
||||||
}
|
|
||||||
exit $ret
|
|
||||||
-1593
File diff suppressed because it is too large
Load Diff
-11545
File diff suppressed because it is too large
Load Diff
-1
File diff suppressed because one or more lines are too long
-62
@@ -1,62 +0,0 @@
|
|||||||
{
|
|
||||||
"hash": "e12a87e5",
|
|
||||||
"configHash": "7f781ef2",
|
|
||||||
"lockfileHash": "a50d3e50",
|
|
||||||
"browserHash": "8fa609b3",
|
|
||||||
"optimized": {
|
|
||||||
"@xyflow/react": {
|
|
||||||
"src": "../../@xyflow/react/dist/esm/index.js",
|
|
||||||
"file": "@xyflow_react.js",
|
|
||||||
"fileHash": "480c6c95",
|
|
||||||
"needsInterop": false
|
|
||||||
},
|
|
||||||
"react-dom": {
|
|
||||||
"src": "../../react-dom/index.js",
|
|
||||||
"file": "react-dom.js",
|
|
||||||
"fileHash": "8bdf5130",
|
|
||||||
"needsInterop": true
|
|
||||||
},
|
|
||||||
"react-dom/client": {
|
|
||||||
"src": "../../react-dom/client.js",
|
|
||||||
"file": "react-dom_client.js",
|
|
||||||
"fileHash": "c6919cbe",
|
|
||||||
"needsInterop": true
|
|
||||||
},
|
|
||||||
"react-router-dom": {
|
|
||||||
"src": "../../react-router-dom/dist/index.mjs",
|
|
||||||
"file": "react-router-dom.js",
|
|
||||||
"fileHash": "7507c011",
|
|
||||||
"needsInterop": false
|
|
||||||
},
|
|
||||||
"react": {
|
|
||||||
"src": "../../react/index.js",
|
|
||||||
"file": "react.js",
|
|
||||||
"fileHash": "9b91f332",
|
|
||||||
"needsInterop": true
|
|
||||||
},
|
|
||||||
"react/jsx-dev-runtime": {
|
|
||||||
"src": "../../react/jsx-dev-runtime.js",
|
|
||||||
"file": "react_jsx-dev-runtime.js",
|
|
||||||
"fileHash": "d000ef3b",
|
|
||||||
"needsInterop": true
|
|
||||||
},
|
|
||||||
"react/jsx-runtime": {
|
|
||||||
"src": "../../react/jsx-runtime.js",
|
|
||||||
"file": "react_jsx-runtime.js",
|
|
||||||
"fileHash": "ca5f42d3",
|
|
||||||
"needsInterop": true
|
|
||||||
},
|
|
||||||
"zustand": {
|
|
||||||
"src": "../../zustand/esm/index.mjs",
|
|
||||||
"file": "zustand.js",
|
|
||||||
"fileHash": "4a330587",
|
|
||||||
"needsInterop": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"chunks": {
|
|
||||||
"react-Ea1HnpA1": {
|
|
||||||
"file": "react-Ea1HnpA1.js",
|
|
||||||
"isDynamicEntry": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"type": "module"
|
|
||||||
}
|
|
||||||
-790
@@ -1,790 +0,0 @@
|
|||||||
//#region \0rolldown/runtime.js
|
|
||||||
var __create = Object.create;
|
|
||||||
var __defProp = Object.defineProperty;
|
|
||||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
||||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
||||||
var __getProtoOf = Object.getPrototypeOf;
|
|
||||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
||||||
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
||||||
var __copyProps = (to, from, except, desc) => {
|
|
||||||
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
||||||
key = keys[i];
|
|
||||||
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
||||||
get: ((k) => from[k]).bind(null, key),
|
|
||||||
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return to;
|
|
||||||
};
|
|
||||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
||||||
value: mod,
|
|
||||||
enumerable: true
|
|
||||||
}) : target, mod));
|
|
||||||
//#endregion
|
|
||||||
//#region node_modules/react/cjs/react.development.js
|
|
||||||
/**
|
|
||||||
* @license React
|
|
||||||
* react.development.js
|
|
||||||
*
|
|
||||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree.
|
|
||||||
*/
|
|
||||||
var require_react_development = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
||||||
(function() {
|
|
||||||
function defineDeprecationWarning(methodName, info) {
|
|
||||||
Object.defineProperty(Component.prototype, methodName, { get: function() {
|
|
||||||
console.warn("%s(...) is deprecated in plain JavaScript React classes. %s", info[0], info[1]);
|
|
||||||
} });
|
|
||||||
}
|
|
||||||
function getIteratorFn(maybeIterable) {
|
|
||||||
if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
|
|
||||||
maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
|
|
||||||
return "function" === typeof maybeIterable ? maybeIterable : null;
|
|
||||||
}
|
|
||||||
function warnNoop(publicInstance, callerName) {
|
|
||||||
publicInstance = (publicInstance = publicInstance.constructor) && (publicInstance.displayName || publicInstance.name) || "ReactClass";
|
|
||||||
var warningKey = publicInstance + "." + callerName;
|
|
||||||
didWarnStateUpdateForUnmountedComponent[warningKey] || (console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.", callerName, publicInstance), didWarnStateUpdateForUnmountedComponent[warningKey] = !0);
|
|
||||||
}
|
|
||||||
function Component(props, context, updater) {
|
|
||||||
this.props = props;
|
|
||||||
this.context = context;
|
|
||||||
this.refs = emptyObject;
|
|
||||||
this.updater = updater || ReactNoopUpdateQueue;
|
|
||||||
}
|
|
||||||
function ComponentDummy() {}
|
|
||||||
function PureComponent(props, context, updater) {
|
|
||||||
this.props = props;
|
|
||||||
this.context = context;
|
|
||||||
this.refs = emptyObject;
|
|
||||||
this.updater = updater || ReactNoopUpdateQueue;
|
|
||||||
}
|
|
||||||
function noop() {}
|
|
||||||
function testStringCoercion(value) {
|
|
||||||
return "" + value;
|
|
||||||
}
|
|
||||||
function checkKeyStringCoercion(value) {
|
|
||||||
try {
|
|
||||||
testStringCoercion(value);
|
|
||||||
var JSCompiler_inline_result = !1;
|
|
||||||
} catch (e) {
|
|
||||||
JSCompiler_inline_result = !0;
|
|
||||||
}
|
|
||||||
if (JSCompiler_inline_result) {
|
|
||||||
JSCompiler_inline_result = console;
|
|
||||||
var JSCompiler_temp_const = JSCompiler_inline_result.error;
|
|
||||||
var JSCompiler_inline_result$jscomp$0 = "function" === typeof Symbol && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
||||||
JSCompiler_temp_const.call(JSCompiler_inline_result, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", JSCompiler_inline_result$jscomp$0);
|
|
||||||
return testStringCoercion(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function getComponentNameFromType(type) {
|
|
||||||
if (null == type) return null;
|
|
||||||
if ("function" === typeof type) return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
|
|
||||||
if ("string" === typeof type) return type;
|
|
||||||
switch (type) {
|
|
||||||
case REACT_FRAGMENT_TYPE: return "Fragment";
|
|
||||||
case REACT_PROFILER_TYPE: return "Profiler";
|
|
||||||
case REACT_STRICT_MODE_TYPE: return "StrictMode";
|
|
||||||
case REACT_SUSPENSE_TYPE: return "Suspense";
|
|
||||||
case REACT_SUSPENSE_LIST_TYPE: return "SuspenseList";
|
|
||||||
case REACT_ACTIVITY_TYPE: return "Activity";
|
|
||||||
}
|
|
||||||
if ("object" === typeof type) switch ("number" === typeof type.tag && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), type.$$typeof) {
|
|
||||||
case REACT_PORTAL_TYPE: return "Portal";
|
|
||||||
case REACT_CONTEXT_TYPE: return type.displayName || "Context";
|
|
||||||
case REACT_CONSUMER_TYPE: return (type._context.displayName || "Context") + ".Consumer";
|
|
||||||
case REACT_FORWARD_REF_TYPE:
|
|
||||||
var innerType = type.render;
|
|
||||||
type = type.displayName;
|
|
||||||
type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef");
|
|
||||||
return type;
|
|
||||||
case REACT_MEMO_TYPE: return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo";
|
|
||||||
case REACT_LAZY_TYPE:
|
|
||||||
innerType = type._payload;
|
|
||||||
type = type._init;
|
|
||||||
try {
|
|
||||||
return getComponentNameFromType(type(innerType));
|
|
||||||
} catch (x) {}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
function getTaskName(type) {
|
|
||||||
if (type === REACT_FRAGMENT_TYPE) return "<>";
|
|
||||||
if ("object" === typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE) return "<...>";
|
|
||||||
try {
|
|
||||||
var name = getComponentNameFromType(type);
|
|
||||||
return name ? "<" + name + ">" : "<...>";
|
|
||||||
} catch (x) {
|
|
||||||
return "<...>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function getOwner() {
|
|
||||||
var dispatcher = ReactSharedInternals.A;
|
|
||||||
return null === dispatcher ? null : dispatcher.getOwner();
|
|
||||||
}
|
|
||||||
function UnknownOwner() {
|
|
||||||
return Error("react-stack-top-frame");
|
|
||||||
}
|
|
||||||
function hasValidKey(config) {
|
|
||||||
if (hasOwnProperty.call(config, "key")) {
|
|
||||||
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
||||||
if (getter && getter.isReactWarning) return !1;
|
|
||||||
}
|
|
||||||
return void 0 !== config.key;
|
|
||||||
}
|
|
||||||
function defineKeyPropWarningGetter(props, displayName) {
|
|
||||||
function warnAboutAccessingKey() {
|
|
||||||
specialPropKeyWarningShown || (specialPropKeyWarningShown = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", displayName));
|
|
||||||
}
|
|
||||||
warnAboutAccessingKey.isReactWarning = !0;
|
|
||||||
Object.defineProperty(props, "key", {
|
|
||||||
get: warnAboutAccessingKey,
|
|
||||||
configurable: !0
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function elementRefGetterWithDeprecationWarning() {
|
|
||||||
var componentName = getComponentNameFromType(this.type);
|
|
||||||
didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."));
|
|
||||||
componentName = this.props.ref;
|
|
||||||
return void 0 !== componentName ? componentName : null;
|
|
||||||
}
|
|
||||||
function ReactElement(type, key, props, owner, debugStack, debugTask) {
|
|
||||||
var refProp = props.ref;
|
|
||||||
type = {
|
|
||||||
$$typeof: REACT_ELEMENT_TYPE,
|
|
||||||
type,
|
|
||||||
key,
|
|
||||||
props,
|
|
||||||
_owner: owner
|
|
||||||
};
|
|
||||||
null !== (void 0 !== refProp ? refProp : null) ? Object.defineProperty(type, "ref", {
|
|
||||||
enumerable: !1,
|
|
||||||
get: elementRefGetterWithDeprecationWarning
|
|
||||||
}) : Object.defineProperty(type, "ref", {
|
|
||||||
enumerable: !1,
|
|
||||||
value: null
|
|
||||||
});
|
|
||||||
type._store = {};
|
|
||||||
Object.defineProperty(type._store, "validated", {
|
|
||||||
configurable: !1,
|
|
||||||
enumerable: !1,
|
|
||||||
writable: !0,
|
|
||||||
value: 0
|
|
||||||
});
|
|
||||||
Object.defineProperty(type, "_debugInfo", {
|
|
||||||
configurable: !1,
|
|
||||||
enumerable: !1,
|
|
||||||
writable: !0,
|
|
||||||
value: null
|
|
||||||
});
|
|
||||||
Object.defineProperty(type, "_debugStack", {
|
|
||||||
configurable: !1,
|
|
||||||
enumerable: !1,
|
|
||||||
writable: !0,
|
|
||||||
value: debugStack
|
|
||||||
});
|
|
||||||
Object.defineProperty(type, "_debugTask", {
|
|
||||||
configurable: !1,
|
|
||||||
enumerable: !1,
|
|
||||||
writable: !0,
|
|
||||||
value: debugTask
|
|
||||||
});
|
|
||||||
Object.freeze && (Object.freeze(type.props), Object.freeze(type));
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
function cloneAndReplaceKey(oldElement, newKey) {
|
|
||||||
newKey = ReactElement(oldElement.type, newKey, oldElement.props, oldElement._owner, oldElement._debugStack, oldElement._debugTask);
|
|
||||||
oldElement._store && (newKey._store.validated = oldElement._store.validated);
|
|
||||||
return newKey;
|
|
||||||
}
|
|
||||||
function validateChildKeys(node) {
|
|
||||||
isValidElement(node) ? node._store && (node._store.validated = 1) : "object" === typeof node && null !== node && node.$$typeof === REACT_LAZY_TYPE && ("fulfilled" === node._payload.status ? isValidElement(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1));
|
|
||||||
}
|
|
||||||
function isValidElement(object) {
|
|
||||||
return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
||||||
}
|
|
||||||
function escape(key) {
|
|
||||||
var escaperLookup = {
|
|
||||||
"=": "=0",
|
|
||||||
":": "=2"
|
|
||||||
};
|
|
||||||
return "$" + key.replace(/[=:]/g, function(match) {
|
|
||||||
return escaperLookup[match];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function getElementKey(element, index) {
|
|
||||||
return "object" === typeof element && null !== element && null != element.key ? (checkKeyStringCoercion(element.key), escape("" + element.key)) : index.toString(36);
|
|
||||||
}
|
|
||||||
function resolveThenable(thenable) {
|
|
||||||
switch (thenable.status) {
|
|
||||||
case "fulfilled": return thenable.value;
|
|
||||||
case "rejected": throw thenable.reason;
|
|
||||||
default: switch ("string" === typeof thenable.status ? thenable.then(noop, noop) : (thenable.status = "pending", thenable.then(function(fulfilledValue) {
|
|
||||||
"pending" === thenable.status && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
|
|
||||||
}, function(error) {
|
|
||||||
"pending" === thenable.status && (thenable.status = "rejected", thenable.reason = error);
|
|
||||||
})), thenable.status) {
|
|
||||||
case "fulfilled": return thenable.value;
|
|
||||||
case "rejected": throw thenable.reason;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw thenable;
|
|
||||||
}
|
|
||||||
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
|
||||||
var type = typeof children;
|
|
||||||
if ("undefined" === type || "boolean" === type) children = null;
|
|
||||||
var invokeCallback = !1;
|
|
||||||
if (null === children) invokeCallback = !0;
|
|
||||||
else switch (type) {
|
|
||||||
case "bigint":
|
|
||||||
case "string":
|
|
||||||
case "number":
|
|
||||||
invokeCallback = !0;
|
|
||||||
break;
|
|
||||||
case "object": switch (children.$$typeof) {
|
|
||||||
case REACT_ELEMENT_TYPE:
|
|
||||||
case REACT_PORTAL_TYPE:
|
|
||||||
invokeCallback = !0;
|
|
||||||
break;
|
|
||||||
case REACT_LAZY_TYPE: return invokeCallback = children._init, mapIntoArray(invokeCallback(children._payload), array, escapedPrefix, nameSoFar, callback);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (invokeCallback) {
|
|
||||||
invokeCallback = children;
|
|
||||||
callback = callback(invokeCallback);
|
|
||||||
var childKey = "" === nameSoFar ? "." + getElementKey(invokeCallback, 0) : nameSoFar;
|
|
||||||
isArrayImpl(callback) ? (escapedPrefix = "", null != childKey && (escapedPrefix = childKey.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), mapIntoArray(callback, array, escapedPrefix, "", function(c) {
|
|
||||||
return c;
|
|
||||||
})) : null != callback && (isValidElement(callback) && (null != callback.key && (invokeCallback && invokeCallback.key === callback.key || checkKeyStringCoercion(callback.key)), escapedPrefix = cloneAndReplaceKey(callback, escapedPrefix + (null == callback.key || invokeCallback && invokeCallback.key === callback.key ? "" : ("" + callback.key).replace(userProvidedKeyEscapeRegex, "$&/") + "/") + childKey), "" !== nameSoFar && null != invokeCallback && isValidElement(invokeCallback) && null == invokeCallback.key && invokeCallback._store && !invokeCallback._store.validated && (escapedPrefix._store.validated = 2), callback = escapedPrefix), array.push(callback));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
invokeCallback = 0;
|
|
||||||
childKey = "" === nameSoFar ? "." : nameSoFar + ":";
|
|
||||||
if (isArrayImpl(children)) for (var i = 0; i < children.length; i++) nameSoFar = children[i], type = childKey + getElementKey(nameSoFar, i), invokeCallback += mapIntoArray(nameSoFar, array, escapedPrefix, type, callback);
|
|
||||||
else if (i = getIteratorFn(children), "function" === typeof i) for (i === children.entries && (didWarnAboutMaps || console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."), didWarnAboutMaps = !0), children = i.call(children), i = 0; !(nameSoFar = children.next()).done;) nameSoFar = nameSoFar.value, type = childKey + getElementKey(nameSoFar, i++), invokeCallback += mapIntoArray(nameSoFar, array, escapedPrefix, type, callback);
|
|
||||||
else if ("object" === type) {
|
|
||||||
if ("function" === typeof children.then) return mapIntoArray(resolveThenable(children), array, escapedPrefix, nameSoFar, callback);
|
|
||||||
array = String(children);
|
|
||||||
throw Error("Objects are not valid as a React child (found: " + ("[object Object]" === array ? "object with keys {" + Object.keys(children).join(", ") + "}" : array) + "). If you meant to render a collection of children, use an array instead.");
|
|
||||||
}
|
|
||||||
return invokeCallback;
|
|
||||||
}
|
|
||||||
function mapChildren(children, func, context) {
|
|
||||||
if (null == children) return children;
|
|
||||||
var result = [], count = 0;
|
|
||||||
mapIntoArray(children, result, "", "", function(child) {
|
|
||||||
return func.call(context, child, count++);
|
|
||||||
});
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
function lazyInitializer(payload) {
|
|
||||||
if (-1 === payload._status) {
|
|
||||||
var ioInfo = payload._ioInfo;
|
|
||||||
null != ioInfo && (ioInfo.start = ioInfo.end = performance.now());
|
|
||||||
ioInfo = payload._result;
|
|
||||||
var thenable = ioInfo();
|
|
||||||
thenable.then(function(moduleObject) {
|
|
||||||
if (0 === payload._status || -1 === payload._status) {
|
|
||||||
payload._status = 1;
|
|
||||||
payload._result = moduleObject;
|
|
||||||
var _ioInfo = payload._ioInfo;
|
|
||||||
null != _ioInfo && (_ioInfo.end = performance.now());
|
|
||||||
void 0 === thenable.status && (thenable.status = "fulfilled", thenable.value = moduleObject);
|
|
||||||
}
|
|
||||||
}, function(error) {
|
|
||||||
if (0 === payload._status || -1 === payload._status) {
|
|
||||||
payload._status = 2;
|
|
||||||
payload._result = error;
|
|
||||||
var _ioInfo2 = payload._ioInfo;
|
|
||||||
null != _ioInfo2 && (_ioInfo2.end = performance.now());
|
|
||||||
void 0 === thenable.status && (thenable.status = "rejected", thenable.reason = error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
ioInfo = payload._ioInfo;
|
|
||||||
if (null != ioInfo) {
|
|
||||||
ioInfo.value = thenable;
|
|
||||||
var displayName = thenable.displayName;
|
|
||||||
"string" === typeof displayName && (ioInfo.name = displayName);
|
|
||||||
}
|
|
||||||
-1 === payload._status && (payload._status = 0, payload._result = thenable);
|
|
||||||
}
|
|
||||||
if (1 === payload._status) return ioInfo = payload._result, void 0 === ioInfo && console.error("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?", ioInfo), "default" in ioInfo || console.error("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))", ioInfo), ioInfo.default;
|
|
||||||
throw payload._result;
|
|
||||||
}
|
|
||||||
function resolveDispatcher() {
|
|
||||||
var dispatcher = ReactSharedInternals.H;
|
|
||||||
null === dispatcher && console.error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.");
|
|
||||||
return dispatcher;
|
|
||||||
}
|
|
||||||
function releaseAsyncTransition() {
|
|
||||||
ReactSharedInternals.asyncTransitions--;
|
|
||||||
}
|
|
||||||
function enqueueTask(task) {
|
|
||||||
if (null === enqueueTaskImpl) try {
|
|
||||||
var requireString = ("require" + Math.random()).slice(0, 7);
|
|
||||||
enqueueTaskImpl = (module && module[requireString]).call(module, "timers").setImmediate;
|
|
||||||
} catch (_err) {
|
|
||||||
enqueueTaskImpl = function(callback) {
|
|
||||||
!1 === didWarnAboutMessageChannel && (didWarnAboutMessageChannel = !0, "undefined" === typeof MessageChannel && console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));
|
|
||||||
var channel = new MessageChannel();
|
|
||||||
channel.port1.onmessage = callback;
|
|
||||||
channel.port2.postMessage(void 0);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return enqueueTaskImpl(task);
|
|
||||||
}
|
|
||||||
function aggregateErrors(errors) {
|
|
||||||
return 1 < errors.length && "function" === typeof AggregateError ? new AggregateError(errors) : errors[0];
|
|
||||||
}
|
|
||||||
function popActScope(prevActQueue, prevActScopeDepth) {
|
|
||||||
prevActScopeDepth !== actScopeDepth - 1 && console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. ");
|
|
||||||
actScopeDepth = prevActScopeDepth;
|
|
||||||
}
|
|
||||||
function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
|
|
||||||
var queue = ReactSharedInternals.actQueue;
|
|
||||||
if (null !== queue) if (0 !== queue.length) try {
|
|
||||||
flushActQueue(queue);
|
|
||||||
enqueueTask(function() {
|
|
||||||
return recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
} catch (error) {
|
|
||||||
ReactSharedInternals.thrownErrors.push(error);
|
|
||||||
}
|
|
||||||
else ReactSharedInternals.actQueue = null;
|
|
||||||
0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve(returnValue);
|
|
||||||
}
|
|
||||||
function flushActQueue(queue) {
|
|
||||||
if (!isFlushing) {
|
|
||||||
isFlushing = !0;
|
|
||||||
var i = 0;
|
|
||||||
try {
|
|
||||||
for (; i < queue.length; i++) {
|
|
||||||
var callback = queue[i];
|
|
||||||
do {
|
|
||||||
ReactSharedInternals.didUsePromise = !1;
|
|
||||||
var continuation = callback(!1);
|
|
||||||
if (null !== continuation) {
|
|
||||||
if (ReactSharedInternals.didUsePromise) {
|
|
||||||
queue[i] = callback;
|
|
||||||
queue.splice(0, i);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
callback = continuation;
|
|
||||||
} else break;
|
|
||||||
} while (1);
|
|
||||||
}
|
|
||||||
queue.length = 0;
|
|
||||||
} catch (error) {
|
|
||||||
queue.splice(0, i + 1), ReactSharedInternals.thrownErrors.push(error);
|
|
||||||
} finally {
|
|
||||||
isFlushing = !1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
||||||
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator, didWarnStateUpdateForUnmountedComponent = {}, ReactNoopUpdateQueue = {
|
|
||||||
isMounted: function() {
|
|
||||||
return !1;
|
|
||||||
},
|
|
||||||
enqueueForceUpdate: function(publicInstance) {
|
|
||||||
warnNoop(publicInstance, "forceUpdate");
|
|
||||||
},
|
|
||||||
enqueueReplaceState: function(publicInstance) {
|
|
||||||
warnNoop(publicInstance, "replaceState");
|
|
||||||
},
|
|
||||||
enqueueSetState: function(publicInstance) {
|
|
||||||
warnNoop(publicInstance, "setState");
|
|
||||||
}
|
|
||||||
}, assign = Object.assign, emptyObject = {};
|
|
||||||
Object.freeze(emptyObject);
|
|
||||||
Component.prototype.isReactComponent = {};
|
|
||||||
Component.prototype.setState = function(partialState, callback) {
|
|
||||||
if ("object" !== typeof partialState && "function" !== typeof partialState && null != partialState) throw Error("takes an object of state variables to update or a function which returns an object of state variables.");
|
|
||||||
this.updater.enqueueSetState(this, partialState, callback, "setState");
|
|
||||||
};
|
|
||||||
Component.prototype.forceUpdate = function(callback) {
|
|
||||||
this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
|
|
||||||
};
|
|
||||||
var deprecatedAPIs = {
|
|
||||||
isMounted: ["isMounted", "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],
|
|
||||||
replaceState: ["replaceState", "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]
|
|
||||||
};
|
|
||||||
for (fnName in deprecatedAPIs) deprecatedAPIs.hasOwnProperty(fnName) && defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
||||||
ComponentDummy.prototype = Component.prototype;
|
|
||||||
deprecatedAPIs = PureComponent.prototype = new ComponentDummy();
|
|
||||||
deprecatedAPIs.constructor = PureComponent;
|
|
||||||
assign(deprecatedAPIs, Component.prototype);
|
|
||||||
deprecatedAPIs.isPureReactComponent = !0;
|
|
||||||
var isArrayImpl = Array.isArray, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = {
|
|
||||||
H: null,
|
|
||||||
A: null,
|
|
||||||
T: null,
|
|
||||||
S: null,
|
|
||||||
actQueue: null,
|
|
||||||
asyncTransitions: 0,
|
|
||||||
isBatchingLegacy: !1,
|
|
||||||
didScheduleLegacyUpdate: !1,
|
|
||||||
didUsePromise: !1,
|
|
||||||
thrownErrors: [],
|
|
||||||
getCurrentStack: null,
|
|
||||||
recentlyCreatedOwnerStacks: 0
|
|
||||||
}, hasOwnProperty = Object.prototype.hasOwnProperty, createTask = console.createTask ? console.createTask : function() {
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
deprecatedAPIs = { react_stack_bottom_frame: function(callStackForError) {
|
|
||||||
return callStackForError();
|
|
||||||
} };
|
|
||||||
var specialPropKeyWarningShown, didWarnAboutOldJSXRuntime;
|
|
||||||
var didWarnAboutElementRef = {};
|
|
||||||
var unknownOwnerDebugStack = deprecatedAPIs.react_stack_bottom_frame.bind(deprecatedAPIs, UnknownOwner)();
|
|
||||||
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
|
|
||||||
var didWarnAboutMaps = !1, userProvidedKeyEscapeRegex = /\/+/g, reportGlobalError = "function" === typeof reportError ? reportError : function(error) {
|
|
||||||
if ("object" === typeof window && "function" === typeof window.ErrorEvent) {
|
|
||||||
var event = new window.ErrorEvent("error", {
|
|
||||||
bubbles: !0,
|
|
||||||
cancelable: !0,
|
|
||||||
message: "object" === typeof error && null !== error && "string" === typeof error.message ? String(error.message) : String(error),
|
|
||||||
error
|
|
||||||
});
|
|
||||||
if (!window.dispatchEvent(event)) return;
|
|
||||||
} else if ("object" === typeof process && "function" === typeof process.emit) {
|
|
||||||
process.emit("uncaughtException", error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
console.error(error);
|
|
||||||
}, didWarnAboutMessageChannel = !1, enqueueTaskImpl = null, actScopeDepth = 0, didWarnNoAwaitAct = !1, isFlushing = !1, queueSeveralMicrotasks = "function" === typeof queueMicrotask ? function(callback) {
|
|
||||||
queueMicrotask(function() {
|
|
||||||
return queueMicrotask(callback);
|
|
||||||
});
|
|
||||||
} : enqueueTask;
|
|
||||||
deprecatedAPIs = Object.freeze({
|
|
||||||
__proto__: null,
|
|
||||||
c: function(size) {
|
|
||||||
return resolveDispatcher().useMemoCache(size);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
var fnName = {
|
|
||||||
map: mapChildren,
|
|
||||||
forEach: function(children, forEachFunc, forEachContext) {
|
|
||||||
mapChildren(children, function() {
|
|
||||||
forEachFunc.apply(this, arguments);
|
|
||||||
}, forEachContext);
|
|
||||||
},
|
|
||||||
count: function(children) {
|
|
||||||
var n = 0;
|
|
||||||
mapChildren(children, function() {
|
|
||||||
n++;
|
|
||||||
});
|
|
||||||
return n;
|
|
||||||
},
|
|
||||||
toArray: function(children) {
|
|
||||||
return mapChildren(children, function(child) {
|
|
||||||
return child;
|
|
||||||
}) || [];
|
|
||||||
},
|
|
||||||
only: function(children) {
|
|
||||||
if (!isValidElement(children)) throw Error("React.Children.only expected to receive a single React element child.");
|
|
||||||
return children;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
exports.Activity = REACT_ACTIVITY_TYPE;
|
|
||||||
exports.Children = fnName;
|
|
||||||
exports.Component = Component;
|
|
||||||
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
||||||
exports.Profiler = REACT_PROFILER_TYPE;
|
|
||||||
exports.PureComponent = PureComponent;
|
|
||||||
exports.StrictMode = REACT_STRICT_MODE_TYPE;
|
|
||||||
exports.Suspense = REACT_SUSPENSE_TYPE;
|
|
||||||
exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
|
|
||||||
exports.__COMPILER_RUNTIME = deprecatedAPIs;
|
|
||||||
exports.act = function(callback) {
|
|
||||||
var prevActQueue = ReactSharedInternals.actQueue, prevActScopeDepth = actScopeDepth;
|
|
||||||
actScopeDepth++;
|
|
||||||
var queue = ReactSharedInternals.actQueue = null !== prevActQueue ? prevActQueue : [], didAwaitActCall = !1;
|
|
||||||
try {
|
|
||||||
var result = callback();
|
|
||||||
} catch (error) {
|
|
||||||
ReactSharedInternals.thrownErrors.push(error);
|
|
||||||
}
|
|
||||||
if (0 < ReactSharedInternals.thrownErrors.length) throw popActScope(prevActQueue, prevActScopeDepth), callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
|
|
||||||
if (null !== result && "object" === typeof result && "function" === typeof result.then) {
|
|
||||||
var thenable = result;
|
|
||||||
queueSeveralMicrotasks(function() {
|
|
||||||
didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = !0, console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"));
|
|
||||||
});
|
|
||||||
return { then: function(resolve, reject) {
|
|
||||||
didAwaitActCall = !0;
|
|
||||||
thenable.then(function(returnValue) {
|
|
||||||
popActScope(prevActQueue, prevActScopeDepth);
|
|
||||||
if (0 === prevActScopeDepth) {
|
|
||||||
try {
|
|
||||||
flushActQueue(queue), enqueueTask(function() {
|
|
||||||
return recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
||||||
});
|
|
||||||
} catch (error$0) {
|
|
||||||
ReactSharedInternals.thrownErrors.push(error$0);
|
|
||||||
}
|
|
||||||
if (0 < ReactSharedInternals.thrownErrors.length) {
|
|
||||||
var _thrownError = aggregateErrors(ReactSharedInternals.thrownErrors);
|
|
||||||
ReactSharedInternals.thrownErrors.length = 0;
|
|
||||||
reject(_thrownError);
|
|
||||||
}
|
|
||||||
} else resolve(returnValue);
|
|
||||||
}, function(error) {
|
|
||||||
popActScope(prevActQueue, prevActScopeDepth);
|
|
||||||
0 < ReactSharedInternals.thrownErrors.length ? (error = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(error)) : reject(error);
|
|
||||||
});
|
|
||||||
} };
|
|
||||||
}
|
|
||||||
var returnValue$jscomp$0 = result;
|
|
||||||
popActScope(prevActQueue, prevActScopeDepth);
|
|
||||||
0 === prevActScopeDepth && (flushActQueue(queue), 0 !== queue.length && queueSeveralMicrotasks(function() {
|
|
||||||
didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = !0, console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"));
|
|
||||||
}), ReactSharedInternals.actQueue = null);
|
|
||||||
if (0 < ReactSharedInternals.thrownErrors.length) throw callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
|
|
||||||
return { then: function(resolve, reject) {
|
|
||||||
didAwaitActCall = !0;
|
|
||||||
0 === prevActScopeDepth ? (ReactSharedInternals.actQueue = queue, enqueueTask(function() {
|
|
||||||
return recursivelyFlushAsyncActWork(returnValue$jscomp$0, resolve, reject);
|
|
||||||
})) : resolve(returnValue$jscomp$0);
|
|
||||||
} };
|
|
||||||
};
|
|
||||||
exports.cache = function(fn) {
|
|
||||||
return function() {
|
|
||||||
return fn.apply(null, arguments);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
exports.cacheSignal = function() {
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
exports.captureOwnerStack = function() {
|
|
||||||
var getCurrentStack = ReactSharedInternals.getCurrentStack;
|
|
||||||
return null === getCurrentStack ? null : getCurrentStack();
|
|
||||||
};
|
|
||||||
exports.cloneElement = function(element, config, children) {
|
|
||||||
if (null === element || void 0 === element) throw Error("The argument must be a React element, but you passed " + element + ".");
|
|
||||||
var props = assign({}, element.props), key = element.key, owner = element._owner;
|
|
||||||
if (null != config) {
|
|
||||||
var JSCompiler_inline_result;
|
|
||||||
a: {
|
|
||||||
if (hasOwnProperty.call(config, "ref") && (JSCompiler_inline_result = Object.getOwnPropertyDescriptor(config, "ref").get) && JSCompiler_inline_result.isReactWarning) {
|
|
||||||
JSCompiler_inline_result = !1;
|
|
||||||
break a;
|
|
||||||
}
|
|
||||||
JSCompiler_inline_result = void 0 !== config.ref;
|
|
||||||
}
|
|
||||||
JSCompiler_inline_result && (owner = getOwner());
|
|
||||||
hasValidKey(config) && (checkKeyStringCoercion(config.key), key = "" + config.key);
|
|
||||||
for (propName in config) !hasOwnProperty.call(config, propName) || "key" === propName || "__self" === propName || "__source" === propName || "ref" === propName && void 0 === config.ref || (props[propName] = config[propName]);
|
|
||||||
}
|
|
||||||
var propName = arguments.length - 2;
|
|
||||||
if (1 === propName) props.children = children;
|
|
||||||
else if (1 < propName) {
|
|
||||||
JSCompiler_inline_result = Array(propName);
|
|
||||||
for (var i = 0; i < propName; i++) JSCompiler_inline_result[i] = arguments[i + 2];
|
|
||||||
props.children = JSCompiler_inline_result;
|
|
||||||
}
|
|
||||||
props = ReactElement(element.type, key, props, owner, element._debugStack, element._debugTask);
|
|
||||||
for (key = 2; key < arguments.length; key++) validateChildKeys(arguments[key]);
|
|
||||||
return props;
|
|
||||||
};
|
|
||||||
exports.createContext = function(defaultValue) {
|
|
||||||
defaultValue = {
|
|
||||||
$$typeof: REACT_CONTEXT_TYPE,
|
|
||||||
_currentValue: defaultValue,
|
|
||||||
_currentValue2: defaultValue,
|
|
||||||
_threadCount: 0,
|
|
||||||
Provider: null,
|
|
||||||
Consumer: null
|
|
||||||
};
|
|
||||||
defaultValue.Provider = defaultValue;
|
|
||||||
defaultValue.Consumer = {
|
|
||||||
$$typeof: REACT_CONSUMER_TYPE,
|
|
||||||
_context: defaultValue
|
|
||||||
};
|
|
||||||
defaultValue._currentRenderer = null;
|
|
||||||
defaultValue._currentRenderer2 = null;
|
|
||||||
return defaultValue;
|
|
||||||
};
|
|
||||||
exports.createElement = function(type, config, children) {
|
|
||||||
for (var i = 2; i < arguments.length; i++) validateChildKeys(arguments[i]);
|
|
||||||
i = {};
|
|
||||||
var key = null;
|
|
||||||
if (null != config) for (propName in didWarnAboutOldJSXRuntime || !("__self" in config) || "key" in config || (didWarnAboutOldJSXRuntime = !0, console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")), hasValidKey(config) && (checkKeyStringCoercion(config.key), key = "" + config.key), config) hasOwnProperty.call(config, propName) && "key" !== propName && "__self" !== propName && "__source" !== propName && (i[propName] = config[propName]);
|
|
||||||
var childrenLength = arguments.length - 2;
|
|
||||||
if (1 === childrenLength) i.children = children;
|
|
||||||
else if (1 < childrenLength) {
|
|
||||||
for (var childArray = Array(childrenLength), _i = 0; _i < childrenLength; _i++) childArray[_i] = arguments[_i + 2];
|
|
||||||
Object.freeze && Object.freeze(childArray);
|
|
||||||
i.children = childArray;
|
|
||||||
}
|
|
||||||
if (type && type.defaultProps) for (propName in childrenLength = type.defaultProps, childrenLength) void 0 === i[propName] && (i[propName] = childrenLength[propName]);
|
|
||||||
key && defineKeyPropWarningGetter(i, "function" === typeof type ? type.displayName || type.name || "Unknown" : type);
|
|
||||||
var propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
||||||
return ReactElement(type, key, i, getOwner(), propName ? Error("react-stack-top-frame") : unknownOwnerDebugStack, propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
|
|
||||||
};
|
|
||||||
exports.createRef = function() {
|
|
||||||
var refObject = { current: null };
|
|
||||||
Object.seal(refObject);
|
|
||||||
return refObject;
|
|
||||||
};
|
|
||||||
exports.forwardRef = function(render) {
|
|
||||||
null != render && render.$$typeof === REACT_MEMO_TYPE ? console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...)).") : "function" !== typeof render ? console.error("forwardRef requires a render function but was given %s.", null === render ? "null" : typeof render) : 0 !== render.length && 2 !== render.length && console.error("forwardRef render functions accept exactly two parameters: props and ref. %s", 1 === render.length ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined.");
|
|
||||||
null != render && null != render.defaultProps && console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");
|
|
||||||
var elementType = {
|
|
||||||
$$typeof: REACT_FORWARD_REF_TYPE,
|
|
||||||
render
|
|
||||||
}, ownName;
|
|
||||||
Object.defineProperty(elementType, "displayName", {
|
|
||||||
enumerable: !1,
|
|
||||||
configurable: !0,
|
|
||||||
get: function() {
|
|
||||||
return ownName;
|
|
||||||
},
|
|
||||||
set: function(name) {
|
|
||||||
ownName = name;
|
|
||||||
render.name || render.displayName || (Object.defineProperty(render, "name", { value: name }), render.displayName = name);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return elementType;
|
|
||||||
};
|
|
||||||
exports.isValidElement = isValidElement;
|
|
||||||
exports.lazy = function(ctor) {
|
|
||||||
ctor = {
|
|
||||||
_status: -1,
|
|
||||||
_result: ctor
|
|
||||||
};
|
|
||||||
var lazyType = {
|
|
||||||
$$typeof: REACT_LAZY_TYPE,
|
|
||||||
_payload: ctor,
|
|
||||||
_init: lazyInitializer
|
|
||||||
}, ioInfo = {
|
|
||||||
name: "lazy",
|
|
||||||
start: -1,
|
|
||||||
end: -1,
|
|
||||||
value: null,
|
|
||||||
owner: null,
|
|
||||||
debugStack: Error("react-stack-top-frame"),
|
|
||||||
debugTask: console.createTask ? console.createTask("lazy()") : null
|
|
||||||
};
|
|
||||||
ctor._ioInfo = ioInfo;
|
|
||||||
lazyType._debugInfo = [{ awaited: ioInfo }];
|
|
||||||
return lazyType;
|
|
||||||
};
|
|
||||||
exports.memo = function(type, compare) {
|
|
||||||
type ?? console.error("memo: The first argument must be a component. Instead received: %s", null === type ? "null" : typeof type);
|
|
||||||
compare = {
|
|
||||||
$$typeof: REACT_MEMO_TYPE,
|
|
||||||
type,
|
|
||||||
compare: void 0 === compare ? null : compare
|
|
||||||
};
|
|
||||||
var ownName;
|
|
||||||
Object.defineProperty(compare, "displayName", {
|
|
||||||
enumerable: !1,
|
|
||||||
configurable: !0,
|
|
||||||
get: function() {
|
|
||||||
return ownName;
|
|
||||||
},
|
|
||||||
set: function(name) {
|
|
||||||
ownName = name;
|
|
||||||
type.name || type.displayName || (Object.defineProperty(type, "name", { value: name }), type.displayName = name);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return compare;
|
|
||||||
};
|
|
||||||
exports.startTransition = function(scope) {
|
|
||||||
var prevTransition = ReactSharedInternals.T, currentTransition = {};
|
|
||||||
currentTransition._updatedFibers = /* @__PURE__ */ new Set();
|
|
||||||
ReactSharedInternals.T = currentTransition;
|
|
||||||
try {
|
|
||||||
var returnValue = scope(), onStartTransitionFinish = ReactSharedInternals.S;
|
|
||||||
null !== onStartTransitionFinish && onStartTransitionFinish(currentTransition, returnValue);
|
|
||||||
"object" === typeof returnValue && null !== returnValue && "function" === typeof returnValue.then && (ReactSharedInternals.asyncTransitions++, returnValue.then(releaseAsyncTransition, releaseAsyncTransition), returnValue.then(noop, reportGlobalError));
|
|
||||||
} catch (error) {
|
|
||||||
reportGlobalError(error);
|
|
||||||
} finally {
|
|
||||||
null === prevTransition && currentTransition._updatedFibers && (scope = currentTransition._updatedFibers.size, currentTransition._updatedFibers.clear(), 10 < scope && console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")), null !== prevTransition && null !== currentTransition.types && (null !== prevTransition.types && prevTransition.types !== currentTransition.types && console.error("We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."), prevTransition.types = currentTransition.types), ReactSharedInternals.T = prevTransition;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
exports.unstable_useCacheRefresh = function() {
|
|
||||||
return resolveDispatcher().useCacheRefresh();
|
|
||||||
};
|
|
||||||
exports.use = function(usable) {
|
|
||||||
return resolveDispatcher().use(usable);
|
|
||||||
};
|
|
||||||
exports.useActionState = function(action, initialState, permalink) {
|
|
||||||
return resolveDispatcher().useActionState(action, initialState, permalink);
|
|
||||||
};
|
|
||||||
exports.useCallback = function(callback, deps) {
|
|
||||||
return resolveDispatcher().useCallback(callback, deps);
|
|
||||||
};
|
|
||||||
exports.useContext = function(Context) {
|
|
||||||
var dispatcher = resolveDispatcher();
|
|
||||||
Context.$$typeof === REACT_CONSUMER_TYPE && console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?");
|
|
||||||
return dispatcher.useContext(Context);
|
|
||||||
};
|
|
||||||
exports.useDebugValue = function(value, formatterFn) {
|
|
||||||
return resolveDispatcher().useDebugValue(value, formatterFn);
|
|
||||||
};
|
|
||||||
exports.useDeferredValue = function(value, initialValue) {
|
|
||||||
return resolveDispatcher().useDeferredValue(value, initialValue);
|
|
||||||
};
|
|
||||||
exports.useEffect = function(create, deps) {
|
|
||||||
create ?? console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?");
|
|
||||||
return resolveDispatcher().useEffect(create, deps);
|
|
||||||
};
|
|
||||||
exports.useEffectEvent = function(callback) {
|
|
||||||
return resolveDispatcher().useEffectEvent(callback);
|
|
||||||
};
|
|
||||||
exports.useId = function() {
|
|
||||||
return resolveDispatcher().useId();
|
|
||||||
};
|
|
||||||
exports.useImperativeHandle = function(ref, create, deps) {
|
|
||||||
return resolveDispatcher().useImperativeHandle(ref, create, deps);
|
|
||||||
};
|
|
||||||
exports.useInsertionEffect = function(create, deps) {
|
|
||||||
create ?? console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?");
|
|
||||||
return resolveDispatcher().useInsertionEffect(create, deps);
|
|
||||||
};
|
|
||||||
exports.useLayoutEffect = function(create, deps) {
|
|
||||||
create ?? console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?");
|
|
||||||
return resolveDispatcher().useLayoutEffect(create, deps);
|
|
||||||
};
|
|
||||||
exports.useMemo = function(create, deps) {
|
|
||||||
return resolveDispatcher().useMemo(create, deps);
|
|
||||||
};
|
|
||||||
exports.useOptimistic = function(passthrough, reducer) {
|
|
||||||
return resolveDispatcher().useOptimistic(passthrough, reducer);
|
|
||||||
};
|
|
||||||
exports.useReducer = function(reducer, initialArg, init) {
|
|
||||||
return resolveDispatcher().useReducer(reducer, initialArg, init);
|
|
||||||
};
|
|
||||||
exports.useRef = function(initialValue) {
|
|
||||||
return resolveDispatcher().useRef(initialValue);
|
|
||||||
};
|
|
||||||
exports.useState = function(initialState) {
|
|
||||||
return resolveDispatcher().useState(initialState);
|
|
||||||
};
|
|
||||||
exports.useSyncExternalStore = function(subscribe, getSnapshot, getServerSnapshot) {
|
|
||||||
return resolveDispatcher().useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
||||||
};
|
|
||||||
exports.useTransition = function() {
|
|
||||||
return resolveDispatcher().useTransition();
|
|
||||||
};
|
|
||||||
exports.version = "19.2.7";
|
|
||||||
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
||||||
})();
|
|
||||||
}));
|
|
||||||
//#endregion
|
|
||||||
//#region node_modules/react/index.js
|
|
||||||
var require_react = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
||||||
module.exports = require_react_development();
|
|
||||||
}));
|
|
||||||
//#endregion
|
|
||||||
export { __commonJSMin as n, __toESM as r, require_react as t };
|
|
||||||
|
|
||||||
//# sourceMappingURL=react-Ea1HnpA1.js.map
|
|
||||||
-1
File diff suppressed because one or more lines are too long
-185
@@ -1,185 +0,0 @@
|
|||||||
import { n as __commonJSMin, t as require_react } from "./react-Ea1HnpA1.js";
|
|
||||||
//#region node_modules/react-dom/cjs/react-dom.development.js
|
|
||||||
/**
|
|
||||||
* @license React
|
|
||||||
* react-dom.development.js
|
|
||||||
*
|
|
||||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree.
|
|
||||||
*/
|
|
||||||
var require_react_dom_development = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
||||||
(function() {
|
|
||||||
function noop() {}
|
|
||||||
function testStringCoercion(value) {
|
|
||||||
return "" + value;
|
|
||||||
}
|
|
||||||
function createPortal$1(children, containerInfo, implementation) {
|
|
||||||
var key = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : null;
|
|
||||||
try {
|
|
||||||
testStringCoercion(key);
|
|
||||||
var JSCompiler_inline_result = !1;
|
|
||||||
} catch (e) {
|
|
||||||
JSCompiler_inline_result = !0;
|
|
||||||
}
|
|
||||||
JSCompiler_inline_result && (console.error("The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", "function" === typeof Symbol && Symbol.toStringTag && key[Symbol.toStringTag] || key.constructor.name || "Object"), testStringCoercion(key));
|
|
||||||
return {
|
|
||||||
$$typeof: REACT_PORTAL_TYPE,
|
|
||||||
key: null == key ? null : "" + key,
|
|
||||||
children,
|
|
||||||
containerInfo,
|
|
||||||
implementation
|
|
||||||
};
|
|
||||||
}
|
|
||||||
function getCrossOriginStringAs(as, input) {
|
|
||||||
if ("font" === as) return "";
|
|
||||||
if ("string" === typeof input) return "use-credentials" === input ? input : "";
|
|
||||||
}
|
|
||||||
function getValueDescriptorExpectingObjectForWarning(thing) {
|
|
||||||
return null === thing ? "`null`" : void 0 === thing ? "`undefined`" : "" === thing ? "an empty string" : "something with type \"" + typeof thing + "\"";
|
|
||||||
}
|
|
||||||
function getValueDescriptorExpectingEnumForWarning(thing) {
|
|
||||||
return null === thing ? "`null`" : void 0 === thing ? "`undefined`" : "" === thing ? "an empty string" : "string" === typeof thing ? JSON.stringify(thing) : "number" === typeof thing ? "`" + thing + "`" : "something with type \"" + typeof thing + "\"";
|
|
||||||
}
|
|
||||||
function resolveDispatcher() {
|
|
||||||
var dispatcher = ReactSharedInternals.H;
|
|
||||||
null === dispatcher && console.error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.");
|
|
||||||
return dispatcher;
|
|
||||||
}
|
|
||||||
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
||||||
var React = require_react(), Internals = {
|
|
||||||
d: {
|
|
||||||
f: noop,
|
|
||||||
r: function() {
|
|
||||||
throw Error("Invalid form element. requestFormReset must be passed a form that was rendered by React.");
|
|
||||||
},
|
|
||||||
D: noop,
|
|
||||||
C: noop,
|
|
||||||
L: noop,
|
|
||||||
m: noop,
|
|
||||||
X: noop,
|
|
||||||
S: noop,
|
|
||||||
M: noop
|
|
||||||
},
|
|
||||||
p: 0,
|
|
||||||
findDOMNode: null
|
|
||||||
}, REACT_PORTAL_TYPE = Symbol.for("react.portal"), ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
|
||||||
"function" === typeof Map && null != Map.prototype && "function" === typeof Map.prototype.forEach && "function" === typeof Set && null != Set.prototype && "function" === typeof Set.prototype.clear && "function" === typeof Set.prototype.forEach || console.error("React depends on Map and Set built-in types. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills");
|
|
||||||
exports.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = Internals;
|
|
||||||
exports.createPortal = function(children, container) {
|
|
||||||
var key = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null;
|
|
||||||
if (!container || 1 !== container.nodeType && 9 !== container.nodeType && 11 !== container.nodeType) throw Error("Target container is not a DOM element.");
|
|
||||||
return createPortal$1(children, container, null, key);
|
|
||||||
};
|
|
||||||
exports.flushSync = function(fn) {
|
|
||||||
var previousTransition = ReactSharedInternals.T, previousUpdatePriority = Internals.p;
|
|
||||||
try {
|
|
||||||
if (ReactSharedInternals.T = null, Internals.p = 2, fn) return fn();
|
|
||||||
} finally {
|
|
||||||
ReactSharedInternals.T = previousTransition, Internals.p = previousUpdatePriority, Internals.d.f() && console.error("flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task.");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
exports.preconnect = function(href, options) {
|
|
||||||
"string" === typeof href && href ? null != options && "object" !== typeof options ? console.error("ReactDOM.preconnect(): Expected the `options` argument (second) to be an object but encountered %s instead. The only supported option at this time is `crossOrigin` which accepts a string.", getValueDescriptorExpectingEnumForWarning(options)) : null != options && "string" !== typeof options.crossOrigin && console.error("ReactDOM.preconnect(): Expected the `crossOrigin` option (second argument) to be a string but encountered %s instead. Try removing this option or passing a string value instead.", getValueDescriptorExpectingObjectForWarning(options.crossOrigin)) : console.error("ReactDOM.preconnect(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.", getValueDescriptorExpectingObjectForWarning(href));
|
|
||||||
"string" === typeof href && (options ? (options = options.crossOrigin, options = "string" === typeof options ? "use-credentials" === options ? options : "" : void 0) : options = null, Internals.d.C(href, options));
|
|
||||||
};
|
|
||||||
exports.prefetchDNS = function(href) {
|
|
||||||
if ("string" !== typeof href || !href) console.error("ReactDOM.prefetchDNS(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.", getValueDescriptorExpectingObjectForWarning(href));
|
|
||||||
else if (1 < arguments.length) {
|
|
||||||
var options = arguments[1];
|
|
||||||
"object" === typeof options && options.hasOwnProperty("crossOrigin") ? console.error("ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. It looks like the you are attempting to set a crossOrigin property for this DNS lookup hint. Browsers do not perform DNS queries using CORS and setting this attribute on the resource hint has no effect. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.", getValueDescriptorExpectingEnumForWarning(options)) : console.error("ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.", getValueDescriptorExpectingEnumForWarning(options));
|
|
||||||
}
|
|
||||||
"string" === typeof href && Internals.d.D(href);
|
|
||||||
};
|
|
||||||
exports.preinit = function(href, options) {
|
|
||||||
"string" === typeof href && href ? null == options || "object" !== typeof options ? console.error("ReactDOM.preinit(): Expected the `options` argument (second) to be an object with an `as` property describing the type of resource to be preinitialized but encountered %s instead.", getValueDescriptorExpectingEnumForWarning(options)) : "style" !== options.as && "script" !== options.as && console.error("ReactDOM.preinit(): Expected the `as` property in the `options` argument (second) to contain a valid value describing the type of resource to be preinitialized but encountered %s instead. Valid values for `as` are \"style\" and \"script\".", getValueDescriptorExpectingEnumForWarning(options.as)) : console.error("ReactDOM.preinit(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.", getValueDescriptorExpectingObjectForWarning(href));
|
|
||||||
if ("string" === typeof href && options && "string" === typeof options.as) {
|
|
||||||
var as = options.as, crossOrigin = getCrossOriginStringAs(as, options.crossOrigin), integrity = "string" === typeof options.integrity ? options.integrity : void 0, fetchPriority = "string" === typeof options.fetchPriority ? options.fetchPriority : void 0;
|
|
||||||
"style" === as ? Internals.d.S(href, "string" === typeof options.precedence ? options.precedence : void 0, {
|
|
||||||
crossOrigin,
|
|
||||||
integrity,
|
|
||||||
fetchPriority
|
|
||||||
}) : "script" === as && Internals.d.X(href, {
|
|
||||||
crossOrigin,
|
|
||||||
integrity,
|
|
||||||
fetchPriority,
|
|
||||||
nonce: "string" === typeof options.nonce ? options.nonce : void 0
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
exports.preinitModule = function(href, options) {
|
|
||||||
var encountered = "";
|
|
||||||
"string" === typeof href && href || (encountered += " The `href` argument encountered was " + getValueDescriptorExpectingObjectForWarning(href) + ".");
|
|
||||||
void 0 !== options && "object" !== typeof options ? encountered += " The `options` argument encountered was " + getValueDescriptorExpectingObjectForWarning(options) + "." : options && "as" in options && "script" !== options.as && (encountered += " The `as` option encountered was " + getValueDescriptorExpectingEnumForWarning(options.as) + ".");
|
|
||||||
if (encountered) console.error("ReactDOM.preinitModule(): Expected up to two arguments, a non-empty `href` string and, optionally, an `options` object with a valid `as` property.%s", encountered);
|
|
||||||
else switch (encountered = options && "string" === typeof options.as ? options.as : "script", encountered) {
|
|
||||||
case "script": break;
|
|
||||||
default: encountered = getValueDescriptorExpectingEnumForWarning(encountered), console.error("ReactDOM.preinitModule(): Currently the only supported \"as\" type for this function is \"script\" but received \"%s\" instead. This warning was generated for `href` \"%s\". In the future other module types will be supported, aligning with the import-attributes proposal. Learn more here: (https://github.com/tc39/proposal-import-attributes)", encountered, href);
|
|
||||||
}
|
|
||||||
if ("string" === typeof href) if ("object" === typeof options && null !== options) {
|
|
||||||
if (null == options.as || "script" === options.as) encountered = getCrossOriginStringAs(options.as, options.crossOrigin), Internals.d.M(href, {
|
|
||||||
crossOrigin: encountered,
|
|
||||||
integrity: "string" === typeof options.integrity ? options.integrity : void 0,
|
|
||||||
nonce: "string" === typeof options.nonce ? options.nonce : void 0
|
|
||||||
});
|
|
||||||
} else options ?? Internals.d.M(href);
|
|
||||||
};
|
|
||||||
exports.preload = function(href, options) {
|
|
||||||
var encountered = "";
|
|
||||||
"string" === typeof href && href || (encountered += " The `href` argument encountered was " + getValueDescriptorExpectingObjectForWarning(href) + ".");
|
|
||||||
null == options || "object" !== typeof options ? encountered += " The `options` argument encountered was " + getValueDescriptorExpectingObjectForWarning(options) + "." : "string" === typeof options.as && options.as || (encountered += " The `as` option encountered was " + getValueDescriptorExpectingObjectForWarning(options.as) + ".");
|
|
||||||
encountered && console.error("ReactDOM.preload(): Expected two arguments, a non-empty `href` string and an `options` object with an `as` property valid for a `<link rel=\"preload\" as=\"...\" />` tag.%s", encountered);
|
|
||||||
if ("string" === typeof href && "object" === typeof options && null !== options && "string" === typeof options.as) {
|
|
||||||
encountered = options.as;
|
|
||||||
var crossOrigin = getCrossOriginStringAs(encountered, options.crossOrigin);
|
|
||||||
Internals.d.L(href, encountered, {
|
|
||||||
crossOrigin,
|
|
||||||
integrity: "string" === typeof options.integrity ? options.integrity : void 0,
|
|
||||||
nonce: "string" === typeof options.nonce ? options.nonce : void 0,
|
|
||||||
type: "string" === typeof options.type ? options.type : void 0,
|
|
||||||
fetchPriority: "string" === typeof options.fetchPriority ? options.fetchPriority : void 0,
|
|
||||||
referrerPolicy: "string" === typeof options.referrerPolicy ? options.referrerPolicy : void 0,
|
|
||||||
imageSrcSet: "string" === typeof options.imageSrcSet ? options.imageSrcSet : void 0,
|
|
||||||
imageSizes: "string" === typeof options.imageSizes ? options.imageSizes : void 0,
|
|
||||||
media: "string" === typeof options.media ? options.media : void 0
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
exports.preloadModule = function(href, options) {
|
|
||||||
var encountered = "";
|
|
||||||
"string" === typeof href && href || (encountered += " The `href` argument encountered was " + getValueDescriptorExpectingObjectForWarning(href) + ".");
|
|
||||||
void 0 !== options && "object" !== typeof options ? encountered += " The `options` argument encountered was " + getValueDescriptorExpectingObjectForWarning(options) + "." : options && "as" in options && "string" !== typeof options.as && (encountered += " The `as` option encountered was " + getValueDescriptorExpectingObjectForWarning(options.as) + ".");
|
|
||||||
encountered && console.error("ReactDOM.preloadModule(): Expected two arguments, a non-empty `href` string and, optionally, an `options` object with an `as` property valid for a `<link rel=\"modulepreload\" as=\"...\" />` tag.%s", encountered);
|
|
||||||
"string" === typeof href && (options ? (encountered = getCrossOriginStringAs(options.as, options.crossOrigin), Internals.d.m(href, {
|
|
||||||
as: "string" === typeof options.as && "script" !== options.as ? options.as : void 0,
|
|
||||||
crossOrigin: encountered,
|
|
||||||
integrity: "string" === typeof options.integrity ? options.integrity : void 0
|
|
||||||
})) : Internals.d.m(href));
|
|
||||||
};
|
|
||||||
exports.requestFormReset = function(form) {
|
|
||||||
Internals.d.r(form);
|
|
||||||
};
|
|
||||||
exports.unstable_batchedUpdates = function(fn, a) {
|
|
||||||
return fn(a);
|
|
||||||
};
|
|
||||||
exports.useFormState = function(action, initialState, permalink) {
|
|
||||||
return resolveDispatcher().useFormState(action, initialState, permalink);
|
|
||||||
};
|
|
||||||
exports.useFormStatus = function() {
|
|
||||||
return resolveDispatcher().useHostTransitionStatus();
|
|
||||||
};
|
|
||||||
exports.version = "19.2.7";
|
|
||||||
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
||||||
})();
|
|
||||||
}));
|
|
||||||
//#endregion
|
|
||||||
//#region node_modules/react-dom/index.js
|
|
||||||
var require_react_dom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
||||||
module.exports = require_react_dom_development();
|
|
||||||
}));
|
|
||||||
//#endregion
|
|
||||||
export default require_react_dom();
|
|
||||||
export { require_react_dom as t };
|
|
||||||
|
|
||||||
//# sourceMappingURL=react-dom.js.map
|
|
||||||
-1
File diff suppressed because one or more lines are too long
-14384
File diff suppressed because it is too large
Load Diff
-1
File diff suppressed because one or more lines are too long
-10177
File diff suppressed because it is too large
Load Diff
-1
File diff suppressed because one or more lines are too long
-2
@@ -1,2 +0,0 @@
|
|||||||
import { t as require_react } from "./react-Ea1HnpA1.js";
|
|
||||||
export default require_react();
|
|
||||||
-204
@@ -1,204 +0,0 @@
|
|||||||
import { n as __commonJSMin, t as require_react } from "./react-Ea1HnpA1.js";
|
|
||||||
//#region node_modules/react/cjs/react-jsx-dev-runtime.development.js
|
|
||||||
/**
|
|
||||||
* @license React
|
|
||||||
* react-jsx-dev-runtime.development.js
|
|
||||||
*
|
|
||||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree.
|
|
||||||
*/
|
|
||||||
var require_react_jsx_dev_runtime_development = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
||||||
(function() {
|
|
||||||
function getComponentNameFromType(type) {
|
|
||||||
if (null == type) return null;
|
|
||||||
if ("function" === typeof type) return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
|
|
||||||
if ("string" === typeof type) return type;
|
|
||||||
switch (type) {
|
|
||||||
case REACT_FRAGMENT_TYPE: return "Fragment";
|
|
||||||
case REACT_PROFILER_TYPE: return "Profiler";
|
|
||||||
case REACT_STRICT_MODE_TYPE: return "StrictMode";
|
|
||||||
case REACT_SUSPENSE_TYPE: return "Suspense";
|
|
||||||
case REACT_SUSPENSE_LIST_TYPE: return "SuspenseList";
|
|
||||||
case REACT_ACTIVITY_TYPE: return "Activity";
|
|
||||||
}
|
|
||||||
if ("object" === typeof type) switch ("number" === typeof type.tag && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), type.$$typeof) {
|
|
||||||
case REACT_PORTAL_TYPE: return "Portal";
|
|
||||||
case REACT_CONTEXT_TYPE: return type.displayName || "Context";
|
|
||||||
case REACT_CONSUMER_TYPE: return (type._context.displayName || "Context") + ".Consumer";
|
|
||||||
case REACT_FORWARD_REF_TYPE:
|
|
||||||
var innerType = type.render;
|
|
||||||
type = type.displayName;
|
|
||||||
type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef");
|
|
||||||
return type;
|
|
||||||
case REACT_MEMO_TYPE: return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo";
|
|
||||||
case REACT_LAZY_TYPE:
|
|
||||||
innerType = type._payload;
|
|
||||||
type = type._init;
|
|
||||||
try {
|
|
||||||
return getComponentNameFromType(type(innerType));
|
|
||||||
} catch (x) {}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
function testStringCoercion(value) {
|
|
||||||
return "" + value;
|
|
||||||
}
|
|
||||||
function checkKeyStringCoercion(value) {
|
|
||||||
try {
|
|
||||||
testStringCoercion(value);
|
|
||||||
var JSCompiler_inline_result = !1;
|
|
||||||
} catch (e) {
|
|
||||||
JSCompiler_inline_result = !0;
|
|
||||||
}
|
|
||||||
if (JSCompiler_inline_result) {
|
|
||||||
JSCompiler_inline_result = console;
|
|
||||||
var JSCompiler_temp_const = JSCompiler_inline_result.error;
|
|
||||||
var JSCompiler_inline_result$jscomp$0 = "function" === typeof Symbol && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
||||||
JSCompiler_temp_const.call(JSCompiler_inline_result, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", JSCompiler_inline_result$jscomp$0);
|
|
||||||
return testStringCoercion(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function getTaskName(type) {
|
|
||||||
if (type === REACT_FRAGMENT_TYPE) return "<>";
|
|
||||||
if ("object" === typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE) return "<...>";
|
|
||||||
try {
|
|
||||||
var name = getComponentNameFromType(type);
|
|
||||||
return name ? "<" + name + ">" : "<...>";
|
|
||||||
} catch (x) {
|
|
||||||
return "<...>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function getOwner() {
|
|
||||||
var dispatcher = ReactSharedInternals.A;
|
|
||||||
return null === dispatcher ? null : dispatcher.getOwner();
|
|
||||||
}
|
|
||||||
function UnknownOwner() {
|
|
||||||
return Error("react-stack-top-frame");
|
|
||||||
}
|
|
||||||
function hasValidKey(config) {
|
|
||||||
if (hasOwnProperty.call(config, "key")) {
|
|
||||||
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
||||||
if (getter && getter.isReactWarning) return !1;
|
|
||||||
}
|
|
||||||
return void 0 !== config.key;
|
|
||||||
}
|
|
||||||
function defineKeyPropWarningGetter(props, displayName) {
|
|
||||||
function warnAboutAccessingKey() {
|
|
||||||
specialPropKeyWarningShown || (specialPropKeyWarningShown = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", displayName));
|
|
||||||
}
|
|
||||||
warnAboutAccessingKey.isReactWarning = !0;
|
|
||||||
Object.defineProperty(props, "key", {
|
|
||||||
get: warnAboutAccessingKey,
|
|
||||||
configurable: !0
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function elementRefGetterWithDeprecationWarning() {
|
|
||||||
var componentName = getComponentNameFromType(this.type);
|
|
||||||
didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."));
|
|
||||||
componentName = this.props.ref;
|
|
||||||
return void 0 !== componentName ? componentName : null;
|
|
||||||
}
|
|
||||||
function ReactElement(type, key, props, owner, debugStack, debugTask) {
|
|
||||||
var refProp = props.ref;
|
|
||||||
type = {
|
|
||||||
$$typeof: REACT_ELEMENT_TYPE,
|
|
||||||
type,
|
|
||||||
key,
|
|
||||||
props,
|
|
||||||
_owner: owner
|
|
||||||
};
|
|
||||||
null !== (void 0 !== refProp ? refProp : null) ? Object.defineProperty(type, "ref", {
|
|
||||||
enumerable: !1,
|
|
||||||
get: elementRefGetterWithDeprecationWarning
|
|
||||||
}) : Object.defineProperty(type, "ref", {
|
|
||||||
enumerable: !1,
|
|
||||||
value: null
|
|
||||||
});
|
|
||||||
type._store = {};
|
|
||||||
Object.defineProperty(type._store, "validated", {
|
|
||||||
configurable: !1,
|
|
||||||
enumerable: !1,
|
|
||||||
writable: !0,
|
|
||||||
value: 0
|
|
||||||
});
|
|
||||||
Object.defineProperty(type, "_debugInfo", {
|
|
||||||
configurable: !1,
|
|
||||||
enumerable: !1,
|
|
||||||
writable: !0,
|
|
||||||
value: null
|
|
||||||
});
|
|
||||||
Object.defineProperty(type, "_debugStack", {
|
|
||||||
configurable: !1,
|
|
||||||
enumerable: !1,
|
|
||||||
writable: !0,
|
|
||||||
value: debugStack
|
|
||||||
});
|
|
||||||
Object.defineProperty(type, "_debugTask", {
|
|
||||||
configurable: !1,
|
|
||||||
enumerable: !1,
|
|
||||||
writable: !0,
|
|
||||||
value: debugTask
|
|
||||||
});
|
|
||||||
Object.freeze && (Object.freeze(type.props), Object.freeze(type));
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
function jsxDEVImpl(type, config, maybeKey, isStaticChildren, debugStack, debugTask) {
|
|
||||||
var children = config.children;
|
|
||||||
if (void 0 !== children) if (isStaticChildren) if (isArrayImpl(children)) {
|
|
||||||
for (isStaticChildren = 0; isStaticChildren < children.length; isStaticChildren++) validateChildKeys(children[isStaticChildren]);
|
|
||||||
Object.freeze && Object.freeze(children);
|
|
||||||
} else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
||||||
else validateChildKeys(children);
|
|
||||||
if (hasOwnProperty.call(config, "key")) {
|
|
||||||
children = getComponentNameFromType(type);
|
|
||||||
var keys = Object.keys(config).filter(function(k) {
|
|
||||||
return "key" !== k;
|
|
||||||
});
|
|
||||||
isStaticChildren = 0 < keys.length ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
||||||
didWarnAboutKeySpread[children + isStaticChildren] || (keys = 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", isStaticChildren, children, keys, children), didWarnAboutKeySpread[children + isStaticChildren] = !0);
|
|
||||||
}
|
|
||||||
children = null;
|
|
||||||
void 0 !== maybeKey && (checkKeyStringCoercion(maybeKey), children = "" + maybeKey);
|
|
||||||
hasValidKey(config) && (checkKeyStringCoercion(config.key), children = "" + config.key);
|
|
||||||
if ("key" in config) {
|
|
||||||
maybeKey = {};
|
|
||||||
for (var propName in config) "key" !== propName && (maybeKey[propName] = config[propName]);
|
|
||||||
} else maybeKey = config;
|
|
||||||
children && defineKeyPropWarningGetter(maybeKey, "function" === typeof type ? type.displayName || type.name || "Unknown" : type);
|
|
||||||
return ReactElement(type, children, maybeKey, getOwner(), debugStack, debugTask);
|
|
||||||
}
|
|
||||||
function validateChildKeys(node) {
|
|
||||||
isValidElement(node) ? node._store && (node._store.validated = 1) : "object" === typeof node && null !== node && node.$$typeof === REACT_LAZY_TYPE && ("fulfilled" === node._payload.status ? isValidElement(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1));
|
|
||||||
}
|
|
||||||
function isValidElement(object) {
|
|
||||||
return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
||||||
}
|
|
||||||
var React = require_react(), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
React = { react_stack_bottom_frame: function(callStackForError) {
|
|
||||||
return callStackForError();
|
|
||||||
} };
|
|
||||||
var specialPropKeyWarningShown;
|
|
||||||
var didWarnAboutElementRef = {};
|
|
||||||
var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(React, UnknownOwner)();
|
|
||||||
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
|
|
||||||
var didWarnAboutKeySpread = {};
|
|
||||||
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
||||||
exports.jsxDEV = function(type, config, maybeKey, isStaticChildren) {
|
|
||||||
var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
||||||
return jsxDEVImpl(type, config, maybeKey, isStaticChildren, trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack, trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
|
|
||||||
};
|
|
||||||
})();
|
|
||||||
}));
|
|
||||||
//#endregion
|
|
||||||
//#region node_modules/react/jsx-dev-runtime.js
|
|
||||||
var require_jsx_dev_runtime = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
||||||
module.exports = require_react_jsx_dev_runtime_development();
|
|
||||||
}));
|
|
||||||
//#endregion
|
|
||||||
export default require_jsx_dev_runtime();
|
|
||||||
|
|
||||||
//# sourceMappingURL=react_jsx-dev-runtime.js.map
|
|
||||||
-1
File diff suppressed because one or more lines are too long
-209
@@ -1,209 +0,0 @@
|
|||||||
import { n as __commonJSMin, t as require_react } from "./react-Ea1HnpA1.js";
|
|
||||||
//#region node_modules/react/cjs/react-jsx-runtime.development.js
|
|
||||||
/**
|
|
||||||
* @license React
|
|
||||||
* react-jsx-runtime.development.js
|
|
||||||
*
|
|
||||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree.
|
|
||||||
*/
|
|
||||||
var require_react_jsx_runtime_development = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
||||||
(function() {
|
|
||||||
function getComponentNameFromType(type) {
|
|
||||||
if (null == type) return null;
|
|
||||||
if ("function" === typeof type) return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
|
|
||||||
if ("string" === typeof type) return type;
|
|
||||||
switch (type) {
|
|
||||||
case REACT_FRAGMENT_TYPE: return "Fragment";
|
|
||||||
case REACT_PROFILER_TYPE: return "Profiler";
|
|
||||||
case REACT_STRICT_MODE_TYPE: return "StrictMode";
|
|
||||||
case REACT_SUSPENSE_TYPE: return "Suspense";
|
|
||||||
case REACT_SUSPENSE_LIST_TYPE: return "SuspenseList";
|
|
||||||
case REACT_ACTIVITY_TYPE: return "Activity";
|
|
||||||
}
|
|
||||||
if ("object" === typeof type) switch ("number" === typeof type.tag && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), type.$$typeof) {
|
|
||||||
case REACT_PORTAL_TYPE: return "Portal";
|
|
||||||
case REACT_CONTEXT_TYPE: return type.displayName || "Context";
|
|
||||||
case REACT_CONSUMER_TYPE: return (type._context.displayName || "Context") + ".Consumer";
|
|
||||||
case REACT_FORWARD_REF_TYPE:
|
|
||||||
var innerType = type.render;
|
|
||||||
type = type.displayName;
|
|
||||||
type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef");
|
|
||||||
return type;
|
|
||||||
case REACT_MEMO_TYPE: return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo";
|
|
||||||
case REACT_LAZY_TYPE:
|
|
||||||
innerType = type._payload;
|
|
||||||
type = type._init;
|
|
||||||
try {
|
|
||||||
return getComponentNameFromType(type(innerType));
|
|
||||||
} catch (x) {}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
function testStringCoercion(value) {
|
|
||||||
return "" + value;
|
|
||||||
}
|
|
||||||
function checkKeyStringCoercion(value) {
|
|
||||||
try {
|
|
||||||
testStringCoercion(value);
|
|
||||||
var JSCompiler_inline_result = !1;
|
|
||||||
} catch (e) {
|
|
||||||
JSCompiler_inline_result = !0;
|
|
||||||
}
|
|
||||||
if (JSCompiler_inline_result) {
|
|
||||||
JSCompiler_inline_result = console;
|
|
||||||
var JSCompiler_temp_const = JSCompiler_inline_result.error;
|
|
||||||
var JSCompiler_inline_result$jscomp$0 = "function" === typeof Symbol && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
||||||
JSCompiler_temp_const.call(JSCompiler_inline_result, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", JSCompiler_inline_result$jscomp$0);
|
|
||||||
return testStringCoercion(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function getTaskName(type) {
|
|
||||||
if (type === REACT_FRAGMENT_TYPE) return "<>";
|
|
||||||
if ("object" === typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE) return "<...>";
|
|
||||||
try {
|
|
||||||
var name = getComponentNameFromType(type);
|
|
||||||
return name ? "<" + name + ">" : "<...>";
|
|
||||||
} catch (x) {
|
|
||||||
return "<...>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function getOwner() {
|
|
||||||
var dispatcher = ReactSharedInternals.A;
|
|
||||||
return null === dispatcher ? null : dispatcher.getOwner();
|
|
||||||
}
|
|
||||||
function UnknownOwner() {
|
|
||||||
return Error("react-stack-top-frame");
|
|
||||||
}
|
|
||||||
function hasValidKey(config) {
|
|
||||||
if (hasOwnProperty.call(config, "key")) {
|
|
||||||
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
||||||
if (getter && getter.isReactWarning) return !1;
|
|
||||||
}
|
|
||||||
return void 0 !== config.key;
|
|
||||||
}
|
|
||||||
function defineKeyPropWarningGetter(props, displayName) {
|
|
||||||
function warnAboutAccessingKey() {
|
|
||||||
specialPropKeyWarningShown || (specialPropKeyWarningShown = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", displayName));
|
|
||||||
}
|
|
||||||
warnAboutAccessingKey.isReactWarning = !0;
|
|
||||||
Object.defineProperty(props, "key", {
|
|
||||||
get: warnAboutAccessingKey,
|
|
||||||
configurable: !0
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function elementRefGetterWithDeprecationWarning() {
|
|
||||||
var componentName = getComponentNameFromType(this.type);
|
|
||||||
didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."));
|
|
||||||
componentName = this.props.ref;
|
|
||||||
return void 0 !== componentName ? componentName : null;
|
|
||||||
}
|
|
||||||
function ReactElement(type, key, props, owner, debugStack, debugTask) {
|
|
||||||
var refProp = props.ref;
|
|
||||||
type = {
|
|
||||||
$$typeof: REACT_ELEMENT_TYPE,
|
|
||||||
type,
|
|
||||||
key,
|
|
||||||
props,
|
|
||||||
_owner: owner
|
|
||||||
};
|
|
||||||
null !== (void 0 !== refProp ? refProp : null) ? Object.defineProperty(type, "ref", {
|
|
||||||
enumerable: !1,
|
|
||||||
get: elementRefGetterWithDeprecationWarning
|
|
||||||
}) : Object.defineProperty(type, "ref", {
|
|
||||||
enumerable: !1,
|
|
||||||
value: null
|
|
||||||
});
|
|
||||||
type._store = {};
|
|
||||||
Object.defineProperty(type._store, "validated", {
|
|
||||||
configurable: !1,
|
|
||||||
enumerable: !1,
|
|
||||||
writable: !0,
|
|
||||||
value: 0
|
|
||||||
});
|
|
||||||
Object.defineProperty(type, "_debugInfo", {
|
|
||||||
configurable: !1,
|
|
||||||
enumerable: !1,
|
|
||||||
writable: !0,
|
|
||||||
value: null
|
|
||||||
});
|
|
||||||
Object.defineProperty(type, "_debugStack", {
|
|
||||||
configurable: !1,
|
|
||||||
enumerable: !1,
|
|
||||||
writable: !0,
|
|
||||||
value: debugStack
|
|
||||||
});
|
|
||||||
Object.defineProperty(type, "_debugTask", {
|
|
||||||
configurable: !1,
|
|
||||||
enumerable: !1,
|
|
||||||
writable: !0,
|
|
||||||
value: debugTask
|
|
||||||
});
|
|
||||||
Object.freeze && (Object.freeze(type.props), Object.freeze(type));
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
function jsxDEVImpl(type, config, maybeKey, isStaticChildren, debugStack, debugTask) {
|
|
||||||
var children = config.children;
|
|
||||||
if (void 0 !== children) if (isStaticChildren) if (isArrayImpl(children)) {
|
|
||||||
for (isStaticChildren = 0; isStaticChildren < children.length; isStaticChildren++) validateChildKeys(children[isStaticChildren]);
|
|
||||||
Object.freeze && Object.freeze(children);
|
|
||||||
} else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
||||||
else validateChildKeys(children);
|
|
||||||
if (hasOwnProperty.call(config, "key")) {
|
|
||||||
children = getComponentNameFromType(type);
|
|
||||||
var keys = Object.keys(config).filter(function(k) {
|
|
||||||
return "key" !== k;
|
|
||||||
});
|
|
||||||
isStaticChildren = 0 < keys.length ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
||||||
didWarnAboutKeySpread[children + isStaticChildren] || (keys = 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", isStaticChildren, children, keys, children), didWarnAboutKeySpread[children + isStaticChildren] = !0);
|
|
||||||
}
|
|
||||||
children = null;
|
|
||||||
void 0 !== maybeKey && (checkKeyStringCoercion(maybeKey), children = "" + maybeKey);
|
|
||||||
hasValidKey(config) && (checkKeyStringCoercion(config.key), children = "" + config.key);
|
|
||||||
if ("key" in config) {
|
|
||||||
maybeKey = {};
|
|
||||||
for (var propName in config) "key" !== propName && (maybeKey[propName] = config[propName]);
|
|
||||||
} else maybeKey = config;
|
|
||||||
children && defineKeyPropWarningGetter(maybeKey, "function" === typeof type ? type.displayName || type.name || "Unknown" : type);
|
|
||||||
return ReactElement(type, children, maybeKey, getOwner(), debugStack, debugTask);
|
|
||||||
}
|
|
||||||
function validateChildKeys(node) {
|
|
||||||
isValidElement(node) ? node._store && (node._store.validated = 1) : "object" === typeof node && null !== node && node.$$typeof === REACT_LAZY_TYPE && ("fulfilled" === node._payload.status ? isValidElement(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1));
|
|
||||||
}
|
|
||||||
function isValidElement(object) {
|
|
||||||
return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
||||||
}
|
|
||||||
var React = require_react(), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
React = { react_stack_bottom_frame: function(callStackForError) {
|
|
||||||
return callStackForError();
|
|
||||||
} };
|
|
||||||
var specialPropKeyWarningShown;
|
|
||||||
var didWarnAboutElementRef = {};
|
|
||||||
var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(React, UnknownOwner)();
|
|
||||||
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
|
|
||||||
var didWarnAboutKeySpread = {};
|
|
||||||
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
||||||
exports.jsx = function(type, config, maybeKey) {
|
|
||||||
var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
||||||
return jsxDEVImpl(type, config, maybeKey, !1, trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack, trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
|
|
||||||
};
|
|
||||||
exports.jsxs = function(type, config, maybeKey) {
|
|
||||||
var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
||||||
return jsxDEVImpl(type, config, maybeKey, !0, trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack, trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
|
|
||||||
};
|
|
||||||
})();
|
|
||||||
}));
|
|
||||||
//#endregion
|
|
||||||
//#region node_modules/react/jsx-runtime.js
|
|
||||||
var require_jsx_runtime = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
||||||
module.exports = require_react_jsx_runtime_development();
|
|
||||||
}));
|
|
||||||
//#endregion
|
|
||||||
export default require_jsx_runtime();
|
|
||||||
export { require_jsx_runtime as t };
|
|
||||||
|
|
||||||
//# sourceMappingURL=react_jsx-runtime.js.map
|
|
||||||
-1
File diff suppressed because one or more lines are too long
-49
@@ -1,49 +0,0 @@
|
|||||||
import { r as __toESM, t as require_react } from "./react-Ea1HnpA1.js";
|
|
||||||
//#region node_modules/zustand/esm/vanilla.mjs
|
|
||||||
var createStoreImpl = (createState) => {
|
|
||||||
let state;
|
|
||||||
const listeners = /* @__PURE__ */ new Set();
|
|
||||||
const setState = (partial, replace) => {
|
|
||||||
const nextState = typeof partial === "function" ? partial(state) : partial;
|
|
||||||
if (!Object.is(nextState, state)) {
|
|
||||||
const previousState = state;
|
|
||||||
state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
|
|
||||||
listeners.forEach((listener) => listener(state, previousState));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const getState = () => state;
|
|
||||||
const getInitialState = () => initialState;
|
|
||||||
const subscribe = (listener) => {
|
|
||||||
listeners.add(listener);
|
|
||||||
return () => listeners.delete(listener);
|
|
||||||
};
|
|
||||||
const api = {
|
|
||||||
setState,
|
|
||||||
getState,
|
|
||||||
getInitialState,
|
|
||||||
subscribe
|
|
||||||
};
|
|
||||||
const initialState = state = createState(setState, getState, api);
|
|
||||||
return api;
|
|
||||||
};
|
|
||||||
var createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
|
|
||||||
//#endregion
|
|
||||||
//#region node_modules/zustand/esm/react.mjs
|
|
||||||
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
||||||
var identity = (arg) => arg;
|
|
||||||
function useStore(api, selector = identity) {
|
|
||||||
const slice = import_react.useSyncExternalStore(api.subscribe, import_react.useCallback(() => selector(api.getState()), [api, selector]), import_react.useCallback(() => selector(api.getInitialState()), [api, selector]));
|
|
||||||
import_react.useDebugValue(slice);
|
|
||||||
return slice;
|
|
||||||
}
|
|
||||||
var createImpl = (createState) => {
|
|
||||||
const api = createStore(createState);
|
|
||||||
const useBoundStore = (selector) => useStore(api, selector);
|
|
||||||
Object.assign(useBoundStore, api);
|
|
||||||
return useBoundStore;
|
|
||||||
};
|
|
||||||
var create = ((createState) => createState ? createImpl(createState) : createImpl);
|
|
||||||
//#endregion
|
|
||||||
export { create, createStore, useStore };
|
|
||||||
|
|
||||||
//# sourceMappingURL=zustand.js.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"zustand.js","names":[],"sources":["../../zustand/esm/vanilla.mjs","../../zustand/esm/react.mjs"],"sourcesContent":["const createStoreImpl = (createState) => {\n let state;\n const listeners = /* @__PURE__ */ new Set();\n const setState = (partial, replace) => {\n const nextState = typeof partial === \"function\" ? partial(state) : partial;\n if (!Object.is(nextState, state)) {\n const previousState = state;\n state = (replace != null ? replace : typeof nextState !== \"object\" || nextState === null) ? nextState : Object.assign({}, state, nextState);\n listeners.forEach((listener) => listener(state, previousState));\n }\n };\n const getState = () => state;\n const getInitialState = () => initialState;\n const subscribe = (listener) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n const api = { setState, getState, getInitialState, subscribe };\n const initialState = state = createState(setState, getState, api);\n return api;\n};\nconst createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);\n\nexport { createStore };\n","import React from 'react';\nimport { createStore } from 'zustand/vanilla';\n\nconst identity = (arg) => arg;\nfunction useStore(api, selector = identity) {\n const slice = React.useSyncExternalStore(\n api.subscribe,\n React.useCallback(() => selector(api.getState()), [api, selector]),\n React.useCallback(() => selector(api.getInitialState()), [api, selector])\n );\n React.useDebugValue(slice);\n return slice;\n}\nconst createImpl = (createState) => {\n const api = createStore(createState);\n const useBoundStore = (selector) => useStore(api, selector);\n Object.assign(useBoundStore, api);\n return useBoundStore;\n};\nconst create = ((createState) => createState ? createImpl(createState) : createImpl);\n\nexport { create, useStore };\n"],"mappings":";;AAAA,IAAM,mBAAmB,gBAAgB;CACvC,IAAI;CACJ,MAAM,4BAA4B,IAAI,IAAI;CAC1C,MAAM,YAAY,SAAS,YAAY;EACrC,MAAM,YAAY,OAAO,YAAY,aAAa,QAAQ,KAAK,IAAI;EACnE,IAAI,CAAC,OAAO,GAAG,WAAW,KAAK,GAAG;GAChC,MAAM,gBAAgB;GACtB,SAAS,WAAW,OAAO,UAAU,OAAO,cAAc,YAAY,cAAc,QAAQ,YAAY,OAAO,OAAO,CAAC,GAAG,OAAO,SAAS;GAC1I,UAAU,SAAS,aAAa,SAAS,OAAO,aAAa,CAAC;EAChE;CACF;CACA,MAAM,iBAAiB;CACvB,MAAM,wBAAwB;CAC9B,MAAM,aAAa,aAAa;EAC9B,UAAU,IAAI,QAAQ;EACtB,aAAa,UAAU,OAAO,QAAQ;CACxC;CACA,MAAM,MAAM;EAAE;EAAU;EAAU;EAAiB;CAAU;CAC7D,MAAM,eAAe,QAAQ,YAAY,UAAU,UAAU,GAAG;CAChE,OAAO;AACT;AACA,IAAM,gBAAgB,gBAAgB,cAAc,gBAAgB,WAAW,IAAI;;;;AClBnF,IAAM,YAAY,QAAQ;AAC1B,SAAS,SAAS,KAAK,WAAW,UAAU;CAC1C,MAAM,QAAA,aAAc,qBAClB,IAAI,WAAA,aACE,kBAAkB,SAAS,IAAI,SAAS,CAAC,GAAG,CAAC,KAAK,QAAQ,CAAC,GAAA,aAC3D,kBAAkB,SAAS,IAAI,gBAAgB,CAAC,GAAG,CAAC,KAAK,QAAQ,CAAC,CAC1E;CACA,aAAM,cAAc,KAAK;CACzB,OAAO;AACT;AACA,IAAM,cAAc,gBAAgB;CAClC,MAAM,MAAM,YAAY,WAAW;CACnC,MAAM,iBAAiB,aAAa,SAAS,KAAK,QAAQ;CAC1D,OAAO,OAAO,eAAe,GAAG;CAChC,OAAO;AACT;AACA,IAAM,WAAW,gBAAgB,cAAc,WAAW,WAAW,IAAI"}
|
|
||||||
-22
@@ -1,22 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2024-present VoidZero Inc. & Contributors
|
|
||||||
Copyright (c) 2023 Boshen
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
# Oxc Types
|
|
||||||
|
|
||||||
Typescript definitions for Oxc AST nodes.
|
|
||||||
-26
@@ -1,26 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@oxc-project/types",
|
|
||||||
"version": "0.133.0",
|
|
||||||
"description": "Types for Oxc AST nodes",
|
|
||||||
"keywords": [
|
|
||||||
"AST",
|
|
||||||
"Parser"
|
|
||||||
],
|
|
||||||
"homepage": "https://oxc.rs",
|
|
||||||
"bugs": "https://github.com/oxc-project/oxc/issues",
|
|
||||||
"license": "MIT",
|
|
||||||
"author": "Boshen and oxc contributors",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/oxc-project/oxc.git",
|
|
||||||
"directory": "npm/oxc-types"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/Boshen"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"types.d.ts"
|
|
||||||
],
|
|
||||||
"type": "module",
|
|
||||||
"types": "types.d.ts"
|
|
||||||
}
|
|
||||||
-1912
File diff suppressed because it is too large
Load Diff
-3
@@ -1,3 +0,0 @@
|
|||||||
# `@rolldown/binding-linux-x64-gnu`
|
|
||||||
|
|
||||||
This is the **x86_64-unknown-linux-gnu** binary for `@rolldown/binding`
|
|
||||||
-40
@@ -1,40 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@rolldown/binding-linux-x64-gnu",
|
|
||||||
"version": "1.0.3",
|
|
||||||
"cpu": [
|
|
||||||
"x64"
|
|
||||||
],
|
|
||||||
"main": "rolldown-binding.linux-x64-gnu.node",
|
|
||||||
"files": [
|
|
||||||
"rolldown-binding.linux-x64-gnu.node"
|
|
||||||
],
|
|
||||||
"description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
|
|
||||||
"keywords": [
|
|
||||||
"bundler",
|
|
||||||
"esbuild",
|
|
||||||
"parcel",
|
|
||||||
"rolldown",
|
|
||||||
"rollup",
|
|
||||||
"webpack"
|
|
||||||
],
|
|
||||||
"homepage": "https://rolldown.rs/",
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": "^20.19.0 || >=22.12.0"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/rolldown/rolldown.git",
|
|
||||||
"directory": "packages/rolldown"
|
|
||||||
},
|
|
||||||
"publishConfig": {
|
|
||||||
"registry": "https://registry.npmjs.org/",
|
|
||||||
"access": "public"
|
|
||||||
},
|
|
||||||
"os": [
|
|
||||||
"linux"
|
|
||||||
],
|
|
||||||
"libc": [
|
|
||||||
"glibc"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
BIN
Binary file not shown.
-3
@@ -1,3 +0,0 @@
|
|||||||
# `@rolldown/binding-linux-x64-musl`
|
|
||||||
|
|
||||||
This is the **x86_64-unknown-linux-musl** binary for `@rolldown/binding`
|
|
||||||
-40
@@ -1,40 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@rolldown/binding-linux-x64-musl",
|
|
||||||
"version": "1.0.3",
|
|
||||||
"cpu": [
|
|
||||||
"x64"
|
|
||||||
],
|
|
||||||
"main": "rolldown-binding.linux-x64-musl.node",
|
|
||||||
"files": [
|
|
||||||
"rolldown-binding.linux-x64-musl.node"
|
|
||||||
],
|
|
||||||
"description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
|
|
||||||
"keywords": [
|
|
||||||
"bundler",
|
|
||||||
"esbuild",
|
|
||||||
"parcel",
|
|
||||||
"rolldown",
|
|
||||||
"rollup",
|
|
||||||
"webpack"
|
|
||||||
],
|
|
||||||
"homepage": "https://rolldown.rs/",
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": "^20.19.0 || >=22.12.0"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/rolldown/rolldown.git",
|
|
||||||
"directory": "packages/rolldown"
|
|
||||||
},
|
|
||||||
"publishConfig": {
|
|
||||||
"registry": "https://registry.npmjs.org/",
|
|
||||||
"access": "public"
|
|
||||||
},
|
|
||||||
"os": [
|
|
||||||
"linux"
|
|
||||||
],
|
|
||||||
"libc": [
|
|
||||||
"musl"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Generated
Vendored
BIN
Binary file not shown.
-3
@@ -1,3 +0,0 @@
|
|||||||
# `@rolldown/binding-win32-x64-msvc`
|
|
||||||
|
|
||||||
This is the **x86_64-pc-windows-msvc** binary for `@rolldown/binding`
|
|
||||||
-37
@@ -1,37 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@rolldown/binding-win32-x64-msvc",
|
|
||||||
"version": "1.0.3",
|
|
||||||
"cpu": [
|
|
||||||
"x64"
|
|
||||||
],
|
|
||||||
"main": "rolldown-binding.win32-x64-msvc.node",
|
|
||||||
"files": [
|
|
||||||
"rolldown-binding.win32-x64-msvc.node"
|
|
||||||
],
|
|
||||||
"description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
|
|
||||||
"keywords": [
|
|
||||||
"bundler",
|
|
||||||
"esbuild",
|
|
||||||
"parcel",
|
|
||||||
"rolldown",
|
|
||||||
"rollup",
|
|
||||||
"webpack"
|
|
||||||
],
|
|
||||||
"homepage": "https://rolldown.rs/",
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": "^20.19.0 || >=22.12.0"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/rolldown/rolldown.git",
|
|
||||||
"directory": "packages/rolldown"
|
|
||||||
},
|
|
||||||
"publishConfig": {
|
|
||||||
"registry": "https://registry.npmjs.org/",
|
|
||||||
"access": "public"
|
|
||||||
},
|
|
||||||
"os": [
|
|
||||||
"win32"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Generated
Vendored
BIN
Binary file not shown.
-21
@@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2026-present, rolldown/plugins repository contributors
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
-145
@@ -1,145 +0,0 @@
|
|||||||
# @rolldown/pluginutils [](https://npmx.dev/package/@rolldown/pluginutils)
|
|
||||||
|
|
||||||
Plugin utilities for [Rolldown](https://rolldown.rs).
|
|
||||||
|
|
||||||
Includes regex helpers for plugin hook filters, composable filter expressions, and a helper for filtering out Vite-serve-only plugins.
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pnpm add -D @rolldown/pluginutils
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import { exactRegex, prefixRegex, makeIdFiltersToMatchWithQuery } from '@rolldown/pluginutils'
|
|
||||||
```
|
|
||||||
|
|
||||||
All filter helpers are also exposed via the `/filter` subpath:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import { and, or, id, include } from '@rolldown/pluginutils/filter'
|
|
||||||
```
|
|
||||||
|
|
||||||
## Regex helpers
|
|
||||||
|
|
||||||
### `exactRegex`
|
|
||||||
|
|
||||||
- **Type:** `(str: string, flags?: string) => RegExp`
|
|
||||||
|
|
||||||
Constructs a `RegExp` that matches the exact string specified. Useful as a plugin hook filter.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import { exactRegex } from '@rolldown/pluginutils'
|
|
||||||
|
|
||||||
const plugin = {
|
|
||||||
name: 'plugin',
|
|
||||||
resolveId: {
|
|
||||||
filter: { id: exactRegex('foo') },
|
|
||||||
handler(id) {}, // only called for `foo`
|
|
||||||
},
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### `prefixRegex`
|
|
||||||
|
|
||||||
- **Type:** `(str: string, flags?: string) => RegExp`
|
|
||||||
|
|
||||||
Constructs a `RegExp` that matches values starting with the specified prefix.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import { prefixRegex } from '@rolldown/pluginutils'
|
|
||||||
|
|
||||||
const plugin = {
|
|
||||||
name: 'plugin',
|
|
||||||
resolveId: {
|
|
||||||
filter: { id: prefixRegex('foo') },
|
|
||||||
handler(id) {}, // called for IDs starting with `foo`
|
|
||||||
},
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### `makeIdFiltersToMatchWithQuery`
|
|
||||||
|
|
||||||
- **Type:** `(input: string | RegExp | (string | RegExp)[]) => string | RegExp | (string | RegExp)[]`
|
|
||||||
|
|
||||||
Converts an id filter so that it also matches ids that include a query string.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import { makeIdFiltersToMatchWithQuery } from '@rolldown/pluginutils'
|
|
||||||
|
|
||||||
const plugin = {
|
|
||||||
name: 'plugin',
|
|
||||||
transform: {
|
|
||||||
filter: { id: makeIdFiltersToMatchWithQuery(['**/*.js', /\.ts$/]) },
|
|
||||||
// Matches:
|
|
||||||
// foo.js, foo.js?foo, foo.txt?foo.js,
|
|
||||||
// foo.ts, foo.ts?foo, foo.txt?foo.ts
|
|
||||||
handler(code, id) {},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Composable filters
|
|
||||||
|
|
||||||
[Composable filter expressions](https://rolldown.rs/apis/plugin-api/hook-filters#composable-filters) for use cases where a simple `id`/`include`/`exclude` is not enough. For example, when a plugin needs to combine `id`, `moduleType`, `code`, and `query` conditions.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import { and, code, id, include, interpreter, moduleType, or } from '@rolldown/pluginutils'
|
|
||||||
|
|
||||||
const expr = include(and(or(id(/\.tsx?$/), id(/\.jsx?$/)), moduleType('tsx'), code(/import React/)))
|
|
||||||
|
|
||||||
interpreter(expr, sourceCode, sourceId, 'tsx') // boolean
|
|
||||||
```
|
|
||||||
|
|
||||||
### Builders
|
|
||||||
|
|
||||||
| Builder | Description |
|
|
||||||
| ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
||||||
| `and(...exprs)` | All operands must match. |
|
|
||||||
| `or(...exprs)` | At least one operand must match. |
|
|
||||||
| `not(expr)` | Negates the operand. |
|
|
||||||
| `id(pattern, params?)` | Match the module id. `pattern` is `string` or `RegExp`. `params.cleanUrl` strips the query/hash before matching. |
|
|
||||||
| `importerId(pattern, params?)` | Match the importer's id. Same shape as `id`. |
|
|
||||||
| `moduleType(type)` | Match Rolldown's module type (`'js'`, `'jsx'`, `'ts'`, `'tsx'`, `'json'`, `'text'`, `'base64'`, `'dataurl'`, `'binary'`, `'empty'`, or a custom string). |
|
|
||||||
| `code(pattern)` | Match the module source. `string` matches with `includes`; `RegExp` with `test`. |
|
|
||||||
| `query(key, pattern)` | Match a single query parameter. `pattern` is `boolean` (key presence/truthiness), `string` (exact value), or `RegExp` (value pattern). |
|
|
||||||
| `queries(obj)` | Shorthand for `and(...)` over multiple `query` entries. |
|
|
||||||
| `include(expr)` | Top-level wrapper marking `expr` as an inclusion rule. |
|
|
||||||
| `exclude(expr)` | Top-level wrapper marking `expr` as an exclusion rule. |
|
|
||||||
|
|
||||||
### `interpreter`
|
|
||||||
|
|
||||||
- **Type:** `(exprs, code?, id?, moduleType?, importerId?) => boolean`
|
|
||||||
|
|
||||||
Evaluates one or more top-level expressions against the given inputs. Returns `true` when at least one `include` matches and no `exclude` matches; when no `include` is present, defaults to `true` unless an `exclude` matches.
|
|
||||||
|
|
||||||
The argument required by each expression must be provided. For example, evaluating an `id(...)` expression without passing `id` will throw.
|
|
||||||
|
|
||||||
## `filterVitePlugins`
|
|
||||||
|
|
||||||
- **Type:** `<T>(plugins: T | T[] | null | undefined | false) => T[]`
|
|
||||||
|
|
||||||
Removes Vite plugins that target the dev server (`apply: 'serve'`) from a (possibly nested) plugin array. Plugins whose `apply` is a function are invoked with a `command: 'build'` context to decide. Useful when reusing a Vite plugin array inside a Rolldown config.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import { defineConfig } from 'rolldown'
|
|
||||||
import { filterVitePlugins } from '@rolldown/pluginutils'
|
|
||||||
import viteReact from '@vitejs/plugin-react'
|
|
||||||
|
|
||||||
export default defineConfig({
|
|
||||||
plugins: filterVitePlugins([
|
|
||||||
viteReact(),
|
|
||||||
{
|
|
||||||
name: 'dev-only',
|
|
||||||
apply: 'serve', // filtered out
|
|
||||||
// ...
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
MIT
|
|
||||||
-323
@@ -1,323 +0,0 @@
|
|||||||
//#region src/utils.ts
|
|
||||||
const postfixRE = /[?#].*$/;
|
|
||||||
function cleanUrl(url) {
|
|
||||||
return url.replace(postfixRE, "");
|
|
||||||
}
|
|
||||||
function extractQueryWithoutFragment(url) {
|
|
||||||
const questionMarkIndex = url.indexOf("?");
|
|
||||||
if (questionMarkIndex === -1) return "";
|
|
||||||
const fragmentIndex = url.indexOf("#", questionMarkIndex);
|
|
||||||
if (fragmentIndex === -1) return url.substring(questionMarkIndex);
|
|
||||||
else return url.substring(questionMarkIndex, fragmentIndex);
|
|
||||||
}
|
|
||||||
//#endregion
|
|
||||||
//#region src/filter/composable-filters.ts
|
|
||||||
var And = class {
|
|
||||||
kind;
|
|
||||||
args;
|
|
||||||
constructor(...args) {
|
|
||||||
if (args.length === 0) throw new Error("`And` expects at least one operand");
|
|
||||||
this.args = args;
|
|
||||||
this.kind = "and";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var Or = class {
|
|
||||||
kind;
|
|
||||||
args;
|
|
||||||
constructor(...args) {
|
|
||||||
if (args.length === 0) throw new Error("`Or` expects at least one operand");
|
|
||||||
this.args = args;
|
|
||||||
this.kind = "or";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var Not = class {
|
|
||||||
kind;
|
|
||||||
expr;
|
|
||||||
constructor(expr) {
|
|
||||||
this.expr = expr;
|
|
||||||
this.kind = "not";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var Id = class {
|
|
||||||
kind;
|
|
||||||
pattern;
|
|
||||||
params;
|
|
||||||
constructor(pattern, params) {
|
|
||||||
this.pattern = pattern;
|
|
||||||
this.kind = "id";
|
|
||||||
this.params = params ?? { cleanUrl: false };
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var ImporterId = class {
|
|
||||||
kind;
|
|
||||||
pattern;
|
|
||||||
params;
|
|
||||||
constructor(pattern, params) {
|
|
||||||
this.pattern = pattern;
|
|
||||||
this.kind = "importerId";
|
|
||||||
this.params = params ?? { cleanUrl: false };
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var ModuleType = class {
|
|
||||||
kind;
|
|
||||||
pattern;
|
|
||||||
constructor(pattern) {
|
|
||||||
this.pattern = pattern;
|
|
||||||
this.kind = "moduleType";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var Code = class {
|
|
||||||
kind;
|
|
||||||
pattern;
|
|
||||||
constructor(expr) {
|
|
||||||
this.pattern = expr;
|
|
||||||
this.kind = "code";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var Query = class {
|
|
||||||
kind;
|
|
||||||
key;
|
|
||||||
pattern;
|
|
||||||
constructor(key, pattern) {
|
|
||||||
this.pattern = pattern;
|
|
||||||
this.key = key;
|
|
||||||
this.kind = "query";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var Include = class {
|
|
||||||
kind;
|
|
||||||
expr;
|
|
||||||
constructor(expr) {
|
|
||||||
this.expr = expr;
|
|
||||||
this.kind = "include";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var Exclude = class {
|
|
||||||
kind;
|
|
||||||
expr;
|
|
||||||
constructor(expr) {
|
|
||||||
this.expr = expr;
|
|
||||||
this.kind = "exclude";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
function and(...args) {
|
|
||||||
return new And(...args);
|
|
||||||
}
|
|
||||||
function or(...args) {
|
|
||||||
return new Or(...args);
|
|
||||||
}
|
|
||||||
function not(expr) {
|
|
||||||
return new Not(expr);
|
|
||||||
}
|
|
||||||
function id(pattern, params) {
|
|
||||||
return new Id(pattern, params);
|
|
||||||
}
|
|
||||||
function importerId(pattern, params) {
|
|
||||||
return new ImporterId(pattern, params);
|
|
||||||
}
|
|
||||||
function moduleType(pattern) {
|
|
||||||
return new ModuleType(pattern);
|
|
||||||
}
|
|
||||||
function code(pattern) {
|
|
||||||
return new Code(pattern);
|
|
||||||
}
|
|
||||||
function query(key, pattern) {
|
|
||||||
return new Query(key, pattern);
|
|
||||||
}
|
|
||||||
function include(expr) {
|
|
||||||
return new Include(expr);
|
|
||||||
}
|
|
||||||
function exclude(expr) {
|
|
||||||
return new Exclude(expr);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* convert a queryObject to FilterExpression like
|
|
||||||
* ```js
|
|
||||||
* and(query(k1, v1), query(k2, v2))
|
|
||||||
* ```
|
|
||||||
* @param queryFilterObject The query filter object needs to be matched.
|
|
||||||
* @returns a `And` FilterExpression
|
|
||||||
*/
|
|
||||||
function queries(queryFilter) {
|
|
||||||
return and(...Object.entries(queryFilter).map(([key, value]) => {
|
|
||||||
return new Query(key, value);
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
function interpreter(exprs, code, id, moduleType, importerId) {
|
|
||||||
let arr = [];
|
|
||||||
if (Array.isArray(exprs)) arr = exprs;
|
|
||||||
else arr = [exprs];
|
|
||||||
return interpreterImpl(arr, code, id, moduleType, importerId);
|
|
||||||
}
|
|
||||||
function interpreterImpl(expr, code, id, moduleType, importerId, ctx = {}) {
|
|
||||||
let hasInclude = false;
|
|
||||||
for (const e of expr) switch (e.kind) {
|
|
||||||
case "include":
|
|
||||||
hasInclude = true;
|
|
||||||
if (exprInterpreter(e.expr, code, id, moduleType, importerId, ctx)) return true;
|
|
||||||
break;
|
|
||||||
case "exclude":
|
|
||||||
if (exprInterpreter(e.expr, code, id, moduleType, importerId, ctx)) return false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return !hasInclude;
|
|
||||||
}
|
|
||||||
function exprInterpreter(expr, code, id, moduleType, importerId, ctx = {}) {
|
|
||||||
switch (expr.kind) {
|
|
||||||
case "and": return expr.args.every((e) => exprInterpreter(e, code, id, moduleType, importerId, ctx));
|
|
||||||
case "or": return expr.args.some((e) => exprInterpreter(e, code, id, moduleType, importerId, ctx));
|
|
||||||
case "not": return !exprInterpreter(expr.expr, code, id, moduleType, importerId, ctx);
|
|
||||||
case "id": {
|
|
||||||
if (id === void 0) throw new Error("`id` is required for `id` expression");
|
|
||||||
let idToMatch = id;
|
|
||||||
if (expr.params.cleanUrl) idToMatch = cleanUrl(idToMatch);
|
|
||||||
return typeof expr.pattern === "string" ? idToMatch === expr.pattern : expr.pattern.test(idToMatch);
|
|
||||||
}
|
|
||||||
case "importerId": {
|
|
||||||
if (importerId === void 0) return false;
|
|
||||||
let importerIdToMatch = importerId;
|
|
||||||
if (expr.params.cleanUrl) importerIdToMatch = cleanUrl(importerIdToMatch);
|
|
||||||
return typeof expr.pattern === "string" ? importerIdToMatch === expr.pattern : expr.pattern.test(importerIdToMatch);
|
|
||||||
}
|
|
||||||
case "moduleType":
|
|
||||||
if (moduleType === void 0) throw new Error("`moduleType` is required for `moduleType` expression");
|
|
||||||
return moduleType === expr.pattern;
|
|
||||||
case "code":
|
|
||||||
if (code === void 0) throw new Error("`code` is required for `code` expression");
|
|
||||||
return typeof expr.pattern === "string" ? code.includes(expr.pattern) : expr.pattern.test(code);
|
|
||||||
case "query": {
|
|
||||||
if (id === void 0) throw new Error("`id` is required for `Query` expression");
|
|
||||||
if (!ctx.urlSearchParamsCache) {
|
|
||||||
let queryString = extractQueryWithoutFragment(id);
|
|
||||||
ctx.urlSearchParamsCache = new URLSearchParams(queryString);
|
|
||||||
}
|
|
||||||
let urlParams = ctx.urlSearchParamsCache;
|
|
||||||
if (typeof expr.pattern === "boolean") if (expr.pattern) return urlParams.has(expr.key);
|
|
||||||
else return !urlParams.has(expr.key);
|
|
||||||
else if (typeof expr.pattern === "string") return urlParams.get(expr.key) === expr.pattern;
|
|
||||||
else return expr.pattern.test(urlParams.get(expr.key) ?? "");
|
|
||||||
}
|
|
||||||
default: throw new Error(`Expression ${JSON.stringify(expr)} is not expected.`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//#endregion
|
|
||||||
//#region src/filter/filter-vite-plugins.ts
|
|
||||||
/**
|
|
||||||
* Filters out Vite plugins that have `apply: 'serve'` set.
|
|
||||||
*
|
|
||||||
* Since Rolldown operates in build mode, plugins marked with `apply: 'serve'`
|
|
||||||
* are intended only for Vite's dev server and should be excluded from the build process.
|
|
||||||
*
|
|
||||||
* @param plugins - Array of plugins (can include nested arrays)
|
|
||||||
* @returns Filtered array with serve-only plugins removed
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* ```ts
|
|
||||||
* import { defineConfig } from 'rolldown';
|
|
||||||
* import { filterVitePlugins } from '@rolldown/pluginutils';
|
|
||||||
* import viteReact from '@vitejs/plugin-react';
|
|
||||||
*
|
|
||||||
* export default defineConfig({
|
|
||||||
* plugins: filterVitePlugins([
|
|
||||||
* viteReact(),
|
|
||||||
* {
|
|
||||||
* name: 'dev-only',
|
|
||||||
* apply: 'serve', // This will be filtered out
|
|
||||||
* // ...
|
|
||||||
* }
|
|
||||||
* ])
|
|
||||||
* });
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
function filterVitePlugins(plugins) {
|
|
||||||
if (!plugins) return [];
|
|
||||||
const pluginArray = Array.isArray(plugins) ? plugins : [plugins];
|
|
||||||
const result = [];
|
|
||||||
for (const plugin of pluginArray) {
|
|
||||||
if (!plugin) continue;
|
|
||||||
if (Array.isArray(plugin)) {
|
|
||||||
result.push(...filterVitePlugins(plugin));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const pluginWithApply = plugin;
|
|
||||||
if ("apply" in pluginWithApply) {
|
|
||||||
const applyValue = pluginWithApply.apply;
|
|
||||||
if (typeof applyValue === "function") try {
|
|
||||||
if (applyValue({}, {
|
|
||||||
command: "build",
|
|
||||||
mode: "production"
|
|
||||||
})) result.push(plugin);
|
|
||||||
} catch {
|
|
||||||
result.push(plugin);
|
|
||||||
}
|
|
||||||
else if (applyValue === "serve") continue;
|
|
||||||
else result.push(plugin);
|
|
||||||
} else result.push(plugin);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
//#endregion
|
|
||||||
//#region src/filter/simple-filters.ts
|
|
||||||
/**
|
|
||||||
* Constructs a RegExp that matches the exact string specified.
|
|
||||||
*
|
|
||||||
* This is useful for plugin hook filters.
|
|
||||||
*
|
|
||||||
* @param str the string to match.
|
|
||||||
* @param flags flags for the RegExp.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* ```ts
|
|
||||||
* import { exactRegex } from '@rolldown/pluginutils';
|
|
||||||
* const plugin = {
|
|
||||||
* name: 'plugin',
|
|
||||||
* resolveId: {
|
|
||||||
* filter: { id: exactRegex('foo') },
|
|
||||||
* handler(id) {} // will only be called for `foo`
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
function exactRegex(str, flags) {
|
|
||||||
return new RegExp(`^${escapeRegex(str)}$`, flags);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Constructs a RegExp that matches a value that has the specified prefix.
|
|
||||||
*
|
|
||||||
* This is useful for plugin hook filters.
|
|
||||||
*
|
|
||||||
* @param str the string to match.
|
|
||||||
* @param flags flags for the RegExp.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* ```ts
|
|
||||||
* import { prefixRegex } from '@rolldown/pluginutils';
|
|
||||||
* const plugin = {
|
|
||||||
* name: 'plugin',
|
|
||||||
* resolveId: {
|
|
||||||
* filter: { id: prefixRegex('foo') },
|
|
||||||
* handler(id) {} // will only be called for IDs starting with `foo`
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
function prefixRegex(str, flags) {
|
|
||||||
return new RegExp(`^${escapeRegex(str)}`, flags);
|
|
||||||
}
|
|
||||||
const escapeRegexRE = /[-/\\^$*+?.()|[\]{}]/g;
|
|
||||||
function escapeRegex(str) {
|
|
||||||
return str.replace(escapeRegexRE, "\\$&");
|
|
||||||
}
|
|
||||||
function makeIdFiltersToMatchWithQuery(input) {
|
|
||||||
if (!Array.isArray(input)) return makeIdFilterToMatchWithQuery(input);
|
|
||||||
return input.map((i) => makeIdFilterToMatchWithQuery(i));
|
|
||||||
}
|
|
||||||
function makeIdFilterToMatchWithQuery(input) {
|
|
||||||
if (typeof input === "string") return `${input}{?*,}`;
|
|
||||||
return makeRegexIdFilterToMatchWithQuery(input);
|
|
||||||
}
|
|
||||||
function makeRegexIdFilterToMatchWithQuery(input) {
|
|
||||||
return new RegExp(input.source.replace(/(?<!\\)\$/g, "(?:\\?.*)?$"), input.flags);
|
|
||||||
}
|
|
||||||
//#endregion
|
|
||||||
export { queries as _, and as a, exprInterpreter as c, include as d, interpreter as f, or as g, not as h, filterVitePlugins as i, id as l, moduleType as m, makeIdFiltersToMatchWithQuery as n, code as o, interpreterImpl as p, prefixRegex as r, exclude as s, exactRegex as t, importerId as u, query as v };
|
|
||||||
-194
@@ -1,194 +0,0 @@
|
|||||||
//#region src/filter/composable-filters.d.ts
|
|
||||||
type StringOrRegExp = string | RegExp;
|
|
||||||
type PluginModuleType = 'js' | 'jsx' | 'ts' | 'tsx' | 'json' | 'text' | 'base64' | 'dataurl' | 'binary' | 'empty' | (string & {});
|
|
||||||
type FilterExpressionKind = FilterExpression['kind'];
|
|
||||||
type FilterExpression = And | Or | Not | Id | ImporterId | ModuleType | Code | Query;
|
|
||||||
type TopLevelFilterExpression = Include | Exclude;
|
|
||||||
declare class And {
|
|
||||||
kind: 'and';
|
|
||||||
args: FilterExpression[];
|
|
||||||
constructor(...args: FilterExpression[]);
|
|
||||||
}
|
|
||||||
declare class Or {
|
|
||||||
kind: 'or';
|
|
||||||
args: FilterExpression[];
|
|
||||||
constructor(...args: FilterExpression[]);
|
|
||||||
}
|
|
||||||
declare class Not {
|
|
||||||
kind: 'not';
|
|
||||||
expr: FilterExpression;
|
|
||||||
constructor(expr: FilterExpression);
|
|
||||||
}
|
|
||||||
interface QueryFilterObject {
|
|
||||||
[key: string]: StringOrRegExp | boolean;
|
|
||||||
}
|
|
||||||
interface IdParams {
|
|
||||||
cleanUrl?: boolean;
|
|
||||||
}
|
|
||||||
declare class Id {
|
|
||||||
kind: 'id';
|
|
||||||
pattern: StringOrRegExp;
|
|
||||||
params: IdParams;
|
|
||||||
constructor(pattern: StringOrRegExp, params?: IdParams);
|
|
||||||
}
|
|
||||||
declare class ImporterId {
|
|
||||||
kind: 'importerId';
|
|
||||||
pattern: StringOrRegExp;
|
|
||||||
params: IdParams;
|
|
||||||
constructor(pattern: StringOrRegExp, params?: IdParams);
|
|
||||||
}
|
|
||||||
declare class ModuleType {
|
|
||||||
kind: 'moduleType';
|
|
||||||
pattern: PluginModuleType;
|
|
||||||
constructor(pattern: PluginModuleType);
|
|
||||||
}
|
|
||||||
declare class Code {
|
|
||||||
kind: 'code';
|
|
||||||
pattern: StringOrRegExp;
|
|
||||||
constructor(expr: StringOrRegExp);
|
|
||||||
}
|
|
||||||
declare class Query {
|
|
||||||
kind: 'query';
|
|
||||||
key: string;
|
|
||||||
pattern: StringOrRegExp | boolean;
|
|
||||||
constructor(key: string, pattern: StringOrRegExp | boolean);
|
|
||||||
}
|
|
||||||
declare class Include {
|
|
||||||
kind: 'include';
|
|
||||||
expr: FilterExpression;
|
|
||||||
constructor(expr: FilterExpression);
|
|
||||||
}
|
|
||||||
declare class Exclude {
|
|
||||||
kind: 'exclude';
|
|
||||||
expr: FilterExpression;
|
|
||||||
constructor(expr: FilterExpression);
|
|
||||||
}
|
|
||||||
declare function and(...args: FilterExpression[]): And;
|
|
||||||
declare function or(...args: FilterExpression[]): Or;
|
|
||||||
declare function not(expr: FilterExpression): Not;
|
|
||||||
declare function id(pattern: StringOrRegExp, params?: IdParams): Id;
|
|
||||||
declare function importerId(pattern: StringOrRegExp, params?: IdParams): ImporterId;
|
|
||||||
declare function moduleType(pattern: PluginModuleType): ModuleType;
|
|
||||||
declare function code(pattern: StringOrRegExp): Code;
|
|
||||||
declare function query(key: string, pattern: StringOrRegExp | boolean): Query;
|
|
||||||
declare function include(expr: FilterExpression): Include;
|
|
||||||
declare function exclude(expr: FilterExpression): Exclude;
|
|
||||||
/**
|
|
||||||
* convert a queryObject to FilterExpression like
|
|
||||||
* ```js
|
|
||||||
* and(query(k1, v1), query(k2, v2))
|
|
||||||
* ```
|
|
||||||
* @param queryFilterObject The query filter object needs to be matched.
|
|
||||||
* @returns a `And` FilterExpression
|
|
||||||
*/
|
|
||||||
declare function queries(queryFilter: QueryFilterObject): And;
|
|
||||||
declare function interpreter(exprs: TopLevelFilterExpression | TopLevelFilterExpression[], code?: string, id?: string, moduleType?: PluginModuleType, importerId?: string): boolean;
|
|
||||||
interface InterpreterCtx {
|
|
||||||
urlSearchParamsCache?: URLSearchParams;
|
|
||||||
}
|
|
||||||
declare function interpreterImpl(expr: TopLevelFilterExpression[], code?: string, id?: string, moduleType?: PluginModuleType, importerId?: string, ctx?: InterpreterCtx): boolean;
|
|
||||||
declare function exprInterpreter(expr: FilterExpression, code?: string, id?: string, moduleType?: PluginModuleType, importerId?: string, ctx?: InterpreterCtx): boolean;
|
|
||||||
//#endregion
|
|
||||||
//#region src/filter/filter-vite-plugins.d.ts
|
|
||||||
/**
|
|
||||||
* Filters out Vite plugins that have `apply: 'serve'` set.
|
|
||||||
*
|
|
||||||
* Since Rolldown operates in build mode, plugins marked with `apply: 'serve'`
|
|
||||||
* are intended only for Vite's dev server and should be excluded from the build process.
|
|
||||||
*
|
|
||||||
* @param plugins - Array of plugins (can include nested arrays)
|
|
||||||
* @returns Filtered array with serve-only plugins removed
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* ```ts
|
|
||||||
* import { defineConfig } from 'rolldown';
|
|
||||||
* import { filterVitePlugins } from '@rolldown/pluginutils';
|
|
||||||
* import viteReact from '@vitejs/plugin-react';
|
|
||||||
*
|
|
||||||
* export default defineConfig({
|
|
||||||
* plugins: filterVitePlugins([
|
|
||||||
* viteReact(),
|
|
||||||
* {
|
|
||||||
* name: 'dev-only',
|
|
||||||
* apply: 'serve', // This will be filtered out
|
|
||||||
* // ...
|
|
||||||
* }
|
|
||||||
* ])
|
|
||||||
* });
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function filterVitePlugins<T = any>(plugins: T | T[] | null | undefined | false): T[];
|
|
||||||
//#endregion
|
|
||||||
//#region src/filter/simple-filters.d.ts
|
|
||||||
/**
|
|
||||||
* Constructs a RegExp that matches the exact string specified.
|
|
||||||
*
|
|
||||||
* This is useful for plugin hook filters.
|
|
||||||
*
|
|
||||||
* @param str the string to match.
|
|
||||||
* @param flags flags for the RegExp.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* ```ts
|
|
||||||
* import { exactRegex } from '@rolldown/pluginutils';
|
|
||||||
* const plugin = {
|
|
||||||
* name: 'plugin',
|
|
||||||
* resolveId: {
|
|
||||||
* filter: { id: exactRegex('foo') },
|
|
||||||
* handler(id) {} // will only be called for `foo`
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function exactRegex(str: string, flags?: string): RegExp;
|
|
||||||
/**
|
|
||||||
* Constructs a RegExp that matches a value that has the specified prefix.
|
|
||||||
*
|
|
||||||
* This is useful for plugin hook filters.
|
|
||||||
*
|
|
||||||
* @param str the string to match.
|
|
||||||
* @param flags flags for the RegExp.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* ```ts
|
|
||||||
* import { prefixRegex } from '@rolldown/pluginutils';
|
|
||||||
* const plugin = {
|
|
||||||
* name: 'plugin',
|
|
||||||
* resolveId: {
|
|
||||||
* filter: { id: prefixRegex('foo') },
|
|
||||||
* handler(id) {} // will only be called for IDs starting with `foo`
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function prefixRegex(str: string, flags?: string): RegExp;
|
|
||||||
type WidenString<T> = T extends string ? string : T;
|
|
||||||
/**
|
|
||||||
* Converts a id filter to match with an id with a query.
|
|
||||||
*
|
|
||||||
* @param input the id filters to convert.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* ```ts
|
|
||||||
* import { makeIdFiltersToMatchWithQuery } from '@rolldown/pluginutils';
|
|
||||||
* const plugin = {
|
|
||||||
* name: 'plugin',
|
|
||||||
* transform: {
|
|
||||||
* filter: { id: makeIdFiltersToMatchWithQuery(['**' + '/*.js', /\.ts$/]) },
|
|
||||||
* // The handler will be called for IDs like:
|
|
||||||
* // - foo.js
|
|
||||||
* // - foo.js?foo
|
|
||||||
* // - foo.txt?foo.js
|
|
||||||
* // - foo.ts
|
|
||||||
* // - foo.ts?foo
|
|
||||||
* // - foo.txt?foo.ts
|
|
||||||
* handler(code, id) {}
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function makeIdFiltersToMatchWithQuery<T extends string | RegExp>(input: T): WidenString<T>;
|
|
||||||
declare function makeIdFiltersToMatchWithQuery<T extends string | RegExp>(input: readonly T[]): WidenString<T>[];
|
|
||||||
declare function makeIdFiltersToMatchWithQuery(input: string | RegExp | readonly (string | RegExp)[]): string | RegExp | (string | RegExp)[];
|
|
||||||
//#endregion
|
|
||||||
export { FilterExpression, FilterExpressionKind, QueryFilterObject, TopLevelFilterExpression, and, code, exactRegex, exclude, exprInterpreter, filterVitePlugins, id, importerId, include, interpreter, interpreterImpl, makeIdFiltersToMatchWithQuery, moduleType, not, or, prefixRegex, queries, query };
|
|
||||||
-2
@@ -1,2 +0,0 @@
|
|||||||
import { _ as queries, a as and, c as exprInterpreter, d as include, f as interpreter, g as or, h as not, i as filterVitePlugins, l as id, m as moduleType, n as makeIdFiltersToMatchWithQuery, o as code, p as interpreterImpl, r as prefixRegex, s as exclude, t as exactRegex, u as importerId, v as query } from "../filter-B_mD-HGz.mjs";
|
|
||||||
export { and, code, exactRegex, exclude, exprInterpreter, filterVitePlugins, id, importerId, include, interpreter, interpreterImpl, makeIdFiltersToMatchWithQuery, moduleType, not, or, prefixRegex, queries, query };
|
|
||||||
-2
@@ -1,2 +0,0 @@
|
|||||||
import { FilterExpression, FilterExpressionKind, QueryFilterObject, TopLevelFilterExpression, and, code, exactRegex, exclude, exprInterpreter, filterVitePlugins, id, importerId, include, interpreter, interpreterImpl, makeIdFiltersToMatchWithQuery, moduleType, not, or, prefixRegex, queries, query } from "./filter/index.mjs";
|
|
||||||
export { FilterExpression, FilterExpressionKind, QueryFilterObject, TopLevelFilterExpression, and, code, exactRegex, exclude, exprInterpreter, filterVitePlugins, id, importerId, include, interpreter, interpreterImpl, makeIdFiltersToMatchWithQuery, moduleType, not, or, prefixRegex, queries, query };
|
|
||||||
-2
@@ -1,2 +0,0 @@
|
|||||||
import { _ as queries, a as and, c as exprInterpreter, d as include, f as interpreter, g as or, h as not, i as filterVitePlugins, l as id, m as moduleType, n as makeIdFiltersToMatchWithQuery, o as code, p as interpreterImpl, r as prefixRegex, s as exclude, t as exactRegex, u as importerId, v as query } from "./filter-B_mD-HGz.mjs";
|
|
||||||
export { and, code, exactRegex, exclude, exprInterpreter, filterVitePlugins, id, importerId, include, interpreter, interpreterImpl, makeIdFiltersToMatchWithQuery, moduleType, not, or, prefixRegex, queries, query };
|
|
||||||
-40
@@ -1,40 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@rolldown/pluginutils",
|
|
||||||
"version": "1.0.1",
|
|
||||||
"description": "Plugin utilities for Rolldown",
|
|
||||||
"keywords": [
|
|
||||||
"filter",
|
|
||||||
"plugin",
|
|
||||||
"rolldown"
|
|
||||||
],
|
|
||||||
"homepage": "https://github.com/rolldown/plugins/tree/main/packages/pluginutils#readme",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/rolldown/plugins/issues"
|
|
||||||
},
|
|
||||||
"license": "MIT",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/rolldown/plugins.git",
|
|
||||||
"directory": "packages/pluginutils"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"dist"
|
|
||||||
],
|
|
||||||
"type": "module",
|
|
||||||
"exports": {
|
|
||||||
".": "./dist/index.mjs",
|
|
||||||
"./filter": "./dist/filter/index.mjs",
|
|
||||||
"./package.json": "./package.json"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/picomatch": "^4.0.3",
|
|
||||||
"picomatch": "^4.0.4",
|
|
||||||
"typescript": "^5.9.3"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"dev": "tsdown --watch",
|
|
||||||
"build": "tsdown",
|
|
||||||
"test": "vitest --project pluginutils",
|
|
||||||
"test:types": "vitest --project pluginutils --typecheck.only"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-21
@@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) Microsoft Corporation.
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE
|
|
||||||
-15
@@ -1,15 +0,0 @@
|
|||||||
# Installation
|
|
||||||
> `npm install --save @types/d3-color`
|
|
||||||
|
|
||||||
# Summary
|
|
||||||
This package contains type definitions for d3-color (https://github.com/d3/d3-color/).
|
|
||||||
|
|
||||||
# Details
|
|
||||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/d3-color.
|
|
||||||
|
|
||||||
### Additional Details
|
|
||||||
* Last updated: Tue, 07 Nov 2023 15:11:36 GMT
|
|
||||||
* Dependencies: none
|
|
||||||
|
|
||||||
# Credits
|
|
||||||
These definitions were written by [Tom Wanzek](https://github.com/tomwanzek), [Alex Ford](https://github.com/gustavderdrache), [Boris Yankov](https://github.com/borisyankov), [denisname](https://github.com/denisname), [Hugues Stefanski](https://github.com/ledragon), [Nathan Bierema](https://github.com/Methuselah96), and [Fil](https://github.com/Fil).
|
|
||||||
-669
@@ -1,669 +0,0 @@
|
|||||||
// Last module patch version validated against: 3.1.0
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
// Shared Type Definitions and Interfaces
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Type allowing for color objects from a specified color space
|
|
||||||
*/
|
|
||||||
export type ColorSpaceObject = RGBColor | HSLColor | LabColor | HCLColor | CubehelixColor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A helper interface of methods common to color objects (including colors defined outside the d3-color standard module,
|
|
||||||
* e.g. in d3-hsv). This interface
|
|
||||||
*/
|
|
||||||
export interface ColorCommonInstance {
|
|
||||||
/**
|
|
||||||
* Returns true if and only if the color is displayable on standard hardware.
|
|
||||||
* For example, this returns false for an RGB color if any channel value is less than zero or greater than 255, or if the opacity is not in the range [0, 1].
|
|
||||||
*/
|
|
||||||
displayable(): boolean;
|
|
||||||
/**
|
|
||||||
* Returns a string representing this color according to the CSS Object Model specification,
|
|
||||||
* such as rgb(247, 234, 186) or rgba(247, 234, 186, 0.2).
|
|
||||||
* If this color is not displayable, a suitable displayable color is returned instead.
|
|
||||||
* For example, RGB channel values greater than 255 are clamped to 255.
|
|
||||||
*/
|
|
||||||
toString(): string;
|
|
||||||
/**
|
|
||||||
* Returns a brighter copy of this color. If k is specified, it controls how much brighter the returned color should be.
|
|
||||||
* If k is not specified, it defaults to 1. The behavior of this method is dependent on the implementing color space.
|
|
||||||
*
|
|
||||||
* @param k A color space dependent number to determine, how much brighter the returned color should be.
|
|
||||||
*/
|
|
||||||
brighter(k?: number): this;
|
|
||||||
/**
|
|
||||||
* Returns a darker copy of this color. If k is specified, it controls how much darker the returned color should be.
|
|
||||||
* If k is not specified, it defaults to 1. The behavior of this method is dependent on the implementing color space.
|
|
||||||
*
|
|
||||||
* @param k A color space dependent number to determine, how much darker the returned color should be.
|
|
||||||
*/
|
|
||||||
darker(k?: number): this;
|
|
||||||
/**
|
|
||||||
* Returns the RGB equivalent of this color. For RGB colors, that’s "this".
|
|
||||||
*/
|
|
||||||
rgb(): RGBColor;
|
|
||||||
/**
|
|
||||||
* Returns a hexadecimal string representing this color.
|
|
||||||
* If this color is not displayable, a suitable displayable color is returned instead.
|
|
||||||
* For example, RGB channel values greater than 255 are clamped to 255.
|
|
||||||
*/
|
|
||||||
hex(): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A Color object which serves as a base class for
|
|
||||||
* colorspace-specific sub-class implementations.
|
|
||||||
*/
|
|
||||||
export interface Color {
|
|
||||||
/**
|
|
||||||
* Returns true if and only if the color is displayable on standard hardware.
|
|
||||||
* For example, this returns false for an RGB color if any channel value is less than zero or greater than 255, or if the opacity is not in the range [0, 1].
|
|
||||||
*/
|
|
||||||
displayable(): boolean; // Note: While this method is used in prototyping for colors of specific colorspaces, it should not be called directly, as 'this.rgb' would not be implemented on Color
|
|
||||||
/**
|
|
||||||
* Returns a string representing this color according to the CSS Object Model specification,
|
|
||||||
* such as rgb(247, 234, 186) or rgba(247, 234, 186, 0.2).
|
|
||||||
* If this color is not displayable, a suitable displayable color is returned instead.
|
|
||||||
* For example, RGB channel values greater than 255 are clamped to 255.
|
|
||||||
*/
|
|
||||||
toString(): string; // Note: While this method is used in prototyping for colors of specific colorspaces, it should not be called directly, as 'this.rgb' would not be implemented on Color
|
|
||||||
/**
|
|
||||||
* Returns a hexadecimal string representing this color in RGB space, such as #f7eaba.
|
|
||||||
* If this color is not displayable, a suitable displayable color is returned instead.
|
|
||||||
* For example, RGB channel values greater than 255 are clamped to 255.
|
|
||||||
*/
|
|
||||||
formatHex(): string;
|
|
||||||
/**
|
|
||||||
* Returns a hexadecimal string representing this color in RGBA space, such as #f7eaba90.
|
|
||||||
* If this color is not displayable, a suitable displayable color is returned instead.
|
|
||||||
* For example, RGB channel values greater than 255 are clamped to 255.
|
|
||||||
*/
|
|
||||||
formatHex8(): string;
|
|
||||||
/**
|
|
||||||
* Returns a string representing this color according to the CSS Color Module Level 3 specification, such as hsl(257, 50%, 80%) or hsla(257, 50%, 80%, 0.2).
|
|
||||||
* If this color is not displayable, a suitable displayable color is returned instead by clamping S and L channel values to the interval [0, 100].
|
|
||||||
*/
|
|
||||||
formatHsl(): string;
|
|
||||||
/**
|
|
||||||
* Returns a string representing this color according to the CSS Object Model specification, such as rgb(247, 234, 186) or rgba(247, 234, 186, 0.2).
|
|
||||||
* If this color is not displayable, a suitable displayable color is returned instead by clamping RGB channel values to the interval [0, 255].
|
|
||||||
*/
|
|
||||||
formatRgb(): string;
|
|
||||||
/**
|
|
||||||
* @deprecated Use color.formatHex.
|
|
||||||
*/
|
|
||||||
hex(): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A Color factory object, which may also be used with instanceof to test if an object is a color instance.
|
|
||||||
*/
|
|
||||||
export interface ColorFactory extends Function {
|
|
||||||
/**
|
|
||||||
* Parses the specified CSS Color Module Level 3 specifier string, returning an RGB or HSL color.
|
|
||||||
* If the specifier was not valid, null is returned.
|
|
||||||
*
|
|
||||||
* @param cssColorSpecifier A CSS Color Module Level 3 specifier string.
|
|
||||||
*/
|
|
||||||
(cssColorSpecifier: string): RGBColor | HSLColor | null;
|
|
||||||
/**
|
|
||||||
* Converts the provided color instance and returns an RGB or HSL color.
|
|
||||||
*
|
|
||||||
* @param color A permissible color space instance.
|
|
||||||
*/
|
|
||||||
(color: ColorSpaceObject | ColorCommonInstance): RGBColor | HSLColor;
|
|
||||||
/**
|
|
||||||
* Prototype of the factory, which can be used for instanceof testing
|
|
||||||
*/
|
|
||||||
readonly prototype: Color;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An RGB color object.
|
|
||||||
*/
|
|
||||||
export interface RGBColor extends Color {
|
|
||||||
/**
|
|
||||||
* Value of red channel
|
|
||||||
*/
|
|
||||||
r: number;
|
|
||||||
/**
|
|
||||||
* Value of green channel
|
|
||||||
*/
|
|
||||||
g: number;
|
|
||||||
/**
|
|
||||||
* Value of blue channel
|
|
||||||
*/
|
|
||||||
b: number;
|
|
||||||
/**
|
|
||||||
* Opacity value
|
|
||||||
*/
|
|
||||||
opacity: number;
|
|
||||||
/**
|
|
||||||
* Returns a brighter copy of this color. If k is specified, it controls how much brighter the returned color should be.
|
|
||||||
* If k is not specified, it defaults to 1.
|
|
||||||
*
|
|
||||||
* @param k A color space dependent number to determine, how much brighter the returned color should be.
|
|
||||||
*/
|
|
||||||
brighter(k?: number): this;
|
|
||||||
/**
|
|
||||||
* Returns a darker copy of this color. If k is specified, it controls how much darker the returned color should be.
|
|
||||||
* If k is not specified, it defaults to 1.
|
|
||||||
*
|
|
||||||
* @param k A color space dependent number to determine, how much darker the returned color should be.
|
|
||||||
*/
|
|
||||||
darker(k?: number): this;
|
|
||||||
/**
|
|
||||||
* Returns the RGB equivalent of this color.
|
|
||||||
*/
|
|
||||||
rgb(): this;
|
|
||||||
/**
|
|
||||||
* Returns a copy of this color.
|
|
||||||
*
|
|
||||||
* @param values If values is specified, any enumerable own properties of values are assigned to the new returned color.
|
|
||||||
*/
|
|
||||||
copy(
|
|
||||||
values?: {
|
|
||||||
r?: number | undefined;
|
|
||||||
g?: number | undefined;
|
|
||||||
b?: number | undefined;
|
|
||||||
opacity?: number | undefined;
|
|
||||||
},
|
|
||||||
): this;
|
|
||||||
/**
|
|
||||||
* Returns a new RGB color where the r, g, and b channels are clamped to the range [0, 255] and rounded to the nearest integer value,
|
|
||||||
* and the opacity is clamped to the range [0, 1].
|
|
||||||
*/
|
|
||||||
clamp(): this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An RGB color factory object, which may also be used with instanceof to test if an object
|
|
||||||
* is an RGB color instance.
|
|
||||||
*/
|
|
||||||
export interface RGBColorFactory extends Function {
|
|
||||||
/**
|
|
||||||
* Constructs a new RGB color based on the specified channel values and opacity.
|
|
||||||
*
|
|
||||||
* @param r Red channel value.
|
|
||||||
* @param g Green channel value.
|
|
||||||
* @param b Blue channel value.
|
|
||||||
* @param opacity Optional opacity value, defaults to 1.
|
|
||||||
*/
|
|
||||||
(r: number, g: number, b: number, opacity?: number): RGBColor;
|
|
||||||
/**
|
|
||||||
* Parses the specified CSS Color Module Level 3 specifier string, returning an RGB color.
|
|
||||||
* If the specifier was not valid, null is returned.
|
|
||||||
*
|
|
||||||
* @param cssColorSpecifier A CSS Color Module Level 3 specifier string.
|
|
||||||
*/
|
|
||||||
(cssColorSpecifier: string): RGBColor;
|
|
||||||
/**
|
|
||||||
* Converts the provided color instance and returns an RGB color. The color instance is converted to the RGB color space using color.rgb.
|
|
||||||
* Note that unlike color.rgb this method always returns a new instance, even if color is already an RGB color.
|
|
||||||
*
|
|
||||||
* @param color A permissible color space instance.
|
|
||||||
*/
|
|
||||||
// tslint:disable-next-line:unified-signatures
|
|
||||||
(color: ColorSpaceObject | ColorCommonInstance): RGBColor;
|
|
||||||
/**
|
|
||||||
* Prototype of the factory, which can be used for instanceof testing
|
|
||||||
*/
|
|
||||||
readonly prototype: RGBColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An HSL color object.
|
|
||||||
*/
|
|
||||||
export interface HSLColor extends Color {
|
|
||||||
/**
|
|
||||||
* Hue channel value.
|
|
||||||
*/
|
|
||||||
h: number;
|
|
||||||
/**
|
|
||||||
* Saturation channel value.
|
|
||||||
*/
|
|
||||||
s: number;
|
|
||||||
/**
|
|
||||||
* Lightness channel value.
|
|
||||||
*/
|
|
||||||
l: number;
|
|
||||||
/**
|
|
||||||
* Opacity value.
|
|
||||||
*/
|
|
||||||
opacity: number;
|
|
||||||
/**
|
|
||||||
* Returns a brighter copy of this color. If k is specified, it controls how much brighter the returned color should be.
|
|
||||||
* If k is not specified, it defaults to 1.
|
|
||||||
*
|
|
||||||
* @param k A color space dependent number to determine, how much brighter the returned color should be.
|
|
||||||
*/
|
|
||||||
brighter(k?: number): this;
|
|
||||||
/**
|
|
||||||
* Returns a darker copy of this color. If k is specified, it controls how much darker the returned color should be.
|
|
||||||
* If k is not specified, it defaults to 1.
|
|
||||||
*
|
|
||||||
* @param k A color space dependent number to determine, how much darker the returned color should be.
|
|
||||||
*/
|
|
||||||
darker(k?: number): this;
|
|
||||||
/**
|
|
||||||
* Returns the RGB color equivalent of this color.
|
|
||||||
*/
|
|
||||||
rgb(): RGBColor;
|
|
||||||
/**
|
|
||||||
* Returns a copy of this color.
|
|
||||||
*
|
|
||||||
* @param values If values is specified, any enumerable own properties of values are assigned to the new returned color.
|
|
||||||
*/
|
|
||||||
copy(
|
|
||||||
values?: {
|
|
||||||
h?: number | undefined;
|
|
||||||
s?: number | undefined;
|
|
||||||
l?: number | undefined;
|
|
||||||
opacity?: number | undefined;
|
|
||||||
},
|
|
||||||
): this;
|
|
||||||
/**
|
|
||||||
* Returns a new HSL color where the h channel is clamped to the range [0, 360), and the s, l, and opacity channels are clamped to the range [0, 1].
|
|
||||||
*/
|
|
||||||
clamp(): this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An HSL color factory object, which may also be used with instanceof to test if an object
|
|
||||||
* is an HSL color instance.
|
|
||||||
*/
|
|
||||||
export interface HSLColorFactory extends Function {
|
|
||||||
/**
|
|
||||||
* Constructs a new HSL color based on the specified channel values and opacity.
|
|
||||||
*
|
|
||||||
* @param h Hue channel value.
|
|
||||||
* @param s Saturation channel value.
|
|
||||||
* @param l Lightness channel value.
|
|
||||||
* @param opacity Optional opacity value, defaults to 1.
|
|
||||||
*/
|
|
||||||
(h: number, s: number, l: number, opacity?: number): HSLColor;
|
|
||||||
/**
|
|
||||||
* Parses the specified CSS Color Module Level 3 specifier string, returning an HSL color.
|
|
||||||
* If the specifier was not valid, null is returned.
|
|
||||||
*
|
|
||||||
* @param cssColorSpecifier A CSS Color Module Level 3 specifier string.
|
|
||||||
*/
|
|
||||||
(cssColorSpecifier: string): HSLColor;
|
|
||||||
/**
|
|
||||||
* Converts the provided color instance and returns an HSL color.
|
|
||||||
* The color instance is converted to the RGB color space using color.rgb and then converted to HSL.
|
|
||||||
* (Colors already in the HSL color space skip the conversion to RGB.)
|
|
||||||
*
|
|
||||||
* @param color A permissible color space instance.
|
|
||||||
*/
|
|
||||||
// tslint:disable-next-line:unified-signatures
|
|
||||||
(color: ColorSpaceObject | ColorCommonInstance): HSLColor;
|
|
||||||
/**
|
|
||||||
* Prototype of the factory, which can be used for instanceof testing
|
|
||||||
*/
|
|
||||||
readonly prototype: HSLColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A Lab (CIELAB) color object.
|
|
||||||
*/
|
|
||||||
export interface LabColor extends Color {
|
|
||||||
/**
|
|
||||||
* Lightness typically in the range [0, 100].
|
|
||||||
*/
|
|
||||||
l: number;
|
|
||||||
/**
|
|
||||||
* Position between red/magenta and green typically in [-160, +160].
|
|
||||||
*/
|
|
||||||
a: number;
|
|
||||||
/**
|
|
||||||
* Position between yellow and blue typically in [-160, +160].
|
|
||||||
*/
|
|
||||||
b: number;
|
|
||||||
/**
|
|
||||||
* Opacity value
|
|
||||||
*/
|
|
||||||
opacity: number;
|
|
||||||
/**
|
|
||||||
* Returns a brighter copy of this color. If k is specified, it controls how much brighter the returned color should be.
|
|
||||||
* If k is not specified, it defaults to 1.
|
|
||||||
*
|
|
||||||
* @param k A color space dependent number to determine, how much brighter the returned color should be.
|
|
||||||
*/
|
|
||||||
brighter(k?: number): this;
|
|
||||||
/**
|
|
||||||
* Returns a darker copy of this color. If k is specified, it controls how much darker the returned color should be.
|
|
||||||
* If k is not specified, it defaults to 1.
|
|
||||||
*
|
|
||||||
* @param k A color space dependent number to determine, how much darker the returned color should be.
|
|
||||||
*/
|
|
||||||
darker(k?: number): this;
|
|
||||||
/**
|
|
||||||
* Returns the RGB color equivalent of this color.
|
|
||||||
*/
|
|
||||||
rgb(): RGBColor;
|
|
||||||
/**
|
|
||||||
* Returns a copy of this color.
|
|
||||||
*
|
|
||||||
* @param values If values is specified, any enumerable own properties of values are assigned to the new returned color.
|
|
||||||
*/
|
|
||||||
copy(
|
|
||||||
values?: {
|
|
||||||
l?: number | undefined;
|
|
||||||
a?: number | undefined;
|
|
||||||
b?: number | undefined;
|
|
||||||
opacity?: number | undefined;
|
|
||||||
},
|
|
||||||
): this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A Lab (CIELAB) color factory object, which may also be used with instanceof to test if an object
|
|
||||||
* is a Lab color instance.
|
|
||||||
*/
|
|
||||||
export interface LabColorFactory extends Function {
|
|
||||||
/**
|
|
||||||
* Constructs a new CIELAB color based on the specified channel values and opacity.
|
|
||||||
*
|
|
||||||
* @param l Lightness typically in the range [0, 100].
|
|
||||||
* @param a Position between red/magenta and green typically in [-160, +160].
|
|
||||||
* @param b Position between yellow and blue typically in [-160, +160].
|
|
||||||
* @param opacity Optional opacity value, defaults to 1.
|
|
||||||
*/
|
|
||||||
(l: number, a: number, b: number, opacity?: number): LabColor;
|
|
||||||
/**
|
|
||||||
* Parses the specified CSS Color Module Level 3 specifier string, returning a Lab color.
|
|
||||||
* If the specifier was not valid, null is returned.
|
|
||||||
*
|
|
||||||
* @param cssColorSpecifier A CSS Color Module Level 3 specifier string.
|
|
||||||
*/
|
|
||||||
(cssColorSpecifier: string): LabColor;
|
|
||||||
/**
|
|
||||||
* Converts the provided color instance and returns a Lab color.
|
|
||||||
* The color instance is converted to the RGB color space using color.rgb and then converted to CIELAB.
|
|
||||||
* (Colors already in the Lab color space skip the conversion to RGB,
|
|
||||||
* and colors in the HCL color space are converted directly to CIELAB.)
|
|
||||||
*
|
|
||||||
* @param color A permissible color space instance.
|
|
||||||
*/
|
|
||||||
// tslint:disable-next-line:unified-signatures
|
|
||||||
(color: ColorSpaceObject | ColorCommonInstance): LabColor;
|
|
||||||
/**
|
|
||||||
* Prototype of the factory, which can be used for instanceof testing
|
|
||||||
*/
|
|
||||||
readonly prototype: LabColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A gray color factory for Lab (CIELAB) colors.
|
|
||||||
*/
|
|
||||||
export type GrayColorFactory =
|
|
||||||
/**
|
|
||||||
* Constructs a new CIELAB color with the specified l value and a = b = 0.
|
|
||||||
*
|
|
||||||
* @param l Lightness typically in the range [0, 100].
|
|
||||||
* @param opacity Optional opacity value, defaults to 1.
|
|
||||||
*/
|
|
||||||
(l: number, opacity?: number) => LabColor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An HCL (CIELCH) color object.
|
|
||||||
*/
|
|
||||||
export interface HCLColor extends Color {
|
|
||||||
/**
|
|
||||||
* Hue channel value typically in [0, 360).
|
|
||||||
*/
|
|
||||||
h: number;
|
|
||||||
/**
|
|
||||||
* Chroma channel value typically in [0, 230].
|
|
||||||
*/
|
|
||||||
c: number;
|
|
||||||
/**
|
|
||||||
* Luminance channel value typically in the range [0, 100].
|
|
||||||
*/
|
|
||||||
l: number;
|
|
||||||
/**
|
|
||||||
* Opacity value
|
|
||||||
*/
|
|
||||||
opacity: number;
|
|
||||||
/**
|
|
||||||
* Returns a brighter copy of this color. If k is specified, it controls how much brighter the returned color should be.
|
|
||||||
* If k is not specified, it defaults to 1.
|
|
||||||
*
|
|
||||||
* @param k A color space dependent number to determine, how much brighter the returned color should be.
|
|
||||||
*/
|
|
||||||
brighter(k?: number): this;
|
|
||||||
/**
|
|
||||||
* Returns a darker copy of this color. If k is specified, it controls how much darker the returned color should be.
|
|
||||||
* If k is not specified, it defaults to 1.
|
|
||||||
*
|
|
||||||
* @param k A color space dependent number to determine, how much darker the returned color should be.
|
|
||||||
*/
|
|
||||||
darker(k?: number): this;
|
|
||||||
/**
|
|
||||||
* Returns the RGB color equivalent of this color.
|
|
||||||
*/
|
|
||||||
rgb(): RGBColor;
|
|
||||||
/**
|
|
||||||
* Returns a copy of this color.
|
|
||||||
*
|
|
||||||
* @param values If values is specified, any enumerable own properties of values are assigned to the new returned color.
|
|
||||||
*/
|
|
||||||
copy(
|
|
||||||
values?: {
|
|
||||||
h?: number | undefined;
|
|
||||||
c?: number | undefined;
|
|
||||||
l?: number | undefined;
|
|
||||||
opacity?: number | undefined;
|
|
||||||
},
|
|
||||||
): this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An HCL (CIELCH) color factory object, which may also be used with instanceof to test if an object
|
|
||||||
* is an HCL color instance.
|
|
||||||
*/
|
|
||||||
export interface HCLColorFactory extends Function {
|
|
||||||
/**
|
|
||||||
* Constructs a new HCL color based on the specified channel values and opacity.
|
|
||||||
*
|
|
||||||
* @param h Hue channel value typically in [0, 360).
|
|
||||||
* @param c Chroma channel value typically in [0, 230].
|
|
||||||
* @param l Luminance channel value typically in the range [0, 100].
|
|
||||||
* @param opacity Optional opacity value, defaults to 1.
|
|
||||||
*/
|
|
||||||
(h: number, c: number, l: number, opacity?: number): HCLColor;
|
|
||||||
/**
|
|
||||||
* Parses the specified CSS Color Module Level 3 specifier string, returning an HCL color.
|
|
||||||
* If the specifier was not valid, null is returned.
|
|
||||||
*
|
|
||||||
* @param cssColorSpecifier A CSS Color Module Level 3 specifier string.
|
|
||||||
*/
|
|
||||||
(cssColorSpecifier: string): HCLColor;
|
|
||||||
/**
|
|
||||||
* Converts the provided color instance and returns an HCL color.
|
|
||||||
* The color instance is converted to the RGB color space using color.rgb and then converted to HCL.
|
|
||||||
* (Colors already in the HCL color space skip the conversion to RGB,
|
|
||||||
* and colors in the Lab color space are converted directly to HCL.)
|
|
||||||
*
|
|
||||||
* @param color A permissible color space instance.
|
|
||||||
*/
|
|
||||||
// tslint:disable-next-line:unified-signatures
|
|
||||||
(color: ColorSpaceObject | ColorCommonInstance): HCLColor;
|
|
||||||
/**
|
|
||||||
* Prototype of the factory, which can be used for instanceof testing
|
|
||||||
*/
|
|
||||||
readonly prototype: HCLColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An LCH (CIELCH) color factory function to create an HCL color object.
|
|
||||||
*/
|
|
||||||
export interface LCHColorFactory {
|
|
||||||
/**
|
|
||||||
* Constructs a new HCL color based on the specified channel values and opacity.
|
|
||||||
*
|
|
||||||
* @param l Luminance channel value typically in the range [0, 100].
|
|
||||||
* @param c Chroma channel value typically in [0, 230].
|
|
||||||
* @param h Hue channel value typically in [0, 360).
|
|
||||||
* @param opacity Optional opacity value, defaults to 1.
|
|
||||||
*/
|
|
||||||
(l: number, c: number, h: number, opacity?: number): HCLColor;
|
|
||||||
/**
|
|
||||||
* Parses the specified CSS Color Module Level 3 specifier string, returning an HCL color.
|
|
||||||
* If the specifier was not valid, null is returned.
|
|
||||||
*
|
|
||||||
* @param cssColorSpecifier A CSS color Module Level 3 specifier string.
|
|
||||||
*/
|
|
||||||
(cssColorSpecifier: string): HCLColor;
|
|
||||||
/**
|
|
||||||
* Converts the provided color instance and returns an HCL color.
|
|
||||||
* The color instance is converted to the RGB color space using color.rgb and then converted to HCL.
|
|
||||||
* (Colors already in the HCL color space skip the conversion to RGB,
|
|
||||||
* and colors in the Lab color space are converted directly to HCL.)
|
|
||||||
*
|
|
||||||
* @param color A permissible color space instance.
|
|
||||||
*/
|
|
||||||
// tslint:disable-next-line:unified-signatures
|
|
||||||
(color: ColorSpaceObject | ColorCommonInstance): HCLColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Dave Green’s Cubehelix color object.
|
|
||||||
*/
|
|
||||||
export interface CubehelixColor extends Color {
|
|
||||||
/**
|
|
||||||
* Hue channel value.
|
|
||||||
*/
|
|
||||||
h: number;
|
|
||||||
/**
|
|
||||||
* Saturation channel value.
|
|
||||||
*/
|
|
||||||
s: number;
|
|
||||||
/**
|
|
||||||
* Lightness channel value.
|
|
||||||
*/
|
|
||||||
l: number;
|
|
||||||
/**
|
|
||||||
* Opacity value.
|
|
||||||
*/
|
|
||||||
opacity: number;
|
|
||||||
/**
|
|
||||||
* Returns a brighter copy of this color. If k is specified, it controls how much brighter the returned color should be.
|
|
||||||
* If k is not specified, it defaults to 1.
|
|
||||||
*
|
|
||||||
* @param k A color space dependent number to determine, how much brighter the returned color should be.
|
|
||||||
*/
|
|
||||||
brighter(k?: number): this;
|
|
||||||
/**
|
|
||||||
* Returns a darker copy of this color. If k is specified, it controls how much darker the returned color should be.
|
|
||||||
* If k is not specified, it defaults to 1.
|
|
||||||
*
|
|
||||||
* @param k A color space dependent number to determine, how much darker the returned color should be.
|
|
||||||
*/
|
|
||||||
darker(k?: number): this;
|
|
||||||
/**
|
|
||||||
* Returns the RGB color equivalent of this color.
|
|
||||||
*/
|
|
||||||
rgb(): RGBColor;
|
|
||||||
/**
|
|
||||||
* Returns a copy of this color.
|
|
||||||
*
|
|
||||||
* @param values If values is specified, any enumerable own properties of values are assigned to the new returned color.
|
|
||||||
*/
|
|
||||||
copy(
|
|
||||||
values?: {
|
|
||||||
h?: number | undefined;
|
|
||||||
s?: number | undefined;
|
|
||||||
l?: number | undefined;
|
|
||||||
opacity?: number | undefined;
|
|
||||||
},
|
|
||||||
): this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A color factory object for Dave Green's Cubehelix colors, which may also be used with instanceof to test if an object
|
|
||||||
* is a Cubehelix color instance.
|
|
||||||
*/
|
|
||||||
export interface CubehelixColorFactory extends Function {
|
|
||||||
/**
|
|
||||||
* Constructs a new Cubehelix color based on the specified channel values and opacity.
|
|
||||||
*
|
|
||||||
* @param h Hue channel value.
|
|
||||||
* @param s Saturation channel value.
|
|
||||||
* @param l Lightness channel value.
|
|
||||||
* @param opacity Optional opacity value, defaults to 1.
|
|
||||||
*/
|
|
||||||
(h: number, s: number, l: number, opacity?: number): CubehelixColor;
|
|
||||||
/**
|
|
||||||
* Parses the specified CSS Color Module Level 3 specifier string, returning an Cubehelix color.
|
|
||||||
* If the specifier was not valid, null is returned.
|
|
||||||
*
|
|
||||||
* @param cssColorSpecifier A CSS Color Module Level 3 specifier string.
|
|
||||||
*/
|
|
||||||
(cssColorSpecifier: string): CubehelixColor;
|
|
||||||
/**
|
|
||||||
* Converts the provided color instance and returns a Cubehelix color.
|
|
||||||
* The color instance is specified, it is converted to the RGB color space using color.rgb and then converted to Cubehelix.
|
|
||||||
* (Colors already in the Cubehelix color space skip the conversion to RGB.)
|
|
||||||
*
|
|
||||||
* @param color A permissible color space instance.
|
|
||||||
*/
|
|
||||||
// tslint:disable-next-line:unified-signatures
|
|
||||||
(color: ColorSpaceObject | ColorCommonInstance): CubehelixColor;
|
|
||||||
/**
|
|
||||||
* Prototype of the factory, which can be used for instanceof testing
|
|
||||||
*/
|
|
||||||
readonly prototype: CubehelixColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
|
||||||
// Color object factories
|
|
||||||
// --------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A Color factory object, which may also be used with instanceof to test if an object is a color instance.
|
|
||||||
*/
|
|
||||||
export const color: ColorFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An RGB color factory object, which may also be used with instanceof to test if an object
|
|
||||||
* is an RGB color instance.
|
|
||||||
*/
|
|
||||||
export const rgb: RGBColorFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An HSL color factory object, which may also be used with instanceof to test if an object
|
|
||||||
* is an HSL color instance.
|
|
||||||
*/
|
|
||||||
export const hsl: HSLColorFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A Lab (CIELAB) color factory object, which may also be used with instanceof to test if an object
|
|
||||||
* is a Lab color instance.
|
|
||||||
*/
|
|
||||||
export const lab: LabColorFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A gray color factory for Lab (CIELAB) colors.
|
|
||||||
*/
|
|
||||||
export const gray: GrayColorFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An HCL (CIELCH) color factory object, which may also be used with instanceof to test if an object
|
|
||||||
* is an HCL color instance.
|
|
||||||
*/
|
|
||||||
export const hcl: HCLColorFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An LCH (CIELCH) color factory function to create an HCL color object.
|
|
||||||
*/
|
|
||||||
export const lch: LCHColorFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A color factory object for Dave Green's Cubehelix colors, which may also be used with instanceof to test if an object
|
|
||||||
* is a Cubehelix color instance.
|
|
||||||
*/
|
|
||||||
export const cubehelix: CubehelixColorFactory;
|
|
||||||
-55
@@ -1,55 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@types/d3-color",
|
|
||||||
"version": "3.1.3",
|
|
||||||
"description": "TypeScript definitions for d3-color",
|
|
||||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/d3-color",
|
|
||||||
"license": "MIT",
|
|
||||||
"contributors": [
|
|
||||||
{
|
|
||||||
"name": "Tom Wanzek",
|
|
||||||
"githubUsername": "tomwanzek",
|
|
||||||
"url": "https://github.com/tomwanzek"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Alex Ford",
|
|
||||||
"githubUsername": "gustavderdrache",
|
|
||||||
"url": "https://github.com/gustavderdrache"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Boris Yankov",
|
|
||||||
"githubUsername": "borisyankov",
|
|
||||||
"url": "https://github.com/borisyankov"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "denisname",
|
|
||||||
"githubUsername": "denisname",
|
|
||||||
"url": "https://github.com/denisname"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Hugues Stefanski",
|
|
||||||
"githubUsername": "ledragon",
|
|
||||||
"url": "https://github.com/ledragon"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Nathan Bierema",
|
|
||||||
"githubUsername": "Methuselah96",
|
|
||||||
"url": "https://github.com/Methuselah96"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Fil",
|
|
||||||
"githubUsername": "Fil",
|
|
||||||
"url": "https://github.com/Fil"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"main": "",
|
|
||||||
"types": "index.d.ts",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
|
||||||
"directory": "types/d3-color"
|
|
||||||
},
|
|
||||||
"scripts": {},
|
|
||||||
"dependencies": {},
|
|
||||||
"typesPublisherContentHash": "89cf9357324cddaa31cfb539b1c33d118648ed55319f2a0d26f24b004975a947",
|
|
||||||
"typeScriptVersion": "4.5"
|
|
||||||
}
|
|
||||||
-21
@@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) Microsoft Corporation.
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE
|
|
||||||
-15
@@ -1,15 +0,0 @@
|
|||||||
# Installation
|
|
||||||
> `npm install --save @types/d3-drag`
|
|
||||||
|
|
||||||
# Summary
|
|
||||||
This package contains type definitions for d3-drag (https://github.com/d3/d3-drag/).
|
|
||||||
|
|
||||||
# Details
|
|
||||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/d3-drag.
|
|
||||||
|
|
||||||
### Additional Details
|
|
||||||
* Last updated: Tue, 07 Nov 2023 15:11:36 GMT
|
|
||||||
* Dependencies: [@types/d3-selection](https://npmjs.com/package/@types/d3-selection)
|
|
||||||
|
|
||||||
# Credits
|
|
||||||
These definitions were written by [Tom Wanzek](https://github.com/tomwanzek), [Alex Ford](https://github.com/gustavderdrache), [Boris Yankov](https://github.com/borisyankov), and [Nathan Bierema](https://github.com/Methuselah96).
|
|
||||||
-395
@@ -1,395 +0,0 @@
|
|||||||
// Last module patch version validated against: 3.0.0
|
|
||||||
|
|
||||||
import { Selection, ValueFn } from "d3-selection";
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
|
||||||
// Shared Type Definitions and Interfaces
|
|
||||||
// --------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DraggedElementBaseType serves as an alias for the 'minimal' data type which can be selected
|
|
||||||
* without 'd3-drag' (and related code in 'd3-selection') trying to use properties internally which would otherwise not
|
|
||||||
* be supported.
|
|
||||||
*/
|
|
||||||
export type DraggedElementBaseType = Element;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Container element type usable for mouse/touch functions
|
|
||||||
*/
|
|
||||||
export type DragContainerElement = HTMLElement | SVGSVGElement | SVGGElement; // HTMLElement includes HTMLCanvasElement
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The subject datum should at a minimum expose x and y properties, so that the relative position
|
|
||||||
* of the subject and the pointer can be preserved during the drag gesture.
|
|
||||||
*/
|
|
||||||
export interface SubjectPosition {
|
|
||||||
/**
|
|
||||||
* x-coordinate
|
|
||||||
*/
|
|
||||||
x: number;
|
|
||||||
/**
|
|
||||||
* y-coordinate
|
|
||||||
*/
|
|
||||||
y: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A D3 Drag Behavior
|
|
||||||
*
|
|
||||||
* The first generic refers to the type of element to be dragged.
|
|
||||||
* The second generic refers to the type of the datum of the dragged element.
|
|
||||||
* The third generic refers to the type of the drag behavior subject.
|
|
||||||
*
|
|
||||||
* The subject of a drag gesture represents the thing being dragged.
|
|
||||||
* It is computed when an initiating input event is received,
|
|
||||||
* such as a mousedown or touchstart, immediately before the drag gesture starts.
|
|
||||||
* The subject is then exposed as event.subject on subsequent drag events for this gesture.
|
|
||||||
*
|
|
||||||
* The default subject is the datum of the element in the originating selection (see drag)
|
|
||||||
* that received the initiating input event; if this datum is undefined,
|
|
||||||
* an object representing the coordinates of the pointer is created.
|
|
||||||
* When dragging circle elements in SVG, the default subject is thus the datum of the circle being dragged.
|
|
||||||
* With Canvas, the default subject is the canvas element’s datum (regardless of where on the canvas you click).
|
|
||||||
* In this case, a custom subject accessor would be more appropriate,
|
|
||||||
* such as one that picks the closest circle to the mouse within a given search radius.
|
|
||||||
*/
|
|
||||||
export interface DragBehavior<GElement extends DraggedElementBaseType, Datum, Subject> extends Function {
|
|
||||||
/**
|
|
||||||
* Applies the drag behavior to the selected elements.
|
|
||||||
* This function is typically not invoked directly, and is instead invoked via selection.call.
|
|
||||||
*
|
|
||||||
* For details see: {@link https://github.com/d3/d3-drag#_drag}
|
|
||||||
*
|
|
||||||
* @param selection A D3 selection of elements.
|
|
||||||
* @param args Optional arguments to be passed in.
|
|
||||||
*/
|
|
||||||
(selection: Selection<GElement, Datum, any, any>, ...args: any[]): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the current container accessor function.
|
|
||||||
*/
|
|
||||||
container(): ValueFn<GElement, Datum, DragContainerElement>;
|
|
||||||
/**
|
|
||||||
* Sets the container accessor to the specified function and returns the drag behavior.
|
|
||||||
*
|
|
||||||
* The container of a drag gesture determines the coordinate system of subsequent drag events, affecting event.x and event.y.
|
|
||||||
* The element returned by the container accessor is subsequently passed to d3.pointer to determine the local coordinates of the pointer.
|
|
||||||
*
|
|
||||||
* The default container accessor returns the parent node of the element in the originating selection (see drag)
|
|
||||||
* that received the initiating input event. This is often appropriate when dragging SVG or HTML elements,
|
|
||||||
* since those elements are typically positioned relative to a parent. For dragging graphical elements with a Canvas,
|
|
||||||
* however, you may want to redefine the container as the initiating element itself, using "this" in the accessor
|
|
||||||
* function.
|
|
||||||
*
|
|
||||||
* @param accessor A container accessor function which is evaluated for each selected element,
|
|
||||||
* in order, being passed the current datum (d), the current index (i), and the current group (nodes),
|
|
||||||
* with this as the current DOM element. The function returns the container element.
|
|
||||||
*/
|
|
||||||
container(accessor: ValueFn<GElement, Datum, DragContainerElement>): this;
|
|
||||||
/**
|
|
||||||
* Sets the container accessor to the specified object and returns the drag behavior.
|
|
||||||
*
|
|
||||||
* The container of a drag gesture determines the coordinate system of subsequent drag events, affecting event.x and event.y.
|
|
||||||
* The element returned by the container accessor is subsequently passed to d3.pointer to determine the local coordinates of the pointer.
|
|
||||||
*
|
|
||||||
* The default container accessor returns the parent node of the element in the originating selection (see drag)
|
|
||||||
* that received the initiating input event. This is often appropriate when dragging SVG or HTML elements,
|
|
||||||
* since those elements are typically positioned relative to a parent. For dragging graphical elements with a Canvas,
|
|
||||||
* however, you may want to redefine the container as the initiating element itself, such as drag.container(canvas).
|
|
||||||
*
|
|
||||||
* @param container Container element for the drag gesture.
|
|
||||||
*/
|
|
||||||
container(container: DragContainerElement): this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the current filter function.
|
|
||||||
*/
|
|
||||||
filter(): (this: GElement, event: any, d: Datum) => boolean;
|
|
||||||
/**
|
|
||||||
* Sets the event filter to the specified filter function and returns the drag behavior.
|
|
||||||
*
|
|
||||||
* If the filter returns falsey, the initiating event is ignored and no drag gesture is started.
|
|
||||||
* Thus, the filter determines which input events are ignored. The default filter ignores mousedown events on secondary buttons,
|
|
||||||
* since those buttons are typically intended for other purposes, such as the context menu.
|
|
||||||
*
|
|
||||||
* @param filterFn A filter function which is evaluated for each selected element,
|
|
||||||
* in order, being passed the current event (event) and datum d, with the this context as the current DOM element.
|
|
||||||
* The function returns a boolean value.
|
|
||||||
*/
|
|
||||||
filter(filterFn: (this: GElement, event: any, d: Datum) => boolean): this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the current touch support detector, which defaults to a function returning true,
|
|
||||||
* if the "ontouchstart" event is supported on the current element.
|
|
||||||
*/
|
|
||||||
touchable(): ValueFn<GElement, Datum, boolean>;
|
|
||||||
/**
|
|
||||||
* Sets the touch support detector to the specified boolean value and returns the drag behavior.
|
|
||||||
*
|
|
||||||
* Touch event listeners are only registered if the detector returns truthy for the corresponding element when the drag behavior is applied.
|
|
||||||
* The default detector works well for most browsers that are capable of touch input, but not all; Chrome’s mobile device emulator, for example,
|
|
||||||
* fails detection.
|
|
||||||
*
|
|
||||||
* @param touchable A boolean value. true when touch event listeners should be applied to the corresponding element, otherwise false.
|
|
||||||
*/
|
|
||||||
touchable(touchable: boolean): this;
|
|
||||||
/**
|
|
||||||
* Sets the touch support detector to the specified function and returns the drag behavior.
|
|
||||||
*
|
|
||||||
* Touch event listeners are only registered if the detector returns truthy for the corresponding element when the drag behavior is applied.
|
|
||||||
* The default detector works well for most browsers that are capable of touch input, but not all; Chrome’s mobile device emulator, for example,
|
|
||||||
* fails detection.
|
|
||||||
*
|
|
||||||
* @param touchable A touch support detector function, which returns true when touch event listeners should be applied to the corresponding element.
|
|
||||||
* The function is evaluated for each selected element to which the drag behavior was applied, in order, being passed the current datum (d),
|
|
||||||
* the current index (i), and the current group (nodes), with this as the current DOM element. The function returns a boolean value.
|
|
||||||
*/
|
|
||||||
touchable(touchable: ValueFn<GElement, Datum, boolean>): this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the current subject accessor functions.
|
|
||||||
*/
|
|
||||||
subject(): (this: GElement, event: any, d: Datum) => Subject;
|
|
||||||
/**
|
|
||||||
* Sets the subject accessor to the specified function and returns the drag behavior.
|
|
||||||
*
|
|
||||||
* The subject of a drag gesture represents the thing being dragged.
|
|
||||||
* It is computed when an initiating input event is received,
|
|
||||||
* such as a mousedown or touchstart, immediately before the drag gesture starts.
|
|
||||||
* The subject is then exposed as event.subject on subsequent drag events for this gesture.
|
|
||||||
*
|
|
||||||
* The default subject is the datum of the element in the originating selection (see drag)
|
|
||||||
* that received the initiating input event; if this datum is undefined,
|
|
||||||
* an object representing the coordinates of the pointer is created.
|
|
||||||
* When dragging circle elements in SVG, the default subject is thus the datum of the circle being dragged.
|
|
||||||
* With Canvas, the default subject is the canvas element’s datum (regardless of where on the canvas you click).
|
|
||||||
* In this case, a custom subject accessor would be more appropriate,
|
|
||||||
* such as one that picks the closest circle to the mouse within a given search radius.
|
|
||||||
*
|
|
||||||
* The subject of a drag gesture may not be changed after the gesture starts.
|
|
||||||
*
|
|
||||||
* During the evaluation of the subject accessor, event is a beforestart drag event.
|
|
||||||
* Use event.sourceEvent to access the initiating input event and event.identifier to access the touch identifier.
|
|
||||||
* The event.x and event.y are relative to the container, and are computed using d3.pointer.
|
|
||||||
*
|
|
||||||
* @param accessor An extent accessor function which is evaluated for each selected element,
|
|
||||||
* in order, being passed the current event (`event`) and datum `d`, with the `this` context as the current DOM element.
|
|
||||||
* The returned subject should be an object that exposes x and y properties,
|
|
||||||
* so that the relative position of the subject and the pointer can be preserved during the drag gesture.
|
|
||||||
* If the subject is null or undefined, no drag gesture is started for this pointer;
|
|
||||||
* however, other starting touches may yet start drag gestures.
|
|
||||||
*/
|
|
||||||
subject(accessor: (this: GElement, event: any, d: Datum) => Subject): this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the current click distance threshold, which defaults to zero.
|
|
||||||
*/
|
|
||||||
clickDistance(): number;
|
|
||||||
/**
|
|
||||||
* Set the maximum distance that the mouse can move between mousedown and mouseup that will trigger
|
|
||||||
* a subsequent click event. If at any point between mousedown and mouseup the mouse is greater than or equal to
|
|
||||||
* distance from its position on mousedown, the click event following mouseup will be suppressed.
|
|
||||||
*
|
|
||||||
* @param distance The distance threshold between mousedown and mouseup measured in client coordinates (event.clientX and event.clientY).
|
|
||||||
* The default is zero.
|
|
||||||
*/
|
|
||||||
clickDistance(distance: number): this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the first currently-assigned listener matching the specified typenames, if any.
|
|
||||||
*
|
|
||||||
* @param typenames The typenames is a string containing one or more typename separated by whitespace.
|
|
||||||
* Each typename is a type, optionally followed by a period (.) and a name, such as "drag.foo"" and "drag.bar";
|
|
||||||
* the name allows multiple listeners to be registered for the same type. The type must be one of the following:
|
|
||||||
* start (after a new pointer becomes active [on mousedown or touchstart]), drag (after an active pointer moves [on mousemove or touchmove], or
|
|
||||||
* end (after an active pointer becomes inactive [on mouseup, touchend or touchcancel].)
|
|
||||||
*/
|
|
||||||
on(typenames: string): ((this: GElement, event: any, d: Datum) => void) | undefined;
|
|
||||||
/**
|
|
||||||
* Remove the current event listeners for the specified typenames, if any, return the drag behavior.
|
|
||||||
*
|
|
||||||
* @param typenames The typenames is a string containing one or more typename separated by whitespace.
|
|
||||||
* Each typename is a type, optionally followed by a period (.) and a name, such as "drag.foo"" and "drag.bar";
|
|
||||||
* the name allows multiple listeners to be registered for the same type. The type must be one of the following:
|
|
||||||
* start (after a new pointer becomes active [on mousedown or touchstart]), drag (after an active pointer moves [on mousemove or touchmove], or
|
|
||||||
* end (after an active pointer becomes inactive [on mouseup, touchend or touchcancel].)
|
|
||||||
* @param listener Use null to remove the listener.
|
|
||||||
*/
|
|
||||||
on(typenames: string, listener: null): this;
|
|
||||||
/**
|
|
||||||
* Set the event listener for the specified typenames and return the drag behavior.
|
|
||||||
* If an event listener was already registered for the same type and name,
|
|
||||||
* the existing listener is removed before the new listener is added.
|
|
||||||
* When a specified event is dispatched, each listener will be invoked with the same context and arguments as selection.on listeners.
|
|
||||||
*
|
|
||||||
* Changes to registered listeners via drag.on during a drag gesture do not affect the current drag gesture.
|
|
||||||
* Instead, you must use event.on, which also allows you to register temporary event listeners for the current drag gesture.
|
|
||||||
* Separate events are dispatched for each active pointer during a drag gesture.
|
|
||||||
* For example, if simultaneously dragging multiple subjects with multiple fingers, a start event is dispatched for each finger,
|
|
||||||
* even if both fingers start touching simultaneously.
|
|
||||||
*
|
|
||||||
* @param typenames The typenames is a string containing one or more typename separated by whitespace.
|
|
||||||
* Each typename is a type, optionally followed by a period (.) and a name, such as "drag.foo"" and "drag.bar";
|
|
||||||
* the name allows multiple listeners to be registered for the same type. The type must be one of the following:
|
|
||||||
* start (after a new pointer becomes active [on mousedown or touchstart]), drag (after an active pointer moves [on mousemove or touchmove], or
|
|
||||||
* end (after an active pointer becomes inactive [on mouseup, touchend or touchcancel].)
|
|
||||||
* @param listener An event listener function which is evaluated for each selected element,
|
|
||||||
* in order, being passed the current event (event) and datum d, with the this context as the current DOM element.
|
|
||||||
*/
|
|
||||||
on(typenames: string, listener: (this: GElement, event: any, d: Datum) => void): this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new drag behavior. The returned behavior, drag, is both an object and a function, and is
|
|
||||||
* typically applied to selected elements via selection.call.
|
|
||||||
*
|
|
||||||
* Use this signature when using the default subject accessor.
|
|
||||||
*
|
|
||||||
* The first generic refers to the type of element to be dragged.
|
|
||||||
* The second generic refers to the type of the datum of the dragged element.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
||||||
export function drag<GElement extends DraggedElementBaseType, Datum>(): DragBehavior<
|
|
||||||
GElement,
|
|
||||||
Datum,
|
|
||||||
Datum | SubjectPosition
|
|
||||||
>;
|
|
||||||
/**
|
|
||||||
* Creates a new drag behavior. The returned behavior, drag, is both an object and a function, and is
|
|
||||||
* typically applied to selected elements via selection.call.
|
|
||||||
*
|
|
||||||
* Use this signature when using a custom subject accessor.
|
|
||||||
*
|
|
||||||
* The first generic refers to the type of element to be dragged.
|
|
||||||
* The second generic refers to the type of the datum of the dragged element.
|
|
||||||
* The third generic refers to the type of the drag behavior subject.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
||||||
export function drag<GElement extends DraggedElementBaseType, Datum, Subject>(): DragBehavior<GElement, Datum, Subject>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* D3 Drag event
|
|
||||||
*
|
|
||||||
* The first generic refers to the type of element to be dragged.
|
|
||||||
* The second generic refers to the type of the datum of the dragged element.
|
|
||||||
* The third generic refers to the type of the drag behavior subject.
|
|
||||||
*/
|
|
||||||
export interface D3DragEvent<GElement extends DraggedElementBaseType, Datum, Subject> {
|
|
||||||
/**
|
|
||||||
* The DragBehavior associated with the event
|
|
||||||
*/
|
|
||||||
target: DragBehavior<GElement, Datum, Subject>;
|
|
||||||
/**
|
|
||||||
* The event type for the DragEvent
|
|
||||||
*/
|
|
||||||
type: "start" | "drag" | "end" | string; // Leave failsafe string type for cases like 'drag.foo'
|
|
||||||
/**
|
|
||||||
* The drag subject, defined by drag.subject.
|
|
||||||
*/
|
|
||||||
subject: Subject;
|
|
||||||
/**
|
|
||||||
* The new x-coordinate of the subject, relative to the container
|
|
||||||
*/
|
|
||||||
x: number;
|
|
||||||
/**
|
|
||||||
* The new y-coordinate of the subject, relative to the container
|
|
||||||
*/
|
|
||||||
y: number;
|
|
||||||
/**
|
|
||||||
* The change in x-coordinate since the previous drag event.
|
|
||||||
*/
|
|
||||||
dx: number;
|
|
||||||
/**
|
|
||||||
* The change in y-coordinate since the previous drag event.
|
|
||||||
*/
|
|
||||||
dy: number;
|
|
||||||
/**
|
|
||||||
* The string “mouse”, or a numeric touch identifier.
|
|
||||||
*/
|
|
||||||
identifier: "mouse" | number;
|
|
||||||
/**
|
|
||||||
* The number of currently active drag gestures (on start and end, not including this one).
|
|
||||||
*
|
|
||||||
* The event.active field is useful for detecting the first start event and the last end event
|
|
||||||
* in a sequence of concurrent drag gestures: it is zero when the first drag gesture starts,
|
|
||||||
* and zero when the last drag gesture ends.
|
|
||||||
*/
|
|
||||||
active: number;
|
|
||||||
/**
|
|
||||||
* The underlying input event, such as mousemove or touchmove.
|
|
||||||
*/
|
|
||||||
sourceEvent: any;
|
|
||||||
/**
|
|
||||||
* Return the first currently-assigned listener matching the specified typenames, if any.
|
|
||||||
*
|
|
||||||
* Equivalent to drag.on, but only applies to the current drag gesture. Before the drag gesture starts,
|
|
||||||
* a copy of the current drag event listeners is made. This copy is bound to the current drag gesture
|
|
||||||
* and modified by event.on. This is useful for temporary listeners that only receive events for the current drag gesture.
|
|
||||||
*
|
|
||||||
* @param typenames The typenames is a string containing one or more typename separated by whitespace.
|
|
||||||
* Each typename is a type, optionally followed by a period (.) and a name, such as "drag.foo"" and "drag.bar";
|
|
||||||
* the name allows multiple listeners to be registered for the same type. The type must be one of the following:
|
|
||||||
* start (after a new pointer becomes active [on mousedown or touchstart]), drag (after an active pointer moves [on mousemove or touchmove], or
|
|
||||||
* end (after an active pointer becomes inactive [on mouseup, touchend or touchcancel].)
|
|
||||||
*/
|
|
||||||
on(typenames: string): ((this: GElement, event: any, d: Datum) => void) | undefined;
|
|
||||||
/**
|
|
||||||
* Remove the current event listeners for the specified typenames, if any, return the drag behavior.
|
|
||||||
*
|
|
||||||
* Equivalent to drag.on, but only applies to the current drag gesture. Before the drag gesture starts,
|
|
||||||
* a copy of the current drag event listeners is made. This copy is bound to the current drag gesture
|
|
||||||
* and modified by event.on. This is useful for temporary listeners that only receive events for the current drag gesture.
|
|
||||||
*
|
|
||||||
* @param typenames The typenames is a string containing one or more typename separated by whitespace.
|
|
||||||
* Each typename is a type, optionally followed by a period (.) and a name, such as "drag.foo"" and "drag.bar";
|
|
||||||
* the name allows multiple listeners to be registered for the same type. The type must be one of the following:
|
|
||||||
* start (after a new pointer becomes active [on mousedown or touchstart]), drag (after an active pointer moves [on mousemove or touchmove], or
|
|
||||||
* end (after an active pointer becomes inactive [on mouseup, touchend or touchcancel].)
|
|
||||||
* @param listener Use null to remove the listener.
|
|
||||||
*/
|
|
||||||
on(typenames: string, listener: null): this;
|
|
||||||
/**
|
|
||||||
* Set the event listener for the specified typenames and return the drag behavior.
|
|
||||||
* If an event listener was already registered for the same type and name,
|
|
||||||
* the existing listener is removed before the new listener is added.
|
|
||||||
* When a specified event is dispatched, each listener will be invoked with the same context and arguments as selection.on listeners.
|
|
||||||
*
|
|
||||||
* Equivalent to drag.on, but only applies to the current drag gesture. Before the drag gesture starts,
|
|
||||||
* a copy of the current drag event listeners is made. This copy is bound to the current drag gesture
|
|
||||||
* and modified by event.on. This is useful for temporary listeners that only receive events for the current drag gesture.
|
|
||||||
*
|
|
||||||
* @param typenames The typenames is a string containing one or more typename separated by whitespace.
|
|
||||||
* Each typename is a type, optionally followed by a period (.) and a name, such as "drag.foo"" and "drag.bar";
|
|
||||||
* the name allows multiple listeners to be registered for the same type. The type must be one of the following:
|
|
||||||
* start (after a new pointer becomes active [on mousedown or touchstart]), drag (after an active pointer moves [on mousemove or touchmove], or
|
|
||||||
* end (after an active pointer becomes inactive [on mouseup, touchend or touchcancel].)
|
|
||||||
* @param listener An event listener function which is evaluated for each selected element,
|
|
||||||
* in order, being passed the current event (event) and datum d, with the this context as the current DOM element.
|
|
||||||
*/
|
|
||||||
on(typenames: string, listener: (this: GElement, event: any, d: Datum) => void): this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prevents native drag-and-drop and text selection on the specified window.
|
|
||||||
* As an alternative to preventing the default action of mousedown events,
|
|
||||||
* this method prevents undesirable default actions following mousedown. In supported browsers,
|
|
||||||
* this means capturing dragstart and selectstart events, preventing the associated default actions,
|
|
||||||
* and immediately stopping their propagation. In browsers that do not support selection events,
|
|
||||||
* the user-select CSS property is set to none on the document element.
|
|
||||||
* This method is intended to be called on mousedown, followed by d3.dragEnable on mouseup.
|
|
||||||
*
|
|
||||||
* @param window The window for which drag should be disabled.
|
|
||||||
*/
|
|
||||||
export function dragDisable(window: Window): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allows native drag-and-drop and text selection on the specified window; undoes the effect of d3.dragDisable.
|
|
||||||
* This method is intended to be called on mouseup, preceded by d3.dragDisable on mousedown.
|
|
||||||
* If noclick is true, this method also temporarily suppresses click events.
|
|
||||||
* The suppression of click events expires after a zero-millisecond timeout,
|
|
||||||
* such that it only suppress the click event that would immediately follow the current mouseup event, if any.
|
|
||||||
*
|
|
||||||
* @param window The window for which drag should be (re-)enabled.
|
|
||||||
* @param noClick An optional flag. If noclick is true, this method also temporarily suppresses click events.
|
|
||||||
*/
|
|
||||||
export function dragEnable(window: Window, noClick?: boolean): void;
|
|
||||||
-42
@@ -1,42 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@types/d3-drag",
|
|
||||||
"version": "3.0.7",
|
|
||||||
"description": "TypeScript definitions for d3-drag",
|
|
||||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/d3-drag",
|
|
||||||
"license": "MIT",
|
|
||||||
"contributors": [
|
|
||||||
{
|
|
||||||
"name": "Tom Wanzek",
|
|
||||||
"githubUsername": "tomwanzek",
|
|
||||||
"url": "https://github.com/tomwanzek"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Alex Ford",
|
|
||||||
"githubUsername": "gustavderdrache",
|
|
||||||
"url": "https://github.com/gustavderdrache"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Boris Yankov",
|
|
||||||
"githubUsername": "borisyankov",
|
|
||||||
"url": "https://github.com/borisyankov"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Nathan Bierema",
|
|
||||||
"githubUsername": "Methuselah96",
|
|
||||||
"url": "https://github.com/Methuselah96"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"main": "",
|
|
||||||
"types": "index.d.ts",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
|
||||||
"directory": "types/d3-drag"
|
|
||||||
},
|
|
||||||
"scripts": {},
|
|
||||||
"dependencies": {
|
|
||||||
"@types/d3-selection": "*"
|
|
||||||
},
|
|
||||||
"typesPublisherContentHash": "cbd098773821019893d7397be4129e19f5b62205943d423ef95a612ec9c9eac6",
|
|
||||||
"typeScriptVersion": "4.5"
|
|
||||||
}
|
|
||||||
-21
@@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) Microsoft Corporation.
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE
|
|
||||||
-15
@@ -1,15 +0,0 @@
|
|||||||
# Installation
|
|
||||||
> `npm install --save @types/d3-interpolate`
|
|
||||||
|
|
||||||
# Summary
|
|
||||||
This package contains type definitions for d3-interpolate (https://github.com/d3/d3-interpolate/).
|
|
||||||
|
|
||||||
# Details
|
|
||||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/d3-interpolate.
|
|
||||||
|
|
||||||
### Additional Details
|
|
||||||
* Last updated: Tue, 07 Nov 2023 15:11:37 GMT
|
|
||||||
* Dependencies: [@types/d3-color](https://npmjs.com/package/@types/d3-color)
|
|
||||||
|
|
||||||
# Credits
|
|
||||||
These definitions were written by [Tom Wanzek](https://github.com/tomwanzek), [Alex Ford](https://github.com/gustavderdrache), [Boris Yankov](https://github.com/borisyankov), [denisname](https://github.com/denisname), and [Nathan Bierema](https://github.com/Methuselah96).
|
|
||||||
-387
@@ -1,387 +0,0 @@
|
|||||||
// Last module patch version validated against: 3.0.1
|
|
||||||
|
|
||||||
import { ColorCommonInstance } from "d3-color";
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
// Shared Type Definitions and Interfaces
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export interface ZoomInterpolator extends Function {
|
|
||||||
(t: number): ZoomView;
|
|
||||||
/**
|
|
||||||
* Recommended duration of zoom transition in milliseconds.
|
|
||||||
*/
|
|
||||||
duration: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Given a zoom interpolator, returns a new zoom interpolator using the specified curvature rho.
|
|
||||||
* When rho is close to 0, the interpolator is almost linear.
|
|
||||||
* The default curvature is sqrt(2).
|
|
||||||
* @param rho
|
|
||||||
*/
|
|
||||||
rho(rho: number): this;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ColorGammaInterpolationFactory extends Function {
|
|
||||||
(a: string | ColorCommonInstance, b: string | ColorCommonInstance): (t: number) => string;
|
|
||||||
/**
|
|
||||||
* Returns a new interpolator factory of the same type using the specified *gamma*.
|
|
||||||
* For example, to interpolate from purple to orange with a gamma of 2.2 in RGB space: `d3.interpolateRgb.gamma(2.2)("purple", "orange")`.
|
|
||||||
* See Eric Brasseur’s article, [Gamma error in picture scaling](https://web.archive.org/web/20160112115812/http://www.4p8.com/eric.brasseur/gamma.html), for more on gamma correction.
|
|
||||||
*/
|
|
||||||
gamma(g: number): ColorGammaInterpolationFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Type zoomView is used to represent a numeric array with three elements.
|
|
||||||
* In order of appearance the elements correspond to:
|
|
||||||
* - cx: *x*-coordinate of the center of the viewport
|
|
||||||
* - cy: *y*-coordinate of the center of the viewport
|
|
||||||
* - width: size of the viewport
|
|
||||||
*/
|
|
||||||
export type ZoomView = [number, number, number];
|
|
||||||
|
|
||||||
export type TypedArray =
|
|
||||||
| Int8Array
|
|
||||||
| Uint8Array
|
|
||||||
| Int16Array
|
|
||||||
| Uint16Array
|
|
||||||
| Int32Array
|
|
||||||
| Uint32Array
|
|
||||||
| Uint8ClampedArray
|
|
||||||
| Float32Array
|
|
||||||
| Float64Array;
|
|
||||||
|
|
||||||
export type NumberArray = TypedArray | DataView;
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
// Interpolation Function Factories
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an `null` constant interpolator.
|
|
||||||
*/
|
|
||||||
export function interpolate(a: any, b: null): (t: number) => null;
|
|
||||||
/**
|
|
||||||
* Returns an boolean constant interpolator of value `b`.
|
|
||||||
*/
|
|
||||||
export function interpolate(a: any, b: boolean): (t: number) => boolean;
|
|
||||||
/**
|
|
||||||
* Returns a `interpolateRgb` interpolator.
|
|
||||||
*/
|
|
||||||
export function interpolate(a: string | ColorCommonInstance, b: ColorCommonInstance): (t: number) => string;
|
|
||||||
/**
|
|
||||||
* Returns a `interpolateDate` interpolator.
|
|
||||||
*/
|
|
||||||
export function interpolate(a: Date, b: Date): (t: number) => Date;
|
|
||||||
/**
|
|
||||||
* Returns a `interpolateNumber` interpolator.
|
|
||||||
*/
|
|
||||||
export function interpolate(
|
|
||||||
a: number | { valueOf(): number },
|
|
||||||
b: number | { valueOf(): number },
|
|
||||||
): (t: number) => number;
|
|
||||||
/**
|
|
||||||
* Returns a `interpolateNumberArray` interpolator.
|
|
||||||
*/
|
|
||||||
export function interpolate<T extends NumberArray>(a: NumberArray | number[], b: T): (t: number) => T;
|
|
||||||
/**
|
|
||||||
* Returns a `interpolateString` interpolator. If `b` is a string coercible to a color use use `interpolateRgb`.
|
|
||||||
*/
|
|
||||||
export function interpolate(a: string | { toString(): string }, b: string): (t: number) => string;
|
|
||||||
/**
|
|
||||||
* Returns a `interpolateArray` interpolator.
|
|
||||||
*/
|
|
||||||
export function interpolate<U extends any[]>(a: any[], b: U): (t: number) => U;
|
|
||||||
/**
|
|
||||||
* Returns a `interpolateObject` interpolator.
|
|
||||||
*/
|
|
||||||
export function interpolate<U extends object>(a: any, b: U): (t: number) => U;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an interpolator between the two numbers `a` and `b`.
|
|
||||||
* The returned interpolator is equivalent to: `(t) => a * (1 - t) + b * t`.
|
|
||||||
*/
|
|
||||||
export function interpolateNumber(
|
|
||||||
a: number | { valueOf(): number },
|
|
||||||
b: number | { valueOf(): number },
|
|
||||||
): (t: number) => number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an interpolator between the two numbers `a` and `b`; the interpolator is similar to `interpolateNumber`,
|
|
||||||
* except it will round the resulting value to the nearest integer.
|
|
||||||
*/
|
|
||||||
export function interpolateRound(
|
|
||||||
a: number | { valueOf(): number },
|
|
||||||
b: number | { valueOf(): number },
|
|
||||||
): (t: number) => number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an interpolator between the two strings `a` and `b`.
|
|
||||||
* The string interpolator finds numbers embedded in `a` and `b`, where each number is of the form understood by JavaScript.
|
|
||||||
* A few examples of numbers that will be detected within a string: `-1`, `42`, `3.14159`, and `6.0221413e+23`.
|
|
||||||
*
|
|
||||||
* For each number embedded in `b`, the interpolator will attempt to find a corresponding number in `a`.
|
|
||||||
* If a corresponding number is found, a numeric interpolator is created using `interpolateNumber`.
|
|
||||||
* The remaining parts of the string `b` are used as a template.
|
|
||||||
*
|
|
||||||
* For example, if `a` is `"300 12px sans-serif"`, and `b` is `"500 36px Comic-Sans"`, two embedded numbers are found.
|
|
||||||
* The remaining static parts (of string `b`) are a space between the two numbers (`" "`), and the suffix (`"px Comic-Sans"`).
|
|
||||||
* The result of the interpolator at `t` = 0.5 is `"400 24px Comic-Sans"`.
|
|
||||||
*/
|
|
||||||
export function interpolateString(
|
|
||||||
a: string | { toString(): string },
|
|
||||||
b: string | { toString(): string },
|
|
||||||
): (t: number) => string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an interpolator between the two dates `a` and `b`.
|
|
||||||
*
|
|
||||||
* Note: *no defensive copy* of the returned date is created; the same Date instance is returned for every evaluation of the interpolator.
|
|
||||||
* No copy is made for performance reasons; interpolators are often part of the inner loop of animated transitions.
|
|
||||||
*/
|
|
||||||
export function interpolateDate(a: Date, b: Date): (t: number) => Date;
|
|
||||||
|
|
||||||
export type ArrayInterpolator<A extends any[]> = (t: number) => A;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an interpolator between the two arrays `a` and `b`. Internally, an array template is created that is the same length in `b`.
|
|
||||||
* For each element in `b`, if there exists a corresponding element in `a`, a generic interpolator is created for the two elements using `interpolate`.
|
|
||||||
* If there is no such element, the static value from `b` is used in the template.
|
|
||||||
* Then, for the given parameter `t`, the template’s embedded interpolators are evaluated. The updated array template is then returned.
|
|
||||||
*
|
|
||||||
* For example, if `a` is the array `[0, 1]` and `b` is the array `[1, 10, 100]`, then the result of the interpolator for `t = 0.5` is the array `[0.5, 5.5, 100]`.
|
|
||||||
*
|
|
||||||
* Note: *no defensive copy* of the template array is created; modifications of the returned array may adversely affect subsequent evaluation of the interpolator.
|
|
||||||
* No copy is made for performance reasons; interpolators are often part of the inner loop of animated transitions.
|
|
||||||
*/
|
|
||||||
export function interpolateArray<A extends any[]>(a: any[], b: A): ArrayInterpolator<A>;
|
|
||||||
/**
|
|
||||||
* interpolateNumberArray is called
|
|
||||||
*/
|
|
||||||
export function interpolateArray<T extends NumberArray>(a: NumberArray | number[], b: T): (t: number) => T;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an interpolator between the two arrays of numbers a and b.
|
|
||||||
* Internally, an array template is created that is the same type and length as b.
|
|
||||||
* For each element in b, if there exists a corresponding element in a, the values are directly interpolated in the array template.
|
|
||||||
* If there is no such element, the static value from b is copied.
|
|
||||||
* The updated array template is then returned.
|
|
||||||
*
|
|
||||||
* Note: For performance reasons, no defensive copy is made of the template array and the arguments a and b; modifications of these arrays may affect subsequent evaluation of the interpolator.
|
|
||||||
*/
|
|
||||||
export function interpolateNumberArray<T extends NumberArray | number[]>(
|
|
||||||
a: NumberArray | number[],
|
|
||||||
b: T,
|
|
||||||
): (t: number) => T;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an interpolator between the two objects `a` and `b`. Internally, an object template is created that has the same properties as `b`.
|
|
||||||
* For each property in `b`, if there exists a corresponding property in `a`, a generic interpolator is created for the two elements using `interpolate`.
|
|
||||||
* If there is no such property, the static value from `b` is used in the template.
|
|
||||||
* Then, for the given parameter `t`, the template's embedded interpolators are evaluated and the updated object template is then returned.
|
|
||||||
*
|
|
||||||
* For example, if `a` is the object `{x: 0, y: 1}` and `b` is the object `{x: 1, y: 10, z: 100}`, the result of the interpolator for `t = 0.5` is the object `{x: 0.5, y: 5.5, z: 100}`.
|
|
||||||
*
|
|
||||||
* Note: *no defensive copy* of the template object is created; modifications of the returned object may adversely affect subsequent evaluation of the interpolator.
|
|
||||||
* No copy is made for performance reasons; interpolators are often part of the inner loop of animated transitions.
|
|
||||||
*/
|
|
||||||
export function interpolateObject<U extends object>(a: any, b: U): (t: number) => U;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an interpolator between the two 2D CSS transforms represented by `a` and `b`.
|
|
||||||
* Each transform is decomposed to a standard representation of translate, rotate, *x*-skew and scale; these component transformations are then interpolated.
|
|
||||||
* This behavior is standardized by CSS: see [matrix decomposition for animation](http://www.w3.org/TR/css3-2d-transforms/#matrix-decomposition).
|
|
||||||
*/
|
|
||||||
export function interpolateTransformCss(a: string, b: string): (t: number) => string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an interpolator between the two 2D SVG transforms represented by `a` and `b`.
|
|
||||||
* Each transform is decomposed to a standard representation of translate, rotate, *x*-skew and scale; these component transformations are then interpolated.
|
|
||||||
* This behavior is standardized by CSS: see [matrix decomposition for animation](http://www.w3.org/TR/css3-2d-transforms/#matrix-decomposition).
|
|
||||||
*/
|
|
||||||
export function interpolateTransformSvg(a: string, b: string): (t: number) => string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an interpolator between the two views `a` and `b` of a two-dimensional plane,
|
|
||||||
* based on [“Smooth and efficient zooming and panning”](http://www.win.tue.nl/~vanwijk/zoompan.pdf).
|
|
||||||
* Each view is defined as an array of three numbers: *cx*, *cy* and *width*.
|
|
||||||
* The first two coordinates *cx*, *cy* represent the center of the viewport; the last coordinate *width* represents the size of the viewport.
|
|
||||||
*
|
|
||||||
* The returned interpolator exposes a *duration* property which encodes the recommended transition duration in milliseconds.
|
|
||||||
* This duration is based on the path length of the curved trajectory through *x,y* space.
|
|
||||||
* If you want to a slower or faster transition, multiply this by an arbitrary scale factor (*V* as described in the original paper).
|
|
||||||
*/
|
|
||||||
export function interpolateZoom(a: ZoomView, b: ZoomView): ZoomInterpolator;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a discrete interpolator for the given array of values. The returned interpolator maps `t` in `[0, 1 / n)` to values[0],
|
|
||||||
* `t` in `[1 / n, 2 / n)` to `values[1]`, and so on, where `n = values.length`. In effect, this is a lightweight quantize scale with a fixed domain of [0, 1].
|
|
||||||
*/
|
|
||||||
export function interpolateDiscrete<T>(values: T[]): (t: number) => T;
|
|
||||||
|
|
||||||
// Sampling ------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns `n` uniformly-spaced samples from the specified `interpolator`, where `n` is an integer greater than one.
|
|
||||||
* The first sample is always at `t = 0`, and the last sample is always at `t = 1`.
|
|
||||||
* This can be useful in generating a fixed number of samples from a given interpolator,
|
|
||||||
* such as to derive the range of a [quantize scale](https://github.com/d3/d3-scale#quantize-scales) from a [continuous interpolator](https://github.com/d3/d3-scale#interpolateWarm).
|
|
||||||
*
|
|
||||||
* Caution: this method will not work with interpolators that do not return defensive copies of their output,
|
|
||||||
* such as `d3.interpolateArray`, `d3.interpolateDate` and `d3.interpolateObject`. For those interpolators, you must wrap the interpolator and create a copy for each returned value.
|
|
||||||
*/
|
|
||||||
export function quantize<T>(interpolator: (t: number) => T, n: number): T[];
|
|
||||||
|
|
||||||
// Color Spaces
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an RGB color space interpolator between the two colors `a` and `b` with a configurable gamma. If the gamma is not specified, it defaults to 1.0.
|
|
||||||
* The colors `a` and `b` need not be in RGB; they will be converted to RGB using [`d3.rgb`](https://github.com/d3/d3-color#rgb). The return value of the interpolator is an RGB string.
|
|
||||||
*/
|
|
||||||
export const interpolateRgb: ColorGammaInterpolationFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a uniform nonrational B-spline interpolator through the specified array of *colors*, which are converted to RGB color space.
|
|
||||||
* Implicit control points are generated such that the interpolator returns `colors[0]` at `t = 0` and `colors[colors.length - 1]` at `t = 1`.
|
|
||||||
* Opacity interpolation is not currently supported. See also `d3.interpolateBasis`, and see [d3-scale-chromatic](https://github.com/d3/d3-scale-chromatic) for examples.
|
|
||||||
*/
|
|
||||||
export function interpolateRgbBasis(colors: Array<string | ColorCommonInstance>): (t: number) => string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a uniform nonrational B-spline interpolator through the specified array of colors, which are converted to RGB color space.
|
|
||||||
* The control points are implicitly repeated such that the resulting spline has cyclical C² continuity when repeated around `t` in [0,1];
|
|
||||||
* this is useful, for example, to create cyclical color scales. Opacity interpolation is not currently supported.
|
|
||||||
* See also `d3.interpolateBasisClosed, and see [d3-scale-chromatic](https://github.com/d3/d3-scale-chromatic) for examples.
|
|
||||||
*/
|
|
||||||
export function interpolateRgbBasisClosed(colors: Array<string | ColorCommonInstance>): (t: number) => string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an HSL color space interpolator between the two colors *a* and *b*. The colors *a* and *b* need not be in HSL;
|
|
||||||
* they will be converted to HSL using `d3.hsl`. If either color’s hue or saturation is NaN, the opposing color’s channel value is used.
|
|
||||||
* The shortest path between hues is used. The return value of the interpolator is an RGB string.
|
|
||||||
*/
|
|
||||||
export function interpolateHsl(a: string | ColorCommonInstance, b: string | ColorCommonInstance): (t: number) => string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Like `interpolateHsl`, but does not use the shortest path between hues.
|
|
||||||
*/
|
|
||||||
export function interpolateHslLong(
|
|
||||||
a: string | ColorCommonInstance,
|
|
||||||
b: string | ColorCommonInstance,
|
|
||||||
): (t: number) => string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a Lab color space interpolator between the two colors *a* and *b*. The colors *a* and *b* need not be in Lab;
|
|
||||||
* they will be converted to Lab using `d3.lab`. The return value of the interpolator is an RGB string.
|
|
||||||
*/
|
|
||||||
export function interpolateLab(a: string | ColorCommonInstance, b: string | ColorCommonInstance): (t: number) => string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an HCL color space interpolator between the two colors `a` and `b`. The colors `a` and `b` need not be in HCL;
|
|
||||||
* they will be converted to HCL using `d3.hcl`. If either color’s hue or chroma is NaN, the opposing color’s channel value is used.
|
|
||||||
* The shortest path between hues is used. The return value of the interpolator is an RGB string.
|
|
||||||
*/
|
|
||||||
export function interpolateHcl(a: string | ColorCommonInstance, b: string | ColorCommonInstance): (t: number) => string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Like `interpolateHcl`, but does not use the shortest path between hues.
|
|
||||||
*/
|
|
||||||
export function interpolateHclLong(
|
|
||||||
a: string | ColorCommonInstance,
|
|
||||||
b: string | ColorCommonInstance,
|
|
||||||
): (t: number) => string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a Cubehelix color space interpolator between the two colors `a` and `b` using a configurable `gamma`.
|
|
||||||
* If the gamma is not specified, it defaults to 1.0. The colors `a` and `b` need not be in Cubehelix;
|
|
||||||
* they will be converted to Cubehelix using [`d3.cubehelix`](https://github.com/d3/d3-color#cubehelix).
|
|
||||||
* If either color’s hue or saturation is NaN, the opposing color’s channel value is used. The shortest path between hues is used. The return value of the interpolator is an RGB string.
|
|
||||||
*/
|
|
||||||
export const interpolateCubehelix: ColorGammaInterpolationFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Like `interpolateCubehelix`, but does not use the shortest path between hues.
|
|
||||||
*/
|
|
||||||
export const interpolateCubehelixLong: ColorGammaInterpolationFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an interpolator between the two hue angles `a` and `b`. If either hue is NaN, the opposing value is used.
|
|
||||||
* The shortest path between hues is used. The return value of the interpolator is a number in `[0, 360)`.
|
|
||||||
*/
|
|
||||||
export function interpolateHue(a: number, b: number): (t: number) => number;
|
|
||||||
|
|
||||||
// Splines -------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a uniform nonrational B-spline interpolator through the specified array of `values`, which must be numbers.
|
|
||||||
* Implicit control points are generated such that the interpolator returns `values[0]` at `t` = 0 and `values[values.length - 1]` at `t` = 1.
|
|
||||||
* See also [`d3.curveBasis`](https://github.com/d3/d3-shape#curveBasis).
|
|
||||||
*/
|
|
||||||
export function interpolateBasis(splineNodes: number[]): (t: number) => number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a uniform nonrational B-spline interpolator through the specified array of `values`, which must be numbers.
|
|
||||||
* The control points are implicitly repeated such that the resulting one-dimensional spline has cyclical C² continuity when repeated around `t` in [0,1].
|
|
||||||
* See also [`d3.curveBasisClosed`](https://github.com/d3/d3-shape#curveBasisClosed).
|
|
||||||
*/
|
|
||||||
export function interpolateBasisClosed(splineNodes: number[]): (t: number) => number;
|
|
||||||
|
|
||||||
// Piecewise -----------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a piecewise zoom interpolator, composing zoom interpolators for each adjacent pair of zoom view.
|
|
||||||
* The returned interpolator maps `t` in `[0, 1 / (n - 1)]` to `interpolate(values[0], values[1])`, `t` in `[1 / (n - 1), 2 / (n - 1)]` to `interpolate(values[1], values[2])`,
|
|
||||||
* and so on, where `n = values.length`. In effect, this is a lightweight linear scale.
|
|
||||||
* For example, to blend through three different zoom views: `d3.piecewise(d3.interpolateZoom, [[0, 0, 1], [0, 0, 10], [0, 0, 15]])`.
|
|
||||||
*
|
|
||||||
* interpolate defaults to d3.interpolate.
|
|
||||||
*/
|
|
||||||
export function piecewise(values: ZoomView[]): ZoomInterpolator;
|
|
||||||
/**
|
|
||||||
* Returns a piecewise zoom interpolator, composing zoom interpolators for each adjacent pair of zoom view.
|
|
||||||
* The returned interpolator maps `t` in `[0, 1 / (n - 1)]` to `interpolate(values[0], values[1])`, `t` in `[1 / (n - 1), 2 / (n - 1)]` to `interpolate(values[1], values[2])`,
|
|
||||||
* and so on, where `n = values.length`. In effect, this is a lightweight linear scale.
|
|
||||||
* For example, to blend through three different zoom views: `d3.piecewise(d3.interpolateZoom, [[0, 0, 1], [0, 0, 10], [0, 0, 15]])`.
|
|
||||||
*/
|
|
||||||
export function piecewise(
|
|
||||||
interpolate: (a: ZoomView, b: ZoomView) => ZoomInterpolator,
|
|
||||||
values: ZoomView[],
|
|
||||||
): ZoomInterpolator;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a piecewise array interpolator, composing array interpolators for each adjacent pair of arrays.
|
|
||||||
* The returned interpolator maps `t` in `[0, 1 / (n - 1)]` to `interpolate(values[0], values[1])`, `t` in `[1 / (n - 1), 2 / (n - 1)]` to `interpolate(values[1], values[2])`,
|
|
||||||
* and so on, where `n = values.length`. In effect, this is a lightweight linear scale.
|
|
||||||
* For example, to blend through three different arrays: `d3.piecewise(d3.interpolateArray, [[0, 0, 1], [0, 0, 10], [0, 0, 15]])`.
|
|
||||||
*
|
|
||||||
* interpolate defaults to d3.interpolate.
|
|
||||||
*/
|
|
||||||
export function piecewise<A extends any[]>(values: A[]): ArrayInterpolator<A>;
|
|
||||||
/**
|
|
||||||
* Returns a piecewise array interpolator, composing array interpolators for each adjacent pair of arrays.
|
|
||||||
* The returned interpolator maps `t` in `[0, 1 / (n - 1)]` to `interpolate(values[0], values[1])`, `t` in `[1 / (n - 1), 2 / (n - 1)]` to `interpolate(values[1], values[2])`,
|
|
||||||
* and so on, where `n = values.length`. In effect, this is a lightweight linear scale.
|
|
||||||
* For example, to blend through three different arrays: `d3.piecewise(d3.interpolateArray, [[0, 0, 1], [0, 0, 10], [0, 0, 15]])`.
|
|
||||||
*/
|
|
||||||
export function piecewise<A extends any[]>(
|
|
||||||
interpolate: (a: any[], b: A) => ArrayInterpolator<A>,
|
|
||||||
values: A[],
|
|
||||||
): ArrayInterpolator<A>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a piecewise interpolator, composing interpolators for each adjacent pair of values.
|
|
||||||
* The returned interpolator maps `t` in `[0, 1 / (n - 1)]` to `interpolate(values[0], values[1])`, `t` in `[1 / (n - 1), 2 / (n - 1)]` to `interpolate(values[1], values[2])`,
|
|
||||||
* and so on, where `n = values.length`. In effect, this is a lightweight linear scale.
|
|
||||||
* For example, to blend through red, green and blue: `d3.piecewise(d3.interpolateRgb.gamma(2.2), ["red", "green", "blue"])`.
|
|
||||||
*
|
|
||||||
* interpolate defaults to d3.interpolate.
|
|
||||||
*/
|
|
||||||
export function piecewise(values: unknown[]): (t: number) => any;
|
|
||||||
/**
|
|
||||||
* Returns a piecewise interpolator, composing interpolators for each adjacent pair of values.
|
|
||||||
* The returned interpolator maps `t` in `[0, 1 / (n - 1)]` to `interpolate(values[0], values[1])`, `t` in `[1 / (n - 1), 2 / (n - 1)]` to `interpolate(values[1], values[2])`,
|
|
||||||
* and so on, where `n = values.length`. In effect, this is a lightweight linear scale.
|
|
||||||
* For example, to blend through red, green and blue: `d3.piecewise(d3.interpolateRgb.gamma(2.2), ["red", "green", "blue"])`.
|
|
||||||
*/
|
|
||||||
export function piecewise<TData>(interpolate: (a: TData, b: TData) => unknown, values: TData[]): (t: number) => any;
|
|
||||||
-47
@@ -1,47 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@types/d3-interpolate",
|
|
||||||
"version": "3.0.4",
|
|
||||||
"description": "TypeScript definitions for d3-interpolate",
|
|
||||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/d3-interpolate",
|
|
||||||
"license": "MIT",
|
|
||||||
"contributors": [
|
|
||||||
{
|
|
||||||
"name": "Tom Wanzek",
|
|
||||||
"githubUsername": "tomwanzek",
|
|
||||||
"url": "https://github.com/tomwanzek"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Alex Ford",
|
|
||||||
"githubUsername": "gustavderdrache",
|
|
||||||
"url": "https://github.com/gustavderdrache"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Boris Yankov",
|
|
||||||
"githubUsername": "borisyankov",
|
|
||||||
"url": "https://github.com/borisyankov"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "denisname",
|
|
||||||
"githubUsername": "denisname",
|
|
||||||
"url": "https://github.com/denisname"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Nathan Bierema",
|
|
||||||
"githubUsername": "Methuselah96",
|
|
||||||
"url": "https://github.com/Methuselah96"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"main": "",
|
|
||||||
"types": "index.d.ts",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
|
||||||
"directory": "types/d3-interpolate"
|
|
||||||
},
|
|
||||||
"scripts": {},
|
|
||||||
"dependencies": {
|
|
||||||
"@types/d3-color": "*"
|
|
||||||
},
|
|
||||||
"typesPublisherContentHash": "d315fc677144695b44f1447ef7429c9ff248886716c2e9f742d031abcb319115",
|
|
||||||
"typeScriptVersion": "4.5"
|
|
||||||
}
|
|
||||||
-21
@@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) Microsoft Corporation.
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE
|
|
||||||
-15
@@ -1,15 +0,0 @@
|
|||||||
# Installation
|
|
||||||
> `npm install --save @types/d3-selection`
|
|
||||||
|
|
||||||
# Summary
|
|
||||||
This package contains type definitions for d3-selection (https://github.com/d3/d3-selection/).
|
|
||||||
|
|
||||||
# Details
|
|
||||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/d3-selection.
|
|
||||||
|
|
||||||
### Additional Details
|
|
||||||
* Last updated: Mon, 07 Oct 2024 22:38:10 GMT
|
|
||||||
* Dependencies: none
|
|
||||||
|
|
||||||
# Credits
|
|
||||||
These definitions were written by [Tom Wanzek](https://github.com/tomwanzek), [Alex Ford](https://github.com/gustavderdrache), [Boris Yankov](https://github.com/borisyankov), [denisname](https://github.com/denisname), [Nathan Bierema](https://github.com/Methuselah96), and [Ambar Mutha](https://github.com/ambar-arkin).
|
|
||||||
-1173
File diff suppressed because it is too large
Load Diff
-50
@@ -1,50 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@types/d3-selection",
|
|
||||||
"version": "3.0.11",
|
|
||||||
"description": "TypeScript definitions for d3-selection",
|
|
||||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/d3-selection",
|
|
||||||
"license": "MIT",
|
|
||||||
"contributors": [
|
|
||||||
{
|
|
||||||
"name": "Tom Wanzek",
|
|
||||||
"githubUsername": "tomwanzek",
|
|
||||||
"url": "https://github.com/tomwanzek"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Alex Ford",
|
|
||||||
"githubUsername": "gustavderdrache",
|
|
||||||
"url": "https://github.com/gustavderdrache"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Boris Yankov",
|
|
||||||
"githubUsername": "borisyankov",
|
|
||||||
"url": "https://github.com/borisyankov"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "denisname",
|
|
||||||
"githubUsername": "denisname",
|
|
||||||
"url": "https://github.com/denisname"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Nathan Bierema",
|
|
||||||
"githubUsername": "Methuselah96",
|
|
||||||
"url": "https://github.com/Methuselah96"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Ambar Mutha",
|
|
||||||
"githubUsername": "ambar-arkin",
|
|
||||||
"url": "https://github.com/ambar-arkin"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"main": "",
|
|
||||||
"types": "index.d.ts",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
|
||||||
"directory": "types/d3-selection"
|
|
||||||
},
|
|
||||||
"scripts": {},
|
|
||||||
"dependencies": {},
|
|
||||||
"typesPublisherContentHash": "fefb1bdeb8d385251c2a5f0f16c4a924e80663081d09b1d98f79573a4db8ff6c",
|
|
||||||
"typeScriptVersion": "4.8"
|
|
||||||
}
|
|
||||||
-21
@@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) Microsoft Corporation.
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE
|
|
||||||
-15
@@ -1,15 +0,0 @@
|
|||||||
# Installation
|
|
||||||
> `npm install --save @types/d3-transition`
|
|
||||||
|
|
||||||
# Summary
|
|
||||||
This package contains type definitions for d3-transition (https://github.com/d3/d3-transition/).
|
|
||||||
|
|
||||||
# Details
|
|
||||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/d3-transition.
|
|
||||||
|
|
||||||
### Additional Details
|
|
||||||
* Last updated: Mon, 07 Oct 2024 22:38:10 GMT
|
|
||||||
* Dependencies: [@types/d3-selection](https://npmjs.com/package/@types/d3-selection)
|
|
||||||
|
|
||||||
# Credits
|
|
||||||
These definitions were written by [Tom Wanzek](https://github.com/tomwanzek), [Alex Ford](https://github.com/gustavderdrache), [Boris Yankov](https://github.com/borisyankov), [Robert Moura](https://github.com/robertmoura), and [Nathan Bierema](https://github.com/Methuselah96).
|
|
||||||
-664
@@ -1,664 +0,0 @@
|
|||||||
// Last module patch version validated against: 3.0.1
|
|
||||||
|
|
||||||
import { ArrayLike, BaseType, Selection, ValueFn } from "d3-selection";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extend interface 'Selection' by declaration merging with 'd3-selection'
|
|
||||||
*/
|
|
||||||
declare module "d3-selection" {
|
|
||||||
/**
|
|
||||||
* A D3 Selection of elements.
|
|
||||||
*
|
|
||||||
* The first generic "GElement" refers to the type of the selected element(s).
|
|
||||||
* The second generic "Datum" refers to the type of the datum of a selected element(s).
|
|
||||||
* The third generic "PElement" refers to the type of the parent element(s) in the D3 selection.
|
|
||||||
* The fourth generic "PDatum" refers to the type of the datum of the parent element(s).
|
|
||||||
*/
|
|
||||||
interface Selection<GElement extends BaseType, Datum, PElement extends BaseType, PDatum> {
|
|
||||||
/**
|
|
||||||
* Interrupts the active transition of the specified name on the selected elements, and cancels any pending transitions with the specified name, if any.
|
|
||||||
* If a name is not specified, null is used.
|
|
||||||
*
|
|
||||||
* IMPORTANT: Interrupting a transition on an element has no effect on any transitions on any descendant elements.
|
|
||||||
* For example, an axis transition consists of multiple independent, synchronized transitions on the descendants of the axis G element
|
|
||||||
* (the tick lines, the tick labels, the domain path, etc.). To interrupt the axis transition, you must therefore interrupt the descendants.
|
|
||||||
*
|
|
||||||
* @param name Name of the transition.
|
|
||||||
*/
|
|
||||||
interrupt(name?: string): this;
|
|
||||||
/**
|
|
||||||
* Returns a new transition on the given selection with the specified name. If a name is not specified, null is used.
|
|
||||||
* The new transition is only exclusive with other transitions of the same name.
|
|
||||||
*
|
|
||||||
* @param name Name of the transition.
|
|
||||||
*/
|
|
||||||
transition(name?: string): Transition<GElement, Datum, PElement, PDatum>;
|
|
||||||
/**
|
|
||||||
* Returns a new transition on the given selection.
|
|
||||||
*
|
|
||||||
* When using a transition instance, the returned transition has the same id and name as the specified transition.
|
|
||||||
* If a transition with the same id already exists on a selected element, the existing transition is returned for that element.
|
|
||||||
* Otherwise, the timing of the returned transition is inherited from the existing transition of the same id on the nearest ancestor of each selected element.
|
|
||||||
* Thus, this method can be used to synchronize a transition across multiple selections,
|
|
||||||
* or to re-select a transition for specific elements and modify its configuration.
|
|
||||||
*
|
|
||||||
* If the specified transition is not found on a selected node or its ancestors (such as if the transition already ended),
|
|
||||||
* the default timing parameters are used; however, in a future release, this will likely be changed to throw an error.
|
|
||||||
*
|
|
||||||
* @param transition A transition instance.
|
|
||||||
*/
|
|
||||||
transition(transition: Transition<BaseType, any, any, any>): Transition<GElement, Datum, PElement, PDatum>;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the active transition on the specified node with the specified name, if any.
|
|
||||||
* If no name is specified, null is used. Returns null if there is no such active transition on the specified node.
|
|
||||||
* This method is useful for creating chained transitions.
|
|
||||||
*
|
|
||||||
* The first generic "GElement" refers to the type of element on which the returned active transition was defined. The second generic "Datum" refers to the type of the
|
|
||||||
* datum, of a selected element on which the transition is defined. The third generic refers to the type of the parent elements in the returned Transition.
|
|
||||||
* The fourth generic refers to the type of the datum defined on the parent elements in the returned Transition.
|
|
||||||
*
|
|
||||||
* @param node Element for which the active transition should be returned.
|
|
||||||
* @param name Name of the transition.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
||||||
export function active<GElement extends BaseType, Datum, PElement extends BaseType, PDatum>(
|
|
||||||
node: GElement,
|
|
||||||
name?: string,
|
|
||||||
): Transition<GElement, Datum, PElement, PDatum> | null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interrupts the active transition of the specified name on the specified node, and cancels any pending transitions with the specified name, if any.
|
|
||||||
* If a name is not specified, null is used.
|
|
||||||
*
|
|
||||||
* @param node Element for which the transition should be interrupted.
|
|
||||||
* @param name Name of the transition to be interrupted. If a name is not specified, null is used.
|
|
||||||
*/
|
|
||||||
export function interrupt(node: BaseType, name?: string): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A D3 Transition.
|
|
||||||
*
|
|
||||||
* The first generic "GElement" refers to the type of the selected element(s) in the Transition.
|
|
||||||
* The second generic "Datum" refers to the type of the datum of a selected element(s) in the Transition.
|
|
||||||
* The third generic "PElement" refers to the type of the parent element(s) in the D3 selection in the Transition.
|
|
||||||
* The fourth generic "PDatum" refers to the type of the datum of the parent element(s) in the Transition.
|
|
||||||
*/
|
|
||||||
export interface Transition<GElement extends BaseType, Datum, PElement extends BaseType, PDatum> {
|
|
||||||
// Sub-selection -------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* For each selected element, select the first descendant element that matches the specified selector string, if any,
|
|
||||||
* and returns a transition on the resulting selection. The new transition has the same id, name and timing as this transition;
|
|
||||||
* however, if a transition with the same id already exists on a selected element,
|
|
||||||
* the existing transition is returned for that element.
|
|
||||||
*
|
|
||||||
* The generic represents the type of the descendant element to be selected.
|
|
||||||
*
|
|
||||||
* @param selector CSS selector string
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
||||||
select<DescElement extends BaseType>(selector: string): Transition<DescElement, Datum, PElement, PDatum>;
|
|
||||||
/**
|
|
||||||
* For each selected element, select the descendant element returned by the selector function, if any,
|
|
||||||
* and returns a transition on the resulting selection. The new transition has the same id, name and timing as this transition;
|
|
||||||
* however, if a transition with the same id already exists on a selected element,
|
|
||||||
* the existing transition is returned for that element.
|
|
||||||
*
|
|
||||||
* The generic represents the type of the descendant element to be selected.
|
|
||||||
*
|
|
||||||
* @param selector A selector function, which is evaluated for each selected element, in order, being passed the current datum (d),
|
|
||||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]).
|
|
||||||
* It must return an element, or null if there is no matching element.
|
|
||||||
*/
|
|
||||||
select<DescElement extends BaseType>(
|
|
||||||
selector: ValueFn<GElement, Datum, DescElement>,
|
|
||||||
): Transition<DescElement, Datum, PElement, PDatum>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* For each selected element, select all descendant elements that match the specified selector string, if any,
|
|
||||||
* and returns a transition on the resulting selection. The new transition has the same id, name and timing as this transition;
|
|
||||||
* however, if a transition with the same id already exists on a selected element, the existing transition is returned for that element.
|
|
||||||
*
|
|
||||||
* The first generic "DescElement" refers to the type of descendant element to be selected. The second generic "OldDatum" refers to the type of the
|
|
||||||
* datum, of a selected element. This is useful when re-selecting elements with a previously set, know datum type.
|
|
||||||
*
|
|
||||||
* @param selector CSS selector string
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
||||||
selectAll<DescElement extends BaseType, OldDatum>(
|
|
||||||
selector: string,
|
|
||||||
): Transition<DescElement, OldDatum, GElement, Datum>;
|
|
||||||
/**
|
|
||||||
* For each selected element, select all descendant elements returned by the selector function, if any,
|
|
||||||
* and returns a transition on the resulting selection. The new transition has the same id, name and timing as this transition;
|
|
||||||
* however, if a transition with the same id already exists on a selected element, the existing transition is returned for that element.
|
|
||||||
*
|
|
||||||
* The first generic "DescElement" refers to the type of descendant element to be selected. The second generic "OldDatum" refers to the type of the
|
|
||||||
* datum, of a selected element. This is useful when re-selecting elements with a previously set, know datum type.
|
|
||||||
*
|
|
||||||
* @param selector A selector function which is evaluated for each selected element, in order, being passed the current datum (d),
|
|
||||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). It must return an array of elements
|
|
||||||
* (or a pseudo-array, such as a NodeList), or the empty array if there are no matching elements.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
||||||
selectAll<DescElement extends BaseType, OldDatum>(
|
|
||||||
selector: ValueFn<GElement, Datum, DescElement[] | ArrayLike<DescElement>>,
|
|
||||||
): Transition<DescElement, OldDatum, GElement, Datum>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* For each selected element, selects the first child element that matches the specified selector string, if any, and returns a transition on the resulting selection.
|
|
||||||
* The selector may be specified either as a selector string or a function.
|
|
||||||
* If a function, it is evaluated for each selected element, in order, being passed the current datum (d),
|
|
||||||
* the current index (i), and the current group (nodes), with this as the current DOM element.
|
|
||||||
* The new transition has the same id, name and timing as this transition;
|
|
||||||
* however, if a transition with the same id already exists on a selected element, the existing transition is returned for that element.
|
|
||||||
* This method is equivalent to deriving the selection for this transition via transition.selection,
|
|
||||||
* creating a subselection via selection.selectChild, and then creating a new transition via selection.transition.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
||||||
selectChild<DescElement extends BaseType, OldDatum>(
|
|
||||||
selector?: string | ValueFn<GElement, Datum, DescElement>,
|
|
||||||
): Transition<DescElement, OldDatum, GElement, Datum>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* For each selected element, selects all children that match the specified selector string, if any, and returns a transition on the resulting selection.
|
|
||||||
* The selector may be specified either as a selector string or a function.
|
|
||||||
* If a function, it is evaluated for each selected element, in order, being passed the current datum (d),
|
|
||||||
* the current index (i), and the current group (nodes), with this as the current DOM element.
|
|
||||||
* The new transition has the same id, name and timing as this transition;
|
|
||||||
* however, if a transition with the same id already exists on a selected element, the existing transition is returned for that element.
|
|
||||||
* This method is equivalent to deriving the selection for this transition via transition.selection,
|
|
||||||
* creating a subselection via selection.selectChildren, and then creating a new transition via selection.transition.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
||||||
selectChildren<DescElement extends BaseType, OldDatum>(
|
|
||||||
selector?: string | ValueFn<GElement, Datum, DescElement>,
|
|
||||||
): Transition<DescElement, OldDatum, GElement, Datum>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the selection corresponding to this transition.
|
|
||||||
*/
|
|
||||||
selection(): Selection<GElement, Datum, PElement, PDatum>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a new transition on the same selected elements as this transition, scheduled to start when this transition ends.
|
|
||||||
* The new transition inherits a reference time equal to this transition’s time plus its delay and duration.
|
|
||||||
* The new transition also inherits this transition’s name, duration, and easing.
|
|
||||||
* This method can be used to schedule a sequence of chained transitions.
|
|
||||||
*
|
|
||||||
* A delay configured for the new transition will be relative to the previous transition.
|
|
||||||
*/
|
|
||||||
transition(): Transition<GElement, Datum, PElement, PDatum>;
|
|
||||||
|
|
||||||
// Modifying -------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* For each selected element, assigns the attribute tween for the attribute with the specified name to the specified target value.
|
|
||||||
* The starting value of the tween is the attribute’s value when the transition starts.
|
|
||||||
* If the target value is null, the attribute is removed when the transition starts.
|
|
||||||
*/
|
|
||||||
attr(name: string, value: null | string | number | boolean): this;
|
|
||||||
/**
|
|
||||||
* For each selected element, assigns the attribute tween for the attribute with the specified name to the specified target value.
|
|
||||||
* The starting value of the tween is the attribute’s value when the transition starts.
|
|
||||||
* The target value is return value of the value function evaluated for the selected element.
|
|
||||||
*
|
|
||||||
* An interpolator is chosen based on the type of the target value, using the following algorithm:
|
|
||||||
* 1.) If value is a number, use interpolateNumber.
|
|
||||||
* 2.) If value is a color or a string coercible to a color, use interpolateRgb.
|
|
||||||
* 3.) Use interpolateString.
|
|
||||||
*
|
|
||||||
* To apply a different interpolator, use transition.attrTween.
|
|
||||||
*
|
|
||||||
* @param name Name of the attribute.
|
|
||||||
* @param value A value function which is evaluated for each selected element, in order, being passed the current datum (d),
|
|
||||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]).
|
|
||||||
* A null value will clear the attribute at the start of the transition.
|
|
||||||
*/
|
|
||||||
attr(name: string, value: ValueFn<GElement, Datum, string | number | boolean | null>): this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the current interpolator factory for attribute with the specified name, or undefined if no such tween exists.
|
|
||||||
*
|
|
||||||
* @param name Name of attribute.
|
|
||||||
*/
|
|
||||||
attrTween(name: string): ValueFn<GElement, Datum, (this: GElement, t: number) => string> | undefined;
|
|
||||||
/**
|
|
||||||
* Remove the previously-assigned attribute tween of the specified name, if any.
|
|
||||||
*
|
|
||||||
* @param name Name of attribute.
|
|
||||||
* @param factory Use null to remove previously-assigned attribute tween.
|
|
||||||
*/
|
|
||||||
attrTween(name: string, factory: null): this;
|
|
||||||
/**
|
|
||||||
* Assign the attribute tween for the attribute with the specified name to the specified interpolator factory.
|
|
||||||
* An interpolator factory is a function that returns an interpolator; when the transition starts, the factory is evaluated for each selected element.
|
|
||||||
* The returned interpolator will then be invoked for each frame of the transition, in order,
|
|
||||||
* being passed the eased time t, typically in the range [0, 1]. Lastly, the return value of the interpolator will be used to set the attribute value.
|
|
||||||
* The interpolator must return a string.
|
|
||||||
*
|
|
||||||
* @param name Name of attribute.
|
|
||||||
* @param factory An interpolator factory which is evaluated for each selected element, in order, being passed the current datum (d),
|
|
||||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). The interpolator factory returns a string interpolator,
|
|
||||||
* which takes as its argument eased time t, typically in the range [0, 1] and returns the interpolated string.
|
|
||||||
*/
|
|
||||||
attrTween(name: string, factory: ValueFn<GElement, Datum, (this: GElement, t: number) => string>): this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* For each selected element, the style with the specified name will be cleared at the start of the transition.
|
|
||||||
*
|
|
||||||
* @param name Name of the style.
|
|
||||||
* @param value Use null to clear the style.
|
|
||||||
*/
|
|
||||||
style(name: string, value: null): this;
|
|
||||||
/**
|
|
||||||
* For each selected element, assigns the style tween for the style with the specified name to the specified target value with the
|
|
||||||
* specified priority.
|
|
||||||
* The starting value of the tween is the style’s inline value if present, and otherwise its computed value.
|
|
||||||
* The target value is the specified constant value for all elements.
|
|
||||||
*
|
|
||||||
* An interpolator is chosen based on the type of the target value, using the following algorithm:
|
|
||||||
* 1.) If value is a number, use interpolateNumber.
|
|
||||||
* 2.) If value is a color or a string coercible to a color, use interpolateRgb.
|
|
||||||
* 3.) Use interpolateString.
|
|
||||||
*
|
|
||||||
* To apply a different interpolator, use transition.attrTween.
|
|
||||||
*
|
|
||||||
* @param name Name of the style.
|
|
||||||
* @param value Target value for the style.
|
|
||||||
* @param priority An optional priority flag, either null or the string important (without the exclamation point)
|
|
||||||
*/
|
|
||||||
style(name: string, value: string | number | boolean, priority?: null | "important"): this;
|
|
||||||
/**
|
|
||||||
* For each selected element, assigns the style tween for the style with the specified name to the specified target value with the
|
|
||||||
* specified priority.
|
|
||||||
* The starting value of the tween is the style's inline value if present, and otherwise its computed value.
|
|
||||||
* The target value is return value of the value function evaluated for the selected element.
|
|
||||||
*
|
|
||||||
* An interpolator is chosen based on the type of the target value, using the following algorithm:
|
|
||||||
* 1.) If value is a number, use interpolateNumber.
|
|
||||||
* 2.) If value is a color or a string coercible to a color, use interpolateRgb.
|
|
||||||
* 3.) Use interpolateString.
|
|
||||||
*
|
|
||||||
* To apply a different interpolator, use transition.attrTween.
|
|
||||||
*
|
|
||||||
* @param name Name of the style.
|
|
||||||
* @param value A value function which is evaluated for each selected element, in order, being passed the current datum (d),
|
|
||||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]).
|
|
||||||
* A null value will clear the style at the start of the transition.
|
|
||||||
* @param priority An optional priority flag, either null or the string important (without the exclamation point)
|
|
||||||
*/
|
|
||||||
style(
|
|
||||||
name: string,
|
|
||||||
value: ValueFn<GElement, Datum, string | number | boolean | null>,
|
|
||||||
priority?: null | "important",
|
|
||||||
): this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the current interpolator factory for style with the specified name, or undefined if no such tween exists.
|
|
||||||
*
|
|
||||||
* @param name Name of style.
|
|
||||||
*/
|
|
||||||
styleTween(name: string): ValueFn<GElement, Datum, (this: GElement, t: number) => string> | undefined;
|
|
||||||
/**
|
|
||||||
* Remove the previously-assigned style tween of the specified name, if any.
|
|
||||||
*
|
|
||||||
* @param name Name of style.
|
|
||||||
* @param factory Use null to remove previously-assigned style tween.
|
|
||||||
*/
|
|
||||||
styleTween(name: string, factory: null): this;
|
|
||||||
/**
|
|
||||||
* Assign the style tween for the style with the specified name to the specified interpolator factory.
|
|
||||||
* An interpolator factory is a function that returns an interpolator; when the transition starts, the factory is evaluated for each selected element.
|
|
||||||
* The returned interpolator will then be invoked for each frame of the transition, in order,
|
|
||||||
* being passed the eased time t, typically in the range [0, 1]. Lastly, the return value of the interpolator will be used to set the style value.
|
|
||||||
* The interpolator must return a string.
|
|
||||||
*
|
|
||||||
* @param name Name of style.
|
|
||||||
* @param factory An interpolator factory which is evaluated for each selected element, in order, being passed the current datum (d),
|
|
||||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). The interpolator factory returns a string interpolator,
|
|
||||||
* which takes as its argument eased time t, typically in the range [0, 1] and returns the interpolated string.
|
|
||||||
* @param priority An optional priority flag, either null or the string important (without the exclamation point)
|
|
||||||
*/
|
|
||||||
styleTween(
|
|
||||||
name: string,
|
|
||||||
factory: ValueFn<GElement, Datum, (this: GElement, t: number) => string>,
|
|
||||||
priority?: null | "important",
|
|
||||||
): this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* For each selected element, sets the text content to the specified target value when the transition starts.
|
|
||||||
* A null value will clear the content.
|
|
||||||
*/
|
|
||||||
text(value: null | string | number | boolean): this;
|
|
||||||
/**
|
|
||||||
* For each selected element, sets the text content returned by the value function for each selected element when the transition starts.
|
|
||||||
*
|
|
||||||
* To interpolate text rather than to set it on start, use transition.textTween (for example) or append a replacement element and cross-fade opacity (for example).
|
|
||||||
* Text is not interpolated by default because it is usually undesirable.
|
|
||||||
*
|
|
||||||
* @param value A value function which is evaluated for each selected element, in order, being passed the current datum (d),
|
|
||||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]).
|
|
||||||
* A null value will clear the text content at the start of the transition.
|
|
||||||
*/
|
|
||||||
text(value: ValueFn<GElement, Datum, string | number | boolean>): this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the current interpolator factory for text, or undefined if no such tween exists.
|
|
||||||
*/
|
|
||||||
textTween(): ValueFn<GElement, Datum, (this: GElement, t: number) => string> | undefined;
|
|
||||||
/**
|
|
||||||
* Removes the previously-assigned text tween, if any
|
|
||||||
*
|
|
||||||
* @param factory Use null to remove previously-assigned text tween.
|
|
||||||
*/
|
|
||||||
textTween(factory: null): this;
|
|
||||||
/**
|
|
||||||
* Assigns the text tween to the specified interpolator factory.
|
|
||||||
* An interpolator factory is a function that returns an interpolator; when the transition starts, the factory is evaluated for each selected element,
|
|
||||||
* in order, being passed the current datum d and index i, with the this context as the current DOM element.
|
|
||||||
* The returned interpolator will then be invoked for each frame of the transition, in order, being passed the eased time t, typically in the range [0, 1].
|
|
||||||
* Lastly, the return value of the interpolator will be used to set the text.
|
|
||||||
* The interpolator must return a string.
|
|
||||||
*
|
|
||||||
* @param factory An interpolator factory is a function that returns an interpolator; when the transition starts, the factory is evaluated for each selected element,
|
|
||||||
* in order, being passed the current datum d and index i, with the this context as the current DOM element.
|
|
||||||
* The returned interpolator will then be invoked for each frame of the transition, in order, being passed the eased time t, typically in the range [0, 1].
|
|
||||||
* Lastly, the return value of the interpolator will be used to set the text.
|
|
||||||
* The interpolator must return a string.
|
|
||||||
*/
|
|
||||||
textTween(factory: ValueFn<GElement, Datum, (this: GElement, t: number) => string>): this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* For each selected element, removes the element when the transition ends, as long as the element has no other active or pending transitions.
|
|
||||||
* If the element has other active or pending transitions, does nothing.
|
|
||||||
*/
|
|
||||||
remove(): this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the tween with the specified name, or undefined, if no tween was previously assigned to
|
|
||||||
* that name.
|
|
||||||
*
|
|
||||||
* @param name Name of tween.
|
|
||||||
*/
|
|
||||||
tween(name: string): ValueFn<GElement, Datum, (this: GElement, t: number) => void> | undefined;
|
|
||||||
/**
|
|
||||||
* Removes the tween with the specified name, if a tween was previously assigned to
|
|
||||||
* that name.
|
|
||||||
*
|
|
||||||
* @param name Name of tween.
|
|
||||||
* @param tweenFn Use null to remove a previously-assigned tween.
|
|
||||||
*/
|
|
||||||
tween(name: string, tweenFn: null): this;
|
|
||||||
/**
|
|
||||||
* For each selected element, assigns the tween with the specified name with the specified value function.
|
|
||||||
* The value must be specified as a function that returns a function.
|
|
||||||
* When the transition starts, the value function is evaluated for each selected element.
|
|
||||||
* The returned function is then invoked for each frame of the transition, in order,
|
|
||||||
* being passed the eased time t, typically in the range [0, 1].
|
|
||||||
*
|
|
||||||
* @param name Name of tween.
|
|
||||||
* @param tweenFn A tween function which is evaluated for each selected element, in order, being passed the current datum (d),
|
|
||||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). The tween function returns a function
|
|
||||||
* which takes as its argument eased time t, typically in the range [0, 1] and performs the tweening activities for each transition frame.
|
|
||||||
*/
|
|
||||||
tween(name: string, tweenFn: ValueFn<GElement, Datum, (this: GElement, t: number) => void>): this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a new transition merging this transition with the specified other transition,
|
|
||||||
* which must have the same id as this transition. The returned transition has the same number of groups,
|
|
||||||
* the same parents, the same name and the same id as this transition.
|
|
||||||
* Any missing (null) elements in this transition are filled with the corresponding element, if present (not null), from the other transition.
|
|
||||||
*
|
|
||||||
* @param other The transition to be merged.
|
|
||||||
*/
|
|
||||||
merge(other: Transition<GElement, Datum, PElement, PDatum>): Transition<GElement, Datum, PElement, PDatum>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* For each selected element, selects only the elements that match the specified filter, and returns a transition on the resulting selection.
|
|
||||||
*
|
|
||||||
* The new transition has the same id, name and timing as this transition; however, if a transition with the same id already exists on a selected element,
|
|
||||||
* the existing transition is returned for that element.
|
|
||||||
*
|
|
||||||
* @param filter A CSS selector string.
|
|
||||||
*/
|
|
||||||
filter(filter: string): Transition<GElement, Datum, PElement, PDatum>;
|
|
||||||
/**
|
|
||||||
* For each selected element, selects only the elements that match the specified filter, and returns a transition on the resulting selection.
|
|
||||||
*
|
|
||||||
* The new transition has the same id, name and timing as this transition; however, if a transition with the same id already exists on a selected element,
|
|
||||||
* the existing transition is returned for that element.
|
|
||||||
*
|
|
||||||
* The generic refers to the type of element which will be selected after applying the filter, i.e. if the element types
|
|
||||||
* contained in a pre-filter selection are narrowed to a subset as part of the filtering.
|
|
||||||
*
|
|
||||||
* @param filter A CSS selector string.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
||||||
filter<FilteredElement extends BaseType>(filter: string): Transition<FilteredElement, Datum, PElement, PDatum>;
|
|
||||||
/**
|
|
||||||
* For each selected element, selects only the elements that match the specified filter, and returns a transition on the resulting selection.
|
|
||||||
*
|
|
||||||
* The new transition has the same id, name and timing as this transition; however, if a transition with the same id already exists on a selected element,
|
|
||||||
* the existing transition is returned for that element.
|
|
||||||
*
|
|
||||||
* @param filter A filter function which is evaluated for each selected element, in order, being passed the current datum (d),
|
|
||||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). The filter function returns a boolean indicating,
|
|
||||||
* whether the selected element matches.
|
|
||||||
*/
|
|
||||||
filter(filter: ValueFn<GElement, Datum, boolean>): Transition<GElement, Datum, PElement, PDatum>;
|
|
||||||
/**
|
|
||||||
* For each selected element, selects only the elements that match the specified filter, and returns a transition on the resulting selection.
|
|
||||||
*
|
|
||||||
* The new transition has the same id, name and timing as this transition; however, if a transition with the same id already exists on a selected element,
|
|
||||||
* the existing transition is returned for that element.
|
|
||||||
*
|
|
||||||
* The generic refers to the type of element which will be selected after applying the filter, i.e. if the element types
|
|
||||||
* contained in a pre-filter selection are narrowed to a subset as part of the filtering.
|
|
||||||
*
|
|
||||||
* @param filter A filter function which is evaluated for each selected element, in order, being passed the current datum (d),
|
|
||||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). The filter function returns a boolean indicating,
|
|
||||||
* whether the selected element matches.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
||||||
filter<FilteredElement extends BaseType>(
|
|
||||||
filter: ValueFn<GElement, Datum, boolean>,
|
|
||||||
): Transition<FilteredElement, Datum, PElement, PDatum>;
|
|
||||||
|
|
||||||
// Event Handling -------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the currently-assigned listener for the specified event typename on the first (non-null) selected element, if any.
|
|
||||||
* If multiple typenames are specified, the first matching listener is returned.
|
|
||||||
*
|
|
||||||
* @param typenames The typenames is one of the following string event types: start (when the transition starts), end (when the transition ends),
|
|
||||||
* interrupt (when the transition is interrupted), cancel(when the transition is cancelled).
|
|
||||||
* Note that these are not native DOM events. The type may be optionally followed by a period (.) and a name;
|
|
||||||
* the optional name allows multiple callbacks to be registered to receive events of the same type, such as "start.foo"" and "start.bar".
|
|
||||||
* To specify multiple typenames, separate typenames with spaces, such as "interrupt end"" or "start.foo start.bar".
|
|
||||||
*/
|
|
||||||
on(typenames: string): ValueFn<GElement, Datum, void> | undefined;
|
|
||||||
/**
|
|
||||||
* Remove all listeners for a given name.
|
|
||||||
*
|
|
||||||
* @param typenames Name of the event type for which the listener should be removed. To remove all listeners for a given name use ".foo"
|
|
||||||
* as the typename, where foo is the name; to remove all listeners with no name, specify "." as the typename.
|
|
||||||
* @param listener Use null to remove listeners.
|
|
||||||
*/
|
|
||||||
on(typenames: string, listener: null): this;
|
|
||||||
/**
|
|
||||||
* Add a listener to each selected element for the specified event typenames.
|
|
||||||
*
|
|
||||||
* When a specified transition event is dispatched on a selected node, the specified listener will be invoked for each transitioning element.
|
|
||||||
* Listeners always see the latest datum for their element, but the index is a property of the selection and is fixed when the listener is assigned;
|
|
||||||
* to update the index, re-assign the listener.
|
|
||||||
*
|
|
||||||
* @param typenames The typenames is one of the following string event types: start (when the transition starts), end (when the transition ends),
|
|
||||||
* interrupt (when the transition is interrupted), cancel(when the transition is cancelled).
|
|
||||||
* Note that these are not native DOM events. The type may be optionally followed by a period (.) and a name;
|
|
||||||
* the optional name allows multiple callbacks to be registered to receive events of the same type, such as "start.foo"" and "start.bar".
|
|
||||||
* To specify multiple typenames, separate typenames with spaces, such as "interrupt end"" or "start.foo start.bar".
|
|
||||||
* @param listener A listener function which will be evaluated for each selected element, being passed the current datum (d), the current index (i),
|
|
||||||
* and the current group (nodes), with this as the current DOM element (nodes[i]). Listeners always see the latest datum for their element,
|
|
||||||
* but the index is a property of the selection and is fixed when the listener is assigned; to update the index, re-assign the listener.
|
|
||||||
*/
|
|
||||||
on(typenames: string, listener: ValueFn<GElement, Datum, void>): this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a promise that resolves when every selected element finishes transitioning. If any element’s transition is cancelled or interrupted, the promise rejects.
|
|
||||||
*/
|
|
||||||
end(): Promise<void>;
|
|
||||||
|
|
||||||
// Control Flow ----------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoke the specified function for each selected element, passing the current datum (d),
|
|
||||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]).
|
|
||||||
* This method can be used to invoke arbitrary code for each selected element, and is useful for creating a context to access parent and child data simultaneously.
|
|
||||||
*
|
|
||||||
* @param func A function which is invoked for each selected element,
|
|
||||||
* being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]).
|
|
||||||
*/
|
|
||||||
each(func: ValueFn<GElement, Datum, void>): this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoke the specified function exactly once, passing in this transition along with any optional arguments.
|
|
||||||
* Returns this transition.
|
|
||||||
*
|
|
||||||
* @param func A function which is passed this transition as the first argument along with any optional arguments.
|
|
||||||
* @param args List of optional arguments to be passed to the callback function.
|
|
||||||
*/
|
|
||||||
call(
|
|
||||||
func: (transition: Transition<GElement, Datum, PElement, PDatum>, ...args: any[]) => any,
|
|
||||||
...args: any[]
|
|
||||||
): this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return true if this transition contains no (non-null) elements.
|
|
||||||
*/
|
|
||||||
empty(): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the first (non-null) element in this transition. If the transition is empty, returns null.
|
|
||||||
*/
|
|
||||||
node(): GElement | null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return an array of all (non-null) elements in this transition.
|
|
||||||
*/
|
|
||||||
nodes(): GElement[];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the total number of elements in this transition.
|
|
||||||
*/
|
|
||||||
size(): number;
|
|
||||||
|
|
||||||
// Transition Configuration ----------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the current value of the delay for the first (non-null) element in the transition.
|
|
||||||
* This is generally useful only if you know that the transition contains exactly one element.
|
|
||||||
*/
|
|
||||||
delay(): number;
|
|
||||||
/**
|
|
||||||
* For each selected element, sets the transition delay to the specified value in milliseconds.
|
|
||||||
* If a delay is not specified, it defaults to zero.
|
|
||||||
*
|
|
||||||
* @param milliseconds Number of milliseconds for the delay.
|
|
||||||
*/
|
|
||||||
delay(milliseconds: number): this;
|
|
||||||
/**
|
|
||||||
* For each selected element, sets the transition delay to the value in milliseconds returned by the
|
|
||||||
* value function.
|
|
||||||
*
|
|
||||||
* @param milliseconds A value function which is evaluated for each selected element, being passed the current datum (d),
|
|
||||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). The return value is a number
|
|
||||||
* specifying the delay in milliseconds.
|
|
||||||
*/
|
|
||||||
delay(milliseconds: ValueFn<GElement, Datum, number>): this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the current value of the duration for the first (non-null) element in the transition.
|
|
||||||
* This is generally useful only if you know that the transition contains exactly one element.
|
|
||||||
*/
|
|
||||||
duration(): number;
|
|
||||||
/**
|
|
||||||
* For each selected element, sets the transition duration to the specified value in milliseconds.
|
|
||||||
* If a duration is not specified, it defaults to 250ms.
|
|
||||||
*
|
|
||||||
* @param duration Number of milliseconds for the duration.
|
|
||||||
*/
|
|
||||||
duration(milliseconds: number): this;
|
|
||||||
/**
|
|
||||||
* For each selected element, sets the transition duration to the value in milliseconds returned by the
|
|
||||||
* value function.
|
|
||||||
*
|
|
||||||
* @param milliseconds A value function which is evaluated for each selected element, being passed the current datum (d),
|
|
||||||
* the current index (i), and the current group (nodes), with this as the current DOM element (nodes[i]). The return value is a number
|
|
||||||
* specifying the duration in milliseconds.
|
|
||||||
*/
|
|
||||||
duration(milliseconds: ValueFn<GElement, Datum, number>): this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the current easing function for the first (non-null) element in the transition.
|
|
||||||
* This is generally useful only if you know that the transition contains exactly one element.
|
|
||||||
*/
|
|
||||||
ease(): (normalizedTime: number) => number;
|
|
||||||
/**
|
|
||||||
* Specifies the transition easing function for all selected elements. The value must be specified as a function.
|
|
||||||
* The easing function is invoked for each frame of the animation, being passed the normalized time t in the range [0, 1];
|
|
||||||
* it must then return the eased time tʹ which is typically also in the range [0, 1].
|
|
||||||
* A good easing function should return 0 if t = 0 and 1 if t = 1. If an easing function is not specified,
|
|
||||||
* it defaults to d3.easeCubic.
|
|
||||||
*
|
|
||||||
* @param easingFn An easing function which is passed the normalized time t in the range [0, 1];
|
|
||||||
* it must then return the eased time tʹ which is typically also in the range [0, 1].
|
|
||||||
* A good easing function should return 0 if t = 0 and 1 if t = 1.
|
|
||||||
*/
|
|
||||||
ease(easingFn: (normalizedTime: number) => number): this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies a factory for the transition easing function.
|
|
||||||
*
|
|
||||||
* @param factory The factory must be a function.
|
|
||||||
* It is invoked for each node of the selection, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element.
|
|
||||||
* It must return an easing function.
|
|
||||||
*/
|
|
||||||
easeVarying(factory: ValueFn<GElement, Datum, (normalizedTime: number) => number>): this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents the union of the Selection and Transition types for any usages that operate on both.
|
|
||||||
* Typically used for functions which take in either a selection or transition and set or update attributes.
|
|
||||||
*/
|
|
||||||
export type SelectionOrTransition<GElement extends BaseType, Datum, PElement extends BaseType, PDatum> =
|
|
||||||
| Selection<GElement, Datum, PElement, PDatum>
|
|
||||||
| Transition<GElement, Datum, PElement, PDatum>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a new transition with the specified name. If a name is not specified, null is used.
|
|
||||||
* The new transition is only exclusive with other transitions of the same name.
|
|
||||||
*
|
|
||||||
* The generic "OldDatum" refers to the type of a previously-set datum of the selected element in the Transition.
|
|
||||||
*
|
|
||||||
* @param name Name of the transition.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
||||||
export function transition<OldDatum>(name?: string): Transition<BaseType, OldDatum, null, undefined>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a new transition from an existing transition.
|
|
||||||
*
|
|
||||||
* When using a transition instance, the returned transition has the same id and name as the specified transition.
|
|
||||||
*
|
|
||||||
* The generic "OldDatum" refers to the type of a previously-set datum of the selected element in the Transition.
|
|
||||||
*
|
|
||||||
* @param transition A transition instance.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
||||||
export function transition<OldDatum>(
|
|
||||||
transition: Transition<BaseType, any, BaseType, any>,
|
|
||||||
): Transition<BaseType, OldDatum, null, undefined>;
|
|
||||||
-47
@@ -1,47 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@types/d3-transition",
|
|
||||||
"version": "3.0.9",
|
|
||||||
"description": "TypeScript definitions for d3-transition",
|
|
||||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/d3-transition",
|
|
||||||
"license": "MIT",
|
|
||||||
"contributors": [
|
|
||||||
{
|
|
||||||
"name": "Tom Wanzek",
|
|
||||||
"githubUsername": "tomwanzek",
|
|
||||||
"url": "https://github.com/tomwanzek"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Alex Ford",
|
|
||||||
"githubUsername": "gustavderdrache",
|
|
||||||
"url": "https://github.com/gustavderdrache"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Boris Yankov",
|
|
||||||
"githubUsername": "borisyankov",
|
|
||||||
"url": "https://github.com/borisyankov"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Robert Moura",
|
|
||||||
"githubUsername": "robertmoura",
|
|
||||||
"url": "https://github.com/robertmoura"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Nathan Bierema",
|
|
||||||
"githubUsername": "Methuselah96",
|
|
||||||
"url": "https://github.com/Methuselah96"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"main": "",
|
|
||||||
"types": "index.d.ts",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
|
||||||
"directory": "types/d3-transition"
|
|
||||||
},
|
|
||||||
"scripts": {},
|
|
||||||
"dependencies": {
|
|
||||||
"@types/d3-selection": "*"
|
|
||||||
},
|
|
||||||
"typesPublisherContentHash": "69cd5510811e76132548e17770c16a10a8ffe039c97e6d45b3663749af4591dd",
|
|
||||||
"typeScriptVersion": "4.8"
|
|
||||||
}
|
|
||||||
-21
@@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) Microsoft Corporation.
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE
|
|
||||||
-15
@@ -1,15 +0,0 @@
|
|||||||
# Installation
|
|
||||||
> `npm install --save @types/d3-zoom`
|
|
||||||
|
|
||||||
# Summary
|
|
||||||
This package contains type definitions for d3-zoom (https://github.com/d3/d3-zoom/).
|
|
||||||
|
|
||||||
# Details
|
|
||||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/d3-zoom.
|
|
||||||
|
|
||||||
### Additional Details
|
|
||||||
* Last updated: Tue, 07 Nov 2023 15:11:37 GMT
|
|
||||||
* Dependencies: [@types/d3-interpolate](https://npmjs.com/package/@types/d3-interpolate), [@types/d3-selection](https://npmjs.com/package/@types/d3-selection)
|
|
||||||
|
|
||||||
# Credits
|
|
||||||
These definitions were written by [Tom Wanzek](https://github.com/tomwanzek), [Alex Ford](https://github.com/gustavderdrache), [Boris Yankov](https://github.com/borisyankov), [denisname](https://github.com/denisname), and [Nathan Bierema](https://github.com/Methuselah96).
|
|
||||||
-611
@@ -1,611 +0,0 @@
|
|||||||
// Last module patch version validated against: 3.0.0
|
|
||||||
|
|
||||||
import { ZoomView } from "d3-interpolate";
|
|
||||||
import { Selection, TransitionLike, ValueFn } from "d3-selection";
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
|
||||||
// Shared Type Definitions and Interfaces
|
|
||||||
// --------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ZoomedElementBaseType serves as an alias for the 'minimal' data type which can be selected
|
|
||||||
* without 'd3-zoom' (and related code in 'd3-selection') trying to use properties internally which would otherwise not
|
|
||||||
* be supported.
|
|
||||||
*/
|
|
||||||
export type ZoomedElementBaseType = Element;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Minimal interface for a continuous scale.
|
|
||||||
* This interface is used as a minimum contract for scale objects
|
|
||||||
* that can be passed into zoomTransform methods rescaleX and rescaleY
|
|
||||||
*/
|
|
||||||
export interface ZoomScale {
|
|
||||||
domain(): number[] | Date[];
|
|
||||||
domain(domain: Array<Date | number>): this;
|
|
||||||
range(): number[];
|
|
||||||
range(range: number[]): this;
|
|
||||||
copy(): ZoomScale;
|
|
||||||
invert(value: number): number | Date;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
|
||||||
// Zoom Behavior
|
|
||||||
// --------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A D3 Zoom Behavior
|
|
||||||
*
|
|
||||||
* The first generic refers to the type of reference element to which the zoom behavior is attached.
|
|
||||||
* The second generic refers to the type of the datum of the reference element.
|
|
||||||
*/
|
|
||||||
export interface ZoomBehavior<ZoomRefElement extends ZoomedElementBaseType, Datum> extends Function {
|
|
||||||
/**
|
|
||||||
* Applies this zoom behavior to the specified selection, binding the necessary event listeners to
|
|
||||||
* allow panning and zooming, and initializing the zoom transform on each selected element to the identity transform if not already defined. This function is typically not invoked directly,
|
|
||||||
* and is instead invoked via selection.call.
|
|
||||||
*
|
|
||||||
* For details see: {@link https://github.com/d3/d3-zoom#_zoom}
|
|
||||||
*
|
|
||||||
* @param selection A D3 selection of elements.
|
|
||||||
* @param args Optional arguments to be passed in.
|
|
||||||
*/
|
|
||||||
(selection: Selection<ZoomRefElement, Datum, any, any>, ...args: any[]): void;
|
|
||||||
/**
|
|
||||||
* If selection is a selection, sets the current zoom transform of the selected elements to the specified transform, instantaneously emitting start, zoom and end events.
|
|
||||||
* If selection is a transition, defines a “zoom” tween to the specified transform using d3.interpolateZoom, emitting a start event when the transition starts,
|
|
||||||
* zoom events for each tick of the transition, and then an end event when the transition ends (or is interrupted).
|
|
||||||
* The transition will attempt to minimize the visual movement around the specified point; if the point is not specified, it defaults to the center of the viewport extent.
|
|
||||||
*
|
|
||||||
* This function is typically not invoked directly, and is instead invoked via selection.call or transition.call.
|
|
||||||
*
|
|
||||||
* @param selection A selection or a transition.
|
|
||||||
* @param transform A zoom transform or a function that returns a zoom transform.
|
|
||||||
* If a function, it is invoked for each selected element, being passed the current event (event) and datum d, with the this context as the current DOM element.
|
|
||||||
* @param point A two-element array [x, y] or a function that returns such an array.
|
|
||||||
* If a function, it is invoked for each selected element, being passed the current event (event) and datum d, with the this context as the current DOM element.
|
|
||||||
*/
|
|
||||||
transform(
|
|
||||||
selection: Selection<ZoomRefElement, Datum, any, any> | TransitionLike<ZoomRefElement, Datum>,
|
|
||||||
transform: ZoomTransform | ((this: ZoomRefElement, event: any, d: Datum) => ZoomTransform),
|
|
||||||
point?: [number, number] | ((this: ZoomRefElement, event: any, d: Datum) => [number, number]),
|
|
||||||
): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If selection is a selection, translates the current zoom transform of the selected elements by x and y, such that the new tx1 = tx0 + kx and ty1 = ty0 + ky.
|
|
||||||
* If selection is a transition, defines a “zoom” tween translating the current transform.
|
|
||||||
* This method is a convenience method for zoom.transform.
|
|
||||||
*
|
|
||||||
* @param selection A selection or a transition.
|
|
||||||
* @param x A number or a function that returns a number.
|
|
||||||
* If a function, it is invoked for each selected element, being passed the current datum d and index i, with the this context as the current DOM element.
|
|
||||||
* @param y A number or a function that returns a number.
|
|
||||||
* If a function, it is invoked for each selected element, being passed the current datum d and index i, with the this context as the current DOM element.
|
|
||||||
*/
|
|
||||||
translateBy(
|
|
||||||
selection: Selection<ZoomRefElement, Datum, any, any> | TransitionLike<ZoomRefElement, Datum>,
|
|
||||||
x: number | ValueFn<ZoomRefElement, Datum, number>,
|
|
||||||
y: number | ValueFn<ZoomRefElement, Datum, number>,
|
|
||||||
): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If selection is a selection, translates the current zoom transform of the selected elements such that the given position ⟨x,y⟩ appears at given point p.
|
|
||||||
* The new tx = px - kx and ty = py - ky. If p is not specified, it defaults to the center of the viewport extent.
|
|
||||||
* If selection is a transition, defines a “zoom” tween translating the current transform. This method is a convenience method for zoom.transform.
|
|
||||||
*
|
|
||||||
* Translates the current zoom transform of the selected elements such that the specified position ⟨x,y⟩ appears at the center of the viewport extent.
|
|
||||||
* The new tx = cx - kx and ty = cy - ky, where ⟨cx,cy⟩ is the center.
|
|
||||||
*
|
|
||||||
* x is provided as a constant for all elements.
|
|
||||||
* y is provided as a constant for all elements.
|
|
||||||
*
|
|
||||||
* @param selection A selection or a transition.
|
|
||||||
* @param x A number or a function that returns a number.
|
|
||||||
* If a function, it is invoked for each selected element, being passed the current datum d and index i, with the this context as the current DOM element.
|
|
||||||
* @param y A number or a function that returns a number.
|
|
||||||
* If a function, it is invoked for each selected element, being passed the current datum d and index i, with the this context as the current DOM element.
|
|
||||||
* @param p A two-element array [px,py] or a function
|
|
||||||
* If a function, it is invoked for each selected element, being passed the current datum d and index i, with the this context as the current DOM element.
|
|
||||||
*/
|
|
||||||
translateTo(
|
|
||||||
selection: Selection<ZoomRefElement, Datum, any, any> | TransitionLike<ZoomRefElement, Datum>,
|
|
||||||
x: number | ValueFn<ZoomRefElement, Datum, number>,
|
|
||||||
y: number | ValueFn<ZoomRefElement, Datum, number>,
|
|
||||||
p?: [number, number] | ValueFn<ZoomRefElement, Datum, [number, number]>,
|
|
||||||
): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If selection is a selection, scales the current zoom transform of the selected elements by k, such that the new k₁ = k₀k.
|
|
||||||
* The reference point p does move.
|
|
||||||
* If p is not specified, it defaults to the center of the viewport extent.
|
|
||||||
* If selection is a transition, defines a “zoom” tween translating the current transform.
|
|
||||||
* This method is a convenience method for zoom.transform.
|
|
||||||
*
|
|
||||||
* @param selection A selection or a transition.
|
|
||||||
* @param k Scale factor. A number or a function that returns a number.
|
|
||||||
* If a function, it is invoked for each selected element, being passed the current datum d and index i, with the this context as the current DOM element.
|
|
||||||
* @param p A two-element array [px,py] or a function.
|
|
||||||
* If a function, it is invoked for each selected element, being passed the current datum d and index i, with the this context as the current DOM element.
|
|
||||||
*/
|
|
||||||
scaleBy(
|
|
||||||
selection: Selection<ZoomRefElement, Datum, any, any> | TransitionLike<ZoomRefElement, Datum>,
|
|
||||||
k: number | ValueFn<ZoomRefElement, Datum, number>,
|
|
||||||
p?: [number, number] | ValueFn<ZoomRefElement, Datum, [number, number]>,
|
|
||||||
): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If selection is a selection, scales the current zoom transform of the selected elements to k, such that the new k₁ = k.
|
|
||||||
* The reference point p does move.
|
|
||||||
* If p is not specified, it defaults to the center of the viewport extent.
|
|
||||||
* If selection is a transition, defines a “zoom” tween translating the current transform.
|
|
||||||
* This method is a convenience method for zoom.transform.
|
|
||||||
*
|
|
||||||
* @param selection: A selection or a transition.
|
|
||||||
* @param k Scale factor. A number or a function that returns a number.
|
|
||||||
* If a function, it is invoked for each selected element, being passed the current datum d and index i, with the this context as the current DOM element.
|
|
||||||
* @param p A two-element array [px,py] or a function.
|
|
||||||
* If a function, it is invoked for each selected element, being passed the current datum d and index i, with the this context as the current DOM element.
|
|
||||||
*/
|
|
||||||
scaleTo(
|
|
||||||
selection: Selection<ZoomRefElement, Datum, any, any> | TransitionLike<ZoomRefElement, Datum>,
|
|
||||||
k: number | ValueFn<ZoomRefElement, Datum, number>,
|
|
||||||
p?: [number, number],
|
|
||||||
): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the current constraint function.
|
|
||||||
* The default implementation attempts to ensure that the viewport extent does not go outside the translate extent.
|
|
||||||
*/
|
|
||||||
constrain(): (
|
|
||||||
transform: ZoomTransform,
|
|
||||||
extent: [[number, number], [number, number]],
|
|
||||||
translateExtent: [[number, number], [number, number]],
|
|
||||||
) => ZoomTransform;
|
|
||||||
/**
|
|
||||||
* Sets the transform constraint function to the specified function and returns the zoom behavior.
|
|
||||||
*
|
|
||||||
* @param constraint A constraint function which returns a transform given the current transform, viewport extent and translate extent.
|
|
||||||
* The default implementation attempts to ensure that the viewport extent does not go outside the translate extent.
|
|
||||||
*/
|
|
||||||
constrain(
|
|
||||||
constraint: (
|
|
||||||
transform: ZoomTransform,
|
|
||||||
extent: [[number, number], [number, number]],
|
|
||||||
translateExtent: [[number, number], [number, number]],
|
|
||||||
) => ZoomTransform,
|
|
||||||
): this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the current filter function.
|
|
||||||
*/
|
|
||||||
filter(): (this: ZoomRefElement, event: any, datum: Datum) => boolean;
|
|
||||||
/**
|
|
||||||
* Sets the filter to the specified filter function and returns the zoom behavior.
|
|
||||||
* The filter function is invoked in the zoom initiating event handlers of each element to which the zoom behavior was applied.
|
|
||||||
*
|
|
||||||
* If the filter returns falsey, the initiating event is ignored and no zoom gesture is started.
|
|
||||||
* Thus, the filter determines which input events are ignored. The default filter ignores mousedown events on secondary buttons,
|
|
||||||
* since those buttons are typically intended for other purposes, such as the context menu.
|
|
||||||
*
|
|
||||||
* @param filter A filter function which is invoked in the zoom initiating event handlers of each element to which the zoom behavior was applied,
|
|
||||||
* in order, being passed the current event (event) and datum d, with the this context as the current DOM element.
|
|
||||||
* The function returns a boolean value.
|
|
||||||
*/
|
|
||||||
filter(filter: (this: ZoomRefElement, event: any, datum: Datum) => boolean): this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the current touch support detector, which defaults to a function returning true,
|
|
||||||
* if the "ontouchstart" event is supported on the current element.
|
|
||||||
*/
|
|
||||||
touchable(): ValueFn<ZoomRefElement, Datum, boolean>;
|
|
||||||
/**
|
|
||||||
* Sets the touch support detector to the specified boolean value and returns the zoom behavior.
|
|
||||||
*
|
|
||||||
* Touch event listeners are only registered if the detector returns truthy for the corresponding element when the zoom behavior is applied.
|
|
||||||
* The default detector works well for most browsers that are capable of touch input, but not all; Chrome’s mobile device emulator, for example,
|
|
||||||
* fails detection.
|
|
||||||
*
|
|
||||||
* @param touchable A boolean value. true when touch event listeners should be applied to the corresponding element, otherwise false.
|
|
||||||
*/
|
|
||||||
touchable(touchable: boolean): this;
|
|
||||||
/**
|
|
||||||
* Sets the touch support detector to the specified function and returns the zoom behavior.
|
|
||||||
*
|
|
||||||
* Touch event listeners are only registered if the detector returns truthy for the corresponding element when the zoom behavior is applied.
|
|
||||||
* The default detector works well for most browsers that are capable of touch input, but not all; Chrome’s mobile device emulator, for example,
|
|
||||||
* fails detection.
|
|
||||||
*
|
|
||||||
* @param touchable A touch support detector function, which returns true when touch event listeners should be applied to the corresponding element.
|
|
||||||
* The function is evaluated for each selected element to which the zoom behavior was applied, in order, being passed the current datum (d),
|
|
||||||
* the current index (i), and the current group (nodes), with this as the current DOM element. The function returns a boolean value.
|
|
||||||
*/
|
|
||||||
touchable(touchable: ValueFn<ZoomRefElement, Datum, boolean>): this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the current wheelDelta function.
|
|
||||||
*/
|
|
||||||
wheelDelta(): ValueFn<ZoomRefElement, Datum, number>;
|
|
||||||
/**
|
|
||||||
* Sets the wheel delta function to the specified function and returns the zoom behavior. The wheel delta function which is invoked in the wheel event handler
|
|
||||||
* of each element to which the zoom behavior was applied.
|
|
||||||
* The value Δ returned by the wheel delta function determines the amount of scaling applied in response to a WheelEvent.
|
|
||||||
* The scale factor transform.k is multiplied by 2Δ; for example, a Δ of +1 doubles the scale factor, Δ of -1 halves the scale factor.
|
|
||||||
*
|
|
||||||
* @param delta Wheel delta function which is invoked in the wheel event handler of each element to which the zoom behavior was applied,
|
|
||||||
* in order, being passed the wheel event that triggered the handler,
|
|
||||||
* with this as the current DOM element. The function returns a numeric value.
|
|
||||||
*/
|
|
||||||
wheelDelta(delta: ((event: WheelEvent) => number) | number): this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the current extent accessor, which defaults to [[0, 0], [width, height]] where width is the client width of the element and height is its client height;
|
|
||||||
* for SVG elements, the nearest ancestor SVG element’s width and height is used. In this case,
|
|
||||||
* the owner SVG element must have defined width and height attributes rather than (for example) relying on CSS properties or the viewBox attribute;
|
|
||||||
* SVG provides no programmatic method for retrieving the initial viewport size. Alternatively, consider using element.getBoundingClientRect.
|
|
||||||
* (In Firefox, element.clientWidth and element.clientHeight is zero for SVG elements!)
|
|
||||||
*/
|
|
||||||
extent(): (this: ZoomRefElement, datum: Datum) => [[number, number], [number, number]];
|
|
||||||
/**
|
|
||||||
* Set the viewport extent to the specified array of points [[x0, y0], [x1, y1]],
|
|
||||||
* where [x0, y0] is the top-left corner of the viewport and [x1, y1] is the bottom-right corner of the viewport,
|
|
||||||
* and return this zoom behavior.
|
|
||||||
*
|
|
||||||
* The viewport extent affects several functions: the center of the viewport remains fixed during changes by zoom.scaleBy and zoom.scaleTo;
|
|
||||||
* the viewport center and dimensions affect the path chosen by d3.interpolateZoom; and the viewport extent is needed to enforce the optional translate extent.
|
|
||||||
*
|
|
||||||
* @param extent An extent specified as an array of two coordinates.
|
|
||||||
*/
|
|
||||||
extent(extent: [[number, number], [number, number]]): this;
|
|
||||||
/**
|
|
||||||
* Set the viewport extent to the array of points [[x0, y0], [x1, y1]] returned by the
|
|
||||||
* extent accessor function, and return this zoom behavior.
|
|
||||||
* The extent accessor function is evaluated for each element.
|
|
||||||
*
|
|
||||||
* [x0, y0] is the top-left corner of the viewport and [x1, y1] is the bottom-right corner of the viewport.
|
|
||||||
*
|
|
||||||
* The viewport extent affects several functions: the center of the viewport remains fixed during changes by zoom.scaleBy and zoom.scaleTo;
|
|
||||||
* the viewport center and dimensions affect the path chosen by d3.interpolateZoom; and the viewport extent is needed to enforce the optional translate extent.
|
|
||||||
*
|
|
||||||
* The default is [[0, 0], [width, height]] where width is the client width of the element and height is its client height;
|
|
||||||
* for SVG elements, the nearest ancestor SVG element’s width and height is used.
|
|
||||||
* In this case, the owner SVG element must have defined width and height attributes rather than (for example) relying on CSS properties or the viewBox attribute;
|
|
||||||
* SVG provides no programmatic method for retrieving the initial viewport size. Alternatively, consider using element.getBoundingClientRect.
|
|
||||||
* (In Firefox, element.clientWidth and element.clientHeight is zero for SVG elements!)
|
|
||||||
*
|
|
||||||
* @param extent An extent accessor function which is evaluated for each selected element, being passed the current datum d, with the this context as the current DOM element.
|
|
||||||
* The function returns the extent array.
|
|
||||||
*/
|
|
||||||
extent(extent: (this: ZoomRefElement, datum: Datum) => [[number, number], [number, number]]): this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the current scale extent.
|
|
||||||
*/
|
|
||||||
scaleExtent(): [number, number];
|
|
||||||
/**
|
|
||||||
* Set the scale extent to the specified array of numbers [k0, k1] where k0 is the minimum allowed scale factor and k1 is the maximum allowed scale factor,
|
|
||||||
* and return this zoom behavior.
|
|
||||||
*
|
|
||||||
* The scale extent restricts zooming in and out. It is enforced on interaction and when using zoom.scaleBy, zoom.scaleTo and zoom.translateBy;
|
|
||||||
* however, it is not enforced when using zoom.transform to set the transform explicitly.
|
|
||||||
*
|
|
||||||
* The default scale extent is [0, infinity].
|
|
||||||
*
|
|
||||||
* If the user tries to zoom by wheeling when already at the corresponding limit of the scale extent, the wheel events will be ignored and not initiate a zoom gesture.
|
|
||||||
* This allows the user to scroll down past a zoomable area after zooming in, or to scroll up after zooming out.
|
|
||||||
* If you would prefer to always prevent scrolling on wheel input regardless of the scale extent, register a wheel event listener to prevent the browser default behavior
|
|
||||||
*
|
|
||||||
* @param extent A scale extent array of two numbers representing the scale boundaries.
|
|
||||||
*/
|
|
||||||
scaleExtent(extent: [number, number]): this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the current translate extent.
|
|
||||||
*/
|
|
||||||
translateExtent(): [[number, number], [number, number]];
|
|
||||||
/**
|
|
||||||
* Set the translate extent to the specified array of points [[x0, y0], [x1, y1]], where [x0, y0] is the top-left corner of the world and [x1, y1]
|
|
||||||
* is the bottom-right corner of the world, and return this zoom behavior.
|
|
||||||
*
|
|
||||||
* The translate extent restricts panning, and may cause translation on zoom out. It is enforced on interaction and when using zoom.scaleBy, zoom.scaleTo and zoom.translateBy;
|
|
||||||
* however, it is not enforced when using zoom.transform to set the transform explicitly.
|
|
||||||
*
|
|
||||||
* The default scale extent is [[-infinity, infinity], [-infinity, infinity]].
|
|
||||||
*
|
|
||||||
* @param extent A translate extent array, i.e. an array of two arrays, each representing a point.
|
|
||||||
*/
|
|
||||||
translateExtent(extent: [[number, number], [number, number]]): this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the current click distance threshold, which defaults to zero.
|
|
||||||
*/
|
|
||||||
clickDistance(): number;
|
|
||||||
/**
|
|
||||||
* Set the maximum distance that the mouse can move between mousedown and mouseup that will trigger
|
|
||||||
* a subsequent click event. If at any point between mousedown and mouseup the mouse is greater than or equal to
|
|
||||||
* distance from its position on mousedown, the click event following mouseup will be suppressed.
|
|
||||||
*
|
|
||||||
* @param distance The distance threshold between mousedown and mouseup measured in client coordinates (event.clientX and event.clientY).
|
|
||||||
* The default is zero.
|
|
||||||
*/
|
|
||||||
clickDistance(distance: number): this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the current tap distance threshold, which defaults to 10.
|
|
||||||
*/
|
|
||||||
tapDistance(): number;
|
|
||||||
/**
|
|
||||||
* Sets the maximum distance that a double-tap gesture can move between first touchstart and second touchend that will trigger a subsequent double-click event.
|
|
||||||
*
|
|
||||||
* @param distance The distance threshold between mousedown and mouseup measured in client coordinates (event.clientX and event.clientY).
|
|
||||||
* The default is 10.
|
|
||||||
*/
|
|
||||||
tapDistance(distance: number): this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the duration for zoom transitions on double-click and double-tap in milliseconds.
|
|
||||||
*/
|
|
||||||
duration(): number;
|
|
||||||
/**
|
|
||||||
* Set the duration for zoom transitions on double-click and double-tap to the specified number of milliseconds and returns the zoom behavior.
|
|
||||||
*
|
|
||||||
* To disable double-click and double-tap transitions, you can remove the zoom behavior’s dblclick event listener after applying the zoom behavior to the selection.
|
|
||||||
*
|
|
||||||
* @param duration in milliseconds.
|
|
||||||
*/
|
|
||||||
duration(duration: number): this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the current interpolation factory, which defaults to d3.interpolateZoom to implement smooth zooming.
|
|
||||||
*/
|
|
||||||
interpolate<
|
|
||||||
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
||||||
InterpolationFactory extends (a: ZoomView, b: ZoomView) => (t: number) => ZoomView,
|
|
||||||
>(): InterpolationFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the interpolation factory for zoom transitions to the specified function.
|
|
||||||
* Use the default d3.interpolateZoom to implement smooth zooming.
|
|
||||||
* To apply direct interpolation between two views, try d3.interpolate instead.
|
|
||||||
*
|
|
||||||
* Each view is defined as an array of three numbers: cx, cy and width. The first two coordinates cx, cy represent the center of the viewport;
|
|
||||||
* the last coordinate width represents the size of the viewport.
|
|
||||||
*
|
|
||||||
* @param interpolatorFactory An interpolator factory to be used to generate interpolators between zooms for transitions.
|
|
||||||
*/
|
|
||||||
interpolate(interpolatorFactory: (a: ZoomView, b: ZoomView) => (t: number) => ZoomView): this;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the first currently-assigned listener matching the specified typenames, if any.
|
|
||||||
*
|
|
||||||
* @param typenames The typenames is a string containing one or more typename separated by whitespace.
|
|
||||||
* Each typename is a type, optionally followed by a period (.) and a name, such as "drag.foo"" and "drag.bar";
|
|
||||||
* the name allows multiple listeners to be registered for the same type. The type must be one of the following:
|
|
||||||
* start (after zooming begins [such as mousedown]), zoom (after a change to the zoom transform [such as mousemove], or
|
|
||||||
* end (after an active pointer becomes inactive [such as on mouseup].)
|
|
||||||
*/
|
|
||||||
on(typenames: string): ((this: ZoomRefElement, event: any, d: Datum) => void) | undefined;
|
|
||||||
/**
|
|
||||||
* Remove the current event listeners for the specified typenames, if any, return the drag behavior.
|
|
||||||
*
|
|
||||||
* @param typenames The typenames is a string containing one or more typename separated by whitespace.
|
|
||||||
* Each typename is a type, optionally followed by a period (.) and a name, such as "drag.foo"" and "drag.bar";
|
|
||||||
* the name allows multiple listeners to be registered for the same type. The type must be one of the following:
|
|
||||||
* start (after zooming begins [such as mousedown]), zoom (after a change to the zoom transform [such as mousemove], or
|
|
||||||
* end (after an active pointer becomes inactive [such as on mouseup].)
|
|
||||||
* @param listener Use null to remove the listener.
|
|
||||||
*/
|
|
||||||
on(typenames: string, listener: null): this;
|
|
||||||
/**
|
|
||||||
* Set the event listener for the specified typenames and return the zoom behavior.
|
|
||||||
* If an event listener was already registered for the same type and name,
|
|
||||||
* the existing listener is removed before the new listener is added.
|
|
||||||
* When a specified event is dispatched, each listener will be invoked with the same context and arguments as selection.on listeners.
|
|
||||||
*
|
|
||||||
* @param typenames The typenames is a string containing one or more typename separated by whitespace.
|
|
||||||
* Each typename is a type, optionally followed by a period (.) and a name, such as "drag.foo"" and "drag.bar";
|
|
||||||
* the name allows multiple listeners to be registered for the same type. The type must be one of the following:
|
|
||||||
* start (after zooming begins [such as mousedown]), zoom (after a change to the zoom transform [such as mousemove], or
|
|
||||||
* end (after an active pointer becomes inactive [such as on mouseup].)
|
|
||||||
* @param listener An event listener function which is evaluated for each selected element,
|
|
||||||
* in order, being passed the current event (event) and datum d, with the this context as the current DOM element.
|
|
||||||
*/
|
|
||||||
on(typenames: string, listener: (this: ZoomRefElement, event: any, d: Datum) => void): this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new zoom behavior. The returned behavior, zoom, is both an object and a function,
|
|
||||||
* and is typically applied to selected elements via selection.call.
|
|
||||||
*
|
|
||||||
* The first generic refers to the type of reference element to which the zoom behavior is attached.
|
|
||||||
* The second generic refers to the type of the datum of the reference element.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
||||||
export function zoom<ZoomRefElement extends ZoomedElementBaseType, Datum>(): ZoomBehavior<ZoomRefElement, Datum>;
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
|
||||||
// Zoom Event
|
|
||||||
// --------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A D3 Zoom Event
|
|
||||||
*
|
|
||||||
* The first generic refers to the type of reference element to which the zoom behavior is attached.
|
|
||||||
* The second generic refers to the type of the datum of the reference element.
|
|
||||||
*/
|
|
||||||
export interface D3ZoomEvent<ZoomRefElement extends ZoomedElementBaseType, Datum> {
|
|
||||||
/**
|
|
||||||
* The ZoomBehavior associated with the event
|
|
||||||
*/
|
|
||||||
target: ZoomBehavior<ZoomRefElement, Datum>;
|
|
||||||
/**
|
|
||||||
* The event type for the zoom event
|
|
||||||
*/
|
|
||||||
type: "start" | "zoom" | "end" | string; // Leave failsafe string type for cases like 'zoom.foo'
|
|
||||||
/**
|
|
||||||
* The current zoom transform
|
|
||||||
*/
|
|
||||||
transform: ZoomTransform;
|
|
||||||
/**
|
|
||||||
* The underlying input event, such as mousemove or touchmove.
|
|
||||||
*/
|
|
||||||
sourceEvent: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
|
||||||
// Zoom Transforms
|
|
||||||
// --------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A zoom transform
|
|
||||||
*
|
|
||||||
* The zoom behavior stores the zoom state on the element to which the zoom behavior was applied, not on the zoom behavior itself.
|
|
||||||
* This is because the zoom behavior can be applied to many elements simultaneously, and each element can be zoomed independently.
|
|
||||||
* The zoom state can change either on user interaction or programmatically via zoom.transform.
|
|
||||||
*
|
|
||||||
* To retrieve the zoom state, use event.transform on the current zoom event within a zoom event listener (see zoom.on), or use d3.zoomTransform for a given node.
|
|
||||||
* The latter is particularly useful for modifying the zoom state programmatically,
|
|
||||||
* say to implement buttons for zooming in and out.
|
|
||||||
*
|
|
||||||
* For details see {@link https://github.com/d3/d3-zoom#zoom-transforms}
|
|
||||||
*/
|
|
||||||
export class ZoomTransform {
|
|
||||||
/**
|
|
||||||
* Returns a transform with scale k and translation (x, y).
|
|
||||||
*/
|
|
||||||
constructor(k: number, x: number, y: number);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The translation amount tx along the x-axis.
|
|
||||||
* This property should be considered read-only; instead of mutating a transform,
|
|
||||||
* use transform.scale and transform.translate to derive a new transform.
|
|
||||||
* Also see zoom.scaleBy, zoom.scaleTo and zoom.translateBy for convenience methods on the zoom behavior.
|
|
||||||
*/
|
|
||||||
readonly x: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The translation amount ty along the y-axis
|
|
||||||
* This property should be considered read-only; instead of mutating a transform,
|
|
||||||
* use transform.scale and transform.translate to derive a new transform.
|
|
||||||
* Also see zoom.scaleBy, zoom.scaleTo and zoom.translateBy for convenience methods on the zoom behavior.
|
|
||||||
*/
|
|
||||||
readonly y: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The scale factor k.
|
|
||||||
* This property should be considered read-only; instead of mutating a transform,
|
|
||||||
* use transform.scale and transform.translate to derive a new transform.
|
|
||||||
* Also see zoom.scaleBy, zoom.scaleTo and zoom.translateBy for convenience methods on the zoom behavior.
|
|
||||||
*/
|
|
||||||
readonly k: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the transformation of the specified point which is a two-element array of numbers [x, y].
|
|
||||||
* The returned point is equal to [xk + tx, yk + ty].
|
|
||||||
*
|
|
||||||
* @param point Point coordinates [x, y]
|
|
||||||
*/
|
|
||||||
apply(point: [number, number]): [number, number];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the transformation of the specified x-coordinate, xk + tx.
|
|
||||||
*
|
|
||||||
* @param x Value of x-coordinate.
|
|
||||||
*/
|
|
||||||
applyX(x: number): number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the transformation of the specified y-coordinate, yk + ty.
|
|
||||||
*
|
|
||||||
* @param y Value of y-coordinate.
|
|
||||||
*/
|
|
||||||
applyY(y: number): number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the inverse transformation of the specified point which is a two-element array of numbers [x, y].
|
|
||||||
* The returned point is equal to [(x - tx) / k, (y - ty) / k].
|
|
||||||
*
|
|
||||||
* @param point Point coordinates [x, y]
|
|
||||||
*/
|
|
||||||
invert(point: [number, number]): [number, number];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the inverse transformation of the specified x-coordinate, (x - tx) / k.
|
|
||||||
*
|
|
||||||
* @param x Value of x-coordinate.
|
|
||||||
*/
|
|
||||||
invertX(x: number): number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the inverse transformation of the specified y-coordinate, (y - ty) / k.
|
|
||||||
*
|
|
||||||
* @param y Value of y-coordinate.
|
|
||||||
*/
|
|
||||||
invertY(y: number): number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a copy of the continuous scale x whose domain is transformed.
|
|
||||||
* This is implemented by first applying the inverse x-transform on the scale’s range,
|
|
||||||
* and then applying the inverse scale to compute the corresponding domain
|
|
||||||
*
|
|
||||||
* The scale x must use d3.interpolateNumber; do not use continuous.rangeRound as this
|
|
||||||
* reduces the accuracy of continuous.invert and can lead to an inaccurate rescaled domain.
|
|
||||||
* This method does not modify the input scale x; x thus represents the untransformed scale,
|
|
||||||
* while the returned scale represents its transformed view.
|
|
||||||
*
|
|
||||||
* @param xScale A continuous scale for x-dimension.
|
|
||||||
*/
|
|
||||||
rescaleX<S extends ZoomScale>(xScale: S): S;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a copy of the continuous scale y whose domain is transformed.
|
|
||||||
* This is implemented by first applying the inverse y-transform on the scale’s range,
|
|
||||||
* and then applying the inverse scale to compute the corresponding domain
|
|
||||||
*
|
|
||||||
* The scale y must use d3.interpolateNumber; do not use continuous.rangeRound as this
|
|
||||||
* reduces the accuracy of continuous.invert and can lead to an inaccurate rescaled domain.
|
|
||||||
* This method does not modify the input scale x; x thus represents the untransformed scale,
|
|
||||||
* while the returned scale represents its transformed view.
|
|
||||||
*
|
|
||||||
* @param yScale A continuous scale for y-dimension.
|
|
||||||
*/
|
|
||||||
rescaleY<S extends ZoomScale>(yScale: S): S;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a transform whose scale k1 is equal to k0 × k, where k0 is this transform’s scale.
|
|
||||||
*
|
|
||||||
* @param k A scale factor.
|
|
||||||
*/
|
|
||||||
scale(k: number): ZoomTransform;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a string representing the SVG transform corresponding to this transform.
|
|
||||||
*/
|
|
||||||
toString(): string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a transform whose translation tx1 and ty1 is equal to tx0 + tkx and ty0 + tky,
|
|
||||||
* where tx0 and ty0 is this transform’s translation and tk is this transform’s scale.
|
|
||||||
*
|
|
||||||
* @param x Amount of translation in x-direction.
|
|
||||||
* @param y Amount of translation in y-direction.
|
|
||||||
*/
|
|
||||||
translate(x: number, y: number): ZoomTransform;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the current transform for the specified node. Note that node should typically be a DOM element, and not a selection.
|
|
||||||
* (A selection may consist of multiple nodes, in different states, and this function only returns a single transform.) If you have a selection, call selection.node first.
|
|
||||||
* In the context of an event listener, the node is typically the element that received the input event (which should be equal to event.transform), "this".
|
|
||||||
* Internally, an element’s transform is stored as element.__zoom; however, you should use this method rather than accessing it directly.
|
|
||||||
* If the given node has no defined transform, returns the identity transformation.
|
|
||||||
* The returned transform represents a two-dimensional transformation matrix
|
|
||||||
*
|
|
||||||
* For details see {@link https://github.com/d3/d3-zoom#zoom-transforms}
|
|
||||||
*
|
|
||||||
* @param node An element for which to retrieve its current zoom transform.
|
|
||||||
*/
|
|
||||||
export function zoomTransform(node: ZoomedElementBaseType): ZoomTransform;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The identity transform, where k = 1, tx = ty = 0.
|
|
||||||
*/
|
|
||||||
export const zoomIdentity: ZoomTransform;
|
|
||||||
-48
@@ -1,48 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@types/d3-zoom",
|
|
||||||
"version": "3.0.8",
|
|
||||||
"description": "TypeScript definitions for d3-zoom",
|
|
||||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/d3-zoom",
|
|
||||||
"license": "MIT",
|
|
||||||
"contributors": [
|
|
||||||
{
|
|
||||||
"name": "Tom Wanzek",
|
|
||||||
"githubUsername": "tomwanzek",
|
|
||||||
"url": "https://github.com/tomwanzek"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Alex Ford",
|
|
||||||
"githubUsername": "gustavderdrache",
|
|
||||||
"url": "https://github.com/gustavderdrache"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Boris Yankov",
|
|
||||||
"githubUsername": "borisyankov",
|
|
||||||
"url": "https://github.com/borisyankov"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "denisname",
|
|
||||||
"githubUsername": "denisname",
|
|
||||||
"url": "https://github.com/denisname"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Nathan Bierema",
|
|
||||||
"githubUsername": "Methuselah96",
|
|
||||||
"url": "https://github.com/Methuselah96"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"main": "",
|
|
||||||
"types": "index.d.ts",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
|
||||||
"directory": "types/d3-zoom"
|
|
||||||
},
|
|
||||||
"scripts": {},
|
|
||||||
"dependencies": {
|
|
||||||
"@types/d3-interpolate": "*",
|
|
||||||
"@types/d3-selection": "*"
|
|
||||||
},
|
|
||||||
"typesPublisherContentHash": "19cbff2a5c60ea95d9eaa6d3d1a4ec6f8e60ec8a8560cf1bd2e359f057335776",
|
|
||||||
"typeScriptVersion": "4.5"
|
|
||||||
}
|
|
||||||
-21
@@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2019-present, Yuxi (Evan) You and Vite contributors
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
-169
@@ -1,169 +0,0 @@
|
|||||||
# @vitejs/plugin-react [](https://npmjs.com/package/@vitejs/plugin-react)
|
|
||||||
|
|
||||||
The default Vite plugin for React projects.
|
|
||||||
|
|
||||||
- enable [Fast Refresh](https://www.npmjs.com/package/react-refresh) in development (requires react >= 16.9)
|
|
||||||
- use the [automatic JSX runtime](https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html)
|
|
||||||
- small installation size
|
|
||||||
|
|
||||||
```js
|
|
||||||
// vite.config.js
|
|
||||||
import { defineConfig } from 'vite'
|
|
||||||
import react from '@vitejs/plugin-react'
|
|
||||||
|
|
||||||
export default defineConfig({
|
|
||||||
plugins: [react()],
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
## Options
|
|
||||||
|
|
||||||
### include
|
|
||||||
|
|
||||||
Includes `.js`, `.jsx`, `.ts` & `.tsx` by default. This option can be used to add fast refresh to `.mdx` files:
|
|
||||||
|
|
||||||
```js
|
|
||||||
import { defineConfig } from 'vite'
|
|
||||||
import react from '@vitejs/plugin-react'
|
|
||||||
import mdx from '@mdx-js/rollup'
|
|
||||||
|
|
||||||
export default defineConfig({
|
|
||||||
plugins: [
|
|
||||||
{ enforce: 'pre', ...mdx() },
|
|
||||||
react({ include: /\.(mdx|js|jsx|ts|tsx)$/ }),
|
|
||||||
],
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
### exclude
|
|
||||||
|
|
||||||
The default value is `/node_modules/`. You may use it to exclude JSX/TSX files that runs in a worker or are not React files.
|
|
||||||
Except if explicitly desired, you should keep `node_modules` in the exclude list:
|
|
||||||
|
|
||||||
```js
|
|
||||||
import { defineConfig } from 'vite'
|
|
||||||
import react from '@vitejs/plugin-react'
|
|
||||||
|
|
||||||
export default defineConfig({
|
|
||||||
plugins: [
|
|
||||||
react({ exclude: [/\/pdf\//, /\.solid\.tsx$/, /\/node_modules\//] }),
|
|
||||||
],
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
### jsxImportSource
|
|
||||||
|
|
||||||
Control where the JSX factory is imported from. By default, this is inferred from `jsxImportSource` from corresponding a tsconfig file for a transformed file.
|
|
||||||
|
|
||||||
```js
|
|
||||||
react({ jsxImportSource: '@emotion/react' })
|
|
||||||
```
|
|
||||||
|
|
||||||
### jsxRuntime
|
|
||||||
|
|
||||||
By default, the plugin uses the [automatic JSX runtime](https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html). However, if you encounter any issues, you may opt out using the `jsxRuntime` option.
|
|
||||||
|
|
||||||
```js
|
|
||||||
react({ jsxRuntime: 'classic' })
|
|
||||||
```
|
|
||||||
|
|
||||||
### reactRefreshHost
|
|
||||||
|
|
||||||
The `reactRefreshHost` option is only necessary in a module federation context. It enables HMR to work between a remote & host application. In your remote Vite config, you would add your host origin:
|
|
||||||
|
|
||||||
```js
|
|
||||||
react({ reactRefreshHost: 'http://localhost:3000' })
|
|
||||||
```
|
|
||||||
|
|
||||||
Under the hood, this simply updates the React Fash Refresh runtime URL from `/@react-refresh` to `http://localhost:3000/@react-refresh` to ensure there is only one Refresh runtime across the whole application. Note that if you define `base` option in the host application, you need to include it in the option, like: `http://localhost:3000/{base}`.
|
|
||||||
|
|
||||||
## React Compiler
|
|
||||||
|
|
||||||
[React Compiler](https://react.dev/learn/react-compiler) support is available via the exported `reactCompilerPreset` helper, which requires [`@rolldown/plugin-babel`](https://npmx.dev/package/@rolldown/plugin-babel) and [`babel-plugin-react-compiler`](https://npmx.dev/package/babel-plugin-react-compiler) and [`@babel/core`](https://npmx.dev/package/@babel/core) as peer dependencies:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npm install -D @rolldown/plugin-babel @babel/core babel-plugin-react-compiler
|
|
||||||
```
|
|
||||||
|
|
||||||
If you are using TypeScript, you will also need to install [`@types/babel__core`](https://npmx.dev/package/@types/babel__core):
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npm install -D @types/babel__core
|
|
||||||
```
|
|
||||||
|
|
||||||
```js
|
|
||||||
// vite.config.js
|
|
||||||
import { defineConfig } from 'vite'
|
|
||||||
import react, { reactCompilerPreset } from '@vitejs/plugin-react'
|
|
||||||
import babel from '@rolldown/plugin-babel'
|
|
||||||
|
|
||||||
export default defineConfig({
|
|
||||||
plugins: [react(), babel({ presets: [reactCompilerPreset()] })],
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
The `reactCompilerPreset` accepts an optional options object with the following properties:
|
|
||||||
|
|
||||||
- `compilationMode` — Set to `'annotation'` to only compile components annotated with `"use memo"`.
|
|
||||||
- `target` — Set to `'17'` or `'18'` to target older React versions (uses `react-compiler-runtime` instead of `react/compiler-runtime`).
|
|
||||||
|
|
||||||
Additional options can be found in the [documentation](https://react.dev/reference/react-compiler/configuration).
|
|
||||||
|
|
||||||
```js
|
|
||||||
babel({
|
|
||||||
presets: [reactCompilerPreset({ compilationMode: 'annotation' })],
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
> [!TIP]
|
|
||||||
>
|
|
||||||
> `reactCompilerPreset` is only a convenient helper with a preconfigured filter. You can configure override the filters to fit your project structure or code. For example, if you know a large portion of your files are never React/hook-related or won't benefit from the React Compiler, you can aggressively exclude them via `rolldown.filter`:
|
|
||||||
>
|
|
||||||
> ```js
|
|
||||||
> const myPreset = reactCompilerPreset()
|
|
||||||
> myPreset.rolldown.filter.id.exclude = ['src/legacy/**', 'src/utils/**']
|
|
||||||
>
|
|
||||||
> babel({
|
|
||||||
> presets: [myPreset],
|
|
||||||
> })
|
|
||||||
> ```
|
|
||||||
|
|
||||||
## `@vitejs/plugin-react/preamble`
|
|
||||||
|
|
||||||
The package provides `@vitejs/plugin-react/preamble` to initialize HMR runtime from client entrypoint for SSR applications which don't use [`transformIndexHtml` API](https://vite.dev/guide/api-javascript.html#vitedevserver). For example:
|
|
||||||
|
|
||||||
```js
|
|
||||||
// [entry.client.js]
|
|
||||||
import '@vitejs/plugin-react/preamble'
|
|
||||||
```
|
|
||||||
|
|
||||||
Alternatively, you can manually call `transformIndexHtml` during SSR, which sets up equivalent initialization code. Here's an example for an Express server:
|
|
||||||
|
|
||||||
```js
|
|
||||||
app.get('/', async (req, res, next) => {
|
|
||||||
try {
|
|
||||||
let html = fs.readFileSync(path.resolve(root, 'index.html'), 'utf-8')
|
|
||||||
|
|
||||||
// Transform HTML using Vite plugins.
|
|
||||||
html = await viteServer.transformIndexHtml(req.url, html)
|
|
||||||
|
|
||||||
res.send(html)
|
|
||||||
} catch (e) {
|
|
||||||
return next(e)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
Otherwise, you'll get the following error:
|
|
||||||
|
|
||||||
```
|
|
||||||
Uncaught Error: @vitejs/plugin-react can't detect preamble. Something is wrong.
|
|
||||||
```
|
|
||||||
|
|
||||||
## Consistent components exports
|
|
||||||
|
|
||||||
For React refresh to work correctly, your file should only export React components. You can find a good explanation in the [Gatsby docs](https://www.gatsbyjs.com/docs/reference/local-development/fast-refresh/#how-it-works).
|
|
||||||
|
|
||||||
If an incompatible change in exports is found, the module will be invalidated and HMR will propagate. To make it easier to export simple constants alongside your component, the module is only invalidated when their value changes.
|
|
||||||
|
|
||||||
You can catch mistakes and get more detailed warnings with this [ESLint rule](https://github.com/ArnaudBarre/eslint-plugin-react-refresh), or the equivalent [Oxlint rule](https://oxc.rs/docs/guide/usage/linter/rules/react/only-export-components.html).
|
|
||||||
-48
@@ -1,48 +0,0 @@
|
|||||||
import { Plugin } from "vite";
|
|
||||||
import { ReactCompilerBabelPluginOptions, RolldownBabelPreset } from "#optionalTypes";
|
|
||||||
|
|
||||||
//#region src/reactCompilerPreset.d.ts
|
|
||||||
declare const reactCompilerPreset: (options?: ReactCompilerBabelPluginOptions) => RolldownBabelPreset;
|
|
||||||
//#endregion
|
|
||||||
//#region src/index.d.ts
|
|
||||||
interface Options {
|
|
||||||
/**
|
|
||||||
* Can be used to process extra files like `.mdx`
|
|
||||||
* @example include: /\.(mdx|js|jsx|ts|tsx)$/
|
|
||||||
* @default /\.[tj]sx?$/
|
|
||||||
*/
|
|
||||||
include?: string | RegExp | Array<string | RegExp>;
|
|
||||||
/**
|
|
||||||
* Can be used to exclude JSX/TSX files that runs in a worker or are not React files.
|
|
||||||
* Except if explicitly desired, you should keep node_modules in the exclude list
|
|
||||||
* @example exclude: [/\/pdf\//, /\.solid\.tsx$/, /\/node_modules\//]
|
|
||||||
* @default /\/node_modules\//
|
|
||||||
*/
|
|
||||||
exclude?: string | RegExp | Array<string | RegExp>;
|
|
||||||
/**
|
|
||||||
* Control where the JSX factory is imported from.
|
|
||||||
* https://oxc.rs/docs/guide/usage/transformer/jsx.html#import-source
|
|
||||||
* @default 'react'
|
|
||||||
*/
|
|
||||||
jsxImportSource?: string;
|
|
||||||
/**
|
|
||||||
* Note: Skipping React import with classic runtime is not supported from v4
|
|
||||||
* @default "automatic"
|
|
||||||
*/
|
|
||||||
jsxRuntime?: 'classic' | 'automatic';
|
|
||||||
/**
|
|
||||||
* React Fast Refresh runtime URL prefix.
|
|
||||||
* Useful in a module federation context to enable HMR by specifying
|
|
||||||
* the host application URL in the Vite config of a remote application.
|
|
||||||
* @example
|
|
||||||
* reactRefreshHost: 'http://localhost:3000'
|
|
||||||
*/
|
|
||||||
reactRefreshHost?: string;
|
|
||||||
}
|
|
||||||
declare function viteReact(opts?: Options): Plugin[];
|
|
||||||
declare namespace viteReact {
|
|
||||||
var preambleCode: string;
|
|
||||||
}
|
|
||||||
declare function viteReactForCjs(this: unknown, options: Options): Plugin[];
|
|
||||||
//#endregion
|
|
||||||
export { Options, viteReact as default, viteReactForCjs as "module.exports", reactCompilerPreset };
|
|
||||||
-199
@@ -1,199 +0,0 @@
|
|||||||
import { readFileSync } from "node:fs";
|
|
||||||
import { dirname, join } from "node:path";
|
|
||||||
import { fileURLToPath } from "node:url";
|
|
||||||
import { exactRegex, makeIdFiltersToMatchWithQuery } from "@rolldown/pluginutils";
|
|
||||||
import { reactRefreshWrapperPlugin } from "vite/internal";
|
|
||||||
//#region ../common/refresh-utils.ts
|
|
||||||
const runtimePublicPath = "/@react-refresh";
|
|
||||||
const preambleCode = `import { injectIntoGlobalHook } from "__BASE__${runtimePublicPath.slice(1)}";
|
|
||||||
injectIntoGlobalHook(window);
|
|
||||||
window.$RefreshReg$ = () => {};
|
|
||||||
window.$RefreshSig$ = () => (type) => type;`;
|
|
||||||
const getPreambleCode = (base) => preambleCode.replace("__BASE__", base);
|
|
||||||
function virtualPreamblePlugin({ name, isEnabled }) {
|
|
||||||
return {
|
|
||||||
name: "vite:react-virtual-preamble",
|
|
||||||
resolveId: {
|
|
||||||
order: "pre",
|
|
||||||
filter: { id: exactRegex(name) },
|
|
||||||
handler(source) {
|
|
||||||
if (source === name) return "\0" + source;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
load: {
|
|
||||||
filter: { id: exactRegex("\0" + name) },
|
|
||||||
handler(id) {
|
|
||||||
if (id === "\0" + name) {
|
|
||||||
if (isEnabled()) return preambleCode.replace("__BASE__", "/");
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
//#endregion
|
|
||||||
//#region ../common/warning.ts
|
|
||||||
const silenceUseClientWarning = (userConfig) => ({ rollupOptions: { onwarn(warning, defaultHandler) {
|
|
||||||
if (warning.code === "MODULE_LEVEL_DIRECTIVE" && (warning.message.includes("use client") || warning.message.includes("use server"))) return;
|
|
||||||
if (warning.code === "SOURCEMAP_ERROR" && warning.message.includes("resolve original location") && warning.pos === 0) return;
|
|
||||||
if (userConfig.build?.rollupOptions?.onwarn) userConfig.build.rollupOptions.onwarn(warning, defaultHandler);
|
|
||||||
else defaultHandler(warning);
|
|
||||||
} } });
|
|
||||||
//#endregion
|
|
||||||
//#region src/reactCompilerPreset.ts
|
|
||||||
const reactCompilerPreset = (options = {}) => ({
|
|
||||||
preset: () => ({ plugins: [["babel-plugin-react-compiler", options]] }),
|
|
||||||
rolldown: {
|
|
||||||
filter: { code: options.compilationMode === "annotation" ? /['"]use memo['"]/ : /\b[A-Z]|\buse/ },
|
|
||||||
applyToEnvironmentHook: (env) => env.config.consumer === "client",
|
|
||||||
optimizeDeps: { include: options.target === "17" || options.target === "18" ? ["react-compiler-runtime"] : ["react/compiler-runtime"] }
|
|
||||||
}
|
|
||||||
});
|
|
||||||
//#endregion
|
|
||||||
//#region src/index.ts
|
|
||||||
const refreshRuntimePath = join(dirname(fileURLToPath(import.meta.url)), "refresh-runtime.js");
|
|
||||||
const defaultIncludeRE = /\.[tj]sx?$/;
|
|
||||||
const defaultExcludeRE = /\/node_modules\//;
|
|
||||||
function viteReact(opts = {}) {
|
|
||||||
const include = opts.include ?? defaultIncludeRE;
|
|
||||||
const exclude = opts.exclude ?? defaultExcludeRE;
|
|
||||||
const jsxImportSource = opts.jsxImportSource ?? "react";
|
|
||||||
const jsxImportRuntime = `${jsxImportSource}/jsx-runtime`;
|
|
||||||
const jsxImportDevRuntime = `${jsxImportSource}/jsx-dev-runtime`;
|
|
||||||
let runningInVite = false;
|
|
||||||
let isProduction = true;
|
|
||||||
let skipFastRefresh = true;
|
|
||||||
let base;
|
|
||||||
let isBundledDev = false;
|
|
||||||
const viteBabel = {
|
|
||||||
name: "vite:react-babel",
|
|
||||||
enforce: "pre",
|
|
||||||
config(_userConfig, { command }) {
|
|
||||||
if (opts.jsxRuntime === "classic") return { oxc: {
|
|
||||||
jsx: {
|
|
||||||
runtime: "classic",
|
|
||||||
refresh: command === "serve"
|
|
||||||
},
|
|
||||||
jsxRefreshInclude: makeIdFiltersToMatchWithQuery(include),
|
|
||||||
jsxRefreshExclude: makeIdFiltersToMatchWithQuery(exclude)
|
|
||||||
} };
|
|
||||||
else return {
|
|
||||||
oxc: {
|
|
||||||
jsx: {
|
|
||||||
runtime: "automatic",
|
|
||||||
importSource: opts.jsxImportSource,
|
|
||||||
refresh: command === "serve"
|
|
||||||
},
|
|
||||||
jsxRefreshInclude: makeIdFiltersToMatchWithQuery(include),
|
|
||||||
jsxRefreshExclude: makeIdFiltersToMatchWithQuery(exclude)
|
|
||||||
},
|
|
||||||
optimizeDeps: { rolldownOptions: { transform: { jsx: { runtime: "automatic" } } } }
|
|
||||||
};
|
|
||||||
},
|
|
||||||
configResolved(config) {
|
|
||||||
runningInVite = true;
|
|
||||||
base = config.base;
|
|
||||||
if (config.experimental.bundledDev) isBundledDev = true;
|
|
||||||
isProduction = config.isProduction;
|
|
||||||
skipFastRefresh = isProduction || config.command === "build" || config.server.hmr === false;
|
|
||||||
},
|
|
||||||
options(options) {
|
|
||||||
if (!runningInVite) {
|
|
||||||
options.transform ??= {};
|
|
||||||
options.transform.jsx = {
|
|
||||||
runtime: opts.jsxRuntime,
|
|
||||||
importSource: opts.jsxImportSource
|
|
||||||
};
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const viteRefreshWrapper = {
|
|
||||||
name: "vite:react:refresh-wrapper",
|
|
||||||
apply: "serve",
|
|
||||||
async applyToEnvironment(env) {
|
|
||||||
if (env.config.consumer !== "client" || skipFastRefresh) return false;
|
|
||||||
return reactRefreshWrapperPlugin({
|
|
||||||
cwd: process.cwd(),
|
|
||||||
include: makeIdFiltersToMatchWithQuery(include),
|
|
||||||
exclude: makeIdFiltersToMatchWithQuery(exclude),
|
|
||||||
jsxImportSource,
|
|
||||||
reactRefreshHost: opts.reactRefreshHost ?? ""
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const viteConfigPost = {
|
|
||||||
name: "vite:react:config-post",
|
|
||||||
enforce: "post",
|
|
||||||
config(userConfig) {
|
|
||||||
if (userConfig.server?.hmr === false) return { oxc: { jsx: { refresh: false } } };
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const viteReactRefreshBundledDevMode = {
|
|
||||||
name: "vite:react-refresh-fbm",
|
|
||||||
enforce: "pre",
|
|
||||||
transformIndexHtml: {
|
|
||||||
handler() {
|
|
||||||
if (!skipFastRefresh && isBundledDev) return [{
|
|
||||||
tag: "script",
|
|
||||||
attrs: { type: "module" },
|
|
||||||
children: getPreambleCode(base)
|
|
||||||
}];
|
|
||||||
},
|
|
||||||
order: "pre"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const dependencies = [
|
|
||||||
"react",
|
|
||||||
"react-dom",
|
|
||||||
jsxImportDevRuntime,
|
|
||||||
jsxImportRuntime
|
|
||||||
];
|
|
||||||
return [
|
|
||||||
viteBabel,
|
|
||||||
viteRefreshWrapper,
|
|
||||||
viteConfigPost,
|
|
||||||
viteReactRefreshBundledDevMode,
|
|
||||||
{
|
|
||||||
name: "vite:react-refresh",
|
|
||||||
enforce: "pre",
|
|
||||||
config: (userConfig) => ({
|
|
||||||
build: silenceUseClientWarning(userConfig),
|
|
||||||
optimizeDeps: { include: dependencies }
|
|
||||||
}),
|
|
||||||
resolveId: {
|
|
||||||
filter: { id: exactRegex(runtimePublicPath) },
|
|
||||||
handler(id) {
|
|
||||||
if (id === "/@react-refresh") return id;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
load: {
|
|
||||||
filter: { id: exactRegex(runtimePublicPath) },
|
|
||||||
handler(id) {
|
|
||||||
if (id === "/@react-refresh") return readFileSync(refreshRuntimePath, "utf-8").replace(/__README_URL__/g, "https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
transformIndexHtml() {
|
|
||||||
if (!skipFastRefresh && !isBundledDev) return [{
|
|
||||||
tag: "script",
|
|
||||||
attrs: { type: "module" },
|
|
||||||
children: getPreambleCode(base)
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
},
|
|
||||||
virtualPreamblePlugin({
|
|
||||||
name: "@vitejs/plugin-react/preamble",
|
|
||||||
isEnabled: () => !skipFastRefresh && !isBundledDev
|
|
||||||
})
|
|
||||||
];
|
|
||||||
}
|
|
||||||
viteReact.preambleCode = preambleCode;
|
|
||||||
function viteReactForCjs(options) {
|
|
||||||
return viteReact.call(this, options);
|
|
||||||
}
|
|
||||||
Object.assign(viteReactForCjs, {
|
|
||||||
default: viteReactForCjs,
|
|
||||||
reactCompilerPreset
|
|
||||||
});
|
|
||||||
//#endregion
|
|
||||||
export { viteReact as default, viteReactForCjs as "module.exports", reactCompilerPreset };
|
|
||||||
-663
@@ -1,663 +0,0 @@
|
|||||||
/* global window */
|
|
||||||
/* eslint-disable eqeqeq, prefer-const, @typescript-eslint/no-empty-function */
|
|
||||||
|
|
||||||
/*! Copyright (c) Meta Platforms, Inc. and affiliates. **/
|
|
||||||
/**
|
|
||||||
* This is simplified pure-js version of https://github.com/facebook/react/blob/main/packages/react-refresh/src/ReactFreshRuntime.js
|
|
||||||
* without IE11 compatibility and verbose isDev checks.
|
|
||||||
* Some utils are appended at the bottom for HMR integration.
|
|
||||||
*/
|
|
||||||
|
|
||||||
const REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref')
|
|
||||||
const REACT_MEMO_TYPE = Symbol.for('react.memo')
|
|
||||||
|
|
||||||
// We never remove these associations.
|
|
||||||
// It's OK to reference families, but use WeakMap/Set for types.
|
|
||||||
let allFamiliesByID = new Map()
|
|
||||||
let allFamiliesByType = new WeakMap()
|
|
||||||
let allSignaturesByType = new WeakMap()
|
|
||||||
|
|
||||||
// This WeakMap is read by React, so we only put families
|
|
||||||
// that have actually been edited here. This keeps checks fast.
|
|
||||||
const updatedFamiliesByType = new WeakMap()
|
|
||||||
|
|
||||||
// This is cleared on every performReactRefresh() call.
|
|
||||||
// It is an array of [Family, NextType] tuples.
|
|
||||||
let pendingUpdates = []
|
|
||||||
|
|
||||||
// This is injected by the renderer via DevTools global hook.
|
|
||||||
const helpersByRendererID = new Map()
|
|
||||||
|
|
||||||
const helpersByRoot = new Map()
|
|
||||||
|
|
||||||
// We keep track of mounted roots so we can schedule updates.
|
|
||||||
const mountedRoots = new Set()
|
|
||||||
// If a root captures an error, we remember it so we can retry on edit.
|
|
||||||
const failedRoots = new Set()
|
|
||||||
|
|
||||||
// We also remember the last element for every root.
|
|
||||||
// It needs to be weak because we do this even for roots that failed to mount.
|
|
||||||
// If there is no WeakMap, we won't attempt to do retrying.
|
|
||||||
let rootElements = new WeakMap()
|
|
||||||
let isPerformingRefresh = false
|
|
||||||
|
|
||||||
function computeFullKey(signature) {
|
|
||||||
if (signature.fullKey !== null) {
|
|
||||||
return signature.fullKey
|
|
||||||
}
|
|
||||||
|
|
||||||
let fullKey = signature.ownKey
|
|
||||||
let hooks
|
|
||||||
try {
|
|
||||||
hooks = signature.getCustomHooks()
|
|
||||||
} catch (err) {
|
|
||||||
// This can happen in an edge case, e.g. if expression like Foo.useSomething
|
|
||||||
// depends on Foo which is lazily initialized during rendering.
|
|
||||||
// In that case just assume we'll have to remount.
|
|
||||||
signature.forceReset = true
|
|
||||||
signature.fullKey = fullKey
|
|
||||||
return fullKey
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < hooks.length; i++) {
|
|
||||||
const hook = hooks[i]
|
|
||||||
if (typeof hook !== 'function') {
|
|
||||||
// Something's wrong. Assume we need to remount.
|
|
||||||
signature.forceReset = true
|
|
||||||
signature.fullKey = fullKey
|
|
||||||
return fullKey
|
|
||||||
}
|
|
||||||
const nestedHookSignature = allSignaturesByType.get(hook)
|
|
||||||
if (nestedHookSignature === undefined) {
|
|
||||||
// No signature means Hook wasn't in the source code, e.g. in a library.
|
|
||||||
// We'll skip it because we can assume it won't change during this session.
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
const nestedHookKey = computeFullKey(nestedHookSignature)
|
|
||||||
if (nestedHookSignature.forceReset) {
|
|
||||||
signature.forceReset = true
|
|
||||||
}
|
|
||||||
fullKey += '\n---\n' + nestedHookKey
|
|
||||||
}
|
|
||||||
|
|
||||||
signature.fullKey = fullKey
|
|
||||||
return fullKey
|
|
||||||
}
|
|
||||||
|
|
||||||
function haveEqualSignatures(prevType, nextType) {
|
|
||||||
const prevSignature = allSignaturesByType.get(prevType)
|
|
||||||
const nextSignature = allSignaturesByType.get(nextType)
|
|
||||||
|
|
||||||
if (prevSignature === undefined && nextSignature === undefined) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
if (prevSignature === undefined || nextSignature === undefined) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if (computeFullKey(prevSignature) !== computeFullKey(nextSignature)) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if (nextSignature.forceReset) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
function isReactClass(type) {
|
|
||||||
return type.prototype && type.prototype.isReactComponent
|
|
||||||
}
|
|
||||||
|
|
||||||
function canPreserveStateBetween(prevType, nextType) {
|
|
||||||
if (isReactClass(prevType) || isReactClass(nextType)) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if (haveEqualSignatures(prevType, nextType)) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
function resolveFamily(type) {
|
|
||||||
// Only check updated types to keep lookups fast.
|
|
||||||
return updatedFamiliesByType.get(type)
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is a safety mechanism to protect against rogue getters and Proxies.
|
|
||||||
function getProperty(object, property) {
|
|
||||||
try {
|
|
||||||
return object[property]
|
|
||||||
} catch (err) {
|
|
||||||
// Intentionally ignore.
|
|
||||||
return undefined
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function performReactRefresh() {
|
|
||||||
if (pendingUpdates.length === 0) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
if (isPerformingRefresh) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
isPerformingRefresh = true
|
|
||||||
try {
|
|
||||||
const staleFamilies = new Set()
|
|
||||||
const updatedFamilies = new Set()
|
|
||||||
|
|
||||||
const updates = pendingUpdates
|
|
||||||
pendingUpdates = []
|
|
||||||
updates.forEach(([family, nextType]) => {
|
|
||||||
// Now that we got a real edit, we can create associations
|
|
||||||
// that will be read by the React reconciler.
|
|
||||||
const prevType = family.current
|
|
||||||
updatedFamiliesByType.set(prevType, family)
|
|
||||||
updatedFamiliesByType.set(nextType, family)
|
|
||||||
family.current = nextType
|
|
||||||
|
|
||||||
// Determine whether this should be a re-render or a re-mount.
|
|
||||||
if (canPreserveStateBetween(prevType, nextType)) {
|
|
||||||
updatedFamilies.add(family)
|
|
||||||
} else {
|
|
||||||
staleFamilies.add(family)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// TODO: rename these fields to something more meaningful.
|
|
||||||
const update = {
|
|
||||||
updatedFamilies, // Families that will re-render preserving state
|
|
||||||
staleFamilies, // Families that will be remounted
|
|
||||||
}
|
|
||||||
|
|
||||||
helpersByRendererID.forEach((helpers) => {
|
|
||||||
// Even if there are no roots, set the handler on first update.
|
|
||||||
// This ensures that if *new* roots are mounted, they'll use the resolve handler.
|
|
||||||
helpers.setRefreshHandler(resolveFamily)
|
|
||||||
})
|
|
||||||
|
|
||||||
let didError = false
|
|
||||||
let firstError = null
|
|
||||||
|
|
||||||
// We snapshot maps and sets that are mutated during commits.
|
|
||||||
// If we don't do this, there is a risk they will be mutated while
|
|
||||||
// we iterate over them. For example, trying to recover a failed root
|
|
||||||
// may cause another root to be added to the failed list -- an infinite loop.
|
|
||||||
const failedRootsSnapshot = new Set(failedRoots)
|
|
||||||
const mountedRootsSnapshot = new Set(mountedRoots)
|
|
||||||
const helpersByRootSnapshot = new Map(helpersByRoot)
|
|
||||||
|
|
||||||
failedRootsSnapshot.forEach((root) => {
|
|
||||||
const helpers = helpersByRootSnapshot.get(root)
|
|
||||||
if (helpers === undefined) {
|
|
||||||
throw new Error(
|
|
||||||
'Could not find helpers for a root. This is a bug in React Refresh.',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
if (!failedRoots.has(root)) {
|
|
||||||
// No longer failed.
|
|
||||||
}
|
|
||||||
if (rootElements === null) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!rootElements.has(root)) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const element = rootElements.get(root)
|
|
||||||
try {
|
|
||||||
helpers.scheduleRoot(root, element)
|
|
||||||
} catch (err) {
|
|
||||||
if (!didError) {
|
|
||||||
didError = true
|
|
||||||
firstError = err
|
|
||||||
}
|
|
||||||
// Keep trying other roots.
|
|
||||||
}
|
|
||||||
})
|
|
||||||
mountedRootsSnapshot.forEach((root) => {
|
|
||||||
const helpers = helpersByRootSnapshot.get(root)
|
|
||||||
if (helpers === undefined) {
|
|
||||||
throw new Error(
|
|
||||||
'Could not find helpers for a root. This is a bug in React Refresh.',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
if (!mountedRoots.has(root)) {
|
|
||||||
// No longer mounted.
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
helpers.scheduleRefresh(root, update)
|
|
||||||
} catch (err) {
|
|
||||||
if (!didError) {
|
|
||||||
didError = true
|
|
||||||
firstError = err
|
|
||||||
}
|
|
||||||
// Keep trying other roots.
|
|
||||||
}
|
|
||||||
})
|
|
||||||
if (didError) {
|
|
||||||
throw firstError
|
|
||||||
}
|
|
||||||
return update
|
|
||||||
} finally {
|
|
||||||
isPerformingRefresh = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function register(type, id) {
|
|
||||||
if (type === null) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (typeof type !== 'function' && typeof type !== 'object') {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// This can happen in an edge case, e.g. if we register
|
|
||||||
// return value of a HOC but it returns a cached component.
|
|
||||||
// Ignore anything but the first registration for each type.
|
|
||||||
if (allFamiliesByType.has(type)) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// Create family or remember to update it.
|
|
||||||
// None of this bookkeeping affects reconciliation
|
|
||||||
// until the first performReactRefresh() call above.
|
|
||||||
let family = allFamiliesByID.get(id)
|
|
||||||
if (family === undefined) {
|
|
||||||
family = { current: type }
|
|
||||||
allFamiliesByID.set(id, family)
|
|
||||||
} else {
|
|
||||||
pendingUpdates.push([family, type])
|
|
||||||
}
|
|
||||||
allFamiliesByType.set(type, family)
|
|
||||||
|
|
||||||
// Visit inner types because we might not have registered them.
|
|
||||||
if (typeof type === 'object' && type !== null) {
|
|
||||||
switch (getProperty(type, '$$typeof')) {
|
|
||||||
case REACT_FORWARD_REF_TYPE:
|
|
||||||
register(type.render, id + '$render')
|
|
||||||
break
|
|
||||||
case REACT_MEMO_TYPE:
|
|
||||||
register(type.type, id + '$type')
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setSignature(type, key, forceReset, getCustomHooks) {
|
|
||||||
if (!allSignaturesByType.has(type)) {
|
|
||||||
allSignaturesByType.set(type, {
|
|
||||||
forceReset,
|
|
||||||
ownKey: key,
|
|
||||||
fullKey: null,
|
|
||||||
getCustomHooks: getCustomHooks || (() => []),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
// Visit inner types because we might not have signed them.
|
|
||||||
if (typeof type === 'object' && type !== null) {
|
|
||||||
switch (getProperty(type, '$$typeof')) {
|
|
||||||
case REACT_FORWARD_REF_TYPE:
|
|
||||||
setSignature(type.render, key, forceReset, getCustomHooks)
|
|
||||||
break
|
|
||||||
case REACT_MEMO_TYPE:
|
|
||||||
setSignature(type.type, key, forceReset, getCustomHooks)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is lazily called during first render for a type.
|
|
||||||
// It captures Hook list at that time so inline requires don't break comparisons.
|
|
||||||
function collectCustomHooksForSignature(type) {
|
|
||||||
const signature = allSignaturesByType.get(type)
|
|
||||||
if (signature !== undefined) {
|
|
||||||
computeFullKey(signature)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function injectIntoGlobalHook(globalObject) {
|
|
||||||
// For React Native, the global hook will be set up by require('react-devtools-core').
|
|
||||||
// That code will run before us. So we need to monkeypatch functions on existing hook.
|
|
||||||
|
|
||||||
// For React Web, the global hook will be set up by the extension.
|
|
||||||
// This will also run before us.
|
|
||||||
let hook = globalObject.__REACT_DEVTOOLS_GLOBAL_HOOK__
|
|
||||||
if (hook === undefined) {
|
|
||||||
// However, if there is no DevTools extension, we'll need to set up the global hook ourselves.
|
|
||||||
// Note that in this case it's important that renderer code runs *after* this method call.
|
|
||||||
// Otherwise, the renderer will think that there is no global hook, and won't do the injection.
|
|
||||||
let nextID = 0
|
|
||||||
globalObject.__REACT_DEVTOOLS_GLOBAL_HOOK__ = hook = {
|
|
||||||
renderers: new Map(),
|
|
||||||
supportsFiber: true,
|
|
||||||
inject: (injected) => nextID++,
|
|
||||||
onScheduleFiberRoot: (id, root, children) => {},
|
|
||||||
onCommitFiberRoot: (id, root, maybePriorityLevel, didError) => {},
|
|
||||||
onCommitFiberUnmount() {},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hook.isDisabled) {
|
|
||||||
// This isn't a real property on the hook, but it can be set to opt out
|
|
||||||
// of DevTools integration and associated warnings and logs.
|
|
||||||
// Using console['warn'] to evade Babel and ESLint
|
|
||||||
console['warn'](
|
|
||||||
'Something has shimmed the React DevTools global hook (__REACT_DEVTOOLS_GLOBAL_HOOK__). ' +
|
|
||||||
'Fast Refresh is not compatible with this shim and will be disabled.',
|
|
||||||
)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Here, we just want to get a reference to scheduleRefresh.
|
|
||||||
const oldInject = hook.inject
|
|
||||||
hook.inject = function (injected) {
|
|
||||||
const id = oldInject.apply(this, arguments)
|
|
||||||
if (
|
|
||||||
typeof injected.scheduleRefresh === 'function' &&
|
|
||||||
typeof injected.setRefreshHandler === 'function'
|
|
||||||
) {
|
|
||||||
// This version supports React Refresh.
|
|
||||||
helpersByRendererID.set(id, injected)
|
|
||||||
}
|
|
||||||
return id
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do the same for any already injected roots.
|
|
||||||
// This is useful if ReactDOM has already been initialized.
|
|
||||||
// https://github.com/facebook/react/issues/17626
|
|
||||||
hook.renderers.forEach((injected, id) => {
|
|
||||||
if (
|
|
||||||
typeof injected.scheduleRefresh === 'function' &&
|
|
||||||
typeof injected.setRefreshHandler === 'function'
|
|
||||||
) {
|
|
||||||
// This version supports React Refresh.
|
|
||||||
helpersByRendererID.set(id, injected)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// We also want to track currently mounted roots.
|
|
||||||
const oldOnCommitFiberRoot = hook.onCommitFiberRoot
|
|
||||||
const oldOnScheduleFiberRoot = hook.onScheduleFiberRoot || (() => {})
|
|
||||||
hook.onScheduleFiberRoot = function (id, root, children) {
|
|
||||||
if (!isPerformingRefresh) {
|
|
||||||
// If it was intentionally scheduled, don't attempt to restore.
|
|
||||||
// This includes intentionally scheduled unmounts.
|
|
||||||
failedRoots.delete(root)
|
|
||||||
if (rootElements !== null) {
|
|
||||||
rootElements.set(root, children)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return oldOnScheduleFiberRoot.apply(this, arguments)
|
|
||||||
}
|
|
||||||
hook.onCommitFiberRoot = function (id, root, maybePriorityLevel, didError) {
|
|
||||||
const helpers = helpersByRendererID.get(id)
|
|
||||||
if (helpers !== undefined) {
|
|
||||||
helpersByRoot.set(root, helpers)
|
|
||||||
|
|
||||||
const current = root.current
|
|
||||||
const alternate = current.alternate
|
|
||||||
|
|
||||||
// We need to determine whether this root has just (un)mounted.
|
|
||||||
// This logic is copy-pasted from similar logic in the DevTools backend.
|
|
||||||
// If this breaks with some refactoring, you'll want to update DevTools too.
|
|
||||||
|
|
||||||
if (alternate !== null) {
|
|
||||||
const wasMounted =
|
|
||||||
alternate.memoizedState != null &&
|
|
||||||
alternate.memoizedState.element != null &&
|
|
||||||
mountedRoots.has(root)
|
|
||||||
|
|
||||||
const isMounted =
|
|
||||||
current.memoizedState != null && current.memoizedState.element != null
|
|
||||||
|
|
||||||
if (!wasMounted && isMounted) {
|
|
||||||
// Mount a new root.
|
|
||||||
mountedRoots.add(root)
|
|
||||||
failedRoots.delete(root)
|
|
||||||
} else if (wasMounted && isMounted) {
|
|
||||||
// Update an existing root.
|
|
||||||
// This doesn't affect our mounted root Set.
|
|
||||||
} else if (wasMounted && !isMounted) {
|
|
||||||
// Unmount an existing root.
|
|
||||||
mountedRoots.delete(root)
|
|
||||||
if (didError) {
|
|
||||||
// We'll remount it on future edits.
|
|
||||||
failedRoots.add(root)
|
|
||||||
} else {
|
|
||||||
helpersByRoot.delete(root)
|
|
||||||
}
|
|
||||||
} else if (!wasMounted && !isMounted) {
|
|
||||||
if (didError) {
|
|
||||||
// We'll remount it on future edits.
|
|
||||||
failedRoots.add(root)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Mount a new root.
|
|
||||||
mountedRoots.add(root)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Always call the decorated DevTools hook.
|
|
||||||
return oldOnCommitFiberRoot.apply(this, arguments)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is a wrapper over more primitive functions for setting signature.
|
|
||||||
// Signatures let us decide whether the Hook order has changed on refresh.
|
|
||||||
//
|
|
||||||
// This function is intended to be used as a transform target, e.g.:
|
|
||||||
// var _s = createSignatureFunctionForTransform()
|
|
||||||
//
|
|
||||||
// function Hello() {
|
|
||||||
// const [foo, setFoo] = useState(0);
|
|
||||||
// const value = useCustomHook();
|
|
||||||
// _s(); /* Call without arguments triggers collecting the custom Hook list.
|
|
||||||
// * This doesn't happen during the module evaluation because we
|
|
||||||
// * don't want to change the module order with inline requires.
|
|
||||||
// * Next calls are noops. */
|
|
||||||
// return <h1>Hi</h1>;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /* Call with arguments attaches the signature to the type: */
|
|
||||||
// _s(
|
|
||||||
// Hello,
|
|
||||||
// 'useState{[foo, setFoo]}(0)',
|
|
||||||
// () => [useCustomHook], /* Lazy to avoid triggering inline requires */
|
|
||||||
// );
|
|
||||||
export function createSignatureFunctionForTransform() {
|
|
||||||
let savedType
|
|
||||||
let hasCustomHooks
|
|
||||||
let didCollectHooks = false
|
|
||||||
return function (type, key, forceReset, getCustomHooks) {
|
|
||||||
if (typeof key === 'string') {
|
|
||||||
// We're in the initial phase that associates signatures
|
|
||||||
// with the functions. Note this may be called multiple times
|
|
||||||
// in HOC chains like _s(hoc1(_s(hoc2(_s(actualFunction))))).
|
|
||||||
if (!savedType) {
|
|
||||||
// We're in the innermost call, so this is the actual type.
|
|
||||||
// $FlowFixMe[escaped-generic] discovered when updating Flow
|
|
||||||
savedType = type
|
|
||||||
hasCustomHooks = typeof getCustomHooks === 'function'
|
|
||||||
}
|
|
||||||
// Set the signature for all types (even wrappers!) in case
|
|
||||||
// they have no signatures of their own. This is to prevent
|
|
||||||
// problems like https://github.com/facebook/react/issues/20417.
|
|
||||||
if (
|
|
||||||
type != null &&
|
|
||||||
(typeof type === 'function' || typeof type === 'object')
|
|
||||||
) {
|
|
||||||
setSignature(type, key, forceReset, getCustomHooks)
|
|
||||||
}
|
|
||||||
return type
|
|
||||||
} else {
|
|
||||||
// We're in the _s() call without arguments, which means
|
|
||||||
// this is the time to collect custom Hook signatures.
|
|
||||||
// Only do this once. This path is hot and runs *inside* every render!
|
|
||||||
if (!didCollectHooks && hasCustomHooks) {
|
|
||||||
didCollectHooks = true
|
|
||||||
collectCustomHooksForSignature(savedType)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function isLikelyComponentType(type) {
|
|
||||||
switch (typeof type) {
|
|
||||||
case 'function': {
|
|
||||||
// First, deal with classes.
|
|
||||||
if (type.prototype != null) {
|
|
||||||
if (type.prototype.isReactComponent) {
|
|
||||||
// React class.
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
const ownNames = Object.getOwnPropertyNames(type.prototype)
|
|
||||||
if (ownNames.length > 1 || ownNames[0] !== 'constructor') {
|
|
||||||
// This looks like a class.
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type.prototype.__proto__ !== Object.prototype) {
|
|
||||||
// It has a superclass.
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
// Pass through.
|
|
||||||
// This looks like a regular function with empty prototype.
|
|
||||||
}
|
|
||||||
// For plain functions and arrows, use name as a heuristic.
|
|
||||||
const name = type.name || type.displayName
|
|
||||||
return typeof name === 'string' && /^[A-Z]/.test(name)
|
|
||||||
}
|
|
||||||
case 'object': {
|
|
||||||
if (type != null) {
|
|
||||||
switch (getProperty(type, '$$typeof')) {
|
|
||||||
case REACT_FORWARD_REF_TYPE:
|
|
||||||
case REACT_MEMO_TYPE:
|
|
||||||
// Definitely React components.
|
|
||||||
return true
|
|
||||||
default:
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function isCompoundComponent(type) {
|
|
||||||
if (!isPlainObject(type)) return false
|
|
||||||
for (const key in type) {
|
|
||||||
if (!isLikelyComponentType(type[key])) return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
function isPlainObject(obj) {
|
|
||||||
return (
|
|
||||||
Object.prototype.toString.call(obj) === '[object Object]' &&
|
|
||||||
(obj.constructor === Object || obj.constructor === undefined)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Plugin utils
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Taken from https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/main/lib/runtime/RefreshUtils.js#L141
|
|
||||||
// This allows to resister components not detected by SWC like styled component
|
|
||||||
export function registerExportsForReactRefresh(filename, moduleExports) {
|
|
||||||
for (const key in moduleExports) {
|
|
||||||
if (key === '__esModule') continue
|
|
||||||
const exportValue = moduleExports[key]
|
|
||||||
if (isLikelyComponentType(exportValue)) {
|
|
||||||
// 'export' is required to avoid key collision when renamed exports that
|
|
||||||
// shadow a local component name: https://github.com/vitejs/vite-plugin-react/issues/116
|
|
||||||
// The register function has an identity check to not register twice the same component,
|
|
||||||
// so this is safe to not used the same key here.
|
|
||||||
register(exportValue, filename + ' export ' + key)
|
|
||||||
} else if (isCompoundComponent(exportValue)) {
|
|
||||||
for (const subKey in exportValue) {
|
|
||||||
register(
|
|
||||||
exportValue[subKey],
|
|
||||||
filename + ' export ' + key + '-' + subKey,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function debounce(fn, delay) {
|
|
||||||
let handle
|
|
||||||
return () => {
|
|
||||||
clearTimeout(handle)
|
|
||||||
handle = setTimeout(fn, delay)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const hooks = []
|
|
||||||
window.__registerBeforePerformReactRefresh = (cb) => {
|
|
||||||
hooks.push(cb)
|
|
||||||
}
|
|
||||||
const enqueueUpdate = debounce(async () => {
|
|
||||||
if (hooks.length) await Promise.all(hooks.map((cb) => cb()))
|
|
||||||
performReactRefresh()
|
|
||||||
}, 16)
|
|
||||||
|
|
||||||
export function validateRefreshBoundaryAndEnqueueUpdate(
|
|
||||||
id,
|
|
||||||
prevExports,
|
|
||||||
nextExports,
|
|
||||||
) {
|
|
||||||
const ignoredExports = window.__getReactRefreshIgnoredExports?.({ id }) ?? []
|
|
||||||
if (
|
|
||||||
predicateOnExport(
|
|
||||||
ignoredExports,
|
|
||||||
prevExports,
|
|
||||||
(key) => key in nextExports,
|
|
||||||
) !== true
|
|
||||||
) {
|
|
||||||
return 'Could not Fast Refresh (export removed)'
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
predicateOnExport(
|
|
||||||
ignoredExports,
|
|
||||||
nextExports,
|
|
||||||
(key) => key in prevExports,
|
|
||||||
) !== true
|
|
||||||
) {
|
|
||||||
return 'Could not Fast Refresh (new export)'
|
|
||||||
}
|
|
||||||
|
|
||||||
let hasExports = false
|
|
||||||
const allExportsAreComponentsOrUnchanged = predicateOnExport(
|
|
||||||
ignoredExports,
|
|
||||||
nextExports,
|
|
||||||
(key, value) => {
|
|
||||||
hasExports = true
|
|
||||||
if (isLikelyComponentType(value)) return true
|
|
||||||
if (isCompoundComponent(value)) return true
|
|
||||||
return prevExports[key] === nextExports[key]
|
|
||||||
},
|
|
||||||
)
|
|
||||||
if (hasExports && allExportsAreComponentsOrUnchanged === true) {
|
|
||||||
enqueueUpdate()
|
|
||||||
} else {
|
|
||||||
return `Could not Fast Refresh ("${allExportsAreComponentsOrUnchanged}" export is incompatible). Learn more at __README_URL__#consistent-components-exports`
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function predicateOnExport(ignoredExports, moduleExports, predicate) {
|
|
||||||
for (const key in moduleExports) {
|
|
||||||
if (ignoredExports.includes(key)) continue
|
|
||||||
if (!predicate(key, moduleExports[key])) return key
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hides vite-ignored dynamic import so that Vite can skip analysis if no other
|
|
||||||
// dynamic import is present (https://github.com/vitejs/vite/pull/12732)
|
|
||||||
export const __hmr_import = (module) => import(/* @vite-ignore */ module)
|
|
||||||
|
|
||||||
// For backwards compatibility with @vitejs/plugin-react.
|
|
||||||
export default { injectIntoGlobalHook }
|
|
||||||
-87
@@ -1,87 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@vitejs/plugin-react",
|
|
||||||
"version": "6.0.2",
|
|
||||||
"description": "The default Vite plugin for React projects",
|
|
||||||
"keywords": [
|
|
||||||
"fast refresh",
|
|
||||||
"react",
|
|
||||||
"react-refresh",
|
|
||||||
"vite",
|
|
||||||
"vite-plugin"
|
|
||||||
],
|
|
||||||
"homepage": "https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react#readme",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/vitejs/vite-plugin-react/issues"
|
|
||||||
},
|
|
||||||
"license": "MIT",
|
|
||||||
"author": "Evan You",
|
|
||||||
"contributors": [
|
|
||||||
"Alec Larson",
|
|
||||||
"Arnaud Barré"
|
|
||||||
],
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/vitejs/vite-plugin-react.git",
|
|
||||||
"directory": "packages/plugin-react"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"dist",
|
|
||||||
"types"
|
|
||||||
],
|
|
||||||
"type": "module",
|
|
||||||
"imports": {
|
|
||||||
"#optionalTypes": "./types/optionalTypes.d.ts"
|
|
||||||
},
|
|
||||||
"exports": {
|
|
||||||
".": "./dist/index.js",
|
|
||||||
"./preamble": "./types/preamble.d.ts"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"dev": "tsdown --watch ./src --watch ../common",
|
|
||||||
"build": "tsdown",
|
|
||||||
"prepublishOnly": "npm run build",
|
|
||||||
"test-unit": "vitest run"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@rolldown/pluginutils": "^1.0.0"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@babel/core": "8.0.0-rc.4",
|
|
||||||
"@rolldown/plugin-babel": "^0.2.3",
|
|
||||||
"@vitejs/react-common": "workspace:*",
|
|
||||||
"babel-plugin-react-compiler": "^1.0.0",
|
|
||||||
"react": "^19.2.6",
|
|
||||||
"react-dom": "^19.2.6",
|
|
||||||
"rolldown": "^1.0.0",
|
|
||||||
"tsdown": "^0.22.0",
|
|
||||||
"vite": "^8.0.11"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"@rolldown/plugin-babel": "^0.1.7 || ^0.2.0",
|
|
||||||
"babel-plugin-react-compiler": "^1.0.0",
|
|
||||||
"vite": "^8.0.0"
|
|
||||||
},
|
|
||||||
"peerDependenciesMeta": {
|
|
||||||
"@rolldown/plugin-babel": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"babel-plugin-react-compiler": {
|
|
||||||
"optional": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": "^20.19.0 || >=22.12.0"
|
|
||||||
},
|
|
||||||
"compatiblePackages": {
|
|
||||||
"schemaVersion": 1,
|
|
||||||
"rolldown": {
|
|
||||||
"type": "compatible",
|
|
||||||
"versions": "^1.0.0",
|
|
||||||
"note": "You can use Rolldown's built-in feature directly."
|
|
||||||
},
|
|
||||||
"rollup": {
|
|
||||||
"type": "incompatible",
|
|
||||||
"reason": "Uses Rolldown-specific APIs or Vite-specific APIs"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-12
@@ -1,12 +0,0 @@
|
|||||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
||||||
|
|
||||||
// @ts-ignore --- `@rolldown/plugin-babel` is an optional peer dependency, so this may cause an error
|
|
||||||
import type * as pluginBabel from '@rolldown/plugin-babel'
|
|
||||||
// @ts-ignore --- `babel-plugin-react-compiler` is an optional peer dependency, so this may cause an error
|
|
||||||
import type * as babelPluginReactCompiler from 'babel-plugin-react-compiler'
|
|
||||||
|
|
||||||
// @ts-ignore --- `@rolldown/plugin-babel` is an optional peer dependency, so this may cause an error
|
|
||||||
export type RolldownBabelPreset = pluginBabel.RolldownBabelPreset
|
|
||||||
// @ts-ignore --- `babel-plugin-react-compiler` is an optional peer dependency, so this may cause an error
|
|
||||||
export type ReactCompilerBabelPluginOptions =
|
|
||||||
babelPluginReactCompiler.PluginOptions
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
export {}
|
|
||||||
-21
@@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2019-2025 webkid GmbH
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
-135
@@ -1,135 +0,0 @@
|
|||||||

|
|
||||||

|
|
||||||
|
|
||||||
<div align="center">
|
|
||||||
|
|
||||||

|
|
||||||

|
|
||||||

|
|
||||||

|
|
||||||
|
|
||||||
A highly customizable React component for building interactive graphs and node-based editors.
|
|
||||||
|
|
||||||
[🚀 Getting Started](https://reactflow.dev/learn) | [📖 Documentation](https://reactflow.dev/api-reference/react-flow) | [📺 Examples](https://reactflow.dev/examples/overview) | [☎️ Discord](https://discord.gg/RVmnytFmGW) | [💎 React Flow Pro](https://pro.reactflow.dev)
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Key Features
|
|
||||||
|
|
||||||
- **Easy to use:** Seamless zooming and panning, single- and multi selection of graph elements and keyboard shortcuts are supported out of the box
|
|
||||||
- **Customizable:** Different [node](https://reactflow.dev/examples) and [edge types](https://reactflow.dev/examples/edges/edge-types) and support for custom nodes with multiple handles and custom edges
|
|
||||||
- **Fast rendering:** Only nodes that have changed are re-rendered
|
|
||||||
- **Hooks and Utils:** [Hooks](https://reactflow.dev/api-reference/hooks) for handling nodes, edges and the viewport and graph [helper functions](https://reactflow.dev/api-reference/utils)
|
|
||||||
- **Plugin Components:** [Background](https://reactflow.dev/api-reference/components/background), [MiniMap](https://reactflow.dev/api-reference/components/minimap) and [Controls](https://reactflow.dev/api-reference/components/controls)
|
|
||||||
- **Reliable**: Written in [Typescript](https://www.typescriptlang.org/) and tested with [cypress](https://www.cypress.io/)
|
|
||||||
|
|
||||||
## Commercial Usage
|
|
||||||
|
|
||||||
**Are you using React Flow for a personal project?** Great! No sponsorship needed, you can support us by reporting any bugs you find, sending us screenshots of your projects, and starring us on Github 🌟
|
|
||||||
|
|
||||||
**Are you using React Flow at your organization and making money from it?** Awesome! We rely on your support to keep React Flow developed and maintained under an MIT License, just how we like it. You can do that on the [React Flow Pro website](https://pro.reactflow.dev) or through [Github Sponsors](https://github.com/sponsors/wbkd).
|
|
||||||
|
|
||||||
You can find more information in our [React Flow Pro FAQs](https://pro.reactflow.dev/info).
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
The easiest way to get the latest version of React Flow is to install it via npm, yarn or pnpm:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm install @xyflow/react
|
|
||||||
```
|
|
||||||
|
|
||||||
## Quickstart
|
|
||||||
|
|
||||||
This is only a very basic usage example of React Flow. To see everything that is possible with the library, please refer to the [website](https://reactflow.dev) for [guides](https://reactflow.dev/learn/customization/custom-nodes), [examples](https://reactflow.dev/examples/overview) and the full [API reference](https://reactflow.dev/api-reference/react-flow).
|
|
||||||
|
|
||||||
```jsx
|
|
||||||
import { useCallback } from 'react';
|
|
||||||
import {
|
|
||||||
ReactFlow,
|
|
||||||
MiniMap,
|
|
||||||
Controls,
|
|
||||||
Background,
|
|
||||||
useNodesState,
|
|
||||||
useEdgesState,
|
|
||||||
addEdge,
|
|
||||||
} from '@xyflow/react';
|
|
||||||
|
|
||||||
import '@xyflow/react/dist/style.css';
|
|
||||||
|
|
||||||
const initialNodes = [
|
|
||||||
{ id: '1', position: { x: 0, y: 0 }, data: { label: '1' } },
|
|
||||||
{ id: '2', position: { x: 0, y: 100 }, data: { label: '2' } },
|
|
||||||
];
|
|
||||||
|
|
||||||
const initialEdges = [{ id: 'e1-2', source: '1', target: '2' }];
|
|
||||||
|
|
||||||
function Flow() {
|
|
||||||
const [nodes, setNodes, onNodesChange] = useNodesState(initialNodes);
|
|
||||||
const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges);
|
|
||||||
|
|
||||||
const onConnect = useCallback((params) => setEdges((eds) => addEdge(params, eds)), [setEdges]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<ReactFlow
|
|
||||||
nodes={nodes}
|
|
||||||
edges={edges}
|
|
||||||
onNodesChange={onNodesChange}
|
|
||||||
onEdgesChange={onEdgesChange}
|
|
||||||
onConnect={onConnect}
|
|
||||||
>
|
|
||||||
<MiniMap />
|
|
||||||
<Controls />
|
|
||||||
<Background />
|
|
||||||
</ReactFlow>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Flow;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Development
|
|
||||||
|
|
||||||
Before you can start developing please make sure that you have [pnpm](https://pnpm.io/) installed (`npm i -g pnpm`). Then install the dependencies using pnpm: `pnpm install`.
|
|
||||||
|
|
||||||
Run `pnpm build` once and then you can use `pnpm dev` for local development.
|
|
||||||
|
|
||||||
## Testing
|
|
||||||
|
|
||||||
Testing is done with cypress. You can find the tests in the [`examples/vite-app/cypress`](/examples/vite-app/cypress/) folder. In order to run the tests do:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
pnpm test
|
|
||||||
```
|
|
||||||
|
|
||||||
## xyflow Team
|
|
||||||
|
|
||||||
React Flow is maintained by the team behind [xyflow](https://xyflow.com). If you need help or want to talk to us about a collaboration, reach out through our [contact form](https://xyflow.com/contact) or by joining our [Discord Server](https://discord.gg/Bqt6xrs).
|
|
||||||
|
|
||||||
- Christopher • [Twitter](https://twitter.com/chrtze) • [Github](https://github.com/chrtze)
|
|
||||||
- Hayleigh • [Twitter](https://twitter.com/hayleighdotdev) • [Github](https://github.com/hayleigh-dot-dev)
|
|
||||||
- John • [Website](https://johnrobbdesign.com/) • [Mastodon](https://mastodon.social/@johnrobbjr)
|
|
||||||
- Moritz • [Twitter](https://twitter.com/moklick) • [Github](https://github.com/moklick)
|
|
||||||
- Peter • [Github](https://github.com/peterkogo)
|
|
||||||
|
|
||||||
Any support you provide goes directly towards the development and maintenance of React Flow and Svelte Flow, allowing us to continue to operate as an independent company, working on what we think is best for our open-source libraries.
|
|
||||||
|
|
||||||
## Community Packages
|
|
||||||
|
|
||||||
- [useUndoable](https://github.com/xplato/useUndoable) - Hook for undo/redo functionality with an explicit React Flow example
|
|
||||||
- [react-flow-smart-edge](https://github.com/tisoap/react-flow-smart-edge) - Custom edge that doesn't intersect with nodes
|
|
||||||
- [Feliz.ReactFlow](https://github.com/tforkmann/Feliz.ReactFlow) - Feliz React Bindings for React Flow
|
|
||||||
|
|
||||||
## Credits
|
|
||||||
|
|
||||||
React Flow was initially developed for [datablocks](https://datablocks.pro), a graph-based editor for transforming, analyzing and visualizing data in the browser. Under the hood, React Flow depends on these great libraries:
|
|
||||||
|
|
||||||
- [d3-zoom](https://github.com/d3/d3-zoom) - used for zoom, pan and drag interactions with the graph canvas
|
|
||||||
- [d3-drag](https://github.com/d3/d3-drag) - used for making the nodes draggable
|
|
||||||
- [zustand](https://github.com/pmndrs/zustand) - internal state management
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
React Flow is [MIT licensed](../../LICENSE).
|
|
||||||
-505
@@ -1,505 +0,0 @@
|
|||||||
/* this will be exported as base.css and can be used for a basic styling */
|
|
||||||
/* these are the necessary styles for React/Svelte Flow, they get used by base.css and style.css */
|
|
||||||
.react-flow {
|
|
||||||
direction: ltr;
|
|
||||||
|
|
||||||
--xy-edge-stroke-default: #b1b1b7;
|
|
||||||
--xy-edge-stroke-width-default: 1;
|
|
||||||
--xy-edge-stroke-selected-default: #555;
|
|
||||||
|
|
||||||
--xy-connectionline-stroke-default: #b1b1b7;
|
|
||||||
--xy-connectionline-stroke-width-default: 1;
|
|
||||||
|
|
||||||
--xy-attribution-background-color-default: rgba(255, 255, 255, 0.5);
|
|
||||||
|
|
||||||
--xy-minimap-background-color-default: #fff;
|
|
||||||
--xy-minimap-mask-background-color-default: rgba(240, 240, 240, 0.6);
|
|
||||||
--xy-minimap-mask-stroke-color-default: transparent;
|
|
||||||
--xy-minimap-mask-stroke-width-default: 1;
|
|
||||||
--xy-minimap-node-background-color-default: #e2e2e2;
|
|
||||||
--xy-minimap-node-stroke-color-default: transparent;
|
|
||||||
--xy-minimap-node-stroke-width-default: 2;
|
|
||||||
|
|
||||||
--xy-background-color-default: transparent;
|
|
||||||
--xy-background-pattern-dots-color-default: #91919a;
|
|
||||||
--xy-background-pattern-lines-color-default: #eee;
|
|
||||||
--xy-background-pattern-cross-color-default: #e2e2e2;
|
|
||||||
background-color: var(--xy-background-color, var(--xy-background-color-default));
|
|
||||||
--xy-node-border-default: 1px solid #bbb;
|
|
||||||
--xy-node-border-selected-default: 1px solid #555;
|
|
||||||
|
|
||||||
--xy-handle-background-color-default: #333;
|
|
||||||
|
|
||||||
--xy-selection-background-color-default: rgba(150, 150, 180, 0.1);
|
|
||||||
--xy-selection-border-default: 1px dotted rgba(155, 155, 155, 0.8);
|
|
||||||
--xy-resize-background-color-default: #3367d9;
|
|
||||||
}
|
|
||||||
.react-flow.dark {
|
|
||||||
--xy-edge-stroke-default: #3e3e3e;
|
|
||||||
--xy-edge-stroke-width-default: 1;
|
|
||||||
--xy-edge-stroke-selected-default: #727272;
|
|
||||||
|
|
||||||
--xy-connectionline-stroke-default: #b1b1b7;
|
|
||||||
--xy-connectionline-stroke-width-default: 1;
|
|
||||||
|
|
||||||
--xy-attribution-background-color-default: rgba(150, 150, 150, 0.25);
|
|
||||||
|
|
||||||
--xy-minimap-background-color-default: #141414;
|
|
||||||
--xy-minimap-mask-background-color-default: rgba(60, 60, 60, 0.6);
|
|
||||||
--xy-minimap-mask-stroke-color-default: transparent;
|
|
||||||
--xy-minimap-mask-stroke-width-default: 1;
|
|
||||||
--xy-minimap-node-background-color-default: #2b2b2b;
|
|
||||||
--xy-minimap-node-stroke-color-default: transparent;
|
|
||||||
--xy-minimap-node-stroke-width-default: 2;
|
|
||||||
|
|
||||||
--xy-background-color-default: #141414;
|
|
||||||
--xy-background-pattern-dots-color-default: #777;
|
|
||||||
--xy-background-pattern-lines-color-default: #777;
|
|
||||||
--xy-background-pattern-cross-color-default: #777;
|
|
||||||
--xy-node-color-default: #f8f8f8;
|
|
||||||
}
|
|
||||||
.react-flow__background {
|
|
||||||
background-color: var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));
|
|
||||||
pointer-events: none;
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
.react-flow__container {
|
|
||||||
position: absolute;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
}
|
|
||||||
.react-flow__pane {
|
|
||||||
z-index: 1;
|
|
||||||
touch-action: none;
|
|
||||||
}
|
|
||||||
.react-flow__pane.draggable {
|
|
||||||
cursor: grab;
|
|
||||||
}
|
|
||||||
.react-flow__pane.dragging {
|
|
||||||
cursor: grabbing;
|
|
||||||
}
|
|
||||||
.react-flow__pane.selection {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
.react-flow__viewport {
|
|
||||||
transform-origin: 0 0;
|
|
||||||
z-index: 2;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
.react-flow__renderer {
|
|
||||||
z-index: 4;
|
|
||||||
}
|
|
||||||
.react-flow__selection {
|
|
||||||
z-index: 6;
|
|
||||||
}
|
|
||||||
.react-flow__nodesselection-rect:focus,
|
|
||||||
.react-flow__nodesselection-rect:focus-visible {
|
|
||||||
outline: none;
|
|
||||||
}
|
|
||||||
.react-flow__edge-path {
|
|
||||||
stroke: var(--xy-edge-stroke, var(--xy-edge-stroke-default));
|
|
||||||
stroke-width: var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));
|
|
||||||
fill: none;
|
|
||||||
}
|
|
||||||
.react-flow__connection-path {
|
|
||||||
stroke: var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));
|
|
||||||
stroke-width: var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));
|
|
||||||
fill: none;
|
|
||||||
}
|
|
||||||
.react-flow .react-flow__edges {
|
|
||||||
position: absolute;
|
|
||||||
}
|
|
||||||
.react-flow .react-flow__edges svg {
|
|
||||||
overflow: visible;
|
|
||||||
position: absolute;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
.react-flow__edge {
|
|
||||||
pointer-events: visibleStroke;
|
|
||||||
}
|
|
||||||
.react-flow__edge.selectable {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
.react-flow__edge.animated path {
|
|
||||||
stroke-dasharray: 5;
|
|
||||||
animation: dashdraw 0.5s linear infinite;
|
|
||||||
}
|
|
||||||
.react-flow__edge.animated path.react-flow__edge-interaction {
|
|
||||||
stroke-dasharray: none;
|
|
||||||
animation: none;
|
|
||||||
}
|
|
||||||
.react-flow__edge.inactive {
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
.react-flow__edge.selected,
|
|
||||||
.react-flow__edge:focus,
|
|
||||||
.react-flow__edge:focus-visible {
|
|
||||||
outline: none;
|
|
||||||
}
|
|
||||||
.react-flow__edge.selected .react-flow__edge-path,
|
|
||||||
.react-flow__edge.selectable:focus .react-flow__edge-path,
|
|
||||||
.react-flow__edge.selectable:focus-visible .react-flow__edge-path {
|
|
||||||
stroke: var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default));
|
|
||||||
}
|
|
||||||
.react-flow__edge-textwrapper {
|
|
||||||
pointer-events: all;
|
|
||||||
}
|
|
||||||
.react-flow__edge .react-flow__edge-text {
|
|
||||||
pointer-events: none;
|
|
||||||
-webkit-user-select: none;
|
|
||||||
-moz-user-select: none;
|
|
||||||
user-select: none;
|
|
||||||
}
|
|
||||||
/* Arrowhead marker styles - use CSS custom properties as default */
|
|
||||||
.react-flow__arrowhead polyline {
|
|
||||||
stroke: var(--xy-edge-stroke, var(--xy-edge-stroke-default));
|
|
||||||
}
|
|
||||||
.react-flow__arrowhead polyline.arrowclosed {
|
|
||||||
fill: var(--xy-edge-stroke, var(--xy-edge-stroke-default));
|
|
||||||
}
|
|
||||||
.react-flow__connection {
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
.react-flow__connection .animated {
|
|
||||||
stroke-dasharray: 5;
|
|
||||||
animation: dashdraw 0.5s linear infinite;
|
|
||||||
}
|
|
||||||
svg.react-flow__connectionline {
|
|
||||||
z-index: 1001;
|
|
||||||
overflow: visible;
|
|
||||||
position: absolute;
|
|
||||||
}
|
|
||||||
.react-flow__nodes {
|
|
||||||
pointer-events: none;
|
|
||||||
transform-origin: 0 0;
|
|
||||||
}
|
|
||||||
.react-flow__node {
|
|
||||||
position: absolute;
|
|
||||||
-webkit-user-select: none;
|
|
||||||
-moz-user-select: none;
|
|
||||||
user-select: none;
|
|
||||||
pointer-events: all;
|
|
||||||
transform-origin: 0 0;
|
|
||||||
box-sizing: border-box;
|
|
||||||
cursor: default;
|
|
||||||
}
|
|
||||||
.react-flow__node.selectable {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
.react-flow__node.draggable {
|
|
||||||
cursor: grab;
|
|
||||||
pointer-events: all;
|
|
||||||
}
|
|
||||||
.react-flow__node.draggable.dragging {
|
|
||||||
cursor: grabbing;
|
|
||||||
}
|
|
||||||
.react-flow__nodesselection {
|
|
||||||
z-index: 3;
|
|
||||||
transform-origin: left top;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
.react-flow__nodesselection-rect {
|
|
||||||
position: absolute;
|
|
||||||
pointer-events: all;
|
|
||||||
cursor: grab;
|
|
||||||
}
|
|
||||||
.react-flow__handle {
|
|
||||||
position: absolute;
|
|
||||||
pointer-events: none;
|
|
||||||
min-width: 5px;
|
|
||||||
min-height: 5px;
|
|
||||||
background-color: var(--xy-handle-background-color, var(--xy-handle-background-color-default));
|
|
||||||
}
|
|
||||||
.react-flow__handle.connectingfrom {
|
|
||||||
pointer-events: all;
|
|
||||||
}
|
|
||||||
.react-flow__handle.connectionindicator {
|
|
||||||
pointer-events: all;
|
|
||||||
cursor: crosshair;
|
|
||||||
}
|
|
||||||
.react-flow__handle-bottom {
|
|
||||||
top: auto;
|
|
||||||
left: 50%;
|
|
||||||
bottom: 0;
|
|
||||||
transform: translate(-50%, 50%);
|
|
||||||
}
|
|
||||||
.react-flow__handle-top {
|
|
||||||
top: 0;
|
|
||||||
left: 50%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
}
|
|
||||||
.react-flow__handle-left {
|
|
||||||
top: 50%;
|
|
||||||
left: 0;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
}
|
|
||||||
.react-flow__handle-right {
|
|
||||||
top: 50%;
|
|
||||||
right: 0;
|
|
||||||
transform: translate(50%, -50%);
|
|
||||||
}
|
|
||||||
.react-flow__edgeupdater {
|
|
||||||
cursor: move;
|
|
||||||
pointer-events: all;
|
|
||||||
}
|
|
||||||
.react-flow__pane.selection .react-flow__panel {
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
.react-flow__panel {
|
|
||||||
position: absolute;
|
|
||||||
z-index: 5;
|
|
||||||
margin: 15px;
|
|
||||||
}
|
|
||||||
.react-flow__panel.top {
|
|
||||||
top: 0;
|
|
||||||
}
|
|
||||||
.react-flow__panel.bottom {
|
|
||||||
bottom: 0;
|
|
||||||
}
|
|
||||||
.react-flow__panel.top.center, .react-flow__panel.bottom.center {
|
|
||||||
left: 50%;
|
|
||||||
transform: translateX(-15px) translateX(-50%);
|
|
||||||
}
|
|
||||||
.react-flow__panel.left {
|
|
||||||
left: 0;
|
|
||||||
}
|
|
||||||
.react-flow__panel.right {
|
|
||||||
right: 0;
|
|
||||||
}
|
|
||||||
.react-flow__panel.left.center, .react-flow__panel.right.center {
|
|
||||||
top: 50%;
|
|
||||||
transform: translateY(-15px) translateY(-50%);
|
|
||||||
}
|
|
||||||
.react-flow__attribution {
|
|
||||||
font-size: 10px;
|
|
||||||
background: var(--xy-attribution-background-color, var(--xy-attribution-background-color-default));
|
|
||||||
padding: 2px 3px;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
.react-flow__attribution a {
|
|
||||||
text-decoration: none;
|
|
||||||
color: #999;
|
|
||||||
}
|
|
||||||
@keyframes dashdraw {
|
|
||||||
from {
|
|
||||||
stroke-dashoffset: 10;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.react-flow__edgelabel-renderer {
|
|
||||||
position: absolute;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
pointer-events: none;
|
|
||||||
-webkit-user-select: none;
|
|
||||||
-moz-user-select: none;
|
|
||||||
user-select: none;
|
|
||||||
left: 0;
|
|
||||||
top: 0;
|
|
||||||
}
|
|
||||||
.react-flow__viewport-portal {
|
|
||||||
position: absolute;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
left: 0;
|
|
||||||
top: 0;
|
|
||||||
-webkit-user-select: none;
|
|
||||||
-moz-user-select: none;
|
|
||||||
user-select: none;
|
|
||||||
}
|
|
||||||
.react-flow__minimap {
|
|
||||||
background: var(
|
|
||||||
--xy-minimap-background-color-props,
|
|
||||||
var(--xy-minimap-background-color, var(--xy-minimap-background-color-default))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
.react-flow__minimap-svg {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
.react-flow__minimap-mask {
|
|
||||||
fill: var(
|
|
||||||
--xy-minimap-mask-background-color-props,
|
|
||||||
var(--xy-minimap-mask-background-color, var(--xy-minimap-mask-background-color-default))
|
|
||||||
);
|
|
||||||
stroke: var(
|
|
||||||
--xy-minimap-mask-stroke-color-props,
|
|
||||||
var(--xy-minimap-mask-stroke-color, var(--xy-minimap-mask-stroke-color-default))
|
|
||||||
);
|
|
||||||
stroke-width: var(
|
|
||||||
--xy-minimap-mask-stroke-width-props,
|
|
||||||
var(--xy-minimap-mask-stroke-width, var(--xy-minimap-mask-stroke-width-default))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
.react-flow__minimap-node {
|
|
||||||
fill: var(
|
|
||||||
--xy-minimap-node-background-color-props,
|
|
||||||
var(--xy-minimap-node-background-color, var(--xy-minimap-node-background-color-default))
|
|
||||||
);
|
|
||||||
stroke: var(
|
|
||||||
--xy-minimap-node-stroke-color-props,
|
|
||||||
var(--xy-minimap-node-stroke-color, var(--xy-minimap-node-stroke-color-default))
|
|
||||||
);
|
|
||||||
stroke-width: var(
|
|
||||||
--xy-minimap-node-stroke-width-props,
|
|
||||||
var(--xy-minimap-node-stroke-width, var(--xy-minimap-node-stroke-width-default))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
.react-flow__background-pattern.dots {
|
|
||||||
fill: var(
|
|
||||||
--xy-background-pattern-color-props,
|
|
||||||
var(--xy-background-pattern-color, var(--xy-background-pattern-dots-color-default))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
.react-flow__background-pattern.lines {
|
|
||||||
stroke: var(
|
|
||||||
--xy-background-pattern-color-props,
|
|
||||||
var(--xy-background-pattern-color, var(--xy-background-pattern-lines-color-default))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
.react-flow__background-pattern.cross {
|
|
||||||
stroke: var(
|
|
||||||
--xy-background-pattern-color-props,
|
|
||||||
var(--xy-background-pattern-color, var(--xy-background-pattern-cross-color-default))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
.react-flow__controls {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
.react-flow__controls.horizontal {
|
|
||||||
flex-direction: row;
|
|
||||||
}
|
|
||||||
.react-flow__controls-button {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
height: 26px;
|
|
||||||
width: 26px;
|
|
||||||
padding: 4px;
|
|
||||||
}
|
|
||||||
.react-flow__controls-button svg {
|
|
||||||
width: 100%;
|
|
||||||
max-width: 12px;
|
|
||||||
max-height: 12px;
|
|
||||||
fill: currentColor;
|
|
||||||
}
|
|
||||||
.react-flow__node-input,
|
|
||||||
.react-flow__node-default,
|
|
||||||
.react-flow__node-output,
|
|
||||||
.react-flow__node-group {
|
|
||||||
border: var(--xy-node-border, var(--xy-node-border-default));
|
|
||||||
color: var(--xy-node-color, var(--xy-node-color-default));
|
|
||||||
}
|
|
||||||
.react-flow__node-input.selected,
|
|
||||||
.react-flow__node-input:focus,
|
|
||||||
.react-flow__node-input:focus-visible,
|
|
||||||
.react-flow__node-default.selected,
|
|
||||||
.react-flow__node-default:focus,
|
|
||||||
.react-flow__node-default:focus-visible,
|
|
||||||
.react-flow__node-output.selected,
|
|
||||||
.react-flow__node-output:focus,
|
|
||||||
.react-flow__node-output:focus-visible,
|
|
||||||
.react-flow__node-group.selected,
|
|
||||||
.react-flow__node-group:focus,
|
|
||||||
.react-flow__node-group:focus-visible {
|
|
||||||
outline: none;
|
|
||||||
border: var(--xy-node-border-selected, var(--xy-node-border-selected-default));
|
|
||||||
}
|
|
||||||
.react-flow__nodesselection-rect,
|
|
||||||
.react-flow__selection {
|
|
||||||
background: var(--xy-selection-background-color, var(--xy-selection-background-color-default));
|
|
||||||
border: var(--xy-selection-border, var(--xy-selection-border-default));
|
|
||||||
}
|
|
||||||
.react-flow__resize-control {
|
|
||||||
position: absolute;
|
|
||||||
}
|
|
||||||
.react-flow__resize-control.left,
|
|
||||||
.react-flow__resize-control.right {
|
|
||||||
cursor: ew-resize;
|
|
||||||
}
|
|
||||||
.react-flow__resize-control.top,
|
|
||||||
.react-flow__resize-control.bottom {
|
|
||||||
cursor: ns-resize;
|
|
||||||
}
|
|
||||||
.react-flow__resize-control.top.left,
|
|
||||||
.react-flow__resize-control.bottom.right {
|
|
||||||
cursor: nwse-resize;
|
|
||||||
}
|
|
||||||
.react-flow__resize-control.bottom.left,
|
|
||||||
.react-flow__resize-control.top.right {
|
|
||||||
cursor: nesw-resize;
|
|
||||||
}
|
|
||||||
/* handle styles */
|
|
||||||
.react-flow__resize-control.handle {
|
|
||||||
width: 5px;
|
|
||||||
height: 5px;
|
|
||||||
border: 1px solid #fff;
|
|
||||||
border-radius: 1px;
|
|
||||||
background-color: var(--xy-resize-background-color, var(--xy-resize-background-color-default));
|
|
||||||
translate: -50% -50%;
|
|
||||||
}
|
|
||||||
.react-flow__resize-control.handle.left {
|
|
||||||
left: 0;
|
|
||||||
top: 50%;
|
|
||||||
}
|
|
||||||
.react-flow__resize-control.handle.right {
|
|
||||||
left: 100%;
|
|
||||||
top: 50%;
|
|
||||||
}
|
|
||||||
.react-flow__resize-control.handle.top {
|
|
||||||
left: 50%;
|
|
||||||
top: 0;
|
|
||||||
}
|
|
||||||
.react-flow__resize-control.handle.bottom {
|
|
||||||
left: 50%;
|
|
||||||
top: 100%;
|
|
||||||
}
|
|
||||||
.react-flow__resize-control.handle.top.left {
|
|
||||||
left: 0;
|
|
||||||
}
|
|
||||||
.react-flow__resize-control.handle.bottom.left {
|
|
||||||
left: 0;
|
|
||||||
}
|
|
||||||
.react-flow__resize-control.handle.top.right {
|
|
||||||
left: 100%;
|
|
||||||
}
|
|
||||||
.react-flow__resize-control.handle.bottom.right {
|
|
||||||
left: 100%;
|
|
||||||
}
|
|
||||||
/* line styles */
|
|
||||||
.react-flow__resize-control.line {
|
|
||||||
border-color: var(--xy-resize-background-color, var(--xy-resize-background-color-default));
|
|
||||||
border-width: 0;
|
|
||||||
border-style: solid;
|
|
||||||
}
|
|
||||||
.react-flow__resize-control.line.left,
|
|
||||||
.react-flow__resize-control.line.right {
|
|
||||||
width: 1px;
|
|
||||||
transform: translate(-50%, 0);
|
|
||||||
top: 0;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
.react-flow__resize-control.line.left {
|
|
||||||
left: 0;
|
|
||||||
border-left-width: 1px;
|
|
||||||
}
|
|
||||||
.react-flow__resize-control.line.right {
|
|
||||||
left: 100%;
|
|
||||||
border-right-width: 1px;
|
|
||||||
}
|
|
||||||
.react-flow__resize-control.line.top,
|
|
||||||
.react-flow__resize-control.line.bottom {
|
|
||||||
height: 1px;
|
|
||||||
transform: translate(0, -50%);
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.react-flow__resize-control.line.top {
|
|
||||||
top: 0;
|
|
||||||
border-top-width: 1px;
|
|
||||||
}
|
|
||||||
.react-flow__resize-control.line.bottom {
|
|
||||||
border-bottom-width: 1px;
|
|
||||||
top: 100%;
|
|
||||||
}
|
|
||||||
Generated
Vendored
-61
@@ -1,61 +0,0 @@
|
|||||||
import { type BackgroundProps } from './types';
|
|
||||||
declare function BackgroundComponent({ id, variant, gap, size, lineWidth, offset, color, bgColor, style, className, patternClassName, }: BackgroundProps): import("react/jsx-runtime").JSX.Element;
|
|
||||||
declare namespace BackgroundComponent {
|
|
||||||
var displayName: string;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* The `<Background />` component makes it convenient to render different types of backgrounds common in node-based UIs. It comes with three variants: lines, dots and cross.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
*
|
|
||||||
* A simple example of how to use the Background component.
|
|
||||||
*
|
|
||||||
* ```tsx
|
|
||||||
* import { useState } from 'react';
|
|
||||||
* import { ReactFlow, Background, BackgroundVariant } from '@xyflow/react';
|
|
||||||
*
|
|
||||||
* export default function Flow() {
|
|
||||||
* return (
|
|
||||||
* <ReactFlow defaultNodes={[...]} defaultEdges={[...]}>
|
|
||||||
* <Background color="#ccc" variant={BackgroundVariant.Dots} />
|
|
||||||
* </ReactFlow>
|
|
||||||
* );
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
*
|
|
||||||
* In this example you can see how to combine multiple backgrounds
|
|
||||||
*
|
|
||||||
* ```tsx
|
|
||||||
* import { ReactFlow, Background, BackgroundVariant } from '@xyflow/react';
|
|
||||||
* import '@xyflow/react/dist/style.css';
|
|
||||||
*
|
|
||||||
* export default function Flow() {
|
|
||||||
* return (
|
|
||||||
* <ReactFlow defaultNodes={[...]} defaultEdges={[...]}>
|
|
||||||
* <Background
|
|
||||||
* id="1"
|
|
||||||
* gap={10}
|
|
||||||
* color="#f1f1f1"
|
|
||||||
* variant={BackgroundVariant.Lines}
|
|
||||||
* />
|
|
||||||
* <Background
|
|
||||||
* id="2"
|
|
||||||
* gap={100}
|
|
||||||
* color="#ccc"
|
|
||||||
* variant={BackgroundVariant.Lines}
|
|
||||||
* />
|
|
||||||
* </ReactFlow>
|
|
||||||
* );
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @remarks
|
|
||||||
*
|
|
||||||
* When combining multiple <Background /> components it’s important to give each of them a unique id prop!
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
export declare const Background: import("react").MemoExoticComponent<typeof BackgroundComponent>;
|
|
||||||
export {};
|
|
||||||
//# sourceMappingURL=Background.d.ts.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"Background.d.ts","sourceRoot":"","sources":["../../../src/additional-components/Background/Background.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,eAAe,EAAqB,MAAM,SAAS,CAAC;AAWlE,iBAAS,mBAAmB,CAAC,EAC3B,EAAE,EACF,OAAgC,EAEhC,GAAQ,EAER,IAAI,EACJ,SAAa,EACb,MAAU,EACV,KAAK,EACL,OAAO,EACP,KAAK,EACL,SAAS,EACT,gBAAgB,GACjB,EAAE,eAAe,2CAwDjB;kBAtEQ,mBAAmB;;;AA0E5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,eAAO,MAAM,UAAU,iEAA4B,CAAC"}
|
|
||||||
Generated
Vendored
-15
@@ -1,15 +0,0 @@
|
|||||||
import { BackgroundVariant } from './types';
|
|
||||||
type LinePatternProps = {
|
|
||||||
dimensions: [number, number];
|
|
||||||
variant: BackgroundVariant;
|
|
||||||
lineWidth?: number;
|
|
||||||
className?: string;
|
|
||||||
};
|
|
||||||
export declare function LinePattern({ dimensions, lineWidth, variant, className }: LinePatternProps): import("react/jsx-runtime").JSX.Element;
|
|
||||||
type DotPatternProps = {
|
|
||||||
radius: number;
|
|
||||||
className?: string;
|
|
||||||
};
|
|
||||||
export declare function DotPattern({ radius, className }: DotPatternProps): import("react/jsx-runtime").JSX.Element;
|
|
||||||
export {};
|
|
||||||
//# sourceMappingURL=Patterns.d.ts.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"Patterns.d.ts","sourceRoot":"","sources":["../../../src/additional-components/Background/Patterns.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,KAAK,gBAAgB,GAAG;IACtB,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,OAAO,EAAE,iBAAiB,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,gBAAgB,2CAQ1F;AAED,KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,UAAU,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,eAAe,2CAIhE"}
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
export { Background } from './Background';
|
|
||||||
export { BackgroundVariant, type BackgroundProps } from './types';
|
|
||||||
//# sourceMappingURL=index.d.ts.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/additional-components/Background/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC"}
|
|
||||||
-59
@@ -1,59 +0,0 @@
|
|||||||
import { CSSProperties } from 'react';
|
|
||||||
/**
|
|
||||||
* The three variants are exported as an enum for convenience. You can either import
|
|
||||||
* the enum and use it like `BackgroundVariant.Lines` or you can use the raw string
|
|
||||||
* value directly.
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
export declare enum BackgroundVariant {
|
|
||||||
Lines = "lines",
|
|
||||||
Dots = "dots",
|
|
||||||
Cross = "cross"
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @expand
|
|
||||||
*/
|
|
||||||
export type BackgroundProps = {
|
|
||||||
/** When multiple backgrounds are present on the page, each one should have a unique id. */
|
|
||||||
id?: string;
|
|
||||||
/** Color of the pattern. */
|
|
||||||
color?: string;
|
|
||||||
/** Color of the background. */
|
|
||||||
bgColor?: string;
|
|
||||||
/** Class applied to the container. */
|
|
||||||
className?: string;
|
|
||||||
/** Class applied to the pattern. */
|
|
||||||
patternClassName?: string;
|
|
||||||
/**
|
|
||||||
* The gap between patterns. Passing in a tuple allows you to control the x and y gap
|
|
||||||
* independently.
|
|
||||||
* @default 20
|
|
||||||
*/
|
|
||||||
gap?: number | [number, number];
|
|
||||||
/**
|
|
||||||
* The radius of each dot or the size of each rectangle if `BackgroundVariant.Dots` or
|
|
||||||
* `BackgroundVariant.Cross` is used. This defaults to 1 or 6 respectively, or ignored if
|
|
||||||
* `BackgroundVariant.Lines` is used.
|
|
||||||
*/
|
|
||||||
size?: number;
|
|
||||||
/**
|
|
||||||
* Offset of the pattern.
|
|
||||||
* @default 0
|
|
||||||
*/
|
|
||||||
offset?: number | [number, number];
|
|
||||||
/**
|
|
||||||
* The stroke thickness used when drawing the pattern.
|
|
||||||
* @default 1
|
|
||||||
*/
|
|
||||||
lineWidth?: number;
|
|
||||||
/**
|
|
||||||
* Variant of the pattern.
|
|
||||||
* @default BackgroundVariant.Dots
|
|
||||||
* @example BackgroundVariant.Lines, BackgroundVariant.Dots, BackgroundVariant.Cross
|
|
||||||
* 'lines', 'dots', 'cross'
|
|
||||||
*/
|
|
||||||
variant?: BackgroundVariant;
|
|
||||||
/** Style applied to the container. */
|
|
||||||
style?: CSSProperties;
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=types.d.ts.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/additional-components/Background/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC;;;;;GAKG;AACH,oBAAY,iBAAiB;IAC3B,KAAK,UAAU;IACf,IAAI,SAAS;IACb,KAAK,UAAU;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,2FAA2F;IAC3F,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,sCAAsC;IACtC,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAC"}
|
|
||||||
Generated
Vendored
-26
@@ -1,26 +0,0 @@
|
|||||||
import type { ControlButtonProps } from './types';
|
|
||||||
/**
|
|
||||||
* You can add buttons to the control panel by using the `<ControlButton />` component
|
|
||||||
* and pass it as a child to the [`<Controls />`](/api-reference/components/controls) component.
|
|
||||||
*
|
|
||||||
* @public
|
|
||||||
* @example
|
|
||||||
*```jsx
|
|
||||||
*import { MagicWand } from '@radix-ui/react-icons'
|
|
||||||
*import { ReactFlow, Controls, ControlButton } from '@xyflow/react'
|
|
||||||
*
|
|
||||||
*export default function Flow() {
|
|
||||||
* return (
|
|
||||||
* <ReactFlow nodes={[...]} edges={[...]}>
|
|
||||||
* <Controls>
|
|
||||||
* <ControlButton onClick={() => alert('Something magical just happened. ✨')}>
|
|
||||||
* <MagicWand />
|
|
||||||
* </ControlButton>
|
|
||||||
* </Controls>
|
|
||||||
* </ReactFlow>
|
|
||||||
* )
|
|
||||||
*}
|
|
||||||
*```
|
|
||||||
*/
|
|
||||||
export declare function ControlButton({ children, className, ...rest }: ControlButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
||||||
//# sourceMappingURL=ControlButton.d.ts.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"ControlButton.d.ts","sourceRoot":"","sources":["../../../src/additional-components/Controls/ControlButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,kBAAkB,2CAMjF"}
|
|
||||||
-29
@@ -1,29 +0,0 @@
|
|||||||
import type { ControlProps } from './types';
|
|
||||||
declare function ControlsComponent({ style, showZoom, showFitView, showInteractive, fitViewOptions, onZoomIn, onZoomOut, onFitView, onInteractiveChange, className, children, position, orientation, 'aria-label': ariaLabel, }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
||||||
declare namespace ControlsComponent {
|
|
||||||
var displayName: string;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* The `<Controls />` component renders a small panel that contains convenient
|
|
||||||
* buttons to zoom in, zoom out, fit the view, and lock the viewport.
|
|
||||||
*
|
|
||||||
* @public
|
|
||||||
* @example
|
|
||||||
*```tsx
|
|
||||||
*import { ReactFlow, Controls } from '@xyflow/react'
|
|
||||||
*
|
|
||||||
*export default function Flow() {
|
|
||||||
* return (
|
|
||||||
* <ReactFlow nodes={[...]} edges={[...]}>
|
|
||||||
* <Controls />
|
|
||||||
* </ReactFlow>
|
|
||||||
* )
|
|
||||||
*}
|
|
||||||
*```
|
|
||||||
*
|
|
||||||
* @remarks To extend or customise the controls, you can use the [`<ControlButton />`](/api-reference/components/control-button) component
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
export declare const Controls: import("react").MemoExoticComponent<typeof ControlsComponent>;
|
|
||||||
export {};
|
|
||||||
//# sourceMappingURL=Controls.d.ts.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"Controls.d.ts","sourceRoot":"","sources":["../../../src/additional-components/Controls/Controls.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAS5C,iBAAS,iBAAiB,CAAC,EACzB,KAAK,EACL,QAAe,EACf,WAAkB,EAClB,eAAsB,EACtB,cAAc,EACd,QAAQ,EACR,SAAS,EACT,SAAS,EACT,mBAAmB,EACnB,SAAS,EACT,QAAQ,EACR,QAAwB,EACxB,WAAwB,EACxB,YAAY,EAAE,SAAS,GACxB,EAAE,YAAY,2CAoFd;kBAnGQ,iBAAiB;;;AAuG1B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,QAAQ,+DAA0B,CAAC"}
|
|
||||||
Generated
Vendored
-2
@@ -1,2 +0,0 @@
|
|||||||
export declare function FitViewIcon(): import("react/jsx-runtime").JSX.Element;
|
|
||||||
//# sourceMappingURL=FitView.d.ts.map
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user