first commit
|
|
@ -0,0 +1,31 @@
|
|||
kind = "web"
|
||||
previewPath = "/"
|
||||
title = "Luxe Companions"
|
||||
version = "1.0.0"
|
||||
id = "artifacts/luxe-companions"
|
||||
router = "path"
|
||||
|
||||
[[integratedSkills]]
|
||||
name = "react-vite"
|
||||
version = "1.0.0"
|
||||
|
||||
[[services]]
|
||||
name = "web"
|
||||
paths = [ "/" ]
|
||||
localPort = 24411
|
||||
|
||||
[services.development]
|
||||
run = "pnpm --filter @workspace/luxe-companions run dev"
|
||||
|
||||
[services.production]
|
||||
build = [ "pnpm", "--filter", "@workspace/luxe-companions", "run", "build" ]
|
||||
publicDir = "artifacts/luxe-companions/dist/public"
|
||||
serve = "static"
|
||||
|
||||
[[services.production.rewrites]]
|
||||
from = "/*"
|
||||
to = "/index.html"
|
||||
|
||||
[services.env]
|
||||
PORT = "24411"
|
||||
BASE_PATH = "/"
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"$schema": "https://ui.shadcn.com/schema.json",
|
||||
"style": "new-york",
|
||||
"rsc": false,
|
||||
"tsx": true,
|
||||
"tailwind": {
|
||||
"config": "",
|
||||
"css": "src/index.css",
|
||||
"baseColor": "neutral",
|
||||
"cssVariables": true,
|
||||
"prefix": ""
|
||||
},
|
||||
"aliases": {
|
||||
"components": "@/components",
|
||||
"utils": "@/lib/utils",
|
||||
"ui": "@/components/ui",
|
||||
"lib": "@/lib",
|
||||
"hooks": "@/hooks"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 5.3 KiB |
|
After Width: | Height: | Size: 6.5 KiB |
|
After Width: | Height: | Size: 6.4 KiB |
|
After Width: | Height: | Size: 96 KiB |
|
After Width: | Height: | Size: 61 KiB |
|
After Width: | Height: | Size: 83 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 70 KiB |
|
After Width: | Height: | Size: 135 KiB |
|
|
@ -0,0 +1,3 @@
|
|||
<svg width="180" height="180" viewBox="0 0 180 180" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="180" height="180" rx="36" fill="#FF3C00"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 163 B |
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1" />
|
||||
<title>Luxe Companions</title>
|
||||
<meta name="description" content="Luxe Companions — built on Replit. Update this description to reflect the app." />
|
||||
<meta name="robots" content="index, follow" />
|
||||
<meta property="og:title" content="Luxe Companions" />
|
||||
<meta property="og:description" content="Luxe Companions — built on Replit. Update this description to reflect the app." />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta name="twitter:title" content="Luxe Companions" />
|
||||
<meta name="twitter:description" content="Luxe Companions — built on Replit. Update this description to reflect the app." />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||
<script type="module" crossorigin src="/assets/index-DbRE3UOJ.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-BMa1HLj5.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 118 KiB |
|
|
@ -0,0 +1,2 @@
|
|||
User-agent: *
|
||||
Allow: /
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1" />
|
||||
<title>Luxe Companions</title>
|
||||
<meta name="description" content="Luxe Companions — built on Replit. Update this description to reflect the app." />
|
||||
<meta name="robots" content="index, follow" />
|
||||
<meta property="og:title" content="Luxe Companions" />
|
||||
<meta property="og:description" content="Luxe Companions — built on Replit. Update this description to reflect the app." />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta name="twitter:title" content="Luxe Companions" />
|
||||
<meta name="twitter:description" content="Luxe Companions — built on Replit. Update this description to reflect the app." />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1 @@
|
|||
../autoprefixer/bin/autoprefixer
|
||||
|
|
@ -0,0 +1 @@
|
|||
../baseline-browser-mapping/dist/cli.cjs
|
||||
|
|
@ -0,0 +1 @@
|
|||
../browserslist/cli.js
|
||||
|
|
@ -0,0 +1 @@
|
|||
../jiti/lib/jiti-cli.mjs
|
||||
|
|
@ -0,0 +1 @@
|
|||
../nanoid/bin/nanoid.cjs
|
||||
|
|
@ -0,0 +1 @@
|
|||
../rolldown/bin/cli.mjs
|
||||
|
|
@ -0,0 +1 @@
|
|||
../typescript/bin/tsc
|
||||
|
|
@ -0,0 +1 @@
|
|||
../typescript/bin/tsserver
|
||||
|
|
@ -0,0 +1 @@
|
|||
../update-browserslist-db/cli.js
|
||||
|
|
@ -0,0 +1 @@
|
|||
../vite/bin/vite.js
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
"hash": "0f79ec78",
|
||||
"configHash": "7d767bdf",
|
||||
"lockfileHash": "9fbb5c2e",
|
||||
"browserHash": "cc6413c5",
|
||||
"optimized": {
|
||||
"framer-motion": {
|
||||
"src": "../../framer-motion/dist/es/index.mjs",
|
||||
"file": "framer-motion.js",
|
||||
"fileHash": "9d8a684a",
|
||||
"needsInterop": false
|
||||
},
|
||||
"lucide-react": {
|
||||
"src": "../../lucide-react/dist/esm/lucide-react.mjs",
|
||||
"file": "lucide-react.js",
|
||||
"fileHash": "68bda0aa",
|
||||
"needsInterop": false
|
||||
},
|
||||
"react-dom": {
|
||||
"src": "../../react-dom/index.js",
|
||||
"file": "react-dom.js",
|
||||
"fileHash": "8abc7783",
|
||||
"needsInterop": true
|
||||
},
|
||||
"react-dom/client": {
|
||||
"src": "../../react-dom/client.js",
|
||||
"file": "react-dom_client.js",
|
||||
"fileHash": "cb2273ee",
|
||||
"needsInterop": true
|
||||
},
|
||||
"react": {
|
||||
"src": "../../react/index.js",
|
||||
"file": "react.js",
|
||||
"fileHash": "aa8a5379",
|
||||
"needsInterop": true
|
||||
},
|
||||
"react/jsx-dev-runtime": {
|
||||
"src": "../../react/jsx-dev-runtime.js",
|
||||
"file": "react_jsx-dev-runtime.js",
|
||||
"fileHash": "66eda9a2",
|
||||
"needsInterop": true
|
||||
},
|
||||
"react/jsx-runtime": {
|
||||
"src": "../../react/jsx-runtime.js",
|
||||
"file": "react_jsx-runtime.js",
|
||||
"fileHash": "93d810a7",
|
||||
"needsInterop": true
|
||||
},
|
||||
"wouter": {
|
||||
"src": "../../wouter/src/index.js",
|
||||
"file": "wouter.js",
|
||||
"fileHash": "83e3beee",
|
||||
"needsInterop": false
|
||||
}
|
||||
},
|
||||
"chunks": {
|
||||
"react-CZunmVaX": {
|
||||
"file": "react-CZunmVaX.js",
|
||||
"isDynamicEntry": false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"type": "module"
|
||||
}
|
||||
|
|
@ -0,0 +1,799 @@
|
|||
//#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 __exportAll = (all, no_symbols) => {
|
||||
let target = {};
|
||||
for (var name in all) __defProp(target, name, {
|
||||
get: all[name],
|
||||
enumerable: true
|
||||
});
|
||||
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
||||
return target;
|
||||
};
|
||||
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 { __toESM as i, __commonJSMin as n, __exportAll as r, require_react as t };
|
||||
|
||||
//# sourceMappingURL=react-CZunmVaX.js.map
|
||||
|
|
@ -0,0 +1,185 @@
|
|||
import { n as __commonJSMin, t as require_react } from "./react-CZunmVaX.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
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
import { t as require_react } from "./react-CZunmVaX.js";
|
||||
export default require_react();
|
||||
|
|
@ -0,0 +1,204 @@
|
|||
import { n as __commonJSMin, t as require_react } from "./react-CZunmVaX.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
|
||||
|
|
@ -0,0 +1,209 @@
|
|||
import { n as __commonJSMin, t as require_react } from "./react-CZunmVaX.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
|
||||
|
|
@ -0,0 +1,330 @@
|
|||
import { i as __toESM, n as __commonJSMin, t as require_react } from "./react-CZunmVaX.js";
|
||||
//#region node_modules/regexparam/dist/index.mjs
|
||||
/**
|
||||
* @param {string|RegExp} input The route pattern
|
||||
* @param {boolean} [loose] Allow open-ended matching. Ignored with `RegExp` input.
|
||||
*/
|
||||
function parse(input, loose) {
|
||||
if (input instanceof RegExp) return {
|
||||
keys: false,
|
||||
pattern: input
|
||||
};
|
||||
var c, o, tmp, ext, keys = [], pattern = "", arr = input.split("/");
|
||||
arr[0] || arr.shift();
|
||||
while (tmp = arr.shift()) {
|
||||
c = tmp[0];
|
||||
if (c === "*") {
|
||||
keys.push(c);
|
||||
pattern += tmp[1] === "?" ? "(?:/(.*))?" : "/(.*)";
|
||||
} else if (c === ":") {
|
||||
o = tmp.indexOf("?", 1);
|
||||
ext = tmp.indexOf(".", 1);
|
||||
keys.push(tmp.substring(1, !!~o ? o : !!~ext ? ext : tmp.length));
|
||||
pattern += !!~o && !~ext ? "(?:/([^/]+?))?" : "/([^/]+?)";
|
||||
if (!!~ext) pattern += (!!~o ? "?" : "") + "\\" + tmp.substring(ext);
|
||||
} else pattern += "/" + tmp;
|
||||
}
|
||||
return {
|
||||
keys,
|
||||
pattern: new RegExp("^" + pattern + (loose ? "(?=$|/)" : "/?$"), "i")
|
||||
};
|
||||
}
|
||||
//#endregion
|
||||
//#region node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
|
||||
/**
|
||||
* @license React
|
||||
* use-sync-external-store-shim.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_use_sync_external_store_shim_development = /* @__PURE__ */ __commonJSMin(((exports) => {
|
||||
(function() {
|
||||
function is(x, y) {
|
||||
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
||||
}
|
||||
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
||||
didWarnOld18Alpha || void 0 === React.startTransition || (didWarnOld18Alpha = !0, console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
|
||||
var value = getSnapshot();
|
||||
if (!didWarnUncachedGetSnapshot) {
|
||||
var cachedValue = getSnapshot();
|
||||
objectIs(value, cachedValue) || (console.error("The result of getSnapshot should be cached to avoid an infinite loop"), didWarnUncachedGetSnapshot = !0);
|
||||
}
|
||||
cachedValue = useState({ inst: {
|
||||
value,
|
||||
getSnapshot
|
||||
} });
|
||||
var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
|
||||
useLayoutEffect(function() {
|
||||
inst.value = value;
|
||||
inst.getSnapshot = getSnapshot;
|
||||
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
||||
}, [
|
||||
subscribe,
|
||||
value,
|
||||
getSnapshot
|
||||
]);
|
||||
useEffect(function() {
|
||||
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
||||
return subscribe(function() {
|
||||
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
||||
});
|
||||
}, [subscribe]);
|
||||
useDebugValue(value);
|
||||
return value;
|
||||
}
|
||||
function checkIfSnapshotChanged(inst) {
|
||||
var latestGetSnapshot = inst.getSnapshot;
|
||||
inst = inst.value;
|
||||
try {
|
||||
var nextValue = latestGetSnapshot();
|
||||
return !objectIs(inst, nextValue);
|
||||
} catch (error) {
|
||||
return !0;
|
||||
}
|
||||
}
|
||||
function useSyncExternalStore$1(subscribe, getSnapshot) {
|
||||
return getSnapshot();
|
||||
}
|
||||
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
||||
var React = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState = React.useState, useEffect = React.useEffect, useLayoutEffect = React.useLayoutEffect, useDebugValue = React.useDebugValue, didWarnOld18Alpha = !1, didWarnUncachedGetSnapshot = !1, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
||||
exports.useSyncExternalStore = void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;
|
||||
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
||||
})();
|
||||
}));
|
||||
//#endregion
|
||||
//#region node_modules/use-sync-external-store/shim/index.js
|
||||
var require_shim = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
||||
module.exports = require_use_sync_external_store_shim_development();
|
||||
}));
|
||||
//#endregion
|
||||
//#region node_modules/wouter/src/use-sync-external-store.js
|
||||
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
||||
var import_shim = require_shim();
|
||||
//#endregion
|
||||
//#region node_modules/wouter/src/react-deps.js
|
||||
var useBuiltinInsertionEffect = import_react.useInsertionEffect;
|
||||
var useIsomorphicLayoutEffect = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined") ? import_react.useLayoutEffect : import_react.useEffect;
|
||||
var useInsertionEffect = useBuiltinInsertionEffect || useIsomorphicLayoutEffect;
|
||||
var useEvent = (fn) => {
|
||||
const ref = import_react.useRef([fn, (...args) => ref[0](...args)]).current;
|
||||
useInsertionEffect(() => {
|
||||
ref[0] = fn;
|
||||
});
|
||||
return ref[1];
|
||||
};
|
||||
//#endregion
|
||||
//#region node_modules/wouter/src/use-browser-location.js
|
||||
/**
|
||||
* History API docs @see https://developer.mozilla.org/en-US/docs/Web/API/History
|
||||
*/
|
||||
var eventPopstate = "popstate";
|
||||
var eventPushState = "pushState";
|
||||
var eventReplaceState = "replaceState";
|
||||
var events = [
|
||||
eventPopstate,
|
||||
eventPushState,
|
||||
eventReplaceState,
|
||||
"hashchange"
|
||||
];
|
||||
var subscribeToLocationUpdates = (callback) => {
|
||||
for (const event of events) addEventListener(event, callback);
|
||||
return () => {
|
||||
for (const event of events) removeEventListener(event, callback);
|
||||
};
|
||||
};
|
||||
var useLocationProperty = (fn, ssrFn) => (0, import_shim.useSyncExternalStore)(subscribeToLocationUpdates, fn, ssrFn);
|
||||
var currentSearch = () => location.search;
|
||||
var useSearch$1 = ({ ssrSearch } = {}) => useLocationProperty(currentSearch, ssrSearch != null ? () => ssrSearch : currentSearch);
|
||||
var currentPathname = () => location.pathname;
|
||||
var usePathname = ({ ssrPath } = {}) => useLocationProperty(currentPathname, ssrPath != null ? () => ssrPath : currentPathname);
|
||||
var navigate = (to, { replace = false, state = null } = {}) => history[replace ? eventReplaceState : eventPushState](state, "", to);
|
||||
var useBrowserLocation = (opts = {}) => [usePathname(opts), navigate];
|
||||
var patchKey = Symbol.for("wouter_v3");
|
||||
if (typeof history !== "undefined" && typeof window[patchKey] === "undefined") {
|
||||
for (const type of [eventPushState, eventReplaceState]) {
|
||||
const original = history[type];
|
||||
history[type] = function() {
|
||||
const result = original.apply(this, arguments);
|
||||
const event = new Event(type);
|
||||
event.arguments = arguments;
|
||||
dispatchEvent(event);
|
||||
return result;
|
||||
};
|
||||
}
|
||||
Object.defineProperty(window, patchKey, { value: true });
|
||||
}
|
||||
//#endregion
|
||||
//#region node_modules/wouter/src/paths.js
|
||||
var _relativePath = (base, path) => !path.toLowerCase().indexOf(base.toLowerCase()) ? path.slice(base.length) || "/" : "~" + path;
|
||||
/**
|
||||
* When basepath is `undefined` or '/' it is ignored (we assume it's empty string)
|
||||
*/
|
||||
var baseDefaults = (base = "") => base === "/" ? "" : base;
|
||||
var absolutePath = (to, base) => to[0] === "~" ? to.slice(1) : baseDefaults(base) + to;
|
||||
var relativePath = (base = "", path) => _relativePath(unescape(baseDefaults(base)), unescape(path));
|
||||
var stripQm = (str) => str[0] === "?" ? str.slice(1) : str;
|
||||
var unescape = (str) => {
|
||||
try {
|
||||
return decodeURI(str);
|
||||
} catch (_e) {
|
||||
return str;
|
||||
}
|
||||
};
|
||||
var sanitizeSearch = (search) => unescape(stripQm(search));
|
||||
//#endregion
|
||||
//#region node_modules/wouter/src/index.js
|
||||
var defaultRouter = {
|
||||
hook: useBrowserLocation,
|
||||
searchHook: useSearch$1,
|
||||
parser: parse,
|
||||
base: "",
|
||||
ssrPath: void 0,
|
||||
ssrSearch: void 0,
|
||||
ssrContext: void 0,
|
||||
hrefs: (x) => x,
|
||||
aroundNav: (n, t, o) => n(t, o)
|
||||
};
|
||||
var RouterCtx = (0, import_react.createContext)(defaultRouter);
|
||||
var useRouter = () => (0, import_react.useContext)(RouterCtx);
|
||||
/**
|
||||
* Parameters context. Used by `useParams()` to get the
|
||||
* matched params from the innermost `Route` component.
|
||||
*/
|
||||
var Params0 = {}, ParamsCtx = (0, import_react.createContext)(Params0);
|
||||
var useParams = () => (0, import_react.useContext)(ParamsCtx);
|
||||
var useLocationFromRouter = (router) => {
|
||||
const [location, navigate] = router.hook(router);
|
||||
return [relativePath(router.base, location), useEvent((to, opts) => router.aroundNav(navigate, absolutePath(to, router.base), opts))];
|
||||
};
|
||||
var useLocation = () => useLocationFromRouter(useRouter());
|
||||
var useSearch = () => {
|
||||
const router = useRouter();
|
||||
return sanitizeSearch(router.searchHook(router));
|
||||
};
|
||||
var matchRoute = (parser, route, path, loose) => {
|
||||
const { pattern, keys } = route instanceof RegExp ? {
|
||||
keys: false,
|
||||
pattern: route
|
||||
} : parser(route || "*", loose);
|
||||
const result = pattern.exec(path) || [];
|
||||
const [$base, ...matches] = result;
|
||||
return $base !== void 0 ? [
|
||||
true,
|
||||
(() => {
|
||||
const groups = keys !== false ? Object.fromEntries(keys.map((key, i) => [key, matches[i]])) : result.groups;
|
||||
let obj = { ...matches };
|
||||
groups && Object.assign(obj, groups);
|
||||
return obj;
|
||||
})(),
|
||||
...loose ? [$base] : []
|
||||
] : [false, null];
|
||||
};
|
||||
var useRoute = (pattern) => matchRoute(useRouter().parser, pattern, useLocation()[0]);
|
||||
var Router = ({ children, ...props }) => {
|
||||
const parent_ = useRouter();
|
||||
const parent = props.hook ? defaultRouter : parent_;
|
||||
let value = parent;
|
||||
const [path, search = props.ssrSearch ?? ""] = props.ssrPath?.split("?") ?? [];
|
||||
if (path) props.ssrSearch = search, props.ssrPath = path;
|
||||
props.hrefs = props.hrefs ?? props.hook?.hrefs;
|
||||
props.searchHook = props.searchHook ?? props.hook?.searchHook;
|
||||
let ref = (0, import_react.useRef)({}), prev = ref.current, next = prev;
|
||||
for (let k in parent) {
|
||||
const option = k === "base" ? parent[k] + (props[k] ?? "") : props[k] ?? parent[k];
|
||||
if (prev === next && option !== next[k]) ref.current = next = { ...next };
|
||||
next[k] = option;
|
||||
if (option !== parent[k] || option !== value[k]) value = next;
|
||||
}
|
||||
return (0, import_react.createElement)(RouterCtx.Provider, {
|
||||
value,
|
||||
children
|
||||
});
|
||||
};
|
||||
var h_route = ({ children, component }, params) => {
|
||||
if (component) return (0, import_react.createElement)(component, { params });
|
||||
return typeof children === "function" ? children(params) : children;
|
||||
};
|
||||
var useCachedParams = (value) => {
|
||||
let prev = (0, import_react.useRef)(Params0);
|
||||
const curr = prev.current;
|
||||
return prev.current = Object.keys(value).length !== Object.keys(curr).length || Object.entries(value).some(([k, v]) => v !== curr[k]) ? value : curr;
|
||||
};
|
||||
function useSearchParams() {
|
||||
const [location, navigate] = useLocation();
|
||||
const search = useSearch();
|
||||
const searchParams = (0, import_react.useMemo)(() => new URLSearchParams(search), [search]);
|
||||
let tempSearchParams = searchParams;
|
||||
return [searchParams, useEvent((nextInit, options) => {
|
||||
tempSearchParams = new URLSearchParams(typeof nextInit === "function" ? nextInit(tempSearchParams) : nextInit);
|
||||
navigate(location + (tempSearchParams.size ? "?" + tempSearchParams : ""), options);
|
||||
})];
|
||||
}
|
||||
var Route = ({ path, nest, match, ...renderProps }) => {
|
||||
const router = useRouter();
|
||||
const [location] = useLocationFromRouter(router);
|
||||
const [matches, routeParams, base] = match ?? matchRoute(router.parser, path, location, nest);
|
||||
const params = useCachedParams({
|
||||
...useParams(),
|
||||
...routeParams
|
||||
});
|
||||
if (!matches) return null;
|
||||
const children = base ? (0, import_react.createElement)(Router, { base }, h_route(renderProps, params)) : h_route(renderProps, params);
|
||||
return (0, import_react.createElement)(ParamsCtx.Provider, {
|
||||
value: params,
|
||||
children
|
||||
});
|
||||
};
|
||||
var Link = (0, import_react.forwardRef)((props, ref) => {
|
||||
const router = useRouter();
|
||||
const [currentPath, navigate] = useLocationFromRouter(router);
|
||||
const { to = "", href: targetPath = to, onClick: _onClick, asChild, children, className: cls, replace, state, transition, ...restProps } = props;
|
||||
const onClick = useEvent((event) => {
|
||||
if (event.ctrlKey || event.metaKey || event.altKey || event.shiftKey || event.button !== 0) return;
|
||||
_onClick?.(event);
|
||||
if (!event.defaultPrevented) {
|
||||
event.preventDefault();
|
||||
navigate(targetPath, props);
|
||||
}
|
||||
});
|
||||
const href = router.hrefs(targetPath[0] === "~" ? targetPath.slice(1) : router.base + targetPath, router);
|
||||
return asChild && (0, import_react.isValidElement)(children) ? (0, import_react.cloneElement)(children, {
|
||||
onClick,
|
||||
href
|
||||
}) : (0, import_react.createElement)("a", {
|
||||
...restProps,
|
||||
onClick,
|
||||
href,
|
||||
className: cls?.call ? cls(currentPath === targetPath) : cls,
|
||||
children,
|
||||
ref
|
||||
});
|
||||
});
|
||||
var flattenChildren = (children) => Array.isArray(children) ? children.flatMap((c) => flattenChildren(c && c.type === import_react.Fragment ? c.props.children : c)) : [children];
|
||||
var Switch = ({ children, location }) => {
|
||||
const router = useRouter();
|
||||
const [originalLocation] = useLocationFromRouter(router);
|
||||
for (const element of flattenChildren(children)) {
|
||||
let match = 0;
|
||||
if ((0, import_react.isValidElement)(element) && (match = matchRoute(router.parser, element.props.path, location || originalLocation, element.props.nest))[0]) return (0, import_react.cloneElement)(element, { match });
|
||||
}
|
||||
return null;
|
||||
};
|
||||
var Redirect = (props) => {
|
||||
const { to, href = to } = props;
|
||||
const router = useRouter();
|
||||
const [, navigate] = useLocationFromRouter(router);
|
||||
const redirect = useEvent(() => navigate(to || href, props));
|
||||
const { ssrContext } = router;
|
||||
useIsomorphicLayoutEffect(() => {
|
||||
redirect();
|
||||
}, []);
|
||||
if (ssrContext) ssrContext.redirectTo = to;
|
||||
return null;
|
||||
};
|
||||
//#endregion
|
||||
export { Link, Redirect, Route, Router, Switch, matchRoute, useLocation, useParams, useRoute, useRouter, useSearch, useSearchParams };
|
||||
|
||||
//# sourceMappingURL=wouter.js.map
|
||||
|
|
@ -0,0 +1,177 @@
|
|||
{
|
||||
"systemParams": "linux-x64-137",
|
||||
"modulesFolders": [
|
||||
"node_modules"
|
||||
],
|
||||
"flags": [],
|
||||
"linkedModules": [],
|
||||
"topLevelPatterns": [
|
||||
"@radix-ui/react-toast@^1.2.15",
|
||||
"@radix-ui/react-tooltip@^1.2.8",
|
||||
"@tailwindcss/vite@^4.3.0",
|
||||
"@tanstack/react-query@^5.101.0",
|
||||
"@types/react-dom@latest",
|
||||
"@types/react@latest",
|
||||
"@vitejs/plugin-react@latest",
|
||||
"autoprefixer@^10.5.0",
|
||||
"class-variance-authority@^0.7.1",
|
||||
"clsx@^2.1.1",
|
||||
"framer-motion@latest",
|
||||
"lucide-react@latest",
|
||||
"postcss@^8.5.15",
|
||||
"react-dom@latest",
|
||||
"react@latest",
|
||||
"sonner@latest",
|
||||
"tailwind-merge@^3.6.0",
|
||||
"tailwindcss@latest",
|
||||
"tw-animate-css@^1.4.0",
|
||||
"typescript@latest",
|
||||
"vite@latest",
|
||||
"wouter@latest"
|
||||
],
|
||||
"lockfileEntries": {
|
||||
"@emnapi/core@1.10.0": "https://registry.yarnpkg.com/@emnapi/core/-/core-1.10.0.tgz#380ccc8f2412ea22d1d972df7f8ee23a3b9c7467",
|
||||
"@emnapi/core@^1.10.0": "https://registry.yarnpkg.com/@emnapi/core/-/core-1.10.0.tgz#380ccc8f2412ea22d1d972df7f8ee23a3b9c7467",
|
||||
"@emnapi/runtime@1.10.0": "https://registry.yarnpkg.com/@emnapi/runtime/-/runtime-1.10.0.tgz#4b260c0d3534204e98c6110b8db1a987d26ec87c",
|
||||
"@emnapi/runtime@^1.10.0": "https://registry.yarnpkg.com/@emnapi/runtime/-/runtime-1.10.0.tgz#4b260c0d3534204e98c6110b8db1a987d26ec87c",
|
||||
"@emnapi/wasi-threads@1.2.1": "https://registry.yarnpkg.com/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz#28fed21a1ba1ce797c44a070abc94d42f3ae8548",
|
||||
"@emnapi/wasi-threads@^1.2.1": "https://registry.yarnpkg.com/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz#28fed21a1ba1ce797c44a070abc94d42f3ae8548",
|
||||
"@floating-ui/core@^1.7.5": "https://registry.yarnpkg.com/@floating-ui/core/-/core-1.7.5.tgz#d4af157a03330af5a60e69da7a4692507ada0622",
|
||||
"@floating-ui/dom@^1.7.6": "https://registry.yarnpkg.com/@floating-ui/dom/-/dom-1.7.6.tgz#f915bba5abbb177e1f227cacee1b4d0634b187bf",
|
||||
"@floating-ui/react-dom@^2.0.0": "https://registry.yarnpkg.com/@floating-ui/react-dom/-/react-dom-2.1.8.tgz#5fb5a20d10aafb9505f38c24f38d00c8e1598893",
|
||||
"@floating-ui/utils@^0.2.11": "https://registry.yarnpkg.com/@floating-ui/utils/-/utils-0.2.11.tgz#a269e055e40e2f45873bae9d1a2fdccbd314ea3f",
|
||||
"@jridgewell/gen-mapping@^0.3.5": "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz#6342a19f44347518c93e43b1ac69deb3c4656a1f",
|
||||
"@jridgewell/remapping@^2.3.5": "https://registry.yarnpkg.com/@jridgewell/remapping/-/remapping-2.3.5.tgz#375c476d1972947851ba1e15ae8f123047445aa1",
|
||||
"@jridgewell/resolve-uri@^3.1.0": "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz#7a0ee601f60f99a20c7c7c5ff0c80388c1189bd6",
|
||||
"@jridgewell/sourcemap-codec@^1.4.14": "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz#6912b00d2c631c0d15ce1a7ab57cd657f2a8f8ba",
|
||||
"@jridgewell/sourcemap-codec@^1.5.0": "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz#6912b00d2c631c0d15ce1a7ab57cd657f2a8f8ba",
|
||||
"@jridgewell/sourcemap-codec@^1.5.5": "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz#6912b00d2c631c0d15ce1a7ab57cd657f2a8f8ba",
|
||||
"@jridgewell/trace-mapping@^0.3.24": "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz#db15d6781c931f3a251a3dac39501c98a6082fd0",
|
||||
"@napi-rs/wasm-runtime@^1.1.4": "https://registry.yarnpkg.com/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.4.tgz#a46bbfedc29751b7170c5d23bc1d8ee8c7e3c1e1",
|
||||
"@oxc-project/types@=0.133.0": "https://registry.yarnpkg.com/@oxc-project/types/-/types-0.133.0.tgz#2e282ef9e1d26e06b68ccd14b73f310a3b2cf7f8",
|
||||
"@radix-ui/primitive@1.1.3": "https://registry.yarnpkg.com/@radix-ui/primitive/-/primitive-1.1.3.tgz#e2dbc13bdc5e4168f4334f75832d7bdd3e2de5ba",
|
||||
"@radix-ui/react-arrow@1.1.7": "https://registry.yarnpkg.com/@radix-ui/react-arrow/-/react-arrow-1.1.7.tgz#e14a2657c81d961598c5e72b73dd6098acc04f09",
|
||||
"@radix-ui/react-collection@1.1.7": "https://registry.yarnpkg.com/@radix-ui/react-collection/-/react-collection-1.1.7.tgz#d05c25ca9ac4695cc19ba91f42f686e3ea2d9aec",
|
||||
"@radix-ui/react-compose-refs@1.1.2": "https://registry.yarnpkg.com/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.2.tgz#a2c4c47af6337048ee78ff6dc0d090b390d2bb30",
|
||||
"@radix-ui/react-context@1.1.2": "https://registry.yarnpkg.com/@radix-ui/react-context/-/react-context-1.1.2.tgz#61628ef269a433382c364f6f1e3788a6dc213a36",
|
||||
"@radix-ui/react-dismissable-layer@1.1.11": "https://registry.yarnpkg.com/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.1.11.tgz#e33ab6f6bdaa00f8f7327c408d9f631376b88b37",
|
||||
"@radix-ui/react-id@1.1.1": "https://registry.yarnpkg.com/@radix-ui/react-id/-/react-id-1.1.1.tgz#1404002e79a03fe062b7e3864aa01e24bd1471f7",
|
||||
"@radix-ui/react-popper@1.2.8": "https://registry.yarnpkg.com/@radix-ui/react-popper/-/react-popper-1.2.8.tgz#a79f39cdd2b09ab9fb50bf95250918422c4d9602",
|
||||
"@radix-ui/react-portal@1.1.9": "https://registry.yarnpkg.com/@radix-ui/react-portal/-/react-portal-1.1.9.tgz#14c3649fe48ec474ac51ed9f2b9f5da4d91c4472",
|
||||
"@radix-ui/react-presence@1.1.5": "https://registry.yarnpkg.com/@radix-ui/react-presence/-/react-presence-1.1.5.tgz#5d8f28ac316c32f078afce2996839250c10693db",
|
||||
"@radix-ui/react-primitive@2.1.3": "https://registry.yarnpkg.com/@radix-ui/react-primitive/-/react-primitive-2.1.3.tgz#db9b8bcff49e01be510ad79893fb0e4cda50f1bc",
|
||||
"@radix-ui/react-slot@1.2.3": "https://registry.yarnpkg.com/@radix-ui/react-slot/-/react-slot-1.2.3.tgz#502d6e354fc847d4169c3bc5f189de777f68cfe1",
|
||||
"@radix-ui/react-toast@^1.2.15": "https://registry.yarnpkg.com/@radix-ui/react-toast/-/react-toast-1.2.15.tgz#746cf9a81297ddbfba214e5c81245ea3f706f876",
|
||||
"@radix-ui/react-tooltip@^1.2.8": "https://registry.yarnpkg.com/@radix-ui/react-tooltip/-/react-tooltip-1.2.8.tgz#3f50267e25bccfc9e20bb3036bfd9ab4c2c30c2c",
|
||||
"@radix-ui/react-use-callback-ref@1.1.1": "https://registry.yarnpkg.com/@radix-ui/react-use-callback-ref/-/react-use-callback-ref-1.1.1.tgz#62a4dba8b3255fdc5cc7787faeac1c6e4cc58d40",
|
||||
"@radix-ui/react-use-controllable-state@1.2.2": "https://registry.yarnpkg.com/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.2.2.tgz#905793405de57d61a439f4afebbb17d0645f3190",
|
||||
"@radix-ui/react-use-effect-event@0.0.2": "https://registry.yarnpkg.com/@radix-ui/react-use-effect-event/-/react-use-effect-event-0.0.2.tgz#090cf30d00a4c7632a15548512e9152217593907",
|
||||
"@radix-ui/react-use-escape-keydown@1.1.1": "https://registry.yarnpkg.com/@radix-ui/react-use-escape-keydown/-/react-use-escape-keydown-1.1.1.tgz#b3fed9bbea366a118f40427ac40500aa1423cc29",
|
||||
"@radix-ui/react-use-layout-effect@1.1.1": "https://registry.yarnpkg.com/@radix-ui/react-use-layout-effect/-/react-use-layout-effect-1.1.1.tgz#0c4230a9eed49d4589c967e2d9c0d9d60a23971e",
|
||||
"@radix-ui/react-use-rect@1.1.1": "https://registry.yarnpkg.com/@radix-ui/react-use-rect/-/react-use-rect-1.1.1.tgz#01443ca8ed071d33023c1113e5173b5ed8769152",
|
||||
"@radix-ui/react-use-size@1.1.1": "https://registry.yarnpkg.com/@radix-ui/react-use-size/-/react-use-size-1.1.1.tgz#6de276ffbc389a537ffe4316f5b0f24129405b37",
|
||||
"@radix-ui/react-visually-hidden@1.2.3": "https://registry.yarnpkg.com/@radix-ui/react-visually-hidden/-/react-visually-hidden-1.2.3.tgz#a8c38c8607735dc9f05c32f87ab0f9c2b109efbf",
|
||||
"@radix-ui/rect@1.1.1": "https://registry.yarnpkg.com/@radix-ui/rect/-/rect-1.1.1.tgz#78244efe12930c56fd255d7923865857c41ac8cb",
|
||||
"@rolldown/binding-android-arm64@1.0.3": "https://registry.yarnpkg.com/@rolldown/binding-android-arm64/-/binding-android-arm64-1.0.3.tgz#54ce8f8382213f4a314a0c2f7ba83f81ffeae592",
|
||||
"@rolldown/binding-darwin-arm64@1.0.3": "https://registry.yarnpkg.com/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.0.3.tgz#388fca1566c14c00c4b446fc3928630e7f0d95fc",
|
||||
"@rolldown/binding-darwin-x64@1.0.3": "https://registry.yarnpkg.com/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.0.3.tgz#53f57de1f599ecf1db13823cfc88c18fb80954ad",
|
||||
"@rolldown/binding-freebsd-x64@1.0.3": "https://registry.yarnpkg.com/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.0.3.tgz#6f3fdda1b7aeaac9d268a526804b4fb96e4e35f1",
|
||||
"@rolldown/binding-linux-arm-gnueabihf@1.0.3": "https://registry.yarnpkg.com/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.0.3.tgz#d87a454bf585cc9676849377e91d6e375297326f",
|
||||
"@rolldown/binding-linux-arm64-gnu@1.0.3": "https://registry.yarnpkg.com/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.0.3.tgz#419fd6bf612cf348f10528cbcd94ebab9607d8d1",
|
||||
"@rolldown/binding-linux-arm64-musl@1.0.3": "https://registry.yarnpkg.com/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.0.3.tgz#fcc6918696bb76844877e1e4930a18fd0d374069",
|
||||
"@rolldown/binding-linux-ppc64-gnu@1.0.3": "https://registry.yarnpkg.com/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.0.3.tgz#32aecb7c8dae5d4f2a8cde57a058ec86991542f8",
|
||||
"@rolldown/binding-linux-s390x-gnu@1.0.3": "https://registry.yarnpkg.com/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.0.3.tgz#bed9346ea81e6bb8b93cf11f5d88b77db890b763",
|
||||
"@rolldown/binding-linux-x64-gnu@1.0.3": "https://registry.yarnpkg.com/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.0.3.tgz#64c2d26f75dffd9b5a1f97557a00ae77250c8cb7",
|
||||
"@rolldown/binding-linux-x64-musl@1.0.3": "https://registry.yarnpkg.com/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.0.3.tgz#5a45132e8a47659eeaaf3b540c2954a97c860ff3",
|
||||
"@rolldown/binding-openharmony-arm64@1.0.3": "https://registry.yarnpkg.com/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.0.3.tgz#290513068c55e849dc8457a32afee1d7b0acb309",
|
||||
"@rolldown/binding-wasm32-wasi@1.0.3": "https://registry.yarnpkg.com/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.0.3.tgz#3d9972dbf1a953d3c7afaa4a0f20ef2b2e39f31b",
|
||||
"@rolldown/binding-win32-arm64-msvc@1.0.3": "https://registry.yarnpkg.com/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.0.3.tgz#a004ab607a16d6f03bcb555728ff888af75773ad",
|
||||
"@rolldown/binding-win32-x64-msvc@1.0.3": "https://registry.yarnpkg.com/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.0.3.tgz#e2a25b34691a1cc8a1209d7de709063026dd0cdb",
|
||||
"@rolldown/pluginutils@^1.0.0": "https://registry.yarnpkg.com/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz#e3fcee093fbb5ce765e1ad088ff4de2889f6f9be",
|
||||
"@tailwindcss/node@4.3.0": "https://registry.yarnpkg.com/@tailwindcss/node/-/node-4.3.0.tgz#9dc5312bf41c48658529f36021e0b466c4eb7860",
|
||||
"@tailwindcss/oxide-android-arm64@4.3.0": "https://registry.yarnpkg.com/@tailwindcss/oxide-android-arm64/-/oxide-android-arm64-4.3.0.tgz#e4533b6125236fe81a899cf5a82028c85244def8",
|
||||
"@tailwindcss/oxide-darwin-arm64@4.3.0": "https://registry.yarnpkg.com/@tailwindcss/oxide-darwin-arm64/-/oxide-darwin-arm64-4.3.0.tgz#96b074ef64ec6c41d580063740c8d36cf5c459ce",
|
||||
"@tailwindcss/oxide-darwin-x64@4.3.0": "https://registry.yarnpkg.com/@tailwindcss/oxide-darwin-x64/-/oxide-darwin-x64-4.3.0.tgz#0d9638d06d38684339b2dc06631966a7296bb64e",
|
||||
"@tailwindcss/oxide-freebsd-x64@4.3.0": "https://registry.yarnpkg.com/@tailwindcss/oxide-freebsd-x64/-/oxide-freebsd-x64-4.3.0.tgz#efc7acd17cd38d7585c07cb938a4f1b703f79d7a",
|
||||
"@tailwindcss/oxide-linux-arm-gnueabihf@4.3.0": "https://registry.yarnpkg.com/@tailwindcss/oxide-linux-arm-gnueabihf/-/oxide-linux-arm-gnueabihf-4.3.0.tgz#e41c945e529670cd93fd6ed0c6a2880de5c40333",
|
||||
"@tailwindcss/oxide-linux-arm64-gnu@4.3.0": "https://registry.yarnpkg.com/@tailwindcss/oxide-linux-arm64-gnu/-/oxide-linux-arm64-gnu-4.3.0.tgz#6bb608b16ba7146d61097c2f4c7ee927d1f3580a",
|
||||
"@tailwindcss/oxide-linux-arm64-musl@4.3.0": "https://registry.yarnpkg.com/@tailwindcss/oxide-linux-arm64-musl/-/oxide-linux-arm64-musl-4.3.0.tgz#1bb443aa371bb99b50cb39d4d688151fadcd8a63",
|
||||
"@tailwindcss/oxide-linux-x64-gnu@4.3.0": "https://registry.yarnpkg.com/@tailwindcss/oxide-linux-x64-gnu/-/oxide-linux-x64-gnu-4.3.0.tgz#5267c0bb2597426c0d2e759acb5389cde2aa71fd",
|
||||
"@tailwindcss/oxide-linux-x64-musl@4.3.0": "https://registry.yarnpkg.com/@tailwindcss/oxide-linux-x64-musl/-/oxide-linux-x64-musl-4.3.0.tgz#fb2da97c67b218e5c7c723cb32782d55d7e4a5d5",
|
||||
"@tailwindcss/oxide-wasm32-wasi@4.3.0": "https://registry.yarnpkg.com/@tailwindcss/oxide-wasm32-wasi/-/oxide-wasm32-wasi-4.3.0.tgz#3f6538e511066d67d8683863dcaeeb16c22de849",
|
||||
"@tailwindcss/oxide-win32-arm64-msvc@4.3.0": "https://registry.yarnpkg.com/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.3.0.tgz#ec45fba773c76759338c05d4fe5cf42c4eea2e4e",
|
||||
"@tailwindcss/oxide-win32-x64-msvc@4.3.0": "https://registry.yarnpkg.com/@tailwindcss/oxide-win32-x64-msvc/-/oxide-win32-x64-msvc-4.3.0.tgz#58cdd6e06adbe2e3160274edfcd0b0b43e17fee4",
|
||||
"@tailwindcss/oxide@4.3.0": "https://registry.yarnpkg.com/@tailwindcss/oxide/-/oxide-4.3.0.tgz#cc1c61e88f62c0e9f56062de3e7873acaa2159d4",
|
||||
"@tailwindcss/vite@^4.3.0": "https://registry.yarnpkg.com/@tailwindcss/vite/-/vite-4.3.0.tgz#b2bbc069a4c700ea7aef5ee30416d84b7652e136",
|
||||
"@tanstack/query-core@5.101.0": "https://registry.yarnpkg.com/@tanstack/query-core/-/query-core-5.101.0.tgz#45391ce143c270b7e7a55bd1a6696918f20782d1",
|
||||
"@tanstack/react-query@^5.101.0": "https://registry.yarnpkg.com/@tanstack/react-query/-/react-query-5.101.0.tgz#2dd56c5b96ec816d6b6ec9cee5c80ed298974733",
|
||||
"@tybys/wasm-util@^0.10.1": "https://registry.yarnpkg.com/@tybys/wasm-util/-/wasm-util-0.10.2.tgz#12b3a1b33db1f9cad4ddff1f604ab7dd00bf464e",
|
||||
"@types/react-dom@latest": "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-19.2.3.tgz#c1e305d15a52a3e508d54dca770d202cb63abf2c",
|
||||
"@types/react@latest": "https://registry.yarnpkg.com/@types/react/-/react-19.2.16.tgz#9868b153fd9e34e0117afcd5d7e372b8179337e1",
|
||||
"@vitejs/plugin-react@latest": "https://registry.yarnpkg.com/@vitejs/plugin-react/-/plugin-react-6.0.2.tgz#f70cb8ed0ce225dbc3055d78070f820d8aa35eda",
|
||||
"autoprefixer@^10.5.0": "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-10.5.0.tgz#33d87e443430f020a0f85319d6ff1593cb291be9",
|
||||
"baseline-browser-mapping@^2.10.12": "https://registry.yarnpkg.com/baseline-browser-mapping/-/baseline-browser-mapping-2.10.33.tgz#27c299b096404978831958d429f48390424c4f9b",
|
||||
"browserslist@^4.28.2": "https://registry.yarnpkg.com/browserslist/-/browserslist-4.28.2.tgz#f50b65362ef48974ca9f50b3680566d786b811d2",
|
||||
"caniuse-lite@^1.0.30001782": "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001793.tgz#238887ddf5fcfc8c36d872394d0a78a517312a72",
|
||||
"caniuse-lite@^1.0.30001787": "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001793.tgz#238887ddf5fcfc8c36d872394d0a78a517312a72",
|
||||
"class-variance-authority@^0.7.1": "https://registry.yarnpkg.com/class-variance-authority/-/class-variance-authority-0.7.1.tgz#4008a798a0e4553a781a57ac5177c9fb5d043787",
|
||||
"clsx@^2.1.1": "https://registry.yarnpkg.com/clsx/-/clsx-2.1.1.tgz#eed397c9fd8bd882bfb18deab7102049a2f32999",
|
||||
"csstype@^3.2.2": "https://registry.yarnpkg.com/csstype/-/csstype-3.2.3.tgz#ec48c0f3e993e50648c86da559e2610995cf989a",
|
||||
"detect-libc@^2.0.3": "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.1.2.tgz#689c5dcdc1900ef5583a4cb9f6d7b473742074ad",
|
||||
"electron-to-chromium@^1.5.328": "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.366.tgz#54cfb4090db768d58dce9ef5a2f8b837e61ebe6b",
|
||||
"enhanced-resolve@^5.21.0": "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.22.1.tgz#c34bc3f414298496fc244b21bbe316440782da17",
|
||||
"escalade@^3.2.0": "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5",
|
||||
"fdir@^6.5.0": "https://registry.yarnpkg.com/fdir/-/fdir-6.5.0.tgz#ed2ab967a331ade62f18d077dae192684d50d350",
|
||||
"fraction.js@^5.3.4": "https://registry.yarnpkg.com/fraction.js/-/fraction.js-5.3.4.tgz#8c0fcc6a9908262df4ed197427bdeef563e0699a",
|
||||
"framer-motion@latest": "https://registry.yarnpkg.com/framer-motion/-/framer-motion-12.40.0.tgz#68e53aecd51c8a8a62b565f059b418bef2add0e2",
|
||||
"fsevents@~2.3.3": "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6",
|
||||
"graceful-fs@^4.2.4": "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3",
|
||||
"jiti@^2.6.1": "https://registry.yarnpkg.com/jiti/-/jiti-2.7.0.tgz#974228f2f4ca2bc21885a1797b45fea68e950c64",
|
||||
"lightningcss-android-arm64@1.32.0": "https://registry.yarnpkg.com/lightningcss-android-arm64/-/lightningcss-android-arm64-1.32.0.tgz#f033885116dfefd9c6f54787523e3514b61e1968",
|
||||
"lightningcss-darwin-arm64@1.32.0": "https://registry.yarnpkg.com/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.32.0.tgz#50b71871b01c8199584b649e292547faea7af9b5",
|
||||
"lightningcss-darwin-x64@1.32.0": "https://registry.yarnpkg.com/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.32.0.tgz#35f3e97332d130b9ca181e11b568ded6aebc6d5e",
|
||||
"lightningcss-freebsd-x64@1.32.0": "https://registry.yarnpkg.com/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.32.0.tgz#9777a76472b64ed6ff94342ad64c7bafd794a575",
|
||||
"lightningcss-linux-arm-gnueabihf@1.32.0": "https://registry.yarnpkg.com/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.32.0.tgz#13ae652e1ab73b9135d7b7da172f666c410ad53d",
|
||||
"lightningcss-linux-arm64-gnu@1.32.0": "https://registry.yarnpkg.com/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.32.0.tgz#417858795a94592f680123a1b1f9da8a0e1ef335",
|
||||
"lightningcss-linux-arm64-musl@1.32.0": "https://registry.yarnpkg.com/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.32.0.tgz#6be36692e810b718040802fd809623cffe732133",
|
||||
"lightningcss-linux-x64-gnu@1.32.0": "https://registry.yarnpkg.com/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.32.0.tgz#0b7803af4eb21cfd38dd39fe2abbb53c7dd091f6",
|
||||
"lightningcss-linux-x64-musl@1.32.0": "https://registry.yarnpkg.com/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.32.0.tgz#88dc8ba865ddddb1ac5ef04b0f161804418c163b",
|
||||
"lightningcss-win32-arm64-msvc@1.32.0": "https://registry.yarnpkg.com/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.32.0.tgz#4f30ba3fa5e925f5b79f945e8cc0d176c3b1ab38",
|
||||
"lightningcss-win32-x64-msvc@1.32.0": "https://registry.yarnpkg.com/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.32.0.tgz#141aa5605645064928902bb4af045fa7d9f4220a",
|
||||
"lightningcss@1.32.0": "https://registry.yarnpkg.com/lightningcss/-/lightningcss-1.32.0.tgz#b85aae96486dcb1bf49a7c8571221273f4f1e4a9",
|
||||
"lightningcss@^1.32.0": "https://registry.yarnpkg.com/lightningcss/-/lightningcss-1.32.0.tgz#b85aae96486dcb1bf49a7c8571221273f4f1e4a9",
|
||||
"lucide-react@latest": "https://registry.yarnpkg.com/lucide-react/-/lucide-react-1.17.0.tgz#5b8ddd7d6975e3e45dc9d03025afc7674d78f8a8",
|
||||
"magic-string@^0.30.21": "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.21.tgz#56763ec09a0fa8091df27879fd94d19078c00d91",
|
||||
"mitt@^3.0.1": "https://registry.yarnpkg.com/mitt/-/mitt-3.0.1.tgz#ea36cf0cc30403601ae074c8f77b7092cdab36d1",
|
||||
"motion-dom@^12.40.0": "https://registry.yarnpkg.com/motion-dom/-/motion-dom-12.40.0.tgz#95fb411ac72e8adbaf5f1b17b8f07783da223bee",
|
||||
"motion-utils@^12.39.0": "https://registry.yarnpkg.com/motion-utils/-/motion-utils-12.39.0.tgz#e1c66f0e912999804bc5e69b4630c3bc794ef29f",
|
||||
"nanoid@^3.3.12": "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.12.tgz#ab3d912e217a6d0a514f00a72a16543a28982c05",
|
||||
"node-releases@^2.0.36": "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.47.tgz#521bb2786da8eb140b748841c0b3b3a75334ffc4",
|
||||
"picocolors@^1.1.1": "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b",
|
||||
"picomatch@^4.0.4": "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.4.tgz#fd6f5e00a143086e074dffe4c924b8fb293b0589",
|
||||
"postcss-value-parser@^4.2.0": "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz#723c09920836ba6d3e5af019f92bc0971c02e514",
|
||||
"postcss@^8.5.15": "https://registry.yarnpkg.com/postcss/-/postcss-8.5.15.tgz#d1eaf677a324e9ec02196da2d3fecf4a0b9a735c",
|
||||
"react-dom@latest": "https://registry.yarnpkg.com/react-dom/-/react-dom-19.2.7.tgz#0450dc9ae9ddbff76ef196401cd8b8c7fb466ccc",
|
||||
"react@latest": "https://registry.yarnpkg.com/react/-/react-19.2.7.tgz#1f47a1bfc06f8ec885752c6f4af14369a9f8260b",
|
||||
"regexparam@^3.0.0": "https://registry.yarnpkg.com/regexparam/-/regexparam-3.0.0.tgz#1673e09d41cb7fd41eaafd4040a6aa90daa0a21a",
|
||||
"rolldown@1.0.3": "https://registry.yarnpkg.com/rolldown/-/rolldown-1.0.3.tgz#db88a3008fb0e28230a00423727ce75ba32121ac",
|
||||
"scheduler@^0.27.0": "https://registry.yarnpkg.com/scheduler/-/scheduler-0.27.0.tgz#0c4ef82d67d1e5c1e359e8fc76d3a87f045fe5bd",
|
||||
"sonner@latest": "https://registry.yarnpkg.com/sonner/-/sonner-2.0.7.tgz#810c1487a67ec3370126e0f400dfb9edddc3e4f6",
|
||||
"source-map-js@^1.2.1": "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.1.tgz#1ce5650fddd87abc099eda37dcff024c2667ae46",
|
||||
"tailwind-merge@^3.6.0": "https://registry.yarnpkg.com/tailwind-merge/-/tailwind-merge-3.6.0.tgz#88d83242d1dd7bc847223f73dcf210dd1f2ee11c",
|
||||
"tailwindcss@4.3.0": "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-4.3.0.tgz#0a874e044a859cf6de413f3a59e76a9bedf05264",
|
||||
"tailwindcss@latest": "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-4.3.0.tgz#0a874e044a859cf6de413f3a59e76a9bedf05264",
|
||||
"tapable@^2.3.3": "https://registry.yarnpkg.com/tapable/-/tapable-2.3.3.tgz#5da7c9992c46038221267985ab28421a8879f160",
|
||||
"tinyglobby@^0.2.17": "https://registry.yarnpkg.com/tinyglobby/-/tinyglobby-0.2.17.tgz#562a9a6c9eb2b3b123d39719f9af5bb44fcd7631",
|
||||
"tslib@^2.4.0": "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f",
|
||||
"tslib@^2.8.1": "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f",
|
||||
"tw-animate-css@^1.4.0": "https://registry.yarnpkg.com/tw-animate-css/-/tw-animate-css-1.4.0.tgz#b4a06f68244cba39428aa47e65e6e4c0babc21ee",
|
||||
"typescript@latest": "https://registry.yarnpkg.com/typescript/-/typescript-6.0.3.tgz#90251dc007916e972786cb94d74d15b185577d21",
|
||||
"update-browserslist-db@^1.2.3": "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz#64d76db58713136acbeb4c49114366cc6cc2e80d",
|
||||
"use-sync-external-store@^1.0.0": "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.6.0.tgz#b174bfa65cb2b526732d9f2ac0a408027876f32d",
|
||||
"vite@latest": "https://registry.yarnpkg.com/vite/-/vite-8.0.16.tgz#ae073866c06563d6634a90169a496e11bd84f1a6",
|
||||
"wouter@latest": "https://registry.yarnpkg.com/wouter/-/wouter-3.10.0.tgz#d0bc6dd3751108b998e7fefd6fa01241160ca351"
|
||||
},
|
||||
"files": [],
|
||||
"artifacts": {}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2021-present Floating UI 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.
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
# @floating-ui/core
|
||||
|
||||
This is the platform-agnostic core of Floating UI, exposing the main
|
||||
`computePosition` function but no platform interface logic.
|
||||
1
node_modules/@floating-ui/core/dist/floating-ui.core.browser.min.mjs
generated
vendored
Normal file
1184
node_modules/@floating-ui/core/dist/floating-ui.core.browser.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,531 @@
|
|||
import { AlignedPlacement } from '@floating-ui/utils';
|
||||
import { Alignment } from '@floating-ui/utils';
|
||||
import { Axis } from '@floating-ui/utils';
|
||||
import { ClientRectObject } from '@floating-ui/utils';
|
||||
import { Coords } from '@floating-ui/utils';
|
||||
import { Dimensions } from '@floating-ui/utils';
|
||||
import { ElementRects } from '@floating-ui/utils';
|
||||
import { Length } from '@floating-ui/utils';
|
||||
import { Padding } from '@floating-ui/utils';
|
||||
import { Placement } from '@floating-ui/utils';
|
||||
import { Rect } from '@floating-ui/utils';
|
||||
import { rectToClientRect } from '@floating-ui/utils';
|
||||
import { Side } from '@floating-ui/utils';
|
||||
import { SideObject } from '@floating-ui/utils';
|
||||
import { Strategy } from '@floating-ui/utils';
|
||||
import { VirtualElement } from '@floating-ui/utils';
|
||||
|
||||
export { AlignedPlacement }
|
||||
|
||||
export { Alignment }
|
||||
|
||||
/**
|
||||
* Provides data to position an inner element of the floating element so that it
|
||||
* appears centered to the reference element.
|
||||
* @see https://floating-ui.com/docs/arrow
|
||||
*/
|
||||
export declare const arrow: (options: ArrowOptions | Derivable<ArrowOptions>) => Middleware;
|
||||
|
||||
export declare interface ArrowOptions {
|
||||
/**
|
||||
* The arrow element to be positioned.
|
||||
* @default undefined
|
||||
*/
|
||||
element: any;
|
||||
/**
|
||||
* The padding between the arrow element and the floating element edges.
|
||||
* Useful when the floating element has rounded corners.
|
||||
* @default 0
|
||||
*/
|
||||
padding?: Padding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by choosing the placement
|
||||
* that has the most space available automatically, without needing to specify a
|
||||
* preferred placement. Alternative to `flip`.
|
||||
* @see https://floating-ui.com/docs/autoPlacement
|
||||
*/
|
||||
export declare const autoPlacement: (options?: AutoPlacementOptions | Derivable<AutoPlacementOptions>) => Middleware;
|
||||
|
||||
export declare interface AutoPlacementOptions extends DetectOverflowOptions {
|
||||
/**
|
||||
* The axis that runs along the alignment of the floating element. Determines
|
||||
* whether to check for most space along this axis.
|
||||
* @default false
|
||||
*/
|
||||
crossAxis?: boolean;
|
||||
/**
|
||||
* Choose placements with a particular alignment.
|
||||
* @default undefined
|
||||
*/
|
||||
alignment?: Alignment | null;
|
||||
/**
|
||||
* Whether to choose placements with the opposite alignment if the preferred
|
||||
* alignment does not fit.
|
||||
* @default true
|
||||
*/
|
||||
autoAlignment?: boolean;
|
||||
/**
|
||||
* Which placements are allowed to be chosen. Placements must be within the
|
||||
* `alignment` option if explicitly set.
|
||||
* @default allPlacements (variable)
|
||||
*/
|
||||
allowedPlacements?: Array<Placement>;
|
||||
}
|
||||
|
||||
export { Axis }
|
||||
|
||||
export declare type Boundary = any;
|
||||
|
||||
export { ClientRectObject }
|
||||
|
||||
export declare type ComputePosition = (reference: unknown, floating: unknown, config: ComputePositionConfig) => Promise<ComputePositionReturn>;
|
||||
|
||||
/**
|
||||
* Computes the `x` and `y` coordinates that will place the floating element
|
||||
* next to a given reference element.
|
||||
*
|
||||
* This export does not have any `platform` interface logic. You will need to
|
||||
* write one for the platform you are using Floating UI with.
|
||||
*/
|
||||
export declare const computePosition: ComputePosition;
|
||||
|
||||
export declare interface ComputePositionConfig {
|
||||
/**
|
||||
* Object to interface with the current platform.
|
||||
*/
|
||||
platform: Platform;
|
||||
/**
|
||||
* Where to place the floating element relative to the reference element.
|
||||
*/
|
||||
placement?: Placement;
|
||||
/**
|
||||
* The strategy to use when positioning the floating element.
|
||||
*/
|
||||
strategy?: Strategy;
|
||||
/**
|
||||
* Array of middleware objects to modify the positioning or provide data for
|
||||
* rendering.
|
||||
*/
|
||||
middleware?: Array<Middleware | null | undefined | false>;
|
||||
}
|
||||
|
||||
export declare interface ComputePositionReturn extends Coords {
|
||||
/**
|
||||
* The final chosen placement of the floating element.
|
||||
*/
|
||||
placement: Placement;
|
||||
/**
|
||||
* The strategy used to position the floating element.
|
||||
*/
|
||||
strategy: Strategy;
|
||||
/**
|
||||
* Object containing data returned from all middleware, keyed by their name.
|
||||
*/
|
||||
middlewareData: MiddlewareData;
|
||||
}
|
||||
|
||||
export { Coords }
|
||||
|
||||
/**
|
||||
* Function option to derive middleware options from state.
|
||||
*/
|
||||
export declare type Derivable<T> = (state: MiddlewareState) => T;
|
||||
|
||||
/**
|
||||
* Resolves with an object of overflow side offsets that determine how much the
|
||||
* element is overflowing a given clipping boundary on each side.
|
||||
* - positive = overflowing the boundary by that number of pixels
|
||||
* - negative = how many pixels left before it will overflow
|
||||
* - 0 = lies flush with the boundary
|
||||
* @see https://floating-ui.com/docs/detectOverflow
|
||||
*/
|
||||
export declare function detectOverflow(state: MiddlewareState, options?: DetectOverflowOptions | Derivable<DetectOverflowOptions>): Promise<SideObject>;
|
||||
|
||||
export declare interface DetectOverflowOptions {
|
||||
/**
|
||||
* The clipping element(s) or area in which overflow will be checked.
|
||||
* @default 'clippingAncestors'
|
||||
*/
|
||||
boundary?: Boundary;
|
||||
/**
|
||||
* The root clipping area in which overflow will be checked.
|
||||
* @default 'viewport'
|
||||
*/
|
||||
rootBoundary?: RootBoundary;
|
||||
/**
|
||||
* The element in which overflow is being checked relative to a boundary.
|
||||
* @default 'floating'
|
||||
*/
|
||||
elementContext?: ElementContext;
|
||||
/**
|
||||
* Whether to check for overflow using the alternate element's boundary
|
||||
* (`clippingAncestors` boundary only).
|
||||
* @default false
|
||||
*/
|
||||
altBoundary?: boolean;
|
||||
/**
|
||||
* Virtual padding for the resolved overflow detection offsets.
|
||||
* @default 0
|
||||
*/
|
||||
padding?: Padding;
|
||||
}
|
||||
|
||||
export { Dimensions }
|
||||
|
||||
export declare type ElementContext = 'reference' | 'floating';
|
||||
|
||||
export { ElementRects }
|
||||
|
||||
export declare interface Elements {
|
||||
reference: ReferenceElement;
|
||||
floating: FloatingElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by flipping the `placement`
|
||||
* in order to keep it in view when the preferred placement(s) will overflow the
|
||||
* clipping boundary. Alternative to `autoPlacement`.
|
||||
* @see https://floating-ui.com/docs/flip
|
||||
*/
|
||||
export declare const flip: (options?: FlipOptions | Derivable<FlipOptions>) => Middleware;
|
||||
|
||||
export declare interface FlipOptions extends DetectOverflowOptions {
|
||||
/**
|
||||
* The axis that runs along the side of the floating element. Determines
|
||||
* whether overflow along this axis is checked to perform a flip.
|
||||
* @default true
|
||||
*/
|
||||
mainAxis?: boolean;
|
||||
/**
|
||||
* The axis that runs along the alignment of the floating element. Determines
|
||||
* whether overflow along this axis is checked to perform a flip.
|
||||
* - `true`: Whether to check cross axis overflow for both side and alignment flipping.
|
||||
* - `false`: Whether to disable all cross axis overflow checking.
|
||||
* - `'alignment'`: Whether to check cross axis overflow for alignment flipping only.
|
||||
* @default true
|
||||
*/
|
||||
crossAxis?: boolean | 'alignment';
|
||||
/**
|
||||
* Placements to try sequentially if the preferred `placement` does not fit.
|
||||
* @default [oppositePlacement] (computed)
|
||||
*/
|
||||
fallbackPlacements?: Array<Placement>;
|
||||
/**
|
||||
* What strategy to use when no placements fit.
|
||||
* @default 'bestFit'
|
||||
*/
|
||||
fallbackStrategy?: 'bestFit' | 'initialPlacement';
|
||||
/**
|
||||
* Whether to allow fallback to the perpendicular axis of the preferred
|
||||
* placement, and if so, which side direction along the axis to prefer.
|
||||
* @default 'none' (disallow fallback)
|
||||
*/
|
||||
fallbackAxisSideDirection?: 'none' | 'start' | 'end';
|
||||
/**
|
||||
* Whether to flip to placements with the opposite alignment if they fit
|
||||
* better.
|
||||
* @default true
|
||||
*/
|
||||
flipAlignment?: boolean;
|
||||
}
|
||||
|
||||
export declare type FloatingElement = any;
|
||||
|
||||
/**
|
||||
* Provides data to hide the floating element in applicable situations, such as
|
||||
* when it is not in the same clipping context as the reference element.
|
||||
* @see https://floating-ui.com/docs/hide
|
||||
*/
|
||||
export declare const hide: (options?: HideOptions | Derivable<HideOptions>) => Middleware;
|
||||
|
||||
export declare interface HideOptions extends DetectOverflowOptions {
|
||||
/**
|
||||
* The strategy used to determine when to hide the floating element.
|
||||
*/
|
||||
strategy?: 'referenceHidden' | 'escaped';
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides improved positioning for inline reference elements that can span
|
||||
* over multiple lines, such as hyperlinks or range selections.
|
||||
* @see https://floating-ui.com/docs/inline
|
||||
*/
|
||||
export declare const inline: (options?: InlineOptions | Derivable<InlineOptions>) => Middleware;
|
||||
|
||||
export declare interface InlineOptions {
|
||||
/**
|
||||
* Viewport-relative `x` coordinate to choose a `ClientRect`.
|
||||
* @default undefined
|
||||
*/
|
||||
x?: number;
|
||||
/**
|
||||
* Viewport-relative `y` coordinate to choose a `ClientRect`.
|
||||
* @default undefined
|
||||
*/
|
||||
y?: number;
|
||||
/**
|
||||
* Represents the padding around a disjoined rect when choosing it.
|
||||
* @default 2
|
||||
*/
|
||||
padding?: Padding;
|
||||
}
|
||||
|
||||
export { Length }
|
||||
|
||||
/**
|
||||
* Built-in `limiter` that will stop `shift()` at a certain point.
|
||||
*/
|
||||
export declare const limitShift: (options?: LimitShiftOptions | Derivable<LimitShiftOptions>) => {
|
||||
options: any;
|
||||
fn: (state: MiddlewareState) => Coords;
|
||||
};
|
||||
|
||||
declare type LimitShiftOffset = number | {
|
||||
/**
|
||||
* Offset the limiting of the axis that runs along the alignment of the
|
||||
* floating element.
|
||||
*/
|
||||
mainAxis?: number;
|
||||
/**
|
||||
* Offset the limiting of the axis that runs along the side of the
|
||||
* floating element.
|
||||
*/
|
||||
crossAxis?: number;
|
||||
};
|
||||
|
||||
export declare interface LimitShiftOptions {
|
||||
/**
|
||||
* Offset when limiting starts. `0` will limit when the opposite edges of the
|
||||
* reference and floating elements are aligned.
|
||||
* - positive = start limiting earlier
|
||||
* - negative = start limiting later
|
||||
*/
|
||||
offset?: LimitShiftOffset | Derivable<LimitShiftOffset>;
|
||||
/**
|
||||
* Whether to limit the axis that runs along the alignment of the floating
|
||||
* element.
|
||||
*/
|
||||
mainAxis?: boolean;
|
||||
/**
|
||||
* Whether to limit the axis that runs along the side of the floating element.
|
||||
*/
|
||||
crossAxis?: boolean;
|
||||
}
|
||||
|
||||
export declare type Middleware = {
|
||||
name: string;
|
||||
options?: any;
|
||||
fn: (state: MiddlewareState) => Promisable<MiddlewareReturn>;
|
||||
};
|
||||
|
||||
/**
|
||||
* @deprecated use `MiddlewareState` instead.
|
||||
*/
|
||||
export declare type MiddlewareArguments = MiddlewareState;
|
||||
|
||||
export declare interface MiddlewareData {
|
||||
[key: string]: any;
|
||||
arrow?: Partial<Coords> & {
|
||||
centerOffset: number;
|
||||
alignmentOffset?: number;
|
||||
};
|
||||
autoPlacement?: {
|
||||
index?: number;
|
||||
overflows: Array<{
|
||||
placement: Placement;
|
||||
overflows: Array<number>;
|
||||
}>;
|
||||
};
|
||||
flip?: {
|
||||
index?: number;
|
||||
overflows: Array<{
|
||||
placement: Placement;
|
||||
overflows: Array<number>;
|
||||
}>;
|
||||
};
|
||||
hide?: {
|
||||
referenceHidden?: boolean;
|
||||
escaped?: boolean;
|
||||
referenceHiddenOffsets?: SideObject;
|
||||
escapedOffsets?: SideObject;
|
||||
};
|
||||
offset?: Coords & {
|
||||
placement: Placement;
|
||||
};
|
||||
shift?: Coords & {
|
||||
enabled: {
|
||||
[key in Axis]: boolean;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export declare interface MiddlewareReturn extends Partial<Coords> {
|
||||
data?: {
|
||||
[key: string]: any;
|
||||
};
|
||||
reset?: boolean | {
|
||||
placement?: Placement;
|
||||
rects?: boolean | ElementRects;
|
||||
};
|
||||
}
|
||||
|
||||
export declare interface MiddlewareState extends Coords {
|
||||
initialPlacement: Placement;
|
||||
placement: Placement;
|
||||
strategy: Strategy;
|
||||
middlewareData: MiddlewareData;
|
||||
elements: Elements;
|
||||
rects: ElementRects;
|
||||
platform: {
|
||||
detectOverflow: typeof detectOverflow;
|
||||
} & Platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* Modifies the placement by translating the floating element along the
|
||||
* specified axes.
|
||||
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
||||
* object may be passed.
|
||||
* @see https://floating-ui.com/docs/offset
|
||||
*/
|
||||
export declare const offset: (options?: OffsetOptions) => Middleware;
|
||||
|
||||
export declare type OffsetOptions = OffsetValue | Derivable<OffsetValue>;
|
||||
|
||||
declare type OffsetValue = number | {
|
||||
/**
|
||||
* The axis that runs along the side of the floating element. Represents
|
||||
* the distance (gutter or margin) between the reference and floating
|
||||
* element.
|
||||
* @default 0
|
||||
*/
|
||||
mainAxis?: number;
|
||||
/**
|
||||
* The axis that runs along the alignment of the floating element.
|
||||
* Represents the skidding between the reference and floating element.
|
||||
* @default 0
|
||||
*/
|
||||
crossAxis?: number;
|
||||
/**
|
||||
* The same axis as `crossAxis` but applies only to aligned placements
|
||||
* and inverts the `end` alignment. When set to a number, it overrides the
|
||||
* `crossAxis` value.
|
||||
*
|
||||
* A positive number will move the floating element in the direction of
|
||||
* the opposite edge to the one that is aligned, while a negative number
|
||||
* the reverse.
|
||||
* @default null
|
||||
*/
|
||||
alignmentAxis?: number | null;
|
||||
};
|
||||
|
||||
export { Padding }
|
||||
|
||||
export { Placement }
|
||||
|
||||
/**
|
||||
* Platform interface methods to work with the current platform.
|
||||
* @see https://floating-ui.com/docs/platform
|
||||
*/
|
||||
export declare interface Platform {
|
||||
getElementRects: (args: {
|
||||
reference: ReferenceElement;
|
||||
floating: FloatingElement;
|
||||
strategy: Strategy;
|
||||
}) => Promisable<ElementRects>;
|
||||
getClippingRect: (args: {
|
||||
element: any;
|
||||
boundary: Boundary;
|
||||
rootBoundary: RootBoundary;
|
||||
strategy: Strategy;
|
||||
}) => Promisable<Rect>;
|
||||
getDimensions: (element: any) => Promisable<Dimensions>;
|
||||
convertOffsetParentRelativeRectToViewportRelativeRect?: (args: {
|
||||
elements?: Elements;
|
||||
rect: Rect;
|
||||
offsetParent: any;
|
||||
strategy: Strategy;
|
||||
}) => Promisable<Rect>;
|
||||
getOffsetParent?: (element: any) => Promisable<any>;
|
||||
isElement?: (value: any) => Promisable<boolean>;
|
||||
getDocumentElement?: (element: any) => Promisable<any>;
|
||||
getClientRects?: (element: any) => Promisable<Array<ClientRectObject>>;
|
||||
isRTL?: (element: any) => Promisable<boolean>;
|
||||
getScale?: (element: any) => Promisable<{
|
||||
x: number;
|
||||
y: number;
|
||||
}>;
|
||||
detectOverflow?: typeof detectOverflow;
|
||||
}
|
||||
|
||||
declare type Promisable<T> = T | Promise<T>;
|
||||
|
||||
export { Rect }
|
||||
|
||||
export { rectToClientRect }
|
||||
|
||||
export declare type ReferenceElement = any;
|
||||
|
||||
export declare type RootBoundary = 'viewport' | 'document' | Rect;
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by shifting it in order to
|
||||
* keep it in view when it will overflow the clipping boundary.
|
||||
* @see https://floating-ui.com/docs/shift
|
||||
*/
|
||||
export declare const shift: (options?: ShiftOptions | Derivable<ShiftOptions>) => Middleware;
|
||||
|
||||
export declare interface ShiftOptions extends DetectOverflowOptions {
|
||||
/**
|
||||
* The axis that runs along the alignment of the floating element. Determines
|
||||
* whether overflow along this axis is checked to perform shifting.
|
||||
* @default true
|
||||
*/
|
||||
mainAxis?: boolean;
|
||||
/**
|
||||
* The axis that runs along the side of the floating element. Determines
|
||||
* whether overflow along this axis is checked to perform shifting.
|
||||
* @default false
|
||||
*/
|
||||
crossAxis?: boolean;
|
||||
/**
|
||||
* Accepts a function that limits the shifting done in order to prevent
|
||||
* detachment.
|
||||
*/
|
||||
limiter?: {
|
||||
fn: (state: MiddlewareState) => Coords;
|
||||
options?: any;
|
||||
};
|
||||
}
|
||||
|
||||
export { Side }
|
||||
|
||||
export { SideObject }
|
||||
|
||||
/**
|
||||
* Provides data that allows you to change the size of the floating element —
|
||||
* for instance, prevent it from overflowing the clipping boundary or match the
|
||||
* width of the reference element.
|
||||
* @see https://floating-ui.com/docs/size
|
||||
*/
|
||||
export declare const size: (options?: SizeOptions | Derivable<SizeOptions>) => Middleware;
|
||||
|
||||
export declare interface SizeOptions extends DetectOverflowOptions {
|
||||
/**
|
||||
* Function that is called to perform style mutations to the floating element
|
||||
* to change its size.
|
||||
* @default undefined
|
||||
*/
|
||||
apply?(args: MiddlewareState & {
|
||||
availableWidth: number;
|
||||
availableHeight: number;
|
||||
}): void | Promise<void>;
|
||||
}
|
||||
|
||||
export { Strategy }
|
||||
|
||||
export { VirtualElement }
|
||||
|
||||
export { }
|
||||
|
|
@ -0,0 +1,531 @@
|
|||
import { AlignedPlacement } from '@floating-ui/utils';
|
||||
import { Alignment } from '@floating-ui/utils';
|
||||
import { Axis } from '@floating-ui/utils';
|
||||
import { ClientRectObject } from '@floating-ui/utils';
|
||||
import { Coords } from '@floating-ui/utils';
|
||||
import { Dimensions } from '@floating-ui/utils';
|
||||
import { ElementRects } from '@floating-ui/utils';
|
||||
import { Length } from '@floating-ui/utils';
|
||||
import { Padding } from '@floating-ui/utils';
|
||||
import { Placement } from '@floating-ui/utils';
|
||||
import { Rect } from '@floating-ui/utils';
|
||||
import { rectToClientRect } from '@floating-ui/utils';
|
||||
import { Side } from '@floating-ui/utils';
|
||||
import { SideObject } from '@floating-ui/utils';
|
||||
import { Strategy } from '@floating-ui/utils';
|
||||
import { VirtualElement } from '@floating-ui/utils';
|
||||
|
||||
export { AlignedPlacement }
|
||||
|
||||
export { Alignment }
|
||||
|
||||
/**
|
||||
* Provides data to position an inner element of the floating element so that it
|
||||
* appears centered to the reference element.
|
||||
* @see https://floating-ui.com/docs/arrow
|
||||
*/
|
||||
export declare const arrow: (options: ArrowOptions | Derivable<ArrowOptions>) => Middleware;
|
||||
|
||||
export declare interface ArrowOptions {
|
||||
/**
|
||||
* The arrow element to be positioned.
|
||||
* @default undefined
|
||||
*/
|
||||
element: any;
|
||||
/**
|
||||
* The padding between the arrow element and the floating element edges.
|
||||
* Useful when the floating element has rounded corners.
|
||||
* @default 0
|
||||
*/
|
||||
padding?: Padding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by choosing the placement
|
||||
* that has the most space available automatically, without needing to specify a
|
||||
* preferred placement. Alternative to `flip`.
|
||||
* @see https://floating-ui.com/docs/autoPlacement
|
||||
*/
|
||||
export declare const autoPlacement: (options?: AutoPlacementOptions | Derivable<AutoPlacementOptions>) => Middleware;
|
||||
|
||||
export declare interface AutoPlacementOptions extends DetectOverflowOptions {
|
||||
/**
|
||||
* The axis that runs along the alignment of the floating element. Determines
|
||||
* whether to check for most space along this axis.
|
||||
* @default false
|
||||
*/
|
||||
crossAxis?: boolean;
|
||||
/**
|
||||
* Choose placements with a particular alignment.
|
||||
* @default undefined
|
||||
*/
|
||||
alignment?: Alignment | null;
|
||||
/**
|
||||
* Whether to choose placements with the opposite alignment if the preferred
|
||||
* alignment does not fit.
|
||||
* @default true
|
||||
*/
|
||||
autoAlignment?: boolean;
|
||||
/**
|
||||
* Which placements are allowed to be chosen. Placements must be within the
|
||||
* `alignment` option if explicitly set.
|
||||
* @default allPlacements (variable)
|
||||
*/
|
||||
allowedPlacements?: Array<Placement>;
|
||||
}
|
||||
|
||||
export { Axis }
|
||||
|
||||
export declare type Boundary = any;
|
||||
|
||||
export { ClientRectObject }
|
||||
|
||||
export declare type ComputePosition = (reference: unknown, floating: unknown, config: ComputePositionConfig) => Promise<ComputePositionReturn>;
|
||||
|
||||
/**
|
||||
* Computes the `x` and `y` coordinates that will place the floating element
|
||||
* next to a given reference element.
|
||||
*
|
||||
* This export does not have any `platform` interface logic. You will need to
|
||||
* write one for the platform you are using Floating UI with.
|
||||
*/
|
||||
export declare const computePosition: ComputePosition;
|
||||
|
||||
export declare interface ComputePositionConfig {
|
||||
/**
|
||||
* Object to interface with the current platform.
|
||||
*/
|
||||
platform: Platform;
|
||||
/**
|
||||
* Where to place the floating element relative to the reference element.
|
||||
*/
|
||||
placement?: Placement;
|
||||
/**
|
||||
* The strategy to use when positioning the floating element.
|
||||
*/
|
||||
strategy?: Strategy;
|
||||
/**
|
||||
* Array of middleware objects to modify the positioning or provide data for
|
||||
* rendering.
|
||||
*/
|
||||
middleware?: Array<Middleware | null | undefined | false>;
|
||||
}
|
||||
|
||||
export declare interface ComputePositionReturn extends Coords {
|
||||
/**
|
||||
* The final chosen placement of the floating element.
|
||||
*/
|
||||
placement: Placement;
|
||||
/**
|
||||
* The strategy used to position the floating element.
|
||||
*/
|
||||
strategy: Strategy;
|
||||
/**
|
||||
* Object containing data returned from all middleware, keyed by their name.
|
||||
*/
|
||||
middlewareData: MiddlewareData;
|
||||
}
|
||||
|
||||
export { Coords }
|
||||
|
||||
/**
|
||||
* Function option to derive middleware options from state.
|
||||
*/
|
||||
export declare type Derivable<T> = (state: MiddlewareState) => T;
|
||||
|
||||
/**
|
||||
* Resolves with an object of overflow side offsets that determine how much the
|
||||
* element is overflowing a given clipping boundary on each side.
|
||||
* - positive = overflowing the boundary by that number of pixels
|
||||
* - negative = how many pixels left before it will overflow
|
||||
* - 0 = lies flush with the boundary
|
||||
* @see https://floating-ui.com/docs/detectOverflow
|
||||
*/
|
||||
export declare function detectOverflow(state: MiddlewareState, options?: DetectOverflowOptions | Derivable<DetectOverflowOptions>): Promise<SideObject>;
|
||||
|
||||
export declare interface DetectOverflowOptions {
|
||||
/**
|
||||
* The clipping element(s) or area in which overflow will be checked.
|
||||
* @default 'clippingAncestors'
|
||||
*/
|
||||
boundary?: Boundary;
|
||||
/**
|
||||
* The root clipping area in which overflow will be checked.
|
||||
* @default 'viewport'
|
||||
*/
|
||||
rootBoundary?: RootBoundary;
|
||||
/**
|
||||
* The element in which overflow is being checked relative to a boundary.
|
||||
* @default 'floating'
|
||||
*/
|
||||
elementContext?: ElementContext;
|
||||
/**
|
||||
* Whether to check for overflow using the alternate element's boundary
|
||||
* (`clippingAncestors` boundary only).
|
||||
* @default false
|
||||
*/
|
||||
altBoundary?: boolean;
|
||||
/**
|
||||
* Virtual padding for the resolved overflow detection offsets.
|
||||
* @default 0
|
||||
*/
|
||||
padding?: Padding;
|
||||
}
|
||||
|
||||
export { Dimensions }
|
||||
|
||||
export declare type ElementContext = 'reference' | 'floating';
|
||||
|
||||
export { ElementRects }
|
||||
|
||||
export declare interface Elements {
|
||||
reference: ReferenceElement;
|
||||
floating: FloatingElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by flipping the `placement`
|
||||
* in order to keep it in view when the preferred placement(s) will overflow the
|
||||
* clipping boundary. Alternative to `autoPlacement`.
|
||||
* @see https://floating-ui.com/docs/flip
|
||||
*/
|
||||
export declare const flip: (options?: FlipOptions | Derivable<FlipOptions>) => Middleware;
|
||||
|
||||
export declare interface FlipOptions extends DetectOverflowOptions {
|
||||
/**
|
||||
* The axis that runs along the side of the floating element. Determines
|
||||
* whether overflow along this axis is checked to perform a flip.
|
||||
* @default true
|
||||
*/
|
||||
mainAxis?: boolean;
|
||||
/**
|
||||
* The axis that runs along the alignment of the floating element. Determines
|
||||
* whether overflow along this axis is checked to perform a flip.
|
||||
* - `true`: Whether to check cross axis overflow for both side and alignment flipping.
|
||||
* - `false`: Whether to disable all cross axis overflow checking.
|
||||
* - `'alignment'`: Whether to check cross axis overflow for alignment flipping only.
|
||||
* @default true
|
||||
*/
|
||||
crossAxis?: boolean | 'alignment';
|
||||
/**
|
||||
* Placements to try sequentially if the preferred `placement` does not fit.
|
||||
* @default [oppositePlacement] (computed)
|
||||
*/
|
||||
fallbackPlacements?: Array<Placement>;
|
||||
/**
|
||||
* What strategy to use when no placements fit.
|
||||
* @default 'bestFit'
|
||||
*/
|
||||
fallbackStrategy?: 'bestFit' | 'initialPlacement';
|
||||
/**
|
||||
* Whether to allow fallback to the perpendicular axis of the preferred
|
||||
* placement, and if so, which side direction along the axis to prefer.
|
||||
* @default 'none' (disallow fallback)
|
||||
*/
|
||||
fallbackAxisSideDirection?: 'none' | 'start' | 'end';
|
||||
/**
|
||||
* Whether to flip to placements with the opposite alignment if they fit
|
||||
* better.
|
||||
* @default true
|
||||
*/
|
||||
flipAlignment?: boolean;
|
||||
}
|
||||
|
||||
export declare type FloatingElement = any;
|
||||
|
||||
/**
|
||||
* Provides data to hide the floating element in applicable situations, such as
|
||||
* when it is not in the same clipping context as the reference element.
|
||||
* @see https://floating-ui.com/docs/hide
|
||||
*/
|
||||
export declare const hide: (options?: HideOptions | Derivable<HideOptions>) => Middleware;
|
||||
|
||||
export declare interface HideOptions extends DetectOverflowOptions {
|
||||
/**
|
||||
* The strategy used to determine when to hide the floating element.
|
||||
*/
|
||||
strategy?: 'referenceHidden' | 'escaped';
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides improved positioning for inline reference elements that can span
|
||||
* over multiple lines, such as hyperlinks or range selections.
|
||||
* @see https://floating-ui.com/docs/inline
|
||||
*/
|
||||
export declare const inline: (options?: InlineOptions | Derivable<InlineOptions>) => Middleware;
|
||||
|
||||
export declare interface InlineOptions {
|
||||
/**
|
||||
* Viewport-relative `x` coordinate to choose a `ClientRect`.
|
||||
* @default undefined
|
||||
*/
|
||||
x?: number;
|
||||
/**
|
||||
* Viewport-relative `y` coordinate to choose a `ClientRect`.
|
||||
* @default undefined
|
||||
*/
|
||||
y?: number;
|
||||
/**
|
||||
* Represents the padding around a disjoined rect when choosing it.
|
||||
* @default 2
|
||||
*/
|
||||
padding?: Padding;
|
||||
}
|
||||
|
||||
export { Length }
|
||||
|
||||
/**
|
||||
* Built-in `limiter` that will stop `shift()` at a certain point.
|
||||
*/
|
||||
export declare const limitShift: (options?: LimitShiftOptions | Derivable<LimitShiftOptions>) => {
|
||||
options: any;
|
||||
fn: (state: MiddlewareState) => Coords;
|
||||
};
|
||||
|
||||
declare type LimitShiftOffset = number | {
|
||||
/**
|
||||
* Offset the limiting of the axis that runs along the alignment of the
|
||||
* floating element.
|
||||
*/
|
||||
mainAxis?: number;
|
||||
/**
|
||||
* Offset the limiting of the axis that runs along the side of the
|
||||
* floating element.
|
||||
*/
|
||||
crossAxis?: number;
|
||||
};
|
||||
|
||||
export declare interface LimitShiftOptions {
|
||||
/**
|
||||
* Offset when limiting starts. `0` will limit when the opposite edges of the
|
||||
* reference and floating elements are aligned.
|
||||
* - positive = start limiting earlier
|
||||
* - negative = start limiting later
|
||||
*/
|
||||
offset?: LimitShiftOffset | Derivable<LimitShiftOffset>;
|
||||
/**
|
||||
* Whether to limit the axis that runs along the alignment of the floating
|
||||
* element.
|
||||
*/
|
||||
mainAxis?: boolean;
|
||||
/**
|
||||
* Whether to limit the axis that runs along the side of the floating element.
|
||||
*/
|
||||
crossAxis?: boolean;
|
||||
}
|
||||
|
||||
export declare type Middleware = {
|
||||
name: string;
|
||||
options?: any;
|
||||
fn: (state: MiddlewareState) => Promisable<MiddlewareReturn>;
|
||||
};
|
||||
|
||||
/**
|
||||
* @deprecated use `MiddlewareState` instead.
|
||||
*/
|
||||
export declare type MiddlewareArguments = MiddlewareState;
|
||||
|
||||
export declare interface MiddlewareData {
|
||||
[key: string]: any;
|
||||
arrow?: Partial<Coords> & {
|
||||
centerOffset: number;
|
||||
alignmentOffset?: number;
|
||||
};
|
||||
autoPlacement?: {
|
||||
index?: number;
|
||||
overflows: Array<{
|
||||
placement: Placement;
|
||||
overflows: Array<number>;
|
||||
}>;
|
||||
};
|
||||
flip?: {
|
||||
index?: number;
|
||||
overflows: Array<{
|
||||
placement: Placement;
|
||||
overflows: Array<number>;
|
||||
}>;
|
||||
};
|
||||
hide?: {
|
||||
referenceHidden?: boolean;
|
||||
escaped?: boolean;
|
||||
referenceHiddenOffsets?: SideObject;
|
||||
escapedOffsets?: SideObject;
|
||||
};
|
||||
offset?: Coords & {
|
||||
placement: Placement;
|
||||
};
|
||||
shift?: Coords & {
|
||||
enabled: {
|
||||
[key in Axis]: boolean;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export declare interface MiddlewareReturn extends Partial<Coords> {
|
||||
data?: {
|
||||
[key: string]: any;
|
||||
};
|
||||
reset?: boolean | {
|
||||
placement?: Placement;
|
||||
rects?: boolean | ElementRects;
|
||||
};
|
||||
}
|
||||
|
||||
export declare interface MiddlewareState extends Coords {
|
||||
initialPlacement: Placement;
|
||||
placement: Placement;
|
||||
strategy: Strategy;
|
||||
middlewareData: MiddlewareData;
|
||||
elements: Elements;
|
||||
rects: ElementRects;
|
||||
platform: {
|
||||
detectOverflow: typeof detectOverflow;
|
||||
} & Platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* Modifies the placement by translating the floating element along the
|
||||
* specified axes.
|
||||
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
||||
* object may be passed.
|
||||
* @see https://floating-ui.com/docs/offset
|
||||
*/
|
||||
export declare const offset: (options?: OffsetOptions) => Middleware;
|
||||
|
||||
export declare type OffsetOptions = OffsetValue | Derivable<OffsetValue>;
|
||||
|
||||
declare type OffsetValue = number | {
|
||||
/**
|
||||
* The axis that runs along the side of the floating element. Represents
|
||||
* the distance (gutter or margin) between the reference and floating
|
||||
* element.
|
||||
* @default 0
|
||||
*/
|
||||
mainAxis?: number;
|
||||
/**
|
||||
* The axis that runs along the alignment of the floating element.
|
||||
* Represents the skidding between the reference and floating element.
|
||||
* @default 0
|
||||
*/
|
||||
crossAxis?: number;
|
||||
/**
|
||||
* The same axis as `crossAxis` but applies only to aligned placements
|
||||
* and inverts the `end` alignment. When set to a number, it overrides the
|
||||
* `crossAxis` value.
|
||||
*
|
||||
* A positive number will move the floating element in the direction of
|
||||
* the opposite edge to the one that is aligned, while a negative number
|
||||
* the reverse.
|
||||
* @default null
|
||||
*/
|
||||
alignmentAxis?: number | null;
|
||||
};
|
||||
|
||||
export { Padding }
|
||||
|
||||
export { Placement }
|
||||
|
||||
/**
|
||||
* Platform interface methods to work with the current platform.
|
||||
* @see https://floating-ui.com/docs/platform
|
||||
*/
|
||||
export declare interface Platform {
|
||||
getElementRects: (args: {
|
||||
reference: ReferenceElement;
|
||||
floating: FloatingElement;
|
||||
strategy: Strategy;
|
||||
}) => Promisable<ElementRects>;
|
||||
getClippingRect: (args: {
|
||||
element: any;
|
||||
boundary: Boundary;
|
||||
rootBoundary: RootBoundary;
|
||||
strategy: Strategy;
|
||||
}) => Promisable<Rect>;
|
||||
getDimensions: (element: any) => Promisable<Dimensions>;
|
||||
convertOffsetParentRelativeRectToViewportRelativeRect?: (args: {
|
||||
elements?: Elements;
|
||||
rect: Rect;
|
||||
offsetParent: any;
|
||||
strategy: Strategy;
|
||||
}) => Promisable<Rect>;
|
||||
getOffsetParent?: (element: any) => Promisable<any>;
|
||||
isElement?: (value: any) => Promisable<boolean>;
|
||||
getDocumentElement?: (element: any) => Promisable<any>;
|
||||
getClientRects?: (element: any) => Promisable<Array<ClientRectObject>>;
|
||||
isRTL?: (element: any) => Promisable<boolean>;
|
||||
getScale?: (element: any) => Promisable<{
|
||||
x: number;
|
||||
y: number;
|
||||
}>;
|
||||
detectOverflow?: typeof detectOverflow;
|
||||
}
|
||||
|
||||
declare type Promisable<T> = T | Promise<T>;
|
||||
|
||||
export { Rect }
|
||||
|
||||
export { rectToClientRect }
|
||||
|
||||
export declare type ReferenceElement = any;
|
||||
|
||||
export declare type RootBoundary = 'viewport' | 'document' | Rect;
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by shifting it in order to
|
||||
* keep it in view when it will overflow the clipping boundary.
|
||||
* @see https://floating-ui.com/docs/shift
|
||||
*/
|
||||
export declare const shift: (options?: ShiftOptions | Derivable<ShiftOptions>) => Middleware;
|
||||
|
||||
export declare interface ShiftOptions extends DetectOverflowOptions {
|
||||
/**
|
||||
* The axis that runs along the alignment of the floating element. Determines
|
||||
* whether overflow along this axis is checked to perform shifting.
|
||||
* @default true
|
||||
*/
|
||||
mainAxis?: boolean;
|
||||
/**
|
||||
* The axis that runs along the side of the floating element. Determines
|
||||
* whether overflow along this axis is checked to perform shifting.
|
||||
* @default false
|
||||
*/
|
||||
crossAxis?: boolean;
|
||||
/**
|
||||
* Accepts a function that limits the shifting done in order to prevent
|
||||
* detachment.
|
||||
*/
|
||||
limiter?: {
|
||||
fn: (state: MiddlewareState) => Coords;
|
||||
options?: any;
|
||||
};
|
||||
}
|
||||
|
||||
export { Side }
|
||||
|
||||
export { SideObject }
|
||||
|
||||
/**
|
||||
* Provides data that allows you to change the size of the floating element —
|
||||
* for instance, prevent it from overflowing the clipping boundary or match the
|
||||
* width of the reference element.
|
||||
* @see https://floating-ui.com/docs/size
|
||||
*/
|
||||
export declare const size: (options?: SizeOptions | Derivable<SizeOptions>) => Middleware;
|
||||
|
||||
export declare interface SizeOptions extends DetectOverflowOptions {
|
||||
/**
|
||||
* Function that is called to perform style mutations to the floating element
|
||||
* to change its size.
|
||||
* @default undefined
|
||||
*/
|
||||
apply?(args: MiddlewareState & {
|
||||
availableWidth: number;
|
||||
availableHeight: number;
|
||||
}): void | Promise<void>;
|
||||
}
|
||||
|
||||
export { Strategy }
|
||||
|
||||
export { VirtualElement }
|
||||
|
||||
export { }
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
{
|
||||
"name": "@floating-ui/core",
|
||||
"version": "1.7.5",
|
||||
"description": "Positioning library for floating elements: tooltips, popovers, dropdowns, and more",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"main": "./dist/floating-ui.core.umd.js",
|
||||
"module": "./dist/floating-ui.core.esm.js",
|
||||
"unpkg": "./dist/floating-ui.core.umd.min.js",
|
||||
"types": "./dist/floating-ui.core.d.ts",
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/floating-ui.core.d.mts",
|
||||
"default": "./dist/floating-ui.core.mjs"
|
||||
},
|
||||
"types": "./dist/floating-ui.core.d.ts",
|
||||
"module": "./dist/floating-ui.core.esm.js",
|
||||
"default": "./dist/floating-ui.core.umd.js"
|
||||
}
|
||||
},
|
||||
"sideEffects": false,
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"author": "atomiks",
|
||||
"license": "MIT",
|
||||
"bugs": "https://github.com/floating-ui/floating-ui",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/floating-ui/floating-ui.git",
|
||||
"directory": "packages/core"
|
||||
},
|
||||
"homepage": "https://floating-ui.com",
|
||||
"keywords": [
|
||||
"tooltip",
|
||||
"popover",
|
||||
"dropdown",
|
||||
"menu",
|
||||
"popup",
|
||||
"positioning"
|
||||
],
|
||||
"dependencies": {
|
||||
"@floating-ui/utils": "^0.2.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"config": "0.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"test:watch": "vitest watch",
|
||||
"lint": "eslint .",
|
||||
"format": "prettier --write .",
|
||||
"clean": "rimraf dist out-tsc",
|
||||
"dev": "rollup -c -w",
|
||||
"build": "rollup -c",
|
||||
"build:api": "build-api --tsc tsconfig.lib.json",
|
||||
"publint": "publint",
|
||||
"typecheck": "tsc -b"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2021-present Floating UI 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.
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
# @floating-ui/dom
|
||||
|
||||
This is the library to use Floating UI on the web, wrapping `@floating-ui/core`
|
||||
with DOM interface logic.
|
||||
|
|
@ -0,0 +1,956 @@
|
|||
import { rectToClientRect, arrow as arrow$1, autoPlacement as autoPlacement$1, detectOverflow as detectOverflow$1, flip as flip$1, hide as hide$1, inline as inline$1, limitShift as limitShift$1, offset as offset$1, shift as shift$1, size as size$1, computePosition as computePosition$1 } from '@floating-ui/core';
|
||||
|
||||
/**
|
||||
* Custom positioning reference element.
|
||||
* @see https://floating-ui.com/docs/virtual-elements
|
||||
*/
|
||||
|
||||
const min = Math.min;
|
||||
const max = Math.max;
|
||||
const round = Math.round;
|
||||
const floor = Math.floor;
|
||||
const createCoords = v => ({
|
||||
x: v,
|
||||
y: v
|
||||
});
|
||||
|
||||
function hasWindow() {
|
||||
return typeof window !== 'undefined';
|
||||
}
|
||||
function getNodeName(node) {
|
||||
if (isNode(node)) {
|
||||
return (node.nodeName || '').toLowerCase();
|
||||
}
|
||||
// Mocked nodes in testing environments may not be instances of Node. By
|
||||
// returning `#document` an infinite loop won't occur.
|
||||
// https://github.com/floating-ui/floating-ui/issues/2317
|
||||
return '#document';
|
||||
}
|
||||
function getWindow(node) {
|
||||
var _node$ownerDocument;
|
||||
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
||||
}
|
||||
function getDocumentElement(node) {
|
||||
var _ref;
|
||||
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
||||
}
|
||||
function isNode(value) {
|
||||
if (!hasWindow()) {
|
||||
return false;
|
||||
}
|
||||
return value instanceof Node || value instanceof getWindow(value).Node;
|
||||
}
|
||||
function isElement(value) {
|
||||
if (!hasWindow()) {
|
||||
return false;
|
||||
}
|
||||
return value instanceof Element || value instanceof getWindow(value).Element;
|
||||
}
|
||||
function isHTMLElement(value) {
|
||||
if (!hasWindow()) {
|
||||
return false;
|
||||
}
|
||||
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
||||
}
|
||||
function isShadowRoot(value) {
|
||||
if (!hasWindow() || typeof ShadowRoot === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
||||
}
|
||||
function isOverflowElement(element) {
|
||||
const {
|
||||
overflow,
|
||||
overflowX,
|
||||
overflowY,
|
||||
display
|
||||
} = getComputedStyle$1(element);
|
||||
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';
|
||||
}
|
||||
function isTableElement(element) {
|
||||
return /^(table|td|th)$/.test(getNodeName(element));
|
||||
}
|
||||
function isTopLayer(element) {
|
||||
try {
|
||||
if (element.matches(':popover-open')) {
|
||||
return true;
|
||||
}
|
||||
} catch (_e) {
|
||||
// no-op
|
||||
}
|
||||
try {
|
||||
return element.matches(':modal');
|
||||
} catch (_e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
|
||||
const containRe = /paint|layout|strict|content/;
|
||||
const isNotNone = value => !!value && value !== 'none';
|
||||
let isWebKitValue;
|
||||
function isContainingBlock(elementOrCss) {
|
||||
const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
||||
// https://drafts.csswg.org/css-transforms-2/#individual-transforms
|
||||
return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || '') || containRe.test(css.contain || '');
|
||||
}
|
||||
function getContainingBlock(element) {
|
||||
let currentNode = getParentNode(element);
|
||||
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
||||
if (isContainingBlock(currentNode)) {
|
||||
return currentNode;
|
||||
} else if (isTopLayer(currentNode)) {
|
||||
return null;
|
||||
}
|
||||
currentNode = getParentNode(currentNode);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function isWebKit() {
|
||||
if (isWebKitValue == null) {
|
||||
isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');
|
||||
}
|
||||
return isWebKitValue;
|
||||
}
|
||||
function isLastTraversableNode(node) {
|
||||
return /^(html|body|#document)$/.test(getNodeName(node));
|
||||
}
|
||||
function getComputedStyle$1(element) {
|
||||
return getWindow(element).getComputedStyle(element);
|
||||
}
|
||||
function getNodeScroll(element) {
|
||||
if (isElement(element)) {
|
||||
return {
|
||||
scrollLeft: element.scrollLeft,
|
||||
scrollTop: element.scrollTop
|
||||
};
|
||||
}
|
||||
return {
|
||||
scrollLeft: element.scrollX,
|
||||
scrollTop: element.scrollY
|
||||
};
|
||||
}
|
||||
function getParentNode(node) {
|
||||
if (getNodeName(node) === 'html') {
|
||||
return node;
|
||||
}
|
||||
const result =
|
||||
// Step into the shadow DOM of the parent of a slotted node.
|
||||
node.assignedSlot ||
|
||||
// DOM Element detected.
|
||||
node.parentNode ||
|
||||
// ShadowRoot detected.
|
||||
isShadowRoot(node) && node.host ||
|
||||
// Fallback.
|
||||
getDocumentElement(node);
|
||||
return isShadowRoot(result) ? result.host : result;
|
||||
}
|
||||
function getNearestOverflowAncestor(node) {
|
||||
const parentNode = getParentNode(node);
|
||||
if (isLastTraversableNode(parentNode)) {
|
||||
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
||||
}
|
||||
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
||||
return parentNode;
|
||||
}
|
||||
return getNearestOverflowAncestor(parentNode);
|
||||
}
|
||||
function getOverflowAncestors(node, list, traverseIframes) {
|
||||
var _node$ownerDocument2;
|
||||
if (list === void 0) {
|
||||
list = [];
|
||||
}
|
||||
if (traverseIframes === void 0) {
|
||||
traverseIframes = true;
|
||||
}
|
||||
const scrollableAncestor = getNearestOverflowAncestor(node);
|
||||
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
||||
const win = getWindow(scrollableAncestor);
|
||||
if (isBody) {
|
||||
const frameElement = getFrameElement(win);
|
||||
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
||||
} else {
|
||||
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
||||
}
|
||||
}
|
||||
function getFrameElement(win) {
|
||||
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
||||
}
|
||||
|
||||
function getCssDimensions(element) {
|
||||
const css = getComputedStyle$1(element);
|
||||
// In testing environments, the `width` and `height` properties are empty
|
||||
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
|
||||
let width = parseFloat(css.width) || 0;
|
||||
let height = parseFloat(css.height) || 0;
|
||||
const hasOffset = isHTMLElement(element);
|
||||
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
||||
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
||||
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
||||
if (shouldFallback) {
|
||||
width = offsetWidth;
|
||||
height = offsetHeight;
|
||||
}
|
||||
return {
|
||||
width,
|
||||
height,
|
||||
$: shouldFallback
|
||||
};
|
||||
}
|
||||
|
||||
function unwrapElement(element) {
|
||||
return !isElement(element) ? element.contextElement : element;
|
||||
}
|
||||
|
||||
function getScale(element) {
|
||||
const domElement = unwrapElement(element);
|
||||
if (!isHTMLElement(domElement)) {
|
||||
return createCoords(1);
|
||||
}
|
||||
const rect = domElement.getBoundingClientRect();
|
||||
const {
|
||||
width,
|
||||
height,
|
||||
$
|
||||
} = getCssDimensions(domElement);
|
||||
let x = ($ ? round(rect.width) : rect.width) / width;
|
||||
let y = ($ ? round(rect.height) : rect.height) / height;
|
||||
|
||||
// 0, NaN, or Infinity should always fallback to 1.
|
||||
|
||||
if (!x || !Number.isFinite(x)) {
|
||||
x = 1;
|
||||
}
|
||||
if (!y || !Number.isFinite(y)) {
|
||||
y = 1;
|
||||
}
|
||||
return {
|
||||
x,
|
||||
y
|
||||
};
|
||||
}
|
||||
|
||||
const noOffsets = /*#__PURE__*/createCoords(0);
|
||||
function getVisualOffsets(element) {
|
||||
const win = getWindow(element);
|
||||
if (!isWebKit() || !win.visualViewport) {
|
||||
return noOffsets;
|
||||
}
|
||||
return {
|
||||
x: win.visualViewport.offsetLeft,
|
||||
y: win.visualViewport.offsetTop
|
||||
};
|
||||
}
|
||||
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
||||
if (isFixed === void 0) {
|
||||
isFixed = false;
|
||||
}
|
||||
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
||||
return false;
|
||||
}
|
||||
return isFixed;
|
||||
}
|
||||
|
||||
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
||||
if (includeScale === void 0) {
|
||||
includeScale = false;
|
||||
}
|
||||
if (isFixedStrategy === void 0) {
|
||||
isFixedStrategy = false;
|
||||
}
|
||||
const clientRect = element.getBoundingClientRect();
|
||||
const domElement = unwrapElement(element);
|
||||
let scale = createCoords(1);
|
||||
if (includeScale) {
|
||||
if (offsetParent) {
|
||||
if (isElement(offsetParent)) {
|
||||
scale = getScale(offsetParent);
|
||||
}
|
||||
} else {
|
||||
scale = getScale(element);
|
||||
}
|
||||
}
|
||||
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
||||
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
||||
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
||||
let width = clientRect.width / scale.x;
|
||||
let height = clientRect.height / scale.y;
|
||||
if (domElement) {
|
||||
const win = getWindow(domElement);
|
||||
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
||||
let currentWin = win;
|
||||
let currentIFrame = getFrameElement(currentWin);
|
||||
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
||||
const iframeScale = getScale(currentIFrame);
|
||||
const iframeRect = currentIFrame.getBoundingClientRect();
|
||||
const css = getComputedStyle$1(currentIFrame);
|
||||
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
||||
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
||||
x *= iframeScale.x;
|
||||
y *= iframeScale.y;
|
||||
width *= iframeScale.x;
|
||||
height *= iframeScale.y;
|
||||
x += left;
|
||||
y += top;
|
||||
currentWin = getWindow(currentIFrame);
|
||||
currentIFrame = getFrameElement(currentWin);
|
||||
}
|
||||
}
|
||||
return rectToClientRect({
|
||||
width,
|
||||
height,
|
||||
x,
|
||||
y
|
||||
});
|
||||
}
|
||||
|
||||
// If <html> has a CSS width greater than the viewport, then this will be
|
||||
// incorrect for RTL.
|
||||
function getWindowScrollBarX(element, rect) {
|
||||
const leftScroll = getNodeScroll(element).scrollLeft;
|
||||
if (!rect) {
|
||||
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
||||
}
|
||||
return rect.left + leftScroll;
|
||||
}
|
||||
|
||||
function getHTMLOffset(documentElement, scroll) {
|
||||
const htmlRect = documentElement.getBoundingClientRect();
|
||||
const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
|
||||
const y = htmlRect.top + scroll.scrollTop;
|
||||
return {
|
||||
x,
|
||||
y
|
||||
};
|
||||
}
|
||||
|
||||
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
||||
let {
|
||||
elements,
|
||||
rect,
|
||||
offsetParent,
|
||||
strategy
|
||||
} = _ref;
|
||||
const isFixed = strategy === 'fixed';
|
||||
const documentElement = getDocumentElement(offsetParent);
|
||||
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
||||
if (offsetParent === documentElement || topLayer && isFixed) {
|
||||
return rect;
|
||||
}
|
||||
let scroll = {
|
||||
scrollLeft: 0,
|
||||
scrollTop: 0
|
||||
};
|
||||
let scale = createCoords(1);
|
||||
const offsets = createCoords(0);
|
||||
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
||||
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
||||
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
||||
scroll = getNodeScroll(offsetParent);
|
||||
}
|
||||
if (isOffsetParentAnElement) {
|
||||
const offsetRect = getBoundingClientRect(offsetParent);
|
||||
scale = getScale(offsetParent);
|
||||
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
||||
offsets.y = offsetRect.y + offsetParent.clientTop;
|
||||
}
|
||||
}
|
||||
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
||||
return {
|
||||
width: rect.width * scale.x,
|
||||
height: rect.height * scale.y,
|
||||
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
||||
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
||||
};
|
||||
}
|
||||
|
||||
function getClientRects(element) {
|
||||
return Array.from(element.getClientRects());
|
||||
}
|
||||
|
||||
// Gets the entire size of the scrollable document area, even extending outside
|
||||
// of the `<html>` and `<body>` rect bounds if horizontally scrollable.
|
||||
function getDocumentRect(element) {
|
||||
const html = getDocumentElement(element);
|
||||
const scroll = getNodeScroll(element);
|
||||
const body = element.ownerDocument.body;
|
||||
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
||||
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
||||
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
||||
const y = -scroll.scrollTop;
|
||||
if (getComputedStyle$1(body).direction === 'rtl') {
|
||||
x += max(html.clientWidth, body.clientWidth) - width;
|
||||
}
|
||||
return {
|
||||
width,
|
||||
height,
|
||||
x,
|
||||
y
|
||||
};
|
||||
}
|
||||
|
||||
// Safety check: ensure the scrollbar space is reasonable in case this
|
||||
// calculation is affected by unusual styles.
|
||||
// Most scrollbars leave 15-18px of space.
|
||||
const SCROLLBAR_MAX = 25;
|
||||
function getViewportRect(element, strategy) {
|
||||
const win = getWindow(element);
|
||||
const html = getDocumentElement(element);
|
||||
const visualViewport = win.visualViewport;
|
||||
let width = html.clientWidth;
|
||||
let height = html.clientHeight;
|
||||
let x = 0;
|
||||
let y = 0;
|
||||
if (visualViewport) {
|
||||
width = visualViewport.width;
|
||||
height = visualViewport.height;
|
||||
const visualViewportBased = isWebKit();
|
||||
if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
|
||||
x = visualViewport.offsetLeft;
|
||||
y = visualViewport.offsetTop;
|
||||
}
|
||||
}
|
||||
const windowScrollbarX = getWindowScrollBarX(html);
|
||||
// <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
|
||||
// visual width of the <html> but this is not considered in the size
|
||||
// of `html.clientWidth`.
|
||||
if (windowScrollbarX <= 0) {
|
||||
const doc = html.ownerDocument;
|
||||
const body = doc.body;
|
||||
const bodyStyles = getComputedStyle(body);
|
||||
const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
|
||||
const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
|
||||
if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
|
||||
width -= clippingStableScrollbarWidth;
|
||||
}
|
||||
} else if (windowScrollbarX <= SCROLLBAR_MAX) {
|
||||
// If the <body> scrollbar is on the left, the width needs to be extended
|
||||
// by the scrollbar amount so there isn't extra space on the right.
|
||||
width += windowScrollbarX;
|
||||
}
|
||||
return {
|
||||
width,
|
||||
height,
|
||||
x,
|
||||
y
|
||||
};
|
||||
}
|
||||
|
||||
// Returns the inner client rect, subtracting scrollbars if present.
|
||||
function getInnerBoundingClientRect(element, strategy) {
|
||||
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
||||
const top = clientRect.top + element.clientTop;
|
||||
const left = clientRect.left + element.clientLeft;
|
||||
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
||||
const width = element.clientWidth * scale.x;
|
||||
const height = element.clientHeight * scale.y;
|
||||
const x = left * scale.x;
|
||||
const y = top * scale.y;
|
||||
return {
|
||||
width,
|
||||
height,
|
||||
x,
|
||||
y
|
||||
};
|
||||
}
|
||||
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
||||
let rect;
|
||||
if (clippingAncestor === 'viewport') {
|
||||
rect = getViewportRect(element, strategy);
|
||||
} else if (clippingAncestor === 'document') {
|
||||
rect = getDocumentRect(getDocumentElement(element));
|
||||
} else if (isElement(clippingAncestor)) {
|
||||
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
||||
} else {
|
||||
const visualOffsets = getVisualOffsets(element);
|
||||
rect = {
|
||||
x: clippingAncestor.x - visualOffsets.x,
|
||||
y: clippingAncestor.y - visualOffsets.y,
|
||||
width: clippingAncestor.width,
|
||||
height: clippingAncestor.height
|
||||
};
|
||||
}
|
||||
return rectToClientRect(rect);
|
||||
}
|
||||
function hasFixedPositionAncestor(element, stopNode) {
|
||||
const parentNode = getParentNode(element);
|
||||
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
||||
return false;
|
||||
}
|
||||
return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
||||
}
|
||||
|
||||
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
||||
// clipping (or hiding) child elements. This returns all clipping ancestors
|
||||
// of the given element up the tree.
|
||||
function getClippingElementAncestors(element, cache) {
|
||||
const cachedResult = cache.get(element);
|
||||
if (cachedResult) {
|
||||
return cachedResult;
|
||||
}
|
||||
let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
||||
let currentContainingBlockComputedStyle = null;
|
||||
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
|
||||
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
||||
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
||||
const computedStyle = getComputedStyle$1(currentNode);
|
||||
const currentNodeIsContaining = isContainingBlock(currentNode);
|
||||
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
||||
currentContainingBlockComputedStyle = null;
|
||||
}
|
||||
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === 'absolute' || currentContainingBlockComputedStyle.position === 'fixed') || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
||||
if (shouldDropCurrentNode) {
|
||||
// Drop non-containing blocks.
|
||||
result = result.filter(ancestor => ancestor !== currentNode);
|
||||
} else {
|
||||
// Record last containing block for next iteration.
|
||||
currentContainingBlockComputedStyle = computedStyle;
|
||||
}
|
||||
currentNode = getParentNode(currentNode);
|
||||
}
|
||||
cache.set(element, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
// Gets the maximum area that the element is visible in due to any number of
|
||||
// clipping ancestors.
|
||||
function getClippingRect(_ref) {
|
||||
let {
|
||||
element,
|
||||
boundary,
|
||||
rootBoundary,
|
||||
strategy
|
||||
} = _ref;
|
||||
const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
||||
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
||||
const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
|
||||
let top = firstRect.top;
|
||||
let right = firstRect.right;
|
||||
let bottom = firstRect.bottom;
|
||||
let left = firstRect.left;
|
||||
for (let i = 1; i < clippingAncestors.length; i++) {
|
||||
const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
|
||||
top = max(rect.top, top);
|
||||
right = min(rect.right, right);
|
||||
bottom = min(rect.bottom, bottom);
|
||||
left = max(rect.left, left);
|
||||
}
|
||||
return {
|
||||
width: right - left,
|
||||
height: bottom - top,
|
||||
x: left,
|
||||
y: top
|
||||
};
|
||||
}
|
||||
|
||||
function getDimensions(element) {
|
||||
const {
|
||||
width,
|
||||
height
|
||||
} = getCssDimensions(element);
|
||||
return {
|
||||
width,
|
||||
height
|
||||
};
|
||||
}
|
||||
|
||||
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
||||
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
||||
const documentElement = getDocumentElement(offsetParent);
|
||||
const isFixed = strategy === 'fixed';
|
||||
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
||||
let scroll = {
|
||||
scrollLeft: 0,
|
||||
scrollTop: 0
|
||||
};
|
||||
const offsets = createCoords(0);
|
||||
|
||||
// If the <body> scrollbar appears on the left (e.g. RTL systems). Use
|
||||
// Firefox with layout.scrollbar.side = 3 in about:config to test this.
|
||||
function setLeftRTLScrollbarOffset() {
|
||||
offsets.x = getWindowScrollBarX(documentElement);
|
||||
}
|
||||
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
||||
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
||||
scroll = getNodeScroll(offsetParent);
|
||||
}
|
||||
if (isOffsetParentAnElement) {
|
||||
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
||||
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
||||
offsets.y = offsetRect.y + offsetParent.clientTop;
|
||||
} else if (documentElement) {
|
||||
setLeftRTLScrollbarOffset();
|
||||
}
|
||||
}
|
||||
if (isFixed && !isOffsetParentAnElement && documentElement) {
|
||||
setLeftRTLScrollbarOffset();
|
||||
}
|
||||
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
||||
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
||||
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
||||
return {
|
||||
x,
|
||||
y,
|
||||
width: rect.width,
|
||||
height: rect.height
|
||||
};
|
||||
}
|
||||
|
||||
function isStaticPositioned(element) {
|
||||
return getComputedStyle$1(element).position === 'static';
|
||||
}
|
||||
|
||||
function getTrueOffsetParent(element, polyfill) {
|
||||
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
|
||||
return null;
|
||||
}
|
||||
if (polyfill) {
|
||||
return polyfill(element);
|
||||
}
|
||||
let rawOffsetParent = element.offsetParent;
|
||||
|
||||
// Firefox returns the <html> element as the offsetParent if it's non-static,
|
||||
// while Chrome and Safari return the <body> element. The <body> element must
|
||||
// be used to perform the correct calculations even if the <html> element is
|
||||
// non-static.
|
||||
if (getDocumentElement(element) === rawOffsetParent) {
|
||||
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
||||
}
|
||||
return rawOffsetParent;
|
||||
}
|
||||
|
||||
// Gets the closest ancestor positioned element. Handles some edge cases,
|
||||
// such as table ancestors and cross browser bugs.
|
||||
function getOffsetParent(element, polyfill) {
|
||||
const win = getWindow(element);
|
||||
if (isTopLayer(element)) {
|
||||
return win;
|
||||
}
|
||||
if (!isHTMLElement(element)) {
|
||||
let svgOffsetParent = getParentNode(element);
|
||||
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
||||
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
||||
return svgOffsetParent;
|
||||
}
|
||||
svgOffsetParent = getParentNode(svgOffsetParent);
|
||||
}
|
||||
return win;
|
||||
}
|
||||
let offsetParent = getTrueOffsetParent(element, polyfill);
|
||||
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
||||
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
||||
}
|
||||
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
||||
return win;
|
||||
}
|
||||
return offsetParent || getContainingBlock(element) || win;
|
||||
}
|
||||
|
||||
const getElementRects = async function (data) {
|
||||
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
||||
const getDimensionsFn = this.getDimensions;
|
||||
const floatingDimensions = await getDimensionsFn(data.floating);
|
||||
return {
|
||||
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
||||
floating: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: floatingDimensions.width,
|
||||
height: floatingDimensions.height
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
function isRTL(element) {
|
||||
return getComputedStyle$1(element).direction === 'rtl';
|
||||
}
|
||||
|
||||
const platform = {
|
||||
convertOffsetParentRelativeRectToViewportRelativeRect,
|
||||
getDocumentElement,
|
||||
getClippingRect,
|
||||
getOffsetParent,
|
||||
getElementRects,
|
||||
getClientRects,
|
||||
getDimensions,
|
||||
getScale,
|
||||
isElement,
|
||||
isRTL
|
||||
};
|
||||
|
||||
function rectsAreEqual(a, b) {
|
||||
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
||||
}
|
||||
|
||||
// https://samthor.au/2021/observing-dom/
|
||||
function observeMove(element, onMove) {
|
||||
let io = null;
|
||||
let timeoutId;
|
||||
const root = getDocumentElement(element);
|
||||
function cleanup() {
|
||||
var _io;
|
||||
clearTimeout(timeoutId);
|
||||
(_io = io) == null || _io.disconnect();
|
||||
io = null;
|
||||
}
|
||||
function refresh(skip, threshold) {
|
||||
if (skip === void 0) {
|
||||
skip = false;
|
||||
}
|
||||
if (threshold === void 0) {
|
||||
threshold = 1;
|
||||
}
|
||||
cleanup();
|
||||
const elementRectForRootMargin = element.getBoundingClientRect();
|
||||
const {
|
||||
left,
|
||||
top,
|
||||
width,
|
||||
height
|
||||
} = elementRectForRootMargin;
|
||||
if (!skip) {
|
||||
onMove();
|
||||
}
|
||||
if (!width || !height) {
|
||||
return;
|
||||
}
|
||||
const insetTop = floor(top);
|
||||
const insetRight = floor(root.clientWidth - (left + width));
|
||||
const insetBottom = floor(root.clientHeight - (top + height));
|
||||
const insetLeft = floor(left);
|
||||
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
||||
const options = {
|
||||
rootMargin,
|
||||
threshold: max(0, min(1, threshold)) || 1
|
||||
};
|
||||
let isFirstUpdate = true;
|
||||
function handleObserve(entries) {
|
||||
const ratio = entries[0].intersectionRatio;
|
||||
if (ratio !== threshold) {
|
||||
if (!isFirstUpdate) {
|
||||
return refresh();
|
||||
}
|
||||
if (!ratio) {
|
||||
// If the reference is clipped, the ratio is 0. Throttle the refresh
|
||||
// to prevent an infinite loop of updates.
|
||||
timeoutId = setTimeout(() => {
|
||||
refresh(false, 1e-7);
|
||||
}, 1000);
|
||||
} else {
|
||||
refresh(false, ratio);
|
||||
}
|
||||
}
|
||||
if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
|
||||
// It's possible that even though the ratio is reported as 1, the
|
||||
// element is not actually fully within the IntersectionObserver's root
|
||||
// area anymore. This can happen under performance constraints. This may
|
||||
// be a bug in the browser's IntersectionObserver implementation. To
|
||||
// work around this, we compare the element's bounding rect now with
|
||||
// what it was at the time we created the IntersectionObserver. If they
|
||||
// are not equal then the element moved, so we refresh.
|
||||
refresh();
|
||||
}
|
||||
isFirstUpdate = false;
|
||||
}
|
||||
|
||||
// Older browsers don't support a `document` as the root and will throw an
|
||||
// error.
|
||||
try {
|
||||
io = new IntersectionObserver(handleObserve, {
|
||||
...options,
|
||||
// Handle <iframe>s
|
||||
root: root.ownerDocument
|
||||
});
|
||||
} catch (_e) {
|
||||
io = new IntersectionObserver(handleObserve, options);
|
||||
}
|
||||
io.observe(element);
|
||||
}
|
||||
refresh(true);
|
||||
return cleanup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Automatically updates the position of the floating element when necessary.
|
||||
* Should only be called when the floating element is mounted on the DOM or
|
||||
* visible on the screen.
|
||||
* @returns cleanup function that should be invoked when the floating element is
|
||||
* removed from the DOM or hidden from the screen.
|
||||
* @see https://floating-ui.com/docs/autoUpdate
|
||||
*/
|
||||
function autoUpdate(reference, floating, update, options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
const {
|
||||
ancestorScroll = true,
|
||||
ancestorResize = true,
|
||||
elementResize = typeof ResizeObserver === 'function',
|
||||
layoutShift = typeof IntersectionObserver === 'function',
|
||||
animationFrame = false
|
||||
} = options;
|
||||
const referenceEl = unwrapElement(reference);
|
||||
const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...(floating ? getOverflowAncestors(floating) : [])] : [];
|
||||
ancestors.forEach(ancestor => {
|
||||
ancestorScroll && ancestor.addEventListener('scroll', update, {
|
||||
passive: true
|
||||
});
|
||||
ancestorResize && ancestor.addEventListener('resize', update);
|
||||
});
|
||||
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
||||
let reobserveFrame = -1;
|
||||
let resizeObserver = null;
|
||||
if (elementResize) {
|
||||
resizeObserver = new ResizeObserver(_ref => {
|
||||
let [firstEntry] = _ref;
|
||||
if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
|
||||
// Prevent update loops when using the `size` middleware.
|
||||
// https://github.com/floating-ui/floating-ui/issues/1740
|
||||
resizeObserver.unobserve(floating);
|
||||
cancelAnimationFrame(reobserveFrame);
|
||||
reobserveFrame = requestAnimationFrame(() => {
|
||||
var _resizeObserver;
|
||||
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
||||
});
|
||||
}
|
||||
update();
|
||||
});
|
||||
if (referenceEl && !animationFrame) {
|
||||
resizeObserver.observe(referenceEl);
|
||||
}
|
||||
if (floating) {
|
||||
resizeObserver.observe(floating);
|
||||
}
|
||||
}
|
||||
let frameId;
|
||||
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
||||
if (animationFrame) {
|
||||
frameLoop();
|
||||
}
|
||||
function frameLoop() {
|
||||
const nextRefRect = getBoundingClientRect(reference);
|
||||
if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
|
||||
update();
|
||||
}
|
||||
prevRefRect = nextRefRect;
|
||||
frameId = requestAnimationFrame(frameLoop);
|
||||
}
|
||||
update();
|
||||
return () => {
|
||||
var _resizeObserver2;
|
||||
ancestors.forEach(ancestor => {
|
||||
ancestorScroll && ancestor.removeEventListener('scroll', update);
|
||||
ancestorResize && ancestor.removeEventListener('resize', update);
|
||||
});
|
||||
cleanupIo == null || cleanupIo();
|
||||
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
||||
resizeObserver = null;
|
||||
if (animationFrame) {
|
||||
cancelAnimationFrame(frameId);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves with an object of overflow side offsets that determine how much the
|
||||
* element is overflowing a given clipping boundary on each side.
|
||||
* - positive = overflowing the boundary by that number of pixels
|
||||
* - negative = how many pixels left before it will overflow
|
||||
* - 0 = lies flush with the boundary
|
||||
* @see https://floating-ui.com/docs/detectOverflow
|
||||
*/
|
||||
const detectOverflow = detectOverflow$1;
|
||||
|
||||
/**
|
||||
* Modifies the placement by translating the floating element along the
|
||||
* specified axes.
|
||||
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
||||
* object may be passed.
|
||||
* @see https://floating-ui.com/docs/offset
|
||||
*/
|
||||
const offset = offset$1;
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by choosing the placement
|
||||
* that has the most space available automatically, without needing to specify a
|
||||
* preferred placement. Alternative to `flip`.
|
||||
* @see https://floating-ui.com/docs/autoPlacement
|
||||
*/
|
||||
const autoPlacement = autoPlacement$1;
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by shifting it in order to
|
||||
* keep it in view when it will overflow the clipping boundary.
|
||||
* @see https://floating-ui.com/docs/shift
|
||||
*/
|
||||
const shift = shift$1;
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by flipping the `placement`
|
||||
* in order to keep it in view when the preferred placement(s) will overflow the
|
||||
* clipping boundary. Alternative to `autoPlacement`.
|
||||
* @see https://floating-ui.com/docs/flip
|
||||
*/
|
||||
const flip = flip$1;
|
||||
|
||||
/**
|
||||
* Provides data that allows you to change the size of the floating element —
|
||||
* for instance, prevent it from overflowing the clipping boundary or match the
|
||||
* width of the reference element.
|
||||
* @see https://floating-ui.com/docs/size
|
||||
*/
|
||||
const size = size$1;
|
||||
|
||||
/**
|
||||
* Provides data to hide the floating element in applicable situations, such as
|
||||
* when it is not in the same clipping context as the reference element.
|
||||
* @see https://floating-ui.com/docs/hide
|
||||
*/
|
||||
const hide = hide$1;
|
||||
|
||||
/**
|
||||
* Provides data to position an inner element of the floating element so that it
|
||||
* appears centered to the reference element.
|
||||
* @see https://floating-ui.com/docs/arrow
|
||||
*/
|
||||
const arrow = arrow$1;
|
||||
|
||||
/**
|
||||
* Provides improved positioning for inline reference elements that can span
|
||||
* over multiple lines, such as hyperlinks or range selections.
|
||||
* @see https://floating-ui.com/docs/inline
|
||||
*/
|
||||
const inline = inline$1;
|
||||
|
||||
/**
|
||||
* Built-in `limiter` that will stop `shift()` at a certain point.
|
||||
*/
|
||||
const limitShift = limitShift$1;
|
||||
|
||||
/**
|
||||
* Computes the `x` and `y` coordinates that will place the floating element
|
||||
* next to a given reference element.
|
||||
*/
|
||||
const computePosition = (reference, floating, options) => {
|
||||
// This caches the expensive `getClippingElementAncestors` function so that
|
||||
// multiple lifecycle resets re-use the same result. It only lives for a
|
||||
// single call. If other functions become expensive, we can add them as well.
|
||||
const cache = new Map();
|
||||
const mergedOptions = {
|
||||
platform,
|
||||
...options
|
||||
};
|
||||
const platformWithCache = {
|
||||
...mergedOptions.platform,
|
||||
_c: cache
|
||||
};
|
||||
return computePosition$1(reference, floating, {
|
||||
...mergedOptions,
|
||||
platform: platformWithCache
|
||||
});
|
||||
};
|
||||
|
||||
export { arrow, autoPlacement, autoUpdate, computePosition, detectOverflow, flip, getOverflowAncestors, hide, inline, limitShift, offset, platform, shift, size };
|
||||
|
|
@ -0,0 +1,358 @@
|
|||
import { AlignedPlacement } from '@floating-ui/core';
|
||||
import { Alignment } from '@floating-ui/core';
|
||||
import type { ArrowOptions as ArrowOptions_2 } from '@floating-ui/core';
|
||||
import type { AutoPlacementOptions as AutoPlacementOptions_2 } from '@floating-ui/core';
|
||||
import { Axis } from '@floating-ui/core';
|
||||
import { ClientRectObject } from '@floating-ui/core';
|
||||
import type { ComputePositionConfig as ComputePositionConfig_2 } from '@floating-ui/core';
|
||||
import { ComputePositionReturn } from '@floating-ui/core';
|
||||
import { Coords } from '@floating-ui/core';
|
||||
import type { detectOverflow as detectOverflow_2 } from '@floating-ui/core';
|
||||
import type { DetectOverflowOptions as DetectOverflowOptions_2 } from '@floating-ui/core';
|
||||
import { Dimensions } from '@floating-ui/core';
|
||||
import { ElementContext } from '@floating-ui/core';
|
||||
import { ElementRects } from '@floating-ui/core';
|
||||
import type { FlipOptions as FlipOptions_2 } from '@floating-ui/core';
|
||||
import { getOverflowAncestors } from '@floating-ui/utils/dom';
|
||||
import type { HideOptions as HideOptions_2 } from '@floating-ui/core';
|
||||
import { InlineOptions } from '@floating-ui/core';
|
||||
import { Length } from '@floating-ui/core';
|
||||
import { LimitShiftOptions } from '@floating-ui/core';
|
||||
import type { Middleware as Middleware_2 } from '@floating-ui/core';
|
||||
import { MiddlewareData } from '@floating-ui/core';
|
||||
import { MiddlewareReturn } from '@floating-ui/core';
|
||||
import type { MiddlewareState as MiddlewareState_2 } from '@floating-ui/core';
|
||||
import { Padding } from '@floating-ui/core';
|
||||
import { Placement } from '@floating-ui/core';
|
||||
import { Rect } from '@floating-ui/core';
|
||||
import { RootBoundary } from '@floating-ui/core';
|
||||
import type { ShiftOptions as ShiftOptions_2 } from '@floating-ui/core';
|
||||
import { Side } from '@floating-ui/core';
|
||||
import { SideObject } from '@floating-ui/core';
|
||||
import type { SizeOptions as SizeOptions_2 } from '@floating-ui/core';
|
||||
import { Strategy } from '@floating-ui/core';
|
||||
|
||||
export { AlignedPlacement }
|
||||
|
||||
export { Alignment }
|
||||
|
||||
/**
|
||||
* Provides data to position an inner element of the floating element so that it
|
||||
* appears centered to the reference element.
|
||||
* @see https://floating-ui.com/docs/arrow
|
||||
*/
|
||||
export declare const arrow: (options: ArrowOptions | Derivable<ArrowOptions>) => Middleware;
|
||||
|
||||
export declare type ArrowOptions = Prettify<Omit<ArrowOptions_2, 'element'> & {
|
||||
element: Element;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by choosing the placement
|
||||
* that has the most space available automatically, without needing to specify a
|
||||
* preferred placement. Alternative to `flip`.
|
||||
* @see https://floating-ui.com/docs/autoPlacement
|
||||
*/
|
||||
export declare const autoPlacement: (options?: AutoPlacementOptions | Derivable<AutoPlacementOptions>) => Middleware;
|
||||
|
||||
export declare type AutoPlacementOptions = Prettify<Omit<AutoPlacementOptions_2, 'boundary'> & DetectOverflowOptions>;
|
||||
|
||||
/**
|
||||
* Automatically updates the position of the floating element when necessary.
|
||||
* Should only be called when the floating element is mounted on the DOM or
|
||||
* visible on the screen.
|
||||
* @returns cleanup function that should be invoked when the floating element is
|
||||
* removed from the DOM or hidden from the screen.
|
||||
* @see https://floating-ui.com/docs/autoUpdate
|
||||
*/
|
||||
export declare function autoUpdate(reference: ReferenceElement, floating: FloatingElement | null, update: () => void, options?: AutoUpdateOptions): () => void;
|
||||
|
||||
export declare interface AutoUpdateOptions {
|
||||
/**
|
||||
* Whether to update the position when an overflow ancestor is scrolled.
|
||||
* @default true
|
||||
*/
|
||||
ancestorScroll?: boolean;
|
||||
/**
|
||||
* Whether to update the position when an overflow ancestor is resized. This
|
||||
* uses the native `resize` event.
|
||||
* @default true
|
||||
*/
|
||||
ancestorResize?: boolean;
|
||||
/**
|
||||
* Whether to update the position when either the reference or floating
|
||||
* elements resized. This uses a `ResizeObserver`.
|
||||
* @default true
|
||||
*/
|
||||
elementResize?: boolean;
|
||||
/**
|
||||
* Whether to update the position when the reference relocated on the screen
|
||||
* due to layout shift.
|
||||
* @default true
|
||||
*/
|
||||
layoutShift?: boolean;
|
||||
/**
|
||||
* Whether to update on every animation frame if necessary. Only use if you
|
||||
* need to update the position in response to an animation using transforms.
|
||||
* @default false
|
||||
*/
|
||||
animationFrame?: boolean;
|
||||
}
|
||||
|
||||
export { Axis }
|
||||
|
||||
/**
|
||||
* The clipping boundary area of the floating element.
|
||||
*/
|
||||
export declare type Boundary = 'clippingAncestors' | Element | Array<Element> | Rect;
|
||||
|
||||
export { ClientRectObject }
|
||||
|
||||
/**
|
||||
* Computes the `x` and `y` coordinates that will place the floating element
|
||||
* next to a given reference element.
|
||||
*/
|
||||
export declare const computePosition: (reference: ReferenceElement, floating: FloatingElement, options?: Partial<ComputePositionConfig>) => Promise<ComputePositionReturn>;
|
||||
|
||||
export declare type ComputePositionConfig = Prettify<Omit<ComputePositionConfig_2, 'middleware' | 'platform'> & {
|
||||
/**
|
||||
* Array of middleware objects to modify the positioning or provide data for
|
||||
* rendering.
|
||||
*/
|
||||
middleware?: Array<Middleware | null | undefined | false>;
|
||||
/**
|
||||
* Custom or extended platform object.
|
||||
*/
|
||||
platform?: Platform;
|
||||
}>;
|
||||
|
||||
export { ComputePositionReturn }
|
||||
|
||||
export { Coords }
|
||||
|
||||
export declare type Derivable<T> = (state: MiddlewareState) => T;
|
||||
|
||||
/**
|
||||
* Resolves with an object of overflow side offsets that determine how much the
|
||||
* element is overflowing a given clipping boundary on each side.
|
||||
* - positive = overflowing the boundary by that number of pixels
|
||||
* - negative = how many pixels left before it will overflow
|
||||
* - 0 = lies flush with the boundary
|
||||
* @see https://floating-ui.com/docs/detectOverflow
|
||||
*/
|
||||
export declare const detectOverflow: (state: MiddlewareState, options?: DetectOverflowOptions | Derivable<DetectOverflowOptions>) => Promise<SideObject>;
|
||||
|
||||
export declare type DetectOverflowOptions = Prettify<Omit<DetectOverflowOptions_2, 'boundary'> & {
|
||||
boundary?: Boundary;
|
||||
}>;
|
||||
|
||||
export { Dimensions }
|
||||
|
||||
export { ElementContext }
|
||||
|
||||
export { ElementRects }
|
||||
|
||||
export declare interface Elements {
|
||||
reference: ReferenceElement;
|
||||
floating: FloatingElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by flipping the `placement`
|
||||
* in order to keep it in view when the preferred placement(s) will overflow the
|
||||
* clipping boundary. Alternative to `autoPlacement`.
|
||||
* @see https://floating-ui.com/docs/flip
|
||||
*/
|
||||
export declare const flip: (options?: FlipOptions | Derivable<FlipOptions>) => Middleware;
|
||||
|
||||
export declare type FlipOptions = Prettify<Omit<FlipOptions_2, 'boundary'> & DetectOverflowOptions>;
|
||||
|
||||
export declare type FloatingElement = HTMLElement;
|
||||
|
||||
export { getOverflowAncestors }
|
||||
|
||||
/**
|
||||
* Provides data to hide the floating element in applicable situations, such as
|
||||
* when it is not in the same clipping context as the reference element.
|
||||
* @see https://floating-ui.com/docs/hide
|
||||
*/
|
||||
export declare const hide: (options?: HideOptions | Derivable<HideOptions>) => Middleware;
|
||||
|
||||
export declare type HideOptions = Prettify<Omit<HideOptions_2, 'boundary'> & DetectOverflowOptions>;
|
||||
|
||||
/**
|
||||
* Provides improved positioning for inline reference elements that can span
|
||||
* over multiple lines, such as hyperlinks or range selections.
|
||||
* @see https://floating-ui.com/docs/inline
|
||||
*/
|
||||
export declare const inline: (options?: InlineOptions | Derivable<InlineOptions>) => Middleware;
|
||||
|
||||
export { InlineOptions }
|
||||
|
||||
export { Length }
|
||||
|
||||
/**
|
||||
* Built-in `limiter` that will stop `shift()` at a certain point.
|
||||
*/
|
||||
export declare const limitShift: (options?: LimitShiftOptions | Derivable<LimitShiftOptions>) => {
|
||||
options: any;
|
||||
fn: (state: MiddlewareState) => Coords;
|
||||
};
|
||||
|
||||
export { LimitShiftOptions }
|
||||
|
||||
export declare type Middleware = Prettify<Omit<Middleware_2, 'fn'> & {
|
||||
fn(state: MiddlewareState): Promisable<MiddlewareReturn>;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* @deprecated use `MiddlewareState` instead.
|
||||
*/
|
||||
export declare type MiddlewareArguments = MiddlewareState;
|
||||
|
||||
export { MiddlewareData }
|
||||
|
||||
export { MiddlewareReturn }
|
||||
|
||||
export declare type MiddlewareState = Prettify<Omit<MiddlewareState_2, 'elements'> & {
|
||||
elements: Elements;
|
||||
}>;
|
||||
|
||||
export declare interface NodeScroll {
|
||||
scrollLeft: number;
|
||||
scrollTop: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Modifies the placement by translating the floating element along the
|
||||
* specified axes.
|
||||
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
||||
* object may be passed.
|
||||
* @see https://floating-ui.com/docs/offset
|
||||
*/
|
||||
export declare const offset: (options?: OffsetOptions) => Middleware;
|
||||
|
||||
export declare type OffsetOptions = OffsetValue | Derivable<OffsetValue>;
|
||||
|
||||
declare type OffsetValue = number | {
|
||||
/**
|
||||
* The axis that runs along the side of the floating element. Represents
|
||||
* the distance (gutter or margin) between the reference and floating
|
||||
* element.
|
||||
* @default 0
|
||||
*/
|
||||
mainAxis?: number;
|
||||
/**
|
||||
* The axis that runs along the alignment of the floating element.
|
||||
* Represents the skidding between the reference and floating element.
|
||||
* @default 0
|
||||
*/
|
||||
crossAxis?: number;
|
||||
/**
|
||||
* The same axis as `crossAxis` but applies only to aligned placements
|
||||
* and inverts the `end` alignment. When set to a number, it overrides the
|
||||
* `crossAxis` value.
|
||||
*
|
||||
* A positive number will move the floating element in the direction of
|
||||
* the opposite edge to the one that is aligned, while a negative number
|
||||
* the reverse.
|
||||
* @default null
|
||||
*/
|
||||
alignmentAxis?: number | null;
|
||||
};
|
||||
|
||||
export { Padding }
|
||||
|
||||
export { Placement }
|
||||
|
||||
export declare interface Platform {
|
||||
getElementRects: (args: {
|
||||
reference: ReferenceElement;
|
||||
floating: FloatingElement;
|
||||
strategy: Strategy;
|
||||
}) => Promisable<ElementRects>;
|
||||
getClippingRect: (args: {
|
||||
element: Element;
|
||||
boundary: Boundary;
|
||||
rootBoundary: RootBoundary;
|
||||
strategy: Strategy;
|
||||
}) => Promisable<Rect>;
|
||||
getDimensions: (element: Element) => Promisable<Dimensions>;
|
||||
convertOffsetParentRelativeRectToViewportRelativeRect: (args: {
|
||||
elements?: Elements;
|
||||
rect: Rect;
|
||||
offsetParent: Element;
|
||||
strategy: Strategy;
|
||||
}) => Promisable<Rect>;
|
||||
getOffsetParent: (element: Element, polyfill?: (element: HTMLElement) => Element | null) => Promisable<Element | Window>;
|
||||
isElement: (value: unknown) => Promisable<boolean>;
|
||||
getDocumentElement: (element: Element) => Promisable<HTMLElement>;
|
||||
getClientRects: (element: Element) => Promisable<Array<ClientRectObject>>;
|
||||
isRTL: (element: Element) => Promisable<boolean>;
|
||||
getScale: (element: HTMLElement) => Promisable<{
|
||||
x: number;
|
||||
y: number;
|
||||
}>;
|
||||
detectOverflow?: typeof detectOverflow_2;
|
||||
}
|
||||
|
||||
export declare const platform: Platform;
|
||||
|
||||
declare type Prettify<T> = {
|
||||
[K in keyof T]: T[K];
|
||||
} & {};
|
||||
|
||||
declare type Promisable<T> = T | Promise<T>;
|
||||
|
||||
export { Rect }
|
||||
|
||||
export declare type ReferenceElement = Element | VirtualElement;
|
||||
|
||||
export { RootBoundary }
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by shifting it in order to
|
||||
* keep it in view when it will overflow the clipping boundary.
|
||||
* @see https://floating-ui.com/docs/shift
|
||||
*/
|
||||
export declare const shift: (options?: ShiftOptions | Derivable<ShiftOptions>) => Middleware;
|
||||
|
||||
export declare type ShiftOptions = Prettify<Omit<ShiftOptions_2, 'boundary'> & DetectOverflowOptions>;
|
||||
|
||||
export { Side }
|
||||
|
||||
export { SideObject }
|
||||
|
||||
/**
|
||||
* Provides data that allows you to change the size of the floating element —
|
||||
* for instance, prevent it from overflowing the clipping boundary or match the
|
||||
* width of the reference element.
|
||||
* @see https://floating-ui.com/docs/size
|
||||
*/
|
||||
export declare const size: (options?: SizeOptions | Derivable<SizeOptions>) => Middleware;
|
||||
|
||||
export declare type SizeOptions = Prettify<Omit<SizeOptions_2, 'apply' | 'boundary'> & DetectOverflowOptions & {
|
||||
/**
|
||||
* Function that is called to perform style mutations to the floating element
|
||||
* to change its size.
|
||||
* @default undefined
|
||||
*/
|
||||
apply?(args: MiddlewareState & {
|
||||
availableWidth: number;
|
||||
availableHeight: number;
|
||||
}): Promisable<void>;
|
||||
}>;
|
||||
|
||||
export { Strategy }
|
||||
|
||||
/**
|
||||
* Custom positioning reference element.
|
||||
* @see https://floating-ui.com/docs/virtual-elements
|
||||
*/
|
||||
export declare interface VirtualElement {
|
||||
getBoundingClientRect(): ClientRectObject;
|
||||
getClientRects?(): Array<ClientRectObject> | DOMRectList;
|
||||
contextElement?: Element;
|
||||
}
|
||||
|
||||
export { }
|
||||
|
|
@ -0,0 +1,358 @@
|
|||
import { AlignedPlacement } from '@floating-ui/core';
|
||||
import { Alignment } from '@floating-ui/core';
|
||||
import type { ArrowOptions as ArrowOptions_2 } from '@floating-ui/core';
|
||||
import type { AutoPlacementOptions as AutoPlacementOptions_2 } from '@floating-ui/core';
|
||||
import { Axis } from '@floating-ui/core';
|
||||
import { ClientRectObject } from '@floating-ui/core';
|
||||
import type { ComputePositionConfig as ComputePositionConfig_2 } from '@floating-ui/core';
|
||||
import { ComputePositionReturn } from '@floating-ui/core';
|
||||
import { Coords } from '@floating-ui/core';
|
||||
import type { detectOverflow as detectOverflow_2 } from '@floating-ui/core';
|
||||
import type { DetectOverflowOptions as DetectOverflowOptions_2 } from '@floating-ui/core';
|
||||
import { Dimensions } from '@floating-ui/core';
|
||||
import { ElementContext } from '@floating-ui/core';
|
||||
import { ElementRects } from '@floating-ui/core';
|
||||
import type { FlipOptions as FlipOptions_2 } from '@floating-ui/core';
|
||||
import { getOverflowAncestors } from '@floating-ui/utils/dom';
|
||||
import type { HideOptions as HideOptions_2 } from '@floating-ui/core';
|
||||
import { InlineOptions } from '@floating-ui/core';
|
||||
import { Length } from '@floating-ui/core';
|
||||
import { LimitShiftOptions } from '@floating-ui/core';
|
||||
import type { Middleware as Middleware_2 } from '@floating-ui/core';
|
||||
import { MiddlewareData } from '@floating-ui/core';
|
||||
import { MiddlewareReturn } from '@floating-ui/core';
|
||||
import type { MiddlewareState as MiddlewareState_2 } from '@floating-ui/core';
|
||||
import { Padding } from '@floating-ui/core';
|
||||
import { Placement } from '@floating-ui/core';
|
||||
import { Rect } from '@floating-ui/core';
|
||||
import { RootBoundary } from '@floating-ui/core';
|
||||
import type { ShiftOptions as ShiftOptions_2 } from '@floating-ui/core';
|
||||
import { Side } from '@floating-ui/core';
|
||||
import { SideObject } from '@floating-ui/core';
|
||||
import type { SizeOptions as SizeOptions_2 } from '@floating-ui/core';
|
||||
import { Strategy } from '@floating-ui/core';
|
||||
|
||||
export { AlignedPlacement }
|
||||
|
||||
export { Alignment }
|
||||
|
||||
/**
|
||||
* Provides data to position an inner element of the floating element so that it
|
||||
* appears centered to the reference element.
|
||||
* @see https://floating-ui.com/docs/arrow
|
||||
*/
|
||||
export declare const arrow: (options: ArrowOptions | Derivable<ArrowOptions>) => Middleware;
|
||||
|
||||
export declare type ArrowOptions = Prettify<Omit<ArrowOptions_2, 'element'> & {
|
||||
element: Element;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by choosing the placement
|
||||
* that has the most space available automatically, without needing to specify a
|
||||
* preferred placement. Alternative to `flip`.
|
||||
* @see https://floating-ui.com/docs/autoPlacement
|
||||
*/
|
||||
export declare const autoPlacement: (options?: AutoPlacementOptions | Derivable<AutoPlacementOptions>) => Middleware;
|
||||
|
||||
export declare type AutoPlacementOptions = Prettify<Omit<AutoPlacementOptions_2, 'boundary'> & DetectOverflowOptions>;
|
||||
|
||||
/**
|
||||
* Automatically updates the position of the floating element when necessary.
|
||||
* Should only be called when the floating element is mounted on the DOM or
|
||||
* visible on the screen.
|
||||
* @returns cleanup function that should be invoked when the floating element is
|
||||
* removed from the DOM or hidden from the screen.
|
||||
* @see https://floating-ui.com/docs/autoUpdate
|
||||
*/
|
||||
export declare function autoUpdate(reference: ReferenceElement, floating: FloatingElement | null, update: () => void, options?: AutoUpdateOptions): () => void;
|
||||
|
||||
export declare interface AutoUpdateOptions {
|
||||
/**
|
||||
* Whether to update the position when an overflow ancestor is scrolled.
|
||||
* @default true
|
||||
*/
|
||||
ancestorScroll?: boolean;
|
||||
/**
|
||||
* Whether to update the position when an overflow ancestor is resized. This
|
||||
* uses the native `resize` event.
|
||||
* @default true
|
||||
*/
|
||||
ancestorResize?: boolean;
|
||||
/**
|
||||
* Whether to update the position when either the reference or floating
|
||||
* elements resized. This uses a `ResizeObserver`.
|
||||
* @default true
|
||||
*/
|
||||
elementResize?: boolean;
|
||||
/**
|
||||
* Whether to update the position when the reference relocated on the screen
|
||||
* due to layout shift.
|
||||
* @default true
|
||||
*/
|
||||
layoutShift?: boolean;
|
||||
/**
|
||||
* Whether to update on every animation frame if necessary. Only use if you
|
||||
* need to update the position in response to an animation using transforms.
|
||||
* @default false
|
||||
*/
|
||||
animationFrame?: boolean;
|
||||
}
|
||||
|
||||
export { Axis }
|
||||
|
||||
/**
|
||||
* The clipping boundary area of the floating element.
|
||||
*/
|
||||
export declare type Boundary = 'clippingAncestors' | Element | Array<Element> | Rect;
|
||||
|
||||
export { ClientRectObject }
|
||||
|
||||
/**
|
||||
* Computes the `x` and `y` coordinates that will place the floating element
|
||||
* next to a given reference element.
|
||||
*/
|
||||
export declare const computePosition: (reference: ReferenceElement, floating: FloatingElement, options?: Partial<ComputePositionConfig>) => Promise<ComputePositionReturn>;
|
||||
|
||||
export declare type ComputePositionConfig = Prettify<Omit<ComputePositionConfig_2, 'middleware' | 'platform'> & {
|
||||
/**
|
||||
* Array of middleware objects to modify the positioning or provide data for
|
||||
* rendering.
|
||||
*/
|
||||
middleware?: Array<Middleware | null | undefined | false>;
|
||||
/**
|
||||
* Custom or extended platform object.
|
||||
*/
|
||||
platform?: Platform;
|
||||
}>;
|
||||
|
||||
export { ComputePositionReturn }
|
||||
|
||||
export { Coords }
|
||||
|
||||
export declare type Derivable<T> = (state: MiddlewareState) => T;
|
||||
|
||||
/**
|
||||
* Resolves with an object of overflow side offsets that determine how much the
|
||||
* element is overflowing a given clipping boundary on each side.
|
||||
* - positive = overflowing the boundary by that number of pixels
|
||||
* - negative = how many pixels left before it will overflow
|
||||
* - 0 = lies flush with the boundary
|
||||
* @see https://floating-ui.com/docs/detectOverflow
|
||||
*/
|
||||
export declare const detectOverflow: (state: MiddlewareState, options?: DetectOverflowOptions | Derivable<DetectOverflowOptions>) => Promise<SideObject>;
|
||||
|
||||
export declare type DetectOverflowOptions = Prettify<Omit<DetectOverflowOptions_2, 'boundary'> & {
|
||||
boundary?: Boundary;
|
||||
}>;
|
||||
|
||||
export { Dimensions }
|
||||
|
||||
export { ElementContext }
|
||||
|
||||
export { ElementRects }
|
||||
|
||||
export declare interface Elements {
|
||||
reference: ReferenceElement;
|
||||
floating: FloatingElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by flipping the `placement`
|
||||
* in order to keep it in view when the preferred placement(s) will overflow the
|
||||
* clipping boundary. Alternative to `autoPlacement`.
|
||||
* @see https://floating-ui.com/docs/flip
|
||||
*/
|
||||
export declare const flip: (options?: FlipOptions | Derivable<FlipOptions>) => Middleware;
|
||||
|
||||
export declare type FlipOptions = Prettify<Omit<FlipOptions_2, 'boundary'> & DetectOverflowOptions>;
|
||||
|
||||
export declare type FloatingElement = HTMLElement;
|
||||
|
||||
export { getOverflowAncestors }
|
||||
|
||||
/**
|
||||
* Provides data to hide the floating element in applicable situations, such as
|
||||
* when it is not in the same clipping context as the reference element.
|
||||
* @see https://floating-ui.com/docs/hide
|
||||
*/
|
||||
export declare const hide: (options?: HideOptions | Derivable<HideOptions>) => Middleware;
|
||||
|
||||
export declare type HideOptions = Prettify<Omit<HideOptions_2, 'boundary'> & DetectOverflowOptions>;
|
||||
|
||||
/**
|
||||
* Provides improved positioning for inline reference elements that can span
|
||||
* over multiple lines, such as hyperlinks or range selections.
|
||||
* @see https://floating-ui.com/docs/inline
|
||||
*/
|
||||
export declare const inline: (options?: InlineOptions | Derivable<InlineOptions>) => Middleware;
|
||||
|
||||
export { InlineOptions }
|
||||
|
||||
export { Length }
|
||||
|
||||
/**
|
||||
* Built-in `limiter` that will stop `shift()` at a certain point.
|
||||
*/
|
||||
export declare const limitShift: (options?: LimitShiftOptions | Derivable<LimitShiftOptions>) => {
|
||||
options: any;
|
||||
fn: (state: MiddlewareState) => Coords;
|
||||
};
|
||||
|
||||
export { LimitShiftOptions }
|
||||
|
||||
export declare type Middleware = Prettify<Omit<Middleware_2, 'fn'> & {
|
||||
fn(state: MiddlewareState): Promisable<MiddlewareReturn>;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* @deprecated use `MiddlewareState` instead.
|
||||
*/
|
||||
export declare type MiddlewareArguments = MiddlewareState;
|
||||
|
||||
export { MiddlewareData }
|
||||
|
||||
export { MiddlewareReturn }
|
||||
|
||||
export declare type MiddlewareState = Prettify<Omit<MiddlewareState_2, 'elements'> & {
|
||||
elements: Elements;
|
||||
}>;
|
||||
|
||||
export declare interface NodeScroll {
|
||||
scrollLeft: number;
|
||||
scrollTop: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Modifies the placement by translating the floating element along the
|
||||
* specified axes.
|
||||
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
||||
* object may be passed.
|
||||
* @see https://floating-ui.com/docs/offset
|
||||
*/
|
||||
export declare const offset: (options?: OffsetOptions) => Middleware;
|
||||
|
||||
export declare type OffsetOptions = OffsetValue | Derivable<OffsetValue>;
|
||||
|
||||
declare type OffsetValue = number | {
|
||||
/**
|
||||
* The axis that runs along the side of the floating element. Represents
|
||||
* the distance (gutter or margin) between the reference and floating
|
||||
* element.
|
||||
* @default 0
|
||||
*/
|
||||
mainAxis?: number;
|
||||
/**
|
||||
* The axis that runs along the alignment of the floating element.
|
||||
* Represents the skidding between the reference and floating element.
|
||||
* @default 0
|
||||
*/
|
||||
crossAxis?: number;
|
||||
/**
|
||||
* The same axis as `crossAxis` but applies only to aligned placements
|
||||
* and inverts the `end` alignment. When set to a number, it overrides the
|
||||
* `crossAxis` value.
|
||||
*
|
||||
* A positive number will move the floating element in the direction of
|
||||
* the opposite edge to the one that is aligned, while a negative number
|
||||
* the reverse.
|
||||
* @default null
|
||||
*/
|
||||
alignmentAxis?: number | null;
|
||||
};
|
||||
|
||||
export { Padding }
|
||||
|
||||
export { Placement }
|
||||
|
||||
export declare interface Platform {
|
||||
getElementRects: (args: {
|
||||
reference: ReferenceElement;
|
||||
floating: FloatingElement;
|
||||
strategy: Strategy;
|
||||
}) => Promisable<ElementRects>;
|
||||
getClippingRect: (args: {
|
||||
element: Element;
|
||||
boundary: Boundary;
|
||||
rootBoundary: RootBoundary;
|
||||
strategy: Strategy;
|
||||
}) => Promisable<Rect>;
|
||||
getDimensions: (element: Element) => Promisable<Dimensions>;
|
||||
convertOffsetParentRelativeRectToViewportRelativeRect: (args: {
|
||||
elements?: Elements;
|
||||
rect: Rect;
|
||||
offsetParent: Element;
|
||||
strategy: Strategy;
|
||||
}) => Promisable<Rect>;
|
||||
getOffsetParent: (element: Element, polyfill?: (element: HTMLElement) => Element | null) => Promisable<Element | Window>;
|
||||
isElement: (value: unknown) => Promisable<boolean>;
|
||||
getDocumentElement: (element: Element) => Promisable<HTMLElement>;
|
||||
getClientRects: (element: Element) => Promisable<Array<ClientRectObject>>;
|
||||
isRTL: (element: Element) => Promisable<boolean>;
|
||||
getScale: (element: HTMLElement) => Promisable<{
|
||||
x: number;
|
||||
y: number;
|
||||
}>;
|
||||
detectOverflow?: typeof detectOverflow_2;
|
||||
}
|
||||
|
||||
export declare const platform: Platform;
|
||||
|
||||
declare type Prettify<T> = {
|
||||
[K in keyof T]: T[K];
|
||||
} & {};
|
||||
|
||||
declare type Promisable<T> = T | Promise<T>;
|
||||
|
||||
export { Rect }
|
||||
|
||||
export declare type ReferenceElement = Element | VirtualElement;
|
||||
|
||||
export { RootBoundary }
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by shifting it in order to
|
||||
* keep it in view when it will overflow the clipping boundary.
|
||||
* @see https://floating-ui.com/docs/shift
|
||||
*/
|
||||
export declare const shift: (options?: ShiftOptions | Derivable<ShiftOptions>) => Middleware;
|
||||
|
||||
export declare type ShiftOptions = Prettify<Omit<ShiftOptions_2, 'boundary'> & DetectOverflowOptions>;
|
||||
|
||||
export { Side }
|
||||
|
||||
export { SideObject }
|
||||
|
||||
/**
|
||||
* Provides data that allows you to change the size of the floating element —
|
||||
* for instance, prevent it from overflowing the clipping boundary or match the
|
||||
* width of the reference element.
|
||||
* @see https://floating-ui.com/docs/size
|
||||
*/
|
||||
export declare const size: (options?: SizeOptions | Derivable<SizeOptions>) => Middleware;
|
||||
|
||||
export declare type SizeOptions = Prettify<Omit<SizeOptions_2, 'apply' | 'boundary'> & DetectOverflowOptions & {
|
||||
/**
|
||||
* Function that is called to perform style mutations to the floating element
|
||||
* to change its size.
|
||||
* @default undefined
|
||||
*/
|
||||
apply?(args: MiddlewareState & {
|
||||
availableWidth: number;
|
||||
availableHeight: number;
|
||||
}): Promisable<void>;
|
||||
}>;
|
||||
|
||||
export { Strategy }
|
||||
|
||||
/**
|
||||
* Custom positioning reference element.
|
||||
* @see https://floating-ui.com/docs/virtual-elements
|
||||
*/
|
||||
export declare interface VirtualElement {
|
||||
getBoundingClientRect(): ClientRectObject;
|
||||
getClientRects?(): Array<ClientRectObject> | DOMRectList;
|
||||
contextElement?: Element;
|
||||
}
|
||||
|
||||
export { }
|
||||
|
|
@ -0,0 +1,781 @@
|
|||
import { rectToClientRect, arrow as arrow$1, autoPlacement as autoPlacement$1, detectOverflow as detectOverflow$1, flip as flip$1, hide as hide$1, inline as inline$1, limitShift as limitShift$1, offset as offset$1, shift as shift$1, size as size$1, computePosition as computePosition$1 } from '@floating-ui/core';
|
||||
import { round, createCoords, max, min, floor } from '@floating-ui/utils';
|
||||
import { getComputedStyle as getComputedStyle$1, isHTMLElement, isElement, getWindow, isWebKit, getFrameElement, getNodeScroll, getDocumentElement, isTopLayer, getNodeName, isOverflowElement, getOverflowAncestors, getParentNode, isLastTraversableNode, isContainingBlock, isTableElement, getContainingBlock } from '@floating-ui/utils/dom';
|
||||
export { getOverflowAncestors } from '@floating-ui/utils/dom';
|
||||
|
||||
function getCssDimensions(element) {
|
||||
const css = getComputedStyle$1(element);
|
||||
// In testing environments, the `width` and `height` properties are empty
|
||||
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
|
||||
let width = parseFloat(css.width) || 0;
|
||||
let height = parseFloat(css.height) || 0;
|
||||
const hasOffset = isHTMLElement(element);
|
||||
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
||||
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
||||
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
||||
if (shouldFallback) {
|
||||
width = offsetWidth;
|
||||
height = offsetHeight;
|
||||
}
|
||||
return {
|
||||
width,
|
||||
height,
|
||||
$: shouldFallback
|
||||
};
|
||||
}
|
||||
|
||||
function unwrapElement(element) {
|
||||
return !isElement(element) ? element.contextElement : element;
|
||||
}
|
||||
|
||||
function getScale(element) {
|
||||
const domElement = unwrapElement(element);
|
||||
if (!isHTMLElement(domElement)) {
|
||||
return createCoords(1);
|
||||
}
|
||||
const rect = domElement.getBoundingClientRect();
|
||||
const {
|
||||
width,
|
||||
height,
|
||||
$
|
||||
} = getCssDimensions(domElement);
|
||||
let x = ($ ? round(rect.width) : rect.width) / width;
|
||||
let y = ($ ? round(rect.height) : rect.height) / height;
|
||||
|
||||
// 0, NaN, or Infinity should always fallback to 1.
|
||||
|
||||
if (!x || !Number.isFinite(x)) {
|
||||
x = 1;
|
||||
}
|
||||
if (!y || !Number.isFinite(y)) {
|
||||
y = 1;
|
||||
}
|
||||
return {
|
||||
x,
|
||||
y
|
||||
};
|
||||
}
|
||||
|
||||
const noOffsets = /*#__PURE__*/createCoords(0);
|
||||
function getVisualOffsets(element) {
|
||||
const win = getWindow(element);
|
||||
if (!isWebKit() || !win.visualViewport) {
|
||||
return noOffsets;
|
||||
}
|
||||
return {
|
||||
x: win.visualViewport.offsetLeft,
|
||||
y: win.visualViewport.offsetTop
|
||||
};
|
||||
}
|
||||
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
||||
if (isFixed === void 0) {
|
||||
isFixed = false;
|
||||
}
|
||||
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
||||
return false;
|
||||
}
|
||||
return isFixed;
|
||||
}
|
||||
|
||||
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
||||
if (includeScale === void 0) {
|
||||
includeScale = false;
|
||||
}
|
||||
if (isFixedStrategy === void 0) {
|
||||
isFixedStrategy = false;
|
||||
}
|
||||
const clientRect = element.getBoundingClientRect();
|
||||
const domElement = unwrapElement(element);
|
||||
let scale = createCoords(1);
|
||||
if (includeScale) {
|
||||
if (offsetParent) {
|
||||
if (isElement(offsetParent)) {
|
||||
scale = getScale(offsetParent);
|
||||
}
|
||||
} else {
|
||||
scale = getScale(element);
|
||||
}
|
||||
}
|
||||
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
||||
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
||||
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
||||
let width = clientRect.width / scale.x;
|
||||
let height = clientRect.height / scale.y;
|
||||
if (domElement) {
|
||||
const win = getWindow(domElement);
|
||||
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
||||
let currentWin = win;
|
||||
let currentIFrame = getFrameElement(currentWin);
|
||||
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
||||
const iframeScale = getScale(currentIFrame);
|
||||
const iframeRect = currentIFrame.getBoundingClientRect();
|
||||
const css = getComputedStyle$1(currentIFrame);
|
||||
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
||||
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
||||
x *= iframeScale.x;
|
||||
y *= iframeScale.y;
|
||||
width *= iframeScale.x;
|
||||
height *= iframeScale.y;
|
||||
x += left;
|
||||
y += top;
|
||||
currentWin = getWindow(currentIFrame);
|
||||
currentIFrame = getFrameElement(currentWin);
|
||||
}
|
||||
}
|
||||
return rectToClientRect({
|
||||
width,
|
||||
height,
|
||||
x,
|
||||
y
|
||||
});
|
||||
}
|
||||
|
||||
// If <html> has a CSS width greater than the viewport, then this will be
|
||||
// incorrect for RTL.
|
||||
function getWindowScrollBarX(element, rect) {
|
||||
const leftScroll = getNodeScroll(element).scrollLeft;
|
||||
if (!rect) {
|
||||
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
||||
}
|
||||
return rect.left + leftScroll;
|
||||
}
|
||||
|
||||
function getHTMLOffset(documentElement, scroll) {
|
||||
const htmlRect = documentElement.getBoundingClientRect();
|
||||
const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
|
||||
const y = htmlRect.top + scroll.scrollTop;
|
||||
return {
|
||||
x,
|
||||
y
|
||||
};
|
||||
}
|
||||
|
||||
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
||||
let {
|
||||
elements,
|
||||
rect,
|
||||
offsetParent,
|
||||
strategy
|
||||
} = _ref;
|
||||
const isFixed = strategy === 'fixed';
|
||||
const documentElement = getDocumentElement(offsetParent);
|
||||
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
||||
if (offsetParent === documentElement || topLayer && isFixed) {
|
||||
return rect;
|
||||
}
|
||||
let scroll = {
|
||||
scrollLeft: 0,
|
||||
scrollTop: 0
|
||||
};
|
||||
let scale = createCoords(1);
|
||||
const offsets = createCoords(0);
|
||||
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
||||
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
||||
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
||||
scroll = getNodeScroll(offsetParent);
|
||||
}
|
||||
if (isOffsetParentAnElement) {
|
||||
const offsetRect = getBoundingClientRect(offsetParent);
|
||||
scale = getScale(offsetParent);
|
||||
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
||||
offsets.y = offsetRect.y + offsetParent.clientTop;
|
||||
}
|
||||
}
|
||||
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
||||
return {
|
||||
width: rect.width * scale.x,
|
||||
height: rect.height * scale.y,
|
||||
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
||||
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
||||
};
|
||||
}
|
||||
|
||||
function getClientRects(element) {
|
||||
return Array.from(element.getClientRects());
|
||||
}
|
||||
|
||||
// Gets the entire size of the scrollable document area, even extending outside
|
||||
// of the `<html>` and `<body>` rect bounds if horizontally scrollable.
|
||||
function getDocumentRect(element) {
|
||||
const html = getDocumentElement(element);
|
||||
const scroll = getNodeScroll(element);
|
||||
const body = element.ownerDocument.body;
|
||||
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
||||
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
||||
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
||||
const y = -scroll.scrollTop;
|
||||
if (getComputedStyle$1(body).direction === 'rtl') {
|
||||
x += max(html.clientWidth, body.clientWidth) - width;
|
||||
}
|
||||
return {
|
||||
width,
|
||||
height,
|
||||
x,
|
||||
y
|
||||
};
|
||||
}
|
||||
|
||||
// Safety check: ensure the scrollbar space is reasonable in case this
|
||||
// calculation is affected by unusual styles.
|
||||
// Most scrollbars leave 15-18px of space.
|
||||
const SCROLLBAR_MAX = 25;
|
||||
function getViewportRect(element, strategy) {
|
||||
const win = getWindow(element);
|
||||
const html = getDocumentElement(element);
|
||||
const visualViewport = win.visualViewport;
|
||||
let width = html.clientWidth;
|
||||
let height = html.clientHeight;
|
||||
let x = 0;
|
||||
let y = 0;
|
||||
if (visualViewport) {
|
||||
width = visualViewport.width;
|
||||
height = visualViewport.height;
|
||||
const visualViewportBased = isWebKit();
|
||||
if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
|
||||
x = visualViewport.offsetLeft;
|
||||
y = visualViewport.offsetTop;
|
||||
}
|
||||
}
|
||||
const windowScrollbarX = getWindowScrollBarX(html);
|
||||
// <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
|
||||
// visual width of the <html> but this is not considered in the size
|
||||
// of `html.clientWidth`.
|
||||
if (windowScrollbarX <= 0) {
|
||||
const doc = html.ownerDocument;
|
||||
const body = doc.body;
|
||||
const bodyStyles = getComputedStyle(body);
|
||||
const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
|
||||
const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
|
||||
if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
|
||||
width -= clippingStableScrollbarWidth;
|
||||
}
|
||||
} else if (windowScrollbarX <= SCROLLBAR_MAX) {
|
||||
// If the <body> scrollbar is on the left, the width needs to be extended
|
||||
// by the scrollbar amount so there isn't extra space on the right.
|
||||
width += windowScrollbarX;
|
||||
}
|
||||
return {
|
||||
width,
|
||||
height,
|
||||
x,
|
||||
y
|
||||
};
|
||||
}
|
||||
|
||||
// Returns the inner client rect, subtracting scrollbars if present.
|
||||
function getInnerBoundingClientRect(element, strategy) {
|
||||
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
||||
const top = clientRect.top + element.clientTop;
|
||||
const left = clientRect.left + element.clientLeft;
|
||||
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
||||
const width = element.clientWidth * scale.x;
|
||||
const height = element.clientHeight * scale.y;
|
||||
const x = left * scale.x;
|
||||
const y = top * scale.y;
|
||||
return {
|
||||
width,
|
||||
height,
|
||||
x,
|
||||
y
|
||||
};
|
||||
}
|
||||
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
||||
let rect;
|
||||
if (clippingAncestor === 'viewport') {
|
||||
rect = getViewportRect(element, strategy);
|
||||
} else if (clippingAncestor === 'document') {
|
||||
rect = getDocumentRect(getDocumentElement(element));
|
||||
} else if (isElement(clippingAncestor)) {
|
||||
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
||||
} else {
|
||||
const visualOffsets = getVisualOffsets(element);
|
||||
rect = {
|
||||
x: clippingAncestor.x - visualOffsets.x,
|
||||
y: clippingAncestor.y - visualOffsets.y,
|
||||
width: clippingAncestor.width,
|
||||
height: clippingAncestor.height
|
||||
};
|
||||
}
|
||||
return rectToClientRect(rect);
|
||||
}
|
||||
function hasFixedPositionAncestor(element, stopNode) {
|
||||
const parentNode = getParentNode(element);
|
||||
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
||||
return false;
|
||||
}
|
||||
return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
||||
}
|
||||
|
||||
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
||||
// clipping (or hiding) child elements. This returns all clipping ancestors
|
||||
// of the given element up the tree.
|
||||
function getClippingElementAncestors(element, cache) {
|
||||
const cachedResult = cache.get(element);
|
||||
if (cachedResult) {
|
||||
return cachedResult;
|
||||
}
|
||||
let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
||||
let currentContainingBlockComputedStyle = null;
|
||||
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
|
||||
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
||||
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
||||
const computedStyle = getComputedStyle$1(currentNode);
|
||||
const currentNodeIsContaining = isContainingBlock(currentNode);
|
||||
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
||||
currentContainingBlockComputedStyle = null;
|
||||
}
|
||||
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === 'absolute' || currentContainingBlockComputedStyle.position === 'fixed') || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
||||
if (shouldDropCurrentNode) {
|
||||
// Drop non-containing blocks.
|
||||
result = result.filter(ancestor => ancestor !== currentNode);
|
||||
} else {
|
||||
// Record last containing block for next iteration.
|
||||
currentContainingBlockComputedStyle = computedStyle;
|
||||
}
|
||||
currentNode = getParentNode(currentNode);
|
||||
}
|
||||
cache.set(element, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
// Gets the maximum area that the element is visible in due to any number of
|
||||
// clipping ancestors.
|
||||
function getClippingRect(_ref) {
|
||||
let {
|
||||
element,
|
||||
boundary,
|
||||
rootBoundary,
|
||||
strategy
|
||||
} = _ref;
|
||||
const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
||||
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
||||
const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
|
||||
let top = firstRect.top;
|
||||
let right = firstRect.right;
|
||||
let bottom = firstRect.bottom;
|
||||
let left = firstRect.left;
|
||||
for (let i = 1; i < clippingAncestors.length; i++) {
|
||||
const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
|
||||
top = max(rect.top, top);
|
||||
right = min(rect.right, right);
|
||||
bottom = min(rect.bottom, bottom);
|
||||
left = max(rect.left, left);
|
||||
}
|
||||
return {
|
||||
width: right - left,
|
||||
height: bottom - top,
|
||||
x: left,
|
||||
y: top
|
||||
};
|
||||
}
|
||||
|
||||
function getDimensions(element) {
|
||||
const {
|
||||
width,
|
||||
height
|
||||
} = getCssDimensions(element);
|
||||
return {
|
||||
width,
|
||||
height
|
||||
};
|
||||
}
|
||||
|
||||
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
||||
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
||||
const documentElement = getDocumentElement(offsetParent);
|
||||
const isFixed = strategy === 'fixed';
|
||||
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
||||
let scroll = {
|
||||
scrollLeft: 0,
|
||||
scrollTop: 0
|
||||
};
|
||||
const offsets = createCoords(0);
|
||||
|
||||
// If the <body> scrollbar appears on the left (e.g. RTL systems). Use
|
||||
// Firefox with layout.scrollbar.side = 3 in about:config to test this.
|
||||
function setLeftRTLScrollbarOffset() {
|
||||
offsets.x = getWindowScrollBarX(documentElement);
|
||||
}
|
||||
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
||||
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
||||
scroll = getNodeScroll(offsetParent);
|
||||
}
|
||||
if (isOffsetParentAnElement) {
|
||||
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
||||
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
||||
offsets.y = offsetRect.y + offsetParent.clientTop;
|
||||
} else if (documentElement) {
|
||||
setLeftRTLScrollbarOffset();
|
||||
}
|
||||
}
|
||||
if (isFixed && !isOffsetParentAnElement && documentElement) {
|
||||
setLeftRTLScrollbarOffset();
|
||||
}
|
||||
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
||||
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
||||
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
||||
return {
|
||||
x,
|
||||
y,
|
||||
width: rect.width,
|
||||
height: rect.height
|
||||
};
|
||||
}
|
||||
|
||||
function isStaticPositioned(element) {
|
||||
return getComputedStyle$1(element).position === 'static';
|
||||
}
|
||||
|
||||
function getTrueOffsetParent(element, polyfill) {
|
||||
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
|
||||
return null;
|
||||
}
|
||||
if (polyfill) {
|
||||
return polyfill(element);
|
||||
}
|
||||
let rawOffsetParent = element.offsetParent;
|
||||
|
||||
// Firefox returns the <html> element as the offsetParent if it's non-static,
|
||||
// while Chrome and Safari return the <body> element. The <body> element must
|
||||
// be used to perform the correct calculations even if the <html> element is
|
||||
// non-static.
|
||||
if (getDocumentElement(element) === rawOffsetParent) {
|
||||
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
||||
}
|
||||
return rawOffsetParent;
|
||||
}
|
||||
|
||||
// Gets the closest ancestor positioned element. Handles some edge cases,
|
||||
// such as table ancestors and cross browser bugs.
|
||||
function getOffsetParent(element, polyfill) {
|
||||
const win = getWindow(element);
|
||||
if (isTopLayer(element)) {
|
||||
return win;
|
||||
}
|
||||
if (!isHTMLElement(element)) {
|
||||
let svgOffsetParent = getParentNode(element);
|
||||
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
||||
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
||||
return svgOffsetParent;
|
||||
}
|
||||
svgOffsetParent = getParentNode(svgOffsetParent);
|
||||
}
|
||||
return win;
|
||||
}
|
||||
let offsetParent = getTrueOffsetParent(element, polyfill);
|
||||
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
||||
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
||||
}
|
||||
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
||||
return win;
|
||||
}
|
||||
return offsetParent || getContainingBlock(element) || win;
|
||||
}
|
||||
|
||||
const getElementRects = async function (data) {
|
||||
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
||||
const getDimensionsFn = this.getDimensions;
|
||||
const floatingDimensions = await getDimensionsFn(data.floating);
|
||||
return {
|
||||
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
||||
floating: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: floatingDimensions.width,
|
||||
height: floatingDimensions.height
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
function isRTL(element) {
|
||||
return getComputedStyle$1(element).direction === 'rtl';
|
||||
}
|
||||
|
||||
const platform = {
|
||||
convertOffsetParentRelativeRectToViewportRelativeRect,
|
||||
getDocumentElement,
|
||||
getClippingRect,
|
||||
getOffsetParent,
|
||||
getElementRects,
|
||||
getClientRects,
|
||||
getDimensions,
|
||||
getScale,
|
||||
isElement,
|
||||
isRTL
|
||||
};
|
||||
|
||||
function rectsAreEqual(a, b) {
|
||||
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
||||
}
|
||||
|
||||
// https://samthor.au/2021/observing-dom/
|
||||
function observeMove(element, onMove) {
|
||||
let io = null;
|
||||
let timeoutId;
|
||||
const root = getDocumentElement(element);
|
||||
function cleanup() {
|
||||
var _io;
|
||||
clearTimeout(timeoutId);
|
||||
(_io = io) == null || _io.disconnect();
|
||||
io = null;
|
||||
}
|
||||
function refresh(skip, threshold) {
|
||||
if (skip === void 0) {
|
||||
skip = false;
|
||||
}
|
||||
if (threshold === void 0) {
|
||||
threshold = 1;
|
||||
}
|
||||
cleanup();
|
||||
const elementRectForRootMargin = element.getBoundingClientRect();
|
||||
const {
|
||||
left,
|
||||
top,
|
||||
width,
|
||||
height
|
||||
} = elementRectForRootMargin;
|
||||
if (!skip) {
|
||||
onMove();
|
||||
}
|
||||
if (!width || !height) {
|
||||
return;
|
||||
}
|
||||
const insetTop = floor(top);
|
||||
const insetRight = floor(root.clientWidth - (left + width));
|
||||
const insetBottom = floor(root.clientHeight - (top + height));
|
||||
const insetLeft = floor(left);
|
||||
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
||||
const options = {
|
||||
rootMargin,
|
||||
threshold: max(0, min(1, threshold)) || 1
|
||||
};
|
||||
let isFirstUpdate = true;
|
||||
function handleObserve(entries) {
|
||||
const ratio = entries[0].intersectionRatio;
|
||||
if (ratio !== threshold) {
|
||||
if (!isFirstUpdate) {
|
||||
return refresh();
|
||||
}
|
||||
if (!ratio) {
|
||||
// If the reference is clipped, the ratio is 0. Throttle the refresh
|
||||
// to prevent an infinite loop of updates.
|
||||
timeoutId = setTimeout(() => {
|
||||
refresh(false, 1e-7);
|
||||
}, 1000);
|
||||
} else {
|
||||
refresh(false, ratio);
|
||||
}
|
||||
}
|
||||
if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
|
||||
// It's possible that even though the ratio is reported as 1, the
|
||||
// element is not actually fully within the IntersectionObserver's root
|
||||
// area anymore. This can happen under performance constraints. This may
|
||||
// be a bug in the browser's IntersectionObserver implementation. To
|
||||
// work around this, we compare the element's bounding rect now with
|
||||
// what it was at the time we created the IntersectionObserver. If they
|
||||
// are not equal then the element moved, so we refresh.
|
||||
refresh();
|
||||
}
|
||||
isFirstUpdate = false;
|
||||
}
|
||||
|
||||
// Older browsers don't support a `document` as the root and will throw an
|
||||
// error.
|
||||
try {
|
||||
io = new IntersectionObserver(handleObserve, {
|
||||
...options,
|
||||
// Handle <iframe>s
|
||||
root: root.ownerDocument
|
||||
});
|
||||
} catch (_e) {
|
||||
io = new IntersectionObserver(handleObserve, options);
|
||||
}
|
||||
io.observe(element);
|
||||
}
|
||||
refresh(true);
|
||||
return cleanup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Automatically updates the position of the floating element when necessary.
|
||||
* Should only be called when the floating element is mounted on the DOM or
|
||||
* visible on the screen.
|
||||
* @returns cleanup function that should be invoked when the floating element is
|
||||
* removed from the DOM or hidden from the screen.
|
||||
* @see https://floating-ui.com/docs/autoUpdate
|
||||
*/
|
||||
function autoUpdate(reference, floating, update, options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
const {
|
||||
ancestorScroll = true,
|
||||
ancestorResize = true,
|
||||
elementResize = typeof ResizeObserver === 'function',
|
||||
layoutShift = typeof IntersectionObserver === 'function',
|
||||
animationFrame = false
|
||||
} = options;
|
||||
const referenceEl = unwrapElement(reference);
|
||||
const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...(floating ? getOverflowAncestors(floating) : [])] : [];
|
||||
ancestors.forEach(ancestor => {
|
||||
ancestorScroll && ancestor.addEventListener('scroll', update, {
|
||||
passive: true
|
||||
});
|
||||
ancestorResize && ancestor.addEventListener('resize', update);
|
||||
});
|
||||
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
||||
let reobserveFrame = -1;
|
||||
let resizeObserver = null;
|
||||
if (elementResize) {
|
||||
resizeObserver = new ResizeObserver(_ref => {
|
||||
let [firstEntry] = _ref;
|
||||
if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
|
||||
// Prevent update loops when using the `size` middleware.
|
||||
// https://github.com/floating-ui/floating-ui/issues/1740
|
||||
resizeObserver.unobserve(floating);
|
||||
cancelAnimationFrame(reobserveFrame);
|
||||
reobserveFrame = requestAnimationFrame(() => {
|
||||
var _resizeObserver;
|
||||
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
||||
});
|
||||
}
|
||||
update();
|
||||
});
|
||||
if (referenceEl && !animationFrame) {
|
||||
resizeObserver.observe(referenceEl);
|
||||
}
|
||||
if (floating) {
|
||||
resizeObserver.observe(floating);
|
||||
}
|
||||
}
|
||||
let frameId;
|
||||
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
||||
if (animationFrame) {
|
||||
frameLoop();
|
||||
}
|
||||
function frameLoop() {
|
||||
const nextRefRect = getBoundingClientRect(reference);
|
||||
if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
|
||||
update();
|
||||
}
|
||||
prevRefRect = nextRefRect;
|
||||
frameId = requestAnimationFrame(frameLoop);
|
||||
}
|
||||
update();
|
||||
return () => {
|
||||
var _resizeObserver2;
|
||||
ancestors.forEach(ancestor => {
|
||||
ancestorScroll && ancestor.removeEventListener('scroll', update);
|
||||
ancestorResize && ancestor.removeEventListener('resize', update);
|
||||
});
|
||||
cleanupIo == null || cleanupIo();
|
||||
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
||||
resizeObserver = null;
|
||||
if (animationFrame) {
|
||||
cancelAnimationFrame(frameId);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves with an object of overflow side offsets that determine how much the
|
||||
* element is overflowing a given clipping boundary on each side.
|
||||
* - positive = overflowing the boundary by that number of pixels
|
||||
* - negative = how many pixels left before it will overflow
|
||||
* - 0 = lies flush with the boundary
|
||||
* @see https://floating-ui.com/docs/detectOverflow
|
||||
*/
|
||||
const detectOverflow = detectOverflow$1;
|
||||
|
||||
/**
|
||||
* Modifies the placement by translating the floating element along the
|
||||
* specified axes.
|
||||
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
||||
* object may be passed.
|
||||
* @see https://floating-ui.com/docs/offset
|
||||
*/
|
||||
const offset = offset$1;
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by choosing the placement
|
||||
* that has the most space available automatically, without needing to specify a
|
||||
* preferred placement. Alternative to `flip`.
|
||||
* @see https://floating-ui.com/docs/autoPlacement
|
||||
*/
|
||||
const autoPlacement = autoPlacement$1;
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by shifting it in order to
|
||||
* keep it in view when it will overflow the clipping boundary.
|
||||
* @see https://floating-ui.com/docs/shift
|
||||
*/
|
||||
const shift = shift$1;
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by flipping the `placement`
|
||||
* in order to keep it in view when the preferred placement(s) will overflow the
|
||||
* clipping boundary. Alternative to `autoPlacement`.
|
||||
* @see https://floating-ui.com/docs/flip
|
||||
*/
|
||||
const flip = flip$1;
|
||||
|
||||
/**
|
||||
* Provides data that allows you to change the size of the floating element —
|
||||
* for instance, prevent it from overflowing the clipping boundary or match the
|
||||
* width of the reference element.
|
||||
* @see https://floating-ui.com/docs/size
|
||||
*/
|
||||
const size = size$1;
|
||||
|
||||
/**
|
||||
* Provides data to hide the floating element in applicable situations, such as
|
||||
* when it is not in the same clipping context as the reference element.
|
||||
* @see https://floating-ui.com/docs/hide
|
||||
*/
|
||||
const hide = hide$1;
|
||||
|
||||
/**
|
||||
* Provides data to position an inner element of the floating element so that it
|
||||
* appears centered to the reference element.
|
||||
* @see https://floating-ui.com/docs/arrow
|
||||
*/
|
||||
const arrow = arrow$1;
|
||||
|
||||
/**
|
||||
* Provides improved positioning for inline reference elements that can span
|
||||
* over multiple lines, such as hyperlinks or range selections.
|
||||
* @see https://floating-ui.com/docs/inline
|
||||
*/
|
||||
const inline = inline$1;
|
||||
|
||||
/**
|
||||
* Built-in `limiter` that will stop `shift()` at a certain point.
|
||||
*/
|
||||
const limitShift = limitShift$1;
|
||||
|
||||
/**
|
||||
* Computes the `x` and `y` coordinates that will place the floating element
|
||||
* next to a given reference element.
|
||||
*/
|
||||
const computePosition = (reference, floating, options) => {
|
||||
// This caches the expensive `getClippingElementAncestors` function so that
|
||||
// multiple lifecycle resets re-use the same result. It only lives for a
|
||||
// single call. If other functions become expensive, we can add them as well.
|
||||
const cache = new Map();
|
||||
const mergedOptions = {
|
||||
platform,
|
||||
...options
|
||||
};
|
||||
const platformWithCache = {
|
||||
...mergedOptions.platform,
|
||||
_c: cache
|
||||
};
|
||||
return computePosition$1(reference, floating, {
|
||||
...mergedOptions,
|
||||
platform: platformWithCache
|
||||
});
|
||||
};
|
||||
|
||||
export { arrow, autoPlacement, autoUpdate, computePosition, detectOverflow, flip, hide, inline, limitShift, offset, platform, shift, size };
|
||||
|
|
@ -0,0 +1,781 @@
|
|||
import { rectToClientRect, arrow as arrow$1, autoPlacement as autoPlacement$1, detectOverflow as detectOverflow$1, flip as flip$1, hide as hide$1, inline as inline$1, limitShift as limitShift$1, offset as offset$1, shift as shift$1, size as size$1, computePosition as computePosition$1 } from '@floating-ui/core';
|
||||
import { round, createCoords, max, min, floor } from '@floating-ui/utils';
|
||||
import { getComputedStyle as getComputedStyle$1, isHTMLElement, isElement, getWindow, isWebKit, getFrameElement, getNodeScroll, getDocumentElement, isTopLayer, getNodeName, isOverflowElement, getOverflowAncestors, getParentNode, isLastTraversableNode, isContainingBlock, isTableElement, getContainingBlock } from '@floating-ui/utils/dom';
|
||||
export { getOverflowAncestors } from '@floating-ui/utils/dom';
|
||||
|
||||
function getCssDimensions(element) {
|
||||
const css = getComputedStyle$1(element);
|
||||
// In testing environments, the `width` and `height` properties are empty
|
||||
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
|
||||
let width = parseFloat(css.width) || 0;
|
||||
let height = parseFloat(css.height) || 0;
|
||||
const hasOffset = isHTMLElement(element);
|
||||
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
||||
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
||||
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
||||
if (shouldFallback) {
|
||||
width = offsetWidth;
|
||||
height = offsetHeight;
|
||||
}
|
||||
return {
|
||||
width,
|
||||
height,
|
||||
$: shouldFallback
|
||||
};
|
||||
}
|
||||
|
||||
function unwrapElement(element) {
|
||||
return !isElement(element) ? element.contextElement : element;
|
||||
}
|
||||
|
||||
function getScale(element) {
|
||||
const domElement = unwrapElement(element);
|
||||
if (!isHTMLElement(domElement)) {
|
||||
return createCoords(1);
|
||||
}
|
||||
const rect = domElement.getBoundingClientRect();
|
||||
const {
|
||||
width,
|
||||
height,
|
||||
$
|
||||
} = getCssDimensions(domElement);
|
||||
let x = ($ ? round(rect.width) : rect.width) / width;
|
||||
let y = ($ ? round(rect.height) : rect.height) / height;
|
||||
|
||||
// 0, NaN, or Infinity should always fallback to 1.
|
||||
|
||||
if (!x || !Number.isFinite(x)) {
|
||||
x = 1;
|
||||
}
|
||||
if (!y || !Number.isFinite(y)) {
|
||||
y = 1;
|
||||
}
|
||||
return {
|
||||
x,
|
||||
y
|
||||
};
|
||||
}
|
||||
|
||||
const noOffsets = /*#__PURE__*/createCoords(0);
|
||||
function getVisualOffsets(element) {
|
||||
const win = getWindow(element);
|
||||
if (!isWebKit() || !win.visualViewport) {
|
||||
return noOffsets;
|
||||
}
|
||||
return {
|
||||
x: win.visualViewport.offsetLeft,
|
||||
y: win.visualViewport.offsetTop
|
||||
};
|
||||
}
|
||||
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
||||
if (isFixed === void 0) {
|
||||
isFixed = false;
|
||||
}
|
||||
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
||||
return false;
|
||||
}
|
||||
return isFixed;
|
||||
}
|
||||
|
||||
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
||||
if (includeScale === void 0) {
|
||||
includeScale = false;
|
||||
}
|
||||
if (isFixedStrategy === void 0) {
|
||||
isFixedStrategy = false;
|
||||
}
|
||||
const clientRect = element.getBoundingClientRect();
|
||||
const domElement = unwrapElement(element);
|
||||
let scale = createCoords(1);
|
||||
if (includeScale) {
|
||||
if (offsetParent) {
|
||||
if (isElement(offsetParent)) {
|
||||
scale = getScale(offsetParent);
|
||||
}
|
||||
} else {
|
||||
scale = getScale(element);
|
||||
}
|
||||
}
|
||||
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
||||
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
||||
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
||||
let width = clientRect.width / scale.x;
|
||||
let height = clientRect.height / scale.y;
|
||||
if (domElement) {
|
||||
const win = getWindow(domElement);
|
||||
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
||||
let currentWin = win;
|
||||
let currentIFrame = getFrameElement(currentWin);
|
||||
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
||||
const iframeScale = getScale(currentIFrame);
|
||||
const iframeRect = currentIFrame.getBoundingClientRect();
|
||||
const css = getComputedStyle$1(currentIFrame);
|
||||
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
||||
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
||||
x *= iframeScale.x;
|
||||
y *= iframeScale.y;
|
||||
width *= iframeScale.x;
|
||||
height *= iframeScale.y;
|
||||
x += left;
|
||||
y += top;
|
||||
currentWin = getWindow(currentIFrame);
|
||||
currentIFrame = getFrameElement(currentWin);
|
||||
}
|
||||
}
|
||||
return rectToClientRect({
|
||||
width,
|
||||
height,
|
||||
x,
|
||||
y
|
||||
});
|
||||
}
|
||||
|
||||
// If <html> has a CSS width greater than the viewport, then this will be
|
||||
// incorrect for RTL.
|
||||
function getWindowScrollBarX(element, rect) {
|
||||
const leftScroll = getNodeScroll(element).scrollLeft;
|
||||
if (!rect) {
|
||||
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
||||
}
|
||||
return rect.left + leftScroll;
|
||||
}
|
||||
|
||||
function getHTMLOffset(documentElement, scroll) {
|
||||
const htmlRect = documentElement.getBoundingClientRect();
|
||||
const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
|
||||
const y = htmlRect.top + scroll.scrollTop;
|
||||
return {
|
||||
x,
|
||||
y
|
||||
};
|
||||
}
|
||||
|
||||
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
||||
let {
|
||||
elements,
|
||||
rect,
|
||||
offsetParent,
|
||||
strategy
|
||||
} = _ref;
|
||||
const isFixed = strategy === 'fixed';
|
||||
const documentElement = getDocumentElement(offsetParent);
|
||||
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
||||
if (offsetParent === documentElement || topLayer && isFixed) {
|
||||
return rect;
|
||||
}
|
||||
let scroll = {
|
||||
scrollLeft: 0,
|
||||
scrollTop: 0
|
||||
};
|
||||
let scale = createCoords(1);
|
||||
const offsets = createCoords(0);
|
||||
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
||||
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
||||
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
||||
scroll = getNodeScroll(offsetParent);
|
||||
}
|
||||
if (isOffsetParentAnElement) {
|
||||
const offsetRect = getBoundingClientRect(offsetParent);
|
||||
scale = getScale(offsetParent);
|
||||
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
||||
offsets.y = offsetRect.y + offsetParent.clientTop;
|
||||
}
|
||||
}
|
||||
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
||||
return {
|
||||
width: rect.width * scale.x,
|
||||
height: rect.height * scale.y,
|
||||
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
||||
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
||||
};
|
||||
}
|
||||
|
||||
function getClientRects(element) {
|
||||
return Array.from(element.getClientRects());
|
||||
}
|
||||
|
||||
// Gets the entire size of the scrollable document area, even extending outside
|
||||
// of the `<html>` and `<body>` rect bounds if horizontally scrollable.
|
||||
function getDocumentRect(element) {
|
||||
const html = getDocumentElement(element);
|
||||
const scroll = getNodeScroll(element);
|
||||
const body = element.ownerDocument.body;
|
||||
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
||||
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
||||
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
||||
const y = -scroll.scrollTop;
|
||||
if (getComputedStyle$1(body).direction === 'rtl') {
|
||||
x += max(html.clientWidth, body.clientWidth) - width;
|
||||
}
|
||||
return {
|
||||
width,
|
||||
height,
|
||||
x,
|
||||
y
|
||||
};
|
||||
}
|
||||
|
||||
// Safety check: ensure the scrollbar space is reasonable in case this
|
||||
// calculation is affected by unusual styles.
|
||||
// Most scrollbars leave 15-18px of space.
|
||||
const SCROLLBAR_MAX = 25;
|
||||
function getViewportRect(element, strategy) {
|
||||
const win = getWindow(element);
|
||||
const html = getDocumentElement(element);
|
||||
const visualViewport = win.visualViewport;
|
||||
let width = html.clientWidth;
|
||||
let height = html.clientHeight;
|
||||
let x = 0;
|
||||
let y = 0;
|
||||
if (visualViewport) {
|
||||
width = visualViewport.width;
|
||||
height = visualViewport.height;
|
||||
const visualViewportBased = isWebKit();
|
||||
if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
|
||||
x = visualViewport.offsetLeft;
|
||||
y = visualViewport.offsetTop;
|
||||
}
|
||||
}
|
||||
const windowScrollbarX = getWindowScrollBarX(html);
|
||||
// <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
|
||||
// visual width of the <html> but this is not considered in the size
|
||||
// of `html.clientWidth`.
|
||||
if (windowScrollbarX <= 0) {
|
||||
const doc = html.ownerDocument;
|
||||
const body = doc.body;
|
||||
const bodyStyles = getComputedStyle(body);
|
||||
const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
|
||||
const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
|
||||
if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
|
||||
width -= clippingStableScrollbarWidth;
|
||||
}
|
||||
} else if (windowScrollbarX <= SCROLLBAR_MAX) {
|
||||
// If the <body> scrollbar is on the left, the width needs to be extended
|
||||
// by the scrollbar amount so there isn't extra space on the right.
|
||||
width += windowScrollbarX;
|
||||
}
|
||||
return {
|
||||
width,
|
||||
height,
|
||||
x,
|
||||
y
|
||||
};
|
||||
}
|
||||
|
||||
// Returns the inner client rect, subtracting scrollbars if present.
|
||||
function getInnerBoundingClientRect(element, strategy) {
|
||||
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
||||
const top = clientRect.top + element.clientTop;
|
||||
const left = clientRect.left + element.clientLeft;
|
||||
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
||||
const width = element.clientWidth * scale.x;
|
||||
const height = element.clientHeight * scale.y;
|
||||
const x = left * scale.x;
|
||||
const y = top * scale.y;
|
||||
return {
|
||||
width,
|
||||
height,
|
||||
x,
|
||||
y
|
||||
};
|
||||
}
|
||||
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
||||
let rect;
|
||||
if (clippingAncestor === 'viewport') {
|
||||
rect = getViewportRect(element, strategy);
|
||||
} else if (clippingAncestor === 'document') {
|
||||
rect = getDocumentRect(getDocumentElement(element));
|
||||
} else if (isElement(clippingAncestor)) {
|
||||
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
||||
} else {
|
||||
const visualOffsets = getVisualOffsets(element);
|
||||
rect = {
|
||||
x: clippingAncestor.x - visualOffsets.x,
|
||||
y: clippingAncestor.y - visualOffsets.y,
|
||||
width: clippingAncestor.width,
|
||||
height: clippingAncestor.height
|
||||
};
|
||||
}
|
||||
return rectToClientRect(rect);
|
||||
}
|
||||
function hasFixedPositionAncestor(element, stopNode) {
|
||||
const parentNode = getParentNode(element);
|
||||
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
||||
return false;
|
||||
}
|
||||
return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
||||
}
|
||||
|
||||
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
||||
// clipping (or hiding) child elements. This returns all clipping ancestors
|
||||
// of the given element up the tree.
|
||||
function getClippingElementAncestors(element, cache) {
|
||||
const cachedResult = cache.get(element);
|
||||
if (cachedResult) {
|
||||
return cachedResult;
|
||||
}
|
||||
let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
||||
let currentContainingBlockComputedStyle = null;
|
||||
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
|
||||
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
||||
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
||||
const computedStyle = getComputedStyle$1(currentNode);
|
||||
const currentNodeIsContaining = isContainingBlock(currentNode);
|
||||
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
||||
currentContainingBlockComputedStyle = null;
|
||||
}
|
||||
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === 'absolute' || currentContainingBlockComputedStyle.position === 'fixed') || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
||||
if (shouldDropCurrentNode) {
|
||||
// Drop non-containing blocks.
|
||||
result = result.filter(ancestor => ancestor !== currentNode);
|
||||
} else {
|
||||
// Record last containing block for next iteration.
|
||||
currentContainingBlockComputedStyle = computedStyle;
|
||||
}
|
||||
currentNode = getParentNode(currentNode);
|
||||
}
|
||||
cache.set(element, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
// Gets the maximum area that the element is visible in due to any number of
|
||||
// clipping ancestors.
|
||||
function getClippingRect(_ref) {
|
||||
let {
|
||||
element,
|
||||
boundary,
|
||||
rootBoundary,
|
||||
strategy
|
||||
} = _ref;
|
||||
const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
||||
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
||||
const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
|
||||
let top = firstRect.top;
|
||||
let right = firstRect.right;
|
||||
let bottom = firstRect.bottom;
|
||||
let left = firstRect.left;
|
||||
for (let i = 1; i < clippingAncestors.length; i++) {
|
||||
const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
|
||||
top = max(rect.top, top);
|
||||
right = min(rect.right, right);
|
||||
bottom = min(rect.bottom, bottom);
|
||||
left = max(rect.left, left);
|
||||
}
|
||||
return {
|
||||
width: right - left,
|
||||
height: bottom - top,
|
||||
x: left,
|
||||
y: top
|
||||
};
|
||||
}
|
||||
|
||||
function getDimensions(element) {
|
||||
const {
|
||||
width,
|
||||
height
|
||||
} = getCssDimensions(element);
|
||||
return {
|
||||
width,
|
||||
height
|
||||
};
|
||||
}
|
||||
|
||||
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
||||
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
||||
const documentElement = getDocumentElement(offsetParent);
|
||||
const isFixed = strategy === 'fixed';
|
||||
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
||||
let scroll = {
|
||||
scrollLeft: 0,
|
||||
scrollTop: 0
|
||||
};
|
||||
const offsets = createCoords(0);
|
||||
|
||||
// If the <body> scrollbar appears on the left (e.g. RTL systems). Use
|
||||
// Firefox with layout.scrollbar.side = 3 in about:config to test this.
|
||||
function setLeftRTLScrollbarOffset() {
|
||||
offsets.x = getWindowScrollBarX(documentElement);
|
||||
}
|
||||
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
||||
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
||||
scroll = getNodeScroll(offsetParent);
|
||||
}
|
||||
if (isOffsetParentAnElement) {
|
||||
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
||||
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
||||
offsets.y = offsetRect.y + offsetParent.clientTop;
|
||||
} else if (documentElement) {
|
||||
setLeftRTLScrollbarOffset();
|
||||
}
|
||||
}
|
||||
if (isFixed && !isOffsetParentAnElement && documentElement) {
|
||||
setLeftRTLScrollbarOffset();
|
||||
}
|
||||
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
||||
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
||||
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
||||
return {
|
||||
x,
|
||||
y,
|
||||
width: rect.width,
|
||||
height: rect.height
|
||||
};
|
||||
}
|
||||
|
||||
function isStaticPositioned(element) {
|
||||
return getComputedStyle$1(element).position === 'static';
|
||||
}
|
||||
|
||||
function getTrueOffsetParent(element, polyfill) {
|
||||
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
|
||||
return null;
|
||||
}
|
||||
if (polyfill) {
|
||||
return polyfill(element);
|
||||
}
|
||||
let rawOffsetParent = element.offsetParent;
|
||||
|
||||
// Firefox returns the <html> element as the offsetParent if it's non-static,
|
||||
// while Chrome and Safari return the <body> element. The <body> element must
|
||||
// be used to perform the correct calculations even if the <html> element is
|
||||
// non-static.
|
||||
if (getDocumentElement(element) === rawOffsetParent) {
|
||||
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
||||
}
|
||||
return rawOffsetParent;
|
||||
}
|
||||
|
||||
// Gets the closest ancestor positioned element. Handles some edge cases,
|
||||
// such as table ancestors and cross browser bugs.
|
||||
function getOffsetParent(element, polyfill) {
|
||||
const win = getWindow(element);
|
||||
if (isTopLayer(element)) {
|
||||
return win;
|
||||
}
|
||||
if (!isHTMLElement(element)) {
|
||||
let svgOffsetParent = getParentNode(element);
|
||||
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
||||
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
||||
return svgOffsetParent;
|
||||
}
|
||||
svgOffsetParent = getParentNode(svgOffsetParent);
|
||||
}
|
||||
return win;
|
||||
}
|
||||
let offsetParent = getTrueOffsetParent(element, polyfill);
|
||||
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
||||
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
||||
}
|
||||
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
||||
return win;
|
||||
}
|
||||
return offsetParent || getContainingBlock(element) || win;
|
||||
}
|
||||
|
||||
const getElementRects = async function (data) {
|
||||
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
||||
const getDimensionsFn = this.getDimensions;
|
||||
const floatingDimensions = await getDimensionsFn(data.floating);
|
||||
return {
|
||||
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
||||
floating: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: floatingDimensions.width,
|
||||
height: floatingDimensions.height
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
function isRTL(element) {
|
||||
return getComputedStyle$1(element).direction === 'rtl';
|
||||
}
|
||||
|
||||
const platform = {
|
||||
convertOffsetParentRelativeRectToViewportRelativeRect,
|
||||
getDocumentElement,
|
||||
getClippingRect,
|
||||
getOffsetParent,
|
||||
getElementRects,
|
||||
getClientRects,
|
||||
getDimensions,
|
||||
getScale,
|
||||
isElement,
|
||||
isRTL
|
||||
};
|
||||
|
||||
function rectsAreEqual(a, b) {
|
||||
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
||||
}
|
||||
|
||||
// https://samthor.au/2021/observing-dom/
|
||||
function observeMove(element, onMove) {
|
||||
let io = null;
|
||||
let timeoutId;
|
||||
const root = getDocumentElement(element);
|
||||
function cleanup() {
|
||||
var _io;
|
||||
clearTimeout(timeoutId);
|
||||
(_io = io) == null || _io.disconnect();
|
||||
io = null;
|
||||
}
|
||||
function refresh(skip, threshold) {
|
||||
if (skip === void 0) {
|
||||
skip = false;
|
||||
}
|
||||
if (threshold === void 0) {
|
||||
threshold = 1;
|
||||
}
|
||||
cleanup();
|
||||
const elementRectForRootMargin = element.getBoundingClientRect();
|
||||
const {
|
||||
left,
|
||||
top,
|
||||
width,
|
||||
height
|
||||
} = elementRectForRootMargin;
|
||||
if (!skip) {
|
||||
onMove();
|
||||
}
|
||||
if (!width || !height) {
|
||||
return;
|
||||
}
|
||||
const insetTop = floor(top);
|
||||
const insetRight = floor(root.clientWidth - (left + width));
|
||||
const insetBottom = floor(root.clientHeight - (top + height));
|
||||
const insetLeft = floor(left);
|
||||
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
||||
const options = {
|
||||
rootMargin,
|
||||
threshold: max(0, min(1, threshold)) || 1
|
||||
};
|
||||
let isFirstUpdate = true;
|
||||
function handleObserve(entries) {
|
||||
const ratio = entries[0].intersectionRatio;
|
||||
if (ratio !== threshold) {
|
||||
if (!isFirstUpdate) {
|
||||
return refresh();
|
||||
}
|
||||
if (!ratio) {
|
||||
// If the reference is clipped, the ratio is 0. Throttle the refresh
|
||||
// to prevent an infinite loop of updates.
|
||||
timeoutId = setTimeout(() => {
|
||||
refresh(false, 1e-7);
|
||||
}, 1000);
|
||||
} else {
|
||||
refresh(false, ratio);
|
||||
}
|
||||
}
|
||||
if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
|
||||
// It's possible that even though the ratio is reported as 1, the
|
||||
// element is not actually fully within the IntersectionObserver's root
|
||||
// area anymore. This can happen under performance constraints. This may
|
||||
// be a bug in the browser's IntersectionObserver implementation. To
|
||||
// work around this, we compare the element's bounding rect now with
|
||||
// what it was at the time we created the IntersectionObserver. If they
|
||||
// are not equal then the element moved, so we refresh.
|
||||
refresh();
|
||||
}
|
||||
isFirstUpdate = false;
|
||||
}
|
||||
|
||||
// Older browsers don't support a `document` as the root and will throw an
|
||||
// error.
|
||||
try {
|
||||
io = new IntersectionObserver(handleObserve, {
|
||||
...options,
|
||||
// Handle <iframe>s
|
||||
root: root.ownerDocument
|
||||
});
|
||||
} catch (_e) {
|
||||
io = new IntersectionObserver(handleObserve, options);
|
||||
}
|
||||
io.observe(element);
|
||||
}
|
||||
refresh(true);
|
||||
return cleanup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Automatically updates the position of the floating element when necessary.
|
||||
* Should only be called when the floating element is mounted on the DOM or
|
||||
* visible on the screen.
|
||||
* @returns cleanup function that should be invoked when the floating element is
|
||||
* removed from the DOM or hidden from the screen.
|
||||
* @see https://floating-ui.com/docs/autoUpdate
|
||||
*/
|
||||
function autoUpdate(reference, floating, update, options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
const {
|
||||
ancestorScroll = true,
|
||||
ancestorResize = true,
|
||||
elementResize = typeof ResizeObserver === 'function',
|
||||
layoutShift = typeof IntersectionObserver === 'function',
|
||||
animationFrame = false
|
||||
} = options;
|
||||
const referenceEl = unwrapElement(reference);
|
||||
const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...(floating ? getOverflowAncestors(floating) : [])] : [];
|
||||
ancestors.forEach(ancestor => {
|
||||
ancestorScroll && ancestor.addEventListener('scroll', update, {
|
||||
passive: true
|
||||
});
|
||||
ancestorResize && ancestor.addEventListener('resize', update);
|
||||
});
|
||||
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
||||
let reobserveFrame = -1;
|
||||
let resizeObserver = null;
|
||||
if (elementResize) {
|
||||
resizeObserver = new ResizeObserver(_ref => {
|
||||
let [firstEntry] = _ref;
|
||||
if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
|
||||
// Prevent update loops when using the `size` middleware.
|
||||
// https://github.com/floating-ui/floating-ui/issues/1740
|
||||
resizeObserver.unobserve(floating);
|
||||
cancelAnimationFrame(reobserveFrame);
|
||||
reobserveFrame = requestAnimationFrame(() => {
|
||||
var _resizeObserver;
|
||||
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
||||
});
|
||||
}
|
||||
update();
|
||||
});
|
||||
if (referenceEl && !animationFrame) {
|
||||
resizeObserver.observe(referenceEl);
|
||||
}
|
||||
if (floating) {
|
||||
resizeObserver.observe(floating);
|
||||
}
|
||||
}
|
||||
let frameId;
|
||||
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
||||
if (animationFrame) {
|
||||
frameLoop();
|
||||
}
|
||||
function frameLoop() {
|
||||
const nextRefRect = getBoundingClientRect(reference);
|
||||
if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
|
||||
update();
|
||||
}
|
||||
prevRefRect = nextRefRect;
|
||||
frameId = requestAnimationFrame(frameLoop);
|
||||
}
|
||||
update();
|
||||
return () => {
|
||||
var _resizeObserver2;
|
||||
ancestors.forEach(ancestor => {
|
||||
ancestorScroll && ancestor.removeEventListener('scroll', update);
|
||||
ancestorResize && ancestor.removeEventListener('resize', update);
|
||||
});
|
||||
cleanupIo == null || cleanupIo();
|
||||
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
||||
resizeObserver = null;
|
||||
if (animationFrame) {
|
||||
cancelAnimationFrame(frameId);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves with an object of overflow side offsets that determine how much the
|
||||
* element is overflowing a given clipping boundary on each side.
|
||||
* - positive = overflowing the boundary by that number of pixels
|
||||
* - negative = how many pixels left before it will overflow
|
||||
* - 0 = lies flush with the boundary
|
||||
* @see https://floating-ui.com/docs/detectOverflow
|
||||
*/
|
||||
const detectOverflow = detectOverflow$1;
|
||||
|
||||
/**
|
||||
* Modifies the placement by translating the floating element along the
|
||||
* specified axes.
|
||||
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
||||
* object may be passed.
|
||||
* @see https://floating-ui.com/docs/offset
|
||||
*/
|
||||
const offset = offset$1;
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by choosing the placement
|
||||
* that has the most space available automatically, without needing to specify a
|
||||
* preferred placement. Alternative to `flip`.
|
||||
* @see https://floating-ui.com/docs/autoPlacement
|
||||
*/
|
||||
const autoPlacement = autoPlacement$1;
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by shifting it in order to
|
||||
* keep it in view when it will overflow the clipping boundary.
|
||||
* @see https://floating-ui.com/docs/shift
|
||||
*/
|
||||
const shift = shift$1;
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by flipping the `placement`
|
||||
* in order to keep it in view when the preferred placement(s) will overflow the
|
||||
* clipping boundary. Alternative to `autoPlacement`.
|
||||
* @see https://floating-ui.com/docs/flip
|
||||
*/
|
||||
const flip = flip$1;
|
||||
|
||||
/**
|
||||
* Provides data that allows you to change the size of the floating element —
|
||||
* for instance, prevent it from overflowing the clipping boundary or match the
|
||||
* width of the reference element.
|
||||
* @see https://floating-ui.com/docs/size
|
||||
*/
|
||||
const size = size$1;
|
||||
|
||||
/**
|
||||
* Provides data to hide the floating element in applicable situations, such as
|
||||
* when it is not in the same clipping context as the reference element.
|
||||
* @see https://floating-ui.com/docs/hide
|
||||
*/
|
||||
const hide = hide$1;
|
||||
|
||||
/**
|
||||
* Provides data to position an inner element of the floating element so that it
|
||||
* appears centered to the reference element.
|
||||
* @see https://floating-ui.com/docs/arrow
|
||||
*/
|
||||
const arrow = arrow$1;
|
||||
|
||||
/**
|
||||
* Provides improved positioning for inline reference elements that can span
|
||||
* over multiple lines, such as hyperlinks or range selections.
|
||||
* @see https://floating-ui.com/docs/inline
|
||||
*/
|
||||
const inline = inline$1;
|
||||
|
||||
/**
|
||||
* Built-in `limiter` that will stop `shift()` at a certain point.
|
||||
*/
|
||||
const limitShift = limitShift$1;
|
||||
|
||||
/**
|
||||
* Computes the `x` and `y` coordinates that will place the floating element
|
||||
* next to a given reference element.
|
||||
*/
|
||||
const computePosition = (reference, floating, options) => {
|
||||
// This caches the expensive `getClippingElementAncestors` function so that
|
||||
// multiple lifecycle resets re-use the same result. It only lives for a
|
||||
// single call. If other functions become expensive, we can add them as well.
|
||||
const cache = new Map();
|
||||
const mergedOptions = {
|
||||
platform,
|
||||
...options
|
||||
};
|
||||
const platformWithCache = {
|
||||
...mergedOptions.platform,
|
||||
_c: cache
|
||||
};
|
||||
return computePosition$1(reference, floating, {
|
||||
...mergedOptions,
|
||||
platform: platformWithCache
|
||||
});
|
||||
};
|
||||
|
||||
export { arrow, autoPlacement, autoUpdate, computePosition, detectOverflow, flip, hide, inline, limitShift, offset, platform, shift, size };
|
||||
|
|
@ -0,0 +1,975 @@
|
|||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@floating-ui/core')) :
|
||||
typeof define === 'function' && define.amd ? define(['exports', '@floating-ui/core'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.FloatingUIDOM = {}, global.FloatingUICore));
|
||||
})(this, (function (exports, core) { 'use strict';
|
||||
|
||||
/**
|
||||
* Custom positioning reference element.
|
||||
* @see https://floating-ui.com/docs/virtual-elements
|
||||
*/
|
||||
|
||||
const min = Math.min;
|
||||
const max = Math.max;
|
||||
const round = Math.round;
|
||||
const floor = Math.floor;
|
||||
const createCoords = v => ({
|
||||
x: v,
|
||||
y: v
|
||||
});
|
||||
|
||||
function hasWindow() {
|
||||
return typeof window !== 'undefined';
|
||||
}
|
||||
function getNodeName(node) {
|
||||
if (isNode(node)) {
|
||||
return (node.nodeName || '').toLowerCase();
|
||||
}
|
||||
// Mocked nodes in testing environments may not be instances of Node. By
|
||||
// returning `#document` an infinite loop won't occur.
|
||||
// https://github.com/floating-ui/floating-ui/issues/2317
|
||||
return '#document';
|
||||
}
|
||||
function getWindow(node) {
|
||||
var _node$ownerDocument;
|
||||
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
||||
}
|
||||
function getDocumentElement(node) {
|
||||
var _ref;
|
||||
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
||||
}
|
||||
function isNode(value) {
|
||||
if (!hasWindow()) {
|
||||
return false;
|
||||
}
|
||||
return value instanceof Node || value instanceof getWindow(value).Node;
|
||||
}
|
||||
function isElement(value) {
|
||||
if (!hasWindow()) {
|
||||
return false;
|
||||
}
|
||||
return value instanceof Element || value instanceof getWindow(value).Element;
|
||||
}
|
||||
function isHTMLElement(value) {
|
||||
if (!hasWindow()) {
|
||||
return false;
|
||||
}
|
||||
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
||||
}
|
||||
function isShadowRoot(value) {
|
||||
if (!hasWindow() || typeof ShadowRoot === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
||||
}
|
||||
function isOverflowElement(element) {
|
||||
const {
|
||||
overflow,
|
||||
overflowX,
|
||||
overflowY,
|
||||
display
|
||||
} = getComputedStyle$1(element);
|
||||
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';
|
||||
}
|
||||
function isTableElement(element) {
|
||||
return /^(table|td|th)$/.test(getNodeName(element));
|
||||
}
|
||||
function isTopLayer(element) {
|
||||
try {
|
||||
if (element.matches(':popover-open')) {
|
||||
return true;
|
||||
}
|
||||
} catch (_e) {
|
||||
// no-op
|
||||
}
|
||||
try {
|
||||
return element.matches(':modal');
|
||||
} catch (_e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
|
||||
const containRe = /paint|layout|strict|content/;
|
||||
const isNotNone = value => !!value && value !== 'none';
|
||||
let isWebKitValue;
|
||||
function isContainingBlock(elementOrCss) {
|
||||
const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
||||
// https://drafts.csswg.org/css-transforms-2/#individual-transforms
|
||||
return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || '') || containRe.test(css.contain || '');
|
||||
}
|
||||
function getContainingBlock(element) {
|
||||
let currentNode = getParentNode(element);
|
||||
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
||||
if (isContainingBlock(currentNode)) {
|
||||
return currentNode;
|
||||
} else if (isTopLayer(currentNode)) {
|
||||
return null;
|
||||
}
|
||||
currentNode = getParentNode(currentNode);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function isWebKit() {
|
||||
if (isWebKitValue == null) {
|
||||
isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');
|
||||
}
|
||||
return isWebKitValue;
|
||||
}
|
||||
function isLastTraversableNode(node) {
|
||||
return /^(html|body|#document)$/.test(getNodeName(node));
|
||||
}
|
||||
function getComputedStyle$1(element) {
|
||||
return getWindow(element).getComputedStyle(element);
|
||||
}
|
||||
function getNodeScroll(element) {
|
||||
if (isElement(element)) {
|
||||
return {
|
||||
scrollLeft: element.scrollLeft,
|
||||
scrollTop: element.scrollTop
|
||||
};
|
||||
}
|
||||
return {
|
||||
scrollLeft: element.scrollX,
|
||||
scrollTop: element.scrollY
|
||||
};
|
||||
}
|
||||
function getParentNode(node) {
|
||||
if (getNodeName(node) === 'html') {
|
||||
return node;
|
||||
}
|
||||
const result =
|
||||
// Step into the shadow DOM of the parent of a slotted node.
|
||||
node.assignedSlot ||
|
||||
// DOM Element detected.
|
||||
node.parentNode ||
|
||||
// ShadowRoot detected.
|
||||
isShadowRoot(node) && node.host ||
|
||||
// Fallback.
|
||||
getDocumentElement(node);
|
||||
return isShadowRoot(result) ? result.host : result;
|
||||
}
|
||||
function getNearestOverflowAncestor(node) {
|
||||
const parentNode = getParentNode(node);
|
||||
if (isLastTraversableNode(parentNode)) {
|
||||
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
||||
}
|
||||
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
||||
return parentNode;
|
||||
}
|
||||
return getNearestOverflowAncestor(parentNode);
|
||||
}
|
||||
function getOverflowAncestors(node, list, traverseIframes) {
|
||||
var _node$ownerDocument2;
|
||||
if (list === void 0) {
|
||||
list = [];
|
||||
}
|
||||
if (traverseIframes === void 0) {
|
||||
traverseIframes = true;
|
||||
}
|
||||
const scrollableAncestor = getNearestOverflowAncestor(node);
|
||||
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
||||
const win = getWindow(scrollableAncestor);
|
||||
if (isBody) {
|
||||
const frameElement = getFrameElement(win);
|
||||
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
||||
} else {
|
||||
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
||||
}
|
||||
}
|
||||
function getFrameElement(win) {
|
||||
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
||||
}
|
||||
|
||||
function getCssDimensions(element) {
|
||||
const css = getComputedStyle$1(element);
|
||||
// In testing environments, the `width` and `height` properties are empty
|
||||
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
|
||||
let width = parseFloat(css.width) || 0;
|
||||
let height = parseFloat(css.height) || 0;
|
||||
const hasOffset = isHTMLElement(element);
|
||||
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
||||
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
||||
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
||||
if (shouldFallback) {
|
||||
width = offsetWidth;
|
||||
height = offsetHeight;
|
||||
}
|
||||
return {
|
||||
width,
|
||||
height,
|
||||
$: shouldFallback
|
||||
};
|
||||
}
|
||||
|
||||
function unwrapElement(element) {
|
||||
return !isElement(element) ? element.contextElement : element;
|
||||
}
|
||||
|
||||
function getScale(element) {
|
||||
const domElement = unwrapElement(element);
|
||||
if (!isHTMLElement(domElement)) {
|
||||
return createCoords(1);
|
||||
}
|
||||
const rect = domElement.getBoundingClientRect();
|
||||
const {
|
||||
width,
|
||||
height,
|
||||
$
|
||||
} = getCssDimensions(domElement);
|
||||
let x = ($ ? round(rect.width) : rect.width) / width;
|
||||
let y = ($ ? round(rect.height) : rect.height) / height;
|
||||
|
||||
// 0, NaN, or Infinity should always fallback to 1.
|
||||
|
||||
if (!x || !Number.isFinite(x)) {
|
||||
x = 1;
|
||||
}
|
||||
if (!y || !Number.isFinite(y)) {
|
||||
y = 1;
|
||||
}
|
||||
return {
|
||||
x,
|
||||
y
|
||||
};
|
||||
}
|
||||
|
||||
const noOffsets = /*#__PURE__*/createCoords(0);
|
||||
function getVisualOffsets(element) {
|
||||
const win = getWindow(element);
|
||||
if (!isWebKit() || !win.visualViewport) {
|
||||
return noOffsets;
|
||||
}
|
||||
return {
|
||||
x: win.visualViewport.offsetLeft,
|
||||
y: win.visualViewport.offsetTop
|
||||
};
|
||||
}
|
||||
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
||||
if (isFixed === void 0) {
|
||||
isFixed = false;
|
||||
}
|
||||
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
||||
return false;
|
||||
}
|
||||
return isFixed;
|
||||
}
|
||||
|
||||
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
||||
if (includeScale === void 0) {
|
||||
includeScale = false;
|
||||
}
|
||||
if (isFixedStrategy === void 0) {
|
||||
isFixedStrategy = false;
|
||||
}
|
||||
const clientRect = element.getBoundingClientRect();
|
||||
const domElement = unwrapElement(element);
|
||||
let scale = createCoords(1);
|
||||
if (includeScale) {
|
||||
if (offsetParent) {
|
||||
if (isElement(offsetParent)) {
|
||||
scale = getScale(offsetParent);
|
||||
}
|
||||
} else {
|
||||
scale = getScale(element);
|
||||
}
|
||||
}
|
||||
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
||||
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
||||
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
||||
let width = clientRect.width / scale.x;
|
||||
let height = clientRect.height / scale.y;
|
||||
if (domElement) {
|
||||
const win = getWindow(domElement);
|
||||
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
||||
let currentWin = win;
|
||||
let currentIFrame = getFrameElement(currentWin);
|
||||
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
||||
const iframeScale = getScale(currentIFrame);
|
||||
const iframeRect = currentIFrame.getBoundingClientRect();
|
||||
const css = getComputedStyle$1(currentIFrame);
|
||||
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
||||
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
||||
x *= iframeScale.x;
|
||||
y *= iframeScale.y;
|
||||
width *= iframeScale.x;
|
||||
height *= iframeScale.y;
|
||||
x += left;
|
||||
y += top;
|
||||
currentWin = getWindow(currentIFrame);
|
||||
currentIFrame = getFrameElement(currentWin);
|
||||
}
|
||||
}
|
||||
return core.rectToClientRect({
|
||||
width,
|
||||
height,
|
||||
x,
|
||||
y
|
||||
});
|
||||
}
|
||||
|
||||
// If <html> has a CSS width greater than the viewport, then this will be
|
||||
// incorrect for RTL.
|
||||
function getWindowScrollBarX(element, rect) {
|
||||
const leftScroll = getNodeScroll(element).scrollLeft;
|
||||
if (!rect) {
|
||||
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
||||
}
|
||||
return rect.left + leftScroll;
|
||||
}
|
||||
|
||||
function getHTMLOffset(documentElement, scroll) {
|
||||
const htmlRect = documentElement.getBoundingClientRect();
|
||||
const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
|
||||
const y = htmlRect.top + scroll.scrollTop;
|
||||
return {
|
||||
x,
|
||||
y
|
||||
};
|
||||
}
|
||||
|
||||
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
||||
let {
|
||||
elements,
|
||||
rect,
|
||||
offsetParent,
|
||||
strategy
|
||||
} = _ref;
|
||||
const isFixed = strategy === 'fixed';
|
||||
const documentElement = getDocumentElement(offsetParent);
|
||||
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
||||
if (offsetParent === documentElement || topLayer && isFixed) {
|
||||
return rect;
|
||||
}
|
||||
let scroll = {
|
||||
scrollLeft: 0,
|
||||
scrollTop: 0
|
||||
};
|
||||
let scale = createCoords(1);
|
||||
const offsets = createCoords(0);
|
||||
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
||||
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
||||
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
||||
scroll = getNodeScroll(offsetParent);
|
||||
}
|
||||
if (isOffsetParentAnElement) {
|
||||
const offsetRect = getBoundingClientRect(offsetParent);
|
||||
scale = getScale(offsetParent);
|
||||
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
||||
offsets.y = offsetRect.y + offsetParent.clientTop;
|
||||
}
|
||||
}
|
||||
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
||||
return {
|
||||
width: rect.width * scale.x,
|
||||
height: rect.height * scale.y,
|
||||
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
||||
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
||||
};
|
||||
}
|
||||
|
||||
function getClientRects(element) {
|
||||
return Array.from(element.getClientRects());
|
||||
}
|
||||
|
||||
// Gets the entire size of the scrollable document area, even extending outside
|
||||
// of the `<html>` and `<body>` rect bounds if horizontally scrollable.
|
||||
function getDocumentRect(element) {
|
||||
const html = getDocumentElement(element);
|
||||
const scroll = getNodeScroll(element);
|
||||
const body = element.ownerDocument.body;
|
||||
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
||||
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
||||
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
||||
const y = -scroll.scrollTop;
|
||||
if (getComputedStyle$1(body).direction === 'rtl') {
|
||||
x += max(html.clientWidth, body.clientWidth) - width;
|
||||
}
|
||||
return {
|
||||
width,
|
||||
height,
|
||||
x,
|
||||
y
|
||||
};
|
||||
}
|
||||
|
||||
// Safety check: ensure the scrollbar space is reasonable in case this
|
||||
// calculation is affected by unusual styles.
|
||||
// Most scrollbars leave 15-18px of space.
|
||||
const SCROLLBAR_MAX = 25;
|
||||
function getViewportRect(element, strategy) {
|
||||
const win = getWindow(element);
|
||||
const html = getDocumentElement(element);
|
||||
const visualViewport = win.visualViewport;
|
||||
let width = html.clientWidth;
|
||||
let height = html.clientHeight;
|
||||
let x = 0;
|
||||
let y = 0;
|
||||
if (visualViewport) {
|
||||
width = visualViewport.width;
|
||||
height = visualViewport.height;
|
||||
const visualViewportBased = isWebKit();
|
||||
if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
|
||||
x = visualViewport.offsetLeft;
|
||||
y = visualViewport.offsetTop;
|
||||
}
|
||||
}
|
||||
const windowScrollbarX = getWindowScrollBarX(html);
|
||||
// <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
|
||||
// visual width of the <html> but this is not considered in the size
|
||||
// of `html.clientWidth`.
|
||||
if (windowScrollbarX <= 0) {
|
||||
const doc = html.ownerDocument;
|
||||
const body = doc.body;
|
||||
const bodyStyles = getComputedStyle(body);
|
||||
const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
|
||||
const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
|
||||
if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
|
||||
width -= clippingStableScrollbarWidth;
|
||||
}
|
||||
} else if (windowScrollbarX <= SCROLLBAR_MAX) {
|
||||
// If the <body> scrollbar is on the left, the width needs to be extended
|
||||
// by the scrollbar amount so there isn't extra space on the right.
|
||||
width += windowScrollbarX;
|
||||
}
|
||||
return {
|
||||
width,
|
||||
height,
|
||||
x,
|
||||
y
|
||||
};
|
||||
}
|
||||
|
||||
// Returns the inner client rect, subtracting scrollbars if present.
|
||||
function getInnerBoundingClientRect(element, strategy) {
|
||||
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
||||
const top = clientRect.top + element.clientTop;
|
||||
const left = clientRect.left + element.clientLeft;
|
||||
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
||||
const width = element.clientWidth * scale.x;
|
||||
const height = element.clientHeight * scale.y;
|
||||
const x = left * scale.x;
|
||||
const y = top * scale.y;
|
||||
return {
|
||||
width,
|
||||
height,
|
||||
x,
|
||||
y
|
||||
};
|
||||
}
|
||||
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
||||
let rect;
|
||||
if (clippingAncestor === 'viewport') {
|
||||
rect = getViewportRect(element, strategy);
|
||||
} else if (clippingAncestor === 'document') {
|
||||
rect = getDocumentRect(getDocumentElement(element));
|
||||
} else if (isElement(clippingAncestor)) {
|
||||
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
||||
} else {
|
||||
const visualOffsets = getVisualOffsets(element);
|
||||
rect = {
|
||||
x: clippingAncestor.x - visualOffsets.x,
|
||||
y: clippingAncestor.y - visualOffsets.y,
|
||||
width: clippingAncestor.width,
|
||||
height: clippingAncestor.height
|
||||
};
|
||||
}
|
||||
return core.rectToClientRect(rect);
|
||||
}
|
||||
function hasFixedPositionAncestor(element, stopNode) {
|
||||
const parentNode = getParentNode(element);
|
||||
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
||||
return false;
|
||||
}
|
||||
return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
||||
}
|
||||
|
||||
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
||||
// clipping (or hiding) child elements. This returns all clipping ancestors
|
||||
// of the given element up the tree.
|
||||
function getClippingElementAncestors(element, cache) {
|
||||
const cachedResult = cache.get(element);
|
||||
if (cachedResult) {
|
||||
return cachedResult;
|
||||
}
|
||||
let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
||||
let currentContainingBlockComputedStyle = null;
|
||||
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
|
||||
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
||||
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
||||
const computedStyle = getComputedStyle$1(currentNode);
|
||||
const currentNodeIsContaining = isContainingBlock(currentNode);
|
||||
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
||||
currentContainingBlockComputedStyle = null;
|
||||
}
|
||||
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === 'absolute' || currentContainingBlockComputedStyle.position === 'fixed') || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
||||
if (shouldDropCurrentNode) {
|
||||
// Drop non-containing blocks.
|
||||
result = result.filter(ancestor => ancestor !== currentNode);
|
||||
} else {
|
||||
// Record last containing block for next iteration.
|
||||
currentContainingBlockComputedStyle = computedStyle;
|
||||
}
|
||||
currentNode = getParentNode(currentNode);
|
||||
}
|
||||
cache.set(element, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
// Gets the maximum area that the element is visible in due to any number of
|
||||
// clipping ancestors.
|
||||
function getClippingRect(_ref) {
|
||||
let {
|
||||
element,
|
||||
boundary,
|
||||
rootBoundary,
|
||||
strategy
|
||||
} = _ref;
|
||||
const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
||||
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
||||
const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
|
||||
let top = firstRect.top;
|
||||
let right = firstRect.right;
|
||||
let bottom = firstRect.bottom;
|
||||
let left = firstRect.left;
|
||||
for (let i = 1; i < clippingAncestors.length; i++) {
|
||||
const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
|
||||
top = max(rect.top, top);
|
||||
right = min(rect.right, right);
|
||||
bottom = min(rect.bottom, bottom);
|
||||
left = max(rect.left, left);
|
||||
}
|
||||
return {
|
||||
width: right - left,
|
||||
height: bottom - top,
|
||||
x: left,
|
||||
y: top
|
||||
};
|
||||
}
|
||||
|
||||
function getDimensions(element) {
|
||||
const {
|
||||
width,
|
||||
height
|
||||
} = getCssDimensions(element);
|
||||
return {
|
||||
width,
|
||||
height
|
||||
};
|
||||
}
|
||||
|
||||
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
||||
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
||||
const documentElement = getDocumentElement(offsetParent);
|
||||
const isFixed = strategy === 'fixed';
|
||||
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
||||
let scroll = {
|
||||
scrollLeft: 0,
|
||||
scrollTop: 0
|
||||
};
|
||||
const offsets = createCoords(0);
|
||||
|
||||
// If the <body> scrollbar appears on the left (e.g. RTL systems). Use
|
||||
// Firefox with layout.scrollbar.side = 3 in about:config to test this.
|
||||
function setLeftRTLScrollbarOffset() {
|
||||
offsets.x = getWindowScrollBarX(documentElement);
|
||||
}
|
||||
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
||||
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
||||
scroll = getNodeScroll(offsetParent);
|
||||
}
|
||||
if (isOffsetParentAnElement) {
|
||||
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
||||
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
||||
offsets.y = offsetRect.y + offsetParent.clientTop;
|
||||
} else if (documentElement) {
|
||||
setLeftRTLScrollbarOffset();
|
||||
}
|
||||
}
|
||||
if (isFixed && !isOffsetParentAnElement && documentElement) {
|
||||
setLeftRTLScrollbarOffset();
|
||||
}
|
||||
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
||||
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
||||
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
||||
return {
|
||||
x,
|
||||
y,
|
||||
width: rect.width,
|
||||
height: rect.height
|
||||
};
|
||||
}
|
||||
|
||||
function isStaticPositioned(element) {
|
||||
return getComputedStyle$1(element).position === 'static';
|
||||
}
|
||||
|
||||
function getTrueOffsetParent(element, polyfill) {
|
||||
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
|
||||
return null;
|
||||
}
|
||||
if (polyfill) {
|
||||
return polyfill(element);
|
||||
}
|
||||
let rawOffsetParent = element.offsetParent;
|
||||
|
||||
// Firefox returns the <html> element as the offsetParent if it's non-static,
|
||||
// while Chrome and Safari return the <body> element. The <body> element must
|
||||
// be used to perform the correct calculations even if the <html> element is
|
||||
// non-static.
|
||||
if (getDocumentElement(element) === rawOffsetParent) {
|
||||
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
||||
}
|
||||
return rawOffsetParent;
|
||||
}
|
||||
|
||||
// Gets the closest ancestor positioned element. Handles some edge cases,
|
||||
// such as table ancestors and cross browser bugs.
|
||||
function getOffsetParent(element, polyfill) {
|
||||
const win = getWindow(element);
|
||||
if (isTopLayer(element)) {
|
||||
return win;
|
||||
}
|
||||
if (!isHTMLElement(element)) {
|
||||
let svgOffsetParent = getParentNode(element);
|
||||
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
||||
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
||||
return svgOffsetParent;
|
||||
}
|
||||
svgOffsetParent = getParentNode(svgOffsetParent);
|
||||
}
|
||||
return win;
|
||||
}
|
||||
let offsetParent = getTrueOffsetParent(element, polyfill);
|
||||
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
||||
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
||||
}
|
||||
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
||||
return win;
|
||||
}
|
||||
return offsetParent || getContainingBlock(element) || win;
|
||||
}
|
||||
|
||||
const getElementRects = async function (data) {
|
||||
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
||||
const getDimensionsFn = this.getDimensions;
|
||||
const floatingDimensions = await getDimensionsFn(data.floating);
|
||||
return {
|
||||
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
||||
floating: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: floatingDimensions.width,
|
||||
height: floatingDimensions.height
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
function isRTL(element) {
|
||||
return getComputedStyle$1(element).direction === 'rtl';
|
||||
}
|
||||
|
||||
const platform = {
|
||||
convertOffsetParentRelativeRectToViewportRelativeRect,
|
||||
getDocumentElement,
|
||||
getClippingRect,
|
||||
getOffsetParent,
|
||||
getElementRects,
|
||||
getClientRects,
|
||||
getDimensions,
|
||||
getScale,
|
||||
isElement,
|
||||
isRTL
|
||||
};
|
||||
|
||||
function rectsAreEqual(a, b) {
|
||||
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
||||
}
|
||||
|
||||
// https://samthor.au/2021/observing-dom/
|
||||
function observeMove(element, onMove) {
|
||||
let io = null;
|
||||
let timeoutId;
|
||||
const root = getDocumentElement(element);
|
||||
function cleanup() {
|
||||
var _io;
|
||||
clearTimeout(timeoutId);
|
||||
(_io = io) == null || _io.disconnect();
|
||||
io = null;
|
||||
}
|
||||
function refresh(skip, threshold) {
|
||||
if (skip === void 0) {
|
||||
skip = false;
|
||||
}
|
||||
if (threshold === void 0) {
|
||||
threshold = 1;
|
||||
}
|
||||
cleanup();
|
||||
const elementRectForRootMargin = element.getBoundingClientRect();
|
||||
const {
|
||||
left,
|
||||
top,
|
||||
width,
|
||||
height
|
||||
} = elementRectForRootMargin;
|
||||
if (!skip) {
|
||||
onMove();
|
||||
}
|
||||
if (!width || !height) {
|
||||
return;
|
||||
}
|
||||
const insetTop = floor(top);
|
||||
const insetRight = floor(root.clientWidth - (left + width));
|
||||
const insetBottom = floor(root.clientHeight - (top + height));
|
||||
const insetLeft = floor(left);
|
||||
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
||||
const options = {
|
||||
rootMargin,
|
||||
threshold: max(0, min(1, threshold)) || 1
|
||||
};
|
||||
let isFirstUpdate = true;
|
||||
function handleObserve(entries) {
|
||||
const ratio = entries[0].intersectionRatio;
|
||||
if (ratio !== threshold) {
|
||||
if (!isFirstUpdate) {
|
||||
return refresh();
|
||||
}
|
||||
if (!ratio) {
|
||||
// If the reference is clipped, the ratio is 0. Throttle the refresh
|
||||
// to prevent an infinite loop of updates.
|
||||
timeoutId = setTimeout(() => {
|
||||
refresh(false, 1e-7);
|
||||
}, 1000);
|
||||
} else {
|
||||
refresh(false, ratio);
|
||||
}
|
||||
}
|
||||
if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
|
||||
// It's possible that even though the ratio is reported as 1, the
|
||||
// element is not actually fully within the IntersectionObserver's root
|
||||
// area anymore. This can happen under performance constraints. This may
|
||||
// be a bug in the browser's IntersectionObserver implementation. To
|
||||
// work around this, we compare the element's bounding rect now with
|
||||
// what it was at the time we created the IntersectionObserver. If they
|
||||
// are not equal then the element moved, so we refresh.
|
||||
refresh();
|
||||
}
|
||||
isFirstUpdate = false;
|
||||
}
|
||||
|
||||
// Older browsers don't support a `document` as the root and will throw an
|
||||
// error.
|
||||
try {
|
||||
io = new IntersectionObserver(handleObserve, {
|
||||
...options,
|
||||
// Handle <iframe>s
|
||||
root: root.ownerDocument
|
||||
});
|
||||
} catch (_e) {
|
||||
io = new IntersectionObserver(handleObserve, options);
|
||||
}
|
||||
io.observe(element);
|
||||
}
|
||||
refresh(true);
|
||||
return cleanup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Automatically updates the position of the floating element when necessary.
|
||||
* Should only be called when the floating element is mounted on the DOM or
|
||||
* visible on the screen.
|
||||
* @returns cleanup function that should be invoked when the floating element is
|
||||
* removed from the DOM or hidden from the screen.
|
||||
* @see https://floating-ui.com/docs/autoUpdate
|
||||
*/
|
||||
function autoUpdate(reference, floating, update, options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
const {
|
||||
ancestorScroll = true,
|
||||
ancestorResize = true,
|
||||
elementResize = typeof ResizeObserver === 'function',
|
||||
layoutShift = typeof IntersectionObserver === 'function',
|
||||
animationFrame = false
|
||||
} = options;
|
||||
const referenceEl = unwrapElement(reference);
|
||||
const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...(floating ? getOverflowAncestors(floating) : [])] : [];
|
||||
ancestors.forEach(ancestor => {
|
||||
ancestorScroll && ancestor.addEventListener('scroll', update, {
|
||||
passive: true
|
||||
});
|
||||
ancestorResize && ancestor.addEventListener('resize', update);
|
||||
});
|
||||
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
||||
let reobserveFrame = -1;
|
||||
let resizeObserver = null;
|
||||
if (elementResize) {
|
||||
resizeObserver = new ResizeObserver(_ref => {
|
||||
let [firstEntry] = _ref;
|
||||
if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
|
||||
// Prevent update loops when using the `size` middleware.
|
||||
// https://github.com/floating-ui/floating-ui/issues/1740
|
||||
resizeObserver.unobserve(floating);
|
||||
cancelAnimationFrame(reobserveFrame);
|
||||
reobserveFrame = requestAnimationFrame(() => {
|
||||
var _resizeObserver;
|
||||
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
||||
});
|
||||
}
|
||||
update();
|
||||
});
|
||||
if (referenceEl && !animationFrame) {
|
||||
resizeObserver.observe(referenceEl);
|
||||
}
|
||||
if (floating) {
|
||||
resizeObserver.observe(floating);
|
||||
}
|
||||
}
|
||||
let frameId;
|
||||
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
||||
if (animationFrame) {
|
||||
frameLoop();
|
||||
}
|
||||
function frameLoop() {
|
||||
const nextRefRect = getBoundingClientRect(reference);
|
||||
if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
|
||||
update();
|
||||
}
|
||||
prevRefRect = nextRefRect;
|
||||
frameId = requestAnimationFrame(frameLoop);
|
||||
}
|
||||
update();
|
||||
return () => {
|
||||
var _resizeObserver2;
|
||||
ancestors.forEach(ancestor => {
|
||||
ancestorScroll && ancestor.removeEventListener('scroll', update);
|
||||
ancestorResize && ancestor.removeEventListener('resize', update);
|
||||
});
|
||||
cleanupIo == null || cleanupIo();
|
||||
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
||||
resizeObserver = null;
|
||||
if (animationFrame) {
|
||||
cancelAnimationFrame(frameId);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves with an object of overflow side offsets that determine how much the
|
||||
* element is overflowing a given clipping boundary on each side.
|
||||
* - positive = overflowing the boundary by that number of pixels
|
||||
* - negative = how many pixels left before it will overflow
|
||||
* - 0 = lies flush with the boundary
|
||||
* @see https://floating-ui.com/docs/detectOverflow
|
||||
*/
|
||||
const detectOverflow = core.detectOverflow;
|
||||
|
||||
/**
|
||||
* Modifies the placement by translating the floating element along the
|
||||
* specified axes.
|
||||
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
||||
* object may be passed.
|
||||
* @see https://floating-ui.com/docs/offset
|
||||
*/
|
||||
const offset = core.offset;
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by choosing the placement
|
||||
* that has the most space available automatically, without needing to specify a
|
||||
* preferred placement. Alternative to `flip`.
|
||||
* @see https://floating-ui.com/docs/autoPlacement
|
||||
*/
|
||||
const autoPlacement = core.autoPlacement;
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by shifting it in order to
|
||||
* keep it in view when it will overflow the clipping boundary.
|
||||
* @see https://floating-ui.com/docs/shift
|
||||
*/
|
||||
const shift = core.shift;
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by flipping the `placement`
|
||||
* in order to keep it in view when the preferred placement(s) will overflow the
|
||||
* clipping boundary. Alternative to `autoPlacement`.
|
||||
* @see https://floating-ui.com/docs/flip
|
||||
*/
|
||||
const flip = core.flip;
|
||||
|
||||
/**
|
||||
* Provides data that allows you to change the size of the floating element —
|
||||
* for instance, prevent it from overflowing the clipping boundary or match the
|
||||
* width of the reference element.
|
||||
* @see https://floating-ui.com/docs/size
|
||||
*/
|
||||
const size = core.size;
|
||||
|
||||
/**
|
||||
* Provides data to hide the floating element in applicable situations, such as
|
||||
* when it is not in the same clipping context as the reference element.
|
||||
* @see https://floating-ui.com/docs/hide
|
||||
*/
|
||||
const hide = core.hide;
|
||||
|
||||
/**
|
||||
* Provides data to position an inner element of the floating element so that it
|
||||
* appears centered to the reference element.
|
||||
* @see https://floating-ui.com/docs/arrow
|
||||
*/
|
||||
const arrow = core.arrow;
|
||||
|
||||
/**
|
||||
* Provides improved positioning for inline reference elements that can span
|
||||
* over multiple lines, such as hyperlinks or range selections.
|
||||
* @see https://floating-ui.com/docs/inline
|
||||
*/
|
||||
const inline = core.inline;
|
||||
|
||||
/**
|
||||
* Built-in `limiter` that will stop `shift()` at a certain point.
|
||||
*/
|
||||
const limitShift = core.limitShift;
|
||||
|
||||
/**
|
||||
* Computes the `x` and `y` coordinates that will place the floating element
|
||||
* next to a given reference element.
|
||||
*/
|
||||
const computePosition = (reference, floating, options) => {
|
||||
// This caches the expensive `getClippingElementAncestors` function so that
|
||||
// multiple lifecycle resets re-use the same result. It only lives for a
|
||||
// single call. If other functions become expensive, we can add them as well.
|
||||
const cache = new Map();
|
||||
const mergedOptions = {
|
||||
platform,
|
||||
...options
|
||||
};
|
||||
const platformWithCache = {
|
||||
...mergedOptions.platform,
|
||||
_c: cache
|
||||
};
|
||||
return core.computePosition(reference, floating, {
|
||||
...mergedOptions,
|
||||
platform: platformWithCache
|
||||
});
|
||||
};
|
||||
|
||||
exports.arrow = arrow;
|
||||
exports.autoPlacement = autoPlacement;
|
||||
exports.autoUpdate = autoUpdate;
|
||||
exports.computePosition = computePosition;
|
||||
exports.detectOverflow = detectOverflow;
|
||||
exports.flip = flip;
|
||||
exports.getOverflowAncestors = getOverflowAncestors;
|
||||
exports.hide = hide;
|
||||
exports.inline = inline;
|
||||
exports.limitShift = limitShift;
|
||||
exports.offset = offset;
|
||||
exports.platform = platform;
|
||||
exports.shift = shift;
|
||||
exports.size = size;
|
||||
|
||||
}));
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
{
|
||||
"name": "@floating-ui/dom",
|
||||
"version": "1.7.6",
|
||||
"description": "Floating UI for the web",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"main": "./dist/floating-ui.dom.umd.js",
|
||||
"module": "./dist/floating-ui.dom.esm.js",
|
||||
"unpkg": "./dist/floating-ui.dom.umd.min.js",
|
||||
"types": "./dist/floating-ui.dom.d.ts",
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/floating-ui.dom.d.mts",
|
||||
"default": "./dist/floating-ui.dom.mjs"
|
||||
},
|
||||
"types": "./dist/floating-ui.dom.d.ts",
|
||||
"module": "./dist/floating-ui.dom.esm.js",
|
||||
"default": "./dist/floating-ui.dom.umd.js"
|
||||
}
|
||||
},
|
||||
"sideEffects": false,
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"author": "atomiks",
|
||||
"license": "MIT",
|
||||
"bugs": "https://github.com/floating-ui/floating-ui",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/floating-ui/floating-ui.git",
|
||||
"directory": "packages/dom"
|
||||
},
|
||||
"homepage": "https://floating-ui.com",
|
||||
"keywords": [
|
||||
"tooltip",
|
||||
"popover",
|
||||
"dropdown",
|
||||
"menu",
|
||||
"popup",
|
||||
"positioning"
|
||||
],
|
||||
"dependencies": {
|
||||
"@floating-ui/core": "^1.7.5",
|
||||
"@floating-ui/utils": "^0.2.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^18.3.19",
|
||||
"@types/react-dom": "^18.3.1",
|
||||
"@vitejs/plugin-react": "^4.3.4",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-router-dom": "^6.21.1",
|
||||
"config": "0.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"format": "prettier --write .",
|
||||
"clean": "rimraf dist out-tsc test-results",
|
||||
"dev": "vite",
|
||||
"build": "rollup -c",
|
||||
"build:api": "build-api --tsc tsconfig.lib.json",
|
||||
"test": "vitest run",
|
||||
"test:watch": "vitest watch",
|
||||
"publint": "publint",
|
||||
"playwright": "playwright test ./test/functional",
|
||||
"typecheck": "tsc -b"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2021-present Floating UI 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.
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# @floating-ui/react-dom
|
||||
|
||||
This is the library to use Floating UI with React DOM.
|
||||
307
node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.d.mts
generated
vendored
Normal file
|
|
@ -0,0 +1,307 @@
|
|||
import { AlignedPlacement } from '@floating-ui/dom';
|
||||
import { Alignment } from '@floating-ui/dom';
|
||||
import { AutoPlacementOptions } from '@floating-ui/dom';
|
||||
import { autoUpdate } from '@floating-ui/dom';
|
||||
import { AutoUpdateOptions } from '@floating-ui/dom';
|
||||
import { Axis } from '@floating-ui/dom';
|
||||
import { Boundary } from '@floating-ui/dom';
|
||||
import { ClientRectObject } from '@floating-ui/dom';
|
||||
import { computePosition } from '@floating-ui/dom';
|
||||
import { ComputePositionConfig } from '@floating-ui/dom';
|
||||
import { ComputePositionReturn } from '@floating-ui/dom';
|
||||
import { Coords } from '@floating-ui/dom';
|
||||
import { Derivable } from '@floating-ui/dom';
|
||||
import { detectOverflow } from '@floating-ui/dom';
|
||||
import { DetectOverflowOptions } from '@floating-ui/dom';
|
||||
import { Dimensions } from '@floating-ui/dom';
|
||||
import { ElementContext } from '@floating-ui/dom';
|
||||
import { ElementRects } from '@floating-ui/dom';
|
||||
import { Elements } from '@floating-ui/dom';
|
||||
import { FlipOptions } from '@floating-ui/dom';
|
||||
import { FloatingElement } from '@floating-ui/dom';
|
||||
import { getOverflowAncestors } from '@floating-ui/dom';
|
||||
import { HideOptions } from '@floating-ui/dom';
|
||||
import { InlineOptions } from '@floating-ui/dom';
|
||||
import { Length } from '@floating-ui/dom';
|
||||
import { LimitShiftOptions } from '@floating-ui/dom';
|
||||
import { Middleware } from '@floating-ui/dom';
|
||||
import { MiddlewareArguments } from '@floating-ui/dom';
|
||||
import { MiddlewareData } from '@floating-ui/dom';
|
||||
import { MiddlewareReturn } from '@floating-ui/dom';
|
||||
import { MiddlewareState } from '@floating-ui/dom';
|
||||
import { NodeScroll } from '@floating-ui/dom';
|
||||
import { OffsetOptions } from '@floating-ui/dom';
|
||||
import { Padding } from '@floating-ui/dom';
|
||||
import { Placement } from '@floating-ui/dom';
|
||||
import { Platform } from '@floating-ui/dom';
|
||||
import { platform } from '@floating-ui/dom';
|
||||
import type * as React from 'react';
|
||||
import { Rect } from '@floating-ui/dom';
|
||||
import { ReferenceElement } from '@floating-ui/dom';
|
||||
import { RootBoundary } from '@floating-ui/dom';
|
||||
import { ShiftOptions } from '@floating-ui/dom';
|
||||
import { Side } from '@floating-ui/dom';
|
||||
import { SideObject } from '@floating-ui/dom';
|
||||
import { SizeOptions } from '@floating-ui/dom';
|
||||
import { Strategy } from '@floating-ui/dom';
|
||||
import { VirtualElement } from '@floating-ui/dom';
|
||||
|
||||
export { AlignedPlacement }
|
||||
|
||||
export { Alignment }
|
||||
|
||||
/**
|
||||
* Provides data to position an inner element of the floating element so that it
|
||||
* appears centered to the reference element.
|
||||
* This wraps the core `arrow` middleware to allow React refs as the element.
|
||||
* @see https://floating-ui.com/docs/arrow
|
||||
*/
|
||||
export declare const arrow: (options: ArrowOptions | Derivable<ArrowOptions>, deps?: React.DependencyList) => Middleware;
|
||||
|
||||
export declare interface ArrowOptions {
|
||||
/**
|
||||
* The arrow element to be positioned.
|
||||
* @default undefined
|
||||
*/
|
||||
element: React.MutableRefObject<Element | null> | Element | null;
|
||||
/**
|
||||
* The padding between the arrow element and the floating element edges.
|
||||
* Useful when the floating element has rounded corners.
|
||||
* @default 0
|
||||
*/
|
||||
padding?: Padding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by choosing the placement
|
||||
* that has the most space available automatically, without needing to specify a
|
||||
* preferred placement. Alternative to `flip`.
|
||||
* @see https://floating-ui.com/docs/autoPlacement
|
||||
*/
|
||||
export declare const autoPlacement: (options?: AutoPlacementOptions | Derivable<AutoPlacementOptions>, deps?: React.DependencyList) => Middleware;
|
||||
|
||||
export { AutoPlacementOptions }
|
||||
|
||||
export { autoUpdate }
|
||||
|
||||
export { AutoUpdateOptions }
|
||||
|
||||
export { Axis }
|
||||
|
||||
export { Boundary }
|
||||
|
||||
export { ClientRectObject }
|
||||
|
||||
export { computePosition }
|
||||
|
||||
export { ComputePositionConfig }
|
||||
|
||||
export { ComputePositionReturn }
|
||||
|
||||
export { Coords }
|
||||
|
||||
export { Derivable }
|
||||
|
||||
export { detectOverflow }
|
||||
|
||||
export { DetectOverflowOptions }
|
||||
|
||||
export { Dimensions }
|
||||
|
||||
export { ElementContext }
|
||||
|
||||
export { ElementRects }
|
||||
|
||||
export { Elements }
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by flipping the `placement`
|
||||
* in order to keep it in view when the preferred placement(s) will overflow the
|
||||
* clipping boundary. Alternative to `autoPlacement`.
|
||||
* @see https://floating-ui.com/docs/flip
|
||||
*/
|
||||
export declare const flip: (options?: FlipOptions | Derivable<FlipOptions>, deps?: React.DependencyList) => Middleware;
|
||||
|
||||
export { FlipOptions }
|
||||
|
||||
export { FloatingElement }
|
||||
|
||||
export { getOverflowAncestors }
|
||||
|
||||
/**
|
||||
* Provides data to hide the floating element in applicable situations, such as
|
||||
* when it is not in the same clipping context as the reference element.
|
||||
* @see https://floating-ui.com/docs/hide
|
||||
*/
|
||||
export declare const hide: (options?: HideOptions | Derivable<HideOptions>, deps?: React.DependencyList) => Middleware;
|
||||
|
||||
export { HideOptions }
|
||||
|
||||
/**
|
||||
* Provides improved positioning for inline reference elements that can span
|
||||
* over multiple lines, such as hyperlinks or range selections.
|
||||
* @see https://floating-ui.com/docs/inline
|
||||
*/
|
||||
export declare const inline: (options?: InlineOptions | Derivable<InlineOptions>, deps?: React.DependencyList) => Middleware;
|
||||
|
||||
export { InlineOptions }
|
||||
|
||||
export { Length }
|
||||
|
||||
/**
|
||||
* Built-in `limiter` that will stop `shift()` at a certain point.
|
||||
*/
|
||||
export declare const limitShift: (options?: LimitShiftOptions | Derivable<LimitShiftOptions>, deps?: React.DependencyList) => {
|
||||
fn: (state: MiddlewareState) => Coords;
|
||||
options: any;
|
||||
};
|
||||
|
||||
export { Middleware }
|
||||
|
||||
export { MiddlewareArguments }
|
||||
|
||||
export { MiddlewareData }
|
||||
|
||||
export { MiddlewareReturn }
|
||||
|
||||
export { MiddlewareState }
|
||||
|
||||
export { NodeScroll }
|
||||
|
||||
/**
|
||||
* Modifies the placement by translating the floating element along the
|
||||
* specified axes.
|
||||
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
||||
* object may be passed.
|
||||
* @see https://floating-ui.com/docs/offset
|
||||
*/
|
||||
export declare const offset: (options?: OffsetOptions, deps?: React.DependencyList) => Middleware;
|
||||
|
||||
export { OffsetOptions }
|
||||
|
||||
export { Padding }
|
||||
|
||||
export { Placement }
|
||||
|
||||
export { Platform }
|
||||
|
||||
export { platform }
|
||||
|
||||
declare type Prettify<T> = {
|
||||
[K in keyof T]: T[K];
|
||||
} & {};
|
||||
|
||||
export { Rect }
|
||||
|
||||
export { ReferenceElement }
|
||||
|
||||
export declare type ReferenceType = Element | VirtualElement;
|
||||
|
||||
export { RootBoundary }
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by shifting it in order to
|
||||
* keep it in view when it will overflow the clipping boundary.
|
||||
* @see https://floating-ui.com/docs/shift
|
||||
*/
|
||||
export declare const shift: (options?: ShiftOptions | Derivable<ShiftOptions>, deps?: React.DependencyList) => Middleware;
|
||||
|
||||
export { ShiftOptions }
|
||||
|
||||
export { Side }
|
||||
|
||||
export { SideObject }
|
||||
|
||||
/**
|
||||
* Provides data that allows you to change the size of the floating element —
|
||||
* for instance, prevent it from overflowing the clipping boundary or match the
|
||||
* width of the reference element.
|
||||
* @see https://floating-ui.com/docs/size
|
||||
*/
|
||||
export declare const size: (options?: SizeOptions | Derivable<SizeOptions>, deps?: React.DependencyList) => Middleware;
|
||||
|
||||
export { SizeOptions }
|
||||
|
||||
export { Strategy }
|
||||
|
||||
/**
|
||||
* Provides data to position a floating element.
|
||||
* @see https://floating-ui.com/docs/useFloating
|
||||
*/
|
||||
export declare function useFloating<RT extends ReferenceType = ReferenceType>(options?: UseFloatingOptions): UseFloatingReturn<RT>;
|
||||
|
||||
export declare type UseFloatingData = Prettify<ComputePositionReturn & {
|
||||
isPositioned: boolean;
|
||||
}>;
|
||||
|
||||
export declare type UseFloatingOptions<RT extends ReferenceType = ReferenceType> = Prettify<Partial<ComputePositionConfig> & {
|
||||
/**
|
||||
* A callback invoked when both the reference and floating elements are
|
||||
* mounted, and cleaned up when either is unmounted. This is useful for
|
||||
* setting up event listeners (e.g. pass `autoUpdate`).
|
||||
*/
|
||||
whileElementsMounted?: (reference: RT, floating: HTMLElement, update: () => void) => () => void;
|
||||
/**
|
||||
* Object containing the reference and floating elements.
|
||||
*/
|
||||
elements?: {
|
||||
reference?: RT | null;
|
||||
floating?: HTMLElement | null;
|
||||
};
|
||||
/**
|
||||
* The `open` state of the floating element to synchronize with the
|
||||
* `isPositioned` value.
|
||||
* @default false
|
||||
*/
|
||||
open?: boolean;
|
||||
/**
|
||||
* Whether to use `transform` for positioning instead of `top` and `left`
|
||||
* (layout) in the `floatingStyles` object.
|
||||
* @default true
|
||||
*/
|
||||
transform?: boolean;
|
||||
}>;
|
||||
|
||||
export declare type UseFloatingReturn<RT extends ReferenceType = ReferenceType> = Prettify<UseFloatingData & {
|
||||
/**
|
||||
* Update the position of the floating element, re-rendering the component
|
||||
* if required.
|
||||
*/
|
||||
update: () => void;
|
||||
/**
|
||||
* Pre-configured positioning styles to apply to the floating element.
|
||||
*/
|
||||
floatingStyles: React.CSSProperties;
|
||||
/**
|
||||
* Object containing the reference and floating refs and reactive setters.
|
||||
*/
|
||||
refs: {
|
||||
/**
|
||||
* A React ref to the reference element.
|
||||
*/
|
||||
reference: React.MutableRefObject<RT | null>;
|
||||
/**
|
||||
* A React ref to the floating element.
|
||||
*/
|
||||
floating: React.MutableRefObject<HTMLElement | null>;
|
||||
/**
|
||||
* A callback to set the reference element (reactive).
|
||||
*/
|
||||
setReference: (node: RT | null) => void;
|
||||
/**
|
||||
* A callback to set the floating element (reactive).
|
||||
*/
|
||||
setFloating: (node: HTMLElement | null) => void;
|
||||
};
|
||||
/**
|
||||
* Object containing the reference and floating elements.
|
||||
*/
|
||||
elements: {
|
||||
reference: RT | null;
|
||||
floating: HTMLElement | null;
|
||||
};
|
||||
}>;
|
||||
|
||||
export { VirtualElement }
|
||||
|
||||
export { }
|
||||
307
node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,307 @@
|
|||
import { AlignedPlacement } from '@floating-ui/dom';
|
||||
import { Alignment } from '@floating-ui/dom';
|
||||
import { AutoPlacementOptions } from '@floating-ui/dom';
|
||||
import { autoUpdate } from '@floating-ui/dom';
|
||||
import { AutoUpdateOptions } from '@floating-ui/dom';
|
||||
import { Axis } from '@floating-ui/dom';
|
||||
import { Boundary } from '@floating-ui/dom';
|
||||
import { ClientRectObject } from '@floating-ui/dom';
|
||||
import { computePosition } from '@floating-ui/dom';
|
||||
import { ComputePositionConfig } from '@floating-ui/dom';
|
||||
import { ComputePositionReturn } from '@floating-ui/dom';
|
||||
import { Coords } from '@floating-ui/dom';
|
||||
import { Derivable } from '@floating-ui/dom';
|
||||
import { detectOverflow } from '@floating-ui/dom';
|
||||
import { DetectOverflowOptions } from '@floating-ui/dom';
|
||||
import { Dimensions } from '@floating-ui/dom';
|
||||
import { ElementContext } from '@floating-ui/dom';
|
||||
import { ElementRects } from '@floating-ui/dom';
|
||||
import { Elements } from '@floating-ui/dom';
|
||||
import { FlipOptions } from '@floating-ui/dom';
|
||||
import { FloatingElement } from '@floating-ui/dom';
|
||||
import { getOverflowAncestors } from '@floating-ui/dom';
|
||||
import { HideOptions } from '@floating-ui/dom';
|
||||
import { InlineOptions } from '@floating-ui/dom';
|
||||
import { Length } from '@floating-ui/dom';
|
||||
import { LimitShiftOptions } from '@floating-ui/dom';
|
||||
import { Middleware } from '@floating-ui/dom';
|
||||
import { MiddlewareArguments } from '@floating-ui/dom';
|
||||
import { MiddlewareData } from '@floating-ui/dom';
|
||||
import { MiddlewareReturn } from '@floating-ui/dom';
|
||||
import { MiddlewareState } from '@floating-ui/dom';
|
||||
import { NodeScroll } from '@floating-ui/dom';
|
||||
import { OffsetOptions } from '@floating-ui/dom';
|
||||
import { Padding } from '@floating-ui/dom';
|
||||
import { Placement } from '@floating-ui/dom';
|
||||
import { Platform } from '@floating-ui/dom';
|
||||
import { platform } from '@floating-ui/dom';
|
||||
import type * as React from 'react';
|
||||
import { Rect } from '@floating-ui/dom';
|
||||
import { ReferenceElement } from '@floating-ui/dom';
|
||||
import { RootBoundary } from '@floating-ui/dom';
|
||||
import { ShiftOptions } from '@floating-ui/dom';
|
||||
import { Side } from '@floating-ui/dom';
|
||||
import { SideObject } from '@floating-ui/dom';
|
||||
import { SizeOptions } from '@floating-ui/dom';
|
||||
import { Strategy } from '@floating-ui/dom';
|
||||
import { VirtualElement } from '@floating-ui/dom';
|
||||
|
||||
export { AlignedPlacement }
|
||||
|
||||
export { Alignment }
|
||||
|
||||
/**
|
||||
* Provides data to position an inner element of the floating element so that it
|
||||
* appears centered to the reference element.
|
||||
* This wraps the core `arrow` middleware to allow React refs as the element.
|
||||
* @see https://floating-ui.com/docs/arrow
|
||||
*/
|
||||
export declare const arrow: (options: ArrowOptions | Derivable<ArrowOptions>, deps?: React.DependencyList) => Middleware;
|
||||
|
||||
export declare interface ArrowOptions {
|
||||
/**
|
||||
* The arrow element to be positioned.
|
||||
* @default undefined
|
||||
*/
|
||||
element: React.MutableRefObject<Element | null> | Element | null;
|
||||
/**
|
||||
* The padding between the arrow element and the floating element edges.
|
||||
* Useful when the floating element has rounded corners.
|
||||
* @default 0
|
||||
*/
|
||||
padding?: Padding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by choosing the placement
|
||||
* that has the most space available automatically, without needing to specify a
|
||||
* preferred placement. Alternative to `flip`.
|
||||
* @see https://floating-ui.com/docs/autoPlacement
|
||||
*/
|
||||
export declare const autoPlacement: (options?: AutoPlacementOptions | Derivable<AutoPlacementOptions>, deps?: React.DependencyList) => Middleware;
|
||||
|
||||
export { AutoPlacementOptions }
|
||||
|
||||
export { autoUpdate }
|
||||
|
||||
export { AutoUpdateOptions }
|
||||
|
||||
export { Axis }
|
||||
|
||||
export { Boundary }
|
||||
|
||||
export { ClientRectObject }
|
||||
|
||||
export { computePosition }
|
||||
|
||||
export { ComputePositionConfig }
|
||||
|
||||
export { ComputePositionReturn }
|
||||
|
||||
export { Coords }
|
||||
|
||||
export { Derivable }
|
||||
|
||||
export { detectOverflow }
|
||||
|
||||
export { DetectOverflowOptions }
|
||||
|
||||
export { Dimensions }
|
||||
|
||||
export { ElementContext }
|
||||
|
||||
export { ElementRects }
|
||||
|
||||
export { Elements }
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by flipping the `placement`
|
||||
* in order to keep it in view when the preferred placement(s) will overflow the
|
||||
* clipping boundary. Alternative to `autoPlacement`.
|
||||
* @see https://floating-ui.com/docs/flip
|
||||
*/
|
||||
export declare const flip: (options?: FlipOptions | Derivable<FlipOptions>, deps?: React.DependencyList) => Middleware;
|
||||
|
||||
export { FlipOptions }
|
||||
|
||||
export { FloatingElement }
|
||||
|
||||
export { getOverflowAncestors }
|
||||
|
||||
/**
|
||||
* Provides data to hide the floating element in applicable situations, such as
|
||||
* when it is not in the same clipping context as the reference element.
|
||||
* @see https://floating-ui.com/docs/hide
|
||||
*/
|
||||
export declare const hide: (options?: HideOptions | Derivable<HideOptions>, deps?: React.DependencyList) => Middleware;
|
||||
|
||||
export { HideOptions }
|
||||
|
||||
/**
|
||||
* Provides improved positioning for inline reference elements that can span
|
||||
* over multiple lines, such as hyperlinks or range selections.
|
||||
* @see https://floating-ui.com/docs/inline
|
||||
*/
|
||||
export declare const inline: (options?: InlineOptions | Derivable<InlineOptions>, deps?: React.DependencyList) => Middleware;
|
||||
|
||||
export { InlineOptions }
|
||||
|
||||
export { Length }
|
||||
|
||||
/**
|
||||
* Built-in `limiter` that will stop `shift()` at a certain point.
|
||||
*/
|
||||
export declare const limitShift: (options?: LimitShiftOptions | Derivable<LimitShiftOptions>, deps?: React.DependencyList) => {
|
||||
fn: (state: MiddlewareState) => Coords;
|
||||
options: any;
|
||||
};
|
||||
|
||||
export { Middleware }
|
||||
|
||||
export { MiddlewareArguments }
|
||||
|
||||
export { MiddlewareData }
|
||||
|
||||
export { MiddlewareReturn }
|
||||
|
||||
export { MiddlewareState }
|
||||
|
||||
export { NodeScroll }
|
||||
|
||||
/**
|
||||
* Modifies the placement by translating the floating element along the
|
||||
* specified axes.
|
||||
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
||||
* object may be passed.
|
||||
* @see https://floating-ui.com/docs/offset
|
||||
*/
|
||||
export declare const offset: (options?: OffsetOptions, deps?: React.DependencyList) => Middleware;
|
||||
|
||||
export { OffsetOptions }
|
||||
|
||||
export { Padding }
|
||||
|
||||
export { Placement }
|
||||
|
||||
export { Platform }
|
||||
|
||||
export { platform }
|
||||
|
||||
declare type Prettify<T> = {
|
||||
[K in keyof T]: T[K];
|
||||
} & {};
|
||||
|
||||
export { Rect }
|
||||
|
||||
export { ReferenceElement }
|
||||
|
||||
export declare type ReferenceType = Element | VirtualElement;
|
||||
|
||||
export { RootBoundary }
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by shifting it in order to
|
||||
* keep it in view when it will overflow the clipping boundary.
|
||||
* @see https://floating-ui.com/docs/shift
|
||||
*/
|
||||
export declare const shift: (options?: ShiftOptions | Derivable<ShiftOptions>, deps?: React.DependencyList) => Middleware;
|
||||
|
||||
export { ShiftOptions }
|
||||
|
||||
export { Side }
|
||||
|
||||
export { SideObject }
|
||||
|
||||
/**
|
||||
* Provides data that allows you to change the size of the floating element —
|
||||
* for instance, prevent it from overflowing the clipping boundary or match the
|
||||
* width of the reference element.
|
||||
* @see https://floating-ui.com/docs/size
|
||||
*/
|
||||
export declare const size: (options?: SizeOptions | Derivable<SizeOptions>, deps?: React.DependencyList) => Middleware;
|
||||
|
||||
export { SizeOptions }
|
||||
|
||||
export { Strategy }
|
||||
|
||||
/**
|
||||
* Provides data to position a floating element.
|
||||
* @see https://floating-ui.com/docs/useFloating
|
||||
*/
|
||||
export declare function useFloating<RT extends ReferenceType = ReferenceType>(options?: UseFloatingOptions): UseFloatingReturn<RT>;
|
||||
|
||||
export declare type UseFloatingData = Prettify<ComputePositionReturn & {
|
||||
isPositioned: boolean;
|
||||
}>;
|
||||
|
||||
export declare type UseFloatingOptions<RT extends ReferenceType = ReferenceType> = Prettify<Partial<ComputePositionConfig> & {
|
||||
/**
|
||||
* A callback invoked when both the reference and floating elements are
|
||||
* mounted, and cleaned up when either is unmounted. This is useful for
|
||||
* setting up event listeners (e.g. pass `autoUpdate`).
|
||||
*/
|
||||
whileElementsMounted?: (reference: RT, floating: HTMLElement, update: () => void) => () => void;
|
||||
/**
|
||||
* Object containing the reference and floating elements.
|
||||
*/
|
||||
elements?: {
|
||||
reference?: RT | null;
|
||||
floating?: HTMLElement | null;
|
||||
};
|
||||
/**
|
||||
* The `open` state of the floating element to synchronize with the
|
||||
* `isPositioned` value.
|
||||
* @default false
|
||||
*/
|
||||
open?: boolean;
|
||||
/**
|
||||
* Whether to use `transform` for positioning instead of `top` and `left`
|
||||
* (layout) in the `floatingStyles` object.
|
||||
* @default true
|
||||
*/
|
||||
transform?: boolean;
|
||||
}>;
|
||||
|
||||
export declare type UseFloatingReturn<RT extends ReferenceType = ReferenceType> = Prettify<UseFloatingData & {
|
||||
/**
|
||||
* Update the position of the floating element, re-rendering the component
|
||||
* if required.
|
||||
*/
|
||||
update: () => void;
|
||||
/**
|
||||
* Pre-configured positioning styles to apply to the floating element.
|
||||
*/
|
||||
floatingStyles: React.CSSProperties;
|
||||
/**
|
||||
* Object containing the reference and floating refs and reactive setters.
|
||||
*/
|
||||
refs: {
|
||||
/**
|
||||
* A React ref to the reference element.
|
||||
*/
|
||||
reference: React.MutableRefObject<RT | null>;
|
||||
/**
|
||||
* A React ref to the floating element.
|
||||
*/
|
||||
floating: React.MutableRefObject<HTMLElement | null>;
|
||||
/**
|
||||
* A callback to set the reference element (reactive).
|
||||
*/
|
||||
setReference: (node: RT | null) => void;
|
||||
/**
|
||||
* A callback to set the floating element (reactive).
|
||||
*/
|
||||
setFloating: (node: HTMLElement | null) => void;
|
||||
};
|
||||
/**
|
||||
* Object containing the reference and floating elements.
|
||||
*/
|
||||
elements: {
|
||||
reference: RT | null;
|
||||
floating: HTMLElement | null;
|
||||
};
|
||||
}>;
|
||||
|
||||
export { VirtualElement }
|
||||
|
||||
export { }
|
||||
406
node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.esm.js
generated
vendored
Normal file
|
|
@ -0,0 +1,406 @@
|
|||
import { computePosition, arrow as arrow$2, autoPlacement as autoPlacement$1, flip as flip$1, hide as hide$1, inline as inline$1, limitShift as limitShift$1, offset as offset$1, shift as shift$1, size as size$1 } from '@floating-ui/dom';
|
||||
export { autoUpdate, computePosition, detectOverflow, getOverflowAncestors, platform } from '@floating-ui/dom';
|
||||
import * as React from 'react';
|
||||
import { useLayoutEffect } from 'react';
|
||||
import * as ReactDOM from 'react-dom';
|
||||
|
||||
var isClient = typeof document !== 'undefined';
|
||||
|
||||
var noop = function noop() {};
|
||||
var index = isClient ? useLayoutEffect : noop;
|
||||
|
||||
// Fork of `fast-deep-equal` that only does the comparisons we need and compares
|
||||
// functions
|
||||
function deepEqual(a, b) {
|
||||
if (a === b) {
|
||||
return true;
|
||||
}
|
||||
if (typeof a !== typeof b) {
|
||||
return false;
|
||||
}
|
||||
if (typeof a === 'function' && a.toString() === b.toString()) {
|
||||
return true;
|
||||
}
|
||||
let length;
|
||||
let i;
|
||||
let keys;
|
||||
if (a && b && typeof a === 'object') {
|
||||
if (Array.isArray(a)) {
|
||||
length = a.length;
|
||||
if (length !== b.length) return false;
|
||||
for (i = length; i-- !== 0;) {
|
||||
if (!deepEqual(a[i], b[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
keys = Object.keys(a);
|
||||
length = keys.length;
|
||||
if (length !== Object.keys(b).length) {
|
||||
return false;
|
||||
}
|
||||
for (i = length; i-- !== 0;) {
|
||||
if (!{}.hasOwnProperty.call(b, keys[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (i = length; i-- !== 0;) {
|
||||
const key = keys[i];
|
||||
if (key === '_owner' && a.$$typeof) {
|
||||
continue;
|
||||
}
|
||||
if (!deepEqual(a[key], b[key])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return a !== a && b !== b;
|
||||
}
|
||||
|
||||
function getDPR(element) {
|
||||
if (typeof window === 'undefined') {
|
||||
return 1;
|
||||
}
|
||||
const win = element.ownerDocument.defaultView || window;
|
||||
return win.devicePixelRatio || 1;
|
||||
}
|
||||
|
||||
function roundByDPR(element, value) {
|
||||
const dpr = getDPR(element);
|
||||
return Math.round(value * dpr) / dpr;
|
||||
}
|
||||
|
||||
function useLatestRef(value) {
|
||||
const ref = React.useRef(value);
|
||||
index(() => {
|
||||
ref.current = value;
|
||||
});
|
||||
return ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides data to position a floating element.
|
||||
* @see https://floating-ui.com/docs/useFloating
|
||||
*/
|
||||
function useFloating(options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
const {
|
||||
placement = 'bottom',
|
||||
strategy = 'absolute',
|
||||
middleware = [],
|
||||
platform,
|
||||
elements: {
|
||||
reference: externalReference,
|
||||
floating: externalFloating
|
||||
} = {},
|
||||
transform = true,
|
||||
whileElementsMounted,
|
||||
open
|
||||
} = options;
|
||||
const [data, setData] = React.useState({
|
||||
x: 0,
|
||||
y: 0,
|
||||
strategy,
|
||||
placement,
|
||||
middlewareData: {},
|
||||
isPositioned: false
|
||||
});
|
||||
const [latestMiddleware, setLatestMiddleware] = React.useState(middleware);
|
||||
if (!deepEqual(latestMiddleware, middleware)) {
|
||||
setLatestMiddleware(middleware);
|
||||
}
|
||||
const [_reference, _setReference] = React.useState(null);
|
||||
const [_floating, _setFloating] = React.useState(null);
|
||||
const setReference = React.useCallback(node => {
|
||||
if (node !== referenceRef.current) {
|
||||
referenceRef.current = node;
|
||||
_setReference(node);
|
||||
}
|
||||
}, []);
|
||||
const setFloating = React.useCallback(node => {
|
||||
if (node !== floatingRef.current) {
|
||||
floatingRef.current = node;
|
||||
_setFloating(node);
|
||||
}
|
||||
}, []);
|
||||
const referenceEl = externalReference || _reference;
|
||||
const floatingEl = externalFloating || _floating;
|
||||
const referenceRef = React.useRef(null);
|
||||
const floatingRef = React.useRef(null);
|
||||
const dataRef = React.useRef(data);
|
||||
const hasWhileElementsMounted = whileElementsMounted != null;
|
||||
const whileElementsMountedRef = useLatestRef(whileElementsMounted);
|
||||
const platformRef = useLatestRef(platform);
|
||||
const openRef = useLatestRef(open);
|
||||
const update = React.useCallback(() => {
|
||||
if (!referenceRef.current || !floatingRef.current) {
|
||||
return;
|
||||
}
|
||||
const config = {
|
||||
placement,
|
||||
strategy,
|
||||
middleware: latestMiddleware
|
||||
};
|
||||
if (platformRef.current) {
|
||||
config.platform = platformRef.current;
|
||||
}
|
||||
computePosition(referenceRef.current, floatingRef.current, config).then(data => {
|
||||
const fullData = {
|
||||
...data,
|
||||
// The floating element's position may be recomputed while it's closed
|
||||
// but still mounted (such as when transitioning out). To ensure
|
||||
// `isPositioned` will be `false` initially on the next open, avoid
|
||||
// setting it to `true` when `open === false` (must be specified).
|
||||
isPositioned: openRef.current !== false
|
||||
};
|
||||
if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
|
||||
dataRef.current = fullData;
|
||||
ReactDOM.flushSync(() => {
|
||||
setData(fullData);
|
||||
});
|
||||
}
|
||||
});
|
||||
}, [latestMiddleware, placement, strategy, platformRef, openRef]);
|
||||
index(() => {
|
||||
if (open === false && dataRef.current.isPositioned) {
|
||||
dataRef.current.isPositioned = false;
|
||||
setData(data => ({
|
||||
...data,
|
||||
isPositioned: false
|
||||
}));
|
||||
}
|
||||
}, [open]);
|
||||
const isMountedRef = React.useRef(false);
|
||||
index(() => {
|
||||
isMountedRef.current = true;
|
||||
return () => {
|
||||
isMountedRef.current = false;
|
||||
};
|
||||
}, []);
|
||||
index(() => {
|
||||
if (referenceEl) referenceRef.current = referenceEl;
|
||||
if (floatingEl) floatingRef.current = floatingEl;
|
||||
if (referenceEl && floatingEl) {
|
||||
if (whileElementsMountedRef.current) {
|
||||
return whileElementsMountedRef.current(referenceEl, floatingEl, update);
|
||||
}
|
||||
update();
|
||||
}
|
||||
}, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
|
||||
const refs = React.useMemo(() => ({
|
||||
reference: referenceRef,
|
||||
floating: floatingRef,
|
||||
setReference,
|
||||
setFloating
|
||||
}), [setReference, setFloating]);
|
||||
const elements = React.useMemo(() => ({
|
||||
reference: referenceEl,
|
||||
floating: floatingEl
|
||||
}), [referenceEl, floatingEl]);
|
||||
const floatingStyles = React.useMemo(() => {
|
||||
const initialStyles = {
|
||||
position: strategy,
|
||||
left: 0,
|
||||
top: 0
|
||||
};
|
||||
if (!elements.floating) {
|
||||
return initialStyles;
|
||||
}
|
||||
const x = roundByDPR(elements.floating, data.x);
|
||||
const y = roundByDPR(elements.floating, data.y);
|
||||
if (transform) {
|
||||
return {
|
||||
...initialStyles,
|
||||
transform: "translate(" + x + "px, " + y + "px)",
|
||||
...(getDPR(elements.floating) >= 1.5 && {
|
||||
willChange: 'transform'
|
||||
})
|
||||
};
|
||||
}
|
||||
return {
|
||||
position: strategy,
|
||||
left: x,
|
||||
top: y
|
||||
};
|
||||
}, [strategy, transform, elements.floating, data.x, data.y]);
|
||||
return React.useMemo(() => ({
|
||||
...data,
|
||||
update,
|
||||
refs,
|
||||
elements,
|
||||
floatingStyles
|
||||
}), [data, update, refs, elements, floatingStyles]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides data to position an inner element of the floating element so that it
|
||||
* appears centered to the reference element.
|
||||
* This wraps the core `arrow` middleware to allow React refs as the element.
|
||||
* @see https://floating-ui.com/docs/arrow
|
||||
*/
|
||||
const arrow$1 = options => {
|
||||
function isRef(value) {
|
||||
return {}.hasOwnProperty.call(value, 'current');
|
||||
}
|
||||
return {
|
||||
name: 'arrow',
|
||||
options,
|
||||
fn(state) {
|
||||
const {
|
||||
element,
|
||||
padding
|
||||
} = typeof options === 'function' ? options(state) : options;
|
||||
if (element && isRef(element)) {
|
||||
if (element.current != null) {
|
||||
return arrow$2({
|
||||
element: element.current,
|
||||
padding
|
||||
}).fn(state);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
if (element) {
|
||||
return arrow$2({
|
||||
element,
|
||||
padding
|
||||
}).fn(state);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Modifies the placement by translating the floating element along the
|
||||
* specified axes.
|
||||
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
||||
* object may be passed.
|
||||
* @see https://floating-ui.com/docs/offset
|
||||
*/
|
||||
const offset = (options, deps) => {
|
||||
const result = offset$1(options);
|
||||
return {
|
||||
name: result.name,
|
||||
fn: result.fn,
|
||||
options: [options, deps]
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by shifting it in order to
|
||||
* keep it in view when it will overflow the clipping boundary.
|
||||
* @see https://floating-ui.com/docs/shift
|
||||
*/
|
||||
const shift = (options, deps) => {
|
||||
const result = shift$1(options);
|
||||
return {
|
||||
name: result.name,
|
||||
fn: result.fn,
|
||||
options: [options, deps]
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Built-in `limiter` that will stop `shift()` at a certain point.
|
||||
*/
|
||||
const limitShift = (options, deps) => {
|
||||
const result = limitShift$1(options);
|
||||
return {
|
||||
fn: result.fn,
|
||||
options: [options, deps]
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by flipping the `placement`
|
||||
* in order to keep it in view when the preferred placement(s) will overflow the
|
||||
* clipping boundary. Alternative to `autoPlacement`.
|
||||
* @see https://floating-ui.com/docs/flip
|
||||
*/
|
||||
const flip = (options, deps) => {
|
||||
const result = flip$1(options);
|
||||
return {
|
||||
name: result.name,
|
||||
fn: result.fn,
|
||||
options: [options, deps]
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Provides data that allows you to change the size of the floating element —
|
||||
* for instance, prevent it from overflowing the clipping boundary or match the
|
||||
* width of the reference element.
|
||||
* @see https://floating-ui.com/docs/size
|
||||
*/
|
||||
const size = (options, deps) => {
|
||||
const result = size$1(options);
|
||||
return {
|
||||
name: result.name,
|
||||
fn: result.fn,
|
||||
options: [options, deps]
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by choosing the placement
|
||||
* that has the most space available automatically, without needing to specify a
|
||||
* preferred placement. Alternative to `flip`.
|
||||
* @see https://floating-ui.com/docs/autoPlacement
|
||||
*/
|
||||
const autoPlacement = (options, deps) => {
|
||||
const result = autoPlacement$1(options);
|
||||
return {
|
||||
name: result.name,
|
||||
fn: result.fn,
|
||||
options: [options, deps]
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Provides data to hide the floating element in applicable situations, such as
|
||||
* when it is not in the same clipping context as the reference element.
|
||||
* @see https://floating-ui.com/docs/hide
|
||||
*/
|
||||
const hide = (options, deps) => {
|
||||
const result = hide$1(options);
|
||||
return {
|
||||
name: result.name,
|
||||
fn: result.fn,
|
||||
options: [options, deps]
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Provides improved positioning for inline reference elements that can span
|
||||
* over multiple lines, such as hyperlinks or range selections.
|
||||
* @see https://floating-ui.com/docs/inline
|
||||
*/
|
||||
const inline = (options, deps) => {
|
||||
const result = inline$1(options);
|
||||
return {
|
||||
name: result.name,
|
||||
fn: result.fn,
|
||||
options: [options, deps]
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Provides data to position an inner element of the floating element so that it
|
||||
* appears centered to the reference element.
|
||||
* This wraps the core `arrow` middleware to allow React refs as the element.
|
||||
* @see https://floating-ui.com/docs/arrow
|
||||
*/
|
||||
const arrow = (options, deps) => {
|
||||
const result = arrow$1(options);
|
||||
return {
|
||||
name: result.name,
|
||||
fn: result.fn,
|
||||
options: [options, deps]
|
||||
};
|
||||
};
|
||||
|
||||
export { arrow, autoPlacement, flip, hide, inline, limitShift, offset, shift, size, useFloating };
|
||||
406
node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,406 @@
|
|||
import { computePosition, arrow as arrow$2, autoPlacement as autoPlacement$1, flip as flip$1, hide as hide$1, inline as inline$1, limitShift as limitShift$1, offset as offset$1, shift as shift$1, size as size$1 } from '@floating-ui/dom';
|
||||
export { autoUpdate, computePosition, detectOverflow, getOverflowAncestors, platform } from '@floating-ui/dom';
|
||||
import * as React from 'react';
|
||||
import { useLayoutEffect } from 'react';
|
||||
import * as ReactDOM from 'react-dom';
|
||||
|
||||
var isClient = typeof document !== 'undefined';
|
||||
|
||||
var noop = function noop() {};
|
||||
var index = isClient ? useLayoutEffect : noop;
|
||||
|
||||
// Fork of `fast-deep-equal` that only does the comparisons we need and compares
|
||||
// functions
|
||||
function deepEqual(a, b) {
|
||||
if (a === b) {
|
||||
return true;
|
||||
}
|
||||
if (typeof a !== typeof b) {
|
||||
return false;
|
||||
}
|
||||
if (typeof a === 'function' && a.toString() === b.toString()) {
|
||||
return true;
|
||||
}
|
||||
let length;
|
||||
let i;
|
||||
let keys;
|
||||
if (a && b && typeof a === 'object') {
|
||||
if (Array.isArray(a)) {
|
||||
length = a.length;
|
||||
if (length !== b.length) return false;
|
||||
for (i = length; i-- !== 0;) {
|
||||
if (!deepEqual(a[i], b[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
keys = Object.keys(a);
|
||||
length = keys.length;
|
||||
if (length !== Object.keys(b).length) {
|
||||
return false;
|
||||
}
|
||||
for (i = length; i-- !== 0;) {
|
||||
if (!{}.hasOwnProperty.call(b, keys[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (i = length; i-- !== 0;) {
|
||||
const key = keys[i];
|
||||
if (key === '_owner' && a.$$typeof) {
|
||||
continue;
|
||||
}
|
||||
if (!deepEqual(a[key], b[key])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return a !== a && b !== b;
|
||||
}
|
||||
|
||||
function getDPR(element) {
|
||||
if (typeof window === 'undefined') {
|
||||
return 1;
|
||||
}
|
||||
const win = element.ownerDocument.defaultView || window;
|
||||
return win.devicePixelRatio || 1;
|
||||
}
|
||||
|
||||
function roundByDPR(element, value) {
|
||||
const dpr = getDPR(element);
|
||||
return Math.round(value * dpr) / dpr;
|
||||
}
|
||||
|
||||
function useLatestRef(value) {
|
||||
const ref = React.useRef(value);
|
||||
index(() => {
|
||||
ref.current = value;
|
||||
});
|
||||
return ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides data to position a floating element.
|
||||
* @see https://floating-ui.com/docs/useFloating
|
||||
*/
|
||||
function useFloating(options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
const {
|
||||
placement = 'bottom',
|
||||
strategy = 'absolute',
|
||||
middleware = [],
|
||||
platform,
|
||||
elements: {
|
||||
reference: externalReference,
|
||||
floating: externalFloating
|
||||
} = {},
|
||||
transform = true,
|
||||
whileElementsMounted,
|
||||
open
|
||||
} = options;
|
||||
const [data, setData] = React.useState({
|
||||
x: 0,
|
||||
y: 0,
|
||||
strategy,
|
||||
placement,
|
||||
middlewareData: {},
|
||||
isPositioned: false
|
||||
});
|
||||
const [latestMiddleware, setLatestMiddleware] = React.useState(middleware);
|
||||
if (!deepEqual(latestMiddleware, middleware)) {
|
||||
setLatestMiddleware(middleware);
|
||||
}
|
||||
const [_reference, _setReference] = React.useState(null);
|
||||
const [_floating, _setFloating] = React.useState(null);
|
||||
const setReference = React.useCallback(node => {
|
||||
if (node !== referenceRef.current) {
|
||||
referenceRef.current = node;
|
||||
_setReference(node);
|
||||
}
|
||||
}, []);
|
||||
const setFloating = React.useCallback(node => {
|
||||
if (node !== floatingRef.current) {
|
||||
floatingRef.current = node;
|
||||
_setFloating(node);
|
||||
}
|
||||
}, []);
|
||||
const referenceEl = externalReference || _reference;
|
||||
const floatingEl = externalFloating || _floating;
|
||||
const referenceRef = React.useRef(null);
|
||||
const floatingRef = React.useRef(null);
|
||||
const dataRef = React.useRef(data);
|
||||
const hasWhileElementsMounted = whileElementsMounted != null;
|
||||
const whileElementsMountedRef = useLatestRef(whileElementsMounted);
|
||||
const platformRef = useLatestRef(platform);
|
||||
const openRef = useLatestRef(open);
|
||||
const update = React.useCallback(() => {
|
||||
if (!referenceRef.current || !floatingRef.current) {
|
||||
return;
|
||||
}
|
||||
const config = {
|
||||
placement,
|
||||
strategy,
|
||||
middleware: latestMiddleware
|
||||
};
|
||||
if (platformRef.current) {
|
||||
config.platform = platformRef.current;
|
||||
}
|
||||
computePosition(referenceRef.current, floatingRef.current, config).then(data => {
|
||||
const fullData = {
|
||||
...data,
|
||||
// The floating element's position may be recomputed while it's closed
|
||||
// but still mounted (such as when transitioning out). To ensure
|
||||
// `isPositioned` will be `false` initially on the next open, avoid
|
||||
// setting it to `true` when `open === false` (must be specified).
|
||||
isPositioned: openRef.current !== false
|
||||
};
|
||||
if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
|
||||
dataRef.current = fullData;
|
||||
ReactDOM.flushSync(() => {
|
||||
setData(fullData);
|
||||
});
|
||||
}
|
||||
});
|
||||
}, [latestMiddleware, placement, strategy, platformRef, openRef]);
|
||||
index(() => {
|
||||
if (open === false && dataRef.current.isPositioned) {
|
||||
dataRef.current.isPositioned = false;
|
||||
setData(data => ({
|
||||
...data,
|
||||
isPositioned: false
|
||||
}));
|
||||
}
|
||||
}, [open]);
|
||||
const isMountedRef = React.useRef(false);
|
||||
index(() => {
|
||||
isMountedRef.current = true;
|
||||
return () => {
|
||||
isMountedRef.current = false;
|
||||
};
|
||||
}, []);
|
||||
index(() => {
|
||||
if (referenceEl) referenceRef.current = referenceEl;
|
||||
if (floatingEl) floatingRef.current = floatingEl;
|
||||
if (referenceEl && floatingEl) {
|
||||
if (whileElementsMountedRef.current) {
|
||||
return whileElementsMountedRef.current(referenceEl, floatingEl, update);
|
||||
}
|
||||
update();
|
||||
}
|
||||
}, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
|
||||
const refs = React.useMemo(() => ({
|
||||
reference: referenceRef,
|
||||
floating: floatingRef,
|
||||
setReference,
|
||||
setFloating
|
||||
}), [setReference, setFloating]);
|
||||
const elements = React.useMemo(() => ({
|
||||
reference: referenceEl,
|
||||
floating: floatingEl
|
||||
}), [referenceEl, floatingEl]);
|
||||
const floatingStyles = React.useMemo(() => {
|
||||
const initialStyles = {
|
||||
position: strategy,
|
||||
left: 0,
|
||||
top: 0
|
||||
};
|
||||
if (!elements.floating) {
|
||||
return initialStyles;
|
||||
}
|
||||
const x = roundByDPR(elements.floating, data.x);
|
||||
const y = roundByDPR(elements.floating, data.y);
|
||||
if (transform) {
|
||||
return {
|
||||
...initialStyles,
|
||||
transform: "translate(" + x + "px, " + y + "px)",
|
||||
...(getDPR(elements.floating) >= 1.5 && {
|
||||
willChange: 'transform'
|
||||
})
|
||||
};
|
||||
}
|
||||
return {
|
||||
position: strategy,
|
||||
left: x,
|
||||
top: y
|
||||
};
|
||||
}, [strategy, transform, elements.floating, data.x, data.y]);
|
||||
return React.useMemo(() => ({
|
||||
...data,
|
||||
update,
|
||||
refs,
|
||||
elements,
|
||||
floatingStyles
|
||||
}), [data, update, refs, elements, floatingStyles]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides data to position an inner element of the floating element so that it
|
||||
* appears centered to the reference element.
|
||||
* This wraps the core `arrow` middleware to allow React refs as the element.
|
||||
* @see https://floating-ui.com/docs/arrow
|
||||
*/
|
||||
const arrow$1 = options => {
|
||||
function isRef(value) {
|
||||
return {}.hasOwnProperty.call(value, 'current');
|
||||
}
|
||||
return {
|
||||
name: 'arrow',
|
||||
options,
|
||||
fn(state) {
|
||||
const {
|
||||
element,
|
||||
padding
|
||||
} = typeof options === 'function' ? options(state) : options;
|
||||
if (element && isRef(element)) {
|
||||
if (element.current != null) {
|
||||
return arrow$2({
|
||||
element: element.current,
|
||||
padding
|
||||
}).fn(state);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
if (element) {
|
||||
return arrow$2({
|
||||
element,
|
||||
padding
|
||||
}).fn(state);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Modifies the placement by translating the floating element along the
|
||||
* specified axes.
|
||||
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
||||
* object may be passed.
|
||||
* @see https://floating-ui.com/docs/offset
|
||||
*/
|
||||
const offset = (options, deps) => {
|
||||
const result = offset$1(options);
|
||||
return {
|
||||
name: result.name,
|
||||
fn: result.fn,
|
||||
options: [options, deps]
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by shifting it in order to
|
||||
* keep it in view when it will overflow the clipping boundary.
|
||||
* @see https://floating-ui.com/docs/shift
|
||||
*/
|
||||
const shift = (options, deps) => {
|
||||
const result = shift$1(options);
|
||||
return {
|
||||
name: result.name,
|
||||
fn: result.fn,
|
||||
options: [options, deps]
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Built-in `limiter` that will stop `shift()` at a certain point.
|
||||
*/
|
||||
const limitShift = (options, deps) => {
|
||||
const result = limitShift$1(options);
|
||||
return {
|
||||
fn: result.fn,
|
||||
options: [options, deps]
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by flipping the `placement`
|
||||
* in order to keep it in view when the preferred placement(s) will overflow the
|
||||
* clipping boundary. Alternative to `autoPlacement`.
|
||||
* @see https://floating-ui.com/docs/flip
|
||||
*/
|
||||
const flip = (options, deps) => {
|
||||
const result = flip$1(options);
|
||||
return {
|
||||
name: result.name,
|
||||
fn: result.fn,
|
||||
options: [options, deps]
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Provides data that allows you to change the size of the floating element —
|
||||
* for instance, prevent it from overflowing the clipping boundary or match the
|
||||
* width of the reference element.
|
||||
* @see https://floating-ui.com/docs/size
|
||||
*/
|
||||
const size = (options, deps) => {
|
||||
const result = size$1(options);
|
||||
return {
|
||||
name: result.name,
|
||||
fn: result.fn,
|
||||
options: [options, deps]
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by choosing the placement
|
||||
* that has the most space available automatically, without needing to specify a
|
||||
* preferred placement. Alternative to `flip`.
|
||||
* @see https://floating-ui.com/docs/autoPlacement
|
||||
*/
|
||||
const autoPlacement = (options, deps) => {
|
||||
const result = autoPlacement$1(options);
|
||||
return {
|
||||
name: result.name,
|
||||
fn: result.fn,
|
||||
options: [options, deps]
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Provides data to hide the floating element in applicable situations, such as
|
||||
* when it is not in the same clipping context as the reference element.
|
||||
* @see https://floating-ui.com/docs/hide
|
||||
*/
|
||||
const hide = (options, deps) => {
|
||||
const result = hide$1(options);
|
||||
return {
|
||||
name: result.name,
|
||||
fn: result.fn,
|
||||
options: [options, deps]
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Provides improved positioning for inline reference elements that can span
|
||||
* over multiple lines, such as hyperlinks or range selections.
|
||||
* @see https://floating-ui.com/docs/inline
|
||||
*/
|
||||
const inline = (options, deps) => {
|
||||
const result = inline$1(options);
|
||||
return {
|
||||
name: result.name,
|
||||
fn: result.fn,
|
||||
options: [options, deps]
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Provides data to position an inner element of the floating element so that it
|
||||
* appears centered to the reference element.
|
||||
* This wraps the core `arrow` middleware to allow React refs as the element.
|
||||
* @see https://floating-ui.com/docs/arrow
|
||||
*/
|
||||
const arrow = (options, deps) => {
|
||||
const result = arrow$1(options);
|
||||
return {
|
||||
name: result.name,
|
||||
fn: result.fn,
|
||||
options: [options, deps]
|
||||
};
|
||||
};
|
||||
|
||||
export { arrow, autoPlacement, flip, hide, inline, limitShift, offset, shift, size, useFloating };
|
||||
457
node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.umd.js
generated
vendored
Normal file
|
|
@ -0,0 +1,457 @@
|
|||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@floating-ui/dom'), require('react'), require('react-dom')) :
|
||||
typeof define === 'function' && define.amd ? define(['exports', '@floating-ui/dom', 'react', 'react-dom'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.FloatingUIReactDOM = {}, global.FloatingUIDOM, global.React, global.ReactDOM));
|
||||
})(this, (function (exports, dom, React, ReactDOM) { 'use strict';
|
||||
|
||||
function _interopNamespaceDefault(e) {
|
||||
var n = Object.create(null);
|
||||
if (e) {
|
||||
Object.keys(e).forEach(function (k) {
|
||||
if (k !== 'default') {
|
||||
var d = Object.getOwnPropertyDescriptor(e, k);
|
||||
Object.defineProperty(n, k, d.get ? d : {
|
||||
enumerable: true,
|
||||
get: function () { return e[k]; }
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
n.default = e;
|
||||
return Object.freeze(n);
|
||||
}
|
||||
|
||||
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
||||
var ReactDOM__namespace = /*#__PURE__*/_interopNamespaceDefault(ReactDOM);
|
||||
|
||||
var isClient = typeof document !== 'undefined';
|
||||
|
||||
var noop = function noop() {};
|
||||
var index = isClient ? React.useLayoutEffect : noop;
|
||||
|
||||
// Fork of `fast-deep-equal` that only does the comparisons we need and compares
|
||||
// functions
|
||||
function deepEqual(a, b) {
|
||||
if (a === b) {
|
||||
return true;
|
||||
}
|
||||
if (typeof a !== typeof b) {
|
||||
return false;
|
||||
}
|
||||
if (typeof a === 'function' && a.toString() === b.toString()) {
|
||||
return true;
|
||||
}
|
||||
let length;
|
||||
let i;
|
||||
let keys;
|
||||
if (a && b && typeof a === 'object') {
|
||||
if (Array.isArray(a)) {
|
||||
length = a.length;
|
||||
if (length !== b.length) return false;
|
||||
for (i = length; i-- !== 0;) {
|
||||
if (!deepEqual(a[i], b[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
keys = Object.keys(a);
|
||||
length = keys.length;
|
||||
if (length !== Object.keys(b).length) {
|
||||
return false;
|
||||
}
|
||||
for (i = length; i-- !== 0;) {
|
||||
if (!{}.hasOwnProperty.call(b, keys[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (i = length; i-- !== 0;) {
|
||||
const key = keys[i];
|
||||
if (key === '_owner' && a.$$typeof) {
|
||||
continue;
|
||||
}
|
||||
if (!deepEqual(a[key], b[key])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return a !== a && b !== b;
|
||||
}
|
||||
|
||||
function getDPR(element) {
|
||||
if (typeof window === 'undefined') {
|
||||
return 1;
|
||||
}
|
||||
const win = element.ownerDocument.defaultView || window;
|
||||
return win.devicePixelRatio || 1;
|
||||
}
|
||||
|
||||
function roundByDPR(element, value) {
|
||||
const dpr = getDPR(element);
|
||||
return Math.round(value * dpr) / dpr;
|
||||
}
|
||||
|
||||
function useLatestRef(value) {
|
||||
const ref = React__namespace.useRef(value);
|
||||
index(() => {
|
||||
ref.current = value;
|
||||
});
|
||||
return ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides data to position a floating element.
|
||||
* @see https://floating-ui.com/docs/useFloating
|
||||
*/
|
||||
function useFloating(options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
const {
|
||||
placement = 'bottom',
|
||||
strategy = 'absolute',
|
||||
middleware = [],
|
||||
platform,
|
||||
elements: {
|
||||
reference: externalReference,
|
||||
floating: externalFloating
|
||||
} = {},
|
||||
transform = true,
|
||||
whileElementsMounted,
|
||||
open
|
||||
} = options;
|
||||
const [data, setData] = React__namespace.useState({
|
||||
x: 0,
|
||||
y: 0,
|
||||
strategy,
|
||||
placement,
|
||||
middlewareData: {},
|
||||
isPositioned: false
|
||||
});
|
||||
const [latestMiddleware, setLatestMiddleware] = React__namespace.useState(middleware);
|
||||
if (!deepEqual(latestMiddleware, middleware)) {
|
||||
setLatestMiddleware(middleware);
|
||||
}
|
||||
const [_reference, _setReference] = React__namespace.useState(null);
|
||||
const [_floating, _setFloating] = React__namespace.useState(null);
|
||||
const setReference = React__namespace.useCallback(node => {
|
||||
if (node !== referenceRef.current) {
|
||||
referenceRef.current = node;
|
||||
_setReference(node);
|
||||
}
|
||||
}, []);
|
||||
const setFloating = React__namespace.useCallback(node => {
|
||||
if (node !== floatingRef.current) {
|
||||
floatingRef.current = node;
|
||||
_setFloating(node);
|
||||
}
|
||||
}, []);
|
||||
const referenceEl = externalReference || _reference;
|
||||
const floatingEl = externalFloating || _floating;
|
||||
const referenceRef = React__namespace.useRef(null);
|
||||
const floatingRef = React__namespace.useRef(null);
|
||||
const dataRef = React__namespace.useRef(data);
|
||||
const hasWhileElementsMounted = whileElementsMounted != null;
|
||||
const whileElementsMountedRef = useLatestRef(whileElementsMounted);
|
||||
const platformRef = useLatestRef(platform);
|
||||
const openRef = useLatestRef(open);
|
||||
const update = React__namespace.useCallback(() => {
|
||||
if (!referenceRef.current || !floatingRef.current) {
|
||||
return;
|
||||
}
|
||||
const config = {
|
||||
placement,
|
||||
strategy,
|
||||
middleware: latestMiddleware
|
||||
};
|
||||
if (platformRef.current) {
|
||||
config.platform = platformRef.current;
|
||||
}
|
||||
dom.computePosition(referenceRef.current, floatingRef.current, config).then(data => {
|
||||
const fullData = {
|
||||
...data,
|
||||
// The floating element's position may be recomputed while it's closed
|
||||
// but still mounted (such as when transitioning out). To ensure
|
||||
// `isPositioned` will be `false` initially on the next open, avoid
|
||||
// setting it to `true` when `open === false` (must be specified).
|
||||
isPositioned: openRef.current !== false
|
||||
};
|
||||
if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
|
||||
dataRef.current = fullData;
|
||||
ReactDOM__namespace.flushSync(() => {
|
||||
setData(fullData);
|
||||
});
|
||||
}
|
||||
});
|
||||
}, [latestMiddleware, placement, strategy, platformRef, openRef]);
|
||||
index(() => {
|
||||
if (open === false && dataRef.current.isPositioned) {
|
||||
dataRef.current.isPositioned = false;
|
||||
setData(data => ({
|
||||
...data,
|
||||
isPositioned: false
|
||||
}));
|
||||
}
|
||||
}, [open]);
|
||||
const isMountedRef = React__namespace.useRef(false);
|
||||
index(() => {
|
||||
isMountedRef.current = true;
|
||||
return () => {
|
||||
isMountedRef.current = false;
|
||||
};
|
||||
}, []);
|
||||
index(() => {
|
||||
if (referenceEl) referenceRef.current = referenceEl;
|
||||
if (floatingEl) floatingRef.current = floatingEl;
|
||||
if (referenceEl && floatingEl) {
|
||||
if (whileElementsMountedRef.current) {
|
||||
return whileElementsMountedRef.current(referenceEl, floatingEl, update);
|
||||
}
|
||||
update();
|
||||
}
|
||||
}, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
|
||||
const refs = React__namespace.useMemo(() => ({
|
||||
reference: referenceRef,
|
||||
floating: floatingRef,
|
||||
setReference,
|
||||
setFloating
|
||||
}), [setReference, setFloating]);
|
||||
const elements = React__namespace.useMemo(() => ({
|
||||
reference: referenceEl,
|
||||
floating: floatingEl
|
||||
}), [referenceEl, floatingEl]);
|
||||
const floatingStyles = React__namespace.useMemo(() => {
|
||||
const initialStyles = {
|
||||
position: strategy,
|
||||
left: 0,
|
||||
top: 0
|
||||
};
|
||||
if (!elements.floating) {
|
||||
return initialStyles;
|
||||
}
|
||||
const x = roundByDPR(elements.floating, data.x);
|
||||
const y = roundByDPR(elements.floating, data.y);
|
||||
if (transform) {
|
||||
return {
|
||||
...initialStyles,
|
||||
transform: "translate(" + x + "px, " + y + "px)",
|
||||
...(getDPR(elements.floating) >= 1.5 && {
|
||||
willChange: 'transform'
|
||||
})
|
||||
};
|
||||
}
|
||||
return {
|
||||
position: strategy,
|
||||
left: x,
|
||||
top: y
|
||||
};
|
||||
}, [strategy, transform, elements.floating, data.x, data.y]);
|
||||
return React__namespace.useMemo(() => ({
|
||||
...data,
|
||||
update,
|
||||
refs,
|
||||
elements,
|
||||
floatingStyles
|
||||
}), [data, update, refs, elements, floatingStyles]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides data to position an inner element of the floating element so that it
|
||||
* appears centered to the reference element.
|
||||
* This wraps the core `arrow` middleware to allow React refs as the element.
|
||||
* @see https://floating-ui.com/docs/arrow
|
||||
*/
|
||||
const arrow$1 = options => {
|
||||
function isRef(value) {
|
||||
return {}.hasOwnProperty.call(value, 'current');
|
||||
}
|
||||
return {
|
||||
name: 'arrow',
|
||||
options,
|
||||
fn(state) {
|
||||
const {
|
||||
element,
|
||||
padding
|
||||
} = typeof options === 'function' ? options(state) : options;
|
||||
if (element && isRef(element)) {
|
||||
if (element.current != null) {
|
||||
return dom.arrow({
|
||||
element: element.current,
|
||||
padding
|
||||
}).fn(state);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
if (element) {
|
||||
return dom.arrow({
|
||||
element,
|
||||
padding
|
||||
}).fn(state);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Modifies the placement by translating the floating element along the
|
||||
* specified axes.
|
||||
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
||||
* object may be passed.
|
||||
* @see https://floating-ui.com/docs/offset
|
||||
*/
|
||||
const offset = (options, deps) => {
|
||||
const result = dom.offset(options);
|
||||
return {
|
||||
name: result.name,
|
||||
fn: result.fn,
|
||||
options: [options, deps]
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by shifting it in order to
|
||||
* keep it in view when it will overflow the clipping boundary.
|
||||
* @see https://floating-ui.com/docs/shift
|
||||
*/
|
||||
const shift = (options, deps) => {
|
||||
const result = dom.shift(options);
|
||||
return {
|
||||
name: result.name,
|
||||
fn: result.fn,
|
||||
options: [options, deps]
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Built-in `limiter` that will stop `shift()` at a certain point.
|
||||
*/
|
||||
const limitShift = (options, deps) => {
|
||||
const result = dom.limitShift(options);
|
||||
return {
|
||||
fn: result.fn,
|
||||
options: [options, deps]
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by flipping the `placement`
|
||||
* in order to keep it in view when the preferred placement(s) will overflow the
|
||||
* clipping boundary. Alternative to `autoPlacement`.
|
||||
* @see https://floating-ui.com/docs/flip
|
||||
*/
|
||||
const flip = (options, deps) => {
|
||||
const result = dom.flip(options);
|
||||
return {
|
||||
name: result.name,
|
||||
fn: result.fn,
|
||||
options: [options, deps]
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Provides data that allows you to change the size of the floating element —
|
||||
* for instance, prevent it from overflowing the clipping boundary or match the
|
||||
* width of the reference element.
|
||||
* @see https://floating-ui.com/docs/size
|
||||
*/
|
||||
const size = (options, deps) => {
|
||||
const result = dom.size(options);
|
||||
return {
|
||||
name: result.name,
|
||||
fn: result.fn,
|
||||
options: [options, deps]
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Optimizes the visibility of the floating element by choosing the placement
|
||||
* that has the most space available automatically, without needing to specify a
|
||||
* preferred placement. Alternative to `flip`.
|
||||
* @see https://floating-ui.com/docs/autoPlacement
|
||||
*/
|
||||
const autoPlacement = (options, deps) => {
|
||||
const result = dom.autoPlacement(options);
|
||||
return {
|
||||
name: result.name,
|
||||
fn: result.fn,
|
||||
options: [options, deps]
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Provides data to hide the floating element in applicable situations, such as
|
||||
* when it is not in the same clipping context as the reference element.
|
||||
* @see https://floating-ui.com/docs/hide
|
||||
*/
|
||||
const hide = (options, deps) => {
|
||||
const result = dom.hide(options);
|
||||
return {
|
||||
name: result.name,
|
||||
fn: result.fn,
|
||||
options: [options, deps]
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Provides improved positioning for inline reference elements that can span
|
||||
* over multiple lines, such as hyperlinks or range selections.
|
||||
* @see https://floating-ui.com/docs/inline
|
||||
*/
|
||||
const inline = (options, deps) => {
|
||||
const result = dom.inline(options);
|
||||
return {
|
||||
name: result.name,
|
||||
fn: result.fn,
|
||||
options: [options, deps]
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Provides data to position an inner element of the floating element so that it
|
||||
* appears centered to the reference element.
|
||||
* This wraps the core `arrow` middleware to allow React refs as the element.
|
||||
* @see https://floating-ui.com/docs/arrow
|
||||
*/
|
||||
const arrow = (options, deps) => {
|
||||
const result = arrow$1(options);
|
||||
return {
|
||||
name: result.name,
|
||||
fn: result.fn,
|
||||
options: [options, deps]
|
||||
};
|
||||
};
|
||||
|
||||
Object.defineProperty(exports, "autoUpdate", {
|
||||
enumerable: true,
|
||||
get: function () { return dom.autoUpdate; }
|
||||
});
|
||||
Object.defineProperty(exports, "computePosition", {
|
||||
enumerable: true,
|
||||
get: function () { return dom.computePosition; }
|
||||
});
|
||||
Object.defineProperty(exports, "detectOverflow", {
|
||||
enumerable: true,
|
||||
get: function () { return dom.detectOverflow; }
|
||||
});
|
||||
Object.defineProperty(exports, "getOverflowAncestors", {
|
||||
enumerable: true,
|
||||
get: function () { return dom.getOverflowAncestors; }
|
||||
});
|
||||
Object.defineProperty(exports, "platform", {
|
||||
enumerable: true,
|
||||
get: function () { return dom.platform; }
|
||||
});
|
||||
exports.arrow = arrow;
|
||||
exports.autoPlacement = autoPlacement;
|
||||
exports.flip = flip;
|
||||
exports.hide = hide;
|
||||
exports.inline = inline;
|
||||
exports.limitShift = limitShift;
|
||||
exports.offset = offset;
|
||||
exports.shift = shift;
|
||||
exports.size = size;
|
||||
exports.useFloating = useFloating;
|
||||
|
||||
}));
|
||||
1
node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.umd.min.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@floating-ui/dom"),require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","@floating-ui/dom","react","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).FloatingUIReactDOM={},e.FloatingUIDOM,e.React,e.ReactDOM)}(this,(function(e,t,n,r){"use strict";function o(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var i=o(n),u=o(r),f="undefined"!=typeof document?n.useLayoutEffect:function(){};function c(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!=r--;)if(!c(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!c(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function a(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function s(e,t){const n=a(e);return Math.round(t*n)/n}function l(e){const t=i.useRef(e);return f((()=>{t.current=e})),t}Object.defineProperty(e,"autoUpdate",{enumerable:!0,get:function(){return t.autoUpdate}}),Object.defineProperty(e,"computePosition",{enumerable:!0,get:function(){return t.computePosition}}),Object.defineProperty(e,"detectOverflow",{enumerable:!0,get:function(){return t.detectOverflow}}),Object.defineProperty(e,"getOverflowAncestors",{enumerable:!0,get:function(){return t.getOverflowAncestors}}),Object.defineProperty(e,"platform",{enumerable:!0,get:function(){return t.platform}}),e.arrow=(e,n)=>{const r=(e=>({name:"arrow",options:e,fn(n){const{element:r,padding:o}="function"==typeof e?e(n):e;return r&&(i=r,{}.hasOwnProperty.call(i,"current"))?null!=r.current?t.arrow({element:r.current,padding:o}).fn(n):{}:r?t.arrow({element:r,padding:o}).fn(n):{};var i}}))(e);return{name:r.name,fn:r.fn,options:[e,n]}},e.autoPlacement=(e,n)=>{const r=t.autoPlacement(e);return{name:r.name,fn:r.fn,options:[e,n]}},e.flip=(e,n)=>{const r=t.flip(e);return{name:r.name,fn:r.fn,options:[e,n]}},e.hide=(e,n)=>{const r=t.hide(e);return{name:r.name,fn:r.fn,options:[e,n]}},e.inline=(e,n)=>{const r=t.inline(e);return{name:r.name,fn:r.fn,options:[e,n]}},e.limitShift=(e,n)=>({fn:t.limitShift(e).fn,options:[e,n]}),e.offset=(e,n)=>{const r=t.offset(e);return{name:r.name,fn:r.fn,options:[e,n]}},e.shift=(e,n)=>{const r=t.shift(e);return{name:r.name,fn:r.fn,options:[e,n]}},e.size=(e,n)=>{const r=t.size(e);return{name:r.name,fn:r.fn,options:[e,n]}},e.useFloating=function(e){void 0===e&&(e={});const{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:m,elements:{reference:p,floating:d}={},transform:g=!0,whileElementsMounted:y,open:b}=e,[w,O]=i.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[h,P]=i.useState(o);c(h,o)||P(o);const[j,v]=i.useState(null),[R,S]=i.useState(null),x=i.useCallback((e=>{e!==A.current&&(A.current=e,v(e))}),[]),M=i.useCallback((e=>{e!==C.current&&(C.current=e,S(e))}),[]),k=p||j,D=d||R,A=i.useRef(null),C=i.useRef(null),F=i.useRef(w),U=null!=y,q=l(y),z=l(m),E=l(b),I=i.useCallback((()=>{if(!A.current||!C.current)return;const e={placement:n,strategy:r,middleware:h};z.current&&(e.platform=z.current),t.computePosition(A.current,C.current,e).then((e=>{const t={...e,isPositioned:!1!==E.current};T.current&&!c(F.current,t)&&(F.current=t,u.flushSync((()=>{O(t)})))}))}),[h,n,r,z,E]);f((()=>{!1===b&&F.current.isPositioned&&(F.current.isPositioned=!1,O((e=>({...e,isPositioned:!1}))))}),[b]);const T=i.useRef(!1);f((()=>(T.current=!0,()=>{T.current=!1})),[]),f((()=>{if(k&&(A.current=k),D&&(C.current=D),k&&D){if(q.current)return q.current(k,D,I);I()}}),[k,D,I,q,U]);const $=i.useMemo((()=>({reference:A,floating:C,setReference:x,setFloating:M})),[x,M]),L=i.useMemo((()=>({reference:k,floating:D})),[k,D]),V=i.useMemo((()=>{const e={position:r,left:0,top:0};if(!L.floating)return e;const t=s(L.floating,w.x),n=s(L.floating,w.y);return g?{...e,transform:"translate("+t+"px, "+n+"px)",...a(L.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}}),[r,g,L.floating,w.x,w.y]);return i.useMemo((()=>({...w,update:I,refs:$,elements:L,floatingStyles:V})),[w,I,$,L,V])}}));
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
{
|
||||
"name": "@floating-ui/react-dom",
|
||||
"version": "2.1.8",
|
||||
"description": "Floating UI for React DOM",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"main": "./dist/floating-ui.react-dom.umd.js",
|
||||
"module": "./dist/floating-ui.react-dom.esm.js",
|
||||
"unpkg": "./dist/floating-ui.react-dom.umd.min.js",
|
||||
"types": "./dist/floating-ui.react-dom.d.ts",
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/floating-ui.react-dom.d.mts",
|
||||
"default": "./dist/floating-ui.react-dom.mjs"
|
||||
},
|
||||
"types": "./dist/floating-ui.react-dom.d.ts",
|
||||
"module": "./dist/floating-ui.react-dom.esm.js",
|
||||
"default": "./dist/floating-ui.react-dom.umd.js"
|
||||
}
|
||||
},
|
||||
"sideEffects": false,
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"author": "atomiks",
|
||||
"license": "MIT",
|
||||
"bugs": "https://github.com/floating-ui/floating-ui",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/floating-ui/floating-ui.git",
|
||||
"directory": "packages/react-dom"
|
||||
},
|
||||
"homepage": "https://floating-ui.com/docs/react-dom",
|
||||
"keywords": [
|
||||
"tooltip",
|
||||
"popover",
|
||||
"dropdown",
|
||||
"menu",
|
||||
"popup",
|
||||
"positioning",
|
||||
"react",
|
||||
"react-dom"
|
||||
],
|
||||
"peerDependencies": {
|
||||
"react": ">=16.8.0",
|
||||
"react-dom": ">=16.8.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@floating-ui/dom": "^1.7.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/preset-react": "^7.23.3",
|
||||
"@testing-library/react": "^16.2.0",
|
||||
"@types/react": "^18.3.19",
|
||||
"@types/react-dom": "^18.3.1",
|
||||
"@vitejs/plugin-react": "^4.3.4",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"use-isomorphic-layout-effect": "^1.2.1",
|
||||
"config": "0.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"format": "prettier --write .",
|
||||
"clean": "rimraf dist out-tsc",
|
||||
"test": "vitest run",
|
||||
"test:watch": "vitest watch",
|
||||
"build": "rollup -c",
|
||||
"build:api": "build-api --tsc tsconfig.lib.json",
|
||||
"publint": "publint",
|
||||
"typecheck": "tsc -b"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2021-present Floating UI 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.
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
# @floating-ui/utils
|
||||
|
||||
Utility functions shared across Floating UI packages. You may use these
|
||||
functions in your own projects, but are subject to breaking changes.
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
export declare type AlignedPlacement = `${Side}-${Alignment}`;
|
||||
|
||||
export declare type Alignment = 'start' | 'end';
|
||||
|
||||
export declare const alignments: Alignment[];
|
||||
|
||||
export declare type Axis = 'x' | 'y';
|
||||
|
||||
export declare function clamp(start: number, value: number, end: number): number;
|
||||
|
||||
export declare type ClientRectObject = Prettify<Rect & SideObject>;
|
||||
|
||||
export declare type Coords = {
|
||||
[key in Axis]: number;
|
||||
};
|
||||
|
||||
export declare const createCoords: (v: number) => {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
|
||||
export declare type Dimensions = {
|
||||
[key in Length]: number;
|
||||
};
|
||||
|
||||
export declare interface ElementRects {
|
||||
reference: Rect;
|
||||
floating: Rect;
|
||||
}
|
||||
|
||||
export declare function evaluate<T, P>(value: T | ((param: P) => T), param: P): T;
|
||||
|
||||
export declare function expandPaddingObject(padding: Partial<SideObject>): SideObject;
|
||||
|
||||
export declare const floor: (x: number) => number;
|
||||
|
||||
export declare function getAlignment(placement: Placement): Alignment | undefined;
|
||||
|
||||
export declare function getAlignmentAxis(placement: Placement): Axis;
|
||||
|
||||
export declare function getAlignmentSides(placement: Placement, rects: ElementRects, rtl?: boolean): [Side, Side];
|
||||
|
||||
export declare function getAxisLength(axis: Axis): Length;
|
||||
|
||||
export declare function getExpandedPlacements(placement: Placement): Array<Placement>;
|
||||
|
||||
export declare function getOppositeAlignmentPlacement<T extends string>(placement: T): T;
|
||||
|
||||
export declare function getOppositeAxis(axis: Axis): Axis;
|
||||
|
||||
export declare function getOppositeAxisPlacements(placement: Placement, flipAlignment: boolean, direction: 'none' | Alignment, rtl?: boolean): Placement[];
|
||||
|
||||
export declare function getOppositePlacement<T extends string>(placement: T): T;
|
||||
|
||||
export declare function getPaddingObject(padding: Padding): SideObject;
|
||||
|
||||
export declare function getSide(placement: Placement): Side;
|
||||
|
||||
export declare function getSideAxis(placement: Placement): Axis;
|
||||
|
||||
export declare type Length = 'width' | 'height';
|
||||
|
||||
export declare const max: (...values: number[]) => number;
|
||||
|
||||
export declare const min: (...values: number[]) => number;
|
||||
|
||||
export declare type Padding = number | Prettify<Partial<SideObject>>;
|
||||
|
||||
export declare type Placement = Prettify<Side | AlignedPlacement>;
|
||||
|
||||
export declare const placements: Placement[];
|
||||
|
||||
declare type Prettify<T> = {
|
||||
[K in keyof T]: T[K];
|
||||
} & {};
|
||||
|
||||
export declare type Rect = Prettify<Coords & Dimensions>;
|
||||
|
||||
export declare function rectToClientRect(rect: Rect): ClientRectObject;
|
||||
|
||||
export declare const round: (x: number) => number;
|
||||
|
||||
export declare type Side = 'top' | 'right' | 'bottom' | 'left';
|
||||
|
||||
export declare type SideObject = {
|
||||
[key in Side]: number;
|
||||
};
|
||||
|
||||
export declare const sides: Side[];
|
||||
|
||||
export declare type Strategy = 'absolute' | 'fixed';
|
||||
|
||||
/**
|
||||
* Custom positioning reference element.
|
||||
* @see https://floating-ui.com/docs/virtual-elements
|
||||
*/
|
||||
export declare interface VirtualElement {
|
||||
getBoundingClientRect(): ClientRectObject;
|
||||
getClientRects?(): Array<ClientRectObject>;
|
||||
contextElement?: any;
|
||||
}
|
||||
|
||||
export { }
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
export declare type AlignedPlacement = `${Side}-${Alignment}`;
|
||||
|
||||
export declare type Alignment = 'start' | 'end';
|
||||
|
||||
export declare const alignments: Alignment[];
|
||||
|
||||
export declare type Axis = 'x' | 'y';
|
||||
|
||||
export declare function clamp(start: number, value: number, end: number): number;
|
||||
|
||||
export declare type ClientRectObject = Prettify<Rect & SideObject>;
|
||||
|
||||
export declare type Coords = {
|
||||
[key in Axis]: number;
|
||||
};
|
||||
|
||||
export declare const createCoords: (v: number) => {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
|
||||
export declare type Dimensions = {
|
||||
[key in Length]: number;
|
||||
};
|
||||
|
||||
export declare interface ElementRects {
|
||||
reference: Rect;
|
||||
floating: Rect;
|
||||
}
|
||||
|
||||
export declare function evaluate<T, P>(value: T | ((param: P) => T), param: P): T;
|
||||
|
||||
export declare function expandPaddingObject(padding: Partial<SideObject>): SideObject;
|
||||
|
||||
export declare const floor: (x: number) => number;
|
||||
|
||||
export declare function getAlignment(placement: Placement): Alignment | undefined;
|
||||
|
||||
export declare function getAlignmentAxis(placement: Placement): Axis;
|
||||
|
||||
export declare function getAlignmentSides(placement: Placement, rects: ElementRects, rtl?: boolean): [Side, Side];
|
||||
|
||||
export declare function getAxisLength(axis: Axis): Length;
|
||||
|
||||
export declare function getExpandedPlacements(placement: Placement): Array<Placement>;
|
||||
|
||||
export declare function getOppositeAlignmentPlacement<T extends string>(placement: T): T;
|
||||
|
||||
export declare function getOppositeAxis(axis: Axis): Axis;
|
||||
|
||||
export declare function getOppositeAxisPlacements(placement: Placement, flipAlignment: boolean, direction: 'none' | Alignment, rtl?: boolean): Placement[];
|
||||
|
||||
export declare function getOppositePlacement<T extends string>(placement: T): T;
|
||||
|
||||
export declare function getPaddingObject(padding: Padding): SideObject;
|
||||
|
||||
export declare function getSide(placement: Placement): Side;
|
||||
|
||||
export declare function getSideAxis(placement: Placement): Axis;
|
||||
|
||||
export declare type Length = 'width' | 'height';
|
||||
|
||||
export declare const max: (...values: number[]) => number;
|
||||
|
||||
export declare const min: (...values: number[]) => number;
|
||||
|
||||
export declare type Padding = number | Prettify<Partial<SideObject>>;
|
||||
|
||||
export declare type Placement = Prettify<Side | AlignedPlacement>;
|
||||
|
||||
export declare const placements: Placement[];
|
||||
|
||||
declare type Prettify<T> = {
|
||||
[K in keyof T]: T[K];
|
||||
} & {};
|
||||
|
||||
export declare type Rect = Prettify<Coords & Dimensions>;
|
||||
|
||||
export declare function rectToClientRect(rect: Rect): ClientRectObject;
|
||||
|
||||
export declare const round: (x: number) => number;
|
||||
|
||||
export declare type Side = 'top' | 'right' | 'bottom' | 'left';
|
||||
|
||||
export declare type SideObject = {
|
||||
[key in Side]: number;
|
||||
};
|
||||
|
||||
export declare const sides: Side[];
|
||||
|
||||
export declare type Strategy = 'absolute' | 'fixed';
|
||||
|
||||
/**
|
||||
* Custom positioning reference element.
|
||||
* @see https://floating-ui.com/docs/virtual-elements
|
||||
*/
|
||||
export declare interface VirtualElement {
|
||||
getBoundingClientRect(): ClientRectObject;
|
||||
getClientRects?(): Array<ClientRectObject>;
|
||||
contextElement?: any;
|
||||
}
|
||||
|
||||
export { }
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
declare function getComputedStyle_2(element: Element): CSSStyleDeclaration;
|
||||
export { getComputedStyle_2 as getComputedStyle }
|
||||
|
||||
export declare function getContainingBlock(element: Element): HTMLElement | null;
|
||||
|
||||
export declare function getDocumentElement(node: Node | Window): HTMLElement;
|
||||
|
||||
export declare function getFrameElement(win: Window): Element | null;
|
||||
|
||||
export declare function getNearestOverflowAncestor(node: Node): HTMLElement;
|
||||
|
||||
export declare function getNodeName(node: Node | Window): string;
|
||||
|
||||
export declare function getNodeScroll(element: Element | Window): {
|
||||
scrollLeft: number;
|
||||
scrollTop: number;
|
||||
};
|
||||
|
||||
export declare function getOverflowAncestors(node: Node, list?: OverflowAncestors, traverseIframes?: boolean): OverflowAncestors;
|
||||
|
||||
export declare function getParentNode(node: Node): Node;
|
||||
|
||||
export declare function getWindow(node: any): typeof window;
|
||||
|
||||
export declare function isContainingBlock(elementOrCss: Element | CSSStyleDeclaration): boolean;
|
||||
|
||||
export declare function isElement(value: unknown): value is Element;
|
||||
|
||||
export declare function isHTMLElement(value: unknown): value is HTMLElement;
|
||||
|
||||
export declare function isLastTraversableNode(node: Node): boolean;
|
||||
|
||||
export declare function isNode(value: unknown): value is Node;
|
||||
|
||||
export declare function isOverflowElement(element: Element): boolean;
|
||||
|
||||
export declare function isShadowRoot(value: unknown): value is ShadowRoot;
|
||||
|
||||
export declare function isTableElement(element: Element): boolean;
|
||||
|
||||
export declare function isTopLayer(element: Element): boolean;
|
||||
|
||||
export declare function isWebKit(): boolean;
|
||||
|
||||
declare type OverflowAncestors = Array<Element | Window | VisualViewport>;
|
||||
|
||||
export { }
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
declare function getComputedStyle_2(element: Element): CSSStyleDeclaration;
|
||||
export { getComputedStyle_2 as getComputedStyle }
|
||||
|
||||
export declare function getContainingBlock(element: Element): HTMLElement | null;
|
||||
|
||||
export declare function getDocumentElement(node: Node | Window): HTMLElement;
|
||||
|
||||
export declare function getFrameElement(win: Window): Element | null;
|
||||
|
||||
export declare function getNearestOverflowAncestor(node: Node): HTMLElement;
|
||||
|
||||
export declare function getNodeName(node: Node | Window): string;
|
||||
|
||||
export declare function getNodeScroll(element: Element | Window): {
|
||||
scrollLeft: number;
|
||||
scrollTop: number;
|
||||
};
|
||||
|
||||
export declare function getOverflowAncestors(node: Node, list?: OverflowAncestors, traverseIframes?: boolean): OverflowAncestors;
|
||||
|
||||
export declare function getParentNode(node: Node): Node;
|
||||
|
||||
export declare function getWindow(node: any): typeof window;
|
||||
|
||||
export declare function isContainingBlock(elementOrCss: Element | CSSStyleDeclaration): boolean;
|
||||
|
||||
export declare function isElement(value: unknown): value is Element;
|
||||
|
||||
export declare function isHTMLElement(value: unknown): value is HTMLElement;
|
||||
|
||||
export declare function isLastTraversableNode(node: Node): boolean;
|
||||
|
||||
export declare function isNode(value: unknown): value is Node;
|
||||
|
||||
export declare function isOverflowElement(element: Element): boolean;
|
||||
|
||||
export declare function isShadowRoot(value: unknown): value is ShadowRoot;
|
||||
|
||||
export declare function isTableElement(element: Element): boolean;
|
||||
|
||||
export declare function isTopLayer(element: Element): boolean;
|
||||
|
||||
export declare function isWebKit(): boolean;
|
||||
|
||||
declare type OverflowAncestors = Array<Element | Window | VisualViewport>;
|
||||
|
||||
export { }
|
||||
165
node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.esm.js
generated
vendored
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
function hasWindow() {
|
||||
return typeof window !== 'undefined';
|
||||
}
|
||||
function getNodeName(node) {
|
||||
if (isNode(node)) {
|
||||
return (node.nodeName || '').toLowerCase();
|
||||
}
|
||||
// Mocked nodes in testing environments may not be instances of Node. By
|
||||
// returning `#document` an infinite loop won't occur.
|
||||
// https://github.com/floating-ui/floating-ui/issues/2317
|
||||
return '#document';
|
||||
}
|
||||
function getWindow(node) {
|
||||
var _node$ownerDocument;
|
||||
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
||||
}
|
||||
function getDocumentElement(node) {
|
||||
var _ref;
|
||||
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
||||
}
|
||||
function isNode(value) {
|
||||
if (!hasWindow()) {
|
||||
return false;
|
||||
}
|
||||
return value instanceof Node || value instanceof getWindow(value).Node;
|
||||
}
|
||||
function isElement(value) {
|
||||
if (!hasWindow()) {
|
||||
return false;
|
||||
}
|
||||
return value instanceof Element || value instanceof getWindow(value).Element;
|
||||
}
|
||||
function isHTMLElement(value) {
|
||||
if (!hasWindow()) {
|
||||
return false;
|
||||
}
|
||||
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
||||
}
|
||||
function isShadowRoot(value) {
|
||||
if (!hasWindow() || typeof ShadowRoot === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
||||
}
|
||||
function isOverflowElement(element) {
|
||||
const {
|
||||
overflow,
|
||||
overflowX,
|
||||
overflowY,
|
||||
display
|
||||
} = getComputedStyle(element);
|
||||
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';
|
||||
}
|
||||
function isTableElement(element) {
|
||||
return /^(table|td|th)$/.test(getNodeName(element));
|
||||
}
|
||||
function isTopLayer(element) {
|
||||
try {
|
||||
if (element.matches(':popover-open')) {
|
||||
return true;
|
||||
}
|
||||
} catch (_e) {
|
||||
// no-op
|
||||
}
|
||||
try {
|
||||
return element.matches(':modal');
|
||||
} catch (_e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
|
||||
const containRe = /paint|layout|strict|content/;
|
||||
const isNotNone = value => !!value && value !== 'none';
|
||||
let isWebKitValue;
|
||||
function isContainingBlock(elementOrCss) {
|
||||
const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
||||
// https://drafts.csswg.org/css-transforms-2/#individual-transforms
|
||||
return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || '') || containRe.test(css.contain || '');
|
||||
}
|
||||
function getContainingBlock(element) {
|
||||
let currentNode = getParentNode(element);
|
||||
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
||||
if (isContainingBlock(currentNode)) {
|
||||
return currentNode;
|
||||
} else if (isTopLayer(currentNode)) {
|
||||
return null;
|
||||
}
|
||||
currentNode = getParentNode(currentNode);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function isWebKit() {
|
||||
if (isWebKitValue == null) {
|
||||
isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');
|
||||
}
|
||||
return isWebKitValue;
|
||||
}
|
||||
function isLastTraversableNode(node) {
|
||||
return /^(html|body|#document)$/.test(getNodeName(node));
|
||||
}
|
||||
function getComputedStyle(element) {
|
||||
return getWindow(element).getComputedStyle(element);
|
||||
}
|
||||
function getNodeScroll(element) {
|
||||
if (isElement(element)) {
|
||||
return {
|
||||
scrollLeft: element.scrollLeft,
|
||||
scrollTop: element.scrollTop
|
||||
};
|
||||
}
|
||||
return {
|
||||
scrollLeft: element.scrollX,
|
||||
scrollTop: element.scrollY
|
||||
};
|
||||
}
|
||||
function getParentNode(node) {
|
||||
if (getNodeName(node) === 'html') {
|
||||
return node;
|
||||
}
|
||||
const result =
|
||||
// Step into the shadow DOM of the parent of a slotted node.
|
||||
node.assignedSlot ||
|
||||
// DOM Element detected.
|
||||
node.parentNode ||
|
||||
// ShadowRoot detected.
|
||||
isShadowRoot(node) && node.host ||
|
||||
// Fallback.
|
||||
getDocumentElement(node);
|
||||
return isShadowRoot(result) ? result.host : result;
|
||||
}
|
||||
function getNearestOverflowAncestor(node) {
|
||||
const parentNode = getParentNode(node);
|
||||
if (isLastTraversableNode(parentNode)) {
|
||||
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
||||
}
|
||||
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
||||
return parentNode;
|
||||
}
|
||||
return getNearestOverflowAncestor(parentNode);
|
||||
}
|
||||
function getOverflowAncestors(node, list, traverseIframes) {
|
||||
var _node$ownerDocument2;
|
||||
if (list === void 0) {
|
||||
list = [];
|
||||
}
|
||||
if (traverseIframes === void 0) {
|
||||
traverseIframes = true;
|
||||
}
|
||||
const scrollableAncestor = getNearestOverflowAncestor(node);
|
||||
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
||||
const win = getWindow(scrollableAncestor);
|
||||
if (isBody) {
|
||||
const frameElement = getFrameElement(win);
|
||||
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
||||
} else {
|
||||
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
||||
}
|
||||
}
|
||||
function getFrameElement(win) {
|
||||
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
||||
}
|
||||
|
||||
export { getComputedStyle, getContainingBlock, getDocumentElement, getFrameElement, getNearestOverflowAncestor, getNodeName, getNodeScroll, getOverflowAncestors, getParentNode, getWindow, isContainingBlock, isElement, isHTMLElement, isLastTraversableNode, isNode, isOverflowElement, isShadowRoot, isTableElement, isTopLayer, isWebKit };
|
||||
|
|
@ -0,0 +1,165 @@
|
|||
function hasWindow() {
|
||||
return typeof window !== 'undefined';
|
||||
}
|
||||
function getNodeName(node) {
|
||||
if (isNode(node)) {
|
||||
return (node.nodeName || '').toLowerCase();
|
||||
}
|
||||
// Mocked nodes in testing environments may not be instances of Node. By
|
||||
// returning `#document` an infinite loop won't occur.
|
||||
// https://github.com/floating-ui/floating-ui/issues/2317
|
||||
return '#document';
|
||||
}
|
||||
function getWindow(node) {
|
||||
var _node$ownerDocument;
|
||||
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
||||
}
|
||||
function getDocumentElement(node) {
|
||||
var _ref;
|
||||
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
||||
}
|
||||
function isNode(value) {
|
||||
if (!hasWindow()) {
|
||||
return false;
|
||||
}
|
||||
return value instanceof Node || value instanceof getWindow(value).Node;
|
||||
}
|
||||
function isElement(value) {
|
||||
if (!hasWindow()) {
|
||||
return false;
|
||||
}
|
||||
return value instanceof Element || value instanceof getWindow(value).Element;
|
||||
}
|
||||
function isHTMLElement(value) {
|
||||
if (!hasWindow()) {
|
||||
return false;
|
||||
}
|
||||
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
||||
}
|
||||
function isShadowRoot(value) {
|
||||
if (!hasWindow() || typeof ShadowRoot === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
||||
}
|
||||
function isOverflowElement(element) {
|
||||
const {
|
||||
overflow,
|
||||
overflowX,
|
||||
overflowY,
|
||||
display
|
||||
} = getComputedStyle(element);
|
||||
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';
|
||||
}
|
||||
function isTableElement(element) {
|
||||
return /^(table|td|th)$/.test(getNodeName(element));
|
||||
}
|
||||
function isTopLayer(element) {
|
||||
try {
|
||||
if (element.matches(':popover-open')) {
|
||||
return true;
|
||||
}
|
||||
} catch (_e) {
|
||||
// no-op
|
||||
}
|
||||
try {
|
||||
return element.matches(':modal');
|
||||
} catch (_e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
|
||||
const containRe = /paint|layout|strict|content/;
|
||||
const isNotNone = value => !!value && value !== 'none';
|
||||
let isWebKitValue;
|
||||
function isContainingBlock(elementOrCss) {
|
||||
const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
||||
// https://drafts.csswg.org/css-transforms-2/#individual-transforms
|
||||
return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || '') || containRe.test(css.contain || '');
|
||||
}
|
||||
function getContainingBlock(element) {
|
||||
let currentNode = getParentNode(element);
|
||||
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
||||
if (isContainingBlock(currentNode)) {
|
||||
return currentNode;
|
||||
} else if (isTopLayer(currentNode)) {
|
||||
return null;
|
||||
}
|
||||
currentNode = getParentNode(currentNode);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function isWebKit() {
|
||||
if (isWebKitValue == null) {
|
||||
isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');
|
||||
}
|
||||
return isWebKitValue;
|
||||
}
|
||||
function isLastTraversableNode(node) {
|
||||
return /^(html|body|#document)$/.test(getNodeName(node));
|
||||
}
|
||||
function getComputedStyle(element) {
|
||||
return getWindow(element).getComputedStyle(element);
|
||||
}
|
||||
function getNodeScroll(element) {
|
||||
if (isElement(element)) {
|
||||
return {
|
||||
scrollLeft: element.scrollLeft,
|
||||
scrollTop: element.scrollTop
|
||||
};
|
||||
}
|
||||
return {
|
||||
scrollLeft: element.scrollX,
|
||||
scrollTop: element.scrollY
|
||||
};
|
||||
}
|
||||
function getParentNode(node) {
|
||||
if (getNodeName(node) === 'html') {
|
||||
return node;
|
||||
}
|
||||
const result =
|
||||
// Step into the shadow DOM of the parent of a slotted node.
|
||||
node.assignedSlot ||
|
||||
// DOM Element detected.
|
||||
node.parentNode ||
|
||||
// ShadowRoot detected.
|
||||
isShadowRoot(node) && node.host ||
|
||||
// Fallback.
|
||||
getDocumentElement(node);
|
||||
return isShadowRoot(result) ? result.host : result;
|
||||
}
|
||||
function getNearestOverflowAncestor(node) {
|
||||
const parentNode = getParentNode(node);
|
||||
if (isLastTraversableNode(parentNode)) {
|
||||
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
||||
}
|
||||
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
||||
return parentNode;
|
||||
}
|
||||
return getNearestOverflowAncestor(parentNode);
|
||||
}
|
||||
function getOverflowAncestors(node, list, traverseIframes) {
|
||||
var _node$ownerDocument2;
|
||||
if (list === void 0) {
|
||||
list = [];
|
||||
}
|
||||
if (traverseIframes === void 0) {
|
||||
traverseIframes = true;
|
||||
}
|
||||
const scrollableAncestor = getNearestOverflowAncestor(node);
|
||||
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
||||
const win = getWindow(scrollableAncestor);
|
||||
if (isBody) {
|
||||
const frameElement = getFrameElement(win);
|
||||
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
||||
} else {
|
||||
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
||||
}
|
||||
}
|
||||
function getFrameElement(win) {
|
||||
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
||||
}
|
||||
|
||||
export { getComputedStyle, getContainingBlock, getDocumentElement, getFrameElement, getNearestOverflowAncestor, getNodeName, getNodeScroll, getOverflowAncestors, getParentNode, getWindow, isContainingBlock, isElement, isHTMLElement, isLastTraversableNode, isNode, isOverflowElement, isShadowRoot, isTableElement, isTopLayer, isWebKit };
|
||||
192
node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.umd.js
generated
vendored
Normal file
|
|
@ -0,0 +1,192 @@
|
|||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.FloatingUIUtilsDOM = {}));
|
||||
})(this, (function (exports) { 'use strict';
|
||||
|
||||
function hasWindow() {
|
||||
return typeof window !== 'undefined';
|
||||
}
|
||||
function getNodeName(node) {
|
||||
if (isNode(node)) {
|
||||
return (node.nodeName || '').toLowerCase();
|
||||
}
|
||||
// Mocked nodes in testing environments may not be instances of Node. By
|
||||
// returning `#document` an infinite loop won't occur.
|
||||
// https://github.com/floating-ui/floating-ui/issues/2317
|
||||
return '#document';
|
||||
}
|
||||
function getWindow(node) {
|
||||
var _node$ownerDocument;
|
||||
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
||||
}
|
||||
function getDocumentElement(node) {
|
||||
var _ref;
|
||||
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
||||
}
|
||||
function isNode(value) {
|
||||
if (!hasWindow()) {
|
||||
return false;
|
||||
}
|
||||
return value instanceof Node || value instanceof getWindow(value).Node;
|
||||
}
|
||||
function isElement(value) {
|
||||
if (!hasWindow()) {
|
||||
return false;
|
||||
}
|
||||
return value instanceof Element || value instanceof getWindow(value).Element;
|
||||
}
|
||||
function isHTMLElement(value) {
|
||||
if (!hasWindow()) {
|
||||
return false;
|
||||
}
|
||||
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
||||
}
|
||||
function isShadowRoot(value) {
|
||||
if (!hasWindow() || typeof ShadowRoot === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
||||
}
|
||||
function isOverflowElement(element) {
|
||||
const {
|
||||
overflow,
|
||||
overflowX,
|
||||
overflowY,
|
||||
display
|
||||
} = getComputedStyle(element);
|
||||
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';
|
||||
}
|
||||
function isTableElement(element) {
|
||||
return /^(table|td|th)$/.test(getNodeName(element));
|
||||
}
|
||||
function isTopLayer(element) {
|
||||
try {
|
||||
if (element.matches(':popover-open')) {
|
||||
return true;
|
||||
}
|
||||
} catch (_e) {
|
||||
// no-op
|
||||
}
|
||||
try {
|
||||
return element.matches(':modal');
|
||||
} catch (_e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
|
||||
const containRe = /paint|layout|strict|content/;
|
||||
const isNotNone = value => !!value && value !== 'none';
|
||||
let isWebKitValue;
|
||||
function isContainingBlock(elementOrCss) {
|
||||
const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
||||
// https://drafts.csswg.org/css-transforms-2/#individual-transforms
|
||||
return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || '') || containRe.test(css.contain || '');
|
||||
}
|
||||
function getContainingBlock(element) {
|
||||
let currentNode = getParentNode(element);
|
||||
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
||||
if (isContainingBlock(currentNode)) {
|
||||
return currentNode;
|
||||
} else if (isTopLayer(currentNode)) {
|
||||
return null;
|
||||
}
|
||||
currentNode = getParentNode(currentNode);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function isWebKit() {
|
||||
if (isWebKitValue == null) {
|
||||
isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');
|
||||
}
|
||||
return isWebKitValue;
|
||||
}
|
||||
function isLastTraversableNode(node) {
|
||||
return /^(html|body|#document)$/.test(getNodeName(node));
|
||||
}
|
||||
function getComputedStyle(element) {
|
||||
return getWindow(element).getComputedStyle(element);
|
||||
}
|
||||
function getNodeScroll(element) {
|
||||
if (isElement(element)) {
|
||||
return {
|
||||
scrollLeft: element.scrollLeft,
|
||||
scrollTop: element.scrollTop
|
||||
};
|
||||
}
|
||||
return {
|
||||
scrollLeft: element.scrollX,
|
||||
scrollTop: element.scrollY
|
||||
};
|
||||
}
|
||||
function getParentNode(node) {
|
||||
if (getNodeName(node) === 'html') {
|
||||
return node;
|
||||
}
|
||||
const result =
|
||||
// Step into the shadow DOM of the parent of a slotted node.
|
||||
node.assignedSlot ||
|
||||
// DOM Element detected.
|
||||
node.parentNode ||
|
||||
// ShadowRoot detected.
|
||||
isShadowRoot(node) && node.host ||
|
||||
// Fallback.
|
||||
getDocumentElement(node);
|
||||
return isShadowRoot(result) ? result.host : result;
|
||||
}
|
||||
function getNearestOverflowAncestor(node) {
|
||||
const parentNode = getParentNode(node);
|
||||
if (isLastTraversableNode(parentNode)) {
|
||||
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
||||
}
|
||||
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
||||
return parentNode;
|
||||
}
|
||||
return getNearestOverflowAncestor(parentNode);
|
||||
}
|
||||
function getOverflowAncestors(node, list, traverseIframes) {
|
||||
var _node$ownerDocument2;
|
||||
if (list === void 0) {
|
||||
list = [];
|
||||
}
|
||||
if (traverseIframes === void 0) {
|
||||
traverseIframes = true;
|
||||
}
|
||||
const scrollableAncestor = getNearestOverflowAncestor(node);
|
||||
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
||||
const win = getWindow(scrollableAncestor);
|
||||
if (isBody) {
|
||||
const frameElement = getFrameElement(win);
|
||||
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
||||
} else {
|
||||
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
||||
}
|
||||
}
|
||||
function getFrameElement(win) {
|
||||
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
||||
}
|
||||
|
||||
exports.getComputedStyle = getComputedStyle;
|
||||
exports.getContainingBlock = getContainingBlock;
|
||||
exports.getDocumentElement = getDocumentElement;
|
||||
exports.getFrameElement = getFrameElement;
|
||||
exports.getNearestOverflowAncestor = getNearestOverflowAncestor;
|
||||
exports.getNodeName = getNodeName;
|
||||
exports.getNodeScroll = getNodeScroll;
|
||||
exports.getOverflowAncestors = getOverflowAncestors;
|
||||
exports.getParentNode = getParentNode;
|
||||
exports.getWindow = getWindow;
|
||||
exports.isContainingBlock = isContainingBlock;
|
||||
exports.isElement = isElement;
|
||||
exports.isHTMLElement = isHTMLElement;
|
||||
exports.isLastTraversableNode = isLastTraversableNode;
|
||||
exports.isNode = isNode;
|
||||
exports.isOverflowElement = isOverflowElement;
|
||||
exports.isShadowRoot = isShadowRoot;
|
||||
exports.isTableElement = isTableElement;
|
||||
exports.isTopLayer = isTopLayer;
|
||||
exports.isWebKit = isWebKit;
|
||||
|
||||
}));
|
||||
1
node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.umd.min.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).FloatingUIUtilsDOM={})}(this,(function(t){"use strict";function e(){return"undefined"!=typeof window}function n(t){return i(t)?(t.nodeName||"").toLowerCase():"#document"}function o(t){var e;return(null==t||null==(e=t.ownerDocument)?void 0:e.defaultView)||window}function r(t){var e;return null==(e=(i(t)?t.ownerDocument:t.document)||window.document)?void 0:e.documentElement}function i(t){return!!e()&&(t instanceof Node||t instanceof o(t).Node)}function l(t){return!!e()&&(t instanceof Element||t instanceof o(t).Element)}function c(t){return!!e()&&(t instanceof HTMLElement||t instanceof o(t).HTMLElement)}function u(t){return!(!e()||"undefined"==typeof ShadowRoot)&&(t instanceof ShadowRoot||t instanceof o(t).ShadowRoot)}function s(t){const{overflow:e,overflowX:n,overflowY:o,display:r}=g(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&"inline"!==r&&"contents"!==r}function f(t){try{if(t.matches(":popover-open"))return!0}catch(t){}try{return t.matches(":modal")}catch(t){return!1}}const a=/transform|translate|scale|rotate|perspective|filter/,d=/paint|layout|strict|content/,m=t=>!!t&&"none"!==t;let p;function w(t){const e=l(t)?g(t):t;return m(e.transform)||m(e.translate)||m(e.scale)||m(e.rotate)||m(e.perspective)||!v()&&(m(e.backdropFilter)||m(e.filter))||a.test(e.willChange||"")||d.test(e.contain||"")}function v(){return null==p&&(p="undefined"!=typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),p}function y(t){return/^(html|body|#document)$/.test(n(t))}function g(t){return o(t).getComputedStyle(t)}function h(t){if("html"===n(t))return t;const e=t.assignedSlot||t.parentNode||u(t)&&t.host||r(t);return u(e)?e.host:e}function b(t){const e=h(t);return y(e)?t.ownerDocument?t.ownerDocument.body:t.body:c(e)&&s(e)?e:b(e)}function S(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}t.getComputedStyle=g,t.getContainingBlock=function(t){let e=h(t);for(;c(e)&&!y(e);){if(w(e))return e;if(f(e))return null;e=h(e)}return null},t.getDocumentElement=r,t.getFrameElement=S,t.getNearestOverflowAncestor=b,t.getNodeName=n,t.getNodeScroll=function(t){return l(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}},t.getOverflowAncestors=function t(e,n,r){var i;void 0===n&&(n=[]),void 0===r&&(r=!0);const l=b(e),c=l===(null==(i=e.ownerDocument)?void 0:i.body),u=o(l);if(c){const e=S(u);return n.concat(u,u.visualViewport||[],s(l)?l:[],e&&r?t(e):[])}return n.concat(l,t(l,[],r))},t.getParentNode=h,t.getWindow=o,t.isContainingBlock=w,t.isElement=l,t.isHTMLElement=c,t.isLastTraversableNode=y,t.isNode=i,t.isOverflowElement=s,t.isShadowRoot=u,t.isTableElement=function(t){return/^(table|td|th)$/.test(n(t))},t.isTopLayer=f,t.isWebKit=v}));
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
/**
|
||||
* Custom positioning reference element.
|
||||
* @see https://floating-ui.com/docs/virtual-elements
|
||||
*/
|
||||
|
||||
const sides = ['top', 'right', 'bottom', 'left'];
|
||||
const alignments = ['start', 'end'];
|
||||
const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
|
||||
const min = Math.min;
|
||||
const max = Math.max;
|
||||
const round = Math.round;
|
||||
const floor = Math.floor;
|
||||
const createCoords = v => ({
|
||||
x: v,
|
||||
y: v
|
||||
});
|
||||
const oppositeSideMap = {
|
||||
left: 'right',
|
||||
right: 'left',
|
||||
bottom: 'top',
|
||||
top: 'bottom'
|
||||
};
|
||||
function clamp(start, value, end) {
|
||||
return max(start, min(value, end));
|
||||
}
|
||||
function evaluate(value, param) {
|
||||
return typeof value === 'function' ? value(param) : value;
|
||||
}
|
||||
function getSide(placement) {
|
||||
return placement.split('-')[0];
|
||||
}
|
||||
function getAlignment(placement) {
|
||||
return placement.split('-')[1];
|
||||
}
|
||||
function getOppositeAxis(axis) {
|
||||
return axis === 'x' ? 'y' : 'x';
|
||||
}
|
||||
function getAxisLength(axis) {
|
||||
return axis === 'y' ? 'height' : 'width';
|
||||
}
|
||||
function getSideAxis(placement) {
|
||||
const firstChar = placement[0];
|
||||
return firstChar === 't' || firstChar === 'b' ? 'y' : 'x';
|
||||
}
|
||||
function getAlignmentAxis(placement) {
|
||||
return getOppositeAxis(getSideAxis(placement));
|
||||
}
|
||||
function getAlignmentSides(placement, rects, rtl) {
|
||||
if (rtl === void 0) {
|
||||
rtl = false;
|
||||
}
|
||||
const alignment = getAlignment(placement);
|
||||
const alignmentAxis = getAlignmentAxis(placement);
|
||||
const length = getAxisLength(alignmentAxis);
|
||||
let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
|
||||
if (rects.reference[length] > rects.floating[length]) {
|
||||
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
||||
}
|
||||
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
||||
}
|
||||
function getExpandedPlacements(placement) {
|
||||
const oppositePlacement = getOppositePlacement(placement);
|
||||
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
||||
}
|
||||
function getOppositeAlignmentPlacement(placement) {
|
||||
return placement.includes('start') ? placement.replace('start', 'end') : placement.replace('end', 'start');
|
||||
}
|
||||
const lrPlacement = ['left', 'right'];
|
||||
const rlPlacement = ['right', 'left'];
|
||||
const tbPlacement = ['top', 'bottom'];
|
||||
const btPlacement = ['bottom', 'top'];
|
||||
function getSideList(side, isStart, rtl) {
|
||||
switch (side) {
|
||||
case 'top':
|
||||
case 'bottom':
|
||||
if (rtl) return isStart ? rlPlacement : lrPlacement;
|
||||
return isStart ? lrPlacement : rlPlacement;
|
||||
case 'left':
|
||||
case 'right':
|
||||
return isStart ? tbPlacement : btPlacement;
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
||||
const alignment = getAlignment(placement);
|
||||
let list = getSideList(getSide(placement), direction === 'start', rtl);
|
||||
if (alignment) {
|
||||
list = list.map(side => side + "-" + alignment);
|
||||
if (flipAlignment) {
|
||||
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
function getOppositePlacement(placement) {
|
||||
const side = getSide(placement);
|
||||
return oppositeSideMap[side] + placement.slice(side.length);
|
||||
}
|
||||
function expandPaddingObject(padding) {
|
||||
return {
|
||||
top: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
...padding
|
||||
};
|
||||
}
|
||||
function getPaddingObject(padding) {
|
||||
return typeof padding !== 'number' ? expandPaddingObject(padding) : {
|
||||
top: padding,
|
||||
right: padding,
|
||||
bottom: padding,
|
||||
left: padding
|
||||
};
|
||||
}
|
||||
function rectToClientRect(rect) {
|
||||
const {
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height
|
||||
} = rect;
|
||||
return {
|
||||
width,
|
||||
height,
|
||||
top: y,
|
||||
left: x,
|
||||
right: x + width,
|
||||
bottom: y + height,
|
||||
x,
|
||||
y
|
||||
};
|
||||
}
|
||||
|
||||
export { alignments, clamp, createCoords, evaluate, expandPaddingObject, floor, getAlignment, getAlignmentAxis, getAlignmentSides, getAxisLength, getExpandedPlacements, getOppositeAlignmentPlacement, getOppositeAxis, getOppositeAxisPlacements, getOppositePlacement, getPaddingObject, getSide, getSideAxis, max, min, placements, rectToClientRect, round, sides };
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
/**
|
||||
* Custom positioning reference element.
|
||||
* @see https://floating-ui.com/docs/virtual-elements
|
||||
*/
|
||||
|
||||
const sides = ['top', 'right', 'bottom', 'left'];
|
||||
const alignments = ['start', 'end'];
|
||||
const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
|
||||
const min = Math.min;
|
||||
const max = Math.max;
|
||||
const round = Math.round;
|
||||
const floor = Math.floor;
|
||||
const createCoords = v => ({
|
||||
x: v,
|
||||
y: v
|
||||
});
|
||||
const oppositeSideMap = {
|
||||
left: 'right',
|
||||
right: 'left',
|
||||
bottom: 'top',
|
||||
top: 'bottom'
|
||||
};
|
||||
function clamp(start, value, end) {
|
||||
return max(start, min(value, end));
|
||||
}
|
||||
function evaluate(value, param) {
|
||||
return typeof value === 'function' ? value(param) : value;
|
||||
}
|
||||
function getSide(placement) {
|
||||
return placement.split('-')[0];
|
||||
}
|
||||
function getAlignment(placement) {
|
||||
return placement.split('-')[1];
|
||||
}
|
||||
function getOppositeAxis(axis) {
|
||||
return axis === 'x' ? 'y' : 'x';
|
||||
}
|
||||
function getAxisLength(axis) {
|
||||
return axis === 'y' ? 'height' : 'width';
|
||||
}
|
||||
function getSideAxis(placement) {
|
||||
const firstChar = placement[0];
|
||||
return firstChar === 't' || firstChar === 'b' ? 'y' : 'x';
|
||||
}
|
||||
function getAlignmentAxis(placement) {
|
||||
return getOppositeAxis(getSideAxis(placement));
|
||||
}
|
||||
function getAlignmentSides(placement, rects, rtl) {
|
||||
if (rtl === void 0) {
|
||||
rtl = false;
|
||||
}
|
||||
const alignment = getAlignment(placement);
|
||||
const alignmentAxis = getAlignmentAxis(placement);
|
||||
const length = getAxisLength(alignmentAxis);
|
||||
let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
|
||||
if (rects.reference[length] > rects.floating[length]) {
|
||||
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
||||
}
|
||||
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
||||
}
|
||||
function getExpandedPlacements(placement) {
|
||||
const oppositePlacement = getOppositePlacement(placement);
|
||||
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
||||
}
|
||||
function getOppositeAlignmentPlacement(placement) {
|
||||
return placement.includes('start') ? placement.replace('start', 'end') : placement.replace('end', 'start');
|
||||
}
|
||||
const lrPlacement = ['left', 'right'];
|
||||
const rlPlacement = ['right', 'left'];
|
||||
const tbPlacement = ['top', 'bottom'];
|
||||
const btPlacement = ['bottom', 'top'];
|
||||
function getSideList(side, isStart, rtl) {
|
||||
switch (side) {
|
||||
case 'top':
|
||||
case 'bottom':
|
||||
if (rtl) return isStart ? rlPlacement : lrPlacement;
|
||||
return isStart ? lrPlacement : rlPlacement;
|
||||
case 'left':
|
||||
case 'right':
|
||||
return isStart ? tbPlacement : btPlacement;
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
||||
const alignment = getAlignment(placement);
|
||||
let list = getSideList(getSide(placement), direction === 'start', rtl);
|
||||
if (alignment) {
|
||||
list = list.map(side => side + "-" + alignment);
|
||||
if (flipAlignment) {
|
||||
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
function getOppositePlacement(placement) {
|
||||
const side = getSide(placement);
|
||||
return oppositeSideMap[side] + placement.slice(side.length);
|
||||
}
|
||||
function expandPaddingObject(padding) {
|
||||
return {
|
||||
top: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
...padding
|
||||
};
|
||||
}
|
||||
function getPaddingObject(padding) {
|
||||
return typeof padding !== 'number' ? expandPaddingObject(padding) : {
|
||||
top: padding,
|
||||
right: padding,
|
||||
bottom: padding,
|
||||
left: padding
|
||||
};
|
||||
}
|
||||
function rectToClientRect(rect) {
|
||||
const {
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height
|
||||
} = rect;
|
||||
return {
|
||||
width,
|
||||
height,
|
||||
top: y,
|
||||
left: x,
|
||||
right: x + width,
|
||||
bottom: y + height,
|
||||
x,
|
||||
y
|
||||
};
|
||||
}
|
||||
|
||||
export { alignments, clamp, createCoords, evaluate, expandPaddingObject, floor, getAlignment, getAlignmentAxis, getAlignmentSides, getAxisLength, getExpandedPlacements, getOppositeAlignmentPlacement, getOppositeAxis, getOppositeAxisPlacements, getOppositePlacement, getPaddingObject, getSide, getSideAxis, max, min, placements, rectToClientRect, round, sides };
|
||||
|
|
@ -0,0 +1,167 @@
|
|||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.FloatingUIUtils = {}));
|
||||
})(this, (function (exports) { 'use strict';
|
||||
|
||||
/**
|
||||
* Custom positioning reference element.
|
||||
* @see https://floating-ui.com/docs/virtual-elements
|
||||
*/
|
||||
|
||||
const sides = ['top', 'right', 'bottom', 'left'];
|
||||
const alignments = ['start', 'end'];
|
||||
const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
|
||||
const min = Math.min;
|
||||
const max = Math.max;
|
||||
const round = Math.round;
|
||||
const floor = Math.floor;
|
||||
const createCoords = v => ({
|
||||
x: v,
|
||||
y: v
|
||||
});
|
||||
const oppositeSideMap = {
|
||||
left: 'right',
|
||||
right: 'left',
|
||||
bottom: 'top',
|
||||
top: 'bottom'
|
||||
};
|
||||
function clamp(start, value, end) {
|
||||
return max(start, min(value, end));
|
||||
}
|
||||
function evaluate(value, param) {
|
||||
return typeof value === 'function' ? value(param) : value;
|
||||
}
|
||||
function getSide(placement) {
|
||||
return placement.split('-')[0];
|
||||
}
|
||||
function getAlignment(placement) {
|
||||
return placement.split('-')[1];
|
||||
}
|
||||
function getOppositeAxis(axis) {
|
||||
return axis === 'x' ? 'y' : 'x';
|
||||
}
|
||||
function getAxisLength(axis) {
|
||||
return axis === 'y' ? 'height' : 'width';
|
||||
}
|
||||
function getSideAxis(placement) {
|
||||
const firstChar = placement[0];
|
||||
return firstChar === 't' || firstChar === 'b' ? 'y' : 'x';
|
||||
}
|
||||
function getAlignmentAxis(placement) {
|
||||
return getOppositeAxis(getSideAxis(placement));
|
||||
}
|
||||
function getAlignmentSides(placement, rects, rtl) {
|
||||
if (rtl === void 0) {
|
||||
rtl = false;
|
||||
}
|
||||
const alignment = getAlignment(placement);
|
||||
const alignmentAxis = getAlignmentAxis(placement);
|
||||
const length = getAxisLength(alignmentAxis);
|
||||
let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
|
||||
if (rects.reference[length] > rects.floating[length]) {
|
||||
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
||||
}
|
||||
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
||||
}
|
||||
function getExpandedPlacements(placement) {
|
||||
const oppositePlacement = getOppositePlacement(placement);
|
||||
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
||||
}
|
||||
function getOppositeAlignmentPlacement(placement) {
|
||||
return placement.includes('start') ? placement.replace('start', 'end') : placement.replace('end', 'start');
|
||||
}
|
||||
const lrPlacement = ['left', 'right'];
|
||||
const rlPlacement = ['right', 'left'];
|
||||
const tbPlacement = ['top', 'bottom'];
|
||||
const btPlacement = ['bottom', 'top'];
|
||||
function getSideList(side, isStart, rtl) {
|
||||
switch (side) {
|
||||
case 'top':
|
||||
case 'bottom':
|
||||
if (rtl) return isStart ? rlPlacement : lrPlacement;
|
||||
return isStart ? lrPlacement : rlPlacement;
|
||||
case 'left':
|
||||
case 'right':
|
||||
return isStart ? tbPlacement : btPlacement;
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
||||
const alignment = getAlignment(placement);
|
||||
let list = getSideList(getSide(placement), direction === 'start', rtl);
|
||||
if (alignment) {
|
||||
list = list.map(side => side + "-" + alignment);
|
||||
if (flipAlignment) {
|
||||
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
function getOppositePlacement(placement) {
|
||||
const side = getSide(placement);
|
||||
return oppositeSideMap[side] + placement.slice(side.length);
|
||||
}
|
||||
function expandPaddingObject(padding) {
|
||||
return {
|
||||
top: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
...padding
|
||||
};
|
||||
}
|
||||
function getPaddingObject(padding) {
|
||||
return typeof padding !== 'number' ? expandPaddingObject(padding) : {
|
||||
top: padding,
|
||||
right: padding,
|
||||
bottom: padding,
|
||||
left: padding
|
||||
};
|
||||
}
|
||||
function rectToClientRect(rect) {
|
||||
const {
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height
|
||||
} = rect;
|
||||
return {
|
||||
width,
|
||||
height,
|
||||
top: y,
|
||||
left: x,
|
||||
right: x + width,
|
||||
bottom: y + height,
|
||||
x,
|
||||
y
|
||||
};
|
||||
}
|
||||
|
||||
exports.alignments = alignments;
|
||||
exports.clamp = clamp;
|
||||
exports.createCoords = createCoords;
|
||||
exports.evaluate = evaluate;
|
||||
exports.expandPaddingObject = expandPaddingObject;
|
||||
exports.floor = floor;
|
||||
exports.getAlignment = getAlignment;
|
||||
exports.getAlignmentAxis = getAlignmentAxis;
|
||||
exports.getAlignmentSides = getAlignmentSides;
|
||||
exports.getAxisLength = getAxisLength;
|
||||
exports.getExpandedPlacements = getExpandedPlacements;
|
||||
exports.getOppositeAlignmentPlacement = getOppositeAlignmentPlacement;
|
||||
exports.getOppositeAxis = getOppositeAxis;
|
||||
exports.getOppositeAxisPlacements = getOppositeAxisPlacements;
|
||||
exports.getOppositePlacement = getOppositePlacement;
|
||||
exports.getPaddingObject = getPaddingObject;
|
||||
exports.getSide = getSide;
|
||||
exports.getSideAxis = getSideAxis;
|
||||
exports.max = max;
|
||||
exports.min = min;
|
||||
exports.placements = placements;
|
||||
exports.rectToClientRect = rectToClientRect;
|
||||
exports.round = round;
|
||||
exports.sides = sides;
|
||||
|
||||
}));
|
||||
|
|
@ -0,0 +1 @@
|
|||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).FloatingUIUtils={})}(this,(function(t){"use strict";const e=["top","right","bottom","left"],n=["start","end"],o=e.reduce(((t,e)=>t.concat(e,e+"-"+n[0],e+"-"+n[1])),[]),i=Math.min,r=Math.max,c=Math.round,s=Math.floor,u={left:"right",right:"left",bottom:"top",top:"bottom"};function f(t){return t.split("-")[0]}function l(t){return t.split("-")[1]}function a(t){return"x"===t?"y":"x"}function g(t){return"y"===t?"height":"width"}function p(t){const e=t[0];return"t"===e||"b"===e?"y":"x"}function d(t){return a(p(t))}function m(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const h=["left","right"],x=["right","left"],b=["top","bottom"],y=["bottom","top"];function A(t){const e=f(t);return u[e]+t.slice(e.length)}function O(t){return{top:0,right:0,bottom:0,left:0,...t}}t.alignments=n,t.clamp=function(t,e,n){return r(t,i(e,n))},t.createCoords=t=>({x:t,y:t}),t.evaluate=function(t,e){return"function"==typeof t?t(e):t},t.expandPaddingObject=O,t.floor=s,t.getAlignment=l,t.getAlignmentAxis=d,t.getAlignmentSides=function(t,e,n){void 0===n&&(n=!1);const o=l(t),i=d(t),r=g(i);let c="x"===i?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return e.reference[r]>e.floating[r]&&(c=A(c)),[c,A(c)]},t.getAxisLength=g,t.getExpandedPlacements=function(t){const e=A(t);return[m(t),e,m(e)]},t.getOppositeAlignmentPlacement=m,t.getOppositeAxis=a,t.getOppositeAxisPlacements=function(t,e,n,o){const i=l(t);let r=function(t,e,n){switch(t){case"top":case"bottom":return n?e?x:h:e?h:x;case"left":case"right":return e?b:y;default:return[]}}(f(t),"start"===n,o);return i&&(r=r.map((t=>t+"-"+i)),e&&(r=r.concat(r.map(m)))),r},t.getOppositePlacement=A,t.getPaddingObject=function(t){return"number"!=typeof t?O(t):{top:t,right:t,bottom:t,left:t}},t.getSide=f,t.getSideAxis=p,t.max=r,t.min=i,t.placements=o,t.rectToClientRect=function(t){const{x:e,y:n,width:o,height:i}=t;return{width:o,height:i,top:n,left:e,right:e+o,bottom:n+i,x:e,y:n}},t.round=c,t.sides=e}));
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
declare function getComputedStyle_2(element: Element): CSSStyleDeclaration;
|
||||
export { getComputedStyle_2 as getComputedStyle }
|
||||
|
||||
export declare function getContainingBlock(element: Element): HTMLElement | null;
|
||||
|
||||
export declare function getDocumentElement(node: Node | Window): HTMLElement;
|
||||
|
||||
export declare function getFrameElement(win: Window): Element | null;
|
||||
|
||||
export declare function getNearestOverflowAncestor(node: Node): HTMLElement;
|
||||
|
||||
export declare function getNodeName(node: Node | Window): string;
|
||||
|
||||
export declare function getNodeScroll(element: Element | Window): {
|
||||
scrollLeft: number;
|
||||
scrollTop: number;
|
||||
};
|
||||
|
||||
export declare function getOverflowAncestors(node: Node, list?: OverflowAncestors, traverseIframes?: boolean): OverflowAncestors;
|
||||
|
||||
export declare function getParentNode(node: Node): Node;
|
||||
|
||||
export declare function getWindow(node: any): typeof window;
|
||||
|
||||
export declare function isContainingBlock(elementOrCss: Element | CSSStyleDeclaration): boolean;
|
||||
|
||||
export declare function isElement(value: unknown): value is Element;
|
||||
|
||||
export declare function isHTMLElement(value: unknown): value is HTMLElement;
|
||||
|
||||
export declare function isLastTraversableNode(node: Node): boolean;
|
||||
|
||||
export declare function isNode(value: unknown): value is Node;
|
||||
|
||||
export declare function isOverflowElement(element: Element): boolean;
|
||||
|
||||
export declare function isShadowRoot(value: unknown): value is ShadowRoot;
|
||||
|
||||
export declare function isTableElement(element: Element): boolean;
|
||||
|
||||
export declare function isTopLayer(element: Element): boolean;
|
||||
|
||||
export declare function isWebKit(): boolean;
|
||||
|
||||
declare type OverflowAncestors = Array<Element | Window | VisualViewport>;
|
||||
|
||||
export { }
|
||||
|
|
@ -0,0 +1,165 @@
|
|||
function hasWindow() {
|
||||
return typeof window !== 'undefined';
|
||||
}
|
||||
function getNodeName(node) {
|
||||
if (isNode(node)) {
|
||||
return (node.nodeName || '').toLowerCase();
|
||||
}
|
||||
// Mocked nodes in testing environments may not be instances of Node. By
|
||||
// returning `#document` an infinite loop won't occur.
|
||||
// https://github.com/floating-ui/floating-ui/issues/2317
|
||||
return '#document';
|
||||
}
|
||||
function getWindow(node) {
|
||||
var _node$ownerDocument;
|
||||
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
||||
}
|
||||
function getDocumentElement(node) {
|
||||
var _ref;
|
||||
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
||||
}
|
||||
function isNode(value) {
|
||||
if (!hasWindow()) {
|
||||
return false;
|
||||
}
|
||||
return value instanceof Node || value instanceof getWindow(value).Node;
|
||||
}
|
||||
function isElement(value) {
|
||||
if (!hasWindow()) {
|
||||
return false;
|
||||
}
|
||||
return value instanceof Element || value instanceof getWindow(value).Element;
|
||||
}
|
||||
function isHTMLElement(value) {
|
||||
if (!hasWindow()) {
|
||||
return false;
|
||||
}
|
||||
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
||||
}
|
||||
function isShadowRoot(value) {
|
||||
if (!hasWindow() || typeof ShadowRoot === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
||||
}
|
||||
function isOverflowElement(element) {
|
||||
const {
|
||||
overflow,
|
||||
overflowX,
|
||||
overflowY,
|
||||
display
|
||||
} = getComputedStyle(element);
|
||||
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';
|
||||
}
|
||||
function isTableElement(element) {
|
||||
return /^(table|td|th)$/.test(getNodeName(element));
|
||||
}
|
||||
function isTopLayer(element) {
|
||||
try {
|
||||
if (element.matches(':popover-open')) {
|
||||
return true;
|
||||
}
|
||||
} catch (_e) {
|
||||
// no-op
|
||||
}
|
||||
try {
|
||||
return element.matches(':modal');
|
||||
} catch (_e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
|
||||
const containRe = /paint|layout|strict|content/;
|
||||
const isNotNone = value => !!value && value !== 'none';
|
||||
let isWebKitValue;
|
||||
function isContainingBlock(elementOrCss) {
|
||||
const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
||||
// https://drafts.csswg.org/css-transforms-2/#individual-transforms
|
||||
return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || '') || containRe.test(css.contain || '');
|
||||
}
|
||||
function getContainingBlock(element) {
|
||||
let currentNode = getParentNode(element);
|
||||
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
||||
if (isContainingBlock(currentNode)) {
|
||||
return currentNode;
|
||||
} else if (isTopLayer(currentNode)) {
|
||||
return null;
|
||||
}
|
||||
currentNode = getParentNode(currentNode);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function isWebKit() {
|
||||
if (isWebKitValue == null) {
|
||||
isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');
|
||||
}
|
||||
return isWebKitValue;
|
||||
}
|
||||
function isLastTraversableNode(node) {
|
||||
return /^(html|body|#document)$/.test(getNodeName(node));
|
||||
}
|
||||
function getComputedStyle(element) {
|
||||
return getWindow(element).getComputedStyle(element);
|
||||
}
|
||||
function getNodeScroll(element) {
|
||||
if (isElement(element)) {
|
||||
return {
|
||||
scrollLeft: element.scrollLeft,
|
||||
scrollTop: element.scrollTop
|
||||
};
|
||||
}
|
||||
return {
|
||||
scrollLeft: element.scrollX,
|
||||
scrollTop: element.scrollY
|
||||
};
|
||||
}
|
||||
function getParentNode(node) {
|
||||
if (getNodeName(node) === 'html') {
|
||||
return node;
|
||||
}
|
||||
const result =
|
||||
// Step into the shadow DOM of the parent of a slotted node.
|
||||
node.assignedSlot ||
|
||||
// DOM Element detected.
|
||||
node.parentNode ||
|
||||
// ShadowRoot detected.
|
||||
isShadowRoot(node) && node.host ||
|
||||
// Fallback.
|
||||
getDocumentElement(node);
|
||||
return isShadowRoot(result) ? result.host : result;
|
||||
}
|
||||
function getNearestOverflowAncestor(node) {
|
||||
const parentNode = getParentNode(node);
|
||||
if (isLastTraversableNode(parentNode)) {
|
||||
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
||||
}
|
||||
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
||||
return parentNode;
|
||||
}
|
||||
return getNearestOverflowAncestor(parentNode);
|
||||
}
|
||||
function getOverflowAncestors(node, list, traverseIframes) {
|
||||
var _node$ownerDocument2;
|
||||
if (list === void 0) {
|
||||
list = [];
|
||||
}
|
||||
if (traverseIframes === void 0) {
|
||||
traverseIframes = true;
|
||||
}
|
||||
const scrollableAncestor = getNearestOverflowAncestor(node);
|
||||
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
||||
const win = getWindow(scrollableAncestor);
|
||||
if (isBody) {
|
||||
const frameElement = getFrameElement(win);
|
||||
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
||||
} else {
|
||||
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
||||
}
|
||||
}
|
||||
function getFrameElement(win) {
|
||||
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
||||
}
|
||||
|
||||
export { getComputedStyle, getContainingBlock, getDocumentElement, getFrameElement, getNearestOverflowAncestor, getNodeName, getNodeScroll, getOverflowAncestors, getParentNode, getWindow, isContainingBlock, isElement, isHTMLElement, isLastTraversableNode, isNode, isOverflowElement, isShadowRoot, isTableElement, isTopLayer, isWebKit };
|
||||
|
|
@ -0,0 +1,192 @@
|
|||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.FloatingUIUtilsDOM = {}));
|
||||
})(this, (function (exports) { 'use strict';
|
||||
|
||||
function hasWindow() {
|
||||
return typeof window !== 'undefined';
|
||||
}
|
||||
function getNodeName(node) {
|
||||
if (isNode(node)) {
|
||||
return (node.nodeName || '').toLowerCase();
|
||||
}
|
||||
// Mocked nodes in testing environments may not be instances of Node. By
|
||||
// returning `#document` an infinite loop won't occur.
|
||||
// https://github.com/floating-ui/floating-ui/issues/2317
|
||||
return '#document';
|
||||
}
|
||||
function getWindow(node) {
|
||||
var _node$ownerDocument;
|
||||
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
||||
}
|
||||
function getDocumentElement(node) {
|
||||
var _ref;
|
||||
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
||||
}
|
||||
function isNode(value) {
|
||||
if (!hasWindow()) {
|
||||
return false;
|
||||
}
|
||||
return value instanceof Node || value instanceof getWindow(value).Node;
|
||||
}
|
||||
function isElement(value) {
|
||||
if (!hasWindow()) {
|
||||
return false;
|
||||
}
|
||||
return value instanceof Element || value instanceof getWindow(value).Element;
|
||||
}
|
||||
function isHTMLElement(value) {
|
||||
if (!hasWindow()) {
|
||||
return false;
|
||||
}
|
||||
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
||||
}
|
||||
function isShadowRoot(value) {
|
||||
if (!hasWindow() || typeof ShadowRoot === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
||||
}
|
||||
function isOverflowElement(element) {
|
||||
const {
|
||||
overflow,
|
||||
overflowX,
|
||||
overflowY,
|
||||
display
|
||||
} = getComputedStyle(element);
|
||||
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';
|
||||
}
|
||||
function isTableElement(element) {
|
||||
return /^(table|td|th)$/.test(getNodeName(element));
|
||||
}
|
||||
function isTopLayer(element) {
|
||||
try {
|
||||
if (element.matches(':popover-open')) {
|
||||
return true;
|
||||
}
|
||||
} catch (_e) {
|
||||
// no-op
|
||||
}
|
||||
try {
|
||||
return element.matches(':modal');
|
||||
} catch (_e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
|
||||
const containRe = /paint|layout|strict|content/;
|
||||
const isNotNone = value => !!value && value !== 'none';
|
||||
let isWebKitValue;
|
||||
function isContainingBlock(elementOrCss) {
|
||||
const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
||||
// https://drafts.csswg.org/css-transforms-2/#individual-transforms
|
||||
return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || '') || containRe.test(css.contain || '');
|
||||
}
|
||||
function getContainingBlock(element) {
|
||||
let currentNode = getParentNode(element);
|
||||
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
||||
if (isContainingBlock(currentNode)) {
|
||||
return currentNode;
|
||||
} else if (isTopLayer(currentNode)) {
|
||||
return null;
|
||||
}
|
||||
currentNode = getParentNode(currentNode);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function isWebKit() {
|
||||
if (isWebKitValue == null) {
|
||||
isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');
|
||||
}
|
||||
return isWebKitValue;
|
||||
}
|
||||
function isLastTraversableNode(node) {
|
||||
return /^(html|body|#document)$/.test(getNodeName(node));
|
||||
}
|
||||
function getComputedStyle(element) {
|
||||
return getWindow(element).getComputedStyle(element);
|
||||
}
|
||||
function getNodeScroll(element) {
|
||||
if (isElement(element)) {
|
||||
return {
|
||||
scrollLeft: element.scrollLeft,
|
||||
scrollTop: element.scrollTop
|
||||
};
|
||||
}
|
||||
return {
|
||||
scrollLeft: element.scrollX,
|
||||
scrollTop: element.scrollY
|
||||
};
|
||||
}
|
||||
function getParentNode(node) {
|
||||
if (getNodeName(node) === 'html') {
|
||||
return node;
|
||||
}
|
||||
const result =
|
||||
// Step into the shadow DOM of the parent of a slotted node.
|
||||
node.assignedSlot ||
|
||||
// DOM Element detected.
|
||||
node.parentNode ||
|
||||
// ShadowRoot detected.
|
||||
isShadowRoot(node) && node.host ||
|
||||
// Fallback.
|
||||
getDocumentElement(node);
|
||||
return isShadowRoot(result) ? result.host : result;
|
||||
}
|
||||
function getNearestOverflowAncestor(node) {
|
||||
const parentNode = getParentNode(node);
|
||||
if (isLastTraversableNode(parentNode)) {
|
||||
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
||||
}
|
||||
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
||||
return parentNode;
|
||||
}
|
||||
return getNearestOverflowAncestor(parentNode);
|
||||
}
|
||||
function getOverflowAncestors(node, list, traverseIframes) {
|
||||
var _node$ownerDocument2;
|
||||
if (list === void 0) {
|
||||
list = [];
|
||||
}
|
||||
if (traverseIframes === void 0) {
|
||||
traverseIframes = true;
|
||||
}
|
||||
const scrollableAncestor = getNearestOverflowAncestor(node);
|
||||
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
||||
const win = getWindow(scrollableAncestor);
|
||||
if (isBody) {
|
||||
const frameElement = getFrameElement(win);
|
||||
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
||||
} else {
|
||||
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
||||
}
|
||||
}
|
||||
function getFrameElement(win) {
|
||||
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
||||
}
|
||||
|
||||
exports.getComputedStyle = getComputedStyle;
|
||||
exports.getContainingBlock = getContainingBlock;
|
||||
exports.getDocumentElement = getDocumentElement;
|
||||
exports.getFrameElement = getFrameElement;
|
||||
exports.getNearestOverflowAncestor = getNearestOverflowAncestor;
|
||||
exports.getNodeName = getNodeName;
|
||||
exports.getNodeScroll = getNodeScroll;
|
||||
exports.getOverflowAncestors = getOverflowAncestors;
|
||||
exports.getParentNode = getParentNode;
|
||||
exports.getWindow = getWindow;
|
||||
exports.isContainingBlock = isContainingBlock;
|
||||
exports.isElement = isElement;
|
||||
exports.isHTMLElement = isHTMLElement;
|
||||
exports.isLastTraversableNode = isLastTraversableNode;
|
||||
exports.isNode = isNode;
|
||||
exports.isOverflowElement = isOverflowElement;
|
||||
exports.isShadowRoot = isShadowRoot;
|
||||
exports.isTableElement = isTableElement;
|
||||
exports.isTopLayer = isTopLayer;
|
||||
exports.isWebKit = isWebKit;
|
||||
|
||||
}));
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"sideEffects": false,
|
||||
"main": "floating-ui.utils.dom.umd.js",
|
||||
"module": "floating-ui.utils.dom.esm.js",
|
||||
"types": "floating-ui.utils.dom.d.ts"
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
{
|
||||
"name": "@floating-ui/utils",
|
||||
"version": "0.2.11",
|
||||
"description": "Utilities for Floating UI",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"main": "./dist/floating-ui.utils.umd.js",
|
||||
"module": "./dist/floating-ui.utils.esm.js",
|
||||
"types": "./dist/floating-ui.utils.d.ts",
|
||||
"sideEffects": false,
|
||||
"files": [
|
||||
"dist",
|
||||
"dom"
|
||||
],
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/floating-ui.utils.d.mts",
|
||||
"default": "./dist/floating-ui.utils.mjs"
|
||||
},
|
||||
"types": "./dist/floating-ui.utils.d.ts",
|
||||
"module": "./dist/floating-ui.utils.esm.js",
|
||||
"default": "./dist/floating-ui.utils.umd.js"
|
||||
},
|
||||
"./dom": {
|
||||
"import": {
|
||||
"types": "./dist/floating-ui.utils.dom.d.mts",
|
||||
"default": "./dist/floating-ui.utils.dom.mjs"
|
||||
},
|
||||
"types": "./dist/floating-ui.utils.dom.d.ts",
|
||||
"module": "./dist/floating-ui.utils.dom.esm.js",
|
||||
"default": "./dist/floating-ui.utils.dom.umd.js"
|
||||
}
|
||||
},
|
||||
"author": "atomiks",
|
||||
"license": "MIT",
|
||||
"bugs": "https://github.com/floating-ui/floating-ui",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/floating-ui/floating-ui.git",
|
||||
"directory": "packages/utils"
|
||||
},
|
||||
"homepage": "https://floating-ui.com",
|
||||
"keywords": [
|
||||
"tooltip",
|
||||
"popover",
|
||||
"dropdown",
|
||||
"menu",
|
||||
"popup",
|
||||
"positioning"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@testing-library/jest-dom": "^6.1.6",
|
||||
"config": "0.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"format": "prettier --write .",
|
||||
"clean": "rimraf dist out-tsc dom react",
|
||||
"test": "vitest run --globals",
|
||||
"test:watch": "vitest watch --globals",
|
||||
"dev": "rollup -c -w",
|
||||
"build": "rollup -c",
|
||||
"build:api": "build-api --tsc tsconfig.lib.json --aec api-extractor.json --aec api-extractor.dom.json --aec api-extractor.react.json",
|
||||
"publint": "publint",
|
||||
"typecheck": "tsc -b"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
Copyright 2024 Justin Ridgewell <justin@ridgewell.name>
|
||||
|
||||
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.
|
||||