39789 lines
1.5 MiB
39789 lines
1.5 MiB
"use strict";
|
|
(self["webpackChunk_woocommerce_storybook"] = self["webpackChunk_woocommerce_storybook"] || []).push([[5384],{
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/3UYWTADI.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ N: () => (/* binding */ createPopoverStore)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _YOHCVXJB_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/YOHCVXJB.js");
|
|
/* harmony import */ var _EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/EQQLU3CG.js");
|
|
/* harmony import */ var _PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js");
|
|
/* harmony import */ var _3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/3YLGPPWQ.js");
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
// src/popover/popover-store.ts
|
|
function createPopoverStore(_a = {}) {
|
|
var _b = _a, {
|
|
popover: otherPopover
|
|
} = _b, props = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_0__/* .__objRest */ .YG)(_b, [
|
|
"popover"
|
|
]);
|
|
const store = (0,_EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_1__/* .mergeStore */ .od)(
|
|
props.store,
|
|
(0,_EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_1__/* .omit */ .cJ)(otherPopover, [
|
|
"arrowElement",
|
|
"anchorElement",
|
|
"contentElement",
|
|
"popoverElement",
|
|
"disclosureElement"
|
|
])
|
|
);
|
|
(0,_EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_1__/* .throwOnConflictingProps */ .UE)(props, store);
|
|
const syncState = store == null ? void 0 : store.getState();
|
|
const dialog = (0,_YOHCVXJB_js__WEBPACK_IMPORTED_MODULE_2__/* .createDialogStore */ .Y)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_0__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_0__/* .__spreadValues */ .IA)({}, props), { store }));
|
|
const placement = (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_3__/* .defaultValue */ .Jh)(
|
|
props.placement,
|
|
syncState == null ? void 0 : syncState.placement,
|
|
"bottom"
|
|
);
|
|
const initialState = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_0__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_0__/* .__spreadValues */ .IA)({}, dialog.getState()), {
|
|
placement,
|
|
currentPlacement: placement,
|
|
anchorElement: (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_3__/* .defaultValue */ .Jh)(syncState == null ? void 0 : syncState.anchorElement, null),
|
|
popoverElement: (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_3__/* .defaultValue */ .Jh)(syncState == null ? void 0 : syncState.popoverElement, null),
|
|
arrowElement: (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_3__/* .defaultValue */ .Jh)(syncState == null ? void 0 : syncState.arrowElement, null),
|
|
rendered: Symbol("rendered")
|
|
});
|
|
const popover = (0,_EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_1__/* .createStore */ .y$)(initialState, dialog, store);
|
|
return (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_0__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_0__/* .__spreadValues */ .IA)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_0__/* .__spreadValues */ .IA)({}, dialog), popover), {
|
|
setAnchorElement: (element) => popover.setState("anchorElement", element),
|
|
setPopoverElement: (element) => popover.setState("popoverElement", element),
|
|
setArrowElement: (element) => popover.setState("arrowElement", element),
|
|
render: () => popover.setState("rendered", Symbol("rendered"))
|
|
});
|
|
}
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/3YLGPPWQ.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ IA: () => (/* binding */ __spreadValues),
|
|
/* harmony export */ YG: () => (/* binding */ __objRest),
|
|
/* harmony export */ ko: () => (/* binding */ __spreadProps)
|
|
/* harmony export */ });
|
|
"use client";
|
|
var __defProp = Object.defineProperty;
|
|
var __defProps = Object.defineProperties;
|
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var __spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (__hasOwnProp.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
if (__getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
if (__propIsEnum.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
var __objRest = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && __getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(source)) {
|
|
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/6DHTHWXD.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ I: () => (/* binding */ createCollectionStore)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/EQQLU3CG.js");
|
|
/* harmony import */ var _PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js");
|
|
/* harmony import */ var _HWOIWM4O_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/HWOIWM4O.js");
|
|
/* harmony import */ var _3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/3YLGPPWQ.js");
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
// src/collection/collection-store.ts
|
|
function isElementPreceding(a, b) {
|
|
return Boolean(
|
|
b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING
|
|
);
|
|
}
|
|
function sortBasedOnDOMPosition(items) {
|
|
const pairs = items.map((item, index) => [index, item]);
|
|
let isOrderDifferent = false;
|
|
pairs.sort(([indexA, a], [indexB, b]) => {
|
|
const elementA = a.element;
|
|
const elementB = b.element;
|
|
if (elementA === elementB) return 0;
|
|
if (!elementA || !elementB) return 0;
|
|
if (isElementPreceding(elementA, elementB)) {
|
|
if (indexA > indexB) {
|
|
isOrderDifferent = true;
|
|
}
|
|
return -1;
|
|
}
|
|
if (indexA < indexB) {
|
|
isOrderDifferent = true;
|
|
}
|
|
return 1;
|
|
});
|
|
if (isOrderDifferent) {
|
|
return pairs.map(([_, item]) => item);
|
|
}
|
|
return items;
|
|
}
|
|
function getCommonParent(items) {
|
|
var _a;
|
|
const firstItem = items.find((item) => !!item.element);
|
|
const lastItem = [...items].reverse().find((item) => !!item.element);
|
|
let parentElement = (_a = firstItem == null ? void 0 : firstItem.element) == null ? void 0 : _a.parentElement;
|
|
while (parentElement && (lastItem == null ? void 0 : lastItem.element)) {
|
|
const parent = parentElement;
|
|
if (lastItem && parent.contains(lastItem.element)) {
|
|
return parentElement;
|
|
}
|
|
parentElement = parentElement.parentElement;
|
|
}
|
|
return (0,_HWOIWM4O_js__WEBPACK_IMPORTED_MODULE_0__/* .getDocument */ .YE)(parentElement).body;
|
|
}
|
|
function getPrivateStore(store) {
|
|
return store == null ? void 0 : store.__unstablePrivateStore;
|
|
}
|
|
function createCollectionStore(props = {}) {
|
|
var _a;
|
|
(0,_EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_1__/* .throwOnConflictingProps */ .UE)(props, props.store);
|
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
const items = (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_2__/* .defaultValue */ .Jh)(
|
|
props.items,
|
|
syncState == null ? void 0 : syncState.items,
|
|
props.defaultItems,
|
|
[]
|
|
);
|
|
const itemsMap = new Map(items.map((item) => [item.id, item]));
|
|
const initialState = {
|
|
items,
|
|
renderedItems: (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_2__/* .defaultValue */ .Jh)(syncState == null ? void 0 : syncState.renderedItems, [])
|
|
};
|
|
const syncPrivateStore = getPrivateStore(props.store);
|
|
const privateStore = (0,_EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_1__/* .createStore */ .y$)(
|
|
{ items, renderedItems: initialState.renderedItems },
|
|
syncPrivateStore
|
|
);
|
|
const collection = (0,_EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_1__/* .createStore */ .y$)(initialState, props.store);
|
|
const sortItems = (renderedItems) => {
|
|
const sortedItems = sortBasedOnDOMPosition(renderedItems);
|
|
privateStore.setState("renderedItems", sortedItems);
|
|
collection.setState("renderedItems", sortedItems);
|
|
};
|
|
(0,_EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_1__/* .setup */ .mj)(collection, () => (0,_EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_1__/* .init */ .Ts)(privateStore));
|
|
(0,_EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_1__/* .setup */ .mj)(privateStore, () => {
|
|
return (0,_EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_1__/* .batch */ .vA)(privateStore, ["items"], (state) => {
|
|
collection.setState("items", state.items);
|
|
});
|
|
});
|
|
(0,_EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_1__/* .setup */ .mj)(privateStore, () => {
|
|
return (0,_EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_1__/* .batch */ .vA)(privateStore, ["renderedItems"], (state) => {
|
|
let firstRun = true;
|
|
let raf = requestAnimationFrame(() => {
|
|
const { renderedItems } = collection.getState();
|
|
if (state.renderedItems === renderedItems) return;
|
|
sortItems(state.renderedItems);
|
|
});
|
|
if (typeof IntersectionObserver !== "function") {
|
|
return () => cancelAnimationFrame(raf);
|
|
}
|
|
const ioCallback = () => {
|
|
if (firstRun) {
|
|
firstRun = false;
|
|
return;
|
|
}
|
|
cancelAnimationFrame(raf);
|
|
raf = requestAnimationFrame(() => sortItems(state.renderedItems));
|
|
};
|
|
const root = getCommonParent(state.renderedItems);
|
|
const observer = new IntersectionObserver(ioCallback, { root });
|
|
for (const item of state.renderedItems) {
|
|
if (!item.element) continue;
|
|
observer.observe(item.element);
|
|
}
|
|
return () => {
|
|
cancelAnimationFrame(raf);
|
|
observer.disconnect();
|
|
};
|
|
});
|
|
});
|
|
const mergeItem = (item, setItems, canDeleteFromMap = false) => {
|
|
let prevItem;
|
|
setItems((items2) => {
|
|
const index = items2.findIndex(({ id }) => id === item.id);
|
|
const nextItems = items2.slice();
|
|
if (index !== -1) {
|
|
prevItem = items2[index];
|
|
const nextItem = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_3__/* .__spreadValues */ .IA)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_3__/* .__spreadValues */ .IA)({}, prevItem), item);
|
|
nextItems[index] = nextItem;
|
|
itemsMap.set(item.id, nextItem);
|
|
} else {
|
|
nextItems.push(item);
|
|
itemsMap.set(item.id, item);
|
|
}
|
|
return nextItems;
|
|
});
|
|
const unmergeItem = () => {
|
|
setItems((items2) => {
|
|
if (!prevItem) {
|
|
if (canDeleteFromMap) {
|
|
itemsMap.delete(item.id);
|
|
}
|
|
return items2.filter(({ id }) => id !== item.id);
|
|
}
|
|
const index = items2.findIndex(({ id }) => id === item.id);
|
|
if (index === -1) return items2;
|
|
const nextItems = items2.slice();
|
|
nextItems[index] = prevItem;
|
|
itemsMap.set(item.id, prevItem);
|
|
return nextItems;
|
|
});
|
|
};
|
|
return unmergeItem;
|
|
};
|
|
const registerItem = (item) => mergeItem(
|
|
item,
|
|
(getItems) => privateStore.setState("items", getItems),
|
|
true
|
|
);
|
|
return (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_3__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_3__/* .__spreadValues */ .IA)({}, collection), {
|
|
registerItem,
|
|
renderItem: (item) => (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_2__/* .chain */ .cy)(
|
|
registerItem(item),
|
|
mergeItem(
|
|
item,
|
|
(getItems) => privateStore.setState("renderedItems", getItems)
|
|
)
|
|
),
|
|
item: (id) => {
|
|
if (!id) return null;
|
|
let item = itemsMap.get(id);
|
|
if (!item) {
|
|
const { items: items2 } = collection.getState();
|
|
item = items2.find((item2) => item2.id === id);
|
|
if (item) {
|
|
itemsMap.set(id, item);
|
|
}
|
|
}
|
|
return item || null;
|
|
},
|
|
// @ts-expect-error Internal
|
|
__unstablePrivateStore: privateStore
|
|
});
|
|
}
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/6E4KKOSB.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ h: () => (/* binding */ createDisclosureStore)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/EQQLU3CG.js");
|
|
/* harmony import */ var _PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js");
|
|
/* harmony import */ var _3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/3YLGPPWQ.js");
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
// src/disclosure/disclosure-store.ts
|
|
function createDisclosureStore(props = {}) {
|
|
const store = (0,_EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_0__/* .mergeStore */ .od)(
|
|
props.store,
|
|
(0,_EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_0__/* .omit */ .cJ)(props.disclosure, ["contentElement", "disclosureElement"])
|
|
);
|
|
(0,_EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_0__/* .throwOnConflictingProps */ .UE)(props, store);
|
|
const syncState = store == null ? void 0 : store.getState();
|
|
const open = (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_1__/* .defaultValue */ .Jh)(
|
|
props.open,
|
|
syncState == null ? void 0 : syncState.open,
|
|
props.defaultOpen,
|
|
false
|
|
);
|
|
const animated = (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_1__/* .defaultValue */ .Jh)(props.animated, syncState == null ? void 0 : syncState.animated, false);
|
|
const initialState = {
|
|
open,
|
|
animated,
|
|
animating: !!animated && open,
|
|
mounted: open,
|
|
contentElement: (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_1__/* .defaultValue */ .Jh)(syncState == null ? void 0 : syncState.contentElement, null),
|
|
disclosureElement: (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_1__/* .defaultValue */ .Jh)(syncState == null ? void 0 : syncState.disclosureElement, null)
|
|
};
|
|
const disclosure = (0,_EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_0__/* .createStore */ .y$)(initialState, store);
|
|
(0,_EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_0__/* .setup */ .mj)(
|
|
disclosure,
|
|
() => (0,_EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_0__/* .sync */ .OH)(disclosure, ["animated", "animating"], (state) => {
|
|
if (state.animated) return;
|
|
disclosure.setState("animating", false);
|
|
})
|
|
);
|
|
(0,_EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_0__/* .setup */ .mj)(
|
|
disclosure,
|
|
() => (0,_EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_0__/* .subscribe */ .B1)(disclosure, ["open"], () => {
|
|
if (!disclosure.getState().animated) return;
|
|
disclosure.setState("animating", true);
|
|
})
|
|
);
|
|
(0,_EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_0__/* .setup */ .mj)(
|
|
disclosure,
|
|
() => (0,_EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_0__/* .sync */ .OH)(disclosure, ["open", "animating"], (state) => {
|
|
disclosure.setState("mounted", state.open || state.animating);
|
|
})
|
|
);
|
|
return (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__/* .__spreadValues */ .IA)({}, disclosure), {
|
|
disclosure: props.disclosure,
|
|
setOpen: (value) => disclosure.setState("open", value),
|
|
show: () => disclosure.setState("open", true),
|
|
hide: () => disclosure.setState("open", false),
|
|
toggle: () => disclosure.setState("open", (open2) => !open2),
|
|
stopAnimation: () => disclosure.setState("animating", false),
|
|
setContentElement: (value) => disclosure.setState("contentElement", value),
|
|
setDisclosureElement: (value) => disclosure.setState("disclosureElement", value)
|
|
});
|
|
}
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/7PRQYBBV.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ $r: () => (/* binding */ toArray),
|
|
/* harmony export */ M9: () => (/* binding */ flatten2DArray),
|
|
/* harmony export */ q7: () => (/* binding */ reverseArray)
|
|
/* harmony export */ });
|
|
/* unused harmony export addItemToArray */
|
|
"use client";
|
|
|
|
// src/utils/array.ts
|
|
function toArray(arg) {
|
|
if (Array.isArray(arg)) {
|
|
return arg;
|
|
}
|
|
return typeof arg !== "undefined" ? [arg] : [];
|
|
}
|
|
function addItemToArray(array, item, index = -1) {
|
|
if (!(index in array)) {
|
|
return [...array, item];
|
|
}
|
|
return [...array.slice(0, index), item, ...array.slice(index)];
|
|
}
|
|
function flatten2DArray(array) {
|
|
const flattened = [];
|
|
for (const row of array) {
|
|
flattened.push(...row);
|
|
}
|
|
return flattened;
|
|
}
|
|
function reverseArray(array) {
|
|
return array.slice().reverse();
|
|
}
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/D7EIQZAU.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ z: () => (/* binding */ createCompositeStore)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _6DHTHWXD_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/6DHTHWXD.js");
|
|
/* harmony import */ var _7PRQYBBV_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/7PRQYBBV.js");
|
|
/* harmony import */ var _EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/EQQLU3CG.js");
|
|
/* harmony import */ var _PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js");
|
|
/* harmony import */ var _3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/3YLGPPWQ.js");
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// src/composite/composite-store.ts
|
|
var NULL_ITEM = { id: null };
|
|
function findFirstEnabledItem(items, excludeId) {
|
|
return items.find((item) => {
|
|
if (excludeId) {
|
|
return !item.disabled && item.id !== excludeId;
|
|
}
|
|
return !item.disabled;
|
|
});
|
|
}
|
|
function getEnabledItems(items, excludeId) {
|
|
return items.filter((item) => {
|
|
if (excludeId) {
|
|
return !item.disabled && item.id !== excludeId;
|
|
}
|
|
return !item.disabled;
|
|
});
|
|
}
|
|
function getOppositeOrientation(orientation) {
|
|
if (orientation === "vertical") return "horizontal";
|
|
if (orientation === "horizontal") return "vertical";
|
|
return;
|
|
}
|
|
function getItemsInRow(items, rowId) {
|
|
return items.filter((item) => item.rowId === rowId);
|
|
}
|
|
function flipItems(items, activeId, shouldInsertNullItem = false) {
|
|
const index = items.findIndex((item) => item.id === activeId);
|
|
return [
|
|
...items.slice(index + 1),
|
|
...shouldInsertNullItem ? [NULL_ITEM] : [],
|
|
...items.slice(0, index)
|
|
];
|
|
}
|
|
function groupItemsByRows(items) {
|
|
const rows = [];
|
|
for (const item of items) {
|
|
const row = rows.find((currentRow) => {
|
|
var _a;
|
|
return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId;
|
|
});
|
|
if (row) {
|
|
row.push(item);
|
|
} else {
|
|
rows.push([item]);
|
|
}
|
|
}
|
|
return rows;
|
|
}
|
|
function getMaxRowLength(array) {
|
|
let maxLength = 0;
|
|
for (const { length } of array) {
|
|
if (length > maxLength) {
|
|
maxLength = length;
|
|
}
|
|
}
|
|
return maxLength;
|
|
}
|
|
function createEmptyItem(rowId) {
|
|
return {
|
|
id: "__EMPTY_ITEM__",
|
|
disabled: true,
|
|
rowId
|
|
};
|
|
}
|
|
function normalizeRows(rows, activeId, focusShift) {
|
|
const maxLength = getMaxRowLength(rows);
|
|
for (const row of rows) {
|
|
for (let i = 0; i < maxLength; i += 1) {
|
|
const item = row[i];
|
|
if (!item || focusShift && item.disabled) {
|
|
const isFirst = i === 0;
|
|
const previousItem = isFirst && focusShift ? findFirstEnabledItem(row) : row[i - 1];
|
|
row[i] = previousItem && activeId !== previousItem.id && focusShift ? previousItem : createEmptyItem(previousItem == null ? void 0 : previousItem.rowId);
|
|
}
|
|
}
|
|
}
|
|
return rows;
|
|
}
|
|
function verticalizeItems(items) {
|
|
const rows = groupItemsByRows(items);
|
|
const maxLength = getMaxRowLength(rows);
|
|
const verticalized = [];
|
|
for (let i = 0; i < maxLength; i += 1) {
|
|
for (const row of rows) {
|
|
const item = row[i];
|
|
if (item) {
|
|
verticalized.push((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_0__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_0__/* .__spreadValues */ .IA)({}, item), {
|
|
// If there's no rowId, it means that it's not a grid composite, but
|
|
// a single row instead. So, instead of verticalizing it, that is,
|
|
// assigning a different rowId based on the column index, we keep it
|
|
// undefined so they will be part of the same row. This is useful
|
|
// when using up/down on one-dimensional composites.
|
|
rowId: item.rowId ? `${i}` : void 0
|
|
}));
|
|
}
|
|
}
|
|
}
|
|
return verticalized;
|
|
}
|
|
function createCompositeStore(props = {}) {
|
|
var _a;
|
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
const collection = (0,_6DHTHWXD_js__WEBPACK_IMPORTED_MODULE_1__/* .createCollectionStore */ .I)(props);
|
|
const activeId = (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_2__/* .defaultValue */ .Jh)(
|
|
props.activeId,
|
|
syncState == null ? void 0 : syncState.activeId,
|
|
props.defaultActiveId
|
|
);
|
|
const initialState = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_0__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_0__/* .__spreadValues */ .IA)({}, collection.getState()), {
|
|
activeId,
|
|
baseElement: (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_2__/* .defaultValue */ .Jh)(syncState == null ? void 0 : syncState.baseElement, null),
|
|
includesBaseElement: (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_2__/* .defaultValue */ .Jh)(
|
|
props.includesBaseElement,
|
|
syncState == null ? void 0 : syncState.includesBaseElement,
|
|
activeId === null
|
|
),
|
|
moves: (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_2__/* .defaultValue */ .Jh)(syncState == null ? void 0 : syncState.moves, 0),
|
|
orientation: (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_2__/* .defaultValue */ .Jh)(
|
|
props.orientation,
|
|
syncState == null ? void 0 : syncState.orientation,
|
|
"both"
|
|
),
|
|
rtl: (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_2__/* .defaultValue */ .Jh)(props.rtl, syncState == null ? void 0 : syncState.rtl, false),
|
|
virtualFocus: (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_2__/* .defaultValue */ .Jh)(
|
|
props.virtualFocus,
|
|
syncState == null ? void 0 : syncState.virtualFocus,
|
|
false
|
|
),
|
|
focusLoop: (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_2__/* .defaultValue */ .Jh)(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false),
|
|
focusWrap: (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_2__/* .defaultValue */ .Jh)(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false),
|
|
focusShift: (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_2__/* .defaultValue */ .Jh)(props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
|
|
});
|
|
const composite = (0,_EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_3__/* .createStore */ .y$)(initialState, collection, props.store);
|
|
(0,_EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_3__/* .setup */ .mj)(
|
|
composite,
|
|
() => (0,_EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_3__/* .sync */ .OH)(composite, ["renderedItems", "activeId"], (state) => {
|
|
composite.setState("activeId", (activeId2) => {
|
|
var _a2;
|
|
if (activeId2 !== void 0) return activeId2;
|
|
return (_a2 = findFirstEnabledItem(state.renderedItems)) == null ? void 0 : _a2.id;
|
|
});
|
|
})
|
|
);
|
|
const getNextId = (items, orientation, hasNullItem, skip) => {
|
|
var _a2, _b;
|
|
const { activeId: activeId2, rtl, focusLoop, focusWrap, includesBaseElement } = composite.getState();
|
|
const isHorizontal = orientation !== "vertical";
|
|
const isRTL = rtl && isHorizontal;
|
|
const allItems = isRTL ? (0,_7PRQYBBV_js__WEBPACK_IMPORTED_MODULE_4__/* .reverseArray */ .q7)(items) : items;
|
|
if (activeId2 == null) {
|
|
return (_a2 = findFirstEnabledItem(allItems)) == null ? void 0 : _a2.id;
|
|
}
|
|
const activeItem = allItems.find((item) => item.id === activeId2);
|
|
if (!activeItem) {
|
|
return (_b = findFirstEnabledItem(allItems)) == null ? void 0 : _b.id;
|
|
}
|
|
const isGrid = !!activeItem.rowId;
|
|
const activeIndex = allItems.indexOf(activeItem);
|
|
const nextItems = allItems.slice(activeIndex + 1);
|
|
const nextItemsInRow = getItemsInRow(nextItems, activeItem.rowId);
|
|
if (skip !== void 0) {
|
|
const nextEnabledItemsInRow = getEnabledItems(nextItemsInRow, activeId2);
|
|
const nextItem2 = nextEnabledItemsInRow.slice(skip)[0] || // If we can't find an item, just return the last one.
|
|
nextEnabledItemsInRow[nextEnabledItemsInRow.length - 1];
|
|
return nextItem2 == null ? void 0 : nextItem2.id;
|
|
}
|
|
const oppositeOrientation = getOppositeOrientation(
|
|
// If it's a grid and orientation is not set, it's a next/previous call,
|
|
// which is inherently horizontal. up/down will call next with orientation
|
|
// set to vertical by default (see below on up/down methods).
|
|
isGrid ? orientation || "horizontal" : orientation
|
|
);
|
|
const canLoop = focusLoop && focusLoop !== oppositeOrientation;
|
|
const canWrap = isGrid && focusWrap && focusWrap !== oppositeOrientation;
|
|
hasNullItem = hasNullItem || !isGrid && canLoop && includesBaseElement;
|
|
if (canLoop) {
|
|
const loopItems = canWrap && !hasNullItem ? allItems : getItemsInRow(allItems, activeItem.rowId);
|
|
const sortedItems = flipItems(loopItems, activeId2, hasNullItem);
|
|
const nextItem2 = findFirstEnabledItem(sortedItems, activeId2);
|
|
return nextItem2 == null ? void 0 : nextItem2.id;
|
|
}
|
|
if (canWrap) {
|
|
const nextItem2 = findFirstEnabledItem(
|
|
// We can use nextItems, which contains all the next items, including
|
|
// items from other rows, to wrap between rows. However, if there is a
|
|
// null item (the composite container), we'll only use the next items in
|
|
// the row. So moving next from the last item will focus on the
|
|
// composite container. On grid composites, horizontal navigation never
|
|
// focuses on the composite container, only vertical.
|
|
hasNullItem ? nextItemsInRow : nextItems,
|
|
activeId2
|
|
);
|
|
const nextId = hasNullItem ? (nextItem2 == null ? void 0 : nextItem2.id) || null : nextItem2 == null ? void 0 : nextItem2.id;
|
|
return nextId;
|
|
}
|
|
const nextItem = findFirstEnabledItem(nextItemsInRow, activeId2);
|
|
if (!nextItem && hasNullItem) {
|
|
return null;
|
|
}
|
|
return nextItem == null ? void 0 : nextItem.id;
|
|
};
|
|
return (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_0__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_0__/* .__spreadValues */ .IA)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_0__/* .__spreadValues */ .IA)({}, collection), composite), {
|
|
setBaseElement: (element) => composite.setState("baseElement", element),
|
|
setActiveId: (id) => composite.setState("activeId", id),
|
|
move: (id) => {
|
|
if (id === void 0) return;
|
|
composite.setState("activeId", id);
|
|
composite.setState("moves", (moves) => moves + 1);
|
|
},
|
|
first: () => {
|
|
var _a2;
|
|
return (_a2 = findFirstEnabledItem(composite.getState().renderedItems)) == null ? void 0 : _a2.id;
|
|
},
|
|
last: () => {
|
|
var _a2;
|
|
return (_a2 = findFirstEnabledItem((0,_7PRQYBBV_js__WEBPACK_IMPORTED_MODULE_4__/* .reverseArray */ .q7)(composite.getState().renderedItems))) == null ? void 0 : _a2.id;
|
|
},
|
|
next: (skip) => {
|
|
const { renderedItems, orientation } = composite.getState();
|
|
return getNextId(renderedItems, orientation, false, skip);
|
|
},
|
|
previous: (skip) => {
|
|
var _a2;
|
|
const { renderedItems, orientation, includesBaseElement } = composite.getState();
|
|
const isGrid = !!((_a2 = findFirstEnabledItem(renderedItems)) == null ? void 0 : _a2.rowId);
|
|
const hasNullItem = !isGrid && includesBaseElement;
|
|
return getNextId(
|
|
(0,_7PRQYBBV_js__WEBPACK_IMPORTED_MODULE_4__/* .reverseArray */ .q7)(renderedItems),
|
|
orientation,
|
|
hasNullItem,
|
|
skip
|
|
);
|
|
},
|
|
down: (skip) => {
|
|
const {
|
|
activeId: activeId2,
|
|
renderedItems,
|
|
focusShift,
|
|
focusLoop,
|
|
includesBaseElement
|
|
} = composite.getState();
|
|
const shouldShift = focusShift && !skip;
|
|
const verticalItems = verticalizeItems(
|
|
(0,_7PRQYBBV_js__WEBPACK_IMPORTED_MODULE_4__/* .flatten2DArray */ .M9)(
|
|
normalizeRows(groupItemsByRows(renderedItems), activeId2, shouldShift)
|
|
)
|
|
);
|
|
const canLoop = focusLoop && focusLoop !== "horizontal";
|
|
const hasNullItem = canLoop && includesBaseElement;
|
|
return getNextId(verticalItems, "vertical", hasNullItem, skip);
|
|
},
|
|
up: (skip) => {
|
|
const { activeId: activeId2, renderedItems, focusShift, includesBaseElement } = composite.getState();
|
|
const shouldShift = focusShift && !skip;
|
|
const verticalItems = verticalizeItems(
|
|
(0,_7PRQYBBV_js__WEBPACK_IMPORTED_MODULE_4__/* .reverseArray */ .q7)(
|
|
(0,_7PRQYBBV_js__WEBPACK_IMPORTED_MODULE_4__/* .flatten2DArray */ .M9)(
|
|
normalizeRows(
|
|
groupItemsByRows(renderedItems),
|
|
activeId2,
|
|
shouldShift
|
|
)
|
|
)
|
|
)
|
|
);
|
|
const hasNullItem = includesBaseElement;
|
|
return getNextId(verticalItems, "vertical", hasNullItem, skip);
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/EACLTACN.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ y: () => (/* binding */ createHovercardStore)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _3UYWTADI_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/3UYWTADI.js");
|
|
/* harmony import */ var _EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/EQQLU3CG.js");
|
|
/* harmony import */ var _PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js");
|
|
/* harmony import */ var _3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/3YLGPPWQ.js");
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
// src/hovercard/hovercard-store.ts
|
|
function createHovercardStore(props = {}) {
|
|
var _a;
|
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
const popover = (0,_3UYWTADI_js__WEBPACK_IMPORTED_MODULE_0__/* .createPopoverStore */ .N)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_1__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_1__/* .__spreadValues */ .IA)({}, props), {
|
|
placement: (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_2__/* .defaultValue */ .Jh)(
|
|
props.placement,
|
|
syncState == null ? void 0 : syncState.placement,
|
|
"bottom"
|
|
)
|
|
}));
|
|
const timeout = (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_2__/* .defaultValue */ .Jh)(props.timeout, syncState == null ? void 0 : syncState.timeout, 500);
|
|
const initialState = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_1__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_1__/* .__spreadValues */ .IA)({}, popover.getState()), {
|
|
timeout,
|
|
showTimeout: (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_2__/* .defaultValue */ .Jh)(props.showTimeout, syncState == null ? void 0 : syncState.showTimeout),
|
|
hideTimeout: (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_2__/* .defaultValue */ .Jh)(props.hideTimeout, syncState == null ? void 0 : syncState.hideTimeout),
|
|
autoFocusOnShow: (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_2__/* .defaultValue */ .Jh)(syncState == null ? void 0 : syncState.autoFocusOnShow, false)
|
|
});
|
|
const hovercard = (0,_EQQLU3CG_js__WEBPACK_IMPORTED_MODULE_3__/* .createStore */ .y$)(initialState, popover, props.store);
|
|
return (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_1__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_1__/* .__spreadValues */ .IA)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_1__/* .__spreadValues */ .IA)({}, popover), hovercard), {
|
|
setAutoFocusOnShow: (value) => hovercard.setState("autoFocusOnShow", value)
|
|
});
|
|
}
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/EQQLU3CG.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ B1: () => (/* binding */ subscribe),
|
|
/* harmony export */ OH: () => (/* binding */ sync),
|
|
/* harmony export */ Ts: () => (/* binding */ init),
|
|
/* harmony export */ UE: () => (/* binding */ throwOnConflictingProps),
|
|
/* harmony export */ Up: () => (/* binding */ pick2),
|
|
/* harmony export */ cJ: () => (/* binding */ omit2),
|
|
/* harmony export */ mj: () => (/* binding */ setup),
|
|
/* harmony export */ od: () => (/* binding */ mergeStore),
|
|
/* harmony export */ vA: () => (/* binding */ batch),
|
|
/* harmony export */ y$: () => (/* binding */ createStore)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js");
|
|
/* harmony import */ var _3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/3YLGPPWQ.js");
|
|
"use client";
|
|
|
|
|
|
|
|
// src/utils/store.ts
|
|
function getInternal(store, key) {
|
|
const internals = store.__unstableInternals;
|
|
(0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_0__/* .invariant */ .V1)(internals, "Invalid store");
|
|
return internals[key];
|
|
}
|
|
function createStore(initialState, ...stores) {
|
|
let state = initialState;
|
|
let prevStateBatch = state;
|
|
let lastUpdate = Symbol();
|
|
let destroy = _PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_0__/* .noop */ .lQ;
|
|
const instances = /* @__PURE__ */ new Set();
|
|
const updatedKeys = /* @__PURE__ */ new Set();
|
|
const setups = /* @__PURE__ */ new Set();
|
|
const listeners = /* @__PURE__ */ new Set();
|
|
const batchListeners = /* @__PURE__ */ new Set();
|
|
const disposables = /* @__PURE__ */ new WeakMap();
|
|
const listenerKeys = /* @__PURE__ */ new WeakMap();
|
|
const storeSetup = (callback) => {
|
|
setups.add(callback);
|
|
return () => setups.delete(callback);
|
|
};
|
|
const storeInit = () => {
|
|
const initialized = instances.size;
|
|
const instance = Symbol();
|
|
instances.add(instance);
|
|
const maybeDestroy = () => {
|
|
instances.delete(instance);
|
|
if (instances.size) return;
|
|
destroy();
|
|
};
|
|
if (initialized) return maybeDestroy;
|
|
const desyncs = (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_0__/* .getKeys */ .xD)(state).map(
|
|
(key) => (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_0__/* .chain */ .cy)(
|
|
...stores.map((store) => {
|
|
var _a;
|
|
const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store);
|
|
if (!storeState) return;
|
|
if (!(0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_0__/* .hasOwnProperty */ .mQ)(storeState, key)) return;
|
|
return sync(store, [key], (state2) => {
|
|
setState(
|
|
key,
|
|
state2[key],
|
|
// @ts-expect-error - Not public API. This is just to prevent
|
|
// infinite loops.
|
|
true
|
|
);
|
|
});
|
|
})
|
|
)
|
|
);
|
|
const teardowns = [];
|
|
for (const setup2 of setups) {
|
|
teardowns.push(setup2());
|
|
}
|
|
const cleanups = stores.map(init);
|
|
destroy = (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_0__/* .chain */ .cy)(...desyncs, ...teardowns, ...cleanups);
|
|
return maybeDestroy;
|
|
};
|
|
const sub = (keys, listener, set = listeners) => {
|
|
set.add(listener);
|
|
listenerKeys.set(listener, keys);
|
|
return () => {
|
|
var _a;
|
|
(_a = disposables.get(listener)) == null ? void 0 : _a();
|
|
disposables.delete(listener);
|
|
listenerKeys.delete(listener);
|
|
set.delete(listener);
|
|
};
|
|
};
|
|
const storeSubscribe = (keys, listener) => sub(keys, listener);
|
|
const storeSync = (keys, listener) => {
|
|
disposables.set(listener, listener(state, state));
|
|
return sub(keys, listener);
|
|
};
|
|
const storeBatch = (keys, listener) => {
|
|
disposables.set(listener, listener(state, prevStateBatch));
|
|
return sub(keys, listener, batchListeners);
|
|
};
|
|
const storePick = (keys) => createStore((0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_0__/* .pick */ .Up)(state, keys), finalStore);
|
|
const storeOmit = (keys) => createStore((0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_0__/* .omit */ .cJ)(state, keys), finalStore);
|
|
const getState = () => state;
|
|
const setState = (key, value, fromStores = false) => {
|
|
var _a;
|
|
if (!(0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_0__/* .hasOwnProperty */ .mQ)(state, key)) return;
|
|
const nextValue = (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_0__/* .applyState */ .Qh)(value, state[key]);
|
|
if (nextValue === state[key]) return;
|
|
if (!fromStores) {
|
|
for (const store of stores) {
|
|
(_a = store == null ? void 0 : store.setState) == null ? void 0 : _a.call(store, key, nextValue);
|
|
}
|
|
}
|
|
const prevState = state;
|
|
state = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_1__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_1__/* .__spreadValues */ .IA)({}, state), { [key]: nextValue });
|
|
const thisUpdate = Symbol();
|
|
lastUpdate = thisUpdate;
|
|
updatedKeys.add(key);
|
|
const run = (listener, prev, uKeys) => {
|
|
var _a2;
|
|
const keys = listenerKeys.get(listener);
|
|
const updated = (k) => uKeys ? uKeys.has(k) : k === key;
|
|
if (!keys || keys.some(updated)) {
|
|
(_a2 = disposables.get(listener)) == null ? void 0 : _a2();
|
|
disposables.set(listener, listener(state, prev));
|
|
}
|
|
};
|
|
for (const listener of listeners) {
|
|
run(listener, prevState);
|
|
}
|
|
queueMicrotask(() => {
|
|
if (lastUpdate !== thisUpdate) return;
|
|
const snapshot = state;
|
|
for (const listener of batchListeners) {
|
|
run(listener, prevStateBatch, updatedKeys);
|
|
}
|
|
prevStateBatch = snapshot;
|
|
updatedKeys.clear();
|
|
});
|
|
};
|
|
const finalStore = {
|
|
getState,
|
|
setState,
|
|
__unstableInternals: {
|
|
setup: storeSetup,
|
|
init: storeInit,
|
|
subscribe: storeSubscribe,
|
|
sync: storeSync,
|
|
batch: storeBatch,
|
|
pick: storePick,
|
|
omit: storeOmit
|
|
}
|
|
};
|
|
return finalStore;
|
|
}
|
|
function setup(store, ...args) {
|
|
if (!store) return;
|
|
return getInternal(store, "setup")(...args);
|
|
}
|
|
function init(store, ...args) {
|
|
if (!store) return;
|
|
return getInternal(store, "init")(...args);
|
|
}
|
|
function subscribe(store, ...args) {
|
|
if (!store) return;
|
|
return getInternal(store, "subscribe")(...args);
|
|
}
|
|
function sync(store, ...args) {
|
|
if (!store) return;
|
|
return getInternal(store, "sync")(...args);
|
|
}
|
|
function batch(store, ...args) {
|
|
if (!store) return;
|
|
return getInternal(store, "batch")(...args);
|
|
}
|
|
function omit2(store, ...args) {
|
|
if (!store) return;
|
|
return getInternal(store, "omit")(...args);
|
|
}
|
|
function pick2(store, ...args) {
|
|
if (!store) return;
|
|
return getInternal(store, "pick")(...args);
|
|
}
|
|
function mergeStore(...stores) {
|
|
const initialState = stores.reduce((state, store2) => {
|
|
var _a;
|
|
const nextState = (_a = store2 == null ? void 0 : store2.getState) == null ? void 0 : _a.call(store2);
|
|
if (!nextState) return state;
|
|
return Object.assign(state, nextState);
|
|
}, {});
|
|
const store = createStore(initialState, ...stores);
|
|
return store;
|
|
}
|
|
function throwOnConflictingProps(props, store) {
|
|
if (true) return;
|
|
if (!store) return;
|
|
const defaultKeys = Object.entries(props).filter(([key, value]) => key.startsWith("default") && value !== void 0).map(([key]) => {
|
|
var _a;
|
|
const stateKey = key.replace("default", "");
|
|
return `${((_a = stateKey[0]) == null ? void 0 : _a.toLowerCase()) || ""}${stateKey.slice(1)}`;
|
|
});
|
|
if (!defaultKeys.length) return;
|
|
const storeState = store.getState();
|
|
const conflictingProps = defaultKeys.filter(
|
|
(key) => (0,_PBFD2E7P_js__WEBPACK_IMPORTED_MODULE_0__/* .hasOwnProperty */ .mQ)(storeState, key)
|
|
);
|
|
if (!conflictingProps.length) return;
|
|
throw new Error(
|
|
`Passing a store prop in conjunction with a default state is not supported.
|
|
|
|
const store = useSelectStore();
|
|
<SelectProvider store={store} defaultValue="Apple" />
|
|
^ ^
|
|
|
|
Instead, pass the default state to the topmost store:
|
|
|
|
const store = useSelectStore({ defaultValue: "Apple" });
|
|
<SelectProvider store={store} />
|
|
|
|
See https://github.com/ariakit/ariakit/pull/2745 for more details.
|
|
|
|
If there's a particular need for this, please submit a feature request at https://github.com/ariakit/ariakit
|
|
`
|
|
);
|
|
}
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/HWOIWM4O.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ Bj: () => (/* binding */ isTextbox),
|
|
/* harmony export */ Bm: () => (/* binding */ isButton),
|
|
/* harmony export */ Mk: () => (/* binding */ getTextboxValue),
|
|
/* harmony export */ Sw: () => (/* binding */ canUseDOM),
|
|
/* harmony export */ Tc: () => (/* binding */ getPopupRole),
|
|
/* harmony export */ YE: () => (/* binding */ getDocument),
|
|
/* harmony export */ Zy: () => (/* binding */ getTextboxSelection),
|
|
/* harmony export */ bq: () => (/* binding */ getActiveElement),
|
|
/* harmony export */ cn: () => (/* binding */ getPopupItemRole),
|
|
/* harmony export */ eG: () => (/* binding */ setSelectionRange),
|
|
/* harmony export */ gR: () => (/* binding */ contains),
|
|
/* harmony export */ mB: () => (/* binding */ isTextField),
|
|
/* harmony export */ qj: () => (/* binding */ getScrollingElement),
|
|
/* harmony export */ qt: () => (/* binding */ isFrame),
|
|
/* harmony export */ zN: () => (/* binding */ isVisible),
|
|
/* harmony export */ zk: () => (/* binding */ getWindow)
|
|
/* harmony export */ });
|
|
/* unused harmony exports scrollIntoViewIfNeeded, isPartiallyHidden */
|
|
"use client";
|
|
|
|
// src/utils/dom.ts
|
|
var canUseDOM = checkIsBrowser();
|
|
function checkIsBrowser() {
|
|
var _a;
|
|
return typeof window !== "undefined" && !!((_a = window.document) == null ? void 0 : _a.createElement);
|
|
}
|
|
function getDocument(node) {
|
|
return node ? node.ownerDocument || node : document;
|
|
}
|
|
function getWindow(node) {
|
|
return getDocument(node).defaultView || window;
|
|
}
|
|
function getActiveElement(node, activeDescendant = false) {
|
|
const { activeElement } = getDocument(node);
|
|
if (!(activeElement == null ? void 0 : activeElement.nodeName)) {
|
|
return null;
|
|
}
|
|
if (isFrame(activeElement) && activeElement.contentDocument) {
|
|
return getActiveElement(
|
|
activeElement.contentDocument.body,
|
|
activeDescendant
|
|
);
|
|
}
|
|
if (activeDescendant) {
|
|
const id = activeElement.getAttribute("aria-activedescendant");
|
|
if (id) {
|
|
const element = getDocument(activeElement).getElementById(id);
|
|
if (element) {
|
|
return element;
|
|
}
|
|
}
|
|
}
|
|
return activeElement;
|
|
}
|
|
function contains(parent, child) {
|
|
return parent === child || parent.contains(child);
|
|
}
|
|
function isFrame(element) {
|
|
return element.tagName === "IFRAME";
|
|
}
|
|
function isButton(element) {
|
|
const tagName = element.tagName.toLowerCase();
|
|
if (tagName === "button") return true;
|
|
if (tagName === "input" && element.type) {
|
|
return buttonInputTypes.indexOf(element.type) !== -1;
|
|
}
|
|
return false;
|
|
}
|
|
var buttonInputTypes = [
|
|
"button",
|
|
"color",
|
|
"file",
|
|
"image",
|
|
"reset",
|
|
"submit"
|
|
];
|
|
function isVisible(element) {
|
|
if (typeof element.checkVisibility === "function") {
|
|
return element.checkVisibility();
|
|
}
|
|
const htmlElement = element;
|
|
return htmlElement.offsetWidth > 0 || htmlElement.offsetHeight > 0 || element.getClientRects().length > 0;
|
|
}
|
|
function isTextField(element) {
|
|
try {
|
|
const isTextInput = element instanceof HTMLInputElement && element.selectionStart !== null;
|
|
const isTextArea = element.tagName === "TEXTAREA";
|
|
return isTextInput || isTextArea || false;
|
|
} catch (error) {
|
|
return false;
|
|
}
|
|
}
|
|
function isTextbox(element) {
|
|
return element.isContentEditable || isTextField(element);
|
|
}
|
|
function getTextboxValue(element) {
|
|
if (isTextField(element)) {
|
|
return element.value;
|
|
}
|
|
if (element.isContentEditable) {
|
|
const range = getDocument(element).createRange();
|
|
range.selectNodeContents(element);
|
|
return range.toString();
|
|
}
|
|
return "";
|
|
}
|
|
function getTextboxSelection(element) {
|
|
let start = 0;
|
|
let end = 0;
|
|
if (isTextField(element)) {
|
|
start = element.selectionStart || 0;
|
|
end = element.selectionEnd || 0;
|
|
} else if (element.isContentEditable) {
|
|
const selection = getDocument(element).getSelection();
|
|
if ((selection == null ? void 0 : selection.rangeCount) && selection.anchorNode && contains(element, selection.anchorNode) && selection.focusNode && contains(element, selection.focusNode)) {
|
|
const range = selection.getRangeAt(0);
|
|
const nextRange = range.cloneRange();
|
|
nextRange.selectNodeContents(element);
|
|
nextRange.setEnd(range.startContainer, range.startOffset);
|
|
start = nextRange.toString().length;
|
|
nextRange.setEnd(range.endContainer, range.endOffset);
|
|
end = nextRange.toString().length;
|
|
}
|
|
}
|
|
return { start, end };
|
|
}
|
|
function getPopupRole(element, fallback) {
|
|
const allowedPopupRoles = ["dialog", "menu", "listbox", "tree", "grid"];
|
|
const role = element == null ? void 0 : element.getAttribute("role");
|
|
if (role && allowedPopupRoles.indexOf(role) !== -1) {
|
|
return role;
|
|
}
|
|
return fallback;
|
|
}
|
|
function getPopupItemRole(element, fallback) {
|
|
var _a;
|
|
const itemRoleByPopupRole = {
|
|
menu: "menuitem",
|
|
listbox: "option",
|
|
tree: "treeitem"
|
|
};
|
|
const popupRole = getPopupRole(element);
|
|
if (!popupRole) return fallback;
|
|
const key = popupRole;
|
|
return (_a = itemRoleByPopupRole[key]) != null ? _a : fallback;
|
|
}
|
|
function scrollIntoViewIfNeeded(element, arg) {
|
|
if (isPartiallyHidden(element) && "scrollIntoView" in element) {
|
|
element.scrollIntoView(arg);
|
|
}
|
|
}
|
|
function getScrollingElement(element) {
|
|
if (!element) return null;
|
|
if (element.clientHeight && element.scrollHeight > element.clientHeight) {
|
|
const { overflowY } = getComputedStyle(element);
|
|
const isScrollable = overflowY !== "visible" && overflowY !== "hidden";
|
|
if (isScrollable) return element;
|
|
} else if (element.clientWidth && element.scrollWidth > element.clientWidth) {
|
|
const { overflowX } = getComputedStyle(element);
|
|
const isScrollable = overflowX !== "visible" && overflowX !== "hidden";
|
|
if (isScrollable) return element;
|
|
}
|
|
return getScrollingElement(element.parentElement) || document.scrollingElement || document.body;
|
|
}
|
|
function isPartiallyHidden(element) {
|
|
const elementRect = element.getBoundingClientRect();
|
|
const scroller = getScrollingElement(element);
|
|
if (!scroller) return false;
|
|
const scrollerRect = scroller.getBoundingClientRect();
|
|
const isHTML = scroller.tagName === "HTML";
|
|
const scrollerTop = isHTML ? scrollerRect.top + scroller.scrollTop : scrollerRect.top;
|
|
const scrollerBottom = isHTML ? scroller.clientHeight : scrollerRect.bottom;
|
|
const scrollerLeft = isHTML ? scrollerRect.left + scroller.scrollLeft : scrollerRect.left;
|
|
const scrollerRight = isHTML ? scroller.clientWidth : scrollerRect.right;
|
|
const top = elementRect.top < scrollerTop;
|
|
const left = elementRect.left < scrollerLeft;
|
|
const bottom = elementRect.bottom > scrollerBottom;
|
|
const right = elementRect.right > scrollerRight;
|
|
return top || left || bottom || right;
|
|
}
|
|
function setSelectionRange(element, ...args) {
|
|
if (/text|search|password|tel|url/i.test(element.type)) {
|
|
element.setSelectionRange(...args);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ $f: () => (/* binding */ disabledFromProps),
|
|
/* harmony export */ D_: () => (/* binding */ identity),
|
|
/* harmony export */ HR: () => (/* binding */ removeUndefinedValues),
|
|
/* harmony export */ J2: () => (/* binding */ normalizeString),
|
|
/* harmony export */ Jh: () => (/* binding */ defaultValue),
|
|
/* harmony export */ Qh: () => (/* binding */ applyState),
|
|
/* harmony export */ Up: () => (/* binding */ pick),
|
|
/* harmony export */ V1: () => (/* binding */ invariant),
|
|
/* harmony export */ bN: () => (/* binding */ shallowEqual),
|
|
/* harmony export */ cJ: () => (/* binding */ omit),
|
|
/* harmony export */ cy: () => (/* binding */ chain),
|
|
/* harmony export */ lQ: () => (/* binding */ noop),
|
|
/* harmony export */ mQ: () => (/* binding */ hasOwnProperty),
|
|
/* harmony export */ xD: () => (/* binding */ getKeys),
|
|
/* harmony export */ zO: () => (/* binding */ isFalsyBooleanCallback)
|
|
/* harmony export */ });
|
|
/* unused harmony exports isObject, isEmpty, isInteger, cx, beforePaint, afterPaint */
|
|
/* harmony import */ var _3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/3YLGPPWQ.js");
|
|
"use client";
|
|
|
|
|
|
// src/utils/misc.ts
|
|
function noop(..._) {
|
|
}
|
|
function shallowEqual(a, b) {
|
|
if (a === b) return true;
|
|
if (!a) return false;
|
|
if (!b) return false;
|
|
if (typeof a !== "object") return false;
|
|
if (typeof b !== "object") return false;
|
|
const aKeys = Object.keys(a);
|
|
const bKeys = Object.keys(b);
|
|
const { length } = aKeys;
|
|
if (bKeys.length !== length) return false;
|
|
for (const key of aKeys) {
|
|
if (a[key] !== b[key]) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
function applyState(argument, currentValue) {
|
|
if (isUpdater(argument)) {
|
|
const value = isLazyValue(currentValue) ? currentValue() : currentValue;
|
|
return argument(value);
|
|
}
|
|
return argument;
|
|
}
|
|
function isUpdater(argument) {
|
|
return typeof argument === "function";
|
|
}
|
|
function isLazyValue(value) {
|
|
return typeof value === "function";
|
|
}
|
|
function isObject(arg) {
|
|
return typeof arg === "object" && arg != null;
|
|
}
|
|
function isEmpty(arg) {
|
|
if (Array.isArray(arg)) return !arg.length;
|
|
if (isObject(arg)) return !Object.keys(arg).length;
|
|
if (arg == null) return true;
|
|
if (arg === "") return true;
|
|
return false;
|
|
}
|
|
function isInteger(arg) {
|
|
if (typeof arg === "number") {
|
|
return Math.floor(arg) === arg;
|
|
}
|
|
return String(Math.floor(Number(arg))) === arg;
|
|
}
|
|
function hasOwnProperty(object, prop) {
|
|
if (typeof Object.hasOwn === "function") {
|
|
return Object.hasOwn(object, prop);
|
|
}
|
|
return Object.prototype.hasOwnProperty.call(object, prop);
|
|
}
|
|
function chain(...fns) {
|
|
return (...args) => {
|
|
for (const fn of fns) {
|
|
if (typeof fn === "function") {
|
|
fn(...args);
|
|
}
|
|
}
|
|
};
|
|
}
|
|
function cx(...args) {
|
|
return args.filter(Boolean).join(" ") || void 0;
|
|
}
|
|
function normalizeString(str) {
|
|
return str.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
|
}
|
|
function omit(object, keys) {
|
|
const result = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_0__/* .__spreadValues */ .IA)({}, object);
|
|
for (const key of keys) {
|
|
if (hasOwnProperty(result, key)) {
|
|
delete result[key];
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
function pick(object, paths) {
|
|
const result = {};
|
|
for (const key of paths) {
|
|
if (hasOwnProperty(object, key)) {
|
|
result[key] = object[key];
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
function identity(value) {
|
|
return value;
|
|
}
|
|
function beforePaint(cb = noop) {
|
|
const raf = requestAnimationFrame(cb);
|
|
return () => cancelAnimationFrame(raf);
|
|
}
|
|
function afterPaint(cb = noop) {
|
|
let raf = requestAnimationFrame(() => {
|
|
raf = requestAnimationFrame(cb);
|
|
});
|
|
return () => cancelAnimationFrame(raf);
|
|
}
|
|
function invariant(condition, message) {
|
|
if (condition) return;
|
|
if (typeof message !== "string") throw new Error("Invariant failed");
|
|
throw new Error(message);
|
|
}
|
|
function getKeys(obj) {
|
|
return Object.keys(obj);
|
|
}
|
|
function isFalsyBooleanCallback(booleanOrCallback, ...args) {
|
|
const result = typeof booleanOrCallback === "function" ? booleanOrCallback(...args) : booleanOrCallback;
|
|
if (result == null) return false;
|
|
return !result;
|
|
}
|
|
function disabledFromProps(props) {
|
|
return props.disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true";
|
|
}
|
|
function removeUndefinedValues(obj) {
|
|
const result = {};
|
|
for (const key in obj) {
|
|
if (obj[key] !== void 0) {
|
|
result[key] = obj[key];
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
function defaultValue(...values) {
|
|
for (const value of values) {
|
|
if (value !== void 0) return value;
|
|
}
|
|
return void 0;
|
|
}
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/US4USQPI.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ CN: () => (/* binding */ isTouchDevice),
|
|
/* harmony export */ cX: () => (/* binding */ isMac),
|
|
/* harmony export */ f8: () => (/* binding */ isApple),
|
|
/* harmony export */ gm: () => (/* binding */ isFirefox),
|
|
/* harmony export */ nr: () => (/* binding */ isSafari)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _HWOIWM4O_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/HWOIWM4O.js");
|
|
"use client";
|
|
|
|
|
|
// src/utils/platform.ts
|
|
function isTouchDevice() {
|
|
return _HWOIWM4O_js__WEBPACK_IMPORTED_MODULE_0__/* .canUseDOM */ .Sw && !!navigator.maxTouchPoints;
|
|
}
|
|
function isApple() {
|
|
if (!_HWOIWM4O_js__WEBPACK_IMPORTED_MODULE_0__/* .canUseDOM */ .Sw) return false;
|
|
return /mac|iphone|ipad|ipod/i.test(navigator.platform);
|
|
}
|
|
function isSafari() {
|
|
return _HWOIWM4O_js__WEBPACK_IMPORTED_MODULE_0__/* .canUseDOM */ .Sw && isApple() && /apple/i.test(navigator.vendor);
|
|
}
|
|
function isFirefox() {
|
|
return _HWOIWM4O_js__WEBPACK_IMPORTED_MODULE_0__/* .canUseDOM */ .Sw && /firefox\//i.test(navigator.userAgent);
|
|
}
|
|
function isMac() {
|
|
return _HWOIWM4O_js__WEBPACK_IMPORTED_MODULE_0__/* .canUseDOM */ .Sw && navigator.platform.startsWith("Mac") && !isTouchDevice();
|
|
}
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/YOHCVXJB.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ Y: () => (/* binding */ createDialogStore)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _6E4KKOSB_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/6E4KKOSB.js");
|
|
"use client";
|
|
|
|
|
|
// src/dialog/dialog-store.ts
|
|
function createDialogStore(props = {}) {
|
|
return (0,_6E4KKOSB_js__WEBPACK_IMPORTED_MODULE_0__/* .createDisclosureStore */ .h)(props);
|
|
}
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/utils/events.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ $b: () => (/* binding */ isOpeningInNewTab),
|
|
/* harmony export */ RN: () => (/* binding */ isDownloading),
|
|
/* harmony export */ aG: () => (/* binding */ isFocusEventOutside),
|
|
/* harmony export */ c$: () => (/* binding */ fireBlurEvent),
|
|
/* harmony export */ dg: () => (/* binding */ addGlobalEventListener),
|
|
/* harmony export */ hY: () => (/* binding */ fireClickEvent),
|
|
/* harmony export */ ho: () => (/* binding */ isPortalEvent),
|
|
/* harmony export */ nz: () => (/* binding */ queueBeforeEvent),
|
|
/* harmony export */ rC: () => (/* binding */ fireEvent),
|
|
/* harmony export */ sz: () => (/* binding */ fireKeyboardEvent),
|
|
/* harmony export */ uh: () => (/* binding */ isSelfTarget)
|
|
/* harmony export */ });
|
|
/* unused harmony exports fireFocusEvent, getInputType */
|
|
/* harmony import */ var _chunks_US4USQPI_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/US4USQPI.js");
|
|
/* harmony import */ var _chunks_HWOIWM4O_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/HWOIWM4O.js");
|
|
/* harmony import */ var _chunks_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/3YLGPPWQ.js");
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
// src/utils/events.ts
|
|
function isPortalEvent(event) {
|
|
return Boolean(
|
|
event.currentTarget && !(0,_chunks_HWOIWM4O_js__WEBPACK_IMPORTED_MODULE_0__/* .contains */ .gR)(event.currentTarget, event.target)
|
|
);
|
|
}
|
|
function isSelfTarget(event) {
|
|
return event.target === event.currentTarget;
|
|
}
|
|
function isOpeningInNewTab(event) {
|
|
const element = event.currentTarget;
|
|
if (!element) return false;
|
|
const isAppleDevice = (0,_chunks_US4USQPI_js__WEBPACK_IMPORTED_MODULE_1__/* .isApple */ .f8)();
|
|
if (isAppleDevice && !event.metaKey) return false;
|
|
if (!isAppleDevice && !event.ctrlKey) return false;
|
|
const tagName = element.tagName.toLowerCase();
|
|
if (tagName === "a") return true;
|
|
if (tagName === "button" && element.type === "submit") return true;
|
|
if (tagName === "input" && element.type === "submit") return true;
|
|
return false;
|
|
}
|
|
function isDownloading(event) {
|
|
const element = event.currentTarget;
|
|
if (!element) return false;
|
|
const tagName = element.tagName.toLowerCase();
|
|
if (!event.altKey) return false;
|
|
if (tagName === "a") return true;
|
|
if (tagName === "button" && element.type === "submit") return true;
|
|
if (tagName === "input" && element.type === "submit") return true;
|
|
return false;
|
|
}
|
|
function fireEvent(element, type, eventInit) {
|
|
const event = new Event(type, eventInit);
|
|
return element.dispatchEvent(event);
|
|
}
|
|
function fireBlurEvent(element, eventInit) {
|
|
const event = new FocusEvent("blur", eventInit);
|
|
const defaultAllowed = element.dispatchEvent(event);
|
|
const bubbleInit = (0,_chunks_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__/* .__spreadProps */ .ko)((0,_chunks_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__/* .__spreadValues */ .IA)({}, eventInit), { bubbles: true });
|
|
element.dispatchEvent(new FocusEvent("focusout", bubbleInit));
|
|
return defaultAllowed;
|
|
}
|
|
function fireFocusEvent(element, eventInit) {
|
|
const event = new FocusEvent("focus", eventInit);
|
|
const defaultAllowed = element.dispatchEvent(event);
|
|
const bubbleInit = __spreadProps(__spreadValues({}, eventInit), { bubbles: true });
|
|
element.dispatchEvent(new FocusEvent("focusin", bubbleInit));
|
|
return defaultAllowed;
|
|
}
|
|
function fireKeyboardEvent(element, type, eventInit) {
|
|
const event = new KeyboardEvent(type, eventInit);
|
|
return element.dispatchEvent(event);
|
|
}
|
|
function fireClickEvent(element, eventInit) {
|
|
const event = new MouseEvent("click", eventInit);
|
|
return element.dispatchEvent(event);
|
|
}
|
|
function isFocusEventOutside(event, container) {
|
|
const containerElement = container || event.currentTarget;
|
|
const relatedTarget = event.relatedTarget;
|
|
return !relatedTarget || !(0,_chunks_HWOIWM4O_js__WEBPACK_IMPORTED_MODULE_0__/* .contains */ .gR)(containerElement, relatedTarget);
|
|
}
|
|
function getInputType(event) {
|
|
const nativeEvent = "nativeEvent" in event ? event.nativeEvent : event;
|
|
if (!nativeEvent) return;
|
|
if (!("inputType" in nativeEvent)) return;
|
|
if (typeof nativeEvent.inputType !== "string") return;
|
|
return nativeEvent.inputType;
|
|
}
|
|
function queueBeforeEvent(element, type, callback, timeout) {
|
|
const createTimer = (callback2) => {
|
|
if (timeout) {
|
|
const timerId2 = setTimeout(callback2, timeout);
|
|
return () => clearTimeout(timerId2);
|
|
}
|
|
const timerId = requestAnimationFrame(callback2);
|
|
return () => cancelAnimationFrame(timerId);
|
|
};
|
|
const cancelTimer = createTimer(() => {
|
|
element.removeEventListener(type, callSync, true);
|
|
callback();
|
|
});
|
|
const callSync = () => {
|
|
cancelTimer();
|
|
callback();
|
|
};
|
|
element.addEventListener(type, callSync, { once: true, capture: true });
|
|
return cancelTimer;
|
|
}
|
|
function addGlobalEventListener(type, listener, options, scope = window) {
|
|
const children = [];
|
|
try {
|
|
scope.document.addEventListener(type, listener, options);
|
|
for (const frame of Array.from(scope.frames)) {
|
|
children.push(addGlobalEventListener(type, listener, options, frame));
|
|
}
|
|
} catch (e) {
|
|
}
|
|
const removeEventListener = () => {
|
|
try {
|
|
scope.document.removeEventListener(type, listener, options);
|
|
} catch (e) {
|
|
}
|
|
for (const remove of children) {
|
|
remove();
|
|
}
|
|
};
|
|
return removeEventListener;
|
|
}
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/utils/focus.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ AJ: () => (/* binding */ hasFocus),
|
|
/* harmony export */ LC: () => (/* binding */ getFirstTabbableIn),
|
|
/* harmony export */ QZ: () => (/* binding */ restoreFocusIn),
|
|
/* harmony export */ WA: () => (/* binding */ focusIntoView),
|
|
/* harmony export */ XJ: () => (/* binding */ getPreviousTabbable),
|
|
/* harmony export */ a9: () => (/* binding */ getAllTabbableIn),
|
|
/* harmony export */ "do": () => (/* binding */ focusIfNeeded),
|
|
/* harmony export */ gw: () => (/* binding */ disableFocusIn),
|
|
/* harmony export */ oW: () => (/* binding */ hasFocusWithin),
|
|
/* harmony export */ tp: () => (/* binding */ isFocusable),
|
|
/* harmony export */ vF: () => (/* binding */ getNextTabbable)
|
|
/* harmony export */ });
|
|
/* unused harmony exports disableFocus, getAllFocusable, getAllFocusableIn, getAllTabbable, getClosestFocusable, getFirstFocusable, getFirstFocusableIn, getFirstTabbable, getLastTabbable, getLastTabbableIn, getNextTabbableIn, getPreviousTabbableIn, isTabbable */
|
|
/* harmony import */ var _chunks_HWOIWM4O_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/HWOIWM4O.js");
|
|
/* harmony import */ var _chunks_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/3YLGPPWQ.js");
|
|
"use client";
|
|
|
|
|
|
|
|
// src/utils/focus.ts
|
|
var selector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], summary, iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";
|
|
function hasNegativeTabIndex(element) {
|
|
const tabIndex = Number.parseInt(element.getAttribute("tabindex") || "0", 10);
|
|
return tabIndex < 0;
|
|
}
|
|
function isFocusable(element) {
|
|
if (!element.matches(selector)) return false;
|
|
if (!(0,_chunks_HWOIWM4O_js__WEBPACK_IMPORTED_MODULE_0__/* .isVisible */ .zN)(element)) return false;
|
|
if (element.closest("[inert]")) return false;
|
|
return true;
|
|
}
|
|
function isTabbable(element) {
|
|
if (!isFocusable(element)) return false;
|
|
if (hasNegativeTabIndex(element)) return false;
|
|
if (!("form" in element)) return true;
|
|
if (!element.form) return true;
|
|
if (element.checked) return true;
|
|
if (element.type !== "radio") return true;
|
|
const radioGroup = element.form.elements.namedItem(element.name);
|
|
if (!radioGroup) return true;
|
|
if (!("length" in radioGroup)) return true;
|
|
const activeElement = (0,_chunks_HWOIWM4O_js__WEBPACK_IMPORTED_MODULE_0__/* .getActiveElement */ .bq)(element);
|
|
if (!activeElement) return true;
|
|
if (activeElement === element) return true;
|
|
if (!("form" in activeElement)) return true;
|
|
if (activeElement.form !== element.form) return true;
|
|
if (activeElement.name !== element.name) return true;
|
|
return false;
|
|
}
|
|
function getAllFocusableIn(container, includeContainer) {
|
|
const elements = Array.from(
|
|
container.querySelectorAll(selector)
|
|
);
|
|
if (includeContainer) {
|
|
elements.unshift(container);
|
|
}
|
|
const focusableElements = elements.filter(isFocusable);
|
|
focusableElements.forEach((element, i) => {
|
|
if ((0,_chunks_HWOIWM4O_js__WEBPACK_IMPORTED_MODULE_0__/* .isFrame */ .qt)(element) && element.contentDocument) {
|
|
const frameBody = element.contentDocument.body;
|
|
focusableElements.splice(i, 1, ...getAllFocusableIn(frameBody));
|
|
}
|
|
});
|
|
return focusableElements;
|
|
}
|
|
function getAllFocusable(includeBody) {
|
|
return getAllFocusableIn(document.body, includeBody);
|
|
}
|
|
function getFirstFocusableIn(container, includeContainer) {
|
|
const [first] = getAllFocusableIn(container, includeContainer);
|
|
return first || null;
|
|
}
|
|
function getFirstFocusable(includeBody) {
|
|
return getFirstFocusableIn(document.body, includeBody);
|
|
}
|
|
function getAllTabbableIn(container, includeContainer, fallbackToFocusable) {
|
|
const elements = Array.from(
|
|
container.querySelectorAll(selector)
|
|
);
|
|
const tabbableElements = elements.filter(isTabbable);
|
|
if (includeContainer && isTabbable(container)) {
|
|
tabbableElements.unshift(container);
|
|
}
|
|
tabbableElements.forEach((element, i) => {
|
|
if ((0,_chunks_HWOIWM4O_js__WEBPACK_IMPORTED_MODULE_0__/* .isFrame */ .qt)(element) && element.contentDocument) {
|
|
const frameBody = element.contentDocument.body;
|
|
const allFrameTabbable = getAllTabbableIn(
|
|
frameBody,
|
|
false,
|
|
fallbackToFocusable
|
|
);
|
|
tabbableElements.splice(i, 1, ...allFrameTabbable);
|
|
}
|
|
});
|
|
if (!tabbableElements.length && fallbackToFocusable) {
|
|
return elements;
|
|
}
|
|
return tabbableElements;
|
|
}
|
|
function getAllTabbable(fallbackToFocusable) {
|
|
return getAllTabbableIn(document.body, false, fallbackToFocusable);
|
|
}
|
|
function getFirstTabbableIn(container, includeContainer, fallbackToFocusable) {
|
|
const [first] = getAllTabbableIn(
|
|
container,
|
|
includeContainer,
|
|
fallbackToFocusable
|
|
);
|
|
return first || null;
|
|
}
|
|
function getFirstTabbable(fallbackToFocusable) {
|
|
return getFirstTabbableIn(document.body, false, fallbackToFocusable);
|
|
}
|
|
function getLastTabbableIn(container, includeContainer, fallbackToFocusable) {
|
|
const allTabbable = getAllTabbableIn(
|
|
container,
|
|
includeContainer,
|
|
fallbackToFocusable
|
|
);
|
|
return allTabbable[allTabbable.length - 1] || null;
|
|
}
|
|
function getLastTabbable(fallbackToFocusable) {
|
|
return getLastTabbableIn(document.body, false, fallbackToFocusable);
|
|
}
|
|
function getNextTabbableIn(container, includeContainer, fallbackToFirst, fallbackToFocusable) {
|
|
const activeElement = (0,_chunks_HWOIWM4O_js__WEBPACK_IMPORTED_MODULE_0__/* .getActiveElement */ .bq)(container);
|
|
const allFocusable = getAllFocusableIn(container, includeContainer);
|
|
const activeIndex = allFocusable.indexOf(activeElement);
|
|
const nextFocusableElements = allFocusable.slice(activeIndex + 1);
|
|
return nextFocusableElements.find(isTabbable) || (fallbackToFirst ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? nextFocusableElements[0] : null) || null;
|
|
}
|
|
function getNextTabbable(fallbackToFirst, fallbackToFocusable) {
|
|
return getNextTabbableIn(
|
|
document.body,
|
|
false,
|
|
fallbackToFirst,
|
|
fallbackToFocusable
|
|
);
|
|
}
|
|
function getPreviousTabbableIn(container, includeContainer, fallbackToLast, fallbackToFocusable) {
|
|
const activeElement = (0,_chunks_HWOIWM4O_js__WEBPACK_IMPORTED_MODULE_0__/* .getActiveElement */ .bq)(container);
|
|
const allFocusable = getAllFocusableIn(container, includeContainer).reverse();
|
|
const activeIndex = allFocusable.indexOf(activeElement);
|
|
const previousFocusableElements = allFocusable.slice(activeIndex + 1);
|
|
return previousFocusableElements.find(isTabbable) || (fallbackToLast ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? previousFocusableElements[0] : null) || null;
|
|
}
|
|
function getPreviousTabbable(fallbackToFirst, fallbackToFocusable) {
|
|
return getPreviousTabbableIn(
|
|
document.body,
|
|
false,
|
|
fallbackToFirst,
|
|
fallbackToFocusable
|
|
);
|
|
}
|
|
function getClosestFocusable(element) {
|
|
while (element && !isFocusable(element)) {
|
|
element = element.closest(selector);
|
|
}
|
|
return element || null;
|
|
}
|
|
function hasFocus(element) {
|
|
const activeElement = (0,_chunks_HWOIWM4O_js__WEBPACK_IMPORTED_MODULE_0__/* .getActiveElement */ .bq)(element);
|
|
if (!activeElement) return false;
|
|
if (activeElement === element) return true;
|
|
const activeDescendant = activeElement.getAttribute("aria-activedescendant");
|
|
if (!activeDescendant) return false;
|
|
return activeDescendant === element.id;
|
|
}
|
|
function hasFocusWithin(element) {
|
|
const activeElement = (0,_chunks_HWOIWM4O_js__WEBPACK_IMPORTED_MODULE_0__/* .getActiveElement */ .bq)(element);
|
|
if (!activeElement) return false;
|
|
if ((0,_chunks_HWOIWM4O_js__WEBPACK_IMPORTED_MODULE_0__/* .contains */ .gR)(element, activeElement)) return true;
|
|
const activeDescendant = activeElement.getAttribute("aria-activedescendant");
|
|
if (!activeDescendant) return false;
|
|
if (!("id" in element)) return false;
|
|
if (activeDescendant === element.id) return true;
|
|
return !!element.querySelector(`#${CSS.escape(activeDescendant)}`);
|
|
}
|
|
function focusIfNeeded(element) {
|
|
if (!hasFocusWithin(element) && isFocusable(element)) {
|
|
element.focus();
|
|
}
|
|
}
|
|
function disableFocus(element) {
|
|
var _a;
|
|
const currentTabindex = (_a = element.getAttribute("tabindex")) != null ? _a : "";
|
|
element.setAttribute("data-tabindex", currentTabindex);
|
|
element.setAttribute("tabindex", "-1");
|
|
}
|
|
function disableFocusIn(container, includeContainer) {
|
|
const tabbableElements = getAllTabbableIn(container, includeContainer);
|
|
for (const element of tabbableElements) {
|
|
disableFocus(element);
|
|
}
|
|
}
|
|
function restoreFocusIn(container) {
|
|
const elements = container.querySelectorAll("[data-tabindex]");
|
|
const restoreTabIndex = (element) => {
|
|
const tabindex = element.getAttribute("data-tabindex");
|
|
element.removeAttribute("data-tabindex");
|
|
if (tabindex) {
|
|
element.setAttribute("tabindex", tabindex);
|
|
} else {
|
|
element.removeAttribute("tabindex");
|
|
}
|
|
};
|
|
if (container.hasAttribute("data-tabindex")) {
|
|
restoreTabIndex(container);
|
|
}
|
|
for (const element of elements) {
|
|
restoreTabIndex(element);
|
|
}
|
|
}
|
|
function focusIntoView(element, options) {
|
|
if (!("scrollIntoView" in element)) {
|
|
element.focus();
|
|
} else {
|
|
element.focus({ preventScroll: true });
|
|
element.scrollIntoView((0,_chunks_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_1__/* .__spreadValues */ .IA)({ block: "nearest", inline: "nearest" }, options));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/2GXGCHW6.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ O$: () => (/* binding */ useStoreState),
|
|
/* harmony export */ Pj: () => (/* binding */ useStore),
|
|
/* harmony export */ Tz: () => (/* binding */ useStoreProps)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/Z32BISHQ.js");
|
|
/* harmony import */ var _3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js");
|
|
/* harmony import */ var _ariakit_core_utils_misc__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js");
|
|
/* harmony import */ var _ariakit_core_utils_store__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/EQQLU3CG.js");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
/* harmony import */ var use_sync_external_store_shim_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@17.0.2/node_modules/use-sync-external-store/shim/index.js");
|
|
"use client";
|
|
|
|
|
|
|
|
// src/utils/store.tsx
|
|
|
|
|
|
|
|
|
|
var { useSyncExternalStore } = use_sync_external_store_shim_index_js__WEBPACK_IMPORTED_MODULE_1__;
|
|
var noopSubscribe = () => () => {
|
|
};
|
|
function useStoreState(store, keyOrSelector = _ariakit_core_utils_misc__WEBPACK_IMPORTED_MODULE_2__/* .identity */ .D_) {
|
|
const storeSubscribe = react__WEBPACK_IMPORTED_MODULE_0__.useCallback(
|
|
(callback) => {
|
|
if (!store) return noopSubscribe();
|
|
return (0,_ariakit_core_utils_store__WEBPACK_IMPORTED_MODULE_3__/* .subscribe */ .B1)(store, null, callback);
|
|
},
|
|
[store]
|
|
);
|
|
const getSnapshot = () => {
|
|
const key = typeof keyOrSelector === "string" ? keyOrSelector : null;
|
|
const selector = typeof keyOrSelector === "function" ? keyOrSelector : null;
|
|
const state = store == null ? void 0 : store.getState();
|
|
if (selector) return selector(state);
|
|
if (!state) return;
|
|
if (!key) return;
|
|
if (!(0,_ariakit_core_utils_misc__WEBPACK_IMPORTED_MODULE_2__/* .hasOwnProperty */ .mQ)(state, key)) return;
|
|
return state[key];
|
|
};
|
|
return useSyncExternalStore(storeSubscribe, getSnapshot, getSnapshot);
|
|
}
|
|
function useStoreProps(store, props, key, setKey) {
|
|
const value = (0,_ariakit_core_utils_misc__WEBPACK_IMPORTED_MODULE_2__/* .hasOwnProperty */ .mQ)(props, key) ? props[key] : void 0;
|
|
const setValue = setKey ? props[setKey] : void 0;
|
|
const propsRef = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_4__/* .useLiveRef */ .hX)({ value, setValue });
|
|
(0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_4__/* .useSafeLayoutEffect */ .UQ)(() => {
|
|
return (0,_ariakit_core_utils_store__WEBPACK_IMPORTED_MODULE_3__/* .sync */ .OH)(store, [key], (state, prev) => {
|
|
const { value: value2, setValue: setValue2 } = propsRef.current;
|
|
if (!setValue2) return;
|
|
if (state[key] === prev[key]) return;
|
|
if (state[key] === value2) return;
|
|
setValue2(state[key]);
|
|
});
|
|
}, [store, key]);
|
|
(0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_4__/* .useSafeLayoutEffect */ .UQ)(() => {
|
|
if (value === void 0) return;
|
|
store.setState(key, value);
|
|
return (0,_ariakit_core_utils_store__WEBPACK_IMPORTED_MODULE_3__/* .batch */ .vA)(store, [key], () => {
|
|
if (value === void 0) return;
|
|
store.setState(key, value);
|
|
});
|
|
});
|
|
}
|
|
function useStore(createStore, props) {
|
|
const [store, setStore] = react__WEBPACK_IMPORTED_MODULE_0__.useState(() => createStore(props));
|
|
(0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_4__/* .useSafeLayoutEffect */ .UQ)(() => (0,_ariakit_core_utils_store__WEBPACK_IMPORTED_MODULE_3__/* .init */ .Ts)(store), [store]);
|
|
const useState2 = react__WEBPACK_IMPORTED_MODULE_0__.useCallback(
|
|
(keyOrSelector) => useStoreState(store, keyOrSelector),
|
|
[store]
|
|
);
|
|
const memoizedStore = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(
|
|
() => (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_5__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_5__/* .__spreadValues */ .IA)({}, store), { useState: useState2 }),
|
|
[store, useState2]
|
|
);
|
|
const updateStore = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_4__/* .useEvent */ ._q)(() => {
|
|
setStore((store2) => createStore((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_5__/* .__spreadValues */ .IA)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_5__/* .__spreadValues */ .IA)({}, props), store2.getState())));
|
|
});
|
|
return [memoizedStore, updateStore];
|
|
}
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/3CCTMYB6.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ k: () => (/* binding */ useCompositeItem),
|
|
/* harmony export */ l: () => (/* binding */ CompositeItem)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _PLQDTVXM_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/PLQDTVXM.js");
|
|
/* harmony import */ var _NAXN2XAB_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/NAXN2XAB.js");
|
|
/* harmony import */ var _5VQZOHHZ_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/5VQZOHHZ.js");
|
|
/* harmony import */ var _WENSINUV_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/WENSINUV.js");
|
|
/* harmony import */ var _HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HKOOKEDE.js");
|
|
/* harmony import */ var _2GXGCHW6_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/2GXGCHW6.js");
|
|
/* harmony import */ var _Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/Z32BISHQ.js");
|
|
/* harmony import */ var _3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js");
|
|
/* harmony import */ var _ariakit_core_utils_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/HWOIWM4O.js");
|
|
/* harmony import */ var _ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/utils/events.js");
|
|
/* harmony import */ var _ariakit_core_utils_misc__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js");
|
|
/* harmony import */ var _ariakit_core_utils_platform__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/US4USQPI.js");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// src/composite/composite-item.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var TagName = "button";
|
|
function isEditableElement(element) {
|
|
if ((0,_ariakit_core_utils_dom__WEBPACK_IMPORTED_MODULE_2__/* .isTextbox */ .Bj)(element)) return true;
|
|
return element.tagName === "INPUT" && !(0,_ariakit_core_utils_dom__WEBPACK_IMPORTED_MODULE_2__/* .isButton */ .Bm)(element);
|
|
}
|
|
function getNextPageOffset(scrollingElement, pageUp = false) {
|
|
const height = scrollingElement.clientHeight;
|
|
const { top } = scrollingElement.getBoundingClientRect();
|
|
const pageSize = Math.max(height * 0.875, height - 40) * 1.5;
|
|
const pageOffset = pageUp ? height - pageSize + top : pageSize + top;
|
|
if (scrollingElement.tagName === "HTML") {
|
|
return pageOffset + scrollingElement.scrollTop;
|
|
}
|
|
return pageOffset;
|
|
}
|
|
function getItemOffset(itemElement, pageUp = false) {
|
|
const { top } = itemElement.getBoundingClientRect();
|
|
if (pageUp) {
|
|
return top + itemElement.clientHeight;
|
|
}
|
|
return top;
|
|
}
|
|
function findNextPageItemId(element, store, next, pageUp = false) {
|
|
var _a;
|
|
if (!store) return;
|
|
if (!next) return;
|
|
const { renderedItems } = store.getState();
|
|
const scrollingElement = (0,_ariakit_core_utils_dom__WEBPACK_IMPORTED_MODULE_2__/* .getScrollingElement */ .qj)(element);
|
|
if (!scrollingElement) return;
|
|
const nextPageOffset = getNextPageOffset(scrollingElement, pageUp);
|
|
let id;
|
|
let prevDifference;
|
|
for (let i = 0; i < renderedItems.length; i += 1) {
|
|
const previousId = id;
|
|
id = next(i);
|
|
if (!id) break;
|
|
if (id === previousId) continue;
|
|
const itemElement = (_a = (0,_5VQZOHHZ_js__WEBPACK_IMPORTED_MODULE_3__/* .getEnabledItem */ .hZ)(store, id)) == null ? void 0 : _a.element;
|
|
if (!itemElement) continue;
|
|
const itemOffset = getItemOffset(itemElement, pageUp);
|
|
const difference = itemOffset - nextPageOffset;
|
|
const absDifference = Math.abs(difference);
|
|
if (pageUp && difference <= 0 || !pageUp && difference >= 0) {
|
|
if (prevDifference !== void 0 && prevDifference < absDifference) {
|
|
id = previousId;
|
|
}
|
|
break;
|
|
}
|
|
prevDifference = absDifference;
|
|
}
|
|
return id;
|
|
}
|
|
function targetIsAnotherItem(event, store) {
|
|
if ((0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_4__/* .isSelfTarget */ .uh)(event)) return false;
|
|
return (0,_5VQZOHHZ_js__WEBPACK_IMPORTED_MODULE_3__/* .isItem */ .WZ)(store, event.target);
|
|
}
|
|
var useCompositeItem = (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_5__/* .createHook */ .ab)(
|
|
function useCompositeItem2(_a) {
|
|
var _b = _a, {
|
|
store,
|
|
rowId: rowIdProp,
|
|
preventScrollOnKeyDown = false,
|
|
moveOnKeyPress = true,
|
|
tabbable = false,
|
|
getItem: getItemProp,
|
|
"aria-setsize": ariaSetSizeProp,
|
|
"aria-posinset": ariaPosInSetProp
|
|
} = _b, props = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_6__/* .__objRest */ .YG)(_b, [
|
|
"store",
|
|
"rowId",
|
|
"preventScrollOnKeyDown",
|
|
"moveOnKeyPress",
|
|
"tabbable",
|
|
"getItem",
|
|
"aria-setsize",
|
|
"aria-posinset"
|
|
]);
|
|
const context = (0,_WENSINUV_js__WEBPACK_IMPORTED_MODULE_7__/* .useCompositeContext */ .k)();
|
|
store = store || context;
|
|
const id = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_8__/* .useId */ .Bi)(props.id);
|
|
const ref = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
const row = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_WENSINUV_js__WEBPACK_IMPORTED_MODULE_7__/* .CompositeRowContext */ .$o);
|
|
const rowId = (0,_2GXGCHW6_js__WEBPACK_IMPORTED_MODULE_9__/* .useStoreState */ .O$)(store, (state) => {
|
|
if (rowIdProp) return rowIdProp;
|
|
if (!state) return;
|
|
if (!(row == null ? void 0 : row.baseElement)) return;
|
|
if (row.baseElement !== state.baseElement) return;
|
|
return row.id;
|
|
});
|
|
const disabled = (0,_ariakit_core_utils_misc__WEBPACK_IMPORTED_MODULE_10__/* .disabledFromProps */ .$f)(props);
|
|
const trulyDisabled = disabled && !props.accessibleWhenDisabled;
|
|
const getItem = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(
|
|
(item) => {
|
|
const nextItem = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_6__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_6__/* .__spreadValues */ .IA)({}, item), {
|
|
id: id || item.id,
|
|
rowId,
|
|
disabled: !!trulyDisabled
|
|
});
|
|
if (getItemProp) {
|
|
return getItemProp(nextItem);
|
|
}
|
|
return nextItem;
|
|
},
|
|
[id, rowId, trulyDisabled, getItemProp]
|
|
);
|
|
const onFocusProp = props.onFocus;
|
|
const hasFocusedComposite = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(false);
|
|
const onFocus = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_8__/* .useEvent */ ._q)((event) => {
|
|
onFocusProp == null ? void 0 : onFocusProp(event);
|
|
if (event.defaultPrevented) return;
|
|
if ((0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_4__/* .isPortalEvent */ .ho)(event)) return;
|
|
if (!id) return;
|
|
if (!store) return;
|
|
if (targetIsAnotherItem(event, store)) return;
|
|
const { virtualFocus, baseElement: baseElement2 } = store.getState();
|
|
store.setActiveId(id);
|
|
if ((0,_ariakit_core_utils_dom__WEBPACK_IMPORTED_MODULE_2__/* .isTextbox */ .Bj)(event.currentTarget)) {
|
|
(0,_5VQZOHHZ_js__WEBPACK_IMPORTED_MODULE_3__/* .selectTextField */ .iT)(event.currentTarget);
|
|
}
|
|
if (!virtualFocus) return;
|
|
if (!(0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_4__/* .isSelfTarget */ .uh)(event)) return;
|
|
if (isEditableElement(event.currentTarget)) return;
|
|
if (!(baseElement2 == null ? void 0 : baseElement2.isConnected)) return;
|
|
if ((0,_ariakit_core_utils_platform__WEBPACK_IMPORTED_MODULE_11__/* .isSafari */ .nr)() && event.currentTarget.hasAttribute("data-autofocus")) {
|
|
event.currentTarget.scrollIntoView({
|
|
block: "nearest",
|
|
inline: "nearest"
|
|
});
|
|
}
|
|
hasFocusedComposite.current = true;
|
|
const fromComposite = event.relatedTarget === baseElement2 || (0,_5VQZOHHZ_js__WEBPACK_IMPORTED_MODULE_3__/* .isItem */ .WZ)(store, event.relatedTarget);
|
|
if (fromComposite) {
|
|
(0,_5VQZOHHZ_js__WEBPACK_IMPORTED_MODULE_3__/* .focusSilently */ .hk)(baseElement2);
|
|
} else {
|
|
baseElement2.focus();
|
|
}
|
|
});
|
|
const onBlurCaptureProp = props.onBlurCapture;
|
|
const onBlurCapture = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_8__/* .useEvent */ ._q)((event) => {
|
|
onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event);
|
|
if (event.defaultPrevented) return;
|
|
const state = store == null ? void 0 : store.getState();
|
|
if ((state == null ? void 0 : state.virtualFocus) && hasFocusedComposite.current) {
|
|
hasFocusedComposite.current = false;
|
|
event.preventDefault();
|
|
event.stopPropagation();
|
|
}
|
|
});
|
|
const onKeyDownProp = props.onKeyDown;
|
|
const preventScrollOnKeyDownProp = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_8__/* .useBooleanEvent */ .O4)(preventScrollOnKeyDown);
|
|
const moveOnKeyPressProp = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_8__/* .useBooleanEvent */ .O4)(moveOnKeyPress);
|
|
const onKeyDown = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_8__/* .useEvent */ ._q)((event) => {
|
|
onKeyDownProp == null ? void 0 : onKeyDownProp(event);
|
|
if (event.defaultPrevented) return;
|
|
if (!(0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_4__/* .isSelfTarget */ .uh)(event)) return;
|
|
if (!store) return;
|
|
const { currentTarget } = event;
|
|
const state = store.getState();
|
|
const item = store.item(id);
|
|
const isGrid = !!(item == null ? void 0 : item.rowId);
|
|
const isVertical = state.orientation !== "horizontal";
|
|
const isHorizontal = state.orientation !== "vertical";
|
|
const canHomeEnd = () => {
|
|
if (isGrid) return true;
|
|
if (isHorizontal) return true;
|
|
if (!state.baseElement) return true;
|
|
if (!(0,_ariakit_core_utils_dom__WEBPACK_IMPORTED_MODULE_2__/* .isTextField */ .mB)(state.baseElement)) return true;
|
|
return false;
|
|
};
|
|
const keyMap = {
|
|
ArrowUp: (isGrid || isVertical) && store.up,
|
|
ArrowRight: (isGrid || isHorizontal) && store.next,
|
|
ArrowDown: (isGrid || isVertical) && store.down,
|
|
ArrowLeft: (isGrid || isHorizontal) && store.previous,
|
|
Home: () => {
|
|
if (!canHomeEnd()) return;
|
|
if (!isGrid || event.ctrlKey) {
|
|
return store == null ? void 0 : store.first();
|
|
}
|
|
return store == null ? void 0 : store.previous(-1);
|
|
},
|
|
End: () => {
|
|
if (!canHomeEnd()) return;
|
|
if (!isGrid || event.ctrlKey) {
|
|
return store == null ? void 0 : store.last();
|
|
}
|
|
return store == null ? void 0 : store.next(-1);
|
|
},
|
|
PageUp: () => {
|
|
return findNextPageItemId(currentTarget, store, store == null ? void 0 : store.up, true);
|
|
},
|
|
PageDown: () => {
|
|
return findNextPageItemId(currentTarget, store, store == null ? void 0 : store.down);
|
|
}
|
|
};
|
|
const action = keyMap[event.key];
|
|
if (action) {
|
|
if ((0,_ariakit_core_utils_dom__WEBPACK_IMPORTED_MODULE_2__/* .isTextbox */ .Bj)(currentTarget)) {
|
|
const selection = (0,_ariakit_core_utils_dom__WEBPACK_IMPORTED_MODULE_2__/* .getTextboxSelection */ .Zy)(currentTarget);
|
|
const isLeft = isHorizontal && event.key === "ArrowLeft";
|
|
const isRight = isHorizontal && event.key === "ArrowRight";
|
|
const isUp = isVertical && event.key === "ArrowUp";
|
|
const isDown = isVertical && event.key === "ArrowDown";
|
|
if (isRight || isDown) {
|
|
const { length: valueLength } = (0,_ariakit_core_utils_dom__WEBPACK_IMPORTED_MODULE_2__/* .getTextboxValue */ .Mk)(currentTarget);
|
|
if (selection.end !== valueLength) return;
|
|
} else if ((isLeft || isUp) && selection.start !== 0) return;
|
|
}
|
|
const nextId = action();
|
|
if (preventScrollOnKeyDownProp(event) || nextId !== void 0) {
|
|
if (!moveOnKeyPressProp(event)) return;
|
|
event.preventDefault();
|
|
store.move(nextId);
|
|
}
|
|
}
|
|
});
|
|
const baseElement = (0,_2GXGCHW6_js__WEBPACK_IMPORTED_MODULE_9__/* .useStoreState */ .O$)(
|
|
store,
|
|
(state) => (state == null ? void 0 : state.baseElement) || void 0
|
|
);
|
|
const providerValue = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(
|
|
() => ({ id, baseElement }),
|
|
[id, baseElement]
|
|
);
|
|
props = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_8__/* .useWrapElement */ .w7)(
|
|
props,
|
|
(element) => /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_WENSINUV_js__WEBPACK_IMPORTED_MODULE_7__/* .CompositeItemContext */ .U0.Provider, { value: providerValue, children: element }),
|
|
[providerValue]
|
|
);
|
|
const isActiveItem = (0,_2GXGCHW6_js__WEBPACK_IMPORTED_MODULE_9__/* .useStoreState */ .O$)(
|
|
store,
|
|
(state) => !!state && state.activeId === id
|
|
);
|
|
const ariaSetSize = (0,_2GXGCHW6_js__WEBPACK_IMPORTED_MODULE_9__/* .useStoreState */ .O$)(store, (state) => {
|
|
if (ariaSetSizeProp != null) return ariaSetSizeProp;
|
|
if (!state) return;
|
|
if (!(row == null ? void 0 : row.ariaSetSize)) return;
|
|
if (row.baseElement !== state.baseElement) return;
|
|
return row.ariaSetSize;
|
|
});
|
|
const ariaPosInSet = (0,_2GXGCHW6_js__WEBPACK_IMPORTED_MODULE_9__/* .useStoreState */ .O$)(store, (state) => {
|
|
if (ariaPosInSetProp != null) return ariaPosInSetProp;
|
|
if (!state) return;
|
|
if (!(row == null ? void 0 : row.ariaPosInSet)) return;
|
|
if (row.baseElement !== state.baseElement) return;
|
|
const itemsInRow = state.renderedItems.filter(
|
|
(item) => item.rowId === rowId
|
|
);
|
|
return row.ariaPosInSet + itemsInRow.findIndex((item) => item.id === id);
|
|
});
|
|
const isTabbable = (0,_2GXGCHW6_js__WEBPACK_IMPORTED_MODULE_9__/* .useStoreState */ .O$)(store, (state) => {
|
|
if (!(state == null ? void 0 : state.renderedItems.length)) return true;
|
|
if (state.virtualFocus) return false;
|
|
if (tabbable) return true;
|
|
return state.activeId === id;
|
|
});
|
|
props = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_6__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_6__/* .__spreadValues */ .IA)({
|
|
id,
|
|
"data-active-item": isActiveItem || void 0
|
|
}, props), {
|
|
ref: (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_8__/* .useMergeRefs */ .SV)(ref, props.ref),
|
|
tabIndex: isTabbable ? props.tabIndex : -1,
|
|
onFocus,
|
|
onBlurCapture,
|
|
onKeyDown
|
|
});
|
|
props = (0,_NAXN2XAB_js__WEBPACK_IMPORTED_MODULE_12__/* .useCommand */ .D)(props);
|
|
props = (0,_PLQDTVXM_js__WEBPACK_IMPORTED_MODULE_13__/* .useCollectionItem */ .v)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_6__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_6__/* .__spreadValues */ .IA)({
|
|
store
|
|
}, props), {
|
|
getItem,
|
|
shouldRegisterItem: id ? props.shouldRegisterItem : false
|
|
}));
|
|
return (0,_ariakit_core_utils_misc__WEBPACK_IMPORTED_MODULE_10__/* .removeUndefinedValues */ .HR)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_6__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_6__/* .__spreadValues */ .IA)({}, props), {
|
|
"aria-setsize": ariaSetSize,
|
|
"aria-posinset": ariaPosInSet
|
|
}));
|
|
}
|
|
);
|
|
var CompositeItem = (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_5__/* .memo */ .ph)(
|
|
(0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_5__/* .forwardRef */ .Rf)(function CompositeItem2(props) {
|
|
const htmlProps = useCompositeItem(props);
|
|
return (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_5__/* .createElement */ .n)(TagName, htmlProps);
|
|
})
|
|
);
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ IA: () => (/* binding */ __spreadValues),
|
|
/* harmony export */ YG: () => (/* binding */ __objRest),
|
|
/* harmony export */ ko: () => (/* binding */ __spreadProps)
|
|
/* harmony export */ });
|
|
"use client";
|
|
var __defProp = Object.defineProperty;
|
|
var __defProps = Object.defineProperties;
|
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var __spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (__hasOwnProp.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
if (__getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
if (__propIsEnum.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
var __objRest = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && __getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(source)) {
|
|
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/54MGSIOI.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ s1: () => (/* binding */ PopoverScopedContextProvider),
|
|
/* harmony export */ wf: () => (/* binding */ PopoverContextProvider),
|
|
/* harmony export */ zG: () => (/* binding */ usePopoverProviderContext)
|
|
/* harmony export */ });
|
|
/* unused harmony exports usePopoverContext, usePopoverScopedContext */
|
|
/* harmony import */ var _DU4D3UCJ_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/DU4D3UCJ.js");
|
|
/* harmony import */ var _HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HKOOKEDE.js");
|
|
"use client";
|
|
|
|
|
|
|
|
// src/popover/popover-context.tsx
|
|
var ctx = (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_0__/* .createStoreContext */ .B0)(
|
|
[_DU4D3UCJ_js__WEBPACK_IMPORTED_MODULE_1__/* .DialogContextProvider */ .Zg],
|
|
[_DU4D3UCJ_js__WEBPACK_IMPORTED_MODULE_1__/* .DialogScopedContextProvider */ .XP]
|
|
);
|
|
var usePopoverContext = ctx.useContext;
|
|
var usePopoverScopedContext = ctx.useScopedContext;
|
|
var usePopoverProviderContext = ctx.useProviderContext;
|
|
var PopoverContextProvider = ctx.ContextProvider;
|
|
var PopoverScopedContextProvider = ctx.ScopedContextProvider;
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/5VQZOHHZ.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ Qh: () => (/* binding */ silentlyFocused),
|
|
/* harmony export */ WZ: () => (/* binding */ isItem),
|
|
/* harmony export */ _d: () => (/* binding */ flipItems),
|
|
/* harmony export */ es: () => (/* binding */ groupItemsByRows),
|
|
/* harmony export */ hZ: () => (/* binding */ getEnabledItem),
|
|
/* harmony export */ hk: () => (/* binding */ focusSilently),
|
|
/* harmony export */ iT: () => (/* binding */ selectTextField),
|
|
/* harmony export */ oi: () => (/* binding */ findFirstEnabledItem)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _ariakit_core_utils_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/HWOIWM4O.js");
|
|
"use client";
|
|
|
|
// src/composite/utils.ts
|
|
|
|
var NULL_ITEM = { id: null };
|
|
function flipItems(items, activeId, shouldInsertNullItem = false) {
|
|
const index = items.findIndex((item) => item.id === activeId);
|
|
return [
|
|
...items.slice(index + 1),
|
|
...shouldInsertNullItem ? [NULL_ITEM] : [],
|
|
...items.slice(0, index)
|
|
];
|
|
}
|
|
function findFirstEnabledItem(items, excludeId) {
|
|
return items.find((item) => {
|
|
if (excludeId) {
|
|
return !item.disabled && item.id !== excludeId;
|
|
}
|
|
return !item.disabled;
|
|
});
|
|
}
|
|
function getEnabledItem(store, id) {
|
|
if (!id) return null;
|
|
return store.item(id) || null;
|
|
}
|
|
function groupItemsByRows(items) {
|
|
const rows = [];
|
|
for (const item of items) {
|
|
const row = rows.find((currentRow) => {
|
|
var _a;
|
|
return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId;
|
|
});
|
|
if (row) {
|
|
row.push(item);
|
|
} else {
|
|
rows.push([item]);
|
|
}
|
|
}
|
|
return rows;
|
|
}
|
|
function selectTextField(element, collapseToEnd = false) {
|
|
if ((0,_ariakit_core_utils_dom__WEBPACK_IMPORTED_MODULE_0__/* .isTextField */ .mB)(element)) {
|
|
element.setSelectionRange(
|
|
collapseToEnd ? element.value.length : 0,
|
|
element.value.length
|
|
);
|
|
} else if (element.isContentEditable) {
|
|
const selection = (0,_ariakit_core_utils_dom__WEBPACK_IMPORTED_MODULE_0__/* .getDocument */ .YE)(element).getSelection();
|
|
selection == null ? void 0 : selection.selectAllChildren(element);
|
|
if (collapseToEnd) {
|
|
selection == null ? void 0 : selection.collapseToEnd();
|
|
}
|
|
}
|
|
}
|
|
var FOCUS_SILENTLY = Symbol("FOCUS_SILENTLY");
|
|
function focusSilently(element) {
|
|
element[FOCUS_SILENTLY] = true;
|
|
element.focus({ preventScroll: true });
|
|
}
|
|
function silentlyFocused(element) {
|
|
const isSilentlyFocused = element[FOCUS_SILENTLY];
|
|
delete element[FOCUS_SILENTLY];
|
|
return isSilentlyFocused;
|
|
}
|
|
function isItem(store, element, exclude) {
|
|
if (!element) return false;
|
|
if (element === exclude) return false;
|
|
const item = store.item(element.id);
|
|
if (!item) return false;
|
|
if (exclude && item.element === exclude) return false;
|
|
return true;
|
|
}
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/AXRBYZQP.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ X: () => (/* binding */ Role)
|
|
/* harmony export */ });
|
|
/* unused harmony export useRole */
|
|
/* harmony import */ var _HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HKOOKEDE.js");
|
|
"use client";
|
|
|
|
|
|
// src/role/role.tsx
|
|
var TagName = "div";
|
|
var elements = [
|
|
"a",
|
|
"button",
|
|
"details",
|
|
"dialog",
|
|
"div",
|
|
"form",
|
|
"h1",
|
|
"h2",
|
|
"h3",
|
|
"h4",
|
|
"h5",
|
|
"h6",
|
|
"header",
|
|
"img",
|
|
"input",
|
|
"label",
|
|
"li",
|
|
"nav",
|
|
"ol",
|
|
"p",
|
|
"section",
|
|
"select",
|
|
"span",
|
|
"summary",
|
|
"textarea",
|
|
"ul",
|
|
"svg"
|
|
];
|
|
var useRole = (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_0__/* .createHook */ .ab)(
|
|
function useRole2(props) {
|
|
return props;
|
|
}
|
|
);
|
|
var Role = (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_0__/* .forwardRef */ .Rf)(
|
|
// @ts-expect-error
|
|
function Role2(props) {
|
|
return (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_0__/* .createElement */ .n)(TagName, props);
|
|
}
|
|
);
|
|
Object.assign(
|
|
Role,
|
|
elements.reduce((acc, element) => {
|
|
acc[element] = (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_0__/* .forwardRef */ .Rf)(function Role3(props) {
|
|
return (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_0__/* .createElement */ .n)(element, props);
|
|
});
|
|
return acc;
|
|
}, {})
|
|
);
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/BSEL4YAF.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ aT: () => (/* binding */ useDisclosureContent),
|
|
/* harmony export */ dK: () => (/* binding */ isHidden)
|
|
/* harmony export */ });
|
|
/* unused harmony export DisclosureContent */
|
|
/* harmony import */ var _DU4D3UCJ_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/DU4D3UCJ.js");
|
|
/* harmony import */ var _RGUP62TM_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/RGUP62TM.js");
|
|
/* harmony import */ var _HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HKOOKEDE.js");
|
|
/* harmony import */ var _2GXGCHW6_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/2GXGCHW6.js");
|
|
/* harmony import */ var _Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/Z32BISHQ.js");
|
|
/* harmony import */ var _3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js");
|
|
/* harmony import */ var _ariakit_core_utils_misc__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/index.js");
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// src/disclosure/disclosure-content.tsx
|
|
|
|
|
|
|
|
|
|
var TagName = "div";
|
|
function afterTimeout(timeoutMs, cb) {
|
|
const timeoutId = setTimeout(cb, timeoutMs);
|
|
return () => clearTimeout(timeoutId);
|
|
}
|
|
function afterPaint(cb) {
|
|
let raf = requestAnimationFrame(() => {
|
|
raf = requestAnimationFrame(cb);
|
|
});
|
|
return () => cancelAnimationFrame(raf);
|
|
}
|
|
function parseCSSTime(...times) {
|
|
return times.join(", ").split(", ").reduce((longestTime, currentTimeString) => {
|
|
const multiplier = currentTimeString.endsWith("ms") ? 1 : 1e3;
|
|
const currentTime = Number.parseFloat(currentTimeString || "0s") * multiplier;
|
|
if (currentTime > longestTime) return currentTime;
|
|
return longestTime;
|
|
}, 0);
|
|
}
|
|
function isHidden(mounted, hidden, alwaysVisible) {
|
|
return !alwaysVisible && hidden !== false && (!mounted || !!hidden);
|
|
}
|
|
var useDisclosureContent = (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_3__/* .createHook */ .ab)(function useDisclosureContent2(_a) {
|
|
var _b = _a, { store, alwaysVisible } = _b, props = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_4__/* .__objRest */ .YG)(_b, ["store", "alwaysVisible"]);
|
|
const context = (0,_RGUP62TM_js__WEBPACK_IMPORTED_MODULE_5__/* .useDisclosureProviderContext */ .vO)();
|
|
store = store || context;
|
|
(0,_ariakit_core_utils_misc__WEBPACK_IMPORTED_MODULE_6__/* .invariant */ .V1)(
|
|
store,
|
|
false && 0
|
|
);
|
|
const ref = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
const id = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_7__/* .useId */ .Bi)(props.id);
|
|
const [transition, setTransition] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null);
|
|
const open = store.useState("open");
|
|
const mounted = store.useState("mounted");
|
|
const animated = store.useState("animated");
|
|
const contentElement = store.useState("contentElement");
|
|
const otherElement = (0,_2GXGCHW6_js__WEBPACK_IMPORTED_MODULE_8__/* .useStoreState */ .O$)(store.disclosure, "contentElement");
|
|
(0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_7__/* .useSafeLayoutEffect */ .UQ)(() => {
|
|
if (!ref.current) return;
|
|
store == null ? void 0 : store.setContentElement(ref.current);
|
|
}, [store]);
|
|
(0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_7__/* .useSafeLayoutEffect */ .UQ)(() => {
|
|
let previousAnimated;
|
|
store == null ? void 0 : store.setState("animated", (animated2) => {
|
|
previousAnimated = animated2;
|
|
return true;
|
|
});
|
|
return () => {
|
|
if (previousAnimated === void 0) return;
|
|
store == null ? void 0 : store.setState("animated", previousAnimated);
|
|
};
|
|
}, [store]);
|
|
(0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_7__/* .useSafeLayoutEffect */ .UQ)(() => {
|
|
if (!animated) return;
|
|
if (!(contentElement == null ? void 0 : contentElement.isConnected)) {
|
|
setTransition(null);
|
|
return;
|
|
}
|
|
return afterPaint(() => {
|
|
setTransition(open ? "enter" : mounted ? "leave" : null);
|
|
});
|
|
}, [animated, contentElement, open, mounted]);
|
|
(0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_7__/* .useSafeLayoutEffect */ .UQ)(() => {
|
|
if (!store) return;
|
|
if (!animated) return;
|
|
const stopAnimation = () => store == null ? void 0 : store.setState("animating", false);
|
|
const stopAnimationSync = () => (0,react_dom__WEBPACK_IMPORTED_MODULE_1__.flushSync)(stopAnimation);
|
|
if (!transition || !contentElement) {
|
|
stopAnimation();
|
|
return;
|
|
}
|
|
if (transition === "leave" && open) return;
|
|
if (transition === "enter" && !open) return;
|
|
if (typeof animated === "number") {
|
|
const timeout2 = animated;
|
|
return afterTimeout(timeout2, stopAnimationSync);
|
|
}
|
|
const {
|
|
transitionDuration,
|
|
animationDuration,
|
|
transitionDelay,
|
|
animationDelay
|
|
} = getComputedStyle(contentElement);
|
|
const {
|
|
transitionDuration: transitionDuration2 = "0",
|
|
animationDuration: animationDuration2 = "0",
|
|
transitionDelay: transitionDelay2 = "0",
|
|
animationDelay: animationDelay2 = "0"
|
|
} = otherElement ? getComputedStyle(otherElement) : {};
|
|
const delay = parseCSSTime(
|
|
transitionDelay,
|
|
animationDelay,
|
|
transitionDelay2,
|
|
animationDelay2
|
|
);
|
|
const duration = parseCSSTime(
|
|
transitionDuration,
|
|
animationDuration,
|
|
transitionDuration2,
|
|
animationDuration2
|
|
);
|
|
const timeout = delay + duration;
|
|
if (!timeout) {
|
|
if (transition === "enter") {
|
|
store.setState("animated", false);
|
|
}
|
|
stopAnimation();
|
|
return;
|
|
}
|
|
const frameRate = 1e3 / 60;
|
|
const maxTimeout = Math.max(timeout - frameRate, 0);
|
|
return afterTimeout(maxTimeout, stopAnimationSync);
|
|
}, [store, animated, contentElement, otherElement, open, transition]);
|
|
props = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_7__/* .useWrapElement */ .w7)(
|
|
props,
|
|
(element) => /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_DU4D3UCJ_js__WEBPACK_IMPORTED_MODULE_9__/* .DialogScopedContextProvider */ .XP, { value: store, children: element }),
|
|
[store]
|
|
);
|
|
const hidden = isHidden(mounted, props.hidden, alwaysVisible);
|
|
const styleProp = props.style;
|
|
const style = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => {
|
|
if (hidden) return (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_4__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_4__/* .__spreadValues */ .IA)({}, styleProp), { display: "none" });
|
|
return styleProp;
|
|
}, [hidden, styleProp]);
|
|
props = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_4__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_4__/* .__spreadValues */ .IA)({
|
|
id,
|
|
"data-open": open || void 0,
|
|
"data-enter": transition === "enter" || void 0,
|
|
"data-leave": transition === "leave" || void 0,
|
|
hidden
|
|
}, props), {
|
|
ref: (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_7__/* .useMergeRefs */ .SV)(id ? store.setContentElement : null, ref, props.ref),
|
|
style
|
|
});
|
|
return (0,_ariakit_core_utils_misc__WEBPACK_IMPORTED_MODULE_6__/* .removeUndefinedValues */ .HR)(props);
|
|
});
|
|
var DisclosureContentImpl = (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_3__/* .forwardRef */ .Rf)(function DisclosureContentImpl2(props) {
|
|
const htmlProps = useDisclosureContent(props);
|
|
return (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_3__/* .createElement */ .n)(TagName, htmlProps);
|
|
});
|
|
var DisclosureContent = (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_3__/* .forwardRef */ .Rf)(function DisclosureContent2(_a) {
|
|
var _b = _a, {
|
|
unmountOnHide
|
|
} = _b, props = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_4__/* .__objRest */ .YG)(_b, [
|
|
"unmountOnHide"
|
|
]);
|
|
const context = (0,_RGUP62TM_js__WEBPACK_IMPORTED_MODULE_5__/* .useDisclosureProviderContext */ .vO)();
|
|
const store = props.store || context;
|
|
const mounted = (0,_2GXGCHW6_js__WEBPACK_IMPORTED_MODULE_8__/* .useStoreState */ .O$)(
|
|
store,
|
|
(state) => !unmountOnHide || (state == null ? void 0 : state.mounted)
|
|
);
|
|
if (mounted === false) return null;
|
|
return /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(DisclosureContentImpl, (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_4__/* .__spreadValues */ .IA)({}, props));
|
|
});
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/CBC47ZYL.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ o: () => (/* binding */ usePopoverStoreProps)
|
|
/* harmony export */ });
|
|
/* unused harmony export usePopoverStore */
|
|
/* harmony import */ var _QYS5FHDY_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/QYS5FHDY.js");
|
|
/* harmony import */ var _2GXGCHW6_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/2GXGCHW6.js");
|
|
/* harmony import */ var _Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/Z32BISHQ.js");
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
// src/popover/popover-store.ts
|
|
|
|
function usePopoverStoreProps(store, update, props) {
|
|
(0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_0__/* .useUpdateEffect */ .w5)(update, [props.popover]);
|
|
(0,_2GXGCHW6_js__WEBPACK_IMPORTED_MODULE_1__/* .useStoreProps */ .Tz)(store, props, "placement");
|
|
return (0,_QYS5FHDY_js__WEBPACK_IMPORTED_MODULE_2__/* .useDialogStoreProps */ .N)(store, update, props);
|
|
}
|
|
function usePopoverStore(props = {}) {
|
|
const [store, update] = useStore(Core.createPopoverStore, props);
|
|
return usePopoverStoreProps(store, update, props);
|
|
}
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/CTQR3VDU.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ Kw: () => (/* binding */ useHovercardProviderContext),
|
|
/* harmony export */ n0: () => (/* binding */ HovercardScopedContextProvider),
|
|
/* harmony export */ pR: () => (/* binding */ HovercardContextProvider)
|
|
/* harmony export */ });
|
|
/* unused harmony exports useHovercardContext, useHovercardScopedContext */
|
|
/* harmony import */ var _54MGSIOI_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/54MGSIOI.js");
|
|
/* harmony import */ var _HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HKOOKEDE.js");
|
|
"use client";
|
|
|
|
|
|
|
|
// src/hovercard/hovercard-context.tsx
|
|
var ctx = (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_0__/* .createStoreContext */ .B0)(
|
|
[_54MGSIOI_js__WEBPACK_IMPORTED_MODULE_1__/* .PopoverContextProvider */ .wf],
|
|
[_54MGSIOI_js__WEBPACK_IMPORTED_MODULE_1__/* .PopoverScopedContextProvider */ .s1]
|
|
);
|
|
var useHovercardContext = ctx.useContext;
|
|
var useHovercardScopedContext = ctx.useScopedContext;
|
|
var useHovercardProviderContext = ctx.useProviderContext;
|
|
var HovercardContextProvider = ctx.ContextProvider;
|
|
var HovercardScopedContextProvider = ctx.ScopedContextProvider;
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/DU4D3UCJ.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ XP: () => (/* binding */ DialogScopedContextProvider),
|
|
/* harmony export */ YH: () => (/* binding */ DialogHeadingContext),
|
|
/* harmony export */ Zg: () => (/* binding */ DialogContextProvider),
|
|
/* harmony export */ cH: () => (/* binding */ useDialogProviderContext),
|
|
/* harmony export */ oL: () => (/* binding */ DialogDescriptionContext)
|
|
/* harmony export */ });
|
|
/* unused harmony exports useDialogContext, useDialogScopedContext */
|
|
/* harmony import */ var _RGUP62TM_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/RGUP62TM.js");
|
|
/* harmony import */ var _HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HKOOKEDE.js");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
"use client";
|
|
|
|
|
|
|
|
// src/dialog/dialog-context.tsx
|
|
|
|
var ctx = (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_1__/* .createStoreContext */ .B0)(
|
|
[_RGUP62TM_js__WEBPACK_IMPORTED_MODULE_2__/* .DisclosureContextProvider */ .sI],
|
|
[_RGUP62TM_js__WEBPACK_IMPORTED_MODULE_2__/* .DisclosureScopedContextProvider */ .WT]
|
|
);
|
|
var useDialogContext = ctx.useContext;
|
|
var useDialogScopedContext = ctx.useScopedContext;
|
|
var useDialogProviderContext = ctx.useProviderContext;
|
|
var DialogContextProvider = ctx.ContextProvider;
|
|
var DialogScopedContextProvider = ctx.ScopedContextProvider;
|
|
var DialogHeadingContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(void 0);
|
|
var DialogDescriptionContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(void 0);
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/FMYQNSCK.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ $I: () => (/* binding */ useCollectionContext),
|
|
/* harmony export */ LN: () => (/* binding */ CollectionContextProvider),
|
|
/* harmony export */ zX: () => (/* binding */ CollectionScopedContextProvider)
|
|
/* harmony export */ });
|
|
/* unused harmony exports useCollectionScopedContext, useCollectionProviderContext */
|
|
/* harmony import */ var _HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HKOOKEDE.js");
|
|
"use client";
|
|
|
|
|
|
// src/collection/collection-context.tsx
|
|
var ctx = (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_0__/* .createStoreContext */ .B0)();
|
|
var useCollectionContext = ctx.useContext;
|
|
var useCollectionScopedContext = ctx.useScopedContext;
|
|
var useCollectionProviderContext = ctx.useProviderContext;
|
|
var CollectionContextProvider = ctx.ContextProvider;
|
|
var CollectionScopedContextProvider = ctx.ScopedContextProvider;
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HGZKAGPL.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ W: () => (/* binding */ useFocusable)
|
|
/* harmony export */ });
|
|
/* unused harmony export Focusable */
|
|
/* harmony import */ var _SWN3JYXT_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/SWN3JYXT.js");
|
|
/* harmony import */ var _HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HKOOKEDE.js");
|
|
/* harmony import */ var _Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/Z32BISHQ.js");
|
|
/* harmony import */ var _3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js");
|
|
/* harmony import */ var _ariakit_core_utils_dom__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/HWOIWM4O.js");
|
|
/* harmony import */ var _ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/utils/events.js");
|
|
/* harmony import */ var _ariakit_core_utils_focus__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/utils/focus.js");
|
|
/* harmony import */ var _ariakit_core_utils_misc__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js");
|
|
/* harmony import */ var _ariakit_core_utils_platform__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/US4USQPI.js");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
// src/focusable/focusable.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var TagName = "div";
|
|
var isSafariBrowser = (0,_ariakit_core_utils_platform__WEBPACK_IMPORTED_MODULE_1__/* .isSafari */ .nr)();
|
|
var alwaysFocusVisibleInputTypes = [
|
|
"text",
|
|
"search",
|
|
"url",
|
|
"tel",
|
|
"email",
|
|
"password",
|
|
"number",
|
|
"date",
|
|
"month",
|
|
"week",
|
|
"time",
|
|
"datetime",
|
|
"datetime-local"
|
|
];
|
|
function isAlwaysFocusVisible(element) {
|
|
const { tagName, readOnly, type } = element;
|
|
if (tagName === "TEXTAREA" && !readOnly) return true;
|
|
if (tagName === "SELECT" && !readOnly) return true;
|
|
if (tagName === "INPUT" && !readOnly) {
|
|
return alwaysFocusVisibleInputTypes.includes(type);
|
|
}
|
|
if (element.isContentEditable) return true;
|
|
const role = element.getAttribute("role");
|
|
if (role === "combobox" && element.dataset.name) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
function getLabels(element) {
|
|
if ("labels" in element) {
|
|
return element.labels;
|
|
}
|
|
return null;
|
|
}
|
|
function isNativeCheckboxOrRadio(element) {
|
|
const tagName = element.tagName.toLowerCase();
|
|
if (tagName === "input" && element.type) {
|
|
return element.type === "radio" || element.type === "checkbox";
|
|
}
|
|
return false;
|
|
}
|
|
function isNativeTabbable(tagName) {
|
|
if (!tagName) return true;
|
|
return tagName === "button" || tagName === "summary" || tagName === "input" || tagName === "select" || tagName === "textarea" || tagName === "a";
|
|
}
|
|
function supportsDisabledAttribute(tagName) {
|
|
if (!tagName) return true;
|
|
return tagName === "button" || tagName === "input" || tagName === "select" || tagName === "textarea";
|
|
}
|
|
function getTabIndex(focusable, trulyDisabled, nativeTabbable, supportsDisabled, tabIndexProp) {
|
|
if (!focusable) {
|
|
return tabIndexProp;
|
|
}
|
|
if (trulyDisabled) {
|
|
if (nativeTabbable && !supportsDisabled) {
|
|
return -1;
|
|
}
|
|
return;
|
|
}
|
|
if (nativeTabbable) {
|
|
return tabIndexProp;
|
|
}
|
|
return tabIndexProp || 0;
|
|
}
|
|
function useDisableEvent(onEvent, disabled) {
|
|
return (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_2__/* .useEvent */ ._q)((event) => {
|
|
onEvent == null ? void 0 : onEvent(event);
|
|
if (event.defaultPrevented) return;
|
|
if (disabled) {
|
|
event.stopPropagation();
|
|
event.preventDefault();
|
|
}
|
|
});
|
|
}
|
|
var isKeyboardModality = true;
|
|
function onGlobalMouseDown(event) {
|
|
const target = event.target;
|
|
if (target && "hasAttribute" in target) {
|
|
if (!target.hasAttribute("data-focus-visible")) {
|
|
isKeyboardModality = false;
|
|
}
|
|
}
|
|
}
|
|
function onGlobalKeyDown(event) {
|
|
if (event.metaKey) return;
|
|
if (event.ctrlKey) return;
|
|
if (event.altKey) return;
|
|
isKeyboardModality = true;
|
|
}
|
|
var useFocusable = (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_3__/* .createHook */ .ab)(
|
|
function useFocusable2(_a) {
|
|
var _b = _a, {
|
|
focusable = true,
|
|
accessibleWhenDisabled,
|
|
autoFocus,
|
|
onFocusVisible
|
|
} = _b, props = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_4__/* .__objRest */ .YG)(_b, [
|
|
"focusable",
|
|
"accessibleWhenDisabled",
|
|
"autoFocus",
|
|
"onFocusVisible"
|
|
]);
|
|
const ref = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
if (!focusable) return;
|
|
(0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_5__/* .addGlobalEventListener */ .dg)("mousedown", onGlobalMouseDown, true);
|
|
(0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_5__/* .addGlobalEventListener */ .dg)("keydown", onGlobalKeyDown, true);
|
|
}, [focusable]);
|
|
if (isSafariBrowser) {
|
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
if (!focusable) return;
|
|
const element = ref.current;
|
|
if (!element) return;
|
|
if (!isNativeCheckboxOrRadio(element)) return;
|
|
const labels = getLabels(element);
|
|
if (!labels) return;
|
|
const onMouseUp = () => queueMicrotask(() => element.focus());
|
|
for (const label of labels) {
|
|
label.addEventListener("mouseup", onMouseUp);
|
|
}
|
|
return () => {
|
|
for (const label of labels) {
|
|
label.removeEventListener("mouseup", onMouseUp);
|
|
}
|
|
};
|
|
}, [focusable]);
|
|
}
|
|
const disabled = focusable && (0,_ariakit_core_utils_misc__WEBPACK_IMPORTED_MODULE_6__/* .disabledFromProps */ .$f)(props);
|
|
const trulyDisabled = !!disabled && !accessibleWhenDisabled;
|
|
const [focusVisible, setFocusVisible] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
|
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
if (!focusable) return;
|
|
if (trulyDisabled && focusVisible) {
|
|
setFocusVisible(false);
|
|
}
|
|
}, [focusable, trulyDisabled, focusVisible]);
|
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
if (!focusable) return;
|
|
if (!focusVisible) return;
|
|
const element = ref.current;
|
|
if (!element) return;
|
|
if (typeof IntersectionObserver === "undefined") return;
|
|
const observer = new IntersectionObserver(() => {
|
|
if (!(0,_ariakit_core_utils_focus__WEBPACK_IMPORTED_MODULE_7__/* .isFocusable */ .tp)(element)) {
|
|
setFocusVisible(false);
|
|
}
|
|
});
|
|
observer.observe(element);
|
|
return () => observer.disconnect();
|
|
}, [focusable, focusVisible]);
|
|
const onKeyPressCapture = useDisableEvent(
|
|
props.onKeyPressCapture,
|
|
disabled
|
|
);
|
|
const onMouseDownCapture = useDisableEvent(
|
|
props.onMouseDownCapture,
|
|
disabled
|
|
);
|
|
const onClickCapture = useDisableEvent(props.onClickCapture, disabled);
|
|
const onMouseDownProp = props.onMouseDown;
|
|
const onMouseDown = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_2__/* .useEvent */ ._q)((event) => {
|
|
onMouseDownProp == null ? void 0 : onMouseDownProp(event);
|
|
if (event.defaultPrevented) return;
|
|
if (!focusable) return;
|
|
const element = event.currentTarget;
|
|
if (!isSafariBrowser) return;
|
|
if ((0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_5__/* .isPortalEvent */ .ho)(event)) return;
|
|
if (!(0,_ariakit_core_utils_dom__WEBPACK_IMPORTED_MODULE_8__/* .isButton */ .Bm)(element) && !isNativeCheckboxOrRadio(element)) return;
|
|
let receivedFocus = false;
|
|
const onFocus = () => {
|
|
receivedFocus = true;
|
|
};
|
|
const options = { capture: true, once: true };
|
|
element.addEventListener("focusin", onFocus, options);
|
|
(0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_5__/* .queueBeforeEvent */ .nz)(element, "mouseup", () => {
|
|
element.removeEventListener("focusin", onFocus, true);
|
|
if (receivedFocus) return;
|
|
(0,_ariakit_core_utils_focus__WEBPACK_IMPORTED_MODULE_7__/* .focusIfNeeded */ ["do"])(element);
|
|
});
|
|
});
|
|
const handleFocusVisible = (event, currentTarget) => {
|
|
if (currentTarget) {
|
|
event.currentTarget = currentTarget;
|
|
}
|
|
if (!focusable) return;
|
|
const element = event.currentTarget;
|
|
if (!element) return;
|
|
if (!(0,_ariakit_core_utils_focus__WEBPACK_IMPORTED_MODULE_7__/* .hasFocus */ .AJ)(element)) return;
|
|
onFocusVisible == null ? void 0 : onFocusVisible(event);
|
|
if (event.defaultPrevented) return;
|
|
setFocusVisible(true);
|
|
};
|
|
const onKeyDownCaptureProp = props.onKeyDownCapture;
|
|
const onKeyDownCapture = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_2__/* .useEvent */ ._q)((event) => {
|
|
onKeyDownCaptureProp == null ? void 0 : onKeyDownCaptureProp(event);
|
|
if (event.defaultPrevented) return;
|
|
if (!focusable) return;
|
|
if (focusVisible) return;
|
|
if (event.metaKey) return;
|
|
if (event.altKey) return;
|
|
if (event.ctrlKey) return;
|
|
if (!(0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_5__/* .isSelfTarget */ .uh)(event)) return;
|
|
const element = event.currentTarget;
|
|
const applyFocusVisible = () => handleFocusVisible(event, element);
|
|
(0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_5__/* .queueBeforeEvent */ .nz)(element, "focusout", applyFocusVisible);
|
|
});
|
|
const onFocusCaptureProp = props.onFocusCapture;
|
|
const onFocusCapture = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_2__/* .useEvent */ ._q)((event) => {
|
|
onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event);
|
|
if (event.defaultPrevented) return;
|
|
if (!focusable) return;
|
|
if (!(0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_5__/* .isSelfTarget */ .uh)(event)) {
|
|
setFocusVisible(false);
|
|
return;
|
|
}
|
|
const element = event.currentTarget;
|
|
const applyFocusVisible = () => handleFocusVisible(event, element);
|
|
if (isKeyboardModality || isAlwaysFocusVisible(event.target)) {
|
|
(0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_5__/* .queueBeforeEvent */ .nz)(event.target, "focusout", applyFocusVisible);
|
|
} else {
|
|
setFocusVisible(false);
|
|
}
|
|
});
|
|
const onBlurProp = props.onBlur;
|
|
const onBlur = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_2__/* .useEvent */ ._q)((event) => {
|
|
onBlurProp == null ? void 0 : onBlurProp(event);
|
|
if (!focusable) return;
|
|
if (!(0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_5__/* .isFocusEventOutside */ .aG)(event)) return;
|
|
setFocusVisible(false);
|
|
});
|
|
const autoFocusOnShow = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_SWN3JYXT_js__WEBPACK_IMPORTED_MODULE_9__/* .FocusableContext */ .g);
|
|
const autoFocusRef = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_2__/* .useEvent */ ._q)((element) => {
|
|
if (!focusable) return;
|
|
if (!autoFocus) return;
|
|
if (!element) return;
|
|
if (!autoFocusOnShow) return;
|
|
queueMicrotask(() => {
|
|
if ((0,_ariakit_core_utils_focus__WEBPACK_IMPORTED_MODULE_7__/* .hasFocus */ .AJ)(element)) return;
|
|
if (!(0,_ariakit_core_utils_focus__WEBPACK_IMPORTED_MODULE_7__/* .isFocusable */ .tp)(element)) return;
|
|
element.focus();
|
|
});
|
|
});
|
|
const tagName = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_2__/* .useTagName */ .vO)(ref);
|
|
const nativeTabbable = focusable && isNativeTabbable(tagName);
|
|
const supportsDisabled = focusable && supportsDisabledAttribute(tagName);
|
|
const styleProp = props.style;
|
|
const style = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => {
|
|
if (trulyDisabled) {
|
|
return (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_4__/* .__spreadValues */ .IA)({ pointerEvents: "none" }, styleProp);
|
|
}
|
|
return styleProp;
|
|
}, [trulyDisabled, styleProp]);
|
|
props = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_4__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_4__/* .__spreadValues */ .IA)({
|
|
"data-focus-visible": focusable && focusVisible || void 0,
|
|
"data-autofocus": autoFocus || void 0,
|
|
"aria-disabled": disabled || void 0
|
|
}, props), {
|
|
ref: (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_2__/* .useMergeRefs */ .SV)(ref, autoFocusRef, props.ref),
|
|
style,
|
|
tabIndex: getTabIndex(
|
|
focusable,
|
|
trulyDisabled,
|
|
nativeTabbable,
|
|
supportsDisabled,
|
|
props.tabIndex
|
|
),
|
|
disabled: supportsDisabled && trulyDisabled ? true : void 0,
|
|
// TODO: Test Focusable contentEditable.
|
|
contentEditable: disabled ? void 0 : props.contentEditable,
|
|
onKeyPressCapture,
|
|
onClickCapture,
|
|
onMouseDownCapture,
|
|
onMouseDown,
|
|
onKeyDownCapture,
|
|
onFocusCapture,
|
|
onBlur
|
|
});
|
|
return (0,_ariakit_core_utils_misc__WEBPACK_IMPORTED_MODULE_6__/* .removeUndefinedValues */ .HR)(props);
|
|
}
|
|
);
|
|
var Focusable = (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_3__/* .forwardRef */ .Rf)(function Focusable2(props) {
|
|
const htmlProps = useFocusable(props);
|
|
return (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_3__/* .createElement */ .n)(TagName, htmlProps);
|
|
});
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HKOOKEDE.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ B0: () => (/* binding */ createStoreContext),
|
|
/* harmony export */ Rf: () => (/* binding */ forwardRef2),
|
|
/* harmony export */ ab: () => (/* binding */ createHook),
|
|
/* harmony export */ n: () => (/* binding */ createElement),
|
|
/* harmony export */ ph: () => (/* binding */ memo2)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/Z32BISHQ.js");
|
|
/* harmony import */ var _SK3NAZA3_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/SK3NAZA3.js");
|
|
/* harmony import */ var _3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
// src/utils/system.tsx
|
|
|
|
|
|
function forwardRef2(render) {
|
|
const Role = react__WEBPACK_IMPORTED_MODULE_0__.forwardRef((props, ref) => render((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__/* .__spreadValues */ .IA)({}, props), { ref })));
|
|
Role.displayName = render.displayName || render.name;
|
|
return Role;
|
|
}
|
|
function memo2(Component, propsAreEqual) {
|
|
return react__WEBPACK_IMPORTED_MODULE_0__.memo(Component, propsAreEqual);
|
|
}
|
|
function createElement(Type, props) {
|
|
const _a = props, { wrapElement, render } = _a, rest = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__/* .__objRest */ .YG)(_a, ["wrapElement", "render"]);
|
|
const mergedRef = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_3__/* .useMergeRefs */ .SV)(props.ref, (0,_SK3NAZA3_js__WEBPACK_IMPORTED_MODULE_4__/* .getRefProperty */ .v1)(render));
|
|
let element;
|
|
if (react__WEBPACK_IMPORTED_MODULE_0__.isValidElement(render)) {
|
|
const renderProps = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__/* .__spreadValues */ .IA)({}, render.props), { ref: mergedRef });
|
|
element = react__WEBPACK_IMPORTED_MODULE_0__.cloneElement(render, (0,_SK3NAZA3_js__WEBPACK_IMPORTED_MODULE_4__/* .mergeProps */ .v6)(rest, renderProps));
|
|
} else if (render) {
|
|
element = render(rest);
|
|
} else {
|
|
element = /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(Type, (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__/* .__spreadValues */ .IA)({}, rest));
|
|
}
|
|
if (wrapElement) {
|
|
return wrapElement(element);
|
|
}
|
|
return element;
|
|
}
|
|
function createHook(useProps) {
|
|
const useRole = (props = {}) => {
|
|
return useProps(props);
|
|
};
|
|
useRole.displayName = useProps.name;
|
|
return useRole;
|
|
}
|
|
function createStoreContext(providers = [], scopedProviders = []) {
|
|
const context = react__WEBPACK_IMPORTED_MODULE_0__.createContext(void 0);
|
|
const scopedContext = react__WEBPACK_IMPORTED_MODULE_0__.createContext(void 0);
|
|
const useContext2 = () => react__WEBPACK_IMPORTED_MODULE_0__.useContext(context);
|
|
const useScopedContext = (onlyScoped = false) => {
|
|
const scoped = react__WEBPACK_IMPORTED_MODULE_0__.useContext(scopedContext);
|
|
const store = useContext2();
|
|
if (onlyScoped) return scoped;
|
|
return scoped || store;
|
|
};
|
|
const useProviderContext = () => {
|
|
const scoped = react__WEBPACK_IMPORTED_MODULE_0__.useContext(scopedContext);
|
|
const store = useContext2();
|
|
if (scoped && scoped === store) return;
|
|
return store;
|
|
};
|
|
const ContextProvider = (props) => {
|
|
return providers.reduceRight(
|
|
(children, Provider) => /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(Provider, (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__/* .__spreadValues */ .IA)({}, props), { children })),
|
|
/* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(context.Provider, (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__/* .__spreadValues */ .IA)({}, props))
|
|
);
|
|
};
|
|
const ScopedContextProvider = (props) => {
|
|
return /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(ContextProvider, (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__/* .__spreadValues */ .IA)({}, props), { children: scopedProviders.reduceRight(
|
|
(children, Provider) => /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(Provider, (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__/* .__spreadValues */ .IA)({}, props), { children })),
|
|
/* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(scopedContext.Provider, (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__/* .__spreadValues */ .IA)({}, props))
|
|
) }));
|
|
};
|
|
return {
|
|
context,
|
|
scopedContext,
|
|
useContext: useContext2,
|
|
useScopedContext,
|
|
useProviderContext,
|
|
ContextProvider,
|
|
ScopedContextProvider
|
|
};
|
|
}
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HQFKUKP3.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
a: () => (/* binding */ useHovercard)
|
|
});
|
|
|
|
// UNUSED EXPORTS: Hovercard
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/X7QOZUD3.js
|
|
"use client";
|
|
|
|
// src/hovercard/utils/polygon.ts
|
|
function getEventPoint(event) {
|
|
return [event.clientX, event.clientY];
|
|
}
|
|
function isPointInPolygon(point, polygon) {
|
|
const [x, y] = point;
|
|
let inside = false;
|
|
const length = polygon.length;
|
|
for (let l = length, i = 0, j = l - 1; i < l; j = i++) {
|
|
const [xi, yi] = polygon[i];
|
|
const [xj, yj] = polygon[j];
|
|
const [, vy] = polygon[j === 0 ? l - 1 : j - 1] || [0, 0];
|
|
const where = (yi - yj) * (x - xi) - (xi - xj) * (y - yi);
|
|
if (yj < yi) {
|
|
if (y >= yj && y < yi) {
|
|
if (where === 0) return true;
|
|
if (where > 0) {
|
|
if (y === yj) {
|
|
if (y > vy) {
|
|
inside = !inside;
|
|
}
|
|
} else {
|
|
inside = !inside;
|
|
}
|
|
}
|
|
}
|
|
} else if (yi < yj) {
|
|
if (y > yi && y <= yj) {
|
|
if (where === 0) return true;
|
|
if (where < 0) {
|
|
if (y === yj) {
|
|
if (y < vy) {
|
|
inside = !inside;
|
|
}
|
|
} else {
|
|
inside = !inside;
|
|
}
|
|
}
|
|
}
|
|
} else if (y === yi && (x >= xj && x <= xi || x >= xi && x <= xj)) {
|
|
return true;
|
|
}
|
|
}
|
|
return inside;
|
|
}
|
|
function getEnterPointPlacement(enterPoint, rect) {
|
|
const { top, right, bottom, left } = rect;
|
|
const [x, y] = enterPoint;
|
|
const placementX = x < left ? "left" : x > right ? "right" : null;
|
|
const placementY = y < top ? "top" : y > bottom ? "bottom" : null;
|
|
return [placementX, placementY];
|
|
}
|
|
function getElementPolygon(element, enterPoint) {
|
|
const rect = element.getBoundingClientRect();
|
|
const { top, right, bottom, left } = rect;
|
|
const [x, y] = getEnterPointPlacement(enterPoint, rect);
|
|
const polygon = [enterPoint];
|
|
if (x) {
|
|
if (y !== "top") {
|
|
polygon.push([x === "left" ? left : right, top]);
|
|
}
|
|
polygon.push([x === "left" ? right : left, top]);
|
|
polygon.push([x === "left" ? right : left, bottom]);
|
|
if (y !== "bottom") {
|
|
polygon.push([x === "left" ? left : right, bottom]);
|
|
}
|
|
} else if (y === "top") {
|
|
polygon.push([left, top]);
|
|
polygon.push([left, bottom]);
|
|
polygon.push([right, bottom]);
|
|
polygon.push([right, top]);
|
|
} else {
|
|
polygon.push([left, bottom]);
|
|
polygon.push([left, top]);
|
|
polygon.push([right, top]);
|
|
polygon.push([right, bottom]);
|
|
}
|
|
return polygon;
|
|
}
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/TT2355LN.js + 21 modules
|
|
var TT2355LN = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/TT2355LN.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/54MGSIOI.js
|
|
var _54MGSIOI = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/54MGSIOI.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HKOOKEDE.js
|
|
var HKOOKEDE = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HKOOKEDE.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/Z32BISHQ.js
|
|
var Z32BISHQ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/Z32BISHQ.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js
|
|
var _3YLGPPWQ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js
|
|
var PBFD2E7P = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@floating-ui+core@1.5.2/node_modules/@floating-ui/core/dist/floating-ui.core.mjs
|
|
var floating_ui_core = __webpack_require__("../../node_modules/.pnpm/@floating-ui+core@1.5.2/node_modules/@floating-ui/core/dist/floating-ui.core.mjs");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@floating-ui+dom@1.5.3/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs + 1 modules
|
|
var floating_ui_dom = __webpack_require__("../../node_modules/.pnpm/@floating-ui+dom@1.5.3/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js
|
|
var react = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/JS55N6L7.js
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// src/popover/popover.tsx
|
|
|
|
|
|
|
|
|
|
var TagName = "div";
|
|
function createDOMRect(x = 0, y = 0, width = 0, height = 0) {
|
|
if (typeof DOMRect === "function") {
|
|
return new DOMRect(x, y, width, height);
|
|
}
|
|
const rect = {
|
|
x,
|
|
y,
|
|
width,
|
|
height,
|
|
top: y,
|
|
right: x + width,
|
|
bottom: y + height,
|
|
left: x
|
|
};
|
|
return (0,_3YLGPPWQ/* __spreadProps */.ko)((0,_3YLGPPWQ/* __spreadValues */.IA)({}, rect), { toJSON: () => rect });
|
|
}
|
|
function getDOMRect(anchorRect) {
|
|
if (!anchorRect) return createDOMRect();
|
|
const { x, y, width, height } = anchorRect;
|
|
return createDOMRect(x, y, width, height);
|
|
}
|
|
function getAnchorElement(anchorElement, getAnchorRect) {
|
|
const contextElement = anchorElement || void 0;
|
|
return {
|
|
contextElement,
|
|
getBoundingClientRect: () => {
|
|
const anchor = anchorElement;
|
|
const anchorRect = getAnchorRect == null ? void 0 : getAnchorRect(anchor);
|
|
if (anchorRect || !anchor) {
|
|
return getDOMRect(anchorRect);
|
|
}
|
|
return anchor.getBoundingClientRect();
|
|
}
|
|
};
|
|
}
|
|
function isValidPlacement(flip2) {
|
|
return /^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(flip2);
|
|
}
|
|
function roundByDPR(value) {
|
|
const dpr = window.devicePixelRatio || 1;
|
|
return Math.round(value * dpr) / dpr;
|
|
}
|
|
function getOffsetMiddleware(arrowElement, props) {
|
|
return (0,floating_ui_core/* offset */.cY)(({ placement }) => {
|
|
var _a;
|
|
const arrowOffset = ((arrowElement == null ? void 0 : arrowElement.clientHeight) || 0) / 2;
|
|
const finalGutter = typeof props.gutter === "number" ? props.gutter + arrowOffset : (_a = props.gutter) != null ? _a : arrowOffset;
|
|
const hasAlignment = !!placement.split("-")[1];
|
|
return {
|
|
crossAxis: !hasAlignment ? props.shift : void 0,
|
|
mainAxis: finalGutter,
|
|
alignmentAxis: props.shift
|
|
};
|
|
});
|
|
}
|
|
function getFlipMiddleware(props) {
|
|
if (props.flip === false) return;
|
|
const fallbackPlacements = typeof props.flip === "string" ? props.flip.split(" ") : void 0;
|
|
(0,PBFD2E7P/* invariant */.V1)(
|
|
!fallbackPlacements || fallbackPlacements.every(isValidPlacement),
|
|
false && 0
|
|
);
|
|
return (0,floating_ui_core/* flip */.UU)({
|
|
padding: props.overflowPadding,
|
|
fallbackPlacements
|
|
});
|
|
}
|
|
function getShiftMiddleware(props) {
|
|
if (!props.slide && !props.overlap) return;
|
|
return (0,floating_ui_core/* shift */.BN)({
|
|
mainAxis: props.slide,
|
|
crossAxis: props.overlap,
|
|
padding: props.overflowPadding,
|
|
limiter: (0,floating_ui_core/* limitShift */.ER)()
|
|
});
|
|
}
|
|
function getSizeMiddleware(props) {
|
|
return (0,floating_ui_core/* size */.Ej)({
|
|
padding: props.overflowPadding,
|
|
apply({ elements, availableWidth, availableHeight, rects }) {
|
|
const wrapper = elements.floating;
|
|
const referenceWidth = Math.round(rects.reference.width);
|
|
availableWidth = Math.floor(availableWidth);
|
|
availableHeight = Math.floor(availableHeight);
|
|
wrapper.style.setProperty(
|
|
"--popover-anchor-width",
|
|
`${referenceWidth}px`
|
|
);
|
|
wrapper.style.setProperty(
|
|
"--popover-available-width",
|
|
`${availableWidth}px`
|
|
);
|
|
wrapper.style.setProperty(
|
|
"--popover-available-height",
|
|
`${availableHeight}px`
|
|
);
|
|
if (props.sameWidth) {
|
|
wrapper.style.width = `${referenceWidth}px`;
|
|
}
|
|
if (props.fitViewport) {
|
|
wrapper.style.maxWidth = `${availableWidth}px`;
|
|
wrapper.style.maxHeight = `${availableHeight}px`;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
function getArrowMiddleware(arrowElement, props) {
|
|
if (!arrowElement) return;
|
|
return (0,floating_ui_core/* arrow */.UE)({
|
|
element: arrowElement,
|
|
padding: props.arrowPadding
|
|
});
|
|
}
|
|
var usePopover = (0,HKOOKEDE/* createHook */.ab)(
|
|
function usePopover2(_a) {
|
|
var _b = _a, {
|
|
store,
|
|
modal = false,
|
|
portal = !!modal,
|
|
preserveTabOrder = true,
|
|
autoFocusOnShow = true,
|
|
wrapperProps,
|
|
fixed = false,
|
|
flip: flip2 = true,
|
|
shift: shift2 = 0,
|
|
slide = true,
|
|
overlap = false,
|
|
sameWidth = false,
|
|
fitViewport = false,
|
|
gutter,
|
|
arrowPadding = 4,
|
|
overflowPadding = 8,
|
|
getAnchorRect,
|
|
updatePosition
|
|
} = _b, props = (0,_3YLGPPWQ/* __objRest */.YG)(_b, [
|
|
"store",
|
|
"modal",
|
|
"portal",
|
|
"preserveTabOrder",
|
|
"autoFocusOnShow",
|
|
"wrapperProps",
|
|
"fixed",
|
|
"flip",
|
|
"shift",
|
|
"slide",
|
|
"overlap",
|
|
"sameWidth",
|
|
"fitViewport",
|
|
"gutter",
|
|
"arrowPadding",
|
|
"overflowPadding",
|
|
"getAnchorRect",
|
|
"updatePosition"
|
|
]);
|
|
const context = (0,_54MGSIOI/* usePopoverProviderContext */.zG)();
|
|
store = store || context;
|
|
(0,PBFD2E7P/* invariant */.V1)(
|
|
store,
|
|
false && 0
|
|
);
|
|
const arrowElement = store.useState("arrowElement");
|
|
const anchorElement = store.useState("anchorElement");
|
|
const disclosureElement = store.useState("disclosureElement");
|
|
const popoverElement = store.useState("popoverElement");
|
|
const contentElement = store.useState("contentElement");
|
|
const placement = store.useState("placement");
|
|
const mounted = store.useState("mounted");
|
|
const rendered = store.useState("rendered");
|
|
const defaultArrowElementRef = (0,react.useRef)(null);
|
|
const [positioned, setPositioned] = (0,react.useState)(false);
|
|
const { portalRef, domReady } = (0,Z32BISHQ/* usePortalRef */.TE)(portal, props.portalRef);
|
|
const getAnchorRectProp = (0,Z32BISHQ/* useEvent */._q)(getAnchorRect);
|
|
const updatePositionProp = (0,Z32BISHQ/* useEvent */._q)(updatePosition);
|
|
const hasCustomUpdatePosition = !!updatePosition;
|
|
(0,Z32BISHQ/* useSafeLayoutEffect */.UQ)(() => {
|
|
if (!(popoverElement == null ? void 0 : popoverElement.isConnected)) return;
|
|
popoverElement.style.setProperty(
|
|
"--popover-overflow-padding",
|
|
`${overflowPadding}px`
|
|
);
|
|
const anchor = getAnchorElement(anchorElement, getAnchorRectProp);
|
|
const updatePosition2 = async () => {
|
|
if (!mounted) return;
|
|
if (!arrowElement) {
|
|
defaultArrowElementRef.current = defaultArrowElementRef.current || document.createElement("div");
|
|
}
|
|
const arrow2 = arrowElement || defaultArrowElementRef.current;
|
|
const middleware = [
|
|
getOffsetMiddleware(arrow2, { gutter, shift: shift2 }),
|
|
getFlipMiddleware({ flip: flip2, overflowPadding }),
|
|
getShiftMiddleware({ slide, shift: shift2, overlap, overflowPadding }),
|
|
getArrowMiddleware(arrow2, { arrowPadding }),
|
|
getSizeMiddleware({
|
|
sameWidth,
|
|
fitViewport,
|
|
overflowPadding
|
|
})
|
|
];
|
|
const pos = await (0,floating_ui_dom/* computePosition */.rD)(anchor, popoverElement, {
|
|
placement,
|
|
strategy: fixed ? "fixed" : "absolute",
|
|
middleware
|
|
});
|
|
store == null ? void 0 : store.setState("currentPlacement", pos.placement);
|
|
setPositioned(true);
|
|
const x = roundByDPR(pos.x);
|
|
const y = roundByDPR(pos.y);
|
|
Object.assign(popoverElement.style, {
|
|
top: "0",
|
|
left: "0",
|
|
transform: `translate3d(${x}px,${y}px,0)`
|
|
});
|
|
if (arrow2 && pos.middlewareData.arrow) {
|
|
const { x: arrowX, y: arrowY } = pos.middlewareData.arrow;
|
|
const side = pos.placement.split("-")[0];
|
|
const centerX = arrow2.clientWidth / 2;
|
|
const centerY = arrow2.clientHeight / 2;
|
|
const originX = arrowX != null ? arrowX + centerX : -centerX;
|
|
const originY = arrowY != null ? arrowY + centerY : -centerY;
|
|
popoverElement.style.setProperty(
|
|
"--popover-transform-origin",
|
|
{
|
|
top: `${originX}px calc(100% + ${centerY}px)`,
|
|
bottom: `${originX}px ${-centerY}px`,
|
|
left: `calc(100% + ${centerX}px) ${originY}px`,
|
|
right: `${-centerX}px ${originY}px`
|
|
}[side]
|
|
);
|
|
Object.assign(arrow2.style, {
|
|
left: arrowX != null ? `${arrowX}px` : "",
|
|
top: arrowY != null ? `${arrowY}px` : "",
|
|
[side]: "100%"
|
|
});
|
|
}
|
|
};
|
|
const update = async () => {
|
|
if (hasCustomUpdatePosition) {
|
|
await updatePositionProp({ updatePosition: updatePosition2 });
|
|
setPositioned(true);
|
|
} else {
|
|
await updatePosition2();
|
|
}
|
|
};
|
|
const cancelAutoUpdate = (0,floating_ui_dom/* autoUpdate */.ll)(anchor, popoverElement, update, {
|
|
// JSDOM doesn't support ResizeObserver
|
|
elementResize: typeof ResizeObserver === "function"
|
|
});
|
|
return () => {
|
|
setPositioned(false);
|
|
cancelAutoUpdate();
|
|
};
|
|
}, [
|
|
store,
|
|
rendered,
|
|
popoverElement,
|
|
arrowElement,
|
|
anchorElement,
|
|
popoverElement,
|
|
placement,
|
|
mounted,
|
|
domReady,
|
|
fixed,
|
|
flip2,
|
|
shift2,
|
|
slide,
|
|
overlap,
|
|
sameWidth,
|
|
fitViewport,
|
|
gutter,
|
|
arrowPadding,
|
|
overflowPadding,
|
|
getAnchorRectProp,
|
|
hasCustomUpdatePosition,
|
|
updatePositionProp
|
|
]);
|
|
(0,Z32BISHQ/* useSafeLayoutEffect */.UQ)(() => {
|
|
if (!mounted) return;
|
|
if (!domReady) return;
|
|
if (!(popoverElement == null ? void 0 : popoverElement.isConnected)) return;
|
|
if (!(contentElement == null ? void 0 : contentElement.isConnected)) return;
|
|
const applyZIndex = () => {
|
|
popoverElement.style.zIndex = getComputedStyle(contentElement).zIndex;
|
|
};
|
|
applyZIndex();
|
|
let raf = requestAnimationFrame(() => {
|
|
raf = requestAnimationFrame(applyZIndex);
|
|
});
|
|
return () => cancelAnimationFrame(raf);
|
|
}, [mounted, domReady, popoverElement, contentElement]);
|
|
const position = fixed ? "fixed" : "absolute";
|
|
props = (0,Z32BISHQ/* useWrapElement */.w7)(
|
|
props,
|
|
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(
|
|
"div",
|
|
(0,_3YLGPPWQ/* __spreadProps */.ko)((0,_3YLGPPWQ/* __spreadValues */.IA)({}, wrapperProps), {
|
|
style: (0,_3YLGPPWQ/* __spreadValues */.IA)({
|
|
// https://floating-ui.com/docs/computeposition#initial-layout
|
|
position,
|
|
top: 0,
|
|
left: 0,
|
|
width: "max-content"
|
|
}, wrapperProps == null ? void 0 : wrapperProps.style),
|
|
ref: store == null ? void 0 : store.setPopoverElement,
|
|
children: element
|
|
})
|
|
),
|
|
[store, position, wrapperProps]
|
|
);
|
|
props = (0,Z32BISHQ/* useWrapElement */.w7)(
|
|
props,
|
|
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(_54MGSIOI/* PopoverScopedContextProvider */.s1, { value: store, children: element }),
|
|
[store]
|
|
);
|
|
props = (0,_3YLGPPWQ/* __spreadProps */.ko)((0,_3YLGPPWQ/* __spreadValues */.IA)({
|
|
// data-placing is not part of the public API. We're setting this here so
|
|
// we can wait for the popover to be positioned before other components
|
|
// move focus into it. For example, this attribute is observed by the
|
|
// Combobox component with the autoSelect behavior.
|
|
"data-placing": !positioned || void 0
|
|
}, props), {
|
|
style: (0,_3YLGPPWQ/* __spreadValues */.IA)({
|
|
position: "relative"
|
|
}, props.style)
|
|
});
|
|
props = (0,TT2355LN/* useDialog */.sp)((0,_3YLGPPWQ/* __spreadProps */.ko)((0,_3YLGPPWQ/* __spreadValues */.IA)({
|
|
store,
|
|
modal,
|
|
portal,
|
|
preserveTabOrder,
|
|
preserveTabOrderAnchor: disclosureElement || anchorElement,
|
|
autoFocusOnShow: positioned && autoFocusOnShow
|
|
}, props), {
|
|
portalRef
|
|
}));
|
|
return props;
|
|
}
|
|
);
|
|
var Popover = (0,TT2355LN/* createDialogComponent */.AV)(
|
|
(0,HKOOKEDE/* forwardRef */.Rf)(function Popover2(props) {
|
|
const htmlProps = usePopover(props);
|
|
return (0,HKOOKEDE/* createElement */.n)(TagName, htmlProps);
|
|
}),
|
|
_54MGSIOI/* usePopoverProviderContext */.zG
|
|
);
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/CTQR3VDU.js
|
|
var CTQR3VDU = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/CTQR3VDU.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/HWOIWM4O.js
|
|
var HWOIWM4O = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/HWOIWM4O.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/utils/events.js
|
|
var events = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/utils/events.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/utils/focus.js
|
|
var utils_focus = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/utils/focus.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/EQQLU3CG.js
|
|
var EQQLU3CG = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/EQQLU3CG.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HQFKUKP3.js
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// src/hovercard/hovercard.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var HQFKUKP3_TagName = "div";
|
|
function isMovingOnHovercard(target, card, anchor, nested) {
|
|
if ((0,utils_focus/* hasFocusWithin */.oW)(card)) return true;
|
|
if (!target) return false;
|
|
if ((0,HWOIWM4O/* contains */.gR)(card, target)) return true;
|
|
if (anchor && (0,HWOIWM4O/* contains */.gR)(anchor, target)) return true;
|
|
if (nested == null ? void 0 : nested.some((card2) => isMovingOnHovercard(target, card2, anchor))) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
function useAutoFocusOnHide(_a) {
|
|
var _b = _a, {
|
|
store
|
|
} = _b, props = (0,_3YLGPPWQ/* __objRest */.YG)(_b, [
|
|
"store"
|
|
]);
|
|
const [autoFocusOnHide, setAutoFocusOnHide] = (0,react.useState)(false);
|
|
const mounted = store.useState("mounted");
|
|
(0,react.useEffect)(() => {
|
|
if (!mounted) {
|
|
setAutoFocusOnHide(false);
|
|
}
|
|
}, [mounted]);
|
|
const onFocusProp = props.onFocus;
|
|
const onFocus = (0,Z32BISHQ/* useEvent */._q)((event) => {
|
|
onFocusProp == null ? void 0 : onFocusProp(event);
|
|
if (event.defaultPrevented) return;
|
|
setAutoFocusOnHide(true);
|
|
});
|
|
const finalFocusRef = (0,react.useRef)(null);
|
|
(0,react.useEffect)(() => {
|
|
return (0,EQQLU3CG/* sync */.OH)(store, ["anchorElement"], (state) => {
|
|
finalFocusRef.current = state.anchorElement;
|
|
});
|
|
}, []);
|
|
props = (0,_3YLGPPWQ/* __spreadProps */.ko)((0,_3YLGPPWQ/* __spreadValues */.IA)({
|
|
autoFocusOnHide,
|
|
finalFocus: finalFocusRef
|
|
}, props), {
|
|
onFocus
|
|
});
|
|
return props;
|
|
}
|
|
var NestedHovercardContext = (0,react.createContext)(null);
|
|
var useHovercard = (0,HKOOKEDE/* createHook */.ab)(
|
|
function useHovercard2(_a) {
|
|
var _b = _a, {
|
|
store,
|
|
modal = false,
|
|
portal = !!modal,
|
|
hideOnEscape = true,
|
|
hideOnHoverOutside = true,
|
|
disablePointerEventsOnApproach = !!hideOnHoverOutside
|
|
} = _b, props = (0,_3YLGPPWQ/* __objRest */.YG)(_b, [
|
|
"store",
|
|
"modal",
|
|
"portal",
|
|
"hideOnEscape",
|
|
"hideOnHoverOutside",
|
|
"disablePointerEventsOnApproach"
|
|
]);
|
|
const context = (0,CTQR3VDU/* useHovercardProviderContext */.Kw)();
|
|
store = store || context;
|
|
(0,PBFD2E7P/* invariant */.V1)(
|
|
store,
|
|
false && 0
|
|
);
|
|
const ref = (0,react.useRef)(null);
|
|
const [nestedHovercards, setNestedHovercards] = (0,react.useState)([]);
|
|
const hideTimeoutRef = (0,react.useRef)(0);
|
|
const enterPointRef = (0,react.useRef)(null);
|
|
const { portalRef, domReady } = (0,Z32BISHQ/* usePortalRef */.TE)(portal, props.portalRef);
|
|
const isMouseMoving = (0,Z32BISHQ/* useIsMouseMoving */.P$)();
|
|
const mayHideOnHoverOutside = !!hideOnHoverOutside;
|
|
const hideOnHoverOutsideProp = (0,Z32BISHQ/* useBooleanEvent */.O4)(hideOnHoverOutside);
|
|
const mayDisablePointerEvents = !!disablePointerEventsOnApproach;
|
|
const disablePointerEventsProp = (0,Z32BISHQ/* useBooleanEvent */.O4)(
|
|
disablePointerEventsOnApproach
|
|
);
|
|
const open = store.useState("open");
|
|
const mounted = store.useState("mounted");
|
|
(0,react.useEffect)(() => {
|
|
if (!domReady) return;
|
|
if (!mounted) return;
|
|
if (!mayHideOnHoverOutside && !mayDisablePointerEvents) return;
|
|
const element = ref.current;
|
|
if (!element) return;
|
|
const onMouseMove = (event) => {
|
|
if (!store) return;
|
|
if (!isMouseMoving()) return;
|
|
const { anchorElement, hideTimeout, timeout } = store.getState();
|
|
const enterPoint = enterPointRef.current;
|
|
const [target] = event.composedPath();
|
|
const anchor = anchorElement;
|
|
if (isMovingOnHovercard(target, element, anchor, nestedHovercards)) {
|
|
enterPointRef.current = target && anchor && (0,HWOIWM4O/* contains */.gR)(anchor, target) ? getEventPoint(event) : null;
|
|
window.clearTimeout(hideTimeoutRef.current);
|
|
hideTimeoutRef.current = 0;
|
|
return;
|
|
}
|
|
if (hideTimeoutRef.current) return;
|
|
if (enterPoint) {
|
|
const currentPoint = getEventPoint(event);
|
|
const polygon = getElementPolygon(element, enterPoint);
|
|
if (isPointInPolygon(currentPoint, polygon)) {
|
|
enterPointRef.current = currentPoint;
|
|
if (!disablePointerEventsProp(event)) return;
|
|
event.preventDefault();
|
|
event.stopPropagation();
|
|
return;
|
|
}
|
|
}
|
|
if (!hideOnHoverOutsideProp(event)) return;
|
|
hideTimeoutRef.current = window.setTimeout(() => {
|
|
hideTimeoutRef.current = 0;
|
|
store == null ? void 0 : store.hide();
|
|
}, hideTimeout != null ? hideTimeout : timeout);
|
|
};
|
|
return (0,PBFD2E7P/* chain */.cy)(
|
|
(0,events/* addGlobalEventListener */.dg)("mousemove", onMouseMove, true),
|
|
() => clearTimeout(hideTimeoutRef.current)
|
|
);
|
|
}, [
|
|
store,
|
|
isMouseMoving,
|
|
domReady,
|
|
mounted,
|
|
mayHideOnHoverOutside,
|
|
mayDisablePointerEvents,
|
|
nestedHovercards,
|
|
disablePointerEventsProp,
|
|
hideOnHoverOutsideProp
|
|
]);
|
|
(0,react.useEffect)(() => {
|
|
if (!domReady) return;
|
|
if (!mounted) return;
|
|
if (!mayDisablePointerEvents) return;
|
|
const disableEvent = (event) => {
|
|
const element = ref.current;
|
|
if (!element) return;
|
|
const enterPoint = enterPointRef.current;
|
|
if (!enterPoint) return;
|
|
const polygon = getElementPolygon(element, enterPoint);
|
|
if (isPointInPolygon(getEventPoint(event), polygon)) {
|
|
if (!disablePointerEventsProp(event)) return;
|
|
event.preventDefault();
|
|
event.stopPropagation();
|
|
}
|
|
};
|
|
return (0,PBFD2E7P/* chain */.cy)(
|
|
// Note: we may need to add pointer events here in the future.
|
|
(0,events/* addGlobalEventListener */.dg)("mouseenter", disableEvent, true),
|
|
(0,events/* addGlobalEventListener */.dg)("mouseover", disableEvent, true),
|
|
(0,events/* addGlobalEventListener */.dg)("mouseout", disableEvent, true),
|
|
(0,events/* addGlobalEventListener */.dg)("mouseleave", disableEvent, true)
|
|
);
|
|
}, [domReady, mounted, mayDisablePointerEvents, disablePointerEventsProp]);
|
|
(0,react.useEffect)(() => {
|
|
if (!domReady) return;
|
|
if (open) return;
|
|
store == null ? void 0 : store.setAutoFocusOnShow(false);
|
|
}, [store, domReady, open]);
|
|
const openRef = (0,Z32BISHQ/* useLiveRef */.hX)(open);
|
|
(0,react.useEffect)(() => {
|
|
if (!domReady) return;
|
|
return () => {
|
|
if (!openRef.current) {
|
|
store == null ? void 0 : store.setAutoFocusOnShow(false);
|
|
}
|
|
};
|
|
}, [store, domReady]);
|
|
const registerOnParent = (0,react.useContext)(NestedHovercardContext);
|
|
(0,Z32BISHQ/* useSafeLayoutEffect */.UQ)(() => {
|
|
if (modal) return;
|
|
if (!portal) return;
|
|
if (!mounted) return;
|
|
if (!domReady) return;
|
|
const element = ref.current;
|
|
if (!element) return;
|
|
return registerOnParent == null ? void 0 : registerOnParent(element);
|
|
}, [modal, portal, mounted, domReady]);
|
|
const registerNestedHovercard = (0,react.useCallback)(
|
|
(element) => {
|
|
setNestedHovercards((prevElements) => [...prevElements, element]);
|
|
const parentUnregister = registerOnParent == null ? void 0 : registerOnParent(element);
|
|
return () => {
|
|
setNestedHovercards(
|
|
(prevElements) => prevElements.filter((item) => item !== element)
|
|
);
|
|
parentUnregister == null ? void 0 : parentUnregister();
|
|
};
|
|
},
|
|
[registerOnParent]
|
|
);
|
|
props = (0,Z32BISHQ/* useWrapElement */.w7)(
|
|
props,
|
|
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(CTQR3VDU/* HovercardScopedContextProvider */.n0, { value: store, children: /* @__PURE__ */ (0,jsx_runtime.jsx)(NestedHovercardContext.Provider, { value: registerNestedHovercard, children: element }) }),
|
|
[store, registerNestedHovercard]
|
|
);
|
|
props = (0,_3YLGPPWQ/* __spreadProps */.ko)((0,_3YLGPPWQ/* __spreadValues */.IA)({}, props), {
|
|
ref: (0,Z32BISHQ/* useMergeRefs */.SV)(ref, props.ref)
|
|
});
|
|
props = useAutoFocusOnHide((0,_3YLGPPWQ/* __spreadValues */.IA)({ store }, props));
|
|
const autoFocusOnShow = store.useState(
|
|
(state) => modal || state.autoFocusOnShow
|
|
);
|
|
props = usePopover((0,_3YLGPPWQ/* __spreadProps */.ko)((0,_3YLGPPWQ/* __spreadValues */.IA)({
|
|
store,
|
|
modal,
|
|
portal,
|
|
autoFocusOnShow
|
|
}, props), {
|
|
portalRef,
|
|
hideOnEscape(event) {
|
|
if ((0,PBFD2E7P/* isFalsyBooleanCallback */.zO)(hideOnEscape, event)) return false;
|
|
requestAnimationFrame(() => {
|
|
requestAnimationFrame(() => {
|
|
store == null ? void 0 : store.hide();
|
|
});
|
|
});
|
|
return true;
|
|
}
|
|
}));
|
|
return props;
|
|
}
|
|
);
|
|
var Hovercard = (0,TT2355LN/* createDialogComponent */.AV)(
|
|
(0,HKOOKEDE/* forwardRef */.Rf)(function Hovercard2(props) {
|
|
const htmlProps = useHovercard(props);
|
|
return (0,HKOOKEDE/* createElement */.n)(HQFKUKP3_TagName, htmlProps);
|
|
}),
|
|
CTQR3VDU/* useHovercardProviderContext */.Kw
|
|
);
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/K7FXVWIT.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ s: () => (/* binding */ Radio),
|
|
/* harmony export */ z: () => (/* binding */ useRadio)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _SOKV3TSX_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/SOKV3TSX.js");
|
|
/* harmony import */ var _3CCTMYB6_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/3CCTMYB6.js");
|
|
/* harmony import */ var _HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HKOOKEDE.js");
|
|
/* harmony import */ var _2GXGCHW6_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/2GXGCHW6.js");
|
|
/* harmony import */ var _Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/Z32BISHQ.js");
|
|
/* harmony import */ var _3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js");
|
|
/* harmony import */ var _ariakit_core_utils_misc__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// src/radio/radio.tsx
|
|
|
|
|
|
var TagName = "input";
|
|
function getIsChecked(value, storeValue) {
|
|
if (storeValue === void 0) return;
|
|
if (value != null && storeValue != null) {
|
|
return storeValue === value;
|
|
}
|
|
return !!storeValue;
|
|
}
|
|
function isNativeRadio(tagName, type) {
|
|
return tagName === "input" && (!type || type === "radio");
|
|
}
|
|
var useRadio = (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_1__/* .createHook */ .ab)(function useRadio2(_a) {
|
|
var _b = _a, {
|
|
store,
|
|
name,
|
|
value,
|
|
checked
|
|
} = _b, props = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__/* .__objRest */ .YG)(_b, [
|
|
"store",
|
|
"name",
|
|
"value",
|
|
"checked"
|
|
]);
|
|
const context = (0,_SOKV3TSX_js__WEBPACK_IMPORTED_MODULE_3__/* .useRadioContext */ .c4)();
|
|
store = store || context;
|
|
const id = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_4__/* .useId */ .Bi)(props.id);
|
|
const ref = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
const isChecked = (0,_2GXGCHW6_js__WEBPACK_IMPORTED_MODULE_5__/* .useStoreState */ .O$)(
|
|
store,
|
|
(state) => checked != null ? checked : getIsChecked(value, state == null ? void 0 : state.value)
|
|
);
|
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
if (!id) return;
|
|
if (!isChecked) return;
|
|
const isActiveItem = (store == null ? void 0 : store.getState().activeId) === id;
|
|
if (isActiveItem) return;
|
|
store == null ? void 0 : store.setActiveId(id);
|
|
}, [store, isChecked, id]);
|
|
const onChangeProp = props.onChange;
|
|
const tagName = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_4__/* .useTagName */ .vO)(ref, TagName);
|
|
const nativeRadio = isNativeRadio(tagName, props.type);
|
|
const disabled = (0,_ariakit_core_utils_misc__WEBPACK_IMPORTED_MODULE_6__/* .disabledFromProps */ .$f)(props);
|
|
const [propertyUpdated, schedulePropertyUpdate] = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_4__/* .useForceUpdate */ .CH)();
|
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
const element = ref.current;
|
|
if (!element) return;
|
|
if (nativeRadio) return;
|
|
if (isChecked !== void 0) {
|
|
element.checked = isChecked;
|
|
}
|
|
if (name !== void 0) {
|
|
element.name = name;
|
|
}
|
|
if (value !== void 0) {
|
|
element.value = `${value}`;
|
|
}
|
|
}, [propertyUpdated, nativeRadio, isChecked, name, value]);
|
|
const onChange = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_4__/* .useEvent */ ._q)((event) => {
|
|
if (disabled) {
|
|
event.preventDefault();
|
|
event.stopPropagation();
|
|
return;
|
|
}
|
|
if (!nativeRadio) {
|
|
event.currentTarget.checked = true;
|
|
schedulePropertyUpdate();
|
|
}
|
|
onChangeProp == null ? void 0 : onChangeProp(event);
|
|
if (event.defaultPrevented) return;
|
|
store == null ? void 0 : store.setValue(value);
|
|
});
|
|
const onClickProp = props.onClick;
|
|
const onClick = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_4__/* .useEvent */ ._q)((event) => {
|
|
onClickProp == null ? void 0 : onClickProp(event);
|
|
if (event.defaultPrevented) return;
|
|
if (nativeRadio) return;
|
|
onChange(event);
|
|
});
|
|
const onFocusProp = props.onFocus;
|
|
const onFocus = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_4__/* .useEvent */ ._q)((event) => {
|
|
onFocusProp == null ? void 0 : onFocusProp(event);
|
|
if (event.defaultPrevented) return;
|
|
if (!nativeRadio) return;
|
|
if (!store) return;
|
|
const { moves, activeId } = store.getState();
|
|
if (!moves) return;
|
|
if (id && activeId !== id) return;
|
|
onChange(event);
|
|
});
|
|
props = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__/* .__spreadValues */ .IA)({
|
|
id,
|
|
role: !nativeRadio ? "radio" : void 0,
|
|
type: nativeRadio ? "radio" : void 0,
|
|
"aria-checked": isChecked
|
|
}, props), {
|
|
ref: (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_4__/* .useMergeRefs */ .SV)(ref, props.ref),
|
|
onChange,
|
|
onClick,
|
|
onFocus
|
|
});
|
|
props = (0,_3CCTMYB6_js__WEBPACK_IMPORTED_MODULE_7__/* .useCompositeItem */ .k)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__/* .__spreadValues */ .IA)({
|
|
store,
|
|
clickOnEnter: !nativeRadio
|
|
}, props));
|
|
return (0,_ariakit_core_utils_misc__WEBPACK_IMPORTED_MODULE_6__/* .removeUndefinedValues */ .HR)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__/* .__spreadValues */ .IA)({
|
|
name: nativeRadio ? name : void 0,
|
|
value: nativeRadio ? value : void 0,
|
|
checked: isChecked
|
|
}, props));
|
|
});
|
|
var Radio = (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_1__/* .memo */ .ph)(
|
|
(0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_1__/* .forwardRef */ .Rf)(function Radio2(props) {
|
|
const htmlProps = useRadio(props);
|
|
return (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_1__/* .createElement */ .n)(TagName, htmlProps);
|
|
})
|
|
);
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/KGK2TTFO.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ E: () => (/* binding */ useDisclosureStore),
|
|
/* harmony export */ W: () => (/* binding */ useDisclosureStoreProps)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _2GXGCHW6_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/2GXGCHW6.js");
|
|
/* harmony import */ var _Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/Z32BISHQ.js");
|
|
/* harmony import */ var _ariakit_core_disclosure_disclosure_store__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/6E4KKOSB.js");
|
|
"use client";
|
|
|
|
|
|
|
|
// src/disclosure/disclosure-store.ts
|
|
|
|
function useDisclosureStoreProps(store, update, props) {
|
|
(0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_0__/* .useUpdateEffect */ .w5)(update, [props.store, props.disclosure]);
|
|
(0,_2GXGCHW6_js__WEBPACK_IMPORTED_MODULE_1__/* .useStoreProps */ .Tz)(store, props, "open", "setOpen");
|
|
(0,_2GXGCHW6_js__WEBPACK_IMPORTED_MODULE_1__/* .useStoreProps */ .Tz)(store, props, "mounted", "setMounted");
|
|
(0,_2GXGCHW6_js__WEBPACK_IMPORTED_MODULE_1__/* .useStoreProps */ .Tz)(store, props, "animated");
|
|
return Object.assign(store, { disclosure: props.disclosure });
|
|
}
|
|
function useDisclosureStore(props = {}) {
|
|
const [store, update] = (0,_2GXGCHW6_js__WEBPACK_IMPORTED_MODULE_1__/* .useStore */ .Pj)(_ariakit_core_disclosure_disclosure_store__WEBPACK_IMPORTED_MODULE_2__/* .createDisclosureStore */ .h, props);
|
|
return useDisclosureStoreProps(store, update, props);
|
|
}
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/NAXN2XAB.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ D: () => (/* binding */ useCommand)
|
|
/* harmony export */ });
|
|
/* unused harmony export Command */
|
|
/* harmony import */ var _HGZKAGPL_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HGZKAGPL.js");
|
|
/* harmony import */ var _HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HKOOKEDE.js");
|
|
/* harmony import */ var _Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/Z32BISHQ.js");
|
|
/* harmony import */ var _3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js");
|
|
/* harmony import */ var _ariakit_core_utils_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/HWOIWM4O.js");
|
|
/* harmony import */ var _ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/utils/events.js");
|
|
/* harmony import */ var _ariakit_core_utils_misc__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js");
|
|
/* harmony import */ var _ariakit_core_utils_platform__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/US4USQPI.js");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
// src/command/command.tsx
|
|
|
|
|
|
|
|
|
|
|
|
var TagName = "button";
|
|
function isNativeClick(event) {
|
|
if (!event.isTrusted) return false;
|
|
const element = event.currentTarget;
|
|
if (event.key === "Enter") {
|
|
return (0,_ariakit_core_utils_dom__WEBPACK_IMPORTED_MODULE_1__/* .isButton */ .Bm)(element) || element.tagName === "SUMMARY" || element.tagName === "A";
|
|
}
|
|
if (event.key === " ") {
|
|
return (0,_ariakit_core_utils_dom__WEBPACK_IMPORTED_MODULE_1__/* .isButton */ .Bm)(element) || element.tagName === "SUMMARY" || element.tagName === "INPUT" || element.tagName === "SELECT";
|
|
}
|
|
return false;
|
|
}
|
|
var symbol = Symbol("command");
|
|
var useCommand = (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_2__/* .createHook */ .ab)(
|
|
function useCommand2(_a) {
|
|
var _b = _a, { clickOnEnter = true, clickOnSpace = true } = _b, props = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_3__/* .__objRest */ .YG)(_b, ["clickOnEnter", "clickOnSpace"]);
|
|
const ref = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
const tagName = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_4__/* .useTagName */ .vO)(ref);
|
|
const type = props.type;
|
|
const [isNativeButton, setIsNativeButton] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(
|
|
() => !!tagName && (0,_ariakit_core_utils_dom__WEBPACK_IMPORTED_MODULE_1__/* .isButton */ .Bm)({ tagName, type })
|
|
);
|
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
if (!ref.current) return;
|
|
setIsNativeButton((0,_ariakit_core_utils_dom__WEBPACK_IMPORTED_MODULE_1__/* .isButton */ .Bm)(ref.current));
|
|
}, []);
|
|
const [active, setActive] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
|
|
const activeRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(false);
|
|
const disabled = (0,_ariakit_core_utils_misc__WEBPACK_IMPORTED_MODULE_5__/* .disabledFromProps */ .$f)(props);
|
|
const [isDuplicate, metadataProps] = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_4__/* .useMetadataProps */ .P1)(props, symbol, true);
|
|
const onKeyDownProp = props.onKeyDown;
|
|
const onKeyDown = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_4__/* .useEvent */ ._q)((event) => {
|
|
onKeyDownProp == null ? void 0 : onKeyDownProp(event);
|
|
const element = event.currentTarget;
|
|
if (event.defaultPrevented) return;
|
|
if (isDuplicate) return;
|
|
if (disabled) return;
|
|
if (!(0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_6__/* .isSelfTarget */ .uh)(event)) return;
|
|
if ((0,_ariakit_core_utils_dom__WEBPACK_IMPORTED_MODULE_1__/* .isTextField */ .mB)(element)) return;
|
|
if (element.isContentEditable) return;
|
|
const isEnter = clickOnEnter && event.key === "Enter";
|
|
const isSpace = clickOnSpace && event.key === " ";
|
|
const shouldPreventEnter = event.key === "Enter" && !clickOnEnter;
|
|
const shouldPreventSpace = event.key === " " && !clickOnSpace;
|
|
if (shouldPreventEnter || shouldPreventSpace) {
|
|
event.preventDefault();
|
|
return;
|
|
}
|
|
if (isEnter || isSpace) {
|
|
const nativeClick = isNativeClick(event);
|
|
if (isEnter) {
|
|
if (!nativeClick) {
|
|
event.preventDefault();
|
|
const _a2 = event, { view } = _a2, eventInit = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_3__/* .__objRest */ .YG)(_a2, ["view"]);
|
|
const click = () => (0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_6__/* .fireClickEvent */ .hY)(element, eventInit);
|
|
if ((0,_ariakit_core_utils_platform__WEBPACK_IMPORTED_MODULE_7__/* .isFirefox */ .gm)()) {
|
|
(0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_6__/* .queueBeforeEvent */ .nz)(element, "keyup", click);
|
|
} else {
|
|
queueMicrotask(click);
|
|
}
|
|
}
|
|
} else if (isSpace) {
|
|
activeRef.current = true;
|
|
if (!nativeClick) {
|
|
event.preventDefault();
|
|
setActive(true);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
const onKeyUpProp = props.onKeyUp;
|
|
const onKeyUp = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_4__/* .useEvent */ ._q)((event) => {
|
|
onKeyUpProp == null ? void 0 : onKeyUpProp(event);
|
|
if (event.defaultPrevented) return;
|
|
if (isDuplicate) return;
|
|
if (disabled) return;
|
|
if (event.metaKey) return;
|
|
const isSpace = clickOnSpace && event.key === " ";
|
|
if (activeRef.current && isSpace) {
|
|
activeRef.current = false;
|
|
if (!isNativeClick(event)) {
|
|
event.preventDefault();
|
|
setActive(false);
|
|
const element = event.currentTarget;
|
|
const _a2 = event, { view } = _a2, eventInit = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_3__/* .__objRest */ .YG)(_a2, ["view"]);
|
|
queueMicrotask(() => (0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_6__/* .fireClickEvent */ .hY)(element, eventInit));
|
|
}
|
|
}
|
|
});
|
|
props = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_3__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_3__/* .__spreadValues */ .IA)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_3__/* .__spreadValues */ .IA)({
|
|
"data-active": active || void 0,
|
|
type: isNativeButton ? "button" : void 0
|
|
}, metadataProps), props), {
|
|
ref: (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_4__/* .useMergeRefs */ .SV)(ref, props.ref),
|
|
onKeyDown,
|
|
onKeyUp
|
|
});
|
|
props = (0,_HGZKAGPL_js__WEBPACK_IMPORTED_MODULE_8__/* .useFocusable */ .W)(props);
|
|
return props;
|
|
}
|
|
);
|
|
var Command = (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_2__/* .forwardRef */ .Rf)(function Command2(props) {
|
|
const htmlProps = useCommand(props);
|
|
return (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_2__/* .createElement */ .n)(TagName, htmlProps);
|
|
});
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/PLQDTVXM.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ v: () => (/* binding */ useCollectionItem)
|
|
/* harmony export */ });
|
|
/* unused harmony export CollectionItem */
|
|
/* harmony import */ var _FMYQNSCK_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/FMYQNSCK.js");
|
|
/* harmony import */ var _HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HKOOKEDE.js");
|
|
/* harmony import */ var _Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/Z32BISHQ.js");
|
|
/* harmony import */ var _3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js");
|
|
/* harmony import */ var _ariakit_core_utils_misc__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
// src/collection/collection-item.tsx
|
|
|
|
|
|
var TagName = "div";
|
|
var useCollectionItem = (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_1__/* .createHook */ .ab)(
|
|
function useCollectionItem2(_a) {
|
|
var _b = _a, {
|
|
store,
|
|
shouldRegisterItem = true,
|
|
getItem = _ariakit_core_utils_misc__WEBPACK_IMPORTED_MODULE_2__/* .identity */ .D_,
|
|
element: element
|
|
} = _b, props = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_3__/* .__objRest */ .YG)(_b, [
|
|
"store",
|
|
"shouldRegisterItem",
|
|
"getItem",
|
|
// @ts-expect-error This prop may come from a collection renderer.
|
|
"element"
|
|
]);
|
|
const context = (0,_FMYQNSCK_js__WEBPACK_IMPORTED_MODULE_4__/* .useCollectionContext */ .$I)();
|
|
store = store || context;
|
|
const id = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_5__/* .useId */ .Bi)(props.id);
|
|
const ref = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(element);
|
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
const element2 = ref.current;
|
|
if (!id) return;
|
|
if (!element2) return;
|
|
if (!shouldRegisterItem) return;
|
|
const item = getItem({ id, element: element2 });
|
|
return store == null ? void 0 : store.renderItem(item);
|
|
}, [id, shouldRegisterItem, getItem, store]);
|
|
props = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_3__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_3__/* .__spreadValues */ .IA)({}, props), {
|
|
ref: (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_5__/* .useMergeRefs */ .SV)(ref, props.ref)
|
|
});
|
|
return (0,_ariakit_core_utils_misc__WEBPACK_IMPORTED_MODULE_2__/* .removeUndefinedValues */ .HR)(props);
|
|
}
|
|
);
|
|
var CollectionItem = (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_1__/* .forwardRef */ .Rf)(function CollectionItem2(props) {
|
|
const htmlProps = useCollectionItem(props);
|
|
return (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_1__/* .createElement */ .n)(TagName, htmlProps);
|
|
});
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/QA27FYGF.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ p: () => (/* binding */ useHovercardAnchor)
|
|
/* harmony export */ });
|
|
/* unused harmony export HovercardAnchor */
|
|
/* harmony import */ var _CTQR3VDU_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/CTQR3VDU.js");
|
|
/* harmony import */ var _HGZKAGPL_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HGZKAGPL.js");
|
|
/* harmony import */ var _HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HKOOKEDE.js");
|
|
/* harmony import */ var _Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/Z32BISHQ.js");
|
|
/* harmony import */ var _3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js");
|
|
/* harmony import */ var _ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/utils/events.js");
|
|
/* harmony import */ var _ariakit_core_utils_misc__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// src/hovercard/hovercard-anchor.tsx
|
|
|
|
|
|
|
|
var TagName = "a";
|
|
var useHovercardAnchor = (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_1__/* .createHook */ .ab)(
|
|
function useHovercardAnchor2(_a) {
|
|
var _b = _a, { store, showOnHover = true } = _b, props = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__/* .__objRest */ .YG)(_b, ["store", "showOnHover"]);
|
|
const context = (0,_CTQR3VDU_js__WEBPACK_IMPORTED_MODULE_3__/* .useHovercardProviderContext */ .Kw)();
|
|
store = store || context;
|
|
(0,_ariakit_core_utils_misc__WEBPACK_IMPORTED_MODULE_4__/* .invariant */ .V1)(
|
|
store,
|
|
false && 0
|
|
);
|
|
const disabled = (0,_ariakit_core_utils_misc__WEBPACK_IMPORTED_MODULE_4__/* .disabledFromProps */ .$f)(props);
|
|
const showTimeoutRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(0);
|
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => () => window.clearTimeout(showTimeoutRef.current), []);
|
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
const onMouseLeave = (event) => {
|
|
if (!store) return;
|
|
const { anchorElement } = store.getState();
|
|
if (!anchorElement) return;
|
|
if (event.target !== anchorElement) return;
|
|
window.clearTimeout(showTimeoutRef.current);
|
|
showTimeoutRef.current = 0;
|
|
};
|
|
return (0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_5__/* .addGlobalEventListener */ .dg)("mouseleave", onMouseLeave, true);
|
|
}, [store]);
|
|
const onMouseMoveProp = props.onMouseMove;
|
|
const showOnHoverProp = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_6__/* .useBooleanEvent */ .O4)(showOnHover);
|
|
const isMouseMoving = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_6__/* .useIsMouseMoving */ .P$)();
|
|
const onMouseMove = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_6__/* .useEvent */ ._q)((event) => {
|
|
onMouseMoveProp == null ? void 0 : onMouseMoveProp(event);
|
|
if (disabled) return;
|
|
if (!store) return;
|
|
if (event.defaultPrevented) return;
|
|
if (showTimeoutRef.current) return;
|
|
if (!isMouseMoving()) return;
|
|
if (!showOnHoverProp(event)) return;
|
|
const element = event.currentTarget;
|
|
store.setAnchorElement(element);
|
|
store.setDisclosureElement(element);
|
|
const { showTimeout, timeout } = store.getState();
|
|
const showHovercard = () => {
|
|
showTimeoutRef.current = 0;
|
|
if (!isMouseMoving()) return;
|
|
store == null ? void 0 : store.setAnchorElement(element);
|
|
store == null ? void 0 : store.show();
|
|
queueMicrotask(() => {
|
|
store == null ? void 0 : store.setDisclosureElement(element);
|
|
});
|
|
};
|
|
const timeoutMs = showTimeout != null ? showTimeout : timeout;
|
|
if (timeoutMs === 0) {
|
|
showHovercard();
|
|
} else {
|
|
showTimeoutRef.current = window.setTimeout(showHovercard, timeoutMs);
|
|
}
|
|
});
|
|
const onClickProp = props.onClick;
|
|
const onClick = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_6__/* .useEvent */ ._q)((event) => {
|
|
onClickProp == null ? void 0 : onClickProp(event);
|
|
if (!store) return;
|
|
window.clearTimeout(showTimeoutRef.current);
|
|
showTimeoutRef.current = 0;
|
|
});
|
|
const ref = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(
|
|
(element) => {
|
|
if (!store) return;
|
|
const { anchorElement } = store.getState();
|
|
if (anchorElement == null ? void 0 : anchorElement.isConnected) return;
|
|
store.setAnchorElement(element);
|
|
},
|
|
[store]
|
|
);
|
|
props = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_2__/* .__spreadValues */ .IA)({}, props), {
|
|
ref: (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_6__/* .useMergeRefs */ .SV)(ref, props.ref),
|
|
onMouseMove,
|
|
onClick
|
|
});
|
|
props = (0,_HGZKAGPL_js__WEBPACK_IMPORTED_MODULE_7__/* .useFocusable */ .W)(props);
|
|
return props;
|
|
}
|
|
);
|
|
var HovercardAnchor = (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_1__/* .forwardRef */ .Rf)(function HovercardAnchor2(props) {
|
|
const htmlProps = useHovercardAnchor(props);
|
|
return (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_1__/* .createElement */ .n)(TagName, htmlProps);
|
|
});
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/QYS5FHDY.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ N: () => (/* binding */ useDialogStoreProps),
|
|
/* harmony export */ j: () => (/* binding */ useDialogStore)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _KGK2TTFO_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/KGK2TTFO.js");
|
|
/* harmony import */ var _2GXGCHW6_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/2GXGCHW6.js");
|
|
/* harmony import */ var _ariakit_core_dialog_dialog_store__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/YOHCVXJB.js");
|
|
"use client";
|
|
|
|
|
|
|
|
// src/dialog/dialog-store.ts
|
|
|
|
function useDialogStoreProps(store, update, props) {
|
|
return (0,_KGK2TTFO_js__WEBPACK_IMPORTED_MODULE_0__/* .useDisclosureStoreProps */ .W)(store, update, props);
|
|
}
|
|
function useDialogStore(props = {}) {
|
|
const [store, update] = (0,_2GXGCHW6_js__WEBPACK_IMPORTED_MODULE_1__/* .useStore */ .Pj)(_ariakit_core_dialog_dialog_store__WEBPACK_IMPORTED_MODULE_2__/* .createDialogStore */ .Y, props);
|
|
return useDialogStoreProps(store, update, props);
|
|
}
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/RGUP62TM.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ WT: () => (/* binding */ DisclosureScopedContextProvider),
|
|
/* harmony export */ sI: () => (/* binding */ DisclosureContextProvider),
|
|
/* harmony export */ vO: () => (/* binding */ useDisclosureProviderContext)
|
|
/* harmony export */ });
|
|
/* unused harmony exports useDisclosureContext, useDisclosureScopedContext */
|
|
/* harmony import */ var _HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HKOOKEDE.js");
|
|
"use client";
|
|
|
|
|
|
// src/disclosure/disclosure-context.tsx
|
|
var ctx = (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_0__/* .createStoreContext */ .B0)();
|
|
var useDisclosureContext = ctx.useContext;
|
|
var useDisclosureScopedContext = ctx.useScopedContext;
|
|
var useDisclosureProviderContext = ctx.useProviderContext;
|
|
var DisclosureContextProvider = ctx.ContextProvider;
|
|
var DisclosureScopedContextProvider = ctx.ScopedContextProvider;
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/SK3NAZA3.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ cZ: () => (/* binding */ setRef),
|
|
/* harmony export */ v1: () => (/* binding */ getRefProperty),
|
|
/* harmony export */ v6: () => (/* binding */ mergeProps)
|
|
/* harmony export */ });
|
|
/* unused harmony export isValidElementWithRef */
|
|
/* harmony import */ var _3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js");
|
|
/* harmony import */ var _ariakit_core_utils_misc__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
"use client";
|
|
|
|
|
|
// src/utils/misc.ts
|
|
|
|
|
|
function setRef(ref, value) {
|
|
if (typeof ref === "function") {
|
|
ref(value);
|
|
} else if (ref) {
|
|
ref.current = value;
|
|
}
|
|
}
|
|
function isValidElementWithRef(element) {
|
|
if (!element) return false;
|
|
if (!(0,react__WEBPACK_IMPORTED_MODULE_0__.isValidElement)(element)) return false;
|
|
if ("ref" in element.props) return true;
|
|
if ("ref" in element) return true;
|
|
return false;
|
|
}
|
|
function getRefProperty(element) {
|
|
if (!isValidElementWithRef(element)) return null;
|
|
const props = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_1__/* .__spreadValues */ .IA)({}, element.props);
|
|
return props.ref || element.ref;
|
|
}
|
|
function mergeProps(base, overrides) {
|
|
const props = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_1__/* .__spreadValues */ .IA)({}, base);
|
|
for (const key in overrides) {
|
|
if (!(0,_ariakit_core_utils_misc__WEBPACK_IMPORTED_MODULE_2__/* .hasOwnProperty */ .mQ)(overrides, key)) continue;
|
|
if (key === "className") {
|
|
const prop = "className";
|
|
props[prop] = base[prop] ? `${base[prop]} ${overrides[prop]}` : overrides[prop];
|
|
continue;
|
|
}
|
|
if (key === "style") {
|
|
const prop = "style";
|
|
props[prop] = base[prop] ? (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_1__/* .__spreadValues */ .IA)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_1__/* .__spreadValues */ .IA)({}, base[prop]), overrides[prop]) : overrides[prop];
|
|
continue;
|
|
}
|
|
const overrideValue = overrides[key];
|
|
if (typeof overrideValue === "function" && key.startsWith("on")) {
|
|
const baseValue = base[key];
|
|
if (typeof baseValue === "function") {
|
|
props[key] = (...args) => {
|
|
overrideValue(...args);
|
|
baseValue(...args);
|
|
};
|
|
continue;
|
|
}
|
|
}
|
|
props[key] = overrideValue;
|
|
}
|
|
return props;
|
|
}
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/SOKV3TSX.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ XF: () => (/* binding */ useRadioProviderContext),
|
|
/* harmony export */ aN: () => (/* binding */ RadioScopedContextProvider),
|
|
/* harmony export */ c4: () => (/* binding */ useRadioContext)
|
|
/* harmony export */ });
|
|
/* unused harmony exports useRadioScopedContext, RadioContextProvider */
|
|
/* harmony import */ var _WENSINUV_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/WENSINUV.js");
|
|
/* harmony import */ var _HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HKOOKEDE.js");
|
|
"use client";
|
|
|
|
|
|
|
|
// src/radio/radio-context.tsx
|
|
var ctx = (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_0__/* .createStoreContext */ .B0)(
|
|
[_WENSINUV_js__WEBPACK_IMPORTED_MODULE_1__/* .CompositeContextProvider */ .ws],
|
|
[_WENSINUV_js__WEBPACK_IMPORTED_MODULE_1__/* .CompositeScopedContextProvider */ .aN]
|
|
);
|
|
var useRadioContext = ctx.useContext;
|
|
var useRadioScopedContext = ctx.useScopedContext;
|
|
var useRadioProviderContext = ctx.useProviderContext;
|
|
var RadioContextProvider = ctx.ContextProvider;
|
|
var RadioScopedContextProvider = ctx.ScopedContextProvider;
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/SWN3JYXT.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ g: () => (/* binding */ FocusableContext)
|
|
/* harmony export */ });
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
"use client";
|
|
|
|
// src/focusable/focusable-context.tsx
|
|
|
|
var FocusableContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(true);
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/TT2355LN.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
AV: () => (/* binding */ createDialogComponent),
|
|
sp: () => (/* binding */ useDialog)
|
|
});
|
|
|
|
// UNUSED EXPORTS: Dialog
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/63XF7ACK.js
|
|
"use client";
|
|
|
|
// src/dialog/utils/is-backdrop.ts
|
|
function _63XF7ACK_isBackdrop(element, ...ids) {
|
|
if (!element) return false;
|
|
const backdrop = element.getAttribute("data-backdrop");
|
|
if (backdrop == null) return false;
|
|
if (backdrop === "") return true;
|
|
if (backdrop === "true") return true;
|
|
if (!ids.length) return true;
|
|
return ids.some((id) => backdrop === id);
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/K2ZF5NU7.js
|
|
"use client";
|
|
|
|
// src/dialog/utils/orchestrate.ts
|
|
var cleanups = /* @__PURE__ */ new WeakMap();
|
|
function orchestrate(element, key, setup) {
|
|
if (!cleanups.has(element)) {
|
|
cleanups.set(element, /* @__PURE__ */ new Map());
|
|
}
|
|
const elementCleanups = cleanups.get(element);
|
|
const prevCleanup = elementCleanups.get(key);
|
|
if (!prevCleanup) {
|
|
elementCleanups.set(key, setup());
|
|
return () => {
|
|
var _a;
|
|
(_a = elementCleanups.get(key)) == null ? void 0 : _a();
|
|
elementCleanups.delete(key);
|
|
};
|
|
}
|
|
const cleanup = setup();
|
|
const nextCleanup = () => {
|
|
cleanup();
|
|
prevCleanup();
|
|
elementCleanups.delete(key);
|
|
};
|
|
elementCleanups.set(key, nextCleanup);
|
|
return () => {
|
|
const isCurrent = elementCleanups.get(key) === nextCleanup;
|
|
if (!isCurrent) return;
|
|
cleanup();
|
|
elementCleanups.set(key, prevCleanup);
|
|
};
|
|
}
|
|
function setAttribute(element, attr, value) {
|
|
const setup = () => {
|
|
const previousValue = element.getAttribute(attr);
|
|
element.setAttribute(attr, value);
|
|
return () => {
|
|
if (previousValue == null) {
|
|
element.removeAttribute(attr);
|
|
} else {
|
|
element.setAttribute(attr, previousValue);
|
|
}
|
|
};
|
|
};
|
|
return orchestrate(element, attr, setup);
|
|
}
|
|
function setProperty(element, property, value) {
|
|
const setup = () => {
|
|
const exists = property in element;
|
|
const previousValue = element[property];
|
|
element[property] = value;
|
|
return () => {
|
|
if (!exists) {
|
|
delete element[property];
|
|
} else {
|
|
element[property] = previousValue;
|
|
}
|
|
};
|
|
};
|
|
return orchestrate(element, property, setup);
|
|
}
|
|
function assignStyle(element, style) {
|
|
if (!element) return () => {
|
|
};
|
|
const setup = () => {
|
|
const prevStyle = element.style.cssText;
|
|
Object.assign(element.style, style);
|
|
return () => {
|
|
element.style.cssText = prevStyle;
|
|
};
|
|
};
|
|
return orchestrate(element, "style", setup);
|
|
}
|
|
function setCSSProperty(element, property, value) {
|
|
if (!element) return () => {
|
|
};
|
|
const setup = () => {
|
|
const previousValue = element.style.getPropertyValue(property);
|
|
element.style.setProperty(property, value);
|
|
return () => {
|
|
if (previousValue) {
|
|
element.style.setProperty(property, previousValue);
|
|
} else {
|
|
element.style.removeProperty(property);
|
|
}
|
|
};
|
|
};
|
|
return orchestrate(element, property, setup);
|
|
}
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/HWOIWM4O.js
|
|
var HWOIWM4O = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/HWOIWM4O.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js
|
|
var PBFD2E7P = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/AOUGVQZ3.js
|
|
"use client";
|
|
|
|
|
|
// src/dialog/utils/walk-tree-outside.ts
|
|
|
|
|
|
var ignoreTags = ["SCRIPT", "STYLE"];
|
|
function getSnapshotPropertyName(id) {
|
|
return `__ariakit-dialog-snapshot-${id}`;
|
|
}
|
|
function inSnapshot(id, element) {
|
|
const doc = (0,HWOIWM4O/* getDocument */.YE)(element);
|
|
const propertyName = getSnapshotPropertyName(id);
|
|
if (!doc.body[propertyName]) return true;
|
|
do {
|
|
if (element === doc.body) return false;
|
|
if (element[propertyName]) return true;
|
|
if (!element.parentElement) return false;
|
|
element = element.parentElement;
|
|
} while (true);
|
|
}
|
|
function isValidElement(id, element, ignoredElements) {
|
|
if (ignoreTags.includes(element.tagName)) return false;
|
|
if (!inSnapshot(id, element)) return false;
|
|
return !ignoredElements.some(
|
|
(enabledElement) => enabledElement && (0,HWOIWM4O/* contains */.gR)(element, enabledElement)
|
|
);
|
|
}
|
|
function AOUGVQZ3_walkTreeOutside(id, elements, callback, ancestorCallback) {
|
|
for (let element of elements) {
|
|
if (!(element == null ? void 0 : element.isConnected)) continue;
|
|
const hasAncestorAlready = elements.some((maybeAncestor) => {
|
|
if (!maybeAncestor) return false;
|
|
if (maybeAncestor === element) return false;
|
|
return maybeAncestor.contains(element);
|
|
});
|
|
const doc = (0,HWOIWM4O/* getDocument */.YE)(element);
|
|
const originalElement = element;
|
|
while (element.parentElement && element !== doc.body) {
|
|
ancestorCallback == null ? void 0 : ancestorCallback(element.parentElement, originalElement);
|
|
if (!hasAncestorAlready) {
|
|
for (const child of element.parentElement.children) {
|
|
if (isValidElement(id, child, elements)) {
|
|
callback(child, originalElement);
|
|
}
|
|
}
|
|
}
|
|
element = element.parentElement;
|
|
}
|
|
}
|
|
}
|
|
function createWalkTreeSnapshot(id, elements) {
|
|
const { body } = (0,HWOIWM4O/* getDocument */.YE)(elements[0]);
|
|
const cleanups = [];
|
|
const markElement = (element) => {
|
|
cleanups.push(setProperty(element, getSnapshotPropertyName(id), true));
|
|
};
|
|
AOUGVQZ3_walkTreeOutside(id, elements, markElement);
|
|
return (0,PBFD2E7P/* chain */.cy)(setProperty(body, getSnapshotPropertyName(id), true), () => {
|
|
for (const cleanup of cleanups) {
|
|
cleanup();
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/2PGBN2Y4.js
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
// src/dialog/utils/mark-tree-outside.ts
|
|
|
|
function getPropertyName(id = "", ancestor = false) {
|
|
return `__ariakit-dialog-${ancestor ? "ancestor" : "outside"}${id ? `-${id}` : ""}`;
|
|
}
|
|
function markElement(element, id = "") {
|
|
return (0,PBFD2E7P/* chain */.cy)(
|
|
setProperty(element, getPropertyName(), true),
|
|
setProperty(element, getPropertyName(id), true)
|
|
);
|
|
}
|
|
function markAncestor(element, id = "") {
|
|
return (0,PBFD2E7P/* chain */.cy)(
|
|
setProperty(element, getPropertyName("", true), true),
|
|
setProperty(element, getPropertyName(id, true), true)
|
|
);
|
|
}
|
|
function isElementMarked(element, id) {
|
|
const ancestorProperty = getPropertyName(id, true);
|
|
if (element[ancestorProperty]) return true;
|
|
const elementProperty = getPropertyName(id);
|
|
do {
|
|
if (element[elementProperty]) return true;
|
|
if (!element.parentElement) return false;
|
|
element = element.parentElement;
|
|
} while (true);
|
|
}
|
|
function markTreeOutside(id, elements) {
|
|
const cleanups = [];
|
|
const ids = elements.map((el) => el == null ? void 0 : el.id);
|
|
AOUGVQZ3_walkTreeOutside(
|
|
id,
|
|
elements,
|
|
(element) => {
|
|
if (_63XF7ACK_isBackdrop(element, ...ids)) return;
|
|
cleanups.unshift(markElement(element, id));
|
|
},
|
|
(ancestor, element) => {
|
|
const isAnotherDialogAncestor = element.hasAttribute("data-dialog") && element.id !== id;
|
|
if (isAnotherDialogAncestor) return;
|
|
cleanups.unshift(markAncestor(ancestor, id));
|
|
}
|
|
);
|
|
const restoreAccessibilityTree = () => {
|
|
for (const cleanup of cleanups) {
|
|
cleanup();
|
|
}
|
|
};
|
|
return restoreAccessibilityTree;
|
|
}
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/BSEL4YAF.js
|
|
var BSEL4YAF = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/BSEL4YAF.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/AXRBYZQP.js
|
|
var AXRBYZQP = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/AXRBYZQP.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/KGK2TTFO.js
|
|
var KGK2TTFO = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/KGK2TTFO.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/Z32BISHQ.js
|
|
var Z32BISHQ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/Z32BISHQ.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js
|
|
var _3YLGPPWQ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js
|
|
var react = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/UQBPM777.js
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// src/dialog/dialog-backdrop.tsx
|
|
|
|
|
|
function DialogBackdrop({
|
|
store,
|
|
backdrop,
|
|
alwaysVisible,
|
|
hidden
|
|
}) {
|
|
const ref = (0,react.useRef)(null);
|
|
const disclosure = (0,KGK2TTFO/* useDisclosureStore */.E)({ disclosure: store });
|
|
const contentElement = store.useState("contentElement");
|
|
(0,Z32BISHQ/* useSafeLayoutEffect */.UQ)(() => {
|
|
const backdrop2 = ref.current;
|
|
const dialog = contentElement;
|
|
if (!backdrop2) return;
|
|
if (!dialog) return;
|
|
backdrop2.style.zIndex = getComputedStyle(dialog).zIndex;
|
|
}, [contentElement]);
|
|
(0,Z32BISHQ/* useSafeLayoutEffect */.UQ)(() => {
|
|
const id = contentElement == null ? void 0 : contentElement.id;
|
|
if (!id) return;
|
|
const backdrop2 = ref.current;
|
|
if (!backdrop2) return;
|
|
return markAncestor(backdrop2, id);
|
|
}, [contentElement]);
|
|
const props = (0,BSEL4YAF/* useDisclosureContent */.aT)({
|
|
ref,
|
|
store: disclosure,
|
|
role: "presentation",
|
|
"data-backdrop": (contentElement == null ? void 0 : contentElement.id) || "",
|
|
alwaysVisible,
|
|
hidden: hidden != null ? hidden : void 0,
|
|
style: {
|
|
position: "fixed",
|
|
top: 0,
|
|
right: 0,
|
|
bottom: 0,
|
|
left: 0
|
|
}
|
|
});
|
|
if (!backdrop) return null;
|
|
if ((0,react.isValidElement)(backdrop)) {
|
|
return /* @__PURE__ */ (0,jsx_runtime.jsx)(AXRBYZQP/* Role */.X, (0,_3YLGPPWQ/* __spreadProps */.ko)((0,_3YLGPPWQ/* __spreadValues */.IA)({}, props), { render: backdrop }));
|
|
}
|
|
const Component = typeof backdrop !== "boolean" ? backdrop : "div";
|
|
return /* @__PURE__ */ (0,jsx_runtime.jsx)(AXRBYZQP/* Role */.X, (0,_3YLGPPWQ/* __spreadProps */.ko)((0,_3YLGPPWQ/* __spreadValues */.IA)({}, props), { render: /* @__PURE__ */ (0,jsx_runtime.jsx)(Component, {}) }));
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/ESSM74HH.js
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
// src/dialog/utils/disable-accessibility-tree-outside.ts
|
|
function hideElementFromAccessibilityTree(element) {
|
|
return setAttribute(element, "aria-hidden", "true");
|
|
}
|
|
function disableAccessibilityTreeOutside(id, elements) {
|
|
const cleanups = [];
|
|
const ids = elements.map((el) => el == null ? void 0 : el.id);
|
|
walkTreeOutside(id, elements, (element) => {
|
|
if (isBackdrop(element, ...ids)) return;
|
|
cleanups.unshift(hideElementFromAccessibilityTree(element));
|
|
});
|
|
const restoreAccessibilityTree = () => {
|
|
for (const cleanup of cleanups) {
|
|
cleanup();
|
|
}
|
|
};
|
|
return restoreAccessibilityTree;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/677M2CI3.js
|
|
"use client";
|
|
|
|
// src/dialog/utils/supports-inert.ts
|
|
function supportsInert() {
|
|
return "inert" in HTMLElement.prototype;
|
|
}
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/utils/focus.js
|
|
var utils_focus = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/utils/focus.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/NSFBIL2Z.js
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// src/dialog/utils/disable-tree.ts
|
|
|
|
|
|
|
|
function disableTree(element, ignoredElements) {
|
|
if (!("style" in element)) return PBFD2E7P/* noop */.lQ;
|
|
if (supportsInert()) {
|
|
return setProperty(element, "inert", true);
|
|
}
|
|
const tabbableElements = (0,utils_focus/* getAllTabbableIn */.a9)(element, true);
|
|
const enableElements = tabbableElements.map((element2) => {
|
|
if (ignoredElements == null ? void 0 : ignoredElements.some((el) => el && (0,HWOIWM4O/* contains */.gR)(el, element2))) return PBFD2E7P/* noop */.lQ;
|
|
const restoreFocusMethod = orchestrate(element2, "focus", () => {
|
|
element2.focus = PBFD2E7P/* noop */.lQ;
|
|
return () => {
|
|
delete element2.focus;
|
|
};
|
|
});
|
|
return (0,PBFD2E7P/* chain */.cy)(setAttribute(element2, "tabindex", "-1"), restoreFocusMethod);
|
|
});
|
|
return (0,PBFD2E7P/* chain */.cy)(
|
|
...enableElements,
|
|
hideElementFromAccessibilityTree(element),
|
|
assignStyle(element, {
|
|
pointerEvents: "none",
|
|
userSelect: "none",
|
|
cursor: "default"
|
|
})
|
|
);
|
|
}
|
|
function disableTreeOutside(id, elements) {
|
|
const cleanups = [];
|
|
const ids = elements.map((el) => el == null ? void 0 : el.id);
|
|
AOUGVQZ3_walkTreeOutside(
|
|
id,
|
|
elements,
|
|
(element) => {
|
|
if (_63XF7ACK_isBackdrop(element, ...ids)) return;
|
|
cleanups.unshift(disableTree(element, elements));
|
|
},
|
|
(element) => {
|
|
if (!element.hasAttribute("role")) return;
|
|
if (elements.some((el) => el && (0,HWOIWM4O/* contains */.gR)(el, element))) return;
|
|
cleanups.unshift(setAttribute(element, "role", "none"));
|
|
}
|
|
);
|
|
const restoreTreeOutside = () => {
|
|
for (const cleanup of cleanups) {
|
|
cleanup();
|
|
}
|
|
};
|
|
return restoreTreeOutside;
|
|
}
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/index.js
|
|
var react_dom = __webpack_require__("../../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/index.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/YJS26JVG.js
|
|
"use client";
|
|
|
|
|
|
// src/dialog/utils/use-root-dialog.ts
|
|
|
|
|
|
|
|
function useRootDialog({
|
|
attribute,
|
|
contentId,
|
|
contentElement,
|
|
enabled
|
|
}) {
|
|
const [updated, retry] = (0,Z32BISHQ/* useForceUpdate */.CH)();
|
|
const isRootDialog = (0,react.useCallback)(() => {
|
|
if (!enabled) return false;
|
|
if (!contentElement) return false;
|
|
const { body } = (0,HWOIWM4O/* getDocument */.YE)(contentElement);
|
|
const id = body.getAttribute(attribute);
|
|
return !id || id === contentId;
|
|
}, [updated, enabled, contentElement, attribute, contentId]);
|
|
(0,react.useEffect)(() => {
|
|
if (!enabled) return;
|
|
if (!contentId) return;
|
|
if (!contentElement) return;
|
|
const { body } = (0,HWOIWM4O/* getDocument */.YE)(contentElement);
|
|
if (isRootDialog()) {
|
|
body.setAttribute(attribute, contentId);
|
|
return () => body.removeAttribute(attribute);
|
|
}
|
|
const observer = new MutationObserver(() => (0,react_dom.flushSync)(retry));
|
|
observer.observe(body, { attributeFilter: [attribute] });
|
|
return () => observer.disconnect();
|
|
}, [updated, enabled, contentId, contentElement, isRootDialog, attribute]);
|
|
return isRootDialog;
|
|
}
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/US4USQPI.js
|
|
var US4USQPI = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/US4USQPI.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/KB6RR6FL.js
|
|
"use client";
|
|
|
|
|
|
|
|
// src/dialog/utils/use-prevent-body-scroll.ts
|
|
|
|
|
|
|
|
|
|
function getPaddingProperty(documentElement) {
|
|
const documentLeft = documentElement.getBoundingClientRect().left;
|
|
const scrollbarX = Math.round(documentLeft) + documentElement.scrollLeft;
|
|
return scrollbarX ? "paddingLeft" : "paddingRight";
|
|
}
|
|
function usePreventBodyScroll(contentElement, contentId, enabled) {
|
|
const isRootDialog = useRootDialog({
|
|
attribute: "data-dialog-prevent-body-scroll",
|
|
contentElement,
|
|
contentId,
|
|
enabled
|
|
});
|
|
(0,react.useEffect)(() => {
|
|
if (!isRootDialog()) return;
|
|
if (!contentElement) return;
|
|
const doc = (0,HWOIWM4O/* getDocument */.YE)(contentElement);
|
|
const win = (0,HWOIWM4O/* getWindow */.zk)(contentElement);
|
|
const { documentElement, body } = doc;
|
|
const cssScrollbarWidth = documentElement.style.getPropertyValue("--scrollbar-width");
|
|
const scrollbarWidth = cssScrollbarWidth ? Number.parseInt(cssScrollbarWidth) : win.innerWidth - documentElement.clientWidth;
|
|
const setScrollbarWidthProperty = () => setCSSProperty(
|
|
documentElement,
|
|
"--scrollbar-width",
|
|
`${scrollbarWidth}px`
|
|
);
|
|
const paddingProperty = getPaddingProperty(documentElement);
|
|
const setStyle = () => assignStyle(body, {
|
|
overflow: "hidden",
|
|
[paddingProperty]: `${scrollbarWidth}px`
|
|
});
|
|
const setIOSStyle = () => {
|
|
var _a, _b;
|
|
const { scrollX, scrollY, visualViewport } = win;
|
|
const offsetLeft = (_a = visualViewport == null ? void 0 : visualViewport.offsetLeft) != null ? _a : 0;
|
|
const offsetTop = (_b = visualViewport == null ? void 0 : visualViewport.offsetTop) != null ? _b : 0;
|
|
const restoreStyle = assignStyle(body, {
|
|
position: "fixed",
|
|
overflow: "hidden",
|
|
top: `${-(scrollY - Math.floor(offsetTop))}px`,
|
|
left: `${-(scrollX - Math.floor(offsetLeft))}px`,
|
|
right: "0",
|
|
[paddingProperty]: `${scrollbarWidth}px`
|
|
});
|
|
return () => {
|
|
restoreStyle();
|
|
if (true) {
|
|
win.scrollTo({ left: scrollX, top: scrollY, behavior: "instant" });
|
|
}
|
|
};
|
|
};
|
|
const isIOS = (0,US4USQPI/* isApple */.f8)() && !(0,US4USQPI/* isMac */.cX)();
|
|
return (0,PBFD2E7P/* chain */.cy)(
|
|
setScrollbarWidthProperty(),
|
|
isIOS ? setIOSStyle() : setStyle()
|
|
);
|
|
}, [isRootDialog, contentElement]);
|
|
}
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/EQQLU3CG.js
|
|
var EQQLU3CG = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/EQQLU3CG.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/T3RMEPVH.js
|
|
"use client";
|
|
|
|
|
|
// src/dialog/utils/use-nested-dialogs.tsx
|
|
|
|
|
|
|
|
|
|
var NestedDialogsContext = (0,react.createContext)({});
|
|
function useNestedDialogs(store) {
|
|
const context = (0,react.useContext)(NestedDialogsContext);
|
|
const [dialogs, setDialogs] = (0,react.useState)([]);
|
|
const add = (0,react.useCallback)(
|
|
(dialog) => {
|
|
var _a;
|
|
setDialogs((dialogs2) => [...dialogs2, dialog]);
|
|
return (0,PBFD2E7P/* chain */.cy)((_a = context.add) == null ? void 0 : _a.call(context, dialog), () => {
|
|
setDialogs((dialogs2) => dialogs2.filter((d) => d !== dialog));
|
|
});
|
|
},
|
|
[context]
|
|
);
|
|
(0,Z32BISHQ/* useSafeLayoutEffect */.UQ)(() => {
|
|
return (0,EQQLU3CG/* sync */.OH)(store, ["open", "contentElement"], (state) => {
|
|
var _a;
|
|
if (!state.open) return;
|
|
if (!state.contentElement) return;
|
|
return (_a = context.add) == null ? void 0 : _a.call(context, store);
|
|
});
|
|
}, [store, context]);
|
|
const providerValue = (0,react.useMemo)(() => ({ store, add }), [store, add]);
|
|
const wrapElement = (0,react.useCallback)(
|
|
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(NestedDialogsContext.Provider, { value: providerValue, children: element }),
|
|
[providerValue]
|
|
);
|
|
return { wrapElement, nestedDialogs: dialogs };
|
|
}
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/utils/events.js
|
|
var events = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/utils/events.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HLTQOHKZ.js
|
|
"use client";
|
|
|
|
// src/dialog/utils/use-previous-mouse-down-ref.ts
|
|
|
|
|
|
function usePreviousMouseDownRef(enabled) {
|
|
const previousMouseDownRef = (0,react.useRef)();
|
|
(0,react.useEffect)(() => {
|
|
if (!enabled) {
|
|
previousMouseDownRef.current = null;
|
|
return;
|
|
}
|
|
const onMouseDown = (event) => {
|
|
previousMouseDownRef.current = event.target;
|
|
};
|
|
return (0,events/* addGlobalEventListener */.dg)("mousedown", onMouseDown, true);
|
|
}, [enabled]);
|
|
return previousMouseDownRef;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/43UOHFGG.js
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
// src/dialog/utils/use-hide-on-interact-outside.ts
|
|
|
|
|
|
|
|
function isInDocument(target) {
|
|
if (target.tagName === "HTML") return true;
|
|
return (0,HWOIWM4O/* contains */.gR)((0,HWOIWM4O/* getDocument */.YE)(target).body, target);
|
|
}
|
|
function isDisclosure(disclosure, target) {
|
|
if (!disclosure) return false;
|
|
if ((0,HWOIWM4O/* contains */.gR)(disclosure, target)) return true;
|
|
const activeId = target.getAttribute("aria-activedescendant");
|
|
if (activeId) {
|
|
const activeElement = (0,HWOIWM4O/* getDocument */.YE)(disclosure).getElementById(activeId);
|
|
if (activeElement) {
|
|
return (0,HWOIWM4O/* contains */.gR)(disclosure, activeElement);
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
function isMouseEventOnDialog(event, dialog) {
|
|
if (!("clientY" in event)) return false;
|
|
const rect = dialog.getBoundingClientRect();
|
|
if (rect.width === 0 || rect.height === 0) return false;
|
|
return rect.top <= event.clientY && event.clientY <= rect.top + rect.height && rect.left <= event.clientX && event.clientX <= rect.left + rect.width;
|
|
}
|
|
function useEventOutside({
|
|
store,
|
|
type,
|
|
listener,
|
|
capture,
|
|
domReady
|
|
}) {
|
|
const callListener = (0,Z32BISHQ/* useEvent */._q)(listener);
|
|
const open = store.useState("open");
|
|
const focusedRef = (0,react.useRef)(false);
|
|
(0,Z32BISHQ/* useSafeLayoutEffect */.UQ)(() => {
|
|
if (!open) return;
|
|
if (!domReady) return;
|
|
const { contentElement } = store.getState();
|
|
if (!contentElement) return;
|
|
const onFocus = () => {
|
|
focusedRef.current = true;
|
|
};
|
|
contentElement.addEventListener("focusin", onFocus, true);
|
|
return () => contentElement.removeEventListener("focusin", onFocus, true);
|
|
}, [store, open, domReady]);
|
|
(0,react.useEffect)(() => {
|
|
if (!open) return;
|
|
const onEvent = (event) => {
|
|
const { contentElement, disclosureElement } = store.getState();
|
|
const target = event.target;
|
|
if (!contentElement) return;
|
|
if (!target) return;
|
|
if (!isInDocument(target)) return;
|
|
if ((0,HWOIWM4O/* contains */.gR)(contentElement, target)) return;
|
|
if (isDisclosure(disclosureElement, target)) return;
|
|
if (target.hasAttribute("data-focus-trap")) return;
|
|
if (isMouseEventOnDialog(event, contentElement)) return;
|
|
const focused = focusedRef.current;
|
|
if (focused && !isElementMarked(target, contentElement.id)) return;
|
|
callListener(event);
|
|
};
|
|
return (0,events/* addGlobalEventListener */.dg)(type, onEvent, capture);
|
|
}, [open, capture]);
|
|
}
|
|
function shouldHideOnInteractOutside(hideOnInteractOutside, event) {
|
|
if (typeof hideOnInteractOutside === "function") {
|
|
return hideOnInteractOutside(event);
|
|
}
|
|
return !!hideOnInteractOutside;
|
|
}
|
|
function useHideOnInteractOutside(store, hideOnInteractOutside, domReady) {
|
|
const open = store.useState("open");
|
|
const previousMouseDownRef = usePreviousMouseDownRef(open);
|
|
const props = { store, domReady, capture: true };
|
|
useEventOutside((0,_3YLGPPWQ/* __spreadProps */.ko)((0,_3YLGPPWQ/* __spreadValues */.IA)({}, props), {
|
|
type: "click",
|
|
listener: (event) => {
|
|
const { contentElement } = store.getState();
|
|
const previousMouseDown = previousMouseDownRef.current;
|
|
if (!previousMouseDown) return;
|
|
if (!(0,HWOIWM4O/* isVisible */.zN)(previousMouseDown)) return;
|
|
if (!isElementMarked(previousMouseDown, contentElement == null ? void 0 : contentElement.id)) return;
|
|
if (!shouldHideOnInteractOutside(hideOnInteractOutside, event)) return;
|
|
store.hide();
|
|
}
|
|
}));
|
|
useEventOutside((0,_3YLGPPWQ/* __spreadProps */.ko)((0,_3YLGPPWQ/* __spreadValues */.IA)({}, props), {
|
|
type: "focusin",
|
|
listener: (event) => {
|
|
const { contentElement } = store.getState();
|
|
if (!contentElement) return;
|
|
if (event.target === (0,HWOIWM4O/* getDocument */.YE)(contentElement)) return;
|
|
if (!shouldHideOnInteractOutside(hideOnInteractOutside, event)) return;
|
|
store.hide();
|
|
}
|
|
}));
|
|
useEventOutside((0,_3YLGPPWQ/* __spreadProps */.ko)((0,_3YLGPPWQ/* __spreadValues */.IA)({}, props), {
|
|
type: "contextmenu",
|
|
listener: (event) => {
|
|
if (!shouldHideOnInteractOutside(hideOnInteractOutside, event)) return;
|
|
store.hide();
|
|
}
|
|
}));
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/6GXEOXGT.js
|
|
"use client";
|
|
|
|
// src/dialog/utils/prepend-hidden-dismiss.ts
|
|
|
|
function prependHiddenDismiss(container, onClick) {
|
|
const document = (0,HWOIWM4O/* getDocument */.YE)(container);
|
|
const button = document.createElement("button");
|
|
button.type = "button";
|
|
button.tabIndex = -1;
|
|
button.textContent = "Dismiss popup";
|
|
Object.assign(button.style, {
|
|
border: "0px",
|
|
clip: "rect(0 0 0 0)",
|
|
height: "1px",
|
|
margin: "-1px",
|
|
overflow: "hidden",
|
|
padding: "0px",
|
|
position: "absolute",
|
|
whiteSpace: "nowrap",
|
|
width: "1px"
|
|
});
|
|
button.addEventListener("click", onClick);
|
|
container.prepend(button);
|
|
const removeHiddenDismiss = () => {
|
|
button.removeEventListener("click", onClick);
|
|
button.remove();
|
|
};
|
|
return removeHiddenDismiss;
|
|
}
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/SWN3JYXT.js
|
|
var SWN3JYXT = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/SWN3JYXT.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HKOOKEDE.js
|
|
var HKOOKEDE = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HKOOKEDE.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HT3UEUDM.js
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
// src/focusable/focusable-container.tsx
|
|
|
|
var TagName = "div";
|
|
var useFocusableContainer = (0,HKOOKEDE/* createHook */.ab)(function useFocusableContainer2(_a) {
|
|
var _b = _a, { autoFocusOnShow = true } = _b, props = (0,_3YLGPPWQ/* __objRest */.YG)(_b, ["autoFocusOnShow"]);
|
|
props = (0,Z32BISHQ/* useWrapElement */.w7)(
|
|
props,
|
|
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(SWN3JYXT/* FocusableContext */.g.Provider, { value: autoFocusOnShow, children: element }),
|
|
[autoFocusOnShow]
|
|
);
|
|
return props;
|
|
});
|
|
var FocusableContainer = (0,HKOOKEDE/* forwardRef */.Rf)(function FocusableContainer2(props) {
|
|
const htmlProps = useFocusableContainer(props);
|
|
return (0,HKOOKEDE/* createElement */.n)(TagName, htmlProps);
|
|
});
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/CZ4GFWYL.js
|
|
"use client";
|
|
|
|
// src/heading/heading-context.tsx
|
|
|
|
var HeadingContext = (0,react.createContext)(0);
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/5M6RIVE2.js
|
|
"use client";
|
|
|
|
|
|
// src/heading/heading-level.tsx
|
|
|
|
|
|
function HeadingLevel({ level, children }) {
|
|
const contextLevel = (0,react.useContext)(HeadingContext);
|
|
const nextLevel = Math.max(
|
|
Math.min(level || contextLevel + 1, 6),
|
|
1
|
|
);
|
|
return /* @__PURE__ */ (0,jsx_runtime.jsx)(HeadingContext.Provider, { value: nextLevel, children });
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/ILNAUGA4.js
|
|
"use client";
|
|
|
|
|
|
|
|
// src/visually-hidden/visually-hidden.tsx
|
|
var ILNAUGA4_TagName = "span";
|
|
var useVisuallyHidden = (0,HKOOKEDE/* createHook */.ab)(
|
|
function useVisuallyHidden2(props) {
|
|
props = (0,_3YLGPPWQ/* __spreadProps */.ko)((0,_3YLGPPWQ/* __spreadValues */.IA)({}, props), {
|
|
style: (0,_3YLGPPWQ/* __spreadValues */.IA)({
|
|
border: 0,
|
|
clip: "rect(0 0 0 0)",
|
|
height: "1px",
|
|
margin: "-1px",
|
|
overflow: "hidden",
|
|
padding: 0,
|
|
position: "absolute",
|
|
whiteSpace: "nowrap",
|
|
width: "1px"
|
|
}, props.style)
|
|
});
|
|
return props;
|
|
}
|
|
);
|
|
var VisuallyHidden = (0,HKOOKEDE/* forwardRef */.Rf)(function VisuallyHidden2(props) {
|
|
const htmlProps = useVisuallyHidden(props);
|
|
return (0,HKOOKEDE/* createElement */.n)(ILNAUGA4_TagName, htmlProps);
|
|
});
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/LWDIJ7XK.js
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
// src/focus-trap/focus-trap.tsx
|
|
var LWDIJ7XK_TagName = "span";
|
|
var useFocusTrap = (0,HKOOKEDE/* createHook */.ab)(
|
|
function useFocusTrap2(props) {
|
|
props = (0,_3YLGPPWQ/* __spreadProps */.ko)((0,_3YLGPPWQ/* __spreadValues */.IA)({
|
|
"data-focus-trap": "",
|
|
tabIndex: 0,
|
|
"aria-hidden": true
|
|
}, props), {
|
|
style: (0,_3YLGPPWQ/* __spreadValues */.IA)({
|
|
// Prevents unintended scroll jumps.
|
|
position: "fixed",
|
|
top: 0,
|
|
left: 0
|
|
}, props.style)
|
|
});
|
|
props = useVisuallyHidden(props);
|
|
return props;
|
|
}
|
|
);
|
|
var FocusTrap = (0,HKOOKEDE/* forwardRef */.Rf)(function FocusTrap2(props) {
|
|
const htmlProps = useFocusTrap(props);
|
|
return (0,HKOOKEDE/* createElement */.n)(LWDIJ7XK_TagName, htmlProps);
|
|
});
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/AOQQTIBO.js
|
|
"use client";
|
|
|
|
// src/portal/portal-context.tsx
|
|
|
|
var PortalContext = (0,react.createContext)(null);
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/SK3NAZA3.js
|
|
var SK3NAZA3 = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/SK3NAZA3.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/UNZQGRPO.js
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// src/portal/portal.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var UNZQGRPO_TagName = "div";
|
|
function getRootElement(element) {
|
|
return (0,HWOIWM4O/* getDocument */.YE)(element).body;
|
|
}
|
|
function getPortalElement(element, portalElement) {
|
|
if (!portalElement) {
|
|
return (0,HWOIWM4O/* getDocument */.YE)(element).createElement("div");
|
|
}
|
|
if (typeof portalElement === "function") {
|
|
return portalElement(element);
|
|
}
|
|
return portalElement;
|
|
}
|
|
function getRandomId(prefix = "id") {
|
|
return `${prefix ? `${prefix}-` : ""}${Math.random().toString(36).substr(2, 6)}`;
|
|
}
|
|
function queueFocus(element) {
|
|
queueMicrotask(() => {
|
|
element == null ? void 0 : element.focus();
|
|
});
|
|
}
|
|
var usePortal = (0,HKOOKEDE/* createHook */.ab)(function usePortal2(_a) {
|
|
var _b = _a, {
|
|
preserveTabOrder,
|
|
preserveTabOrderAnchor,
|
|
portalElement,
|
|
portalRef,
|
|
portal = true
|
|
} = _b, props = (0,_3YLGPPWQ/* __objRest */.YG)(_b, [
|
|
"preserveTabOrder",
|
|
"preserveTabOrderAnchor",
|
|
"portalElement",
|
|
"portalRef",
|
|
"portal"
|
|
]);
|
|
const ref = (0,react.useRef)(null);
|
|
const refProp = (0,Z32BISHQ/* useMergeRefs */.SV)(ref, props.ref);
|
|
const context = (0,react.useContext)(PortalContext);
|
|
const [portalNode, setPortalNode] = (0,react.useState)(null);
|
|
const [anchorPortalNode, setAnchorPortalNode] = (0,react.useState)(
|
|
null
|
|
);
|
|
const outerBeforeRef = (0,react.useRef)(null);
|
|
const innerBeforeRef = (0,react.useRef)(null);
|
|
const innerAfterRef = (0,react.useRef)(null);
|
|
const outerAfterRef = (0,react.useRef)(null);
|
|
(0,Z32BISHQ/* useSafeLayoutEffect */.UQ)(() => {
|
|
const element = ref.current;
|
|
if (!element || !portal) {
|
|
setPortalNode(null);
|
|
return;
|
|
}
|
|
const portalEl = getPortalElement(element, portalElement);
|
|
if (!portalEl) {
|
|
setPortalNode(null);
|
|
return;
|
|
}
|
|
const isPortalInDocument = portalEl.isConnected;
|
|
if (!isPortalInDocument) {
|
|
const rootElement = context || getRootElement(element);
|
|
rootElement.appendChild(portalEl);
|
|
}
|
|
if (!portalEl.id) {
|
|
portalEl.id = element.id ? `portal/${element.id}` : getRandomId();
|
|
}
|
|
setPortalNode(portalEl);
|
|
(0,SK3NAZA3/* setRef */.cZ)(portalRef, portalEl);
|
|
if (isPortalInDocument) return;
|
|
return () => {
|
|
portalEl.remove();
|
|
(0,SK3NAZA3/* setRef */.cZ)(portalRef, null);
|
|
};
|
|
}, [portal, portalElement, context, portalRef]);
|
|
(0,Z32BISHQ/* useSafeLayoutEffect */.UQ)(() => {
|
|
if (!portal) return;
|
|
if (!preserveTabOrder) return;
|
|
if (!preserveTabOrderAnchor) return;
|
|
const doc = (0,HWOIWM4O/* getDocument */.YE)(preserveTabOrderAnchor);
|
|
const element = doc.createElement("span");
|
|
element.style.position = "fixed";
|
|
preserveTabOrderAnchor.insertAdjacentElement("afterend", element);
|
|
setAnchorPortalNode(element);
|
|
return () => {
|
|
element.remove();
|
|
setAnchorPortalNode(null);
|
|
};
|
|
}, [portal, preserveTabOrder, preserveTabOrderAnchor]);
|
|
(0,react.useEffect)(() => {
|
|
if (!portalNode) return;
|
|
if (!preserveTabOrder) return;
|
|
let raf = 0;
|
|
const onFocus = (event) => {
|
|
if (!(0,events/* isFocusEventOutside */.aG)(event)) return;
|
|
const focusing = event.type === "focusin";
|
|
cancelAnimationFrame(raf);
|
|
if (focusing) {
|
|
return (0,utils_focus/* restoreFocusIn */.QZ)(portalNode);
|
|
}
|
|
raf = requestAnimationFrame(() => {
|
|
(0,utils_focus/* disableFocusIn */.gw)(portalNode, true);
|
|
});
|
|
};
|
|
portalNode.addEventListener("focusin", onFocus, true);
|
|
portalNode.addEventListener("focusout", onFocus, true);
|
|
return () => {
|
|
cancelAnimationFrame(raf);
|
|
portalNode.removeEventListener("focusin", onFocus, true);
|
|
portalNode.removeEventListener("focusout", onFocus, true);
|
|
};
|
|
}, [portalNode, preserveTabOrder]);
|
|
props = (0,Z32BISHQ/* useWrapElement */.w7)(
|
|
props,
|
|
(element) => {
|
|
element = // While the portal node is not in the DOM, we need to pass the
|
|
// current context to the portal context, otherwise it's going to
|
|
// reset to the body element on nested portals.
|
|
/* @__PURE__ */ (0,jsx_runtime.jsx)(PortalContext.Provider, { value: portalNode || context, children: element });
|
|
if (!portal) return element;
|
|
if (!portalNode) {
|
|
return /* @__PURE__ */ (0,jsx_runtime.jsx)(
|
|
"span",
|
|
{
|
|
ref: refProp,
|
|
id: props.id,
|
|
style: { position: "fixed" },
|
|
hidden: true
|
|
}
|
|
);
|
|
}
|
|
element = /* @__PURE__ */ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, { children: [
|
|
preserveTabOrder && portalNode && /* @__PURE__ */ (0,jsx_runtime.jsx)(
|
|
FocusTrap,
|
|
{
|
|
ref: innerBeforeRef,
|
|
className: "__focus-trap-inner-before",
|
|
onFocus: (event) => {
|
|
if ((0,events/* isFocusEventOutside */.aG)(event, portalNode)) {
|
|
queueFocus((0,utils_focus/* getNextTabbable */.vF)());
|
|
} else {
|
|
queueFocus(outerBeforeRef.current);
|
|
}
|
|
}
|
|
}
|
|
),
|
|
element,
|
|
preserveTabOrder && portalNode && /* @__PURE__ */ (0,jsx_runtime.jsx)(
|
|
FocusTrap,
|
|
{
|
|
ref: innerAfterRef,
|
|
className: "__focus-trap-inner-after",
|
|
onFocus: (event) => {
|
|
if ((0,events/* isFocusEventOutside */.aG)(event, portalNode)) {
|
|
queueFocus((0,utils_focus/* getPreviousTabbable */.XJ)());
|
|
} else {
|
|
queueFocus(outerAfterRef.current);
|
|
}
|
|
}
|
|
}
|
|
)
|
|
] });
|
|
if (portalNode) {
|
|
element = (0,react_dom.createPortal)(element, portalNode);
|
|
}
|
|
let preserveTabOrderElement = /* @__PURE__ */ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, { children: [
|
|
preserveTabOrder && portalNode && /* @__PURE__ */ (0,jsx_runtime.jsx)(
|
|
FocusTrap,
|
|
{
|
|
ref: outerBeforeRef,
|
|
className: "__focus-trap-outer-before",
|
|
onFocus: (event) => {
|
|
const fromOuter = event.relatedTarget === outerAfterRef.current;
|
|
if (!fromOuter && (0,events/* isFocusEventOutside */.aG)(event, portalNode)) {
|
|
queueFocus(innerBeforeRef.current);
|
|
} else {
|
|
queueFocus((0,utils_focus/* getPreviousTabbable */.XJ)());
|
|
}
|
|
}
|
|
}
|
|
),
|
|
preserveTabOrder && // We're using position: fixed here so that the browser doesn't
|
|
// add margin to the element when setting gap on a parent element.
|
|
/* @__PURE__ */ (0,jsx_runtime.jsx)("span", { "aria-owns": portalNode == null ? void 0 : portalNode.id, style: { position: "fixed" } }),
|
|
preserveTabOrder && portalNode && /* @__PURE__ */ (0,jsx_runtime.jsx)(
|
|
FocusTrap,
|
|
{
|
|
ref: outerAfterRef,
|
|
className: "__focus-trap-outer-after",
|
|
onFocus: (event) => {
|
|
if ((0,events/* isFocusEventOutside */.aG)(event, portalNode)) {
|
|
queueFocus(innerAfterRef.current);
|
|
} else {
|
|
const nextTabbable = (0,utils_focus/* getNextTabbable */.vF)();
|
|
if (nextTabbable === innerBeforeRef.current) {
|
|
requestAnimationFrame(() => {
|
|
var _a2;
|
|
return (_a2 = (0,utils_focus/* getNextTabbable */.vF)()) == null ? void 0 : _a2.focus();
|
|
});
|
|
return;
|
|
}
|
|
queueFocus(nextTabbable);
|
|
}
|
|
}
|
|
}
|
|
)
|
|
] });
|
|
if (anchorPortalNode && preserveTabOrder) {
|
|
preserveTabOrderElement = (0,react_dom.createPortal)(
|
|
preserveTabOrderElement,
|
|
anchorPortalNode
|
|
);
|
|
}
|
|
return /* @__PURE__ */ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, { children: [
|
|
preserveTabOrderElement,
|
|
element
|
|
] });
|
|
},
|
|
[portalNode, context, portal, props.id, preserveTabOrder, anchorPortalNode]
|
|
);
|
|
props = (0,_3YLGPPWQ/* __spreadProps */.ko)((0,_3YLGPPWQ/* __spreadValues */.IA)({}, props), {
|
|
ref: refProp
|
|
});
|
|
return props;
|
|
});
|
|
var Portal = (0,HKOOKEDE/* forwardRef */.Rf)(function Portal2(props) {
|
|
const htmlProps = usePortal(props);
|
|
return (0,HKOOKEDE/* createElement */.n)(UNZQGRPO_TagName, htmlProps);
|
|
});
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/DU4D3UCJ.js
|
|
var DU4D3UCJ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/DU4D3UCJ.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HGZKAGPL.js
|
|
var HGZKAGPL = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HGZKAGPL.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/QYS5FHDY.js
|
|
var QYS5FHDY = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/QYS5FHDY.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/2GXGCHW6.js
|
|
var _2GXGCHW6 = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/2GXGCHW6.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/TT2355LN.js
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// src/dialog/dialog.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var TT2355LN_TagName = "div";
|
|
var isSafariBrowser = (0,US4USQPI/* isSafari */.nr)();
|
|
function isAlreadyFocusingAnotherElement(dialog) {
|
|
const activeElement = (0,HWOIWM4O/* getActiveElement */.bq)();
|
|
if (!activeElement) return false;
|
|
if (dialog && (0,HWOIWM4O/* contains */.gR)(dialog, activeElement)) return false;
|
|
if ((0,utils_focus/* isFocusable */.tp)(activeElement)) return true;
|
|
return false;
|
|
}
|
|
function getElementFromProp(prop, focusable = false) {
|
|
if (!prop) return null;
|
|
const element = "current" in prop ? prop.current : prop;
|
|
if (!element) return null;
|
|
if (focusable) return (0,utils_focus/* isFocusable */.tp)(element) ? element : null;
|
|
return element;
|
|
}
|
|
var useDialog = (0,HKOOKEDE/* createHook */.ab)(function useDialog2(_a) {
|
|
var _b = _a, {
|
|
store: storeProp,
|
|
open: openProp,
|
|
onClose,
|
|
focusable = true,
|
|
modal = true,
|
|
portal = !!modal,
|
|
backdrop = !!modal,
|
|
hideOnEscape = true,
|
|
hideOnInteractOutside = true,
|
|
getPersistentElements,
|
|
preventBodyScroll = !!modal,
|
|
autoFocusOnShow = true,
|
|
autoFocusOnHide = true,
|
|
initialFocus,
|
|
finalFocus,
|
|
unmountOnHide,
|
|
unstable_treeSnapshotKey
|
|
} = _b, props = (0,_3YLGPPWQ/* __objRest */.YG)(_b, [
|
|
"store",
|
|
"open",
|
|
"onClose",
|
|
"focusable",
|
|
"modal",
|
|
"portal",
|
|
"backdrop",
|
|
"hideOnEscape",
|
|
"hideOnInteractOutside",
|
|
"getPersistentElements",
|
|
"preventBodyScroll",
|
|
"autoFocusOnShow",
|
|
"autoFocusOnHide",
|
|
"initialFocus",
|
|
"finalFocus",
|
|
"unmountOnHide",
|
|
"unstable_treeSnapshotKey"
|
|
]);
|
|
const context = (0,DU4D3UCJ/* useDialogProviderContext */.cH)();
|
|
const ref = (0,react.useRef)(null);
|
|
const store = (0,QYS5FHDY/* useDialogStore */.j)({
|
|
store: storeProp || context,
|
|
open: openProp,
|
|
setOpen(open2) {
|
|
if (open2) return;
|
|
const dialog = ref.current;
|
|
if (!dialog) return;
|
|
const event = new Event("close", { bubbles: false, cancelable: true });
|
|
if (onClose) {
|
|
dialog.addEventListener("close", onClose, { once: true });
|
|
}
|
|
dialog.dispatchEvent(event);
|
|
if (!event.defaultPrevented) return;
|
|
store.setOpen(true);
|
|
}
|
|
});
|
|
const { portalRef, domReady } = (0,Z32BISHQ/* usePortalRef */.TE)(portal, props.portalRef);
|
|
const preserveTabOrderProp = props.preserveTabOrder;
|
|
const preserveTabOrder = store.useState(
|
|
(state) => preserveTabOrderProp && !modal && state.mounted
|
|
);
|
|
const id = (0,Z32BISHQ/* useId */.Bi)(props.id);
|
|
const open = store.useState("open");
|
|
const mounted = store.useState("mounted");
|
|
const contentElement = store.useState("contentElement");
|
|
const hidden = (0,BSEL4YAF/* isHidden */.dK)(mounted, props.hidden, props.alwaysVisible);
|
|
usePreventBodyScroll(contentElement, id, preventBodyScroll && !hidden);
|
|
useHideOnInteractOutside(store, hideOnInteractOutside, domReady);
|
|
const { wrapElement, nestedDialogs } = useNestedDialogs(store);
|
|
props = (0,Z32BISHQ/* useWrapElement */.w7)(props, wrapElement, [wrapElement]);
|
|
(0,Z32BISHQ/* useSafeLayoutEffect */.UQ)(() => {
|
|
if (!open) return;
|
|
const dialog = ref.current;
|
|
const activeElement = (0,HWOIWM4O/* getActiveElement */.bq)(dialog, true);
|
|
if (!activeElement) return;
|
|
if (activeElement.tagName === "BODY") return;
|
|
if (dialog && (0,HWOIWM4O/* contains */.gR)(dialog, activeElement)) return;
|
|
store.setDisclosureElement(activeElement);
|
|
}, [store, open]);
|
|
if (isSafariBrowser) {
|
|
(0,react.useEffect)(() => {
|
|
if (!mounted) return;
|
|
const { disclosureElement } = store.getState();
|
|
if (!disclosureElement) return;
|
|
if (!(0,HWOIWM4O/* isButton */.Bm)(disclosureElement)) return;
|
|
const onMouseDown = () => {
|
|
let receivedFocus = false;
|
|
const onFocus = () => {
|
|
receivedFocus = true;
|
|
};
|
|
const options = { capture: true, once: true };
|
|
disclosureElement.addEventListener("focusin", onFocus, options);
|
|
(0,events/* queueBeforeEvent */.nz)(disclosureElement, "mouseup", () => {
|
|
disclosureElement.removeEventListener("focusin", onFocus, true);
|
|
if (receivedFocus) return;
|
|
(0,utils_focus/* focusIfNeeded */["do"])(disclosureElement);
|
|
});
|
|
};
|
|
disclosureElement.addEventListener("mousedown", onMouseDown);
|
|
return () => {
|
|
disclosureElement.removeEventListener("mousedown", onMouseDown);
|
|
};
|
|
}, [store, mounted]);
|
|
}
|
|
(0,react.useEffect)(() => {
|
|
if (!modal) return;
|
|
if (!mounted) return;
|
|
if (!domReady) return;
|
|
const dialog = ref.current;
|
|
if (!dialog) return;
|
|
const existingDismiss = dialog.querySelector("[data-dialog-dismiss]");
|
|
if (existingDismiss) return;
|
|
return prependHiddenDismiss(dialog, store.hide);
|
|
}, [store, modal, mounted, domReady]);
|
|
(0,Z32BISHQ/* useSafeLayoutEffect */.UQ)(() => {
|
|
if (!supportsInert()) return;
|
|
if (open) return;
|
|
if (!mounted) return;
|
|
if (!domReady) return;
|
|
const dialog = ref.current;
|
|
if (!dialog) return;
|
|
return disableTree(dialog);
|
|
}, [open, mounted, domReady]);
|
|
const canTakeTreeSnapshot = open && domReady;
|
|
(0,Z32BISHQ/* useSafeLayoutEffect */.UQ)(() => {
|
|
if (!id) return;
|
|
if (!canTakeTreeSnapshot) return;
|
|
const dialog = ref.current;
|
|
return createWalkTreeSnapshot(id, [dialog]);
|
|
}, [id, canTakeTreeSnapshot, unstable_treeSnapshotKey]);
|
|
const getPersistentElementsProp = (0,Z32BISHQ/* useEvent */._q)(getPersistentElements);
|
|
(0,Z32BISHQ/* useSafeLayoutEffect */.UQ)(() => {
|
|
if (!id) return;
|
|
if (!canTakeTreeSnapshot) return;
|
|
const { disclosureElement } = store.getState();
|
|
const dialog = ref.current;
|
|
const persistentElements = getPersistentElementsProp() || [];
|
|
const allElements = [
|
|
dialog,
|
|
...persistentElements,
|
|
...nestedDialogs.map((dialog2) => dialog2.getState().contentElement)
|
|
];
|
|
if (modal) {
|
|
return (0,PBFD2E7P/* chain */.cy)(
|
|
markTreeOutside(id, allElements),
|
|
disableTreeOutside(id, allElements)
|
|
);
|
|
}
|
|
return markTreeOutside(id, [disclosureElement, ...allElements]);
|
|
}, [
|
|
id,
|
|
store,
|
|
canTakeTreeSnapshot,
|
|
getPersistentElementsProp,
|
|
nestedDialogs,
|
|
modal,
|
|
unstable_treeSnapshotKey
|
|
]);
|
|
const mayAutoFocusOnShow = !!autoFocusOnShow;
|
|
const autoFocusOnShowProp = (0,Z32BISHQ/* useBooleanEvent */.O4)(autoFocusOnShow);
|
|
const [autoFocusEnabled, setAutoFocusEnabled] = (0,react.useState)(false);
|
|
(0,react.useEffect)(() => {
|
|
if (!open) return;
|
|
if (!mayAutoFocusOnShow) return;
|
|
if (!domReady) return;
|
|
if (!(contentElement == null ? void 0 : contentElement.isConnected)) return;
|
|
const element = getElementFromProp(initialFocus, true) || // If no initial focus is specified, we try to focus the first element
|
|
// with the autofocus attribute. If it's an Ariakit component, the
|
|
// Focusable component will consume the autoFocus prop and add the
|
|
// data-autofocus attribute to the element instead.
|
|
contentElement.querySelector(
|
|
"[data-autofocus=true],[autofocus]"
|
|
) || // We have to fallback to the first focusable element otherwise portaled
|
|
// dialogs with preserveTabOrder set to true will not receive focus
|
|
// properly because the elements aren't tabbable until the dialog receives
|
|
// focus.
|
|
(0,utils_focus/* getFirstTabbableIn */.LC)(contentElement, true, portal && preserveTabOrder) || // Finally, we fallback to the dialog element itself.
|
|
contentElement;
|
|
const isElementFocusable = (0,utils_focus/* isFocusable */.tp)(element);
|
|
if (!autoFocusOnShowProp(isElementFocusable ? element : null)) return;
|
|
setAutoFocusEnabled(true);
|
|
queueMicrotask(() => {
|
|
element.focus();
|
|
if (!isSafariBrowser) return;
|
|
element.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
});
|
|
}, [
|
|
open,
|
|
mayAutoFocusOnShow,
|
|
domReady,
|
|
contentElement,
|
|
initialFocus,
|
|
portal,
|
|
preserveTabOrder,
|
|
autoFocusOnShowProp
|
|
]);
|
|
const mayAutoFocusOnHide = !!autoFocusOnHide;
|
|
const autoFocusOnHideProp = (0,Z32BISHQ/* useBooleanEvent */.O4)(autoFocusOnHide);
|
|
const [hasOpened, setHasOpened] = (0,react.useState)(false);
|
|
(0,react.useEffect)(() => {
|
|
if (!open) return;
|
|
setHasOpened(true);
|
|
return () => setHasOpened(false);
|
|
}, [open]);
|
|
const focusOnHide = (0,react.useCallback)(
|
|
(dialog, retry = true) => {
|
|
const { disclosureElement } = store.getState();
|
|
if (isAlreadyFocusingAnotherElement(dialog)) return;
|
|
let element = getElementFromProp(finalFocus) || disclosureElement;
|
|
if (element == null ? void 0 : element.id) {
|
|
const doc = (0,HWOIWM4O/* getDocument */.YE)(element);
|
|
const selector = `[aria-activedescendant="${element.id}"]`;
|
|
const composite = doc.querySelector(selector);
|
|
if (composite) {
|
|
element = composite;
|
|
}
|
|
}
|
|
if (element && !(0,utils_focus/* isFocusable */.tp)(element)) {
|
|
const maybeParentDialog = element.closest("[data-dialog]");
|
|
if (maybeParentDialog == null ? void 0 : maybeParentDialog.id) {
|
|
const doc = (0,HWOIWM4O/* getDocument */.YE)(maybeParentDialog);
|
|
const selector = `[aria-controls~="${maybeParentDialog.id}"]`;
|
|
const control = doc.querySelector(selector);
|
|
if (control) {
|
|
element = control;
|
|
}
|
|
}
|
|
}
|
|
const isElementFocusable = element && (0,utils_focus/* isFocusable */.tp)(element);
|
|
if (!isElementFocusable && retry) {
|
|
requestAnimationFrame(() => focusOnHide(dialog, false));
|
|
return;
|
|
}
|
|
if (!autoFocusOnHideProp(isElementFocusable ? element : null)) return;
|
|
if (!isElementFocusable) return;
|
|
element == null ? void 0 : element.focus();
|
|
},
|
|
[store, finalFocus, autoFocusOnHideProp]
|
|
);
|
|
const focusedOnHideRef = (0,react.useRef)(false);
|
|
(0,Z32BISHQ/* useSafeLayoutEffect */.UQ)(() => {
|
|
if (open) return;
|
|
if (!hasOpened) return;
|
|
if (!mayAutoFocusOnHide) return;
|
|
const dialog = ref.current;
|
|
focusedOnHideRef.current = true;
|
|
focusOnHide(dialog);
|
|
}, [open, hasOpened, domReady, mayAutoFocusOnHide, focusOnHide]);
|
|
(0,react.useEffect)(() => {
|
|
if (!hasOpened) return;
|
|
if (!mayAutoFocusOnHide) return;
|
|
const dialog = ref.current;
|
|
return () => {
|
|
if (focusedOnHideRef.current) {
|
|
focusedOnHideRef.current = false;
|
|
return;
|
|
}
|
|
focusOnHide(dialog);
|
|
};
|
|
}, [hasOpened, mayAutoFocusOnHide, focusOnHide]);
|
|
const hideOnEscapeProp = (0,Z32BISHQ/* useBooleanEvent */.O4)(hideOnEscape);
|
|
(0,react.useEffect)(() => {
|
|
if (!domReady) return;
|
|
if (!mounted) return;
|
|
const onKeyDown = (event) => {
|
|
if (event.key !== "Escape") return;
|
|
if (event.defaultPrevented) return;
|
|
const dialog = ref.current;
|
|
if (!dialog) return;
|
|
if (isElementMarked(dialog)) return;
|
|
const target = event.target;
|
|
if (!target) return;
|
|
const { disclosureElement } = store.getState();
|
|
const isValidTarget = () => {
|
|
if (target.tagName === "BODY") return true;
|
|
if ((0,HWOIWM4O/* contains */.gR)(dialog, target)) return true;
|
|
if (!disclosureElement) return true;
|
|
if ((0,HWOIWM4O/* contains */.gR)(disclosureElement, target)) return true;
|
|
return false;
|
|
};
|
|
if (!isValidTarget()) return;
|
|
if (!hideOnEscapeProp(event)) return;
|
|
store.hide();
|
|
};
|
|
return (0,events/* addGlobalEventListener */.dg)("keydown", onKeyDown, true);
|
|
}, [store, domReady, mounted, hideOnEscapeProp]);
|
|
props = (0,Z32BISHQ/* useWrapElement */.w7)(
|
|
props,
|
|
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(HeadingLevel, { level: modal ? 1 : void 0, children: element }),
|
|
[modal]
|
|
);
|
|
const hiddenProp = props.hidden;
|
|
const alwaysVisible = props.alwaysVisible;
|
|
props = (0,Z32BISHQ/* useWrapElement */.w7)(
|
|
props,
|
|
(element) => {
|
|
if (!backdrop) return element;
|
|
return /* @__PURE__ */ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, { children: [
|
|
/* @__PURE__ */ (0,jsx_runtime.jsx)(
|
|
DialogBackdrop,
|
|
{
|
|
store,
|
|
backdrop,
|
|
hidden: hiddenProp,
|
|
alwaysVisible
|
|
}
|
|
),
|
|
element
|
|
] });
|
|
},
|
|
[store, backdrop, hiddenProp, alwaysVisible]
|
|
);
|
|
const [headingId, setHeadingId] = (0,react.useState)();
|
|
const [descriptionId, setDescriptionId] = (0,react.useState)();
|
|
props = (0,Z32BISHQ/* useWrapElement */.w7)(
|
|
props,
|
|
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(DU4D3UCJ/* DialogScopedContextProvider */.XP, { value: store, children: /* @__PURE__ */ (0,jsx_runtime.jsx)(DU4D3UCJ/* DialogHeadingContext */.YH.Provider, { value: setHeadingId, children: /* @__PURE__ */ (0,jsx_runtime.jsx)(DU4D3UCJ/* DialogDescriptionContext */.oL.Provider, { value: setDescriptionId, children: element }) }) }),
|
|
[store]
|
|
);
|
|
props = (0,_3YLGPPWQ/* __spreadProps */.ko)((0,_3YLGPPWQ/* __spreadValues */.IA)({
|
|
id,
|
|
"data-dialog": "",
|
|
role: "dialog",
|
|
tabIndex: focusable ? -1 : void 0,
|
|
"aria-labelledby": headingId,
|
|
"aria-describedby": descriptionId
|
|
}, props), {
|
|
ref: (0,Z32BISHQ/* useMergeRefs */.SV)(ref, props.ref)
|
|
});
|
|
props = useFocusableContainer((0,_3YLGPPWQ/* __spreadProps */.ko)((0,_3YLGPPWQ/* __spreadValues */.IA)({}, props), {
|
|
autoFocusOnShow: autoFocusEnabled
|
|
}));
|
|
props = (0,BSEL4YAF/* useDisclosureContent */.aT)((0,_3YLGPPWQ/* __spreadValues */.IA)({ store }, props));
|
|
props = (0,HGZKAGPL/* useFocusable */.W)((0,_3YLGPPWQ/* __spreadProps */.ko)((0,_3YLGPPWQ/* __spreadValues */.IA)({}, props), { focusable }));
|
|
props = usePortal((0,_3YLGPPWQ/* __spreadProps */.ko)((0,_3YLGPPWQ/* __spreadValues */.IA)({ portal }, props), { portalRef, preserveTabOrder }));
|
|
return props;
|
|
});
|
|
function createDialogComponent(Component, useProviderContext = DU4D3UCJ/* useDialogProviderContext */.cH) {
|
|
return (0,HKOOKEDE/* forwardRef */.Rf)(function DialogComponent(props) {
|
|
const context = useProviderContext();
|
|
const store = props.store || context;
|
|
const mounted = (0,_2GXGCHW6/* useStoreState */.O$)(
|
|
store,
|
|
(state) => !props.unmountOnHide || (state == null ? void 0 : state.mounted) || !!props.open
|
|
);
|
|
if (!mounted) return null;
|
|
return /* @__PURE__ */ (0,jsx_runtime.jsx)(Component, (0,_3YLGPPWQ/* __spreadValues */.IA)({}, props));
|
|
});
|
|
}
|
|
var Dialog = createDialogComponent(
|
|
(0,HKOOKEDE/* forwardRef */.Rf)(function Dialog2(props) {
|
|
const htmlProps = useDialog(props);
|
|
return (0,HKOOKEDE/* createElement */.n)(TT2355LN_TagName, htmlProps);
|
|
}),
|
|
DU4D3UCJ/* useDialogProviderContext */.cH
|
|
);
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/TW35PKTK.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ T: () => (/* binding */ useComposite),
|
|
/* harmony export */ e: () => (/* binding */ Composite)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _5VQZOHHZ_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/5VQZOHHZ.js");
|
|
/* harmony import */ var _WENSINUV_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/WENSINUV.js");
|
|
/* harmony import */ var _HGZKAGPL_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HGZKAGPL.js");
|
|
/* harmony import */ var _HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HKOOKEDE.js");
|
|
/* harmony import */ var _Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/Z32BISHQ.js");
|
|
/* harmony import */ var _3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js");
|
|
/* harmony import */ var _ariakit_core_utils_array__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/7PRQYBBV.js");
|
|
/* harmony import */ var _ariakit_core_utils_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/HWOIWM4O.js");
|
|
/* harmony import */ var _ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/utils/events.js");
|
|
/* harmony import */ var _ariakit_core_utils_focus__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/utils/focus.js");
|
|
/* harmony import */ var _ariakit_core_utils_misc__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// src/composite/composite.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var TagName = "div";
|
|
function isGrid(items) {
|
|
return items.some((item) => !!item.rowId);
|
|
}
|
|
function isPrintableKey(event) {
|
|
const target = event.target;
|
|
if (target && !(0,_ariakit_core_utils_dom__WEBPACK_IMPORTED_MODULE_2__/* .isTextField */ .mB)(target)) return false;
|
|
return event.key.length === 1 && !event.ctrlKey && !event.metaKey;
|
|
}
|
|
function isModifierKey(event) {
|
|
return event.key === "Shift" || event.key === "Control" || event.key === "Alt" || event.key === "Meta";
|
|
}
|
|
function useKeyboardEventProxy(store, onKeyboardEvent, previousElementRef) {
|
|
return (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_3__/* .useEvent */ ._q)((event) => {
|
|
var _a;
|
|
onKeyboardEvent == null ? void 0 : onKeyboardEvent(event);
|
|
if (event.defaultPrevented) return;
|
|
if (event.isPropagationStopped()) return;
|
|
if (!(0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_4__/* .isSelfTarget */ .uh)(event)) return;
|
|
if (isModifierKey(event)) return;
|
|
if (isPrintableKey(event)) return;
|
|
const state = store.getState();
|
|
const activeElement = (_a = (0,_5VQZOHHZ_js__WEBPACK_IMPORTED_MODULE_5__/* .getEnabledItem */ .hZ)(store, state.activeId)) == null ? void 0 : _a.element;
|
|
if (!activeElement) return;
|
|
const _b = event, { view } = _b, eventInit = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_6__/* .__objRest */ .YG)(_b, ["view"]);
|
|
const previousElement = previousElementRef == null ? void 0 : previousElementRef.current;
|
|
if (activeElement !== previousElement) {
|
|
activeElement.focus();
|
|
}
|
|
if (!(0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_4__/* .fireKeyboardEvent */ .sz)(activeElement, event.type, eventInit)) {
|
|
event.preventDefault();
|
|
}
|
|
if (event.currentTarget.contains(activeElement)) {
|
|
event.stopPropagation();
|
|
}
|
|
});
|
|
}
|
|
function findFirstEnabledItemInTheLastRow(items) {
|
|
return (0,_5VQZOHHZ_js__WEBPACK_IMPORTED_MODULE_5__/* .findFirstEnabledItem */ .oi)(
|
|
(0,_ariakit_core_utils_array__WEBPACK_IMPORTED_MODULE_7__/* .flatten2DArray */ .M9)((0,_ariakit_core_utils_array__WEBPACK_IMPORTED_MODULE_7__/* .reverseArray */ .q7)((0,_5VQZOHHZ_js__WEBPACK_IMPORTED_MODULE_5__/* .groupItemsByRows */ .es)(items)))
|
|
);
|
|
}
|
|
function useScheduleFocus(store) {
|
|
const [scheduled, setScheduled] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
|
|
const schedule = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(() => setScheduled(true), []);
|
|
const activeItem = store.useState(
|
|
(state) => (0,_5VQZOHHZ_js__WEBPACK_IMPORTED_MODULE_5__/* .getEnabledItem */ .hZ)(store, state.activeId)
|
|
);
|
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
const activeElement = activeItem == null ? void 0 : activeItem.element;
|
|
if (!scheduled) return;
|
|
if (!activeElement) return;
|
|
setScheduled(false);
|
|
activeElement.focus({ preventScroll: true });
|
|
}, [activeItem, scheduled]);
|
|
return schedule;
|
|
}
|
|
var useComposite = (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_8__/* .createHook */ .ab)(
|
|
function useComposite2(_a) {
|
|
var _b = _a, {
|
|
store,
|
|
composite = true,
|
|
focusOnMove = composite,
|
|
moveOnKeyPress = true
|
|
} = _b, props = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_6__/* .__objRest */ .YG)(_b, [
|
|
"store",
|
|
"composite",
|
|
"focusOnMove",
|
|
"moveOnKeyPress"
|
|
]);
|
|
const context = (0,_WENSINUV_js__WEBPACK_IMPORTED_MODULE_9__/* .useCompositeProviderContext */ .Lf)();
|
|
store = store || context;
|
|
(0,_ariakit_core_utils_misc__WEBPACK_IMPORTED_MODULE_10__/* .invariant */ .V1)(
|
|
store,
|
|
false && 0
|
|
);
|
|
const ref = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
const previousElementRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
const scheduleFocus = useScheduleFocus(store);
|
|
const moves = store.useState("moves");
|
|
const [, setBaseElement] = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_3__/* .useTransactionState */ .XB)(
|
|
composite ? store.setBaseElement : null
|
|
);
|
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
var _a2;
|
|
if (!store) return;
|
|
if (!moves) return;
|
|
if (!composite) return;
|
|
if (!focusOnMove) return;
|
|
const { activeId: activeId2 } = store.getState();
|
|
const itemElement = (_a2 = (0,_5VQZOHHZ_js__WEBPACK_IMPORTED_MODULE_5__/* .getEnabledItem */ .hZ)(store, activeId2)) == null ? void 0 : _a2.element;
|
|
if (!itemElement) return;
|
|
(0,_ariakit_core_utils_focus__WEBPACK_IMPORTED_MODULE_11__/* .focusIntoView */ .WA)(itemElement);
|
|
}, [store, moves, composite, focusOnMove]);
|
|
(0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_3__/* .useSafeLayoutEffect */ .UQ)(() => {
|
|
if (!store) return;
|
|
if (!moves) return;
|
|
if (!composite) return;
|
|
const { baseElement, activeId: activeId2 } = store.getState();
|
|
const isSelfAcive = activeId2 === null;
|
|
if (!isSelfAcive) return;
|
|
if (!baseElement) return;
|
|
const previousElement = previousElementRef.current;
|
|
previousElementRef.current = null;
|
|
if (previousElement) {
|
|
(0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_4__/* .fireBlurEvent */ .c$)(previousElement, { relatedTarget: baseElement });
|
|
}
|
|
if (!(0,_ariakit_core_utils_focus__WEBPACK_IMPORTED_MODULE_11__/* .hasFocus */ .AJ)(baseElement)) {
|
|
baseElement.focus();
|
|
}
|
|
}, [store, moves, composite]);
|
|
const activeId = store.useState("activeId");
|
|
const virtualFocus = store.useState("virtualFocus");
|
|
(0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_3__/* .useSafeLayoutEffect */ .UQ)(() => {
|
|
var _a2;
|
|
if (!store) return;
|
|
if (!composite) return;
|
|
if (!virtualFocus) return;
|
|
const previousElement = previousElementRef.current;
|
|
previousElementRef.current = null;
|
|
if (!previousElement) return;
|
|
const activeElement = (_a2 = (0,_5VQZOHHZ_js__WEBPACK_IMPORTED_MODULE_5__/* .getEnabledItem */ .hZ)(store, activeId)) == null ? void 0 : _a2.element;
|
|
const relatedTarget = activeElement || (0,_ariakit_core_utils_dom__WEBPACK_IMPORTED_MODULE_2__/* .getActiveElement */ .bq)(previousElement);
|
|
if (relatedTarget === previousElement) return;
|
|
(0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_4__/* .fireBlurEvent */ .c$)(previousElement, { relatedTarget });
|
|
}, [store, activeId, virtualFocus, composite]);
|
|
const onKeyDownCapture = useKeyboardEventProxy(
|
|
store,
|
|
props.onKeyDownCapture,
|
|
previousElementRef
|
|
);
|
|
const onKeyUpCapture = useKeyboardEventProxy(
|
|
store,
|
|
props.onKeyUpCapture,
|
|
previousElementRef
|
|
);
|
|
const onFocusCaptureProp = props.onFocusCapture;
|
|
const onFocusCapture = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_3__/* .useEvent */ ._q)((event) => {
|
|
onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event);
|
|
if (event.defaultPrevented) return;
|
|
if (!store) return;
|
|
const { virtualFocus: virtualFocus2 } = store.getState();
|
|
if (!virtualFocus2) return;
|
|
const previousActiveElement = event.relatedTarget;
|
|
const isSilentlyFocused = (0,_5VQZOHHZ_js__WEBPACK_IMPORTED_MODULE_5__/* .silentlyFocused */ .Qh)(event.currentTarget);
|
|
if ((0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_4__/* .isSelfTarget */ .uh)(event) && isSilentlyFocused) {
|
|
event.stopPropagation();
|
|
previousElementRef.current = previousActiveElement;
|
|
}
|
|
});
|
|
const onFocusProp = props.onFocus;
|
|
const onFocus = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_3__/* .useEvent */ ._q)((event) => {
|
|
onFocusProp == null ? void 0 : onFocusProp(event);
|
|
if (event.defaultPrevented) return;
|
|
if (!composite) return;
|
|
if (!store) return;
|
|
const { relatedTarget } = event;
|
|
const { virtualFocus: virtualFocus2 } = store.getState();
|
|
if (virtualFocus2) {
|
|
if ((0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_4__/* .isSelfTarget */ .uh)(event) && !(0,_5VQZOHHZ_js__WEBPACK_IMPORTED_MODULE_5__/* .isItem */ .WZ)(store, relatedTarget)) {
|
|
queueMicrotask(scheduleFocus);
|
|
}
|
|
} else if ((0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_4__/* .isSelfTarget */ .uh)(event)) {
|
|
store.setActiveId(null);
|
|
}
|
|
});
|
|
const onBlurCaptureProp = props.onBlurCapture;
|
|
const onBlurCapture = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_3__/* .useEvent */ ._q)((event) => {
|
|
var _a2;
|
|
onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event);
|
|
if (event.defaultPrevented) return;
|
|
if (!store) return;
|
|
const { virtualFocus: virtualFocus2, activeId: activeId2 } = store.getState();
|
|
if (!virtualFocus2) return;
|
|
const activeElement = (_a2 = (0,_5VQZOHHZ_js__WEBPACK_IMPORTED_MODULE_5__/* .getEnabledItem */ .hZ)(store, activeId2)) == null ? void 0 : _a2.element;
|
|
const nextActiveElement = event.relatedTarget;
|
|
const nextActiveElementIsItem = (0,_5VQZOHHZ_js__WEBPACK_IMPORTED_MODULE_5__/* .isItem */ .WZ)(store, nextActiveElement);
|
|
const previousElement = previousElementRef.current;
|
|
previousElementRef.current = null;
|
|
if ((0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_4__/* .isSelfTarget */ .uh)(event) && nextActiveElementIsItem) {
|
|
if (nextActiveElement === activeElement) {
|
|
if (previousElement && previousElement !== nextActiveElement) {
|
|
(0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_4__/* .fireBlurEvent */ .c$)(previousElement, event);
|
|
}
|
|
} else if (activeElement) {
|
|
(0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_4__/* .fireBlurEvent */ .c$)(activeElement, event);
|
|
} else if (previousElement) {
|
|
(0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_4__/* .fireBlurEvent */ .c$)(previousElement, event);
|
|
}
|
|
event.stopPropagation();
|
|
} else {
|
|
const targetIsItem = (0,_5VQZOHHZ_js__WEBPACK_IMPORTED_MODULE_5__/* .isItem */ .WZ)(store, event.target);
|
|
if (!targetIsItem && activeElement) {
|
|
(0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_4__/* .fireBlurEvent */ .c$)(activeElement, event);
|
|
}
|
|
}
|
|
});
|
|
const onKeyDownProp = props.onKeyDown;
|
|
const moveOnKeyPressProp = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_3__/* .useBooleanEvent */ .O4)(moveOnKeyPress);
|
|
const onKeyDown = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_3__/* .useEvent */ ._q)((event) => {
|
|
var _a2;
|
|
onKeyDownProp == null ? void 0 : onKeyDownProp(event);
|
|
if (event.defaultPrevented) return;
|
|
if (!store) return;
|
|
if (!(0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_4__/* .isSelfTarget */ .uh)(event)) return;
|
|
const { orientation, items, renderedItems, activeId: activeId2 } = store.getState();
|
|
const activeItem = (0,_5VQZOHHZ_js__WEBPACK_IMPORTED_MODULE_5__/* .getEnabledItem */ .hZ)(store, activeId2);
|
|
if ((_a2 = activeItem == null ? void 0 : activeItem.element) == null ? void 0 : _a2.isConnected) return;
|
|
const isVertical = orientation !== "horizontal";
|
|
const isHorizontal = orientation !== "vertical";
|
|
const grid = isGrid(renderedItems);
|
|
const isHorizontalKey = event.key === "ArrowLeft" || event.key === "ArrowRight" || event.key === "Home" || event.key === "End";
|
|
if (isHorizontalKey && (0,_ariakit_core_utils_dom__WEBPACK_IMPORTED_MODULE_2__/* .isTextField */ .mB)(event.currentTarget)) return;
|
|
const up = () => {
|
|
if (grid) {
|
|
const item = items && findFirstEnabledItemInTheLastRow(items);
|
|
return item == null ? void 0 : item.id;
|
|
}
|
|
return store == null ? void 0 : store.last();
|
|
};
|
|
const keyMap = {
|
|
ArrowUp: (grid || isVertical) && up,
|
|
ArrowRight: (grid || isHorizontal) && store.first,
|
|
ArrowDown: (grid || isVertical) && store.first,
|
|
ArrowLeft: (grid || isHorizontal) && store.last,
|
|
Home: store.first,
|
|
End: store.last,
|
|
PageUp: store.first,
|
|
PageDown: store.last
|
|
};
|
|
const action = keyMap[event.key];
|
|
if (action) {
|
|
const id = action();
|
|
if (id !== void 0) {
|
|
if (!moveOnKeyPressProp(event)) return;
|
|
event.preventDefault();
|
|
store.move(id);
|
|
}
|
|
}
|
|
});
|
|
props = (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_3__/* .useWrapElement */ .w7)(
|
|
props,
|
|
(element) => /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_WENSINUV_js__WEBPACK_IMPORTED_MODULE_9__/* .CompositeContextProvider */ .ws, { value: store, children: element }),
|
|
[store]
|
|
);
|
|
const activeDescendant = store.useState((state) => {
|
|
var _a2;
|
|
if (!store) return;
|
|
if (!composite) return;
|
|
if (!state.virtualFocus) return;
|
|
return (_a2 = (0,_5VQZOHHZ_js__WEBPACK_IMPORTED_MODULE_5__/* .getEnabledItem */ .hZ)(store, state.activeId)) == null ? void 0 : _a2.id;
|
|
});
|
|
props = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_6__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_6__/* .__spreadValues */ .IA)({
|
|
"aria-activedescendant": activeDescendant
|
|
}, props), {
|
|
ref: (0,_Z32BISHQ_js__WEBPACK_IMPORTED_MODULE_3__/* .useMergeRefs */ .SV)(ref, setBaseElement, props.ref),
|
|
onKeyDownCapture,
|
|
onKeyUpCapture,
|
|
onFocusCapture,
|
|
onFocus,
|
|
onBlurCapture,
|
|
onKeyDown
|
|
});
|
|
const focusable = store.useState(
|
|
(state) => composite && (state.virtualFocus || state.activeId === null)
|
|
);
|
|
props = (0,_HGZKAGPL_js__WEBPACK_IMPORTED_MODULE_12__/* .useFocusable */ .W)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_6__/* .__spreadValues */ .IA)({ focusable }, props));
|
|
return props;
|
|
}
|
|
);
|
|
var Composite = (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_8__/* .forwardRef */ .Rf)(function Composite2(props) {
|
|
const htmlProps = useComposite(props);
|
|
return (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_8__/* .createElement */ .n)(TagName, htmlProps);
|
|
});
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/UVQLZ7T5.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
q: () => (/* binding */ useCompositeStore),
|
|
Y: () => (/* binding */ useCompositeStoreProps)
|
|
});
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/2GXGCHW6.js
|
|
var _2GXGCHW6 = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/2GXGCHW6.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/Z32BISHQ.js
|
|
var Z32BISHQ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/Z32BISHQ.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/TCAGH6BH.js
|
|
"use client";
|
|
|
|
|
|
|
|
// src/collection/collection-store.ts
|
|
|
|
function useCollectionStoreProps(store, update, props) {
|
|
(0,Z32BISHQ/* useUpdateEffect */.w5)(update, [props.store]);
|
|
(0,_2GXGCHW6/* useStoreProps */.Tz)(store, props, "items", "setItems");
|
|
return store;
|
|
}
|
|
function useCollectionStore(props = {}) {
|
|
const [store, update] = useStore(Core.createCollectionStore, props);
|
|
return useCollectionStoreProps(store, update, props);
|
|
}
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/D7EIQZAU.js
|
|
var D7EIQZAU = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/D7EIQZAU.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/UVQLZ7T5.js
|
|
"use client";
|
|
|
|
|
|
|
|
// src/composite/composite-store.ts
|
|
|
|
function useCompositeStoreProps(store, update, props) {
|
|
store = useCollectionStoreProps(store, update, props);
|
|
(0,_2GXGCHW6/* useStoreProps */.Tz)(store, props, "activeId", "setActiveId");
|
|
(0,_2GXGCHW6/* useStoreProps */.Tz)(store, props, "includesBaseElement");
|
|
(0,_2GXGCHW6/* useStoreProps */.Tz)(store, props, "virtualFocus");
|
|
(0,_2GXGCHW6/* useStoreProps */.Tz)(store, props, "orientation");
|
|
(0,_2GXGCHW6/* useStoreProps */.Tz)(store, props, "rtl");
|
|
(0,_2GXGCHW6/* useStoreProps */.Tz)(store, props, "focusLoop");
|
|
(0,_2GXGCHW6/* useStoreProps */.Tz)(store, props, "focusWrap");
|
|
(0,_2GXGCHW6/* useStoreProps */.Tz)(store, props, "focusShift");
|
|
return store;
|
|
}
|
|
function useCompositeStore(props = {}) {
|
|
const [store, update] = (0,_2GXGCHW6/* useStore */.Pj)(D7EIQZAU/* createCompositeStore */.z, props);
|
|
return useCompositeStoreProps(store, update, props);
|
|
}
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/WENSINUV.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ $o: () => (/* binding */ CompositeRowContext),
|
|
/* harmony export */ Lf: () => (/* binding */ useCompositeProviderContext),
|
|
/* harmony export */ U0: () => (/* binding */ CompositeItemContext),
|
|
/* harmony export */ aN: () => (/* binding */ CompositeScopedContextProvider),
|
|
/* harmony export */ k: () => (/* binding */ useCompositeContext),
|
|
/* harmony export */ ws: () => (/* binding */ CompositeContextProvider)
|
|
/* harmony export */ });
|
|
/* unused harmony export useCompositeScopedContext */
|
|
/* harmony import */ var _FMYQNSCK_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/FMYQNSCK.js");
|
|
/* harmony import */ var _HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HKOOKEDE.js");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
"use client";
|
|
|
|
|
|
|
|
// src/composite/composite-context.tsx
|
|
|
|
var ctx = (0,_HKOOKEDE_js__WEBPACK_IMPORTED_MODULE_1__/* .createStoreContext */ .B0)(
|
|
[_FMYQNSCK_js__WEBPACK_IMPORTED_MODULE_2__/* .CollectionContextProvider */ .LN],
|
|
[_FMYQNSCK_js__WEBPACK_IMPORTED_MODULE_2__/* .CollectionScopedContextProvider */ .zX]
|
|
);
|
|
var useCompositeContext = ctx.useContext;
|
|
var useCompositeScopedContext = ctx.useScopedContext;
|
|
var useCompositeProviderContext = ctx.useProviderContext;
|
|
var CompositeContextProvider = ctx.ContextProvider;
|
|
var CompositeScopedContextProvider = ctx.ScopedContextProvider;
|
|
var CompositeItemContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(
|
|
void 0
|
|
);
|
|
var CompositeRowContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(
|
|
void 0
|
|
);
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/XMDAT5SM.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ B: () => (/* binding */ useHovercardStoreProps)
|
|
/* harmony export */ });
|
|
/* unused harmony export useHovercardStore */
|
|
/* harmony import */ var _CBC47ZYL_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/CBC47ZYL.js");
|
|
/* harmony import */ var _2GXGCHW6_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/2GXGCHW6.js");
|
|
"use client";
|
|
|
|
|
|
|
|
// src/hovercard/hovercard-store.ts
|
|
|
|
function useHovercardStoreProps(store, update, props) {
|
|
(0,_2GXGCHW6_js__WEBPACK_IMPORTED_MODULE_0__/* .useStoreProps */ .Tz)(store, props, "timeout");
|
|
(0,_2GXGCHW6_js__WEBPACK_IMPORTED_MODULE_0__/* .useStoreProps */ .Tz)(store, props, "showTimeout");
|
|
(0,_2GXGCHW6_js__WEBPACK_IMPORTED_MODULE_0__/* .useStoreProps */ .Tz)(store, props, "hideTimeout");
|
|
return (0,_CBC47ZYL_js__WEBPACK_IMPORTED_MODULE_1__/* .usePopoverStoreProps */ .o)(store, update, props);
|
|
}
|
|
function useHovercardStore(props = {}) {
|
|
const [store, update] = useStore(Core.createHovercardStore, props);
|
|
return useHovercardStoreProps(store, update, props);
|
|
}
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/Z32BISHQ.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
var react__WEBPACK_IMPORTED_MODULE_0___namespace_cache;
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ Bi: () => (/* binding */ useId),
|
|
/* harmony export */ CH: () => (/* binding */ useForceUpdate),
|
|
/* harmony export */ Cy: () => (/* binding */ useAttribute),
|
|
/* harmony export */ Kp: () => (/* binding */ useUpdateLayoutEffect),
|
|
/* harmony export */ O4: () => (/* binding */ useBooleanEvent),
|
|
/* harmony export */ P$: () => (/* binding */ useIsMouseMoving),
|
|
/* harmony export */ P1: () => (/* binding */ useMetadataProps),
|
|
/* harmony export */ SV: () => (/* binding */ useMergeRefs),
|
|
/* harmony export */ TE: () => (/* binding */ usePortalRef),
|
|
/* harmony export */ UQ: () => (/* binding */ useSafeLayoutEffect),
|
|
/* harmony export */ XB: () => (/* binding */ useTransactionState),
|
|
/* harmony export */ _q: () => (/* binding */ useEvent),
|
|
/* harmony export */ hX: () => (/* binding */ useLiveRef),
|
|
/* harmony export */ nf: () => (/* binding */ useInitialValue),
|
|
/* harmony export */ vO: () => (/* binding */ useTagName),
|
|
/* harmony export */ w5: () => (/* binding */ useUpdateEffect),
|
|
/* harmony export */ w7: () => (/* binding */ useWrapElement)
|
|
/* harmony export */ });
|
|
/* unused harmony exports useLazyValue, usePreviousValue, useDeferredValue */
|
|
/* harmony import */ var _SK3NAZA3_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/SK3NAZA3.js");
|
|
/* harmony import */ var _3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js");
|
|
/* harmony import */ var _ariakit_core_utils_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/HWOIWM4O.js");
|
|
/* harmony import */ var _ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/utils/events.js");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
"use client";
|
|
|
|
|
|
|
|
// src/utils/hooks.ts
|
|
|
|
|
|
|
|
|
|
var _React = (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_1__/* .__spreadValues */ .IA)({}, /*#__PURE__*/ (react__WEBPACK_IMPORTED_MODULE_0___namespace_cache || (react__WEBPACK_IMPORTED_MODULE_0___namespace_cache = __webpack_require__.t(react__WEBPACK_IMPORTED_MODULE_0__, 2))));
|
|
var useReactId = _React.useId;
|
|
var useReactDeferredValue = _React.useDeferredValue;
|
|
var useReactInsertionEffect = _React.useInsertionEffect;
|
|
var useSafeLayoutEffect = _ariakit_core_utils_dom__WEBPACK_IMPORTED_MODULE_2__/* .canUseDOM */ .Sw ? react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect : react__WEBPACK_IMPORTED_MODULE_0__.useEffect;
|
|
function useInitialValue(value) {
|
|
const [initialValue] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(value);
|
|
return initialValue;
|
|
}
|
|
function useLazyValue(init) {
|
|
const ref = useRef();
|
|
if (ref.current === void 0) {
|
|
ref.current = init();
|
|
}
|
|
return ref.current;
|
|
}
|
|
function useLiveRef(value) {
|
|
const ref = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(value);
|
|
useSafeLayoutEffect(() => {
|
|
ref.current = value;
|
|
});
|
|
return ref;
|
|
}
|
|
function usePreviousValue(value) {
|
|
const [previousValue, setPreviousValue] = useState(value);
|
|
if (value !== previousValue) {
|
|
setPreviousValue(value);
|
|
}
|
|
return previousValue;
|
|
}
|
|
function useEvent(callback) {
|
|
const ref = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(() => {
|
|
throw new Error("Cannot call an event handler while rendering.");
|
|
});
|
|
if (useReactInsertionEffect) {
|
|
useReactInsertionEffect(() => {
|
|
ref.current = callback;
|
|
});
|
|
} else {
|
|
ref.current = callback;
|
|
}
|
|
return (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((...args) => {
|
|
var _a;
|
|
return (_a = ref.current) == null ? void 0 : _a.call(ref, ...args);
|
|
}, []);
|
|
}
|
|
function useTransactionState(callback) {
|
|
const [state, setState] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null);
|
|
useSafeLayoutEffect(() => {
|
|
if (state == null) return;
|
|
if (!callback) return;
|
|
let prevState = null;
|
|
callback((prev) => {
|
|
prevState = prev;
|
|
return state;
|
|
});
|
|
return () => {
|
|
callback(prevState);
|
|
};
|
|
}, [state, callback]);
|
|
return [state, setState];
|
|
}
|
|
function useMergeRefs(...refs) {
|
|
return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => {
|
|
if (!refs.some(Boolean)) return;
|
|
return (value) => {
|
|
for (const ref of refs) {
|
|
(0,_SK3NAZA3_js__WEBPACK_IMPORTED_MODULE_3__/* .setRef */ .cZ)(ref, value);
|
|
}
|
|
};
|
|
}, refs);
|
|
}
|
|
function useId(defaultId) {
|
|
if (useReactId) {
|
|
const reactId = useReactId();
|
|
if (defaultId) return defaultId;
|
|
return reactId;
|
|
}
|
|
const [id, setId] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(defaultId);
|
|
useSafeLayoutEffect(() => {
|
|
if (defaultId || id) return;
|
|
const random = Math.random().toString(36).substr(2, 6);
|
|
setId(`id-${random}`);
|
|
}, [defaultId, id]);
|
|
return defaultId || id;
|
|
}
|
|
function useDeferredValue(value) {
|
|
if (useReactDeferredValue) {
|
|
return useReactDeferredValue(value);
|
|
}
|
|
const [deferredValue, setDeferredValue] = useState(value);
|
|
useEffect(() => {
|
|
const raf = requestAnimationFrame(() => setDeferredValue(value));
|
|
return () => cancelAnimationFrame(raf);
|
|
}, [value]);
|
|
return deferredValue;
|
|
}
|
|
function useTagName(refOrElement, type) {
|
|
const stringOrUndefined = (type2) => {
|
|
if (typeof type2 !== "string") return;
|
|
return type2;
|
|
};
|
|
const [tagName, setTagName] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(() => stringOrUndefined(type));
|
|
useSafeLayoutEffect(() => {
|
|
const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement;
|
|
setTagName((element == null ? void 0 : element.tagName.toLowerCase()) || stringOrUndefined(type));
|
|
}, [refOrElement, type]);
|
|
return tagName;
|
|
}
|
|
function useAttribute(refOrElement, attributeName, defaultValue) {
|
|
const [attribute, setAttribute] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(defaultValue);
|
|
useSafeLayoutEffect(() => {
|
|
const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement;
|
|
if (!element) return;
|
|
const callback = () => {
|
|
const value = element.getAttribute(attributeName);
|
|
if (value == null) return;
|
|
setAttribute(value);
|
|
};
|
|
const observer = new MutationObserver(callback);
|
|
observer.observe(element, { attributeFilter: [attributeName] });
|
|
callback();
|
|
return () => observer.disconnect();
|
|
}, [refOrElement, attributeName]);
|
|
return attribute;
|
|
}
|
|
function useUpdateEffect(effect, deps) {
|
|
const mounted = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(false);
|
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
if (mounted.current) {
|
|
return effect();
|
|
}
|
|
mounted.current = true;
|
|
}, deps);
|
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(
|
|
() => () => {
|
|
mounted.current = false;
|
|
},
|
|
[]
|
|
);
|
|
}
|
|
function useUpdateLayoutEffect(effect, deps) {
|
|
const mounted = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(false);
|
|
useSafeLayoutEffect(() => {
|
|
if (mounted.current) {
|
|
return effect();
|
|
}
|
|
mounted.current = true;
|
|
}, deps);
|
|
useSafeLayoutEffect(
|
|
() => () => {
|
|
mounted.current = false;
|
|
},
|
|
[]
|
|
);
|
|
}
|
|
function useForceUpdate() {
|
|
return (0,react__WEBPACK_IMPORTED_MODULE_0__.useReducer)(() => [], []);
|
|
}
|
|
function useBooleanEvent(booleanOrCallback) {
|
|
return useEvent(
|
|
typeof booleanOrCallback === "function" ? booleanOrCallback : () => booleanOrCallback
|
|
);
|
|
}
|
|
function useWrapElement(props, callback, deps = []) {
|
|
const wrapElement = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(
|
|
(element) => {
|
|
if (props.wrapElement) {
|
|
element = props.wrapElement(element);
|
|
}
|
|
return callback(element);
|
|
},
|
|
[...deps, props.wrapElement]
|
|
);
|
|
return (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_1__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_1__/* .__spreadValues */ .IA)({}, props), { wrapElement });
|
|
}
|
|
function usePortalRef(portalProp = false, portalRefProp) {
|
|
const [portalNode, setPortalNode] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null);
|
|
const portalRef = useMergeRefs(setPortalNode, portalRefProp);
|
|
const domReady = !portalProp || portalNode;
|
|
return { portalRef, portalNode, domReady };
|
|
}
|
|
function useMetadataProps(props, key, value) {
|
|
const parent = props.onLoadedMetadataCapture;
|
|
const onLoadedMetadataCapture = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => {
|
|
return Object.assign(() => {
|
|
}, (0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_1__/* .__spreadProps */ .ko)((0,_3YLGPPWQ_js__WEBPACK_IMPORTED_MODULE_1__/* .__spreadValues */ .IA)({}, parent), { [key]: value }));
|
|
}, [parent, key, value]);
|
|
return [parent == null ? void 0 : parent[key], { onLoadedMetadataCapture }];
|
|
}
|
|
function useIsMouseMoving() {
|
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
(0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_4__/* .addGlobalEventListener */ .dg)("mousemove", setMouseMoving, true);
|
|
(0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_4__/* .addGlobalEventListener */ .dg)("mousedown", resetMouseMoving, true);
|
|
(0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_4__/* .addGlobalEventListener */ .dg)("mouseup", resetMouseMoving, true);
|
|
(0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_4__/* .addGlobalEventListener */ .dg)("keydown", resetMouseMoving, true);
|
|
(0,_ariakit_core_utils_events__WEBPACK_IMPORTED_MODULE_4__/* .addGlobalEventListener */ .dg)("scroll", resetMouseMoving, true);
|
|
}, []);
|
|
const isMouseMoving = useEvent(() => mouseMoving);
|
|
return isMouseMoving;
|
|
}
|
|
var mouseMoving = false;
|
|
var previousScreenX = 0;
|
|
var previousScreenY = 0;
|
|
function hasMouseMovement(event) {
|
|
const movementX = event.movementX || event.screenX - previousScreenX;
|
|
const movementY = event.movementY || event.screenY - previousScreenY;
|
|
previousScreenX = event.screenX;
|
|
previousScreenY = event.screenY;
|
|
return movementX || movementY || "production" === "test";
|
|
}
|
|
function setMouseMoving(event) {
|
|
if (!hasMouseMovement(event)) return;
|
|
mouseMoving = true;
|
|
}
|
|
function resetMouseMoving() {
|
|
mouseMoving = false;
|
|
}
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@babel+runtime@7.25.0/node_modules/@babel/runtime/helpers/esm/extends.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (/* binding */ _extends)
|
|
/* harmony export */ });
|
|
function _extends() {
|
|
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
for (var e = 1; e < arguments.length; e++) {
|
|
var t = arguments[e];
|
|
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
}
|
|
return n;
|
|
}, _extends.apply(null, arguments);
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@emotion+css@11.11.2/node_modules/@emotion/css/dist/emotion-css.esm.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
cx: () => (/* binding */ cx)
|
|
});
|
|
|
|
// UNUSED EXPORTS: cache, css, flush, getRegisteredStyles, hydrate, injectGlobal, keyframes, merge, sheet
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@emotion+cache@11.11.0/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js + 7 modules
|
|
var emotion_cache_browser_esm = __webpack_require__("../../node_modules/.pnpm/@emotion+cache@11.11.0/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@emotion+serialize@1.1.2/node_modules/@emotion/serialize/dist/emotion-serialize.browser.esm.js + 2 modules
|
|
var emotion_serialize_browser_esm = __webpack_require__("../../node_modules/.pnpm/@emotion+serialize@1.1.2/node_modules/@emotion/serialize/dist/emotion-serialize.browser.esm.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@emotion+utils@1.2.1/node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js
|
|
var emotion_utils_browser_esm = __webpack_require__("../../node_modules/.pnpm/@emotion+utils@1.2.1/node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@emotion+css@11.11.2/node_modules/@emotion/css/create-instance/dist/emotion-css-create-instance.esm.js
|
|
|
|
|
|
|
|
|
|
function insertWithoutScoping(cache, serialized) {
|
|
if (cache.inserted[serialized.name] === undefined) {
|
|
return cache.insert('', serialized, cache.sheet, true);
|
|
}
|
|
}
|
|
|
|
function merge(registered, css, className) {
|
|
var registeredStyles = [];
|
|
var rawClassName = (0,emotion_utils_browser_esm/* getRegisteredStyles */.Rk)(registered, registeredStyles, className);
|
|
|
|
if (registeredStyles.length < 2) {
|
|
return className;
|
|
}
|
|
|
|
return rawClassName + css(registeredStyles);
|
|
}
|
|
|
|
var createEmotion = function createEmotion(options) {
|
|
var cache = (0,emotion_cache_browser_esm/* default */.A)(options); // $FlowFixMe
|
|
|
|
cache.sheet.speedy = function (value) {
|
|
if (false) {}
|
|
|
|
this.isSpeedy = value;
|
|
};
|
|
|
|
cache.compat = true;
|
|
|
|
var css = function css() {
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
args[_key] = arguments[_key];
|
|
}
|
|
|
|
var serialized = (0,emotion_serialize_browser_esm/* serializeStyles */.J)(args, cache.registered, undefined);
|
|
(0,emotion_utils_browser_esm/* insertStyles */.sk)(cache, serialized, false);
|
|
return cache.key + "-" + serialized.name;
|
|
};
|
|
|
|
var keyframes = function keyframes() {
|
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
args[_key2] = arguments[_key2];
|
|
}
|
|
|
|
var serialized = (0,emotion_serialize_browser_esm/* serializeStyles */.J)(args, cache.registered);
|
|
var animation = "animation-" + serialized.name;
|
|
insertWithoutScoping(cache, {
|
|
name: serialized.name,
|
|
styles: "@keyframes " + animation + "{" + serialized.styles + "}"
|
|
});
|
|
return animation;
|
|
};
|
|
|
|
var injectGlobal = function injectGlobal() {
|
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
args[_key3] = arguments[_key3];
|
|
}
|
|
|
|
var serialized = (0,emotion_serialize_browser_esm/* serializeStyles */.J)(args, cache.registered);
|
|
insertWithoutScoping(cache, serialized);
|
|
};
|
|
|
|
var cx = function cx() {
|
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
args[_key4] = arguments[_key4];
|
|
}
|
|
|
|
return merge(cache.registered, css, classnames(args));
|
|
};
|
|
|
|
return {
|
|
css: css,
|
|
cx: cx,
|
|
injectGlobal: injectGlobal,
|
|
keyframes: keyframes,
|
|
hydrate: function hydrate(ids) {
|
|
ids.forEach(function (key) {
|
|
cache.inserted[key] = true;
|
|
});
|
|
},
|
|
flush: function flush() {
|
|
cache.registered = {};
|
|
cache.inserted = {};
|
|
cache.sheet.flush();
|
|
},
|
|
// $FlowFixMe
|
|
sheet: cache.sheet,
|
|
cache: cache,
|
|
getRegisteredStyles: emotion_utils_browser_esm/* getRegisteredStyles */.Rk.bind(null, cache.registered),
|
|
merge: merge.bind(null, cache.registered, css)
|
|
};
|
|
};
|
|
|
|
var classnames = function classnames(args) {
|
|
var cls = '';
|
|
|
|
for (var i = 0; i < args.length; i++) {
|
|
var arg = args[i];
|
|
if (arg == null) continue;
|
|
var toAdd = void 0;
|
|
|
|
switch (typeof arg) {
|
|
case 'boolean':
|
|
break;
|
|
|
|
case 'object':
|
|
{
|
|
if (Array.isArray(arg)) {
|
|
toAdd = classnames(arg);
|
|
} else {
|
|
toAdd = '';
|
|
|
|
for (var k in arg) {
|
|
if (arg[k] && k) {
|
|
toAdd && (toAdd += ' ');
|
|
toAdd += k;
|
|
}
|
|
}
|
|
}
|
|
|
|
break;
|
|
}
|
|
|
|
default:
|
|
{
|
|
toAdd = arg;
|
|
}
|
|
}
|
|
|
|
if (toAdd) {
|
|
cls && (cls += ' ');
|
|
cls += toAdd;
|
|
}
|
|
}
|
|
|
|
return cls;
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@emotion+css@11.11.2/node_modules/@emotion/css/dist/emotion-css.esm.js
|
|
|
|
|
|
|
|
|
|
|
|
var _createEmotion = createEmotion({
|
|
key: 'css'
|
|
}),
|
|
flush = _createEmotion.flush,
|
|
hydrate = _createEmotion.hydrate,
|
|
cx = _createEmotion.cx,
|
|
emotion_css_esm_merge = _createEmotion.merge,
|
|
getRegisteredStyles = _createEmotion.getRegisteredStyles,
|
|
injectGlobal = _createEmotion.injectGlobal,
|
|
keyframes = _createEmotion.keyframes,
|
|
css = _createEmotion.css,
|
|
sheet = _createEmotion.sheet,
|
|
cache = _createEmotion.cache;
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@emotion+is-prop-valid@1.2.1/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (/* binding */ isPropValid)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _emotion_memoize__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@emotion+memoize@0.8.1/node_modules/@emotion/memoize/dist/emotion-memoize.esm.js");
|
|
|
|
|
|
var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23
|
|
|
|
var isPropValid = /* #__PURE__ */(0,_emotion_memoize__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)(function (prop) {
|
|
return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111
|
|
/* o */
|
|
&& prop.charCodeAt(1) === 110
|
|
/* n */
|
|
&& prop.charCodeAt(2) < 91;
|
|
}
|
|
/* Z+1 */
|
|
);
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2/node_modules/@emotion/react/dist/emotion-react.browser.esm.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ AH: () => (/* binding */ css),
|
|
/* harmony export */ i7: () => (/* binding */ keyframes)
|
|
/* harmony export */ });
|
|
/* unused harmony exports ClassNames, Global, createElement, jsx */
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
/* harmony import */ var _emotion_use_insertion_effect_with_fallbacks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@emotion+use-insertion-effect-with-fallbacks@1.0.1_react@17.0.2/node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js");
|
|
/* harmony import */ var _emotion_serialize__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@emotion+serialize@1.1.2/node_modules/@emotion/serialize/dist/emotion-serialize.browser.esm.js");
|
|
/* harmony import */ var _emotion_cache__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/.pnpm/@emotion+cache@11.11.0/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js");
|
|
/* harmony import */ var hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("../../node_modules/.pnpm/hoist-non-react-statics@3.3.2/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js");
|
|
/* harmony import */ var hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_4__);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var pkg = {
|
|
name: "@emotion/react",
|
|
version: "11.11.1",
|
|
main: "dist/emotion-react.cjs.js",
|
|
module: "dist/emotion-react.esm.js",
|
|
browser: {
|
|
"./dist/emotion-react.esm.js": "./dist/emotion-react.browser.esm.js"
|
|
},
|
|
exports: {
|
|
".": {
|
|
module: {
|
|
worker: "./dist/emotion-react.worker.esm.js",
|
|
browser: "./dist/emotion-react.browser.esm.js",
|
|
"default": "./dist/emotion-react.esm.js"
|
|
},
|
|
"import": "./dist/emotion-react.cjs.mjs",
|
|
"default": "./dist/emotion-react.cjs.js"
|
|
},
|
|
"./jsx-runtime": {
|
|
module: {
|
|
worker: "./jsx-runtime/dist/emotion-react-jsx-runtime.worker.esm.js",
|
|
browser: "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js",
|
|
"default": "./jsx-runtime/dist/emotion-react-jsx-runtime.esm.js"
|
|
},
|
|
"import": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.mjs",
|
|
"default": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.js"
|
|
},
|
|
"./_isolated-hnrs": {
|
|
module: {
|
|
worker: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.worker.esm.js",
|
|
browser: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.esm.js",
|
|
"default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.esm.js"
|
|
},
|
|
"import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.mjs",
|
|
"default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.js"
|
|
},
|
|
"./jsx-dev-runtime": {
|
|
module: {
|
|
worker: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.worker.esm.js",
|
|
browser: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.esm.js",
|
|
"default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.esm.js"
|
|
},
|
|
"import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.mjs",
|
|
"default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.js"
|
|
},
|
|
"./package.json": "./package.json",
|
|
"./types/css-prop": "./types/css-prop.d.ts",
|
|
"./macro": {
|
|
types: {
|
|
"import": "./macro.d.mts",
|
|
"default": "./macro.d.ts"
|
|
},
|
|
"default": "./macro.js"
|
|
}
|
|
},
|
|
types: "types/index.d.ts",
|
|
files: [
|
|
"src",
|
|
"dist",
|
|
"jsx-runtime",
|
|
"jsx-dev-runtime",
|
|
"_isolated-hnrs",
|
|
"types/*.d.ts",
|
|
"macro.*"
|
|
],
|
|
sideEffects: false,
|
|
author: "Emotion Contributors",
|
|
license: "MIT",
|
|
scripts: {
|
|
"test:typescript": "dtslint types"
|
|
},
|
|
dependencies: {
|
|
"@babel/runtime": "^7.18.3",
|
|
"@emotion/babel-plugin": "^11.11.0",
|
|
"@emotion/cache": "^11.11.0",
|
|
"@emotion/serialize": "^1.1.2",
|
|
"@emotion/use-insertion-effect-with-fallbacks": "^1.0.1",
|
|
"@emotion/utils": "^1.2.1",
|
|
"@emotion/weak-memoize": "^0.3.1",
|
|
"hoist-non-react-statics": "^3.3.1"
|
|
},
|
|
peerDependencies: {
|
|
react: ">=16.8.0"
|
|
},
|
|
peerDependenciesMeta: {
|
|
"@types/react": {
|
|
optional: true
|
|
}
|
|
},
|
|
devDependencies: {
|
|
"@definitelytyped/dtslint": "0.0.112",
|
|
"@emotion/css": "11.11.0",
|
|
"@emotion/css-prettifier": "1.1.3",
|
|
"@emotion/server": "11.11.0",
|
|
"@emotion/styled": "11.11.0",
|
|
"html-tag-names": "^1.1.2",
|
|
react: "16.14.0",
|
|
"svg-tag-names": "^1.1.1",
|
|
typescript: "^4.5.5"
|
|
},
|
|
repository: "https://github.com/emotion-js/emotion/tree/main/packages/react",
|
|
publishConfig: {
|
|
access: "public"
|
|
},
|
|
"umd:main": "dist/emotion-react.umd.min.js",
|
|
preconstruct: {
|
|
entrypoints: [
|
|
"./index.js",
|
|
"./jsx-runtime.js",
|
|
"./jsx-dev-runtime.js",
|
|
"./_isolated-hnrs.js"
|
|
],
|
|
umdName: "emotionReact",
|
|
exports: {
|
|
envConditions: [
|
|
"browser",
|
|
"worker"
|
|
],
|
|
extra: {
|
|
"./types/css-prop": "./types/css-prop.d.ts",
|
|
"./macro": {
|
|
types: {
|
|
"import": "./macro.d.mts",
|
|
"default": "./macro.d.ts"
|
|
},
|
|
"default": "./macro.js"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
var jsx = function jsx(type, props) {
|
|
var args = arguments;
|
|
|
|
if (props == null || !hasOwnProperty.call(props, 'css')) {
|
|
// $FlowFixMe
|
|
return React.createElement.apply(undefined, args);
|
|
}
|
|
|
|
var argsLength = args.length;
|
|
var createElementArgArray = new Array(argsLength);
|
|
createElementArgArray[0] = Emotion;
|
|
createElementArgArray[1] = createEmotionProps(type, props);
|
|
|
|
for (var i = 2; i < argsLength; i++) {
|
|
createElementArgArray[i] = args[i];
|
|
} // $FlowFixMe
|
|
|
|
|
|
return React.createElement.apply(null, createElementArgArray);
|
|
};
|
|
|
|
var warnedAboutCssPropForGlobal = false; // maintain place over rerenders.
|
|
// initial render from browser, insertBefore context.sheet.tags[0] or if a style hasn't been inserted there yet, appendChild
|
|
// initial client-side render from SSR, use place of hydrating tag
|
|
|
|
var Global = /* #__PURE__ */(/* unused pure expression or super */ null && (withEmotionCache(function (props, cache) {
|
|
if (false) {}
|
|
|
|
var styles = props.styles;
|
|
var serialized = serializeStyles([styles], undefined, React.useContext(ThemeContext));
|
|
|
|
if (!isBrowser$1) {
|
|
var _ref;
|
|
|
|
var serializedNames = serialized.name;
|
|
var serializedStyles = serialized.styles;
|
|
var next = serialized.next;
|
|
|
|
while (next !== undefined) {
|
|
serializedNames += ' ' + next.name;
|
|
serializedStyles += next.styles;
|
|
next = next.next;
|
|
}
|
|
|
|
var shouldCache = cache.compat === true;
|
|
var rules = cache.insert("", {
|
|
name: serializedNames,
|
|
styles: serializedStyles
|
|
}, cache.sheet, shouldCache);
|
|
|
|
if (shouldCache) {
|
|
return null;
|
|
}
|
|
|
|
return /*#__PURE__*/React.createElement("style", (_ref = {}, _ref["data-emotion"] = cache.key + "-global " + serializedNames, _ref.dangerouslySetInnerHTML = {
|
|
__html: rules
|
|
}, _ref.nonce = cache.sheet.nonce, _ref));
|
|
} // yes, i know these hooks are used conditionally
|
|
// but it is based on a constant that will never change at runtime
|
|
// it's effectively like having two implementations and switching them out
|
|
// so it's not actually breaking anything
|
|
|
|
|
|
var sheetRef = React.useRef();
|
|
useInsertionEffectWithLayoutFallback(function () {
|
|
var key = cache.key + "-global"; // use case of https://github.com/emotion-js/emotion/issues/2675
|
|
|
|
var sheet = new cache.sheet.constructor({
|
|
key: key,
|
|
nonce: cache.sheet.nonce,
|
|
container: cache.sheet.container,
|
|
speedy: cache.sheet.isSpeedy
|
|
});
|
|
var rehydrating = false; // $FlowFixMe
|
|
|
|
var node = document.querySelector("style[data-emotion=\"" + key + " " + serialized.name + "\"]");
|
|
|
|
if (cache.sheet.tags.length) {
|
|
sheet.before = cache.sheet.tags[0];
|
|
}
|
|
|
|
if (node !== null) {
|
|
rehydrating = true; // clear the hash so this node won't be recognizable as rehydratable by other <Global/>s
|
|
|
|
node.setAttribute('data-emotion', key);
|
|
sheet.hydrate([node]);
|
|
}
|
|
|
|
sheetRef.current = [sheet, rehydrating];
|
|
return function () {
|
|
sheet.flush();
|
|
};
|
|
}, [cache]);
|
|
useInsertionEffectWithLayoutFallback(function () {
|
|
var sheetRefCurrent = sheetRef.current;
|
|
var sheet = sheetRefCurrent[0],
|
|
rehydrating = sheetRefCurrent[1];
|
|
|
|
if (rehydrating) {
|
|
sheetRefCurrent[1] = false;
|
|
return;
|
|
}
|
|
|
|
if (serialized.next !== undefined) {
|
|
// insert keyframes
|
|
insertStyles(cache, serialized.next, true);
|
|
}
|
|
|
|
if (sheet.tags.length) {
|
|
// if this doesn't exist then it will be null so the style element will be appended
|
|
var element = sheet.tags[sheet.tags.length - 1].nextElementSibling;
|
|
sheet.before = element;
|
|
sheet.flush();
|
|
}
|
|
|
|
cache.insert("", serialized, sheet, false);
|
|
}, [cache, serialized.name]);
|
|
return null;
|
|
})));
|
|
|
|
if (false) {}
|
|
|
|
function css() {
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
args[_key] = arguments[_key];
|
|
}
|
|
|
|
return (0,_emotion_serialize__WEBPACK_IMPORTED_MODULE_2__/* .serializeStyles */ .J)(args);
|
|
}
|
|
|
|
var keyframes = function keyframes() {
|
|
var insertable = css.apply(void 0, arguments);
|
|
var name = "animation-" + insertable.name; // $FlowFixMe
|
|
|
|
return {
|
|
name: name,
|
|
styles: "@keyframes " + name + "{" + insertable.styles + "}",
|
|
anim: 1,
|
|
toString: function toString() {
|
|
return "_EMO_" + this.name + "_" + this.styles + "_EMO_";
|
|
}
|
|
};
|
|
};
|
|
|
|
var classnames = function classnames(args) {
|
|
var len = args.length;
|
|
var i = 0;
|
|
var cls = '';
|
|
|
|
for (; i < len; i++) {
|
|
var arg = args[i];
|
|
if (arg == null) continue;
|
|
var toAdd = void 0;
|
|
|
|
switch (typeof arg) {
|
|
case 'boolean':
|
|
break;
|
|
|
|
case 'object':
|
|
{
|
|
if (Array.isArray(arg)) {
|
|
toAdd = classnames(arg);
|
|
} else {
|
|
if (false) {}
|
|
|
|
toAdd = '';
|
|
|
|
for (var k in arg) {
|
|
if (arg[k] && k) {
|
|
toAdd && (toAdd += ' ');
|
|
toAdd += k;
|
|
}
|
|
}
|
|
}
|
|
|
|
break;
|
|
}
|
|
|
|
default:
|
|
{
|
|
toAdd = arg;
|
|
}
|
|
}
|
|
|
|
if (toAdd) {
|
|
cls && (cls += ' ');
|
|
cls += toAdd;
|
|
}
|
|
}
|
|
|
|
return cls;
|
|
};
|
|
|
|
function merge(registered, css, className) {
|
|
var registeredStyles = [];
|
|
var rawClassName = getRegisteredStyles(registered, registeredStyles, className);
|
|
|
|
if (registeredStyles.length < 2) {
|
|
return className;
|
|
}
|
|
|
|
return rawClassName + css(registeredStyles);
|
|
}
|
|
|
|
var Insertion = function Insertion(_ref) {
|
|
var cache = _ref.cache,
|
|
serializedArr = _ref.serializedArr;
|
|
useInsertionEffectAlwaysWithSyncFallback(function () {
|
|
|
|
for (var i = 0; i < serializedArr.length; i++) {
|
|
insertStyles(cache, serializedArr[i], false);
|
|
}
|
|
});
|
|
|
|
return null;
|
|
};
|
|
|
|
var ClassNames = /* #__PURE__ */(/* unused pure expression or super */ null && (withEmotionCache(function (props, cache) {
|
|
var hasRendered = false;
|
|
var serializedArr = [];
|
|
|
|
var css = function css() {
|
|
if (hasRendered && "production" !== 'production') {}
|
|
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
args[_key] = arguments[_key];
|
|
}
|
|
|
|
var serialized = serializeStyles(args, cache.registered);
|
|
serializedArr.push(serialized); // registration has to happen here as the result of this might get consumed by `cx`
|
|
|
|
registerStyles(cache, serialized, false);
|
|
return cache.key + "-" + serialized.name;
|
|
};
|
|
|
|
var cx = function cx() {
|
|
if (hasRendered && "production" !== 'production') {}
|
|
|
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
args[_key2] = arguments[_key2];
|
|
}
|
|
|
|
return merge(cache.registered, css, classnames(args));
|
|
};
|
|
|
|
var content = {
|
|
css: css,
|
|
cx: cx,
|
|
theme: React.useContext(ThemeContext)
|
|
};
|
|
var ele = props.children(content);
|
|
hasRendered = true;
|
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Insertion, {
|
|
cache: cache,
|
|
serializedArr: serializedArr
|
|
}), ele);
|
|
})));
|
|
|
|
if (false) {}
|
|
|
|
if (false) { var globalKey, globalContext, isTestEnv, isBrowser; }
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@emotion+styled@11.11.0_@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2__@types+react@17.0.71_react@17.0.2/node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (/* binding */ createStyled)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.25.0/node_modules/@babel/runtime/helpers/esm/extends.js");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
/* harmony import */ var _emotion_is_prop_valid__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/.pnpm/@emotion+is-prop-valid@1.2.1/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js");
|
|
/* harmony import */ var _emotion_react__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("../../node_modules/.pnpm/@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2/node_modules/@emotion/react/dist/emotion-element-c39617d8.browser.esm.js");
|
|
/* harmony import */ var _emotion_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("../../node_modules/.pnpm/@emotion+utils@1.2.1/node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js");
|
|
/* harmony import */ var _emotion_serialize__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@emotion+serialize@1.1.2/node_modules/@emotion/serialize/dist/emotion-serialize.browser.esm.js");
|
|
/* harmony import */ var _emotion_use_insertion_effect_with_fallbacks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@emotion+use-insertion-effect-with-fallbacks@1.0.1_react@17.0.2/node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var testOmitPropsOnStringTag = _emotion_is_prop_valid__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A;
|
|
|
|
var testOmitPropsOnComponent = function testOmitPropsOnComponent(key) {
|
|
return key !== 'theme';
|
|
};
|
|
|
|
var getDefaultShouldForwardProp = function getDefaultShouldForwardProp(tag) {
|
|
return typeof tag === 'string' && // 96 is one less than the char code
|
|
// for "a" so this is checking that
|
|
// it's a lowercase character
|
|
tag.charCodeAt(0) > 96 ? testOmitPropsOnStringTag : testOmitPropsOnComponent;
|
|
};
|
|
var composeShouldForwardProps = function composeShouldForwardProps(tag, options, isReal) {
|
|
var shouldForwardProp;
|
|
|
|
if (options) {
|
|
var optionsShouldForwardProp = options.shouldForwardProp;
|
|
shouldForwardProp = tag.__emotion_forwardProp && optionsShouldForwardProp ? function (propName) {
|
|
return tag.__emotion_forwardProp(propName) && optionsShouldForwardProp(propName);
|
|
} : optionsShouldForwardProp;
|
|
}
|
|
|
|
if (typeof shouldForwardProp !== 'function' && isReal) {
|
|
shouldForwardProp = tag.__emotion_forwardProp;
|
|
}
|
|
|
|
return shouldForwardProp;
|
|
};
|
|
|
|
var ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences";
|
|
|
|
var Insertion = function Insertion(_ref) {
|
|
var cache = _ref.cache,
|
|
serialized = _ref.serialized,
|
|
isStringTag = _ref.isStringTag;
|
|
(0,_emotion_utils__WEBPACK_IMPORTED_MODULE_4__/* .registerStyles */ .SF)(cache, serialized, isStringTag);
|
|
(0,_emotion_use_insertion_effect_with_fallbacks__WEBPACK_IMPORTED_MODULE_2__/* .useInsertionEffectAlwaysWithSyncFallback */ .s)(function () {
|
|
return (0,_emotion_utils__WEBPACK_IMPORTED_MODULE_4__/* .insertStyles */ .sk)(cache, serialized, isStringTag);
|
|
});
|
|
|
|
return null;
|
|
};
|
|
|
|
var createStyled = function createStyled(tag, options) {
|
|
if (false) {}
|
|
|
|
var isReal = tag.__emotion_real === tag;
|
|
var baseTag = isReal && tag.__emotion_base || tag;
|
|
var identifierName;
|
|
var targetClassName;
|
|
|
|
if (options !== undefined) {
|
|
identifierName = options.label;
|
|
targetClassName = options.target;
|
|
}
|
|
|
|
var shouldForwardProp = composeShouldForwardProps(tag, options, isReal);
|
|
var defaultShouldForwardProp = shouldForwardProp || getDefaultShouldForwardProp(baseTag);
|
|
var shouldUseAs = !defaultShouldForwardProp('as');
|
|
return function () {
|
|
var args = arguments;
|
|
var styles = isReal && tag.__emotion_styles !== undefined ? tag.__emotion_styles.slice(0) : [];
|
|
|
|
if (identifierName !== undefined) {
|
|
styles.push("label:" + identifierName + ";");
|
|
}
|
|
|
|
if (args[0] == null || args[0].raw === undefined) {
|
|
styles.push.apply(styles, args);
|
|
} else {
|
|
if (false) {}
|
|
|
|
styles.push(args[0][0]);
|
|
var len = args.length;
|
|
var i = 1;
|
|
|
|
for (; i < len; i++) {
|
|
if (false) {}
|
|
|
|
styles.push(args[i], args[0][i]);
|
|
}
|
|
} // $FlowFixMe: we need to cast StatelessFunctionalComponent to our PrivateStyledComponent class
|
|
|
|
|
|
var Styled = (0,_emotion_react__WEBPACK_IMPORTED_MODULE_5__.w)(function (props, cache, ref) {
|
|
var FinalTag = shouldUseAs && props.as || baseTag;
|
|
var className = '';
|
|
var classInterpolations = [];
|
|
var mergedProps = props;
|
|
|
|
if (props.theme == null) {
|
|
mergedProps = {};
|
|
|
|
for (var key in props) {
|
|
mergedProps[key] = props[key];
|
|
}
|
|
|
|
mergedProps.theme = react__WEBPACK_IMPORTED_MODULE_0__.useContext(_emotion_react__WEBPACK_IMPORTED_MODULE_5__.T);
|
|
}
|
|
|
|
if (typeof props.className === 'string') {
|
|
className = (0,_emotion_utils__WEBPACK_IMPORTED_MODULE_4__/* .getRegisteredStyles */ .Rk)(cache.registered, classInterpolations, props.className);
|
|
} else if (props.className != null) {
|
|
className = props.className + " ";
|
|
}
|
|
|
|
var serialized = (0,_emotion_serialize__WEBPACK_IMPORTED_MODULE_1__/* .serializeStyles */ .J)(styles.concat(classInterpolations), cache.registered, mergedProps);
|
|
className += cache.key + "-" + serialized.name;
|
|
|
|
if (targetClassName !== undefined) {
|
|
className += " " + targetClassName;
|
|
}
|
|
|
|
var finalShouldForwardProp = shouldUseAs && shouldForwardProp === undefined ? getDefaultShouldForwardProp(FinalTag) : defaultShouldForwardProp;
|
|
var newProps = {};
|
|
|
|
for (var _key in props) {
|
|
if (shouldUseAs && _key === 'as') continue;
|
|
|
|
if ( // $FlowFixMe
|
|
finalShouldForwardProp(_key)) {
|
|
newProps[_key] = props[_key];
|
|
}
|
|
}
|
|
|
|
newProps.className = className;
|
|
newProps.ref = ref;
|
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Insertion, {
|
|
cache: cache,
|
|
serialized: serialized,
|
|
isStringTag: typeof FinalTag === 'string'
|
|
}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(FinalTag, newProps));
|
|
});
|
|
Styled.displayName = identifierName !== undefined ? identifierName : "Styled(" + (typeof baseTag === 'string' ? baseTag : baseTag.displayName || baseTag.name || 'Component') + ")";
|
|
Styled.defaultProps = tag.defaultProps;
|
|
Styled.__emotion_real = Styled;
|
|
Styled.__emotion_base = baseTag;
|
|
Styled.__emotion_styles = styles;
|
|
Styled.__emotion_forwardProp = shouldForwardProp;
|
|
Object.defineProperty(Styled, 'toString', {
|
|
value: function value() {
|
|
if (targetClassName === undefined && "production" !== 'production') {} // $FlowFixMe: coerce undefined to string
|
|
|
|
|
|
return "." + targetClassName;
|
|
}
|
|
});
|
|
|
|
Styled.withComponent = function (nextTag, nextOptions) {
|
|
return createStyled(nextTag, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .A)({}, options, nextOptions, {
|
|
shouldForwardProp: composeShouldForwardProps(Styled, nextOptions, true)
|
|
})).apply(void 0, styles);
|
|
};
|
|
|
|
return Styled;
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@emotion+utils@1.2.1/node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ Rk: () => (/* binding */ getRegisteredStyles),
|
|
/* harmony export */ SF: () => (/* binding */ registerStyles),
|
|
/* harmony export */ sk: () => (/* binding */ insertStyles)
|
|
/* harmony export */ });
|
|
var isBrowser = "object" !== 'undefined';
|
|
function getRegisteredStyles(registered, registeredStyles, classNames) {
|
|
var rawClassName = '';
|
|
classNames.split(' ').forEach(function (className) {
|
|
if (registered[className] !== undefined) {
|
|
registeredStyles.push(registered[className] + ";");
|
|
} else {
|
|
rawClassName += className + " ";
|
|
}
|
|
});
|
|
return rawClassName;
|
|
}
|
|
var registerStyles = function registerStyles(cache, serialized, isStringTag) {
|
|
var className = cache.key + "-" + serialized.name;
|
|
|
|
if ( // we only need to add the styles to the registered cache if the
|
|
// class name could be used further down
|
|
// the tree but if it's a string tag, we know it won't
|
|
// so we don't have to add it to registered cache.
|
|
// this improves memory usage since we can avoid storing the whole style string
|
|
(isStringTag === false || // we need to always store it if we're in compat mode and
|
|
// in node since emotion-server relies on whether a style is in
|
|
// the registered cache to know whether a style is global or not
|
|
// also, note that this check will be dead code eliminated in the browser
|
|
isBrowser === false ) && cache.registered[className] === undefined) {
|
|
cache.registered[className] = serialized.styles;
|
|
}
|
|
};
|
|
var insertStyles = function insertStyles(cache, serialized, isStringTag) {
|
|
registerStyles(cache, serialized, isStringTag);
|
|
var className = cache.key + "-" + serialized.name;
|
|
|
|
if (cache.inserted[serialized.name] === undefined) {
|
|
var current = serialized;
|
|
|
|
do {
|
|
cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true);
|
|
|
|
current = current.next;
|
|
} while (current !== undefined);
|
|
}
|
|
};
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/base-control/index.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ Ay: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/* unused harmony exports VisualLabel, BaseControl */
|
|
/* harmony import */ var clsx__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs");
|
|
/* harmony import */ var _wordpress_deprecated__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+deprecated@4.7.0/node_modules/@wordpress/deprecated/build-module/index.js");
|
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
/* harmony import */ var _visually_hidden__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/visually-hidden/component.js");
|
|
/* harmony import */ var _styles_base_control_styles__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/base-control/styles/base-control-styles.js");
|
|
/* harmony import */ var _context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js");
|
|
/* harmony import */ var _context__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-connect.js");
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const UnconnectedBaseControl = props => {
|
|
const {
|
|
__nextHasNoMarginBottom = false,
|
|
__associatedWPComponentName = 'BaseControl',
|
|
id,
|
|
label,
|
|
hideLabelFromVision = false,
|
|
help,
|
|
className,
|
|
children
|
|
} = (0,_context__WEBPACK_IMPORTED_MODULE_1__/* .useContextSystem */ .A)(props, 'BaseControl');
|
|
if (!__nextHasNoMarginBottom) {
|
|
(0,_wordpress_deprecated__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A)(`Bottom margin styles for wp.components.${__associatedWPComponentName}`, {
|
|
since: '6.7',
|
|
version: '7.0',
|
|
hint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version.'
|
|
});
|
|
}
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_styles_base_control_styles__WEBPACK_IMPORTED_MODULE_3__/* .Wrapper */ .mO, {
|
|
className: className,
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_styles_base_control_styles__WEBPACK_IMPORTED_MODULE_3__/* .StyledField */ .mh, {
|
|
className: "components-base-control__field"
|
|
// TODO: Official deprecation for this should start after all internal usages have been migrated
|
|
,
|
|
__nextHasNoMarginBottom: __nextHasNoMarginBottom,
|
|
children: [label && id && (hideLabelFromVision ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_visually_hidden__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .A, {
|
|
as: "label",
|
|
htmlFor: id,
|
|
children: label
|
|
}) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_styles_base_control_styles__WEBPACK_IMPORTED_MODULE_3__/* .StyledLabel */ .Gw, {
|
|
className: "components-base-control__label",
|
|
htmlFor: id,
|
|
children: label
|
|
})), label && !id && (hideLabelFromVision ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_visually_hidden__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .A, {
|
|
as: "label",
|
|
children: label
|
|
}) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(VisualLabel, {
|
|
children: label
|
|
})), children]
|
|
}), !!help && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_styles_base_control_styles__WEBPACK_IMPORTED_MODULE_3__/* .StyledHelp */ .te, {
|
|
id: id ? id + '__help' : undefined,
|
|
className: "components-base-control__help",
|
|
__nextHasNoMarginBottom: __nextHasNoMarginBottom,
|
|
children: help
|
|
})]
|
|
});
|
|
};
|
|
const UnforwardedVisualLabel = (props, ref) => {
|
|
const {
|
|
className,
|
|
children,
|
|
...restProps
|
|
} = props;
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_styles_base_control_styles__WEBPACK_IMPORTED_MODULE_3__/* .StyledVisualLabel */ .Om, {
|
|
ref: ref,
|
|
...restProps,
|
|
className: (0,clsx__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A)('components-base-control__label', className),
|
|
children: children
|
|
});
|
|
};
|
|
const VisualLabel = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_6__.forwardRef)(UnforwardedVisualLabel);
|
|
|
|
/**
|
|
* `BaseControl` is a component used to generate labels and help text for components handling user inputs.
|
|
*
|
|
* ```jsx
|
|
* import { BaseControl, useBaseControlProps } from '@wordpress/components';
|
|
*
|
|
* // Render a `BaseControl` for a textarea input
|
|
* const MyCustomTextareaControl = ({ children, ...baseProps }) => (
|
|
* // `useBaseControlProps` is a convenience hook to get the props for the `BaseControl`
|
|
* // and the inner control itself. Namely, it takes care of generating a unique `id`,
|
|
* // properly associating it with the `label` and `help` elements.
|
|
* const { baseControlProps, controlProps } = useBaseControlProps( baseProps );
|
|
*
|
|
* return (
|
|
* <BaseControl { ...baseControlProps } __nextHasNoMarginBottom>
|
|
* <textarea { ...controlProps }>
|
|
* { children }
|
|
* </textarea>
|
|
* </BaseControl>
|
|
* );
|
|
* );
|
|
* ```
|
|
*/
|
|
const BaseControl = Object.assign((0,_context__WEBPACK_IMPORTED_MODULE_7__/* .contextConnectWithoutRef */ .zS)(UnconnectedBaseControl, 'BaseControl'), {
|
|
/**
|
|
* `BaseControl.VisualLabel` is used to render a purely visual label inside a `BaseControl` component.
|
|
*
|
|
* It should only be used in cases where the children being rendered inside `BaseControl` are already accessibly labeled,
|
|
* e.g., a button, but we want an additional visual label for that section equivalent to the labels `BaseControl` would
|
|
* otherwise use if the `label` prop was passed.
|
|
*
|
|
* ```jsx
|
|
* import { BaseControl } from '@wordpress/components';
|
|
*
|
|
* const MyBaseControl = () => (
|
|
* <BaseControl
|
|
* __nextHasNoMarginBottom
|
|
* help="This button is already accessibly labeled."
|
|
* >
|
|
* <BaseControl.VisualLabel>Author</BaseControl.VisualLabel>
|
|
* <Button>Select an author</Button>
|
|
* </BaseControl>
|
|
* );
|
|
* ```
|
|
*/
|
|
VisualLabel
|
|
});
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BaseControl);
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/base-control/styles/base-control-styles.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
mh: () => (/* binding */ StyledField),
|
|
te: () => (/* binding */ StyledHelp),
|
|
Gw: () => (/* binding */ StyledLabel),
|
|
Om: () => (/* binding */ StyledVisualLabel),
|
|
mO: () => (/* binding */ Wrapper)
|
|
});
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@emotion+styled@11.11.0_@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2__@types+react@17.0.71_react@17.0.2/node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js
|
|
var emotion_styled_base_browser_esm = __webpack_require__("../../node_modules/.pnpm/@emotion+styled@11.11.0_@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2__@types+react@17.0.71_react@17.0.2/node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2/node_modules/@emotion/react/dist/emotion-react.browser.esm.js
|
|
var emotion_react_browser_esm = __webpack_require__("../../node_modules/.pnpm/@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2/node_modules/@emotion/react/dist/emotion-react.browser.esm.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/font.js + 1 modules
|
|
var font = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/font.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/box-sizing.js
|
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
const boxSizingReset = true ? {
|
|
name: "kv6lnz",
|
|
styles: "box-sizing:border-box;*,*::before,*::after{box-sizing:inherit;}"
|
|
} : 0;
|
|
//# sourceMappingURL=box-sizing.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/base-label.js
|
|
var base_label = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/base-label.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/colors-values.js
|
|
var colors_values = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/colors-values.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/space.js
|
|
var space = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/space.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/base-control/styles/base-control-styles.js
|
|
|
|
function base_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
const Wrapper = /*#__PURE__*/(0,emotion_styled_base_browser_esm/* default */.A)("div", true ? {
|
|
target: "ej5x27r4"
|
|
} : 0)("font-family:", (0,font/* font */.g)('default.fontFamily'), ";font-size:", (0,font/* font */.g)('default.fontSize'), ";", boxSizingReset, ";" + ( true ? "" : 0));
|
|
const deprecatedMarginField = ({
|
|
__nextHasNoMarginBottom = false
|
|
}) => {
|
|
return !__nextHasNoMarginBottom && /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)("margin-bottom:", (0,space/* space */.x)(2), ";" + ( true ? "" : 0), true ? "" : 0);
|
|
};
|
|
const StyledField = /*#__PURE__*/(0,emotion_styled_base_browser_esm/* default */.A)("div", true ? {
|
|
target: "ej5x27r3"
|
|
} : 0)(deprecatedMarginField, " .components-panel__row &{margin-bottom:inherit;}" + ( true ? "" : 0));
|
|
const labelStyles = /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)(base_label/* baseLabelTypography */.z, ";display:block;margin-bottom:", (0,space/* space */.x)(2), ";padding:0;" + ( true ? "" : 0), true ? "" : 0);
|
|
const StyledLabel = /*#__PURE__*/(0,emotion_styled_base_browser_esm/* default */.A)("label", true ? {
|
|
target: "ej5x27r2"
|
|
} : 0)(labelStyles, ";" + ( true ? "" : 0));
|
|
var _ref = true ? {
|
|
name: "11yad0w",
|
|
styles: "margin-bottom:revert"
|
|
} : 0;
|
|
const deprecatedMarginHelp = ({
|
|
__nextHasNoMarginBottom = false
|
|
}) => {
|
|
return !__nextHasNoMarginBottom && _ref;
|
|
};
|
|
const StyledHelp = /*#__PURE__*/(0,emotion_styled_base_browser_esm/* default */.A)("p", true ? {
|
|
target: "ej5x27r1"
|
|
} : 0)("margin-top:", (0,space/* space */.x)(2), ";margin-bottom:0;font-size:", (0,font/* font */.g)('helpText.fontSize'), ";font-style:normal;color:", colors_values/* COLORS */.l.gray[700], ";", deprecatedMarginHelp, ";" + ( true ? "" : 0));
|
|
const StyledVisualLabel = /*#__PURE__*/(0,emotion_styled_base_browser_esm/* default */.A)("span", true ? {
|
|
target: "ej5x27r0"
|
|
} : 0)(labelStyles, ";" + ( true ? "" : 0));
|
|
//# sourceMappingURL=base-control-styles.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/button/index.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ Ay: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/* unused harmony exports UnforwardedButton, Button */
|
|
/* harmony import */ var clsx__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs");
|
|
/* harmony import */ var _wordpress_deprecated__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+deprecated@4.7.0/node_modules/@wordpress/deprecated/build-module/index.js");
|
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-instance-id/index.js");
|
|
/* harmony import */ var _tooltip__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/tooltip/index.js");
|
|
/* harmony import */ var _icon__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/icon/index.js");
|
|
/* harmony import */ var _visually_hidden__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/visually-hidden/component.js");
|
|
/* harmony import */ var _popover_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/popover/utils.js");
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const disabledEventsOnDisabledButton = ['onMouseDown', 'onClick'];
|
|
function useDeprecatedProps({
|
|
__experimentalIsFocusable,
|
|
isDefault,
|
|
isPrimary,
|
|
isSecondary,
|
|
isTertiary,
|
|
isLink,
|
|
isPressed,
|
|
isSmall,
|
|
size,
|
|
variant,
|
|
describedBy,
|
|
...otherProps
|
|
}) {
|
|
let computedSize = size;
|
|
let computedVariant = variant;
|
|
const newProps = {
|
|
accessibleWhenDisabled: __experimentalIsFocusable,
|
|
// @todo Mark `isPressed` as deprecated
|
|
'aria-pressed': isPressed,
|
|
description: describedBy
|
|
};
|
|
if (isSmall) {
|
|
var _computedSize;
|
|
(_computedSize = computedSize) !== null && _computedSize !== void 0 ? _computedSize : computedSize = 'small';
|
|
}
|
|
if (isPrimary) {
|
|
var _computedVariant;
|
|
(_computedVariant = computedVariant) !== null && _computedVariant !== void 0 ? _computedVariant : computedVariant = 'primary';
|
|
}
|
|
if (isTertiary) {
|
|
var _computedVariant2;
|
|
(_computedVariant2 = computedVariant) !== null && _computedVariant2 !== void 0 ? _computedVariant2 : computedVariant = 'tertiary';
|
|
}
|
|
if (isSecondary) {
|
|
var _computedVariant3;
|
|
(_computedVariant3 = computedVariant) !== null && _computedVariant3 !== void 0 ? _computedVariant3 : computedVariant = 'secondary';
|
|
}
|
|
if (isDefault) {
|
|
var _computedVariant4;
|
|
(0,_wordpress_deprecated__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A)('wp.components.Button `isDefault` prop', {
|
|
since: '5.4',
|
|
alternative: 'variant="secondary"'
|
|
});
|
|
(_computedVariant4 = computedVariant) !== null && _computedVariant4 !== void 0 ? _computedVariant4 : computedVariant = 'secondary';
|
|
}
|
|
if (isLink) {
|
|
var _computedVariant5;
|
|
(_computedVariant5 = computedVariant) !== null && _computedVariant5 !== void 0 ? _computedVariant5 : computedVariant = 'link';
|
|
}
|
|
return {
|
|
...newProps,
|
|
...otherProps,
|
|
size: computedSize,
|
|
variant: computedVariant
|
|
};
|
|
}
|
|
function UnforwardedButton(props, ref) {
|
|
const {
|
|
__next40pxDefaultSize,
|
|
accessibleWhenDisabled,
|
|
isBusy,
|
|
isDestructive,
|
|
className,
|
|
disabled,
|
|
icon,
|
|
iconPosition = 'left',
|
|
iconSize,
|
|
showTooltip,
|
|
tooltipPosition,
|
|
shortcut,
|
|
label,
|
|
children,
|
|
size = 'default',
|
|
text,
|
|
variant,
|
|
description,
|
|
...buttonOrAnchorProps
|
|
} = useDeprecatedProps(props);
|
|
const {
|
|
href,
|
|
target,
|
|
'aria-checked': ariaChecked,
|
|
'aria-pressed': ariaPressed,
|
|
'aria-selected': ariaSelected,
|
|
...additionalProps
|
|
} = 'href' in buttonOrAnchorProps ? buttonOrAnchorProps : {
|
|
href: undefined,
|
|
target: undefined,
|
|
...buttonOrAnchorProps
|
|
};
|
|
const instanceId = (0,_wordpress_compose__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A)(Button, 'components-button__description');
|
|
const hasChildren = 'string' === typeof children && !!children || Array.isArray(children) && children?.[0] && children[0] !== null &&
|
|
// Tooltip should not considered as a child
|
|
children?.[0]?.props?.className !== 'components-tooltip';
|
|
const truthyAriaPressedValues = [true, 'true', 'mixed'];
|
|
const classes = (0,clsx__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A)('components-button', className, {
|
|
'is-next-40px-default-size': __next40pxDefaultSize,
|
|
'is-secondary': variant === 'secondary',
|
|
'is-primary': variant === 'primary',
|
|
'is-small': size === 'small',
|
|
'is-compact': size === 'compact',
|
|
'is-tertiary': variant === 'tertiary',
|
|
'is-pressed': truthyAriaPressedValues.includes(ariaPressed),
|
|
'is-pressed-mixed': ariaPressed === 'mixed',
|
|
'is-busy': isBusy,
|
|
'is-link': variant === 'link',
|
|
'is-destructive': isDestructive,
|
|
'has-text': !!icon && (hasChildren || text),
|
|
'has-icon': !!icon
|
|
});
|
|
const trulyDisabled = disabled && !accessibleWhenDisabled;
|
|
const Tag = href !== undefined && !disabled ? 'a' : 'button';
|
|
const buttonProps = Tag === 'button' ? {
|
|
type: 'button',
|
|
disabled: trulyDisabled,
|
|
'aria-checked': ariaChecked,
|
|
'aria-pressed': ariaPressed,
|
|
'aria-selected': ariaSelected
|
|
} : {};
|
|
const anchorProps = Tag === 'a' ? {
|
|
href,
|
|
target
|
|
} : {};
|
|
const disableEventProps = {};
|
|
if (disabled && accessibleWhenDisabled) {
|
|
// In this case, the button will be disabled, but still focusable and
|
|
// perceivable by screen reader users.
|
|
buttonProps['aria-disabled'] = true;
|
|
anchorProps['aria-disabled'] = true;
|
|
for (const disabledEvent of disabledEventsOnDisabledButton) {
|
|
disableEventProps[disabledEvent] = event => {
|
|
if (event) {
|
|
event.stopPropagation();
|
|
event.preventDefault();
|
|
}
|
|
};
|
|
}
|
|
}
|
|
|
|
// Should show the tooltip if...
|
|
const shouldShowTooltip = !trulyDisabled && (
|
|
// An explicit tooltip is passed or...
|
|
showTooltip && !!label ||
|
|
// There's a shortcut or...
|
|
!!shortcut ||
|
|
// There's a label and...
|
|
!!label &&
|
|
// The children are empty and...
|
|
!children?.length &&
|
|
// The tooltip is not explicitly disabled.
|
|
false !== showTooltip);
|
|
const descriptionId = description ? instanceId : undefined;
|
|
const describedById = additionalProps['aria-describedby'] || descriptionId;
|
|
const commonProps = {
|
|
className: classes,
|
|
'aria-label': additionalProps['aria-label'] || label,
|
|
'aria-describedby': describedById,
|
|
ref
|
|
};
|
|
const elementChildren = /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
|
|
children: [icon && iconPosition === 'left' && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_icon__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .A, {
|
|
icon: icon,
|
|
size: iconSize
|
|
}), text && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
|
|
children: text
|
|
}), children, icon && iconPosition === 'right' && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_icon__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .A, {
|
|
icon: icon,
|
|
size: iconSize
|
|
})]
|
|
});
|
|
const element = Tag === 'a' ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("a", {
|
|
...anchorProps,
|
|
...additionalProps,
|
|
...disableEventProps,
|
|
...commonProps,
|
|
children: elementChildren
|
|
}) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("button", {
|
|
...buttonProps,
|
|
...additionalProps,
|
|
...disableEventProps,
|
|
...commonProps,
|
|
children: elementChildren
|
|
});
|
|
|
|
// In order to avoid some React reconciliation issues, we are always rendering
|
|
// the `Tooltip` component even when `shouldShowTooltip` is `false`.
|
|
// In order to make sure that the tooltip doesn't show when it shouldn't,
|
|
// we don't pass the props to the `Tooltip` component.
|
|
const tooltipProps = shouldShowTooltip ? {
|
|
text: children?.length && description ? description : label,
|
|
shortcut,
|
|
placement: tooltipPosition &&
|
|
// Convert legacy `position` values to be used with the new `placement` prop
|
|
(0,_popover_utils__WEBPACK_IMPORTED_MODULE_5__/* .positionToPlacement */ .YK)(tooltipPosition)
|
|
} : {};
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_tooltip__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Ay, {
|
|
...tooltipProps,
|
|
children: element
|
|
}), description && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_visually_hidden__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .A, {
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", {
|
|
id: descriptionId,
|
|
children: description
|
|
})
|
|
})]
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Lets users take actions and make choices with a single click or tap.
|
|
*
|
|
* ```jsx
|
|
* import { Button } from '@wordpress/components';
|
|
* const Mybutton = () => (
|
|
* <Button
|
|
* variant="primary"
|
|
* onClick={ handleClick }
|
|
* >
|
|
* Click here
|
|
* </Button>
|
|
* );
|
|
* ```
|
|
*/
|
|
const Button = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_8__.forwardRef)(UnforwardedButton);
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Button);
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/constants.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ Yr: () => (/* binding */ CONNECT_STATIC_NAMESPACE),
|
|
/* harmony export */ yG: () => (/* binding */ COMPONENT_NAMESPACE),
|
|
/* harmony export */ yy: () => (/* binding */ CONNECTED_NAMESPACE)
|
|
/* harmony export */ });
|
|
const COMPONENT_NAMESPACE = 'data-wp-component';
|
|
const CONNECTED_NAMESPACE = 'data-wp-c16t';
|
|
|
|
/**
|
|
* Special key where the connected namespaces are stored.
|
|
* This is attached to Context connected components as a static property.
|
|
*/
|
|
const CONNECT_STATIC_NAMESPACE = '__contextSystemKey__';
|
|
//# sourceMappingURL=constants.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-connect.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ KZ: () => (/* binding */ contextConnect),
|
|
/* harmony export */ SZ: () => (/* binding */ hasConnectNamespace),
|
|
/* harmony export */ zS: () => (/* binding */ contextConnectWithoutRef)
|
|
/* harmony export */ });
|
|
/* unused harmony export getConnectNamespace */
|
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
/* harmony import */ var _wordpress_warning__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+warning@3.7.0/node_modules/@wordpress/warning/build-module/index.js");
|
|
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/constants.js");
|
|
/* harmony import */ var _get_styled_class_name_from_key__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/get-styled-class-name-from-key.js");
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Forwards ref (React.ForwardRef) and "Connects" (or registers) a component
|
|
* within the Context system under a specified namespace.
|
|
*
|
|
* @param Component The component to register into the Context system.
|
|
* @param namespace The namespace to register the component under.
|
|
* @return The connected WordPressComponent
|
|
*/
|
|
function contextConnect(Component, namespace) {
|
|
return _contextConnect(Component, namespace, {
|
|
forwardsRef: true
|
|
});
|
|
}
|
|
|
|
/**
|
|
* "Connects" (or registers) a component within the Context system under a specified namespace.
|
|
* Does not forward a ref.
|
|
*
|
|
* @param Component The component to register into the Context system.
|
|
* @param namespace The namespace to register the component under.
|
|
* @return The connected WordPressComponent
|
|
*/
|
|
function contextConnectWithoutRef(Component, namespace) {
|
|
return _contextConnect(Component, namespace);
|
|
}
|
|
|
|
// This is an (experimental) evolution of the initial connect() HOC.
|
|
// The hope is that we can improve render performance by removing functional
|
|
// component wrappers.
|
|
function _contextConnect(Component, namespace, options) {
|
|
const WrappedComponent = options?.forwardsRef ? (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(Component) : Component;
|
|
if (typeof namespace === 'undefined') {
|
|
globalThis.SCRIPT_DEBUG === true ? (0,_wordpress_warning__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A)('contextConnect: Please provide a namespace') : void 0;
|
|
}
|
|
|
|
// @ts-expect-error internal property
|
|
let mergedNamespace = WrappedComponent[_constants__WEBPACK_IMPORTED_MODULE_2__/* .CONNECT_STATIC_NAMESPACE */ .Yr] || [namespace];
|
|
|
|
/**
|
|
* Consolidate (merge) namespaces before attaching it to the WrappedComponent.
|
|
*/
|
|
if (Array.isArray(namespace)) {
|
|
mergedNamespace = [...mergedNamespace, ...namespace];
|
|
}
|
|
if (typeof namespace === 'string') {
|
|
mergedNamespace = [...mergedNamespace, namespace];
|
|
}
|
|
|
|
// @ts-expect-error We can't rely on inferred types here because of the
|
|
// `as` prop polymorphism we're handling in https://github.com/WordPress/gutenberg/blob/4f3a11243c365f94892e479bff0b922ccc4ccda3/packages/components/src/context/wordpress-component.ts#L32-L33
|
|
return Object.assign(WrappedComponent, {
|
|
[_constants__WEBPACK_IMPORTED_MODULE_2__/* .CONNECT_STATIC_NAMESPACE */ .Yr]: [...new Set(mergedNamespace)],
|
|
displayName: namespace,
|
|
selector: `.${(0,_get_styled_class_name_from_key__WEBPACK_IMPORTED_MODULE_3__/* .getStyledClassNameFromKey */ .o)(namespace)}`
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Attempts to retrieve the connected namespace from a component.
|
|
*
|
|
* @param Component The component to retrieve a namespace from.
|
|
* @return The connected namespaces.
|
|
*/
|
|
function getConnectNamespace(Component) {
|
|
if (!Component) {
|
|
return [];
|
|
}
|
|
let namespaces = [];
|
|
|
|
// @ts-ignore internal property
|
|
if (Component[_constants__WEBPACK_IMPORTED_MODULE_2__/* .CONNECT_STATIC_NAMESPACE */ .Yr]) {
|
|
// @ts-ignore internal property
|
|
namespaces = Component[_constants__WEBPACK_IMPORTED_MODULE_2__/* .CONNECT_STATIC_NAMESPACE */ .Yr];
|
|
}
|
|
|
|
// @ts-ignore
|
|
if (Component.type && Component.type[_constants__WEBPACK_IMPORTED_MODULE_2__/* .CONNECT_STATIC_NAMESPACE */ .Yr]) {
|
|
// @ts-ignore
|
|
namespaces = Component.type[_constants__WEBPACK_IMPORTED_MODULE_2__/* .CONNECT_STATIC_NAMESPACE */ .Yr];
|
|
}
|
|
return namespaces;
|
|
}
|
|
|
|
/**
|
|
* Checks to see if a component is connected within the Context system.
|
|
*
|
|
* @param Component The component to retrieve a namespace from.
|
|
* @param match The namespace to check.
|
|
*/
|
|
function hasConnectNamespace(Component, match) {
|
|
if (!Component) {
|
|
return false;
|
|
}
|
|
if (typeof match === 'string') {
|
|
return getConnectNamespace(Component).includes(match);
|
|
}
|
|
if (Array.isArray(match)) {
|
|
return match.some(result => getConnectNamespace(Component).includes(result));
|
|
}
|
|
return false;
|
|
}
|
|
//# sourceMappingURL=context-connect.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-system-provider.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
aG: () => (/* binding */ ComponentsContext),
|
|
c7: () => (/* binding */ ContextSystemProvider),
|
|
rm: () => (/* binding */ useComponentsContext)
|
|
});
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js
|
|
var cjs = __webpack_require__("../../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js");
|
|
var cjs_default = /*#__PURE__*/__webpack_require__.n(cjs);
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/es6/index.js
|
|
var es6 = __webpack_require__("../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/es6/index.js");
|
|
var es6_default = /*#__PURE__*/__webpack_require__.n(es6);
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/is-plain-object@5.0.0/node_modules/is-plain-object/dist/is-plain-object.mjs
|
|
var is_plain_object = __webpack_require__("../../node_modules/.pnpm/is-plain-object@5.0.0/node_modules/is-plain-object/dist/is-plain-object.mjs");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js
|
|
var react = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+warning@3.7.0/node_modules/@wordpress/warning/build-module/index.js + 1 modules
|
|
var build_module = __webpack_require__("../../node_modules/.pnpm/@wordpress+warning@3.7.0/node_modules/@wordpress/warning/build-module/index.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/hooks/use-update-effect.js
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* A `React.useEffect` that will not run on the first render.
|
|
* Source:
|
|
* https://github.com/ariakit/ariakit/blob/main/packages/ariakit-react-core/src/utils/hooks.ts
|
|
*
|
|
* @param {import('react').EffectCallback} effect
|
|
* @param {import('react').DependencyList} deps
|
|
*/
|
|
function useUpdateEffect(effect, deps) {
|
|
const mountedRef = (0,react.useRef)(false);
|
|
(0,react.useEffect)(() => {
|
|
if (mountedRef.current) {
|
|
return effect();
|
|
}
|
|
mountedRef.current = true;
|
|
return undefined;
|
|
// Disable reasons:
|
|
// 1. This hook needs to pass a dep list that isn't an array literal
|
|
// 2. `effect` is missing from the array, and will need to be added carefully to avoid additional warnings
|
|
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
}, deps);
|
|
(0,react.useEffect)(() => () => {
|
|
mountedRef.current = false;
|
|
}, []);
|
|
}
|
|
/* harmony default export */ const use_update_effect = (useUpdateEffect);
|
|
//# sourceMappingURL=use-update-effect.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-system-provider.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
const ComponentsContext = (0,react.createContext)( /** @type {Record<string, any>} */{});
|
|
const useComponentsContext = () => (0,react.useContext)(ComponentsContext);
|
|
|
|
/**
|
|
* Consolidates incoming ContextSystem values with a (potential) parent ContextSystem value.
|
|
*
|
|
* Note: This function will warn if it detects an un-memoized `value`
|
|
*
|
|
* @param {Object} props
|
|
* @param {Record<string, any>} props.value
|
|
* @return {Record<string, any>} The consolidated value.
|
|
*/
|
|
function useContextSystemBridge({
|
|
value
|
|
}) {
|
|
const parentContext = useComponentsContext();
|
|
const valueRef = (0,react.useRef)(value);
|
|
use_update_effect(() => {
|
|
if (
|
|
// Objects are equivalent.
|
|
es6_default()(valueRef.current, value) &&
|
|
// But not the same reference.
|
|
valueRef.current !== value) {
|
|
globalThis.SCRIPT_DEBUG === true ? (0,build_module/* default */.A)(`Please memoize your context: ${JSON.stringify(value)}`) : void 0;
|
|
}
|
|
}, [value]);
|
|
|
|
// `parentContext` will always be memoized (i.e., the result of this hook itself)
|
|
// or the default value from when the `ComponentsContext` was originally
|
|
// initialized (which will never change, it's a static variable)
|
|
// so this memoization will prevent `deepmerge()` from rerunning unless
|
|
// the references to `value` change OR the `parentContext` has an actual material change
|
|
// (because again, it's guaranteed to be memoized or a static reference to the empty object
|
|
// so we know that the only changes for `parentContext` are material ones... i.e., why we
|
|
// don't have to warn in the `useUpdateEffect` hook above for `parentContext` and we only
|
|
// need to bother with the `value`). The `useUpdateEffect` above will ensure that we are
|
|
// correctly warning when the `value` isn't being properly memoized. All of that to say
|
|
// that this should be super safe to assume that `useMemo` will only run on actual
|
|
// changes to the two dependencies, therefore saving us calls to `deepmerge()`!
|
|
const config = (0,react.useMemo)(() => {
|
|
// Deep clone `parentContext` to avoid mutating it later.
|
|
return cjs_default()(parentContext !== null && parentContext !== void 0 ? parentContext : {}, value !== null && value !== void 0 ? value : {}, {
|
|
isMergeableObject: is_plain_object/* isPlainObject */.Q
|
|
});
|
|
}, [parentContext, value]);
|
|
return config;
|
|
}
|
|
|
|
/**
|
|
* A Provider component that can modify props for connected components within
|
|
* the Context system.
|
|
*
|
|
* @example
|
|
* ```jsx
|
|
* <ContextSystemProvider value={{ Button: { size: 'small' }}}>
|
|
* <Button>...</Button>
|
|
* </ContextSystemProvider>
|
|
* ```
|
|
*
|
|
* @template {Record<string, any>} T
|
|
* @param {Object} options
|
|
* @param {import('react').ReactNode} options.children Children to render.
|
|
* @param {T} options.value Props to render into connected components.
|
|
* @return {JSX.Element} A Provider wrapped component.
|
|
*/
|
|
const BaseContextSystemProvider = ({
|
|
children,
|
|
value
|
|
}) => {
|
|
const contextValue = useContextSystemBridge({
|
|
value
|
|
});
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(ComponentsContext.Provider, {
|
|
value: contextValue,
|
|
children: children
|
|
});
|
|
};
|
|
const ContextSystemProvider = (0,react.memo)(BaseContextSystemProvider);
|
|
//# sourceMappingURL=context-system-provider.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/get-styled-class-name-from-key.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ o: () => (/* binding */ getStyledClassNameFromKey)
|
|
/* harmony export */ });
|
|
/* harmony import */ var change_case__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/param-case@3.0.4/node_modules/param-case/dist.es2015/index.js");
|
|
/* harmony import */ var memize__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/memize@2.1.0/node_modules/memize/dist/index.js");
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Generates the connected component CSS className based on the namespace.
|
|
*
|
|
* @param namespace The name of the connected component.
|
|
* @return The generated CSS className.
|
|
*/
|
|
function getStyledClassName(namespace) {
|
|
const kebab = (0,change_case__WEBPACK_IMPORTED_MODULE_0__/* .paramCase */ .c)(namespace);
|
|
return `components-${kebab}`;
|
|
}
|
|
const getStyledClassNameFromKey = (0,memize__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A)(getStyledClassName);
|
|
//# sourceMappingURL=get-styled-class-name-from-key.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
A: () => (/* binding */ useContextSystem)
|
|
});
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+warning@3.7.0/node_modules/@wordpress/warning/build-module/index.js + 1 modules
|
|
var build_module = __webpack_require__("../../node_modules/.pnpm/@wordpress+warning@3.7.0/node_modules/@wordpress/warning/build-module/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-system-provider.js + 1 modules
|
|
var context_system_provider = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-system-provider.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/constants.js
|
|
var constants = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/constants.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/utils.js
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Creates a dedicated context namespace HTML attribute for components.
|
|
* ns is short for "namespace"
|
|
*
|
|
* @example
|
|
* ```jsx
|
|
* <div {...ns('Container')} />
|
|
* ```
|
|
*
|
|
* @param {string} componentName The name for the component.
|
|
* @return {Record<string, any>} A props object with the namespaced HTML attribute.
|
|
*/
|
|
function getNamespace(componentName) {
|
|
return {
|
|
[constants/* COMPONENT_NAMESPACE */.yG]: componentName
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a dedicated connected context namespace HTML attribute for components.
|
|
* ns is short for "namespace"
|
|
*
|
|
* @example
|
|
* ```jsx
|
|
* <div {...cns()} />
|
|
* ```
|
|
*
|
|
* @return {Record<string, any>} A props object with the namespaced HTML attribute.
|
|
*/
|
|
function getConnectedNamespace() {
|
|
return {
|
|
[constants/* CONNECTED_NAMESPACE */.yy]: true
|
|
};
|
|
}
|
|
//# sourceMappingURL=utils.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/get-styled-class-name-from-key.js
|
|
var get_styled_class_name_from_key = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/get-styled-class-name-from-key.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/hooks/use-cx.js
|
|
var use_cx = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/hooks/use-cx.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* @template TProps
|
|
* @typedef {TProps & { className: string }} ConnectedProps
|
|
*/
|
|
|
|
/**
|
|
* Custom hook that derives registered props from the Context system.
|
|
* These derived props are then consolidated with incoming component props.
|
|
*
|
|
* @template {{ className?: string }} P
|
|
* @param {P} props Incoming props from the component.
|
|
* @param {string} namespace The namespace to register and to derive context props from.
|
|
* @return {ConnectedProps<P>} The connected props.
|
|
*/
|
|
function useContextSystem(props, namespace) {
|
|
const contextSystemProps = (0,context_system_provider/* useComponentsContext */.rm)();
|
|
if (typeof namespace === 'undefined') {
|
|
globalThis.SCRIPT_DEBUG === true ? (0,build_module/* default */.A)('useContextSystem: Please provide a namespace') : void 0;
|
|
}
|
|
const contextProps = contextSystemProps?.[namespace] || {};
|
|
|
|
/* eslint-disable jsdoc/no-undefined-types */
|
|
/** @type {ConnectedProps<P>} */
|
|
// @ts-ignore We fill in the missing properties below
|
|
const finalComponentProps = {
|
|
...getConnectedNamespace(),
|
|
...getNamespace(namespace)
|
|
};
|
|
/* eslint-enable jsdoc/no-undefined-types */
|
|
|
|
const {
|
|
_overrides: overrideProps,
|
|
...otherContextProps
|
|
} = contextProps;
|
|
const initialMergedProps = Object.entries(otherContextProps).length ? Object.assign({}, otherContextProps, props) : props;
|
|
const cx = (0,use_cx/* useCx */.l)();
|
|
const classes = cx((0,get_styled_class_name_from_key/* getStyledClassNameFromKey */.o)(namespace), props.className);
|
|
|
|
// Provides the ability to customize the render of the component.
|
|
const rendered = typeof initialMergedProps.renderChildren === 'function' ? initialMergedProps.renderChildren(initialMergedProps) : initialMergedProps.children;
|
|
for (const key in initialMergedProps) {
|
|
// @ts-ignore filling in missing props
|
|
finalComponentProps[key] = initialMergedProps[key];
|
|
}
|
|
for (const key in overrideProps) {
|
|
// @ts-ignore filling in missing props
|
|
finalComponentProps[key] = overrideProps[key];
|
|
}
|
|
|
|
// Setting an `undefined` explicitly can cause unintended overwrites
|
|
// when a `cloneElement()` is involved.
|
|
if (rendered !== undefined) {
|
|
// @ts-ignore
|
|
finalComponentProps.children = rendered;
|
|
}
|
|
finalComponentProps.className = classes;
|
|
return finalComponentProps;
|
|
}
|
|
//# sourceMappingURL=use-context-system.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/dropdown/index.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/* unused harmony export Dropdown */
|
|
/* harmony import */ var clsx__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs");
|
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-merge-refs/index.js");
|
|
/* harmony import */ var _wordpress_deprecated__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+deprecated@4.7.0/node_modules/@wordpress/deprecated/build-module/index.js");
|
|
/* harmony import */ var _context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js");
|
|
/* harmony import */ var _context__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-connect.js");
|
|
/* harmony import */ var _utils_hooks__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/hooks/use-controlled-value.js");
|
|
/* harmony import */ var _popover__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/popover/index.js");
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
const UnconnectedDropdown = (props, forwardedRef) => {
|
|
const {
|
|
renderContent,
|
|
renderToggle,
|
|
className,
|
|
contentClassName,
|
|
expandOnMobile,
|
|
headerTitle,
|
|
focusOnMount,
|
|
popoverProps,
|
|
onClose,
|
|
onToggle,
|
|
style,
|
|
open,
|
|
defaultOpen,
|
|
// Deprecated props
|
|
position,
|
|
// From context system
|
|
variant
|
|
} = (0,_context__WEBPACK_IMPORTED_MODULE_1__/* .useContextSystem */ .A)(props, 'Dropdown');
|
|
if (position !== undefined) {
|
|
(0,_wordpress_deprecated__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A)('`position` prop in wp.components.Dropdown', {
|
|
since: '6.2',
|
|
alternative: '`popoverProps.placement` prop',
|
|
hint: 'Note that the `position` prop will override any values passed through the `popoverProps.placement` prop.'
|
|
});
|
|
}
|
|
|
|
// Use internal state instead of a ref to make sure that the component
|
|
// re-renders when the popover's anchor updates.
|
|
const [fallbackPopoverAnchor, setFallbackPopoverAnchor] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_3__.useState)(null);
|
|
const containerRef = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_3__.useRef)();
|
|
const [isOpen, setIsOpen] = (0,_utils_hooks__WEBPACK_IMPORTED_MODULE_4__/* .useControlledValue */ .j)({
|
|
defaultValue: defaultOpen,
|
|
value: open,
|
|
onChange: onToggle
|
|
});
|
|
|
|
/**
|
|
* Closes the popover when focus leaves it unless the toggle was pressed or
|
|
* focus has moved to a separate dialog. The former is to let the toggle
|
|
* handle closing the popover and the latter is to preserve presence in
|
|
* case a dialog has opened, allowing focus to return when it's dismissed.
|
|
*/
|
|
function closeIfFocusOutside() {
|
|
if (!containerRef.current) {
|
|
return;
|
|
}
|
|
const {
|
|
ownerDocument
|
|
} = containerRef.current;
|
|
const dialog = ownerDocument?.activeElement?.closest('[role="dialog"]');
|
|
if (!containerRef.current.contains(ownerDocument.activeElement) && (!dialog || dialog.contains(containerRef.current))) {
|
|
close();
|
|
}
|
|
}
|
|
function close() {
|
|
onClose?.();
|
|
setIsOpen(false);
|
|
}
|
|
const args = {
|
|
isOpen: !!isOpen,
|
|
onToggle: () => setIsOpen(!isOpen),
|
|
onClose: close
|
|
};
|
|
const popoverPropsHaveAnchor = !!popoverProps?.anchor ||
|
|
// Note: `anchorRef`, `getAnchorRect` and `anchorRect` are deprecated and
|
|
// be removed from `Popover` from WordPress 6.3
|
|
!!popoverProps?.anchorRef || !!popoverProps?.getAnchorRect || !!popoverProps?.anchorRect;
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
|
|
className: className,
|
|
ref: (0,_wordpress_compose__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A)([containerRef, forwardedRef, setFallbackPopoverAnchor])
|
|
// Some UAs focus the closest focusable parent when the toggle is
|
|
// clicked. Making this div focusable ensures such UAs will focus
|
|
// it and `closeIfFocusOutside` can tell if the toggle was clicked.
|
|
,
|
|
tabIndex: -1,
|
|
style: style,
|
|
children: [renderToggle(args), isOpen && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_popover__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Ay, {
|
|
position: position,
|
|
onClose: close,
|
|
onFocusOutside: closeIfFocusOutside,
|
|
expandOnMobile: expandOnMobile,
|
|
headerTitle: headerTitle,
|
|
focusOnMount: focusOnMount
|
|
// This value is used to ensure that the dropdowns
|
|
// align with the editor header by default.
|
|
,
|
|
offset: 13,
|
|
anchor: !popoverPropsHaveAnchor ? fallbackPopoverAnchor : undefined,
|
|
variant: variant,
|
|
...popoverProps,
|
|
className: (0,clsx__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .A)('components-dropdown__content', popoverProps?.className, contentClassName),
|
|
children: renderContent(args)
|
|
})]
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Renders a button that opens a floating content modal when clicked.
|
|
*
|
|
* ```jsx
|
|
* import { Button, Dropdown } from '@wordpress/components';
|
|
*
|
|
* const MyDropdown = () => (
|
|
* <Dropdown
|
|
* className="my-container-class-name"
|
|
* contentClassName="my-dropdown-content-classname"
|
|
* popoverProps={ { placement: 'bottom-start' } }
|
|
* renderToggle={ ( { isOpen, onToggle } ) => (
|
|
* <Button
|
|
* variant="primary"
|
|
* onClick={ onToggle }
|
|
* aria-expanded={ isOpen }
|
|
* >
|
|
* Toggle Dropdown!
|
|
* </Button>
|
|
* ) }
|
|
* renderContent={ () => <div>This is the content of the dropdown.</div> }
|
|
* />
|
|
* );
|
|
* ```
|
|
*/
|
|
const Dropdown = (0,_context__WEBPACK_IMPORTED_MODULE_8__/* .contextConnect */ .KZ)(UnconnectedDropdown, 'Dropdown');
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Dropdown);
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/flex/context.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ R: () => (/* binding */ FlexContext),
|
|
/* harmony export */ a: () => (/* binding */ useFlexContext)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
const FlexContext = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createContext)({
|
|
flexItemDisplay: undefined
|
|
});
|
|
const useFlexContext = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useContext)(FlexContext);
|
|
//# sourceMappingURL=context.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/flex/flex-item/component.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
A: () => (/* binding */ flex_item_component)
|
|
});
|
|
|
|
// UNUSED EXPORTS: FlexItem
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-connect.js
|
|
var context_connect = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-connect.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/view/component.js
|
|
var component = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/view/component.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2/node_modules/@emotion/react/dist/emotion-react.browser.esm.js
|
|
var emotion_react_browser_esm = __webpack_require__("../../node_modules/.pnpm/@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2/node_modules/@emotion/react/dist/emotion-react.browser.esm.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js + 1 modules
|
|
var use_context_system = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/flex/context.js
|
|
var context = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/flex/context.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/flex/styles.js
|
|
var styles = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/flex/styles.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/hooks/use-cx.js
|
|
var use_cx = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/hooks/use-cx.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/flex/flex-item/hook.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
function useFlexItem(props) {
|
|
const {
|
|
className,
|
|
display: displayProp,
|
|
isBlock = false,
|
|
...otherProps
|
|
} = (0,use_context_system/* useContextSystem */.A)(props, 'FlexItem');
|
|
const sx = {};
|
|
const contextDisplay = (0,context/* useFlexContext */.a)().flexItemDisplay;
|
|
sx.Base = /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)({
|
|
display: displayProp || contextDisplay
|
|
}, true ? "" : 0, true ? "" : 0);
|
|
const cx = (0,use_cx/* useCx */.l)();
|
|
const classes = cx(styles/* Item */.q7, sx.Base, isBlock && styles/* block */.om, className);
|
|
return {
|
|
...otherProps,
|
|
className: classes
|
|
};
|
|
}
|
|
//# sourceMappingURL=hook.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/flex/flex-item/component.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
function UnconnectedFlexItem(props, forwardedRef) {
|
|
const flexItemProps = useFlexItem(props);
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(component/* default */.A, {
|
|
...flexItemProps,
|
|
ref: forwardedRef
|
|
});
|
|
}
|
|
|
|
/**
|
|
* `FlexItem` is a primitive layout component that aligns content within layout
|
|
* containers like `Flex`.
|
|
*
|
|
* ```jsx
|
|
* import { Flex, FlexItem } from '@wordpress/components';
|
|
*
|
|
* function Example() {
|
|
* return (
|
|
* <Flex>
|
|
* <FlexItem>...</FlexItem>
|
|
* </Flex>
|
|
* );
|
|
* }
|
|
* ```
|
|
*/
|
|
const FlexItem = (0,context_connect/* contextConnect */.KZ)(UnconnectedFlexItem, 'FlexItem');
|
|
/* harmony default export */ const flex_item_component = (FlexItem);
|
|
//# sourceMappingURL=component.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/flex/flex/component.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/* unused harmony export Flex */
|
|
/* harmony import */ var _context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-connect.js");
|
|
/* harmony import */ var _hook__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/flex/flex/hook.js");
|
|
/* harmony import */ var _context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/flex/context.js");
|
|
/* harmony import */ var _view__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/view/component.js");
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function UnconnectedFlex(props, forwardedRef) {
|
|
const {
|
|
children,
|
|
isColumn,
|
|
...otherProps
|
|
} = (0,_hook__WEBPACK_IMPORTED_MODULE_1__/* .useFlex */ .v)(props);
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_context__WEBPACK_IMPORTED_MODULE_2__/* .FlexContext */ .R.Provider, {
|
|
value: {
|
|
flexItemDisplay: isColumn ? 'block' : undefined
|
|
},
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_view__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A, {
|
|
...otherProps,
|
|
ref: forwardedRef,
|
|
children: children
|
|
})
|
|
});
|
|
}
|
|
|
|
/**
|
|
* `Flex` is a primitive layout component that adaptively aligns child content
|
|
* horizontally or vertically. `Flex` powers components like `HStack` and
|
|
* `VStack`.
|
|
*
|
|
* `Flex` is used with any of its two sub-components, `FlexItem` and
|
|
* `FlexBlock`.
|
|
*
|
|
* ```jsx
|
|
* import { Flex, FlexBlock, FlexItem } from '@wordpress/components';
|
|
*
|
|
* function Example() {
|
|
* return (
|
|
* <Flex>
|
|
* <FlexItem>
|
|
* <p>Code</p>
|
|
* </FlexItem>
|
|
* <FlexBlock>
|
|
* <p>Poetry</p>
|
|
* </FlexBlock>
|
|
* </Flex>
|
|
* );
|
|
* }
|
|
* ```
|
|
*/
|
|
const Flex = (0,_context__WEBPACK_IMPORTED_MODULE_4__/* .contextConnect */ .KZ)(UnconnectedFlex, 'Flex');
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Flex);
|
|
//# sourceMappingURL=component.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/flex/flex/hook.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ v: () => (/* binding */ useFlex)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _emotion_react__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("../../node_modules/.pnpm/@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2/node_modules/@emotion/react/dist/emotion-react.browser.esm.js");
|
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
/* harmony import */ var _wordpress_deprecated__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+deprecated@4.7.0/node_modules/@wordpress/deprecated/build-module/index.js");
|
|
/* harmony import */ var _context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js");
|
|
/* harmony import */ var _utils_use_responsive_value__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/use-responsive-value.js");
|
|
/* harmony import */ var _utils_space__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/space.js");
|
|
/* harmony import */ var _styles__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/flex/styles.js");
|
|
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/hooks/use-cx.js");
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function useDeprecatedProps(props) {
|
|
const {
|
|
isReversed,
|
|
...otherProps
|
|
} = props;
|
|
if (typeof isReversed !== 'undefined') {
|
|
(0,_wordpress_deprecated__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)('Flex isReversed', {
|
|
alternative: 'Flex direction="row-reverse" or "column-reverse"',
|
|
since: '5.9'
|
|
});
|
|
return {
|
|
...otherProps,
|
|
direction: isReversed ? 'row-reverse' : 'row'
|
|
};
|
|
}
|
|
return otherProps;
|
|
}
|
|
function useFlex(props) {
|
|
const {
|
|
align,
|
|
className,
|
|
direction: directionProp = 'row',
|
|
expanded = true,
|
|
gap = 2,
|
|
justify = 'space-between',
|
|
wrap = false,
|
|
...otherProps
|
|
} = (0,_context__WEBPACK_IMPORTED_MODULE_1__/* .useContextSystem */ .A)(useDeprecatedProps(props), 'Flex');
|
|
const directionAsArray = Array.isArray(directionProp) ? directionProp : [directionProp];
|
|
const direction = (0,_utils_use_responsive_value__WEBPACK_IMPORTED_MODULE_2__/* .useResponsiveValue */ .t)(directionAsArray);
|
|
const isColumn = typeof direction === 'string' && !!direction.includes('column');
|
|
const cx = (0,_utils__WEBPACK_IMPORTED_MODULE_3__/* .useCx */ .l)();
|
|
const classes = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_4__.useMemo)(() => {
|
|
const base = /*#__PURE__*/(0,_emotion_react__WEBPACK_IMPORTED_MODULE_5__/* .css */ .AH)({
|
|
alignItems: align !== null && align !== void 0 ? align : isColumn ? 'normal' : 'center',
|
|
flexDirection: direction,
|
|
flexWrap: wrap ? 'wrap' : undefined,
|
|
gap: (0,_utils_space__WEBPACK_IMPORTED_MODULE_6__/* .space */ .x)(gap),
|
|
justifyContent: justify,
|
|
height: isColumn && expanded ? '100%' : undefined,
|
|
width: !isColumn && expanded ? '100%' : undefined
|
|
}, true ? "" : 0, true ? "" : 0);
|
|
return cx(_styles__WEBPACK_IMPORTED_MODULE_7__/* .Flex */ .so, base, isColumn ? _styles__WEBPACK_IMPORTED_MODULE_7__/* .ItemsColumn */ .Z2 : _styles__WEBPACK_IMPORTED_MODULE_7__/* .ItemsRow */ .RI, className);
|
|
}, [align, className, cx, direction, expanded, gap, isColumn, justify, wrap]);
|
|
return {
|
|
...otherProps,
|
|
className: classes,
|
|
isColumn
|
|
};
|
|
}
|
|
//# sourceMappingURL=hook.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/flex/styles.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ RI: () => (/* binding */ ItemsRow),
|
|
/* harmony export */ Z2: () => (/* binding */ ItemsColumn),
|
|
/* harmony export */ om: () => (/* binding */ block),
|
|
/* harmony export */ q7: () => (/* binding */ Item),
|
|
/* harmony export */ so: () => (/* binding */ Flex)
|
|
/* harmony export */ });
|
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
const Flex = true ? {
|
|
name: "zjik7",
|
|
styles: "display:flex"
|
|
} : 0;
|
|
const Item = true ? {
|
|
name: "qgaee5",
|
|
styles: "display:block;max-height:100%;max-width:100%;min-height:0;min-width:0"
|
|
} : 0;
|
|
const block = true ? {
|
|
name: "82a6rk",
|
|
styles: "flex:1"
|
|
} : 0;
|
|
|
|
/**
|
|
* Workaround to optimize DOM rendering.
|
|
* We'll enhance alignment with naive parent flex assumptions.
|
|
*
|
|
* Trade-off:
|
|
* Far less DOM less. However, UI rendering is not as reliable.
|
|
*/
|
|
|
|
/**
|
|
* Improves stability of width/height rendering.
|
|
* https://github.com/ItsJonQ/g2/pull/149
|
|
*/
|
|
const ItemsColumn = true ? {
|
|
name: "13nosa1",
|
|
styles: ">*{min-height:0;}"
|
|
} : 0;
|
|
const ItemsRow = true ? {
|
|
name: "1pwxzk4",
|
|
styles: ">*{min-width:0;}"
|
|
} : 0;
|
|
//# sourceMappingURL=styles.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/h-stack/component.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/* unused harmony export HStack */
|
|
/* harmony import */ var _context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-connect.js");
|
|
/* harmony import */ var _view__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/view/component.js");
|
|
/* harmony import */ var _hook__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/h-stack/hook.js");
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
function UnconnectedHStack(props, forwardedRef) {
|
|
const hStackProps = (0,_hook__WEBPACK_IMPORTED_MODULE_1__/* .useHStack */ .A)(props);
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_view__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A, {
|
|
...hStackProps,
|
|
ref: forwardedRef
|
|
});
|
|
}
|
|
|
|
/**
|
|
* `HStack` (Horizontal Stack) arranges child elements in a horizontal line.
|
|
*
|
|
* `HStack` can render anything inside.
|
|
*
|
|
* ```jsx
|
|
* import {
|
|
* __experimentalHStack as HStack,
|
|
* __experimentalText as Text,
|
|
* } from `@wordpress/components`;
|
|
*
|
|
* function Example() {
|
|
* return (
|
|
* <HStack>
|
|
* <Text>Code</Text>
|
|
* <Text>is</Text>
|
|
* <Text>Poetry</Text>
|
|
* </HStack>
|
|
* );
|
|
* }
|
|
* ```
|
|
*/
|
|
const HStack = (0,_context__WEBPACK_IMPORTED_MODULE_3__/* .contextConnect */ .KZ)(UnconnectedHStack, 'HStack');
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (HStack);
|
|
//# sourceMappingURL=component.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/h-stack/hook.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
A: () => (/* binding */ useHStack)
|
|
});
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js + 1 modules
|
|
var use_context_system = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-connect.js
|
|
var context_connect = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-connect.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/flex/flex-item/component.js + 1 modules
|
|
var component = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/flex/flex-item/component.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/flex/flex/hook.js
|
|
var hook = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/flex/flex/hook.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/values.js
|
|
var values = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/values.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/h-stack/utils.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
const H_ALIGNMENTS = {
|
|
bottom: {
|
|
align: 'flex-end',
|
|
justify: 'center'
|
|
},
|
|
bottomLeft: {
|
|
align: 'flex-end',
|
|
justify: 'flex-start'
|
|
},
|
|
bottomRight: {
|
|
align: 'flex-end',
|
|
justify: 'flex-end'
|
|
},
|
|
center: {
|
|
align: 'center',
|
|
justify: 'center'
|
|
},
|
|
edge: {
|
|
align: 'center',
|
|
justify: 'space-between'
|
|
},
|
|
left: {
|
|
align: 'center',
|
|
justify: 'flex-start'
|
|
},
|
|
right: {
|
|
align: 'center',
|
|
justify: 'flex-end'
|
|
},
|
|
stretch: {
|
|
align: 'stretch'
|
|
},
|
|
top: {
|
|
align: 'flex-start',
|
|
justify: 'center'
|
|
},
|
|
topLeft: {
|
|
align: 'flex-start',
|
|
justify: 'flex-start'
|
|
},
|
|
topRight: {
|
|
align: 'flex-start',
|
|
justify: 'flex-end'
|
|
}
|
|
};
|
|
const V_ALIGNMENTS = {
|
|
bottom: {
|
|
justify: 'flex-end',
|
|
align: 'center'
|
|
},
|
|
bottomLeft: {
|
|
justify: 'flex-end',
|
|
align: 'flex-start'
|
|
},
|
|
bottomRight: {
|
|
justify: 'flex-end',
|
|
align: 'flex-end'
|
|
},
|
|
center: {
|
|
justify: 'center',
|
|
align: 'center'
|
|
},
|
|
edge: {
|
|
justify: 'space-between',
|
|
align: 'center'
|
|
},
|
|
left: {
|
|
justify: 'center',
|
|
align: 'flex-start'
|
|
},
|
|
right: {
|
|
justify: 'center',
|
|
align: 'flex-end'
|
|
},
|
|
stretch: {
|
|
align: 'stretch'
|
|
},
|
|
top: {
|
|
justify: 'flex-start',
|
|
align: 'center'
|
|
},
|
|
topLeft: {
|
|
justify: 'flex-start',
|
|
align: 'flex-start'
|
|
},
|
|
topRight: {
|
|
justify: 'flex-start',
|
|
align: 'flex-end'
|
|
}
|
|
};
|
|
function getAlignmentProps(alignment, direction = 'row') {
|
|
if (!(0,values/* isValueDefined */.J5)(alignment)) {
|
|
return {};
|
|
}
|
|
const isVertical = direction === 'column';
|
|
const props = isVertical ? V_ALIGNMENTS : H_ALIGNMENTS;
|
|
const alignmentProps = alignment in props ? props[alignment] : {
|
|
align: alignment
|
|
};
|
|
return alignmentProps;
|
|
}
|
|
//# sourceMappingURL=utils.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js
|
|
var react = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/get-valid-children.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Gets a collection of available children elements from a React component's children prop.
|
|
*
|
|
* @param children
|
|
*
|
|
* @return An array of available children.
|
|
*/
|
|
function getValidChildren(children) {
|
|
if (typeof children === 'string') {
|
|
return [children];
|
|
}
|
|
return react.Children.toArray(children).filter(child => (0,react.isValidElement)(child));
|
|
}
|
|
//# sourceMappingURL=get-valid-children.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/h-stack/hook.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function useHStack(props) {
|
|
const {
|
|
alignment = 'edge',
|
|
children,
|
|
direction,
|
|
spacing = 2,
|
|
...otherProps
|
|
} = (0,use_context_system/* useContextSystem */.A)(props, 'HStack');
|
|
const align = getAlignmentProps(alignment, direction);
|
|
const validChildren = getValidChildren(children);
|
|
const clonedChildren = validChildren.map((child, index) => {
|
|
const _isSpacer = (0,context_connect/* hasConnectNamespace */.SZ)(child, ['Spacer']);
|
|
if (_isSpacer) {
|
|
const childElement = child;
|
|
const _key = childElement.key || `hstack-${index}`;
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(component/* default */.A, {
|
|
isBlock: true,
|
|
...childElement.props
|
|
}, _key);
|
|
}
|
|
return child;
|
|
});
|
|
const propsForFlex = {
|
|
children: clonedChildren,
|
|
direction,
|
|
justify: 'center',
|
|
...align,
|
|
...otherProps,
|
|
gap: spacing
|
|
};
|
|
|
|
// Omit `isColumn` because it's not used in HStack.
|
|
const {
|
|
isColumn,
|
|
...flexProps
|
|
} = (0,hook/* useFlex */.v)(propsForFlex);
|
|
return flexProps;
|
|
}
|
|
//# sourceMappingURL=hook.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/heading/component.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
A: () => (/* binding */ heading_component)
|
|
});
|
|
|
|
// UNUSED EXPORTS: Heading
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-connect.js
|
|
var context_connect = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-connect.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/view/component.js
|
|
var component = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/view/component.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js + 1 modules
|
|
var use_context_system = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/text/hook.js + 4 modules
|
|
var hook = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/text/hook.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/font-size.js
|
|
var font_size = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/font-size.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/colors-values.js
|
|
var colors_values = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/colors-values.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/config-values.js
|
|
var config_values = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/config-values.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/heading/hook.js
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
function useHeading(props) {
|
|
const {
|
|
as: asProp,
|
|
level = 2,
|
|
color = colors_values/* COLORS */.l.gray[900],
|
|
isBlock = true,
|
|
weight = config_values/* default */.A.fontWeightHeading,
|
|
...otherProps
|
|
} = (0,use_context_system/* useContextSystem */.A)(props, 'Heading');
|
|
const as = asProp || `h${level}`;
|
|
const a11yProps = {};
|
|
if (typeof as === 'string' && as[0] !== 'h') {
|
|
// If not a semantic `h` element, add a11y props:
|
|
a11yProps.role = 'heading';
|
|
a11yProps['aria-level'] = typeof level === 'string' ? parseInt(level) : level;
|
|
}
|
|
const textProps = (0,hook/* default */.A)({
|
|
color,
|
|
isBlock,
|
|
weight,
|
|
size: (0,font_size/* getHeadingFontSize */.fM)(level),
|
|
...otherProps
|
|
});
|
|
return {
|
|
...textProps,
|
|
...a11yProps,
|
|
as
|
|
};
|
|
}
|
|
//# sourceMappingURL=hook.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/heading/component.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
function UnconnectedHeading(props, forwardedRef) {
|
|
const headerProps = useHeading(props);
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(component/* default */.A, {
|
|
...headerProps,
|
|
ref: forwardedRef
|
|
});
|
|
}
|
|
|
|
/**
|
|
* `Heading` renders headings and titles using the library's typography system.
|
|
*
|
|
* ```jsx
|
|
* import { __experimentalHeading as Heading } from "@wordpress/components";
|
|
*
|
|
* function Example() {
|
|
* return <Heading>Code is Poetry</Heading>;
|
|
* }
|
|
* ```
|
|
*/
|
|
const Heading = (0,context_connect/* contextConnect */.KZ)(UnconnectedHeading, 'Heading');
|
|
/* harmony default export */ const heading_component = (Heading);
|
|
//# sourceMappingURL=component.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/icon/index.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
A: () => (/* binding */ icon)
|
|
});
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js
|
|
var react = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+primitives@4.7.0_react@17.0.2/node_modules/@wordpress/primitives/build-module/svg/index.js
|
|
var svg = __webpack_require__("../../node_modules/.pnpm/@wordpress+primitives@4.7.0_react@17.0.2/node_modules/@wordpress/primitives/build-module/svg/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/dashicon/index.js
|
|
|
|
/**
|
|
* @typedef OwnProps
|
|
*
|
|
* @property {import('./types').IconKey} icon Icon name
|
|
* @property {string} [className] Class name
|
|
* @property {number} [size] Size of the icon
|
|
*/
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
function Dashicon({
|
|
icon,
|
|
className,
|
|
size = 20,
|
|
style = {},
|
|
...extraProps
|
|
}) {
|
|
const iconClass = ['dashicon', 'dashicons', 'dashicons-' + icon, className].filter(Boolean).join(' ');
|
|
|
|
// For retro-compatibility reasons (for example if people are overriding icon size with CSS), we add inline styles just if the size is different to the default
|
|
const sizeStyles =
|
|
// using `!=` to catch both 20 and "20"
|
|
// eslint-disable-next-line eqeqeq
|
|
20 != size ? {
|
|
fontSize: `${size}px`,
|
|
width: `${size}px`,
|
|
height: `${size}px`
|
|
} : {};
|
|
const styles = {
|
|
...sizeStyles,
|
|
...style
|
|
};
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: iconClass,
|
|
style: styles,
|
|
...extraProps
|
|
});
|
|
}
|
|
/* harmony default export */ const dashicon = (Dashicon);
|
|
//# sourceMappingURL=index.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/icon/index.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
function Icon({
|
|
icon = null,
|
|
size = 'string' === typeof icon ? 20 : 24,
|
|
...additionalProps
|
|
}) {
|
|
if ('string' === typeof icon) {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(dashicon, {
|
|
icon: icon,
|
|
size: size,
|
|
...additionalProps
|
|
});
|
|
}
|
|
if ((0,react.isValidElement)(icon) && dashicon === icon.type) {
|
|
return (0,react.cloneElement)(icon, {
|
|
...additionalProps
|
|
});
|
|
}
|
|
if ('function' === typeof icon) {
|
|
return (0,react.createElement)(icon, {
|
|
size,
|
|
...additionalProps
|
|
});
|
|
}
|
|
if (icon && (icon.type === 'svg' || icon.type === svg/* SVG */.t4)) {
|
|
const appliedProps = {
|
|
...icon.props,
|
|
width: size,
|
|
height: size,
|
|
...additionalProps
|
|
};
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(svg/* SVG */.t4, {
|
|
...appliedProps
|
|
});
|
|
}
|
|
if ((0,react.isValidElement)(icon)) {
|
|
return (0,react.cloneElement)(icon, {
|
|
// @ts-ignore Just forwarding the size prop along
|
|
size,
|
|
...additionalProps
|
|
});
|
|
}
|
|
return icon;
|
|
}
|
|
/* harmony default export */ const icon = (Icon);
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/index.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
Ay: () => (/* binding */ input_control)
|
|
});
|
|
|
|
// UNUSED EXPORTS: InputControl, UnforwardedInputControl
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
var clsx = __webpack_require__("../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-instance-id/index.js
|
|
var use_instance_id = __webpack_require__("../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-instance-id/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js
|
|
var react = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/input-base.js + 2 modules
|
|
var input_base = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/input-base.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@use-gesture+core@10.3.1/node_modules/@use-gesture/core/dist/maths-0ab39ae9.esm.js
|
|
function clamp(v, min, max) {
|
|
return Math.max(min, Math.min(v, max));
|
|
}
|
|
const V = {
|
|
toVector(v, fallback) {
|
|
if (v === undefined) v = fallback;
|
|
return Array.isArray(v) ? v : [v, v];
|
|
},
|
|
add(v1, v2) {
|
|
return [v1[0] + v2[0], v1[1] + v2[1]];
|
|
},
|
|
sub(v1, v2) {
|
|
return [v1[0] - v2[0], v1[1] - v2[1]];
|
|
},
|
|
addTo(v1, v2) {
|
|
v1[0] += v2[0];
|
|
v1[1] += v2[1];
|
|
},
|
|
subTo(v1, v2) {
|
|
v1[0] -= v2[0];
|
|
v1[1] -= v2[1];
|
|
}
|
|
};
|
|
function rubberband(distance, dimension, constant) {
|
|
if (dimension === 0 || Math.abs(dimension) === Infinity) return Math.pow(distance, constant * 5);
|
|
return distance * dimension * constant / (dimension + constant * distance);
|
|
}
|
|
function rubberbandIfOutOfBounds(position, min, max, constant = 0.15) {
|
|
if (constant === 0) return clamp(position, min, max);
|
|
if (position < min) return -rubberband(min - position, max - min, constant) + min;
|
|
if (position > max) return +rubberband(position - max, max - min, constant) + max;
|
|
return position;
|
|
}
|
|
function computeRubberband(bounds, [Vx, Vy], [Rx, Ry]) {
|
|
const [[X0, X1], [Y0, Y1]] = bounds;
|
|
return [rubberbandIfOutOfBounds(Vx, X0, X1, Rx), rubberbandIfOutOfBounds(Vy, Y0, Y1, Ry)];
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@use-gesture+core@10.3.1/node_modules/@use-gesture/core/dist/actions-fe213e88.esm.js
|
|
|
|
|
|
function _toPrimitive(input, hint) {
|
|
if (typeof input !== "object" || input === null) return input;
|
|
var prim = input[Symbol.toPrimitive];
|
|
if (prim !== undefined) {
|
|
var res = prim.call(input, hint || "default");
|
|
if (typeof res !== "object") return res;
|
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
}
|
|
return (hint === "string" ? String : Number)(input);
|
|
}
|
|
|
|
function _toPropertyKey(arg) {
|
|
var key = _toPrimitive(arg, "string");
|
|
return typeof key === "symbol" ? key : String(key);
|
|
}
|
|
|
|
function _defineProperty(obj, key, value) {
|
|
key = _toPropertyKey(key);
|
|
if (key in obj) {
|
|
Object.defineProperty(obj, key, {
|
|
value: value,
|
|
enumerable: true,
|
|
configurable: true,
|
|
writable: true
|
|
});
|
|
} else {
|
|
obj[key] = value;
|
|
}
|
|
return obj;
|
|
}
|
|
|
|
function ownKeys(e, r) {
|
|
var t = Object.keys(e);
|
|
if (Object.getOwnPropertySymbols) {
|
|
var o = Object.getOwnPropertySymbols(e);
|
|
r && (o = o.filter(function (r) {
|
|
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
})), t.push.apply(t, o);
|
|
}
|
|
return t;
|
|
}
|
|
function _objectSpread2(e) {
|
|
for (var r = 1; r < arguments.length; r++) {
|
|
var t = null != arguments[r] ? arguments[r] : {};
|
|
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
|
_defineProperty(e, r, t[r]);
|
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
});
|
|
}
|
|
return e;
|
|
}
|
|
|
|
const EVENT_TYPE_MAP = {
|
|
pointer: {
|
|
start: 'down',
|
|
change: 'move',
|
|
end: 'up'
|
|
},
|
|
mouse: {
|
|
start: 'down',
|
|
change: 'move',
|
|
end: 'up'
|
|
},
|
|
touch: {
|
|
start: 'start',
|
|
change: 'move',
|
|
end: 'end'
|
|
},
|
|
gesture: {
|
|
start: 'start',
|
|
change: 'change',
|
|
end: 'end'
|
|
}
|
|
};
|
|
function capitalize(string) {
|
|
if (!string) return '';
|
|
return string[0].toUpperCase() + string.slice(1);
|
|
}
|
|
const actionsWithoutCaptureSupported = ['enter', 'leave'];
|
|
function hasCapture(capture = false, actionKey) {
|
|
return capture && !actionsWithoutCaptureSupported.includes(actionKey);
|
|
}
|
|
function toHandlerProp(device, action = '', capture = false) {
|
|
const deviceProps = EVENT_TYPE_MAP[device];
|
|
const actionKey = deviceProps ? deviceProps[action] || action : action;
|
|
return 'on' + capitalize(device) + capitalize(actionKey) + (hasCapture(capture, actionKey) ? 'Capture' : '');
|
|
}
|
|
const pointerCaptureEvents = ['gotpointercapture', 'lostpointercapture'];
|
|
function parseProp(prop) {
|
|
let eventKey = prop.substring(2).toLowerCase();
|
|
const passive = !!~eventKey.indexOf('passive');
|
|
if (passive) eventKey = eventKey.replace('passive', '');
|
|
const captureKey = pointerCaptureEvents.includes(eventKey) ? 'capturecapture' : 'capture';
|
|
const capture = !!~eventKey.indexOf(captureKey);
|
|
if (capture) eventKey = eventKey.replace('capture', '');
|
|
return {
|
|
device: eventKey,
|
|
capture,
|
|
passive
|
|
};
|
|
}
|
|
function toDomEventType(device, action = '') {
|
|
const deviceProps = EVENT_TYPE_MAP[device];
|
|
const actionKey = deviceProps ? deviceProps[action] || action : action;
|
|
return device + actionKey;
|
|
}
|
|
function isTouch(event) {
|
|
return 'touches' in event;
|
|
}
|
|
function getPointerType(event) {
|
|
if (isTouch(event)) return 'touch';
|
|
if ('pointerType' in event) return event.pointerType;
|
|
return 'mouse';
|
|
}
|
|
function getCurrentTargetTouchList(event) {
|
|
return Array.from(event.touches).filter(e => {
|
|
var _event$currentTarget, _event$currentTarget$;
|
|
return e.target === event.currentTarget || ((_event$currentTarget = event.currentTarget) === null || _event$currentTarget === void 0 || (_event$currentTarget$ = _event$currentTarget.contains) === null || _event$currentTarget$ === void 0 ? void 0 : _event$currentTarget$.call(_event$currentTarget, e.target));
|
|
});
|
|
}
|
|
function getTouchList(event) {
|
|
return event.type === 'touchend' || event.type === 'touchcancel' ? event.changedTouches : event.targetTouches;
|
|
}
|
|
function getValueEvent(event) {
|
|
return isTouch(event) ? getTouchList(event)[0] : event;
|
|
}
|
|
function distanceAngle(P1, P2) {
|
|
try {
|
|
const dx = P2.clientX - P1.clientX;
|
|
const dy = P2.clientY - P1.clientY;
|
|
const cx = (P2.clientX + P1.clientX) / 2;
|
|
const cy = (P2.clientY + P1.clientY) / 2;
|
|
const distance = Math.hypot(dx, dy);
|
|
const angle = -(Math.atan2(dx, dy) * 180) / Math.PI;
|
|
const origin = [cx, cy];
|
|
return {
|
|
angle,
|
|
distance,
|
|
origin
|
|
};
|
|
} catch (_unused) {}
|
|
return null;
|
|
}
|
|
function touchIds(event) {
|
|
return getCurrentTargetTouchList(event).map(touch => touch.identifier);
|
|
}
|
|
function touchDistanceAngle(event, ids) {
|
|
const [P1, P2] = Array.from(event.touches).filter(touch => ids.includes(touch.identifier));
|
|
return distanceAngle(P1, P2);
|
|
}
|
|
function pointerId(event) {
|
|
const valueEvent = getValueEvent(event);
|
|
return isTouch(event) ? valueEvent.identifier : valueEvent.pointerId;
|
|
}
|
|
function pointerValues(event) {
|
|
const valueEvent = getValueEvent(event);
|
|
return [valueEvent.clientX, valueEvent.clientY];
|
|
}
|
|
const LINE_HEIGHT = 40;
|
|
const PAGE_HEIGHT = 800;
|
|
function wheelValues(event) {
|
|
let {
|
|
deltaX,
|
|
deltaY,
|
|
deltaMode
|
|
} = event;
|
|
if (deltaMode === 1) {
|
|
deltaX *= LINE_HEIGHT;
|
|
deltaY *= LINE_HEIGHT;
|
|
} else if (deltaMode === 2) {
|
|
deltaX *= PAGE_HEIGHT;
|
|
deltaY *= PAGE_HEIGHT;
|
|
}
|
|
return [deltaX, deltaY];
|
|
}
|
|
function scrollValues(event) {
|
|
var _ref, _ref2;
|
|
const {
|
|
scrollX,
|
|
scrollY,
|
|
scrollLeft,
|
|
scrollTop
|
|
} = event.currentTarget;
|
|
return [(_ref = scrollX !== null && scrollX !== void 0 ? scrollX : scrollLeft) !== null && _ref !== void 0 ? _ref : 0, (_ref2 = scrollY !== null && scrollY !== void 0 ? scrollY : scrollTop) !== null && _ref2 !== void 0 ? _ref2 : 0];
|
|
}
|
|
function getEventDetails(event) {
|
|
const payload = {};
|
|
if ('buttons' in event) payload.buttons = event.buttons;
|
|
if ('shiftKey' in event) {
|
|
const {
|
|
shiftKey,
|
|
altKey,
|
|
metaKey,
|
|
ctrlKey
|
|
} = event;
|
|
Object.assign(payload, {
|
|
shiftKey,
|
|
altKey,
|
|
metaKey,
|
|
ctrlKey
|
|
});
|
|
}
|
|
return payload;
|
|
}
|
|
|
|
function call(v, ...args) {
|
|
if (typeof v === 'function') {
|
|
return v(...args);
|
|
} else {
|
|
return v;
|
|
}
|
|
}
|
|
function noop() {}
|
|
function chain(...fns) {
|
|
if (fns.length === 0) return noop;
|
|
if (fns.length === 1) return fns[0];
|
|
return function () {
|
|
let result;
|
|
for (const fn of fns) {
|
|
result = fn.apply(this, arguments) || result;
|
|
}
|
|
return result;
|
|
};
|
|
}
|
|
function assignDefault(value, fallback) {
|
|
return Object.assign({}, fallback, value || {});
|
|
}
|
|
|
|
const BEFORE_LAST_KINEMATICS_DELAY = 32;
|
|
class Engine {
|
|
constructor(ctrl, args, key) {
|
|
this.ctrl = ctrl;
|
|
this.args = args;
|
|
this.key = key;
|
|
if (!this.state) {
|
|
this.state = {};
|
|
this.computeValues([0, 0]);
|
|
this.computeInitial();
|
|
if (this.init) this.init();
|
|
this.reset();
|
|
}
|
|
}
|
|
get state() {
|
|
return this.ctrl.state[this.key];
|
|
}
|
|
set state(state) {
|
|
this.ctrl.state[this.key] = state;
|
|
}
|
|
get shared() {
|
|
return this.ctrl.state.shared;
|
|
}
|
|
get eventStore() {
|
|
return this.ctrl.gestureEventStores[this.key];
|
|
}
|
|
get timeoutStore() {
|
|
return this.ctrl.gestureTimeoutStores[this.key];
|
|
}
|
|
get config() {
|
|
return this.ctrl.config[this.key];
|
|
}
|
|
get sharedConfig() {
|
|
return this.ctrl.config.shared;
|
|
}
|
|
get handler() {
|
|
return this.ctrl.handlers[this.key];
|
|
}
|
|
reset() {
|
|
const {
|
|
state,
|
|
shared,
|
|
ingKey,
|
|
args
|
|
} = this;
|
|
shared[ingKey] = state._active = state.active = state._blocked = state._force = false;
|
|
state._step = [false, false];
|
|
state.intentional = false;
|
|
state._movement = [0, 0];
|
|
state._distance = [0, 0];
|
|
state._direction = [0, 0];
|
|
state._delta = [0, 0];
|
|
state._bounds = [[-Infinity, Infinity], [-Infinity, Infinity]];
|
|
state.args = args;
|
|
state.axis = undefined;
|
|
state.memo = undefined;
|
|
state.elapsedTime = state.timeDelta = 0;
|
|
state.direction = [0, 0];
|
|
state.distance = [0, 0];
|
|
state.overflow = [0, 0];
|
|
state._movementBound = [false, false];
|
|
state.velocity = [0, 0];
|
|
state.movement = [0, 0];
|
|
state.delta = [0, 0];
|
|
state.timeStamp = 0;
|
|
}
|
|
start(event) {
|
|
const state = this.state;
|
|
const config = this.config;
|
|
if (!state._active) {
|
|
this.reset();
|
|
this.computeInitial();
|
|
state._active = true;
|
|
state.target = event.target;
|
|
state.currentTarget = event.currentTarget;
|
|
state.lastOffset = config.from ? call(config.from, state) : state.offset;
|
|
state.offset = state.lastOffset;
|
|
state.startTime = state.timeStamp = event.timeStamp;
|
|
}
|
|
}
|
|
computeValues(values) {
|
|
const state = this.state;
|
|
state._values = values;
|
|
state.values = this.config.transform(values);
|
|
}
|
|
computeInitial() {
|
|
const state = this.state;
|
|
state._initial = state._values;
|
|
state.initial = state.values;
|
|
}
|
|
compute(event) {
|
|
const {
|
|
state,
|
|
config,
|
|
shared
|
|
} = this;
|
|
state.args = this.args;
|
|
let dt = 0;
|
|
if (event) {
|
|
state.event = event;
|
|
if (config.preventDefault && event.cancelable) state.event.preventDefault();
|
|
state.type = event.type;
|
|
shared.touches = this.ctrl.pointerIds.size || this.ctrl.touchIds.size;
|
|
shared.locked = !!document.pointerLockElement;
|
|
Object.assign(shared, getEventDetails(event));
|
|
shared.down = shared.pressed = shared.buttons % 2 === 1 || shared.touches > 0;
|
|
dt = event.timeStamp - state.timeStamp;
|
|
state.timeStamp = event.timeStamp;
|
|
state.elapsedTime = state.timeStamp - state.startTime;
|
|
}
|
|
if (state._active) {
|
|
const _absoluteDelta = state._delta.map(Math.abs);
|
|
V.addTo(state._distance, _absoluteDelta);
|
|
}
|
|
if (this.axisIntent) this.axisIntent(event);
|
|
const [_m0, _m1] = state._movement;
|
|
const [t0, t1] = config.threshold;
|
|
const {
|
|
_step,
|
|
values
|
|
} = state;
|
|
if (config.hasCustomTransform) {
|
|
if (_step[0] === false) _step[0] = Math.abs(_m0) >= t0 && values[0];
|
|
if (_step[1] === false) _step[1] = Math.abs(_m1) >= t1 && values[1];
|
|
} else {
|
|
if (_step[0] === false) _step[0] = Math.abs(_m0) >= t0 && Math.sign(_m0) * t0;
|
|
if (_step[1] === false) _step[1] = Math.abs(_m1) >= t1 && Math.sign(_m1) * t1;
|
|
}
|
|
state.intentional = _step[0] !== false || _step[1] !== false;
|
|
if (!state.intentional) return;
|
|
const movement = [0, 0];
|
|
if (config.hasCustomTransform) {
|
|
const [v0, v1] = values;
|
|
movement[0] = _step[0] !== false ? v0 - _step[0] : 0;
|
|
movement[1] = _step[1] !== false ? v1 - _step[1] : 0;
|
|
} else {
|
|
movement[0] = _step[0] !== false ? _m0 - _step[0] : 0;
|
|
movement[1] = _step[1] !== false ? _m1 - _step[1] : 0;
|
|
}
|
|
if (this.restrictToAxis && !state._blocked) this.restrictToAxis(movement);
|
|
const previousOffset = state.offset;
|
|
const gestureIsActive = state._active && !state._blocked || state.active;
|
|
if (gestureIsActive) {
|
|
state.first = state._active && !state.active;
|
|
state.last = !state._active && state.active;
|
|
state.active = shared[this.ingKey] = state._active;
|
|
if (event) {
|
|
if (state.first) {
|
|
if ('bounds' in config) state._bounds = call(config.bounds, state);
|
|
if (this.setup) this.setup();
|
|
}
|
|
state.movement = movement;
|
|
this.computeOffset();
|
|
}
|
|
}
|
|
const [ox, oy] = state.offset;
|
|
const [[x0, x1], [y0, y1]] = state._bounds;
|
|
state.overflow = [ox < x0 ? -1 : ox > x1 ? 1 : 0, oy < y0 ? -1 : oy > y1 ? 1 : 0];
|
|
state._movementBound[0] = state.overflow[0] ? state._movementBound[0] === false ? state._movement[0] : state._movementBound[0] : false;
|
|
state._movementBound[1] = state.overflow[1] ? state._movementBound[1] === false ? state._movement[1] : state._movementBound[1] : false;
|
|
const rubberband = state._active ? config.rubberband || [0, 0] : [0, 0];
|
|
state.offset = computeRubberband(state._bounds, state.offset, rubberband);
|
|
state.delta = V.sub(state.offset, previousOffset);
|
|
this.computeMovement();
|
|
if (gestureIsActive && (!state.last || dt > BEFORE_LAST_KINEMATICS_DELAY)) {
|
|
state.delta = V.sub(state.offset, previousOffset);
|
|
const absoluteDelta = state.delta.map(Math.abs);
|
|
V.addTo(state.distance, absoluteDelta);
|
|
state.direction = state.delta.map(Math.sign);
|
|
state._direction = state._delta.map(Math.sign);
|
|
if (!state.first && dt > 0) {
|
|
state.velocity = [absoluteDelta[0] / dt, absoluteDelta[1] / dt];
|
|
state.timeDelta = dt;
|
|
}
|
|
}
|
|
}
|
|
emit() {
|
|
const state = this.state;
|
|
const shared = this.shared;
|
|
const config = this.config;
|
|
if (!state._active) this.clean();
|
|
if ((state._blocked || !state.intentional) && !state._force && !config.triggerAllEvents) return;
|
|
const memo = this.handler(_objectSpread2(_objectSpread2(_objectSpread2({}, shared), state), {}, {
|
|
[this.aliasKey]: state.values
|
|
}));
|
|
if (memo !== undefined) state.memo = memo;
|
|
}
|
|
clean() {
|
|
this.eventStore.clean();
|
|
this.timeoutStore.clean();
|
|
}
|
|
}
|
|
|
|
function selectAxis([dx, dy], threshold) {
|
|
const absDx = Math.abs(dx);
|
|
const absDy = Math.abs(dy);
|
|
if (absDx > absDy && absDx > threshold) {
|
|
return 'x';
|
|
}
|
|
if (absDy > absDx && absDy > threshold) {
|
|
return 'y';
|
|
}
|
|
return undefined;
|
|
}
|
|
class CoordinatesEngine extends Engine {
|
|
constructor(...args) {
|
|
super(...args);
|
|
_defineProperty(this, "aliasKey", 'xy');
|
|
}
|
|
reset() {
|
|
super.reset();
|
|
this.state.axis = undefined;
|
|
}
|
|
init() {
|
|
this.state.offset = [0, 0];
|
|
this.state.lastOffset = [0, 0];
|
|
}
|
|
computeOffset() {
|
|
this.state.offset = V.add(this.state.lastOffset, this.state.movement);
|
|
}
|
|
computeMovement() {
|
|
this.state.movement = V.sub(this.state.offset, this.state.lastOffset);
|
|
}
|
|
axisIntent(event) {
|
|
const state = this.state;
|
|
const config = this.config;
|
|
if (!state.axis && event) {
|
|
const threshold = typeof config.axisThreshold === 'object' ? config.axisThreshold[getPointerType(event)] : config.axisThreshold;
|
|
state.axis = selectAxis(state._movement, threshold);
|
|
}
|
|
state._blocked = (config.lockDirection || !!config.axis) && !state.axis || !!config.axis && config.axis !== state.axis;
|
|
}
|
|
restrictToAxis(v) {
|
|
if (this.config.axis || this.config.lockDirection) {
|
|
switch (this.state.axis) {
|
|
case 'x':
|
|
v[1] = 0;
|
|
break;
|
|
case 'y':
|
|
v[0] = 0;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
const identity = v => v;
|
|
const DEFAULT_RUBBERBAND = 0.15;
|
|
const commonConfigResolver = {
|
|
enabled(value = true) {
|
|
return value;
|
|
},
|
|
eventOptions(value, _k, config) {
|
|
return _objectSpread2(_objectSpread2({}, config.shared.eventOptions), value);
|
|
},
|
|
preventDefault(value = false) {
|
|
return value;
|
|
},
|
|
triggerAllEvents(value = false) {
|
|
return value;
|
|
},
|
|
rubberband(value = 0) {
|
|
switch (value) {
|
|
case true:
|
|
return [DEFAULT_RUBBERBAND, DEFAULT_RUBBERBAND];
|
|
case false:
|
|
return [0, 0];
|
|
default:
|
|
return V.toVector(value);
|
|
}
|
|
},
|
|
from(value) {
|
|
if (typeof value === 'function') return value;
|
|
if (value != null) return V.toVector(value);
|
|
},
|
|
transform(value, _k, config) {
|
|
const transform = value || config.shared.transform;
|
|
this.hasCustomTransform = !!transform;
|
|
if (false) {}
|
|
return transform || identity;
|
|
},
|
|
threshold(value) {
|
|
return V.toVector(value, 0);
|
|
}
|
|
};
|
|
if (false) {}
|
|
|
|
const DEFAULT_AXIS_THRESHOLD = 0;
|
|
const coordinatesConfigResolver = _objectSpread2(_objectSpread2({}, commonConfigResolver), {}, {
|
|
axis(_v, _k, {
|
|
axis
|
|
}) {
|
|
this.lockDirection = axis === 'lock';
|
|
if (!this.lockDirection) return axis;
|
|
},
|
|
axisThreshold(value = DEFAULT_AXIS_THRESHOLD) {
|
|
return value;
|
|
},
|
|
bounds(value = {}) {
|
|
if (typeof value === 'function') {
|
|
return state => coordinatesConfigResolver.bounds(value(state));
|
|
}
|
|
if ('current' in value) {
|
|
return () => value.current;
|
|
}
|
|
if (typeof HTMLElement === 'function' && value instanceof HTMLElement) {
|
|
return value;
|
|
}
|
|
const {
|
|
left = -Infinity,
|
|
right = Infinity,
|
|
top = -Infinity,
|
|
bottom = Infinity
|
|
} = value;
|
|
return [[left, right], [top, bottom]];
|
|
}
|
|
});
|
|
|
|
const KEYS_DELTA_MAP = {
|
|
ArrowRight: (displacement, factor = 1) => [displacement * factor, 0],
|
|
ArrowLeft: (displacement, factor = 1) => [-1 * displacement * factor, 0],
|
|
ArrowUp: (displacement, factor = 1) => [0, -1 * displacement * factor],
|
|
ArrowDown: (displacement, factor = 1) => [0, displacement * factor]
|
|
};
|
|
class DragEngine extends CoordinatesEngine {
|
|
constructor(...args) {
|
|
super(...args);
|
|
_defineProperty(this, "ingKey", 'dragging');
|
|
}
|
|
reset() {
|
|
super.reset();
|
|
const state = this.state;
|
|
state._pointerId = undefined;
|
|
state._pointerActive = false;
|
|
state._keyboardActive = false;
|
|
state._preventScroll = false;
|
|
state._delayed = false;
|
|
state.swipe = [0, 0];
|
|
state.tap = false;
|
|
state.canceled = false;
|
|
state.cancel = this.cancel.bind(this);
|
|
}
|
|
setup() {
|
|
const state = this.state;
|
|
if (state._bounds instanceof HTMLElement) {
|
|
const boundRect = state._bounds.getBoundingClientRect();
|
|
const targetRect = state.currentTarget.getBoundingClientRect();
|
|
const _bounds = {
|
|
left: boundRect.left - targetRect.left + state.offset[0],
|
|
right: boundRect.right - targetRect.right + state.offset[0],
|
|
top: boundRect.top - targetRect.top + state.offset[1],
|
|
bottom: boundRect.bottom - targetRect.bottom + state.offset[1]
|
|
};
|
|
state._bounds = coordinatesConfigResolver.bounds(_bounds);
|
|
}
|
|
}
|
|
cancel() {
|
|
const state = this.state;
|
|
if (state.canceled) return;
|
|
state.canceled = true;
|
|
state._active = false;
|
|
setTimeout(() => {
|
|
this.compute();
|
|
this.emit();
|
|
}, 0);
|
|
}
|
|
setActive() {
|
|
this.state._active = this.state._pointerActive || this.state._keyboardActive;
|
|
}
|
|
clean() {
|
|
this.pointerClean();
|
|
this.state._pointerActive = false;
|
|
this.state._keyboardActive = false;
|
|
super.clean();
|
|
}
|
|
pointerDown(event) {
|
|
const config = this.config;
|
|
const state = this.state;
|
|
if (event.buttons != null && (Array.isArray(config.pointerButtons) ? !config.pointerButtons.includes(event.buttons) : config.pointerButtons !== -1 && config.pointerButtons !== event.buttons)) return;
|
|
const ctrlIds = this.ctrl.setEventIds(event);
|
|
if (config.pointerCapture) {
|
|
event.target.setPointerCapture(event.pointerId);
|
|
}
|
|
if (ctrlIds && ctrlIds.size > 1 && state._pointerActive) return;
|
|
this.start(event);
|
|
this.setupPointer(event);
|
|
state._pointerId = pointerId(event);
|
|
state._pointerActive = true;
|
|
this.computeValues(pointerValues(event));
|
|
this.computeInitial();
|
|
if (config.preventScrollAxis && getPointerType(event) !== 'mouse') {
|
|
state._active = false;
|
|
this.setupScrollPrevention(event);
|
|
} else if (config.delay > 0) {
|
|
this.setupDelayTrigger(event);
|
|
if (config.triggerAllEvents) {
|
|
this.compute(event);
|
|
this.emit();
|
|
}
|
|
} else {
|
|
this.startPointerDrag(event);
|
|
}
|
|
}
|
|
startPointerDrag(event) {
|
|
const state = this.state;
|
|
state._active = true;
|
|
state._preventScroll = true;
|
|
state._delayed = false;
|
|
this.compute(event);
|
|
this.emit();
|
|
}
|
|
pointerMove(event) {
|
|
const state = this.state;
|
|
const config = this.config;
|
|
if (!state._pointerActive) return;
|
|
const id = pointerId(event);
|
|
if (state._pointerId !== undefined && id !== state._pointerId) return;
|
|
const _values = pointerValues(event);
|
|
if (document.pointerLockElement === event.target) {
|
|
state._delta = [event.movementX, event.movementY];
|
|
} else {
|
|
state._delta = V.sub(_values, state._values);
|
|
this.computeValues(_values);
|
|
}
|
|
V.addTo(state._movement, state._delta);
|
|
this.compute(event);
|
|
if (state._delayed && state.intentional) {
|
|
this.timeoutStore.remove('dragDelay');
|
|
state.active = false;
|
|
this.startPointerDrag(event);
|
|
return;
|
|
}
|
|
if (config.preventScrollAxis && !state._preventScroll) {
|
|
if (state.axis) {
|
|
if (state.axis === config.preventScrollAxis || config.preventScrollAxis === 'xy') {
|
|
state._active = false;
|
|
this.clean();
|
|
return;
|
|
} else {
|
|
this.timeoutStore.remove('startPointerDrag');
|
|
this.startPointerDrag(event);
|
|
return;
|
|
}
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
this.emit();
|
|
}
|
|
pointerUp(event) {
|
|
this.ctrl.setEventIds(event);
|
|
try {
|
|
if (this.config.pointerCapture && event.target.hasPointerCapture(event.pointerId)) {
|
|
;
|
|
event.target.releasePointerCapture(event.pointerId);
|
|
}
|
|
} catch (_unused) {
|
|
if (false) {}
|
|
}
|
|
const state = this.state;
|
|
const config = this.config;
|
|
if (!state._active || !state._pointerActive) return;
|
|
const id = pointerId(event);
|
|
if (state._pointerId !== undefined && id !== state._pointerId) return;
|
|
this.state._pointerActive = false;
|
|
this.setActive();
|
|
this.compute(event);
|
|
const [dx, dy] = state._distance;
|
|
state.tap = dx <= config.tapsThreshold && dy <= config.tapsThreshold;
|
|
if (state.tap && config.filterTaps) {
|
|
state._force = true;
|
|
} else {
|
|
const [_dx, _dy] = state._delta;
|
|
const [_mx, _my] = state._movement;
|
|
const [svx, svy] = config.swipe.velocity;
|
|
const [sx, sy] = config.swipe.distance;
|
|
const sdt = config.swipe.duration;
|
|
if (state.elapsedTime < sdt) {
|
|
const _vx = Math.abs(_dx / state.timeDelta);
|
|
const _vy = Math.abs(_dy / state.timeDelta);
|
|
if (_vx > svx && Math.abs(_mx) > sx) state.swipe[0] = Math.sign(_dx);
|
|
if (_vy > svy && Math.abs(_my) > sy) state.swipe[1] = Math.sign(_dy);
|
|
}
|
|
}
|
|
this.emit();
|
|
}
|
|
pointerClick(event) {
|
|
if (!this.state.tap && event.detail > 0) {
|
|
event.preventDefault();
|
|
event.stopPropagation();
|
|
}
|
|
}
|
|
setupPointer(event) {
|
|
const config = this.config;
|
|
const device = config.device;
|
|
if (false) {}
|
|
if (config.pointerLock) {
|
|
event.currentTarget.requestPointerLock();
|
|
}
|
|
if (!config.pointerCapture) {
|
|
this.eventStore.add(this.sharedConfig.window, device, 'change', this.pointerMove.bind(this));
|
|
this.eventStore.add(this.sharedConfig.window, device, 'end', this.pointerUp.bind(this));
|
|
this.eventStore.add(this.sharedConfig.window, device, 'cancel', this.pointerUp.bind(this));
|
|
}
|
|
}
|
|
pointerClean() {
|
|
if (this.config.pointerLock && document.pointerLockElement === this.state.currentTarget) {
|
|
document.exitPointerLock();
|
|
}
|
|
}
|
|
preventScroll(event) {
|
|
if (this.state._preventScroll && event.cancelable) {
|
|
event.preventDefault();
|
|
}
|
|
}
|
|
setupScrollPrevention(event) {
|
|
this.state._preventScroll = false;
|
|
persistEvent(event);
|
|
const remove = this.eventStore.add(this.sharedConfig.window, 'touch', 'change', this.preventScroll.bind(this), {
|
|
passive: false
|
|
});
|
|
this.eventStore.add(this.sharedConfig.window, 'touch', 'end', remove);
|
|
this.eventStore.add(this.sharedConfig.window, 'touch', 'cancel', remove);
|
|
this.timeoutStore.add('startPointerDrag', this.startPointerDrag.bind(this), this.config.preventScrollDelay, event);
|
|
}
|
|
setupDelayTrigger(event) {
|
|
this.state._delayed = true;
|
|
this.timeoutStore.add('dragDelay', () => {
|
|
this.state._step = [0, 0];
|
|
this.startPointerDrag(event);
|
|
}, this.config.delay);
|
|
}
|
|
keyDown(event) {
|
|
const deltaFn = KEYS_DELTA_MAP[event.key];
|
|
if (deltaFn) {
|
|
const state = this.state;
|
|
const factor = event.shiftKey ? 10 : event.altKey ? 0.1 : 1;
|
|
this.start(event);
|
|
state._delta = deltaFn(this.config.keyboardDisplacement, factor);
|
|
state._keyboardActive = true;
|
|
V.addTo(state._movement, state._delta);
|
|
this.compute(event);
|
|
this.emit();
|
|
}
|
|
}
|
|
keyUp(event) {
|
|
if (!(event.key in KEYS_DELTA_MAP)) return;
|
|
this.state._keyboardActive = false;
|
|
this.setActive();
|
|
this.compute(event);
|
|
this.emit();
|
|
}
|
|
bind(bindFunction) {
|
|
const device = this.config.device;
|
|
bindFunction(device, 'start', this.pointerDown.bind(this));
|
|
if (this.config.pointerCapture) {
|
|
bindFunction(device, 'change', this.pointerMove.bind(this));
|
|
bindFunction(device, 'end', this.pointerUp.bind(this));
|
|
bindFunction(device, 'cancel', this.pointerUp.bind(this));
|
|
bindFunction('lostPointerCapture', '', this.pointerUp.bind(this));
|
|
}
|
|
if (this.config.keys) {
|
|
bindFunction('key', 'down', this.keyDown.bind(this));
|
|
bindFunction('key', 'up', this.keyUp.bind(this));
|
|
}
|
|
if (this.config.filterTaps) {
|
|
bindFunction('click', '', this.pointerClick.bind(this), {
|
|
capture: true,
|
|
passive: false
|
|
});
|
|
}
|
|
}
|
|
}
|
|
function persistEvent(event) {
|
|
'persist' in event && typeof event.persist === 'function' && event.persist();
|
|
}
|
|
|
|
const isBrowser = typeof window !== 'undefined' && window.document && window.document.createElement;
|
|
function supportsTouchEvents() {
|
|
return isBrowser && 'ontouchstart' in window;
|
|
}
|
|
function isTouchScreen() {
|
|
return supportsTouchEvents() || isBrowser && window.navigator.maxTouchPoints > 1;
|
|
}
|
|
function supportsPointerEvents() {
|
|
return isBrowser && 'onpointerdown' in window;
|
|
}
|
|
function supportsPointerLock() {
|
|
return isBrowser && 'exitPointerLock' in window.document;
|
|
}
|
|
function supportsGestureEvents() {
|
|
try {
|
|
return 'constructor' in GestureEvent;
|
|
} catch (e) {
|
|
return false;
|
|
}
|
|
}
|
|
const SUPPORT = {
|
|
isBrowser,
|
|
gesture: supportsGestureEvents(),
|
|
touch: supportsTouchEvents(),
|
|
touchscreen: isTouchScreen(),
|
|
pointer: supportsPointerEvents(),
|
|
pointerLock: supportsPointerLock()
|
|
};
|
|
|
|
const DEFAULT_PREVENT_SCROLL_DELAY = 250;
|
|
const DEFAULT_DRAG_DELAY = 180;
|
|
const DEFAULT_SWIPE_VELOCITY = 0.5;
|
|
const DEFAULT_SWIPE_DISTANCE = 50;
|
|
const DEFAULT_SWIPE_DURATION = 250;
|
|
const DEFAULT_KEYBOARD_DISPLACEMENT = 10;
|
|
const DEFAULT_DRAG_AXIS_THRESHOLD = {
|
|
mouse: 0,
|
|
touch: 0,
|
|
pen: 8
|
|
};
|
|
const dragConfigResolver = _objectSpread2(_objectSpread2({}, coordinatesConfigResolver), {}, {
|
|
device(_v, _k, {
|
|
pointer: {
|
|
touch = false,
|
|
lock = false,
|
|
mouse = false
|
|
} = {}
|
|
}) {
|
|
this.pointerLock = lock && SUPPORT.pointerLock;
|
|
if (SUPPORT.touch && touch) return 'touch';
|
|
if (this.pointerLock) return 'mouse';
|
|
if (SUPPORT.pointer && !mouse) return 'pointer';
|
|
if (SUPPORT.touch) return 'touch';
|
|
return 'mouse';
|
|
},
|
|
preventScrollAxis(value, _k, {
|
|
preventScroll
|
|
}) {
|
|
this.preventScrollDelay = typeof preventScroll === 'number' ? preventScroll : preventScroll || preventScroll === undefined && value ? DEFAULT_PREVENT_SCROLL_DELAY : undefined;
|
|
if (!SUPPORT.touchscreen || preventScroll === false) return undefined;
|
|
return value ? value : preventScroll !== undefined ? 'y' : undefined;
|
|
},
|
|
pointerCapture(_v, _k, {
|
|
pointer: {
|
|
capture = true,
|
|
buttons = 1,
|
|
keys = true
|
|
} = {}
|
|
}) {
|
|
this.pointerButtons = buttons;
|
|
this.keys = keys;
|
|
return !this.pointerLock && this.device === 'pointer' && capture;
|
|
},
|
|
threshold(value, _k, {
|
|
filterTaps = false,
|
|
tapsThreshold = 3,
|
|
axis = undefined
|
|
}) {
|
|
const threshold = V.toVector(value, filterTaps ? tapsThreshold : axis ? 1 : 0);
|
|
this.filterTaps = filterTaps;
|
|
this.tapsThreshold = tapsThreshold;
|
|
return threshold;
|
|
},
|
|
swipe({
|
|
velocity = DEFAULT_SWIPE_VELOCITY,
|
|
distance = DEFAULT_SWIPE_DISTANCE,
|
|
duration = DEFAULT_SWIPE_DURATION
|
|
} = {}) {
|
|
return {
|
|
velocity: this.transform(V.toVector(velocity)),
|
|
distance: this.transform(V.toVector(distance)),
|
|
duration
|
|
};
|
|
},
|
|
delay(value = 0) {
|
|
switch (value) {
|
|
case true:
|
|
return DEFAULT_DRAG_DELAY;
|
|
case false:
|
|
return 0;
|
|
default:
|
|
return value;
|
|
}
|
|
},
|
|
axisThreshold(value) {
|
|
if (!value) return DEFAULT_DRAG_AXIS_THRESHOLD;
|
|
return _objectSpread2(_objectSpread2({}, DEFAULT_DRAG_AXIS_THRESHOLD), value);
|
|
},
|
|
keyboardDisplacement(value = DEFAULT_KEYBOARD_DISPLACEMENT) {
|
|
return value;
|
|
}
|
|
});
|
|
if (false) {}
|
|
|
|
function clampStateInternalMovementToBounds(state) {
|
|
const [ox, oy] = state.overflow;
|
|
const [dx, dy] = state._delta;
|
|
const [dirx, diry] = state._direction;
|
|
if (ox < 0 && dx > 0 && dirx < 0 || ox > 0 && dx < 0 && dirx > 0) {
|
|
state._movement[0] = state._movementBound[0];
|
|
}
|
|
if (oy < 0 && dy > 0 && diry < 0 || oy > 0 && dy < 0 && diry > 0) {
|
|
state._movement[1] = state._movementBound[1];
|
|
}
|
|
}
|
|
|
|
const SCALE_ANGLE_RATIO_INTENT_DEG = 30;
|
|
const PINCH_WHEEL_RATIO = 100;
|
|
class PinchEngine extends Engine {
|
|
constructor(...args) {
|
|
super(...args);
|
|
_defineProperty(this, "ingKey", 'pinching');
|
|
_defineProperty(this, "aliasKey", 'da');
|
|
}
|
|
init() {
|
|
this.state.offset = [1, 0];
|
|
this.state.lastOffset = [1, 0];
|
|
this.state._pointerEvents = new Map();
|
|
}
|
|
reset() {
|
|
super.reset();
|
|
const state = this.state;
|
|
state._touchIds = [];
|
|
state.canceled = false;
|
|
state.cancel = this.cancel.bind(this);
|
|
state.turns = 0;
|
|
}
|
|
computeOffset() {
|
|
const {
|
|
type,
|
|
movement,
|
|
lastOffset
|
|
} = this.state;
|
|
if (type === 'wheel') {
|
|
this.state.offset = V.add(movement, lastOffset);
|
|
} else {
|
|
this.state.offset = [(1 + movement[0]) * lastOffset[0], movement[1] + lastOffset[1]];
|
|
}
|
|
}
|
|
computeMovement() {
|
|
const {
|
|
offset,
|
|
lastOffset
|
|
} = this.state;
|
|
this.state.movement = [offset[0] / lastOffset[0], offset[1] - lastOffset[1]];
|
|
}
|
|
axisIntent() {
|
|
const state = this.state;
|
|
const [_m0, _m1] = state._movement;
|
|
if (!state.axis) {
|
|
const axisMovementDifference = Math.abs(_m0) * SCALE_ANGLE_RATIO_INTENT_DEG - Math.abs(_m1);
|
|
if (axisMovementDifference < 0) state.axis = 'angle';else if (axisMovementDifference > 0) state.axis = 'scale';
|
|
}
|
|
}
|
|
restrictToAxis(v) {
|
|
if (this.config.lockDirection) {
|
|
if (this.state.axis === 'scale') v[1] = 0;else if (this.state.axis === 'angle') v[0] = 0;
|
|
}
|
|
}
|
|
cancel() {
|
|
const state = this.state;
|
|
if (state.canceled) return;
|
|
setTimeout(() => {
|
|
state.canceled = true;
|
|
state._active = false;
|
|
this.compute();
|
|
this.emit();
|
|
}, 0);
|
|
}
|
|
touchStart(event) {
|
|
this.ctrl.setEventIds(event);
|
|
const state = this.state;
|
|
const ctrlTouchIds = this.ctrl.touchIds;
|
|
if (state._active) {
|
|
if (state._touchIds.every(id => ctrlTouchIds.has(id))) return;
|
|
}
|
|
if (ctrlTouchIds.size < 2) return;
|
|
this.start(event);
|
|
state._touchIds = Array.from(ctrlTouchIds).slice(0, 2);
|
|
const payload = touchDistanceAngle(event, state._touchIds);
|
|
if (!payload) return;
|
|
this.pinchStart(event, payload);
|
|
}
|
|
pointerStart(event) {
|
|
if (event.buttons != null && event.buttons % 2 !== 1) return;
|
|
this.ctrl.setEventIds(event);
|
|
event.target.setPointerCapture(event.pointerId);
|
|
const state = this.state;
|
|
const _pointerEvents = state._pointerEvents;
|
|
const ctrlPointerIds = this.ctrl.pointerIds;
|
|
if (state._active) {
|
|
if (Array.from(_pointerEvents.keys()).every(id => ctrlPointerIds.has(id))) return;
|
|
}
|
|
if (_pointerEvents.size < 2) {
|
|
_pointerEvents.set(event.pointerId, event);
|
|
}
|
|
if (state._pointerEvents.size < 2) return;
|
|
this.start(event);
|
|
const payload = distanceAngle(...Array.from(_pointerEvents.values()));
|
|
if (!payload) return;
|
|
this.pinchStart(event, payload);
|
|
}
|
|
pinchStart(event, payload) {
|
|
const state = this.state;
|
|
state.origin = payload.origin;
|
|
this.computeValues([payload.distance, payload.angle]);
|
|
this.computeInitial();
|
|
this.compute(event);
|
|
this.emit();
|
|
}
|
|
touchMove(event) {
|
|
if (!this.state._active) return;
|
|
const payload = touchDistanceAngle(event, this.state._touchIds);
|
|
if (!payload) return;
|
|
this.pinchMove(event, payload);
|
|
}
|
|
pointerMove(event) {
|
|
const _pointerEvents = this.state._pointerEvents;
|
|
if (_pointerEvents.has(event.pointerId)) {
|
|
_pointerEvents.set(event.pointerId, event);
|
|
}
|
|
if (!this.state._active) return;
|
|
const payload = distanceAngle(...Array.from(_pointerEvents.values()));
|
|
if (!payload) return;
|
|
this.pinchMove(event, payload);
|
|
}
|
|
pinchMove(event, payload) {
|
|
const state = this.state;
|
|
const prev_a = state._values[1];
|
|
const delta_a = payload.angle - prev_a;
|
|
let delta_turns = 0;
|
|
if (Math.abs(delta_a) > 270) delta_turns += Math.sign(delta_a);
|
|
this.computeValues([payload.distance, payload.angle - 360 * delta_turns]);
|
|
state.origin = payload.origin;
|
|
state.turns = delta_turns;
|
|
state._movement = [state._values[0] / state._initial[0] - 1, state._values[1] - state._initial[1]];
|
|
this.compute(event);
|
|
this.emit();
|
|
}
|
|
touchEnd(event) {
|
|
this.ctrl.setEventIds(event);
|
|
if (!this.state._active) return;
|
|
if (this.state._touchIds.some(id => !this.ctrl.touchIds.has(id))) {
|
|
this.state._active = false;
|
|
this.compute(event);
|
|
this.emit();
|
|
}
|
|
}
|
|
pointerEnd(event) {
|
|
const state = this.state;
|
|
this.ctrl.setEventIds(event);
|
|
try {
|
|
event.target.releasePointerCapture(event.pointerId);
|
|
} catch (_unused) {}
|
|
if (state._pointerEvents.has(event.pointerId)) {
|
|
state._pointerEvents.delete(event.pointerId);
|
|
}
|
|
if (!state._active) return;
|
|
if (state._pointerEvents.size < 2) {
|
|
state._active = false;
|
|
this.compute(event);
|
|
this.emit();
|
|
}
|
|
}
|
|
gestureStart(event) {
|
|
if (event.cancelable) event.preventDefault();
|
|
const state = this.state;
|
|
if (state._active) return;
|
|
this.start(event);
|
|
this.computeValues([event.scale, event.rotation]);
|
|
state.origin = [event.clientX, event.clientY];
|
|
this.compute(event);
|
|
this.emit();
|
|
}
|
|
gestureMove(event) {
|
|
if (event.cancelable) event.preventDefault();
|
|
if (!this.state._active) return;
|
|
const state = this.state;
|
|
this.computeValues([event.scale, event.rotation]);
|
|
state.origin = [event.clientX, event.clientY];
|
|
const _previousMovement = state._movement;
|
|
state._movement = [event.scale - 1, event.rotation];
|
|
state._delta = V.sub(state._movement, _previousMovement);
|
|
this.compute(event);
|
|
this.emit();
|
|
}
|
|
gestureEnd(event) {
|
|
if (!this.state._active) return;
|
|
this.state._active = false;
|
|
this.compute(event);
|
|
this.emit();
|
|
}
|
|
wheel(event) {
|
|
const modifierKey = this.config.modifierKey;
|
|
if (modifierKey && (Array.isArray(modifierKey) ? !modifierKey.find(k => event[k]) : !event[modifierKey])) return;
|
|
if (!this.state._active) this.wheelStart(event);else this.wheelChange(event);
|
|
this.timeoutStore.add('wheelEnd', this.wheelEnd.bind(this));
|
|
}
|
|
wheelStart(event) {
|
|
this.start(event);
|
|
this.wheelChange(event);
|
|
}
|
|
wheelChange(event) {
|
|
const isR3f = ('uv' in event);
|
|
if (!isR3f) {
|
|
if (event.cancelable) {
|
|
event.preventDefault();
|
|
}
|
|
if (false) {}
|
|
}
|
|
const state = this.state;
|
|
state._delta = [-wheelValues(event)[1] / PINCH_WHEEL_RATIO * state.offset[0], 0];
|
|
V.addTo(state._movement, state._delta);
|
|
clampStateInternalMovementToBounds(state);
|
|
this.state.origin = [event.clientX, event.clientY];
|
|
this.compute(event);
|
|
this.emit();
|
|
}
|
|
wheelEnd() {
|
|
if (!this.state._active) return;
|
|
this.state._active = false;
|
|
this.compute();
|
|
this.emit();
|
|
}
|
|
bind(bindFunction) {
|
|
const device = this.config.device;
|
|
if (!!device) {
|
|
bindFunction(device, 'start', this[device + 'Start'].bind(this));
|
|
bindFunction(device, 'change', this[device + 'Move'].bind(this));
|
|
bindFunction(device, 'end', this[device + 'End'].bind(this));
|
|
bindFunction(device, 'cancel', this[device + 'End'].bind(this));
|
|
bindFunction('lostPointerCapture', '', this[device + 'End'].bind(this));
|
|
}
|
|
if (this.config.pinchOnWheel) {
|
|
bindFunction('wheel', '', this.wheel.bind(this), {
|
|
passive: false
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
const pinchConfigResolver = _objectSpread2(_objectSpread2({}, commonConfigResolver), {}, {
|
|
device(_v, _k, {
|
|
shared,
|
|
pointer: {
|
|
touch = false
|
|
} = {}
|
|
}) {
|
|
const sharedConfig = shared;
|
|
if (sharedConfig.target && !SUPPORT.touch && SUPPORT.gesture) return 'gesture';
|
|
if (SUPPORT.touch && touch) return 'touch';
|
|
if (SUPPORT.touchscreen) {
|
|
if (SUPPORT.pointer) return 'pointer';
|
|
if (SUPPORT.touch) return 'touch';
|
|
}
|
|
},
|
|
bounds(_v, _k, {
|
|
scaleBounds = {},
|
|
angleBounds = {}
|
|
}) {
|
|
const _scaleBounds = state => {
|
|
const D = assignDefault(call(scaleBounds, state), {
|
|
min: -Infinity,
|
|
max: Infinity
|
|
});
|
|
return [D.min, D.max];
|
|
};
|
|
const _angleBounds = state => {
|
|
const A = assignDefault(call(angleBounds, state), {
|
|
min: -Infinity,
|
|
max: Infinity
|
|
});
|
|
return [A.min, A.max];
|
|
};
|
|
if (typeof scaleBounds !== 'function' && typeof angleBounds !== 'function') return [_scaleBounds(), _angleBounds()];
|
|
return state => [_scaleBounds(state), _angleBounds(state)];
|
|
},
|
|
threshold(value, _k, config) {
|
|
this.lockDirection = config.axis === 'lock';
|
|
const threshold = V.toVector(value, this.lockDirection ? [0.1, 3] : 0);
|
|
return threshold;
|
|
},
|
|
modifierKey(value) {
|
|
if (value === undefined) return 'ctrlKey';
|
|
return value;
|
|
},
|
|
pinchOnWheel(value = true) {
|
|
return value;
|
|
}
|
|
});
|
|
|
|
class MoveEngine extends CoordinatesEngine {
|
|
constructor(...args) {
|
|
super(...args);
|
|
_defineProperty(this, "ingKey", 'moving');
|
|
}
|
|
move(event) {
|
|
if (this.config.mouseOnly && event.pointerType !== 'mouse') return;
|
|
if (!this.state._active) this.moveStart(event);else this.moveChange(event);
|
|
this.timeoutStore.add('moveEnd', this.moveEnd.bind(this));
|
|
}
|
|
moveStart(event) {
|
|
this.start(event);
|
|
this.computeValues(pointerValues(event));
|
|
this.compute(event);
|
|
this.computeInitial();
|
|
this.emit();
|
|
}
|
|
moveChange(event) {
|
|
if (!this.state._active) return;
|
|
const values = pointerValues(event);
|
|
const state = this.state;
|
|
state._delta = V.sub(values, state._values);
|
|
V.addTo(state._movement, state._delta);
|
|
this.computeValues(values);
|
|
this.compute(event);
|
|
this.emit();
|
|
}
|
|
moveEnd(event) {
|
|
if (!this.state._active) return;
|
|
this.state._active = false;
|
|
this.compute(event);
|
|
this.emit();
|
|
}
|
|
bind(bindFunction) {
|
|
bindFunction('pointer', 'change', this.move.bind(this));
|
|
bindFunction('pointer', 'leave', this.moveEnd.bind(this));
|
|
}
|
|
}
|
|
|
|
const moveConfigResolver = _objectSpread2(_objectSpread2({}, coordinatesConfigResolver), {}, {
|
|
mouseOnly: (value = true) => value
|
|
});
|
|
|
|
class ScrollEngine extends CoordinatesEngine {
|
|
constructor(...args) {
|
|
super(...args);
|
|
_defineProperty(this, "ingKey", 'scrolling');
|
|
}
|
|
scroll(event) {
|
|
if (!this.state._active) this.start(event);
|
|
this.scrollChange(event);
|
|
this.timeoutStore.add('scrollEnd', this.scrollEnd.bind(this));
|
|
}
|
|
scrollChange(event) {
|
|
if (event.cancelable) event.preventDefault();
|
|
const state = this.state;
|
|
const values = scrollValues(event);
|
|
state._delta = V.sub(values, state._values);
|
|
V.addTo(state._movement, state._delta);
|
|
this.computeValues(values);
|
|
this.compute(event);
|
|
this.emit();
|
|
}
|
|
scrollEnd() {
|
|
if (!this.state._active) return;
|
|
this.state._active = false;
|
|
this.compute();
|
|
this.emit();
|
|
}
|
|
bind(bindFunction) {
|
|
bindFunction('scroll', '', this.scroll.bind(this));
|
|
}
|
|
}
|
|
|
|
const scrollConfigResolver = coordinatesConfigResolver;
|
|
|
|
class WheelEngine extends CoordinatesEngine {
|
|
constructor(...args) {
|
|
super(...args);
|
|
_defineProperty(this, "ingKey", 'wheeling');
|
|
}
|
|
wheel(event) {
|
|
if (!this.state._active) this.start(event);
|
|
this.wheelChange(event);
|
|
this.timeoutStore.add('wheelEnd', this.wheelEnd.bind(this));
|
|
}
|
|
wheelChange(event) {
|
|
const state = this.state;
|
|
state._delta = wheelValues(event);
|
|
V.addTo(state._movement, state._delta);
|
|
clampStateInternalMovementToBounds(state);
|
|
this.compute(event);
|
|
this.emit();
|
|
}
|
|
wheelEnd() {
|
|
if (!this.state._active) return;
|
|
this.state._active = false;
|
|
this.compute();
|
|
this.emit();
|
|
}
|
|
bind(bindFunction) {
|
|
bindFunction('wheel', '', this.wheel.bind(this));
|
|
}
|
|
}
|
|
|
|
const wheelConfigResolver = coordinatesConfigResolver;
|
|
|
|
class HoverEngine extends CoordinatesEngine {
|
|
constructor(...args) {
|
|
super(...args);
|
|
_defineProperty(this, "ingKey", 'hovering');
|
|
}
|
|
enter(event) {
|
|
if (this.config.mouseOnly && event.pointerType !== 'mouse') return;
|
|
this.start(event);
|
|
this.computeValues(pointerValues(event));
|
|
this.compute(event);
|
|
this.emit();
|
|
}
|
|
leave(event) {
|
|
if (this.config.mouseOnly && event.pointerType !== 'mouse') return;
|
|
const state = this.state;
|
|
if (!state._active) return;
|
|
state._active = false;
|
|
const values = pointerValues(event);
|
|
state._movement = state._delta = V.sub(values, state._values);
|
|
this.computeValues(values);
|
|
this.compute(event);
|
|
state.delta = state.movement;
|
|
this.emit();
|
|
}
|
|
bind(bindFunction) {
|
|
bindFunction('pointer', 'enter', this.enter.bind(this));
|
|
bindFunction('pointer', 'leave', this.leave.bind(this));
|
|
}
|
|
}
|
|
|
|
const hoverConfigResolver = _objectSpread2(_objectSpread2({}, coordinatesConfigResolver), {}, {
|
|
mouseOnly: (value = true) => value
|
|
});
|
|
|
|
const actions_fe213e88_esm_EngineMap = new Map();
|
|
const ConfigResolverMap = new Map();
|
|
function actions_fe213e88_esm_registerAction(action) {
|
|
actions_fe213e88_esm_EngineMap.set(action.key, action.engine);
|
|
ConfigResolverMap.set(action.key, action.resolver);
|
|
}
|
|
const actions_fe213e88_esm_dragAction = {
|
|
key: 'drag',
|
|
engine: DragEngine,
|
|
resolver: dragConfigResolver
|
|
};
|
|
const actions_fe213e88_esm_hoverAction = {
|
|
key: 'hover',
|
|
engine: HoverEngine,
|
|
resolver: hoverConfigResolver
|
|
};
|
|
const actions_fe213e88_esm_moveAction = {
|
|
key: 'move',
|
|
engine: MoveEngine,
|
|
resolver: moveConfigResolver
|
|
};
|
|
const actions_fe213e88_esm_pinchAction = {
|
|
key: 'pinch',
|
|
engine: PinchEngine,
|
|
resolver: pinchConfigResolver
|
|
};
|
|
const actions_fe213e88_esm_scrollAction = {
|
|
key: 'scroll',
|
|
engine: ScrollEngine,
|
|
resolver: scrollConfigResolver
|
|
};
|
|
const actions_fe213e88_esm_wheelAction = {
|
|
key: 'wheel',
|
|
engine: WheelEngine,
|
|
resolver: wheelConfigResolver
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@use-gesture+core@10.3.1/node_modules/@use-gesture/core/dist/use-gesture-core.esm.js
|
|
|
|
|
|
|
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
if (source == null) return {};
|
|
var target = {};
|
|
var sourceKeys = Object.keys(source);
|
|
var key, i;
|
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
key = sourceKeys[i];
|
|
if (excluded.indexOf(key) >= 0) continue;
|
|
target[key] = source[key];
|
|
}
|
|
return target;
|
|
}
|
|
|
|
function _objectWithoutProperties(source, excluded) {
|
|
if (source == null) return {};
|
|
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
var key, i;
|
|
if (Object.getOwnPropertySymbols) {
|
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
key = sourceSymbolKeys[i];
|
|
if (excluded.indexOf(key) >= 0) continue;
|
|
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
target[key] = source[key];
|
|
}
|
|
}
|
|
return target;
|
|
}
|
|
|
|
const sharedConfigResolver = {
|
|
target(value) {
|
|
if (value) {
|
|
return () => 'current' in value ? value.current : value;
|
|
}
|
|
return undefined;
|
|
},
|
|
enabled(value = true) {
|
|
return value;
|
|
},
|
|
window(value = SUPPORT.isBrowser ? window : undefined) {
|
|
return value;
|
|
},
|
|
eventOptions({
|
|
passive = true,
|
|
capture = false
|
|
} = {}) {
|
|
return {
|
|
passive,
|
|
capture
|
|
};
|
|
},
|
|
transform(value) {
|
|
return value;
|
|
}
|
|
};
|
|
|
|
const _excluded = ["target", "eventOptions", "window", "enabled", "transform"];
|
|
function resolveWith(config = {}, resolvers) {
|
|
const result = {};
|
|
for (const [key, resolver] of Object.entries(resolvers)) {
|
|
switch (typeof resolver) {
|
|
case 'function':
|
|
if (false) {} else {
|
|
result[key] = resolver.call(result, config[key], key, config);
|
|
}
|
|
break;
|
|
case 'object':
|
|
result[key] = resolveWith(config[key], resolver);
|
|
break;
|
|
case 'boolean':
|
|
if (resolver) result[key] = config[key];
|
|
break;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
function parse(newConfig, gestureKey, _config = {}) {
|
|
const _ref = newConfig,
|
|
{
|
|
target,
|
|
eventOptions,
|
|
window,
|
|
enabled,
|
|
transform
|
|
} = _ref,
|
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
_config.shared = resolveWith({
|
|
target,
|
|
eventOptions,
|
|
window,
|
|
enabled,
|
|
transform
|
|
}, sharedConfigResolver);
|
|
if (gestureKey) {
|
|
const resolver = ConfigResolverMap.get(gestureKey);
|
|
_config[gestureKey] = resolveWith(_objectSpread2({
|
|
shared: _config.shared
|
|
}, rest), resolver);
|
|
} else {
|
|
for (const key in rest) {
|
|
const resolver = ConfigResolverMap.get(key);
|
|
if (resolver) {
|
|
_config[key] = resolveWith(_objectSpread2({
|
|
shared: _config.shared
|
|
}, rest[key]), resolver);
|
|
} else if (false) {}
|
|
}
|
|
}
|
|
return _config;
|
|
}
|
|
|
|
class EventStore {
|
|
constructor(ctrl, gestureKey) {
|
|
_defineProperty(this, "_listeners", new Set());
|
|
this._ctrl = ctrl;
|
|
this._gestureKey = gestureKey;
|
|
}
|
|
add(element, device, action, handler, options) {
|
|
const listeners = this._listeners;
|
|
const type = toDomEventType(device, action);
|
|
const _options = this._gestureKey ? this._ctrl.config[this._gestureKey].eventOptions : {};
|
|
const eventOptions = _objectSpread2(_objectSpread2({}, _options), options);
|
|
element.addEventListener(type, handler, eventOptions);
|
|
const remove = () => {
|
|
element.removeEventListener(type, handler, eventOptions);
|
|
listeners.delete(remove);
|
|
};
|
|
listeners.add(remove);
|
|
return remove;
|
|
}
|
|
clean() {
|
|
this._listeners.forEach(remove => remove());
|
|
this._listeners.clear();
|
|
}
|
|
}
|
|
|
|
class TimeoutStore {
|
|
constructor() {
|
|
_defineProperty(this, "_timeouts", new Map());
|
|
}
|
|
add(key, callback, ms = 140, ...args) {
|
|
this.remove(key);
|
|
this._timeouts.set(key, window.setTimeout(callback, ms, ...args));
|
|
}
|
|
remove(key) {
|
|
const timeout = this._timeouts.get(key);
|
|
if (timeout) window.clearTimeout(timeout);
|
|
}
|
|
clean() {
|
|
this._timeouts.forEach(timeout => void window.clearTimeout(timeout));
|
|
this._timeouts.clear();
|
|
}
|
|
}
|
|
|
|
class Controller {
|
|
constructor(handlers) {
|
|
_defineProperty(this, "gestures", new Set());
|
|
_defineProperty(this, "_targetEventStore", new EventStore(this));
|
|
_defineProperty(this, "gestureEventStores", {});
|
|
_defineProperty(this, "gestureTimeoutStores", {});
|
|
_defineProperty(this, "handlers", {});
|
|
_defineProperty(this, "config", {});
|
|
_defineProperty(this, "pointerIds", new Set());
|
|
_defineProperty(this, "touchIds", new Set());
|
|
_defineProperty(this, "state", {
|
|
shared: {
|
|
shiftKey: false,
|
|
metaKey: false,
|
|
ctrlKey: false,
|
|
altKey: false
|
|
}
|
|
});
|
|
resolveGestures(this, handlers);
|
|
}
|
|
setEventIds(event) {
|
|
if (isTouch(event)) {
|
|
this.touchIds = new Set(touchIds(event));
|
|
return this.touchIds;
|
|
} else if ('pointerId' in event) {
|
|
if (event.type === 'pointerup' || event.type === 'pointercancel') this.pointerIds.delete(event.pointerId);else if (event.type === 'pointerdown') this.pointerIds.add(event.pointerId);
|
|
return this.pointerIds;
|
|
}
|
|
}
|
|
applyHandlers(handlers, nativeHandlers) {
|
|
this.handlers = handlers;
|
|
this.nativeHandlers = nativeHandlers;
|
|
}
|
|
applyConfig(config, gestureKey) {
|
|
this.config = parse(config, gestureKey, this.config);
|
|
}
|
|
clean() {
|
|
this._targetEventStore.clean();
|
|
for (const key of this.gestures) {
|
|
this.gestureEventStores[key].clean();
|
|
this.gestureTimeoutStores[key].clean();
|
|
}
|
|
}
|
|
effect() {
|
|
if (this.config.shared.target) this.bind();
|
|
return () => this._targetEventStore.clean();
|
|
}
|
|
bind(...args) {
|
|
const sharedConfig = this.config.shared;
|
|
const props = {};
|
|
let target;
|
|
if (sharedConfig.target) {
|
|
target = sharedConfig.target();
|
|
if (!target) return;
|
|
}
|
|
if (sharedConfig.enabled) {
|
|
for (const gestureKey of this.gestures) {
|
|
const gestureConfig = this.config[gestureKey];
|
|
const bindFunction = bindToProps(props, gestureConfig.eventOptions, !!target);
|
|
if (gestureConfig.enabled) {
|
|
const Engine = actions_fe213e88_esm_EngineMap.get(gestureKey);
|
|
new Engine(this, args, gestureKey).bind(bindFunction);
|
|
}
|
|
}
|
|
const nativeBindFunction = bindToProps(props, sharedConfig.eventOptions, !!target);
|
|
for (const eventKey in this.nativeHandlers) {
|
|
nativeBindFunction(eventKey, '', event => this.nativeHandlers[eventKey](_objectSpread2(_objectSpread2({}, this.state.shared), {}, {
|
|
event,
|
|
args
|
|
})), undefined, true);
|
|
}
|
|
}
|
|
for (const handlerProp in props) {
|
|
props[handlerProp] = chain(...props[handlerProp]);
|
|
}
|
|
if (!target) return props;
|
|
for (const handlerProp in props) {
|
|
const {
|
|
device,
|
|
capture,
|
|
passive
|
|
} = parseProp(handlerProp);
|
|
this._targetEventStore.add(target, device, '', props[handlerProp], {
|
|
capture,
|
|
passive
|
|
});
|
|
}
|
|
}
|
|
}
|
|
function setupGesture(ctrl, gestureKey) {
|
|
ctrl.gestures.add(gestureKey);
|
|
ctrl.gestureEventStores[gestureKey] = new EventStore(ctrl, gestureKey);
|
|
ctrl.gestureTimeoutStores[gestureKey] = new TimeoutStore();
|
|
}
|
|
function resolveGestures(ctrl, internalHandlers) {
|
|
if (internalHandlers.drag) setupGesture(ctrl, 'drag');
|
|
if (internalHandlers.wheel) setupGesture(ctrl, 'wheel');
|
|
if (internalHandlers.scroll) setupGesture(ctrl, 'scroll');
|
|
if (internalHandlers.move) setupGesture(ctrl, 'move');
|
|
if (internalHandlers.pinch) setupGesture(ctrl, 'pinch');
|
|
if (internalHandlers.hover) setupGesture(ctrl, 'hover');
|
|
}
|
|
const bindToProps = (props, eventOptions, withPassiveOption) => (device, action, handler, options = {}, isNative = false) => {
|
|
var _options$capture, _options$passive;
|
|
const capture = (_options$capture = options.capture) !== null && _options$capture !== void 0 ? _options$capture : eventOptions.capture;
|
|
const passive = (_options$passive = options.passive) !== null && _options$passive !== void 0 ? _options$passive : eventOptions.passive;
|
|
let handlerProp = isNative ? device : toHandlerProp(device, action, capture);
|
|
if (withPassiveOption && passive) handlerProp += 'Passive';
|
|
props[handlerProp] = props[handlerProp] || [];
|
|
props[handlerProp].push(handler);
|
|
};
|
|
|
|
const RE_NOT_NATIVE = /^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;
|
|
function sortHandlers(_handlers) {
|
|
const native = {};
|
|
const handlers = {};
|
|
const actions = new Set();
|
|
for (let key in _handlers) {
|
|
if (RE_NOT_NATIVE.test(key)) {
|
|
actions.add(RegExp.lastMatch);
|
|
handlers[key] = _handlers[key];
|
|
} else {
|
|
native[key] = _handlers[key];
|
|
}
|
|
}
|
|
return [handlers, native, actions];
|
|
}
|
|
function registerGesture(actions, handlers, handlerKey, key, internalHandlers, config) {
|
|
if (!actions.has(handlerKey)) return;
|
|
if (!EngineMap.has(key)) {
|
|
if (false) {}
|
|
return;
|
|
}
|
|
const startKey = handlerKey + 'Start';
|
|
const endKey = handlerKey + 'End';
|
|
const fn = state => {
|
|
let memo = undefined;
|
|
if (state.first && startKey in handlers) handlers[startKey](state);
|
|
if (handlerKey in handlers) memo = handlers[handlerKey](state);
|
|
if (state.last && endKey in handlers) handlers[endKey](state);
|
|
return memo;
|
|
};
|
|
internalHandlers[key] = fn;
|
|
config[key] = config[key] || {};
|
|
}
|
|
function use_gesture_core_esm_parseMergedHandlers(mergedHandlers, mergedConfig) {
|
|
const [handlers, nativeHandlers, actions] = sortHandlers(mergedHandlers);
|
|
const internalHandlers = {};
|
|
registerGesture(actions, handlers, 'onDrag', 'drag', internalHandlers, mergedConfig);
|
|
registerGesture(actions, handlers, 'onWheel', 'wheel', internalHandlers, mergedConfig);
|
|
registerGesture(actions, handlers, 'onScroll', 'scroll', internalHandlers, mergedConfig);
|
|
registerGesture(actions, handlers, 'onPinch', 'pinch', internalHandlers, mergedConfig);
|
|
registerGesture(actions, handlers, 'onMove', 'move', internalHandlers, mergedConfig);
|
|
registerGesture(actions, handlers, 'onHover', 'hover', internalHandlers, mergedConfig);
|
|
return {
|
|
handlers: internalHandlers,
|
|
config: mergedConfig,
|
|
nativeHandlers
|
|
};
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@use-gesture+react@10.3.1_react@17.0.2/node_modules/@use-gesture/react/dist/use-gesture-react.esm.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function useRecognizers(handlers, config = {}, gestureKey, nativeHandlers) {
|
|
const ctrl = react.useMemo(() => new Controller(handlers), []);
|
|
ctrl.applyHandlers(handlers, nativeHandlers);
|
|
ctrl.applyConfig(config, gestureKey);
|
|
react.useEffect(ctrl.effect.bind(ctrl));
|
|
react.useEffect(() => {
|
|
return ctrl.clean.bind(ctrl);
|
|
}, []);
|
|
if (config.target === undefined) {
|
|
return ctrl.bind.bind(ctrl);
|
|
}
|
|
return undefined;
|
|
}
|
|
|
|
function useDrag(handler, config) {
|
|
actions_fe213e88_esm_registerAction(actions_fe213e88_esm_dragAction);
|
|
return useRecognizers({
|
|
drag: handler
|
|
}, config || {}, 'drag');
|
|
}
|
|
|
|
function usePinch(handler, config) {
|
|
registerAction(pinchAction);
|
|
return useRecognizers({
|
|
pinch: handler
|
|
}, config || {}, 'pinch');
|
|
}
|
|
|
|
function useWheel(handler, config) {
|
|
registerAction(wheelAction);
|
|
return useRecognizers({
|
|
wheel: handler
|
|
}, config || {}, 'wheel');
|
|
}
|
|
|
|
function useScroll(handler, config) {
|
|
registerAction(scrollAction);
|
|
return useRecognizers({
|
|
scroll: handler
|
|
}, config || {}, 'scroll');
|
|
}
|
|
|
|
function useMove(handler, config) {
|
|
registerAction(moveAction);
|
|
return useRecognizers({
|
|
move: handler
|
|
}, config || {}, 'move');
|
|
}
|
|
|
|
function useHover(handler, config) {
|
|
registerAction(hoverAction);
|
|
return useRecognizers({
|
|
hover: handler
|
|
}, config || {}, 'hover');
|
|
}
|
|
|
|
function createUseGesture(actions) {
|
|
actions.forEach(registerAction);
|
|
return function useGesture(_handlers, _config) {
|
|
const {
|
|
handlers,
|
|
nativeHandlers,
|
|
config
|
|
} = parseMergedHandlers(_handlers, _config || {});
|
|
return useRecognizers(handlers, config, undefined, nativeHandlers);
|
|
};
|
|
}
|
|
|
|
function useGesture(handlers, config) {
|
|
const hook = createUseGesture([dragAction, pinchAction, scrollAction, wheelAction, moveAction, hoverAction]);
|
|
return hook(handlers, config || {});
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/utils.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
/**
|
|
* Gets a CSS cursor value based on a drag direction.
|
|
*
|
|
* @param dragDirection The drag direction.
|
|
* @return The CSS cursor value.
|
|
*/
|
|
function getDragCursor(dragDirection) {
|
|
let dragCursor = 'ns-resize';
|
|
switch (dragDirection) {
|
|
case 'n':
|
|
case 's':
|
|
dragCursor = 'ns-resize';
|
|
break;
|
|
case 'e':
|
|
case 'w':
|
|
dragCursor = 'ew-resize';
|
|
break;
|
|
}
|
|
return dragCursor;
|
|
}
|
|
|
|
/**
|
|
* Custom hook that renders a drag cursor when dragging.
|
|
*
|
|
* @param {boolean} isDragging The dragging state.
|
|
* @param {string} dragDirection The drag direction.
|
|
*
|
|
* @return {string} The CSS cursor value.
|
|
*/
|
|
function useDragCursor(isDragging, dragDirection) {
|
|
const dragCursor = getDragCursor(dragDirection);
|
|
(0,react.useEffect)(() => {
|
|
if (isDragging) {
|
|
document.documentElement.style.cursor = dragCursor;
|
|
} else {
|
|
// @ts-expect-error
|
|
document.documentElement.style.cursor = null;
|
|
}
|
|
}, [isDragging, dragCursor]);
|
|
return dragCursor;
|
|
}
|
|
function useDraft(props) {
|
|
const previousValueRef = (0,react.useRef)(props.value);
|
|
const [draft, setDraft] = (0,react.useState)({});
|
|
const value = draft.value !== undefined ? draft.value : props.value;
|
|
|
|
// Determines when to discard the draft value to restore controlled status.
|
|
// To do so, it tracks the previous value and marks the draft value as stale
|
|
// after each render.
|
|
(0,react.useLayoutEffect)(() => {
|
|
const {
|
|
current: previousValue
|
|
} = previousValueRef;
|
|
previousValueRef.current = props.value;
|
|
if (draft.value !== undefined && !draft.isStale) {
|
|
setDraft({
|
|
...draft,
|
|
isStale: true
|
|
});
|
|
} else if (draft.isStale && props.value !== previousValue) {
|
|
setDraft({});
|
|
}
|
|
}, [props.value, draft]);
|
|
const onChange = (nextValue, extra) => {
|
|
// Mutates the draft value to avoid an extra effect run.
|
|
setDraft(current => Object.assign(current, {
|
|
value: nextValue,
|
|
isStale: false
|
|
}));
|
|
props.onChange(nextValue, extra);
|
|
};
|
|
const onBlur = event => {
|
|
setDraft({});
|
|
props.onBlur?.(event);
|
|
};
|
|
return {
|
|
value,
|
|
onBlur,
|
|
onChange
|
|
};
|
|
}
|
|
//# sourceMappingURL=utils.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/styles/input-control-styles.js
|
|
var input_control_styles = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/styles/input-control-styles.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/reducer/state.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
const initialStateReducer = state => state;
|
|
const initialInputControlState = {
|
|
error: null,
|
|
initialValue: '',
|
|
isDirty: false,
|
|
isDragEnabled: false,
|
|
isDragging: false,
|
|
isPressEnterToChange: false,
|
|
value: ''
|
|
};
|
|
//# sourceMappingURL=state.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/reducer/actions.js
|
|
var actions = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/reducer/actions.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/reducer/reducer.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Prepares initialState for the reducer.
|
|
*
|
|
* @param initialState The initial state.
|
|
* @return Prepared initialState for the reducer
|
|
*/
|
|
function mergeInitialState(initialState = initialInputControlState) {
|
|
const {
|
|
value
|
|
} = initialState;
|
|
return {
|
|
...initialInputControlState,
|
|
...initialState,
|
|
initialValue: value
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates the base reducer which may be coupled to a specializing reducer.
|
|
* As its final step, for all actions other than CONTROL, the base reducer
|
|
* passes the state and action on through the specializing reducer. The
|
|
* exception for CONTROL actions is because they represent controlled updates
|
|
* from props and no case has yet presented for their specialization.
|
|
*
|
|
* @param composedStateReducers A reducer to specialize state changes.
|
|
* @return The reducer.
|
|
*/
|
|
function inputControlStateReducer(composedStateReducers) {
|
|
return (state, action) => {
|
|
const nextState = {
|
|
...state
|
|
};
|
|
switch (action.type) {
|
|
/*
|
|
* Controlled updates
|
|
*/
|
|
case actions/* CONTROL */.W3:
|
|
nextState.value = action.payload.value;
|
|
nextState.isDirty = false;
|
|
nextState._event = undefined;
|
|
// Returns immediately to avoid invoking additional reducers.
|
|
return nextState;
|
|
|
|
/**
|
|
* Keyboard events
|
|
*/
|
|
case actions/* PRESS_UP */.wX:
|
|
nextState.isDirty = false;
|
|
break;
|
|
case actions/* PRESS_DOWN */.r7:
|
|
nextState.isDirty = false;
|
|
break;
|
|
|
|
/**
|
|
* Drag events
|
|
*/
|
|
case actions/* DRAG_START */.Qf:
|
|
nextState.isDragging = true;
|
|
break;
|
|
case actions/* DRAG_END */.Ry:
|
|
nextState.isDragging = false;
|
|
break;
|
|
|
|
/**
|
|
* Input events
|
|
*/
|
|
case actions/* CHANGE */.PL:
|
|
nextState.error = null;
|
|
nextState.value = action.payload.value;
|
|
if (state.isPressEnterToChange) {
|
|
nextState.isDirty = true;
|
|
}
|
|
break;
|
|
case actions/* COMMIT */.cJ:
|
|
nextState.value = action.payload.value;
|
|
nextState.isDirty = false;
|
|
break;
|
|
case actions/* RESET */.Ut:
|
|
nextState.error = null;
|
|
nextState.isDirty = false;
|
|
nextState.value = action.payload.value || state.initialValue;
|
|
break;
|
|
|
|
/**
|
|
* Validation
|
|
*/
|
|
case actions/* INVALIDATE */.uY:
|
|
nextState.error = action.payload.error;
|
|
break;
|
|
}
|
|
nextState._event = action.payload.event;
|
|
|
|
/**
|
|
* Send the nextState + action to the composedReducers via
|
|
* this "bridge" mechanism. This allows external stateReducers
|
|
* to hook into actions, and modify state if needed.
|
|
*/
|
|
return composedStateReducers(nextState, action);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* A custom hook that connects and external stateReducer with an internal
|
|
* reducer. This hook manages the internal state of InputControl.
|
|
* However, by connecting an external stateReducer function, other
|
|
* components can react to actions as well as modify state before it is
|
|
* applied.
|
|
*
|
|
* This technique uses the "stateReducer" design pattern:
|
|
* https://kentcdodds.com/blog/the-state-reducer-pattern/
|
|
*
|
|
* @param stateReducer An external state reducer.
|
|
* @param initialState The initial state for the reducer.
|
|
* @param onChangeHandler A handler for the onChange event.
|
|
* @return State, dispatch, and a collection of actions.
|
|
*/
|
|
function useInputControlStateReducer(stateReducer = initialStateReducer, initialState = initialInputControlState, onChangeHandler) {
|
|
const [state, dispatch] = (0,react.useReducer)(inputControlStateReducer(stateReducer), mergeInitialState(initialState));
|
|
const createChangeEvent = type => (nextValue, event) => {
|
|
dispatch({
|
|
type,
|
|
payload: {
|
|
value: nextValue,
|
|
event
|
|
}
|
|
});
|
|
};
|
|
const createKeyEvent = type => event => {
|
|
dispatch({
|
|
type,
|
|
payload: {
|
|
event
|
|
}
|
|
});
|
|
};
|
|
const createDragEvent = type => payload => {
|
|
dispatch({
|
|
type,
|
|
payload
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Actions for the reducer
|
|
*/
|
|
const change = createChangeEvent(actions/* CHANGE */.PL);
|
|
const invalidate = (error, event) => dispatch({
|
|
type: actions/* INVALIDATE */.uY,
|
|
payload: {
|
|
error,
|
|
event
|
|
}
|
|
});
|
|
const reset = createChangeEvent(actions/* RESET */.Ut);
|
|
const commit = createChangeEvent(actions/* COMMIT */.cJ);
|
|
const dragStart = createDragEvent(actions/* DRAG_START */.Qf);
|
|
const drag = createDragEvent(actions/* DRAG */.j);
|
|
const dragEnd = createDragEvent(actions/* DRAG_END */.Ry);
|
|
const pressUp = createKeyEvent(actions/* PRESS_UP */.wX);
|
|
const pressDown = createKeyEvent(actions/* PRESS_DOWN */.r7);
|
|
const pressEnter = createKeyEvent(actions/* PRESS_ENTER */.bR);
|
|
const currentStateRef = (0,react.useRef)(state);
|
|
const refPropsRef = (0,react.useRef)({
|
|
value: initialState.value,
|
|
onChangeHandler
|
|
});
|
|
|
|
// Freshens refs to props and state so that subsequent effects have access
|
|
// to their latest values without their changes causing effect runs.
|
|
(0,react.useLayoutEffect)(() => {
|
|
currentStateRef.current = state;
|
|
refPropsRef.current = {
|
|
value: initialState.value,
|
|
onChangeHandler
|
|
};
|
|
});
|
|
|
|
// Propagates the latest state through onChange.
|
|
(0,react.useLayoutEffect)(() => {
|
|
if (currentStateRef.current._event !== undefined && state.value !== refPropsRef.current.value && !state.isDirty) {
|
|
var _state$value;
|
|
refPropsRef.current.onChangeHandler((_state$value = state.value) !== null && _state$value !== void 0 ? _state$value : '', {
|
|
event: currentStateRef.current._event
|
|
});
|
|
}
|
|
}, [state.value, state.isDirty]);
|
|
|
|
// Updates the state from props.
|
|
(0,react.useLayoutEffect)(() => {
|
|
if (initialState.value !== currentStateRef.current.value && !currentStateRef.current.isDirty) {
|
|
var _initialState$value;
|
|
dispatch({
|
|
type: actions/* CONTROL */.W3,
|
|
payload: {
|
|
value: (_initialState$value = initialState.value) !== null && _initialState$value !== void 0 ? _initialState$value : ''
|
|
}
|
|
});
|
|
}
|
|
}, [initialState.value]);
|
|
return {
|
|
change,
|
|
commit,
|
|
dispatch,
|
|
drag,
|
|
dragEnd,
|
|
dragStart,
|
|
invalidate,
|
|
pressDown,
|
|
pressEnter,
|
|
pressUp,
|
|
reset,
|
|
state
|
|
};
|
|
}
|
|
//# sourceMappingURL=reducer.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/with-ignore-ime-events.js
|
|
var with_ignore_ime_events = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/with-ignore-ime-events.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/input-field.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const input_field_noop = () => {};
|
|
function InputField({
|
|
disabled = false,
|
|
dragDirection = 'n',
|
|
dragThreshold = 10,
|
|
id,
|
|
isDragEnabled = false,
|
|
isPressEnterToChange = false,
|
|
onBlur = input_field_noop,
|
|
onChange = input_field_noop,
|
|
onDrag = input_field_noop,
|
|
onDragEnd = input_field_noop,
|
|
onDragStart = input_field_noop,
|
|
onKeyDown = input_field_noop,
|
|
onValidate = input_field_noop,
|
|
size = 'default',
|
|
stateReducer = state => state,
|
|
value: valueProp,
|
|
type,
|
|
...props
|
|
}, ref) {
|
|
const {
|
|
// State.
|
|
state,
|
|
// Actions.
|
|
change,
|
|
commit,
|
|
drag,
|
|
dragEnd,
|
|
dragStart,
|
|
invalidate,
|
|
pressDown,
|
|
pressEnter,
|
|
pressUp,
|
|
reset
|
|
} = useInputControlStateReducer(stateReducer, {
|
|
isDragEnabled,
|
|
value: valueProp,
|
|
isPressEnterToChange
|
|
}, onChange);
|
|
const {
|
|
value,
|
|
isDragging,
|
|
isDirty
|
|
} = state;
|
|
const wasDirtyOnBlur = (0,react.useRef)(false);
|
|
const dragCursor = useDragCursor(isDragging, dragDirection);
|
|
const handleOnBlur = event => {
|
|
onBlur(event);
|
|
|
|
/**
|
|
* If isPressEnterToChange is set, this commits the value to
|
|
* the onChange callback.
|
|
*/
|
|
if (isDirty || !event.target.validity.valid) {
|
|
wasDirtyOnBlur.current = true;
|
|
handleOnCommit(event);
|
|
}
|
|
};
|
|
const handleOnChange = event => {
|
|
const nextValue = event.target.value;
|
|
change(nextValue, event);
|
|
};
|
|
const handleOnCommit = event => {
|
|
const nextValue = event.currentTarget.value;
|
|
try {
|
|
onValidate(nextValue);
|
|
commit(nextValue, event);
|
|
} catch (err) {
|
|
invalidate(err, event);
|
|
}
|
|
};
|
|
const handleOnKeyDown = event => {
|
|
const {
|
|
key
|
|
} = event;
|
|
onKeyDown(event);
|
|
switch (key) {
|
|
case 'ArrowUp':
|
|
pressUp(event);
|
|
break;
|
|
case 'ArrowDown':
|
|
pressDown(event);
|
|
break;
|
|
case 'Enter':
|
|
pressEnter(event);
|
|
if (isPressEnterToChange) {
|
|
event.preventDefault();
|
|
handleOnCommit(event);
|
|
}
|
|
break;
|
|
case 'Escape':
|
|
if (isPressEnterToChange && isDirty) {
|
|
event.preventDefault();
|
|
reset(valueProp, event);
|
|
}
|
|
break;
|
|
}
|
|
};
|
|
const dragGestureProps = useDrag(dragProps => {
|
|
const {
|
|
distance,
|
|
dragging,
|
|
event,
|
|
target
|
|
} = dragProps;
|
|
|
|
// The `target` prop always references the `input` element while, by
|
|
// default, the `dragProps.event.target` property would reference the real
|
|
// event target (i.e. any DOM element that the pointer is hovering while
|
|
// dragging). Ensuring that the `target` is always the `input` element
|
|
// allows consumers of `InputControl` (or any higher-level control) to
|
|
// check the input's validity by accessing `event.target.validity.valid`.
|
|
dragProps.event = {
|
|
...dragProps.event,
|
|
target
|
|
};
|
|
if (!distance) {
|
|
return;
|
|
}
|
|
event.stopPropagation();
|
|
|
|
/**
|
|
* Quick return if no longer dragging.
|
|
* This prevents unnecessary value calculations.
|
|
*/
|
|
if (!dragging) {
|
|
onDragEnd(dragProps);
|
|
dragEnd(dragProps);
|
|
return;
|
|
}
|
|
onDrag(dragProps);
|
|
drag(dragProps);
|
|
if (!isDragging) {
|
|
onDragStart(dragProps);
|
|
dragStart(dragProps);
|
|
}
|
|
}, {
|
|
axis: dragDirection === 'e' || dragDirection === 'w' ? 'x' : 'y',
|
|
threshold: dragThreshold,
|
|
enabled: isDragEnabled,
|
|
pointer: {
|
|
capture: false
|
|
}
|
|
});
|
|
const dragProps = isDragEnabled ? dragGestureProps() : {};
|
|
/*
|
|
* Works around the odd UA (e.g. Firefox) that does not focus inputs of
|
|
* type=number when their spinner arrows are pressed.
|
|
*/
|
|
let handleOnMouseDown;
|
|
if (type === 'number') {
|
|
handleOnMouseDown = event => {
|
|
props.onMouseDown?.(event);
|
|
if (event.currentTarget !== event.currentTarget.ownerDocument.activeElement) {
|
|
event.currentTarget.focus();
|
|
}
|
|
};
|
|
}
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(input_control_styles/* Input */.pd, {
|
|
...props,
|
|
...dragProps,
|
|
className: "components-input-control__input",
|
|
disabled: disabled,
|
|
dragCursor: dragCursor,
|
|
isDragging: isDragging,
|
|
id: id,
|
|
onBlur: handleOnBlur,
|
|
onChange: handleOnChange,
|
|
onKeyDown: (0,with_ignore_ime_events/* withIgnoreIMEEvents */.n)(handleOnKeyDown),
|
|
onMouseDown: handleOnMouseDown,
|
|
ref: ref,
|
|
inputSize: size
|
|
// Fallback to `''` to avoid "uncontrolled to controlled" warning.
|
|
// See https://github.com/WordPress/gutenberg/pull/47250 for details.
|
|
,
|
|
value: value !== null && value !== void 0 ? value : '',
|
|
type: type
|
|
});
|
|
}
|
|
const ForwardedComponent = (0,react.forwardRef)(InputField);
|
|
/* harmony default export */ const input_field = (ForwardedComponent);
|
|
//# sourceMappingURL=input-field.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/space.js
|
|
var space = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/space.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/base-control/index.js
|
|
var base_control = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/base-control/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/use-deprecated-props.js
|
|
var use_deprecated_props = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/use-deprecated-props.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/index.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const input_control_noop = () => {};
|
|
function useUniqueId(idProp) {
|
|
const instanceId = (0,use_instance_id/* default */.A)(InputControl);
|
|
const id = `inspector-input-control-${instanceId}`;
|
|
return idProp || id;
|
|
}
|
|
function UnforwardedInputControl(props, ref) {
|
|
const {
|
|
__next40pxDefaultSize,
|
|
__unstableStateReducer: stateReducer = state => state,
|
|
__unstableInputWidth,
|
|
className,
|
|
disabled = false,
|
|
help,
|
|
hideLabelFromVision = false,
|
|
id: idProp,
|
|
isPressEnterToChange = false,
|
|
label,
|
|
labelPosition = 'top',
|
|
onChange = input_control_noop,
|
|
onValidate = input_control_noop,
|
|
onKeyDown = input_control_noop,
|
|
prefix,
|
|
size = 'default',
|
|
style,
|
|
suffix,
|
|
value,
|
|
...restProps
|
|
} = (0,use_deprecated_props/* useDeprecated36pxDefaultSizeProp */.R)(props);
|
|
const id = useUniqueId(idProp);
|
|
const classes = (0,clsx/* default */.A)('components-input-control', className);
|
|
const draftHookProps = useDraft({
|
|
value,
|
|
onBlur: restProps.onBlur,
|
|
onChange
|
|
});
|
|
const helpProp = !!help ? {
|
|
'aria-describedby': `${id}__help`
|
|
} : {};
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(base_control/* default */.Ay, {
|
|
className: classes,
|
|
help: help,
|
|
id: id,
|
|
__nextHasNoMarginBottom: true,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_base/* default */.A, {
|
|
__next40pxDefaultSize: __next40pxDefaultSize,
|
|
__unstableInputWidth: __unstableInputWidth,
|
|
disabled: disabled,
|
|
gap: 3,
|
|
hideLabelFromVision: hideLabelFromVision,
|
|
id: id,
|
|
justify: "left",
|
|
label: label,
|
|
labelPosition: labelPosition,
|
|
prefix: prefix,
|
|
size: size,
|
|
style: style,
|
|
suffix: suffix,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_field, {
|
|
...restProps,
|
|
...helpProp,
|
|
__next40pxDefaultSize: __next40pxDefaultSize,
|
|
className: "components-input-control__input",
|
|
disabled: disabled,
|
|
id: id,
|
|
isPressEnterToChange: isPressEnterToChange,
|
|
onKeyDown: onKeyDown,
|
|
onValidate: onValidate,
|
|
paddingInlineStart: prefix ? (0,space/* space */.x)(1) : undefined,
|
|
paddingInlineEnd: suffix ? (0,space/* space */.x)(1) : undefined,
|
|
ref: ref,
|
|
size: size,
|
|
stateReducer: stateReducer,
|
|
...draftHookProps
|
|
})
|
|
})
|
|
});
|
|
}
|
|
|
|
/**
|
|
* InputControl components let users enter and edit text. This is an experimental component
|
|
* intended to (in time) merge with or replace `TextControl`.
|
|
*
|
|
* ```jsx
|
|
* import { __experimentalInputControl as InputControl } from '@wordpress/components';
|
|
* import { useState } from 'react';
|
|
*
|
|
* const Example = () => {
|
|
* const [ value, setValue ] = useState( '' );
|
|
*
|
|
* return (
|
|
* <InputControl
|
|
* value={ value }
|
|
* onChange={ ( nextValue ) => setValue( nextValue ?? '' ) }
|
|
* />
|
|
* );
|
|
* };
|
|
* ```
|
|
*/
|
|
const InputControl = (0,react.forwardRef)(UnforwardedInputControl);
|
|
/* harmony default export */ const input_control = (InputControl);
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/input-base.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
A: () => (/* binding */ input_base)
|
|
});
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-instance-id/index.js
|
|
var use_instance_id = __webpack_require__("../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-instance-id/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js
|
|
var react = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/styles/input-control-styles.js
|
|
var input_control_styles = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/styles/input-control-styles.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/backdrop.js
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
function Backdrop({
|
|
disabled = false,
|
|
isBorderless = false
|
|
}) {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(input_control_styles/* BackdropUI */.Hr, {
|
|
"aria-hidden": "true",
|
|
className: "components-input-control__backdrop",
|
|
disabled: disabled,
|
|
isBorderless: isBorderless
|
|
});
|
|
}
|
|
const MemoizedBackdrop = (0,react.memo)(Backdrop);
|
|
/* harmony default export */ const backdrop = (MemoizedBackdrop);
|
|
//# sourceMappingURL=backdrop.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/visually-hidden/component.js + 1 modules
|
|
var component = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/visually-hidden/component.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/label.js
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
function Label({
|
|
children,
|
|
hideLabelFromVision,
|
|
htmlFor,
|
|
...props
|
|
}) {
|
|
if (!children) {
|
|
return null;
|
|
}
|
|
if (hideLabelFromVision) {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(component/* default */.A, {
|
|
as: "label",
|
|
htmlFor: htmlFor,
|
|
children: children
|
|
});
|
|
}
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(input_control_styles/* LabelWrapper */.cR, {
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_control_styles/* Label */.JU, {
|
|
htmlFor: htmlFor,
|
|
...props,
|
|
children: children
|
|
})
|
|
});
|
|
}
|
|
//# sourceMappingURL=label.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js + 1 modules
|
|
var use_context_system = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-system-provider.js + 1 modules
|
|
var context_system_provider = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-system-provider.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-connect.js
|
|
var context_connect = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-connect.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/use-deprecated-props.js
|
|
var use_deprecated_props = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/use-deprecated-props.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/input-base.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function useUniqueId(idProp) {
|
|
const instanceId = (0,use_instance_id/* default */.A)(InputBase);
|
|
const id = `input-base-control-${instanceId}`;
|
|
return idProp || id;
|
|
}
|
|
|
|
// Adapter to map props for the new ui/flex component.
|
|
function getUIFlexProps(labelPosition) {
|
|
const props = {};
|
|
switch (labelPosition) {
|
|
case 'top':
|
|
props.direction = 'column';
|
|
props.expanded = false;
|
|
props.gap = 0;
|
|
break;
|
|
case 'bottom':
|
|
props.direction = 'column-reverse';
|
|
props.expanded = false;
|
|
props.gap = 0;
|
|
break;
|
|
case 'edge':
|
|
props.justify = 'space-between';
|
|
break;
|
|
}
|
|
return props;
|
|
}
|
|
function InputBase(props, ref) {
|
|
const {
|
|
__next40pxDefaultSize,
|
|
__unstableInputWidth,
|
|
children,
|
|
className,
|
|
disabled = false,
|
|
hideLabelFromVision = false,
|
|
labelPosition,
|
|
id: idProp,
|
|
isBorderless = false,
|
|
label,
|
|
prefix,
|
|
size = 'default',
|
|
suffix,
|
|
...restProps
|
|
} = (0,use_deprecated_props/* useDeprecated36pxDefaultSizeProp */.R)((0,use_context_system/* useContextSystem */.A)(props, 'InputBase'));
|
|
const id = useUniqueId(idProp);
|
|
const hideLabel = hideLabelFromVision || !label;
|
|
const prefixSuffixContextValue = (0,react.useMemo)(() => {
|
|
return {
|
|
InputControlPrefixWrapper: {
|
|
__next40pxDefaultSize,
|
|
size
|
|
},
|
|
InputControlSuffixWrapper: {
|
|
__next40pxDefaultSize,
|
|
size
|
|
}
|
|
};
|
|
}, [__next40pxDefaultSize, size]);
|
|
return (
|
|
/*#__PURE__*/
|
|
// @ts-expect-error The `direction` prop from Flex (FlexDirection) conflicts with legacy SVGAttributes `direction` (string) that come from React intrinsic prop definitions.
|
|
(0,jsx_runtime.jsxs)(input_control_styles/* Root */.bL, {
|
|
...restProps,
|
|
...getUIFlexProps(labelPosition),
|
|
className: className,
|
|
gap: 2,
|
|
ref: ref,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(Label, {
|
|
className: "components-input-control__label",
|
|
hideLabelFromVision: hideLabelFromVision,
|
|
labelPosition: labelPosition,
|
|
htmlFor: id,
|
|
children: label
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(input_control_styles/* Container */.mc, {
|
|
__unstableInputWidth: __unstableInputWidth,
|
|
className: "components-input-control__container",
|
|
disabled: disabled,
|
|
hideLabel: hideLabel,
|
|
labelPosition: labelPosition,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(context_system_provider/* ContextSystemProvider */.c7, {
|
|
value: prefixSuffixContextValue,
|
|
children: [prefix && /*#__PURE__*/(0,jsx_runtime.jsx)(input_control_styles/* Prefix */.b3, {
|
|
className: "components-input-control__prefix",
|
|
children: prefix
|
|
}), children, suffix && /*#__PURE__*/(0,jsx_runtime.jsx)(input_control_styles/* Suffix */.sZ, {
|
|
className: "components-input-control__suffix",
|
|
children: suffix
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(backdrop, {
|
|
disabled: disabled,
|
|
isBorderless: isBorderless
|
|
})]
|
|
})]
|
|
})
|
|
);
|
|
}
|
|
|
|
/**
|
|
* `InputBase` is an internal component used to style the standard borders for an input,
|
|
* as well as handle the layout for prefix/suffix elements.
|
|
*/
|
|
/* harmony default export */ const input_base = ((0,context_connect/* contextConnect */.KZ)(InputBase, 'InputBase'));
|
|
//# sourceMappingURL=input-base.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/reducer/actions.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ PL: () => (/* binding */ CHANGE),
|
|
/* harmony export */ Qf: () => (/* binding */ DRAG_START),
|
|
/* harmony export */ Ry: () => (/* binding */ DRAG_END),
|
|
/* harmony export */ Ut: () => (/* binding */ RESET),
|
|
/* harmony export */ W3: () => (/* binding */ CONTROL),
|
|
/* harmony export */ bR: () => (/* binding */ PRESS_ENTER),
|
|
/* harmony export */ cJ: () => (/* binding */ COMMIT),
|
|
/* harmony export */ j: () => (/* binding */ DRAG),
|
|
/* harmony export */ r7: () => (/* binding */ PRESS_DOWN),
|
|
/* harmony export */ uY: () => (/* binding */ INVALIDATE),
|
|
/* harmony export */ wX: () => (/* binding */ PRESS_UP)
|
|
/* harmony export */ });
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
const CHANGE = 'CHANGE';
|
|
const COMMIT = 'COMMIT';
|
|
const CONTROL = 'CONTROL';
|
|
const DRAG_END = 'DRAG_END';
|
|
const DRAG_START = 'DRAG_START';
|
|
const DRAG = 'DRAG';
|
|
const INVALIDATE = 'INVALIDATE';
|
|
const PRESS_DOWN = 'PRESS_DOWN';
|
|
const PRESS_ENTER = 'PRESS_ENTER';
|
|
const PRESS_UP = 'PRESS_UP';
|
|
const RESET = 'RESET';
|
|
//# sourceMappingURL=actions.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/styles/input-control-styles.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ Hr: () => (/* binding */ BackdropUI),
|
|
/* harmony export */ JU: () => (/* binding */ Label),
|
|
/* harmony export */ TA: () => (/* binding */ fontSizeStyles),
|
|
/* harmony export */ b3: () => (/* binding */ Prefix),
|
|
/* harmony export */ bC: () => (/* binding */ PrefixSuffixWrapper),
|
|
/* harmony export */ bL: () => (/* binding */ Root),
|
|
/* harmony export */ cR: () => (/* binding */ LabelWrapper),
|
|
/* harmony export */ mc: () => (/* binding */ Container),
|
|
/* harmony export */ pd: () => (/* binding */ Input),
|
|
/* harmony export */ sZ: () => (/* binding */ Suffix)
|
|
/* harmony export */ });
|
|
/* unused harmony export getSizeConfig */
|
|
/* harmony import */ var _emotion_styled_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@emotion+styled@11.11.0_@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2__@types+react@17.0.71_react@17.0.2/node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js");
|
|
/* harmony import */ var _emotion_react__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("../../node_modules/.pnpm/@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2/node_modules/@emotion/react/dist/emotion-react.browser.esm.js");
|
|
/* harmony import */ var _flex__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/flex/flex/component.js");
|
|
/* harmony import */ var _flex__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/flex/flex-item/component.js");
|
|
/* harmony import */ var _text__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/text/component.js");
|
|
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/colors-values.js");
|
|
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/rtl.js");
|
|
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/config-values.js");
|
|
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/base-label.js");
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
|
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
const Prefix = /*#__PURE__*/(0,_emotion_styled_base__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)("span", true ? {
|
|
target: "em5sgkm8"
|
|
} : 0)( true ? {
|
|
name: "pvvbxf",
|
|
styles: "box-sizing:border-box;display:block"
|
|
} : 0);
|
|
const Suffix = /*#__PURE__*/(0,_emotion_styled_base__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)("span", true ? {
|
|
target: "em5sgkm7"
|
|
} : 0)( true ? {
|
|
name: "jgf79h",
|
|
styles: "align-items:center;align-self:stretch;box-sizing:border-box;display:flex"
|
|
} : 0);
|
|
const backdropBorderColor = ({
|
|
disabled,
|
|
isBorderless
|
|
}) => {
|
|
if (isBorderless) {
|
|
return 'transparent';
|
|
}
|
|
if (disabled) {
|
|
return _utils__WEBPACK_IMPORTED_MODULE_2__/* .COLORS */ .l.ui.borderDisabled;
|
|
}
|
|
return _utils__WEBPACK_IMPORTED_MODULE_2__/* .COLORS */ .l.ui.border;
|
|
};
|
|
const BackdropUI = /*#__PURE__*/(0,_emotion_styled_base__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)("div", true ? {
|
|
target: "em5sgkm6"
|
|
} : 0)("&&&{box-sizing:border-box;border-color:", backdropBorderColor, ";border-radius:inherit;border-style:solid;border-width:1px;bottom:0;left:0;margin:0;padding:0;pointer-events:none;position:absolute;right:0;top:0;", (0,_utils__WEBPACK_IMPORTED_MODULE_3__/* .rtl */ .h)({
|
|
paddingLeft: 2
|
|
}), ";}" + ( true ? "" : 0));
|
|
const Root = /*#__PURE__*/(0,_emotion_styled_base__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)(_flex__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .A, true ? {
|
|
target: "em5sgkm5"
|
|
} : 0)("box-sizing:border-box;position:relative;border-radius:", _utils__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.radiusSmall, ";padding-top:0;&:focus-within:not( :has( :is( ", Prefix, ", ", Suffix, " ):focus-within ) ){", BackdropUI, "{border-color:", _utils__WEBPACK_IMPORTED_MODULE_2__/* .COLORS */ .l.ui.borderFocus, ";box-shadow:", _utils__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.controlBoxShadowFocus, ";outline:2px solid transparent;outline-offset:-2px;}}" + ( true ? "" : 0));
|
|
const containerDisabledStyles = ({
|
|
disabled
|
|
}) => {
|
|
const backgroundColor = disabled ? _utils__WEBPACK_IMPORTED_MODULE_2__/* .COLORS */ .l.ui.backgroundDisabled : _utils__WEBPACK_IMPORTED_MODULE_2__/* .COLORS */ .l.ui.background;
|
|
return /*#__PURE__*/(0,_emotion_react__WEBPACK_IMPORTED_MODULE_6__/* .css */ .AH)({
|
|
backgroundColor
|
|
}, true ? "" : 0, true ? "" : 0);
|
|
};
|
|
var _ref = true ? {
|
|
name: "1d3w5wq",
|
|
styles: "width:100%"
|
|
} : 0;
|
|
const containerWidthStyles = ({
|
|
__unstableInputWidth,
|
|
labelPosition
|
|
}) => {
|
|
if (!__unstableInputWidth) {
|
|
return _ref;
|
|
}
|
|
if (labelPosition === 'side') {
|
|
return '';
|
|
}
|
|
if (labelPosition === 'edge') {
|
|
return /*#__PURE__*/(0,_emotion_react__WEBPACK_IMPORTED_MODULE_6__/* .css */ .AH)({
|
|
flex: `0 0 ${__unstableInputWidth}`
|
|
}, true ? "" : 0, true ? "" : 0);
|
|
}
|
|
return /*#__PURE__*/(0,_emotion_react__WEBPACK_IMPORTED_MODULE_6__/* .css */ .AH)({
|
|
width: __unstableInputWidth
|
|
}, true ? "" : 0, true ? "" : 0);
|
|
};
|
|
const Container = /*#__PURE__*/(0,_emotion_styled_base__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)("div", true ? {
|
|
target: "em5sgkm4"
|
|
} : 0)("align-items:center;box-sizing:border-box;border-radius:inherit;display:flex;flex:1;position:relative;", containerDisabledStyles, " ", containerWidthStyles, ";" + ( true ? "" : 0));
|
|
const disabledStyles = ({
|
|
disabled
|
|
}) => {
|
|
if (!disabled) {
|
|
return '';
|
|
}
|
|
return /*#__PURE__*/(0,_emotion_react__WEBPACK_IMPORTED_MODULE_6__/* .css */ .AH)({
|
|
color: _utils__WEBPACK_IMPORTED_MODULE_2__/* .COLORS */ .l.ui.textDisabled
|
|
}, true ? "" : 0, true ? "" : 0);
|
|
};
|
|
const fontSizeStyles = ({
|
|
inputSize: size
|
|
}) => {
|
|
const sizes = {
|
|
default: '13px',
|
|
small: '11px',
|
|
compact: '13px',
|
|
'__unstable-large': '13px'
|
|
};
|
|
const fontSize = sizes[size] || sizes.default;
|
|
const fontSizeMobile = '16px';
|
|
if (!fontSize) {
|
|
return '';
|
|
}
|
|
return /*#__PURE__*/(0,_emotion_react__WEBPACK_IMPORTED_MODULE_6__/* .css */ .AH)("font-size:", fontSizeMobile, ";@media ( min-width: 600px ){font-size:", fontSize, ";}" + ( true ? "" : 0), true ? "" : 0);
|
|
};
|
|
const getSizeConfig = ({
|
|
inputSize: size,
|
|
__next40pxDefaultSize
|
|
}) => {
|
|
// Paddings may be overridden by the custom paddings props.
|
|
const sizes = {
|
|
default: {
|
|
height: 40,
|
|
lineHeight: 1,
|
|
minHeight: 40,
|
|
paddingLeft: _utils__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.controlPaddingX,
|
|
paddingRight: _utils__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.controlPaddingX
|
|
},
|
|
small: {
|
|
height: 24,
|
|
lineHeight: 1,
|
|
minHeight: 24,
|
|
paddingLeft: _utils__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.controlPaddingXSmall,
|
|
paddingRight: _utils__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.controlPaddingXSmall
|
|
},
|
|
compact: {
|
|
height: 32,
|
|
lineHeight: 1,
|
|
minHeight: 32,
|
|
paddingLeft: _utils__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.controlPaddingXSmall,
|
|
paddingRight: _utils__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.controlPaddingXSmall
|
|
},
|
|
'__unstable-large': {
|
|
height: 40,
|
|
lineHeight: 1,
|
|
minHeight: 40,
|
|
paddingLeft: _utils__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.controlPaddingX,
|
|
paddingRight: _utils__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A.controlPaddingX
|
|
}
|
|
};
|
|
if (!__next40pxDefaultSize) {
|
|
sizes.default = sizes.compact;
|
|
}
|
|
return sizes[size] || sizes.default;
|
|
};
|
|
const sizeStyles = props => {
|
|
return /*#__PURE__*/(0,_emotion_react__WEBPACK_IMPORTED_MODULE_6__/* .css */ .AH)(getSizeConfig(props), true ? "" : 0, true ? "" : 0);
|
|
};
|
|
const customPaddings = ({
|
|
paddingInlineStart,
|
|
paddingInlineEnd
|
|
}) => {
|
|
return /*#__PURE__*/(0,_emotion_react__WEBPACK_IMPORTED_MODULE_6__/* .css */ .AH)({
|
|
paddingInlineStart,
|
|
paddingInlineEnd
|
|
}, true ? "" : 0, true ? "" : 0);
|
|
};
|
|
const dragStyles = ({
|
|
isDragging,
|
|
dragCursor
|
|
}) => {
|
|
let defaultArrowStyles;
|
|
let activeDragCursorStyles;
|
|
if (isDragging) {
|
|
defaultArrowStyles = /*#__PURE__*/(0,_emotion_react__WEBPACK_IMPORTED_MODULE_6__/* .css */ .AH)("cursor:", dragCursor, ";user-select:none;&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{-webkit-appearance:none!important;margin:0!important;}" + ( true ? "" : 0), true ? "" : 0);
|
|
}
|
|
if (isDragging && dragCursor) {
|
|
activeDragCursorStyles = /*#__PURE__*/(0,_emotion_react__WEBPACK_IMPORTED_MODULE_6__/* .css */ .AH)("&:active{cursor:", dragCursor, ";}" + ( true ? "" : 0), true ? "" : 0);
|
|
}
|
|
return /*#__PURE__*/(0,_emotion_react__WEBPACK_IMPORTED_MODULE_6__/* .css */ .AH)(defaultArrowStyles, " ", activeDragCursorStyles, ";" + ( true ? "" : 0), true ? "" : 0);
|
|
};
|
|
|
|
// TODO: Resolve need to use &&& to increase specificity
|
|
// https://github.com/WordPress/gutenberg/issues/18483
|
|
|
|
const Input = /*#__PURE__*/(0,_emotion_styled_base__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)("input", true ? {
|
|
target: "em5sgkm3"
|
|
} : 0)("&&&{background-color:transparent;box-sizing:border-box;border:none;box-shadow:none!important;color:", _utils__WEBPACK_IMPORTED_MODULE_2__/* .COLORS */ .l.theme.foreground, ";display:block;font-family:inherit;margin:0;outline:none;width:100%;", dragStyles, " ", disabledStyles, " ", fontSizeStyles, " ", sizeStyles, " ", customPaddings, " &::-webkit-input-placeholder{line-height:normal;}}" + ( true ? "" : 0));
|
|
const BaseLabel = /*#__PURE__*/(0,_emotion_styled_base__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)(_text__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .A, true ? {
|
|
target: "em5sgkm2"
|
|
} : 0)("&&&{", _utils__WEBPACK_IMPORTED_MODULE_8__/* .baseLabelTypography */ .z, ";box-sizing:border-box;display:block;padding-top:0;padding-bottom:0;max-width:100%;z-index:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}" + ( true ? "" : 0));
|
|
const Label = props => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(BaseLabel, {
|
|
...props,
|
|
as: "label"
|
|
});
|
|
const LabelWrapper = /*#__PURE__*/(0,_emotion_styled_base__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)(_flex__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .A, true ? {
|
|
target: "em5sgkm1"
|
|
} : 0)( true ? {
|
|
name: "1b6uupn",
|
|
styles: "max-width:calc( 100% - 10px )"
|
|
} : 0);
|
|
const prefixSuffixWrapperStyles = ({
|
|
variant = 'default',
|
|
size,
|
|
__next40pxDefaultSize,
|
|
isPrefix
|
|
}) => {
|
|
const {
|
|
paddingLeft: padding
|
|
} = getSizeConfig({
|
|
inputSize: size,
|
|
__next40pxDefaultSize
|
|
});
|
|
const paddingProperty = isPrefix ? 'paddingInlineStart' : 'paddingInlineEnd';
|
|
if (variant === 'default') {
|
|
return /*#__PURE__*/(0,_emotion_react__WEBPACK_IMPORTED_MODULE_6__/* .css */ .AH)({
|
|
[paddingProperty]: padding
|
|
}, true ? "" : 0, true ? "" : 0);
|
|
}
|
|
|
|
// If variant is 'icon' or 'control'
|
|
return /*#__PURE__*/(0,_emotion_react__WEBPACK_IMPORTED_MODULE_6__/* .css */ .AH)({
|
|
display: 'flex',
|
|
[paddingProperty]: padding - 4
|
|
}, true ? "" : 0, true ? "" : 0);
|
|
};
|
|
const PrefixSuffixWrapper = /*#__PURE__*/(0,_emotion_styled_base__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)("div", true ? {
|
|
target: "em5sgkm0"
|
|
} : 0)(prefixSuffixWrapperStyles, ";" + ( true ? "" : 0));
|
|
//# sourceMappingURL=input-control-styles.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/number-control/index.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
A: () => (/* binding */ number_control)
|
|
});
|
|
|
|
// UNUSED EXPORTS: NumberControl
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
var clsx = __webpack_require__("../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js
|
|
var react = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+i18n@5.7.0/node_modules/@wordpress/i18n/build-module/index.js + 3 modules
|
|
var build_module = __webpack_require__("../../node_modules/.pnpm/@wordpress+i18n@5.7.0/node_modules/@wordpress/i18n/build-module/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+primitives@4.7.0_react@17.0.2/node_modules/@wordpress/primitives/build-module/svg/index.js
|
|
var svg = __webpack_require__("../../node_modules/.pnpm/@wordpress+primitives@4.7.0_react@17.0.2/node_modules/@wordpress/primitives/build-module/svg/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+icons@10.7.0_react@17.0.2/node_modules/@wordpress/icons/build-module/library/plus.js
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
const plus = /*#__PURE__*/(0,jsx_runtime.jsx)(svg/* SVG */.t4, {
|
|
xmlns: "http://www.w3.org/2000/svg",
|
|
viewBox: "0 0 24 24",
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(svg/* Path */.wA, {
|
|
d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"
|
|
})
|
|
});
|
|
/* harmony default export */ const library_plus = (plus);
|
|
//# sourceMappingURL=plus.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+icons@10.7.0_react@17.0.2/node_modules/@wordpress/icons/build-module/library/reset.js
|
|
var library_reset = __webpack_require__("../../node_modules/.pnpm/@wordpress+icons@10.7.0_react@17.0.2/node_modules/@wordpress/icons/build-module/library/reset.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-merge-refs/index.js
|
|
var use_merge_refs = __webpack_require__("../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-merge-refs/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+deprecated@4.7.0/node_modules/@wordpress/deprecated/build-module/index.js
|
|
var deprecated_build_module = __webpack_require__("../../node_modules/.pnpm/@wordpress+deprecated@4.7.0/node_modules/@wordpress/deprecated/build-module/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@emotion+styled@11.11.0_@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2__@types+react@17.0.71_react@17.0.2/node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js
|
|
var emotion_styled_base_browser_esm = __webpack_require__("../../node_modules/.pnpm/@emotion+styled@11.11.0_@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2__@types+react@17.0.71_react@17.0.2/node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2/node_modules/@emotion/react/dist/emotion-react.browser.esm.js
|
|
var emotion_react_browser_esm = __webpack_require__("../../node_modules/.pnpm/@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2/node_modules/@emotion/react/dist/emotion-react.browser.esm.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/index.js + 8 modules
|
|
var input_control = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/colors-values.js
|
|
var colors_values = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/colors-values.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/button/index.js
|
|
var build_module_button = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/button/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/space.js
|
|
var space = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/space.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/number-control/styles/number-control-styles.js
|
|
|
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
var _ref = true ? {
|
|
name: "euqsgg",
|
|
styles: "input[type='number']::-webkit-outer-spin-button,input[type='number']::-webkit-inner-spin-button{-webkit-appearance:none!important;margin:0!important;}input[type='number']{-moz-appearance:textfield;}"
|
|
} : 0;
|
|
const htmlArrowStyles = ({
|
|
hideHTMLArrows
|
|
}) => {
|
|
if (!hideHTMLArrows) {
|
|
return ``;
|
|
}
|
|
return _ref;
|
|
};
|
|
const Input = /*#__PURE__*/(0,emotion_styled_base_browser_esm/* default */.A)(input_control/* default */.Ay, true ? {
|
|
target: "ep09it41"
|
|
} : 0)(htmlArrowStyles, ";" + ( true ? "" : 0));
|
|
const SpinButton = /*#__PURE__*/(0,emotion_styled_base_browser_esm/* default */.A)(build_module_button/* default */.Ay, true ? {
|
|
target: "ep09it40"
|
|
} : 0)("&&&&&{color:", colors_values/* COLORS */.l.theme.accent, ";}" + ( true ? "" : 0));
|
|
const smallSpinButtons = /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)("width:", (0,space/* space */.x)(5), ";min-width:", (0,space/* space */.x)(5), ";height:", (0,space/* space */.x)(5), ";" + ( true ? "" : 0), true ? "" : 0);
|
|
const styles = {
|
|
smallSpinButtons
|
|
};
|
|
//# sourceMappingURL=number-control-styles.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/reducer/actions.js
|
|
var actions = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/reducer/actions.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/math.js
|
|
var math = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/math.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/values.js
|
|
var values = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/values.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/h-stack/component.js
|
|
var component = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/h-stack/component.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/spacer/component.js + 1 modules
|
|
var spacer_component = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/spacer/component.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/hooks/use-cx.js
|
|
var use_cx = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/hooks/use-cx.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/use-deprecated-props.js
|
|
var use_deprecated_props = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/use-deprecated-props.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/number-control/index.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const noop = () => {};
|
|
function UnforwardedNumberControl(props, forwardedRef) {
|
|
const {
|
|
__unstableStateReducer: stateReducerProp,
|
|
className,
|
|
dragDirection = 'n',
|
|
hideHTMLArrows = false,
|
|
spinControls = hideHTMLArrows ? 'none' : 'native',
|
|
isDragEnabled = true,
|
|
isShiftStepEnabled = true,
|
|
label,
|
|
max = Infinity,
|
|
min = -Infinity,
|
|
required = false,
|
|
shiftStep = 10,
|
|
step = 1,
|
|
spinFactor = 1,
|
|
type: typeProp = 'number',
|
|
value: valueProp,
|
|
size = 'default',
|
|
suffix,
|
|
onChange = noop,
|
|
...restProps
|
|
} = (0,use_deprecated_props/* useDeprecated36pxDefaultSizeProp */.R)(props);
|
|
if (hideHTMLArrows) {
|
|
(0,deprecated_build_module/* default */.A)('wp.components.NumberControl hideHTMLArrows prop ', {
|
|
alternative: 'spinControls="none"',
|
|
since: '6.2',
|
|
version: '6.3'
|
|
});
|
|
}
|
|
const inputRef = (0,react.useRef)();
|
|
const mergedRef = (0,use_merge_refs/* default */.A)([inputRef, forwardedRef]);
|
|
const isStepAny = step === 'any';
|
|
const baseStep = isStepAny ? 1 : (0,values/* ensureNumber */.GB)(step);
|
|
const baseSpin = (0,values/* ensureNumber */.GB)(spinFactor) * baseStep;
|
|
const baseValue = (0,math/* roundClamp */.ir)(0, min, max, baseStep);
|
|
const constrainValue = (value, stepOverride) => {
|
|
// When step is "any" clamp the value, otherwise round and clamp it.
|
|
// Use '' + to convert to string for use in input value attribute.
|
|
return isStepAny ? '' + Math.min(max, Math.max(min, (0,values/* ensureNumber */.GB)(value))) : '' + (0,math/* roundClamp */.ir)(value, min, max, stepOverride !== null && stepOverride !== void 0 ? stepOverride : baseStep);
|
|
};
|
|
const autoComplete = typeProp === 'number' ? 'off' : undefined;
|
|
const classes = (0,clsx/* default */.A)('components-number-control', className);
|
|
const cx = (0,use_cx/* useCx */.l)();
|
|
const spinButtonClasses = cx(size === 'small' && styles.smallSpinButtons);
|
|
const spinValue = (value, direction, event) => {
|
|
event?.preventDefault();
|
|
const shift = event?.shiftKey && isShiftStepEnabled;
|
|
const delta = shift ? (0,values/* ensureNumber */.GB)(shiftStep) * baseSpin : baseSpin;
|
|
let nextValue = (0,values/* isValueEmpty */.r6)(value) ? baseValue : value;
|
|
if (direction === 'up') {
|
|
nextValue = (0,math/* add */.WQ)(nextValue, delta);
|
|
} else if (direction === 'down') {
|
|
nextValue = (0,math/* subtract */.Re)(nextValue, delta);
|
|
}
|
|
return constrainValue(nextValue, shift ? delta : undefined);
|
|
};
|
|
|
|
/**
|
|
* "Middleware" function that intercepts updates from InputControl.
|
|
* This allows us to tap into actions to transform the (next) state for
|
|
* InputControl.
|
|
*
|
|
* @return The updated state to apply to InputControl
|
|
*/
|
|
const numberControlStateReducer = (state, action) => {
|
|
const nextState = {
|
|
...state
|
|
};
|
|
const {
|
|
type,
|
|
payload
|
|
} = action;
|
|
const event = payload.event;
|
|
const currentValue = nextState.value;
|
|
|
|
/**
|
|
* Handles custom UP and DOWN Keyboard events
|
|
*/
|
|
if (type === actions/* PRESS_UP */.wX || type === actions/* PRESS_DOWN */.r7) {
|
|
nextState.value = spinValue(currentValue, type === actions/* PRESS_UP */.wX ? 'up' : 'down', event);
|
|
}
|
|
|
|
/**
|
|
* Handles drag to update events
|
|
*/
|
|
if (type === actions/* DRAG */.j && isDragEnabled) {
|
|
const [x, y] = payload.delta;
|
|
const enableShift = payload.shiftKey && isShiftStepEnabled;
|
|
const modifier = enableShift ? (0,values/* ensureNumber */.GB)(shiftStep) * baseSpin : baseSpin;
|
|
let directionModifier;
|
|
let delta;
|
|
switch (dragDirection) {
|
|
case 'n':
|
|
delta = y;
|
|
directionModifier = -1;
|
|
break;
|
|
case 'e':
|
|
delta = x;
|
|
directionModifier = (0,build_module/* isRTL */.V8)() ? -1 : 1;
|
|
break;
|
|
case 's':
|
|
delta = y;
|
|
directionModifier = 1;
|
|
break;
|
|
case 'w':
|
|
delta = x;
|
|
directionModifier = (0,build_module/* isRTL */.V8)() ? 1 : -1;
|
|
break;
|
|
}
|
|
if (delta !== 0) {
|
|
delta = Math.ceil(Math.abs(delta)) * Math.sign(delta);
|
|
const distance = delta * modifier * directionModifier;
|
|
nextState.value = constrainValue(
|
|
// @ts-expect-error TODO: Investigate if it's ok for currentValue to be undefined
|
|
(0,math/* add */.WQ)(currentValue, distance), enableShift ? modifier : undefined);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Handles commit (ENTER key press or blur)
|
|
*/
|
|
if (type === actions/* PRESS_ENTER */.bR || type === actions/* COMMIT */.cJ) {
|
|
const applyEmptyValue = required === false && currentValue === '';
|
|
nextState.value = applyEmptyValue ? currentValue :
|
|
// @ts-expect-error TODO: Investigate if it's ok for currentValue to be undefined
|
|
constrainValue(currentValue);
|
|
}
|
|
return nextState;
|
|
};
|
|
const buildSpinButtonClickHandler = direction => event => onChange(String(spinValue(valueProp, direction, event)), {
|
|
// Set event.target to the <input> so that consumers can use
|
|
// e.g. event.target.validity.
|
|
event: {
|
|
...event,
|
|
target: inputRef.current
|
|
}
|
|
});
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(Input, {
|
|
autoComplete: autoComplete,
|
|
inputMode: "numeric",
|
|
...restProps,
|
|
className: classes,
|
|
dragDirection: dragDirection,
|
|
hideHTMLArrows: spinControls !== 'native',
|
|
isDragEnabled: isDragEnabled,
|
|
label: label,
|
|
max: max,
|
|
min: min,
|
|
ref: mergedRef,
|
|
required: required,
|
|
step: step,
|
|
type: typeProp
|
|
// @ts-expect-error TODO: Resolve discrepancy between `value` types in InputControl based components
|
|
,
|
|
value: valueProp,
|
|
__unstableStateReducer: (state, action) => {
|
|
var _stateReducerProp;
|
|
const baseState = numberControlStateReducer(state, action);
|
|
return (_stateReducerProp = stateReducerProp?.(baseState, action)) !== null && _stateReducerProp !== void 0 ? _stateReducerProp : baseState;
|
|
},
|
|
size: size,
|
|
suffix: spinControls === 'custom' ? /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
children: [suffix, /*#__PURE__*/(0,jsx_runtime.jsx)(spacer_component/* default */.A, {
|
|
marginBottom: 0,
|
|
marginRight: 2,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(component/* default */.A, {
|
|
spacing: 1,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(SpinButton, {
|
|
className: spinButtonClasses,
|
|
icon: library_plus,
|
|
size: "small",
|
|
label: (0,build_module.__)('Increment'),
|
|
onClick: buildSpinButtonClickHandler('up')
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(SpinButton, {
|
|
className: spinButtonClasses,
|
|
icon: library_reset/* default */.A,
|
|
size: "small",
|
|
label: (0,build_module.__)('Decrement'),
|
|
onClick: buildSpinButtonClickHandler('down')
|
|
})]
|
|
})
|
|
})]
|
|
}) : suffix,
|
|
onChange: onChange
|
|
});
|
|
}
|
|
const NumberControl = (0,react.forwardRef)(UnforwardedNumberControl);
|
|
/* harmony default export */ const number_control = (NumberControl);
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/popover/index.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
Ay: () => (/* binding */ popover)
|
|
});
|
|
|
|
// UNUSED EXPORTS: Popover, SLOT_NAME
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
var clsx = __webpack_require__("../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@floating-ui+core@1.5.2/node_modules/@floating-ui/core/dist/floating-ui.core.mjs
|
|
var floating_ui_core = __webpack_require__("../../node_modules/.pnpm/@floating-ui+core@1.5.2/node_modules/@floating-ui/core/dist/floating-ui.core.mjs");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@floating-ui+dom@1.5.3/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs + 1 modules
|
|
var floating_ui_dom = __webpack_require__("../../node_modules/.pnpm/@floating-ui+dom@1.5.3/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js
|
|
var react = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/index.js
|
|
var react_dom = __webpack_require__("../../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/index.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@floating-ui+react-dom@2.0.9_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* 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 => {
|
|
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 (0,floating_ui_core/* arrow */.UE)({
|
|
element: element.current,
|
|
padding
|
|
}).fn(state);
|
|
}
|
|
return {};
|
|
}
|
|
if (element) {
|
|
return (0,floating_ui_core/* arrow */.UE)({
|
|
element,
|
|
padding
|
|
}).fn(state);
|
|
}
|
|
return {};
|
|
}
|
|
};
|
|
};
|
|
|
|
var index = typeof document !== 'undefined' ? react.useLayoutEffect : react.useEffect;
|
|
|
|
// 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 update = react.useCallback(() => {
|
|
if (!referenceRef.current || !floatingRef.current) {
|
|
return;
|
|
}
|
|
const config = {
|
|
placement,
|
|
strategy,
|
|
middleware: latestMiddleware
|
|
};
|
|
if (platformRef.current) {
|
|
config.platform = platformRef.current;
|
|
}
|
|
(0,floating_ui_dom/* computePosition */.rD)(referenceRef.current, floatingRef.current, config).then(data => {
|
|
const fullData = {
|
|
...data,
|
|
isPositioned: true
|
|
};
|
|
if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
|
|
dataRef.current = fullData;
|
|
react_dom.flushSync(() => {
|
|
setData(fullData);
|
|
});
|
|
}
|
|
});
|
|
}, [latestMiddleware, placement, strategy, platformRef]);
|
|
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]);
|
|
}
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/dom/motion.mjs + 210 modules
|
|
var motion = __webpack_require__("../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/dom/motion.mjs");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-viewport-match/index.js
|
|
var use_viewport_match = __webpack_require__("../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-viewport-match/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+i18n@5.7.0/node_modules/@wordpress/i18n/build-module/index.js + 3 modules
|
|
var build_module = __webpack_require__("../../node_modules/.pnpm/@wordpress+i18n@5.7.0/node_modules/@wordpress/i18n/build-module/index.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+keycodes@4.7.0/node_modules/@wordpress/keycodes/build-module/platform.js
|
|
/**
|
|
* Return true if platform is MacOS.
|
|
*
|
|
* @param {Window?} _window window object by default; used for DI testing.
|
|
*
|
|
* @return {boolean} True if MacOS; false otherwise.
|
|
*/
|
|
function isAppleOS(_window = null) {
|
|
if (!_window) {
|
|
if (typeof window === 'undefined') {
|
|
return false;
|
|
}
|
|
_window = window;
|
|
}
|
|
const {
|
|
platform
|
|
} = _window.navigator;
|
|
return platform.indexOf('Mac') !== -1 || ['iPad', 'iPhone'].includes(platform);
|
|
}
|
|
//# sourceMappingURL=platform.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+keycodes@4.7.0/node_modules/@wordpress/keycodes/build-module/index.js
|
|
/**
|
|
* Note: The order of the modifier keys in many of the [foo]Shortcut()
|
|
* functions in this file are intentional and should not be changed. They're
|
|
* designed to fit with the standard menu keyboard shortcuts shown in the
|
|
* user's platform.
|
|
*
|
|
* For example, on MacOS menu shortcuts will place Shift before Command, but
|
|
* on Windows Control will usually come first. So don't provide your own
|
|
* shortcut combos directly to keyboardShortcut().
|
|
*/
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
/** @typedef {typeof ALT | CTRL | COMMAND | SHIFT } WPModifierPart */
|
|
|
|
/** @typedef {'primary' | 'primaryShift' | 'primaryAlt' | 'secondary' | 'access' | 'ctrl' | 'alt' | 'ctrlShift' | 'shift' | 'shiftAlt' | 'undefined'} WPKeycodeModifier */
|
|
|
|
/**
|
|
* An object of handler functions for each of the possible modifier
|
|
* combinations. A handler will return a value for a given key.
|
|
*
|
|
* @template T
|
|
*
|
|
* @typedef {Record<WPKeycodeModifier, T>} WPModifierHandler
|
|
*/
|
|
|
|
/**
|
|
* @template T
|
|
*
|
|
* @typedef {(character: string, isApple?: () => boolean) => T} WPKeyHandler
|
|
*/
|
|
/** @typedef {(event: import('react').KeyboardEvent<HTMLElement> | KeyboardEvent, character: string, isApple?: () => boolean) => boolean} WPEventKeyHandler */
|
|
|
|
/** @typedef {( isApple: () => boolean ) => WPModifierPart[]} WPModifier */
|
|
|
|
/**
|
|
* Keycode for BACKSPACE key.
|
|
*/
|
|
const BACKSPACE = 8;
|
|
|
|
/**
|
|
* Keycode for TAB key.
|
|
*/
|
|
const TAB = 9;
|
|
|
|
/**
|
|
* Keycode for ENTER key.
|
|
*/
|
|
const ENTER = 13;
|
|
|
|
/**
|
|
* Keycode for ESCAPE key.
|
|
*/
|
|
const ESCAPE = 27;
|
|
|
|
/**
|
|
* Keycode for SPACE key.
|
|
*/
|
|
const SPACE = 32;
|
|
|
|
/**
|
|
* Keycode for PAGEUP key.
|
|
*/
|
|
const PAGEUP = 33;
|
|
|
|
/**
|
|
* Keycode for PAGEDOWN key.
|
|
*/
|
|
const PAGEDOWN = 34;
|
|
|
|
/**
|
|
* Keycode for END key.
|
|
*/
|
|
const END = 35;
|
|
|
|
/**
|
|
* Keycode for HOME key.
|
|
*/
|
|
const HOME = 36;
|
|
|
|
/**
|
|
* Keycode for LEFT key.
|
|
*/
|
|
const LEFT = 37;
|
|
|
|
/**
|
|
* Keycode for UP key.
|
|
*/
|
|
const UP = 38;
|
|
|
|
/**
|
|
* Keycode for RIGHT key.
|
|
*/
|
|
const RIGHT = 39;
|
|
|
|
/**
|
|
* Keycode for DOWN key.
|
|
*/
|
|
const DOWN = 40;
|
|
|
|
/**
|
|
* Keycode for DELETE key.
|
|
*/
|
|
const DELETE = 46;
|
|
|
|
/**
|
|
* Keycode for F10 key.
|
|
*/
|
|
const F10 = 121;
|
|
|
|
/**
|
|
* Keycode for ALT key.
|
|
*/
|
|
const ALT = 'alt';
|
|
|
|
/**
|
|
* Keycode for CTRL key.
|
|
*/
|
|
const CTRL = 'ctrl';
|
|
|
|
/**
|
|
* Keycode for COMMAND/META key.
|
|
*/
|
|
const COMMAND = 'meta';
|
|
|
|
/**
|
|
* Keycode for SHIFT key.
|
|
*/
|
|
const SHIFT = 'shift';
|
|
|
|
/**
|
|
* Keycode for ZERO key.
|
|
*/
|
|
const ZERO = 48;
|
|
|
|
|
|
/**
|
|
* Capitalise the first character of a string.
|
|
* @param {string} string String to capitalise.
|
|
* @return {string} Capitalised string.
|
|
*/
|
|
function capitaliseFirstCharacter(string) {
|
|
return string.length < 2 ? string.toUpperCase() : string.charAt(0).toUpperCase() + string.slice(1);
|
|
}
|
|
|
|
/**
|
|
* Map the values of an object with a specified callback and return the result object.
|
|
*
|
|
* @template {{ [s: string]: any; } | ArrayLike<any>} T
|
|
*
|
|
* @param {T} object Object to map values of.
|
|
* @param {( value: any ) => any} mapFn Mapping function
|
|
*
|
|
* @return {any} Active modifier constants.
|
|
*/
|
|
function mapValues(object, mapFn) {
|
|
return Object.fromEntries(Object.entries(object).map(([key, value]) => [key, mapFn(value)]));
|
|
}
|
|
|
|
/**
|
|
* Object that contains functions that return the available modifier
|
|
* depending on platform.
|
|
*
|
|
* @type {WPModifierHandler< ( isApple: () => boolean ) => WPModifierPart[]>}
|
|
*/
|
|
const modifiers = {
|
|
primary: _isApple => _isApple() ? [COMMAND] : [CTRL],
|
|
primaryShift: _isApple => _isApple() ? [SHIFT, COMMAND] : [CTRL, SHIFT],
|
|
primaryAlt: _isApple => _isApple() ? [ALT, COMMAND] : [CTRL, ALT],
|
|
secondary: _isApple => _isApple() ? [SHIFT, ALT, COMMAND] : [CTRL, SHIFT, ALT],
|
|
access: _isApple => _isApple() ? [CTRL, ALT] : [SHIFT, ALT],
|
|
ctrl: () => [CTRL],
|
|
alt: () => [ALT],
|
|
ctrlShift: () => [CTRL, SHIFT],
|
|
shift: () => [SHIFT],
|
|
shiftAlt: () => [SHIFT, ALT],
|
|
undefined: () => []
|
|
};
|
|
|
|
/**
|
|
* An object that contains functions to get raw shortcuts.
|
|
*
|
|
* These are intended for user with the KeyboardShortcuts.
|
|
*
|
|
* @example
|
|
* ```js
|
|
* // Assuming macOS:
|
|
* rawShortcut.primary( 'm' )
|
|
* // "meta+m""
|
|
* ```
|
|
*
|
|
* @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to raw
|
|
* shortcuts.
|
|
*/
|
|
const rawShortcut = mapValues(modifiers, ( /** @type {WPModifier} */modifier) => {
|
|
return /** @type {WPKeyHandler<string>} */(character, _isApple = isAppleOS) => {
|
|
return [...modifier(_isApple), character.toLowerCase()].join('+');
|
|
};
|
|
});
|
|
|
|
/**
|
|
* Return an array of the parts of a keyboard shortcut chord for display.
|
|
*
|
|
* @example
|
|
* ```js
|
|
* // Assuming macOS:
|
|
* displayShortcutList.primary( 'm' );
|
|
* // [ "⌘", "M" ]
|
|
* ```
|
|
*
|
|
* @type {WPModifierHandler<WPKeyHandler<string[]>>} Keyed map of functions to
|
|
* shortcut sequences.
|
|
*/
|
|
const displayShortcutList = mapValues(modifiers, ( /** @type {WPModifier} */modifier) => {
|
|
return /** @type {WPKeyHandler<string[]>} */(character, _isApple = isAppleOS) => {
|
|
const isApple = _isApple();
|
|
const replacementKeyMap = {
|
|
[ALT]: isApple ? '⌥' : 'Alt',
|
|
[CTRL]: isApple ? '⌃' : 'Ctrl',
|
|
// Make sure ⌃ is the U+2303 UP ARROWHEAD unicode character and not the caret character.
|
|
[COMMAND]: '⌘',
|
|
[SHIFT]: isApple ? '⇧' : 'Shift'
|
|
};
|
|
const modifierKeys = modifier(_isApple).reduce((accumulator, key) => {
|
|
var _replacementKeyMap$ke;
|
|
const replacementKey = (_replacementKeyMap$ke = replacementKeyMap[key]) !== null && _replacementKeyMap$ke !== void 0 ? _replacementKeyMap$ke : key;
|
|
// If on the Mac, adhere to platform convention and don't show plus between keys.
|
|
if (isApple) {
|
|
return [...accumulator, replacementKey];
|
|
}
|
|
return [...accumulator, replacementKey, '+'];
|
|
}, /** @type {string[]} */[]);
|
|
return [...modifierKeys, capitaliseFirstCharacter(character)];
|
|
};
|
|
});
|
|
|
|
/**
|
|
* An object that contains functions to display shortcuts.
|
|
*
|
|
* @example
|
|
* ```js
|
|
* // Assuming macOS:
|
|
* displayShortcut.primary( 'm' );
|
|
* // "⌘M"
|
|
* ```
|
|
*
|
|
* @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to
|
|
* display shortcuts.
|
|
*/
|
|
const displayShortcut = mapValues(displayShortcutList, ( /** @type {WPKeyHandler<string[]>} */shortcutList) => {
|
|
return /** @type {WPKeyHandler<string>} */(character, _isApple = isAppleOS) => shortcutList(character, _isApple).join('');
|
|
});
|
|
|
|
/**
|
|
* An object that contains functions to return an aria label for a keyboard
|
|
* shortcut.
|
|
*
|
|
* @example
|
|
* ```js
|
|
* // Assuming macOS:
|
|
* shortcutAriaLabel.primary( '.' );
|
|
* // "Command + Period"
|
|
* ```
|
|
*
|
|
* @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to
|
|
* shortcut ARIA labels.
|
|
*/
|
|
const shortcutAriaLabel = mapValues(modifiers, ( /** @type {WPModifier} */modifier) => {
|
|
return /** @type {WPKeyHandler<string>} */(character, _isApple = isAppleOS) => {
|
|
const isApple = _isApple();
|
|
/** @type {Record<string,string>} */
|
|
const replacementKeyMap = {
|
|
[SHIFT]: 'Shift',
|
|
[COMMAND]: isApple ? 'Command' : 'Control',
|
|
[CTRL]: 'Control',
|
|
[ALT]: isApple ? 'Option' : 'Alt',
|
|
/* translators: comma as in the character ',' */
|
|
',': (0,build_module.__)('Comma'),
|
|
/* translators: period as in the character '.' */
|
|
'.': (0,build_module.__)('Period'),
|
|
/* translators: backtick as in the character '`' */
|
|
'`': (0,build_module.__)('Backtick'),
|
|
/* translators: tilde as in the character '~' */
|
|
'~': (0,build_module.__)('Tilde')
|
|
};
|
|
return [...modifier(_isApple), character].map(key => {
|
|
var _replacementKeyMap$ke2;
|
|
return capitaliseFirstCharacter((_replacementKeyMap$ke2 = replacementKeyMap[key]) !== null && _replacementKeyMap$ke2 !== void 0 ? _replacementKeyMap$ke2 : key);
|
|
}).join(isApple ? ' ' : ' + ');
|
|
};
|
|
});
|
|
|
|
/**
|
|
* From a given KeyboardEvent, returns an array of active modifier constants for
|
|
* the event.
|
|
*
|
|
* @param {import('react').KeyboardEvent<HTMLElement> | KeyboardEvent} event Keyboard event.
|
|
*
|
|
* @return {Array<WPModifierPart>} Active modifier constants.
|
|
*/
|
|
function getEventModifiers(event) {
|
|
return /** @type {WPModifierPart[]} */[ALT, CTRL, COMMAND, SHIFT].filter(key => event[( /** @type {'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey'} */
|
|
`${key}Key`)]);
|
|
}
|
|
|
|
/**
|
|
* An object that contains functions to check if a keyboard event matches a
|
|
* predefined shortcut combination.
|
|
*
|
|
* @example
|
|
* ```js
|
|
* // Assuming an event for ⌘M key press:
|
|
* isKeyboardEvent.primary( event, 'm' );
|
|
* // true
|
|
* ```
|
|
*
|
|
* @type {WPModifierHandler<WPEventKeyHandler>} Keyed map of functions
|
|
* to match events.
|
|
*/
|
|
const isKeyboardEvent = mapValues(modifiers, ( /** @type {WPModifier} */getModifiers) => {
|
|
return /** @type {WPEventKeyHandler} */(event, character, _isApple = isAppleOS) => {
|
|
const mods = getModifiers(_isApple);
|
|
const eventMods = getEventModifiers(event);
|
|
/** @type {Record<string,string>} */
|
|
const replacementWithShiftKeyMap = {
|
|
Comma: ',',
|
|
Backslash: '\\',
|
|
// Windows returns `\` for both IntlRo and IntlYen.
|
|
IntlRo: '\\',
|
|
IntlYen: '\\'
|
|
};
|
|
const modsDiff = mods.filter(mod => !eventMods.includes(mod));
|
|
const eventModsDiff = eventMods.filter(mod => !mods.includes(mod));
|
|
if (modsDiff.length > 0 || eventModsDiff.length > 0) {
|
|
return false;
|
|
}
|
|
let key = event.key.toLowerCase();
|
|
if (!character) {
|
|
return mods.includes( /** @type {WPModifierPart} */key);
|
|
}
|
|
if (event.altKey && character.length === 1) {
|
|
key = String.fromCharCode(event.keyCode).toLowerCase();
|
|
}
|
|
|
|
// `event.key` returns the value of the key pressed, taking into the state of
|
|
// modifier keys such as `Shift`. If the shift key is pressed, a different
|
|
// value may be returned depending on the keyboard layout. It is necessary to
|
|
// convert to the physical key value that don't take into account keyboard
|
|
// layout or modifier key state.
|
|
if (event.shiftKey && character.length === 1 && replacementWithShiftKeyMap[event.code]) {
|
|
key = replacementWithShiftKeyMap[event.code];
|
|
}
|
|
|
|
// For backwards compatibility.
|
|
if (character === 'del') {
|
|
character = 'delete';
|
|
}
|
|
return key === character.toLowerCase();
|
|
};
|
|
});
|
|
//# sourceMappingURL=index.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-constrained-tabbing/index.js
|
|
var use_constrained_tabbing = __webpack_require__("../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-constrained-tabbing/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-focus-on-mount/index.js
|
|
var use_focus_on_mount = __webpack_require__("../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-focus-on-mount/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-focus-return/index.js
|
|
var use_focus_return = __webpack_require__("../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-focus-return/index.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-focus-outside/index.js
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Input types which are classified as button types, for use in considering
|
|
* whether element is a (focus-normalized) button.
|
|
*/
|
|
const INPUT_BUTTON_TYPES = ['button', 'submit'];
|
|
|
|
/**
|
|
* List of HTML button elements subject to focus normalization
|
|
*
|
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus
|
|
*/
|
|
|
|
/**
|
|
* Returns true if the given element is a button element subject to focus
|
|
* normalization, or false otherwise.
|
|
*
|
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus
|
|
*
|
|
* @param eventTarget The target from a mouse or touch event.
|
|
*
|
|
* @return Whether the element is a button element subject to focus normalization.
|
|
*/
|
|
function isFocusNormalizedButton(eventTarget) {
|
|
if (!(eventTarget instanceof window.HTMLElement)) {
|
|
return false;
|
|
}
|
|
switch (eventTarget.nodeName) {
|
|
case 'A':
|
|
case 'BUTTON':
|
|
return true;
|
|
case 'INPUT':
|
|
return INPUT_BUTTON_TYPES.includes(eventTarget.type);
|
|
}
|
|
return false;
|
|
}
|
|
/**
|
|
* A react hook that can be used to check whether focus has moved outside the
|
|
* element the event handlers are bound to.
|
|
*
|
|
* @param onFocusOutside A callback triggered when focus moves outside
|
|
* the element the event handlers are bound to.
|
|
*
|
|
* @return An object containing event handlers. Bind the event handlers to a
|
|
* wrapping element element to capture when focus moves outside that element.
|
|
*/
|
|
function useFocusOutside(onFocusOutside) {
|
|
const currentOnFocusOutsideRef = (0,react.useRef)(onFocusOutside);
|
|
(0,react.useEffect)(() => {
|
|
currentOnFocusOutsideRef.current = onFocusOutside;
|
|
}, [onFocusOutside]);
|
|
const preventBlurCheckRef = (0,react.useRef)(false);
|
|
const blurCheckTimeoutIdRef = (0,react.useRef)();
|
|
|
|
/**
|
|
* Cancel a blur check timeout.
|
|
*/
|
|
const cancelBlurCheck = (0,react.useCallback)(() => {
|
|
clearTimeout(blurCheckTimeoutIdRef.current);
|
|
}, []);
|
|
|
|
// Cancel blur checks on unmount.
|
|
(0,react.useEffect)(() => {
|
|
return () => cancelBlurCheck();
|
|
}, []);
|
|
|
|
// Cancel a blur check if the callback or ref is no longer provided.
|
|
(0,react.useEffect)(() => {
|
|
if (!onFocusOutside) {
|
|
cancelBlurCheck();
|
|
}
|
|
}, [onFocusOutside, cancelBlurCheck]);
|
|
|
|
/**
|
|
* Handles a mousedown or mouseup event to respectively assign and
|
|
* unassign a flag for preventing blur check on button elements. Some
|
|
* browsers, namely Firefox and Safari, do not emit a focus event on
|
|
* button elements when clicked, while others do. The logic here
|
|
* intends to normalize this as treating click on buttons as focus.
|
|
*
|
|
* @param event
|
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus
|
|
*/
|
|
const normalizeButtonFocus = (0,react.useCallback)(event => {
|
|
const {
|
|
type,
|
|
target
|
|
} = event;
|
|
const isInteractionEnd = ['mouseup', 'touchend'].includes(type);
|
|
if (isInteractionEnd) {
|
|
preventBlurCheckRef.current = false;
|
|
} else if (isFocusNormalizedButton(target)) {
|
|
preventBlurCheckRef.current = true;
|
|
}
|
|
}, []);
|
|
|
|
/**
|
|
* A callback triggered when a blur event occurs on the element the handler
|
|
* is bound to.
|
|
*
|
|
* Calls the `onFocusOutside` callback in an immediate timeout if focus has
|
|
* move outside the bound element and is still within the document.
|
|
*/
|
|
const queueBlurCheck = (0,react.useCallback)(event => {
|
|
// React does not allow using an event reference asynchronously
|
|
// due to recycling behavior, except when explicitly persisted.
|
|
event.persist();
|
|
|
|
// Skip blur check if clicking button. See `normalizeButtonFocus`.
|
|
if (preventBlurCheckRef.current) {
|
|
return;
|
|
}
|
|
|
|
// The usage of this attribute should be avoided. The only use case
|
|
// would be when we load modals that are not React components and
|
|
// therefore don't exist in the React tree. An example is opening
|
|
// the Media Library modal from another dialog.
|
|
// This attribute should contain a selector of the related target
|
|
// we want to ignore, because we still need to trigger the blur event
|
|
// on all other cases.
|
|
const ignoreForRelatedTarget = event.target.getAttribute('data-unstable-ignore-focus-outside-for-relatedtarget');
|
|
if (ignoreForRelatedTarget && event.relatedTarget?.closest(ignoreForRelatedTarget)) {
|
|
return;
|
|
}
|
|
blurCheckTimeoutIdRef.current = setTimeout(() => {
|
|
// If document is not focused then focus should remain
|
|
// inside the wrapped component and therefore we cancel
|
|
// this blur event thereby leaving focus in place.
|
|
// https://developer.mozilla.org/en-US/docs/Web/API/Document/hasFocus.
|
|
if (!document.hasFocus()) {
|
|
event.preventDefault();
|
|
return;
|
|
}
|
|
if ('function' === typeof currentOnFocusOutsideRef.current) {
|
|
currentOnFocusOutsideRef.current(event);
|
|
}
|
|
}, 0);
|
|
}, []);
|
|
return {
|
|
onFocus: cancelBlurCheck,
|
|
onMouseDown: normalizeButtonFocus,
|
|
onMouseUp: normalizeButtonFocus,
|
|
onTouchStart: normalizeButtonFocus,
|
|
onTouchEnd: normalizeButtonFocus,
|
|
onBlur: queueBlurCheck
|
|
};
|
|
}
|
|
//# sourceMappingURL=index.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-merge-refs/index.js
|
|
var use_merge_refs = __webpack_require__("../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-merge-refs/index.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-dialog/index.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Returns a ref and props to apply to a dialog wrapper to enable the following behaviors:
|
|
* - constrained tabbing.
|
|
* - focus on mount.
|
|
* - return focus on unmount.
|
|
* - focus outside.
|
|
*
|
|
* @param options Dialog Options.
|
|
*/
|
|
function useDialog(options) {
|
|
const currentOptions = (0,react.useRef)();
|
|
const {
|
|
constrainTabbing = options.focusOnMount !== false
|
|
} = options;
|
|
(0,react.useEffect)(() => {
|
|
currentOptions.current = options;
|
|
}, Object.values(options));
|
|
const constrainedTabbingRef = (0,use_constrained_tabbing/* default */.A)();
|
|
const focusOnMountRef = (0,use_focus_on_mount/* default */.A)(options.focusOnMount);
|
|
const focusReturnRef = (0,use_focus_return/* default */.A)();
|
|
const focusOutsideProps = useFocusOutside(event => {
|
|
// This unstable prop is here only to manage backward compatibility
|
|
// for the Popover component otherwise, the onClose should be enough.
|
|
if (currentOptions.current?.__unstableOnClose) {
|
|
currentOptions.current.__unstableOnClose('focus-outside', event);
|
|
} else if (currentOptions.current?.onClose) {
|
|
currentOptions.current.onClose();
|
|
}
|
|
});
|
|
const closeOnEscapeRef = (0,react.useCallback)(node => {
|
|
if (!node) {
|
|
return;
|
|
}
|
|
node.addEventListener('keydown', event => {
|
|
// Close on escape.
|
|
if (event.keyCode === ESCAPE && !event.defaultPrevented && currentOptions.current?.onClose) {
|
|
event.preventDefault();
|
|
currentOptions.current.onClose();
|
|
}
|
|
});
|
|
}, []);
|
|
return [(0,use_merge_refs/* default */.A)([constrainTabbing ? constrainedTabbingRef : null, options.focusOnMount !== false ? focusReturnRef : null, options.focusOnMount !== false ? focusOnMountRef : null, closeOnEscapeRef]), {
|
|
...focusOutsideProps,
|
|
tabIndex: -1
|
|
}];
|
|
}
|
|
/* harmony default export */ const use_dialog = (useDialog);
|
|
//# sourceMappingURL=index.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-reduced-motion/index.js
|
|
var use_reduced_motion = __webpack_require__("../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-reduced-motion/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+icons@10.7.0_react@17.0.2/node_modules/@wordpress/icons/build-module/library/close.js
|
|
var library_close = __webpack_require__("../../node_modules/.pnpm/@wordpress+icons@10.7.0_react@17.0.2/node_modules/@wordpress/icons/build-module/library/close.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+deprecated@4.7.0/node_modules/@wordpress/deprecated/build-module/index.js
|
|
var deprecated_build_module = __webpack_require__("../../node_modules/.pnpm/@wordpress+deprecated@4.7.0/node_modules/@wordpress/deprecated/build-module/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+primitives@4.7.0_react@17.0.2/node_modules/@wordpress/primitives/build-module/svg/index.js
|
|
var svg = __webpack_require__("../../node_modules/.pnpm/@wordpress+primitives@4.7.0_react@17.0.2/node_modules/@wordpress/primitives/build-module/svg/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/button/index.js
|
|
var build_module_button = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/button/index.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/scroll-lock/index.js
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/*
|
|
* Setting `overflow: hidden` on html and body elements resets body scroll in iOS.
|
|
* Save scroll top so we can restore it after locking scroll.
|
|
*
|
|
* NOTE: It would be cleaner and possibly safer to find a localized solution such
|
|
* as preventing default on certain touchmove events.
|
|
*/
|
|
let previousScrollTop = 0;
|
|
function setLocked(locked) {
|
|
const scrollingElement = document.scrollingElement || document.body;
|
|
if (locked) {
|
|
previousScrollTop = scrollingElement.scrollTop;
|
|
}
|
|
const methodName = locked ? 'add' : 'remove';
|
|
scrollingElement.classList[methodName]('lockscroll');
|
|
|
|
// Adding the class to the document element seems to be necessary in iOS.
|
|
document.documentElement.classList[methodName]('lockscroll');
|
|
if (!locked) {
|
|
scrollingElement.scrollTop = previousScrollTop;
|
|
}
|
|
}
|
|
let lockCounter = 0;
|
|
|
|
/**
|
|
* ScrollLock is a content-free React component for declaratively preventing
|
|
* scroll bleed from modal UI to the page body. This component applies a
|
|
* `lockscroll` class to the `document.documentElement` and
|
|
* `document.scrollingElement` elements to stop the body from scrolling. When it
|
|
* is present, the lock is applied.
|
|
*
|
|
* ```jsx
|
|
* import { ScrollLock, Button } from '@wordpress/components';
|
|
* import { useState } from '@wordpress/element';
|
|
*
|
|
* const MyScrollLock = () => {
|
|
* const [ isScrollLocked, setIsScrollLocked ] = useState( false );
|
|
*
|
|
* const toggleLock = () => {
|
|
* setIsScrollLocked( ( locked ) => ! locked ) );
|
|
* };
|
|
*
|
|
* return (
|
|
* <div>
|
|
* <Button variant="secondary" onClick={ toggleLock }>
|
|
* Toggle scroll lock
|
|
* </Button>
|
|
* { isScrollLocked && <ScrollLock /> }
|
|
* <p>
|
|
* Scroll locked:
|
|
* <strong>{ isScrollLocked ? 'Yes' : 'No' }</strong>
|
|
* </p>
|
|
* </div>
|
|
* );
|
|
* };
|
|
* ```
|
|
*/
|
|
function ScrollLock() {
|
|
(0,react.useEffect)(() => {
|
|
if (lockCounter === 0) {
|
|
setLocked(true);
|
|
}
|
|
++lockCounter;
|
|
return () => {
|
|
if (lockCounter === 1) {
|
|
setLocked(false);
|
|
}
|
|
--lockCounter;
|
|
};
|
|
}, []);
|
|
return null;
|
|
}
|
|
/* harmony default export */ const scroll_lock = (ScrollLock);
|
|
//# sourceMappingURL=index.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/use-slot.js + 1 modules
|
|
var use_slot = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/use-slot.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/slot-fill/index.js + 7 modules
|
|
var slot_fill = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/slot-fill/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/popover/utils.js
|
|
var utils = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/popover/utils.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js + 1 modules
|
|
var use_context_system = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-connect.js
|
|
var context_connect = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-connect.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/popover/overlay-middlewares.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
function overlayMiddlewares() {
|
|
return [{
|
|
name: 'overlay',
|
|
fn({
|
|
rects
|
|
}) {
|
|
return rects.reference;
|
|
}
|
|
}, (0,floating_ui_core/* size */.Ej)({
|
|
apply({
|
|
rects,
|
|
elements
|
|
}) {
|
|
var _elements$floating;
|
|
const {
|
|
firstElementChild
|
|
} = (_elements$floating = elements.floating) !== null && _elements$floating !== void 0 ? _elements$floating : {};
|
|
|
|
// Only HTMLElement instances have the `style` property.
|
|
if (!(firstElementChild instanceof HTMLElement)) {
|
|
return;
|
|
}
|
|
|
|
// Reduce the height of the popover to the available space.
|
|
Object.assign(firstElementChild.style, {
|
|
width: `${rects.reference.width}px`,
|
|
height: `${rects.reference.height}px`
|
|
});
|
|
}
|
|
})];
|
|
}
|
|
//# sourceMappingURL=overlay-middlewares.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/style-provider/index.js
|
|
var style_provider = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/style-provider/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/popover/index.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Name of slot in which popover should fill.
|
|
*
|
|
* @type {string}
|
|
*/
|
|
|
|
|
|
|
|
const SLOT_NAME = 'Popover';
|
|
|
|
// An SVG displaying a triangle facing down, filled with a solid
|
|
// color and bordered in such a way to create an arrow-like effect.
|
|
// Keeping the SVG's viewbox squared simplify the arrow positioning
|
|
// calculations.
|
|
const ArrowTriangle = () => /*#__PURE__*/(0,jsx_runtime.jsxs)(svg/* SVG */.t4, {
|
|
xmlns: "http://www.w3.org/2000/svg",
|
|
viewBox: "0 0 100 100",
|
|
className: "components-popover__triangle",
|
|
role: "presentation",
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(svg/* Path */.wA, {
|
|
className: "components-popover__triangle-bg",
|
|
d: "M 0 0 L 50 50 L 100 0"
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(svg/* Path */.wA, {
|
|
className: "components-popover__triangle-border",
|
|
d: "M 0 0 L 50 50 L 100 0",
|
|
vectorEffect: "non-scaling-stroke"
|
|
})]
|
|
});
|
|
const slotNameContext = (0,react.createContext)(undefined);
|
|
const fallbackContainerClassname = 'components-popover__fallback-container';
|
|
const getPopoverFallbackContainer = () => {
|
|
let container = document.body.querySelector('.' + fallbackContainerClassname);
|
|
if (!container) {
|
|
container = document.createElement('div');
|
|
container.className = fallbackContainerClassname;
|
|
document.body.append(container);
|
|
}
|
|
return container;
|
|
};
|
|
const UnforwardedPopover = (props, forwardedRef) => {
|
|
const {
|
|
animate = true,
|
|
headerTitle,
|
|
constrainTabbing,
|
|
onClose,
|
|
children,
|
|
className,
|
|
noArrow = true,
|
|
position,
|
|
placement: placementProp = 'bottom-start',
|
|
offset: offsetProp = 0,
|
|
focusOnMount = 'firstElement',
|
|
anchor,
|
|
expandOnMobile,
|
|
onFocusOutside,
|
|
__unstableSlotName = SLOT_NAME,
|
|
flip = true,
|
|
resize = true,
|
|
shift = false,
|
|
inline = false,
|
|
variant,
|
|
style: contentStyle,
|
|
// Deprecated props
|
|
__unstableForcePosition,
|
|
anchorRef,
|
|
anchorRect,
|
|
getAnchorRect,
|
|
isAlternate,
|
|
// Rest
|
|
...contentProps
|
|
} = (0,use_context_system/* useContextSystem */.A)(props, 'Popover');
|
|
let computedFlipProp = flip;
|
|
let computedResizeProp = resize;
|
|
if (__unstableForcePosition !== undefined) {
|
|
(0,deprecated_build_module/* default */.A)('`__unstableForcePosition` prop in wp.components.Popover', {
|
|
since: '6.1',
|
|
version: '6.3',
|
|
alternative: '`flip={ false }` and `resize={ false }`'
|
|
});
|
|
|
|
// Back-compat, set the `flip` and `resize` props
|
|
// to `false` to replicate `__unstableForcePosition`.
|
|
computedFlipProp = !__unstableForcePosition;
|
|
computedResizeProp = !__unstableForcePosition;
|
|
}
|
|
if (anchorRef !== undefined) {
|
|
(0,deprecated_build_module/* default */.A)('`anchorRef` prop in wp.components.Popover', {
|
|
since: '6.1',
|
|
alternative: '`anchor` prop'
|
|
});
|
|
}
|
|
if (anchorRect !== undefined) {
|
|
(0,deprecated_build_module/* default */.A)('`anchorRect` prop in wp.components.Popover', {
|
|
since: '6.1',
|
|
alternative: '`anchor` prop'
|
|
});
|
|
}
|
|
if (getAnchorRect !== undefined) {
|
|
(0,deprecated_build_module/* default */.A)('`getAnchorRect` prop in wp.components.Popover', {
|
|
since: '6.1',
|
|
alternative: '`anchor` prop'
|
|
});
|
|
}
|
|
const computedVariant = isAlternate ? 'toolbar' : variant;
|
|
if (isAlternate !== undefined) {
|
|
(0,deprecated_build_module/* default */.A)('`isAlternate` prop in wp.components.Popover', {
|
|
since: '6.2',
|
|
alternative: "`variant` prop with the `'toolbar'` value"
|
|
});
|
|
}
|
|
const arrowRef = (0,react.useRef)(null);
|
|
const [fallbackReferenceElement, setFallbackReferenceElement] = (0,react.useState)(null);
|
|
const anchorRefFallback = (0,react.useCallback)(node => {
|
|
setFallbackReferenceElement(node);
|
|
}, []);
|
|
const isMobileViewport = (0,use_viewport_match/* default */.A)('medium', '<');
|
|
const isExpanded = expandOnMobile && isMobileViewport;
|
|
const hasArrow = !isExpanded && !noArrow;
|
|
const normalizedPlacementFromProps = position ? (0,utils/* positionToPlacement */.YK)(position) : placementProp;
|
|
const middleware = [...(placementProp === 'overlay' ? overlayMiddlewares() : []), (0,floating_ui_core/* offset */.cY)(offsetProp), computedFlipProp && (0,floating_ui_core/* flip */.UU)(), computedResizeProp && (0,floating_ui_core/* size */.Ej)({
|
|
apply(sizeProps) {
|
|
var _refs$floating$curren;
|
|
const {
|
|
firstElementChild
|
|
} = (_refs$floating$curren = refs.floating.current) !== null && _refs$floating$curren !== void 0 ? _refs$floating$curren : {};
|
|
|
|
// Only HTMLElement instances have the `style` property.
|
|
if (!(firstElementChild instanceof HTMLElement)) {
|
|
return;
|
|
}
|
|
|
|
// Reduce the height of the popover to the available space.
|
|
Object.assign(firstElementChild.style, {
|
|
maxHeight: `${sizeProps.availableHeight}px`,
|
|
overflow: 'auto'
|
|
});
|
|
}
|
|
}), shift && (0,floating_ui_core/* shift */.BN)({
|
|
crossAxis: true,
|
|
limiter: (0,floating_ui_core/* limitShift */.ER)(),
|
|
padding: 1 // Necessary to avoid flickering at the edge of the viewport.
|
|
}), arrow({
|
|
element: arrowRef
|
|
})];
|
|
const slotName = (0,react.useContext)(slotNameContext) || __unstableSlotName;
|
|
const slot = (0,use_slot/* default */.A)(slotName);
|
|
let onDialogClose;
|
|
if (onClose || onFocusOutside) {
|
|
onDialogClose = (type, event) => {
|
|
// Ideally the popover should have just a single onClose prop and
|
|
// not three props that potentially do the same thing.
|
|
if (type === 'focus-outside' && onFocusOutside) {
|
|
onFocusOutside(event);
|
|
} else if (onClose) {
|
|
onClose();
|
|
}
|
|
};
|
|
}
|
|
const [dialogRef, dialogProps] = use_dialog({
|
|
constrainTabbing,
|
|
focusOnMount,
|
|
__unstableOnClose: onDialogClose,
|
|
// @ts-expect-error The __unstableOnClose property needs to be deprecated first (see https://github.com/WordPress/gutenberg/pull/27675)
|
|
onClose: onDialogClose
|
|
});
|
|
const {
|
|
// Positioning coordinates
|
|
x,
|
|
y,
|
|
// Object with "regular" refs to both "reference" and "floating"
|
|
refs,
|
|
// Type of CSS position property to use (absolute or fixed)
|
|
strategy,
|
|
update,
|
|
placement: computedPlacement,
|
|
middlewareData: {
|
|
arrow: arrowData
|
|
}
|
|
} = useFloating({
|
|
placement: normalizedPlacementFromProps === 'overlay' ? undefined : normalizedPlacementFromProps,
|
|
middleware,
|
|
whileElementsMounted: (referenceParam, floatingParam, updateParam) => (0,floating_ui_dom/* autoUpdate */.ll)(referenceParam, floatingParam, updateParam, {
|
|
layoutShift: false,
|
|
animationFrame: true
|
|
})
|
|
});
|
|
const arrowCallbackRef = (0,react.useCallback)(node => {
|
|
arrowRef.current = node;
|
|
update();
|
|
}, [update]);
|
|
|
|
// When any of the possible anchor "sources" change,
|
|
// recompute the reference element (real or virtual) and its owner document.
|
|
|
|
const anchorRefTop = anchorRef?.top;
|
|
const anchorRefBottom = anchorRef?.bottom;
|
|
const anchorRefStartContainer = anchorRef?.startContainer;
|
|
const anchorRefCurrent = anchorRef?.current;
|
|
(0,react.useLayoutEffect)(() => {
|
|
const resultingReferenceElement = (0,utils/* getReferenceElement */._G)({
|
|
anchor,
|
|
anchorRef,
|
|
anchorRect,
|
|
getAnchorRect,
|
|
fallbackReferenceElement
|
|
});
|
|
refs.setReference(resultingReferenceElement);
|
|
}, [anchor, anchorRef, anchorRefTop, anchorRefBottom, anchorRefStartContainer, anchorRefCurrent, anchorRect, getAnchorRect, fallbackReferenceElement, refs]);
|
|
const mergedFloatingRef = (0,use_merge_refs/* default */.A)([refs.setFloating, dialogRef, forwardedRef]);
|
|
const style = isExpanded ? undefined : {
|
|
position: strategy,
|
|
top: 0,
|
|
left: 0,
|
|
// `x` and `y` are framer-motion specific props and are shorthands
|
|
// for `translateX` and `translateY`. Currently it is not possible
|
|
// to use `translateX` and `translateY` because those values would
|
|
// be overridden by the return value of the
|
|
// `placementToMotionAnimationProps` function.
|
|
x: (0,utils/* computePopoverPosition */.WS)(x),
|
|
y: (0,utils/* computePopoverPosition */.WS)(y)
|
|
};
|
|
const shouldReduceMotion = (0,use_reduced_motion/* default */.A)();
|
|
const shouldAnimate = animate && !isExpanded && !shouldReduceMotion;
|
|
const [animationFinished, setAnimationFinished] = (0,react.useState)(false);
|
|
const {
|
|
style: motionInlineStyles,
|
|
...otherMotionProps
|
|
} = (0,react.useMemo)(() => (0,utils/* placementToMotionAnimationProps */.Vn)(computedPlacement), [computedPlacement]);
|
|
const animationProps = shouldAnimate ? {
|
|
style: {
|
|
...contentStyle,
|
|
...motionInlineStyles,
|
|
...style
|
|
},
|
|
onAnimationComplete: () => setAnimationFinished(true),
|
|
...otherMotionProps
|
|
} : {
|
|
animate: false,
|
|
style: {
|
|
...contentStyle,
|
|
...style
|
|
}
|
|
};
|
|
|
|
// When Floating UI has finished positioning and Framer Motion has finished animating
|
|
// the popover, add the `is-positioned` class to signal that all transitions have finished.
|
|
const isPositioned = (!shouldAnimate || animationFinished) && x !== null && y !== null;
|
|
let content = /*#__PURE__*/(0,jsx_runtime.jsxs)(motion/* motion */.P.div, {
|
|
className: (0,clsx/* default */.A)(className, {
|
|
'is-expanded': isExpanded,
|
|
'is-positioned': isPositioned,
|
|
// Use the 'alternate' classname for 'toolbar' variant for back compat.
|
|
[`is-${computedVariant === 'toolbar' ? 'alternate' : computedVariant}`]: computedVariant
|
|
}),
|
|
...animationProps,
|
|
...contentProps,
|
|
ref: mergedFloatingRef,
|
|
...dialogProps,
|
|
tabIndex: -1,
|
|
children: [isExpanded && /*#__PURE__*/(0,jsx_runtime.jsx)(scroll_lock, {}), isExpanded && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: "components-popover__header",
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: "components-popover__header-title",
|
|
children: headerTitle
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(build_module_button/* default */.Ay, {
|
|
className: "components-popover__close",
|
|
icon: library_close/* default */.A,
|
|
onClick: onClose
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: "components-popover__content",
|
|
children: children
|
|
}), hasArrow && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
ref: arrowCallbackRef,
|
|
className: ['components-popover__arrow', `is-${computedPlacement.split('-')[0]}`].join(' '),
|
|
style: {
|
|
left: typeof arrowData?.x !== 'undefined' && Number.isFinite(arrowData.x) ? `${arrowData.x}px` : '',
|
|
top: typeof arrowData?.y !== 'undefined' && Number.isFinite(arrowData.y) ? `${arrowData.y}px` : ''
|
|
},
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(ArrowTriangle, {})
|
|
})]
|
|
});
|
|
const shouldRenderWithinSlot = slot.ref && !inline;
|
|
const hasAnchor = anchorRef || anchorRect || anchor;
|
|
if (shouldRenderWithinSlot) {
|
|
content = /*#__PURE__*/(0,jsx_runtime.jsx)(slot_fill/* Fill */.SQ, {
|
|
name: slotName,
|
|
children: content
|
|
});
|
|
} else if (!inline) {
|
|
content = (0,react_dom.createPortal)( /*#__PURE__*/(0,jsx_runtime.jsx)(style_provider/* StyleProvider */.N, {
|
|
document: document,
|
|
children: content
|
|
}), getPopoverFallbackContainer());
|
|
}
|
|
if (hasAnchor) {
|
|
return content;
|
|
}
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
ref: anchorRefFallback
|
|
}), content]
|
|
});
|
|
};
|
|
|
|
/**
|
|
* `Popover` renders its content in a floating modal. If no explicit anchor is passed via props, it anchors to its parent element by default.
|
|
*
|
|
* ```jsx
|
|
* import { Button, Popover } from '@wordpress/components';
|
|
* import { useState } from '@wordpress/element';
|
|
*
|
|
* const MyPopover = () => {
|
|
* const [ isVisible, setIsVisible ] = useState( false );
|
|
* const toggleVisible = () => {
|
|
* setIsVisible( ( state ) => ! state );
|
|
* };
|
|
*
|
|
* return (
|
|
* <Button variant="secondary" onClick={ toggleVisible }>
|
|
* Toggle Popover!
|
|
* { isVisible && <Popover>Popover is toggled!</Popover> }
|
|
* </Button>
|
|
* );
|
|
* };
|
|
* ```
|
|
*
|
|
*/
|
|
const Popover = (0,context_connect/* contextConnect */.KZ)(UnforwardedPopover, 'Popover');
|
|
function PopoverSlot({
|
|
name = SLOT_NAME
|
|
}, ref) {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(slot_fill/* Slot */.DX, {
|
|
bubblesVirtually: true,
|
|
name: name,
|
|
className: "popover-slot",
|
|
ref: ref
|
|
});
|
|
}
|
|
|
|
// @ts-expect-error For Legacy Reasons
|
|
Popover.Slot = (0,react.forwardRef)(PopoverSlot);
|
|
// @ts-expect-error For Legacy Reasons
|
|
Popover.__unstableSlotNameProvider = slotNameContext.Provider;
|
|
/* harmony default export */ const popover = (Popover);
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/popover/utils.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ Vn: () => (/* binding */ placementToMotionAnimationProps),
|
|
/* harmony export */ WS: () => (/* binding */ computePopoverPosition),
|
|
/* harmony export */ YK: () => (/* binding */ positionToPlacement),
|
|
/* harmony export */ _G: () => (/* binding */ getReferenceElement)
|
|
/* harmony export */ });
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
const POSITION_TO_PLACEMENT = {
|
|
bottom: 'bottom',
|
|
top: 'top',
|
|
'middle left': 'left',
|
|
'middle right': 'right',
|
|
'bottom left': 'bottom-end',
|
|
'bottom center': 'bottom',
|
|
'bottom right': 'bottom-start',
|
|
'top left': 'top-end',
|
|
'top center': 'top',
|
|
'top right': 'top-start',
|
|
'middle left left': 'left',
|
|
'middle left right': 'left',
|
|
'middle left bottom': 'left-end',
|
|
'middle left top': 'left-start',
|
|
'middle right left': 'right',
|
|
'middle right right': 'right',
|
|
'middle right bottom': 'right-end',
|
|
'middle right top': 'right-start',
|
|
'bottom left left': 'bottom-end',
|
|
'bottom left right': 'bottom-end',
|
|
'bottom left bottom': 'bottom-end',
|
|
'bottom left top': 'bottom-end',
|
|
'bottom center left': 'bottom',
|
|
'bottom center right': 'bottom',
|
|
'bottom center bottom': 'bottom',
|
|
'bottom center top': 'bottom',
|
|
'bottom right left': 'bottom-start',
|
|
'bottom right right': 'bottom-start',
|
|
'bottom right bottom': 'bottom-start',
|
|
'bottom right top': 'bottom-start',
|
|
'top left left': 'top-end',
|
|
'top left right': 'top-end',
|
|
'top left bottom': 'top-end',
|
|
'top left top': 'top-end',
|
|
'top center left': 'top',
|
|
'top center right': 'top',
|
|
'top center bottom': 'top',
|
|
'top center top': 'top',
|
|
'top right left': 'top-start',
|
|
'top right right': 'top-start',
|
|
'top right bottom': 'top-start',
|
|
'top right top': 'top-start',
|
|
// `middle`/`middle center [corner?]` positions are associated to a fallback
|
|
// `bottom` placement because there aren't any corresponding placement values.
|
|
middle: 'bottom',
|
|
'middle center': 'bottom',
|
|
'middle center bottom': 'bottom',
|
|
'middle center left': 'bottom',
|
|
'middle center right': 'bottom',
|
|
'middle center top': 'bottom'
|
|
};
|
|
|
|
/**
|
|
* Converts the `Popover`'s legacy "position" prop to the new "placement" prop
|
|
* (used by `floating-ui`).
|
|
*
|
|
* @param position The legacy position
|
|
* @return The corresponding placement
|
|
*/
|
|
const positionToPlacement = position => {
|
|
var _POSITION_TO_PLACEMEN;
|
|
return (_POSITION_TO_PLACEMEN = POSITION_TO_PLACEMENT[position]) !== null && _POSITION_TO_PLACEMEN !== void 0 ? _POSITION_TO_PLACEMEN : 'bottom';
|
|
};
|
|
|
|
/**
|
|
* @typedef AnimationOrigin
|
|
* @type {Object}
|
|
* @property {number} originX A number between 0 and 1 (in CSS logical properties jargon, 0 is "start", 0.5 is "center", and 1 is "end")
|
|
* @property {number} originY A number between 0 and 1 (0 is top, 0.5 is center, and 1 is bottom)
|
|
*/
|
|
|
|
const PLACEMENT_TO_ANIMATION_ORIGIN = {
|
|
top: {
|
|
originX: 0.5,
|
|
originY: 1
|
|
},
|
|
// open from bottom, center
|
|
'top-start': {
|
|
originX: 0,
|
|
originY: 1
|
|
},
|
|
// open from bottom, left
|
|
'top-end': {
|
|
originX: 1,
|
|
originY: 1
|
|
},
|
|
// open from bottom, right
|
|
right: {
|
|
originX: 0,
|
|
originY: 0.5
|
|
},
|
|
// open from middle, left
|
|
'right-start': {
|
|
originX: 0,
|
|
originY: 0
|
|
},
|
|
// open from top, left
|
|
'right-end': {
|
|
originX: 0,
|
|
originY: 1
|
|
},
|
|
// open from bottom, left
|
|
bottom: {
|
|
originX: 0.5,
|
|
originY: 0
|
|
},
|
|
// open from top, center
|
|
'bottom-start': {
|
|
originX: 0,
|
|
originY: 0
|
|
},
|
|
// open from top, left
|
|
'bottom-end': {
|
|
originX: 1,
|
|
originY: 0
|
|
},
|
|
// open from top, right
|
|
left: {
|
|
originX: 1,
|
|
originY: 0.5
|
|
},
|
|
// open from middle, right
|
|
'left-start': {
|
|
originX: 1,
|
|
originY: 0
|
|
},
|
|
// open from top, right
|
|
'left-end': {
|
|
originX: 1,
|
|
originY: 1
|
|
},
|
|
// open from bottom, right
|
|
overlay: {
|
|
originX: 0.5,
|
|
originY: 0.5
|
|
} // open from center, center
|
|
};
|
|
|
|
/**
|
|
* Given the floating-ui `placement`, compute the framer-motion props for the
|
|
* popover's entry animation.
|
|
*
|
|
* @param placement A placement string from floating ui
|
|
* @return The object containing the motion props
|
|
*/
|
|
const placementToMotionAnimationProps = placement => {
|
|
const translateProp = placement.startsWith('top') || placement.startsWith('bottom') ? 'translateY' : 'translateX';
|
|
const translateDirection = placement.startsWith('top') || placement.startsWith('left') ? 1 : -1;
|
|
return {
|
|
style: PLACEMENT_TO_ANIMATION_ORIGIN[placement],
|
|
initial: {
|
|
opacity: 0,
|
|
scale: 0,
|
|
[translateProp]: `${2 * translateDirection}em`
|
|
},
|
|
animate: {
|
|
opacity: 1,
|
|
scale: 1,
|
|
[translateProp]: 0
|
|
},
|
|
transition: {
|
|
duration: 0.1,
|
|
ease: [0, 0, 0.2, 1]
|
|
}
|
|
};
|
|
};
|
|
function isTopBottom(anchorRef) {
|
|
return !!anchorRef?.top;
|
|
}
|
|
function isRef(anchorRef) {
|
|
return !!anchorRef?.current;
|
|
}
|
|
const getReferenceElement = ({
|
|
anchor,
|
|
anchorRef,
|
|
anchorRect,
|
|
getAnchorRect,
|
|
fallbackReferenceElement
|
|
}) => {
|
|
var _referenceElement;
|
|
let referenceElement = null;
|
|
if (anchor) {
|
|
referenceElement = anchor;
|
|
} else if (isTopBottom(anchorRef)) {
|
|
// Create a virtual element for the ref. The expectation is that
|
|
// if anchorRef.top is defined, then anchorRef.bottom is defined too.
|
|
// Seems to be used by the block toolbar, when multiple blocks are selected
|
|
// (top and bottom blocks are used to calculate the resulting rect).
|
|
referenceElement = {
|
|
getBoundingClientRect() {
|
|
const topRect = anchorRef.top.getBoundingClientRect();
|
|
const bottomRect = anchorRef.bottom.getBoundingClientRect();
|
|
return new window.DOMRect(topRect.x, topRect.y, topRect.width, bottomRect.bottom - topRect.top);
|
|
}
|
|
};
|
|
} else if (isRef(anchorRef)) {
|
|
// Standard React ref.
|
|
referenceElement = anchorRef.current;
|
|
} else if (anchorRef) {
|
|
// If `anchorRef` holds directly the element's value (no `current` key)
|
|
// This is a weird scenario and should be deprecated.
|
|
referenceElement = anchorRef;
|
|
} else if (anchorRect) {
|
|
// Create a virtual element for the ref.
|
|
referenceElement = {
|
|
getBoundingClientRect() {
|
|
return anchorRect;
|
|
}
|
|
};
|
|
} else if (getAnchorRect) {
|
|
// Create a virtual element for the ref.
|
|
referenceElement = {
|
|
getBoundingClientRect() {
|
|
var _rect$x, _rect$y, _rect$width, _rect$height;
|
|
const rect = getAnchorRect(fallbackReferenceElement);
|
|
return new window.DOMRect((_rect$x = rect.x) !== null && _rect$x !== void 0 ? _rect$x : rect.left, (_rect$y = rect.y) !== null && _rect$y !== void 0 ? _rect$y : rect.top, (_rect$width = rect.width) !== null && _rect$width !== void 0 ? _rect$width : rect.right - rect.left, (_rect$height = rect.height) !== null && _rect$height !== void 0 ? _rect$height : rect.bottom - rect.top);
|
|
}
|
|
};
|
|
} else if (fallbackReferenceElement) {
|
|
// If no explicit ref is passed via props, fall back to
|
|
// anchoring to the popover's parent node.
|
|
referenceElement = fallbackReferenceElement.parentElement;
|
|
}
|
|
|
|
// Convert any `undefined` value to `null`.
|
|
return (_referenceElement = referenceElement) !== null && _referenceElement !== void 0 ? _referenceElement : null;
|
|
};
|
|
|
|
/**
|
|
* Computes the final coordinate that needs to be applied to the floating
|
|
* element when applying transform inline styles, defaulting to `undefined`
|
|
* if the provided value is `null` or `NaN`.
|
|
*
|
|
* @param c input coordinate (usually as returned from floating-ui)
|
|
* @return The coordinate's value to be used for inline styles. An `undefined`
|
|
* return value means "no style set" for this coordinate.
|
|
*/
|
|
const computePopoverPosition = c => c === null || Number.isNaN(c) ? undefined : Math.round(c);
|
|
//# sourceMappingURL=utils.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/select-control/index.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
A: () => (/* binding */ select_control)
|
|
});
|
|
|
|
// UNUSED EXPORTS: SelectControl
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
var clsx = __webpack_require__("../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-instance-id/index.js
|
|
var use_instance_id = __webpack_require__("../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-instance-id/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js
|
|
var react = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/base-control/index.js
|
|
var base_control = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/base-control/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@emotion+styled@11.11.0_@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2__@types+react@17.0.71_react@17.0.2/node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js
|
|
var emotion_styled_base_browser_esm = __webpack_require__("../../node_modules/.pnpm/@emotion+styled@11.11.0_@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2__@types+react@17.0.71_react@17.0.2/node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2/node_modules/@emotion/react/dist/emotion-react.browser.esm.js
|
|
var emotion_react_browser_esm = __webpack_require__("../../node_modules/.pnpm/@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2/node_modules/@emotion/react/dist/emotion-react.browser.esm.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/colors-values.js
|
|
var colors_values = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/colors-values.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/config-values.js
|
|
var config_values = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/config-values.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/rtl.js
|
|
var rtl = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/rtl.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/space.js
|
|
var space = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/space.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js + 1 modules
|
|
var use_context_system = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-connect.js
|
|
var context_connect = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-connect.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/styles/input-control-styles.js
|
|
var input_control_styles = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/styles/input-control-styles.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/input-suffix-wrapper.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
function UnconnectedInputControlSuffixWrapper(props, forwardedRef) {
|
|
const derivedProps = (0,use_context_system/* useContextSystem */.A)(props, 'InputControlSuffixWrapper');
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(input_control_styles/* PrefixSuffixWrapper */.bC, {
|
|
...derivedProps,
|
|
ref: forwardedRef
|
|
});
|
|
}
|
|
|
|
/**
|
|
* A convenience wrapper for the `suffix` when you want to apply
|
|
* standard padding in accordance with the size variant.
|
|
*
|
|
* ```jsx
|
|
* import {
|
|
* __experimentalInputControl as InputControl,
|
|
* __experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,
|
|
* } from '@wordpress/components';
|
|
*
|
|
* <InputControl
|
|
* suffix={<InputControlSuffixWrapper>%</InputControlSuffixWrapper>}
|
|
* />
|
|
* ```
|
|
*/
|
|
const InputControlSuffixWrapper = (0,context_connect/* contextConnect */.KZ)(UnconnectedInputControlSuffixWrapper, 'InputControlSuffixWrapper');
|
|
/* harmony default export */ const input_suffix_wrapper = (InputControlSuffixWrapper);
|
|
//# sourceMappingURL=input-suffix-wrapper.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/input-base.js + 2 modules
|
|
var input_base = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/input-base.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/select-control/styles/select-control-styles.js
|
|
|
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
const disabledStyles = ({
|
|
disabled
|
|
}) => {
|
|
if (!disabled) {
|
|
return '';
|
|
}
|
|
return /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)("color:", colors_values/* COLORS */.l.ui.textDisabled, ";cursor:default;" + ( true ? "" : 0), true ? "" : 0);
|
|
};
|
|
var _ref2 = true ? {
|
|
name: "1lv1yo7",
|
|
styles: "display:inline-flex"
|
|
} : 0;
|
|
const inputBaseVariantStyles = ({
|
|
variant
|
|
}) => {
|
|
if (variant === 'minimal') {
|
|
return _ref2;
|
|
}
|
|
return '';
|
|
};
|
|
const StyledInputBase = /*#__PURE__*/(0,emotion_styled_base_browser_esm/* default */.A)(input_base/* default */.A, true ? {
|
|
target: "e1mv6sxx3"
|
|
} : 0)("color:", colors_values/* COLORS */.l.theme.foreground, ";cursor:pointer;", disabledStyles, " ", inputBaseVariantStyles, ";" + ( true ? "" : 0));
|
|
const sizeStyles = ({
|
|
__next40pxDefaultSize,
|
|
multiple,
|
|
selectSize = 'default'
|
|
}) => {
|
|
if (multiple) {
|
|
// When `multiple`, just use the native browser styles
|
|
// without setting explicit height.
|
|
return;
|
|
}
|
|
const sizes = {
|
|
default: {
|
|
height: 40,
|
|
minHeight: 40,
|
|
paddingTop: 0,
|
|
paddingBottom: 0
|
|
},
|
|
small: {
|
|
height: 24,
|
|
minHeight: 24,
|
|
paddingTop: 0,
|
|
paddingBottom: 0
|
|
},
|
|
compact: {
|
|
height: 32,
|
|
minHeight: 32,
|
|
paddingTop: 0,
|
|
paddingBottom: 0
|
|
},
|
|
'__unstable-large': {
|
|
height: 40,
|
|
minHeight: 40,
|
|
paddingTop: 0,
|
|
paddingBottom: 0
|
|
}
|
|
};
|
|
if (!__next40pxDefaultSize) {
|
|
sizes.default = sizes.compact;
|
|
}
|
|
const style = sizes[selectSize] || sizes.default;
|
|
return /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)(style, true ? "" : 0, true ? "" : 0);
|
|
};
|
|
const chevronIconSize = 18;
|
|
const sizePaddings = ({
|
|
__next40pxDefaultSize,
|
|
multiple,
|
|
selectSize = 'default'
|
|
}) => {
|
|
const padding = {
|
|
default: config_values/* default */.A.controlPaddingX,
|
|
small: config_values/* default */.A.controlPaddingXSmall,
|
|
compact: config_values/* default */.A.controlPaddingXSmall,
|
|
'__unstable-large': config_values/* default */.A.controlPaddingX
|
|
};
|
|
if (!__next40pxDefaultSize) {
|
|
padding.default = padding.compact;
|
|
}
|
|
const selectedPadding = padding[selectSize] || padding.default;
|
|
return (0,rtl/* rtl */.h)({
|
|
paddingLeft: selectedPadding,
|
|
paddingRight: selectedPadding + chevronIconSize,
|
|
...(multiple ? {
|
|
paddingTop: selectedPadding,
|
|
paddingBottom: selectedPadding
|
|
} : {})
|
|
});
|
|
};
|
|
const overflowStyles = ({
|
|
multiple
|
|
}) => {
|
|
return {
|
|
overflow: multiple ? 'auto' : 'hidden'
|
|
};
|
|
};
|
|
var _ref = true ? {
|
|
name: "n1jncc",
|
|
styles: "field-sizing:content"
|
|
} : 0;
|
|
const variantStyles = ({
|
|
variant
|
|
}) => {
|
|
if (variant === 'minimal') {
|
|
return _ref;
|
|
}
|
|
return '';
|
|
};
|
|
|
|
// TODO: Resolve need to use &&& to increase specificity
|
|
// https://github.com/WordPress/gutenberg/issues/18483
|
|
|
|
const Select = /*#__PURE__*/(0,emotion_styled_base_browser_esm/* default */.A)("select", true ? {
|
|
target: "e1mv6sxx2"
|
|
} : 0)("&&&{appearance:none;background:transparent;box-sizing:border-box;border:none;box-shadow:none!important;color:currentColor;cursor:inherit;display:block;font-family:inherit;margin:0;width:100%;max-width:none;white-space:nowrap;text-overflow:ellipsis;", input_control_styles/* fontSizeStyles */.TA, ";", sizeStyles, ";", sizePaddings, ";", overflowStyles, " ", variantStyles, ";}" + ( true ? "" : 0));
|
|
const DownArrowWrapper = /*#__PURE__*/(0,emotion_styled_base_browser_esm/* default */.A)("div", true ? {
|
|
target: "e1mv6sxx1"
|
|
} : 0)("margin-inline-end:", (0,space/* space */.x)(-1), ";line-height:0;path{fill:currentColor;}" + ( true ? "" : 0));
|
|
const InputControlSuffixWrapperWithClickThrough = /*#__PURE__*/(0,emotion_styled_base_browser_esm/* default */.A)(input_suffix_wrapper, true ? {
|
|
target: "e1mv6sxx0"
|
|
} : 0)("position:absolute;pointer-events:none;", (0,rtl/* rtl */.h)({
|
|
right: 0
|
|
}), ";" + ( true ? "" : 0));
|
|
//# sourceMappingURL=select-control-styles.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+icons@10.7.0_react@17.0.2/node_modules/@wordpress/icons/build-module/icon/index.js
|
|
var icon = __webpack_require__("../../node_modules/.pnpm/@wordpress+icons@10.7.0_react@17.0.2/node_modules/@wordpress/icons/build-module/icon/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+icons@10.7.0_react@17.0.2/node_modules/@wordpress/icons/build-module/library/chevron-down.js
|
|
var chevron_down = __webpack_require__("../../node_modules/.pnpm/@wordpress+icons@10.7.0_react@17.0.2/node_modules/@wordpress/icons/build-module/library/chevron-down.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/select-control/chevron-down.js
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
const SelectControlChevronDown = () => {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(InputControlSuffixWrapperWithClickThrough, {
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(DownArrowWrapper, {
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(icon/* default */.A, {
|
|
icon: chevron_down/* default */.A,
|
|
size: chevronIconSize
|
|
})
|
|
})
|
|
});
|
|
};
|
|
/* harmony default export */ const select_control_chevron_down = (SelectControlChevronDown);
|
|
//# sourceMappingURL=chevron-down.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/use-deprecated-props.js
|
|
var use_deprecated_props = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/use-deprecated-props.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/select-control/index.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
function useUniqueId(idProp) {
|
|
const instanceId = (0,use_instance_id/* default */.A)(SelectControl);
|
|
const id = `inspector-select-control-${instanceId}`;
|
|
return idProp || id;
|
|
}
|
|
function SelectOptions({
|
|
options
|
|
}) {
|
|
return options.map(({
|
|
id,
|
|
label,
|
|
value,
|
|
...optionProps
|
|
}, index) => {
|
|
const key = id || `${label}-${value}-${index}`;
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("option", {
|
|
value: value,
|
|
...optionProps,
|
|
children: label
|
|
}, key);
|
|
});
|
|
}
|
|
function UnforwardedSelectControl(props, ref) {
|
|
const {
|
|
className,
|
|
disabled = false,
|
|
help,
|
|
hideLabelFromVision,
|
|
id: idProp,
|
|
label,
|
|
multiple = false,
|
|
onChange,
|
|
options = [],
|
|
size = 'default',
|
|
value: valueProp,
|
|
labelPosition = 'top',
|
|
children,
|
|
prefix,
|
|
suffix,
|
|
variant = 'default',
|
|
__next40pxDefaultSize = false,
|
|
__nextHasNoMarginBottom = false,
|
|
...restProps
|
|
} = (0,use_deprecated_props/* useDeprecated36pxDefaultSizeProp */.R)(props);
|
|
const id = useUniqueId(idProp);
|
|
const helpId = help ? `${id}__help` : undefined;
|
|
|
|
// Disable reason: A select with an onchange throws a warning.
|
|
if (!options?.length && !children) {
|
|
return null;
|
|
}
|
|
const handleOnChange = event => {
|
|
if (props.multiple) {
|
|
const selectedOptions = Array.from(event.target.options).filter(({
|
|
selected
|
|
}) => selected);
|
|
const newValues = selectedOptions.map(({
|
|
value
|
|
}) => value);
|
|
props.onChange?.(newValues, {
|
|
event
|
|
});
|
|
return;
|
|
}
|
|
props.onChange?.(event.target.value, {
|
|
event
|
|
});
|
|
};
|
|
const classes = (0,clsx/* default */.A)('components-select-control', className);
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(base_control/* default */.Ay, {
|
|
help: help,
|
|
id: id,
|
|
__nextHasNoMarginBottom: __nextHasNoMarginBottom,
|
|
__associatedWPComponentName: "SelectControl",
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(StyledInputBase, {
|
|
className: classes,
|
|
disabled: disabled,
|
|
hideLabelFromVision: hideLabelFromVision,
|
|
id: id,
|
|
isBorderless: variant === 'minimal',
|
|
label: label,
|
|
size: size,
|
|
suffix: suffix || !multiple && /*#__PURE__*/(0,jsx_runtime.jsx)(select_control_chevron_down, {}),
|
|
prefix: prefix,
|
|
labelPosition: labelPosition,
|
|
__unstableInputWidth: variant === 'minimal' ? 'auto' : undefined,
|
|
variant: variant,
|
|
__next40pxDefaultSize: __next40pxDefaultSize,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(Select, {
|
|
...restProps,
|
|
__next40pxDefaultSize: __next40pxDefaultSize,
|
|
"aria-describedby": helpId,
|
|
className: "components-select-control__input",
|
|
disabled: disabled,
|
|
id: id,
|
|
multiple: multiple,
|
|
onChange: handleOnChange,
|
|
ref: ref,
|
|
selectSize: size,
|
|
value: valueProp,
|
|
variant: variant,
|
|
children: children || /*#__PURE__*/(0,jsx_runtime.jsx)(SelectOptions, {
|
|
options: options
|
|
})
|
|
})
|
|
})
|
|
});
|
|
}
|
|
|
|
/**
|
|
* `SelectControl` allows users to select from a single or multiple option menu.
|
|
* It functions as a wrapper around the browser's native `<select>` element.
|
|
*
|
|
* ```jsx
|
|
* import { SelectControl } from '@wordpress/components';
|
|
* import { useState } from '@wordpress/element';
|
|
*
|
|
* const MySelectControl = () => {
|
|
* const [ size, setSize ] = useState( '50%' );
|
|
*
|
|
* return (
|
|
* <SelectControl
|
|
* __nextHasNoMarginBottom
|
|
* label="Size"
|
|
* value={ size }
|
|
* options={ [
|
|
* { label: 'Big', value: '100%' },
|
|
* { label: 'Medium', value: '50%' },
|
|
* { label: 'Small', value: '25%' },
|
|
* ] }
|
|
* onChange={ setSize }
|
|
* />
|
|
* );
|
|
* };
|
|
* ```
|
|
*/
|
|
const SelectControl = (0,react.forwardRef)(UnforwardedSelectControl);
|
|
/* harmony default export */ const select_control = (SelectControl);
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/slot-fill-context.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
A: () => (/* binding */ slot_fill_context)
|
|
});
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js
|
|
var react = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+warning@3.7.0/node_modules/@wordpress/warning/build-module/index.js + 1 modules
|
|
var build_module = __webpack_require__("../../node_modules/.pnpm/@wordpress+warning@3.7.0/node_modules/@wordpress/warning/build-module/index.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/utils/observable-map/index.js
|
|
/**
|
|
* A constructor (factory) for `ObservableMap`, a map-like key/value data structure
|
|
* where the individual entries are observable: using the `subscribe` method, you can
|
|
* subscribe to updates for a particular keys. Each subscriber always observes one
|
|
* specific key and is not notified about any unrelated changes (for different keys)
|
|
* in the `ObservableMap`.
|
|
*
|
|
* @template K The type of the keys in the map.
|
|
* @template V The type of the values in the map.
|
|
* @return A new instance of the `ObservableMap` type.
|
|
*/
|
|
function observableMap() {
|
|
const map = new Map();
|
|
const listeners = new Map();
|
|
function callListeners(name) {
|
|
const list = listeners.get(name);
|
|
if (!list) {
|
|
return;
|
|
}
|
|
for (const listener of list) {
|
|
listener();
|
|
}
|
|
}
|
|
return {
|
|
get(name) {
|
|
return map.get(name);
|
|
},
|
|
set(name, value) {
|
|
map.set(name, value);
|
|
callListeners(name);
|
|
},
|
|
delete(name) {
|
|
map.delete(name);
|
|
callListeners(name);
|
|
},
|
|
subscribe(name, listener) {
|
|
let list = listeners.get(name);
|
|
if (!list) {
|
|
list = new Set();
|
|
listeners.set(name, list);
|
|
}
|
|
list.add(listener);
|
|
return () => {
|
|
list.delete(listener);
|
|
if (list.size === 0) {
|
|
listeners.delete(name);
|
|
}
|
|
};
|
|
}
|
|
};
|
|
}
|
|
//# sourceMappingURL=index.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/slot-fill-context.js
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
const initialContextValue = {
|
|
slots: observableMap(),
|
|
fills: observableMap(),
|
|
registerSlot: () => {
|
|
globalThis.SCRIPT_DEBUG === true ? (0,build_module/* default */.A)('Components must be wrapped within `SlotFillProvider`. ' + 'See https://developer.wordpress.org/block-editor/components/slot-fill/') : void 0;
|
|
},
|
|
updateSlot: () => {},
|
|
unregisterSlot: () => {},
|
|
registerFill: () => {},
|
|
unregisterFill: () => {},
|
|
// This helps the provider know if it's using the default context value or not.
|
|
isDefault: true
|
|
};
|
|
const SlotFillContext = (0,react.createContext)(initialContextValue);
|
|
/* harmony default export */ const slot_fill_context = (SlotFillContext);
|
|
//# sourceMappingURL=slot-fill-context.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/use-slot.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
A: () => (/* binding */ useSlot)
|
|
});
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js
|
|
var react = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-observable-value/index.js
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
/**
|
|
* React hook that lets you observe an entry in an `ObservableMap`. The hook returns the
|
|
* current value corresponding to the key, or `undefined` when there is no value stored.
|
|
* It also observes changes to the value and triggers an update of the calling component
|
|
* in case the value changes.
|
|
*
|
|
* @template K The type of the keys in the map.
|
|
* @template V The type of the values in the map.
|
|
* @param map The `ObservableMap` to observe.
|
|
* @param name The map key to observe.
|
|
* @return The value corresponding to the map key requested.
|
|
*/
|
|
function useObservableValue(map, name) {
|
|
const [subscribe, getValue] = (0,react.useMemo)(() => [listener => map.subscribe(name, listener), () => map.get(name)], [map, name]);
|
|
return (0,react.useSyncExternalStore)(subscribe, getValue, getValue);
|
|
}
|
|
//# sourceMappingURL=index.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/slot-fill-context.js + 1 modules
|
|
var slot_fill_context = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/slot-fill-context.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/use-slot.js
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
function useSlot(name) {
|
|
const registry = (0,react.useContext)(slot_fill_context/* default */.A);
|
|
const slot = useObservableValue(registry.slots, name);
|
|
const api = (0,react.useMemo)(() => ({
|
|
updateSlot: fillProps => registry.updateSlot(name, fillProps),
|
|
unregisterSlot: ref => registry.unregisterSlot(name, ref),
|
|
registerFill: ref => registry.registerFill(name, ref),
|
|
unregisterFill: ref => registry.unregisterFill(name, ref)
|
|
}), [name, registry]);
|
|
return {
|
|
...slot,
|
|
...api
|
|
};
|
|
}
|
|
//# sourceMappingURL=use-slot.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/slot-fill/index.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
SQ: () => (/* binding */ slot_fill_Fill),
|
|
DX: () => (/* binding */ slot_fill_Slot),
|
|
VI: () => (/* binding */ createPrivateSlotFill)
|
|
});
|
|
|
|
// UNUSED EXPORTS: Provider, UnforwardedSlot, createSlotFill, useSlot, useSlotFills
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js
|
|
var react = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/slot-fill/context.js
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
const initialValue = {
|
|
registerSlot: () => {},
|
|
unregisterSlot: () => {},
|
|
registerFill: () => {},
|
|
unregisterFill: () => {},
|
|
getSlot: () => undefined,
|
|
getFills: () => [],
|
|
subscribe: () => () => {}
|
|
};
|
|
const context_SlotFillContext = (0,react.createContext)(initialValue);
|
|
/* harmony default export */ const context = (context_SlotFillContext);
|
|
//# sourceMappingURL=context.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/slot-fill/use-slot.js
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
/**
|
|
* React hook returning the active slot given a name.
|
|
*
|
|
* @param name Slot name.
|
|
* @return Slot object.
|
|
*/
|
|
const useSlot = name => {
|
|
const {
|
|
getSlot,
|
|
subscribe
|
|
} = (0,react.useContext)(context);
|
|
return (0,react.useSyncExternalStore)(subscribe, () => getSlot(name), () => getSlot(name));
|
|
};
|
|
/* harmony default export */ const use_slot = (useSlot);
|
|
//# sourceMappingURL=use-slot.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/slot-fill/fill.js
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
function Fill({
|
|
name,
|
|
children
|
|
}) {
|
|
const {
|
|
registerFill,
|
|
unregisterFill
|
|
} = (0,react.useContext)(context);
|
|
const slot = use_slot(name);
|
|
const ref = (0,react.useRef)({
|
|
name,
|
|
children
|
|
});
|
|
(0,react.useLayoutEffect)(() => {
|
|
const refValue = ref.current;
|
|
registerFill(name, refValue);
|
|
return () => unregisterFill(name, refValue);
|
|
// Ignore reason: the useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.
|
|
// We'll leave them as-is until a more detailed investigation/refactor can be performed.
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
}, []);
|
|
(0,react.useLayoutEffect)(() => {
|
|
ref.current.children = children;
|
|
if (slot) {
|
|
slot.forceUpdate();
|
|
}
|
|
// Ignore reason: the useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.
|
|
// We'll leave them as-is until a more detailed investigation/refactor can be performed.
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
}, [children]);
|
|
(0,react.useLayoutEffect)(() => {
|
|
if (name === ref.current.name) {
|
|
// Ignore initial effect.
|
|
return;
|
|
}
|
|
unregisterFill(ref.current.name, ref.current);
|
|
ref.current.name = name;
|
|
registerFill(name, ref.current);
|
|
// Ignore reason: the useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.
|
|
// We'll leave them as-is until a more detailed investigation/refactor can be performed.
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
}, [name]);
|
|
return null;
|
|
}
|
|
//# sourceMappingURL=fill.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+element@6.7.0/node_modules/@wordpress/element/build-module/utils.js
|
|
/**
|
|
* Checks if the provided WP element is empty.
|
|
*
|
|
* @param {*} element WP element to check.
|
|
* @return {boolean} True when an element is considered empty.
|
|
*/
|
|
const isEmptyElement = element => {
|
|
if (typeof element === 'number') {
|
|
return false;
|
|
}
|
|
if (typeof element?.valueOf() === 'string' || Array.isArray(element)) {
|
|
return !element.length;
|
|
}
|
|
return !element;
|
|
};
|
|
//# sourceMappingURL=utils.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/slot-fill/slot.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Whether the argument is a function.
|
|
*
|
|
* @param maybeFunc The argument to check.
|
|
* @return True if the argument is a function, false otherwise.
|
|
*/
|
|
function isFunction(maybeFunc) {
|
|
return typeof maybeFunc === 'function';
|
|
}
|
|
class SlotComponent extends react.Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.isUnmounted = false;
|
|
}
|
|
componentDidMount() {
|
|
const {
|
|
registerSlot
|
|
} = this.props;
|
|
this.isUnmounted = false;
|
|
registerSlot(this.props.name, this);
|
|
}
|
|
componentWillUnmount() {
|
|
const {
|
|
unregisterSlot
|
|
} = this.props;
|
|
this.isUnmounted = true;
|
|
unregisterSlot(this.props.name, this);
|
|
}
|
|
componentDidUpdate(prevProps) {
|
|
const {
|
|
name,
|
|
unregisterSlot,
|
|
registerSlot
|
|
} = this.props;
|
|
if (prevProps.name !== name) {
|
|
unregisterSlot(prevProps.name, this);
|
|
registerSlot(name, this);
|
|
}
|
|
}
|
|
forceUpdate() {
|
|
if (this.isUnmounted) {
|
|
return;
|
|
}
|
|
super.forceUpdate();
|
|
}
|
|
render() {
|
|
var _getFills;
|
|
const {
|
|
children,
|
|
name,
|
|
fillProps = {},
|
|
getFills
|
|
} = this.props;
|
|
const fills = ((_getFills = getFills(name, this)) !== null && _getFills !== void 0 ? _getFills : []).map(fill => {
|
|
const fillChildren = isFunction(fill.children) ? fill.children(fillProps) : fill.children;
|
|
return react.Children.map(fillChildren, (child, childIndex) => {
|
|
if (!child || typeof child === 'string') {
|
|
return child;
|
|
}
|
|
let childKey = childIndex;
|
|
if (typeof child === 'object' && 'key' in child && child?.key) {
|
|
childKey = child.key;
|
|
}
|
|
return (0,react.cloneElement)(child, {
|
|
key: childKey
|
|
});
|
|
});
|
|
}).filter(
|
|
// In some cases fills are rendered only when some conditions apply.
|
|
// This ensures that we only use non-empty fills when rendering, i.e.,
|
|
// it allows us to render wrappers only when the fills are actually present.
|
|
element => !isEmptyElement(element));
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
children: isFunction(children) ? children(fills) : fills
|
|
});
|
|
}
|
|
}
|
|
const Slot = props => /*#__PURE__*/(0,jsx_runtime.jsx)(context.Consumer, {
|
|
children: ({
|
|
registerSlot,
|
|
unregisterSlot,
|
|
getFills
|
|
}) => /*#__PURE__*/(0,jsx_runtime.jsx)(SlotComponent, {
|
|
...props,
|
|
registerSlot: registerSlot,
|
|
unregisterSlot: unregisterSlot,
|
|
getFills: getFills
|
|
})
|
|
});
|
|
/* harmony default export */ const slot = (Slot);
|
|
//# sourceMappingURL=slot.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/index.js
|
|
var react_dom = __webpack_require__("../../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/use-slot.js + 1 modules
|
|
var bubbles_virtually_use_slot = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/use-slot.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/style-provider/index.js
|
|
var style_provider = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/style-provider/index.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/fill.js
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
function useForceUpdate() {
|
|
const [, setState] = (0,react.useState)({});
|
|
const mountedRef = (0,react.useRef)(true);
|
|
(0,react.useEffect)(() => {
|
|
mountedRef.current = true;
|
|
return () => {
|
|
mountedRef.current = false;
|
|
};
|
|
}, []);
|
|
return () => {
|
|
if (mountedRef.current) {
|
|
setState({});
|
|
}
|
|
};
|
|
}
|
|
function fill_Fill(props) {
|
|
var _slot$fillProps;
|
|
const {
|
|
name,
|
|
children
|
|
} = props;
|
|
const {
|
|
registerFill,
|
|
unregisterFill,
|
|
...slot
|
|
} = (0,bubbles_virtually_use_slot/* default */.A)(name);
|
|
const rerender = useForceUpdate();
|
|
const ref = (0,react.useRef)({
|
|
rerender
|
|
});
|
|
(0,react.useEffect)(() => {
|
|
// We register fills so we can keep track of their existence.
|
|
// Some Slot implementations need to know if there're already fills
|
|
// registered so they can choose to render themselves or not.
|
|
registerFill(ref);
|
|
return () => {
|
|
unregisterFill(ref);
|
|
};
|
|
}, [registerFill, unregisterFill]);
|
|
if (!slot.ref || !slot.ref.current) {
|
|
return null;
|
|
}
|
|
|
|
// When using a `Fill`, the `children` will be rendered in the document of the
|
|
// `Slot`. This means that we need to wrap the `children` in a `StyleProvider`
|
|
// to make sure we're referencing the right document/iframe (instead of the
|
|
// context of the `Fill`'s parent).
|
|
const wrappedChildren = /*#__PURE__*/(0,jsx_runtime.jsx)(style_provider/* default */.A, {
|
|
document: slot.ref.current.ownerDocument,
|
|
children: typeof children === 'function' ? children((_slot$fillProps = slot.fillProps) !== null && _slot$fillProps !== void 0 ? _slot$fillProps : {}) : children
|
|
});
|
|
return (0,react_dom.createPortal)(wrappedChildren, slot.ref.current);
|
|
}
|
|
//# sourceMappingURL=fill.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-merge-refs/index.js
|
|
var use_merge_refs = __webpack_require__("../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-merge-refs/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/view/component.js
|
|
var component = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/view/component.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/slot-fill-context.js + 1 modules
|
|
var slot_fill_context = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/slot-fill-context.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/slot.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
function slot_Slot(props, forwardedRef) {
|
|
const {
|
|
name,
|
|
fillProps = {},
|
|
as,
|
|
// `children` is not allowed. However, if it is passed,
|
|
// it will be displayed as is, so remove `children`.
|
|
// @ts-ignore
|
|
children,
|
|
...restProps
|
|
} = props;
|
|
const {
|
|
registerSlot,
|
|
unregisterSlot,
|
|
...registry
|
|
} = (0,react.useContext)(slot_fill_context/* default */.A);
|
|
const ref = (0,react.useRef)(null);
|
|
(0,react.useLayoutEffect)(() => {
|
|
registerSlot(name, ref, fillProps);
|
|
return () => {
|
|
unregisterSlot(name, ref);
|
|
};
|
|
// Ignore reason: We don't want to unregister and register the slot whenever
|
|
// `fillProps` change, which would cause the fill to be re-mounted. Instead,
|
|
// we can just update the slot (see hook below).
|
|
// For more context, see https://github.com/WordPress/gutenberg/pull/44403#discussion_r994415973
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
}, [registerSlot, unregisterSlot, name]);
|
|
// fillProps may be an update that interacts with the layout, so we
|
|
// useLayoutEffect.
|
|
(0,react.useLayoutEffect)(() => {
|
|
registry.updateSlot(name, fillProps);
|
|
});
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(component/* default */.A, {
|
|
as: as,
|
|
ref: (0,use_merge_refs/* default */.A)([forwardedRef, ref]),
|
|
...restProps
|
|
});
|
|
}
|
|
/* harmony default export */ const bubbles_virtually_slot = ((0,react.forwardRef)(slot_Slot));
|
|
//# sourceMappingURL=slot.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/slot-fill/index.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function slot_fill_Fill(props) {
|
|
// We're adding both Fills here so they can register themselves before
|
|
// their respective slot has been registered. Only the Fill that has a slot
|
|
// will render. The other one will return null.
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(Fill, {
|
|
...props
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(fill_Fill, {
|
|
...props
|
|
})]
|
|
});
|
|
}
|
|
function UnforwardedSlot(props, ref) {
|
|
const {
|
|
bubblesVirtually,
|
|
...restProps
|
|
} = props;
|
|
if (bubblesVirtually) {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(bubbles_virtually_slot, {
|
|
...restProps,
|
|
ref: ref
|
|
});
|
|
}
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(slot, {
|
|
...restProps
|
|
});
|
|
}
|
|
const slot_fill_Slot = (0,react.forwardRef)(UnforwardedSlot);
|
|
function Provider({
|
|
children,
|
|
passthrough = false
|
|
}) {
|
|
const parent = useContext(SlotFillContext);
|
|
if (!parent.isDefault && passthrough) {
|
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
children: children
|
|
});
|
|
}
|
|
return /*#__PURE__*/_jsx(SlotFillProvider, {
|
|
children: /*#__PURE__*/_jsx(BubblesVirtuallySlotFillProvider, {
|
|
children: children
|
|
})
|
|
});
|
|
}
|
|
function createSlotFill(key) {
|
|
const baseName = typeof key === 'symbol' ? key.description : key;
|
|
const FillComponent = props => /*#__PURE__*/(0,jsx_runtime.jsx)(slot_fill_Fill, {
|
|
name: key,
|
|
...props
|
|
});
|
|
FillComponent.displayName = `${baseName}Fill`;
|
|
const SlotComponent = props => /*#__PURE__*/(0,jsx_runtime.jsx)(slot_fill_Slot, {
|
|
name: key,
|
|
...props
|
|
});
|
|
SlotComponent.displayName = `${baseName}Slot`;
|
|
SlotComponent.__unstableName = key;
|
|
return {
|
|
Fill: FillComponent,
|
|
Slot: SlotComponent
|
|
};
|
|
}
|
|
const createPrivateSlotFill = name => {
|
|
const privateKey = Symbol(name);
|
|
const privateSlotFill = createSlotFill(privateKey);
|
|
return {
|
|
privateKey,
|
|
...privateSlotFill
|
|
};
|
|
};
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/spacer/component.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
A: () => (/* binding */ spacer_component)
|
|
});
|
|
|
|
// UNUSED EXPORTS: Spacer
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-connect.js
|
|
var context_connect = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-connect.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/view/component.js
|
|
var component = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/view/component.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2/node_modules/@emotion/react/dist/emotion-react.browser.esm.js
|
|
var emotion_react_browser_esm = __webpack_require__("../../node_modules/.pnpm/@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2/node_modules/@emotion/react/dist/emotion-react.browser.esm.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js + 1 modules
|
|
var use_context_system = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/space.js
|
|
var space = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/space.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/hooks/use-cx.js
|
|
var use_cx = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/hooks/use-cx.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/rtl.js
|
|
var rtl = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/rtl.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/spacer/hook.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
const isDefined = o => typeof o !== 'undefined' && o !== null;
|
|
function useSpacer(props) {
|
|
const {
|
|
className,
|
|
margin,
|
|
marginBottom = 2,
|
|
marginLeft,
|
|
marginRight,
|
|
marginTop,
|
|
marginX,
|
|
marginY,
|
|
padding,
|
|
paddingBottom,
|
|
paddingLeft,
|
|
paddingRight,
|
|
paddingTop,
|
|
paddingX,
|
|
paddingY,
|
|
...otherProps
|
|
} = (0,use_context_system/* useContextSystem */.A)(props, 'Spacer');
|
|
const cx = (0,use_cx/* useCx */.l)();
|
|
const classes = cx(isDefined(margin) && /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)("margin:", (0,space/* space */.x)(margin), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(marginY) && /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)("margin-bottom:", (0,space/* space */.x)(marginY), ";margin-top:", (0,space/* space */.x)(marginY), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(marginX) && /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)("margin-left:", (0,space/* space */.x)(marginX), ";margin-right:", (0,space/* space */.x)(marginX), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(marginTop) && /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)("margin-top:", (0,space/* space */.x)(marginTop), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(marginBottom) && /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)("margin-bottom:", (0,space/* space */.x)(marginBottom), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(marginLeft) && (0,rtl/* rtl */.h)({
|
|
marginLeft: (0,space/* space */.x)(marginLeft)
|
|
})(), isDefined(marginRight) && (0,rtl/* rtl */.h)({
|
|
marginRight: (0,space/* space */.x)(marginRight)
|
|
})(), isDefined(padding) && /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)("padding:", (0,space/* space */.x)(padding), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(paddingY) && /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)("padding-bottom:", (0,space/* space */.x)(paddingY), ";padding-top:", (0,space/* space */.x)(paddingY), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(paddingX) && /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)("padding-left:", (0,space/* space */.x)(paddingX), ";padding-right:", (0,space/* space */.x)(paddingX), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(paddingTop) && /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)("padding-top:", (0,space/* space */.x)(paddingTop), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(paddingBottom) && /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)("padding-bottom:", (0,space/* space */.x)(paddingBottom), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(paddingLeft) && (0,rtl/* rtl */.h)({
|
|
paddingLeft: (0,space/* space */.x)(paddingLeft)
|
|
})(), isDefined(paddingRight) && (0,rtl/* rtl */.h)({
|
|
paddingRight: (0,space/* space */.x)(paddingRight)
|
|
})(), className);
|
|
return {
|
|
...otherProps,
|
|
className: classes
|
|
};
|
|
}
|
|
//# sourceMappingURL=hook.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/spacer/component.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
function UnconnectedSpacer(props, forwardedRef) {
|
|
const spacerProps = useSpacer(props);
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(component/* default */.A, {
|
|
...spacerProps,
|
|
ref: forwardedRef
|
|
});
|
|
}
|
|
|
|
/**
|
|
* `Spacer` is a primitive layout component that providers inner (`padding`) or outer (`margin`) space in-between components. It can also be used to adaptively provide space within an `HStack` or `VStack`.
|
|
*
|
|
* `Spacer` comes with a bunch of shorthand props to adjust `margin` and `padding`. The values of these props
|
|
* can either be a number (which will act as a multiplier to the library's grid system base of 4px),
|
|
* or a literal CSS value string.
|
|
*
|
|
* ```jsx
|
|
* import { Spacer } from `@wordpress/components`
|
|
*
|
|
* function Example() {
|
|
* return (
|
|
* <View>
|
|
* <Spacer>
|
|
* <Heading>WordPress.org</Heading>
|
|
* </Spacer>
|
|
* <Text>
|
|
* Code is Poetry
|
|
* </Text>
|
|
* </View>
|
|
* );
|
|
* }
|
|
* ```
|
|
*/
|
|
const Spacer = (0,context_connect/* contextConnect */.KZ)(UnconnectedSpacer, 'Spacer');
|
|
/* harmony default export */ const spacer_component = (Spacer);
|
|
//# sourceMappingURL=component.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/style-provider/index.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__),
|
|
/* harmony export */ N: () => (/* binding */ StyleProvider)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _emotion_react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/.pnpm/@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2/node_modules/@emotion/react/dist/emotion-element-c39617d8.browser.esm.js");
|
|
/* harmony import */ var _emotion_cache__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@emotion+cache@11.11.0/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js");
|
|
/* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/v4.js");
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
const uuidCache = new Set();
|
|
// Use a weak map so that when the container is detached it's automatically
|
|
// dereferenced to avoid memory leak.
|
|
const containerCacheMap = new WeakMap();
|
|
const memoizedCreateCacheWithContainer = container => {
|
|
if (containerCacheMap.has(container)) {
|
|
return containerCacheMap.get(container);
|
|
}
|
|
|
|
// Emotion only accepts alphabetical and hyphenated keys so we just
|
|
// strip the numbers from the UUID. It _should_ be fine.
|
|
let key = uuid__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A().replace(/[0-9]/g, '');
|
|
while (uuidCache.has(key)) {
|
|
key = uuid__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A().replace(/[0-9]/g, '');
|
|
}
|
|
uuidCache.add(key);
|
|
const cache = (0,_emotion_cache__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)({
|
|
container,
|
|
key
|
|
});
|
|
containerCacheMap.set(container, cache);
|
|
return cache;
|
|
};
|
|
function StyleProvider(props) {
|
|
const {
|
|
children,
|
|
document
|
|
} = props;
|
|
if (!document) {
|
|
return null;
|
|
}
|
|
const cache = memoizedCreateCacheWithContainer(document.head);
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_emotion_react__WEBPACK_IMPORTED_MODULE_3__.C, {
|
|
value: cache,
|
|
children: children
|
|
});
|
|
}
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (StyleProvider);
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/text/component.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/* unused harmony export Text */
|
|
/* harmony import */ var _context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-connect.js");
|
|
/* harmony import */ var _view__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/view/component.js");
|
|
/* harmony import */ var _hook__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/text/hook.js");
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* @param props
|
|
* @param forwardedRef
|
|
*/
|
|
function UnconnectedText(props, forwardedRef) {
|
|
const textProps = (0,_hook__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A)(props);
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_view__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A, {
|
|
as: "span",
|
|
...textProps,
|
|
ref: forwardedRef
|
|
});
|
|
}
|
|
|
|
/**
|
|
* `Text` is a core component that renders text in the library, using the
|
|
* library's typography system.
|
|
*
|
|
* `Text` can be used to render any text-content, like an HTML `p` or `span`.
|
|
*
|
|
* @example
|
|
*
|
|
* ```jsx
|
|
* import { __experimentalText as Text } from `@wordpress/components`;
|
|
*
|
|
* function Example() {
|
|
* return <Text>Code is Poetry</Text>;
|
|
* }
|
|
* ```
|
|
*/
|
|
const Text = (0,_context__WEBPACK_IMPORTED_MODULE_3__/* .contextConnect */ .KZ)(UnconnectedText, 'Text');
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Text);
|
|
//# sourceMappingURL=component.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/text/hook.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
A: () => (/* binding */ useText)
|
|
});
|
|
|
|
// NAMESPACE OBJECT: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/text/styles.js
|
|
var styles_namespaceObject = {};
|
|
__webpack_require__.r(styles_namespaceObject);
|
|
__webpack_require__.d(styles_namespaceObject, {
|
|
Text: () => (Text),
|
|
block: () => (block),
|
|
destructive: () => (destructive),
|
|
highlighterText: () => (highlighterText),
|
|
muted: () => (muted),
|
|
positive: () => (positive),
|
|
upperCase: () => (upperCase)
|
|
});
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2/node_modules/@emotion/react/dist/emotion-react.browser.esm.js
|
|
var emotion_react_browser_esm = __webpack_require__("../../node_modules/.pnpm/@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2/node_modules/@emotion/react/dist/emotion-react.browser.esm.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js
|
|
var react = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js + 1 modules
|
|
var use_context_system = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-connect.js
|
|
var context_connect = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-connect.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/truncate/hook.js + 2 modules
|
|
var hook = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/truncate/hook.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/memize@2.1.0/node_modules/memize/dist/index.js
|
|
var dist = __webpack_require__("../../node_modules/.pnpm/memize@2.1.0/node_modules/memize/dist/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/colord@2.9.3/node_modules/colord/index.mjs
|
|
var node_modules_colord = __webpack_require__("../../node_modules/.pnpm/colord@2.9.3/node_modules/colord/index.mjs");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/colord@2.9.3/node_modules/colord/plugins/names.mjs
|
|
var names = __webpack_require__("../../node_modules/.pnpm/colord@2.9.3/node_modules/colord/plugins/names.mjs");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/colors.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
/** @type {HTMLDivElement} */
|
|
let colorComputationNode;
|
|
(0,node_modules_colord/* extend */.X$)([names/* default */.A]);
|
|
|
|
/**
|
|
* Generating a CSS compliant rgba() color value.
|
|
*
|
|
* @param {string} hexValue The hex value to convert to rgba().
|
|
* @param {number} alpha The alpha value for opacity.
|
|
* @return {string} The converted rgba() color value.
|
|
*
|
|
* @example
|
|
* rgba( '#000000', 0.5 )
|
|
* // rgba(0, 0, 0, 0.5)
|
|
*/
|
|
function rgba(hexValue = '', alpha = 1) {
|
|
return colord(hexValue).alpha(alpha).toRgbString();
|
|
}
|
|
|
|
/**
|
|
* @return {HTMLDivElement | undefined} The HTML element for color computation.
|
|
*/
|
|
function getColorComputationNode() {
|
|
if (typeof document === 'undefined') {
|
|
return;
|
|
}
|
|
if (!colorComputationNode) {
|
|
// Create a temporary element for style computation.
|
|
const el = document.createElement('div');
|
|
el.setAttribute('data-g2-color-computation-node', '');
|
|
// Inject for window computed style.
|
|
document.body.appendChild(el);
|
|
colorComputationNode = el;
|
|
}
|
|
return colorComputationNode;
|
|
}
|
|
|
|
/**
|
|
* @param {string | unknown} value
|
|
*
|
|
* @return {boolean} Whether the value is a valid color.
|
|
*/
|
|
function isColor(value) {
|
|
if (typeof value !== 'string') {
|
|
return false;
|
|
}
|
|
const test = (0,node_modules_colord/* colord */.Mj)(value);
|
|
return test.isValid();
|
|
}
|
|
|
|
/**
|
|
* Retrieves the computed background color. This is useful for getting the
|
|
* value of a CSS variable color.
|
|
*
|
|
* @param {string | unknown} backgroundColor The background color to compute.
|
|
*
|
|
* @return {string} The computed background color.
|
|
*/
|
|
function _getComputedBackgroundColor(backgroundColor) {
|
|
if (typeof backgroundColor !== 'string') {
|
|
return '';
|
|
}
|
|
if (isColor(backgroundColor)) {
|
|
return backgroundColor;
|
|
}
|
|
if (!backgroundColor.includes('var(')) {
|
|
return '';
|
|
}
|
|
if (typeof document === 'undefined') {
|
|
return '';
|
|
}
|
|
|
|
// Attempts to gracefully handle CSS variables color values.
|
|
const el = getColorComputationNode();
|
|
if (!el) {
|
|
return '';
|
|
}
|
|
el.style.background = backgroundColor;
|
|
// Grab the style.
|
|
const computedColor = window?.getComputedStyle(el).background;
|
|
// Reset.
|
|
el.style.background = '';
|
|
return computedColor || '';
|
|
}
|
|
const getComputedBackgroundColor = (0,dist/* default */.A)(_getComputedBackgroundColor);
|
|
|
|
/**
|
|
* Get the text shade optimized for readability, based on a background color.
|
|
*
|
|
* @param {string | unknown} backgroundColor The background color.
|
|
*
|
|
* @return {string} The optimized text color (black or white).
|
|
*/
|
|
function getOptimalTextColor(backgroundColor) {
|
|
const background = getComputedBackgroundColor(backgroundColor);
|
|
return (0,node_modules_colord/* colord */.Mj)(background).isLight() ? '#000000' : '#ffffff';
|
|
}
|
|
|
|
/**
|
|
* Get the text shade optimized for readability, based on a background color.
|
|
*
|
|
* @param {string | unknown} backgroundColor The background color.
|
|
*
|
|
* @return {string} The optimized text shade (dark or light).
|
|
*/
|
|
function getOptimalTextShade(backgroundColor) {
|
|
const result = getOptimalTextColor(backgroundColor);
|
|
return result === '#000000' ? 'dark' : 'light';
|
|
}
|
|
//# sourceMappingURL=colors.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/colors-values.js
|
|
var colors_values = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/colors-values.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/config-values.js
|
|
var config_values = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/config-values.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/text/styles.js
|
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
const Text = /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)("color:", colors_values/* COLORS */.l.gray[900], ";line-height:", config_values/* default */.A.fontLineHeightBase, ";margin:0;text-wrap:balance;text-wrap:pretty;" + ( true ? "" : 0), true ? "" : 0);
|
|
const block = true ? {
|
|
name: "4zleql",
|
|
styles: "display:block"
|
|
} : 0;
|
|
const positive = /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)("color:", colors_values/* COLORS */.l.alert.green, ";" + ( true ? "" : 0), true ? "" : 0);
|
|
const destructive = /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)("color:", colors_values/* COLORS */.l.alert.red, ";" + ( true ? "" : 0), true ? "" : 0);
|
|
const muted = /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)("color:", colors_values/* COLORS */.l.gray[700], ";" + ( true ? "" : 0), true ? "" : 0);
|
|
const highlighterText = /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)("mark{background:", colors_values/* COLORS */.l.alert.yellow, ";border-radius:", config_values/* default */.A.radiusSmall, ";box-shadow:0 0 0 1px rgba( 0, 0, 0, 0.05 ) inset,0 -1px 0 rgba( 0, 0, 0, 0.1 ) inset;}" + ( true ? "" : 0), true ? "" : 0);
|
|
const upperCase = true ? {
|
|
name: "50zrmy",
|
|
styles: "text-transform:uppercase"
|
|
} : 0;
|
|
//# sourceMappingURL=styles.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/highlight-words-core@1.2.2/node_modules/highlight-words-core/dist/index.js
|
|
var highlight_words_core_dist = __webpack_require__("../../node_modules/.pnpm/highlight-words-core@1.2.2/node_modules/highlight-words-core/dist/index.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/text/utils.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Source:
|
|
* https://github.com/bvaughn/react-highlight-words/blob/HEAD/src/Highlighter.js
|
|
*/
|
|
|
|
/**
|
|
* @typedef Options
|
|
* @property {string} [activeClassName=''] Classname for active highlighted areas.
|
|
* @property {number} [activeIndex=-1] The index of the active highlighted area.
|
|
* @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [activeStyle] Styles to apply to the active highlighted area.
|
|
* @property {boolean} [autoEscape] Whether to automatically escape text.
|
|
* @property {boolean} [caseSensitive=false] Whether to highlight in a case-sensitive manner.
|
|
* @property {string} children Children to highlight.
|
|
* @property {import('highlight-words-core').FindAllArgs['findChunks']} [findChunks] Custom `findChunks` function to pass to `highlight-words-core`.
|
|
* @property {string | Record<string, unknown>} [highlightClassName=''] Classname to apply to highlighted text or a Record of classnames to apply to given text (which should be the key).
|
|
* @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [highlightStyle={}] Styles to apply to highlighted text.
|
|
* @property {keyof JSX.IntrinsicElements} [highlightTag='mark'] Tag to use for the highlighted text.
|
|
* @property {import('highlight-words-core').FindAllArgs['sanitize']} [sanitize] Custom `santize` function to pass to `highlight-words-core`.
|
|
* @property {string[]} [searchWords=[]] Words to search for and highlight.
|
|
* @property {string} [unhighlightClassName=''] Classname to apply to unhighlighted text.
|
|
* @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [unhighlightStyle] Style to apply to unhighlighted text.
|
|
*/
|
|
|
|
/**
|
|
* Maps props to lowercase names.
|
|
*
|
|
* @param object Props to map.
|
|
* @return The mapped props.
|
|
*/
|
|
const lowercaseProps = object => {
|
|
const mapped = {};
|
|
for (const key in object) {
|
|
mapped[key.toLowerCase()] = object[key];
|
|
}
|
|
return mapped;
|
|
};
|
|
const memoizedLowercaseProps = (0,dist/* default */.A)(lowercaseProps);
|
|
|
|
/**
|
|
* @param options
|
|
* @param options.activeClassName
|
|
* @param options.activeIndex
|
|
* @param options.activeStyle
|
|
* @param options.autoEscape
|
|
* @param options.caseSensitive
|
|
* @param options.children
|
|
* @param options.findChunks
|
|
* @param options.highlightClassName
|
|
* @param options.highlightStyle
|
|
* @param options.highlightTag
|
|
* @param options.sanitize
|
|
* @param options.searchWords
|
|
* @param options.unhighlightClassName
|
|
* @param options.unhighlightStyle
|
|
*/
|
|
function createHighlighterText({
|
|
activeClassName = '',
|
|
activeIndex = -1,
|
|
activeStyle,
|
|
autoEscape,
|
|
caseSensitive = false,
|
|
children,
|
|
findChunks,
|
|
highlightClassName = '',
|
|
highlightStyle = {},
|
|
highlightTag = 'mark',
|
|
sanitize,
|
|
searchWords = [],
|
|
unhighlightClassName = '',
|
|
unhighlightStyle
|
|
}) {
|
|
if (!children) {
|
|
return null;
|
|
}
|
|
if (typeof children !== 'string') {
|
|
return children;
|
|
}
|
|
const textToHighlight = children;
|
|
const chunks = (0,highlight_words_core_dist.findAll)({
|
|
autoEscape,
|
|
caseSensitive,
|
|
findChunks,
|
|
sanitize,
|
|
searchWords,
|
|
textToHighlight
|
|
});
|
|
const HighlightTag = highlightTag;
|
|
let highlightIndex = -1;
|
|
let highlightClassNames = '';
|
|
let highlightStyles;
|
|
const textContent = chunks.map((chunk, index) => {
|
|
const text = textToHighlight.substr(chunk.start, chunk.end - chunk.start);
|
|
if (chunk.highlight) {
|
|
highlightIndex++;
|
|
let highlightClass;
|
|
if (typeof highlightClassName === 'object') {
|
|
if (!caseSensitive) {
|
|
highlightClassName = memoizedLowercaseProps(highlightClassName);
|
|
highlightClass = highlightClassName[text.toLowerCase()];
|
|
} else {
|
|
highlightClass = highlightClassName[text];
|
|
}
|
|
} else {
|
|
highlightClass = highlightClassName;
|
|
}
|
|
const isActive = highlightIndex === +activeIndex;
|
|
highlightClassNames = `${highlightClass} ${isActive ? activeClassName : ''}`;
|
|
highlightStyles = isActive === true && activeStyle !== null ? Object.assign({}, highlightStyle, activeStyle) : highlightStyle;
|
|
const props = {
|
|
children: text,
|
|
className: highlightClassNames,
|
|
key: index,
|
|
style: highlightStyles
|
|
};
|
|
|
|
// Don't attach arbitrary props to DOM elements; this triggers React DEV warnings (https://fb.me/react-unknown-prop)
|
|
// Only pass through the highlightIndex attribute for custom components.
|
|
if (typeof HighlightTag !== 'string') {
|
|
props.highlightIndex = highlightIndex;
|
|
}
|
|
return (0,react.createElement)(HighlightTag, props);
|
|
}
|
|
return (0,react.createElement)('span', {
|
|
children: text,
|
|
className: unhighlightClassName,
|
|
key: index,
|
|
style: unhighlightStyle
|
|
});
|
|
});
|
|
return textContent;
|
|
}
|
|
//# sourceMappingURL=utils.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/font-size.js
|
|
var font_size = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/font-size.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/space.js
|
|
var space = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/space.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/text/get-line-height.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
function getLineHeight(adjustLineHeightForInnerControls, lineHeight) {
|
|
if (lineHeight) {
|
|
return lineHeight;
|
|
}
|
|
if (!adjustLineHeightForInnerControls) {
|
|
return;
|
|
}
|
|
let value = `calc(${config_values/* default */.A.controlHeight} + ${(0,space/* space */.x)(2)})`;
|
|
switch (adjustLineHeightForInnerControls) {
|
|
case 'large':
|
|
value = `calc(${config_values/* default */.A.controlHeightLarge} + ${(0,space/* space */.x)(2)})`;
|
|
break;
|
|
case 'small':
|
|
value = `calc(${config_values/* default */.A.controlHeightSmall} + ${(0,space/* space */.x)(2)})`;
|
|
break;
|
|
case 'xSmall':
|
|
value = `calc(${config_values/* default */.A.controlHeightXSmall} + ${(0,space/* space */.x)(2)})`;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
return value;
|
|
}
|
|
//# sourceMappingURL=get-line-height.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/hooks/use-cx.js
|
|
var use_cx = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/hooks/use-cx.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/text/hook.js
|
|
function hook_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _ref = true ? {
|
|
name: "50zrmy",
|
|
styles: "text-transform:uppercase"
|
|
} : 0;
|
|
/**
|
|
* @param {import('../context').WordPressComponentProps<import('./types').Props, 'span'>} props
|
|
*/
|
|
function useText(props) {
|
|
const {
|
|
adjustLineHeightForInnerControls,
|
|
align,
|
|
children,
|
|
className,
|
|
color,
|
|
ellipsizeMode,
|
|
isDestructive = false,
|
|
display,
|
|
highlightEscape = false,
|
|
highlightCaseSensitive = false,
|
|
highlightWords,
|
|
highlightSanitize,
|
|
isBlock = false,
|
|
letterSpacing,
|
|
lineHeight: lineHeightProp,
|
|
optimizeReadabilityFor,
|
|
size,
|
|
truncate = false,
|
|
upperCase = false,
|
|
variant,
|
|
weight = config_values/* default */.A.fontWeight,
|
|
...otherProps
|
|
} = (0,use_context_system/* useContextSystem */.A)(props, 'Text');
|
|
let content = children;
|
|
const isHighlighter = Array.isArray(highlightWords);
|
|
const isCaption = size === 'caption';
|
|
if (isHighlighter) {
|
|
if (typeof children !== 'string') {
|
|
throw new TypeError('`children` of `Text` must only be `string` types when `highlightWords` is defined');
|
|
}
|
|
content = createHighlighterText({
|
|
autoEscape: highlightEscape,
|
|
children,
|
|
caseSensitive: highlightCaseSensitive,
|
|
searchWords: highlightWords,
|
|
sanitize: highlightSanitize
|
|
});
|
|
}
|
|
const cx = (0,use_cx/* useCx */.l)();
|
|
const classes = (0,react.useMemo)(() => {
|
|
const sx = {};
|
|
const lineHeight = getLineHeight(adjustLineHeightForInnerControls, lineHeightProp);
|
|
sx.Base = /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)({
|
|
color,
|
|
display,
|
|
fontSize: (0,font_size/* getFontSize */.ny)(size),
|
|
fontWeight: weight,
|
|
lineHeight,
|
|
letterSpacing,
|
|
textAlign: align
|
|
}, true ? "" : 0, true ? "" : 0);
|
|
sx.upperCase = _ref;
|
|
sx.optimalTextColor = null;
|
|
if (optimizeReadabilityFor) {
|
|
const isOptimalTextColorDark = getOptimalTextShade(optimizeReadabilityFor) === 'dark';
|
|
sx.optimalTextColor = isOptimalTextColorDark ? /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)({
|
|
color: colors_values/* COLORS */.l.gray[900]
|
|
}, true ? "" : 0, true ? "" : 0) : /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)({
|
|
color: colors_values/* COLORS */.l.white
|
|
}, true ? "" : 0, true ? "" : 0);
|
|
}
|
|
return cx(Text, sx.Base, sx.optimalTextColor, isDestructive && destructive, !!isHighlighter && highlighterText, isBlock && block, isCaption && muted, variant && styles_namespaceObject[variant], upperCase && sx.upperCase, className);
|
|
}, [adjustLineHeightForInnerControls, align, className, color, cx, display, isBlock, isCaption, isDestructive, isHighlighter, letterSpacing, lineHeightProp, optimizeReadabilityFor, size, upperCase, variant, weight]);
|
|
let finalEllipsizeMode;
|
|
if (truncate === true) {
|
|
finalEllipsizeMode = 'auto';
|
|
}
|
|
if (truncate === false) {
|
|
finalEllipsizeMode = 'none';
|
|
}
|
|
const finalComponentProps = {
|
|
...otherProps,
|
|
className: classes,
|
|
children,
|
|
ellipsizeMode: ellipsizeMode || finalEllipsizeMode
|
|
};
|
|
const truncateProps = (0,hook/* default */.A)(finalComponentProps);
|
|
|
|
/**
|
|
* Enhance child `<Link />` components to inherit font size.
|
|
*/
|
|
if (!truncate && Array.isArray(children)) {
|
|
content = react.Children.map(children, child => {
|
|
if (typeof child !== 'object' || child === null || !('props' in child)) {
|
|
return child;
|
|
}
|
|
const isLink = (0,context_connect/* hasConnectNamespace */.SZ)(child, ['Link']);
|
|
if (isLink) {
|
|
return (0,react.cloneElement)(child, {
|
|
size: child.props.size || 'inherit'
|
|
});
|
|
}
|
|
return child;
|
|
});
|
|
}
|
|
return {
|
|
...truncateProps,
|
|
children: truncate ? truncateProps.children : content
|
|
};
|
|
}
|
|
//# sourceMappingURL=hook.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/toggle-group-control/context.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__),
|
|
/* harmony export */ H: () => (/* binding */ useToggleGroupControlContext)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
const ToggleGroupControlContext = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createContext)({});
|
|
const useToggleGroupControlContext = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useContext)(ToggleGroupControlContext);
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ToggleGroupControlContext);
|
|
//# sourceMappingURL=context.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option-base/component.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
A: () => (/* binding */ component)
|
|
});
|
|
|
|
// NAMESPACE OBJECT: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option-base/styles.js
|
|
var styles_namespaceObject = {};
|
|
__webpack_require__.r(styles_namespaceObject);
|
|
__webpack_require__.d(styles_namespaceObject, {
|
|
ButtonContentView: () => (ButtonContentView),
|
|
LabelView: () => (LabelView),
|
|
ou: () => (backdropView),
|
|
uG: () => (buttonView),
|
|
eh: () => (labelBlock)
|
|
});
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/K7FXVWIT.js
|
|
var K7FXVWIT = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/K7FXVWIT.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/dom/motion.mjs + 210 modules
|
|
var motion = __webpack_require__("../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/dom/motion.mjs");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-reduced-motion/index.js
|
|
var use_reduced_motion = __webpack_require__("../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-reduced-motion/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-instance-id/index.js
|
|
var use_instance_id = __webpack_require__("../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-instance-id/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js
|
|
var react = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js + 1 modules
|
|
var use_context_system = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-connect.js
|
|
var context_connect = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-connect.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/toggle-group-control/context.js
|
|
var context = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/toggle-group-control/context.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@emotion+styled@11.11.0_@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2__@types+react@17.0.71_react@17.0.2/node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js
|
|
var emotion_styled_base_browser_esm = __webpack_require__("../../node_modules/.pnpm/@emotion+styled@11.11.0_@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2__@types+react@17.0.71_react@17.0.2/node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2/node_modules/@emotion/react/dist/emotion-react.browser.esm.js
|
|
var emotion_react_browser_esm = __webpack_require__("../../node_modules/.pnpm/@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2/node_modules/@emotion/react/dist/emotion-react.browser.esm.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/config-values.js
|
|
var config_values = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/config-values.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/colors-values.js
|
|
var colors_values = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/colors-values.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option-base/styles.js
|
|
|
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
const LabelView = /*#__PURE__*/(0,emotion_styled_base_browser_esm/* default */.A)("div", true ? {
|
|
target: "et6ln9s1"
|
|
} : 0)( true ? {
|
|
name: "sln1fl",
|
|
styles: "display:inline-flex;max-width:100%;min-width:0;position:relative"
|
|
} : 0);
|
|
const labelBlock = true ? {
|
|
name: "82a6rk",
|
|
styles: "flex:1"
|
|
} : 0;
|
|
const buttonView = ({
|
|
isDeselectable,
|
|
isIcon,
|
|
isPressed,
|
|
size
|
|
}) => /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)("align-items:center;appearance:none;background:transparent;border:none;border-radius:", config_values/* default */.A.radiusXSmall, ";color:", colors_values/* COLORS */.l.gray[700], ";fill:currentColor;cursor:pointer;display:flex;font-family:inherit;height:100%;justify-content:center;line-height:100%;outline:none;padding:0 12px;position:relative;text-align:center;@media not ( prefers-reduced-motion ){transition:background ", config_values/* default */.A.transitionDurationFast, " linear,color ", config_values/* default */.A.transitionDurationFast, " linear,font-weight 60ms linear;}user-select:none;width:100%;z-index:2;&::-moz-focus-inner{border:0;}&[disabled]{opacity:0.4;cursor:default;}&:active{background:", config_values/* default */.A.toggleGroupControlBackgroundColor, ";}", isDeselectable && deselectable, " ", isIcon && isIconStyles({
|
|
size
|
|
}), " ", isPressed && pressed, ";" + ( true ? "" : 0), true ? "" : 0);
|
|
const pressed = /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)("color:", colors_values/* COLORS */.l.white, ";&:active{background:transparent;}" + ( true ? "" : 0), true ? "" : 0);
|
|
const deselectable = /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)("color:", colors_values/* COLORS */.l.gray[900], ";&:focus{box-shadow:inset 0 0 0 1px ", colors_values/* COLORS */.l.white, ",0 0 0 ", config_values/* default */.A.borderWidthFocus, " ", colors_values/* COLORS */.l.theme.accent, ";outline:2px solid transparent;}" + ( true ? "" : 0), true ? "" : 0);
|
|
const ButtonContentView = /*#__PURE__*/(0,emotion_styled_base_browser_esm/* default */.A)("div", true ? {
|
|
target: "et6ln9s0"
|
|
} : 0)("display:flex;font-size:", config_values/* default */.A.fontSize, ";line-height:1;" + ( true ? "" : 0));
|
|
const isIconStyles = ({
|
|
size = 'default'
|
|
}) => {
|
|
const iconButtonSizes = {
|
|
default: '30px',
|
|
'__unstable-large': '32px'
|
|
};
|
|
return /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)("color:", colors_values/* COLORS */.l.gray[900], ";height:", iconButtonSizes[size], ";aspect-ratio:1;padding-left:0;padding-right:0;" + ( true ? "" : 0), true ? "" : 0);
|
|
};
|
|
const backdropView = /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)("background:", colors_values/* COLORS */.l.gray[900], ";border-radius:", config_values/* default */.A.radiusXSmall, ";position:absolute;inset:0;z-index:1;outline:2px solid transparent;outline-offset:-3px;" + ( true ? "" : 0), true ? "" : 0);
|
|
//# sourceMappingURL=styles.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/hooks/use-cx.js
|
|
var use_cx = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/hooks/use-cx.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/tooltip/index.js + 6 modules
|
|
var tooltip = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/tooltip/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option-base/component.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const {
|
|
ButtonContentView: component_ButtonContentView,
|
|
LabelView: component_LabelView
|
|
} = styles_namespaceObject;
|
|
const REDUCED_MOTION_TRANSITION_CONFIG = {
|
|
duration: 0
|
|
};
|
|
const LAYOUT_ID = 'toggle-group-backdrop-shared-layout-id';
|
|
const WithToolTip = ({
|
|
showTooltip,
|
|
text,
|
|
children
|
|
}) => {
|
|
if (showTooltip && text) {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Ay, {
|
|
text: text,
|
|
placement: "top",
|
|
children: children
|
|
});
|
|
}
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
children: children
|
|
});
|
|
};
|
|
function ToggleGroupControlOptionBase(props, forwardedRef) {
|
|
const shouldReduceMotion = (0,use_reduced_motion/* default */.A)();
|
|
const toggleGroupControlContext = (0,context/* useToggleGroupControlContext */.H)();
|
|
const id = (0,use_instance_id/* default */.A)(ToggleGroupControlOptionBase, toggleGroupControlContext.baseId || 'toggle-group-control-option-base');
|
|
const buttonProps = (0,use_context_system/* useContextSystem */.A)({
|
|
...props,
|
|
id
|
|
}, 'ToggleGroupControlOptionBase');
|
|
const {
|
|
isBlock = false,
|
|
isDeselectable = false,
|
|
size = 'default'
|
|
} = toggleGroupControlContext;
|
|
const {
|
|
className,
|
|
isIcon = false,
|
|
value,
|
|
children,
|
|
showTooltip = false,
|
|
onFocus: onFocusProp,
|
|
disabled,
|
|
...otherButtonProps
|
|
} = buttonProps;
|
|
const isPressed = toggleGroupControlContext.value === value;
|
|
const cx = (0,use_cx/* useCx */.l)();
|
|
const labelViewClasses = (0,react.useMemo)(() => cx(isBlock && labelBlock), [cx, isBlock]);
|
|
const itemClasses = (0,react.useMemo)(() => cx(buttonView({
|
|
isDeselectable,
|
|
isIcon,
|
|
isPressed,
|
|
size
|
|
}), className), [cx, isDeselectable, isIcon, isPressed, size, className]);
|
|
const backdropClasses = (0,react.useMemo)(() => cx(backdropView), [cx]);
|
|
const buttonOnClick = () => {
|
|
if (isDeselectable && isPressed) {
|
|
toggleGroupControlContext.setValue(undefined);
|
|
} else {
|
|
toggleGroupControlContext.setValue(value);
|
|
}
|
|
};
|
|
const commonProps = {
|
|
...otherButtonProps,
|
|
className: itemClasses,
|
|
'data-value': value,
|
|
ref: forwardedRef
|
|
};
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(component_LabelView, {
|
|
className: labelViewClasses,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(WithToolTip, {
|
|
showTooltip: showTooltip,
|
|
text: otherButtonProps['aria-label'],
|
|
children: isDeselectable ? /*#__PURE__*/(0,jsx_runtime.jsx)("button", {
|
|
...commonProps,
|
|
disabled: disabled,
|
|
onFocus: onFocusProp,
|
|
"aria-pressed": isPressed,
|
|
type: "button",
|
|
onClick: buttonOnClick,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(component_ButtonContentView, {
|
|
children: children
|
|
})
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(K7FXVWIT/* Radio */.s, {
|
|
disabled: disabled,
|
|
render: /*#__PURE__*/(0,jsx_runtime.jsx)("button", {
|
|
type: "button",
|
|
...commonProps,
|
|
onFocus: event => {
|
|
onFocusProp?.(event);
|
|
if (event.defaultPrevented) {
|
|
return;
|
|
}
|
|
toggleGroupControlContext.setValue(value);
|
|
}
|
|
}),
|
|
value: value,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(component_ButtonContentView, {
|
|
children: children
|
|
})
|
|
})
|
|
}), isPressed ? /*#__PURE__*/(0,jsx_runtime.jsx)(motion/* motion */.P.div, {
|
|
layout: true,
|
|
layoutRoot: true,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(motion/* motion */.P.div, {
|
|
className: backdropClasses,
|
|
transition: shouldReduceMotion ? REDUCED_MOTION_TRANSITION_CONFIG : undefined,
|
|
role: "presentation",
|
|
layoutId: LAYOUT_ID
|
|
})
|
|
}) : null]
|
|
});
|
|
}
|
|
|
|
/**
|
|
* `ToggleGroupControlOptionBase` is a form component and is meant to be used as an internal,
|
|
* generic component for any children of `ToggleGroupControl`.
|
|
*
|
|
* @example
|
|
* ```jsx
|
|
* import {
|
|
* __experimentalToggleGroupControl as ToggleGroupControl,
|
|
* __experimentalToggleGroupControlOptionBase as ToggleGroupControlOptionBase,
|
|
* } from '@wordpress/components';
|
|
*
|
|
* function Example() {
|
|
* return (
|
|
* <ToggleGroupControl label="my label" value="vertical" isBlock>
|
|
* <ToggleGroupControlOption value="horizontal" label="Horizontal" />
|
|
* <ToggleGroupControlOption value="vertical" label="Vertical" />
|
|
* </ToggleGroupControl>
|
|
* );
|
|
* }
|
|
* ```
|
|
*/
|
|
const ConnectedToggleGroupControlOptionBase = (0,context_connect/* contextConnect */.KZ)(ToggleGroupControlOptionBase, 'ToggleGroupControlOptionBase');
|
|
/* harmony default export */ const component = (ConnectedToggleGroupControlOptionBase);
|
|
//# sourceMappingURL=component.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option/component.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/* unused harmony export ToggleGroupControlOption */
|
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
/* harmony import */ var _toggle_group_control_option_base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option-base/component.js");
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
function UnforwardedToggleGroupControlOption(props, ref) {
|
|
const {
|
|
label,
|
|
...restProps
|
|
} = props;
|
|
const optionLabel = restProps['aria-label'] || label;
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_toggle_group_control_option_base__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A, {
|
|
...restProps,
|
|
"aria-label": optionLabel,
|
|
ref: ref,
|
|
children: label
|
|
});
|
|
}
|
|
|
|
/**
|
|
* `ToggleGroupControlOption` is a form component and is meant to be used as a
|
|
* child of `ToggleGroupControl`.
|
|
*
|
|
* ```jsx
|
|
* import {
|
|
* __experimentalToggleGroupControl as ToggleGroupControl,
|
|
* __experimentalToggleGroupControlOption as ToggleGroupControlOption,
|
|
* } from '@wordpress/components';
|
|
*
|
|
* function Example() {
|
|
* return (
|
|
* <ToggleGroupControl
|
|
* label="my label"
|
|
* value="vertical"
|
|
* isBlock
|
|
* __nextHasNoMarginBottom
|
|
* >
|
|
* <ToggleGroupControlOption value="horizontal" label="Horizontal" />
|
|
* <ToggleGroupControlOption value="vertical" label="Vertical" />
|
|
* </ToggleGroupControl>
|
|
* );
|
|
* }
|
|
* ```
|
|
*/
|
|
const ToggleGroupControlOption = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.forwardRef)(UnforwardedToggleGroupControlOption);
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ToggleGroupControlOption);
|
|
//# sourceMappingURL=component.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control/component.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
A: () => (/* binding */ toggle_group_control_component)
|
|
});
|
|
|
|
// UNUSED EXPORTS: ToggleGroupControl
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js
|
|
var react = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/context/LayoutGroupContext.mjs
|
|
var LayoutGroupContext = __webpack_require__("../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/context/LayoutGroupContext.mjs");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/context/DeprecatedLayoutGroupContext.mjs
|
|
|
|
|
|
/**
|
|
* Note: Still used by components generated by old versions of Framer
|
|
*
|
|
* @deprecated
|
|
*/
|
|
const DeprecatedLayoutGroupContext = (0,react.createContext)(null);
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/use-isomorphic-effect.mjs
|
|
var use_isomorphic_effect = __webpack_require__("../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/use-isomorphic-effect.mjs");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/use-is-mounted.mjs
|
|
|
|
|
|
|
|
function useIsMounted() {
|
|
const isMounted = (0,react.useRef)(false);
|
|
(0,use_isomorphic_effect/* useIsomorphicLayoutEffect */.E)(() => {
|
|
isMounted.current = true;
|
|
return () => {
|
|
isMounted.current = false;
|
|
};
|
|
}, []);
|
|
return isMounted;
|
|
}
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/frameloop/frame.mjs
|
|
var frameloop_frame = __webpack_require__("../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/frameloop/frame.mjs");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/use-force-update.mjs
|
|
|
|
|
|
|
|
|
|
function useForceUpdate() {
|
|
const isMounted = useIsMounted();
|
|
const [forcedRenderCount, setForcedRenderCount] = (0,react.useState)(0);
|
|
const forceRender = (0,react.useCallback)(() => {
|
|
isMounted.current && setForcedRenderCount(forcedRenderCount + 1);
|
|
}, [forcedRenderCount]);
|
|
/**
|
|
* Defer this to the end of the next animation frame in case there are multiple
|
|
* synchronous calls.
|
|
*/
|
|
const deferredForceRender = (0,react.useCallback)(() => frameloop_frame/* frame */.Gt.postRender(forceRender), [forceRender]);
|
|
return [deferredForceRender, forcedRenderCount];
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/projection/node/group.mjs
|
|
const notify = (node) => !node.isLayoutDirty && node.willUpdate(false);
|
|
function nodeGroup() {
|
|
const nodes = new Set();
|
|
const subscriptions = new WeakMap();
|
|
const dirtyAll = () => nodes.forEach(notify);
|
|
return {
|
|
add: (node) => {
|
|
nodes.add(node);
|
|
subscriptions.set(node, node.addEventListener("willUpdate", dirtyAll));
|
|
},
|
|
remove: (node) => {
|
|
nodes.delete(node);
|
|
const unsubscribe = subscriptions.get(node);
|
|
if (unsubscribe) {
|
|
unsubscribe();
|
|
subscriptions.delete(node);
|
|
}
|
|
dirtyAll();
|
|
},
|
|
dirty: dirtyAll,
|
|
};
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/components/LayoutGroup/index.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const shouldInheritGroup = (inherit) => inherit === true;
|
|
const shouldInheritId = (inherit) => shouldInheritGroup(inherit === true) || inherit === "id";
|
|
const LayoutGroup = ({ children, id, inherit = true }) => {
|
|
const layoutGroupContext = (0,react.useContext)(LayoutGroupContext/* LayoutGroupContext */.L);
|
|
const deprecatedLayoutGroupContext = (0,react.useContext)(DeprecatedLayoutGroupContext);
|
|
const [forceRender, key] = useForceUpdate();
|
|
const context = (0,react.useRef)(null);
|
|
const upstreamId = layoutGroupContext.id || deprecatedLayoutGroupContext;
|
|
if (context.current === null) {
|
|
if (shouldInheritId(inherit) && upstreamId) {
|
|
id = id ? upstreamId + "-" + id : upstreamId;
|
|
}
|
|
context.current = {
|
|
id,
|
|
group: shouldInheritGroup(inherit)
|
|
? layoutGroupContext.group || nodeGroup()
|
|
: nodeGroup(),
|
|
};
|
|
}
|
|
const memoizedContext = (0,react.useMemo)(() => ({ ...context.current, forceRender }), [key]);
|
|
return ((0,jsx_runtime.jsx)(LayoutGroupContext/* LayoutGroupContext */.L.Provider, { value: memoizedContext, children: children }));
|
|
};
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-instance-id/index.js
|
|
var use_instance_id = __webpack_require__("../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-instance-id/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js + 1 modules
|
|
var use_context_system = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-connect.js
|
|
var context_connect = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-connect.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/hooks/use-cx.js
|
|
var use_cx = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/hooks/use-cx.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/base-control/index.js
|
|
var base_control = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/base-control/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@emotion+styled@11.11.0_@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2__@types+react@17.0.71_react@17.0.2/node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js
|
|
var emotion_styled_base_browser_esm = __webpack_require__("../../node_modules/.pnpm/@emotion+styled@11.11.0_@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2__@types+react@17.0.71_react@17.0.2/node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2/node_modules/@emotion/react/dist/emotion-react.browser.esm.js
|
|
var emotion_react_browser_esm = __webpack_require__("../../node_modules/.pnpm/@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2/node_modules/@emotion/react/dist/emotion-react.browser.esm.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/colors-values.js
|
|
var colors_values = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/colors-values.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/config-values.js
|
|
var config_values = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/config-values.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control/styles.js
|
|
|
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
const toggleGroupControl = ({
|
|
isBlock,
|
|
isDeselectable,
|
|
size
|
|
}) => /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)("background:", colors_values/* COLORS */.l.ui.background, ";border:1px solid transparent;border-radius:", config_values/* default */.A.radiusSmall, ";display:inline-flex;min-width:0;position:relative;", toggleGroupControlSize(size), " ", !isDeselectable && enclosingBorders(isBlock), ";" + ( true ? "" : 0), true ? "" : 0);
|
|
const enclosingBorders = isBlock => {
|
|
const enclosingBorder = /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)("border-color:", colors_values/* COLORS */.l.ui.border, ";" + ( true ? "" : 0), true ? "" : 0);
|
|
return /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)(isBlock && enclosingBorder, " &:hover{border-color:", colors_values/* COLORS */.l.ui.borderHover, ";}&:focus-within{border-color:", colors_values/* COLORS */.l.ui.borderFocus, ";box-shadow:", config_values/* default */.A.controlBoxShadowFocus, ";z-index:1;outline:2px solid transparent;outline-offset:-2px;}" + ( true ? "" : 0), true ? "" : 0);
|
|
};
|
|
var _ref = true ? {
|
|
name: "1aqh2c7",
|
|
styles: "min-height:40px;padding:3px"
|
|
} : 0;
|
|
var _ref2 = true ? {
|
|
name: "1ndywgm",
|
|
styles: "min-height:36px;padding:2px"
|
|
} : 0;
|
|
const toggleGroupControlSize = size => {
|
|
const styles = {
|
|
default: _ref2,
|
|
'__unstable-large': _ref
|
|
};
|
|
return styles[size];
|
|
};
|
|
const block = true ? {
|
|
name: "7whenc",
|
|
styles: "display:flex;width:100%"
|
|
} : 0;
|
|
const VisualLabelWrapper = /*#__PURE__*/(0,emotion_styled_base_browser_esm/* default */.A)("div", true ? {
|
|
target: "eakva830"
|
|
} : 0)( true ? {
|
|
name: "zjik7",
|
|
styles: "display:flex"
|
|
} : 0);
|
|
//# sourceMappingURL=styles.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/UVQLZ7T5.js + 1 modules
|
|
var UVQLZ7T5 = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/UVQLZ7T5.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/2GXGCHW6.js
|
|
var _2GXGCHW6 = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/2GXGCHW6.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/D7EIQZAU.js
|
|
var D7EIQZAU = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/D7EIQZAU.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/EQQLU3CG.js
|
|
var EQQLU3CG = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/EQQLU3CG.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js
|
|
var PBFD2E7P = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/3YLGPPWQ.js
|
|
var _3YLGPPWQ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/3YLGPPWQ.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/radio/radio-store.js
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// src/radio/radio-store.ts
|
|
function createRadioStore(_a = {}) {
|
|
var props = (0,_3YLGPPWQ/* __objRest */.YG)(_a, []);
|
|
var _a2;
|
|
const syncState = (_a2 = props.store) == null ? void 0 : _a2.getState();
|
|
const composite = (0,D7EIQZAU/* createCompositeStore */.z)((0,_3YLGPPWQ/* __spreadProps */.ko)((0,_3YLGPPWQ/* __spreadValues */.IA)({}, props), {
|
|
focusLoop: (0,PBFD2E7P/* defaultValue */.Jh)(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
|
|
}));
|
|
const initialState = (0,_3YLGPPWQ/* __spreadProps */.ko)((0,_3YLGPPWQ/* __spreadValues */.IA)({}, composite.getState()), {
|
|
value: (0,PBFD2E7P/* defaultValue */.Jh)(
|
|
props.value,
|
|
syncState == null ? void 0 : syncState.value,
|
|
props.defaultValue,
|
|
null
|
|
)
|
|
});
|
|
const radio = (0,EQQLU3CG/* createStore */.y$)(initialState, composite, props.store);
|
|
return (0,_3YLGPPWQ/* __spreadProps */.ko)((0,_3YLGPPWQ/* __spreadValues */.IA)((0,_3YLGPPWQ/* __spreadValues */.IA)({}, composite), radio), {
|
|
setValue: (value) => radio.setState("value", value)
|
|
});
|
|
}
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/DYHFBFEH.js
|
|
"use client";
|
|
|
|
|
|
|
|
// src/radio/radio-store.ts
|
|
|
|
function useRadioStoreProps(store, update, props) {
|
|
store = (0,UVQLZ7T5/* useCompositeStoreProps */.Y)(store, update, props);
|
|
(0,_2GXGCHW6/* useStoreProps */.Tz)(store, props, "value", "setValue");
|
|
return store;
|
|
}
|
|
function useRadioStore(props = {}) {
|
|
const [store, update] = (0,_2GXGCHW6/* useStore */.Pj)(createRadioStore, props);
|
|
return useRadioStoreProps(store, update, props);
|
|
}
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/SOKV3TSX.js
|
|
var SOKV3TSX = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/SOKV3TSX.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/TW35PKTK.js
|
|
var TW35PKTK = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/TW35PKTK.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HKOOKEDE.js
|
|
var HKOOKEDE = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HKOOKEDE.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/Z32BISHQ.js
|
|
var Z32BISHQ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/Z32BISHQ.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js
|
|
var _chunks_3YLGPPWQ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/radio/radio-group.js
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// src/radio/radio-group.tsx
|
|
|
|
|
|
var TagName = "div";
|
|
var useRadioGroup = (0,HKOOKEDE/* createHook */.ab)(
|
|
function useRadioGroup2(_a) {
|
|
var _b = _a, { store } = _b, props = (0,_chunks_3YLGPPWQ/* __objRest */.YG)(_b, ["store"]);
|
|
const context = (0,SOKV3TSX/* useRadioProviderContext */.XF)();
|
|
store = store || context;
|
|
(0,PBFD2E7P/* invariant */.V1)(
|
|
store,
|
|
false && 0
|
|
);
|
|
props = (0,Z32BISHQ/* useWrapElement */.w7)(
|
|
props,
|
|
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(SOKV3TSX/* RadioScopedContextProvider */.aN, { value: store, children: element }),
|
|
[store]
|
|
);
|
|
props = (0,_chunks_3YLGPPWQ/* __spreadValues */.IA)({
|
|
role: "radiogroup"
|
|
}, props);
|
|
props = (0,TW35PKTK/* useComposite */.T)((0,_chunks_3YLGPPWQ/* __spreadValues */.IA)({ store }, props));
|
|
return props;
|
|
}
|
|
);
|
|
var RadioGroup = (0,HKOOKEDE/* forwardRef */.Rf)(function RadioGroup2(props) {
|
|
const htmlProps = useRadioGroup(props);
|
|
return (0,HKOOKEDE/* createElement */.n)(TagName, htmlProps);
|
|
});
|
|
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/view/component.js
|
|
var component = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/view/component.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/toggle-group-control/context.js
|
|
var context = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/toggle-group-control/context.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-previous/index.js
|
|
var use_previous = __webpack_require__("../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-previous/index.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control/utils.js
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
/**
|
|
* Used to determine, via an internal heuristics, whether an `undefined` value
|
|
* received for the `value` prop should be interpreted as the component being
|
|
* used in uncontrolled mode, or as an "empty" value for controlled mode.
|
|
*
|
|
* @param valueProp The received `value`
|
|
*/
|
|
function useComputeControlledOrUncontrolledValue(valueProp) {
|
|
const isInitialRenderRef = (0,react.useRef)(true);
|
|
const prevValueProp = (0,use_previous/* default */.A)(valueProp);
|
|
const prevIsControlledRef = (0,react.useRef)(false);
|
|
(0,react.useEffect)(() => {
|
|
if (isInitialRenderRef.current) {
|
|
isInitialRenderRef.current = false;
|
|
}
|
|
}, []);
|
|
|
|
// Assume the component is being used in controlled mode on the first re-render
|
|
// that has a different `valueProp` from the previous render.
|
|
const isControlled = prevIsControlledRef.current || !isInitialRenderRef.current && prevValueProp !== valueProp;
|
|
(0,react.useEffect)(() => {
|
|
prevIsControlledRef.current = isControlled;
|
|
}, [isControlled]);
|
|
if (isControlled) {
|
|
// When in controlled mode, use `''` instead of `undefined`
|
|
return {
|
|
value: valueProp !== null && valueProp !== void 0 ? valueProp : '',
|
|
defaultValue: undefined
|
|
};
|
|
}
|
|
|
|
// When in uncontrolled mode, the `value` should be intended as the initial value
|
|
return {
|
|
value: undefined,
|
|
defaultValue: valueProp
|
|
};
|
|
}
|
|
//# sourceMappingURL=utils.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control/as-radio-group.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
function UnforwardedToggleGroupControlAsRadioGroup({
|
|
children,
|
|
isAdaptiveWidth,
|
|
label,
|
|
onChange: onChangeProp,
|
|
size,
|
|
value: valueProp,
|
|
id: idProp,
|
|
...otherProps
|
|
}, forwardedRef) {
|
|
const generatedId = (0,use_instance_id/* default */.A)(ToggleGroupControlAsRadioGroup, 'toggle-group-control-as-radio-group');
|
|
const baseId = idProp || generatedId;
|
|
|
|
// Use a heuristic to understand if the component is being used in controlled
|
|
// or uncontrolled mode, and consequently:
|
|
// - when controlled, convert `undefined` values to `''` (ie. "no value")
|
|
// - use the `value` prop as the `defaultValue` when uncontrolled
|
|
const {
|
|
value,
|
|
defaultValue
|
|
} = useComputeControlledOrUncontrolledValue(valueProp);
|
|
|
|
// `useRadioStore`'s `setValue` prop can be called with `null`, while
|
|
// the component's `onChange` prop only expects `undefined`
|
|
const wrappedOnChangeProp = onChangeProp ? v => {
|
|
onChangeProp(v !== null && v !== void 0 ? v : undefined);
|
|
} : undefined;
|
|
const radio = useRadioStore({
|
|
defaultValue,
|
|
value,
|
|
setValue: wrappedOnChangeProp
|
|
});
|
|
const selectedValue = (0,_2GXGCHW6/* useStoreState */.O$)(radio, 'value');
|
|
const setValue = radio.setValue;
|
|
const groupContextValue = (0,react.useMemo)(() => ({
|
|
baseId,
|
|
isBlock: !isAdaptiveWidth,
|
|
size,
|
|
value: selectedValue,
|
|
setValue
|
|
}), [baseId, isAdaptiveWidth, size, selectedValue, setValue]);
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(context/* default */.A.Provider, {
|
|
value: groupContextValue,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RadioGroup, {
|
|
store: radio,
|
|
"aria-label": label,
|
|
render: /*#__PURE__*/(0,jsx_runtime.jsx)(component/* default */.A, {}),
|
|
...otherProps,
|
|
id: baseId,
|
|
ref: forwardedRef,
|
|
children: children
|
|
})
|
|
});
|
|
}
|
|
const ToggleGroupControlAsRadioGroup = (0,react.forwardRef)(UnforwardedToggleGroupControlAsRadioGroup);
|
|
//# sourceMappingURL=as-radio-group.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/hooks/use-controlled-value.js
|
|
var use_controlled_value = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/hooks/use-controlled-value.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control/as-button-group.js
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
function UnforwardedToggleGroupControlAsButtonGroup({
|
|
children,
|
|
isAdaptiveWidth,
|
|
label,
|
|
onChange,
|
|
size,
|
|
value: valueProp,
|
|
id: idProp,
|
|
...otherProps
|
|
}, forwardedRef) {
|
|
const generatedId = (0,use_instance_id/* default */.A)(ToggleGroupControlAsButtonGroup, 'toggle-group-control-as-button-group');
|
|
const baseId = idProp || generatedId;
|
|
|
|
// Use a heuristic to understand if the component is being used in controlled
|
|
// or uncontrolled mode, and consequently:
|
|
// - when controlled, convert `undefined` values to `''` (ie. "no value")
|
|
// - use the `value` prop as the `defaultValue` when uncontrolled
|
|
const {
|
|
value,
|
|
defaultValue
|
|
} = useComputeControlledOrUncontrolledValue(valueProp);
|
|
const [selectedValue, setSelectedValue] = (0,use_controlled_value/* useControlledValue */.j)({
|
|
defaultValue,
|
|
value,
|
|
onChange
|
|
});
|
|
const groupContextValue = (0,react.useMemo)(() => ({
|
|
baseId,
|
|
value: selectedValue,
|
|
setValue: setSelectedValue,
|
|
isBlock: !isAdaptiveWidth,
|
|
isDeselectable: true,
|
|
size
|
|
}), [baseId, selectedValue, setSelectedValue, isAdaptiveWidth, size]);
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(context/* default */.A.Provider, {
|
|
value: groupContextValue,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(component/* default */.A, {
|
|
"aria-label": label,
|
|
...otherProps,
|
|
ref: forwardedRef,
|
|
role: "group",
|
|
children: children
|
|
})
|
|
});
|
|
}
|
|
const ToggleGroupControlAsButtonGroup = (0,react.forwardRef)(UnforwardedToggleGroupControlAsButtonGroup);
|
|
//# sourceMappingURL=as-button-group.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control/component.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function UnconnectedToggleGroupControl(props, forwardedRef) {
|
|
const {
|
|
__nextHasNoMarginBottom = false,
|
|
__next40pxDefaultSize = false,
|
|
className,
|
|
isAdaptiveWidth = false,
|
|
isBlock = false,
|
|
isDeselectable = false,
|
|
label,
|
|
hideLabelFromVision = false,
|
|
help,
|
|
onChange,
|
|
size = 'default',
|
|
value,
|
|
children,
|
|
...otherProps
|
|
} = (0,use_context_system/* useContextSystem */.A)(props, 'ToggleGroupControl');
|
|
const baseId = (0,use_instance_id/* default */.A)(ToggleGroupControl, 'toggle-group-control');
|
|
const normalizedSize = __next40pxDefaultSize && size === 'default' ? '__unstable-large' : size;
|
|
const cx = (0,use_cx/* useCx */.l)();
|
|
const classes = (0,react.useMemo)(() => cx(toggleGroupControl({
|
|
isBlock,
|
|
isDeselectable,
|
|
size: normalizedSize
|
|
}), isBlock && block, className), [className, cx, isBlock, isDeselectable, normalizedSize]);
|
|
const MainControl = isDeselectable ? ToggleGroupControlAsButtonGroup : ToggleGroupControlAsRadioGroup;
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(base_control/* default */.Ay, {
|
|
help: help,
|
|
__nextHasNoMarginBottom: __nextHasNoMarginBottom,
|
|
__associatedWPComponentName: "ToggleGroupControl",
|
|
children: [!hideLabelFromVision && /*#__PURE__*/(0,jsx_runtime.jsx)(VisualLabelWrapper, {
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(base_control/* default.VisualLabel */.Ay.VisualLabel, {
|
|
children: label
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(MainControl, {
|
|
...otherProps,
|
|
className: classes,
|
|
isAdaptiveWidth: isAdaptiveWidth,
|
|
label: label,
|
|
onChange: onChange,
|
|
ref: forwardedRef,
|
|
size: normalizedSize,
|
|
value: value,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(LayoutGroup, {
|
|
id: baseId,
|
|
children: children
|
|
})
|
|
})]
|
|
});
|
|
}
|
|
|
|
/**
|
|
* `ToggleGroupControl` is a form component that lets users choose options
|
|
* represented in horizontal segments. To render options for this control use
|
|
* `ToggleGroupControlOption` component.
|
|
*
|
|
* This component is intended for selecting a single persistent value from a set of options,
|
|
* similar to a how a radio button group would work. If you simply want a toggle to switch between views,
|
|
* use a `TabPanel` instead.
|
|
*
|
|
* Only use this control when you know for sure the labels of items inside won't
|
|
* wrap. For items with longer labels, you can consider a `SelectControl` or a
|
|
* `CustomSelectControl` component instead.
|
|
*
|
|
* ```jsx
|
|
* import {
|
|
* __experimentalToggleGroupControl as ToggleGroupControl,
|
|
* __experimentalToggleGroupControlOption as ToggleGroupControlOption,
|
|
* } from '@wordpress/components';
|
|
*
|
|
* function Example() {
|
|
* return (
|
|
* <ToggleGroupControl
|
|
* label="my label"
|
|
* value="vertical"
|
|
* isBlock
|
|
* __nextHasNoMarginBottom
|
|
* >
|
|
* <ToggleGroupControlOption value="horizontal" label="Horizontal" />
|
|
* <ToggleGroupControlOption value="vertical" label="Vertical" />
|
|
* </ToggleGroupControl>
|
|
* );
|
|
* }
|
|
* ```
|
|
*/
|
|
const ToggleGroupControl = (0,context_connect/* contextConnect */.KZ)(UnconnectedToggleGroupControl, 'ToggleGroupControl');
|
|
/* harmony default export */ const toggle_group_control_component = (ToggleGroupControl);
|
|
//# sourceMappingURL=component.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/tooltip/index.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
Ay: () => (/* binding */ tooltip)
|
|
});
|
|
|
|
// UNUSED EXPORTS: TOOLTIP_DELAY, Tooltip
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/XMDAT5SM.js
|
|
var XMDAT5SM = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/XMDAT5SM.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/2GXGCHW6.js
|
|
var _2GXGCHW6 = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/2GXGCHW6.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/EACLTACN.js
|
|
var EACLTACN = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/EACLTACN.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/EQQLU3CG.js
|
|
var EQQLU3CG = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/EQQLU3CG.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js
|
|
var PBFD2E7P = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/3YLGPPWQ.js
|
|
var _3YLGPPWQ = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/3YLGPPWQ.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/tooltip/tooltip-store.js
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// src/tooltip/tooltip-store.ts
|
|
function createTooltipStore(props = {}) {
|
|
var _a;
|
|
if (false) {}
|
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
const hovercard = (0,EACLTACN/* createHovercardStore */.y)((0,_3YLGPPWQ/* __spreadProps */.ko)((0,_3YLGPPWQ/* __spreadValues */.IA)({}, props), {
|
|
placement: (0,PBFD2E7P/* defaultValue */.Jh)(
|
|
props.placement,
|
|
syncState == null ? void 0 : syncState.placement,
|
|
"top"
|
|
),
|
|
hideTimeout: (0,PBFD2E7P/* defaultValue */.Jh)(props.hideTimeout, syncState == null ? void 0 : syncState.hideTimeout, 0)
|
|
}));
|
|
const initialState = (0,_3YLGPPWQ/* __spreadProps */.ko)((0,_3YLGPPWQ/* __spreadValues */.IA)({}, hovercard.getState()), {
|
|
type: (0,PBFD2E7P/* defaultValue */.Jh)(props.type, syncState == null ? void 0 : syncState.type, "description"),
|
|
skipTimeout: (0,PBFD2E7P/* defaultValue */.Jh)(props.skipTimeout, syncState == null ? void 0 : syncState.skipTimeout, 300)
|
|
});
|
|
const tooltip = (0,EQQLU3CG/* createStore */.y$)(initialState, hovercard, props.store);
|
|
return (0,_3YLGPPWQ/* __spreadValues */.IA)((0,_3YLGPPWQ/* __spreadValues */.IA)({}, hovercard), tooltip);
|
|
}
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/2D53SX6Q.js
|
|
"use client";
|
|
|
|
|
|
|
|
// src/tooltip/tooltip-store.ts
|
|
|
|
function useTooltipStoreProps(store, update, props) {
|
|
(0,_2GXGCHW6/* useStoreProps */.Tz)(store, props, "type");
|
|
(0,_2GXGCHW6/* useStoreProps */.Tz)(store, props, "skipTimeout");
|
|
return (0,XMDAT5SM/* useHovercardStoreProps */.B)(store, update, props);
|
|
}
|
|
function useTooltipStore(props = {}) {
|
|
const [store, update] = (0,_2GXGCHW6/* useStore */.Pj)(createTooltipStore, props);
|
|
return useTooltipStoreProps(store, update, props);
|
|
}
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/AXRBYZQP.js
|
|
var AXRBYZQP = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/AXRBYZQP.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/QA27FYGF.js
|
|
var QA27FYGF = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/QA27FYGF.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/CTQR3VDU.js
|
|
var CTQR3VDU = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/CTQR3VDU.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HKOOKEDE.js
|
|
var HKOOKEDE = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HKOOKEDE.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/TWCRTUOB.js
|
|
"use client";
|
|
|
|
|
|
|
|
// src/tooltip/tooltip-context.tsx
|
|
var ctx = (0,HKOOKEDE/* createStoreContext */.B0)(
|
|
[CTQR3VDU/* HovercardContextProvider */.pR],
|
|
[CTQR3VDU/* HovercardScopedContextProvider */.n0]
|
|
);
|
|
var useTooltipContext = ctx.useContext;
|
|
var useTooltipScopedContext = ctx.useScopedContext;
|
|
var useTooltipProviderContext = ctx.useProviderContext;
|
|
var TooltipContextProvider = ctx.ContextProvider;
|
|
var TooltipScopedContextProvider = ctx.ScopedContextProvider;
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/Z32BISHQ.js
|
|
var Z32BISHQ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/Z32BISHQ.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js
|
|
var _chunks_3YLGPPWQ = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js
|
|
var react = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/tooltip/tooltip-anchor.js
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// src/tooltip/tooltip-anchor.tsx
|
|
|
|
|
|
|
|
var TagName = "div";
|
|
var globalStore = (0,EQQLU3CG/* createStore */.y$)({
|
|
activeStore: null
|
|
});
|
|
function createRemoveStoreCallback(store) {
|
|
return () => {
|
|
const { activeStore } = globalStore.getState();
|
|
if (activeStore !== store) return;
|
|
globalStore.setState("activeStore", null);
|
|
};
|
|
}
|
|
var useTooltipAnchor = (0,HKOOKEDE/* createHook */.ab)(
|
|
function useTooltipAnchor2(_a) {
|
|
var _b = _a, { store, showOnHover = true } = _b, props = (0,_chunks_3YLGPPWQ/* __objRest */.YG)(_b, ["store", "showOnHover"]);
|
|
const context = useTooltipProviderContext();
|
|
store = store || context;
|
|
(0,PBFD2E7P/* invariant */.V1)(
|
|
store,
|
|
false && 0
|
|
);
|
|
const canShowOnHoverRef = (0,react.useRef)(false);
|
|
(0,react.useEffect)(() => {
|
|
return (0,EQQLU3CG/* sync */.OH)(store, ["mounted"], (state) => {
|
|
if (state.mounted) return;
|
|
canShowOnHoverRef.current = false;
|
|
});
|
|
}, [store]);
|
|
(0,react.useEffect)(() => {
|
|
if (!store) return;
|
|
return (0,PBFD2E7P/* chain */.cy)(
|
|
// Immediately remove the current store from the global store when
|
|
// the component unmounts. This is useful, for example, to avoid
|
|
// showing tooltips immediately on serial tests.
|
|
createRemoveStoreCallback(store),
|
|
(0,EQQLU3CG/* sync */.OH)(store, ["mounted", "skipTimeout"], (state) => {
|
|
if (!store) return;
|
|
if (state.mounted) {
|
|
const { activeStore } = globalStore.getState();
|
|
if (activeStore !== store) {
|
|
activeStore == null ? void 0 : activeStore.hide();
|
|
}
|
|
return globalStore.setState("activeStore", store);
|
|
}
|
|
const id = setTimeout(
|
|
createRemoveStoreCallback(store),
|
|
state.skipTimeout
|
|
);
|
|
return () => clearTimeout(id);
|
|
})
|
|
);
|
|
}, [store]);
|
|
const onMouseEnterProp = props.onMouseEnter;
|
|
const onMouseEnter = (0,Z32BISHQ/* useEvent */._q)((event) => {
|
|
onMouseEnterProp == null ? void 0 : onMouseEnterProp(event);
|
|
canShowOnHoverRef.current = true;
|
|
});
|
|
const onFocusVisibleProp = props.onFocusVisible;
|
|
const onFocusVisible = (0,Z32BISHQ/* useEvent */._q)((event) => {
|
|
onFocusVisibleProp == null ? void 0 : onFocusVisibleProp(event);
|
|
if (event.defaultPrevented) return;
|
|
store == null ? void 0 : store.setAnchorElement(event.currentTarget);
|
|
store == null ? void 0 : store.show();
|
|
});
|
|
const onBlurProp = props.onBlur;
|
|
const onBlur = (0,Z32BISHQ/* useEvent */._q)((event) => {
|
|
onBlurProp == null ? void 0 : onBlurProp(event);
|
|
if (event.defaultPrevented) return;
|
|
const { activeStore } = globalStore.getState();
|
|
canShowOnHoverRef.current = false;
|
|
if (activeStore === store) {
|
|
globalStore.setState("activeStore", null);
|
|
}
|
|
});
|
|
const type = store.useState("type");
|
|
const contentId = store.useState((state) => {
|
|
var _a2;
|
|
return (_a2 = state.contentElement) == null ? void 0 : _a2.id;
|
|
});
|
|
props = (0,_chunks_3YLGPPWQ/* __spreadProps */.ko)((0,_chunks_3YLGPPWQ/* __spreadValues */.IA)({
|
|
"aria-labelledby": type === "label" ? contentId : void 0
|
|
}, props), {
|
|
onMouseEnter,
|
|
onFocusVisible,
|
|
onBlur
|
|
});
|
|
props = (0,QA27FYGF/* useHovercardAnchor */.p)((0,_chunks_3YLGPPWQ/* __spreadValues */.IA)({
|
|
store,
|
|
showOnHover(event) {
|
|
if (!canShowOnHoverRef.current) return false;
|
|
if ((0,PBFD2E7P/* isFalsyBooleanCallback */.zO)(showOnHover, event)) return false;
|
|
const { activeStore } = globalStore.getState();
|
|
if (!activeStore) return true;
|
|
store == null ? void 0 : store.show();
|
|
return false;
|
|
}
|
|
}, props));
|
|
return props;
|
|
}
|
|
);
|
|
var TooltipAnchor = (0,HKOOKEDE/* forwardRef */.Rf)(function TooltipAnchor2(props) {
|
|
const htmlProps = useTooltipAnchor(props);
|
|
return (0,HKOOKEDE/* createElement */.n)(TagName, htmlProps);
|
|
});
|
|
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HQFKUKP3.js + 2 modules
|
|
var HQFKUKP3 = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/HQFKUKP3.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/TT2355LN.js + 21 modules
|
|
var TT2355LN = __webpack_require__("../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/__chunks/TT2355LN.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/HWOIWM4O.js
|
|
var HWOIWM4O = __webpack_require__("../../node_modules/.pnpm/@ariakit+core@0.4.9/node_modules/@ariakit/core/esm/__chunks/HWOIWM4O.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@ariakit+react-core@0.4.10_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@ariakit/react-core/esm/tooltip/tooltip.js
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// src/tooltip/tooltip.tsx
|
|
|
|
|
|
|
|
var tooltip_TagName = "div";
|
|
var useTooltip = (0,HKOOKEDE/* createHook */.ab)(
|
|
function useTooltip2(_a) {
|
|
var _b = _a, {
|
|
store,
|
|
portal = true,
|
|
gutter = 8,
|
|
preserveTabOrder = false,
|
|
hideOnHoverOutside = true,
|
|
hideOnInteractOutside = true
|
|
} = _b, props = (0,_chunks_3YLGPPWQ/* __objRest */.YG)(_b, [
|
|
"store",
|
|
"portal",
|
|
"gutter",
|
|
"preserveTabOrder",
|
|
"hideOnHoverOutside",
|
|
"hideOnInteractOutside"
|
|
]);
|
|
const context = useTooltipProviderContext();
|
|
store = store || context;
|
|
(0,PBFD2E7P/* invariant */.V1)(
|
|
store,
|
|
false && 0
|
|
);
|
|
props = (0,Z32BISHQ/* useWrapElement */.w7)(
|
|
props,
|
|
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(TooltipScopedContextProvider, { value: store, children: element }),
|
|
[store]
|
|
);
|
|
const role = store.useState(
|
|
(state) => state.type === "description" ? "tooltip" : "none"
|
|
);
|
|
props = (0,_chunks_3YLGPPWQ/* __spreadValues */.IA)({ role }, props);
|
|
props = (0,HQFKUKP3/* useHovercard */.a)((0,_chunks_3YLGPPWQ/* __spreadProps */.ko)((0,_chunks_3YLGPPWQ/* __spreadValues */.IA)({}, props), {
|
|
store,
|
|
portal,
|
|
gutter,
|
|
preserveTabOrder,
|
|
hideOnHoverOutside(event) {
|
|
if ((0,PBFD2E7P/* isFalsyBooleanCallback */.zO)(hideOnHoverOutside, event)) return false;
|
|
const anchorElement = store == null ? void 0 : store.getState().anchorElement;
|
|
if (!anchorElement) return true;
|
|
if ("focusVisible" in anchorElement.dataset) return false;
|
|
return true;
|
|
},
|
|
hideOnInteractOutside: (event) => {
|
|
if ((0,PBFD2E7P/* isFalsyBooleanCallback */.zO)(hideOnInteractOutside, event)) return false;
|
|
const anchorElement = store == null ? void 0 : store.getState().anchorElement;
|
|
if (!anchorElement) return true;
|
|
if ((0,HWOIWM4O/* contains */.gR)(anchorElement, event.target)) return false;
|
|
return true;
|
|
}
|
|
}));
|
|
return props;
|
|
}
|
|
);
|
|
var Tooltip = (0,TT2355LN/* createDialogComponent */.AV)(
|
|
(0,HKOOKEDE/* forwardRef */.Rf)(function Tooltip2(props) {
|
|
const htmlProps = useTooltip(props);
|
|
return (0,HKOOKEDE/* createElement */.n)(tooltip_TagName, htmlProps);
|
|
}),
|
|
useTooltipProviderContext
|
|
);
|
|
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
var clsx = __webpack_require__("../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-instance-id/index.js
|
|
var use_instance_id = __webpack_require__("../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-instance-id/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+deprecated@4.7.0/node_modules/@wordpress/deprecated/build-module/index.js
|
|
var build_module = __webpack_require__("../../node_modules/.pnpm/@wordpress+deprecated@4.7.0/node_modules/@wordpress/deprecated/build-module/index.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/shortcut/index.js
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
/**
|
|
* Shortcut component is used to display keyboard shortcuts, and it can be customized with a custom display and aria label if needed.
|
|
*
|
|
* ```jsx
|
|
* import { Shortcut } from '@wordpress/components';
|
|
*
|
|
* const MyShortcut = () => {
|
|
* return (
|
|
* <Shortcut shortcut={{ display: 'Ctrl + S', ariaLabel: 'Save' }} />
|
|
* );
|
|
* };
|
|
* ```
|
|
*/
|
|
function Shortcut(props) {
|
|
const {
|
|
shortcut,
|
|
className
|
|
} = props;
|
|
if (!shortcut) {
|
|
return null;
|
|
}
|
|
let displayText;
|
|
let ariaLabel;
|
|
if (typeof shortcut === 'string') {
|
|
displayText = shortcut;
|
|
}
|
|
if (shortcut !== null && typeof shortcut === 'object') {
|
|
displayText = shortcut.display;
|
|
ariaLabel = shortcut.ariaLabel;
|
|
}
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: className,
|
|
"aria-label": ariaLabel,
|
|
children: displayText
|
|
});
|
|
}
|
|
/* harmony default export */ const build_module_shortcut = (Shortcut);
|
|
//# sourceMappingURL=index.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/popover/utils.js
|
|
var utils = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/popover/utils.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/tooltip/index.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
const TooltipInternalContext = (0,react.createContext)({
|
|
isNestedInTooltip: false
|
|
});
|
|
|
|
/**
|
|
* Time over anchor to wait before showing tooltip
|
|
*/
|
|
const TOOLTIP_DELAY = 700;
|
|
const CONTEXT_VALUE = {
|
|
isNestedInTooltip: true
|
|
};
|
|
function UnforwardedTooltip(props, ref) {
|
|
const {
|
|
children,
|
|
className,
|
|
delay = TOOLTIP_DELAY,
|
|
hideOnClick = true,
|
|
placement,
|
|
position,
|
|
shortcut,
|
|
text,
|
|
...restProps
|
|
} = props;
|
|
const {
|
|
isNestedInTooltip
|
|
} = (0,react.useContext)(TooltipInternalContext);
|
|
const baseId = (0,use_instance_id/* default */.A)(tooltip_Tooltip, 'tooltip');
|
|
const describedById = text || shortcut ? baseId : undefined;
|
|
const isOnlyChild = react.Children.count(children) === 1;
|
|
// console error if more than one child element is added
|
|
if (!isOnlyChild) {
|
|
if (false) {}
|
|
}
|
|
|
|
// Compute tooltip's placement:
|
|
// - give priority to `placement` prop, if defined
|
|
// - otherwise, compute it from the legacy `position` prop (if defined)
|
|
// - finally, fallback to the default placement: 'bottom'
|
|
let computedPlacement;
|
|
if (placement !== undefined) {
|
|
computedPlacement = placement;
|
|
} else if (position !== undefined) {
|
|
computedPlacement = (0,utils/* positionToPlacement */.YK)(position);
|
|
(0,build_module/* default */.A)('`position` prop in wp.components.tooltip', {
|
|
since: '6.4',
|
|
alternative: '`placement` prop'
|
|
});
|
|
}
|
|
computedPlacement = computedPlacement || 'bottom';
|
|
const tooltipStore = useTooltipStore({
|
|
placement: computedPlacement,
|
|
showTimeout: delay
|
|
});
|
|
const mounted = (0,_2GXGCHW6/* useStoreState */.O$)(tooltipStore, 'mounted');
|
|
if (isNestedInTooltip) {
|
|
return isOnlyChild ? /*#__PURE__*/(0,jsx_runtime.jsx)(AXRBYZQP/* Role */.X, {
|
|
...restProps,
|
|
render: children
|
|
}) : children;
|
|
}
|
|
|
|
// TODO: this is a temporary workaround to minimize the effects of the
|
|
// Ariakit upgrade. Ariakit doesn't pass the `aria-describedby` prop to
|
|
// the tooltip anchor anymore since 0.4.0, so we need to add it manually.
|
|
// See: https://github.com/WordPress/gutenberg/pull/64066
|
|
function addDescribedById(element) {
|
|
return describedById && mounted ? (0,react.cloneElement)(element, {
|
|
'aria-describedby': describedById
|
|
}) : element;
|
|
}
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(TooltipInternalContext.Provider, {
|
|
value: CONTEXT_VALUE,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(TooltipAnchor, {
|
|
onClick: hideOnClick ? tooltipStore.hide : undefined,
|
|
store: tooltipStore,
|
|
render: isOnlyChild ? addDescribedById(children) : undefined,
|
|
ref: ref,
|
|
children: isOnlyChild ? undefined : children
|
|
}), isOnlyChild && (text || shortcut) && /*#__PURE__*/(0,jsx_runtime.jsxs)(Tooltip, {
|
|
...restProps,
|
|
className: (0,clsx/* default */.A)('components-tooltip', className),
|
|
unmountOnHide: true,
|
|
gutter: 4,
|
|
id: describedById,
|
|
overflowPadding: 0.5,
|
|
store: tooltipStore,
|
|
children: [text, shortcut && /*#__PURE__*/(0,jsx_runtime.jsx)(build_module_shortcut, {
|
|
className: text ? 'components-tooltip__shortcut' : '',
|
|
shortcut: shortcut
|
|
})]
|
|
})]
|
|
});
|
|
}
|
|
const tooltip_Tooltip = (0,react.forwardRef)(UnforwardedTooltip);
|
|
/* harmony default export */ const tooltip = (tooltip_Tooltip);
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/truncate/hook.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
A: () => (/* binding */ useTruncate)
|
|
});
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2/node_modules/@emotion/react/dist/emotion-react.browser.esm.js
|
|
var emotion_react_browser_esm = __webpack_require__("../../node_modules/.pnpm/@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2/node_modules/@emotion/react/dist/emotion-react.browser.esm.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js
|
|
var react = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js + 1 modules
|
|
var use_context_system = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/truncate/styles.js
|
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
const Truncate = true ? {
|
|
name: "hdknak",
|
|
styles: "display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap"
|
|
} : 0;
|
|
//# sourceMappingURL=styles.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/values.js
|
|
var values = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/values.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/truncate/utils.js
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
const TRUNCATE_ELLIPSIS = '…';
|
|
const TRUNCATE_TYPE = {
|
|
auto: 'auto',
|
|
head: 'head',
|
|
middle: 'middle',
|
|
tail: 'tail',
|
|
none: 'none'
|
|
};
|
|
const TRUNCATE_DEFAULT_PROPS = {
|
|
ellipsis: TRUNCATE_ELLIPSIS,
|
|
ellipsizeMode: TRUNCATE_TYPE.auto,
|
|
limit: 0,
|
|
numberOfLines: 0
|
|
};
|
|
|
|
// Source
|
|
// https://github.com/kahwee/truncate-middle
|
|
function truncateMiddle(word, headLength, tailLength, ellipsis) {
|
|
if (typeof word !== 'string') {
|
|
return '';
|
|
}
|
|
const wordLength = word.length;
|
|
// Setting default values
|
|
// eslint-disable-next-line no-bitwise
|
|
const frontLength = ~~headLength; // Will cast to integer
|
|
// eslint-disable-next-line no-bitwise
|
|
const backLength = ~~tailLength;
|
|
/* istanbul ignore next */
|
|
const truncateStr = (0,values/* isValueDefined */.J5)(ellipsis) ? ellipsis : TRUNCATE_ELLIPSIS;
|
|
if (frontLength === 0 && backLength === 0 || frontLength >= wordLength || backLength >= wordLength || frontLength + backLength >= wordLength) {
|
|
return word;
|
|
} else if (backLength === 0) {
|
|
return word.slice(0, frontLength) + truncateStr;
|
|
}
|
|
return word.slice(0, frontLength) + truncateStr + word.slice(wordLength - backLength);
|
|
}
|
|
function truncateContent(words = '', props) {
|
|
const mergedProps = {
|
|
...TRUNCATE_DEFAULT_PROPS,
|
|
...props
|
|
};
|
|
const {
|
|
ellipsis,
|
|
ellipsizeMode,
|
|
limit
|
|
} = mergedProps;
|
|
if (ellipsizeMode === TRUNCATE_TYPE.none) {
|
|
return words;
|
|
}
|
|
let truncateHead;
|
|
let truncateTail;
|
|
switch (ellipsizeMode) {
|
|
case TRUNCATE_TYPE.head:
|
|
truncateHead = 0;
|
|
truncateTail = limit;
|
|
break;
|
|
case TRUNCATE_TYPE.middle:
|
|
truncateHead = Math.floor(limit / 2);
|
|
truncateTail = Math.floor(limit / 2);
|
|
break;
|
|
default:
|
|
truncateHead = limit;
|
|
truncateTail = 0;
|
|
}
|
|
const truncatedContent = ellipsizeMode !== TRUNCATE_TYPE.auto ? truncateMiddle(words, truncateHead, truncateTail, ellipsis) : words;
|
|
return truncatedContent;
|
|
}
|
|
//# sourceMappingURL=utils.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/hooks/use-cx.js
|
|
var use_cx = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/hooks/use-cx.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/truncate/hook.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
function useTruncate(props) {
|
|
const {
|
|
className,
|
|
children,
|
|
ellipsis = TRUNCATE_ELLIPSIS,
|
|
ellipsizeMode = TRUNCATE_TYPE.auto,
|
|
limit = 0,
|
|
numberOfLines = 0,
|
|
...otherProps
|
|
} = (0,use_context_system/* useContextSystem */.A)(props, 'Truncate');
|
|
const cx = (0,use_cx/* useCx */.l)();
|
|
let childrenAsText;
|
|
if (typeof children === 'string') {
|
|
childrenAsText = children;
|
|
} else if (typeof children === 'number') {
|
|
childrenAsText = children.toString();
|
|
}
|
|
const truncatedContent = childrenAsText ? truncateContent(childrenAsText, {
|
|
ellipsis,
|
|
ellipsizeMode,
|
|
limit,
|
|
numberOfLines
|
|
}) : children;
|
|
const shouldTruncate = !!childrenAsText && ellipsizeMode === TRUNCATE_TYPE.auto;
|
|
const classes = (0,react.useMemo)(() => {
|
|
// The `word-break: break-all` property first makes sure a text line
|
|
// breaks even when it contains 'unbreakable' content such as long URLs.
|
|
// See https://github.com/WordPress/gutenberg/issues/60860.
|
|
const truncateLines = /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)(numberOfLines === 1 ? 'word-break: break-all;' : '', " -webkit-box-orient:vertical;-webkit-line-clamp:", numberOfLines, ";display:-webkit-box;overflow:hidden;" + ( true ? "" : 0), true ? "" : 0);
|
|
return cx(shouldTruncate && !numberOfLines && Truncate, shouldTruncate && !!numberOfLines && truncateLines, className);
|
|
}, [className, cx, numberOfLines, shouldTruncate]);
|
|
return {
|
|
...otherProps,
|
|
className: classes,
|
|
children: truncatedContent
|
|
};
|
|
}
|
|
//# sourceMappingURL=hook.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/base-label.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ z: () => (/* binding */ baseLabelTypography)
|
|
/* harmony export */ });
|
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
// This is a very low-level mixin which you shouldn't have to use directly.
|
|
// Try to use BaseControl's StyledLabel or BaseControl.VisualLabel if you can.
|
|
const baseLabelTypography = true ? {
|
|
name: "9amh4a",
|
|
styles: "font-size:11px;font-weight:500;line-height:1.4;text-transform:uppercase"
|
|
} : 0;
|
|
//# sourceMappingURL=base-label.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/colors-values.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ l: () => (/* binding */ COLORS)
|
|
/* harmony export */ });
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
const white = '#fff';
|
|
|
|
// Matches the grays in @wordpress/base-styles
|
|
const GRAY = {
|
|
900: '#1e1e1e',
|
|
800: '#2f2f2f',
|
|
/** Meets 4.6:1 text contrast against white. */
|
|
700: '#757575',
|
|
/** Meets 3:1 UI or large text contrast against white. */
|
|
600: '#949494',
|
|
400: '#ccc',
|
|
/** Used for most borders. */
|
|
300: '#ddd',
|
|
/** Used sparingly for light borders. */
|
|
200: '#e0e0e0',
|
|
/** Used for light gray backgrounds. */
|
|
100: '#f0f0f0'
|
|
};
|
|
|
|
// Matches @wordpress/base-styles
|
|
const ALERT = {
|
|
yellow: '#f0b849',
|
|
red: '#d94f4f',
|
|
green: '#4ab866'
|
|
};
|
|
|
|
// Should match packages/components/src/utils/theme-variables.scss
|
|
const THEME = {
|
|
accent: `var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9))`,
|
|
accentDarker10: `var(--wp-components-color-accent-darker-10, var(--wp-admin-theme-color-darker-10, #2145e6))`,
|
|
accentDarker20: `var(--wp-components-color-accent-darker-20, var(--wp-admin-theme-color-darker-20, #183ad6))`,
|
|
/** Used when placing text on the accent color. */
|
|
accentInverted: `var(--wp-components-color-accent-inverted, ${white})`,
|
|
background: `var(--wp-components-color-background, ${white})`,
|
|
foreground: `var(--wp-components-color-foreground, ${GRAY[900]})`,
|
|
/** Used when placing text on the foreground color. */
|
|
foregroundInverted: `var(--wp-components-color-foreground-inverted, ${white})`,
|
|
gray: {
|
|
/** @deprecated Use `COLORS.theme.foreground` instead. */
|
|
900: `var(--wp-components-color-foreground, ${GRAY[900]})`,
|
|
800: `var(--wp-components-color-gray-800, ${GRAY[800]})`,
|
|
700: `var(--wp-components-color-gray-700, ${GRAY[700]})`,
|
|
600: `var(--wp-components-color-gray-600, ${GRAY[600]})`,
|
|
400: `var(--wp-components-color-gray-400, ${GRAY[400]})`,
|
|
300: `var(--wp-components-color-gray-300, ${GRAY[300]})`,
|
|
200: `var(--wp-components-color-gray-200, ${GRAY[200]})`,
|
|
100: `var(--wp-components-color-gray-100, ${GRAY[100]})`
|
|
}
|
|
};
|
|
const UI = {
|
|
background: THEME.background,
|
|
backgroundDisabled: THEME.gray[100],
|
|
border: THEME.gray[600],
|
|
borderHover: THEME.gray[700],
|
|
borderFocus: THEME.accent,
|
|
borderDisabled: THEME.gray[400],
|
|
textDisabled: THEME.gray[600],
|
|
// Matches @wordpress/base-styles
|
|
darkGrayPlaceholder: `color-mix(in srgb, ${THEME.foreground}, transparent 38%)`,
|
|
lightGrayPlaceholder: `color-mix(in srgb, ${THEME.background}, transparent 35%)`
|
|
};
|
|
const COLORS = Object.freeze({
|
|
/**
|
|
* The main gray color object.
|
|
*
|
|
* @deprecated Use semantic aliases in `COLORS.ui` or theme-ready variables in `COLORS.theme.gray`.
|
|
*/
|
|
gray: GRAY,
|
|
// TODO: Stop exporting this when everything is migrated to `theme` or `ui`
|
|
white,
|
|
alert: ALERT,
|
|
/**
|
|
* Theme-ready variables with fallbacks.
|
|
*
|
|
* Prefer semantic aliases in `COLORS.ui` when applicable.
|
|
*/
|
|
theme: THEME,
|
|
/**
|
|
* Semantic aliases (prefer these over raw variables when applicable).
|
|
*/
|
|
ui: UI
|
|
});
|
|
/* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = ((/* unused pure expression or super */ null && (COLORS)));
|
|
//# sourceMappingURL=colors-values.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/config-values.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _space__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/space.js");
|
|
/* harmony import */ var _colors_values__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/colors-values.js");
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
const CONTROL_HEIGHT = '36px';
|
|
const CONTROL_PROPS = {
|
|
controlSurfaceColor: _colors_values__WEBPACK_IMPORTED_MODULE_0__/* .COLORS */ .l.white,
|
|
controlTextActiveColor: _colors_values__WEBPACK_IMPORTED_MODULE_0__/* .COLORS */ .l.theme.accent,
|
|
// These values should be shared with TextControl.
|
|
controlPaddingX: 12,
|
|
controlPaddingXSmall: 8,
|
|
controlPaddingXLarge: 12 * 1.3334,
|
|
// TODO: Deprecate
|
|
|
|
controlBackgroundColor: _colors_values__WEBPACK_IMPORTED_MODULE_0__/* .COLORS */ .l.white,
|
|
controlBoxShadow: 'transparent',
|
|
controlBoxShadowFocus: `0 0 0 0.5px ${_colors_values__WEBPACK_IMPORTED_MODULE_0__/* .COLORS */ .l.theme.accent}`,
|
|
controlDestructiveBorderColor: _colors_values__WEBPACK_IMPORTED_MODULE_0__/* .COLORS */ .l.alert.red,
|
|
controlHeight: CONTROL_HEIGHT,
|
|
controlHeightXSmall: `calc( ${CONTROL_HEIGHT} * 0.6 )`,
|
|
controlHeightSmall: `calc( ${CONTROL_HEIGHT} * 0.8 )`,
|
|
controlHeightLarge: `calc( ${CONTROL_HEIGHT} * 1.2 )`,
|
|
controlHeightXLarge: `calc( ${CONTROL_HEIGHT} * 1.4 )`
|
|
};
|
|
const TOGGLE_GROUP_CONTROL_PROPS = {
|
|
toggleGroupControlBackgroundColor: CONTROL_PROPS.controlBackgroundColor,
|
|
toggleGroupControlBorderColor: _colors_values__WEBPACK_IMPORTED_MODULE_0__/* .COLORS */ .l.ui.border,
|
|
toggleGroupControlBackdropBackgroundColor: CONTROL_PROPS.controlSurfaceColor,
|
|
toggleGroupControlBackdropBorderColor: _colors_values__WEBPACK_IMPORTED_MODULE_0__/* .COLORS */ .l.ui.border,
|
|
toggleGroupControlButtonColorActive: CONTROL_PROPS.controlBackgroundColor
|
|
};
|
|
|
|
// Using Object.assign to avoid creating circular references when emitting
|
|
// TypeScript type declarations.
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Object.assign({}, CONTROL_PROPS, TOGGLE_GROUP_CONTROL_PROPS, {
|
|
colorDivider: 'rgba(0, 0, 0, 0.1)',
|
|
colorScrollbarThumb: 'rgba(0, 0, 0, 0.2)',
|
|
colorScrollbarThumbHover: 'rgba(0, 0, 0, 0.5)',
|
|
colorScrollbarTrack: 'rgba(0, 0, 0, 0.04)',
|
|
elevationIntensity: 1,
|
|
radiusXSmall: '1px',
|
|
radiusSmall: '2px',
|
|
radiusMedium: '4px',
|
|
radiusLarge: '8px',
|
|
radiusFull: '9999px',
|
|
radiusRound: '50%',
|
|
borderWidth: '1px',
|
|
borderWidthFocus: '1.5px',
|
|
borderWidthTab: '4px',
|
|
spinnerSize: 16,
|
|
fontSize: '13px',
|
|
fontSizeH1: 'calc(2.44 * 13px)',
|
|
fontSizeH2: 'calc(1.95 * 13px)',
|
|
fontSizeH3: 'calc(1.56 * 13px)',
|
|
fontSizeH4: 'calc(1.25 * 13px)',
|
|
fontSizeH5: '13px',
|
|
fontSizeH6: 'calc(0.8 * 13px)',
|
|
fontSizeInputMobile: '16px',
|
|
fontSizeMobile: '15px',
|
|
fontSizeSmall: 'calc(0.92 * 13px)',
|
|
fontSizeXSmall: 'calc(0.75 * 13px)',
|
|
fontLineHeightBase: '1.4',
|
|
fontWeight: 'normal',
|
|
fontWeightHeading: '600',
|
|
gridBase: '4px',
|
|
cardBorderRadius: '2px',
|
|
cardPaddingXSmall: `${(0,_space__WEBPACK_IMPORTED_MODULE_1__/* .space */ .x)(2)}`,
|
|
cardPaddingSmall: `${(0,_space__WEBPACK_IMPORTED_MODULE_1__/* .space */ .x)(4)}`,
|
|
cardPaddingMedium: `${(0,_space__WEBPACK_IMPORTED_MODULE_1__/* .space */ .x)(4)} ${(0,_space__WEBPACK_IMPORTED_MODULE_1__/* .space */ .x)(6)}`,
|
|
cardPaddingLarge: `${(0,_space__WEBPACK_IMPORTED_MODULE_1__/* .space */ .x)(6)} ${(0,_space__WEBPACK_IMPORTED_MODULE_1__/* .space */ .x)(8)}`,
|
|
elevationXSmall: `0 0.7px 1px rgba(0, 0, 0, 0.1), 0 1.2px 1.7px -0.2px rgba(0, 0, 0, 0.1), 0 2.3px 3.3px -0.5px rgba(0, 0, 0, 0.1)`,
|
|
elevationSmall: `0 0.7px 1px 0 rgba(0, 0, 0, 0.12), 0 2.2px 3.7px -0.2px rgba(0, 0, 0, 0.12), 0 5.3px 7.3px -0.5px rgba(0, 0, 0, 0.12)`,
|
|
elevationMedium: `0 0.7px 1px 0 rgba(0, 0, 0, 0.14), 0 4.2px 5.7px -0.2px rgba(0, 0, 0, 0.14), 0 7.3px 9.3px -0.5px rgba(0, 0, 0, 0.14)`,
|
|
elevationLarge: `0 0.7px 1px rgba(0, 0, 0, 0.15), 0 2.7px 3.8px -0.2px rgba(0, 0, 0, 0.15), 0 5.5px 7.8px -0.3px rgba(0, 0, 0, 0.15), 0.1px 11.5px 16.4px -0.5px rgba(0, 0, 0, 0.15)`,
|
|
surfaceBackgroundColor: _colors_values__WEBPACK_IMPORTED_MODULE_0__/* .COLORS */ .l.white,
|
|
surfaceBackgroundSubtleColor: '#F3F3F3',
|
|
surfaceBackgroundTintColor: '#F5F5F5',
|
|
surfaceBorderColor: 'rgba(0, 0, 0, 0.1)',
|
|
surfaceBorderBoldColor: 'rgba(0, 0, 0, 0.15)',
|
|
surfaceBorderSubtleColor: 'rgba(0, 0, 0, 0.05)',
|
|
surfaceBackgroundTertiaryColor: _colors_values__WEBPACK_IMPORTED_MODULE_0__/* .COLORS */ .l.white,
|
|
surfaceColor: _colors_values__WEBPACK_IMPORTED_MODULE_0__/* .COLORS */ .l.white,
|
|
transitionDuration: '200ms',
|
|
transitionDurationFast: '160ms',
|
|
transitionDurationFaster: '120ms',
|
|
transitionDurationFastest: '100ms',
|
|
transitionTimingFunction: 'cubic-bezier(0.08, 0.52, 0.52, 1)',
|
|
transitionTimingFunctionControl: 'cubic-bezier(0.12, 0.8, 0.32, 1)'
|
|
}));
|
|
//# sourceMappingURL=config-values.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/font-size.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ fM: () => (/* binding */ getHeadingFontSize),
|
|
/* harmony export */ ny: () => (/* binding */ getFontSize)
|
|
/* harmony export */ });
|
|
/* unused harmony exports BASE_FONT_SIZE, PRESET_FONT_SIZES, HEADING_FONT_SIZES */
|
|
/* harmony import */ var _config_values__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/config-values.js");
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
const BASE_FONT_SIZE = 13;
|
|
const PRESET_FONT_SIZES = {
|
|
body: BASE_FONT_SIZE,
|
|
caption: 10,
|
|
footnote: 11,
|
|
largeTitle: 28,
|
|
subheadline: 12,
|
|
title: 20
|
|
};
|
|
const HEADING_FONT_SIZES = [1, 2, 3, 4, 5, 6].flatMap(n => [n, n.toString()]);
|
|
function getFontSize(size = BASE_FONT_SIZE) {
|
|
if (size in PRESET_FONT_SIZES) {
|
|
return getFontSize(PRESET_FONT_SIZES[size]);
|
|
}
|
|
if (typeof size !== 'number') {
|
|
const parsed = parseFloat(size);
|
|
if (Number.isNaN(parsed)) {
|
|
return size;
|
|
}
|
|
size = parsed;
|
|
}
|
|
const ratio = `(${size} / ${BASE_FONT_SIZE})`;
|
|
return `calc(${ratio} * ${_config_values__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A.fontSize})`;
|
|
}
|
|
function getHeadingFontSize(size = 3) {
|
|
if (!HEADING_FONT_SIZES.includes(size)) {
|
|
return getFontSize(size);
|
|
}
|
|
const headingSize = `fontSizeH${size}`;
|
|
return _config_values__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A[headingSize];
|
|
}
|
|
//# sourceMappingURL=font-size.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/font.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
g: () => (/* binding */ font)
|
|
});
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/font-values.js
|
|
/* harmony default export */ const font_values = ({
|
|
'default.fontFamily': "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif",
|
|
'default.fontSize': '13px',
|
|
'helpText.fontSize': '12px',
|
|
mobileTextMinFontSize: '16px'
|
|
});
|
|
//# sourceMappingURL=font-values.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/font.js
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
*
|
|
* @param {keyof FONT} value Path of value from `FONT`
|
|
* @return {string} Font rule value
|
|
*/
|
|
function font(value) {
|
|
var _FONT$value;
|
|
return (_FONT$value = font_values[value]) !== null && _FONT$value !== void 0 ? _FONT$value : '';
|
|
}
|
|
//# sourceMappingURL=font.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/hooks/use-controlled-value.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ j: () => (/* binding */ useControlledValue)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
/**
|
|
* Simplified and improved implementation of useControlledState.
|
|
*
|
|
* @param props
|
|
* @param props.defaultValue
|
|
* @param props.value
|
|
* @param props.onChange
|
|
* @return The controlled value and the value setter.
|
|
*/
|
|
function useControlledValue({
|
|
defaultValue,
|
|
onChange,
|
|
value: valueProp
|
|
}) {
|
|
const hasValue = typeof valueProp !== 'undefined';
|
|
const initialValue = hasValue ? valueProp : defaultValue;
|
|
const [state, setState] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(initialValue);
|
|
const value = hasValue ? valueProp : state;
|
|
let setValue;
|
|
if (hasValue && typeof onChange === 'function') {
|
|
setValue = onChange;
|
|
} else if (!hasValue && typeof onChange === 'function') {
|
|
setValue = nextValue => {
|
|
onChange(nextValue);
|
|
setState(nextValue);
|
|
};
|
|
} else {
|
|
setValue = setState;
|
|
}
|
|
return [value, setValue];
|
|
}
|
|
//# sourceMappingURL=use-controlled-value.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/hooks/use-cx.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ l: () => (/* binding */ useCx)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _emotion_react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2/node_modules/@emotion/react/dist/emotion-element-c39617d8.browser.esm.js");
|
|
/* harmony import */ var _emotion_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/.pnpm/@emotion+utils@1.2.1/node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js");
|
|
/* harmony import */ var _emotion_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@emotion+css@11.11.2/node_modules/@emotion/css/dist/emotion-css.esm.js");
|
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
// eslint-disable-next-line no-restricted-imports
|
|
|
|
// eslint-disable-next-line no-restricted-imports
|
|
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
const isSerializedStyles = o => typeof o !== 'undefined' && o !== null && ['name', 'styles'].every(p => typeof o[p] !== 'undefined');
|
|
|
|
/**
|
|
* Retrieve a `cx` function that knows how to handle `SerializedStyles`
|
|
* returned by the `@emotion/react` `css` function in addition to what
|
|
* `cx` normally knows how to handle. It also hooks into the Emotion
|
|
* Cache, allowing `css` calls to work inside iframes.
|
|
*
|
|
* ```jsx
|
|
* import { css } from '@emotion/react';
|
|
*
|
|
* const styles = css`
|
|
* color: red
|
|
* `;
|
|
*
|
|
* function RedText( { className, ...props } ) {
|
|
* const cx = useCx();
|
|
*
|
|
* const classes = cx(styles, className);
|
|
*
|
|
* return <span className={classes} {...props} />;
|
|
* }
|
|
* ```
|
|
*/
|
|
const useCx = () => {
|
|
const cache = (0,_emotion_react__WEBPACK_IMPORTED_MODULE_1__._)();
|
|
const cx = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.useCallback)((...classNames) => {
|
|
if (cache === null) {
|
|
throw new Error('The `useCx` hook should be only used within a valid Emotion Cache Context');
|
|
}
|
|
return (0,_emotion_css__WEBPACK_IMPORTED_MODULE_0__.cx)(...classNames.map(arg => {
|
|
if (isSerializedStyles(arg)) {
|
|
(0,_emotion_utils__WEBPACK_IMPORTED_MODULE_3__/* .insertStyles */ .sk)(cache, arg, false);
|
|
return `${cache.key}-${arg.name}`;
|
|
}
|
|
return arg;
|
|
}));
|
|
}, [cache]);
|
|
return cx;
|
|
};
|
|
//# sourceMappingURL=use-cx.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/math.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ Re: () => (/* binding */ subtract),
|
|
/* harmony export */ WQ: () => (/* binding */ add),
|
|
/* harmony export */ ir: () => (/* binding */ roundClamp),
|
|
/* harmony export */ qE: () => (/* binding */ clamp)
|
|
/* harmony export */ });
|
|
/* unused harmony export getNumber */
|
|
/**
|
|
* Parses and retrieves a number value.
|
|
*
|
|
* @param {unknown} value The incoming value.
|
|
*
|
|
* @return {number} The parsed number value.
|
|
*/
|
|
function getNumber(value) {
|
|
const number = Number(value);
|
|
return isNaN(number) ? 0 : number;
|
|
}
|
|
|
|
/**
|
|
* Safely adds 2 values.
|
|
*
|
|
* @param {Array<number|string>} args Values to add together.
|
|
*
|
|
* @return {number} The sum of values.
|
|
*/
|
|
function add(...args) {
|
|
return args.reduce( /** @type {(sum:number, arg: number|string) => number} */
|
|
(sum, arg) => sum + getNumber(arg), 0);
|
|
}
|
|
|
|
/**
|
|
* Safely subtracts 2 values.
|
|
*
|
|
* @param {Array<number|string>} args Values to subtract together.
|
|
*
|
|
* @return {number} The difference of the values.
|
|
*/
|
|
function subtract(...args) {
|
|
return args.reduce( /** @type {(diff:number, arg: number|string, index:number) => number} */
|
|
(diff, arg, index) => {
|
|
const value = getNumber(arg);
|
|
return index === 0 ? value : diff - value;
|
|
}, 0);
|
|
}
|
|
|
|
/**
|
|
* Determines the decimal position of a number value.
|
|
*
|
|
* @param {number} value The number to evaluate.
|
|
*
|
|
* @return {number} The number of decimal places.
|
|
*/
|
|
function getPrecision(value) {
|
|
const split = (value + '').split('.');
|
|
return split[1] !== undefined ? split[1].length : 0;
|
|
}
|
|
|
|
/**
|
|
* Clamps a value based on a min/max range.
|
|
*
|
|
* @param {number} value The value.
|
|
* @param {number} min The minimum range.
|
|
* @param {number} max The maximum range.
|
|
*
|
|
* @return {number} The clamped value.
|
|
*/
|
|
function clamp(value, min, max) {
|
|
const baseValue = getNumber(value);
|
|
return Math.max(min, Math.min(baseValue, max));
|
|
}
|
|
|
|
/**
|
|
* Clamps a value based on a min/max range with rounding
|
|
*
|
|
* @param {number | string} value The value.
|
|
* @param {number} min The minimum range.
|
|
* @param {number} max The maximum range.
|
|
* @param {number} step A multiplier for the value.
|
|
*
|
|
* @return {number} The rounded and clamped value.
|
|
*/
|
|
function roundClamp(value = 0, min = Infinity, max = Infinity, step = 1) {
|
|
const baseValue = getNumber(value);
|
|
const stepValue = getNumber(step);
|
|
const precision = getPrecision(step);
|
|
const rounded = Math.round(baseValue / stepValue) * stepValue;
|
|
const clampedValue = clamp(rounded, min, max);
|
|
return precision ? getNumber(clampedValue.toFixed(precision)) : clampedValue;
|
|
}
|
|
//# sourceMappingURL=math.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/rtl.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ h: () => (/* binding */ rtl)
|
|
/* harmony export */ });
|
|
/* unused harmony export convertLTRToRTL */
|
|
/* harmony import */ var _emotion_react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2/node_modules/@emotion/react/dist/emotion-react.browser.esm.js");
|
|
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+i18n@5.7.0/node_modules/@wordpress/i18n/build-module/index.js");
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
const LOWER_LEFT_REGEXP = new RegExp(/-left/g);
|
|
const LOWER_RIGHT_REGEXP = new RegExp(/-right/g);
|
|
const UPPER_LEFT_REGEXP = new RegExp(/Left/g);
|
|
const UPPER_RIGHT_REGEXP = new RegExp(/Right/g);
|
|
|
|
/**
|
|
* Flips a CSS property from left <-> right.
|
|
*
|
|
* @param {string} key The CSS property name.
|
|
*
|
|
* @return {string} The flipped CSS property name, if applicable.
|
|
*/
|
|
function getConvertedKey(key) {
|
|
if (key === 'left') {
|
|
return 'right';
|
|
}
|
|
if (key === 'right') {
|
|
return 'left';
|
|
}
|
|
if (LOWER_LEFT_REGEXP.test(key)) {
|
|
return key.replace(LOWER_LEFT_REGEXP, '-right');
|
|
}
|
|
if (LOWER_RIGHT_REGEXP.test(key)) {
|
|
return key.replace(LOWER_RIGHT_REGEXP, '-left');
|
|
}
|
|
if (UPPER_LEFT_REGEXP.test(key)) {
|
|
return key.replace(UPPER_LEFT_REGEXP, 'Right');
|
|
}
|
|
if (UPPER_RIGHT_REGEXP.test(key)) {
|
|
return key.replace(UPPER_RIGHT_REGEXP, 'Left');
|
|
}
|
|
return key;
|
|
}
|
|
|
|
/**
|
|
* An incredibly basic ltr -> rtl converter for style properties
|
|
*
|
|
* @param {import('react').CSSProperties} ltrStyles
|
|
*
|
|
* @return {import('react').CSSProperties} Converted ltr -> rtl styles
|
|
*/
|
|
const convertLTRToRTL = (ltrStyles = {}) => {
|
|
return Object.fromEntries(Object.entries(ltrStyles).map(([key, value]) => [getConvertedKey(key), value]));
|
|
};
|
|
|
|
/**
|
|
* A higher-order function that create an incredibly basic ltr -> rtl style converter for CSS objects.
|
|
*
|
|
* @param {import('react').CSSProperties} ltrStyles Ltr styles. Converts and renders from ltr -> rtl styles, if applicable.
|
|
* @param {import('react').CSSProperties} [rtlStyles] Rtl styles. Renders if provided.
|
|
*
|
|
* @return {() => import('@emotion/react').SerializedStyles} A function to output CSS styles for Emotion's renderer
|
|
*/
|
|
function rtl(ltrStyles = {}, rtlStyles) {
|
|
return () => {
|
|
if (rtlStyles) {
|
|
// @ts-ignore: `css` types are wrong, it can accept an object: https://emotion.sh/docs/object-styles#with-css
|
|
return (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__/* .isRTL */ .V8)() ? /*#__PURE__*/(0,_emotion_react__WEBPACK_IMPORTED_MODULE_1__/* .css */ .AH)(rtlStyles, true ? "" : 0, true ? "" : 0) : /*#__PURE__*/(0,_emotion_react__WEBPACK_IMPORTED_MODULE_1__/* .css */ .AH)(ltrStyles, true ? "" : 0, true ? "" : 0);
|
|
}
|
|
|
|
// @ts-ignore: `css` types are wrong, it can accept an object: https://emotion.sh/docs/object-styles#with-css
|
|
return (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__/* .isRTL */ .V8)() ? /*#__PURE__*/(0,_emotion_react__WEBPACK_IMPORTED_MODULE_1__/* .css */ .AH)(convertLTRToRTL(ltrStyles), true ? "" : 0, true ? "" : 0) : /*#__PURE__*/(0,_emotion_react__WEBPACK_IMPORTED_MODULE_1__/* .css */ .AH)(ltrStyles, true ? "" : 0, true ? "" : 0);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Call this in the `useMemo` dependency array to ensure that subsequent renders will
|
|
* cause rtl styles to update based on the `isRTL` return value even if all other dependencies
|
|
* remain the same.
|
|
*
|
|
* @example
|
|
* const styles = useMemo( () => {
|
|
* return css`
|
|
* ${ rtl( { marginRight: '10px' } ) }
|
|
* `;
|
|
* }, [ rtl.watch() ] );
|
|
*/
|
|
rtl.watch = () => (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__/* .isRTL */ .V8)();
|
|
//# sourceMappingURL=rtl.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/space.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ x: () => (/* binding */ space)
|
|
/* harmony export */ });
|
|
/**
|
|
* The argument value for the `space()` utility function.
|
|
*
|
|
* When this is a number or a numeric string, it will be interpreted as a
|
|
* multiplier for the grid base value (4px). For example, `space( 2 )` will be 8px.
|
|
*
|
|
* Otherwise, it will be interpreted as a literal CSS length value. For example,
|
|
* `space( 'auto' )` will be 'auto', and `space( '2px' )` will be 2px.
|
|
*/
|
|
|
|
const GRID_BASE = '4px';
|
|
|
|
/**
|
|
* A function that handles numbers, numeric strings, and unit values.
|
|
*
|
|
* When given a number or a numeric string, it will return the grid-based
|
|
* value as a factor of GRID_BASE, defined above.
|
|
*
|
|
* When given a unit value or one of the named CSS values like `auto`,
|
|
* it will simply return the value back.
|
|
*
|
|
* @param value A number, numeric string, or a unit value.
|
|
*/
|
|
function space(value) {
|
|
if (typeof value === 'undefined') {
|
|
return undefined;
|
|
}
|
|
|
|
// Handle empty strings, if it's the number 0 this still works.
|
|
if (!value) {
|
|
return '0';
|
|
}
|
|
const asInt = typeof value === 'number' ? value : Number(value);
|
|
|
|
// Test if the input has a unit, was NaN, or was one of the named CSS values (like `auto`), in which case just use that value.
|
|
if (typeof window !== 'undefined' && window.CSS?.supports?.('margin', value.toString()) || Number.isNaN(asInt)) {
|
|
return value.toString();
|
|
}
|
|
return `calc(${GRID_BASE} * ${value})`;
|
|
}
|
|
//# sourceMappingURL=space.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/use-deprecated-props.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ R: () => (/* binding */ useDeprecated36pxDefaultSizeProp)
|
|
/* harmony export */ });
|
|
function useDeprecated36pxDefaultSizeProp(props) {
|
|
const {
|
|
__next36pxDefaultSize,
|
|
__next40pxDefaultSize,
|
|
...otherProps
|
|
} = props;
|
|
return {
|
|
...otherProps,
|
|
__next40pxDefaultSize: __next40pxDefaultSize !== null && __next40pxDefaultSize !== void 0 ? __next40pxDefaultSize : __next36pxDefaultSize
|
|
};
|
|
}
|
|
//# sourceMappingURL=use-deprecated-props.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/use-responsive-value.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ t: () => (/* binding */ useResponsiveValue)
|
|
/* harmony export */ });
|
|
/* unused harmony export useBreakpointIndex */
|
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
const breakpoints = ['40em', '52em', '64em'];
|
|
const useBreakpointIndex = (options = {}) => {
|
|
const {
|
|
defaultIndex = 0
|
|
} = options;
|
|
if (typeof defaultIndex !== 'number') {
|
|
throw new TypeError(`Default breakpoint index should be a number. Got: ${defaultIndex}, ${typeof defaultIndex}`);
|
|
} else if (defaultIndex < 0 || defaultIndex > breakpoints.length - 1) {
|
|
throw new RangeError(`Default breakpoint index out of range. Theme has ${breakpoints.length} breakpoints, got index ${defaultIndex}`);
|
|
}
|
|
const [value, setValue] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(defaultIndex);
|
|
(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
const getIndex = () => breakpoints.filter(bp => {
|
|
return typeof window !== 'undefined' ? window.matchMedia(`screen and (min-width: ${bp})`).matches : false;
|
|
}).length;
|
|
const onResize = () => {
|
|
const newValue = getIndex();
|
|
if (value !== newValue) {
|
|
setValue(newValue);
|
|
}
|
|
};
|
|
onResize();
|
|
if (typeof window !== 'undefined') {
|
|
window.addEventListener('resize', onResize);
|
|
}
|
|
return () => {
|
|
if (typeof window !== 'undefined') {
|
|
window.removeEventListener('resize', onResize);
|
|
}
|
|
};
|
|
}, [value]);
|
|
return value;
|
|
};
|
|
function useResponsiveValue(values, options = {}) {
|
|
const index = useBreakpointIndex(options);
|
|
|
|
// Allow calling the function with a "normal" value without having to check on the outside.
|
|
if (!Array.isArray(values) && typeof values !== 'function') {
|
|
return values;
|
|
}
|
|
const array = values || [];
|
|
|
|
/* eslint-disable jsdoc/no-undefined-types */
|
|
return /** @type {T[]} */array[/* eslint-enable jsdoc/no-undefined-types */
|
|
index >= array.length ? array.length - 1 : index];
|
|
}
|
|
//# sourceMappingURL=use-responsive-value.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/values.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ GB: () => (/* binding */ ensureNumber),
|
|
/* harmony export */ J5: () => (/* binding */ isValueDefined),
|
|
/* harmony export */ r6: () => (/* binding */ isValueEmpty),
|
|
/* harmony export */ vD: () => (/* binding */ getDefinedValue)
|
|
/* harmony export */ });
|
|
/* unused harmony export stringToNumber */
|
|
/* eslint-disable jsdoc/valid-types */
|
|
/**
|
|
* Determines if a value is null or undefined.
|
|
*
|
|
* @template T
|
|
*
|
|
* @param {T} value The value to check.
|
|
* @return {value is Exclude<T, null | undefined>} Whether value is not null or undefined.
|
|
*/
|
|
function isValueDefined(value) {
|
|
return value !== undefined && value !== null;
|
|
}
|
|
/* eslint-enable jsdoc/valid-types */
|
|
|
|
/* eslint-disable jsdoc/valid-types */
|
|
/**
|
|
* Determines if a value is empty, null, or undefined.
|
|
*
|
|
* @param {string | number | null | undefined} value The value to check.
|
|
* @return {value is ("" | null | undefined)} Whether value is empty.
|
|
*/
|
|
function isValueEmpty(value) {
|
|
const isEmptyString = value === '';
|
|
return !isValueDefined(value) || isEmptyString;
|
|
}
|
|
/* eslint-enable jsdoc/valid-types */
|
|
|
|
/**
|
|
* Get the first defined/non-null value from an array.
|
|
*
|
|
* @template T
|
|
*
|
|
* @param {Array<T | null | undefined>} values Values to derive from.
|
|
* @param {T} fallbackValue Fallback value if there are no defined values.
|
|
* @return {T} A defined value or the fallback value.
|
|
*/
|
|
function getDefinedValue(values = [], fallbackValue) {
|
|
var _values$find;
|
|
return (_values$find = values.find(isValueDefined)) !== null && _values$find !== void 0 ? _values$find : fallbackValue;
|
|
}
|
|
|
|
/**
|
|
* Converts a string to a number.
|
|
*
|
|
* @param {string} value
|
|
* @return {number} String as a number.
|
|
*/
|
|
const stringToNumber = value => {
|
|
return parseFloat(value);
|
|
};
|
|
|
|
/**
|
|
* Regardless of the input being a string or a number, returns a number.
|
|
*
|
|
* Returns `undefined` in case the string is `undefined` or not a valid numeric value.
|
|
*
|
|
* @param {string | number} value
|
|
* @return {number} The parsed number.
|
|
*/
|
|
const ensureNumber = value => {
|
|
return typeof value === 'string' ? stringToNumber(value) : value;
|
|
};
|
|
//# sourceMappingURL=values.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/with-ignore-ime-events.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ n: () => (/* binding */ withIgnoreIMEEvents)
|
|
/* harmony export */ });
|
|
/**
|
|
* A higher-order function that wraps a keydown event handler to ensure it is not an IME event.
|
|
*
|
|
* In CJK languages, an IME (Input Method Editor) is used to input complex characters.
|
|
* During an IME composition, keydown events (e.g. Enter or Escape) can be fired
|
|
* which are intended to control the IME and not the application.
|
|
* These events should be ignored by any application logic.
|
|
*
|
|
* @param keydownHandler The keydown event handler to execute after ensuring it was not an IME event.
|
|
*
|
|
* @return A wrapped version of the given event handler that ignores IME events.
|
|
*/
|
|
function withIgnoreIMEEvents(keydownHandler) {
|
|
return event => {
|
|
const {
|
|
isComposing
|
|
} = 'nativeEvent' in event ? event.nativeEvent : event;
|
|
if (isComposing ||
|
|
// Workaround for Mac Safari where the final Enter/Backspace of an IME composition
|
|
// is `isComposing=false`, even though it's technically still part of the composition.
|
|
// These can only be detected by keyCode.
|
|
event.keyCode === 229) {
|
|
return;
|
|
}
|
|
keydownHandler(event);
|
|
};
|
|
}
|
|
//# sourceMappingURL=with-ignore-ime-events.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/v-stack/component.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
A: () => (/* binding */ v_stack_component)
|
|
});
|
|
|
|
// UNUSED EXPORTS: VStack
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-connect.js
|
|
var context_connect = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-connect.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/view/component.js
|
|
var component = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/view/component.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js + 1 modules
|
|
var use_context_system = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/h-stack/hook.js + 2 modules
|
|
var hook = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/h-stack/hook.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/v-stack/hook.js
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
function useVStack(props) {
|
|
const {
|
|
expanded = false,
|
|
alignment = 'stretch',
|
|
...otherProps
|
|
} = (0,use_context_system/* useContextSystem */.A)(props, 'VStack');
|
|
const hStackProps = (0,hook/* useHStack */.A)({
|
|
direction: 'column',
|
|
expanded,
|
|
alignment,
|
|
...otherProps
|
|
});
|
|
return hStackProps;
|
|
}
|
|
//# sourceMappingURL=hook.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/v-stack/component.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
function UnconnectedVStack(props, forwardedRef) {
|
|
const vStackProps = useVStack(props);
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(component/* default */.A, {
|
|
...vStackProps,
|
|
ref: forwardedRef
|
|
});
|
|
}
|
|
|
|
/**
|
|
* `VStack` (or Vertical Stack) is a layout component that arranges child
|
|
* elements in a vertical line.
|
|
*
|
|
* `VStack` can render anything inside.
|
|
*
|
|
* ```jsx
|
|
* import {
|
|
* __experimentalText as Text,
|
|
* __experimentalVStack as VStack,
|
|
* } from `@wordpress/components`;
|
|
*
|
|
* function Example() {
|
|
* return (
|
|
* <VStack>
|
|
* <Text>Code</Text>
|
|
* <Text>is</Text>
|
|
* <Text>Poetry</Text>
|
|
* </VStack>
|
|
* );
|
|
* }
|
|
* ```
|
|
*/
|
|
const VStack = (0,context_connect/* contextConnect */.KZ)(UnconnectedVStack, 'VStack');
|
|
/* harmony default export */ const v_stack_component = (VStack);
|
|
//# sourceMappingURL=component.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/view/component.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/* unused harmony export View */
|
|
/* harmony import */ var _emotion_styled_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@emotion+styled@11.11.0_@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2__@types+react@17.0.71_react@17.0.2/node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js");
|
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
const PolymorphicDiv = /*#__PURE__*/(0,_emotion_styled_base__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)("div", true ? {
|
|
target: "e19lxcc00"
|
|
} : 0)( true ? "" : 0);
|
|
function UnforwardedView({
|
|
as,
|
|
...restProps
|
|
}, ref) {
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(PolymorphicDiv, {
|
|
as: as,
|
|
ref: ref,
|
|
...restProps
|
|
});
|
|
}
|
|
|
|
/**
|
|
* `View` is a core component that renders everything in the library.
|
|
* It is the principle component in the entire library.
|
|
*
|
|
* ```jsx
|
|
* import { View } from `@wordpress/components`;
|
|
*
|
|
* function Example() {
|
|
* return (
|
|
* <View>
|
|
* Code is Poetry
|
|
* </View>
|
|
* );
|
|
* }
|
|
* ```
|
|
*/
|
|
const View = Object.assign((0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.forwardRef)(UnforwardedView), {
|
|
selector: '.components-view'
|
|
});
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (View);
|
|
//# sourceMappingURL=component.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/visually-hidden/component.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
A: () => (/* binding */ visually_hidden_component)
|
|
});
|
|
|
|
// UNUSED EXPORTS: VisuallyHidden
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js + 1 modules
|
|
var use_context_system = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/use-context-system.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-connect.js
|
|
var context_connect = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/context/context-connect.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/visually-hidden/styles.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
const visuallyHidden = {
|
|
border: 0,
|
|
clip: 'rect(1px, 1px, 1px, 1px)',
|
|
WebkitClipPath: 'inset( 50% )',
|
|
clipPath: 'inset( 50% )',
|
|
height: '1px',
|
|
margin: '-1px',
|
|
overflow: 'hidden',
|
|
padding: 0,
|
|
position: 'absolute',
|
|
width: '1px',
|
|
wordWrap: 'normal'
|
|
};
|
|
//# sourceMappingURL=styles.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/view/component.js
|
|
var component = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/view/component.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/visually-hidden/component.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
function UnconnectedVisuallyHidden(props, forwardedRef) {
|
|
const {
|
|
style: styleProp,
|
|
...contextProps
|
|
} = (0,use_context_system/* useContextSystem */.A)(props, 'VisuallyHidden');
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(component/* default */.A, {
|
|
ref: forwardedRef,
|
|
...contextProps,
|
|
style: {
|
|
...visuallyHidden,
|
|
...(styleProp || {})
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* `VisuallyHidden` is a component used to render text intended to be visually
|
|
* hidden, but will show for alternate devices, for example a screen reader.
|
|
*
|
|
* ```jsx
|
|
* import { VisuallyHidden } from `@wordpress/components`;
|
|
*
|
|
* function Example() {
|
|
* return (
|
|
* <VisuallyHidden>
|
|
* <label>Code is Poetry</label>
|
|
* </VisuallyHidden>
|
|
* );
|
|
* }
|
|
* ```
|
|
*/
|
|
const VisuallyHidden = (0,context_connect/* contextConnect */.KZ)(UnconnectedVisuallyHidden, 'VisuallyHidden');
|
|
/* harmony default export */ const visually_hidden_component = (VisuallyHidden);
|
|
//# sourceMappingURL=component.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-constrained-tabbing/index.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _wordpress_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+dom@4.7.0/node_modules/@wordpress/dom/build-module/index.js");
|
|
/* harmony import */ var _use_ref_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-ref-effect/index.js");
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* In Dialogs/modals, the tabbing must be constrained to the content of
|
|
* the wrapper element. This hook adds the behavior to the returned ref.
|
|
*
|
|
* @return {import('react').RefCallback<Element>} Element Ref.
|
|
*
|
|
* @example
|
|
* ```js
|
|
* import { useConstrainedTabbing } from '@wordpress/compose';
|
|
*
|
|
* const ConstrainedTabbingExample = () => {
|
|
* const constrainedTabbingRef = useConstrainedTabbing()
|
|
* return (
|
|
* <div ref={ constrainedTabbingRef }>
|
|
* <Button />
|
|
* <Button />
|
|
* </div>
|
|
* );
|
|
* }
|
|
* ```
|
|
*/
|
|
function useConstrainedTabbing() {
|
|
return (0,_use_ref_effect__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)(( /** @type {HTMLElement} */node) => {
|
|
function onKeyDown( /** @type {KeyboardEvent} */event) {
|
|
const {
|
|
key,
|
|
shiftKey,
|
|
target
|
|
} = event;
|
|
if (key !== 'Tab') {
|
|
return;
|
|
}
|
|
const action = shiftKey ? 'findPrevious' : 'findNext';
|
|
const nextElement = _wordpress_dom__WEBPACK_IMPORTED_MODULE_1__/* .focus */ .XC.tabbable[action]( /** @type {HTMLElement} */target) || null;
|
|
|
|
// When the target element contains the element that is about to
|
|
// receive focus, for example when the target is a tabbable
|
|
// container, browsers may disagree on where to move focus next.
|
|
// In this case we can't rely on native browsers behavior. We need
|
|
// to manage focus instead.
|
|
// See https://github.com/WordPress/gutenberg/issues/46041.
|
|
if ( /** @type {HTMLElement} */target.contains(nextElement)) {
|
|
event.preventDefault();
|
|
nextElement?.focus();
|
|
return;
|
|
}
|
|
|
|
// If the element that is about to receive focus is inside the
|
|
// area, rely on native browsers behavior and let tabbing follow
|
|
// the native tab sequence.
|
|
if (node.contains(nextElement)) {
|
|
return;
|
|
}
|
|
|
|
// If the element that is about to receive focus is outside the
|
|
// area, move focus to a div and insert it at the start or end of
|
|
// the area, depending on the direction. Without preventing default
|
|
// behaviour, the browser will then move focus to the next element.
|
|
const domAction = shiftKey ? 'append' : 'prepend';
|
|
const {
|
|
ownerDocument
|
|
} = node;
|
|
const trap = ownerDocument.createElement('div');
|
|
trap.tabIndex = -1;
|
|
node[domAction](trap);
|
|
|
|
// Remove itself when the trap loses focus.
|
|
trap.addEventListener('blur', () => node.removeChild(trap));
|
|
trap.focus();
|
|
}
|
|
node.addEventListener('keydown', onKeyDown);
|
|
return () => {
|
|
node.removeEventListener('keydown', onKeyDown);
|
|
};
|
|
}, []);
|
|
}
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (useConstrainedTabbing);
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-focus-on-mount/index.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (/* binding */ useFocusOnMount)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
/* harmony import */ var _wordpress_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+dom@4.7.0/node_modules/@wordpress/dom/build-module/index.js");
|
|
/* harmony import */ var _use_ref_effect__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-ref-effect/index.js");
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Hook used to focus the first tabbable element on mount.
|
|
*
|
|
* @param {boolean | 'firstElement'} focusOnMount Focus on mount mode.
|
|
* @return {import('react').RefCallback<HTMLElement>} Ref callback.
|
|
*
|
|
* @example
|
|
* ```js
|
|
* import { useFocusOnMount } from '@wordpress/compose';
|
|
*
|
|
* const WithFocusOnMount = () => {
|
|
* const ref = useFocusOnMount()
|
|
* return (
|
|
* <div ref={ ref }>
|
|
* <Button />
|
|
* <Button />
|
|
* </div>
|
|
* );
|
|
* }
|
|
* ```
|
|
*/
|
|
function useFocusOnMount(focusOnMount = 'firstElement') {
|
|
const focusOnMountRef = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useRef)(focusOnMount);
|
|
|
|
/**
|
|
* Sets focus on a DOM element.
|
|
*
|
|
* @param {HTMLElement} target The DOM element to set focus to.
|
|
* @return {void}
|
|
*/
|
|
const setFocus = target => {
|
|
target.focus({
|
|
// When focusing newly mounted dialogs,
|
|
// the position of the popover is often not right on the first render
|
|
// This prevents the layout shifts when focusing the dialogs.
|
|
preventScroll: true
|
|
});
|
|
};
|
|
|
|
/** @type {import('react').MutableRefObject<ReturnType<setTimeout> | undefined>} */
|
|
const timerIdRef = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useRef)();
|
|
(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
focusOnMountRef.current = focusOnMount;
|
|
}, [focusOnMount]);
|
|
return (0,_use_ref_effect__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A)(node => {
|
|
var _node$ownerDocument$a;
|
|
if (!node || focusOnMountRef.current === false) {
|
|
return;
|
|
}
|
|
if (node.contains((_node$ownerDocument$a = node.ownerDocument?.activeElement) !== null && _node$ownerDocument$a !== void 0 ? _node$ownerDocument$a : null)) {
|
|
return;
|
|
}
|
|
if (focusOnMountRef.current === 'firstElement') {
|
|
timerIdRef.current = setTimeout(() => {
|
|
const firstTabbable = _wordpress_dom__WEBPACK_IMPORTED_MODULE_2__/* .focus */ .XC.tabbable.find(node)[0];
|
|
if (firstTabbable) {
|
|
setFocus(firstTabbable);
|
|
}
|
|
}, 0);
|
|
return;
|
|
}
|
|
setFocus(node);
|
|
return () => {
|
|
if (timerIdRef.current) {
|
|
clearTimeout(timerIdRef.current);
|
|
}
|
|
};
|
|
}, []);
|
|
}
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-focus-return/index.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/** @type {Element|null} */
|
|
let origin = null;
|
|
|
|
/**
|
|
* Adds the unmount behavior of returning focus to the element which had it
|
|
* previously as is expected for roles like menus or dialogs.
|
|
*
|
|
* @param {() => void} [onFocusReturn] Overrides the default return behavior.
|
|
* @return {import('react').RefCallback<HTMLElement>} Element Ref.
|
|
*
|
|
* @example
|
|
* ```js
|
|
* import { useFocusReturn } from '@wordpress/compose';
|
|
*
|
|
* const WithFocusReturn = () => {
|
|
* const ref = useFocusReturn()
|
|
* return (
|
|
* <div ref={ ref }>
|
|
* <Button />
|
|
* <Button />
|
|
* </div>
|
|
* );
|
|
* }
|
|
* ```
|
|
*/
|
|
function useFocusReturn(onFocusReturn) {
|
|
/** @type {import('react').MutableRefObject<null | HTMLElement>} */
|
|
const ref = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
/** @type {import('react').MutableRefObject<null | Element>} */
|
|
const focusedBeforeMount = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
const onFocusReturnRef = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useRef)(onFocusReturn);
|
|
(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
onFocusReturnRef.current = onFocusReturn;
|
|
}, [onFocusReturn]);
|
|
return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useCallback)(node => {
|
|
if (node) {
|
|
// Set ref to be used when unmounting.
|
|
ref.current = node;
|
|
|
|
// Only set when the node mounts.
|
|
if (focusedBeforeMount.current) {
|
|
return;
|
|
}
|
|
focusedBeforeMount.current = node.ownerDocument.activeElement;
|
|
} else if (focusedBeforeMount.current) {
|
|
const isFocused = ref.current?.contains(ref.current?.ownerDocument.activeElement);
|
|
if (ref.current?.isConnected && !isFocused) {
|
|
var _origin;
|
|
(_origin = origin) !== null && _origin !== void 0 ? _origin : origin = focusedBeforeMount.current;
|
|
return;
|
|
}
|
|
|
|
// Defer to the component's own explicit focus return behavior, if
|
|
// specified. This allows for support that the `onFocusReturn`
|
|
// decides to allow the default behavior to occur under some
|
|
// conditions.
|
|
if (onFocusReturnRef.current) {
|
|
onFocusReturnRef.current();
|
|
} else {
|
|
/** @type {null|HTMLElement} */(!focusedBeforeMount.current.isConnected ? origin : focusedBeforeMount.current)?.focus();
|
|
}
|
|
origin = null;
|
|
}
|
|
}, []);
|
|
}
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (useFocusReturn);
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-instance-id/index.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
const instanceMap = new WeakMap();
|
|
|
|
/**
|
|
* Creates a new id for a given object.
|
|
*
|
|
* @param object Object reference to create an id for.
|
|
* @return The instance id (index).
|
|
*/
|
|
function createId(object) {
|
|
const instances = instanceMap.get(object) || 0;
|
|
instanceMap.set(object, instances + 1);
|
|
return instances;
|
|
}
|
|
|
|
/**
|
|
* Specify the useInstanceId *function* signatures.
|
|
*
|
|
* More accurately, useInstanceId distinguishes between three different
|
|
* signatures:
|
|
*
|
|
* 1. When only object is given, the returned value is a number
|
|
* 2. When object and prefix is given, the returned value is a string
|
|
* 3. When preferredId is given, the returned value is the type of preferredId
|
|
*
|
|
* @param object Object reference to create an id for.
|
|
*/
|
|
|
|
/**
|
|
* Provides a unique instance ID.
|
|
*
|
|
* @param object Object reference to create an id for.
|
|
* @param [prefix] Prefix for the unique id.
|
|
* @param [preferredId] Default ID to use.
|
|
* @return The unique instance id.
|
|
*/
|
|
function useInstanceId(object, prefix, preferredId) {
|
|
return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => {
|
|
if (preferredId) {
|
|
return preferredId;
|
|
}
|
|
const id = createId(object);
|
|
return prefix ? `${prefix}-${id}` : id;
|
|
}, [object, preferredId, prefix]);
|
|
}
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (useInstanceId);
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-media-query/index.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (/* binding */ useMediaQuery)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
const matchMediaCache = new Map();
|
|
|
|
/**
|
|
* A new MediaQueryList object for the media query
|
|
*
|
|
* @param {string} [query] Media Query.
|
|
* @return {MediaQueryList|null} A new object for the media query
|
|
*/
|
|
function getMediaQueryList(query) {
|
|
if (!query) {
|
|
return null;
|
|
}
|
|
let match = matchMediaCache.get(query);
|
|
if (match) {
|
|
return match;
|
|
}
|
|
if (typeof window !== 'undefined' && typeof window.matchMedia === 'function') {
|
|
match = window.matchMedia(query);
|
|
matchMediaCache.set(query, match);
|
|
return match;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
/**
|
|
* Runs a media query and returns its value when it changes.
|
|
*
|
|
* @param {string} [query] Media Query.
|
|
* @return {boolean} return value of the media query.
|
|
*/
|
|
function useMediaQuery(query) {
|
|
const source = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => {
|
|
const mediaQueryList = getMediaQueryList(query);
|
|
return {
|
|
/** @type {(onStoreChange: () => void) => () => void} */
|
|
subscribe(onStoreChange) {
|
|
if (!mediaQueryList) {
|
|
return () => {};
|
|
}
|
|
|
|
// Avoid a fatal error when browsers don't support `addEventListener` on MediaQueryList.
|
|
mediaQueryList.addEventListener?.('change', onStoreChange);
|
|
return () => {
|
|
mediaQueryList.removeEventListener?.('change', onStoreChange);
|
|
};
|
|
},
|
|
getValue() {
|
|
var _mediaQueryList$match;
|
|
return (_mediaQueryList$match = mediaQueryList?.matches) !== null && _mediaQueryList$match !== void 0 ? _mediaQueryList$match : false;
|
|
}
|
|
};
|
|
}, [query]);
|
|
return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useSyncExternalStore)(source.subscribe, source.getValue, () => false);
|
|
}
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-merge-refs/index.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (/* binding */ useMergeRefs)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/* eslint-disable jsdoc/valid-types */
|
|
/**
|
|
* @template T
|
|
* @typedef {T extends import('react').Ref<infer R> ? R : never} TypeFromRef
|
|
*/
|
|
/* eslint-enable jsdoc/valid-types */
|
|
|
|
/**
|
|
* @template T
|
|
* @param {import('react').Ref<T>} ref
|
|
* @param {T} value
|
|
*/
|
|
function assignRef(ref, value) {
|
|
if (typeof ref === 'function') {
|
|
ref(value);
|
|
} else if (ref && ref.hasOwnProperty('current')) {
|
|
/* eslint-disable jsdoc/no-undefined-types */
|
|
/** @type {import('react').MutableRefObject<T>} */ref.current = value;
|
|
/* eslint-enable jsdoc/no-undefined-types */
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Merges refs into one ref callback.
|
|
*
|
|
* It also ensures that the merged ref callbacks are only called when they
|
|
* change (as a result of a `useCallback` dependency update) OR when the ref
|
|
* value changes, just as React does when passing a single ref callback to the
|
|
* component.
|
|
*
|
|
* As expected, if you pass a new function on every render, the ref callback
|
|
* will be called after every render.
|
|
*
|
|
* If you don't wish a ref callback to be called after every render, wrap it
|
|
* with `useCallback( callback, dependencies )`. When a dependency changes, the
|
|
* old ref callback will be called with `null` and the new ref callback will be
|
|
* called with the same value.
|
|
*
|
|
* To make ref callbacks easier to use, you can also pass the result of
|
|
* `useRefEffect`, which makes cleanup easier by allowing you to return a
|
|
* cleanup function instead of handling `null`.
|
|
*
|
|
* It's also possible to _disable_ a ref (and its behaviour) by simply not
|
|
* passing the ref.
|
|
*
|
|
* ```jsx
|
|
* const ref = useRefEffect( ( node ) => {
|
|
* node.addEventListener( ... );
|
|
* return () => {
|
|
* node.removeEventListener( ... );
|
|
* };
|
|
* }, [ ...dependencies ] );
|
|
* const otherRef = useRef();
|
|
* const mergedRefs useMergeRefs( [
|
|
* enabled && ref,
|
|
* otherRef,
|
|
* ] );
|
|
* return <div ref={ mergedRefs } />;
|
|
* ```
|
|
*
|
|
* @template {import('react').Ref<any>} TRef
|
|
* @param {Array<TRef>} refs The refs to be merged.
|
|
*
|
|
* @return {import('react').RefCallback<TypeFromRef<TRef>>} The merged ref callback.
|
|
*/
|
|
function useMergeRefs(refs) {
|
|
const element = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useRef)();
|
|
const isAttachedRef = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useRef)(false);
|
|
const didElementChangeRef = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useRef)(false);
|
|
/* eslint-disable jsdoc/no-undefined-types */
|
|
/** @type {import('react').MutableRefObject<TRef[]>} */
|
|
/* eslint-enable jsdoc/no-undefined-types */
|
|
const previousRefsRef = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useRef)([]);
|
|
const currentRefsRef = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useRef)(refs);
|
|
|
|
// Update on render before the ref callback is called, so the ref callback
|
|
// always has access to the current refs.
|
|
currentRefsRef.current = refs;
|
|
|
|
// If any of the refs change, call the previous ref with `null` and the new
|
|
// ref with the node, except when the element changes in the same cycle, in
|
|
// which case the ref callbacks will already have been called.
|
|
(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect)(() => {
|
|
if (didElementChangeRef.current === false && isAttachedRef.current === true) {
|
|
refs.forEach((ref, index) => {
|
|
const previousRef = previousRefsRef.current[index];
|
|
if (ref !== previousRef) {
|
|
assignRef(previousRef, null);
|
|
assignRef(ref, element.current);
|
|
}
|
|
});
|
|
}
|
|
previousRefsRef.current = refs;
|
|
}, refs);
|
|
|
|
// No dependencies, must be reset after every render so ref callbacks are
|
|
// correctly called after a ref change.
|
|
(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect)(() => {
|
|
didElementChangeRef.current = false;
|
|
});
|
|
|
|
// There should be no dependencies so that `callback` is only called when
|
|
// the node changes.
|
|
return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useCallback)(value => {
|
|
// Update the element so it can be used when calling ref callbacks on a
|
|
// dependency change.
|
|
assignRef(element, value);
|
|
didElementChangeRef.current = true;
|
|
isAttachedRef.current = value !== null;
|
|
|
|
// When an element changes, the current ref callback should be called
|
|
// with the new element and the previous one with `null`.
|
|
const refsToAssign = value ? currentRefsRef.current : previousRefsRef.current;
|
|
|
|
// Update the latest refs.
|
|
for (const ref of refsToAssign) {
|
|
assignRef(ref, value);
|
|
}
|
|
}, []);
|
|
}
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-previous/index.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (/* binding */ usePrevious)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Use something's value from the previous render.
|
|
* Based on https://usehooks.com/usePrevious/.
|
|
*
|
|
* @param value The value to track.
|
|
*
|
|
* @return The value from the previous render.
|
|
*/
|
|
function usePrevious(value) {
|
|
const ref = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useRef)();
|
|
|
|
// Store current value in ref.
|
|
(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
ref.current = value;
|
|
}, [value]); // Re-run when value changes.
|
|
|
|
// Return previous value (happens before update in useEffect above).
|
|
return ref.current;
|
|
}
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-reduced-motion/index.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _use_media_query__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-media-query/index.js");
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Hook returning whether the user has a preference for reduced motion.
|
|
*
|
|
* @return {boolean} Reduced motion preference value.
|
|
*/
|
|
const useReducedMotion = () => (0,_use_media_query__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)('(prefers-reduced-motion: reduce)');
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (useReducedMotion);
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-ref-effect/index.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (/* binding */ useRefEffect)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Effect-like ref callback. Just like with `useEffect`, this allows you to
|
|
* return a cleanup function to be run if the ref changes or one of the
|
|
* dependencies changes. The ref is provided as an argument to the callback
|
|
* functions. The main difference between this and `useEffect` is that
|
|
* the `useEffect` callback is not called when the ref changes, but this is.
|
|
* Pass the returned ref callback as the component's ref and merge multiple refs
|
|
* with `useMergeRefs`.
|
|
*
|
|
* It's worth noting that if the dependencies array is empty, there's not
|
|
* strictly a need to clean up event handlers for example, because the node is
|
|
* to be removed. It *is* necessary if you add dependencies because the ref
|
|
* callback will be called multiple times for the same node.
|
|
*
|
|
* @param callback Callback with ref as argument.
|
|
* @param dependencies Dependencies of the callback.
|
|
*
|
|
* @return Ref callback.
|
|
*/
|
|
function useRefEffect(callback, dependencies) {
|
|
const cleanupRef = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useRef)();
|
|
return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useCallback)(node => {
|
|
if (node) {
|
|
cleanupRef.current = callback(node);
|
|
} else if (cleanupRef.current) {
|
|
cleanupRef.current();
|
|
}
|
|
}, dependencies);
|
|
}
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-viewport-match/index.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
/* harmony import */ var _use_media_query__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-media-query/index.js");
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* @typedef {"xhuge" | "huge" | "wide" | "xlarge" | "large" | "medium" | "small" | "mobile"} WPBreakpoint
|
|
*/
|
|
|
|
/**
|
|
* Hash of breakpoint names with pixel width at which it becomes effective.
|
|
*
|
|
* @see _breakpoints.scss
|
|
*
|
|
* @type {Record<WPBreakpoint, number>}
|
|
*/
|
|
const BREAKPOINTS = {
|
|
xhuge: 1920,
|
|
huge: 1440,
|
|
wide: 1280,
|
|
xlarge: 1080,
|
|
large: 960,
|
|
medium: 782,
|
|
small: 600,
|
|
mobile: 480
|
|
};
|
|
|
|
/**
|
|
* @typedef {">=" | "<"} WPViewportOperator
|
|
*/
|
|
|
|
/**
|
|
* Object mapping media query operators to the condition to be used.
|
|
*
|
|
* @type {Record<WPViewportOperator, string>}
|
|
*/
|
|
const CONDITIONS = {
|
|
'>=': 'min-width',
|
|
'<': 'max-width'
|
|
};
|
|
|
|
/**
|
|
* Object mapping media query operators to a function that given a breakpointValue and a width evaluates if the operator matches the values.
|
|
*
|
|
* @type {Record<WPViewportOperator, (breakpointValue: number, width: number) => boolean>}
|
|
*/
|
|
const OPERATOR_EVALUATORS = {
|
|
'>=': (breakpointValue, width) => width >= breakpointValue,
|
|
'<': (breakpointValue, width) => width < breakpointValue
|
|
};
|
|
const ViewportMatchWidthContext = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createContext)( /** @type {null | number} */null);
|
|
|
|
/**
|
|
* Returns true if the viewport matches the given query, or false otherwise.
|
|
*
|
|
* @param {WPBreakpoint} breakpoint Breakpoint size name.
|
|
* @param {WPViewportOperator} [operator=">="] Viewport operator.
|
|
*
|
|
* @example
|
|
*
|
|
* ```js
|
|
* useViewportMatch( 'huge', '<' );
|
|
* useViewportMatch( 'medium' );
|
|
* ```
|
|
*
|
|
* @return {boolean} Whether viewport matches query.
|
|
*/
|
|
const useViewportMatch = (breakpoint, operator = '>=') => {
|
|
const simulatedWidth = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useContext)(ViewportMatchWidthContext);
|
|
const mediaQuery = !simulatedWidth && `(${CONDITIONS[operator]}: ${BREAKPOINTS[breakpoint]}px)`;
|
|
const mediaQueryResult = (0,_use_media_query__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A)(mediaQuery || undefined);
|
|
if (simulatedWidth) {
|
|
return OPERATOR_EVALUATORS[operator](BREAKPOINTS[breakpoint], simulatedWidth);
|
|
}
|
|
return mediaQueryResult;
|
|
};
|
|
useViewportMatch.__experimentalWidthProvider = ViewportMatchWidthContext.Provider;
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (useViewportMatch);
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+dataviews@4.3.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@wordpress/dataviews/build-module/normalize-fields.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
t: () => (/* binding */ normalizeFields)
|
|
});
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+dataviews@4.3.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@wordpress/dataviews/build-module/field-types/integer.js
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
function sort(a, b, direction) {
|
|
return direction === 'asc' ? a - b : b - a;
|
|
}
|
|
function isValid(value, context) {
|
|
// TODO: this implicitely means the value is required.
|
|
if (value === '') {
|
|
return false;
|
|
}
|
|
if (!Number.isInteger(Number(value))) {
|
|
return false;
|
|
}
|
|
if (context?.elements) {
|
|
const validValues = context?.elements.map(f => f.value);
|
|
if (!validValues.includes(Number(value))) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
/* harmony default export */ const integer = ({
|
|
sort,
|
|
isValid,
|
|
Edit: 'integer'
|
|
});
|
|
//# sourceMappingURL=integer.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+dataviews@4.3.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@wordpress/dataviews/build-module/field-types/text.js
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
function text_sort(valueA, valueB, direction) {
|
|
return direction === 'asc' ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA);
|
|
}
|
|
function text_isValid(value, context) {
|
|
if (context?.elements) {
|
|
const validValues = context?.elements?.map(f => f.value);
|
|
if (!validValues.includes(value)) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
/* harmony default export */ const field_types_text = ({
|
|
sort: text_sort,
|
|
isValid: text_isValid,
|
|
Edit: 'text'
|
|
});
|
|
//# sourceMappingURL=text.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+dataviews@4.3.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@wordpress/dataviews/build-module/field-types/datetime.js
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
function datetime_sort(a, b, direction) {
|
|
const timeA = new Date(a).getTime();
|
|
const timeB = new Date(b).getTime();
|
|
return direction === 'asc' ? timeA - timeB : timeB - timeA;
|
|
}
|
|
function datetime_isValid(value, context) {
|
|
if (context?.elements) {
|
|
const validValues = context?.elements.map(f => f.value);
|
|
if (!validValues.includes(value)) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
/* harmony default export */ const datetime = ({
|
|
sort: datetime_sort,
|
|
isValid: datetime_isValid,
|
|
Edit: 'datetime'
|
|
});
|
|
//# sourceMappingURL=datetime.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+dataviews@4.3.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@wordpress/dataviews/build-module/field-types/index.js
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
*
|
|
* @param {FieldType} type The field type definition to get.
|
|
*
|
|
* @return A field type definition.
|
|
*/
|
|
function getFieldTypeDefinition(type) {
|
|
if ('integer' === type) {
|
|
return integer;
|
|
}
|
|
if ('text' === type) {
|
|
return field_types_text;
|
|
}
|
|
if ('datetime' === type) {
|
|
return datetime;
|
|
}
|
|
return {
|
|
sort: (a, b, direction) => {
|
|
if (typeof a === 'number' && typeof b === 'number') {
|
|
return direction === 'asc' ? a - b : b - a;
|
|
}
|
|
return direction === 'asc' ? a.localeCompare(b) : b.localeCompare(a);
|
|
},
|
|
isValid: (value, context) => {
|
|
if (context?.elements) {
|
|
const validValues = context?.elements?.map(f => f.value);
|
|
if (!validValues.includes(value)) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
},
|
|
Edit: () => null
|
|
};
|
|
}
|
|
//# sourceMappingURL=index.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/base-control/index.js
|
|
var base_control = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/base-control/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/visually-hidden/component.js + 1 modules
|
|
var component = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/visually-hidden/component.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/toDate.mjs
|
|
/**
|
|
* @name toDate
|
|
* @category Common Helpers
|
|
* @summary Convert the given argument to an instance of Date.
|
|
*
|
|
* @description
|
|
* Convert the given argument to an instance of Date.
|
|
*
|
|
* If the argument is an instance of Date, the function returns its clone.
|
|
*
|
|
* If the argument is a number, it is treated as a timestamp.
|
|
*
|
|
* If the argument is none of the above, the function returns Invalid Date.
|
|
*
|
|
* **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
|
|
*
|
|
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
*
|
|
* @param argument - The value to convert
|
|
*
|
|
* @returns The parsed date in the local time zone
|
|
*
|
|
* @example
|
|
* // Clone the date:
|
|
* const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
|
|
* //=> Tue Feb 11 2014 11:30:30
|
|
*
|
|
* @example
|
|
* // Convert the timestamp to date:
|
|
* const result = toDate(1392098430000)
|
|
* //=> Tue Feb 11 2014 11:30:30
|
|
*/
|
|
function toDate(argument) {
|
|
const argStr = Object.prototype.toString.call(argument);
|
|
|
|
// Clone the date
|
|
if (
|
|
argument instanceof Date ||
|
|
(typeof argument === "object" && argStr === "[object Date]")
|
|
) {
|
|
// Prevent the date to lose the milliseconds when passed to new Date() in IE10
|
|
return new argument.constructor(+argument);
|
|
} else if (
|
|
typeof argument === "number" ||
|
|
argStr === "[object Number]" ||
|
|
typeof argument === "string" ||
|
|
argStr === "[object String]"
|
|
) {
|
|
// TODO: Can we get rid of as?
|
|
return new Date(argument);
|
|
} else {
|
|
// TODO: Can we get rid of as?
|
|
return new Date(NaN);
|
|
}
|
|
}
|
|
|
|
// Fallback for modularized imports:
|
|
/* harmony default export */ const date_fns_toDate = ((/* unused pure expression or super */ null && (toDate)));
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/startOfMinute.mjs
|
|
|
|
|
|
/**
|
|
* @name startOfMinute
|
|
* @category Minute Helpers
|
|
* @summary Return the start of a minute for the given date.
|
|
*
|
|
* @description
|
|
* Return the start of a minute for the given date.
|
|
* The result will be in the local timezone.
|
|
*
|
|
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
*
|
|
* @param date - The original date
|
|
*
|
|
* @returns The start of a minute
|
|
*
|
|
* @example
|
|
* // The start of a minute for 1 December 2014 22:15:45.400:
|
|
* const result = startOfMinute(new Date(2014, 11, 1, 22, 15, 45, 400))
|
|
* //=> Mon Dec 01 2014 22:15:00
|
|
*/
|
|
function startOfMinute(date) {
|
|
const _date = toDate(date);
|
|
_date.setSeconds(0, 0);
|
|
return _date;
|
|
}
|
|
|
|
// Fallback for modularized imports:
|
|
/* harmony default export */ const date_fns_startOfMinute = ((/* unused pure expression or super */ null && (startOfMinute)));
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/en-US/_lib/formatDistance.mjs
|
|
const formatDistanceLocale = {
|
|
lessThanXSeconds: {
|
|
one: "less than a second",
|
|
other: "less than {{count}} seconds",
|
|
},
|
|
|
|
xSeconds: {
|
|
one: "1 second",
|
|
other: "{{count}} seconds",
|
|
},
|
|
|
|
halfAMinute: "half a minute",
|
|
|
|
lessThanXMinutes: {
|
|
one: "less than a minute",
|
|
other: "less than {{count}} minutes",
|
|
},
|
|
|
|
xMinutes: {
|
|
one: "1 minute",
|
|
other: "{{count}} minutes",
|
|
},
|
|
|
|
aboutXHours: {
|
|
one: "about 1 hour",
|
|
other: "about {{count}} hours",
|
|
},
|
|
|
|
xHours: {
|
|
one: "1 hour",
|
|
other: "{{count}} hours",
|
|
},
|
|
|
|
xDays: {
|
|
one: "1 day",
|
|
other: "{{count}} days",
|
|
},
|
|
|
|
aboutXWeeks: {
|
|
one: "about 1 week",
|
|
other: "about {{count}} weeks",
|
|
},
|
|
|
|
xWeeks: {
|
|
one: "1 week",
|
|
other: "{{count}} weeks",
|
|
},
|
|
|
|
aboutXMonths: {
|
|
one: "about 1 month",
|
|
other: "about {{count}} months",
|
|
},
|
|
|
|
xMonths: {
|
|
one: "1 month",
|
|
other: "{{count}} months",
|
|
},
|
|
|
|
aboutXYears: {
|
|
one: "about 1 year",
|
|
other: "about {{count}} years",
|
|
},
|
|
|
|
xYears: {
|
|
one: "1 year",
|
|
other: "{{count}} years",
|
|
},
|
|
|
|
overXYears: {
|
|
one: "over 1 year",
|
|
other: "over {{count}} years",
|
|
},
|
|
|
|
almostXYears: {
|
|
one: "almost 1 year",
|
|
other: "almost {{count}} years",
|
|
},
|
|
};
|
|
|
|
const formatDistance = (token, count, options) => {
|
|
let result;
|
|
|
|
const tokenValue = formatDistanceLocale[token];
|
|
if (typeof tokenValue === "string") {
|
|
result = tokenValue;
|
|
} else if (count === 1) {
|
|
result = tokenValue.one;
|
|
} else {
|
|
result = tokenValue.other.replace("{{count}}", count.toString());
|
|
}
|
|
|
|
if (options?.addSuffix) {
|
|
if (options.comparison && options.comparison > 0) {
|
|
return "in " + result;
|
|
} else {
|
|
return result + " ago";
|
|
}
|
|
}
|
|
|
|
return result;
|
|
};
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/_lib/buildFormatLongFn.mjs
|
|
function buildFormatLongFn(args) {
|
|
return (options = {}) => {
|
|
// TODO: Remove String()
|
|
const width = options.width ? String(options.width) : args.defaultWidth;
|
|
const format = args.formats[width] || args.formats[args.defaultWidth];
|
|
return format;
|
|
};
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/en-US/_lib/formatLong.mjs
|
|
|
|
|
|
const dateFormats = {
|
|
full: "EEEE, MMMM do, y",
|
|
long: "MMMM do, y",
|
|
medium: "MMM d, y",
|
|
short: "MM/dd/yyyy",
|
|
};
|
|
|
|
const timeFormats = {
|
|
full: "h:mm:ss a zzzz",
|
|
long: "h:mm:ss a z",
|
|
medium: "h:mm:ss a",
|
|
short: "h:mm a",
|
|
};
|
|
|
|
const dateTimeFormats = {
|
|
full: "{{date}} 'at' {{time}}",
|
|
long: "{{date}} 'at' {{time}}",
|
|
medium: "{{date}}, {{time}}",
|
|
short: "{{date}}, {{time}}",
|
|
};
|
|
|
|
const formatLong = {
|
|
date: buildFormatLongFn({
|
|
formats: dateFormats,
|
|
defaultWidth: "full",
|
|
}),
|
|
|
|
time: buildFormatLongFn({
|
|
formats: timeFormats,
|
|
defaultWidth: "full",
|
|
}),
|
|
|
|
dateTime: buildFormatLongFn({
|
|
formats: dateTimeFormats,
|
|
defaultWidth: "full",
|
|
}),
|
|
};
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/en-US/_lib/formatRelative.mjs
|
|
const formatRelativeLocale = {
|
|
lastWeek: "'last' eeee 'at' p",
|
|
yesterday: "'yesterday at' p",
|
|
today: "'today at' p",
|
|
tomorrow: "'tomorrow at' p",
|
|
nextWeek: "eeee 'at' p",
|
|
other: "P",
|
|
};
|
|
|
|
const formatRelative = (token, _date, _baseDate, _options) =>
|
|
formatRelativeLocale[token];
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/_lib/buildLocalizeFn.mjs
|
|
/* eslint-disable no-unused-vars */
|
|
|
|
/**
|
|
* The localize function argument callback which allows to convert raw value to
|
|
* the actual type.
|
|
*
|
|
* @param value - The value to convert
|
|
*
|
|
* @returns The converted value
|
|
*/
|
|
|
|
/**
|
|
* The map of localized values for each width.
|
|
*/
|
|
|
|
/**
|
|
* The index type of the locale unit value. It types conversion of units of
|
|
* values that don't start at 0 (i.e. quarters).
|
|
*/
|
|
|
|
/**
|
|
* Converts the unit value to the tuple of values.
|
|
*/
|
|
|
|
/**
|
|
* The tuple of localized era values. The first element represents BC,
|
|
* the second element represents AD.
|
|
*/
|
|
|
|
/**
|
|
* The tuple of localized quarter values. The first element represents Q1.
|
|
*/
|
|
|
|
/**
|
|
* The tuple of localized day values. The first element represents Sunday.
|
|
*/
|
|
|
|
/**
|
|
* The tuple of localized month values. The first element represents January.
|
|
*/
|
|
|
|
function buildLocalizeFn(args) {
|
|
return (value, options) => {
|
|
const context = options?.context ? String(options.context) : "standalone";
|
|
|
|
let valuesArray;
|
|
if (context === "formatting" && args.formattingValues) {
|
|
const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
|
|
const width = options?.width ? String(options.width) : defaultWidth;
|
|
|
|
valuesArray =
|
|
args.formattingValues[width] || args.formattingValues[defaultWidth];
|
|
} else {
|
|
const defaultWidth = args.defaultWidth;
|
|
const width = options?.width ? String(options.width) : args.defaultWidth;
|
|
|
|
valuesArray = args.values[width] || args.values[defaultWidth];
|
|
}
|
|
const index = args.argumentCallback ? args.argumentCallback(value) : value;
|
|
|
|
// @ts-expect-error - For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!
|
|
return valuesArray[index];
|
|
};
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/en-US/_lib/localize.mjs
|
|
|
|
|
|
const eraValues = {
|
|
narrow: ["B", "A"],
|
|
abbreviated: ["BC", "AD"],
|
|
wide: ["Before Christ", "Anno Domini"],
|
|
};
|
|
|
|
const quarterValues = {
|
|
narrow: ["1", "2", "3", "4"],
|
|
abbreviated: ["Q1", "Q2", "Q3", "Q4"],
|
|
wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"],
|
|
};
|
|
|
|
// Note: in English, the names of days of the week and months are capitalized.
|
|
// If you are making a new locale based on this one, check if the same is true for the language you're working on.
|
|
// Generally, formatted dates should look like they are in the middle of a sentence,
|
|
// e.g. in Spanish language the weekdays and months should be in the lowercase.
|
|
const monthValues = {
|
|
narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
|
|
abbreviated: [
|
|
"Jan",
|
|
"Feb",
|
|
"Mar",
|
|
"Apr",
|
|
"May",
|
|
"Jun",
|
|
"Jul",
|
|
"Aug",
|
|
"Sep",
|
|
"Oct",
|
|
"Nov",
|
|
"Dec",
|
|
],
|
|
|
|
wide: [
|
|
"January",
|
|
"February",
|
|
"March",
|
|
"April",
|
|
"May",
|
|
"June",
|
|
"July",
|
|
"August",
|
|
"September",
|
|
"October",
|
|
"November",
|
|
"December",
|
|
],
|
|
};
|
|
|
|
const dayValues = {
|
|
narrow: ["S", "M", "T", "W", "T", "F", "S"],
|
|
short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
|
|
abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
wide: [
|
|
"Sunday",
|
|
"Monday",
|
|
"Tuesday",
|
|
"Wednesday",
|
|
"Thursday",
|
|
"Friday",
|
|
"Saturday",
|
|
],
|
|
};
|
|
|
|
const dayPeriodValues = {
|
|
narrow: {
|
|
am: "a",
|
|
pm: "p",
|
|
midnight: "mi",
|
|
noon: "n",
|
|
morning: "morning",
|
|
afternoon: "afternoon",
|
|
evening: "evening",
|
|
night: "night",
|
|
},
|
|
abbreviated: {
|
|
am: "AM",
|
|
pm: "PM",
|
|
midnight: "midnight",
|
|
noon: "noon",
|
|
morning: "morning",
|
|
afternoon: "afternoon",
|
|
evening: "evening",
|
|
night: "night",
|
|
},
|
|
wide: {
|
|
am: "a.m.",
|
|
pm: "p.m.",
|
|
midnight: "midnight",
|
|
noon: "noon",
|
|
morning: "morning",
|
|
afternoon: "afternoon",
|
|
evening: "evening",
|
|
night: "night",
|
|
},
|
|
};
|
|
|
|
const formattingDayPeriodValues = {
|
|
narrow: {
|
|
am: "a",
|
|
pm: "p",
|
|
midnight: "mi",
|
|
noon: "n",
|
|
morning: "in the morning",
|
|
afternoon: "in the afternoon",
|
|
evening: "in the evening",
|
|
night: "at night",
|
|
},
|
|
abbreviated: {
|
|
am: "AM",
|
|
pm: "PM",
|
|
midnight: "midnight",
|
|
noon: "noon",
|
|
morning: "in the morning",
|
|
afternoon: "in the afternoon",
|
|
evening: "in the evening",
|
|
night: "at night",
|
|
},
|
|
wide: {
|
|
am: "a.m.",
|
|
pm: "p.m.",
|
|
midnight: "midnight",
|
|
noon: "noon",
|
|
morning: "in the morning",
|
|
afternoon: "in the afternoon",
|
|
evening: "in the evening",
|
|
night: "at night",
|
|
},
|
|
};
|
|
|
|
const ordinalNumber = (dirtyNumber, _options) => {
|
|
const number = Number(dirtyNumber);
|
|
|
|
// If ordinal numbers depend on context, for example,
|
|
// if they are different for different grammatical genders,
|
|
// use `options.unit`.
|
|
//
|
|
// `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
|
|
// 'day', 'hour', 'minute', 'second'.
|
|
|
|
const rem100 = number % 100;
|
|
if (rem100 > 20 || rem100 < 10) {
|
|
switch (rem100 % 10) {
|
|
case 1:
|
|
return number + "st";
|
|
case 2:
|
|
return number + "nd";
|
|
case 3:
|
|
return number + "rd";
|
|
}
|
|
}
|
|
return number + "th";
|
|
};
|
|
|
|
const localize = {
|
|
ordinalNumber,
|
|
|
|
era: buildLocalizeFn({
|
|
values: eraValues,
|
|
defaultWidth: "wide",
|
|
}),
|
|
|
|
quarter: buildLocalizeFn({
|
|
values: quarterValues,
|
|
defaultWidth: "wide",
|
|
argumentCallback: (quarter) => quarter - 1,
|
|
}),
|
|
|
|
month: buildLocalizeFn({
|
|
values: monthValues,
|
|
defaultWidth: "wide",
|
|
}),
|
|
|
|
day: buildLocalizeFn({
|
|
values: dayValues,
|
|
defaultWidth: "wide",
|
|
}),
|
|
|
|
dayPeriod: buildLocalizeFn({
|
|
values: dayPeriodValues,
|
|
defaultWidth: "wide",
|
|
formattingValues: formattingDayPeriodValues,
|
|
defaultFormattingWidth: "wide",
|
|
}),
|
|
};
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/_lib/buildMatchFn.mjs
|
|
function buildMatchFn(args) {
|
|
return (string, options = {}) => {
|
|
const width = options.width;
|
|
|
|
const matchPattern =
|
|
(width && args.matchPatterns[width]) ||
|
|
args.matchPatterns[args.defaultMatchWidth];
|
|
const matchResult = string.match(matchPattern);
|
|
|
|
if (!matchResult) {
|
|
return null;
|
|
}
|
|
const matchedString = matchResult[0];
|
|
|
|
const parsePatterns =
|
|
(width && args.parsePatterns[width]) ||
|
|
args.parsePatterns[args.defaultParseWidth];
|
|
|
|
const key = Array.isArray(parsePatterns)
|
|
? findIndex(parsePatterns, (pattern) => pattern.test(matchedString))
|
|
: // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
|
|
findKey(parsePatterns, (pattern) => pattern.test(matchedString));
|
|
|
|
let value;
|
|
|
|
value = args.valueCallback ? args.valueCallback(key) : key;
|
|
value = options.valueCallback
|
|
? // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
|
|
options.valueCallback(value)
|
|
: value;
|
|
|
|
const rest = string.slice(matchedString.length);
|
|
|
|
return { value, rest };
|
|
};
|
|
}
|
|
|
|
function findKey(object, predicate) {
|
|
for (const key in object) {
|
|
if (
|
|
Object.prototype.hasOwnProperty.call(object, key) &&
|
|
predicate(object[key])
|
|
) {
|
|
return key;
|
|
}
|
|
}
|
|
return undefined;
|
|
}
|
|
|
|
function findIndex(array, predicate) {
|
|
for (let key = 0; key < array.length; key++) {
|
|
if (predicate(array[key])) {
|
|
return key;
|
|
}
|
|
}
|
|
return undefined;
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/_lib/buildMatchPatternFn.mjs
|
|
function buildMatchPatternFn(args) {
|
|
return (string, options = {}) => {
|
|
const matchResult = string.match(args.matchPattern);
|
|
if (!matchResult) return null;
|
|
const matchedString = matchResult[0];
|
|
|
|
const parseResult = string.match(args.parsePattern);
|
|
if (!parseResult) return null;
|
|
let value = args.valueCallback
|
|
? args.valueCallback(parseResult[0])
|
|
: parseResult[0];
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
|
|
value = options.valueCallback ? options.valueCallback(value) : value;
|
|
|
|
const rest = string.slice(matchedString.length);
|
|
|
|
return { value, rest };
|
|
};
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/en-US/_lib/match.mjs
|
|
|
|
|
|
|
|
const matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
|
|
const parseOrdinalNumberPattern = /\d+/i;
|
|
|
|
const matchEraPatterns = {
|
|
narrow: /^(b|a)/i,
|
|
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
|
|
wide: /^(before christ|before common era|anno domini|common era)/i,
|
|
};
|
|
const parseEraPatterns = {
|
|
any: [/^b/i, /^(a|c)/i],
|
|
};
|
|
|
|
const matchQuarterPatterns = {
|
|
narrow: /^[1234]/i,
|
|
abbreviated: /^q[1234]/i,
|
|
wide: /^[1234](th|st|nd|rd)? quarter/i,
|
|
};
|
|
const parseQuarterPatterns = {
|
|
any: [/1/i, /2/i, /3/i, /4/i],
|
|
};
|
|
|
|
const matchMonthPatterns = {
|
|
narrow: /^[jfmasond]/i,
|
|
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
|
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i,
|
|
};
|
|
const parseMonthPatterns = {
|
|
narrow: [
|
|
/^j/i,
|
|
/^f/i,
|
|
/^m/i,
|
|
/^a/i,
|
|
/^m/i,
|
|
/^j/i,
|
|
/^j/i,
|
|
/^a/i,
|
|
/^s/i,
|
|
/^o/i,
|
|
/^n/i,
|
|
/^d/i,
|
|
],
|
|
|
|
any: [
|
|
/^ja/i,
|
|
/^f/i,
|
|
/^mar/i,
|
|
/^ap/i,
|
|
/^may/i,
|
|
/^jun/i,
|
|
/^jul/i,
|
|
/^au/i,
|
|
/^s/i,
|
|
/^o/i,
|
|
/^n/i,
|
|
/^d/i,
|
|
],
|
|
};
|
|
|
|
const matchDayPatterns = {
|
|
narrow: /^[smtwf]/i,
|
|
short: /^(su|mo|tu|we|th|fr|sa)/i,
|
|
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
|
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i,
|
|
};
|
|
const parseDayPatterns = {
|
|
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
|
|
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i],
|
|
};
|
|
|
|
const matchDayPeriodPatterns = {
|
|
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
|
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i,
|
|
};
|
|
const parseDayPeriodPatterns = {
|
|
any: {
|
|
am: /^a/i,
|
|
pm: /^p/i,
|
|
midnight: /^mi/i,
|
|
noon: /^no/i,
|
|
morning: /morning/i,
|
|
afternoon: /afternoon/i,
|
|
evening: /evening/i,
|
|
night: /night/i,
|
|
},
|
|
};
|
|
|
|
const match = {
|
|
ordinalNumber: buildMatchPatternFn({
|
|
matchPattern: matchOrdinalNumberPattern,
|
|
parsePattern: parseOrdinalNumberPattern,
|
|
valueCallback: (value) => parseInt(value, 10),
|
|
}),
|
|
|
|
era: buildMatchFn({
|
|
matchPatterns: matchEraPatterns,
|
|
defaultMatchWidth: "wide",
|
|
parsePatterns: parseEraPatterns,
|
|
defaultParseWidth: "any",
|
|
}),
|
|
|
|
quarter: buildMatchFn({
|
|
matchPatterns: matchQuarterPatterns,
|
|
defaultMatchWidth: "wide",
|
|
parsePatterns: parseQuarterPatterns,
|
|
defaultParseWidth: "any",
|
|
valueCallback: (index) => index + 1,
|
|
}),
|
|
|
|
month: buildMatchFn({
|
|
matchPatterns: matchMonthPatterns,
|
|
defaultMatchWidth: "wide",
|
|
parsePatterns: parseMonthPatterns,
|
|
defaultParseWidth: "any",
|
|
}),
|
|
|
|
day: buildMatchFn({
|
|
matchPatterns: matchDayPatterns,
|
|
defaultMatchWidth: "wide",
|
|
parsePatterns: parseDayPatterns,
|
|
defaultParseWidth: "any",
|
|
}),
|
|
|
|
dayPeriod: buildMatchFn({
|
|
matchPatterns: matchDayPeriodPatterns,
|
|
defaultMatchWidth: "any",
|
|
parsePatterns: parseDayPeriodPatterns,
|
|
defaultParseWidth: "any",
|
|
}),
|
|
};
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/en-US.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* @category Locales
|
|
* @summary English locale (United States).
|
|
* @language English
|
|
* @iso-639-2 eng
|
|
* @author Sasha Koss [@kossnocorp](https://github.com/kossnocorp)
|
|
* @author Lesha Koss [@leshakoss](https://github.com/leshakoss)
|
|
*/
|
|
const enUS = {
|
|
code: "en-US",
|
|
formatDistance: formatDistance,
|
|
formatLong: formatLong,
|
|
formatRelative: formatRelative,
|
|
localize: localize,
|
|
match: match,
|
|
options: {
|
|
weekStartsOn: 0 /* Sunday */,
|
|
firstWeekContainsDate: 1,
|
|
},
|
|
};
|
|
|
|
// Fallback for modularized imports:
|
|
/* harmony default export */ const en_US = ((/* unused pure expression or super */ null && (enUS)));
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/_lib/defaultOptions.mjs
|
|
let defaultOptions = {};
|
|
|
|
function getDefaultOptions() {
|
|
return defaultOptions;
|
|
}
|
|
|
|
function setDefaultOptions(newOptions) {
|
|
defaultOptions = newOptions;
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/constants.mjs
|
|
/**
|
|
* @module constants
|
|
* @summary Useful constants
|
|
* @description
|
|
* Collection of useful date constants.
|
|
*
|
|
* The constants could be imported from `date-fns/constants`:
|
|
*
|
|
* ```ts
|
|
* import { maxTime, minTime } from "./constants/date-fns/constants";
|
|
*
|
|
* function isAllowedTime(time) {
|
|
* return time <= maxTime && time >= minTime;
|
|
* }
|
|
* ```
|
|
*/
|
|
|
|
/**
|
|
* @constant
|
|
* @name daysInWeek
|
|
* @summary Days in 1 week.
|
|
*/
|
|
const daysInWeek = 7;
|
|
|
|
/**
|
|
* @constant
|
|
* @name daysInYear
|
|
* @summary Days in 1 year.
|
|
*
|
|
* @description
|
|
* How many days in a year.
|
|
*
|
|
* One years equals 365.2425 days according to the formula:
|
|
*
|
|
* > Leap year occures every 4 years, except for years that are divisable by 100 and not divisable by 400.
|
|
* > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days
|
|
*/
|
|
const daysInYear = 365.2425;
|
|
|
|
/**
|
|
* @constant
|
|
* @name maxTime
|
|
* @summary Maximum allowed time.
|
|
*
|
|
* @example
|
|
* import { maxTime } from "./constants/date-fns/constants";
|
|
*
|
|
* const isValid = 8640000000000001 <= maxTime;
|
|
* //=> false
|
|
*
|
|
* new Date(8640000000000001);
|
|
* //=> Invalid Date
|
|
*/
|
|
const maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;
|
|
|
|
/**
|
|
* @constant
|
|
* @name minTime
|
|
* @summary Minimum allowed time.
|
|
*
|
|
* @example
|
|
* import { minTime } from "./constants/date-fns/constants";
|
|
*
|
|
* const isValid = -8640000000000001 >= minTime;
|
|
* //=> false
|
|
*
|
|
* new Date(-8640000000000001)
|
|
* //=> Invalid Date
|
|
*/
|
|
const minTime = -maxTime;
|
|
|
|
/**
|
|
* @constant
|
|
* @name millisecondsInWeek
|
|
* @summary Milliseconds in 1 week.
|
|
*/
|
|
const millisecondsInWeek = 604800000;
|
|
|
|
/**
|
|
* @constant
|
|
* @name millisecondsInDay
|
|
* @summary Milliseconds in 1 day.
|
|
*/
|
|
const millisecondsInDay = 86400000;
|
|
|
|
/**
|
|
* @constant
|
|
* @name millisecondsInMinute
|
|
* @summary Milliseconds in 1 minute
|
|
*/
|
|
const millisecondsInMinute = 60000;
|
|
|
|
/**
|
|
* @constant
|
|
* @name millisecondsInHour
|
|
* @summary Milliseconds in 1 hour
|
|
*/
|
|
const millisecondsInHour = 3600000;
|
|
|
|
/**
|
|
* @constant
|
|
* @name millisecondsInSecond
|
|
* @summary Milliseconds in 1 second
|
|
*/
|
|
const millisecondsInSecond = 1000;
|
|
|
|
/**
|
|
* @constant
|
|
* @name minutesInYear
|
|
* @summary Minutes in 1 year.
|
|
*/
|
|
const minutesInYear = 525600;
|
|
|
|
/**
|
|
* @constant
|
|
* @name minutesInMonth
|
|
* @summary Minutes in 1 month.
|
|
*/
|
|
const minutesInMonth = 43200;
|
|
|
|
/**
|
|
* @constant
|
|
* @name minutesInDay
|
|
* @summary Minutes in 1 day.
|
|
*/
|
|
const minutesInDay = 1440;
|
|
|
|
/**
|
|
* @constant
|
|
* @name minutesInHour
|
|
* @summary Minutes in 1 hour.
|
|
*/
|
|
const minutesInHour = 60;
|
|
|
|
/**
|
|
* @constant
|
|
* @name monthsInQuarter
|
|
* @summary Months in 1 quarter.
|
|
*/
|
|
const monthsInQuarter = 3;
|
|
|
|
/**
|
|
* @constant
|
|
* @name monthsInYear
|
|
* @summary Months in 1 year.
|
|
*/
|
|
const monthsInYear = 12;
|
|
|
|
/**
|
|
* @constant
|
|
* @name quartersInYear
|
|
* @summary Quarters in 1 year
|
|
*/
|
|
const quartersInYear = 4;
|
|
|
|
/**
|
|
* @constant
|
|
* @name secondsInHour
|
|
* @summary Seconds in 1 hour.
|
|
*/
|
|
const secondsInHour = 3600;
|
|
|
|
/**
|
|
* @constant
|
|
* @name secondsInMinute
|
|
* @summary Seconds in 1 minute.
|
|
*/
|
|
const secondsInMinute = 60;
|
|
|
|
/**
|
|
* @constant
|
|
* @name secondsInDay
|
|
* @summary Seconds in 1 day.
|
|
*/
|
|
const secondsInDay = secondsInHour * 24;
|
|
|
|
/**
|
|
* @constant
|
|
* @name secondsInWeek
|
|
* @summary Seconds in 1 week.
|
|
*/
|
|
const secondsInWeek = secondsInDay * 7;
|
|
|
|
/**
|
|
* @constant
|
|
* @name secondsInYear
|
|
* @summary Seconds in 1 year.
|
|
*/
|
|
const secondsInYear = secondsInDay * daysInYear;
|
|
|
|
/**
|
|
* @constant
|
|
* @name secondsInMonth
|
|
* @summary Seconds in 1 month
|
|
*/
|
|
const secondsInMonth = secondsInYear / 12;
|
|
|
|
/**
|
|
* @constant
|
|
* @name secondsInQuarter
|
|
* @summary Seconds in 1 quarter.
|
|
*/
|
|
const secondsInQuarter = secondsInMonth * 3;
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/startOfDay.mjs
|
|
|
|
|
|
/**
|
|
* @name startOfDay
|
|
* @category Day Helpers
|
|
* @summary Return the start of a day for the given date.
|
|
*
|
|
* @description
|
|
* Return the start of a day for the given date.
|
|
* The result will be in the local timezone.
|
|
*
|
|
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
*
|
|
* @param date - The original date
|
|
*
|
|
* @returns The start of a day
|
|
*
|
|
* @example
|
|
* // The start of a day for 2 September 2014 11:55:00:
|
|
* const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
|
|
* //=> Tue Sep 02 2014 00:00:00
|
|
*/
|
|
function startOfDay(date) {
|
|
const _date = toDate(date);
|
|
_date.setHours(0, 0, 0, 0);
|
|
return _date;
|
|
}
|
|
|
|
// Fallback for modularized imports:
|
|
/* harmony default export */ const date_fns_startOfDay = ((/* unused pure expression or super */ null && (startOfDay)));
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.mjs
|
|
|
|
|
|
/**
|
|
* Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
|
|
* They usually appear for dates that denote time before the timezones were introduced
|
|
* (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
|
|
* and GMT+01:00:00 after that date)
|
|
*
|
|
* Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
|
|
* which would lead to incorrect calculations.
|
|
*
|
|
* This function returns the timezone offset in milliseconds that takes seconds in account.
|
|
*/
|
|
function getTimezoneOffsetInMilliseconds(date) {
|
|
const _date = toDate(date);
|
|
const utcDate = new Date(
|
|
Date.UTC(
|
|
_date.getFullYear(),
|
|
_date.getMonth(),
|
|
_date.getDate(),
|
|
_date.getHours(),
|
|
_date.getMinutes(),
|
|
_date.getSeconds(),
|
|
_date.getMilliseconds(),
|
|
),
|
|
);
|
|
utcDate.setUTCFullYear(_date.getFullYear());
|
|
return +date - +utcDate;
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/differenceInCalendarDays.mjs
|
|
|
|
|
|
|
|
|
|
/**
|
|
* @name differenceInCalendarDays
|
|
* @category Day Helpers
|
|
* @summary Get the number of calendar days between the given dates.
|
|
*
|
|
* @description
|
|
* Get the number of calendar days between the given dates. This means that the times are removed
|
|
* from the dates and then the difference in days is calculated.
|
|
*
|
|
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
*
|
|
* @param dateLeft - The later date
|
|
* @param dateRight - The earlier date
|
|
*
|
|
* @returns The number of calendar days
|
|
*
|
|
* @example
|
|
* // How many calendar days are between
|
|
* // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?
|
|
* const result = differenceInCalendarDays(
|
|
* new Date(2012, 6, 2, 0, 0),
|
|
* new Date(2011, 6, 2, 23, 0)
|
|
* )
|
|
* //=> 366
|
|
* // How many calendar days are between
|
|
* // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?
|
|
* const result = differenceInCalendarDays(
|
|
* new Date(2011, 6, 3, 0, 1),
|
|
* new Date(2011, 6, 2, 23, 59)
|
|
* )
|
|
* //=> 1
|
|
*/
|
|
function differenceInCalendarDays(dateLeft, dateRight) {
|
|
const startOfDayLeft = startOfDay(dateLeft);
|
|
const startOfDayRight = startOfDay(dateRight);
|
|
|
|
const timestampLeft =
|
|
+startOfDayLeft - getTimezoneOffsetInMilliseconds(startOfDayLeft);
|
|
const timestampRight =
|
|
+startOfDayRight - getTimezoneOffsetInMilliseconds(startOfDayRight);
|
|
|
|
// Round the number of days to the nearest integer because the number of
|
|
// milliseconds in a day is not constant (e.g. it's different in the week of
|
|
// the daylight saving time clock shift).
|
|
return Math.round((timestampLeft - timestampRight) / millisecondsInDay);
|
|
}
|
|
|
|
// Fallback for modularized imports:
|
|
/* harmony default export */ const date_fns_differenceInCalendarDays = ((/* unused pure expression or super */ null && (differenceInCalendarDays)));
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/constructFrom.mjs
|
|
/**
|
|
* @name constructFrom
|
|
* @category Generic Helpers
|
|
* @summary Constructs a date using the reference date and the value
|
|
*
|
|
* @description
|
|
* The function constructs a new date using the constructor from the reference
|
|
* date and the given value. It helps to build generic functions that accept
|
|
* date extensions.
|
|
*
|
|
* It defaults to `Date` if the passed reference date is a number or a string.
|
|
*
|
|
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
*
|
|
* @param date - The reference date to take constructor from
|
|
* @param value - The value to create the date
|
|
*
|
|
* @returns Date initialized using the given date and value
|
|
*
|
|
* @example
|
|
* import { constructFrom } from 'date-fns'
|
|
*
|
|
* // A function that clones a date preserving the original type
|
|
* function cloneDate<DateType extends Date(date: DateType): DateType {
|
|
* return constructFrom(
|
|
* date, // Use contrustor from the given date
|
|
* date.getTime() // Use the date value to create a new date
|
|
* )
|
|
* }
|
|
*/
|
|
function constructFrom(date, value) {
|
|
if (date instanceof Date) {
|
|
return new date.constructor(value);
|
|
} else {
|
|
return new Date(value);
|
|
}
|
|
}
|
|
|
|
// Fallback for modularized imports:
|
|
/* harmony default export */ const date_fns_constructFrom = ((/* unused pure expression or super */ null && (constructFrom)));
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/startOfYear.mjs
|
|
|
|
|
|
|
|
/**
|
|
* @name startOfYear
|
|
* @category Year Helpers
|
|
* @summary Return the start of a year for the given date.
|
|
*
|
|
* @description
|
|
* Return the start of a year for the given date.
|
|
* The result will be in the local timezone.
|
|
*
|
|
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
*
|
|
* @param date - The original date
|
|
*
|
|
* @returns The start of a year
|
|
*
|
|
* @example
|
|
* // The start of a year for 2 September 2014 11:55:00:
|
|
* const result = startOfYear(new Date(2014, 8, 2, 11, 55, 00))
|
|
* //=> Wed Jan 01 2014 00:00:00
|
|
*/
|
|
function startOfYear(date) {
|
|
const cleanDate = toDate(date);
|
|
const _date = constructFrom(date, 0);
|
|
_date.setFullYear(cleanDate.getFullYear(), 0, 1);
|
|
_date.setHours(0, 0, 0, 0);
|
|
return _date;
|
|
}
|
|
|
|
// Fallback for modularized imports:
|
|
/* harmony default export */ const date_fns_startOfYear = ((/* unused pure expression or super */ null && (startOfYear)));
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/getDayOfYear.mjs
|
|
|
|
|
|
|
|
|
|
/**
|
|
* @name getDayOfYear
|
|
* @category Day Helpers
|
|
* @summary Get the day of the year of the given date.
|
|
*
|
|
* @description
|
|
* Get the day of the year of the given date.
|
|
*
|
|
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
*
|
|
* @param date - The given date
|
|
*
|
|
* @returns The day of year
|
|
*
|
|
* @example
|
|
* // Which day of the year is 2 July 2014?
|
|
* const result = getDayOfYear(new Date(2014, 6, 2))
|
|
* //=> 183
|
|
*/
|
|
function getDayOfYear(date) {
|
|
const _date = toDate(date);
|
|
const diff = differenceInCalendarDays(_date, startOfYear(_date));
|
|
const dayOfYear = diff + 1;
|
|
return dayOfYear;
|
|
}
|
|
|
|
// Fallback for modularized imports:
|
|
/* harmony default export */ const date_fns_getDayOfYear = ((/* unused pure expression or super */ null && (getDayOfYear)));
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/startOfWeek.mjs
|
|
|
|
|
|
|
|
/**
|
|
* The {@link startOfWeek} function options.
|
|
*/
|
|
|
|
/**
|
|
* @name startOfWeek
|
|
* @category Week Helpers
|
|
* @summary Return the start of a week for the given date.
|
|
*
|
|
* @description
|
|
* Return the start of a week for the given date.
|
|
* The result will be in the local timezone.
|
|
*
|
|
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
*
|
|
* @param date - The original date
|
|
* @param options - An object with options
|
|
*
|
|
* @returns The start of a week
|
|
*
|
|
* @example
|
|
* // The start of a week for 2 September 2014 11:55:00:
|
|
* const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))
|
|
* //=> Sun Aug 31 2014 00:00:00
|
|
*
|
|
* @example
|
|
* // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:
|
|
* const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
|
|
* //=> Mon Sep 01 2014 00:00:00
|
|
*/
|
|
function startOfWeek(date, options) {
|
|
const defaultOptions = getDefaultOptions();
|
|
const weekStartsOn =
|
|
options?.weekStartsOn ??
|
|
options?.locale?.options?.weekStartsOn ??
|
|
defaultOptions.weekStartsOn ??
|
|
defaultOptions.locale?.options?.weekStartsOn ??
|
|
0;
|
|
|
|
const _date = toDate(date);
|
|
const day = _date.getDay();
|
|
const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
|
|
|
|
_date.setDate(_date.getDate() - diff);
|
|
_date.setHours(0, 0, 0, 0);
|
|
return _date;
|
|
}
|
|
|
|
// Fallback for modularized imports:
|
|
/* harmony default export */ const date_fns_startOfWeek = ((/* unused pure expression or super */ null && (startOfWeek)));
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/startOfISOWeek.mjs
|
|
|
|
|
|
/**
|
|
* @name startOfISOWeek
|
|
* @category ISO Week Helpers
|
|
* @summary Return the start of an ISO week for the given date.
|
|
*
|
|
* @description
|
|
* Return the start of an ISO week for the given date.
|
|
* The result will be in the local timezone.
|
|
*
|
|
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
|
|
*
|
|
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
*
|
|
* @param date - The original date
|
|
*
|
|
* @returns The start of an ISO week
|
|
*
|
|
* @example
|
|
* // The start of an ISO week for 2 September 2014 11:55:00:
|
|
* const result = startOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))
|
|
* //=> Mon Sep 01 2014 00:00:00
|
|
*/
|
|
function startOfISOWeek(date) {
|
|
return startOfWeek(date, { weekStartsOn: 1 });
|
|
}
|
|
|
|
// Fallback for modularized imports:
|
|
/* harmony default export */ const date_fns_startOfISOWeek = ((/* unused pure expression or super */ null && (startOfISOWeek)));
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/getISOWeekYear.mjs
|
|
|
|
|
|
|
|
|
|
/**
|
|
* @name getISOWeekYear
|
|
* @category ISO Week-Numbering Year Helpers
|
|
* @summary Get the ISO week-numbering year of the given date.
|
|
*
|
|
* @description
|
|
* Get the ISO week-numbering year of the given date,
|
|
* which always starts 3 days before the year's first Thursday.
|
|
*
|
|
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
|
|
*
|
|
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
*
|
|
* @param date - The given date
|
|
*
|
|
* @returns The ISO week-numbering year
|
|
*
|
|
* @example
|
|
* // Which ISO-week numbering year is 2 January 2005?
|
|
* const result = getISOWeekYear(new Date(2005, 0, 2))
|
|
* //=> 2004
|
|
*/
|
|
function getISOWeekYear(date) {
|
|
const _date = toDate(date);
|
|
const year = _date.getFullYear();
|
|
|
|
const fourthOfJanuaryOfNextYear = constructFrom(date, 0);
|
|
fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
|
|
fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
|
|
const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
|
|
|
|
const fourthOfJanuaryOfThisYear = constructFrom(date, 0);
|
|
fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
|
|
fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
|
|
const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
|
|
|
|
if (_date.getTime() >= startOfNextYear.getTime()) {
|
|
return year + 1;
|
|
} else if (_date.getTime() >= startOfThisYear.getTime()) {
|
|
return year;
|
|
} else {
|
|
return year - 1;
|
|
}
|
|
}
|
|
|
|
// Fallback for modularized imports:
|
|
/* harmony default export */ const date_fns_getISOWeekYear = ((/* unused pure expression or super */ null && (getISOWeekYear)));
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/startOfISOWeekYear.mjs
|
|
|
|
|
|
|
|
|
|
/**
|
|
* @name startOfISOWeekYear
|
|
* @category ISO Week-Numbering Year Helpers
|
|
* @summary Return the start of an ISO week-numbering year for the given date.
|
|
*
|
|
* @description
|
|
* Return the start of an ISO week-numbering year,
|
|
* which always starts 3 days before the year's first Thursday.
|
|
* The result will be in the local timezone.
|
|
*
|
|
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
|
|
*
|
|
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
*
|
|
* @param date - The original date
|
|
*
|
|
* @returns The start of an ISO week-numbering year
|
|
*
|
|
* @example
|
|
* // The start of an ISO week-numbering year for 2 July 2005:
|
|
* const result = startOfISOWeekYear(new Date(2005, 6, 2))
|
|
* //=> Mon Jan 03 2005 00:00:00
|
|
*/
|
|
function startOfISOWeekYear(date) {
|
|
const year = getISOWeekYear(date);
|
|
const fourthOfJanuary = constructFrom(date, 0);
|
|
fourthOfJanuary.setFullYear(year, 0, 4);
|
|
fourthOfJanuary.setHours(0, 0, 0, 0);
|
|
return startOfISOWeek(fourthOfJanuary);
|
|
}
|
|
|
|
// Fallback for modularized imports:
|
|
/* harmony default export */ const date_fns_startOfISOWeekYear = ((/* unused pure expression or super */ null && (startOfISOWeekYear)));
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/getISOWeek.mjs
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* @name getISOWeek
|
|
* @category ISO Week Helpers
|
|
* @summary Get the ISO week of the given date.
|
|
*
|
|
* @description
|
|
* Get the ISO week of the given date.
|
|
*
|
|
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
|
|
*
|
|
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
*
|
|
* @param date - The given date
|
|
*
|
|
* @returns The ISO week
|
|
*
|
|
* @example
|
|
* // Which week of the ISO-week numbering year is 2 January 2005?
|
|
* const result = getISOWeek(new Date(2005, 0, 2))
|
|
* //=> 53
|
|
*/
|
|
function getISOWeek(date) {
|
|
const _date = toDate(date);
|
|
const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);
|
|
|
|
// Round the number of weeks to the nearest integer because the number of
|
|
// milliseconds in a week is not constant (e.g. it's different in the week of
|
|
// the daylight saving time clock shift).
|
|
return Math.round(diff / millisecondsInWeek) + 1;
|
|
}
|
|
|
|
// Fallback for modularized imports:
|
|
/* harmony default export */ const date_fns_getISOWeek = ((/* unused pure expression or super */ null && (getISOWeek)));
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/getWeekYear.mjs
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* The {@link getWeekYear} function options.
|
|
*/
|
|
|
|
/**
|
|
* @name getWeekYear
|
|
* @category Week-Numbering Year Helpers
|
|
* @summary Get the local week-numbering year of the given date.
|
|
*
|
|
* @description
|
|
* Get the local week-numbering year of the given date.
|
|
* The exact calculation depends on the values of
|
|
* `options.weekStartsOn` (which is the index of the first day of the week)
|
|
* and `options.firstWeekContainsDate` (which is the day of January, which is always in
|
|
* the first week of the week-numbering year)
|
|
*
|
|
* Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system
|
|
*
|
|
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
*
|
|
* @param date - The given date
|
|
* @param options - An object with options.
|
|
*
|
|
* @returns The local week-numbering year
|
|
*
|
|
* @example
|
|
* // Which week numbering year is 26 December 2004 with the default settings?
|
|
* const result = getWeekYear(new Date(2004, 11, 26))
|
|
* //=> 2005
|
|
*
|
|
* @example
|
|
* // Which week numbering year is 26 December 2004 if week starts on Saturday?
|
|
* const result = getWeekYear(new Date(2004, 11, 26), { weekStartsOn: 6 })
|
|
* //=> 2004
|
|
*
|
|
* @example
|
|
* // Which week numbering year is 26 December 2004 if the first week contains 4 January?
|
|
* const result = getWeekYear(new Date(2004, 11, 26), { firstWeekContainsDate: 4 })
|
|
* //=> 2004
|
|
*/
|
|
function getWeekYear(date, options) {
|
|
const _date = toDate(date);
|
|
const year = _date.getFullYear();
|
|
|
|
const defaultOptions = getDefaultOptions();
|
|
const firstWeekContainsDate =
|
|
options?.firstWeekContainsDate ??
|
|
options?.locale?.options?.firstWeekContainsDate ??
|
|
defaultOptions.firstWeekContainsDate ??
|
|
defaultOptions.locale?.options?.firstWeekContainsDate ??
|
|
1;
|
|
|
|
const firstWeekOfNextYear = constructFrom(date, 0);
|
|
firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
|
|
firstWeekOfNextYear.setHours(0, 0, 0, 0);
|
|
const startOfNextYear = startOfWeek(firstWeekOfNextYear, options);
|
|
|
|
const firstWeekOfThisYear = constructFrom(date, 0);
|
|
firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
|
|
firstWeekOfThisYear.setHours(0, 0, 0, 0);
|
|
const startOfThisYear = startOfWeek(firstWeekOfThisYear, options);
|
|
|
|
if (_date.getTime() >= startOfNextYear.getTime()) {
|
|
return year + 1;
|
|
} else if (_date.getTime() >= startOfThisYear.getTime()) {
|
|
return year;
|
|
} else {
|
|
return year - 1;
|
|
}
|
|
}
|
|
|
|
// Fallback for modularized imports:
|
|
/* harmony default export */ const date_fns_getWeekYear = ((/* unused pure expression or super */ null && (getWeekYear)));
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/startOfWeekYear.mjs
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* The {@link startOfWeekYear} function options.
|
|
*/
|
|
|
|
/**
|
|
* @name startOfWeekYear
|
|
* @category Week-Numbering Year Helpers
|
|
* @summary Return the start of a local week-numbering year for the given date.
|
|
*
|
|
* @description
|
|
* Return the start of a local week-numbering year.
|
|
* The exact calculation depends on the values of
|
|
* `options.weekStartsOn` (which is the index of the first day of the week)
|
|
* and `options.firstWeekContainsDate` (which is the day of January, which is always in
|
|
* the first week of the week-numbering year)
|
|
*
|
|
* Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system
|
|
*
|
|
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
*
|
|
* @param date - The original date
|
|
* @param options - An object with options
|
|
*
|
|
* @returns The start of a week-numbering year
|
|
*
|
|
* @example
|
|
* // The start of an a week-numbering year for 2 July 2005 with default settings:
|
|
* const result = startOfWeekYear(new Date(2005, 6, 2))
|
|
* //=> Sun Dec 26 2004 00:00:00
|
|
*
|
|
* @example
|
|
* // The start of a week-numbering year for 2 July 2005
|
|
* // if Monday is the first day of week
|
|
* // and 4 January is always in the first week of the year:
|
|
* const result = startOfWeekYear(new Date(2005, 6, 2), {
|
|
* weekStartsOn: 1,
|
|
* firstWeekContainsDate: 4
|
|
* })
|
|
* //=> Mon Jan 03 2005 00:00:00
|
|
*/
|
|
function startOfWeekYear(date, options) {
|
|
const defaultOptions = getDefaultOptions();
|
|
const firstWeekContainsDate =
|
|
options?.firstWeekContainsDate ??
|
|
options?.locale?.options?.firstWeekContainsDate ??
|
|
defaultOptions.firstWeekContainsDate ??
|
|
defaultOptions.locale?.options?.firstWeekContainsDate ??
|
|
1;
|
|
|
|
const year = getWeekYear(date, options);
|
|
const firstWeek = constructFrom(date, 0);
|
|
firstWeek.setFullYear(year, 0, firstWeekContainsDate);
|
|
firstWeek.setHours(0, 0, 0, 0);
|
|
const _date = startOfWeek(firstWeek, options);
|
|
return _date;
|
|
}
|
|
|
|
// Fallback for modularized imports:
|
|
/* harmony default export */ const date_fns_startOfWeekYear = ((/* unused pure expression or super */ null && (startOfWeekYear)));
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/getWeek.mjs
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* The {@link getWeek} function options.
|
|
*/
|
|
|
|
/**
|
|
* @name getWeek
|
|
* @category Week Helpers
|
|
* @summary Get the local week index of the given date.
|
|
*
|
|
* @description
|
|
* Get the local week index of the given date.
|
|
* The exact calculation depends on the values of
|
|
* `options.weekStartsOn` (which is the index of the first day of the week)
|
|
* and `options.firstWeekContainsDate` (which is the day of January, which is always in
|
|
* the first week of the week-numbering year)
|
|
*
|
|
* Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system
|
|
*
|
|
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
*
|
|
* @param date - The given date
|
|
* @param options - An object with options
|
|
*
|
|
* @returns The week
|
|
*
|
|
* @example
|
|
* // Which week of the local week numbering year is 2 January 2005 with default options?
|
|
* const result = getWeek(new Date(2005, 0, 2))
|
|
* //=> 2
|
|
*
|
|
* @example
|
|
* // Which week of the local week numbering year is 2 January 2005,
|
|
* // if Monday is the first day of the week,
|
|
* // and the first week of the year always contains 4 January?
|
|
* const result = getWeek(new Date(2005, 0, 2), {
|
|
* weekStartsOn: 1,
|
|
* firstWeekContainsDate: 4
|
|
* })
|
|
* //=> 53
|
|
*/
|
|
|
|
function getWeek(date, options) {
|
|
const _date = toDate(date);
|
|
const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options);
|
|
|
|
// Round the number of weeks to the nearest integer because the number of
|
|
// milliseconds in a week is not constant (e.g. it's different in the week of
|
|
// the daylight saving time clock shift).
|
|
return Math.round(diff / millisecondsInWeek) + 1;
|
|
}
|
|
|
|
// Fallback for modularized imports:
|
|
/* harmony default export */ const date_fns_getWeek = ((/* unused pure expression or super */ null && (getWeek)));
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/_lib/addLeadingZeros.mjs
|
|
function addLeadingZeros(number, targetLength) {
|
|
const sign = number < 0 ? "-" : "";
|
|
const output = Math.abs(number).toString().padStart(targetLength, "0");
|
|
return sign + output;
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/_lib/format/lightFormatters.mjs
|
|
|
|
|
|
/*
|
|
* | | Unit | | Unit |
|
|
* |-----|--------------------------------|-----|--------------------------------|
|
|
* | a | AM, PM | A* | |
|
|
* | d | Day of month | D | |
|
|
* | h | Hour [1-12] | H | Hour [0-23] |
|
|
* | m | Minute | M | Month |
|
|
* | s | Second | S | Fraction of second |
|
|
* | y | Year (abs) | Y | |
|
|
*
|
|
* Letters marked by * are not implemented but reserved by Unicode standard.
|
|
*/
|
|
|
|
const lightFormatters = {
|
|
// Year
|
|
y(date, token) {
|
|
// From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
|
|
// | Year | y | yy | yyy | yyyy | yyyyy |
|
|
// |----------|-------|----|-------|-------|-------|
|
|
// | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
|
|
// | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
|
|
// | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
|
|
// | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
|
|
// | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
|
|
|
|
const signedYear = date.getFullYear();
|
|
// Returns 1 for 1 BC (which is year 0 in JavaScript)
|
|
const year = signedYear > 0 ? signedYear : 1 - signedYear;
|
|
return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
|
|
},
|
|
|
|
// Month
|
|
M(date, token) {
|
|
const month = date.getMonth();
|
|
return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
|
|
},
|
|
|
|
// Day of the month
|
|
d(date, token) {
|
|
return addLeadingZeros(date.getDate(), token.length);
|
|
},
|
|
|
|
// AM or PM
|
|
a(date, token) {
|
|
const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
|
|
|
|
switch (token) {
|
|
case "a":
|
|
case "aa":
|
|
return dayPeriodEnumValue.toUpperCase();
|
|
case "aaa":
|
|
return dayPeriodEnumValue;
|
|
case "aaaaa":
|
|
return dayPeriodEnumValue[0];
|
|
case "aaaa":
|
|
default:
|
|
return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
|
|
}
|
|
},
|
|
|
|
// Hour [1-12]
|
|
h(date, token) {
|
|
return addLeadingZeros(date.getHours() % 12 || 12, token.length);
|
|
},
|
|
|
|
// Hour [0-23]
|
|
H(date, token) {
|
|
return addLeadingZeros(date.getHours(), token.length);
|
|
},
|
|
|
|
// Minute
|
|
m(date, token) {
|
|
return addLeadingZeros(date.getMinutes(), token.length);
|
|
},
|
|
|
|
// Second
|
|
s(date, token) {
|
|
return addLeadingZeros(date.getSeconds(), token.length);
|
|
},
|
|
|
|
// Fraction of second
|
|
S(date, token) {
|
|
const numberOfDigits = token.length;
|
|
const milliseconds = date.getMilliseconds();
|
|
const fractionalSeconds = Math.trunc(
|
|
milliseconds * Math.pow(10, numberOfDigits - 3),
|
|
);
|
|
return addLeadingZeros(fractionalSeconds, token.length);
|
|
},
|
|
};
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/_lib/format/formatters.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const dayPeriodEnum = {
|
|
am: "am",
|
|
pm: "pm",
|
|
midnight: "midnight",
|
|
noon: "noon",
|
|
morning: "morning",
|
|
afternoon: "afternoon",
|
|
evening: "evening",
|
|
night: "night",
|
|
};
|
|
|
|
/*
|
|
* | | Unit | | Unit |
|
|
* |-----|--------------------------------|-----|--------------------------------|
|
|
* | a | AM, PM | A* | Milliseconds in day |
|
|
* | b | AM, PM, noon, midnight | B | Flexible day period |
|
|
* | c | Stand-alone local day of week | C* | Localized hour w/ day period |
|
|
* | d | Day of month | D | Day of year |
|
|
* | e | Local day of week | E | Day of week |
|
|
* | f | | F* | Day of week in month |
|
|
* | g* | Modified Julian day | G | Era |
|
|
* | h | Hour [1-12] | H | Hour [0-23] |
|
|
* | i! | ISO day of week | I! | ISO week of year |
|
|
* | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
|
|
* | k | Hour [1-24] | K | Hour [0-11] |
|
|
* | l* | (deprecated) | L | Stand-alone month |
|
|
* | m | Minute | M | Month |
|
|
* | n | | N | |
|
|
* | o! | Ordinal number modifier | O | Timezone (GMT) |
|
|
* | p! | Long localized time | P! | Long localized date |
|
|
* | q | Stand-alone quarter | Q | Quarter |
|
|
* | r* | Related Gregorian year | R! | ISO week-numbering year |
|
|
* | s | Second | S | Fraction of second |
|
|
* | t! | Seconds timestamp | T! | Milliseconds timestamp |
|
|
* | u | Extended year | U* | Cyclic year |
|
|
* | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
|
|
* | w | Local week of year | W* | Week of month |
|
|
* | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
|
|
* | y | Year (abs) | Y | Local week-numbering year |
|
|
* | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
|
|
*
|
|
* Letters marked by * are not implemented but reserved by Unicode standard.
|
|
*
|
|
* Letters marked by ! are non-standard, but implemented by date-fns:
|
|
* - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
|
|
* - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
|
|
* i.e. 7 for Sunday, 1 for Monday, etc.
|
|
* - `I` is ISO week of year, as opposed to `w` which is local week of year.
|
|
* - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
|
|
* `R` is supposed to be used in conjunction with `I` and `i`
|
|
* for universal ISO week-numbering date, whereas
|
|
* `Y` is supposed to be used in conjunction with `w` and `e`
|
|
* for week-numbering date specific to the locale.
|
|
* - `P` is long localized date format
|
|
* - `p` is long localized time format
|
|
*/
|
|
|
|
const formatters = {
|
|
// Era
|
|
G: function (date, token, localize) {
|
|
const era = date.getFullYear() > 0 ? 1 : 0;
|
|
switch (token) {
|
|
// AD, BC
|
|
case "G":
|
|
case "GG":
|
|
case "GGG":
|
|
return localize.era(era, { width: "abbreviated" });
|
|
// A, B
|
|
case "GGGGG":
|
|
return localize.era(era, { width: "narrow" });
|
|
// Anno Domini, Before Christ
|
|
case "GGGG":
|
|
default:
|
|
return localize.era(era, { width: "wide" });
|
|
}
|
|
},
|
|
|
|
// Year
|
|
y: function (date, token, localize) {
|
|
// Ordinal number
|
|
if (token === "yo") {
|
|
const signedYear = date.getFullYear();
|
|
// Returns 1 for 1 BC (which is year 0 in JavaScript)
|
|
const year = signedYear > 0 ? signedYear : 1 - signedYear;
|
|
return localize.ordinalNumber(year, { unit: "year" });
|
|
}
|
|
|
|
return lightFormatters.y(date, token);
|
|
},
|
|
|
|
// Local week-numbering year
|
|
Y: function (date, token, localize, options) {
|
|
const signedWeekYear = getWeekYear(date, options);
|
|
// Returns 1 for 1 BC (which is year 0 in JavaScript)
|
|
const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
|
|
|
|
// Two digit year
|
|
if (token === "YY") {
|
|
const twoDigitYear = weekYear % 100;
|
|
return addLeadingZeros(twoDigitYear, 2);
|
|
}
|
|
|
|
// Ordinal number
|
|
if (token === "Yo") {
|
|
return localize.ordinalNumber(weekYear, { unit: "year" });
|
|
}
|
|
|
|
// Padding
|
|
return addLeadingZeros(weekYear, token.length);
|
|
},
|
|
|
|
// ISO week-numbering year
|
|
R: function (date, token) {
|
|
const isoWeekYear = getISOWeekYear(date);
|
|
|
|
// Padding
|
|
return addLeadingZeros(isoWeekYear, token.length);
|
|
},
|
|
|
|
// Extended year. This is a single number designating the year of this calendar system.
|
|
// The main difference between `y` and `u` localizers are B.C. years:
|
|
// | Year | `y` | `u` |
|
|
// |------|-----|-----|
|
|
// | AC 1 | 1 | 1 |
|
|
// | BC 1 | 1 | 0 |
|
|
// | BC 2 | 2 | -1 |
|
|
// Also `yy` always returns the last two digits of a year,
|
|
// while `uu` pads single digit years to 2 characters and returns other years unchanged.
|
|
u: function (date, token) {
|
|
const year = date.getFullYear();
|
|
return addLeadingZeros(year, token.length);
|
|
},
|
|
|
|
// Quarter
|
|
Q: function (date, token, localize) {
|
|
const quarter = Math.ceil((date.getMonth() + 1) / 3);
|
|
switch (token) {
|
|
// 1, 2, 3, 4
|
|
case "Q":
|
|
return String(quarter);
|
|
// 01, 02, 03, 04
|
|
case "QQ":
|
|
return addLeadingZeros(quarter, 2);
|
|
// 1st, 2nd, 3rd, 4th
|
|
case "Qo":
|
|
return localize.ordinalNumber(quarter, { unit: "quarter" });
|
|
// Q1, Q2, Q3, Q4
|
|
case "QQQ":
|
|
return localize.quarter(quarter, {
|
|
width: "abbreviated",
|
|
context: "formatting",
|
|
});
|
|
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
|
case "QQQQQ":
|
|
return localize.quarter(quarter, {
|
|
width: "narrow",
|
|
context: "formatting",
|
|
});
|
|
// 1st quarter, 2nd quarter, ...
|
|
case "QQQQ":
|
|
default:
|
|
return localize.quarter(quarter, {
|
|
width: "wide",
|
|
context: "formatting",
|
|
});
|
|
}
|
|
},
|
|
|
|
// Stand-alone quarter
|
|
q: function (date, token, localize) {
|
|
const quarter = Math.ceil((date.getMonth() + 1) / 3);
|
|
switch (token) {
|
|
// 1, 2, 3, 4
|
|
case "q":
|
|
return String(quarter);
|
|
// 01, 02, 03, 04
|
|
case "qq":
|
|
return addLeadingZeros(quarter, 2);
|
|
// 1st, 2nd, 3rd, 4th
|
|
case "qo":
|
|
return localize.ordinalNumber(quarter, { unit: "quarter" });
|
|
// Q1, Q2, Q3, Q4
|
|
case "qqq":
|
|
return localize.quarter(quarter, {
|
|
width: "abbreviated",
|
|
context: "standalone",
|
|
});
|
|
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
|
case "qqqqq":
|
|
return localize.quarter(quarter, {
|
|
width: "narrow",
|
|
context: "standalone",
|
|
});
|
|
// 1st quarter, 2nd quarter, ...
|
|
case "qqqq":
|
|
default:
|
|
return localize.quarter(quarter, {
|
|
width: "wide",
|
|
context: "standalone",
|
|
});
|
|
}
|
|
},
|
|
|
|
// Month
|
|
M: function (date, token, localize) {
|
|
const month = date.getMonth();
|
|
switch (token) {
|
|
case "M":
|
|
case "MM":
|
|
return lightFormatters.M(date, token);
|
|
// 1st, 2nd, ..., 12th
|
|
case "Mo":
|
|
return localize.ordinalNumber(month + 1, { unit: "month" });
|
|
// Jan, Feb, ..., Dec
|
|
case "MMM":
|
|
return localize.month(month, {
|
|
width: "abbreviated",
|
|
context: "formatting",
|
|
});
|
|
// J, F, ..., D
|
|
case "MMMMM":
|
|
return localize.month(month, {
|
|
width: "narrow",
|
|
context: "formatting",
|
|
});
|
|
// January, February, ..., December
|
|
case "MMMM":
|
|
default:
|
|
return localize.month(month, { width: "wide", context: "formatting" });
|
|
}
|
|
},
|
|
|
|
// Stand-alone month
|
|
L: function (date, token, localize) {
|
|
const month = date.getMonth();
|
|
switch (token) {
|
|
// 1, 2, ..., 12
|
|
case "L":
|
|
return String(month + 1);
|
|
// 01, 02, ..., 12
|
|
case "LL":
|
|
return addLeadingZeros(month + 1, 2);
|
|
// 1st, 2nd, ..., 12th
|
|
case "Lo":
|
|
return localize.ordinalNumber(month + 1, { unit: "month" });
|
|
// Jan, Feb, ..., Dec
|
|
case "LLL":
|
|
return localize.month(month, {
|
|
width: "abbreviated",
|
|
context: "standalone",
|
|
});
|
|
// J, F, ..., D
|
|
case "LLLLL":
|
|
return localize.month(month, {
|
|
width: "narrow",
|
|
context: "standalone",
|
|
});
|
|
// January, February, ..., December
|
|
case "LLLL":
|
|
default:
|
|
return localize.month(month, { width: "wide", context: "standalone" });
|
|
}
|
|
},
|
|
|
|
// Local week of year
|
|
w: function (date, token, localize, options) {
|
|
const week = getWeek(date, options);
|
|
|
|
if (token === "wo") {
|
|
return localize.ordinalNumber(week, { unit: "week" });
|
|
}
|
|
|
|
return addLeadingZeros(week, token.length);
|
|
},
|
|
|
|
// ISO week of year
|
|
I: function (date, token, localize) {
|
|
const isoWeek = getISOWeek(date);
|
|
|
|
if (token === "Io") {
|
|
return localize.ordinalNumber(isoWeek, { unit: "week" });
|
|
}
|
|
|
|
return addLeadingZeros(isoWeek, token.length);
|
|
},
|
|
|
|
// Day of the month
|
|
d: function (date, token, localize) {
|
|
if (token === "do") {
|
|
return localize.ordinalNumber(date.getDate(), { unit: "date" });
|
|
}
|
|
|
|
return lightFormatters.d(date, token);
|
|
},
|
|
|
|
// Day of year
|
|
D: function (date, token, localize) {
|
|
const dayOfYear = getDayOfYear(date);
|
|
|
|
if (token === "Do") {
|
|
return localize.ordinalNumber(dayOfYear, { unit: "dayOfYear" });
|
|
}
|
|
|
|
return addLeadingZeros(dayOfYear, token.length);
|
|
},
|
|
|
|
// Day of week
|
|
E: function (date, token, localize) {
|
|
const dayOfWeek = date.getDay();
|
|
switch (token) {
|
|
// Tue
|
|
case "E":
|
|
case "EE":
|
|
case "EEE":
|
|
return localize.day(dayOfWeek, {
|
|
width: "abbreviated",
|
|
context: "formatting",
|
|
});
|
|
// T
|
|
case "EEEEE":
|
|
return localize.day(dayOfWeek, {
|
|
width: "narrow",
|
|
context: "formatting",
|
|
});
|
|
// Tu
|
|
case "EEEEEE":
|
|
return localize.day(dayOfWeek, {
|
|
width: "short",
|
|
context: "formatting",
|
|
});
|
|
// Tuesday
|
|
case "EEEE":
|
|
default:
|
|
return localize.day(dayOfWeek, {
|
|
width: "wide",
|
|
context: "formatting",
|
|
});
|
|
}
|
|
},
|
|
|
|
// Local day of week
|
|
e: function (date, token, localize, options) {
|
|
const dayOfWeek = date.getDay();
|
|
const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
|
|
switch (token) {
|
|
// Numerical value (Nth day of week with current locale or weekStartsOn)
|
|
case "e":
|
|
return String(localDayOfWeek);
|
|
// Padded numerical value
|
|
case "ee":
|
|
return addLeadingZeros(localDayOfWeek, 2);
|
|
// 1st, 2nd, ..., 7th
|
|
case "eo":
|
|
return localize.ordinalNumber(localDayOfWeek, { unit: "day" });
|
|
case "eee":
|
|
return localize.day(dayOfWeek, {
|
|
width: "abbreviated",
|
|
context: "formatting",
|
|
});
|
|
// T
|
|
case "eeeee":
|
|
return localize.day(dayOfWeek, {
|
|
width: "narrow",
|
|
context: "formatting",
|
|
});
|
|
// Tu
|
|
case "eeeeee":
|
|
return localize.day(dayOfWeek, {
|
|
width: "short",
|
|
context: "formatting",
|
|
});
|
|
// Tuesday
|
|
case "eeee":
|
|
default:
|
|
return localize.day(dayOfWeek, {
|
|
width: "wide",
|
|
context: "formatting",
|
|
});
|
|
}
|
|
},
|
|
|
|
// Stand-alone local day of week
|
|
c: function (date, token, localize, options) {
|
|
const dayOfWeek = date.getDay();
|
|
const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
|
|
switch (token) {
|
|
// Numerical value (same as in `e`)
|
|
case "c":
|
|
return String(localDayOfWeek);
|
|
// Padded numerical value
|
|
case "cc":
|
|
return addLeadingZeros(localDayOfWeek, token.length);
|
|
// 1st, 2nd, ..., 7th
|
|
case "co":
|
|
return localize.ordinalNumber(localDayOfWeek, { unit: "day" });
|
|
case "ccc":
|
|
return localize.day(dayOfWeek, {
|
|
width: "abbreviated",
|
|
context: "standalone",
|
|
});
|
|
// T
|
|
case "ccccc":
|
|
return localize.day(dayOfWeek, {
|
|
width: "narrow",
|
|
context: "standalone",
|
|
});
|
|
// Tu
|
|
case "cccccc":
|
|
return localize.day(dayOfWeek, {
|
|
width: "short",
|
|
context: "standalone",
|
|
});
|
|
// Tuesday
|
|
case "cccc":
|
|
default:
|
|
return localize.day(dayOfWeek, {
|
|
width: "wide",
|
|
context: "standalone",
|
|
});
|
|
}
|
|
},
|
|
|
|
// ISO day of week
|
|
i: function (date, token, localize) {
|
|
const dayOfWeek = date.getDay();
|
|
const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
|
|
switch (token) {
|
|
// 2
|
|
case "i":
|
|
return String(isoDayOfWeek);
|
|
// 02
|
|
case "ii":
|
|
return addLeadingZeros(isoDayOfWeek, token.length);
|
|
// 2nd
|
|
case "io":
|
|
return localize.ordinalNumber(isoDayOfWeek, { unit: "day" });
|
|
// Tue
|
|
case "iii":
|
|
return localize.day(dayOfWeek, {
|
|
width: "abbreviated",
|
|
context: "formatting",
|
|
});
|
|
// T
|
|
case "iiiii":
|
|
return localize.day(dayOfWeek, {
|
|
width: "narrow",
|
|
context: "formatting",
|
|
});
|
|
// Tu
|
|
case "iiiiii":
|
|
return localize.day(dayOfWeek, {
|
|
width: "short",
|
|
context: "formatting",
|
|
});
|
|
// Tuesday
|
|
case "iiii":
|
|
default:
|
|
return localize.day(dayOfWeek, {
|
|
width: "wide",
|
|
context: "formatting",
|
|
});
|
|
}
|
|
},
|
|
|
|
// AM or PM
|
|
a: function (date, token, localize) {
|
|
const hours = date.getHours();
|
|
const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
|
|
|
|
switch (token) {
|
|
case "a":
|
|
case "aa":
|
|
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
width: "abbreviated",
|
|
context: "formatting",
|
|
});
|
|
case "aaa":
|
|
return localize
|
|
.dayPeriod(dayPeriodEnumValue, {
|
|
width: "abbreviated",
|
|
context: "formatting",
|
|
})
|
|
.toLowerCase();
|
|
case "aaaaa":
|
|
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
width: "narrow",
|
|
context: "formatting",
|
|
});
|
|
case "aaaa":
|
|
default:
|
|
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
width: "wide",
|
|
context: "formatting",
|
|
});
|
|
}
|
|
},
|
|
|
|
// AM, PM, midnight, noon
|
|
b: function (date, token, localize) {
|
|
const hours = date.getHours();
|
|
let dayPeriodEnumValue;
|
|
if (hours === 12) {
|
|
dayPeriodEnumValue = dayPeriodEnum.noon;
|
|
} else if (hours === 0) {
|
|
dayPeriodEnumValue = dayPeriodEnum.midnight;
|
|
} else {
|
|
dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
|
|
}
|
|
|
|
switch (token) {
|
|
case "b":
|
|
case "bb":
|
|
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
width: "abbreviated",
|
|
context: "formatting",
|
|
});
|
|
case "bbb":
|
|
return localize
|
|
.dayPeriod(dayPeriodEnumValue, {
|
|
width: "abbreviated",
|
|
context: "formatting",
|
|
})
|
|
.toLowerCase();
|
|
case "bbbbb":
|
|
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
width: "narrow",
|
|
context: "formatting",
|
|
});
|
|
case "bbbb":
|
|
default:
|
|
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
width: "wide",
|
|
context: "formatting",
|
|
});
|
|
}
|
|
},
|
|
|
|
// in the morning, in the afternoon, in the evening, at night
|
|
B: function (date, token, localize) {
|
|
const hours = date.getHours();
|
|
let dayPeriodEnumValue;
|
|
if (hours >= 17) {
|
|
dayPeriodEnumValue = dayPeriodEnum.evening;
|
|
} else if (hours >= 12) {
|
|
dayPeriodEnumValue = dayPeriodEnum.afternoon;
|
|
} else if (hours >= 4) {
|
|
dayPeriodEnumValue = dayPeriodEnum.morning;
|
|
} else {
|
|
dayPeriodEnumValue = dayPeriodEnum.night;
|
|
}
|
|
|
|
switch (token) {
|
|
case "B":
|
|
case "BB":
|
|
case "BBB":
|
|
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
width: "abbreviated",
|
|
context: "formatting",
|
|
});
|
|
case "BBBBB":
|
|
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
width: "narrow",
|
|
context: "formatting",
|
|
});
|
|
case "BBBB":
|
|
default:
|
|
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
width: "wide",
|
|
context: "formatting",
|
|
});
|
|
}
|
|
},
|
|
|
|
// Hour [1-12]
|
|
h: function (date, token, localize) {
|
|
if (token === "ho") {
|
|
let hours = date.getHours() % 12;
|
|
if (hours === 0) hours = 12;
|
|
return localize.ordinalNumber(hours, { unit: "hour" });
|
|
}
|
|
|
|
return lightFormatters.h(date, token);
|
|
},
|
|
|
|
// Hour [0-23]
|
|
H: function (date, token, localize) {
|
|
if (token === "Ho") {
|
|
return localize.ordinalNumber(date.getHours(), { unit: "hour" });
|
|
}
|
|
|
|
return lightFormatters.H(date, token);
|
|
},
|
|
|
|
// Hour [0-11]
|
|
K: function (date, token, localize) {
|
|
const hours = date.getHours() % 12;
|
|
|
|
if (token === "Ko") {
|
|
return localize.ordinalNumber(hours, { unit: "hour" });
|
|
}
|
|
|
|
return addLeadingZeros(hours, token.length);
|
|
},
|
|
|
|
// Hour [1-24]
|
|
k: function (date, token, localize) {
|
|
let hours = date.getHours();
|
|
if (hours === 0) hours = 24;
|
|
|
|
if (token === "ko") {
|
|
return localize.ordinalNumber(hours, { unit: "hour" });
|
|
}
|
|
|
|
return addLeadingZeros(hours, token.length);
|
|
},
|
|
|
|
// Minute
|
|
m: function (date, token, localize) {
|
|
if (token === "mo") {
|
|
return localize.ordinalNumber(date.getMinutes(), { unit: "minute" });
|
|
}
|
|
|
|
return lightFormatters.m(date, token);
|
|
},
|
|
|
|
// Second
|
|
s: function (date, token, localize) {
|
|
if (token === "so") {
|
|
return localize.ordinalNumber(date.getSeconds(), { unit: "second" });
|
|
}
|
|
|
|
return lightFormatters.s(date, token);
|
|
},
|
|
|
|
// Fraction of second
|
|
S: function (date, token) {
|
|
return lightFormatters.S(date, token);
|
|
},
|
|
|
|
// Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
|
|
X: function (date, token, _localize) {
|
|
const timezoneOffset = date.getTimezoneOffset();
|
|
|
|
if (timezoneOffset === 0) {
|
|
return "Z";
|
|
}
|
|
|
|
switch (token) {
|
|
// Hours and optional minutes
|
|
case "X":
|
|
return formatTimezoneWithOptionalMinutes(timezoneOffset);
|
|
|
|
// Hours, minutes and optional seconds without `:` delimiter
|
|
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
// so this token always has the same output as `XX`
|
|
case "XXXX":
|
|
case "XX": // Hours and minutes without `:` delimiter
|
|
return formatTimezone(timezoneOffset);
|
|
|
|
// Hours, minutes and optional seconds with `:` delimiter
|
|
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
// so this token always has the same output as `XXX`
|
|
case "XXXXX":
|
|
case "XXX": // Hours and minutes with `:` delimiter
|
|
default:
|
|
return formatTimezone(timezoneOffset, ":");
|
|
}
|
|
},
|
|
|
|
// Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
|
|
x: function (date, token, _localize) {
|
|
const timezoneOffset = date.getTimezoneOffset();
|
|
|
|
switch (token) {
|
|
// Hours and optional minutes
|
|
case "x":
|
|
return formatTimezoneWithOptionalMinutes(timezoneOffset);
|
|
|
|
// Hours, minutes and optional seconds without `:` delimiter
|
|
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
// so this token always has the same output as `xx`
|
|
case "xxxx":
|
|
case "xx": // Hours and minutes without `:` delimiter
|
|
return formatTimezone(timezoneOffset);
|
|
|
|
// Hours, minutes and optional seconds with `:` delimiter
|
|
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
// so this token always has the same output as `xxx`
|
|
case "xxxxx":
|
|
case "xxx": // Hours and minutes with `:` delimiter
|
|
default:
|
|
return formatTimezone(timezoneOffset, ":");
|
|
}
|
|
},
|
|
|
|
// Timezone (GMT)
|
|
O: function (date, token, _localize) {
|
|
const timezoneOffset = date.getTimezoneOffset();
|
|
|
|
switch (token) {
|
|
// Short
|
|
case "O":
|
|
case "OO":
|
|
case "OOO":
|
|
return "GMT" + formatTimezoneShort(timezoneOffset, ":");
|
|
// Long
|
|
case "OOOO":
|
|
default:
|
|
return "GMT" + formatTimezone(timezoneOffset, ":");
|
|
}
|
|
},
|
|
|
|
// Timezone (specific non-location)
|
|
z: function (date, token, _localize) {
|
|
const timezoneOffset = date.getTimezoneOffset();
|
|
|
|
switch (token) {
|
|
// Short
|
|
case "z":
|
|
case "zz":
|
|
case "zzz":
|
|
return "GMT" + formatTimezoneShort(timezoneOffset, ":");
|
|
// Long
|
|
case "zzzz":
|
|
default:
|
|
return "GMT" + formatTimezone(timezoneOffset, ":");
|
|
}
|
|
},
|
|
|
|
// Seconds timestamp
|
|
t: function (date, token, _localize) {
|
|
const timestamp = Math.trunc(date.getTime() / 1000);
|
|
return addLeadingZeros(timestamp, token.length);
|
|
},
|
|
|
|
// Milliseconds timestamp
|
|
T: function (date, token, _localize) {
|
|
const timestamp = date.getTime();
|
|
return addLeadingZeros(timestamp, token.length);
|
|
},
|
|
};
|
|
|
|
function formatTimezoneShort(offset, delimiter = "") {
|
|
const sign = offset > 0 ? "-" : "+";
|
|
const absOffset = Math.abs(offset);
|
|
const hours = Math.trunc(absOffset / 60);
|
|
const minutes = absOffset % 60;
|
|
if (minutes === 0) {
|
|
return sign + String(hours);
|
|
}
|
|
return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
|
|
}
|
|
|
|
function formatTimezoneWithOptionalMinutes(offset, delimiter) {
|
|
if (offset % 60 === 0) {
|
|
const sign = offset > 0 ? "-" : "+";
|
|
return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
|
|
}
|
|
return formatTimezone(offset, delimiter);
|
|
}
|
|
|
|
function formatTimezone(offset, delimiter = "") {
|
|
const sign = offset > 0 ? "-" : "+";
|
|
const absOffset = Math.abs(offset);
|
|
const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);
|
|
const minutes = addLeadingZeros(absOffset % 60, 2);
|
|
return sign + hours + delimiter + minutes;
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/_lib/format/longFormatters.mjs
|
|
const dateLongFormatter = (pattern, formatLong) => {
|
|
switch (pattern) {
|
|
case "P":
|
|
return formatLong.date({ width: "short" });
|
|
case "PP":
|
|
return formatLong.date({ width: "medium" });
|
|
case "PPP":
|
|
return formatLong.date({ width: "long" });
|
|
case "PPPP":
|
|
default:
|
|
return formatLong.date({ width: "full" });
|
|
}
|
|
};
|
|
|
|
const timeLongFormatter = (pattern, formatLong) => {
|
|
switch (pattern) {
|
|
case "p":
|
|
return formatLong.time({ width: "short" });
|
|
case "pp":
|
|
return formatLong.time({ width: "medium" });
|
|
case "ppp":
|
|
return formatLong.time({ width: "long" });
|
|
case "pppp":
|
|
default:
|
|
return formatLong.time({ width: "full" });
|
|
}
|
|
};
|
|
|
|
const dateTimeLongFormatter = (pattern, formatLong) => {
|
|
const matchResult = pattern.match(/(P+)(p+)?/) || [];
|
|
const datePattern = matchResult[1];
|
|
const timePattern = matchResult[2];
|
|
|
|
if (!timePattern) {
|
|
return dateLongFormatter(pattern, formatLong);
|
|
}
|
|
|
|
let dateTimeFormat;
|
|
|
|
switch (datePattern) {
|
|
case "P":
|
|
dateTimeFormat = formatLong.dateTime({ width: "short" });
|
|
break;
|
|
case "PP":
|
|
dateTimeFormat = formatLong.dateTime({ width: "medium" });
|
|
break;
|
|
case "PPP":
|
|
dateTimeFormat = formatLong.dateTime({ width: "long" });
|
|
break;
|
|
case "PPPP":
|
|
default:
|
|
dateTimeFormat = formatLong.dateTime({ width: "full" });
|
|
break;
|
|
}
|
|
|
|
return dateTimeFormat
|
|
.replace("{{date}}", dateLongFormatter(datePattern, formatLong))
|
|
.replace("{{time}}", timeLongFormatter(timePattern, formatLong));
|
|
};
|
|
|
|
const longFormatters = {
|
|
p: timeLongFormatter,
|
|
P: dateTimeLongFormatter,
|
|
};
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/_lib/protectedTokens.mjs
|
|
const dayOfYearTokenRE = /^D+$/;
|
|
const weekYearTokenRE = /^Y+$/;
|
|
|
|
const throwTokens = ["D", "DD", "YY", "YYYY"];
|
|
|
|
function isProtectedDayOfYearToken(token) {
|
|
return dayOfYearTokenRE.test(token);
|
|
}
|
|
|
|
function isProtectedWeekYearToken(token) {
|
|
return weekYearTokenRE.test(token);
|
|
}
|
|
|
|
function warnOrThrowProtectedError(token, format, input) {
|
|
const _message = message(token, format, input);
|
|
console.warn(_message);
|
|
if (throwTokens.includes(token)) throw new RangeError(_message);
|
|
}
|
|
|
|
function message(token, format, input) {
|
|
const subject = token[0] === "Y" ? "years" : "days of the month";
|
|
return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/isDate.mjs
|
|
/**
|
|
* @name isDate
|
|
* @category Common Helpers
|
|
* @summary Is the given value a date?
|
|
*
|
|
* @description
|
|
* Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
|
|
*
|
|
* @param value - The value to check
|
|
*
|
|
* @returns True if the given value is a date
|
|
*
|
|
* @example
|
|
* // For a valid date:
|
|
* const result = isDate(new Date())
|
|
* //=> true
|
|
*
|
|
* @example
|
|
* // For an invalid date:
|
|
* const result = isDate(new Date(NaN))
|
|
* //=> true
|
|
*
|
|
* @example
|
|
* // For some value:
|
|
* const result = isDate('2014-02-31')
|
|
* //=> false
|
|
*
|
|
* @example
|
|
* // For an object:
|
|
* const result = isDate({})
|
|
* //=> false
|
|
*/
|
|
function isDate(value) {
|
|
return (
|
|
value instanceof Date ||
|
|
(typeof value === "object" &&
|
|
Object.prototype.toString.call(value) === "[object Date]")
|
|
);
|
|
}
|
|
|
|
// Fallback for modularized imports:
|
|
/* harmony default export */ const date_fns_isDate = ((/* unused pure expression or super */ null && (isDate)));
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/isValid.mjs
|
|
|
|
|
|
|
|
/**
|
|
* @name isValid
|
|
* @category Common Helpers
|
|
* @summary Is the given date valid?
|
|
*
|
|
* @description
|
|
* Returns false if argument is Invalid Date and true otherwise.
|
|
* Argument is converted to Date using `toDate`. See [toDate](https://date-fns.org/docs/toDate)
|
|
* Invalid Date is a Date, whose time value is NaN.
|
|
*
|
|
* Time value of Date: http://es5.github.io/#x15.9.1.1
|
|
*
|
|
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
*
|
|
* @param date - The date to check
|
|
*
|
|
* @returns The date is valid
|
|
*
|
|
* @example
|
|
* // For the valid date:
|
|
* const result = isValid(new Date(2014, 1, 31))
|
|
* //=> true
|
|
*
|
|
* @example
|
|
* // For the value, convertable into a date:
|
|
* const result = isValid(1393804800000)
|
|
* //=> true
|
|
*
|
|
* @example
|
|
* // For the invalid date:
|
|
* const result = isValid(new Date(''))
|
|
* //=> false
|
|
*/
|
|
function isValid_isValid(date) {
|
|
if (!isDate(date) && typeof date !== "number") {
|
|
return false;
|
|
}
|
|
const _date = toDate(date);
|
|
return !isNaN(Number(_date));
|
|
}
|
|
|
|
// Fallback for modularized imports:
|
|
/* harmony default export */ const date_fns_isValid = ((/* unused pure expression or super */ null && (isValid_isValid)));
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/format.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Rexports of internal for libraries to use.
|
|
// See: https://github.com/date-fns/date-fns/issues/3638#issuecomment-1877082874
|
|
|
|
|
|
// This RegExp consists of three parts separated by `|`:
|
|
// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
|
|
// (one of the certain letters followed by `o`)
|
|
// - (\w)\1* matches any sequences of the same letter
|
|
// - '' matches two quote characters in a row
|
|
// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
|
|
// except a single quote symbol, which ends the sequence.
|
|
// Two quote characters do not end the sequence.
|
|
// If there is no matching single quote
|
|
// then the sequence will continue until the end of the string.
|
|
// - . matches any single character unmatched by previous parts of the RegExps
|
|
const formattingTokensRegExp =
|
|
/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
|
|
|
|
// This RegExp catches symbols escaped by quotes, and also
|
|
// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
|
|
const longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
|
|
|
|
const escapedStringRegExp = /^'([^]*?)'?$/;
|
|
const doubleQuoteRegExp = /''/g;
|
|
const unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
|
|
|
|
|
|
/**
|
|
* The {@link format} function options.
|
|
*/
|
|
|
|
/**
|
|
* @name format
|
|
* @alias formatDate
|
|
* @category Common Helpers
|
|
* @summary Format the date.
|
|
*
|
|
* @description
|
|
* Return the formatted date string in the given format. The result may vary by locale.
|
|
*
|
|
* > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
|
|
* > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
*
|
|
* The characters wrapped between two single quotes characters (') are escaped.
|
|
* Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
|
|
* (see the last example)
|
|
*
|
|
* Format of the string is based on Unicode Technical Standard #35:
|
|
* https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
|
* with a few additions (see note 7 below the table).
|
|
*
|
|
* Accepted patterns:
|
|
* | Unit | Pattern | Result examples | Notes |
|
|
* |---------------------------------|---------|-----------------------------------|-------|
|
|
* | Era | G..GGG | AD, BC | |
|
|
* | | GGGG | Anno Domini, Before Christ | 2 |
|
|
* | | GGGGG | A, B | |
|
|
* | Calendar year | y | 44, 1, 1900, 2017 | 5 |
|
|
* | | yo | 44th, 1st, 0th, 17th | 5,7 |
|
|
* | | yy | 44, 01, 00, 17 | 5 |
|
|
* | | yyy | 044, 001, 1900, 2017 | 5 |
|
|
* | | yyyy | 0044, 0001, 1900, 2017 | 5 |
|
|
* | | yyyyy | ... | 3,5 |
|
|
* | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
|
|
* | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
|
|
* | | YY | 44, 01, 00, 17 | 5,8 |
|
|
* | | YYY | 044, 001, 1900, 2017 | 5 |
|
|
* | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
|
|
* | | YYYYY | ... | 3,5 |
|
|
* | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
|
|
* | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
|
|
* | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
|
|
* | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
|
|
* | | RRRRR | ... | 3,5,7 |
|
|
* | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
|
|
* | | uu | -43, 01, 1900, 2017 | 5 |
|
|
* | | uuu | -043, 001, 1900, 2017 | 5 |
|
|
* | | uuuu | -0043, 0001, 1900, 2017 | 5 |
|
|
* | | uuuuu | ... | 3,5 |
|
|
* | Quarter (formatting) | Q | 1, 2, 3, 4 | |
|
|
* | | Qo | 1st, 2nd, 3rd, 4th | 7 |
|
|
* | | QQ | 01, 02, 03, 04 | |
|
|
* | | QQQ | Q1, Q2, Q3, Q4 | |
|
|
* | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
|
|
* | | QQQQQ | 1, 2, 3, 4 | 4 |
|
|
* | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
|
|
* | | qo | 1st, 2nd, 3rd, 4th | 7 |
|
|
* | | qq | 01, 02, 03, 04 | |
|
|
* | | qqq | Q1, Q2, Q3, Q4 | |
|
|
* | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
|
|
* | | qqqqq | 1, 2, 3, 4 | 4 |
|
|
* | Month (formatting) | M | 1, 2, ..., 12 | |
|
|
* | | Mo | 1st, 2nd, ..., 12th | 7 |
|
|
* | | MM | 01, 02, ..., 12 | |
|
|
* | | MMM | Jan, Feb, ..., Dec | |
|
|
* | | MMMM | January, February, ..., December | 2 |
|
|
* | | MMMMM | J, F, ..., D | |
|
|
* | Month (stand-alone) | L | 1, 2, ..., 12 | |
|
|
* | | Lo | 1st, 2nd, ..., 12th | 7 |
|
|
* | | LL | 01, 02, ..., 12 | |
|
|
* | | LLL | Jan, Feb, ..., Dec | |
|
|
* | | LLLL | January, February, ..., December | 2 |
|
|
* | | LLLLL | J, F, ..., D | |
|
|
* | Local week of year | w | 1, 2, ..., 53 | |
|
|
* | | wo | 1st, 2nd, ..., 53th | 7 |
|
|
* | | ww | 01, 02, ..., 53 | |
|
|
* | ISO week of year | I | 1, 2, ..., 53 | 7 |
|
|
* | | Io | 1st, 2nd, ..., 53th | 7 |
|
|
* | | II | 01, 02, ..., 53 | 7 |
|
|
* | Day of month | d | 1, 2, ..., 31 | |
|
|
* | | do | 1st, 2nd, ..., 31st | 7 |
|
|
* | | dd | 01, 02, ..., 31 | |
|
|
* | Day of year | D | 1, 2, ..., 365, 366 | 9 |
|
|
* | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
|
|
* | | DD | 01, 02, ..., 365, 366 | 9 |
|
|
* | | DDD | 001, 002, ..., 365, 366 | |
|
|
* | | DDDD | ... | 3 |
|
|
* | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
|
|
* | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
|
|
* | | EEEEE | M, T, W, T, F, S, S | |
|
|
* | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
* | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
|
|
* | | io | 1st, 2nd, ..., 7th | 7 |
|
|
* | | ii | 01, 02, ..., 07 | 7 |
|
|
* | | iii | Mon, Tue, Wed, ..., Sun | 7 |
|
|
* | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
|
|
* | | iiiii | M, T, W, T, F, S, S | 7 |
|
|
* | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
|
|
* | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
|
|
* | | eo | 2nd, 3rd, ..., 1st | 7 |
|
|
* | | ee | 02, 03, ..., 01 | |
|
|
* | | eee | Mon, Tue, Wed, ..., Sun | |
|
|
* | | eeee | Monday, Tuesday, ..., Sunday | 2 |
|
|
* | | eeeee | M, T, W, T, F, S, S | |
|
|
* | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
* | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
|
|
* | | co | 2nd, 3rd, ..., 1st | 7 |
|
|
* | | cc | 02, 03, ..., 01 | |
|
|
* | | ccc | Mon, Tue, Wed, ..., Sun | |
|
|
* | | cccc | Monday, Tuesday, ..., Sunday | 2 |
|
|
* | | ccccc | M, T, W, T, F, S, S | |
|
|
* | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
* | AM, PM | a..aa | AM, PM | |
|
|
* | | aaa | am, pm | |
|
|
* | | aaaa | a.m., p.m. | 2 |
|
|
* | | aaaaa | a, p | |
|
|
* | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
|
|
* | | bbb | am, pm, noon, midnight | |
|
|
* | | bbbb | a.m., p.m., noon, midnight | 2 |
|
|
* | | bbbbb | a, p, n, mi | |
|
|
* | Flexible day period | B..BBB | at night, in the morning, ... | |
|
|
* | | BBBB | at night, in the morning, ... | 2 |
|
|
* | | BBBBB | at night, in the morning, ... | |
|
|
* | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
|
|
* | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
|
|
* | | hh | 01, 02, ..., 11, 12 | |
|
|
* | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
|
|
* | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
|
|
* | | HH | 00, 01, 02, ..., 23 | |
|
|
* | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
|
|
* | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
|
|
* | | KK | 01, 02, ..., 11, 00 | |
|
|
* | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
|
|
* | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
|
|
* | | kk | 24, 01, 02, ..., 23 | |
|
|
* | Minute | m | 0, 1, ..., 59 | |
|
|
* | | mo | 0th, 1st, ..., 59th | 7 |
|
|
* | | mm | 00, 01, ..., 59 | |
|
|
* | Second | s | 0, 1, ..., 59 | |
|
|
* | | so | 0th, 1st, ..., 59th | 7 |
|
|
* | | ss | 00, 01, ..., 59 | |
|
|
* | Fraction of second | S | 0, 1, ..., 9 | |
|
|
* | | SS | 00, 01, ..., 99 | |
|
|
* | | SSS | 000, 001, ..., 999 | |
|
|
* | | SSSS | ... | 3 |
|
|
* | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
|
|
* | | XX | -0800, +0530, Z | |
|
|
* | | XXX | -08:00, +05:30, Z | |
|
|
* | | XXXX | -0800, +0530, Z, +123456 | 2 |
|
|
* | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
|
|
* | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
|
|
* | | xx | -0800, +0530, +0000 | |
|
|
* | | xxx | -08:00, +05:30, +00:00 | 2 |
|
|
* | | xxxx | -0800, +0530, +0000, +123456 | |
|
|
* | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
|
|
* | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
|
|
* | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
|
|
* | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
|
|
* | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
|
|
* | Seconds timestamp | t | 512969520 | 7 |
|
|
* | | tt | ... | 3,7 |
|
|
* | Milliseconds timestamp | T | 512969520900 | 7 |
|
|
* | | TT | ... | 3,7 |
|
|
* | Long localized date | P | 04/29/1453 | 7 |
|
|
* | | PP | Apr 29, 1453 | 7 |
|
|
* | | PPP | April 29th, 1453 | 7 |
|
|
* | | PPPP | Friday, April 29th, 1453 | 2,7 |
|
|
* | Long localized time | p | 12:00 AM | 7 |
|
|
* | | pp | 12:00:00 AM | 7 |
|
|
* | | ppp | 12:00:00 AM GMT+2 | 7 |
|
|
* | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
|
|
* | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
|
|
* | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
|
|
* | | PPPppp | April 29th, 1453 at ... | 7 |
|
|
* | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
|
|
* Notes:
|
|
* 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
|
|
* are the same as "stand-alone" units, but are different in some languages.
|
|
* "Formatting" units are declined according to the rules of the language
|
|
* in the context of a date. "Stand-alone" units are always nominative singular:
|
|
*
|
|
* `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
|
|
*
|
|
* `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
|
|
*
|
|
* 2. Any sequence of the identical letters is a pattern, unless it is escaped by
|
|
* the single quote characters (see below).
|
|
* If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
|
|
* the output will be the same as default pattern for this unit, usually
|
|
* the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
|
|
* are marked with "2" in the last column of the table.
|
|
*
|
|
* `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
|
|
*
|
|
* `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
|
|
*
|
|
* `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
|
|
*
|
|
* `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
|
|
*
|
|
* `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
|
|
*
|
|
* 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
|
|
* The output will be padded with zeros to match the length of the pattern.
|
|
*
|
|
* `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
|
|
*
|
|
* 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
|
|
* These tokens represent the shortest form of the quarter.
|
|
*
|
|
* 5. The main difference between `y` and `u` patterns are B.C. years:
|
|
*
|
|
* | Year | `y` | `u` |
|
|
* |------|-----|-----|
|
|
* | AC 1 | 1 | 1 |
|
|
* | BC 1 | 1 | 0 |
|
|
* | BC 2 | 2 | -1 |
|
|
*
|
|
* Also `yy` always returns the last two digits of a year,
|
|
* while `uu` pads single digit years to 2 characters and returns other years unchanged:
|
|
*
|
|
* | Year | `yy` | `uu` |
|
|
* |------|------|------|
|
|
* | 1 | 01 | 01 |
|
|
* | 14 | 14 | 14 |
|
|
* | 376 | 76 | 376 |
|
|
* | 1453 | 53 | 1453 |
|
|
*
|
|
* The same difference is true for local and ISO week-numbering years (`Y` and `R`),
|
|
* except local week-numbering years are dependent on `options.weekStartsOn`
|
|
* and `options.firstWeekContainsDate` (compare [getISOWeekYear](https://date-fns.org/docs/getISOWeekYear)
|
|
* and [getWeekYear](https://date-fns.org/docs/getWeekYear)).
|
|
*
|
|
* 6. Specific non-location timezones are currently unavailable in `date-fns`,
|
|
* so right now these tokens fall back to GMT timezones.
|
|
*
|
|
* 7. These patterns are not in the Unicode Technical Standard #35:
|
|
* - `i`: ISO day of week
|
|
* - `I`: ISO week of year
|
|
* - `R`: ISO week-numbering year
|
|
* - `t`: seconds timestamp
|
|
* - `T`: milliseconds timestamp
|
|
* - `o`: ordinal number modifier
|
|
* - `P`: long localized date
|
|
* - `p`: long localized time
|
|
*
|
|
* 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
|
|
* You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
*
|
|
* 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
|
|
* You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
*
|
|
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
*
|
|
* @param date - The original date
|
|
* @param format - The string of tokens
|
|
* @param options - An object with options
|
|
*
|
|
* @returns The formatted date string
|
|
*
|
|
* @throws `date` must not be Invalid Date
|
|
* @throws `options.locale` must contain `localize` property
|
|
* @throws `options.locale` must contain `formatLong` property
|
|
* @throws use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
* @throws use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
* @throws use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
* @throws use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
* @throws format string contains an unescaped latin alphabet character
|
|
*
|
|
* @example
|
|
* // Represent 11 February 2014 in middle-endian format:
|
|
* const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
|
|
* //=> '02/11/2014'
|
|
*
|
|
* @example
|
|
* // Represent 2 July 2014 in Esperanto:
|
|
* import { eoLocale } from 'date-fns/locale/eo'
|
|
* const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
|
|
* locale: eoLocale
|
|
* })
|
|
* //=> '2-a de julio 2014'
|
|
*
|
|
* @example
|
|
* // Escape string by single quote characters:
|
|
* const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
|
|
* //=> "3 o'clock"
|
|
*/
|
|
function format(date, formatStr, options) {
|
|
const defaultOptions = getDefaultOptions();
|
|
const locale = options?.locale ?? defaultOptions.locale ?? enUS;
|
|
|
|
const firstWeekContainsDate =
|
|
options?.firstWeekContainsDate ??
|
|
options?.locale?.options?.firstWeekContainsDate ??
|
|
defaultOptions.firstWeekContainsDate ??
|
|
defaultOptions.locale?.options?.firstWeekContainsDate ??
|
|
1;
|
|
|
|
const weekStartsOn =
|
|
options?.weekStartsOn ??
|
|
options?.locale?.options?.weekStartsOn ??
|
|
defaultOptions.weekStartsOn ??
|
|
defaultOptions.locale?.options?.weekStartsOn ??
|
|
0;
|
|
|
|
const originalDate = toDate(date);
|
|
|
|
if (!isValid_isValid(originalDate)) {
|
|
throw new RangeError("Invalid time value");
|
|
}
|
|
|
|
let parts = formatStr
|
|
.match(longFormattingTokensRegExp)
|
|
.map((substring) => {
|
|
const firstCharacter = substring[0];
|
|
if (firstCharacter === "p" || firstCharacter === "P") {
|
|
const longFormatter = longFormatters[firstCharacter];
|
|
return longFormatter(substring, locale.formatLong);
|
|
}
|
|
return substring;
|
|
})
|
|
.join("")
|
|
.match(formattingTokensRegExp)
|
|
.map((substring) => {
|
|
// Replace two single quote characters with one single quote character
|
|
if (substring === "''") {
|
|
return { isToken: false, value: "'" };
|
|
}
|
|
|
|
const firstCharacter = substring[0];
|
|
if (firstCharacter === "'") {
|
|
return { isToken: false, value: cleanEscapedString(substring) };
|
|
}
|
|
|
|
if (formatters[firstCharacter]) {
|
|
return { isToken: true, value: substring };
|
|
}
|
|
|
|
if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
|
|
throw new RangeError(
|
|
"Format string contains an unescaped latin alphabet character `" +
|
|
firstCharacter +
|
|
"`",
|
|
);
|
|
}
|
|
|
|
return { isToken: false, value: substring };
|
|
});
|
|
|
|
// invoke localize preprocessor (only for french locales at the moment)
|
|
if (locale.localize.preprocessor) {
|
|
parts = locale.localize.preprocessor(originalDate, parts);
|
|
}
|
|
|
|
const formatterOptions = {
|
|
firstWeekContainsDate,
|
|
weekStartsOn,
|
|
locale,
|
|
};
|
|
|
|
return parts
|
|
.map((part) => {
|
|
if (!part.isToken) return part.value;
|
|
|
|
const token = part.value;
|
|
|
|
if (
|
|
(!options?.useAdditionalWeekYearTokens &&
|
|
isProtectedWeekYearToken(token)) ||
|
|
(!options?.useAdditionalDayOfYearTokens &&
|
|
isProtectedDayOfYearToken(token))
|
|
) {
|
|
warnOrThrowProtectedError(token, formatStr, String(date));
|
|
}
|
|
|
|
const formatter = formatters[token[0]];
|
|
return formatter(originalDate, token, locale.localize, formatterOptions);
|
|
})
|
|
.join("");
|
|
}
|
|
|
|
function cleanEscapedString(input) {
|
|
const matched = input.match(escapedStringRegExp);
|
|
|
|
if (!matched) {
|
|
return input;
|
|
}
|
|
|
|
return matched[1].replace(doubleQuoteRegExp, "'");
|
|
}
|
|
|
|
// Fallback for modularized imports:
|
|
/* harmony default export */ const date_fns_format = ((/* unused pure expression or super */ null && (format)));
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/getDaysInMonth.mjs
|
|
|
|
|
|
|
|
/**
|
|
* @name getDaysInMonth
|
|
* @category Month Helpers
|
|
* @summary Get the number of days in a month of the given date.
|
|
*
|
|
* @description
|
|
* Get the number of days in a month of the given date.
|
|
*
|
|
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
*
|
|
* @param date - The given date
|
|
*
|
|
* @returns The number of days in a month
|
|
*
|
|
* @example
|
|
* // How many days are in February 2000?
|
|
* const result = getDaysInMonth(new Date(2000, 1))
|
|
* //=> 29
|
|
*/
|
|
function getDaysInMonth(date) {
|
|
const _date = toDate(date);
|
|
const year = _date.getFullYear();
|
|
const monthIndex = _date.getMonth();
|
|
const lastDayOfMonth = constructFrom(date, 0);
|
|
lastDayOfMonth.setFullYear(year, monthIndex + 1, 0);
|
|
lastDayOfMonth.setHours(0, 0, 0, 0);
|
|
return lastDayOfMonth.getDate();
|
|
}
|
|
|
|
// Fallback for modularized imports:
|
|
/* harmony default export */ const date_fns_getDaysInMonth = ((/* unused pure expression or super */ null && (getDaysInMonth)));
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/setMonth.mjs
|
|
|
|
|
|
|
|
|
|
/**
|
|
* @name setMonth
|
|
* @category Month Helpers
|
|
* @summary Set the month to the given date.
|
|
*
|
|
* @description
|
|
* Set the month to the given date.
|
|
*
|
|
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
*
|
|
* @param date - The date to be changed
|
|
* @param month - The month index to set (0-11)
|
|
*
|
|
* @returns The new date with the month set
|
|
*
|
|
* @example
|
|
* // Set February to 1 September 2014:
|
|
* const result = setMonth(new Date(2014, 8, 1), 1)
|
|
* //=> Sat Feb 01 2014 00:00:00
|
|
*/
|
|
function setMonth(date, month) {
|
|
const _date = toDate(date);
|
|
const year = _date.getFullYear();
|
|
const day = _date.getDate();
|
|
|
|
const dateWithDesiredMonth = constructFrom(date, 0);
|
|
dateWithDesiredMonth.setFullYear(year, month, 15);
|
|
dateWithDesiredMonth.setHours(0, 0, 0, 0);
|
|
const daysInMonth = getDaysInMonth(dateWithDesiredMonth);
|
|
// Set the last day of the new month
|
|
// if the original date was the last day of the longer month
|
|
_date.setMonth(month, Math.min(day, daysInMonth));
|
|
return _date;
|
|
}
|
|
|
|
// Fallback for modularized imports:
|
|
/* harmony default export */ const date_fns_setMonth = ((/* unused pure expression or super */ null && (setMonth)));
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/set.mjs
|
|
|
|
|
|
|
|
|
|
/**
|
|
* @name set
|
|
* @category Common Helpers
|
|
* @summary Set date values to a given date.
|
|
*
|
|
* @description
|
|
* Set date values to a given date.
|
|
*
|
|
* Sets time values to date from object `values`.
|
|
* A value is not set if it is undefined or null or doesn't exist in `values`.
|
|
*
|
|
* Note about bundle size: `set` does not internally use `setX` functions from date-fns but instead opts
|
|
* to use native `Date#setX` methods. If you use this function, you may not want to include the
|
|
* other `setX` functions that date-fns provides if you are concerned about the bundle size.
|
|
*
|
|
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
*
|
|
* @param date - The date to be changed
|
|
* @param values - The date values to be set
|
|
*
|
|
* @returns The new date with options set
|
|
*
|
|
* @example
|
|
* // Transform 1 September 2014 into 20 October 2015 in a single line:
|
|
* const result = set(new Date(2014, 8, 20), { year: 2015, month: 9, date: 20 })
|
|
* //=> Tue Oct 20 2015 00:00:00
|
|
*
|
|
* @example
|
|
* // Set 12 PM to 1 September 2014 01:23:45 to 1 September 2014 12:00:00:
|
|
* const result = set(new Date(2014, 8, 1, 1, 23, 45), { hours: 12 })
|
|
* //=> Mon Sep 01 2014 12:23:45
|
|
*/
|
|
|
|
function set(date, values) {
|
|
let _date = toDate(date);
|
|
|
|
// Check if date is Invalid Date because Date.prototype.setFullYear ignores the value of Invalid Date
|
|
if (isNaN(+_date)) {
|
|
return constructFrom(date, NaN);
|
|
}
|
|
|
|
if (values.year != null) {
|
|
_date.setFullYear(values.year);
|
|
}
|
|
|
|
if (values.month != null) {
|
|
_date = setMonth(_date, values.month);
|
|
}
|
|
|
|
if (values.date != null) {
|
|
_date.setDate(values.date);
|
|
}
|
|
|
|
if (values.hours != null) {
|
|
_date.setHours(values.hours);
|
|
}
|
|
|
|
if (values.minutes != null) {
|
|
_date.setMinutes(values.minutes);
|
|
}
|
|
|
|
if (values.seconds != null) {
|
|
_date.setSeconds(values.seconds);
|
|
}
|
|
|
|
if (values.milliseconds != null) {
|
|
_date.setMilliseconds(values.milliseconds);
|
|
}
|
|
|
|
return _date;
|
|
}
|
|
|
|
// Fallback for modularized imports:
|
|
/* harmony default export */ const date_fns_set = ((/* unused pure expression or super */ null && (set)));
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js
|
|
var react = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+i18n@5.7.0/node_modules/@wordpress/i18n/build-module/index.js + 3 modules
|
|
var build_module = __webpack_require__("../../node_modules/.pnpm/@wordpress+i18n@5.7.0/node_modules/@wordpress/i18n/build-module/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/select-control/index.js + 3 modules
|
|
var select_control = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/select-control/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/moment@2.29.4/node_modules/moment/moment.js
|
|
var moment = __webpack_require__("../../node_modules/.pnpm/moment@2.29.4/node_modules/moment/moment.js");
|
|
var moment_default = /*#__PURE__*/__webpack_require__.n(moment);
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/moment-timezone@0.5.43/node_modules/moment-timezone/moment-timezone.js
|
|
var moment_timezone = __webpack_require__("../../node_modules/.pnpm/moment-timezone@0.5.43/node_modules/moment-timezone/moment-timezone.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/moment-timezone@0.5.43/node_modules/moment-timezone/moment-timezone-utils.js
|
|
var moment_timezone_utils = __webpack_require__("../../node_modules/.pnpm/moment-timezone@0.5.43/node_modules/moment-timezone/moment-timezone-utils.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+date@5.7.0/node_modules/@wordpress/date/build-module/index.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/** @typedef {import('moment').Moment} Moment */
|
|
/** @typedef {import('moment').LocaleSpecification} MomentLocaleSpecification */
|
|
|
|
/**
|
|
* @typedef MeridiemConfig
|
|
* @property {string} am Lowercase AM.
|
|
* @property {string} AM Uppercase AM.
|
|
* @property {string} pm Lowercase PM.
|
|
* @property {string} PM Uppercase PM.
|
|
*/
|
|
|
|
/**
|
|
* @typedef FormatsConfig
|
|
* @property {string} time Time format.
|
|
* @property {string} date Date format.
|
|
* @property {string} datetime Datetime format.
|
|
* @property {string} datetimeAbbreviated Abbreviated datetime format.
|
|
*/
|
|
|
|
/**
|
|
* @typedef TimezoneConfig
|
|
* @property {string} offset Offset setting.
|
|
* @property {string} offsetFormatted Offset setting with decimals formatted to minutes.
|
|
* @property {string} string The timezone as a string (e.g., `'America/Los_Angeles'`).
|
|
* @property {string} abbr Abbreviation for the timezone.
|
|
*/
|
|
|
|
/* eslint-disable jsdoc/valid-types */
|
|
/**
|
|
* @typedef L10nSettings
|
|
* @property {string} locale Moment locale.
|
|
* @property {MomentLocaleSpecification['months']} months Locale months.
|
|
* @property {MomentLocaleSpecification['monthsShort']} monthsShort Locale months short.
|
|
* @property {MomentLocaleSpecification['weekdays']} weekdays Locale weekdays.
|
|
* @property {MomentLocaleSpecification['weekdaysShort']} weekdaysShort Locale weekdays short.
|
|
* @property {MeridiemConfig} meridiem Meridiem config.
|
|
* @property {MomentLocaleSpecification['relativeTime']} relative Relative time config.
|
|
* @property {0|1|2|3|4|5|6} startOfWeek Day that the week starts on.
|
|
*/
|
|
/* eslint-enable jsdoc/valid-types */
|
|
|
|
/**
|
|
* @typedef DateSettings
|
|
* @property {L10nSettings} l10n Localization settings.
|
|
* @property {FormatsConfig} formats Date/time formats config.
|
|
* @property {TimezoneConfig} timezone Timezone settings.
|
|
*/
|
|
|
|
const WP_ZONE = 'WP';
|
|
|
|
// This regular expression tests positive for UTC offsets as described in ISO 8601.
|
|
// See: https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC
|
|
const VALID_UTC_OFFSET = /^[+-][0-1][0-9](:?[0-9][0-9])?$/;
|
|
|
|
// Changes made here will likely need to be synced with Core in the file
|
|
// src/wp-includes/script-loader.php in `wp_default_packages_inline_scripts()`.
|
|
/** @type {DateSettings} */
|
|
let settings = {
|
|
l10n: {
|
|
locale: 'en',
|
|
months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
|
monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
|
weekdays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
|
|
weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
|
meridiem: {
|
|
am: 'am',
|
|
pm: 'pm',
|
|
AM: 'AM',
|
|
PM: 'PM'
|
|
},
|
|
relative: {
|
|
future: '%s from now',
|
|
past: '%s ago',
|
|
s: 'a few seconds',
|
|
ss: '%d seconds',
|
|
m: 'a minute',
|
|
mm: '%d minutes',
|
|
h: 'an hour',
|
|
hh: '%d hours',
|
|
d: 'a day',
|
|
dd: '%d days',
|
|
M: 'a month',
|
|
MM: '%d months',
|
|
y: 'a year',
|
|
yy: '%d years'
|
|
},
|
|
startOfWeek: 0
|
|
},
|
|
formats: {
|
|
time: 'g: i a',
|
|
date: 'F j, Y',
|
|
datetime: 'F j, Y g: i a',
|
|
datetimeAbbreviated: 'M j, Y g: i a'
|
|
},
|
|
timezone: {
|
|
offset: '0',
|
|
offsetFormatted: '0',
|
|
string: '',
|
|
abbr: ''
|
|
}
|
|
};
|
|
|
|
/**
|
|
* Adds a locale to moment, using the format supplied by `wp_localize_script()`.
|
|
*
|
|
* @param {DateSettings} dateSettings Settings, including locale data.
|
|
*/
|
|
function setSettings(dateSettings) {
|
|
settings = dateSettings;
|
|
setupWPTimezone();
|
|
|
|
// Does moment already have a locale with the right name?
|
|
if (momentLib.locales().includes(dateSettings.l10n.locale)) {
|
|
// Is that locale misconfigured, e.g. because we are on a site running
|
|
// WordPress < 6.0?
|
|
if (momentLib.localeData(dateSettings.l10n.locale).longDateFormat('LTS') === null) {
|
|
// Delete the misconfigured locale.
|
|
// @ts-ignore Type definitions are incorrect - null is permitted.
|
|
momentLib.defineLocale(dateSettings.l10n.locale, null);
|
|
} else {
|
|
// We have a properly configured locale, so no need to create one.
|
|
return;
|
|
}
|
|
}
|
|
|
|
// defineLocale() will modify the current locale, so back it up.
|
|
const currentLocale = momentLib.locale();
|
|
|
|
// Create locale.
|
|
momentLib.defineLocale(dateSettings.l10n.locale, {
|
|
// Inherit anything missing from English. We don't load
|
|
// moment-with-locales.js so English is all there is.
|
|
parentLocale: 'en',
|
|
months: dateSettings.l10n.months,
|
|
monthsShort: dateSettings.l10n.monthsShort,
|
|
weekdays: dateSettings.l10n.weekdays,
|
|
weekdaysShort: dateSettings.l10n.weekdaysShort,
|
|
meridiem(hour, minute, isLowercase) {
|
|
if (hour < 12) {
|
|
return isLowercase ? dateSettings.l10n.meridiem.am : dateSettings.l10n.meridiem.AM;
|
|
}
|
|
return isLowercase ? dateSettings.l10n.meridiem.pm : dateSettings.l10n.meridiem.PM;
|
|
},
|
|
longDateFormat: {
|
|
LT: dateSettings.formats.time,
|
|
LTS: momentLib.localeData('en').longDateFormat('LTS'),
|
|
L: momentLib.localeData('en').longDateFormat('L'),
|
|
LL: dateSettings.formats.date,
|
|
LLL: dateSettings.formats.datetime,
|
|
LLLL: momentLib.localeData('en').longDateFormat('LLLL')
|
|
},
|
|
// From human_time_diff?
|
|
// Set to `(number, withoutSuffix, key, isFuture) => {}` instead.
|
|
relativeTime: dateSettings.l10n.relative
|
|
});
|
|
|
|
// Restore the locale to what it was.
|
|
momentLib.locale(currentLocale);
|
|
}
|
|
|
|
/**
|
|
* Returns the currently defined date settings.
|
|
*
|
|
* @return {DateSettings} Settings, including locale data.
|
|
*/
|
|
function getSettings() {
|
|
return settings;
|
|
}
|
|
|
|
/**
|
|
* Returns the currently defined date settings.
|
|
*
|
|
* @deprecated
|
|
* @return {DateSettings} Settings, including locale data.
|
|
*/
|
|
function __experimentalGetSettings() {
|
|
deprecated('wp.date.__experimentalGetSettings', {
|
|
since: '6.1',
|
|
alternative: 'wp.date.getSettings'
|
|
});
|
|
return getSettings();
|
|
}
|
|
function setupWPTimezone() {
|
|
// Get the current timezone settings from the WP timezone string.
|
|
const currentTimezone = moment_default().tz.zone(settings.timezone.string);
|
|
|
|
// Check to see if we have a valid TZ data, if so, use it for the custom WP_ZONE timezone, otherwise just use the offset.
|
|
if (currentTimezone) {
|
|
// Create WP timezone based off settings.timezone.string. We need to include the additional data so that we
|
|
// don't lose information about daylight savings time and other items.
|
|
// See https://github.com/WordPress/gutenberg/pull/48083
|
|
moment_default().tz.add(moment_default().tz.pack({
|
|
name: WP_ZONE,
|
|
abbrs: currentTimezone.abbrs,
|
|
untils: currentTimezone.untils,
|
|
offsets: currentTimezone.offsets
|
|
}));
|
|
} else {
|
|
// Create WP timezone based off dateSettings.
|
|
moment_default().tz.add(moment_default().tz.pack({
|
|
name: WP_ZONE,
|
|
abbrs: [WP_ZONE],
|
|
untils: [null],
|
|
offsets: [-settings.timezone.offset * 60 || 0]
|
|
}));
|
|
}
|
|
}
|
|
|
|
// Date constants.
|
|
/**
|
|
* Number of seconds in one minute.
|
|
*
|
|
* @type {number}
|
|
*/
|
|
const MINUTE_IN_SECONDS = 60;
|
|
/**
|
|
* Number of minutes in one hour.
|
|
*
|
|
* @type {number}
|
|
*/
|
|
const HOUR_IN_MINUTES = 60;
|
|
/**
|
|
* Number of seconds in one hour.
|
|
*
|
|
* @type {number}
|
|
*/
|
|
const HOUR_IN_SECONDS = 60 * MINUTE_IN_SECONDS;
|
|
|
|
/**
|
|
* Map of PHP formats to Moment.js formats.
|
|
*
|
|
* These are used internally by {@link wp.date.format}, and are either
|
|
* a string representing the corresponding Moment.js format code, or a
|
|
* function which returns the formatted string.
|
|
*
|
|
* This should only be used through {@link wp.date.format}, not
|
|
* directly.
|
|
*/
|
|
const formatMap = {
|
|
// Day.
|
|
d: 'DD',
|
|
D: 'ddd',
|
|
j: 'D',
|
|
l: 'dddd',
|
|
N: 'E',
|
|
/**
|
|
* Gets the ordinal suffix.
|
|
*
|
|
* @param {Moment} momentDate Moment instance.
|
|
*
|
|
* @return {string} Formatted date.
|
|
*/
|
|
S(momentDate) {
|
|
// Do - D.
|
|
const num = momentDate.format('D');
|
|
const withOrdinal = momentDate.format('Do');
|
|
return withOrdinal.replace(num, '');
|
|
},
|
|
w: 'd',
|
|
/**
|
|
* Gets the day of the year (zero-indexed).
|
|
*
|
|
* @param {Moment} momentDate Moment instance.
|
|
*
|
|
* @return {string} Formatted date.
|
|
*/
|
|
z(momentDate) {
|
|
// DDD - 1.
|
|
return (parseInt(momentDate.format('DDD'), 10) - 1).toString();
|
|
},
|
|
// Week.
|
|
W: 'W',
|
|
// Month.
|
|
F: 'MMMM',
|
|
m: 'MM',
|
|
M: 'MMM',
|
|
n: 'M',
|
|
/**
|
|
* Gets the days in the month.
|
|
*
|
|
* @param {Moment} momentDate Moment instance.
|
|
*
|
|
* @return {number} Formatted date.
|
|
*/
|
|
t(momentDate) {
|
|
return momentDate.daysInMonth();
|
|
},
|
|
// Year.
|
|
/**
|
|
* Gets whether the current year is a leap year.
|
|
*
|
|
* @param {Moment} momentDate Moment instance.
|
|
*
|
|
* @return {string} Formatted date.
|
|
*/
|
|
L(momentDate) {
|
|
return momentDate.isLeapYear() ? '1' : '0';
|
|
},
|
|
o: 'GGGG',
|
|
Y: 'YYYY',
|
|
y: 'YY',
|
|
// Time.
|
|
a: 'a',
|
|
A: 'A',
|
|
/**
|
|
* Gets the current time in Swatch Internet Time (.beats).
|
|
*
|
|
* @param {Moment} momentDate Moment instance.
|
|
*
|
|
* @return {number} Formatted date.
|
|
*/
|
|
B(momentDate) {
|
|
const timezoned = moment_default()(momentDate).utcOffset(60);
|
|
const seconds = parseInt(timezoned.format('s'), 10),
|
|
minutes = parseInt(timezoned.format('m'), 10),
|
|
hours = parseInt(timezoned.format('H'), 10);
|
|
return parseInt(((seconds + minutes * MINUTE_IN_SECONDS + hours * HOUR_IN_SECONDS) / 86.4).toString(), 10);
|
|
},
|
|
g: 'h',
|
|
G: 'H',
|
|
h: 'hh',
|
|
H: 'HH',
|
|
i: 'mm',
|
|
s: 'ss',
|
|
u: 'SSSSSS',
|
|
v: 'SSS',
|
|
// Timezone.
|
|
e: 'zz',
|
|
/**
|
|
* Gets whether the timezone is in DST currently.
|
|
*
|
|
* @param {Moment} momentDate Moment instance.
|
|
*
|
|
* @return {string} Formatted date.
|
|
*/
|
|
I(momentDate) {
|
|
return momentDate.isDST() ? '1' : '0';
|
|
},
|
|
O: 'ZZ',
|
|
P: 'Z',
|
|
T: 'z',
|
|
/**
|
|
* Gets the timezone offset in seconds.
|
|
*
|
|
* @param {Moment} momentDate Moment instance.
|
|
*
|
|
* @return {number} Formatted date.
|
|
*/
|
|
Z(momentDate) {
|
|
// Timezone offset in seconds.
|
|
const offset = momentDate.format('Z');
|
|
const sign = offset[0] === '-' ? -1 : 1;
|
|
const parts = offset.substring(1).split(':').map(n => parseInt(n, 10));
|
|
return sign * (parts[0] * HOUR_IN_MINUTES + parts[1]) * MINUTE_IN_SECONDS;
|
|
},
|
|
// Full date/time.
|
|
c: 'YYYY-MM-DDTHH:mm:ssZ',
|
|
// .toISOString.
|
|
/**
|
|
* Formats the date as RFC2822.
|
|
*
|
|
* @param {Moment} momentDate Moment instance.
|
|
*
|
|
* @return {string} Formatted date.
|
|
*/
|
|
r(momentDate) {
|
|
return momentDate.locale('en').format('ddd, DD MMM YYYY HH:mm:ss ZZ');
|
|
},
|
|
U: 'X'
|
|
};
|
|
|
|
/**
|
|
* Formats a date. Does not alter the date's timezone.
|
|
*
|
|
* @param {string} dateFormat PHP-style formatting string.
|
|
* See php.net/date.
|
|
* @param {Moment | Date | string | undefined} dateValue Date object or string,
|
|
* parsable by moment.js.
|
|
*
|
|
* @return {string} Formatted date.
|
|
*/
|
|
function build_module_format(dateFormat, dateValue = new Date()) {
|
|
let i, char;
|
|
const newFormat = [];
|
|
const momentDate = momentLib(dateValue);
|
|
for (i = 0; i < dateFormat.length; i++) {
|
|
char = dateFormat[i];
|
|
// Is this an escape?
|
|
if ('\\' === char) {
|
|
// Add next character, then move on.
|
|
i++;
|
|
newFormat.push('[' + dateFormat[i] + ']');
|
|
continue;
|
|
}
|
|
if (char in formatMap) {
|
|
const formatter = formatMap[( /** @type {keyof formatMap} */char)];
|
|
if (typeof formatter !== 'string') {
|
|
// If the format is a function, call it.
|
|
newFormat.push('[' + formatter(momentDate) + ']');
|
|
} else {
|
|
// Otherwise, add as a formatting string.
|
|
newFormat.push(formatter);
|
|
}
|
|
} else {
|
|
newFormat.push('[' + char + ']');
|
|
}
|
|
}
|
|
// Join with [] between to separate characters, and replace
|
|
// unneeded separators with static text.
|
|
return momentDate.format(newFormat.join('[]'));
|
|
}
|
|
|
|
/**
|
|
* Formats a date (like `date()` in PHP).
|
|
*
|
|
* @param {string} dateFormat PHP-style formatting string.
|
|
* See php.net/date.
|
|
* @param {Moment | Date | string | undefined} dateValue Date object or string, parsable
|
|
* by moment.js.
|
|
* @param {string | number | undefined} timezone Timezone to output result in or a
|
|
* UTC offset. Defaults to timezone from
|
|
* site.
|
|
*
|
|
* @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
|
* @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC
|
|
*
|
|
* @return {string} Formatted date in English.
|
|
*/
|
|
function date(dateFormat, dateValue = new Date(), timezone) {
|
|
const dateMoment = buildMoment(dateValue, timezone);
|
|
return build_module_format(dateFormat, dateMoment);
|
|
}
|
|
|
|
/**
|
|
* Formats a date (like `date()` in PHP), in the UTC timezone.
|
|
*
|
|
* @param {string} dateFormat PHP-style formatting string.
|
|
* See php.net/date.
|
|
* @param {Moment | Date | string | undefined} dateValue Date object or string,
|
|
* parsable by moment.js.
|
|
*
|
|
* @return {string} Formatted date in English.
|
|
*/
|
|
function gmdate(dateFormat, dateValue = new Date()) {
|
|
const dateMoment = momentLib(dateValue).utc();
|
|
return build_module_format(dateFormat, dateMoment);
|
|
}
|
|
|
|
/**
|
|
* Formats a date (like `wp_date()` in PHP), translating it into site's locale.
|
|
*
|
|
* Backward Compatibility Notice: if `timezone` is set to `true`, the function
|
|
* behaves like `gmdateI18n`.
|
|
*
|
|
* @param {string} dateFormat PHP-style formatting string.
|
|
* See php.net/date.
|
|
* @param {Moment | Date | string | undefined} dateValue Date object or string, parsable by
|
|
* moment.js.
|
|
* @param {string | number | boolean | undefined} timezone Timezone to output result in or a
|
|
* UTC offset. Defaults to timezone from
|
|
* site. Notice: `boolean` is effectively
|
|
* deprecated, but still supported for
|
|
* backward compatibility reasons.
|
|
*
|
|
* @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
|
* @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC
|
|
*
|
|
* @return {string} Formatted date.
|
|
*/
|
|
function dateI18n(dateFormat, dateValue = new Date(), timezone) {
|
|
if (true === timezone) {
|
|
return gmdateI18n(dateFormat, dateValue);
|
|
}
|
|
if (false === timezone) {
|
|
timezone = undefined;
|
|
}
|
|
const dateMoment = buildMoment(dateValue, timezone);
|
|
dateMoment.locale(settings.l10n.locale);
|
|
return build_module_format(dateFormat, dateMoment);
|
|
}
|
|
|
|
/**
|
|
* Formats a date (like `wp_date()` in PHP), translating it into site's locale
|
|
* and using the UTC timezone.
|
|
*
|
|
* @param {string} dateFormat PHP-style formatting string.
|
|
* See php.net/date.
|
|
* @param {Moment | Date | string | undefined} dateValue Date object or string,
|
|
* parsable by moment.js.
|
|
*
|
|
* @return {string} Formatted date.
|
|
*/
|
|
function gmdateI18n(dateFormat, dateValue = new Date()) {
|
|
const dateMoment = momentLib(dateValue).utc();
|
|
dateMoment.locale(settings.l10n.locale);
|
|
return build_module_format(dateFormat, dateMoment);
|
|
}
|
|
|
|
/**
|
|
* Check whether a date is considered in the future according to the WordPress settings.
|
|
*
|
|
* @param {string} dateValue Date String or Date object in the Defined WP Timezone.
|
|
*
|
|
* @return {boolean} Is in the future.
|
|
*/
|
|
function isInTheFuture(dateValue) {
|
|
const now = momentLib.tz(WP_ZONE);
|
|
const momentObject = momentLib.tz(dateValue, WP_ZONE);
|
|
return momentObject.isAfter(now);
|
|
}
|
|
|
|
/**
|
|
* Create and return a JavaScript Date Object from a date string in the WP timezone.
|
|
*
|
|
* @param {string?} dateString Date formatted in the WP timezone.
|
|
*
|
|
* @return {Date} Date
|
|
*/
|
|
function getDate(dateString) {
|
|
if (!dateString) {
|
|
return momentLib.tz(WP_ZONE).toDate();
|
|
}
|
|
return momentLib.tz(dateString, WP_ZONE).toDate();
|
|
}
|
|
|
|
/**
|
|
* Returns a human-readable time difference between two dates, like human_time_diff() in PHP.
|
|
*
|
|
* @param {Moment | Date | string} from From date, in the WP timezone.
|
|
* @param {Moment | Date | string | undefined} to To date, formatted in the WP timezone.
|
|
*
|
|
* @return {string} Human-readable time difference.
|
|
*/
|
|
function humanTimeDiff(from, to) {
|
|
const fromMoment = momentLib.tz(from, WP_ZONE);
|
|
const toMoment = to ? momentLib.tz(to, WP_ZONE) : momentLib.tz(WP_ZONE);
|
|
return fromMoment.from(toMoment);
|
|
}
|
|
|
|
/**
|
|
* Creates a moment instance using the given timezone or, if none is provided, using global settings.
|
|
*
|
|
* @param {Moment | Date | string | undefined} dateValue Date object or string, parsable
|
|
* by moment.js.
|
|
* @param {string | number | undefined} timezone Timezone to output result in or a
|
|
* UTC offset. Defaults to timezone from
|
|
* site.
|
|
*
|
|
* @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
|
* @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC
|
|
*
|
|
* @return {Moment} a moment instance.
|
|
*/
|
|
function buildMoment(dateValue, timezone = '') {
|
|
const dateMoment = momentLib(dateValue);
|
|
if (timezone && !isUTCOffset(timezone)) {
|
|
// The ! isUTCOffset() check guarantees that timezone is a string.
|
|
return dateMoment.tz( /** @type {string} */timezone);
|
|
}
|
|
if (timezone && isUTCOffset(timezone)) {
|
|
return dateMoment.utcOffset(timezone);
|
|
}
|
|
if (settings.timezone.string) {
|
|
return dateMoment.tz(settings.timezone.string);
|
|
}
|
|
return dateMoment.utcOffset(+settings.timezone.offset);
|
|
}
|
|
|
|
/**
|
|
* Returns whether a certain UTC offset is valid or not.
|
|
*
|
|
* @param {number|string} offset a UTC offset.
|
|
*
|
|
* @return {boolean} whether a certain UTC offset is valid or not.
|
|
*/
|
|
function isUTCOffset(offset) {
|
|
if ('number' === typeof offset) {
|
|
return true;
|
|
}
|
|
return VALID_UTC_OFFSET.test(offset);
|
|
}
|
|
setupWPTimezone();
|
|
//# sourceMappingURL=index.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/tooltip/index.js + 6 modules
|
|
var tooltip = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/tooltip/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@emotion+styled@11.11.0_@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2__@types+react@17.0.71_react@17.0.2/node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js
|
|
var emotion_styled_base_browser_esm = __webpack_require__("../../node_modules/.pnpm/@emotion+styled@11.11.0_@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2__@types+react@17.0.71_react@17.0.2/node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2/node_modules/@emotion/react/dist/emotion-react.browser.esm.js
|
|
var emotion_react_browser_esm = __webpack_require__("../../node_modules/.pnpm/@emotion+react@11.11.1_@types+react@17.0.71_react@17.0.2/node_modules/@emotion/react/dist/emotion-react.browser.esm.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/config-values.js
|
|
var config_values = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/config-values.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/colors-values.js
|
|
var colors_values = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/colors-values.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/space.js
|
|
var space = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/space.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/styles/input-control-styles.js
|
|
var input_control_styles = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/styles/input-control-styles.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/number-control/index.js + 2 modules
|
|
var number_control = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/number-control/index.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/date-time/time/styles.js
|
|
|
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
const Wrapper = /*#__PURE__*/(0,emotion_styled_base_browser_esm/* default */.A)("div", true ? {
|
|
target: "evcr2319"
|
|
} : 0)("box-sizing:border-box;font-size:", config_values/* default */.A.fontSize, ";" + ( true ? "" : 0));
|
|
const Fieldset = /*#__PURE__*/(0,emotion_styled_base_browser_esm/* default */.A)("fieldset", true ? {
|
|
target: "evcr2318"
|
|
} : 0)("border:0;margin:0 0 ", (0,space/* space */.x)(2 * 2), " 0;padding:0;&:last-child{margin-bottom:0;}" + ( true ? "" : 0));
|
|
const TimeWrapper = /*#__PURE__*/(0,emotion_styled_base_browser_esm/* default */.A)("div", true ? {
|
|
target: "evcr2317"
|
|
} : 0)( true ? {
|
|
name: "pd0mhc",
|
|
styles: "direction:ltr;display:flex"
|
|
} : 0);
|
|
const baseInput = /*#__PURE__*/(0,emotion_react_browser_esm/* css */.AH)("&&& ", input_control_styles/* Input */.pd, "{padding-left:", (0,space/* space */.x)(2), ";padding-right:", (0,space/* space */.x)(2), ";text-align:center;}" + ( true ? "" : 0), true ? "" : 0);
|
|
const HoursInput = /*#__PURE__*/(0,emotion_styled_base_browser_esm/* default */.A)(number_control/* default */.A, true ? {
|
|
target: "evcr2316"
|
|
} : 0)(baseInput, " width:", (0,space/* space */.x)(9), ";&&& ", input_control_styles/* Input */.pd, "{padding-right:0;}&&& ", input_control_styles/* BackdropUI */.Hr, "{border-right:0;border-top-right-radius:0;border-bottom-right-radius:0;}" + ( true ? "" : 0));
|
|
const TimeSeparator = /*#__PURE__*/(0,emotion_styled_base_browser_esm/* default */.A)("span", true ? {
|
|
target: "evcr2315"
|
|
} : 0)("border-top:", config_values/* default */.A.borderWidth, " solid ", colors_values/* COLORS */.l.gray[700], ";border-bottom:", config_values/* default */.A.borderWidth, " solid ", colors_values/* COLORS */.l.gray[700], ";font-size:", config_values/* default */.A.fontSize, ";line-height:calc(\n\t\t", config_values/* default */.A.controlHeight, " - ", config_values/* default */.A.borderWidth, " * 2\n\t);display:inline-block;" + ( true ? "" : 0));
|
|
const MinutesInput = /*#__PURE__*/(0,emotion_styled_base_browser_esm/* default */.A)(number_control/* default */.A, true ? {
|
|
target: "evcr2314"
|
|
} : 0)(baseInput, " width:", (0,space/* space */.x)(9), ";&&& ", input_control_styles/* Input */.pd, "{padding-left:0;}&&& ", input_control_styles/* BackdropUI */.Hr, "{border-left:0;border-top-left-radius:0;border-bottom-left-radius:0;}" + ( true ? "" : 0));
|
|
|
|
// Ideally we wouldn't need a wrapper, but can't otherwise target the
|
|
// <BaseControl> in <SelectControl>
|
|
const MonthSelectWrapper = /*#__PURE__*/(0,emotion_styled_base_browser_esm/* default */.A)("div", true ? {
|
|
target: "evcr2313"
|
|
} : 0)( true ? {
|
|
name: "1ff36h2",
|
|
styles: "flex-grow:1"
|
|
} : 0);
|
|
const DayInput = /*#__PURE__*/(0,emotion_styled_base_browser_esm/* default */.A)(number_control/* default */.A, true ? {
|
|
target: "evcr2312"
|
|
} : 0)(baseInput, " width:", (0,space/* space */.x)(9), ";" + ( true ? "" : 0));
|
|
const YearInput = /*#__PURE__*/(0,emotion_styled_base_browser_esm/* default */.A)(number_control/* default */.A, true ? {
|
|
target: "evcr2311"
|
|
} : 0)(baseInput, " width:", (0,space/* space */.x)(14), ";" + ( true ? "" : 0));
|
|
const TimeZone = /*#__PURE__*/(0,emotion_styled_base_browser_esm/* default */.A)("div", true ? {
|
|
target: "evcr2310"
|
|
} : 0)( true ? {
|
|
name: "ebu3jh",
|
|
styles: "text-decoration:underline dotted"
|
|
} : 0);
|
|
//# sourceMappingURL=styles.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/date-time/time/timezone.js
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Displays timezone information when user timezone is different from site
|
|
* timezone.
|
|
*/
|
|
|
|
const timezone_TimeZone = () => {
|
|
const {
|
|
timezone
|
|
} = getSettings();
|
|
|
|
// Convert timezone offset to hours.
|
|
const userTimezoneOffset = -1 * (new Date().getTimezoneOffset() / 60);
|
|
|
|
// System timezone and user timezone match, nothing needed.
|
|
// Compare as numbers because it comes over as string.
|
|
if (Number(timezone.offset) === userTimezoneOffset) {
|
|
return null;
|
|
}
|
|
const offsetSymbol = Number(timezone.offset) >= 0 ? '+' : '';
|
|
const zoneAbbr = '' !== timezone.abbr && isNaN(Number(timezone.abbr)) ? timezone.abbr : `UTC${offsetSymbol}${timezone.offsetFormatted}`;
|
|
|
|
// Replace underscore with space in strings like `America/Costa_Rica`.
|
|
const prettyTimezoneString = timezone.string.replace('_', ' ');
|
|
const timezoneDetail = 'UTC' === timezone.string ? (0,build_module.__)('Coordinated Universal Time') : `(${zoneAbbr}) ${prettyTimezoneString}`;
|
|
|
|
// When the prettyTimezoneString is empty, there is no additional timezone
|
|
// detail information to show in a Tooltip.
|
|
const hasNoAdditionalTimezoneDetail = prettyTimezoneString.trim().length === 0;
|
|
return hasNoAdditionalTimezoneDetail ? /*#__PURE__*/(0,jsx_runtime.jsx)(TimeZone, {
|
|
className: "components-datetime__timezone",
|
|
children: zoneAbbr
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Ay, {
|
|
placement: "top",
|
|
text: timezoneDetail,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(TimeZone, {
|
|
className: "components-datetime__timezone",
|
|
children: zoneAbbr
|
|
})
|
|
});
|
|
};
|
|
/* harmony default export */ const timezone = (timezone_TimeZone);
|
|
//# sourceMappingURL=timezone.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/h-stack/component.js
|
|
var h_stack_component = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/h-stack/component.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/spacer/component.js + 1 modules
|
|
var spacer_component = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/spacer/component.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/reducer/actions.js
|
|
var actions = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/input-control/reducer/actions.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/date-time/utils.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Like date-fn's toDate, but tries to guess the format when a string is
|
|
* given.
|
|
*
|
|
* @param input Value to turn into a date.
|
|
*/
|
|
function inputToDate(input) {
|
|
if (typeof input === 'string') {
|
|
return new Date(input);
|
|
}
|
|
return toDate(input);
|
|
}
|
|
|
|
/**
|
|
* Converts a 12-hour time to a 24-hour time.
|
|
* @param hours
|
|
* @param isPm
|
|
*/
|
|
function from12hTo24h(hours, isPm) {
|
|
return isPm ? (hours % 12 + 12) % 24 : hours % 12;
|
|
}
|
|
|
|
/**
|
|
* Converts a 24-hour time to a 12-hour time.
|
|
* @param hours
|
|
*/
|
|
function from24hTo12h(hours) {
|
|
return hours % 12 || 12;
|
|
}
|
|
|
|
/**
|
|
* Creates an InputControl reducer used to pad an input so that it is always a
|
|
* given width. For example, the hours and minutes inputs are padded to 2 so
|
|
* that '4' appears as '04'.
|
|
*
|
|
* @param pad How many digits the value should be.
|
|
*/
|
|
function buildPadInputStateReducer(pad) {
|
|
return (state, action) => {
|
|
const nextState = {
|
|
...state
|
|
};
|
|
if (action.type === actions/* COMMIT */.cJ || action.type === actions/* PRESS_UP */.wX || action.type === actions/* PRESS_DOWN */.r7) {
|
|
if (nextState.value !== undefined) {
|
|
nextState.value = nextState.value.toString().padStart(pad, '0');
|
|
}
|
|
}
|
|
return nextState;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Validates the target of a React event to ensure it is an input element and
|
|
* that the input is valid.
|
|
* @param event
|
|
*/
|
|
function validateInputElementTarget(event) {
|
|
var _ownerDocument$defaul;
|
|
// `instanceof` checks need to get the instance definition from the
|
|
// corresponding window object — therefore, the following logic makes
|
|
// the component work correctly even when rendered inside an iframe.
|
|
const HTMLInputElementInstance = (_ownerDocument$defaul = event.target?.ownerDocument.defaultView?.HTMLInputElement) !== null && _ownerDocument$defaul !== void 0 ? _ownerDocument$defaul : HTMLInputElement;
|
|
if (!(event.target instanceof HTMLInputElementInstance)) {
|
|
return false;
|
|
}
|
|
return event.target.validity.valid;
|
|
}
|
|
//# sourceMappingURL=utils.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/date-time/constants.js
|
|
const TIMEZONELESS_FORMAT = "yyyy-MM-dd'T'HH:mm:ss";
|
|
//# sourceMappingURL=constants.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
var clsx = __webpack_require__("../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/hooks/use-controlled-value.js
|
|
var use_controlled_value = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/utils/hooks/use-controlled-value.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control/component.js + 12 modules
|
|
var toggle_group_control_component = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control/component.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option/component.js
|
|
var toggle_group_control_option_component = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option/component.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/date-time/time/time-input/index.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function TimeInput({
|
|
value: valueProp,
|
|
defaultValue,
|
|
is12Hour,
|
|
label,
|
|
minutesProps,
|
|
onChange
|
|
}) {
|
|
const [value = {
|
|
hours: new Date().getHours(),
|
|
minutes: new Date().getMinutes()
|
|
}, setValue] = (0,use_controlled_value/* useControlledValue */.j)({
|
|
value: valueProp,
|
|
onChange,
|
|
defaultValue
|
|
});
|
|
const dayPeriod = parseDayPeriod(value.hours);
|
|
const hours12Format = from24hTo12h(value.hours);
|
|
const buildNumberControlChangeCallback = method => {
|
|
return (_value, {
|
|
event
|
|
}) => {
|
|
if (!validateInputElementTarget(event)) {
|
|
return;
|
|
}
|
|
|
|
// We can safely assume value is a number if target is valid.
|
|
const numberValue = Number(_value);
|
|
setValue({
|
|
...value,
|
|
[method]: method === 'hours' && is12Hour ? from12hTo24h(numberValue, dayPeriod === 'PM') : numberValue
|
|
});
|
|
};
|
|
};
|
|
const buildAmPmChangeCallback = _value => {
|
|
return () => {
|
|
if (dayPeriod === _value) {
|
|
return;
|
|
}
|
|
setValue({
|
|
...value,
|
|
hours: from12hTo24h(hours12Format, _value === 'PM')
|
|
});
|
|
};
|
|
};
|
|
function parseDayPeriod(_hours) {
|
|
return _hours < 12 ? 'AM' : 'PM';
|
|
}
|
|
const Wrapper = label ? Fieldset : react.Fragment;
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(Wrapper, {
|
|
children: [label && /*#__PURE__*/(0,jsx_runtime.jsx)(base_control/* default.VisualLabel */.Ay.VisualLabel, {
|
|
as: "legend",
|
|
children: label
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(h_stack_component/* default */.A, {
|
|
alignment: "left",
|
|
expanded: false,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(TimeWrapper, {
|
|
className: "components-datetime__time-field components-datetime__time-field-time" // Unused, for backwards compatibility.
|
|
,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(HoursInput, {
|
|
className: "components-datetime__time-field-hours-input" // Unused, for backwards compatibility.
|
|
,
|
|
label: (0,build_module.__)('Hours'),
|
|
hideLabelFromVision: true,
|
|
__next40pxDefaultSize: true,
|
|
value: String(is12Hour ? hours12Format : value.hours).padStart(2, '0'),
|
|
step: 1,
|
|
min: is12Hour ? 1 : 0,
|
|
max: is12Hour ? 12 : 23,
|
|
required: true,
|
|
spinControls: "none",
|
|
isPressEnterToChange: true,
|
|
isDragEnabled: false,
|
|
isShiftStepEnabled: false,
|
|
onChange: buildNumberControlChangeCallback('hours'),
|
|
__unstableStateReducer: buildPadInputStateReducer(2)
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(TimeSeparator, {
|
|
className: "components-datetime__time-separator" // Unused, for backwards compatibility.
|
|
,
|
|
"aria-hidden": "true",
|
|
children: ":"
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(MinutesInput, {
|
|
className: (0,clsx/* default */.A)('components-datetime__time-field-minutes-input',
|
|
// Unused, for backwards compatibility.
|
|
minutesProps?.className),
|
|
label: (0,build_module.__)('Minutes'),
|
|
hideLabelFromVision: true,
|
|
__next40pxDefaultSize: true,
|
|
value: String(value.minutes).padStart(2, '0'),
|
|
step: 1,
|
|
min: 0,
|
|
max: 59,
|
|
required: true,
|
|
spinControls: "none",
|
|
isPressEnterToChange: true,
|
|
isDragEnabled: false,
|
|
isShiftStepEnabled: false,
|
|
onChange: (...args) => {
|
|
buildNumberControlChangeCallback('minutes')(...args);
|
|
minutesProps?.onChange?.(...args);
|
|
},
|
|
__unstableStateReducer: buildPadInputStateReducer(2),
|
|
...minutesProps
|
|
})]
|
|
}), is12Hour && /*#__PURE__*/(0,jsx_runtime.jsxs)(toggle_group_control_component/* default */.A, {
|
|
__next40pxDefaultSize: true,
|
|
__nextHasNoMarginBottom: true,
|
|
isBlock: true,
|
|
label: (0,build_module.__)('Select AM or PM'),
|
|
hideLabelFromVision: true,
|
|
value: dayPeriod,
|
|
onChange: newValue => {
|
|
buildAmPmChangeCallback(newValue)();
|
|
},
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(toggle_group_control_option_component/* default */.A, {
|
|
value: "AM",
|
|
label: (0,build_module.__)('AM')
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(toggle_group_control_option_component/* default */.A, {
|
|
value: "PM",
|
|
label: (0,build_module.__)('PM')
|
|
})]
|
|
})]
|
|
})]
|
|
});
|
|
}
|
|
/* harmony default export */ const time_input = ((/* unused pure expression or super */ null && (TimeInput)));
|
|
//# sourceMappingURL=index.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/date-time/time/index.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const VALID_DATE_ORDERS = ['dmy', 'mdy', 'ymd'];
|
|
|
|
/**
|
|
* TimePicker is a React component that renders a clock for time selection.
|
|
*
|
|
* ```jsx
|
|
* import { TimePicker } from '@wordpress/components';
|
|
* import { useState } from '@wordpress/element';
|
|
*
|
|
* const MyTimePicker = () => {
|
|
* const [ time, setTime ] = useState( new Date() );
|
|
*
|
|
* return (
|
|
* <TimePicker
|
|
* currentTime={ date }
|
|
* onChange={ ( newTime ) => setTime( newTime ) }
|
|
* is12Hour
|
|
* />
|
|
* );
|
|
* };
|
|
* ```
|
|
*/
|
|
function TimePicker({
|
|
is12Hour,
|
|
currentTime,
|
|
onChange,
|
|
dateOrder: dateOrderProp,
|
|
hideLabelFromVision = false
|
|
}) {
|
|
const [date, setDate] = (0,react.useState)(() =>
|
|
// Truncate the date at the minutes, see: #15495.
|
|
currentTime ? startOfMinute(inputToDate(currentTime)) : new Date());
|
|
|
|
// Reset the state when currentTime changed.
|
|
// TODO: useEffect() shouldn't be used like this, causes an unnecessary render
|
|
(0,react.useEffect)(() => {
|
|
setDate(currentTime ? startOfMinute(inputToDate(currentTime)) : new Date());
|
|
}, [currentTime]);
|
|
const monthOptions = [{
|
|
value: '01',
|
|
label: (0,build_module.__)('January')
|
|
}, {
|
|
value: '02',
|
|
label: (0,build_module.__)('February')
|
|
}, {
|
|
value: '03',
|
|
label: (0,build_module.__)('March')
|
|
}, {
|
|
value: '04',
|
|
label: (0,build_module.__)('April')
|
|
}, {
|
|
value: '05',
|
|
label: (0,build_module.__)('May')
|
|
}, {
|
|
value: '06',
|
|
label: (0,build_module.__)('June')
|
|
}, {
|
|
value: '07',
|
|
label: (0,build_module.__)('July')
|
|
}, {
|
|
value: '08',
|
|
label: (0,build_module.__)('August')
|
|
}, {
|
|
value: '09',
|
|
label: (0,build_module.__)('September')
|
|
}, {
|
|
value: '10',
|
|
label: (0,build_module.__)('October')
|
|
}, {
|
|
value: '11',
|
|
label: (0,build_module.__)('November')
|
|
}, {
|
|
value: '12',
|
|
label: (0,build_module.__)('December')
|
|
}];
|
|
const {
|
|
day,
|
|
month,
|
|
year,
|
|
minutes,
|
|
hours
|
|
} = (0,react.useMemo)(() => ({
|
|
day: format(date, 'dd'),
|
|
month: format(date, 'MM'),
|
|
year: format(date, 'yyyy'),
|
|
minutes: format(date, 'mm'),
|
|
hours: format(date, 'HH'),
|
|
am: format(date, 'a')
|
|
}), [date]);
|
|
const buildNumberControlChangeCallback = method => {
|
|
const callback = (value, {
|
|
event
|
|
}) => {
|
|
if (!validateInputElementTarget(event)) {
|
|
return;
|
|
}
|
|
|
|
// We can safely assume value is a number if target is valid.
|
|
const numberValue = Number(value);
|
|
const newDate = set(date, {
|
|
[method]: numberValue
|
|
});
|
|
setDate(newDate);
|
|
onChange?.(format(newDate, TIMEZONELESS_FORMAT));
|
|
};
|
|
return callback;
|
|
};
|
|
const onTimeInputChangeCallback = ({
|
|
hours: newHours,
|
|
minutes: newMinutes
|
|
}) => {
|
|
const newDate = set(date, {
|
|
hours: newHours,
|
|
minutes: newMinutes
|
|
});
|
|
setDate(newDate);
|
|
onChange?.(format(newDate, TIMEZONELESS_FORMAT));
|
|
};
|
|
const dayField = /*#__PURE__*/(0,jsx_runtime.jsx)(DayInput, {
|
|
className: "components-datetime__time-field components-datetime__time-field-day" // Unused, for backwards compatibility.
|
|
,
|
|
label: (0,build_module.__)('Day'),
|
|
hideLabelFromVision: true,
|
|
__next40pxDefaultSize: true,
|
|
value: day,
|
|
step: 1,
|
|
min: 1,
|
|
max: 31,
|
|
required: true,
|
|
spinControls: "none",
|
|
isPressEnterToChange: true,
|
|
isDragEnabled: false,
|
|
isShiftStepEnabled: false,
|
|
onChange: buildNumberControlChangeCallback('date')
|
|
}, "day");
|
|
const monthField = /*#__PURE__*/(0,jsx_runtime.jsx)(MonthSelectWrapper, {
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(select_control/* default */.A, {
|
|
className: "components-datetime__time-field components-datetime__time-field-month" // Unused, for backwards compatibility.
|
|
,
|
|
label: (0,build_module.__)('Month'),
|
|
hideLabelFromVision: true,
|
|
__next40pxDefaultSize: true,
|
|
__nextHasNoMarginBottom: true,
|
|
value: month,
|
|
options: monthOptions,
|
|
onChange: value => {
|
|
const newDate = setMonth(date, Number(value) - 1);
|
|
setDate(newDate);
|
|
onChange?.(format(newDate, TIMEZONELESS_FORMAT));
|
|
}
|
|
})
|
|
}, "month");
|
|
const yearField = /*#__PURE__*/(0,jsx_runtime.jsx)(YearInput, {
|
|
className: "components-datetime__time-field components-datetime__time-field-year" // Unused, for backwards compatibility.
|
|
,
|
|
label: (0,build_module.__)('Year'),
|
|
hideLabelFromVision: true,
|
|
__next40pxDefaultSize: true,
|
|
value: year,
|
|
step: 1,
|
|
min: 1,
|
|
max: 9999,
|
|
required: true,
|
|
spinControls: "none",
|
|
isPressEnterToChange: true,
|
|
isDragEnabled: false,
|
|
isShiftStepEnabled: false,
|
|
onChange: buildNumberControlChangeCallback('year'),
|
|
__unstableStateReducer: buildPadInputStateReducer(4)
|
|
}, "year");
|
|
const defaultDateOrder = is12Hour ? 'mdy' : 'dmy';
|
|
const dateOrder = dateOrderProp && VALID_DATE_ORDERS.includes(dateOrderProp) ? dateOrderProp : defaultDateOrder;
|
|
const fields = dateOrder.split('').map(field => {
|
|
switch (field) {
|
|
case 'd':
|
|
return dayField;
|
|
case 'm':
|
|
return monthField;
|
|
case 'y':
|
|
return yearField;
|
|
default:
|
|
return null;
|
|
}
|
|
});
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(Wrapper, {
|
|
className: "components-datetime__time" // Unused, for backwards compatibility.
|
|
,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(Fieldset, {
|
|
children: [hideLabelFromVision ? /*#__PURE__*/(0,jsx_runtime.jsx)(component/* default */.A, {
|
|
as: "legend",
|
|
children: (0,build_module.__)('Time')
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(base_control/* default.VisualLabel */.Ay.VisualLabel, {
|
|
as: "legend",
|
|
className: "components-datetime__time-legend" // Unused, for backwards compatibility.
|
|
,
|
|
children: (0,build_module.__)('Time')
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(h_stack_component/* default */.A, {
|
|
className: "components-datetime__time-wrapper" // Unused, for backwards compatibility.
|
|
,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(TimeInput, {
|
|
value: {
|
|
hours: Number(hours),
|
|
minutes: Number(minutes)
|
|
},
|
|
is12Hour: is12Hour,
|
|
onChange: onTimeInputChangeCallback
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(spacer_component/* default */.A, {}), /*#__PURE__*/(0,jsx_runtime.jsx)(timezone, {})]
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(Fieldset, {
|
|
children: [hideLabelFromVision ? /*#__PURE__*/(0,jsx_runtime.jsx)(component/* default */.A, {
|
|
as: "legend",
|
|
children: (0,build_module.__)('Date')
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(base_control/* default.VisualLabel */.Ay.VisualLabel, {
|
|
as: "legend",
|
|
className: "components-datetime__time-legend" // Unused, for backwards compatibility.
|
|
,
|
|
children: (0,build_module.__)('Date')
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(h_stack_component/* default */.A, {
|
|
className: "components-datetime__time-wrapper" // Unused, for backwards compatibility.
|
|
,
|
|
children: fields
|
|
})]
|
|
})]
|
|
});
|
|
}
|
|
|
|
/**
|
|
* A component to input a time.
|
|
*
|
|
* Values are passed as an object in 24-hour format (`{ hours: number, minutes: number }`).
|
|
*
|
|
* ```jsx
|
|
* import { TimePicker } from '@wordpress/components';
|
|
* import { useState } from '@wordpress/element';
|
|
*
|
|
* const MyTimeInput = () => {
|
|
* const [ time, setTime ] = useState( { hours: 13, minutes: 30 } );
|
|
*
|
|
* return (
|
|
* <TimePicker.TimeInput
|
|
* value={ time }
|
|
* onChange={ setTime }
|
|
* label="Time"
|
|
* />
|
|
* );
|
|
* };
|
|
* ```
|
|
*/
|
|
TimePicker.TimeInput = TimeInput;
|
|
Object.assign(TimePicker.TimeInput, {
|
|
displayName: 'TimePicker.TimeInput'
|
|
});
|
|
/* harmony default export */ const time = (TimePicker);
|
|
//# sourceMappingURL=index.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+dataviews@4.3.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@wordpress/dataviews/build-module/dataform-controls/datetime.js
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
function DateTime({
|
|
data,
|
|
field,
|
|
onChange,
|
|
hideLabelFromVision
|
|
}) {
|
|
const {
|
|
id,
|
|
label
|
|
} = field;
|
|
const value = field.getValue({
|
|
item: data
|
|
});
|
|
const onChangeControl = (0,react.useCallback)(newValue => onChange({
|
|
[id]: newValue
|
|
}), [id, onChange]);
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("fieldset", {
|
|
className: "dataviews-controls__datetime",
|
|
children: [!hideLabelFromVision && /*#__PURE__*/(0,jsx_runtime.jsx)(base_control/* default.VisualLabel */.Ay.VisualLabel, {
|
|
as: "legend",
|
|
children: label
|
|
}), hideLabelFromVision && /*#__PURE__*/(0,jsx_runtime.jsx)(component/* default */.A, {
|
|
as: "legend",
|
|
children: label
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(time, {
|
|
currentTime: value,
|
|
onChange: onChangeControl,
|
|
hideLabelFromVision: true
|
|
})]
|
|
});
|
|
}
|
|
//# sourceMappingURL=datetime.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+dataviews@4.3.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@wordpress/dataviews/build-module/dataform-controls/integer.js
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
function Integer({
|
|
data,
|
|
field,
|
|
onChange,
|
|
hideLabelFromVision
|
|
}) {
|
|
var _field$getValue;
|
|
const {
|
|
id,
|
|
label,
|
|
description
|
|
} = field;
|
|
const value = (_field$getValue = field.getValue({
|
|
item: data
|
|
})) !== null && _field$getValue !== void 0 ? _field$getValue : '';
|
|
const onChangeControl = (0,react.useCallback)(newValue => onChange({
|
|
[id]: Number(newValue)
|
|
}), [id, onChange]);
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(number_control/* default */.A, {
|
|
label: label,
|
|
help: description,
|
|
value: value,
|
|
onChange: onChangeControl,
|
|
__next40pxDefaultSize: true,
|
|
hideLabelFromVision: hideLabelFromVision
|
|
});
|
|
}
|
|
//# sourceMappingURL=integer.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-instance-id/index.js
|
|
var use_instance_id = __webpack_require__("../../node_modules/.pnpm/@wordpress+compose@7.7.0_react@17.0.2/node_modules/@wordpress/compose/build-module/hooks/use-instance-id/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/v-stack/component.js + 1 modules
|
|
var v_stack_component = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/v-stack/component.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/base-control/styles/base-control-styles.js + 1 modules
|
|
var base_control_styles = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/base-control/styles/base-control-styles.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/radio-control/index.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function generateOptionDescriptionId(radioGroupId, index) {
|
|
return `${radioGroupId}-${index}-option-description`;
|
|
}
|
|
function generateOptionId(radioGroupId, index) {
|
|
return `${radioGroupId}-${index}`;
|
|
}
|
|
function generateHelpId(radioGroupId) {
|
|
return `${radioGroupId}__help`;
|
|
}
|
|
|
|
/**
|
|
* Render a user interface to select the user type using radio inputs.
|
|
*
|
|
* ```jsx
|
|
* import { RadioControl } from '@wordpress/components';
|
|
* import { useState } from '@wordpress/element';
|
|
*
|
|
* const MyRadioControl = () => {
|
|
* const [ option, setOption ] = useState( 'a' );
|
|
*
|
|
* return (
|
|
* <RadioControl
|
|
* label="User type"
|
|
* help="The type of the current user"
|
|
* selected={ option }
|
|
* options={ [
|
|
* { label: 'Author', value: 'a' },
|
|
* { label: 'Editor', value: 'e' },
|
|
* ] }
|
|
* onChange={ ( value ) => setOption( value ) }
|
|
* />
|
|
* );
|
|
* };
|
|
* ```
|
|
*/
|
|
function RadioControl(props) {
|
|
const {
|
|
label,
|
|
className,
|
|
selected,
|
|
help,
|
|
onChange,
|
|
hideLabelFromVision,
|
|
options = [],
|
|
id: preferredId,
|
|
...additionalProps
|
|
} = props;
|
|
const id = (0,use_instance_id/* default */.A)(RadioControl, 'inspector-radio-control', preferredId);
|
|
const onChangeValue = event => onChange(event.target.value);
|
|
if (!options?.length) {
|
|
return null;
|
|
}
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("fieldset", {
|
|
id: id,
|
|
className: (0,clsx/* default */.A)(className, 'components-radio-control'),
|
|
"aria-describedby": !!help ? generateHelpId(id) : undefined,
|
|
children: [hideLabelFromVision ? /*#__PURE__*/(0,jsx_runtime.jsx)(component/* default */.A, {
|
|
as: "legend",
|
|
children: label
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(base_control/* default.VisualLabel */.Ay.VisualLabel, {
|
|
as: "legend",
|
|
children: label
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(v_stack_component/* default */.A, {
|
|
spacing: 3,
|
|
className: (0,clsx/* default */.A)('components-radio-control__group-wrapper', {
|
|
'has-help': !!help
|
|
}),
|
|
children: options.map((option, index) => /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: "components-radio-control__option",
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("input", {
|
|
id: generateOptionId(id, index),
|
|
className: "components-radio-control__input",
|
|
type: "radio",
|
|
name: id,
|
|
value: option.value,
|
|
onChange: onChangeValue,
|
|
checked: option.value === selected,
|
|
"aria-describedby": !!option.description ? generateOptionDescriptionId(id, index) : undefined,
|
|
...additionalProps
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("label", {
|
|
className: "components-radio-control__label",
|
|
htmlFor: generateOptionId(id, index),
|
|
children: option.label
|
|
}), !!option.description ? /*#__PURE__*/(0,jsx_runtime.jsx)(base_control_styles/* StyledHelp */.te, {
|
|
__nextHasNoMarginBottom: true,
|
|
id: generateOptionDescriptionId(id, index),
|
|
className: "components-radio-control__option-description",
|
|
children: option.description
|
|
}) : null]
|
|
}, generateOptionId(id, index)))
|
|
}), !!help && /*#__PURE__*/(0,jsx_runtime.jsx)(base_control_styles/* StyledHelp */.te, {
|
|
__nextHasNoMarginBottom: true,
|
|
id: generateHelpId(id),
|
|
className: "components-base-control__help",
|
|
children: help
|
|
})]
|
|
});
|
|
}
|
|
/* harmony default export */ const radio_control = (RadioControl);
|
|
//# sourceMappingURL=index.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+dataviews@4.3.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@wordpress/dataviews/build-module/dataform-controls/radio.js
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
function Radio({
|
|
data,
|
|
field,
|
|
onChange,
|
|
hideLabelFromVision
|
|
}) {
|
|
const {
|
|
id,
|
|
label
|
|
} = field;
|
|
const value = field.getValue({
|
|
item: data
|
|
});
|
|
const onChangeControl = (0,react.useCallback)(newValue => onChange({
|
|
[id]: newValue
|
|
}), [id, onChange]);
|
|
if (field.elements) {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(radio_control, {
|
|
label: label,
|
|
onChange: onChangeControl,
|
|
options: field.elements,
|
|
selected: value,
|
|
hideLabelFromVision: hideLabelFromVision
|
|
});
|
|
}
|
|
return null;
|
|
}
|
|
//# sourceMappingURL=radio.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+dataviews@4.3.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@wordpress/dataviews/build-module/dataform-controls/select.js
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
function Select({
|
|
data,
|
|
field,
|
|
onChange,
|
|
hideLabelFromVision
|
|
}) {
|
|
var _field$getValue, _field$elements;
|
|
const {
|
|
id,
|
|
label
|
|
} = field;
|
|
const value = (_field$getValue = field.getValue({
|
|
item: data
|
|
})) !== null && _field$getValue !== void 0 ? _field$getValue : '';
|
|
const onChangeControl = (0,react.useCallback)(newValue => onChange({
|
|
[id]: newValue
|
|
}), [id, onChange]);
|
|
const elements = [
|
|
/*
|
|
* Value can be undefined when:
|
|
*
|
|
* - the field is not required
|
|
* - in bulk editing
|
|
*
|
|
*/
|
|
{
|
|
label: (0,build_module.__)('Select item'),
|
|
value: ''
|
|
}, ...((_field$elements = field?.elements) !== null && _field$elements !== void 0 ? _field$elements : [])];
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(select_control/* default */.A, {
|
|
label: label,
|
|
value: value,
|
|
options: elements,
|
|
onChange: onChangeControl,
|
|
__next40pxDefaultSize: true,
|
|
__nextHasNoMarginBottom: true,
|
|
hideLabelFromVision: hideLabelFromVision
|
|
});
|
|
}
|
|
//# sourceMappingURL=select.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+components@28.7.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0_hsnmspo6xxbym6m5qywqiwgrj4/node_modules/@wordpress/components/build-module/text-control/index.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
function UnforwardedTextControl(props, ref) {
|
|
const {
|
|
__nextHasNoMarginBottom,
|
|
__next40pxDefaultSize = false,
|
|
label,
|
|
hideLabelFromVision,
|
|
value,
|
|
help,
|
|
id: idProp,
|
|
className,
|
|
onChange,
|
|
type = 'text',
|
|
...additionalProps
|
|
} = props;
|
|
const id = (0,use_instance_id/* default */.A)(TextControl, 'inspector-text-control', idProp);
|
|
const onChangeValue = event => onChange(event.target.value);
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(base_control/* default */.Ay, {
|
|
__nextHasNoMarginBottom: __nextHasNoMarginBottom,
|
|
__associatedWPComponentName: "TextControl",
|
|
label: label,
|
|
hideLabelFromVision: hideLabelFromVision,
|
|
id: id,
|
|
help: help,
|
|
className: className,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("input", {
|
|
className: (0,clsx/* default */.A)('components-text-control__input', {
|
|
'is-next-40px-default-size': __next40pxDefaultSize
|
|
}),
|
|
type: type,
|
|
id: id,
|
|
value: value,
|
|
onChange: onChangeValue,
|
|
"aria-describedby": !!help ? id + '__help' : undefined,
|
|
ref: ref,
|
|
...additionalProps
|
|
})
|
|
});
|
|
}
|
|
|
|
/**
|
|
* TextControl components let users enter and edit text.
|
|
*
|
|
* ```jsx
|
|
* import { TextControl } from '@wordpress/components';
|
|
* import { useState } from '@wordpress/element';
|
|
*
|
|
* const MyTextControl = () => {
|
|
* const [ className, setClassName ] = useState( '' );
|
|
*
|
|
* return (
|
|
* <TextControl
|
|
* __nextHasNoMarginBottom
|
|
* label="Additional CSS Class"
|
|
* value={ className }
|
|
* onChange={ ( value ) => setClassName( value ) }
|
|
* />
|
|
* );
|
|
* };
|
|
* ```
|
|
*/
|
|
const TextControl = (0,react.forwardRef)(UnforwardedTextControl);
|
|
/* harmony default export */ const text_control = (TextControl);
|
|
//# sourceMappingURL=index.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+dataviews@4.3.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@wordpress/dataviews/build-module/dataform-controls/text.js
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
function Text({
|
|
data,
|
|
field,
|
|
onChange,
|
|
hideLabelFromVision
|
|
}) {
|
|
const {
|
|
id,
|
|
label,
|
|
placeholder
|
|
} = field;
|
|
const value = field.getValue({
|
|
item: data
|
|
});
|
|
const onChangeControl = (0,react.useCallback)(newValue => onChange({
|
|
[id]: newValue
|
|
}), [id, onChange]);
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(text_control, {
|
|
label: label,
|
|
placeholder: placeholder,
|
|
value: value !== null && value !== void 0 ? value : '',
|
|
onChange: onChangeControl,
|
|
__next40pxDefaultSize: true,
|
|
__nextHasNoMarginBottom: true,
|
|
hideLabelFromVision: hideLabelFromVision
|
|
});
|
|
}
|
|
//# sourceMappingURL=text.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+dataviews@4.3.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@wordpress/dataviews/build-module/dataform-controls/index.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const FORM_CONTROLS = {
|
|
datetime: DateTime,
|
|
integer: Integer,
|
|
radio: Radio,
|
|
select: Select,
|
|
text: Text
|
|
};
|
|
function getControl(field, fieldTypeDefinition) {
|
|
if (typeof field.Edit === 'function') {
|
|
return field.Edit;
|
|
}
|
|
if (typeof field.Edit === 'string') {
|
|
return getControlByType(field.Edit);
|
|
}
|
|
if (field.elements) {
|
|
return getControlByType('select');
|
|
}
|
|
if (typeof fieldTypeDefinition.Edit === 'string') {
|
|
return getControlByType(fieldTypeDefinition.Edit);
|
|
}
|
|
return fieldTypeDefinition.Edit;
|
|
}
|
|
function getControlByType(type) {
|
|
if (Object.keys(FORM_CONTROLS).includes(type)) {
|
|
return FORM_CONTROLS[type];
|
|
}
|
|
throw 'Control ' + type + ' not found';
|
|
}
|
|
//# sourceMappingURL=index.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+dataviews@4.3.0_@emotion+is-prop-valid@1.2.1_@types+react@17.0.71_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@wordpress/dataviews/build-module/normalize-fields.js
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Apply default values and normalize the fields config.
|
|
*
|
|
* @param fields Fields config.
|
|
* @return Normalized fields config.
|
|
*/
|
|
function normalizeFields(fields) {
|
|
return fields.map(field => {
|
|
var _field$sort, _field$isValid, _field$enableHiding, _field$enableSorting;
|
|
const fieldTypeDefinition = getFieldTypeDefinition(field.type);
|
|
const getValue = field.getValue || (({
|
|
item
|
|
}) => item[field.id]);
|
|
const sort = (_field$sort = field.sort) !== null && _field$sort !== void 0 ? _field$sort : function sort(a, b, direction) {
|
|
return fieldTypeDefinition.sort(getValue({
|
|
item: a
|
|
}), getValue({
|
|
item: b
|
|
}), direction);
|
|
};
|
|
const isValid = (_field$isValid = field.isValid) !== null && _field$isValid !== void 0 ? _field$isValid : function isValid(item, context) {
|
|
return fieldTypeDefinition.isValid(getValue({
|
|
item
|
|
}), context);
|
|
};
|
|
const Edit = getControl(field, fieldTypeDefinition);
|
|
const renderFromElements = ({
|
|
item
|
|
}) => {
|
|
const value = getValue({
|
|
item
|
|
});
|
|
return field?.elements?.find(element => element.value === value)?.label || getValue({
|
|
item
|
|
});
|
|
};
|
|
const render = field.render || (field.elements ? renderFromElements : getValue);
|
|
return {
|
|
...field,
|
|
label: field.label || field.id,
|
|
header: field.header || field.label || field.id,
|
|
getValue,
|
|
render,
|
|
sort,
|
|
isValid,
|
|
Edit,
|
|
enableHiding: (_field$enableHiding = field.enableHiding) !== null && _field$enableHiding !== void 0 ? _field$enableHiding : true,
|
|
enableSorting: (_field$enableSorting = field.enableSorting) !== null && _field$enableSorting !== void 0 ? _field$enableSorting : true
|
|
};
|
|
});
|
|
}
|
|
//# sourceMappingURL=normalize-fields.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+deprecated@4.7.0/node_modules/@wordpress/deprecated/build-module/index.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (/* binding */ deprecated)
|
|
/* harmony export */ });
|
|
/* unused harmony export logged */
|
|
/* harmony import */ var _wordpress_hooks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+hooks@4.7.0/node_modules/@wordpress/hooks/build-module/index.js");
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Object map tracking messages which have been logged, for use in ensuring a
|
|
* message is only logged once.
|
|
*
|
|
* @type {Record<string, true | undefined>}
|
|
*/
|
|
const logged = Object.create(null);
|
|
|
|
/**
|
|
* Logs a message to notify developers about a deprecated feature.
|
|
*
|
|
* @param {string} feature Name of the deprecated feature.
|
|
* @param {Object} [options] Personalisation options
|
|
* @param {string} [options.since] Version in which the feature was deprecated.
|
|
* @param {string} [options.version] Version in which the feature will be removed.
|
|
* @param {string} [options.alternative] Feature to use instead
|
|
* @param {string} [options.plugin] Plugin name if it's a plugin feature
|
|
* @param {string} [options.link] Link to documentation
|
|
* @param {string} [options.hint] Additional message to help transition away from the deprecated feature.
|
|
*
|
|
* @example
|
|
* ```js
|
|
* import deprecated from '@wordpress/deprecated';
|
|
*
|
|
* deprecated( 'Eating meat', {
|
|
* since: '2019.01.01'
|
|
* version: '2020.01.01',
|
|
* alternative: 'vegetables',
|
|
* plugin: 'the earth',
|
|
* hint: 'You may find it beneficial to transition gradually.',
|
|
* } );
|
|
*
|
|
* // Logs: 'Eating meat is deprecated since version 2019.01.01 and will be removed from the earth in version 2020.01.01. Please use vegetables instead. Note: You may find it beneficial to transition gradually.'
|
|
* ```
|
|
*/
|
|
function deprecated(feature, options = {}) {
|
|
const {
|
|
since,
|
|
version,
|
|
alternative,
|
|
plugin,
|
|
link,
|
|
hint
|
|
} = options;
|
|
const pluginMessage = plugin ? ` from ${plugin}` : '';
|
|
const sinceMessage = since ? ` since version ${since}` : '';
|
|
const versionMessage = version ? ` and will be removed${pluginMessage} in version ${version}` : '';
|
|
const useInsteadMessage = alternative ? ` Please use ${alternative} instead.` : '';
|
|
const linkMessage = link ? ` See: ${link}` : '';
|
|
const hintMessage = hint ? ` Note: ${hint}` : '';
|
|
const message = `${feature} is deprecated${sinceMessage}${versionMessage}.${useInsteadMessage}${linkMessage}${hintMessage}`;
|
|
|
|
// Skip if already logged.
|
|
if (message in logged) {
|
|
return;
|
|
}
|
|
|
|
/**
|
|
* Fires whenever a deprecated feature is encountered
|
|
*
|
|
* @param {string} feature Name of the deprecated feature.
|
|
* @param {?Object} options Personalisation options
|
|
* @param {string} options.since Version in which the feature was deprecated.
|
|
* @param {?string} options.version Version in which the feature will be removed.
|
|
* @param {?string} options.alternative Feature to use instead
|
|
* @param {?string} options.plugin Plugin name if it's a plugin feature
|
|
* @param {?string} options.link Link to documentation
|
|
* @param {?string} options.hint Additional message to help transition away from the deprecated feature.
|
|
* @param {?string} message Message sent to console.warn
|
|
*/
|
|
(0,_wordpress_hooks__WEBPACK_IMPORTED_MODULE_0__/* .doAction */ .Eo)('deprecated', feature, options, message);
|
|
|
|
// eslint-disable-next-line no-console
|
|
console.warn(message);
|
|
logged[message] = true;
|
|
}
|
|
|
|
/** @typedef {import('utility-types').NonUndefined<Parameters<typeof deprecated>[1]>} DeprecatedOptions */
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+dom@4.7.0/node_modules/@wordpress/dom/build-module/index.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
XC: () => (/* binding */ build_module_focus)
|
|
});
|
|
|
|
// UNUSED EXPORTS: __unstableStripHTML, computeCaretRect, documentHasSelection, documentHasTextSelection, documentHasUncollapsedSelection, getFilesFromDataTransfer, getOffsetParent, getPhrasingContentSchema, getRectangleFromRange, getScrollContainer, insertAfter, isEmpty, isEntirelySelected, isFormElement, isHorizontalEdge, isNumberInput, isPhrasingContent, isRTL, isSelectionForward, isTextContent, isTextField, isVerticalEdge, placeCaretAtHorizontalEdge, placeCaretAtVerticalEdge, remove, removeInvalidHTML, replace, replaceTag, safeHTML, unwrap, wrap
|
|
|
|
// NAMESPACE OBJECT: ../../node_modules/.pnpm/@wordpress+dom@4.7.0/node_modules/@wordpress/dom/build-module/focusable.js
|
|
var focusable_namespaceObject = {};
|
|
__webpack_require__.r(focusable_namespaceObject);
|
|
__webpack_require__.d(focusable_namespaceObject, {
|
|
find: () => (find)
|
|
});
|
|
|
|
// NAMESPACE OBJECT: ../../node_modules/.pnpm/@wordpress+dom@4.7.0/node_modules/@wordpress/dom/build-module/tabbable.js
|
|
var tabbable_namespaceObject = {};
|
|
__webpack_require__.r(tabbable_namespaceObject);
|
|
__webpack_require__.d(tabbable_namespaceObject, {
|
|
find: () => (tabbable_find),
|
|
findNext: () => (findNext),
|
|
findPrevious: () => (findPrevious),
|
|
isTabbableIndex: () => (isTabbableIndex)
|
|
});
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+dom@4.7.0/node_modules/@wordpress/dom/build-module/focusable.js
|
|
/**
|
|
* References:
|
|
*
|
|
* Focusable:
|
|
* - https://www.w3.org/TR/html5/editing.html#focus-management
|
|
*
|
|
* Sequential focus navigation:
|
|
* - https://www.w3.org/TR/html5/editing.html#sequential-focus-navigation-and-the-tabindex-attribute
|
|
*
|
|
* Disabled elements:
|
|
* - https://www.w3.org/TR/html5/disabled-elements.html#disabled-elements
|
|
*
|
|
* getClientRects algorithm (requiring layout box):
|
|
* - https://www.w3.org/TR/cssom-view-1/#extension-to-the-element-interface
|
|
*
|
|
* AREA elements associated with an IMG:
|
|
* - https://w3c.github.io/html/editing.html#data-model
|
|
*/
|
|
|
|
/**
|
|
* Returns a CSS selector used to query for focusable elements.
|
|
*
|
|
* @param {boolean} sequential If set, only query elements that are sequentially
|
|
* focusable. Non-interactive elements with a
|
|
* negative `tabindex` are focusable but not
|
|
* sequentially focusable.
|
|
* https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute
|
|
*
|
|
* @return {string} CSS selector.
|
|
*/
|
|
function buildSelector(sequential) {
|
|
return [sequential ? '[tabindex]:not([tabindex^="-"])' : '[tabindex]', 'a[href]', 'button:not([disabled])', 'input:not([type="hidden"]):not([disabled])', 'select:not([disabled])', 'textarea:not([disabled])', 'iframe:not([tabindex^="-"])', 'object', 'embed', 'area[href]', '[contenteditable]:not([contenteditable=false])'].join(',');
|
|
}
|
|
|
|
/**
|
|
* Returns true if the specified element is visible (i.e. neither display: none
|
|
* nor visibility: hidden).
|
|
*
|
|
* @param {HTMLElement} element DOM element to test.
|
|
*
|
|
* @return {boolean} Whether element is visible.
|
|
*/
|
|
function isVisible(element) {
|
|
return element.offsetWidth > 0 || element.offsetHeight > 0 || element.getClientRects().length > 0;
|
|
}
|
|
|
|
/**
|
|
* Returns true if the specified area element is a valid focusable element, or
|
|
* false otherwise. Area is only focusable if within a map where a named map
|
|
* referenced by an image somewhere in the document.
|
|
*
|
|
* @param {HTMLAreaElement} element DOM area element to test.
|
|
*
|
|
* @return {boolean} Whether area element is valid for focus.
|
|
*/
|
|
function isValidFocusableArea(element) {
|
|
/** @type {HTMLMapElement | null} */
|
|
const map = element.closest('map[name]');
|
|
if (!map) {
|
|
return false;
|
|
}
|
|
|
|
/** @type {HTMLImageElement | null} */
|
|
const img = element.ownerDocument.querySelector('img[usemap="#' + map.name + '"]');
|
|
return !!img && isVisible(img);
|
|
}
|
|
|
|
/**
|
|
* Returns all focusable elements within a given context.
|
|
*
|
|
* @param {Element} context Element in which to search.
|
|
* @param {Object} options
|
|
* @param {boolean} [options.sequential] If set, only return elements that are
|
|
* sequentially focusable.
|
|
* Non-interactive elements with a
|
|
* negative `tabindex` are focusable but
|
|
* not sequentially focusable.
|
|
* https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute
|
|
*
|
|
* @return {HTMLElement[]} Focusable elements.
|
|
*/
|
|
function find(context, {
|
|
sequential = false
|
|
} = {}) {
|
|
/** @type {NodeListOf<HTMLElement>} */
|
|
const elements = context.querySelectorAll(buildSelector(sequential));
|
|
return Array.from(elements).filter(element => {
|
|
if (!isVisible(element)) {
|
|
return false;
|
|
}
|
|
const {
|
|
nodeName
|
|
} = element;
|
|
if ('AREA' === nodeName) {
|
|
return isValidFocusableArea( /** @type {HTMLAreaElement} */element);
|
|
}
|
|
return true;
|
|
});
|
|
}
|
|
//# sourceMappingURL=focusable.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+dom@4.7.0/node_modules/@wordpress/dom/build-module/tabbable.js
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* Returns the tab index of the given element. In contrast with the tabIndex
|
|
* property, this normalizes the default (0) to avoid browser inconsistencies,
|
|
* operating under the assumption that this function is only ever called with a
|
|
* focusable node.
|
|
*
|
|
* @see https://bugzilla.mozilla.org/show_bug.cgi?id=1190261
|
|
*
|
|
* @param {Element} element Element from which to retrieve.
|
|
*
|
|
* @return {number} Tab index of element (default 0).
|
|
*/
|
|
function getTabIndex(element) {
|
|
const tabIndex = element.getAttribute('tabindex');
|
|
return tabIndex === null ? 0 : parseInt(tabIndex, 10);
|
|
}
|
|
|
|
/**
|
|
* Returns true if the specified element is tabbable, or false otherwise.
|
|
*
|
|
* @param {Element} element Element to test.
|
|
*
|
|
* @return {boolean} Whether element is tabbable.
|
|
*/
|
|
function isTabbableIndex(element) {
|
|
return getTabIndex(element) !== -1;
|
|
}
|
|
|
|
/** @typedef {HTMLElement & { type?: string, checked?: boolean, name?: string }} MaybeHTMLInputElement */
|
|
|
|
/**
|
|
* Returns a stateful reducer function which constructs a filtered array of
|
|
* tabbable elements, where at most one radio input is selected for a given
|
|
* name, giving priority to checked input, falling back to the first
|
|
* encountered.
|
|
*
|
|
* @return {(acc: MaybeHTMLInputElement[], el: MaybeHTMLInputElement) => MaybeHTMLInputElement[]} Radio group collapse reducer.
|
|
*/
|
|
function createStatefulCollapseRadioGroup() {
|
|
/** @type {Record<string, MaybeHTMLInputElement>} */
|
|
const CHOSEN_RADIO_BY_NAME = {};
|
|
return function collapseRadioGroup( /** @type {MaybeHTMLInputElement[]} */result, /** @type {MaybeHTMLInputElement} */element) {
|
|
const {
|
|
nodeName,
|
|
type,
|
|
checked,
|
|
name
|
|
} = element;
|
|
|
|
// For all non-radio tabbables, construct to array by concatenating.
|
|
if (nodeName !== 'INPUT' || type !== 'radio' || !name) {
|
|
return result.concat(element);
|
|
}
|
|
const hasChosen = CHOSEN_RADIO_BY_NAME.hasOwnProperty(name);
|
|
|
|
// Omit by skipping concatenation if the radio element is not chosen.
|
|
const isChosen = checked || !hasChosen;
|
|
if (!isChosen) {
|
|
return result;
|
|
}
|
|
|
|
// At this point, if there had been a chosen element, the current
|
|
// element is checked and should take priority. Retroactively remove
|
|
// the element which had previously been considered the chosen one.
|
|
if (hasChosen) {
|
|
const hadChosenElement = CHOSEN_RADIO_BY_NAME[name];
|
|
result = result.filter(e => e !== hadChosenElement);
|
|
}
|
|
CHOSEN_RADIO_BY_NAME[name] = element;
|
|
return result.concat(element);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* An array map callback, returning an object with the element value and its
|
|
* array index location as properties. This is used to emulate a proper stable
|
|
* sort where equal tabIndex should be left in order of their occurrence in the
|
|
* document.
|
|
*
|
|
* @param {HTMLElement} element Element.
|
|
* @param {number} index Array index of element.
|
|
*
|
|
* @return {{ element: HTMLElement, index: number }} Mapped object with element, index.
|
|
*/
|
|
function mapElementToObjectTabbable(element, index) {
|
|
return {
|
|
element,
|
|
index
|
|
};
|
|
}
|
|
|
|
/**
|
|
* An array map callback, returning an element of the given mapped object's
|
|
* element value.
|
|
*
|
|
* @param {{ element: HTMLElement }} object Mapped object with element.
|
|
*
|
|
* @return {HTMLElement} Mapped object element.
|
|
*/
|
|
function mapObjectTabbableToElement(object) {
|
|
return object.element;
|
|
}
|
|
|
|
/**
|
|
* A sort comparator function used in comparing two objects of mapped elements.
|
|
*
|
|
* @see mapElementToObjectTabbable
|
|
*
|
|
* @param {{ element: HTMLElement, index: number }} a First object to compare.
|
|
* @param {{ element: HTMLElement, index: number }} b Second object to compare.
|
|
*
|
|
* @return {number} Comparator result.
|
|
*/
|
|
function compareObjectTabbables(a, b) {
|
|
const aTabIndex = getTabIndex(a.element);
|
|
const bTabIndex = getTabIndex(b.element);
|
|
if (aTabIndex === bTabIndex) {
|
|
return a.index - b.index;
|
|
}
|
|
return aTabIndex - bTabIndex;
|
|
}
|
|
|
|
/**
|
|
* Givin focusable elements, filters out tabbable element.
|
|
*
|
|
* @param {HTMLElement[]} focusables Focusable elements to filter.
|
|
*
|
|
* @return {HTMLElement[]} Tabbable elements.
|
|
*/
|
|
function filterTabbable(focusables) {
|
|
return focusables.filter(isTabbableIndex).map(mapElementToObjectTabbable).sort(compareObjectTabbables).map(mapObjectTabbableToElement).reduce(createStatefulCollapseRadioGroup(), []);
|
|
}
|
|
|
|
/**
|
|
* @param {Element} context
|
|
* @return {HTMLElement[]} Tabbable elements within the context.
|
|
*/
|
|
function tabbable_find(context) {
|
|
return filterTabbable(find(context));
|
|
}
|
|
|
|
/**
|
|
* Given a focusable element, find the preceding tabbable element.
|
|
*
|
|
* @param {Element} element The focusable element before which to look. Defaults
|
|
* to the active element.
|
|
*
|
|
* @return {HTMLElement|undefined} Preceding tabbable element.
|
|
*/
|
|
function findPrevious(element) {
|
|
return filterTabbable(find(element.ownerDocument.body)).reverse().find(focusable =>
|
|
// eslint-disable-next-line no-bitwise
|
|
element.compareDocumentPosition(focusable) & element.DOCUMENT_POSITION_PRECEDING);
|
|
}
|
|
|
|
/**
|
|
* Given a focusable element, find the next tabbable element.
|
|
*
|
|
* @param {Element} element The focusable element after which to look. Defaults
|
|
* to the active element.
|
|
*
|
|
* @return {HTMLElement|undefined} Next tabbable element.
|
|
*/
|
|
function findNext(element) {
|
|
return filterTabbable(find(element.ownerDocument.body)).find(focusable =>
|
|
// eslint-disable-next-line no-bitwise
|
|
element.compareDocumentPosition(focusable) & element.DOCUMENT_POSITION_FOLLOWING);
|
|
}
|
|
//# sourceMappingURL=tabbable.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+dom@4.7.0/node_modules/@wordpress/dom/build-module/index.js
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Object grouping `focusable` and `tabbable` utils
|
|
* under the keys with the same name.
|
|
*/
|
|
const build_module_focus = {
|
|
focusable: focusable_namespaceObject,
|
|
tabbable: tabbable_namespaceObject
|
|
};
|
|
|
|
|
|
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+hooks@4.7.0/node_modules/@wordpress/hooks/build-module/index.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
se: () => (/* binding */ defaultHooks),
|
|
Eo: () => (/* binding */ doAction)
|
|
});
|
|
|
|
// UNUSED EXPORTS: actions, addAction, addFilter, applyFilters, createHooks, currentAction, currentFilter, didAction, didFilter, doingAction, doingFilter, filters, hasAction, hasFilter, removeAction, removeAllActions, removeAllFilters, removeFilter
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+hooks@4.7.0/node_modules/@wordpress/hooks/build-module/validateNamespace.js
|
|
/**
|
|
* Validate a namespace string.
|
|
*
|
|
* @param {string} namespace The namespace to validate - should take the form
|
|
* `vendor/plugin/function`.
|
|
*
|
|
* @return {boolean} Whether the namespace is valid.
|
|
*/
|
|
function validateNamespace(namespace) {
|
|
if ('string' !== typeof namespace || '' === namespace) {
|
|
// eslint-disable-next-line no-console
|
|
console.error('The namespace must be a non-empty string.');
|
|
return false;
|
|
}
|
|
if (!/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(namespace)) {
|
|
// eslint-disable-next-line no-console
|
|
console.error('The namespace can only contain numbers, letters, dashes, periods, underscores and slashes.');
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
/* harmony default export */ const build_module_validateNamespace = (validateNamespace);
|
|
//# sourceMappingURL=validateNamespace.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+hooks@4.7.0/node_modules/@wordpress/hooks/build-module/validateHookName.js
|
|
/**
|
|
* Validate a hookName string.
|
|
*
|
|
* @param {string} hookName The hook name to validate. Should be a non empty string containing
|
|
* only numbers, letters, dashes, periods and underscores. Also,
|
|
* the hook name cannot begin with `__`.
|
|
*
|
|
* @return {boolean} Whether the hook name is valid.
|
|
*/
|
|
function validateHookName(hookName) {
|
|
if ('string' !== typeof hookName || '' === hookName) {
|
|
// eslint-disable-next-line no-console
|
|
console.error('The hook name must be a non-empty string.');
|
|
return false;
|
|
}
|
|
if (/^__/.test(hookName)) {
|
|
// eslint-disable-next-line no-console
|
|
console.error('The hook name cannot begin with `__`.');
|
|
return false;
|
|
}
|
|
if (!/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(hookName)) {
|
|
// eslint-disable-next-line no-console
|
|
console.error('The hook name can only contain numbers, letters, dashes, periods and underscores.');
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
/* harmony default export */ const build_module_validateHookName = (validateHookName);
|
|
//# sourceMappingURL=validateHookName.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+hooks@4.7.0/node_modules/@wordpress/hooks/build-module/createAddHook.js
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* @callback AddHook
|
|
*
|
|
* Adds the hook to the appropriate hooks container.
|
|
*
|
|
* @param {string} hookName Name of hook to add
|
|
* @param {string} namespace The unique namespace identifying the callback in the form `vendor/plugin/function`.
|
|
* @param {import('.').Callback} callback Function to call when the hook is run
|
|
* @param {number} [priority=10] Priority of this hook
|
|
*/
|
|
|
|
/**
|
|
* Returns a function which, when invoked, will add a hook.
|
|
*
|
|
* @param {import('.').Hooks} hooks Hooks instance.
|
|
* @param {import('.').StoreKey} storeKey
|
|
*
|
|
* @return {AddHook} Function that adds a new hook.
|
|
*/
|
|
function createAddHook(hooks, storeKey) {
|
|
return function addHook(hookName, namespace, callback, priority = 10) {
|
|
const hooksStore = hooks[storeKey];
|
|
if (!build_module_validateHookName(hookName)) {
|
|
return;
|
|
}
|
|
if (!build_module_validateNamespace(namespace)) {
|
|
return;
|
|
}
|
|
if ('function' !== typeof callback) {
|
|
// eslint-disable-next-line no-console
|
|
console.error('The hook callback must be a function.');
|
|
return;
|
|
}
|
|
|
|
// Validate numeric priority
|
|
if ('number' !== typeof priority) {
|
|
// eslint-disable-next-line no-console
|
|
console.error('If specified, the hook priority must be a number.');
|
|
return;
|
|
}
|
|
const handler = {
|
|
callback,
|
|
priority,
|
|
namespace
|
|
};
|
|
if (hooksStore[hookName]) {
|
|
// Find the correct insert index of the new hook.
|
|
const handlers = hooksStore[hookName].handlers;
|
|
|
|
/** @type {number} */
|
|
let i;
|
|
for (i = handlers.length; i > 0; i--) {
|
|
if (priority >= handlers[i - 1].priority) {
|
|
break;
|
|
}
|
|
}
|
|
if (i === handlers.length) {
|
|
// If append, operate via direct assignment.
|
|
handlers[i] = handler;
|
|
} else {
|
|
// Otherwise, insert before index via splice.
|
|
handlers.splice(i, 0, handler);
|
|
}
|
|
|
|
// We may also be currently executing this hook. If the callback
|
|
// we're adding would come after the current callback, there's no
|
|
// problem; otherwise we need to increase the execution index of
|
|
// any other runs by 1 to account for the added element.
|
|
hooksStore.__current.forEach(hookInfo => {
|
|
if (hookInfo.name === hookName && hookInfo.currentIndex >= i) {
|
|
hookInfo.currentIndex++;
|
|
}
|
|
});
|
|
} else {
|
|
// This is the first hook of its type.
|
|
hooksStore[hookName] = {
|
|
handlers: [handler],
|
|
runs: 0
|
|
};
|
|
}
|
|
if (hookName !== 'hookAdded') {
|
|
hooks.doAction('hookAdded', hookName, namespace, callback, priority);
|
|
}
|
|
};
|
|
}
|
|
/* harmony default export */ const build_module_createAddHook = (createAddHook);
|
|
//# sourceMappingURL=createAddHook.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+hooks@4.7.0/node_modules/@wordpress/hooks/build-module/createRemoveHook.js
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* @callback RemoveHook
|
|
* Removes the specified callback (or all callbacks) from the hook with a given hookName
|
|
* and namespace.
|
|
*
|
|
* @param {string} hookName The name of the hook to modify.
|
|
* @param {string} namespace The unique namespace identifying the callback in the
|
|
* form `vendor/plugin/function`.
|
|
*
|
|
* @return {number | undefined} The number of callbacks removed.
|
|
*/
|
|
|
|
/**
|
|
* Returns a function which, when invoked, will remove a specified hook or all
|
|
* hooks by the given name.
|
|
*
|
|
* @param {import('.').Hooks} hooks Hooks instance.
|
|
* @param {import('.').StoreKey} storeKey
|
|
* @param {boolean} [removeAll=false] Whether to remove all callbacks for a hookName,
|
|
* without regard to namespace. Used to create
|
|
* `removeAll*` functions.
|
|
*
|
|
* @return {RemoveHook} Function that removes hooks.
|
|
*/
|
|
function createRemoveHook(hooks, storeKey, removeAll = false) {
|
|
return function removeHook(hookName, namespace) {
|
|
const hooksStore = hooks[storeKey];
|
|
if (!build_module_validateHookName(hookName)) {
|
|
return;
|
|
}
|
|
if (!removeAll && !build_module_validateNamespace(namespace)) {
|
|
return;
|
|
}
|
|
|
|
// Bail if no hooks exist by this name.
|
|
if (!hooksStore[hookName]) {
|
|
return 0;
|
|
}
|
|
let handlersRemoved = 0;
|
|
if (removeAll) {
|
|
handlersRemoved = hooksStore[hookName].handlers.length;
|
|
hooksStore[hookName] = {
|
|
runs: hooksStore[hookName].runs,
|
|
handlers: []
|
|
};
|
|
} else {
|
|
// Try to find the specified callback to remove.
|
|
const handlers = hooksStore[hookName].handlers;
|
|
for (let i = handlers.length - 1; i >= 0; i--) {
|
|
if (handlers[i].namespace === namespace) {
|
|
handlers.splice(i, 1);
|
|
handlersRemoved++;
|
|
// This callback may also be part of a hook that is
|
|
// currently executing. If the callback we're removing
|
|
// comes after the current callback, there's no problem;
|
|
// otherwise we need to decrease the execution index of any
|
|
// other runs by 1 to account for the removed element.
|
|
hooksStore.__current.forEach(hookInfo => {
|
|
if (hookInfo.name === hookName && hookInfo.currentIndex >= i) {
|
|
hookInfo.currentIndex--;
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
if (hookName !== 'hookRemoved') {
|
|
hooks.doAction('hookRemoved', hookName, namespace);
|
|
}
|
|
return handlersRemoved;
|
|
};
|
|
}
|
|
/* harmony default export */ const build_module_createRemoveHook = (createRemoveHook);
|
|
//# sourceMappingURL=createRemoveHook.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+hooks@4.7.0/node_modules/@wordpress/hooks/build-module/createHasHook.js
|
|
/**
|
|
* @callback HasHook
|
|
*
|
|
* Returns whether any handlers are attached for the given hookName and optional namespace.
|
|
*
|
|
* @param {string} hookName The name of the hook to check for.
|
|
* @param {string} [namespace] Optional. The unique namespace identifying the callback
|
|
* in the form `vendor/plugin/function`.
|
|
*
|
|
* @return {boolean} Whether there are handlers that are attached to the given hook.
|
|
*/
|
|
/**
|
|
* Returns a function which, when invoked, will return whether any handlers are
|
|
* attached to a particular hook.
|
|
*
|
|
* @param {import('.').Hooks} hooks Hooks instance.
|
|
* @param {import('.').StoreKey} storeKey
|
|
*
|
|
* @return {HasHook} Function that returns whether any handlers are
|
|
* attached to a particular hook and optional namespace.
|
|
*/
|
|
function createHasHook(hooks, storeKey) {
|
|
return function hasHook(hookName, namespace) {
|
|
const hooksStore = hooks[storeKey];
|
|
|
|
// Use the namespace if provided.
|
|
if ('undefined' !== typeof namespace) {
|
|
return hookName in hooksStore && hooksStore[hookName].handlers.some(hook => hook.namespace === namespace);
|
|
}
|
|
return hookName in hooksStore;
|
|
};
|
|
}
|
|
/* harmony default export */ const build_module_createHasHook = (createHasHook);
|
|
//# sourceMappingURL=createHasHook.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+hooks@4.7.0/node_modules/@wordpress/hooks/build-module/createRunHook.js
|
|
/**
|
|
* Returns a function which, when invoked, will execute all callbacks
|
|
* registered to a hook of the specified type, optionally returning the final
|
|
* value of the call chain.
|
|
*
|
|
* @param {import('.').Hooks} hooks Hooks instance.
|
|
* @param {import('.').StoreKey} storeKey
|
|
* @param {boolean} [returnFirstArg=false] Whether each hook callback is expected to
|
|
* return its first argument.
|
|
*
|
|
* @return {(hookName:string, ...args: unknown[]) => undefined|unknown} Function that runs hook callbacks.
|
|
*/
|
|
function createRunHook(hooks, storeKey, returnFirstArg = false) {
|
|
return function runHooks(hookName, ...args) {
|
|
const hooksStore = hooks[storeKey];
|
|
if (!hooksStore[hookName]) {
|
|
hooksStore[hookName] = {
|
|
handlers: [],
|
|
runs: 0
|
|
};
|
|
}
|
|
hooksStore[hookName].runs++;
|
|
const handlers = hooksStore[hookName].handlers;
|
|
|
|
// The following code is stripped from production builds.
|
|
if (false) {}
|
|
if (!handlers || !handlers.length) {
|
|
return returnFirstArg ? args[0] : undefined;
|
|
}
|
|
const hookInfo = {
|
|
name: hookName,
|
|
currentIndex: 0
|
|
};
|
|
hooksStore.__current.push(hookInfo);
|
|
while (hookInfo.currentIndex < handlers.length) {
|
|
const handler = handlers[hookInfo.currentIndex];
|
|
const result = handler.callback.apply(null, args);
|
|
if (returnFirstArg) {
|
|
args[0] = result;
|
|
}
|
|
hookInfo.currentIndex++;
|
|
}
|
|
hooksStore.__current.pop();
|
|
if (returnFirstArg) {
|
|
return args[0];
|
|
}
|
|
return undefined;
|
|
};
|
|
}
|
|
/* harmony default export */ const build_module_createRunHook = (createRunHook);
|
|
//# sourceMappingURL=createRunHook.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+hooks@4.7.0/node_modules/@wordpress/hooks/build-module/createCurrentHook.js
|
|
/**
|
|
* Returns a function which, when invoked, will return the name of the
|
|
* currently running hook, or `null` if no hook of the given type is currently
|
|
* running.
|
|
*
|
|
* @param {import('.').Hooks} hooks Hooks instance.
|
|
* @param {import('.').StoreKey} storeKey
|
|
*
|
|
* @return {() => string | null} Function that returns the current hook name or null.
|
|
*/
|
|
function createCurrentHook(hooks, storeKey) {
|
|
return function currentHook() {
|
|
var _hooksStore$__current;
|
|
const hooksStore = hooks[storeKey];
|
|
return (_hooksStore$__current = hooksStore.__current[hooksStore.__current.length - 1]?.name) !== null && _hooksStore$__current !== void 0 ? _hooksStore$__current : null;
|
|
};
|
|
}
|
|
/* harmony default export */ const build_module_createCurrentHook = (createCurrentHook);
|
|
//# sourceMappingURL=createCurrentHook.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+hooks@4.7.0/node_modules/@wordpress/hooks/build-module/createDoingHook.js
|
|
/**
|
|
* @callback DoingHook
|
|
* Returns whether a hook is currently being executed.
|
|
*
|
|
* @param {string} [hookName] The name of the hook to check for. If
|
|
* omitted, will check for any hook being executed.
|
|
*
|
|
* @return {boolean} Whether the hook is being executed.
|
|
*/
|
|
|
|
/**
|
|
* Returns a function which, when invoked, will return whether a hook is
|
|
* currently being executed.
|
|
*
|
|
* @param {import('.').Hooks} hooks Hooks instance.
|
|
* @param {import('.').StoreKey} storeKey
|
|
*
|
|
* @return {DoingHook} Function that returns whether a hook is currently
|
|
* being executed.
|
|
*/
|
|
function createDoingHook(hooks, storeKey) {
|
|
return function doingHook(hookName) {
|
|
const hooksStore = hooks[storeKey];
|
|
|
|
// If the hookName was not passed, check for any current hook.
|
|
if ('undefined' === typeof hookName) {
|
|
return 'undefined' !== typeof hooksStore.__current[0];
|
|
}
|
|
|
|
// Return the __current hook.
|
|
return hooksStore.__current[0] ? hookName === hooksStore.__current[0].name : false;
|
|
};
|
|
}
|
|
/* harmony default export */ const build_module_createDoingHook = (createDoingHook);
|
|
//# sourceMappingURL=createDoingHook.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+hooks@4.7.0/node_modules/@wordpress/hooks/build-module/createDidHook.js
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* @callback DidHook
|
|
*
|
|
* Returns the number of times an action has been fired.
|
|
*
|
|
* @param {string} hookName The hook name to check.
|
|
*
|
|
* @return {number | undefined} The number of times the hook has run.
|
|
*/
|
|
|
|
/**
|
|
* Returns a function which, when invoked, will return the number of times a
|
|
* hook has been called.
|
|
*
|
|
* @param {import('.').Hooks} hooks Hooks instance.
|
|
* @param {import('.').StoreKey} storeKey
|
|
*
|
|
* @return {DidHook} Function that returns a hook's call count.
|
|
*/
|
|
function createDidHook(hooks, storeKey) {
|
|
return function didHook(hookName) {
|
|
const hooksStore = hooks[storeKey];
|
|
if (!build_module_validateHookName(hookName)) {
|
|
return;
|
|
}
|
|
return hooksStore[hookName] && hooksStore[hookName].runs ? hooksStore[hookName].runs : 0;
|
|
};
|
|
}
|
|
/* harmony default export */ const build_module_createDidHook = (createDidHook);
|
|
//# sourceMappingURL=createDidHook.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+hooks@4.7.0/node_modules/@wordpress/hooks/build-module/createHooks.js
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Internal class for constructing hooks. Use `createHooks()` function
|
|
*
|
|
* Note, it is necessary to expose this class to make its type public.
|
|
*
|
|
* @private
|
|
*/
|
|
class _Hooks {
|
|
constructor() {
|
|
/** @type {import('.').Store} actions */
|
|
this.actions = Object.create(null);
|
|
this.actions.__current = [];
|
|
|
|
/** @type {import('.').Store} filters */
|
|
this.filters = Object.create(null);
|
|
this.filters.__current = [];
|
|
this.addAction = build_module_createAddHook(this, 'actions');
|
|
this.addFilter = build_module_createAddHook(this, 'filters');
|
|
this.removeAction = build_module_createRemoveHook(this, 'actions');
|
|
this.removeFilter = build_module_createRemoveHook(this, 'filters');
|
|
this.hasAction = build_module_createHasHook(this, 'actions');
|
|
this.hasFilter = build_module_createHasHook(this, 'filters');
|
|
this.removeAllActions = build_module_createRemoveHook(this, 'actions', true);
|
|
this.removeAllFilters = build_module_createRemoveHook(this, 'filters', true);
|
|
this.doAction = build_module_createRunHook(this, 'actions');
|
|
this.applyFilters = build_module_createRunHook(this, 'filters', true);
|
|
this.currentAction = build_module_createCurrentHook(this, 'actions');
|
|
this.currentFilter = build_module_createCurrentHook(this, 'filters');
|
|
this.doingAction = build_module_createDoingHook(this, 'actions');
|
|
this.doingFilter = build_module_createDoingHook(this, 'filters');
|
|
this.didAction = build_module_createDidHook(this, 'actions');
|
|
this.didFilter = build_module_createDidHook(this, 'filters');
|
|
}
|
|
}
|
|
|
|
/** @typedef {_Hooks} Hooks */
|
|
|
|
/**
|
|
* Returns an instance of the hooks object.
|
|
*
|
|
* @return {Hooks} A Hooks instance.
|
|
*/
|
|
function createHooks() {
|
|
return new _Hooks();
|
|
}
|
|
/* harmony default export */ const build_module_createHooks = (createHooks);
|
|
//# sourceMappingURL=createHooks.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+hooks@4.7.0/node_modules/@wordpress/hooks/build-module/index.js
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
/** @typedef {(...args: any[])=>any} Callback */
|
|
|
|
/**
|
|
* @typedef Handler
|
|
* @property {Callback} callback The callback
|
|
* @property {string} namespace The namespace
|
|
* @property {number} priority The namespace
|
|
*/
|
|
|
|
/**
|
|
* @typedef Hook
|
|
* @property {Handler[]} handlers Array of handlers
|
|
* @property {number} runs Run counter
|
|
*/
|
|
|
|
/**
|
|
* @typedef Current
|
|
* @property {string} name Hook name
|
|
* @property {number} currentIndex The index
|
|
*/
|
|
|
|
/**
|
|
* @typedef {Record<string, Hook> & {__current: Current[]}} Store
|
|
*/
|
|
|
|
/**
|
|
* @typedef {'actions' | 'filters'} StoreKey
|
|
*/
|
|
|
|
/**
|
|
* @typedef {import('./createHooks').Hooks} Hooks
|
|
*/
|
|
|
|
const defaultHooks = build_module_createHooks();
|
|
const {
|
|
addAction,
|
|
addFilter,
|
|
removeAction,
|
|
removeFilter,
|
|
hasAction,
|
|
hasFilter,
|
|
removeAllActions,
|
|
removeAllFilters,
|
|
doAction,
|
|
applyFilters,
|
|
currentAction,
|
|
currentFilter,
|
|
doingAction,
|
|
doingFilter,
|
|
didAction,
|
|
didFilter,
|
|
actions,
|
|
filters
|
|
} = defaultHooks;
|
|
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+i18n@5.7.0/node_modules/@wordpress/i18n/build-module/index.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
__: () => (/* reexport */ __),
|
|
_n: () => (/* reexport */ _n),
|
|
_x: () => (/* reexport */ _x),
|
|
V8: () => (/* reexport */ isRTL),
|
|
nv: () => (/* reexport */ sprintf_sprintf)
|
|
});
|
|
|
|
// UNUSED EXPORTS: _nx, createI18n, defaultI18n, getLocaleData, hasTranslation, resetLocaleData, setLocaleData, subscribe
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/memize@2.1.0/node_modules/memize/dist/index.js
|
|
var dist = __webpack_require__("../../node_modules/.pnpm/memize@2.1.0/node_modules/memize/dist/index.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/sprintf-js@1.1.3/node_modules/sprintf-js/src/sprintf.js
|
|
var sprintf = __webpack_require__("../../node_modules/.pnpm/sprintf-js@1.1.3/node_modules/sprintf-js/src/sprintf.js");
|
|
var sprintf_default = /*#__PURE__*/__webpack_require__.n(sprintf);
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+i18n@5.7.0/node_modules/@wordpress/i18n/build-module/sprintf.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Log to console, once per message; or more precisely, per referentially equal
|
|
* argument set. Because Jed throws errors, we log these to the console instead
|
|
* to avoid crashing the application.
|
|
*
|
|
* @param {...*} args Arguments to pass to `console.error`
|
|
*/
|
|
const logErrorOnce = (0,dist/* default */.A)(console.error); // eslint-disable-line no-console
|
|
|
|
/**
|
|
* Returns a formatted string. If an error occurs in applying the format, the
|
|
* original format string is returned.
|
|
*
|
|
* @param {string} format The format of the string to generate.
|
|
* @param {...*} args Arguments to apply to the format.
|
|
*
|
|
* @see https://www.npmjs.com/package/sprintf-js
|
|
*
|
|
* @return {string} The formatted string.
|
|
*/
|
|
function sprintf_sprintf(format, ...args) {
|
|
try {
|
|
return sprintf_default().sprintf(format, ...args);
|
|
} catch (error) {
|
|
if (error instanceof Error) {
|
|
logErrorOnce('sprintf error: \n\n' + error.toString());
|
|
}
|
|
return format;
|
|
}
|
|
}
|
|
//# sourceMappingURL=sprintf.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/tannin@1.2.0/node_modules/tannin/index.js + 4 modules
|
|
var node_modules_tannin = __webpack_require__("../../node_modules/.pnpm/tannin@1.2.0/node_modules/tannin/index.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+i18n@5.7.0/node_modules/@wordpress/i18n/build-module/create-i18n.js
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* @typedef {Record<string,any>} LocaleData
|
|
*/
|
|
|
|
/**
|
|
* Default locale data to use for Tannin domain when not otherwise provided.
|
|
* Assumes an English plural forms expression.
|
|
*
|
|
* @type {LocaleData}
|
|
*/
|
|
const DEFAULT_LOCALE_DATA = {
|
|
'': {
|
|
/** @param {number} n */
|
|
plural_forms(n) {
|
|
return n === 1 ? 0 : 1;
|
|
}
|
|
}
|
|
};
|
|
|
|
/*
|
|
* Regular expression that matches i18n hooks like `i18n.gettext`, `i18n.ngettext`,
|
|
* `i18n.gettext_domain` or `i18n.ngettext_with_context` or `i18n.has_translation`.
|
|
*/
|
|
const I18N_HOOK_REGEXP = /^i18n\.(n?gettext|has_translation)(_|$)/;
|
|
|
|
/**
|
|
* @typedef {(domain?: string) => LocaleData} GetLocaleData
|
|
*
|
|
* Returns locale data by domain in a
|
|
* Jed-formatted JSON object shape.
|
|
*
|
|
* @see http://messageformat.github.io/Jed/
|
|
*/
|
|
/**
|
|
* @typedef {(data?: LocaleData, domain?: string) => void} SetLocaleData
|
|
*
|
|
* Merges locale data into the Tannin instance by domain. Note that this
|
|
* function will overwrite the domain configuration. Accepts data in a
|
|
* Jed-formatted JSON object shape.
|
|
*
|
|
* @see http://messageformat.github.io/Jed/
|
|
*/
|
|
/**
|
|
* @typedef {(data?: LocaleData, domain?: string) => void} AddLocaleData
|
|
*
|
|
* Merges locale data into the Tannin instance by domain. Note that this
|
|
* function will also merge the domain configuration. Accepts data in a
|
|
* Jed-formatted JSON object shape.
|
|
*
|
|
* @see http://messageformat.github.io/Jed/
|
|
*/
|
|
/**
|
|
* @typedef {(data?: LocaleData, domain?: string) => void} ResetLocaleData
|
|
*
|
|
* Resets all current Tannin instance locale data and sets the specified
|
|
* locale data for the domain. Accepts data in a Jed-formatted JSON object shape.
|
|
*
|
|
* @see http://messageformat.github.io/Jed/
|
|
*/
|
|
/** @typedef {() => void} SubscribeCallback */
|
|
/** @typedef {() => void} UnsubscribeCallback */
|
|
/**
|
|
* @typedef {(callback: SubscribeCallback) => UnsubscribeCallback} Subscribe
|
|
*
|
|
* Subscribes to changes of locale data
|
|
*/
|
|
/**
|
|
* @typedef {(domain?: string) => string} GetFilterDomain
|
|
* Retrieve the domain to use when calling domain-specific filters.
|
|
*/
|
|
/**
|
|
* @typedef {(text: string, domain?: string) => string} __
|
|
*
|
|
* Retrieve the translation of text.
|
|
*
|
|
* @see https://developer.wordpress.org/reference/functions/__/
|
|
*/
|
|
/**
|
|
* @typedef {(text: string, context: string, domain?: string) => string} _x
|
|
*
|
|
* Retrieve translated string with gettext context.
|
|
*
|
|
* @see https://developer.wordpress.org/reference/functions/_x/
|
|
*/
|
|
/**
|
|
* @typedef {(single: string, plural: string, number: number, domain?: string) => string} _n
|
|
*
|
|
* Translates and retrieves the singular or plural form based on the supplied
|
|
* number.
|
|
*
|
|
* @see https://developer.wordpress.org/reference/functions/_n/
|
|
*/
|
|
/**
|
|
* @typedef {(single: string, plural: string, number: number, context: string, domain?: string) => string} _nx
|
|
*
|
|
* Translates and retrieves the singular or plural form based on the supplied
|
|
* number, with gettext context.
|
|
*
|
|
* @see https://developer.wordpress.org/reference/functions/_nx/
|
|
*/
|
|
/**
|
|
* @typedef {() => boolean} IsRtl
|
|
*
|
|
* Check if current locale is RTL.
|
|
*
|
|
* **RTL (Right To Left)** is a locale property indicating that text is written from right to left.
|
|
* For example, the `he` locale (for Hebrew) specifies right-to-left. Arabic (ar) is another common
|
|
* language written RTL. The opposite of RTL, LTR (Left To Right) is used in other languages,
|
|
* including English (`en`, `en-US`, `en-GB`, etc.), Spanish (`es`), and French (`fr`).
|
|
*/
|
|
/**
|
|
* @typedef {(single: string, context?: string, domain?: string) => boolean} HasTranslation
|
|
*
|
|
* Check if there is a translation for a given string in singular form.
|
|
*/
|
|
/** @typedef {import('@wordpress/hooks').Hooks} Hooks */
|
|
|
|
/**
|
|
* An i18n instance
|
|
*
|
|
* @typedef I18n
|
|
* @property {GetLocaleData} getLocaleData Returns locale data by domain in a Jed-formatted JSON object shape.
|
|
* @property {SetLocaleData} setLocaleData Merges locale data into the Tannin instance by domain. Note that this
|
|
* function will overwrite the domain configuration. Accepts data in a
|
|
* Jed-formatted JSON object shape.
|
|
* @property {AddLocaleData} addLocaleData Merges locale data into the Tannin instance by domain. Note that this
|
|
* function will also merge the domain configuration. Accepts data in a
|
|
* Jed-formatted JSON object shape.
|
|
* @property {ResetLocaleData} resetLocaleData Resets all current Tannin instance locale data and sets the specified
|
|
* locale data for the domain. Accepts data in a Jed-formatted JSON object shape.
|
|
* @property {Subscribe} subscribe Subscribes to changes of Tannin locale data.
|
|
* @property {__} __ Retrieve the translation of text.
|
|
* @property {_x} _x Retrieve translated string with gettext context.
|
|
* @property {_n} _n Translates and retrieves the singular or plural form based on the supplied
|
|
* number.
|
|
* @property {_nx} _nx Translates and retrieves the singular or plural form based on the supplied
|
|
* number, with gettext context.
|
|
* @property {IsRtl} isRTL Check if current locale is RTL.
|
|
* @property {HasTranslation} hasTranslation Check if there is a translation for a given string.
|
|
*/
|
|
|
|
/**
|
|
* Create an i18n instance
|
|
*
|
|
* @param {LocaleData} [initialData] Locale data configuration.
|
|
* @param {string} [initialDomain] Domain for which configuration applies.
|
|
* @param {Hooks} [hooks] Hooks implementation.
|
|
*
|
|
* @return {I18n} I18n instance.
|
|
*/
|
|
const createI18n = (initialData, initialDomain, hooks) => {
|
|
/**
|
|
* The underlying instance of Tannin to which exported functions interface.
|
|
*
|
|
* @type {Tannin}
|
|
*/
|
|
const tannin = new node_modules_tannin/* default */.A({});
|
|
const listeners = new Set();
|
|
const notifyListeners = () => {
|
|
listeners.forEach(listener => listener());
|
|
};
|
|
|
|
/**
|
|
* Subscribe to changes of locale data.
|
|
*
|
|
* @param {SubscribeCallback} callback Subscription callback.
|
|
* @return {UnsubscribeCallback} Unsubscribe callback.
|
|
*/
|
|
const subscribe = callback => {
|
|
listeners.add(callback);
|
|
return () => listeners.delete(callback);
|
|
};
|
|
|
|
/** @type {GetLocaleData} */
|
|
const getLocaleData = (domain = 'default') => tannin.data[domain];
|
|
|
|
/**
|
|
* @param {LocaleData} [data]
|
|
* @param {string} [domain]
|
|
*/
|
|
const doSetLocaleData = (data, domain = 'default') => {
|
|
tannin.data[domain] = {
|
|
...tannin.data[domain],
|
|
...data
|
|
};
|
|
|
|
// Populate default domain configuration (supported locale date which omits
|
|
// a plural forms expression).
|
|
tannin.data[domain][''] = {
|
|
...DEFAULT_LOCALE_DATA[''],
|
|
...tannin.data[domain]?.['']
|
|
};
|
|
|
|
// Clean up cached plural forms functions cache as it might be updated.
|
|
delete tannin.pluralForms[domain];
|
|
};
|
|
|
|
/** @type {SetLocaleData} */
|
|
const setLocaleData = (data, domain) => {
|
|
doSetLocaleData(data, domain);
|
|
notifyListeners();
|
|
};
|
|
|
|
/** @type {AddLocaleData} */
|
|
const addLocaleData = (data, domain = 'default') => {
|
|
tannin.data[domain] = {
|
|
...tannin.data[domain],
|
|
...data,
|
|
// Populate default domain configuration (supported locale date which omits
|
|
// a plural forms expression).
|
|
'': {
|
|
...DEFAULT_LOCALE_DATA[''],
|
|
...tannin.data[domain]?.[''],
|
|
...data?.['']
|
|
}
|
|
};
|
|
|
|
// Clean up cached plural forms functions cache as it might be updated.
|
|
delete tannin.pluralForms[domain];
|
|
notifyListeners();
|
|
};
|
|
|
|
/** @type {ResetLocaleData} */
|
|
const resetLocaleData = (data, domain) => {
|
|
// Reset all current Tannin locale data.
|
|
tannin.data = {};
|
|
|
|
// Reset cached plural forms functions cache.
|
|
tannin.pluralForms = {};
|
|
setLocaleData(data, domain);
|
|
};
|
|
|
|
/**
|
|
* Wrapper for Tannin's `dcnpgettext`. Populates default locale data if not
|
|
* otherwise previously assigned.
|
|
*
|
|
* @param {string|undefined} domain Domain to retrieve the translated text.
|
|
* @param {string|undefined} context Context information for the translators.
|
|
* @param {string} single Text to translate if non-plural. Used as
|
|
* fallback return value on a caught error.
|
|
* @param {string} [plural] The text to be used if the number is
|
|
* plural.
|
|
* @param {number} [number] The number to compare against to use
|
|
* either the singular or plural form.
|
|
*
|
|
* @return {string} The translated string.
|
|
*/
|
|
const dcnpgettext = (domain = 'default', context, single, plural, number) => {
|
|
if (!tannin.data[domain]) {
|
|
// Use `doSetLocaleData` to set silently, without notifying listeners.
|
|
doSetLocaleData(undefined, domain);
|
|
}
|
|
return tannin.dcnpgettext(domain, context, single, plural, number);
|
|
};
|
|
|
|
/** @type {GetFilterDomain} */
|
|
const getFilterDomain = (domain = 'default') => domain;
|
|
|
|
/** @type {__} */
|
|
const __ = (text, domain) => {
|
|
let translation = dcnpgettext(domain, undefined, text);
|
|
if (!hooks) {
|
|
return translation;
|
|
}
|
|
|
|
/**
|
|
* Filters text with its translation.
|
|
*
|
|
* @param {string} translation Translated text.
|
|
* @param {string} text Text to translate.
|
|
* @param {string} domain Text domain. Unique identifier for retrieving translated strings.
|
|
*/
|
|
translation = /** @type {string} */
|
|
/** @type {*} */hooks.applyFilters('i18n.gettext', translation, text, domain);
|
|
return /** @type {string} */(
|
|
/** @type {*} */hooks.applyFilters('i18n.gettext_' + getFilterDomain(domain), translation, text, domain)
|
|
);
|
|
};
|
|
|
|
/** @type {_x} */
|
|
const _x = (text, context, domain) => {
|
|
let translation = dcnpgettext(domain, context, text);
|
|
if (!hooks) {
|
|
return translation;
|
|
}
|
|
|
|
/**
|
|
* Filters text with its translation based on context information.
|
|
*
|
|
* @param {string} translation Translated text.
|
|
* @param {string} text Text to translate.
|
|
* @param {string} context Context information for the translators.
|
|
* @param {string} domain Text domain. Unique identifier for retrieving translated strings.
|
|
*/
|
|
translation = /** @type {string} */
|
|
/** @type {*} */hooks.applyFilters('i18n.gettext_with_context', translation, text, context, domain);
|
|
return /** @type {string} */(
|
|
/** @type {*} */hooks.applyFilters('i18n.gettext_with_context_' + getFilterDomain(domain), translation, text, context, domain)
|
|
);
|
|
};
|
|
|
|
/** @type {_n} */
|
|
const _n = (single, plural, number, domain) => {
|
|
let translation = dcnpgettext(domain, undefined, single, plural, number);
|
|
if (!hooks) {
|
|
return translation;
|
|
}
|
|
|
|
/**
|
|
* Filters the singular or plural form of a string.
|
|
*
|
|
* @param {string} translation Translated text.
|
|
* @param {string} single The text to be used if the number is singular.
|
|
* @param {string} plural The text to be used if the number is plural.
|
|
* @param {string} number The number to compare against to use either the singular or plural form.
|
|
* @param {string} domain Text domain. Unique identifier for retrieving translated strings.
|
|
*/
|
|
translation = /** @type {string} */
|
|
/** @type {*} */hooks.applyFilters('i18n.ngettext', translation, single, plural, number, domain);
|
|
return /** @type {string} */(
|
|
/** @type {*} */hooks.applyFilters('i18n.ngettext_' + getFilterDomain(domain), translation, single, plural, number, domain)
|
|
);
|
|
};
|
|
|
|
/** @type {_nx} */
|
|
const _nx = (single, plural, number, context, domain) => {
|
|
let translation = dcnpgettext(domain, context, single, plural, number);
|
|
if (!hooks) {
|
|
return translation;
|
|
}
|
|
|
|
/**
|
|
* Filters the singular or plural form of a string with gettext context.
|
|
*
|
|
* @param {string} translation Translated text.
|
|
* @param {string} single The text to be used if the number is singular.
|
|
* @param {string} plural The text to be used if the number is plural.
|
|
* @param {string} number The number to compare against to use either the singular or plural form.
|
|
* @param {string} context Context information for the translators.
|
|
* @param {string} domain Text domain. Unique identifier for retrieving translated strings.
|
|
*/
|
|
translation = /** @type {string} */
|
|
/** @type {*} */hooks.applyFilters('i18n.ngettext_with_context', translation, single, plural, number, context, domain);
|
|
return /** @type {string} */(
|
|
/** @type {*} */hooks.applyFilters('i18n.ngettext_with_context_' + getFilterDomain(domain), translation, single, plural, number, context, domain)
|
|
);
|
|
};
|
|
|
|
/** @type {IsRtl} */
|
|
const isRTL = () => {
|
|
return 'rtl' === _x('ltr', 'text direction');
|
|
};
|
|
|
|
/** @type {HasTranslation} */
|
|
const hasTranslation = (single, context, domain) => {
|
|
const key = context ? context + '\u0004' + single : single;
|
|
let result = !!tannin.data?.[domain !== null && domain !== void 0 ? domain : 'default']?.[key];
|
|
if (hooks) {
|
|
/**
|
|
* Filters the presence of a translation in the locale data.
|
|
*
|
|
* @param {boolean} hasTranslation Whether the translation is present or not..
|
|
* @param {string} single The singular form of the translated text (used as key in locale data)
|
|
* @param {string} context Context information for the translators.
|
|
* @param {string} domain Text domain. Unique identifier for retrieving translated strings.
|
|
*/
|
|
result = /** @type { boolean } */
|
|
/** @type {*} */hooks.applyFilters('i18n.has_translation', result, single, context, domain);
|
|
result = /** @type { boolean } */
|
|
/** @type {*} */hooks.applyFilters('i18n.has_translation_' + getFilterDomain(domain), result, single, context, domain);
|
|
}
|
|
return result;
|
|
};
|
|
if (initialData) {
|
|
setLocaleData(initialData, initialDomain);
|
|
}
|
|
if (hooks) {
|
|
/**
|
|
* @param {string} hookName
|
|
*/
|
|
const onHookAddedOrRemoved = hookName => {
|
|
if (I18N_HOOK_REGEXP.test(hookName)) {
|
|
notifyListeners();
|
|
}
|
|
};
|
|
hooks.addAction('hookAdded', 'core/i18n', onHookAddedOrRemoved);
|
|
hooks.addAction('hookRemoved', 'core/i18n', onHookAddedOrRemoved);
|
|
}
|
|
return {
|
|
getLocaleData,
|
|
setLocaleData,
|
|
addLocaleData,
|
|
resetLocaleData,
|
|
subscribe,
|
|
__,
|
|
_x,
|
|
_n,
|
|
_nx,
|
|
isRTL,
|
|
hasTranslation
|
|
};
|
|
};
|
|
//# sourceMappingURL=create-i18n.js.map
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+hooks@4.7.0/node_modules/@wordpress/hooks/build-module/index.js + 10 modules
|
|
var build_module = __webpack_require__("../../node_modules/.pnpm/@wordpress+hooks@4.7.0/node_modules/@wordpress/hooks/build-module/index.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+i18n@5.7.0/node_modules/@wordpress/i18n/build-module/default-i18n.js
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
const i18n = createI18n(undefined, undefined, build_module/* defaultHooks */.se);
|
|
|
|
/**
|
|
* Default, singleton instance of `I18n`.
|
|
*/
|
|
/* harmony default export */ const default_i18n = ((/* unused pure expression or super */ null && (i18n)));
|
|
|
|
/*
|
|
* Comments in this file are duplicated from ./i18n due to
|
|
* https://github.com/WordPress/gutenberg/pull/20318#issuecomment-590837722
|
|
*/
|
|
|
|
/**
|
|
* @typedef {import('./create-i18n').LocaleData} LocaleData
|
|
* @typedef {import('./create-i18n').SubscribeCallback} SubscribeCallback
|
|
* @typedef {import('./create-i18n').UnsubscribeCallback} UnsubscribeCallback
|
|
*/
|
|
|
|
/**
|
|
* Returns locale data by domain in a Jed-formatted JSON object shape.
|
|
*
|
|
* @see http://messageformat.github.io/Jed/
|
|
*
|
|
* @param {string} [domain] Domain for which to get the data.
|
|
* @return {LocaleData} Locale data.
|
|
*/
|
|
const getLocaleData = i18n.getLocaleData.bind(i18n);
|
|
|
|
/**
|
|
* Merges locale data into the Tannin instance by domain. Accepts data in a
|
|
* Jed-formatted JSON object shape.
|
|
*
|
|
* @see http://messageformat.github.io/Jed/
|
|
*
|
|
* @param {LocaleData} [data] Locale data configuration.
|
|
* @param {string} [domain] Domain for which configuration applies.
|
|
*/
|
|
const setLocaleData = i18n.setLocaleData.bind(i18n);
|
|
|
|
/**
|
|
* Resets all current Tannin instance locale data and sets the specified
|
|
* locale data for the domain. Accepts data in a Jed-formatted JSON object shape.
|
|
*
|
|
* @see http://messageformat.github.io/Jed/
|
|
*
|
|
* @param {LocaleData} [data] Locale data configuration.
|
|
* @param {string} [domain] Domain for which configuration applies.
|
|
*/
|
|
const resetLocaleData = i18n.resetLocaleData.bind(i18n);
|
|
|
|
/**
|
|
* Subscribes to changes of locale data
|
|
*
|
|
* @param {SubscribeCallback} callback Subscription callback
|
|
* @return {UnsubscribeCallback} Unsubscribe callback
|
|
*/
|
|
const subscribe = i18n.subscribe.bind(i18n);
|
|
|
|
/**
|
|
* Retrieve the translation of text.
|
|
*
|
|
* @see https://developer.wordpress.org/reference/functions/__/
|
|
*
|
|
* @param {string} text Text to translate.
|
|
* @param {string} [domain] Domain to retrieve the translated text.
|
|
*
|
|
* @return {string} Translated text.
|
|
*/
|
|
const __ = i18n.__.bind(i18n);
|
|
|
|
/**
|
|
* Retrieve translated string with gettext context.
|
|
*
|
|
* @see https://developer.wordpress.org/reference/functions/_x/
|
|
*
|
|
* @param {string} text Text to translate.
|
|
* @param {string} context Context information for the translators.
|
|
* @param {string} [domain] Domain to retrieve the translated text.
|
|
*
|
|
* @return {string} Translated context string without pipe.
|
|
*/
|
|
const _x = i18n._x.bind(i18n);
|
|
|
|
/**
|
|
* Translates and retrieves the singular or plural form based on the supplied
|
|
* number.
|
|
*
|
|
* @see https://developer.wordpress.org/reference/functions/_n/
|
|
*
|
|
* @param {string} single The text to be used if the number is singular.
|
|
* @param {string} plural The text to be used if the number is plural.
|
|
* @param {number} number The number to compare against to use either the
|
|
* singular or plural form.
|
|
* @param {string} [domain] Domain to retrieve the translated text.
|
|
*
|
|
* @return {string} The translated singular or plural form.
|
|
*/
|
|
const _n = i18n._n.bind(i18n);
|
|
|
|
/**
|
|
* Translates and retrieves the singular or plural form based on the supplied
|
|
* number, with gettext context.
|
|
*
|
|
* @see https://developer.wordpress.org/reference/functions/_nx/
|
|
*
|
|
* @param {string} single The text to be used if the number is singular.
|
|
* @param {string} plural The text to be used if the number is plural.
|
|
* @param {number} number The number to compare against to use either the
|
|
* singular or plural form.
|
|
* @param {string} context Context information for the translators.
|
|
* @param {string} [domain] Domain to retrieve the translated text.
|
|
*
|
|
* @return {string} The translated singular or plural form.
|
|
*/
|
|
const _nx = i18n._nx.bind(i18n);
|
|
|
|
/**
|
|
* Check if current locale is RTL.
|
|
*
|
|
* **RTL (Right To Left)** is a locale property indicating that text is written from right to left.
|
|
* For example, the `he` locale (for Hebrew) specifies right-to-left. Arabic (ar) is another common
|
|
* language written RTL. The opposite of RTL, LTR (Left To Right) is used in other languages,
|
|
* including English (`en`, `en-US`, `en-GB`, etc.), Spanish (`es`), and French (`fr`).
|
|
*
|
|
* @return {boolean} Whether locale is RTL.
|
|
*/
|
|
const isRTL = i18n.isRTL.bind(i18n);
|
|
|
|
/**
|
|
* Check if there is a translation for a given string (in singular form).
|
|
*
|
|
* @param {string} single Singular form of the string to look up.
|
|
* @param {string} [context] Context information for the translators.
|
|
* @param {string} [domain] Domain to retrieve the translated text.
|
|
* @return {boolean} Whether the translation exists or not.
|
|
*/
|
|
const hasTranslation = i18n.hasTranslation.bind(i18n);
|
|
//# sourceMappingURL=default-i18n.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+i18n@5.7.0/node_modules/@wordpress/i18n/build-module/index.js
|
|
|
|
|
|
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+icons@10.7.0_react@17.0.2/node_modules/@wordpress/icons/build-module/icon/index.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */
|
|
|
|
/**
|
|
* Return an SVG icon.
|
|
*
|
|
* @param {IconProps} props icon is the SVG component to render
|
|
* size is a number specifiying the icon size in pixels
|
|
* Other props will be passed to wrapped SVG component
|
|
* @param {import('react').ForwardedRef<HTMLElement>} ref The forwarded ref to the SVG element.
|
|
*
|
|
* @return {JSX.Element} Icon component
|
|
*/
|
|
function Icon({
|
|
icon,
|
|
size = 24,
|
|
...props
|
|
}, ref) {
|
|
return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.cloneElement)(icon, {
|
|
width: size,
|
|
height: size,
|
|
...props,
|
|
ref
|
|
});
|
|
}
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(Icon));
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+icons@10.7.0_react@17.0.2/node_modules/@wordpress/icons/build-module/library/chevron-down.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+primitives@4.7.0_react@17.0.2/node_modules/@wordpress/primitives/build-module/svg/index.js");
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
const chevronDown = /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__/* .SVG */ .t4, {
|
|
viewBox: "0 0 24 24",
|
|
xmlns: "http://www.w3.org/2000/svg",
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__/* .Path */ .wA, {
|
|
d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"
|
|
})
|
|
});
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (chevronDown);
|
|
//# sourceMappingURL=chevron-down.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+icons@10.7.0_react@17.0.2/node_modules/@wordpress/icons/build-module/library/close-small.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+primitives@4.7.0_react@17.0.2/node_modules/@wordpress/primitives/build-module/svg/index.js");
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
const closeSmall = /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__/* .SVG */ .t4, {
|
|
xmlns: "http://www.w3.org/2000/svg",
|
|
viewBox: "0 0 24 24",
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__/* .Path */ .wA, {
|
|
d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"
|
|
})
|
|
});
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (closeSmall);
|
|
//# sourceMappingURL=close-small.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+icons@10.7.0_react@17.0.2/node_modules/@wordpress/icons/build-module/library/close.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+primitives@4.7.0_react@17.0.2/node_modules/@wordpress/primitives/build-module/svg/index.js");
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
const close = /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__/* .SVG */ .t4, {
|
|
xmlns: "http://www.w3.org/2000/svg",
|
|
viewBox: "0 0 24 24",
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__/* .Path */ .wA, {
|
|
d: "m13.06 12 6.47-6.47-1.06-1.06L12 10.94 5.53 4.47 4.47 5.53 10.94 12l-6.47 6.47 1.06 1.06L12 13.06l6.47 6.47 1.06-1.06L13.06 12Z"
|
|
})
|
|
});
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (close);
|
|
//# sourceMappingURL=close.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+icons@10.7.0_react@17.0.2/node_modules/@wordpress/icons/build-module/library/reset.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+primitives@4.7.0_react@17.0.2/node_modules/@wordpress/primitives/build-module/svg/index.js");
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
const reset = /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__/* .SVG */ .t4, {
|
|
xmlns: "http://www.w3.org/2000/svg",
|
|
viewBox: "0 0 24 24",
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__/* .Path */ .wA, {
|
|
d: "M7 11.5h10V13H7z"
|
|
})
|
|
});
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (reset);
|
|
//# sourceMappingURL=reset.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+primitives@4.7.0_react@17.0.2/node_modules/@wordpress/primitives/build-module/svg/index.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ jl: () => (/* binding */ Circle),
|
|
/* harmony export */ t4: () => (/* binding */ SVG),
|
|
/* harmony export */ wA: () => (/* binding */ Path)
|
|
/* harmony export */ });
|
|
/* unused harmony exports G, Line, Polygon, Rect, Defs, RadialGradient, LinearGradient, Stop */
|
|
/* harmony import */ var clsx__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs");
|
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
/** @typedef {{isPressed?: boolean} & import('react').ComponentPropsWithoutRef<'svg'>} SVGProps */
|
|
|
|
/**
|
|
* @param {import('react').ComponentPropsWithoutRef<'circle'>} props
|
|
*
|
|
* @return {JSX.Element} Circle component
|
|
*/
|
|
|
|
const Circle = props => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)('circle', props);
|
|
|
|
/**
|
|
* @param {import('react').ComponentPropsWithoutRef<'g'>} props
|
|
*
|
|
* @return {JSX.Element} G component
|
|
*/
|
|
const G = props => createElement('g', props);
|
|
|
|
/**
|
|
* @param {import('react').ComponentPropsWithoutRef<'line'>} props
|
|
*
|
|
* @return {JSX.Element} Path component
|
|
*/
|
|
const Line = props => createElement('line', props);
|
|
|
|
/**
|
|
* @param {import('react').ComponentPropsWithoutRef<'path'>} props
|
|
*
|
|
* @return {JSX.Element} Path component
|
|
*/
|
|
const Path = props => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)('path', props);
|
|
|
|
/**
|
|
* @param {import('react').ComponentPropsWithoutRef<'polygon'>} props
|
|
*
|
|
* @return {JSX.Element} Polygon component
|
|
*/
|
|
const Polygon = props => createElement('polygon', props);
|
|
|
|
/**
|
|
* @param {import('react').ComponentPropsWithoutRef<'rect'>} props
|
|
*
|
|
* @return {JSX.Element} Rect component
|
|
*/
|
|
const Rect = props => createElement('rect', props);
|
|
|
|
/**
|
|
* @param {import('react').ComponentPropsWithoutRef<'defs'>} props
|
|
*
|
|
* @return {JSX.Element} Defs component
|
|
*/
|
|
const Defs = props => createElement('defs', props);
|
|
|
|
/**
|
|
* @param {import('react').ComponentPropsWithoutRef<'radialGradient'>} props
|
|
*
|
|
* @return {JSX.Element} RadialGradient component
|
|
*/
|
|
const RadialGradient = props => createElement('radialGradient', props);
|
|
|
|
/**
|
|
* @param {import('react').ComponentPropsWithoutRef<'linearGradient'>} props
|
|
*
|
|
* @return {JSX.Element} LinearGradient component
|
|
*/
|
|
const LinearGradient = props => createElement('linearGradient', props);
|
|
|
|
/**
|
|
* @param {import('react').ComponentPropsWithoutRef<'stop'>} props
|
|
*
|
|
* @return {JSX.Element} Stop component
|
|
*/
|
|
const Stop = props => createElement('stop', props);
|
|
const SVG = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.forwardRef)(
|
|
/**
|
|
* @param {SVGProps} props isPressed indicates whether the SVG should appear as pressed.
|
|
* Other props will be passed through to svg component.
|
|
* @param {import('react').ForwardedRef<SVGSVGElement>} ref The forwarded ref to the SVG element.
|
|
*
|
|
* @return {JSX.Element} Stop component
|
|
*/
|
|
({
|
|
className,
|
|
isPressed,
|
|
...props
|
|
}, ref) => {
|
|
const appliedProps = {
|
|
...props,
|
|
className: (0,clsx__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A)(className, {
|
|
'is-pressed': isPressed
|
|
}) || undefined,
|
|
'aria-hidden': true,
|
|
focusable: false
|
|
};
|
|
|
|
// Disable reason: We need to have a way to render HTML tag for web.
|
|
// eslint-disable-next-line react/forbid-elements
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("svg", {
|
|
...appliedProps,
|
|
ref: ref
|
|
});
|
|
});
|
|
SVG.displayName = 'SVG';
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/@wordpress+warning@3.7.0/node_modules/@wordpress/warning/build-module/index.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
A: () => (/* binding */ warning)
|
|
});
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+warning@3.7.0/node_modules/@wordpress/warning/build-module/utils.js
|
|
/**
|
|
* Object map tracking messages which have been logged, for use in ensuring a
|
|
* message is only logged once.
|
|
*/
|
|
const logged = new Set();
|
|
//# sourceMappingURL=utils.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@wordpress+warning@3.7.0/node_modules/@wordpress/warning/build-module/index.js
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
function isDev() {
|
|
// eslint-disable-next-line @wordpress/wp-global-usage
|
|
return globalThis.SCRIPT_DEBUG === true;
|
|
}
|
|
|
|
/**
|
|
* Shows a warning with `message` if environment is not `production`.
|
|
*
|
|
* @param message Message to show in the warning.
|
|
*
|
|
* @example
|
|
* ```js
|
|
* import warning from '@wordpress/warning';
|
|
*
|
|
* function MyComponent( props ) {
|
|
* if ( ! props.title ) {
|
|
* warning( '`props.title` was not passed' );
|
|
* }
|
|
* ...
|
|
* }
|
|
* ```
|
|
*/
|
|
function warning(message) {
|
|
if (!isDev()) {
|
|
return;
|
|
}
|
|
|
|
// Skip if already logged.
|
|
if (logged.has(message)) {
|
|
return;
|
|
}
|
|
|
|
// eslint-disable-next-line no-console
|
|
console.warn(message);
|
|
|
|
// Throwing an error and catching it immediately to improve debugging
|
|
// A consumer can use 'pause on caught exceptions'
|
|
// https://github.com/facebook/react/issues/4216
|
|
try {
|
|
throw Error(message);
|
|
} catch (x) {
|
|
// Do nothing.
|
|
}
|
|
logged.add(message);
|
|
}
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/* unused harmony export clsx */
|
|
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (clsx);
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/colord@2.9.3/node_modules/colord/index.mjs":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ Mj: () => (/* binding */ w),
|
|
/* harmony export */ X$: () => (/* binding */ k)
|
|
/* harmony export */ });
|
|
/* unused harmony exports Colord, getFormat, random */
|
|
var r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n+0},e=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},u=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},a=function(r){return{r:e(r.r,0,255),g:e(r.g,0,255),b:e(r.b,0,255),a:e(r.a)}},o=function(r){return{r:n(r.r),g:n(r.g),b:n(r.b),a:n(r.a,3)}},i=/^#([0-9a-f]{3,8})$/i,s=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},h=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,a=Math.max(t,n,e),o=a-Math.min(t,n,e),i=o?a===t?(n-e)/o:a===n?2+(e-t)/o:4+(t-n)/o:0;return{h:60*(i<0?i+6:i),s:a?o/a*100:0,v:a/255*100,a:u}},b=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var a=Math.floor(t),o=e*(1-n),i=e*(1-(t-a)*n),s=e*(1-(1-t+a)*n),h=a%6;return{r:255*[e,i,o,o,s,e][h],g:255*[s,e,e,i,o,o][h],b:255*[o,o,s,e,e,i][h],a:u}},g=function(r){return{h:u(r.h),s:e(r.s,0,100),l:e(r.l,0,100),a:e(r.a)}},d=function(r){return{h:n(r.h),s:n(r.s),l:n(r.l),a:n(r.a,3)}},f=function(r){return b((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e},c=function(r){return{h:(t=h(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u},l=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,p=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,m=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,y={string:[[function(r){var t=i.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:4===r.length?n(parseInt(r[3]+r[3],16)/255,2):1}:6===r.length||8===r.length?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:8===r.length?n(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=v.exec(r)||m.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:a({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(t){var n=l.exec(t)||p.exec(t);if(!n)return null;var e,u,a=g({h:(e=n[1],u=n[2],void 0===u&&(u="deg"),Number(e)*(r[u]||1)),s:Number(n[3]),l:Number(n[4]),a:void 0===n[5]?1:Number(n[5])/(n[6]?100:1)});return f(a)},"hsl"]],object:[[function(r){var n=r.r,e=r.g,u=r.b,o=r.a,i=void 0===o?1:o;return t(n)&&t(e)&&t(u)?a({r:Number(n),g:Number(e),b:Number(u),a:Number(i)}):null},"rgb"],[function(r){var n=r.h,e=r.s,u=r.l,a=r.a,o=void 0===a?1:a;if(!t(n)||!t(e)||!t(u))return null;var i=g({h:Number(n),s:Number(e),l:Number(u),a:Number(o)});return f(i)},"hsl"],[function(r){var n=r.h,a=r.s,o=r.v,i=r.a,s=void 0===i?1:i;if(!t(n)||!t(a)||!t(o))return null;var h=function(r){return{h:u(r.h),s:e(r.s,0,100),v:e(r.v,0,100),a:e(r.a)}}({h:Number(n),s:Number(a),v:Number(o),a:Number(s)});return b(h)},"hsv"]]},N=function(r,t){for(var n=0;n<t.length;n++){var e=t[n][0](r);if(e)return[e,t[n][1]]}return[null,void 0]},x=function(r){return"string"==typeof r?N(r.trim(),y.string):"object"==typeof r&&null!==r?N(r,y.object):[null,void 0]},I=function(r){return x(r)[1]},M=function(r,t){var n=c(r);return{h:n.h,s:e(n.s+100*t,0,100),l:n.l,a:n.a}},H=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},$=function(r,t){var n=c(r);return{h:n.h,s:n.s,l:e(n.l+100*t,0,100),a:n.a}},j=function(){function r(r){this.parsed=x(r)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return null!==this.parsed},r.prototype.brightness=function(){return n(H(this.rgba),2)},r.prototype.isDark=function(){return H(this.rgba)<.5},r.prototype.isLight=function(){return H(this.rgba)>=.5},r.prototype.toHex=function(){return r=o(this.rgba),t=r.r,e=r.g,u=r.b,i=(a=r.a)<1?s(n(255*a)):"","#"+s(t)+s(e)+s(u)+i;var r,t,e,u,a,i},r.prototype.toRgb=function(){return o(this.rgba)},r.prototype.toRgbString=function(){return r=o(this.rgba),t=r.r,n=r.g,e=r.b,(u=r.a)<1?"rgba("+t+", "+n+", "+e+", "+u+")":"rgb("+t+", "+n+", "+e+")";var r,t,n,e,u},r.prototype.toHsl=function(){return d(c(this.rgba))},r.prototype.toHslString=function(){return r=d(c(this.rgba)),t=r.h,n=r.s,e=r.l,(u=r.a)<1?"hsla("+t+", "+n+"%, "+e+"%, "+u+")":"hsl("+t+", "+n+"%, "+e+"%)";var r,t,n,e,u},r.prototype.toHsv=function(){return r=h(this.rgba),{h:n(r.h),s:n(r.s),v:n(r.v),a:n(r.a,3)};var r},r.prototype.invert=function(){return w({r:255-(r=this.rgba).r,g:255-r.g,b:255-r.b,a:r.a});var r},r.prototype.saturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,-r))},r.prototype.grayscale=function(){return w(M(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),w($(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),w($(this.rgba,-r))},r.prototype.rotate=function(r){return void 0===r&&(r=15),this.hue(this.hue()+r)},r.prototype.alpha=function(r){return"number"==typeof r?w({r:(t=this.rgba).r,g:t.g,b:t.b,a:r}):n(this.rgba.a,3);var t},r.prototype.hue=function(r){var t=c(this.rgba);return"number"==typeof r?w({h:r,s:t.s,l:t.l,a:t.a}):n(t.h)},r.prototype.isEqual=function(r){return this.toHex()===w(r).toHex()},r}(),w=function(r){return r instanceof j?r:new j(r)},S=[],k=function(r){r.forEach(function(r){S.indexOf(r)<0&&(r(j,y),S.push(r))})},E=function(){return new j({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})};
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/colord@2.9.3/node_modules/colord/plugins/names.mjs":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(e,f){var a={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var d in a)r[a[d]]=d;var l={};e.prototype.toName=function(f){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var d,i,n=r[this.toHex()];if(n)return n;if(null==f?void 0:f.closest){var o=this.toRgb(),t=1/0,b="black";if(!l.length)for(var c in a)l[c]=new e(a[c]).toRgb();for(var g in a){var u=(d=o,i=l[g],Math.pow(d.r-i.r,2)+Math.pow(d.g-i.g,2)+Math.pow(d.b-i.b,2));u<t&&(t=u,b=g)}return b}};f.string.push([function(f){var r=f.toLowerCase(),d="transparent"===r?"#0000":a[r];return d?new e(d).toRgb():null},"name"])}
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/array-method-has-species-support.js":
|
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
|
|
|
|
var fails = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/fails.js");
|
|
var wellKnownSymbol = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/well-known-symbol.js");
|
|
var V8_VERSION = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/engine-v8-version.js");
|
|
|
|
var SPECIES = wellKnownSymbol('species');
|
|
|
|
module.exports = function (METHOD_NAME) {
|
|
// We can't use this feature detection in V8 since it causes
|
|
// deoptimization and serious performance degradation
|
|
// https://github.com/zloirock/core-js/issues/677
|
|
return V8_VERSION >= 51 || !fails(function () {
|
|
var array = [];
|
|
var constructor = array.constructor = {};
|
|
constructor[SPECIES] = function () {
|
|
return { foo: 1 };
|
|
};
|
|
return array[METHOD_NAME](Boolean).foo !== 1;
|
|
});
|
|
};
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.array.filter.js":
|
|
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
|
|
|
|
|
|
var $ = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/export.js");
|
|
var $filter = (__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/array-iteration.js").filter);
|
|
var arrayMethodHasSpeciesSupport = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/array-method-has-species-support.js");
|
|
|
|
var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
|
|
|
|
// `Array.prototype.filter` method
|
|
// https://tc39.es/ecma262/#sec-array.prototype.filter
|
|
// with adding support of @@species
|
|
$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
|
|
filter: function filter(callbackfn /* , thisArg */) {
|
|
return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
|
}
|
|
});
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.array.map.js":
|
|
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
|
|
|
|
|
|
var $ = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/export.js");
|
|
var $map = (__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/array-iteration.js").map);
|
|
var arrayMethodHasSpeciesSupport = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/array-method-has-species-support.js");
|
|
|
|
var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map');
|
|
|
|
// `Array.prototype.map` method
|
|
// https://tc39.es/ecma262/#sec-array.prototype.map
|
|
// with adding support of @@species
|
|
$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
|
|
map: function map(callbackfn /* , thisArg */) {
|
|
return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
|
}
|
|
});
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.function.bind.js":
|
|
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
|
|
|
|
|
|
// TODO: Remove from `core-js@4`
|
|
var $ = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/export.js");
|
|
var bind = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/function-bind.js");
|
|
|
|
// `Function.prototype.bind` method
|
|
// https://tc39.es/ecma262/#sec-function.prototype.bind
|
|
// eslint-disable-next-line es/no-function-prototype-bind -- detection
|
|
$({ target: 'Function', proto: true, forced: Function.bind !== bind }, {
|
|
bind: bind
|
|
});
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js":
|
|
/***/ ((module) => {
|
|
|
|
|
|
|
|
var isMergeableObject = function isMergeableObject(value) {
|
|
return isNonNullObject(value)
|
|
&& !isSpecial(value)
|
|
};
|
|
|
|
function isNonNullObject(value) {
|
|
return !!value && typeof value === 'object'
|
|
}
|
|
|
|
function isSpecial(value) {
|
|
var stringValue = Object.prototype.toString.call(value);
|
|
|
|
return stringValue === '[object RegExp]'
|
|
|| stringValue === '[object Date]'
|
|
|| isReactElement(value)
|
|
}
|
|
|
|
// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
|
|
var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
|
|
function isReactElement(value) {
|
|
return value.$$typeof === REACT_ELEMENT_TYPE
|
|
}
|
|
|
|
function emptyTarget(val) {
|
|
return Array.isArray(val) ? [] : {}
|
|
}
|
|
|
|
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
return (options.clone !== false && options.isMergeableObject(value))
|
|
? deepmerge(emptyTarget(value), value, options)
|
|
: value
|
|
}
|
|
|
|
function defaultArrayMerge(target, source, options) {
|
|
return target.concat(source).map(function(element) {
|
|
return cloneUnlessOtherwiseSpecified(element, options)
|
|
})
|
|
}
|
|
|
|
function getMergeFunction(key, options) {
|
|
if (!options.customMerge) {
|
|
return deepmerge
|
|
}
|
|
var customMerge = options.customMerge(key);
|
|
return typeof customMerge === 'function' ? customMerge : deepmerge
|
|
}
|
|
|
|
function getEnumerableOwnPropertySymbols(target) {
|
|
return Object.getOwnPropertySymbols
|
|
? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
|
return Object.propertyIsEnumerable.call(target, symbol)
|
|
})
|
|
: []
|
|
}
|
|
|
|
function getKeys(target) {
|
|
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
|
|
}
|
|
|
|
function propertyIsOnObject(object, property) {
|
|
try {
|
|
return property in object
|
|
} catch(_) {
|
|
return false
|
|
}
|
|
}
|
|
|
|
// Protects from prototype poisoning and unexpected merging up the prototype chain.
|
|
function propertyIsUnsafe(target, key) {
|
|
return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
|
|
&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
|
|
&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.
|
|
}
|
|
|
|
function mergeObject(target, source, options) {
|
|
var destination = {};
|
|
if (options.isMergeableObject(target)) {
|
|
getKeys(target).forEach(function(key) {
|
|
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
|
});
|
|
}
|
|
getKeys(source).forEach(function(key) {
|
|
if (propertyIsUnsafe(target, key)) {
|
|
return
|
|
}
|
|
|
|
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
|
|
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
|
} else {
|
|
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
|
}
|
|
});
|
|
return destination
|
|
}
|
|
|
|
function deepmerge(target, source, options) {
|
|
options = options || {};
|
|
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
|
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
|
|
// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
|
|
// implementations can use it. The caller may not replace it.
|
|
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
|
|
|
|
var sourceIsArray = Array.isArray(source);
|
|
var targetIsArray = Array.isArray(target);
|
|
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
|
|
|
if (!sourceAndTargetTypesMatch) {
|
|
return cloneUnlessOtherwiseSpecified(source, options)
|
|
} else if (sourceIsArray) {
|
|
return options.arrayMerge(target, source, options)
|
|
} else {
|
|
return mergeObject(target, source, options)
|
|
}
|
|
}
|
|
|
|
deepmerge.all = function deepmergeAll(array, options) {
|
|
if (!Array.isArray(array)) {
|
|
throw new Error('first argument should be an array')
|
|
}
|
|
|
|
return array.reduce(function(prev, next) {
|
|
return deepmerge(prev, next, options)
|
|
}, {})
|
|
};
|
|
|
|
var deepmerge_1 = deepmerge;
|
|
|
|
module.exports = deepmerge_1;
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/es6/index.js":
|
|
/***/ ((module) => {
|
|
|
|
|
|
|
|
// do not edit .js files directly - edit src/index.jst
|
|
|
|
|
|
var envHasBigInt64Array = typeof BigInt64Array !== 'undefined';
|
|
|
|
|
|
module.exports = function equal(a, b) {
|
|
if (a === b) return true;
|
|
|
|
if (a && b && typeof a == 'object' && typeof b == 'object') {
|
|
if (a.constructor !== b.constructor) return false;
|
|
|
|
var length, i, keys;
|
|
if (Array.isArray(a)) {
|
|
length = a.length;
|
|
if (length != b.length) return false;
|
|
for (i = length; i-- !== 0;)
|
|
if (!equal(a[i], b[i])) return false;
|
|
return true;
|
|
}
|
|
|
|
|
|
if ((a instanceof Map) && (b instanceof Map)) {
|
|
if (a.size !== b.size) return false;
|
|
for (i of a.entries())
|
|
if (!b.has(i[0])) return false;
|
|
for (i of a.entries())
|
|
if (!equal(i[1], b.get(i[0]))) return false;
|
|
return true;
|
|
}
|
|
|
|
if ((a instanceof Set) && (b instanceof Set)) {
|
|
if (a.size !== b.size) return false;
|
|
for (i of a.entries())
|
|
if (!b.has(i[0])) return false;
|
|
return true;
|
|
}
|
|
|
|
if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
|
|
length = a.length;
|
|
if (length != b.length) return false;
|
|
for (i = length; i-- !== 0;)
|
|
if (a[i] !== b[i]) return false;
|
|
return true;
|
|
}
|
|
|
|
|
|
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
|
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
|
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
|
|
|
keys = Object.keys(a);
|
|
length = keys.length;
|
|
if (length !== Object.keys(b).length) return false;
|
|
|
|
for (i = length; i-- !== 0;)
|
|
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
|
|
|
for (i = length; i-- !== 0;) {
|
|
var key = keys[i];
|
|
|
|
if (!equal(a[key], b[key])) return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
// true if both NaN, false otherwise
|
|
return a!==a && b!==b;
|
|
};
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/context/LayoutGroupContext.mjs":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ L: () => (/* binding */ LayoutGroupContext)
|
|
/* harmony export */ });
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
|
|
|
|
const LayoutGroupContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)({});
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/frameloop/batcher.mjs":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
I: () => (/* binding */ createRenderBatcher)
|
|
});
|
|
|
|
// UNUSED EXPORTS: stepsOrder
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/GlobalConfig.mjs
|
|
var GlobalConfig = __webpack_require__("../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/GlobalConfig.mjs");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/frameloop/render-step.mjs
|
|
function createRenderStep(runNextFrame) {
|
|
/**
|
|
* We create and reuse two queues, one to queue jobs for the current frame
|
|
* and one for the next. We reuse to avoid triggering GC after x frames.
|
|
*/
|
|
let thisFrame = new Set();
|
|
let nextFrame = new Set();
|
|
/**
|
|
* Track whether we're currently processing jobs in this step. This way
|
|
* we can decide whether to schedule new jobs for this frame or next.
|
|
*/
|
|
let isProcessing = false;
|
|
let flushNextFrame = false;
|
|
/**
|
|
* A set of processes which were marked keepAlive when scheduled.
|
|
*/
|
|
const toKeepAlive = new WeakSet();
|
|
let latestFrameData = {
|
|
delta: 0.0,
|
|
timestamp: 0.0,
|
|
isProcessing: false,
|
|
};
|
|
function triggerCallback(callback) {
|
|
if (toKeepAlive.has(callback)) {
|
|
step.schedule(callback);
|
|
runNextFrame();
|
|
}
|
|
callback(latestFrameData);
|
|
}
|
|
const step = {
|
|
/**
|
|
* Schedule a process to run on the next frame.
|
|
*/
|
|
schedule: (callback, keepAlive = false, immediate = false) => {
|
|
const addToCurrentFrame = immediate && isProcessing;
|
|
const queue = addToCurrentFrame ? thisFrame : nextFrame;
|
|
if (keepAlive)
|
|
toKeepAlive.add(callback);
|
|
if (!queue.has(callback))
|
|
queue.add(callback);
|
|
return callback;
|
|
},
|
|
/**
|
|
* Cancel the provided callback from running on the next frame.
|
|
*/
|
|
cancel: (callback) => {
|
|
nextFrame.delete(callback);
|
|
toKeepAlive.delete(callback);
|
|
},
|
|
/**
|
|
* Execute all schedule callbacks.
|
|
*/
|
|
process: (frameData) => {
|
|
latestFrameData = frameData;
|
|
/**
|
|
* If we're already processing we've probably been triggered by a flushSync
|
|
* inside an existing process. Instead of executing, mark flushNextFrame
|
|
* as true and ensure we flush the following frame at the end of this one.
|
|
*/
|
|
if (isProcessing) {
|
|
flushNextFrame = true;
|
|
return;
|
|
}
|
|
isProcessing = true;
|
|
[thisFrame, nextFrame] = [nextFrame, thisFrame];
|
|
// Clear the next frame queue
|
|
nextFrame.clear();
|
|
// Execute this frame
|
|
thisFrame.forEach(triggerCallback);
|
|
isProcessing = false;
|
|
if (flushNextFrame) {
|
|
flushNextFrame = false;
|
|
step.process(frameData);
|
|
}
|
|
},
|
|
};
|
|
return step;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/frameloop/batcher.mjs
|
|
|
|
|
|
|
|
const stepsOrder = [
|
|
"read", // Read
|
|
"resolveKeyframes", // Write/Read/Write/Read
|
|
"update", // Compute
|
|
"preRender", // Compute
|
|
"render", // Write
|
|
"postRender", // Compute
|
|
];
|
|
const maxElapsed = 40;
|
|
function createRenderBatcher(scheduleNextBatch, allowKeepAlive) {
|
|
let runNextFrame = false;
|
|
let useDefaultElapsed = true;
|
|
const state = {
|
|
delta: 0.0,
|
|
timestamp: 0.0,
|
|
isProcessing: false,
|
|
};
|
|
const flagRunNextFrame = () => (runNextFrame = true);
|
|
const steps = stepsOrder.reduce((acc, key) => {
|
|
acc[key] = createRenderStep(flagRunNextFrame);
|
|
return acc;
|
|
}, {});
|
|
const { read, resolveKeyframes, update, preRender, render, postRender } = steps;
|
|
const processBatch = () => {
|
|
const timestamp = GlobalConfig/* MotionGlobalConfig */.W.useManualTiming
|
|
? state.timestamp
|
|
: performance.now();
|
|
runNextFrame = false;
|
|
state.delta = useDefaultElapsed
|
|
? 1000 / 60
|
|
: Math.max(Math.min(timestamp - state.timestamp, maxElapsed), 1);
|
|
state.timestamp = timestamp;
|
|
state.isProcessing = true;
|
|
// Unrolled render loop for better per-frame performance
|
|
read.process(state);
|
|
resolveKeyframes.process(state);
|
|
update.process(state);
|
|
preRender.process(state);
|
|
render.process(state);
|
|
postRender.process(state);
|
|
state.isProcessing = false;
|
|
if (runNextFrame && allowKeepAlive) {
|
|
useDefaultElapsed = false;
|
|
scheduleNextBatch(processBatch);
|
|
}
|
|
};
|
|
const wake = () => {
|
|
runNextFrame = true;
|
|
useDefaultElapsed = true;
|
|
if (!state.isProcessing) {
|
|
scheduleNextBatch(processBatch);
|
|
}
|
|
};
|
|
const schedule = stepsOrder.reduce((acc, key) => {
|
|
const step = steps[key];
|
|
acc[key] = (process, keepAlive = false, immediate = false) => {
|
|
if (!runNextFrame)
|
|
wake();
|
|
return step.schedule(process, keepAlive, immediate);
|
|
};
|
|
return acc;
|
|
}, {});
|
|
const cancel = (process) => {
|
|
for (let i = 0; i < stepsOrder.length; i++) {
|
|
steps[stepsOrder[i]].cancel(process);
|
|
}
|
|
};
|
|
return { schedule, cancel, state, steps };
|
|
}
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/frameloop/frame.mjs":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ Ci: () => (/* binding */ steps),
|
|
/* harmony export */ Gt: () => (/* binding */ frame),
|
|
/* harmony export */ WG: () => (/* binding */ cancelFrame),
|
|
/* harmony export */ uv: () => (/* binding */ frameData)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _utils_noop_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/noop.mjs");
|
|
/* harmony import */ var _batcher_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/frameloop/batcher.mjs");
|
|
|
|
|
|
|
|
const { schedule: frame, cancel: cancelFrame, state: frameData, steps, } = (0,_batcher_mjs__WEBPACK_IMPORTED_MODULE_0__/* .createRenderBatcher */ .I)(typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame : _utils_noop_mjs__WEBPACK_IMPORTED_MODULE_1__/* .noop */ .l, true);
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/dom/motion.mjs":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
P: () => (/* binding */ motion)
|
|
});
|
|
|
|
// UNUSED EXPORTS: createDomMotionComponent
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js
|
|
var react = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/context/MotionConfigContext.mjs
|
|
|
|
|
|
/**
|
|
* @public
|
|
*/
|
|
const MotionConfigContext = (0,react.createContext)({
|
|
transformPagePoint: (p) => p,
|
|
isStatic: false,
|
|
reducedMotion: "never",
|
|
});
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/context/MotionContext/index.mjs
|
|
|
|
|
|
const MotionContext = (0,react.createContext)({});
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/context/PresenceContext.mjs
|
|
|
|
|
|
/**
|
|
* @public
|
|
*/
|
|
const PresenceContext_PresenceContext = (0,react.createContext)(null);
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/use-isomorphic-effect.mjs
|
|
var use_isomorphic_effect = __webpack_require__("../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/use-isomorphic-effect.mjs");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/context/LazyContext.mjs
|
|
|
|
|
|
const LazyContext = (0,react.createContext)({ strict: false });
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/dom/utils/camel-to-dash.mjs
|
|
/**
|
|
* Convert camelCase to dash-case properties.
|
|
*/
|
|
const camelToDash = (str) => str.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase();
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/animation/optimized-appear/data-id.mjs
|
|
|
|
|
|
const optimizedAppearDataId = "framerAppearId";
|
|
const optimizedAppearDataAttribute = "data-" + camelToDash(optimizedAppearDataId);
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/frameloop/batcher.mjs + 1 modules
|
|
var batcher = __webpack_require__("../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/frameloop/batcher.mjs");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/frameloop/microtask.mjs
|
|
|
|
|
|
const { schedule: microtask, cancel: cancelMicrotask } = (0,batcher/* createRenderBatcher */.I)(queueMicrotask, false);
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/is-ref-object.mjs
|
|
function isRefObject(ref) {
|
|
return (ref &&
|
|
typeof ref === "object" &&
|
|
Object.prototype.hasOwnProperty.call(ref, "current"));
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/context/SwitchLayoutGroupContext.mjs
|
|
|
|
|
|
/**
|
|
* Internal, exported only for usage in Framer
|
|
*/
|
|
const SwitchLayoutGroupContext = (0,react.createContext)({});
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/motion/utils/use-visual-element.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let scheduleHandoffComplete = false;
|
|
function useVisualElement(Component, visualState, props, createVisualElement, ProjectionNodeConstructor) {
|
|
var _a;
|
|
const { visualElement: parent } = (0,react.useContext)(MotionContext);
|
|
const lazyContext = (0,react.useContext)(LazyContext);
|
|
const presenceContext = (0,react.useContext)(PresenceContext_PresenceContext);
|
|
const reducedMotionConfig = (0,react.useContext)(MotionConfigContext).reducedMotion;
|
|
const visualElementRef = (0,react.useRef)();
|
|
/**
|
|
* If we haven't preloaded a renderer, check to see if we have one lazy-loaded
|
|
*/
|
|
createVisualElement = createVisualElement || lazyContext.renderer;
|
|
if (!visualElementRef.current && createVisualElement) {
|
|
visualElementRef.current = createVisualElement(Component, {
|
|
visualState,
|
|
parent,
|
|
props,
|
|
presenceContext,
|
|
blockInitialAnimation: presenceContext
|
|
? presenceContext.initial === false
|
|
: false,
|
|
reducedMotionConfig,
|
|
});
|
|
}
|
|
const visualElement = visualElementRef.current;
|
|
/**
|
|
* Load Motion gesture and animation features. These are rendered as renderless
|
|
* components so each feature can optionally make use of React lifecycle methods.
|
|
*/
|
|
const initialLayoutGroupConfig = (0,react.useContext)(SwitchLayoutGroupContext);
|
|
if (visualElement &&
|
|
!visualElement.projection &&
|
|
ProjectionNodeConstructor &&
|
|
(visualElement.type === "html" || visualElement.type === "svg")) {
|
|
createProjectionNode(visualElementRef.current, props, ProjectionNodeConstructor, initialLayoutGroupConfig);
|
|
}
|
|
(0,react.useInsertionEffect)(() => {
|
|
visualElement && visualElement.update(props, presenceContext);
|
|
});
|
|
/**
|
|
* Cache this value as we want to know whether HandoffAppearAnimations
|
|
* was present on initial render - it will be deleted after this.
|
|
*/
|
|
const optimisedAppearId = props[optimizedAppearDataAttribute];
|
|
const wantsHandoff = (0,react.useRef)(Boolean(optimisedAppearId) &&
|
|
!window.MotionHandoffIsComplete &&
|
|
((_a = window.MotionHasOptimisedAnimation) === null || _a === void 0 ? void 0 : _a.call(window, optimisedAppearId)));
|
|
(0,use_isomorphic_effect/* useIsomorphicLayoutEffect */.E)(() => {
|
|
if (!visualElement)
|
|
return;
|
|
visualElement.updateFeatures();
|
|
microtask.render(visualElement.render);
|
|
/**
|
|
* Ideally this function would always run in a useEffect.
|
|
*
|
|
* However, if we have optimised appear animations to handoff from,
|
|
* it needs to happen synchronously to ensure there's no flash of
|
|
* incorrect styles in the event of a hydration error.
|
|
*
|
|
* So if we detect a situtation where optimised appear animations
|
|
* are running, we use useLayoutEffect to trigger animations.
|
|
*/
|
|
if (wantsHandoff.current && visualElement.animationState) {
|
|
visualElement.animationState.animateChanges();
|
|
}
|
|
});
|
|
(0,react.useEffect)(() => {
|
|
if (!visualElement)
|
|
return;
|
|
if (!wantsHandoff.current && visualElement.animationState) {
|
|
visualElement.animationState.animateChanges();
|
|
}
|
|
wantsHandoff.current = false;
|
|
// This ensures all future calls to animateChanges() will run in useEffect
|
|
if (!scheduleHandoffComplete) {
|
|
scheduleHandoffComplete = true;
|
|
queueMicrotask(completeHandoff);
|
|
}
|
|
});
|
|
return visualElement;
|
|
}
|
|
function completeHandoff() {
|
|
window.MotionHandoffIsComplete = true;
|
|
}
|
|
function createProjectionNode(visualElement, props, ProjectionNodeConstructor, initialPromotionConfig) {
|
|
const { layoutId, layout, drag, dragConstraints, layoutScroll, layoutRoot, } = props;
|
|
visualElement.projection = new ProjectionNodeConstructor(visualElement.latestValues, props["data-framer-portal-id"]
|
|
? undefined
|
|
: getClosestProjectingNode(visualElement.parent));
|
|
visualElement.projection.setOptions({
|
|
layoutId,
|
|
layout,
|
|
alwaysMeasureLayout: Boolean(drag) || (dragConstraints && isRefObject(dragConstraints)),
|
|
visualElement,
|
|
/**
|
|
* TODO: Update options in an effect. This could be tricky as it'll be too late
|
|
* to update by the time layout animations run.
|
|
* We also need to fix this safeToRemove by linking it up to the one returned by usePresence,
|
|
* ensuring it gets called if there's no potential layout animations.
|
|
*
|
|
*/
|
|
animationType: typeof layout === "string" ? layout : "both",
|
|
initialPromotionConfig,
|
|
layoutScroll,
|
|
layoutRoot,
|
|
});
|
|
}
|
|
function getClosestProjectingNode(visualElement) {
|
|
if (!visualElement)
|
|
return undefined;
|
|
return visualElement.options.allowProjection !== false
|
|
? visualElement.projection
|
|
: getClosestProjectingNode(visualElement.parent);
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/motion/utils/use-motion-ref.mjs
|
|
|
|
|
|
|
|
/**
|
|
* Creates a ref function that, when called, hydrates the provided
|
|
* external ref and VisualElement.
|
|
*/
|
|
function useMotionRef(visualState, visualElement, externalRef) {
|
|
return (0,react.useCallback)((instance) => {
|
|
instance && visualState.mount && visualState.mount(instance);
|
|
if (visualElement) {
|
|
if (instance) {
|
|
visualElement.mount(instance);
|
|
}
|
|
else {
|
|
visualElement.unmount();
|
|
}
|
|
}
|
|
if (externalRef) {
|
|
if (typeof externalRef === "function") {
|
|
externalRef(instance);
|
|
}
|
|
else if (isRefObject(externalRef)) {
|
|
externalRef.current = instance;
|
|
}
|
|
}
|
|
},
|
|
/**
|
|
* Only pass a new ref callback to React if we've received a visual element
|
|
* factory. Otherwise we'll be mounting/remounting every time externalRef
|
|
* or other dependencies change.
|
|
*/
|
|
[visualElement]);
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/utils/is-variant-label.mjs
|
|
/**
|
|
* Decides if the supplied variable is variant label
|
|
*/
|
|
function isVariantLabel(v) {
|
|
return typeof v === "string" || Array.isArray(v);
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/animation/utils/is-animation-controls.mjs
|
|
function isAnimationControls(v) {
|
|
return (v !== null &&
|
|
typeof v === "object" &&
|
|
typeof v.start === "function");
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/utils/variant-props.mjs
|
|
const variantPriorityOrder = [
|
|
"animate",
|
|
"whileInView",
|
|
"whileFocus",
|
|
"whileHover",
|
|
"whileTap",
|
|
"whileDrag",
|
|
"exit",
|
|
];
|
|
const variantProps = ["initial", ...variantPriorityOrder];
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/utils/is-controlling-variants.mjs
|
|
|
|
|
|
|
|
|
|
function isControllingVariants(props) {
|
|
return (isAnimationControls(props.animate) ||
|
|
variantProps.some((name) => isVariantLabel(props[name])));
|
|
}
|
|
function isVariantNode(props) {
|
|
return Boolean(isControllingVariants(props) || props.variants);
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/context/MotionContext/utils.mjs
|
|
|
|
|
|
|
|
function getCurrentTreeVariants(props, context) {
|
|
if (isControllingVariants(props)) {
|
|
const { initial, animate } = props;
|
|
return {
|
|
initial: initial === false || isVariantLabel(initial)
|
|
? initial
|
|
: undefined,
|
|
animate: isVariantLabel(animate) ? animate : undefined,
|
|
};
|
|
}
|
|
return props.inherit !== false ? context : {};
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/context/MotionContext/create.mjs
|
|
|
|
|
|
|
|
|
|
function useCreateMotionContext(props) {
|
|
const { initial, animate } = getCurrentTreeVariants(props, (0,react.useContext)(MotionContext));
|
|
return (0,react.useMemo)(() => ({ initial, animate }), [variantLabelsAsDependency(initial), variantLabelsAsDependency(animate)]);
|
|
}
|
|
function variantLabelsAsDependency(prop) {
|
|
return Array.isArray(prop) ? prop.join(" ") : prop;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/motion/features/definitions.mjs
|
|
const featureProps = {
|
|
animation: [
|
|
"animate",
|
|
"variants",
|
|
"whileHover",
|
|
"whileTap",
|
|
"exit",
|
|
"whileInView",
|
|
"whileFocus",
|
|
"whileDrag",
|
|
],
|
|
exit: ["exit"],
|
|
drag: ["drag", "dragControls"],
|
|
focus: ["whileFocus"],
|
|
hover: ["whileHover", "onHoverStart", "onHoverEnd"],
|
|
tap: ["whileTap", "onTap", "onTapStart", "onTapCancel"],
|
|
pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"],
|
|
inView: ["whileInView", "onViewportEnter", "onViewportLeave"],
|
|
layout: ["layout", "layoutId"],
|
|
};
|
|
const featureDefinitions = {};
|
|
for (const key in featureProps) {
|
|
featureDefinitions[key] = {
|
|
isEnabled: (props) => featureProps[key].some((name) => !!props[name]),
|
|
};
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/motion/features/load-features.mjs
|
|
|
|
|
|
function loadFeatures(features) {
|
|
for (const key in features) {
|
|
featureDefinitions[key] = {
|
|
...featureDefinitions[key],
|
|
...features[key],
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/is-browser.mjs
|
|
var is_browser = __webpack_require__("../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/is-browser.mjs");
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/context/LayoutGroupContext.mjs
|
|
var LayoutGroupContext = __webpack_require__("../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/context/LayoutGroupContext.mjs");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/motion/utils/symbol.mjs
|
|
const motionComponentSymbol = Symbol.for("motionComponentSymbol");
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/motion/index.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Create a `motion` component.
|
|
*
|
|
* This function accepts a Component argument, which can be either a string (ie "div"
|
|
* for `motion.div`), or an actual React component.
|
|
*
|
|
* Alongside this is a config option which provides a way of rendering the provided
|
|
* component "offline", or outside the React render cycle.
|
|
*/
|
|
function motion_createMotionComponent({ preloadedFeatures, createVisualElement, useRender, useVisualState, Component, }) {
|
|
preloadedFeatures && loadFeatures(preloadedFeatures);
|
|
function MotionComponent(props, externalRef) {
|
|
/**
|
|
* If we need to measure the element we load this functionality in a
|
|
* separate class component in order to gain access to getSnapshotBeforeUpdate.
|
|
*/
|
|
let MeasureLayout;
|
|
const configAndProps = {
|
|
...(0,react.useContext)(MotionConfigContext),
|
|
...props,
|
|
layoutId: useLayoutId(props),
|
|
};
|
|
const { isStatic } = configAndProps;
|
|
const context = useCreateMotionContext(props);
|
|
const visualState = useVisualState(props, isStatic);
|
|
if (!isStatic && is_browser/* isBrowser */.B) {
|
|
useStrictMode(configAndProps, preloadedFeatures);
|
|
const layoutProjection = getProjectionFunctionality(configAndProps);
|
|
MeasureLayout = layoutProjection.MeasureLayout;
|
|
/**
|
|
* Create a VisualElement for this component. A VisualElement provides a common
|
|
* interface to renderer-specific APIs (ie DOM/Three.js etc) as well as
|
|
* providing a way of rendering to these APIs outside of the React render loop
|
|
* for more performant animations and interactions
|
|
*/
|
|
context.visualElement = useVisualElement(Component, visualState, configAndProps, createVisualElement, layoutProjection.ProjectionNode);
|
|
}
|
|
/**
|
|
* The mount order and hierarchy is specific to ensure our element ref
|
|
* is hydrated by the time features fire their effects.
|
|
*/
|
|
return ((0,jsx_runtime.jsxs)(MotionContext.Provider, { value: context, children: [MeasureLayout && context.visualElement ? ((0,jsx_runtime.jsx)(MeasureLayout, { visualElement: context.visualElement, ...configAndProps })) : null, useRender(Component, props, useMotionRef(visualState, context.visualElement, externalRef), visualState, isStatic, context.visualElement)] }));
|
|
}
|
|
const ForwardRefComponent = (0,react.forwardRef)(MotionComponent);
|
|
ForwardRefComponent[motionComponentSymbol] = Component;
|
|
return ForwardRefComponent;
|
|
}
|
|
function useLayoutId({ layoutId }) {
|
|
const layoutGroupId = (0,react.useContext)(LayoutGroupContext/* LayoutGroupContext */.L).id;
|
|
return layoutGroupId && layoutId !== undefined
|
|
? layoutGroupId + "-" + layoutId
|
|
: layoutId;
|
|
}
|
|
function useStrictMode(configAndProps, preloadedFeatures) {
|
|
const isStrict = (0,react.useContext)(LazyContext).strict;
|
|
/**
|
|
* If we're in development mode, check to make sure we're not rendering a motion component
|
|
* as a child of LazyMotion, as this will break the file-size benefits of using it.
|
|
*/
|
|
if (false) {}
|
|
}
|
|
function getProjectionFunctionality(props) {
|
|
const { drag, layout } = featureDefinitions;
|
|
if (!drag && !layout)
|
|
return {};
|
|
const combined = { ...drag, ...layout };
|
|
return {
|
|
MeasureLayout: (drag === null || drag === void 0 ? void 0 : drag.isEnabled(props)) || (layout === null || layout === void 0 ? void 0 : layout.isEnabled(props))
|
|
? combined.MeasureLayout
|
|
: undefined,
|
|
ProjectionNode: combined.ProjectionNode,
|
|
};
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/dom/motion-proxy.mjs
|
|
|
|
|
|
/**
|
|
* Convert any React component into a `motion` component. The provided component
|
|
* **must** use `React.forwardRef` to the underlying DOM component you want to animate.
|
|
*
|
|
* ```jsx
|
|
* const Component = React.forwardRef((props, ref) => {
|
|
* return <div ref={ref} />
|
|
* })
|
|
*
|
|
* const MotionComponent = motion(Component)
|
|
* ```
|
|
*
|
|
* @public
|
|
*/
|
|
function createMotionProxy(createConfig) {
|
|
function custom(Component, customMotionComponentConfig = {}) {
|
|
return motion_createMotionComponent(createConfig(Component, customMotionComponentConfig));
|
|
}
|
|
if (typeof Proxy === "undefined") {
|
|
return custom;
|
|
}
|
|
/**
|
|
* A cache of generated `motion` components, e.g `motion.div`, `motion.input` etc.
|
|
* Rather than generating them anew every render.
|
|
*/
|
|
const componentCache = new Map();
|
|
return new Proxy(custom, {
|
|
/**
|
|
* Called when `motion` is referenced with a prop: `motion.div`, `motion.input` etc.
|
|
* The prop name is passed through as `key` and we can use that to generate a `motion`
|
|
* DOM component with that name.
|
|
*/
|
|
get: (_target, key) => {
|
|
/**
|
|
* If this element doesn't exist in the component cache, create it and cache.
|
|
*/
|
|
if (!componentCache.has(key)) {
|
|
componentCache.set(key, custom(key));
|
|
}
|
|
return componentCache.get(key);
|
|
},
|
|
});
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/svg/lowercase-elements.mjs
|
|
/**
|
|
* We keep these listed separately as we use the lowercase tag names as part
|
|
* of the runtime bundle to detect SVG components
|
|
*/
|
|
const lowercaseSVGElements = [
|
|
"animate",
|
|
"circle",
|
|
"defs",
|
|
"desc",
|
|
"ellipse",
|
|
"g",
|
|
"image",
|
|
"line",
|
|
"filter",
|
|
"marker",
|
|
"mask",
|
|
"metadata",
|
|
"path",
|
|
"pattern",
|
|
"polygon",
|
|
"polyline",
|
|
"rect",
|
|
"stop",
|
|
"switch",
|
|
"symbol",
|
|
"svg",
|
|
"text",
|
|
"tspan",
|
|
"use",
|
|
"view",
|
|
];
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/dom/utils/is-svg-component.mjs
|
|
|
|
|
|
function isSVGComponent(Component) {
|
|
if (
|
|
/**
|
|
* If it's not a string, it's a custom React component. Currently we only support
|
|
* HTML custom React components.
|
|
*/
|
|
typeof Component !== "string" ||
|
|
/**
|
|
* If it contains a dash, the element is a custom HTML webcomponent.
|
|
*/
|
|
Component.includes("-")) {
|
|
return false;
|
|
}
|
|
else if (
|
|
/**
|
|
* If it's in our list of lowercase SVG tags, it's an SVG component
|
|
*/
|
|
lowercaseSVGElements.indexOf(Component) > -1 ||
|
|
/**
|
|
* If it contains a capital letter, it's an SVG component
|
|
*/
|
|
/[A-Z]/u.test(Component)) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/projection/styles/scale-correction.mjs
|
|
const scaleCorrectors = {};
|
|
function addScaleCorrector(correctors) {
|
|
Object.assign(scaleCorrectors, correctors);
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/html/utils/transform.mjs
|
|
/**
|
|
* Generate a list of every possible transform key.
|
|
*/
|
|
const transformPropOrder = [
|
|
"transformPerspective",
|
|
"x",
|
|
"y",
|
|
"z",
|
|
"translateX",
|
|
"translateY",
|
|
"translateZ",
|
|
"scale",
|
|
"scaleX",
|
|
"scaleY",
|
|
"rotate",
|
|
"rotateX",
|
|
"rotateY",
|
|
"rotateZ",
|
|
"skew",
|
|
"skewX",
|
|
"skewY",
|
|
];
|
|
/**
|
|
* A quick lookup for transform props.
|
|
*/
|
|
const transformProps = new Set(transformPropOrder);
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/motion/utils/is-forced-motion-value.mjs
|
|
|
|
|
|
|
|
function isForcedMotionValue(key, { layout, layoutId }) {
|
|
return (transformProps.has(key) ||
|
|
key.startsWith("origin") ||
|
|
((layout || layoutId !== undefined) &&
|
|
(!!scaleCorrectors[key] || key === "opacity")));
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/value/utils/is-motion-value.mjs
|
|
const isMotionValue = (value) => Boolean(value && value.getVelocity);
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/dom/value-types/get-as-type.mjs
|
|
/**
|
|
* Provided a value and a ValueType, returns the value as that value type.
|
|
*/
|
|
const getValueAsType = (value, type) => {
|
|
return type && typeof value === "number"
|
|
? type.transform(value)
|
|
: value;
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/clamp.mjs
|
|
const clamp = (min, max, v) => {
|
|
if (v > max)
|
|
return max;
|
|
if (v < min)
|
|
return min;
|
|
return v;
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/value/types/numbers/index.mjs
|
|
|
|
|
|
const number = {
|
|
test: (v) => typeof v === "number",
|
|
parse: parseFloat,
|
|
transform: (v) => v,
|
|
};
|
|
const alpha = {
|
|
...number,
|
|
transform: (v) => clamp(0, 1, v),
|
|
};
|
|
const scale = {
|
|
...number,
|
|
default: 1,
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/value/types/utils.mjs
|
|
/**
|
|
* TODO: When we move from string as a source of truth to data models
|
|
* everything in this folder should probably be referred to as models vs types
|
|
*/
|
|
// If this number is a decimal, make it just five decimal places
|
|
// to avoid exponents
|
|
const sanitize = (v) => Math.round(v * 100000) / 100000;
|
|
const floatRegex = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu;
|
|
const colorRegex = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;
|
|
const singleColorRegex = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;
|
|
function isString(v) {
|
|
return typeof v === "string";
|
|
}
|
|
function isNullish(v) {
|
|
return v == null;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/value/types/numbers/units.mjs
|
|
|
|
|
|
const createUnitType = (unit) => ({
|
|
test: (v) => isString(v) && v.endsWith(unit) && v.split(" ").length === 1,
|
|
parse: parseFloat,
|
|
transform: (v) => `${v}${unit}`,
|
|
});
|
|
const degrees = createUnitType("deg");
|
|
const percent = createUnitType("%");
|
|
const px = createUnitType("px");
|
|
const vh = createUnitType("vh");
|
|
const vw = createUnitType("vw");
|
|
const progressPercentage = {
|
|
...percent,
|
|
parse: (v) => percent.parse(v) / 100,
|
|
transform: (v) => percent.transform(v * 100),
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/dom/value-types/type-int.mjs
|
|
|
|
|
|
const type_int_int = {
|
|
...number,
|
|
transform: Math.round,
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/dom/value-types/number.mjs
|
|
|
|
|
|
|
|
|
|
const numberValueTypes = {
|
|
// Border props
|
|
borderWidth: px,
|
|
borderTopWidth: px,
|
|
borderRightWidth: px,
|
|
borderBottomWidth: px,
|
|
borderLeftWidth: px,
|
|
borderRadius: px,
|
|
radius: px,
|
|
borderTopLeftRadius: px,
|
|
borderTopRightRadius: px,
|
|
borderBottomRightRadius: px,
|
|
borderBottomLeftRadius: px,
|
|
// Positioning props
|
|
width: px,
|
|
maxWidth: px,
|
|
height: px,
|
|
maxHeight: px,
|
|
size: px,
|
|
top: px,
|
|
right: px,
|
|
bottom: px,
|
|
left: px,
|
|
// Spacing props
|
|
padding: px,
|
|
paddingTop: px,
|
|
paddingRight: px,
|
|
paddingBottom: px,
|
|
paddingLeft: px,
|
|
margin: px,
|
|
marginTop: px,
|
|
marginRight: px,
|
|
marginBottom: px,
|
|
marginLeft: px,
|
|
// Transform props
|
|
rotate: degrees,
|
|
rotateX: degrees,
|
|
rotateY: degrees,
|
|
rotateZ: degrees,
|
|
scale: scale,
|
|
scaleX: scale,
|
|
scaleY: scale,
|
|
scaleZ: scale,
|
|
skew: degrees,
|
|
skewX: degrees,
|
|
skewY: degrees,
|
|
distance: px,
|
|
translateX: px,
|
|
translateY: px,
|
|
translateZ: px,
|
|
x: px,
|
|
y: px,
|
|
z: px,
|
|
perspective: px,
|
|
transformPerspective: px,
|
|
opacity: alpha,
|
|
originX: progressPercentage,
|
|
originY: progressPercentage,
|
|
originZ: px,
|
|
// Misc
|
|
zIndex: type_int_int,
|
|
backgroundPositionX: px,
|
|
backgroundPositionY: px,
|
|
// SVG
|
|
fillOpacity: alpha,
|
|
strokeOpacity: alpha,
|
|
numOctaves: type_int_int,
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/html/utils/build-transform.mjs
|
|
|
|
|
|
|
|
|
|
const translateAlias = {
|
|
x: "translateX",
|
|
y: "translateY",
|
|
z: "translateZ",
|
|
transformPerspective: "perspective",
|
|
};
|
|
const numTransforms = transformPropOrder.length;
|
|
/**
|
|
* Build a CSS transform style from individual x/y/scale etc properties.
|
|
*
|
|
* This outputs with a default order of transforms/scales/rotations, this can be customised by
|
|
* providing a transformTemplate function.
|
|
*/
|
|
function buildTransform(latestValues, transform, transformTemplate) {
|
|
// The transform string we're going to build into.
|
|
let transformString = "";
|
|
let transformIsDefault = true;
|
|
/**
|
|
* Loop over all possible transforms in order, adding the ones that
|
|
* are present to the transform string.
|
|
*/
|
|
for (let i = 0; i < numTransforms; i++) {
|
|
const key = transformPropOrder[i];
|
|
const value = latestValues[key];
|
|
if (value === undefined)
|
|
continue;
|
|
let valueIsDefault = true;
|
|
if (typeof value === "number") {
|
|
valueIsDefault = value === (key.startsWith("scale") ? 1 : 0);
|
|
}
|
|
else {
|
|
valueIsDefault = parseFloat(value) === 0;
|
|
}
|
|
if (!valueIsDefault || transformTemplate) {
|
|
const valueAsType = getValueAsType(value, numberValueTypes[key]);
|
|
if (!valueIsDefault) {
|
|
transformIsDefault = false;
|
|
const transformName = translateAlias[key] || key;
|
|
transformString += `${transformName}(${valueAsType}) `;
|
|
}
|
|
if (transformTemplate) {
|
|
transform[key] = valueAsType;
|
|
}
|
|
}
|
|
}
|
|
transformString = transformString.trim();
|
|
// If we have a custom `transform` template, pass our transform values and
|
|
// generated transformString to that before returning
|
|
if (transformTemplate) {
|
|
transformString = transformTemplate(transform, transformIsDefault ? "" : transformString);
|
|
}
|
|
else if (transformIsDefault) {
|
|
transformString = "none";
|
|
}
|
|
return transformString;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/dom/utils/is-css-variable.mjs
|
|
const checkStringStartsWith = (token) => (key) => typeof key === "string" && key.startsWith(token);
|
|
const isCSSVariableName = checkStringStartsWith("--");
|
|
const startsAsVariableToken = checkStringStartsWith("var(--");
|
|
const isCSSVariableToken = (value) => {
|
|
const startsWithToken = startsAsVariableToken(value);
|
|
if (!startsWithToken)
|
|
return false;
|
|
// Ensure any comments are stripped from the value as this can harm performance of the regex.
|
|
return singleCssVariableRegex.test(value.split("/*")[0].trim());
|
|
};
|
|
const singleCssVariableRegex = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/html/utils/build-styles.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function buildHTMLStyles(state, latestValues, transformTemplate) {
|
|
const { style, vars, transformOrigin } = state;
|
|
// Track whether we encounter any transform or transformOrigin values.
|
|
let hasTransform = false;
|
|
let hasTransformOrigin = false;
|
|
/**
|
|
* Loop over all our latest animated values and decide whether to handle them
|
|
* as a style or CSS variable.
|
|
*
|
|
* Transforms and transform origins are kept separately for further processing.
|
|
*/
|
|
for (const key in latestValues) {
|
|
const value = latestValues[key];
|
|
if (transformProps.has(key)) {
|
|
// If this is a transform, flag to enable further transform processing
|
|
hasTransform = true;
|
|
continue;
|
|
}
|
|
else if (isCSSVariableName(key)) {
|
|
vars[key] = value;
|
|
continue;
|
|
}
|
|
else {
|
|
// Convert the value to its default value type, ie 0 -> "0px"
|
|
const valueAsType = getValueAsType(value, numberValueTypes[key]);
|
|
if (key.startsWith("origin")) {
|
|
// If this is a transform origin, flag and enable further transform-origin processing
|
|
hasTransformOrigin = true;
|
|
transformOrigin[key] =
|
|
valueAsType;
|
|
}
|
|
else {
|
|
style[key] = valueAsType;
|
|
}
|
|
}
|
|
}
|
|
if (!latestValues.transform) {
|
|
if (hasTransform || transformTemplate) {
|
|
style.transform = buildTransform(latestValues, state.transform, transformTemplate);
|
|
}
|
|
else if (style.transform) {
|
|
/**
|
|
* If we have previously created a transform but currently don't have any,
|
|
* reset transform style to none.
|
|
*/
|
|
style.transform = "none";
|
|
}
|
|
}
|
|
/**
|
|
* Build a transformOrigin style. Uses the same defaults as the browser for
|
|
* undefined origins.
|
|
*/
|
|
if (hasTransformOrigin) {
|
|
const { originX = "50%", originY = "50%", originZ = 0, } = transformOrigin;
|
|
style.transformOrigin = `${originX} ${originY} ${originZ}`;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/html/utils/create-render-state.mjs
|
|
const createHtmlRenderState = () => ({
|
|
style: {},
|
|
transform: {},
|
|
transformOrigin: {},
|
|
vars: {},
|
|
});
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/html/use-props.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function copyRawValuesOnly(target, source, props) {
|
|
for (const key in source) {
|
|
if (!isMotionValue(source[key]) && !isForcedMotionValue(key, props)) {
|
|
target[key] = source[key];
|
|
}
|
|
}
|
|
}
|
|
function useInitialMotionValues({ transformTemplate }, visualState) {
|
|
return (0,react.useMemo)(() => {
|
|
const state = createHtmlRenderState();
|
|
buildHTMLStyles(state, visualState, transformTemplate);
|
|
return Object.assign({}, state.vars, state.style);
|
|
}, [visualState]);
|
|
}
|
|
function useStyle(props, visualState) {
|
|
const styleProp = props.style || {};
|
|
const style = {};
|
|
/**
|
|
* Copy non-Motion Values straight into style
|
|
*/
|
|
copyRawValuesOnly(style, styleProp, props);
|
|
Object.assign(style, useInitialMotionValues(props, visualState));
|
|
return style;
|
|
}
|
|
function useHTMLProps(props, visualState) {
|
|
// The `any` isn't ideal but it is the type of createElement props argument
|
|
const htmlProps = {};
|
|
const style = useStyle(props, visualState);
|
|
if (props.drag && props.dragListener !== false) {
|
|
// Disable the ghost element when a user drags
|
|
htmlProps.draggable = false;
|
|
// Disable text selection
|
|
style.userSelect =
|
|
style.WebkitUserSelect =
|
|
style.WebkitTouchCallout =
|
|
"none";
|
|
// Disable scrolling on the draggable direction
|
|
style.touchAction =
|
|
props.drag === true
|
|
? "none"
|
|
: `pan-${props.drag === "x" ? "y" : "x"}`;
|
|
}
|
|
if (props.tabIndex === undefined &&
|
|
(props.onTap || props.onTapStart || props.whileTap)) {
|
|
htmlProps.tabIndex = 0;
|
|
}
|
|
htmlProps.style = style;
|
|
return htmlProps;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/motion/utils/valid-prop.mjs
|
|
/**
|
|
* A list of all valid MotionProps.
|
|
*
|
|
* @privateRemarks
|
|
* This doesn't throw if a `MotionProp` name is missing - it should.
|
|
*/
|
|
const validMotionProps = new Set([
|
|
"animate",
|
|
"exit",
|
|
"variants",
|
|
"initial",
|
|
"style",
|
|
"values",
|
|
"variants",
|
|
"transition",
|
|
"transformTemplate",
|
|
"custom",
|
|
"inherit",
|
|
"onBeforeLayoutMeasure",
|
|
"onAnimationStart",
|
|
"onAnimationComplete",
|
|
"onUpdate",
|
|
"onDragStart",
|
|
"onDrag",
|
|
"onDragEnd",
|
|
"onMeasureDragConstraints",
|
|
"onDirectionLock",
|
|
"onDragTransitionEnd",
|
|
"_dragX",
|
|
"_dragY",
|
|
"onHoverStart",
|
|
"onHoverEnd",
|
|
"onViewportEnter",
|
|
"onViewportLeave",
|
|
"globalTapTarget",
|
|
"ignoreStrict",
|
|
"viewport",
|
|
]);
|
|
/**
|
|
* Check whether a prop name is a valid `MotionProp` key.
|
|
*
|
|
* @param key - Name of the property to check
|
|
* @returns `true` is key is a valid `MotionProp`.
|
|
*
|
|
* @public
|
|
*/
|
|
function isValidMotionProp(key) {
|
|
return (key.startsWith("while") ||
|
|
(key.startsWith("drag") && key !== "draggable") ||
|
|
key.startsWith("layout") ||
|
|
key.startsWith("onTap") ||
|
|
key.startsWith("onPan") ||
|
|
key.startsWith("onLayout") ||
|
|
validMotionProps.has(key));
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/dom/utils/filter-props.mjs
|
|
|
|
|
|
let shouldForward = (key) => !isValidMotionProp(key);
|
|
function loadExternalIsValidProp(isValidProp) {
|
|
if (!isValidProp)
|
|
return;
|
|
// Explicitly filter our events
|
|
shouldForward = (key) => key.startsWith("on") ? !isValidMotionProp(key) : isValidProp(key);
|
|
}
|
|
/**
|
|
* Emotion and Styled Components both allow users to pass through arbitrary props to their components
|
|
* to dynamically generate CSS. They both use the `@emotion/is-prop-valid` package to determine which
|
|
* of these should be passed to the underlying DOM node.
|
|
*
|
|
* However, when styling a Motion component `styled(motion.div)`, both packages pass through *all* props
|
|
* as it's seen as an arbitrary component rather than a DOM node. Motion only allows arbitrary props
|
|
* passed through the `custom` prop so it doesn't *need* the payload or computational overhead of
|
|
* `@emotion/is-prop-valid`, however to fix this problem we need to use it.
|
|
*
|
|
* By making it an optionalDependency we can offer this functionality only in the situations where it's
|
|
* actually required.
|
|
*/
|
|
try {
|
|
/**
|
|
* We attempt to import this package but require won't be defined in esm environments, in that case
|
|
* isPropValid will have to be provided via `MotionContext`. In a 6.0.0 this should probably be removed
|
|
* in favour of explicit injection.
|
|
*/
|
|
loadExternalIsValidProp((__webpack_require__("../../node_modules/.pnpm/@emotion+is-prop-valid@1.2.1/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js")/* ["default"] */ .A));
|
|
}
|
|
catch (_a) {
|
|
// We don't need to actually do anything here - the fallback is the existing `isPropValid`.
|
|
}
|
|
function filterProps(props, isDom, forwardMotionProps) {
|
|
const filteredProps = {};
|
|
for (const key in props) {
|
|
/**
|
|
* values is considered a valid prop by Emotion, so if it's present
|
|
* this will be rendered out to the DOM unless explicitly filtered.
|
|
*
|
|
* We check the type as it could be used with the `feColorMatrix`
|
|
* element, which we support.
|
|
*/
|
|
if (key === "values" && typeof props.values === "object")
|
|
continue;
|
|
if (shouldForward(key) ||
|
|
(forwardMotionProps === true && isValidMotionProp(key)) ||
|
|
(!isDom && !isValidMotionProp(key)) ||
|
|
// If trying to use native HTML drag events, forward drag listeners
|
|
(props["draggable"] &&
|
|
key.startsWith("onDrag"))) {
|
|
filteredProps[key] =
|
|
props[key];
|
|
}
|
|
}
|
|
return filteredProps;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/svg/utils/transform-origin.mjs
|
|
|
|
|
|
function calcOrigin(origin, offset, size) {
|
|
return typeof origin === "string"
|
|
? origin
|
|
: px.transform(offset + size * origin);
|
|
}
|
|
/**
|
|
* The SVG transform origin defaults are different to CSS and is less intuitive,
|
|
* so we use the measured dimensions of the SVG to reconcile these.
|
|
*/
|
|
function calcSVGTransformOrigin(dimensions, originX, originY) {
|
|
const pxOriginX = calcOrigin(originX, dimensions.x, dimensions.width);
|
|
const pxOriginY = calcOrigin(originY, dimensions.y, dimensions.height);
|
|
return `${pxOriginX} ${pxOriginY}`;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/svg/utils/path.mjs
|
|
|
|
|
|
const dashKeys = {
|
|
offset: "stroke-dashoffset",
|
|
array: "stroke-dasharray",
|
|
};
|
|
const camelKeys = {
|
|
offset: "strokeDashoffset",
|
|
array: "strokeDasharray",
|
|
};
|
|
/**
|
|
* Build SVG path properties. Uses the path's measured length to convert
|
|
* our custom pathLength, pathSpacing and pathOffset into stroke-dashoffset
|
|
* and stroke-dasharray attributes.
|
|
*
|
|
* This function is mutative to reduce per-frame GC.
|
|
*/
|
|
function buildSVGPath(attrs, length, spacing = 1, offset = 0, useDashCase = true) {
|
|
// Normalise path length by setting SVG attribute pathLength to 1
|
|
attrs.pathLength = 1;
|
|
// We use dash case when setting attributes directly to the DOM node and camel case
|
|
// when defining props on a React component.
|
|
const keys = useDashCase ? dashKeys : camelKeys;
|
|
// Build the dash offset
|
|
attrs[keys.offset] = px.transform(-offset);
|
|
// Build the dash array
|
|
const pathLength = px.transform(length);
|
|
const pathSpacing = px.transform(spacing);
|
|
attrs[keys.array] = `${pathLength} ${pathSpacing}`;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/svg/utils/build-attrs.mjs
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Build SVG visual attrbutes, like cx and style.transform
|
|
*/
|
|
function buildSVGAttrs(state, { attrX, attrY, attrScale, originX, originY, pathLength, pathSpacing = 1, pathOffset = 0,
|
|
// This is object creation, which we try to avoid per-frame.
|
|
...latest }, isSVGTag, transformTemplate) {
|
|
buildHTMLStyles(state, latest, transformTemplate);
|
|
/**
|
|
* For svg tags we just want to make sure viewBox is animatable and treat all the styles
|
|
* as normal HTML tags.
|
|
*/
|
|
if (isSVGTag) {
|
|
if (state.style.viewBox) {
|
|
state.attrs.viewBox = state.style.viewBox;
|
|
}
|
|
return;
|
|
}
|
|
state.attrs = state.style;
|
|
state.style = {};
|
|
const { attrs, style, dimensions } = state;
|
|
/**
|
|
* However, we apply transforms as CSS transforms. So if we detect a transform we take it from attrs
|
|
* and copy it into style.
|
|
*/
|
|
if (attrs.transform) {
|
|
if (dimensions)
|
|
style.transform = attrs.transform;
|
|
delete attrs.transform;
|
|
}
|
|
// Parse transformOrigin
|
|
if (dimensions &&
|
|
(originX !== undefined || originY !== undefined || style.transform)) {
|
|
style.transformOrigin = calcSVGTransformOrigin(dimensions, originX !== undefined ? originX : 0.5, originY !== undefined ? originY : 0.5);
|
|
}
|
|
// Render attrX/attrY/attrScale as attributes
|
|
if (attrX !== undefined)
|
|
attrs.x = attrX;
|
|
if (attrY !== undefined)
|
|
attrs.y = attrY;
|
|
if (attrScale !== undefined)
|
|
attrs.scale = attrScale;
|
|
// Build SVG path if one has been defined
|
|
if (pathLength !== undefined) {
|
|
buildSVGPath(attrs, pathLength, pathSpacing, pathOffset, false);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/svg/utils/create-render-state.mjs
|
|
|
|
|
|
const createSvgRenderState = () => ({
|
|
...createHtmlRenderState(),
|
|
attrs: {},
|
|
});
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/svg/utils/is-svg-tag.mjs
|
|
const isSVGTag = (tag) => typeof tag === "string" && tag.toLowerCase() === "svg";
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/svg/use-props.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function useSVGProps(props, visualState, _isStatic, Component) {
|
|
const visualProps = (0,react.useMemo)(() => {
|
|
const state = createSvgRenderState();
|
|
buildSVGAttrs(state, visualState, isSVGTag(Component), props.transformTemplate);
|
|
return {
|
|
...state.attrs,
|
|
style: { ...state.style },
|
|
};
|
|
}, [visualState]);
|
|
if (props.style) {
|
|
const rawStyles = {};
|
|
copyRawValuesOnly(rawStyles, props.style, props);
|
|
visualProps.style = { ...rawStyles, ...visualProps.style };
|
|
}
|
|
return visualProps;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/dom/use-render.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function createUseRender(forwardMotionProps = false) {
|
|
const useRender = (Component, props, ref, { latestValues }, isStatic) => {
|
|
const useVisualProps = isSVGComponent(Component)
|
|
? useSVGProps
|
|
: useHTMLProps;
|
|
const visualProps = useVisualProps(props, latestValues, isStatic, Component);
|
|
const filteredProps = filterProps(props, typeof Component === "string", forwardMotionProps);
|
|
const elementProps = Component !== react.Fragment
|
|
? { ...filteredProps, ...visualProps, ref }
|
|
: {};
|
|
/**
|
|
* If component has been handed a motion value as its child,
|
|
* memoise its initial value and render that. Subsequent updates
|
|
* will be handled by the onChange handler
|
|
*/
|
|
const { children } = props;
|
|
const renderedChildren = (0,react.useMemo)(() => (isMotionValue(children) ? children.get() : children), [children]);
|
|
return (0,react.createElement)(Component, {
|
|
...elementProps,
|
|
children: renderedChildren,
|
|
});
|
|
};
|
|
return useRender;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/html/utils/render.mjs
|
|
function renderHTML(element, { style, vars }, styleProp, projection) {
|
|
Object.assign(element.style, style, projection && projection.getProjectionStyles(styleProp));
|
|
// Loop over any CSS variables and assign those.
|
|
for (const key in vars) {
|
|
element.style.setProperty(key, vars[key]);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/svg/utils/camel-case-attrs.mjs
|
|
/**
|
|
* A set of attribute names that are always read/written as camel case.
|
|
*/
|
|
const camelCaseAttributes = new Set([
|
|
"baseFrequency",
|
|
"diffuseConstant",
|
|
"kernelMatrix",
|
|
"kernelUnitLength",
|
|
"keySplines",
|
|
"keyTimes",
|
|
"limitingConeAngle",
|
|
"markerHeight",
|
|
"markerWidth",
|
|
"numOctaves",
|
|
"targetX",
|
|
"targetY",
|
|
"surfaceScale",
|
|
"specularConstant",
|
|
"specularExponent",
|
|
"stdDeviation",
|
|
"tableValues",
|
|
"viewBox",
|
|
"gradientTransform",
|
|
"pathLength",
|
|
"startOffset",
|
|
"textLength",
|
|
"lengthAdjust",
|
|
]);
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/svg/utils/render.mjs
|
|
|
|
|
|
|
|
|
|
function renderSVG(element, renderState, _styleProp, projection) {
|
|
renderHTML(element, renderState, undefined, projection);
|
|
for (const key in renderState.attrs) {
|
|
element.setAttribute(!camelCaseAttributes.has(key) ? camelToDash(key) : key, renderState.attrs[key]);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/html/utils/scrape-motion-values.mjs
|
|
|
|
|
|
|
|
function scrapeMotionValuesFromProps(props, prevProps, visualElement) {
|
|
var _a;
|
|
const { style } = props;
|
|
const newValues = {};
|
|
for (const key in style) {
|
|
if (isMotionValue(style[key]) ||
|
|
(prevProps.style &&
|
|
isMotionValue(prevProps.style[key])) ||
|
|
isForcedMotionValue(key, props) ||
|
|
((_a = visualElement === null || visualElement === void 0 ? void 0 : visualElement.getValue(key)) === null || _a === void 0 ? void 0 : _a.liveStyle) !== undefined) {
|
|
newValues[key] = style[key];
|
|
}
|
|
}
|
|
/**
|
|
* If the willChange style has been manually set as a string, set
|
|
* applyWillChange to false to prevent it from automatically being applied.
|
|
*/
|
|
if (visualElement && style && typeof style.willChange === "string") {
|
|
visualElement.applyWillChange = false;
|
|
}
|
|
return newValues;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/svg/utils/scrape-motion-values.mjs
|
|
|
|
|
|
|
|
|
|
function scrape_motion_values_scrapeMotionValuesFromProps(props, prevProps, visualElement) {
|
|
const newValues = scrapeMotionValuesFromProps(props, prevProps, visualElement);
|
|
for (const key in props) {
|
|
if (isMotionValue(props[key]) ||
|
|
isMotionValue(prevProps[key])) {
|
|
const targetKey = transformPropOrder.indexOf(key) !== -1
|
|
? "attr" + key.charAt(0).toUpperCase() + key.substring(1)
|
|
: key;
|
|
newValues[targetKey] = props[key];
|
|
}
|
|
}
|
|
return newValues;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/utils/resolve-variants.mjs
|
|
function getValueState(visualElement) {
|
|
const state = [{}, {}];
|
|
visualElement === null || visualElement === void 0 ? void 0 : visualElement.values.forEach((value, key) => {
|
|
state[0][key] = value.get();
|
|
state[1][key] = value.getVelocity();
|
|
});
|
|
return state;
|
|
}
|
|
function resolveVariantFromProps(props, definition, custom, visualElement) {
|
|
/**
|
|
* If the variant definition is a function, resolve.
|
|
*/
|
|
if (typeof definition === "function") {
|
|
const [current, velocity] = getValueState(visualElement);
|
|
definition = definition(custom !== undefined ? custom : props.custom, current, velocity);
|
|
}
|
|
/**
|
|
* If the variant definition is a variant label, or
|
|
* the function returned a variant label, resolve.
|
|
*/
|
|
if (typeof definition === "string") {
|
|
definition = props.variants && props.variants[definition];
|
|
}
|
|
/**
|
|
* At this point we've resolved both functions and variant labels,
|
|
* but the resolved variant label might itself have been a function.
|
|
* If so, resolve. This can only have returned a valid target object.
|
|
*/
|
|
if (typeof definition === "function") {
|
|
const [current, velocity] = getValueState(visualElement);
|
|
definition = definition(custom !== undefined ? custom : props.custom, current, velocity);
|
|
}
|
|
return definition;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/use-constant.mjs
|
|
|
|
|
|
/**
|
|
* Creates a constant value over the lifecycle of a component.
|
|
*
|
|
* Even if `useMemo` is provided an empty array as its final argument, it doesn't offer
|
|
* a guarantee that it won't re-run for performance reasons later on. By using `useConstant`
|
|
* you can ensure that initialisers don't execute twice or more.
|
|
*/
|
|
function useConstant(init) {
|
|
const ref = (0,react.useRef)(null);
|
|
if (ref.current === null) {
|
|
ref.current = init();
|
|
}
|
|
return ref.current;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/animation/utils/is-keyframes-target.mjs
|
|
const isKeyframesTarget = (v) => {
|
|
return Array.isArray(v);
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/resolve-value.mjs
|
|
|
|
|
|
const isCustomValue = (v) => {
|
|
return Boolean(v && typeof v === "object" && v.mix && v.toValue);
|
|
};
|
|
const resolveFinalValueInKeyframes = (v) => {
|
|
// TODO maybe throw if v.length - 1 is placeholder token?
|
|
return isKeyframesTarget(v) ? v[v.length - 1] || 0 : v;
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/value/utils/resolve-motion-value.mjs
|
|
|
|
|
|
|
|
/**
|
|
* If the provided value is a MotionValue, this returns the actual value, otherwise just the value itself
|
|
*
|
|
* TODO: Remove and move to library
|
|
*/
|
|
function resolveMotionValue(value) {
|
|
const unwrappedValue = isMotionValue(value) ? value.get() : value;
|
|
return isCustomValue(unwrappedValue)
|
|
? unwrappedValue.toValue()
|
|
: unwrappedValue;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/animation/animators/utils/accelerated-values.mjs
|
|
/**
|
|
* A list of values that can be hardware-accelerated.
|
|
*/
|
|
const acceleratedValues = new Set([
|
|
"opacity",
|
|
"clipPath",
|
|
"filter",
|
|
"transform",
|
|
// TODO: Can be accelerated but currently disabled until https://issues.chromium.org/issues/41491098 is resolved
|
|
// or until we implement support for linear() easing.
|
|
// "background-color"
|
|
]);
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/value/use-will-change/get-will-change-name.mjs
|
|
|
|
|
|
|
|
|
|
function getWillChangeName(name) {
|
|
if (transformProps.has(name)) {
|
|
return "transform";
|
|
}
|
|
else if (acceleratedValues.has(name)) {
|
|
return camelToDash(name);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/array.mjs
|
|
function addUniqueItem(arr, item) {
|
|
if (arr.indexOf(item) === -1)
|
|
arr.push(item);
|
|
}
|
|
function removeItem(arr, item) {
|
|
const index = arr.indexOf(item);
|
|
if (index > -1)
|
|
arr.splice(index, 1);
|
|
}
|
|
// Adapted from array-move
|
|
function moveItem([...arr], fromIndex, toIndex) {
|
|
const startIndex = fromIndex < 0 ? arr.length + fromIndex : fromIndex;
|
|
if (startIndex >= 0 && startIndex < arr.length) {
|
|
const endIndex = toIndex < 0 ? arr.length + toIndex : toIndex;
|
|
const [item] = arr.splice(fromIndex, 1);
|
|
arr.splice(endIndex, 0, item);
|
|
}
|
|
return arr;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/motion/utils/use-visual-state.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function makeState({ applyWillChange = false, scrapeMotionValuesFromProps, createRenderState, onMount, }, props, context, presenceContext, isStatic) {
|
|
const state = {
|
|
latestValues: makeLatestValues(props, context, presenceContext, isStatic ? false : applyWillChange, scrapeMotionValuesFromProps),
|
|
renderState: createRenderState(),
|
|
};
|
|
if (onMount) {
|
|
state.mount = (instance) => onMount(props, instance, state);
|
|
}
|
|
return state;
|
|
}
|
|
const makeUseVisualState = (config) => (props, isStatic) => {
|
|
const context = (0,react.useContext)(MotionContext);
|
|
const presenceContext = (0,react.useContext)(PresenceContext_PresenceContext);
|
|
const make = () => makeState(config, props, context, presenceContext, isStatic);
|
|
return isStatic ? make() : useConstant(make);
|
|
};
|
|
function addWillChange(willChange, name) {
|
|
const memberName = getWillChangeName(name);
|
|
if (memberName) {
|
|
addUniqueItem(willChange, memberName);
|
|
}
|
|
}
|
|
function forEachDefinition(props, definition, callback) {
|
|
const list = Array.isArray(definition) ? definition : [definition];
|
|
for (let i = 0; i < list.length; i++) {
|
|
const resolved = resolveVariantFromProps(props, list[i]);
|
|
if (resolved) {
|
|
const { transitionEnd, transition, ...target } = resolved;
|
|
callback(target, transitionEnd);
|
|
}
|
|
}
|
|
}
|
|
function makeLatestValues(props, context, presenceContext, shouldApplyWillChange, scrapeMotionValues) {
|
|
var _a;
|
|
const values = {};
|
|
const willChange = [];
|
|
const applyWillChange = shouldApplyWillChange && ((_a = props.style) === null || _a === void 0 ? void 0 : _a.willChange) === undefined;
|
|
const motionValues = scrapeMotionValues(props, {});
|
|
for (const key in motionValues) {
|
|
values[key] = resolveMotionValue(motionValues[key]);
|
|
}
|
|
let { initial, animate } = props;
|
|
const isControllingVariants$1 = isControllingVariants(props);
|
|
const isVariantNode$1 = isVariantNode(props);
|
|
if (context &&
|
|
isVariantNode$1 &&
|
|
!isControllingVariants$1 &&
|
|
props.inherit !== false) {
|
|
if (initial === undefined)
|
|
initial = context.initial;
|
|
if (animate === undefined)
|
|
animate = context.animate;
|
|
}
|
|
let isInitialAnimationBlocked = presenceContext
|
|
? presenceContext.initial === false
|
|
: false;
|
|
isInitialAnimationBlocked = isInitialAnimationBlocked || initial === false;
|
|
const variantToSet = isInitialAnimationBlocked ? animate : initial;
|
|
if (variantToSet &&
|
|
typeof variantToSet !== "boolean" &&
|
|
!isAnimationControls(variantToSet)) {
|
|
forEachDefinition(props, variantToSet, (target, transitionEnd) => {
|
|
for (const key in target) {
|
|
let valueTarget = target[key];
|
|
if (Array.isArray(valueTarget)) {
|
|
/**
|
|
* Take final keyframe if the initial animation is blocked because
|
|
* we want to initialise at the end of that blocked animation.
|
|
*/
|
|
const index = isInitialAnimationBlocked
|
|
? valueTarget.length - 1
|
|
: 0;
|
|
valueTarget = valueTarget[index];
|
|
}
|
|
if (valueTarget !== null) {
|
|
values[key] = valueTarget;
|
|
}
|
|
}
|
|
for (const key in transitionEnd) {
|
|
values[key] = transitionEnd[key];
|
|
}
|
|
});
|
|
}
|
|
// Add animating values to will-change
|
|
if (applyWillChange) {
|
|
if (animate && initial !== false && !isAnimationControls(animate)) {
|
|
forEachDefinition(props, animate, (target) => {
|
|
for (const key in target) {
|
|
addWillChange(willChange, key);
|
|
}
|
|
});
|
|
}
|
|
if (willChange.length) {
|
|
values.willChange = willChange.join(",");
|
|
}
|
|
}
|
|
return values;
|
|
}
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/frameloop/frame.mjs
|
|
var frameloop_frame = __webpack_require__("../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/frameloop/frame.mjs");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/svg/config-motion.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const svgMotionConfig = {
|
|
useVisualState: makeUseVisualState({
|
|
scrapeMotionValuesFromProps: scrape_motion_values_scrapeMotionValuesFromProps,
|
|
createRenderState: createSvgRenderState,
|
|
onMount: (props, instance, { renderState, latestValues }) => {
|
|
frameloop_frame/* frame */.Gt.read(() => {
|
|
try {
|
|
renderState.dimensions =
|
|
typeof instance.getBBox ===
|
|
"function"
|
|
? instance.getBBox()
|
|
: instance.getBoundingClientRect();
|
|
}
|
|
catch (e) {
|
|
// Most likely trying to measure an unrendered element under Firefox
|
|
renderState.dimensions = {
|
|
x: 0,
|
|
y: 0,
|
|
width: 0,
|
|
height: 0,
|
|
};
|
|
}
|
|
});
|
|
frameloop_frame/* frame */.Gt.render(() => {
|
|
buildSVGAttrs(renderState, latestValues, isSVGTag(instance.tagName), props.transformTemplate);
|
|
renderSVG(instance, renderState);
|
|
});
|
|
},
|
|
}),
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/html/config-motion.mjs
|
|
|
|
|
|
|
|
|
|
const htmlMotionConfig = {
|
|
useVisualState: makeUseVisualState({
|
|
applyWillChange: true,
|
|
scrapeMotionValuesFromProps: scrapeMotionValuesFromProps,
|
|
createRenderState: createHtmlRenderState,
|
|
}),
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/dom/utils/create-config.mjs
|
|
|
|
|
|
|
|
|
|
|
|
function create_config_createDomMotionConfig(Component, { forwardMotionProps = false }, preloadedFeatures, createVisualElement) {
|
|
const baseConfig = isSVGComponent(Component)
|
|
? svgMotionConfig
|
|
: htmlMotionConfig;
|
|
return {
|
|
...baseConfig,
|
|
preloadedFeatures,
|
|
useRender: createUseRender(forwardMotionProps),
|
|
createVisualElement,
|
|
Component,
|
|
};
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/events/add-dom-event.mjs
|
|
function addDomEvent(target, eventName, handler, options = { passive: true }) {
|
|
target.addEventListener(eventName, handler, options);
|
|
return () => target.removeEventListener(eventName, handler);
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/events/utils/is-primary-pointer.mjs
|
|
const isPrimaryPointer = (event) => {
|
|
if (event.pointerType === "mouse") {
|
|
return typeof event.button !== "number" || event.button <= 0;
|
|
}
|
|
else {
|
|
/**
|
|
* isPrimary is true for all mice buttons, whereas every touch point
|
|
* is regarded as its own input. So subsequent concurrent touch points
|
|
* will be false.
|
|
*
|
|
* Specifically match against false here as incomplete versions of
|
|
* PointerEvents in very old browser might have it set as undefined.
|
|
*/
|
|
return event.isPrimary !== false;
|
|
}
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/events/event-info.mjs
|
|
|
|
|
|
function extractEventInfo(event, pointType = "page") {
|
|
return {
|
|
point: {
|
|
x: event[`${pointType}X`],
|
|
y: event[`${pointType}Y`],
|
|
},
|
|
};
|
|
}
|
|
const addPointerInfo = (handler) => {
|
|
return (event) => isPrimaryPointer(event) && handler(event, extractEventInfo(event));
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/events/add-pointer-event.mjs
|
|
|
|
|
|
|
|
function addPointerEvent(target, eventName, handler, options) {
|
|
return addDomEvent(target, eventName, addPointerInfo(handler), options);
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/pipe.mjs
|
|
/**
|
|
* Pipe
|
|
* Compose other transformers to run linearily
|
|
* pipe(min(20), max(40))
|
|
* @param {...functions} transformers
|
|
* @return {function}
|
|
*/
|
|
const combineFunctions = (a, b) => (v) => b(a(v));
|
|
const pipe = (...transformers) => transformers.reduce(combineFunctions);
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/gestures/drag/utils/lock.mjs
|
|
function createLock(name) {
|
|
let lock = null;
|
|
return () => {
|
|
const openLock = () => {
|
|
lock = null;
|
|
};
|
|
if (lock === null) {
|
|
lock = name;
|
|
return openLock;
|
|
}
|
|
return false;
|
|
};
|
|
}
|
|
const globalHorizontalLock = createLock("dragHorizontal");
|
|
const globalVerticalLock = createLock("dragVertical");
|
|
function getGlobalLock(drag) {
|
|
let lock = false;
|
|
if (drag === "y") {
|
|
lock = globalVerticalLock();
|
|
}
|
|
else if (drag === "x") {
|
|
lock = globalHorizontalLock();
|
|
}
|
|
else {
|
|
const openHorizontal = globalHorizontalLock();
|
|
const openVertical = globalVerticalLock();
|
|
if (openHorizontal && openVertical) {
|
|
lock = () => {
|
|
openHorizontal();
|
|
openVertical();
|
|
};
|
|
}
|
|
else {
|
|
// Release the locks because we don't use them
|
|
if (openHorizontal)
|
|
openHorizontal();
|
|
if (openVertical)
|
|
openVertical();
|
|
}
|
|
}
|
|
return lock;
|
|
}
|
|
function isDragActive() {
|
|
// Check the gesture lock - if we get it, it means no drag gesture is active
|
|
// and we can safely fire the tap gesture.
|
|
const openGestureLock = getGlobalLock(true);
|
|
if (!openGestureLock)
|
|
return true;
|
|
openGestureLock();
|
|
return false;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/motion/features/Feature.mjs
|
|
class Feature {
|
|
constructor(node) {
|
|
this.isMounted = false;
|
|
this.node = node;
|
|
}
|
|
update() { }
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/gestures/hover.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function addHoverEvent(node, isActive) {
|
|
const eventName = isActive ? "pointerenter" : "pointerleave";
|
|
const callbackName = isActive ? "onHoverStart" : "onHoverEnd";
|
|
const handleEvent = (event, info) => {
|
|
if (event.pointerType === "touch" || isDragActive())
|
|
return;
|
|
const props = node.getProps();
|
|
if (node.animationState && props.whileHover) {
|
|
node.animationState.setActive("whileHover", isActive);
|
|
}
|
|
const callback = props[callbackName];
|
|
if (callback) {
|
|
frameloop_frame/* frame */.Gt.postRender(() => callback(event, info));
|
|
}
|
|
};
|
|
return addPointerEvent(node.current, eventName, handleEvent, {
|
|
passive: !node.getProps()[callbackName],
|
|
});
|
|
}
|
|
class HoverGesture extends Feature {
|
|
mount() {
|
|
this.unmount = pipe(addHoverEvent(this.node, true), addHoverEvent(this.node, false));
|
|
}
|
|
unmount() { }
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/gestures/focus.mjs
|
|
|
|
|
|
|
|
|
|
class FocusGesture extends Feature {
|
|
constructor() {
|
|
super(...arguments);
|
|
this.isActive = false;
|
|
}
|
|
onFocus() {
|
|
let isFocusVisible = false;
|
|
/**
|
|
* If this element doesn't match focus-visible then don't
|
|
* apply whileHover. But, if matches throws that focus-visible
|
|
* is not a valid selector then in that browser outline styles will be applied
|
|
* to the element by default and we want to match that behaviour with whileFocus.
|
|
*/
|
|
try {
|
|
isFocusVisible = this.node.current.matches(":focus-visible");
|
|
}
|
|
catch (e) {
|
|
isFocusVisible = true;
|
|
}
|
|
if (!isFocusVisible || !this.node.animationState)
|
|
return;
|
|
this.node.animationState.setActive("whileFocus", true);
|
|
this.isActive = true;
|
|
}
|
|
onBlur() {
|
|
if (!this.isActive || !this.node.animationState)
|
|
return;
|
|
this.node.animationState.setActive("whileFocus", false);
|
|
this.isActive = false;
|
|
}
|
|
mount() {
|
|
this.unmount = pipe(addDomEvent(this.node.current, "focus", () => this.onFocus()), addDomEvent(this.node.current, "blur", () => this.onBlur()));
|
|
}
|
|
unmount() { }
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/gestures/utils/is-node-or-child.mjs
|
|
/**
|
|
* Recursively traverse up the tree to check whether the provided child node
|
|
* is the parent or a descendant of it.
|
|
*
|
|
* @param parent - Element to find
|
|
* @param child - Element to test against parent
|
|
*/
|
|
const isNodeOrChild = (parent, child) => {
|
|
if (!child) {
|
|
return false;
|
|
}
|
|
else if (parent === child) {
|
|
return true;
|
|
}
|
|
else {
|
|
return isNodeOrChild(parent, child.parentElement);
|
|
}
|
|
};
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/noop.mjs
|
|
var noop = __webpack_require__("../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/noop.mjs");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/gestures/press.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function fireSyntheticPointerEvent(name, handler) {
|
|
if (!handler)
|
|
return;
|
|
const syntheticPointerEvent = new PointerEvent("pointer" + name);
|
|
handler(syntheticPointerEvent, extractEventInfo(syntheticPointerEvent));
|
|
}
|
|
class PressGesture extends Feature {
|
|
constructor() {
|
|
super(...arguments);
|
|
this.removeStartListeners = noop/* noop */.l;
|
|
this.removeEndListeners = noop/* noop */.l;
|
|
this.removeAccessibleListeners = noop/* noop */.l;
|
|
this.startPointerPress = (startEvent, startInfo) => {
|
|
if (this.isPressing)
|
|
return;
|
|
this.removeEndListeners();
|
|
const props = this.node.getProps();
|
|
const endPointerPress = (endEvent, endInfo) => {
|
|
if (!this.checkPressEnd())
|
|
return;
|
|
const { onTap, onTapCancel, globalTapTarget } = this.node.getProps();
|
|
/**
|
|
* We only count this as a tap gesture if the event.target is the same
|
|
* as, or a child of, this component's element
|
|
*/
|
|
const handler = !globalTapTarget &&
|
|
!isNodeOrChild(this.node.current, endEvent.target)
|
|
? onTapCancel
|
|
: onTap;
|
|
if (handler) {
|
|
frameloop_frame/* frame */.Gt.update(() => handler(endEvent, endInfo));
|
|
}
|
|
};
|
|
const removePointerUpListener = addPointerEvent(window, "pointerup", endPointerPress, {
|
|
passive: !(props.onTap || props["onPointerUp"]),
|
|
});
|
|
const removePointerCancelListener = addPointerEvent(window, "pointercancel", (cancelEvent, cancelInfo) => this.cancelPress(cancelEvent, cancelInfo), {
|
|
passive: !(props.onTapCancel ||
|
|
props["onPointerCancel"]),
|
|
});
|
|
this.removeEndListeners = pipe(removePointerUpListener, removePointerCancelListener);
|
|
this.startPress(startEvent, startInfo);
|
|
};
|
|
this.startAccessiblePress = () => {
|
|
const handleKeydown = (keydownEvent) => {
|
|
if (keydownEvent.key !== "Enter" || this.isPressing)
|
|
return;
|
|
const handleKeyup = (keyupEvent) => {
|
|
if (keyupEvent.key !== "Enter" || !this.checkPressEnd())
|
|
return;
|
|
fireSyntheticPointerEvent("up", (event, info) => {
|
|
const { onTap } = this.node.getProps();
|
|
if (onTap) {
|
|
frameloop_frame/* frame */.Gt.postRender(() => onTap(event, info));
|
|
}
|
|
});
|
|
};
|
|
this.removeEndListeners();
|
|
this.removeEndListeners = addDomEvent(this.node.current, "keyup", handleKeyup);
|
|
fireSyntheticPointerEvent("down", (event, info) => {
|
|
this.startPress(event, info);
|
|
});
|
|
};
|
|
const removeKeydownListener = addDomEvent(this.node.current, "keydown", handleKeydown);
|
|
const handleBlur = () => {
|
|
if (!this.isPressing)
|
|
return;
|
|
fireSyntheticPointerEvent("cancel", (cancelEvent, cancelInfo) => this.cancelPress(cancelEvent, cancelInfo));
|
|
};
|
|
const removeBlurListener = addDomEvent(this.node.current, "blur", handleBlur);
|
|
this.removeAccessibleListeners = pipe(removeKeydownListener, removeBlurListener);
|
|
};
|
|
}
|
|
startPress(event, info) {
|
|
this.isPressing = true;
|
|
const { onTapStart, whileTap } = this.node.getProps();
|
|
/**
|
|
* Ensure we trigger animations before firing event callback
|
|
*/
|
|
if (whileTap && this.node.animationState) {
|
|
this.node.animationState.setActive("whileTap", true);
|
|
}
|
|
if (onTapStart) {
|
|
frameloop_frame/* frame */.Gt.postRender(() => onTapStart(event, info));
|
|
}
|
|
}
|
|
checkPressEnd() {
|
|
this.removeEndListeners();
|
|
this.isPressing = false;
|
|
const props = this.node.getProps();
|
|
if (props.whileTap && this.node.animationState) {
|
|
this.node.animationState.setActive("whileTap", false);
|
|
}
|
|
return !isDragActive();
|
|
}
|
|
cancelPress(event, info) {
|
|
if (!this.checkPressEnd())
|
|
return;
|
|
const { onTapCancel } = this.node.getProps();
|
|
if (onTapCancel) {
|
|
frameloop_frame/* frame */.Gt.postRender(() => onTapCancel(event, info));
|
|
}
|
|
}
|
|
mount() {
|
|
const props = this.node.getProps();
|
|
const removePointerListener = addPointerEvent(props.globalTapTarget ? window : this.node.current, "pointerdown", this.startPointerPress, {
|
|
passive: !(props.onTapStart ||
|
|
props["onPointerStart"]),
|
|
});
|
|
const removeFocusListener = addDomEvent(this.node.current, "focus", this.startAccessiblePress);
|
|
this.removeStartListeners = pipe(removePointerListener, removeFocusListener);
|
|
}
|
|
unmount() {
|
|
this.removeStartListeners();
|
|
this.removeEndListeners();
|
|
this.removeAccessibleListeners();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/motion/features/viewport/observers.mjs
|
|
/**
|
|
* Map an IntersectionHandler callback to an element. We only ever make one handler for one
|
|
* element, so even though these handlers might all be triggered by different
|
|
* observers, we can keep them in the same map.
|
|
*/
|
|
const observerCallbacks = new WeakMap();
|
|
/**
|
|
* Multiple observers can be created for multiple element/document roots. Each with
|
|
* different settings. So here we store dictionaries of observers to each root,
|
|
* using serialised settings (threshold/margin) as lookup keys.
|
|
*/
|
|
const observers = new WeakMap();
|
|
const fireObserverCallback = (entry) => {
|
|
const callback = observerCallbacks.get(entry.target);
|
|
callback && callback(entry);
|
|
};
|
|
const fireAllObserverCallbacks = (entries) => {
|
|
entries.forEach(fireObserverCallback);
|
|
};
|
|
function initIntersectionObserver({ root, ...options }) {
|
|
const lookupRoot = root || document;
|
|
/**
|
|
* If we don't have an observer lookup map for this root, create one.
|
|
*/
|
|
if (!observers.has(lookupRoot)) {
|
|
observers.set(lookupRoot, {});
|
|
}
|
|
const rootObservers = observers.get(lookupRoot);
|
|
const key = JSON.stringify(options);
|
|
/**
|
|
* If we don't have an observer for this combination of root and settings,
|
|
* create one.
|
|
*/
|
|
if (!rootObservers[key]) {
|
|
rootObservers[key] = new IntersectionObserver(fireAllObserverCallbacks, { root, ...options });
|
|
}
|
|
return rootObservers[key];
|
|
}
|
|
function observeIntersection(element, options, callback) {
|
|
const rootInteresectionObserver = initIntersectionObserver(options);
|
|
observerCallbacks.set(element, callback);
|
|
rootInteresectionObserver.observe(element);
|
|
return () => {
|
|
observerCallbacks.delete(element);
|
|
rootInteresectionObserver.unobserve(element);
|
|
};
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/motion/features/viewport/index.mjs
|
|
|
|
|
|
|
|
const thresholdNames = {
|
|
some: 0,
|
|
all: 1,
|
|
};
|
|
class InViewFeature extends Feature {
|
|
constructor() {
|
|
super(...arguments);
|
|
this.hasEnteredView = false;
|
|
this.isInView = false;
|
|
}
|
|
startObserver() {
|
|
this.unmount();
|
|
const { viewport = {} } = this.node.getProps();
|
|
const { root, margin: rootMargin, amount = "some", once } = viewport;
|
|
const options = {
|
|
root: root ? root.current : undefined,
|
|
rootMargin,
|
|
threshold: typeof amount === "number" ? amount : thresholdNames[amount],
|
|
};
|
|
const onIntersectionUpdate = (entry) => {
|
|
const { isIntersecting } = entry;
|
|
/**
|
|
* If there's been no change in the viewport state, early return.
|
|
*/
|
|
if (this.isInView === isIntersecting)
|
|
return;
|
|
this.isInView = isIntersecting;
|
|
/**
|
|
* Handle hasEnteredView. If this is only meant to run once, and
|
|
* element isn't visible, early return. Otherwise set hasEnteredView to true.
|
|
*/
|
|
if (once && !isIntersecting && this.hasEnteredView) {
|
|
return;
|
|
}
|
|
else if (isIntersecting) {
|
|
this.hasEnteredView = true;
|
|
}
|
|
if (this.node.animationState) {
|
|
this.node.animationState.setActive("whileInView", isIntersecting);
|
|
}
|
|
/**
|
|
* Use the latest committed props rather than the ones in scope
|
|
* when this observer is created
|
|
*/
|
|
const { onViewportEnter, onViewportLeave } = this.node.getProps();
|
|
const callback = isIntersecting ? onViewportEnter : onViewportLeave;
|
|
callback && callback(entry);
|
|
};
|
|
return observeIntersection(this.node.current, options, onIntersectionUpdate);
|
|
}
|
|
mount() {
|
|
this.startObserver();
|
|
}
|
|
update() {
|
|
if (typeof IntersectionObserver === "undefined")
|
|
return;
|
|
const { props, prevProps } = this.node;
|
|
const hasOptionsChanged = ["amount", "margin", "root"].some(hasViewportOptionChanged(props, prevProps));
|
|
if (hasOptionsChanged) {
|
|
this.startObserver();
|
|
}
|
|
}
|
|
unmount() { }
|
|
}
|
|
function hasViewportOptionChanged({ viewport = {} }, { viewport: prevViewport = {} } = {}) {
|
|
return (name) => viewport[name] !== prevViewport[name];
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/motion/features/gestures.mjs
|
|
|
|
|
|
|
|
|
|
|
|
const gestureAnimations = {
|
|
inView: {
|
|
Feature: InViewFeature,
|
|
},
|
|
tap: {
|
|
Feature: PressGesture,
|
|
},
|
|
focus: {
|
|
Feature: FocusGesture,
|
|
},
|
|
hover: {
|
|
Feature: HoverGesture,
|
|
},
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/shallow-compare.mjs
|
|
function shallowCompare(next, prev) {
|
|
if (!Array.isArray(prev))
|
|
return false;
|
|
const prevLength = prev.length;
|
|
if (prevLength !== next.length)
|
|
return false;
|
|
for (let i = 0; i < prevLength; i++) {
|
|
if (prev[i] !== next[i])
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/utils/resolve-dynamic-variants.mjs
|
|
|
|
|
|
function resolveVariant(visualElement, definition, custom) {
|
|
const props = visualElement.getProps();
|
|
return resolveVariantFromProps(props, definition, custom !== undefined ? custom : props.custom, visualElement);
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/time-conversion.mjs
|
|
/**
|
|
* Converts seconds to milliseconds
|
|
*
|
|
* @param seconds - Time in seconds.
|
|
* @return milliseconds - Converted time in milliseconds.
|
|
*/
|
|
const secondsToMilliseconds = (seconds) => seconds * 1000;
|
|
const millisecondsToSeconds = (milliseconds) => milliseconds / 1000;
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/animation/utils/default-transitions.mjs
|
|
|
|
|
|
const underDampedSpring = {
|
|
type: "spring",
|
|
stiffness: 500,
|
|
damping: 25,
|
|
restSpeed: 10,
|
|
};
|
|
const criticallyDampedSpring = (target) => ({
|
|
type: "spring",
|
|
stiffness: 550,
|
|
damping: target === 0 ? 2 * Math.sqrt(550) : 30,
|
|
restSpeed: 10,
|
|
});
|
|
const keyframesTransition = {
|
|
type: "keyframes",
|
|
duration: 0.8,
|
|
};
|
|
/**
|
|
* Default easing curve is a slightly shallower version of
|
|
* the default browser easing curve.
|
|
*/
|
|
const ease = {
|
|
type: "keyframes",
|
|
ease: [0.25, 0.1, 0.35, 1],
|
|
duration: 0.3,
|
|
};
|
|
const getDefaultTransition = (valueKey, { keyframes }) => {
|
|
if (keyframes.length > 2) {
|
|
return keyframesTransition;
|
|
}
|
|
else if (transformProps.has(valueKey)) {
|
|
return valueKey.startsWith("scale")
|
|
? criticallyDampedSpring(keyframes[1])
|
|
: underDampedSpring;
|
|
}
|
|
return ease;
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/animation/utils/transitions.mjs
|
|
/**
|
|
* Decide whether a transition is defined on a given Transition.
|
|
* This filters out orchestration options and returns true
|
|
* if any options are left.
|
|
*/
|
|
function isTransitionDefined({ when, delay: _delay, delayChildren, staggerChildren, staggerDirection, repeat, repeatType, repeatDelay, from, elapsed, ...transition }) {
|
|
return !!Object.keys(transition).length;
|
|
}
|
|
function getValueTransition(transition, key) {
|
|
return (transition[key] ||
|
|
transition["default"] ||
|
|
transition);
|
|
}
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/GlobalConfig.mjs
|
|
var GlobalConfig = __webpack_require__("../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/GlobalConfig.mjs");
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/use-instant-transition-state.mjs
|
|
const instantAnimationState = {
|
|
current: false,
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/animation/animators/waapi/utils/get-final-keyframe.mjs
|
|
const isNotNull = (value) => value !== null;
|
|
function getFinalKeyframe(keyframes, { repeat, repeatType = "loop" }, finalKeyframe) {
|
|
const resolvedKeyframes = keyframes.filter(isNotNull);
|
|
const index = repeat && repeatType !== "loop" && repeat % 2 === 1
|
|
? 0
|
|
: resolvedKeyframes.length - 1;
|
|
return !index || finalKeyframe === undefined
|
|
? resolvedKeyframes[index]
|
|
: finalKeyframe;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/is-zero-value-string.mjs
|
|
/**
|
|
* Check if the value is a zero value string like "0px" or "0%"
|
|
*/
|
|
const isZeroValueString = (v) => /^0[^.\s]+$/u.test(v);
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/animation/utils/is-none.mjs
|
|
|
|
|
|
function isNone(value) {
|
|
if (typeof value === "number") {
|
|
return value === 0;
|
|
}
|
|
else if (value !== null) {
|
|
return value === "none" || value === "0" || isZeroValueString(value);
|
|
}
|
|
else {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/errors.mjs
|
|
|
|
|
|
let warning = noop/* noop */.l;
|
|
let invariant = noop/* noop */.l;
|
|
if (false) {}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/is-numerical-string.mjs
|
|
/**
|
|
* Check if value is a numerical string, ie a string that is purely a number eg "100" or "-100.1"
|
|
*/
|
|
const isNumericalString = (v) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(v);
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/dom/utils/css-variables-conversion.mjs
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Parse Framer's special CSS variable format into a CSS token and a fallback.
|
|
*
|
|
* ```
|
|
* `var(--foo, #fff)` => [`--foo`, '#fff']
|
|
* ```
|
|
*
|
|
* @param current
|
|
*/
|
|
const splitCSSVariableRegex =
|
|
// eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words
|
|
/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;
|
|
function parseCSSVariable(current) {
|
|
const match = splitCSSVariableRegex.exec(current);
|
|
if (!match)
|
|
return [,];
|
|
const [, token1, token2, fallback] = match;
|
|
return [`--${token1 !== null && token1 !== void 0 ? token1 : token2}`, fallback];
|
|
}
|
|
const maxDepth = 4;
|
|
function getVariableValue(current, element, depth = 1) {
|
|
invariant(depth <= maxDepth, `Max CSS variable fallback depth detected in property "${current}". This may indicate a circular fallback dependency.`);
|
|
const [token, fallback] = parseCSSVariable(current);
|
|
// No CSS variable detected
|
|
if (!token)
|
|
return;
|
|
// Attempt to read this CSS variable off the element
|
|
const resolved = window.getComputedStyle(element).getPropertyValue(token);
|
|
if (resolved) {
|
|
const trimmed = resolved.trim();
|
|
return isNumericalString(trimmed) ? parseFloat(trimmed) : trimmed;
|
|
}
|
|
return isCSSVariableToken(fallback)
|
|
? getVariableValue(fallback, element, depth + 1)
|
|
: fallback;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/dom/utils/unit-conversion.mjs
|
|
|
|
|
|
|
|
|
|
const positionalKeys = new Set([
|
|
"width",
|
|
"height",
|
|
"top",
|
|
"left",
|
|
"right",
|
|
"bottom",
|
|
"x",
|
|
"y",
|
|
"translateX",
|
|
"translateY",
|
|
]);
|
|
const isNumOrPxType = (v) => v === number || v === px;
|
|
const getPosFromMatrix = (matrix, pos) => parseFloat(matrix.split(", ")[pos]);
|
|
const getTranslateFromMatrix = (pos2, pos3) => (_bbox, { transform }) => {
|
|
if (transform === "none" || !transform)
|
|
return 0;
|
|
const matrix3d = transform.match(/^matrix3d\((.+)\)$/u);
|
|
if (matrix3d) {
|
|
return getPosFromMatrix(matrix3d[1], pos3);
|
|
}
|
|
else {
|
|
const matrix = transform.match(/^matrix\((.+)\)$/u);
|
|
if (matrix) {
|
|
return getPosFromMatrix(matrix[1], pos2);
|
|
}
|
|
else {
|
|
return 0;
|
|
}
|
|
}
|
|
};
|
|
const transformKeys = new Set(["x", "y", "z"]);
|
|
const nonTranslationalTransformKeys = transformPropOrder.filter((key) => !transformKeys.has(key));
|
|
function removeNonTranslationalTransform(visualElement) {
|
|
const removedTransforms = [];
|
|
nonTranslationalTransformKeys.forEach((key) => {
|
|
const value = visualElement.getValue(key);
|
|
if (value !== undefined) {
|
|
removedTransforms.push([key, value.get()]);
|
|
value.set(key.startsWith("scale") ? 1 : 0);
|
|
}
|
|
});
|
|
return removedTransforms;
|
|
}
|
|
const positionalValues = {
|
|
// Dimensions
|
|
width: ({ x }, { paddingLeft = "0", paddingRight = "0" }) => x.max - x.min - parseFloat(paddingLeft) - parseFloat(paddingRight),
|
|
height: ({ y }, { paddingTop = "0", paddingBottom = "0" }) => y.max - y.min - parseFloat(paddingTop) - parseFloat(paddingBottom),
|
|
top: (_bbox, { top }) => parseFloat(top),
|
|
left: (_bbox, { left }) => parseFloat(left),
|
|
bottom: ({ y }, { top }) => parseFloat(top) + (y.max - y.min),
|
|
right: ({ x }, { left }) => parseFloat(left) + (x.max - x.min),
|
|
// Transform
|
|
x: getTranslateFromMatrix(4, 13),
|
|
y: getTranslateFromMatrix(5, 14),
|
|
};
|
|
// Alias translate longform names
|
|
positionalValues.translateX = positionalValues.x;
|
|
positionalValues.translateY = positionalValues.y;
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/dom/value-types/test.mjs
|
|
/**
|
|
* Tests a provided value against a ValueType
|
|
*/
|
|
const testValueType = (v) => (type) => type.test(v);
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/dom/value-types/type-auto.mjs
|
|
/**
|
|
* ValueType for "auto"
|
|
*/
|
|
const auto = {
|
|
test: (v) => v === "auto",
|
|
parse: (v) => v,
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/dom/value-types/dimensions.mjs
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* A list of value types commonly used for dimensions
|
|
*/
|
|
const dimensionValueTypes = [number, px, percent, degrees, vw, vh, auto];
|
|
/**
|
|
* Tests a dimensional value against the list of dimension ValueTypes
|
|
*/
|
|
const findDimensionValueType = (v) => dimensionValueTypes.find(testValueType(v));
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/utils/KeyframesResolver.mjs
|
|
|
|
|
|
|
|
const toResolve = new Set();
|
|
let isScheduled = false;
|
|
let anyNeedsMeasurement = false;
|
|
function measureAllKeyframes() {
|
|
if (anyNeedsMeasurement) {
|
|
const resolversToMeasure = Array.from(toResolve).filter((resolver) => resolver.needsMeasurement);
|
|
const elementsToMeasure = new Set(resolversToMeasure.map((resolver) => resolver.element));
|
|
const transformsToRestore = new Map();
|
|
/**
|
|
* Write pass
|
|
* If we're measuring elements we want to remove bounding box-changing transforms.
|
|
*/
|
|
elementsToMeasure.forEach((element) => {
|
|
const removedTransforms = removeNonTranslationalTransform(element);
|
|
if (!removedTransforms.length)
|
|
return;
|
|
transformsToRestore.set(element, removedTransforms);
|
|
element.render();
|
|
});
|
|
// Read
|
|
resolversToMeasure.forEach((resolver) => resolver.measureInitialState());
|
|
// Write
|
|
elementsToMeasure.forEach((element) => {
|
|
element.render();
|
|
const restore = transformsToRestore.get(element);
|
|
if (restore) {
|
|
restore.forEach(([key, value]) => {
|
|
var _a;
|
|
(_a = element.getValue(key)) === null || _a === void 0 ? void 0 : _a.set(value);
|
|
});
|
|
}
|
|
});
|
|
// Read
|
|
resolversToMeasure.forEach((resolver) => resolver.measureEndState());
|
|
// Write
|
|
resolversToMeasure.forEach((resolver) => {
|
|
if (resolver.suspendedScrollY !== undefined) {
|
|
window.scrollTo(0, resolver.suspendedScrollY);
|
|
}
|
|
});
|
|
}
|
|
anyNeedsMeasurement = false;
|
|
isScheduled = false;
|
|
toResolve.forEach((resolver) => resolver.complete());
|
|
toResolve.clear();
|
|
}
|
|
function readAllKeyframes() {
|
|
toResolve.forEach((resolver) => {
|
|
resolver.readKeyframes();
|
|
if (resolver.needsMeasurement) {
|
|
anyNeedsMeasurement = true;
|
|
}
|
|
});
|
|
}
|
|
function flushKeyframeResolvers() {
|
|
readAllKeyframes();
|
|
measureAllKeyframes();
|
|
}
|
|
class KeyframeResolver {
|
|
constructor(unresolvedKeyframes, onComplete, name, motionValue, element, isAsync = false) {
|
|
/**
|
|
* Track whether this resolver has completed. Once complete, it never
|
|
* needs to attempt keyframe resolution again.
|
|
*/
|
|
this.isComplete = false;
|
|
/**
|
|
* Track whether this resolver is async. If it is, it'll be added to the
|
|
* resolver queue and flushed in the next frame. Resolvers that aren't going
|
|
* to trigger read/write thrashing don't need to be async.
|
|
*/
|
|
this.isAsync = false;
|
|
/**
|
|
* Track whether this resolver needs to perform a measurement
|
|
* to resolve its keyframes.
|
|
*/
|
|
this.needsMeasurement = false;
|
|
/**
|
|
* Track whether this resolver is currently scheduled to resolve
|
|
* to allow it to be cancelled and resumed externally.
|
|
*/
|
|
this.isScheduled = false;
|
|
this.unresolvedKeyframes = [...unresolvedKeyframes];
|
|
this.onComplete = onComplete;
|
|
this.name = name;
|
|
this.motionValue = motionValue;
|
|
this.element = element;
|
|
this.isAsync = isAsync;
|
|
}
|
|
scheduleResolve() {
|
|
this.isScheduled = true;
|
|
if (this.isAsync) {
|
|
toResolve.add(this);
|
|
if (!isScheduled) {
|
|
isScheduled = true;
|
|
frameloop_frame/* frame */.Gt.read(readAllKeyframes);
|
|
frameloop_frame/* frame */.Gt.resolveKeyframes(measureAllKeyframes);
|
|
}
|
|
}
|
|
else {
|
|
this.readKeyframes();
|
|
this.complete();
|
|
}
|
|
}
|
|
readKeyframes() {
|
|
const { unresolvedKeyframes, name, element, motionValue } = this;
|
|
/**
|
|
* If a keyframe is null, we hydrate it either by reading it from
|
|
* the instance, or propagating from previous keyframes.
|
|
*/
|
|
for (let i = 0; i < unresolvedKeyframes.length; i++) {
|
|
if (unresolvedKeyframes[i] === null) {
|
|
/**
|
|
* If the first keyframe is null, we need to find its value by sampling the element
|
|
*/
|
|
if (i === 0) {
|
|
const currentValue = motionValue === null || motionValue === void 0 ? void 0 : motionValue.get();
|
|
const finalKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1];
|
|
if (currentValue !== undefined) {
|
|
unresolvedKeyframes[0] = currentValue;
|
|
}
|
|
else if (element && name) {
|
|
const valueAsRead = element.readValue(name, finalKeyframe);
|
|
if (valueAsRead !== undefined && valueAsRead !== null) {
|
|
unresolvedKeyframes[0] = valueAsRead;
|
|
}
|
|
}
|
|
if (unresolvedKeyframes[0] === undefined) {
|
|
unresolvedKeyframes[0] = finalKeyframe;
|
|
}
|
|
if (motionValue && currentValue === undefined) {
|
|
motionValue.set(unresolvedKeyframes[0]);
|
|
}
|
|
}
|
|
else {
|
|
unresolvedKeyframes[i] = unresolvedKeyframes[i - 1];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
setFinalKeyframe() { }
|
|
measureInitialState() { }
|
|
renderEndStyles() { }
|
|
measureEndState() { }
|
|
complete() {
|
|
this.isComplete = true;
|
|
this.onComplete(this.unresolvedKeyframes, this.finalKeyframe);
|
|
toResolve.delete(this);
|
|
}
|
|
cancel() {
|
|
if (!this.isComplete) {
|
|
this.isScheduled = false;
|
|
toResolve.delete(this);
|
|
}
|
|
}
|
|
resume() {
|
|
if (!this.isComplete)
|
|
this.scheduleResolve();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/value/types/color/utils.mjs
|
|
|
|
|
|
/**
|
|
* Returns true if the provided string is a color, ie rgba(0,0,0,0) or #000,
|
|
* but false if a number or multiple colors
|
|
*/
|
|
const isColorString = (type, testProp) => (v) => {
|
|
return Boolean((isString(v) && singleColorRegex.test(v) && v.startsWith(type)) ||
|
|
(testProp &&
|
|
!isNullish(v) &&
|
|
Object.prototype.hasOwnProperty.call(v, testProp)));
|
|
};
|
|
const splitColor = (aName, bName, cName) => (v) => {
|
|
if (!isString(v))
|
|
return v;
|
|
const [a, b, c, alpha] = v.match(floatRegex);
|
|
return {
|
|
[aName]: parseFloat(a),
|
|
[bName]: parseFloat(b),
|
|
[cName]: parseFloat(c),
|
|
alpha: alpha !== undefined ? parseFloat(alpha) : 1,
|
|
};
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/value/types/color/rgba.mjs
|
|
|
|
|
|
|
|
|
|
|
|
const clampRgbUnit = (v) => clamp(0, 255, v);
|
|
const rgbUnit = {
|
|
...number,
|
|
transform: (v) => Math.round(clampRgbUnit(v)),
|
|
};
|
|
const rgba = {
|
|
test: isColorString("rgb", "red"),
|
|
parse: splitColor("red", "green", "blue"),
|
|
transform: ({ red, green, blue, alpha: alpha$1 = 1 }) => "rgba(" +
|
|
rgbUnit.transform(red) +
|
|
", " +
|
|
rgbUnit.transform(green) +
|
|
", " +
|
|
rgbUnit.transform(blue) +
|
|
", " +
|
|
sanitize(alpha.transform(alpha$1)) +
|
|
")",
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/value/types/color/hex.mjs
|
|
|
|
|
|
|
|
function parseHex(v) {
|
|
let r = "";
|
|
let g = "";
|
|
let b = "";
|
|
let a = "";
|
|
// If we have 6 characters, ie #FF0000
|
|
if (v.length > 5) {
|
|
r = v.substring(1, 3);
|
|
g = v.substring(3, 5);
|
|
b = v.substring(5, 7);
|
|
a = v.substring(7, 9);
|
|
// Or we have 3 characters, ie #F00
|
|
}
|
|
else {
|
|
r = v.substring(1, 2);
|
|
g = v.substring(2, 3);
|
|
b = v.substring(3, 4);
|
|
a = v.substring(4, 5);
|
|
r += r;
|
|
g += g;
|
|
b += b;
|
|
a += a;
|
|
}
|
|
return {
|
|
red: parseInt(r, 16),
|
|
green: parseInt(g, 16),
|
|
blue: parseInt(b, 16),
|
|
alpha: a ? parseInt(a, 16) / 255 : 1,
|
|
};
|
|
}
|
|
const hex = {
|
|
test: isColorString("#"),
|
|
parse: parseHex,
|
|
transform: rgba.transform,
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/value/types/color/hsla.mjs
|
|
|
|
|
|
|
|
|
|
|
|
const hsla = {
|
|
test: isColorString("hsl", "hue"),
|
|
parse: splitColor("hue", "saturation", "lightness"),
|
|
transform: ({ hue, saturation, lightness, alpha: alpha$1 = 1 }) => {
|
|
return ("hsla(" +
|
|
Math.round(hue) +
|
|
", " +
|
|
percent.transform(sanitize(saturation)) +
|
|
", " +
|
|
percent.transform(sanitize(lightness)) +
|
|
", " +
|
|
sanitize(alpha.transform(alpha$1)) +
|
|
")");
|
|
},
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/value/types/color/index.mjs
|
|
|
|
|
|
|
|
|
|
|
|
const color = {
|
|
test: (v) => rgba.test(v) || hex.test(v) || hsla.test(v),
|
|
parse: (v) => {
|
|
if (rgba.test(v)) {
|
|
return rgba.parse(v);
|
|
}
|
|
else if (hsla.test(v)) {
|
|
return hsla.parse(v);
|
|
}
|
|
else {
|
|
return hex.parse(v);
|
|
}
|
|
},
|
|
transform: (v) => {
|
|
return isString(v)
|
|
? v
|
|
: v.hasOwnProperty("red")
|
|
? rgba.transform(v)
|
|
: hsla.transform(v);
|
|
},
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/value/types/complex/index.mjs
|
|
|
|
|
|
|
|
function test(v) {
|
|
var _a, _b;
|
|
return (isNaN(v) &&
|
|
isString(v) &&
|
|
(((_a = v.match(floatRegex)) === null || _a === void 0 ? void 0 : _a.length) || 0) +
|
|
(((_b = v.match(colorRegex)) === null || _b === void 0 ? void 0 : _b.length) || 0) >
|
|
0);
|
|
}
|
|
const NUMBER_TOKEN = "number";
|
|
const COLOR_TOKEN = "color";
|
|
const VAR_TOKEN = "var";
|
|
const VAR_FUNCTION_TOKEN = "var(";
|
|
const SPLIT_TOKEN = "${}";
|
|
// this regex consists of the `singleCssVariableRegex|rgbHSLValueRegex|digitRegex`
|
|
const complexRegex = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;
|
|
function analyseComplexValue(value) {
|
|
const originalValue = value.toString();
|
|
const values = [];
|
|
const indexes = {
|
|
color: [],
|
|
number: [],
|
|
var: [],
|
|
};
|
|
const types = [];
|
|
let i = 0;
|
|
const tokenised = originalValue.replace(complexRegex, (parsedValue) => {
|
|
if (color.test(parsedValue)) {
|
|
indexes.color.push(i);
|
|
types.push(COLOR_TOKEN);
|
|
values.push(color.parse(parsedValue));
|
|
}
|
|
else if (parsedValue.startsWith(VAR_FUNCTION_TOKEN)) {
|
|
indexes.var.push(i);
|
|
types.push(VAR_TOKEN);
|
|
values.push(parsedValue);
|
|
}
|
|
else {
|
|
indexes.number.push(i);
|
|
types.push(NUMBER_TOKEN);
|
|
values.push(parseFloat(parsedValue));
|
|
}
|
|
++i;
|
|
return SPLIT_TOKEN;
|
|
});
|
|
const split = tokenised.split(SPLIT_TOKEN);
|
|
return { values, split, indexes, types };
|
|
}
|
|
function parseComplexValue(v) {
|
|
return analyseComplexValue(v).values;
|
|
}
|
|
function createTransformer(source) {
|
|
const { split, types } = analyseComplexValue(source);
|
|
const numSections = split.length;
|
|
return (v) => {
|
|
let output = "";
|
|
for (let i = 0; i < numSections; i++) {
|
|
output += split[i];
|
|
if (v[i] !== undefined) {
|
|
const type = types[i];
|
|
if (type === NUMBER_TOKEN) {
|
|
output += sanitize(v[i]);
|
|
}
|
|
else if (type === COLOR_TOKEN) {
|
|
output += color.transform(v[i]);
|
|
}
|
|
else {
|
|
output += v[i];
|
|
}
|
|
}
|
|
}
|
|
return output;
|
|
};
|
|
}
|
|
const convertNumbersToZero = (v) => typeof v === "number" ? 0 : v;
|
|
function getAnimatableNone(v) {
|
|
const parsed = parseComplexValue(v);
|
|
const transformer = createTransformer(v);
|
|
return transformer(parsed.map(convertNumbersToZero));
|
|
}
|
|
const complex = {
|
|
test,
|
|
parse: parseComplexValue,
|
|
createTransformer,
|
|
getAnimatableNone,
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/value/types/complex/filter.mjs
|
|
|
|
|
|
|
|
/**
|
|
* Properties that should default to 1 or 100%
|
|
*/
|
|
const maxDefaults = new Set(["brightness", "contrast", "saturate", "opacity"]);
|
|
function applyDefaultFilter(v) {
|
|
const [name, value] = v.slice(0, -1).split("(");
|
|
if (name === "drop-shadow")
|
|
return v;
|
|
const [number] = value.match(floatRegex) || [];
|
|
if (!number)
|
|
return v;
|
|
const unit = value.replace(number, "");
|
|
let defaultValue = maxDefaults.has(name) ? 1 : 0;
|
|
if (number !== value)
|
|
defaultValue *= 100;
|
|
return name + "(" + defaultValue + unit + ")";
|
|
}
|
|
const functionRegex = /\b([a-z-]*)\(.*?\)/gu;
|
|
const filter = {
|
|
...complex,
|
|
getAnimatableNone: (v) => {
|
|
const functions = v.match(functionRegex);
|
|
return functions ? functions.map(applyDefaultFilter).join(" ") : v;
|
|
},
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/dom/value-types/defaults.mjs
|
|
|
|
|
|
|
|
|
|
/**
|
|
* A map of default value types for common values
|
|
*/
|
|
const defaultValueTypes = {
|
|
...numberValueTypes,
|
|
// Color props
|
|
color: color,
|
|
backgroundColor: color,
|
|
outlineColor: color,
|
|
fill: color,
|
|
stroke: color,
|
|
// Border props
|
|
borderColor: color,
|
|
borderTopColor: color,
|
|
borderRightColor: color,
|
|
borderBottomColor: color,
|
|
borderLeftColor: color,
|
|
filter: filter,
|
|
WebkitFilter: filter,
|
|
};
|
|
/**
|
|
* Gets the default ValueType for the provided value key
|
|
*/
|
|
const getDefaultValueType = (key) => defaultValueTypes[key];
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/dom/value-types/animatable-none.mjs
|
|
|
|
|
|
|
|
|
|
function animatable_none_getAnimatableNone(key, value) {
|
|
let defaultValueType = getDefaultValueType(key);
|
|
if (defaultValueType !== filter)
|
|
defaultValueType = complex;
|
|
// If value is not recognised as animatable, ie "none", create an animatable version origin based on the target
|
|
return defaultValueType.getAnimatableNone
|
|
? defaultValueType.getAnimatableNone(value)
|
|
: undefined;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/html/utils/make-none-animatable.mjs
|
|
|
|
|
|
|
|
/**
|
|
* If we encounter keyframes like "none" or "0" and we also have keyframes like
|
|
* "#fff" or "200px 200px" we want to find a keyframe to serve as a template for
|
|
* the "none" keyframes. In this case "#fff" or "200px 200px" - then these get turned into
|
|
* zero equivalents, i.e. "#fff0" or "0px 0px".
|
|
*/
|
|
const invalidTemplates = new Set(["auto", "none", "0"]);
|
|
function makeNoneKeyframesAnimatable(unresolvedKeyframes, noneKeyframeIndexes, name) {
|
|
let i = 0;
|
|
let animatableTemplate = undefined;
|
|
while (i < unresolvedKeyframes.length && !animatableTemplate) {
|
|
const keyframe = unresolvedKeyframes[i];
|
|
if (typeof keyframe === "string" &&
|
|
!invalidTemplates.has(keyframe) &&
|
|
analyseComplexValue(keyframe).values.length) {
|
|
animatableTemplate = unresolvedKeyframes[i];
|
|
}
|
|
i++;
|
|
}
|
|
if (animatableTemplate && name) {
|
|
for (const noneIndex of noneKeyframeIndexes) {
|
|
unresolvedKeyframes[noneIndex] = animatable_none_getAnimatableNone(name, animatableTemplate);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/dom/DOMKeyframesResolver.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class DOMKeyframesResolver extends KeyframeResolver {
|
|
constructor(unresolvedKeyframes, onComplete, name, motionValue, element) {
|
|
super(unresolvedKeyframes, onComplete, name, motionValue, element, true);
|
|
}
|
|
readKeyframes() {
|
|
const { unresolvedKeyframes, element, name } = this;
|
|
if (!element || !element.current)
|
|
return;
|
|
super.readKeyframes();
|
|
/**
|
|
* If any keyframe is a CSS variable, we need to find its value by sampling the element
|
|
*/
|
|
for (let i = 0; i < unresolvedKeyframes.length; i++) {
|
|
let keyframe = unresolvedKeyframes[i];
|
|
if (typeof keyframe === "string") {
|
|
keyframe = keyframe.trim();
|
|
if (isCSSVariableToken(keyframe)) {
|
|
const resolved = getVariableValue(keyframe, element.current);
|
|
if (resolved !== undefined) {
|
|
unresolvedKeyframes[i] = resolved;
|
|
}
|
|
if (i === unresolvedKeyframes.length - 1) {
|
|
this.finalKeyframe = keyframe;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/**
|
|
* Resolve "none" values. We do this potentially twice - once before and once after measuring keyframes.
|
|
* This could be seen as inefficient but it's a trade-off to avoid measurements in more situations, which
|
|
* have a far bigger performance impact.
|
|
*/
|
|
this.resolveNoneKeyframes();
|
|
/**
|
|
* Check to see if unit type has changed. If so schedule jobs that will
|
|
* temporarily set styles to the destination keyframes.
|
|
* Skip if we have more than two keyframes or this isn't a positional value.
|
|
* TODO: We can throw if there are multiple keyframes and the value type changes.
|
|
*/
|
|
if (!positionalKeys.has(name) || unresolvedKeyframes.length !== 2) {
|
|
return;
|
|
}
|
|
const [origin, target] = unresolvedKeyframes;
|
|
const originType = findDimensionValueType(origin);
|
|
const targetType = findDimensionValueType(target);
|
|
/**
|
|
* Either we don't recognise these value types or we can animate between them.
|
|
*/
|
|
if (originType === targetType)
|
|
return;
|
|
/**
|
|
* If both values are numbers or pixels, we can animate between them by
|
|
* converting them to numbers.
|
|
*/
|
|
if (isNumOrPxType(originType) && isNumOrPxType(targetType)) {
|
|
for (let i = 0; i < unresolvedKeyframes.length; i++) {
|
|
const value = unresolvedKeyframes[i];
|
|
if (typeof value === "string") {
|
|
unresolvedKeyframes[i] = parseFloat(value);
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
/**
|
|
* Else, the only way to resolve this is by measuring the element.
|
|
*/
|
|
this.needsMeasurement = true;
|
|
}
|
|
}
|
|
resolveNoneKeyframes() {
|
|
const { unresolvedKeyframes, name } = this;
|
|
const noneKeyframeIndexes = [];
|
|
for (let i = 0; i < unresolvedKeyframes.length; i++) {
|
|
if (isNone(unresolvedKeyframes[i])) {
|
|
noneKeyframeIndexes.push(i);
|
|
}
|
|
}
|
|
if (noneKeyframeIndexes.length) {
|
|
makeNoneKeyframesAnimatable(unresolvedKeyframes, noneKeyframeIndexes, name);
|
|
}
|
|
}
|
|
measureInitialState() {
|
|
const { element, unresolvedKeyframes, name } = this;
|
|
if (!element || !element.current)
|
|
return;
|
|
if (name === "height") {
|
|
this.suspendedScrollY = window.pageYOffset;
|
|
}
|
|
this.measuredOrigin = positionalValues[name](element.measureViewportBox(), window.getComputedStyle(element.current));
|
|
unresolvedKeyframes[0] = this.measuredOrigin;
|
|
// Set final key frame to measure after next render
|
|
const measureKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1];
|
|
if (measureKeyframe !== undefined) {
|
|
element.getValue(name, measureKeyframe).jump(measureKeyframe, false);
|
|
}
|
|
}
|
|
measureEndState() {
|
|
var _a;
|
|
const { element, name, unresolvedKeyframes } = this;
|
|
if (!element || !element.current)
|
|
return;
|
|
const value = element.getValue(name);
|
|
value && value.jump(this.measuredOrigin, false);
|
|
const finalKeyframeIndex = unresolvedKeyframes.length - 1;
|
|
const finalKeyframe = unresolvedKeyframes[finalKeyframeIndex];
|
|
unresolvedKeyframes[finalKeyframeIndex] = positionalValues[name](element.measureViewportBox(), window.getComputedStyle(element.current));
|
|
if (finalKeyframe !== null && this.finalKeyframe === undefined) {
|
|
this.finalKeyframe = finalKeyframe;
|
|
}
|
|
// If we removed transform values, reapply them before the next render
|
|
if ((_a = this.removedTransforms) === null || _a === void 0 ? void 0 : _a.length) {
|
|
this.removedTransforms.forEach(([unsetTransformName, unsetTransformValue]) => {
|
|
element
|
|
.getValue(unsetTransformName)
|
|
.set(unsetTransformValue);
|
|
});
|
|
}
|
|
this.resolveNoneKeyframes();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/memo.mjs
|
|
function memo(callback) {
|
|
let result;
|
|
return () => {
|
|
if (result === undefined)
|
|
result = callback();
|
|
return result;
|
|
};
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/frameloop/sync-time.mjs
|
|
|
|
|
|
|
|
let now;
|
|
function clearTime() {
|
|
now = undefined;
|
|
}
|
|
/**
|
|
* An eventloop-synchronous alternative to performance.now().
|
|
*
|
|
* Ensures that time measurements remain consistent within a synchronous context.
|
|
* Usually calling performance.now() twice within the same synchronous context
|
|
* will return different values which isn't useful for animations when we're usually
|
|
* trying to sync animations to the same frame.
|
|
*/
|
|
const time = {
|
|
now: () => {
|
|
if (now === undefined) {
|
|
time.set(frameloop_frame/* frameData */.uv.isProcessing || GlobalConfig/* MotionGlobalConfig */.W.useManualTiming
|
|
? frameloop_frame/* frameData */.uv.timestamp
|
|
: performance.now());
|
|
}
|
|
return now;
|
|
},
|
|
set: (newTime) => {
|
|
now = newTime;
|
|
queueMicrotask(clearTime);
|
|
},
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/animation/utils/is-animatable.mjs
|
|
|
|
|
|
/**
|
|
* Check if a value is animatable. Examples:
|
|
*
|
|
* ✅: 100, "100px", "#fff"
|
|
* ❌: "block", "url(2.jpg)"
|
|
* @param value
|
|
*
|
|
* @internal
|
|
*/
|
|
const isAnimatable = (value, name) => {
|
|
// If the list of keys tat might be non-animatable grows, replace with Set
|
|
if (name === "zIndex")
|
|
return false;
|
|
// If it's a number or a keyframes array, we can animate it. We might at some point
|
|
// need to do a deep isAnimatable check of keyframes, or let Popmotion handle this,
|
|
// but for now lets leave it like this for performance reasons
|
|
if (typeof value === "number" || Array.isArray(value))
|
|
return true;
|
|
if (typeof value === "string" && // It's animatable if we have a string
|
|
(complex.test(value) || value === "0") && // And it contains numbers and/or colors
|
|
!value.startsWith("url(") // Unless it starts with "url("
|
|
) {
|
|
return true;
|
|
}
|
|
return false;
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/animation/animators/utils/can-animate.mjs
|
|
|
|
|
|
|
|
function hasKeyframesChanged(keyframes) {
|
|
const current = keyframes[0];
|
|
if (keyframes.length === 1)
|
|
return true;
|
|
for (let i = 0; i < keyframes.length; i++) {
|
|
if (keyframes[i] !== current)
|
|
return true;
|
|
}
|
|
}
|
|
function canAnimate(keyframes, name, type, velocity) {
|
|
/**
|
|
* Check if we're able to animate between the start and end keyframes,
|
|
* and throw a warning if we're attempting to animate between one that's
|
|
* animatable and another that isn't.
|
|
*/
|
|
const originKeyframe = keyframes[0];
|
|
if (originKeyframe === null)
|
|
return false;
|
|
/**
|
|
* These aren't traditionally animatable but we do support them.
|
|
* In future we could look into making this more generic or replacing
|
|
* this function with mix() === mixImmediate
|
|
*/
|
|
if (name === "display" || name === "visibility")
|
|
return true;
|
|
const targetKeyframe = keyframes[keyframes.length - 1];
|
|
const isOriginAnimatable = isAnimatable(originKeyframe, name);
|
|
const isTargetAnimatable = isAnimatable(targetKeyframe, name);
|
|
warning(isOriginAnimatable === isTargetAnimatable, `You are trying to animate ${name} from "${originKeyframe}" to "${targetKeyframe}". ${originKeyframe} is not an animatable value - to enable this animation set ${originKeyframe} to a value animatable to ${targetKeyframe} via the \`style\` property.`);
|
|
// Always skip if any of these are true
|
|
if (!isOriginAnimatable || !isTargetAnimatable) {
|
|
return false;
|
|
}
|
|
return hasKeyframesChanged(keyframes) || (type === "spring" && velocity);
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/animation/animators/BaseAnimation.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Maximum time allowed between an animation being created and it being
|
|
* resolved for us to use the latter as the start time.
|
|
*
|
|
* This is to ensure that while we prefer to "start" an animation as soon
|
|
* as it's triggered, we also want to avoid a visual jump if there's a big delay
|
|
* between these two moments.
|
|
*/
|
|
const MAX_RESOLVE_DELAY = 40;
|
|
class BaseAnimation {
|
|
constructor({ autoplay = true, delay = 0, type = "keyframes", repeat = 0, repeatDelay = 0, repeatType = "loop", ...options }) {
|
|
// Track whether the animation has been stopped. Stopped animations won't restart.
|
|
this.isStopped = false;
|
|
this.hasAttemptedResolve = false;
|
|
this.createdAt = time.now();
|
|
this.options = {
|
|
autoplay,
|
|
delay,
|
|
type,
|
|
repeat,
|
|
repeatDelay,
|
|
repeatType,
|
|
...options,
|
|
};
|
|
this.updateFinishedPromise();
|
|
}
|
|
/**
|
|
* This method uses the createdAt and resolvedAt to calculate the
|
|
* animation startTime. *Ideally*, we would use the createdAt time as t=0
|
|
* as the following frame would then be the first frame of the animation in
|
|
* progress, which would feel snappier.
|
|
*
|
|
* However, if there's a delay (main thread work) between the creation of
|
|
* the animation and the first commited frame, we prefer to use resolvedAt
|
|
* to avoid a sudden jump into the animation.
|
|
*/
|
|
calcStartTime() {
|
|
if (!this.resolvedAt)
|
|
return this.createdAt;
|
|
return this.resolvedAt - this.createdAt > MAX_RESOLVE_DELAY
|
|
? this.resolvedAt
|
|
: this.createdAt;
|
|
}
|
|
/**
|
|
* A getter for resolved data. If keyframes are not yet resolved, accessing
|
|
* this.resolved will synchronously flush all pending keyframe resolvers.
|
|
* This is a deoptimisation, but at its worst still batches read/writes.
|
|
*/
|
|
get resolved() {
|
|
if (!this._resolved && !this.hasAttemptedResolve) {
|
|
flushKeyframeResolvers();
|
|
}
|
|
return this._resolved;
|
|
}
|
|
/**
|
|
* A method to be called when the keyframes resolver completes. This method
|
|
* will check if its possible to run the animation and, if not, skip it.
|
|
* Otherwise, it will call initPlayback on the implementing class.
|
|
*/
|
|
onKeyframesResolved(keyframes, finalKeyframe) {
|
|
this.resolvedAt = time.now();
|
|
this.hasAttemptedResolve = true;
|
|
const { name, type, velocity, delay, onComplete, onUpdate, isGenerator, } = this.options;
|
|
/**
|
|
* If we can't animate this value with the resolved keyframes
|
|
* then we should complete it immediately.
|
|
*/
|
|
if (!isGenerator && !canAnimate(keyframes, name, type, velocity)) {
|
|
// Finish immediately
|
|
if (instantAnimationState.current || !delay) {
|
|
onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(getFinalKeyframe(keyframes, this.options, finalKeyframe));
|
|
onComplete === null || onComplete === void 0 ? void 0 : onComplete();
|
|
this.resolveFinishedPromise();
|
|
return;
|
|
}
|
|
// Finish after a delay
|
|
else {
|
|
this.options.duration = 0;
|
|
}
|
|
}
|
|
const resolvedAnimation = this.initPlayback(keyframes, finalKeyframe);
|
|
if (resolvedAnimation === false)
|
|
return;
|
|
this._resolved = {
|
|
keyframes,
|
|
finalKeyframe,
|
|
...resolvedAnimation,
|
|
};
|
|
this.onPostResolved();
|
|
}
|
|
onPostResolved() { }
|
|
/**
|
|
* Allows the returned animation to be awaited or promise-chained. Currently
|
|
* resolves when the animation finishes at all but in a future update could/should
|
|
* reject if its cancels.
|
|
*/
|
|
then(resolve, reject) {
|
|
return this.currentFinishedPromise.then(resolve, reject);
|
|
}
|
|
updateFinishedPromise() {
|
|
this.currentFinishedPromise = new Promise((resolve) => {
|
|
this.resolveFinishedPromise = resolve;
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/velocity-per-second.mjs
|
|
/*
|
|
Convert velocity into velocity per second
|
|
|
|
@param [number]: Unit per frame
|
|
@param [number]: Frame duration in ms
|
|
*/
|
|
function velocityPerSecond(velocity, frameDuration) {
|
|
return frameDuration ? velocity * (1000 / frameDuration) : 0;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/animation/generators/utils/velocity.mjs
|
|
|
|
|
|
const velocitySampleDuration = 5; // ms
|
|
function calcGeneratorVelocity(resolveValue, t, current) {
|
|
const prevT = Math.max(t - velocitySampleDuration, 0);
|
|
return velocityPerSecond(current - resolveValue(prevT), t - prevT);
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/animation/generators/spring/find.mjs
|
|
|
|
|
|
|
|
|
|
const safeMin = 0.001;
|
|
const minDuration = 0.01;
|
|
const maxDuration = 10.0;
|
|
const minDamping = 0.05;
|
|
const maxDamping = 1;
|
|
function findSpring({ duration = 800, bounce = 0.25, velocity = 0, mass = 1, }) {
|
|
let envelope;
|
|
let derivative;
|
|
warning(duration <= secondsToMilliseconds(maxDuration), "Spring duration must be 10 seconds or less");
|
|
let dampingRatio = 1 - bounce;
|
|
/**
|
|
* Restrict dampingRatio and duration to within acceptable ranges.
|
|
*/
|
|
dampingRatio = clamp(minDamping, maxDamping, dampingRatio);
|
|
duration = clamp(minDuration, maxDuration, millisecondsToSeconds(duration));
|
|
if (dampingRatio < 1) {
|
|
/**
|
|
* Underdamped spring
|
|
*/
|
|
envelope = (undampedFreq) => {
|
|
const exponentialDecay = undampedFreq * dampingRatio;
|
|
const delta = exponentialDecay * duration;
|
|
const a = exponentialDecay - velocity;
|
|
const b = calcAngularFreq(undampedFreq, dampingRatio);
|
|
const c = Math.exp(-delta);
|
|
return safeMin - (a / b) * c;
|
|
};
|
|
derivative = (undampedFreq) => {
|
|
const exponentialDecay = undampedFreq * dampingRatio;
|
|
const delta = exponentialDecay * duration;
|
|
const d = delta * velocity + velocity;
|
|
const e = Math.pow(dampingRatio, 2) * Math.pow(undampedFreq, 2) * duration;
|
|
const f = Math.exp(-delta);
|
|
const g = calcAngularFreq(Math.pow(undampedFreq, 2), dampingRatio);
|
|
const factor = -envelope(undampedFreq) + safeMin > 0 ? -1 : 1;
|
|
return (factor * ((d - e) * f)) / g;
|
|
};
|
|
}
|
|
else {
|
|
/**
|
|
* Critically-damped spring
|
|
*/
|
|
envelope = (undampedFreq) => {
|
|
const a = Math.exp(-undampedFreq * duration);
|
|
const b = (undampedFreq - velocity) * duration + 1;
|
|
return -safeMin + a * b;
|
|
};
|
|
derivative = (undampedFreq) => {
|
|
const a = Math.exp(-undampedFreq * duration);
|
|
const b = (velocity - undampedFreq) * (duration * duration);
|
|
return a * b;
|
|
};
|
|
}
|
|
const initialGuess = 5 / duration;
|
|
const undampedFreq = approximateRoot(envelope, derivative, initialGuess);
|
|
duration = secondsToMilliseconds(duration);
|
|
if (isNaN(undampedFreq)) {
|
|
return {
|
|
stiffness: 100,
|
|
damping: 10,
|
|
duration,
|
|
};
|
|
}
|
|
else {
|
|
const stiffness = Math.pow(undampedFreq, 2) * mass;
|
|
return {
|
|
stiffness,
|
|
damping: dampingRatio * 2 * Math.sqrt(mass * stiffness),
|
|
duration,
|
|
};
|
|
}
|
|
}
|
|
const rootIterations = 12;
|
|
function approximateRoot(envelope, derivative, initialGuess) {
|
|
let result = initialGuess;
|
|
for (let i = 1; i < rootIterations; i++) {
|
|
result = result - envelope(result) / derivative(result);
|
|
}
|
|
return result;
|
|
}
|
|
function calcAngularFreq(undampedFreq, dampingRatio) {
|
|
return undampedFreq * Math.sqrt(1 - dampingRatio * dampingRatio);
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/animation/generators/spring/index.mjs
|
|
|
|
|
|
|
|
|
|
const durationKeys = ["duration", "bounce"];
|
|
const physicsKeys = ["stiffness", "damping", "mass"];
|
|
function isSpringType(options, keys) {
|
|
return keys.some((key) => options[key] !== undefined);
|
|
}
|
|
function getSpringOptions(options) {
|
|
let springOptions = {
|
|
velocity: 0.0,
|
|
stiffness: 100,
|
|
damping: 10,
|
|
mass: 1.0,
|
|
isResolvedFromDuration: false,
|
|
...options,
|
|
};
|
|
// stiffness/damping/mass overrides duration/bounce
|
|
if (!isSpringType(options, physicsKeys) &&
|
|
isSpringType(options, durationKeys)) {
|
|
const derived = findSpring(options);
|
|
springOptions = {
|
|
...springOptions,
|
|
...derived,
|
|
mass: 1.0,
|
|
};
|
|
springOptions.isResolvedFromDuration = true;
|
|
}
|
|
return springOptions;
|
|
}
|
|
function spring({ keyframes, restDelta, restSpeed, ...options }) {
|
|
const origin = keyframes[0];
|
|
const target = keyframes[keyframes.length - 1];
|
|
/**
|
|
* This is the Iterator-spec return value. We ensure it's mutable rather than using a generator
|
|
* to reduce GC during animation.
|
|
*/
|
|
const state = { done: false, value: origin };
|
|
const { stiffness, damping, mass, duration, velocity, isResolvedFromDuration, } = getSpringOptions({
|
|
...options,
|
|
velocity: -millisecondsToSeconds(options.velocity || 0),
|
|
});
|
|
const initialVelocity = velocity || 0.0;
|
|
const dampingRatio = damping / (2 * Math.sqrt(stiffness * mass));
|
|
const initialDelta = target - origin;
|
|
const undampedAngularFreq = millisecondsToSeconds(Math.sqrt(stiffness / mass));
|
|
/**
|
|
* If we're working on a granular scale, use smaller defaults for determining
|
|
* when the spring is finished.
|
|
*
|
|
* These defaults have been selected emprically based on what strikes a good
|
|
* ratio between feeling good and finishing as soon as changes are imperceptible.
|
|
*/
|
|
const isGranularScale = Math.abs(initialDelta) < 5;
|
|
restSpeed || (restSpeed = isGranularScale ? 0.01 : 2);
|
|
restDelta || (restDelta = isGranularScale ? 0.005 : 0.5);
|
|
let resolveSpring;
|
|
if (dampingRatio < 1) {
|
|
const angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio);
|
|
// Underdamped spring
|
|
resolveSpring = (t) => {
|
|
const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
|
|
return (target -
|
|
envelope *
|
|
(((initialVelocity +
|
|
dampingRatio * undampedAngularFreq * initialDelta) /
|
|
angularFreq) *
|
|
Math.sin(angularFreq * t) +
|
|
initialDelta * Math.cos(angularFreq * t)));
|
|
};
|
|
}
|
|
else if (dampingRatio === 1) {
|
|
// Critically damped spring
|
|
resolveSpring = (t) => target -
|
|
Math.exp(-undampedAngularFreq * t) *
|
|
(initialDelta +
|
|
(initialVelocity + undampedAngularFreq * initialDelta) * t);
|
|
}
|
|
else {
|
|
// Overdamped spring
|
|
const dampedAngularFreq = undampedAngularFreq * Math.sqrt(dampingRatio * dampingRatio - 1);
|
|
resolveSpring = (t) => {
|
|
const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
|
|
// When performing sinh or cosh values can hit Infinity so we cap them here
|
|
const freqForT = Math.min(dampedAngularFreq * t, 300);
|
|
return (target -
|
|
(envelope *
|
|
((initialVelocity +
|
|
dampingRatio * undampedAngularFreq * initialDelta) *
|
|
Math.sinh(freqForT) +
|
|
dampedAngularFreq *
|
|
initialDelta *
|
|
Math.cosh(freqForT))) /
|
|
dampedAngularFreq);
|
|
};
|
|
}
|
|
return {
|
|
calculatedDuration: isResolvedFromDuration ? duration || null : null,
|
|
next: (t) => {
|
|
const current = resolveSpring(t);
|
|
if (!isResolvedFromDuration) {
|
|
let currentVelocity = 0.0;
|
|
/**
|
|
* We only need to calculate velocity for under-damped springs
|
|
* as over- and critically-damped springs can't overshoot, so
|
|
* checking only for displacement is enough.
|
|
*/
|
|
if (dampingRatio < 1) {
|
|
currentVelocity =
|
|
t === 0
|
|
? secondsToMilliseconds(initialVelocity)
|
|
: calcGeneratorVelocity(resolveSpring, t, current);
|
|
}
|
|
const isBelowVelocityThreshold = Math.abs(currentVelocity) <= restSpeed;
|
|
const isBelowDisplacementThreshold = Math.abs(target - current) <= restDelta;
|
|
state.done =
|
|
isBelowVelocityThreshold && isBelowDisplacementThreshold;
|
|
}
|
|
else {
|
|
state.done = t >= duration;
|
|
}
|
|
state.value = state.done ? target : current;
|
|
return state;
|
|
},
|
|
};
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/animation/generators/inertia.mjs
|
|
|
|
|
|
|
|
function inertia({ keyframes, velocity = 0.0, power = 0.8, timeConstant = 325, bounceDamping = 10, bounceStiffness = 500, modifyTarget, min, max, restDelta = 0.5, restSpeed, }) {
|
|
const origin = keyframes[0];
|
|
const state = {
|
|
done: false,
|
|
value: origin,
|
|
};
|
|
const isOutOfBounds = (v) => (min !== undefined && v < min) || (max !== undefined && v > max);
|
|
const nearestBoundary = (v) => {
|
|
if (min === undefined)
|
|
return max;
|
|
if (max === undefined)
|
|
return min;
|
|
return Math.abs(min - v) < Math.abs(max - v) ? min : max;
|
|
};
|
|
let amplitude = power * velocity;
|
|
const ideal = origin + amplitude;
|
|
const target = modifyTarget === undefined ? ideal : modifyTarget(ideal);
|
|
/**
|
|
* If the target has changed we need to re-calculate the amplitude, otherwise
|
|
* the animation will start from the wrong position.
|
|
*/
|
|
if (target !== ideal)
|
|
amplitude = target - origin;
|
|
const calcDelta = (t) => -amplitude * Math.exp(-t / timeConstant);
|
|
const calcLatest = (t) => target + calcDelta(t);
|
|
const applyFriction = (t) => {
|
|
const delta = calcDelta(t);
|
|
const latest = calcLatest(t);
|
|
state.done = Math.abs(delta) <= restDelta;
|
|
state.value = state.done ? target : latest;
|
|
};
|
|
/**
|
|
* Ideally this would resolve for t in a stateless way, we could
|
|
* do that by always precalculating the animation but as we know
|
|
* this will be done anyway we can assume that spring will
|
|
* be discovered during that.
|
|
*/
|
|
let timeReachedBoundary;
|
|
let spring$1;
|
|
const checkCatchBoundary = (t) => {
|
|
if (!isOutOfBounds(state.value))
|
|
return;
|
|
timeReachedBoundary = t;
|
|
spring$1 = spring({
|
|
keyframes: [state.value, nearestBoundary(state.value)],
|
|
velocity: calcGeneratorVelocity(calcLatest, t, state.value), // TODO: This should be passing * 1000
|
|
damping: bounceDamping,
|
|
stiffness: bounceStiffness,
|
|
restDelta,
|
|
restSpeed,
|
|
});
|
|
};
|
|
checkCatchBoundary(0);
|
|
return {
|
|
calculatedDuration: null,
|
|
next: (t) => {
|
|
/**
|
|
* We need to resolve the friction to figure out if we need a
|
|
* spring but we don't want to do this twice per frame. So here
|
|
* we flag if we updated for this frame and later if we did
|
|
* we can skip doing it again.
|
|
*/
|
|
let hasUpdatedFrame = false;
|
|
if (!spring$1 && timeReachedBoundary === undefined) {
|
|
hasUpdatedFrame = true;
|
|
applyFriction(t);
|
|
checkCatchBoundary(t);
|
|
}
|
|
/**
|
|
* If we have a spring and the provided t is beyond the moment the friction
|
|
* animation crossed the min/max boundary, use the spring.
|
|
*/
|
|
if (timeReachedBoundary !== undefined && t >= timeReachedBoundary) {
|
|
return spring$1.next(t - timeReachedBoundary);
|
|
}
|
|
else {
|
|
!hasUpdatedFrame && applyFriction(t);
|
|
return state;
|
|
}
|
|
},
|
|
};
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/easing/cubic-bezier.mjs
|
|
|
|
|
|
/*
|
|
Bezier function generator
|
|
This has been modified from Gaëtan Renaudeau's BezierEasing
|
|
https://github.com/gre/bezier-easing/blob/master/src/index.js
|
|
https://github.com/gre/bezier-easing/blob/master/LICENSE
|
|
|
|
I've removed the newtonRaphsonIterate algo because in benchmarking it
|
|
wasn't noticiably faster than binarySubdivision, indeed removing it
|
|
usually improved times, depending on the curve.
|
|
I also removed the lookup table, as for the added bundle size and loop we're
|
|
only cutting ~4 or so subdivision iterations. I bumped the max iterations up
|
|
to 12 to compensate and this still tended to be faster for no perceivable
|
|
loss in accuracy.
|
|
Usage
|
|
const easeOut = cubicBezier(.17,.67,.83,.67);
|
|
const x = easeOut(0.5); // returns 0.627...
|
|
*/
|
|
// Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.
|
|
const calcBezier = (t, a1, a2) => (((1.0 - 3.0 * a2 + 3.0 * a1) * t + (3.0 * a2 - 6.0 * a1)) * t + 3.0 * a1) *
|
|
t;
|
|
const subdivisionPrecision = 0.0000001;
|
|
const subdivisionMaxIterations = 12;
|
|
function binarySubdivide(x, lowerBound, upperBound, mX1, mX2) {
|
|
let currentX;
|
|
let currentT;
|
|
let i = 0;
|
|
do {
|
|
currentT = lowerBound + (upperBound - lowerBound) / 2.0;
|
|
currentX = calcBezier(currentT, mX1, mX2) - x;
|
|
if (currentX > 0.0) {
|
|
upperBound = currentT;
|
|
}
|
|
else {
|
|
lowerBound = currentT;
|
|
}
|
|
} while (Math.abs(currentX) > subdivisionPrecision &&
|
|
++i < subdivisionMaxIterations);
|
|
return currentT;
|
|
}
|
|
function cubicBezier(mX1, mY1, mX2, mY2) {
|
|
// If this is a linear gradient, return linear easing
|
|
if (mX1 === mY1 && mX2 === mY2)
|
|
return noop/* noop */.l;
|
|
const getTForX = (aX) => binarySubdivide(aX, 0, 1, mX1, mX2);
|
|
// If animation is at start/end, return t without easing
|
|
return (t) => t === 0 || t === 1 ? t : calcBezier(getTForX(t), mY1, mY2);
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/easing/ease.mjs
|
|
|
|
|
|
const easeIn = cubicBezier(0.42, 0, 1, 1);
|
|
const easeOut = cubicBezier(0, 0, 0.58, 1);
|
|
const easeInOut = cubicBezier(0.42, 0, 0.58, 1);
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/easing/utils/is-easing-array.mjs
|
|
const isEasingArray = (ease) => {
|
|
return Array.isArray(ease) && typeof ease[0] !== "number";
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/easing/modifiers/mirror.mjs
|
|
// Accepts an easing function and returns a new one that outputs mirrored values for
|
|
// the second half of the animation. Turns easeIn into easeInOut.
|
|
const mirrorEasing = (easing) => (p) => p <= 0.5 ? easing(2 * p) / 2 : (2 - easing(2 * (1 - p))) / 2;
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/easing/modifiers/reverse.mjs
|
|
// Accepts an easing function and returns a new one that outputs reversed values.
|
|
// Turns easeIn into easeOut.
|
|
const reverseEasing = (easing) => (p) => 1 - easing(1 - p);
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/easing/circ.mjs
|
|
|
|
|
|
|
|
const circIn = (p) => 1 - Math.sin(Math.acos(p));
|
|
const circOut = reverseEasing(circIn);
|
|
const circInOut = mirrorEasing(circIn);
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/easing/back.mjs
|
|
|
|
|
|
|
|
|
|
const backOut = cubicBezier(0.33, 1.53, 0.69, 0.99);
|
|
const backIn = reverseEasing(backOut);
|
|
const backInOut = mirrorEasing(backIn);
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/easing/anticipate.mjs
|
|
|
|
|
|
const anticipate = (p) => (p *= 2) < 1 ? 0.5 * backIn(p) : 0.5 * (2 - Math.pow(2, -10 * (p - 1)));
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/easing/utils/map.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const easingLookup = {
|
|
linear: noop/* noop */.l,
|
|
easeIn: easeIn,
|
|
easeInOut: easeInOut,
|
|
easeOut: easeOut,
|
|
circIn: circIn,
|
|
circInOut: circInOut,
|
|
circOut: circOut,
|
|
backIn: backIn,
|
|
backInOut: backInOut,
|
|
backOut: backOut,
|
|
anticipate: anticipate,
|
|
};
|
|
const easingDefinitionToFunction = (definition) => {
|
|
if (Array.isArray(definition)) {
|
|
// If cubic bezier definition, create bezier curve
|
|
invariant(definition.length === 4, `Cubic bezier arrays must contain four numerical values.`);
|
|
const [x1, y1, x2, y2] = definition;
|
|
return cubicBezier(x1, y1, x2, y2);
|
|
}
|
|
else if (typeof definition === "string") {
|
|
// Else lookup from table
|
|
invariant(easingLookup[definition] !== undefined, `Invalid easing type '${definition}'`);
|
|
return easingLookup[definition];
|
|
}
|
|
return definition;
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/progress.mjs
|
|
/*
|
|
Progress within given range
|
|
|
|
Given a lower limit and an upper limit, we return the progress
|
|
(expressed as a number 0-1) represented by the given value, and
|
|
limit that progress to within 0-1.
|
|
|
|
@param [number]: Lower limit
|
|
@param [number]: Upper limit
|
|
@param [number]: Value to find progress within given range
|
|
@return [number]: Progress of value within range as expressed 0-1
|
|
*/
|
|
const progress = (from, to, value) => {
|
|
const toFromDifference = to - from;
|
|
return toFromDifference === 0 ? 1 : (value - from) / toFromDifference;
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/mix/number.mjs
|
|
/*
|
|
Value in range from progress
|
|
|
|
Given a lower limit and an upper limit, we return the value within
|
|
that range as expressed by progress (usually a number from 0 to 1)
|
|
|
|
So progress = 0.5 would change
|
|
|
|
from -------- to
|
|
|
|
to
|
|
|
|
from ---- to
|
|
|
|
E.g. from = 10, to = 20, progress = 0.5 => 15
|
|
|
|
@param [number]: Lower limit of range
|
|
@param [number]: Upper limit of range
|
|
@param [number]: The progress between lower and upper limits expressed 0-1
|
|
@return [number]: Value as calculated from progress within range (not limited within range)
|
|
*/
|
|
const mixNumber = (from, to, progress) => {
|
|
return from + (to - from) * progress;
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/hsla-to-rgba.mjs
|
|
// Adapted from https://gist.github.com/mjackson/5311256
|
|
function hueToRgb(p, q, t) {
|
|
if (t < 0)
|
|
t += 1;
|
|
if (t > 1)
|
|
t -= 1;
|
|
if (t < 1 / 6)
|
|
return p + (q - p) * 6 * t;
|
|
if (t < 1 / 2)
|
|
return q;
|
|
if (t < 2 / 3)
|
|
return p + (q - p) * (2 / 3 - t) * 6;
|
|
return p;
|
|
}
|
|
function hslaToRgba({ hue, saturation, lightness, alpha }) {
|
|
hue /= 360;
|
|
saturation /= 100;
|
|
lightness /= 100;
|
|
let red = 0;
|
|
let green = 0;
|
|
let blue = 0;
|
|
if (!saturation) {
|
|
red = green = blue = lightness;
|
|
}
|
|
else {
|
|
const q = lightness < 0.5
|
|
? lightness * (1 + saturation)
|
|
: lightness + saturation - lightness * saturation;
|
|
const p = 2 * lightness - q;
|
|
red = hueToRgb(p, q, hue + 1 / 3);
|
|
green = hueToRgb(p, q, hue);
|
|
blue = hueToRgb(p, q, hue - 1 / 3);
|
|
}
|
|
return {
|
|
red: Math.round(red * 255),
|
|
green: Math.round(green * 255),
|
|
blue: Math.round(blue * 255),
|
|
alpha,
|
|
};
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/mix/immediate.mjs
|
|
function mixImmediate(a, b) {
|
|
return (p) => (p > 0 ? b : a);
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/mix/color.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Linear color space blending
|
|
// Explained https://www.youtube.com/watch?v=LKnqECcg6Gw
|
|
// Demonstrated http://codepen.io/osublake/pen/xGVVaN
|
|
const mixLinearColor = (from, to, v) => {
|
|
const fromExpo = from * from;
|
|
const expo = v * (to * to - fromExpo) + fromExpo;
|
|
return expo < 0 ? 0 : Math.sqrt(expo);
|
|
};
|
|
const colorTypes = [hex, rgba, hsla];
|
|
const getColorType = (v) => colorTypes.find((type) => type.test(v));
|
|
function asRGBA(color) {
|
|
const type = getColorType(color);
|
|
warning(Boolean(type), `'${color}' is not an animatable color. Use the equivalent color code instead.`);
|
|
if (!Boolean(type))
|
|
return false;
|
|
let model = type.parse(color);
|
|
if (type === hsla) {
|
|
// TODO Remove this cast - needed since Framer Motion's stricter typing
|
|
model = hslaToRgba(model);
|
|
}
|
|
return model;
|
|
}
|
|
const mixColor = (from, to) => {
|
|
const fromRGBA = asRGBA(from);
|
|
const toRGBA = asRGBA(to);
|
|
if (!fromRGBA || !toRGBA) {
|
|
return mixImmediate(from, to);
|
|
}
|
|
const blended = { ...fromRGBA };
|
|
return (v) => {
|
|
blended.red = mixLinearColor(fromRGBA.red, toRGBA.red, v);
|
|
blended.green = mixLinearColor(fromRGBA.green, toRGBA.green, v);
|
|
blended.blue = mixLinearColor(fromRGBA.blue, toRGBA.blue, v);
|
|
blended.alpha = mixNumber(fromRGBA.alpha, toRGBA.alpha, v);
|
|
return rgba.transform(blended);
|
|
};
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/mix/visibility.mjs
|
|
const invisibleValues = new Set(["none", "hidden"]);
|
|
/**
|
|
* Returns a function that, when provided a progress value between 0 and 1,
|
|
* will return the "none" or "hidden" string only when the progress is that of
|
|
* the origin or target.
|
|
*/
|
|
function mixVisibility(origin, target) {
|
|
if (invisibleValues.has(origin)) {
|
|
return (p) => (p <= 0 ? origin : target);
|
|
}
|
|
else {
|
|
return (p) => (p >= 1 ? target : origin);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/mix/complex.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function complex_mixNumber(a, b) {
|
|
return (p) => mixNumber(a, b, p);
|
|
}
|
|
function getMixer(a) {
|
|
if (typeof a === "number") {
|
|
return complex_mixNumber;
|
|
}
|
|
else if (typeof a === "string") {
|
|
return isCSSVariableToken(a)
|
|
? mixImmediate
|
|
: color.test(a)
|
|
? mixColor
|
|
: mixComplex;
|
|
}
|
|
else if (Array.isArray(a)) {
|
|
return mixArray;
|
|
}
|
|
else if (typeof a === "object") {
|
|
return color.test(a) ? mixColor : mixObject;
|
|
}
|
|
return mixImmediate;
|
|
}
|
|
function mixArray(a, b) {
|
|
const output = [...a];
|
|
const numValues = output.length;
|
|
const blendValue = a.map((v, i) => getMixer(v)(v, b[i]));
|
|
return (p) => {
|
|
for (let i = 0; i < numValues; i++) {
|
|
output[i] = blendValue[i](p);
|
|
}
|
|
return output;
|
|
};
|
|
}
|
|
function mixObject(a, b) {
|
|
const output = { ...a, ...b };
|
|
const blendValue = {};
|
|
for (const key in output) {
|
|
if (a[key] !== undefined && b[key] !== undefined) {
|
|
blendValue[key] = getMixer(a[key])(a[key], b[key]);
|
|
}
|
|
}
|
|
return (v) => {
|
|
for (const key in blendValue) {
|
|
output[key] = blendValue[key](v);
|
|
}
|
|
return output;
|
|
};
|
|
}
|
|
function matchOrder(origin, target) {
|
|
var _a;
|
|
const orderedOrigin = [];
|
|
const pointers = { color: 0, var: 0, number: 0 };
|
|
for (let i = 0; i < target.values.length; i++) {
|
|
const type = target.types[i];
|
|
const originIndex = origin.indexes[type][pointers[type]];
|
|
const originValue = (_a = origin.values[originIndex]) !== null && _a !== void 0 ? _a : 0;
|
|
orderedOrigin[i] = originValue;
|
|
pointers[type]++;
|
|
}
|
|
return orderedOrigin;
|
|
}
|
|
const mixComplex = (origin, target) => {
|
|
const template = complex.createTransformer(target);
|
|
const originStats = analyseComplexValue(origin);
|
|
const targetStats = analyseComplexValue(target);
|
|
const canInterpolate = originStats.indexes.var.length === targetStats.indexes.var.length &&
|
|
originStats.indexes.color.length === targetStats.indexes.color.length &&
|
|
originStats.indexes.number.length >= targetStats.indexes.number.length;
|
|
if (canInterpolate) {
|
|
if ((invisibleValues.has(origin) &&
|
|
!targetStats.values.length) ||
|
|
(invisibleValues.has(target) &&
|
|
!originStats.values.length)) {
|
|
return mixVisibility(origin, target);
|
|
}
|
|
return pipe(mixArray(matchOrder(originStats, targetStats), targetStats.values), template);
|
|
}
|
|
else {
|
|
warning(true, `Complex values '${origin}' and '${target}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`);
|
|
return mixImmediate(origin, target);
|
|
}
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/mix/index.mjs
|
|
|
|
|
|
|
|
function mix(from, to, p) {
|
|
if (typeof from === "number" &&
|
|
typeof to === "number" &&
|
|
typeof p === "number") {
|
|
return mixNumber(from, to, p);
|
|
}
|
|
const mixer = getMixer(from);
|
|
return mixer(from, to);
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/interpolate.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function createMixers(output, ease, customMixer) {
|
|
const mixers = [];
|
|
const mixerFactory = customMixer || mix;
|
|
const numMixers = output.length - 1;
|
|
for (let i = 0; i < numMixers; i++) {
|
|
let mixer = mixerFactory(output[i], output[i + 1]);
|
|
if (ease) {
|
|
const easingFunction = Array.isArray(ease) ? ease[i] || noop/* noop */.l : ease;
|
|
mixer = pipe(easingFunction, mixer);
|
|
}
|
|
mixers.push(mixer);
|
|
}
|
|
return mixers;
|
|
}
|
|
/**
|
|
* Create a function that maps from a numerical input array to a generic output array.
|
|
*
|
|
* Accepts:
|
|
* - Numbers
|
|
* - Colors (hex, hsl, hsla, rgb, rgba)
|
|
* - Complex (combinations of one or more numbers or strings)
|
|
*
|
|
* ```jsx
|
|
* const mixColor = interpolate([0, 1], ['#fff', '#000'])
|
|
*
|
|
* mixColor(0.5) // 'rgba(128, 128, 128, 1)'
|
|
* ```
|
|
*
|
|
* TODO Revist this approach once we've moved to data models for values,
|
|
* probably not needed to pregenerate mixer functions.
|
|
*
|
|
* @public
|
|
*/
|
|
function interpolate(input, output, { clamp: isClamp = true, ease, mixer } = {}) {
|
|
const inputLength = input.length;
|
|
invariant(inputLength === output.length, "Both input and output ranges must be the same length");
|
|
/**
|
|
* If we're only provided a single input, we can just make a function
|
|
* that returns the output.
|
|
*/
|
|
if (inputLength === 1)
|
|
return () => output[0];
|
|
if (inputLength === 2 && input[0] === input[1])
|
|
return () => output[1];
|
|
// If input runs highest -> lowest, reverse both arrays
|
|
if (input[0] > input[inputLength - 1]) {
|
|
input = [...input].reverse();
|
|
output = [...output].reverse();
|
|
}
|
|
const mixers = createMixers(output, ease, mixer);
|
|
const numMixers = mixers.length;
|
|
const interpolator = (v) => {
|
|
let i = 0;
|
|
if (numMixers > 1) {
|
|
for (; i < input.length - 2; i++) {
|
|
if (v < input[i + 1])
|
|
break;
|
|
}
|
|
}
|
|
const progressInRange = progress(input[i], input[i + 1], v);
|
|
return mixers[i](progressInRange);
|
|
};
|
|
return isClamp
|
|
? (v) => interpolator(clamp(input[0], input[inputLength - 1], v))
|
|
: interpolator;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/offsets/fill.mjs
|
|
|
|
|
|
|
|
function fillOffset(offset, remaining) {
|
|
const min = offset[offset.length - 1];
|
|
for (let i = 1; i <= remaining; i++) {
|
|
const offsetProgress = progress(0, remaining, i);
|
|
offset.push(mixNumber(min, 1, offsetProgress));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/offsets/default.mjs
|
|
|
|
|
|
function defaultOffset(arr) {
|
|
const offset = [0];
|
|
fillOffset(offset, arr.length - 1);
|
|
return offset;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/offsets/time.mjs
|
|
function convertOffsetToTimes(offset, duration) {
|
|
return offset.map((o) => o * duration);
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/animation/generators/keyframes.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function defaultEasing(values, easing) {
|
|
return values.map(() => easing || easeInOut).splice(0, values.length - 1);
|
|
}
|
|
function keyframes({ duration = 300, keyframes: keyframeValues, times, ease = "easeInOut", }) {
|
|
/**
|
|
* Easing functions can be externally defined as strings. Here we convert them
|
|
* into actual functions.
|
|
*/
|
|
const easingFunctions = isEasingArray(ease)
|
|
? ease.map(easingDefinitionToFunction)
|
|
: easingDefinitionToFunction(ease);
|
|
/**
|
|
* This is the Iterator-spec return value. We ensure it's mutable rather than using a generator
|
|
* to reduce GC during animation.
|
|
*/
|
|
const state = {
|
|
done: false,
|
|
value: keyframeValues[0],
|
|
};
|
|
/**
|
|
* Create a times array based on the provided 0-1 offsets
|
|
*/
|
|
const absoluteTimes = convertOffsetToTimes(
|
|
// Only use the provided offsets if they're the correct length
|
|
// TODO Maybe we should warn here if there's a length mismatch
|
|
times && times.length === keyframeValues.length
|
|
? times
|
|
: defaultOffset(keyframeValues), duration);
|
|
const mapTimeToKeyframe = interpolate(absoluteTimes, keyframeValues, {
|
|
ease: Array.isArray(easingFunctions)
|
|
? easingFunctions
|
|
: defaultEasing(keyframeValues, easingFunctions),
|
|
});
|
|
return {
|
|
calculatedDuration: duration,
|
|
next: (t) => {
|
|
state.value = mapTimeToKeyframe(t);
|
|
state.done = t >= duration;
|
|
return state;
|
|
},
|
|
};
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/animation/generators/utils/calc-duration.mjs
|
|
/**
|
|
* Implement a practical max duration for keyframe generation
|
|
* to prevent infinite loops
|
|
*/
|
|
const maxGeneratorDuration = 20000;
|
|
function calcGeneratorDuration(generator) {
|
|
let duration = 0;
|
|
const timeStep = 50;
|
|
let state = generator.next(duration);
|
|
while (!state.done && duration < maxGeneratorDuration) {
|
|
duration += timeStep;
|
|
state = generator.next(duration);
|
|
}
|
|
return duration >= maxGeneratorDuration ? Infinity : duration;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/animation/animators/drivers/driver-frameloop.mjs
|
|
|
|
|
|
|
|
const frameloopDriver = (update) => {
|
|
const passTimestamp = ({ timestamp }) => update(timestamp);
|
|
return {
|
|
start: () => frameloop_frame/* frame */.Gt.update(passTimestamp, true),
|
|
stop: () => (0,frameloop_frame/* cancelFrame */.WG)(passTimestamp),
|
|
/**
|
|
* If we're processing this frame we can use the
|
|
* framelocked timestamp to keep things in sync.
|
|
*/
|
|
now: () => (frameloop_frame/* frameData */.uv.isProcessing ? frameloop_frame/* frameData */.uv.timestamp : time.now()),
|
|
};
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/animation/animators/MainThreadAnimation.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const generators = {
|
|
decay: inertia,
|
|
inertia: inertia,
|
|
tween: keyframes,
|
|
keyframes: keyframes,
|
|
spring: spring,
|
|
};
|
|
const percentToProgress = (percent) => percent / 100;
|
|
/**
|
|
* Animation that runs on the main thread. Designed to be WAAPI-spec in the subset of
|
|
* features we expose publically. Mostly the compatibility is to ensure visual identity
|
|
* between both WAAPI and main thread animations.
|
|
*/
|
|
class MainThreadAnimation extends BaseAnimation {
|
|
constructor(options) {
|
|
super(options);
|
|
/**
|
|
* The time at which the animation was paused.
|
|
*/
|
|
this.holdTime = null;
|
|
/**
|
|
* The time at which the animation was cancelled.
|
|
*/
|
|
this.cancelTime = null;
|
|
/**
|
|
* The current time of the animation.
|
|
*/
|
|
this.currentTime = 0;
|
|
/**
|
|
* Playback speed as a factor. 0 would be stopped, -1 reverse and 2 double speed.
|
|
*/
|
|
this.playbackSpeed = 1;
|
|
/**
|
|
* The state of the animation to apply when the animation is resolved. This
|
|
* allows calls to the public API to control the animation before it is resolved,
|
|
* without us having to resolve it first.
|
|
*/
|
|
this.pendingPlayState = "running";
|
|
/**
|
|
* The time at which the animation was started.
|
|
*/
|
|
this.startTime = null;
|
|
this.state = "idle";
|
|
/**
|
|
* This method is bound to the instance to fix a pattern where
|
|
* animation.stop is returned as a reference from a useEffect.
|
|
*/
|
|
this.stop = () => {
|
|
this.resolver.cancel();
|
|
this.isStopped = true;
|
|
if (this.state === "idle")
|
|
return;
|
|
this.teardown();
|
|
const { onStop } = this.options;
|
|
onStop && onStop();
|
|
};
|
|
const { name, motionValue, element, keyframes } = this.options;
|
|
const KeyframeResolver$1 = (element === null || element === void 0 ? void 0 : element.KeyframeResolver) || KeyframeResolver;
|
|
const onResolved = (resolvedKeyframes, finalKeyframe) => this.onKeyframesResolved(resolvedKeyframes, finalKeyframe);
|
|
this.resolver = new KeyframeResolver$1(keyframes, onResolved, name, motionValue, element);
|
|
this.resolver.scheduleResolve();
|
|
}
|
|
initPlayback(keyframes$1) {
|
|
const { type = "keyframes", repeat = 0, repeatDelay = 0, repeatType, velocity = 0, } = this.options;
|
|
const generatorFactory = generators[type] || keyframes;
|
|
/**
|
|
* If our generator doesn't support mixing numbers, we need to replace keyframes with
|
|
* [0, 100] and then make a function that maps that to the actual keyframes.
|
|
*
|
|
* 100 is chosen instead of 1 as it works nicer with spring animations.
|
|
*/
|
|
let mapPercentToKeyframes;
|
|
let mirroredGenerator;
|
|
if (generatorFactory !== keyframes &&
|
|
typeof keyframes$1[0] !== "number") {
|
|
if (false) {}
|
|
mapPercentToKeyframes = pipe(percentToProgress, mix(keyframes$1[0], keyframes$1[1]));
|
|
keyframes$1 = [0, 100];
|
|
}
|
|
const generator = generatorFactory({ ...this.options, keyframes: keyframes$1 });
|
|
/**
|
|
* If we have a mirror repeat type we need to create a second generator that outputs the
|
|
* mirrored (not reversed) animation and later ping pong between the two generators.
|
|
*/
|
|
if (repeatType === "mirror") {
|
|
mirroredGenerator = generatorFactory({
|
|
...this.options,
|
|
keyframes: [...keyframes$1].reverse(),
|
|
velocity: -velocity,
|
|
});
|
|
}
|
|
/**
|
|
* If duration is undefined and we have repeat options,
|
|
* we need to calculate a duration from the generator.
|
|
*
|
|
* We set it to the generator itself to cache the duration.
|
|
* Any timeline resolver will need to have already precalculated
|
|
* the duration by this step.
|
|
*/
|
|
if (generator.calculatedDuration === null) {
|
|
generator.calculatedDuration = calcGeneratorDuration(generator);
|
|
}
|
|
const { calculatedDuration } = generator;
|
|
const resolvedDuration = calculatedDuration + repeatDelay;
|
|
const totalDuration = resolvedDuration * (repeat + 1) - repeatDelay;
|
|
return {
|
|
generator,
|
|
mirroredGenerator,
|
|
mapPercentToKeyframes,
|
|
calculatedDuration,
|
|
resolvedDuration,
|
|
totalDuration,
|
|
};
|
|
}
|
|
onPostResolved() {
|
|
const { autoplay = true } = this.options;
|
|
this.play();
|
|
if (this.pendingPlayState === "paused" || !autoplay) {
|
|
this.pause();
|
|
}
|
|
else {
|
|
this.state = this.pendingPlayState;
|
|
}
|
|
}
|
|
tick(timestamp, sample = false) {
|
|
const { resolved } = this;
|
|
// If the animations has failed to resolve, return the final keyframe.
|
|
if (!resolved) {
|
|
const { keyframes } = this.options;
|
|
return { done: true, value: keyframes[keyframes.length - 1] };
|
|
}
|
|
const { finalKeyframe, generator, mirroredGenerator, mapPercentToKeyframes, keyframes, calculatedDuration, totalDuration, resolvedDuration, } = resolved;
|
|
if (this.startTime === null)
|
|
return generator.next(0);
|
|
const { delay, repeat, repeatType, repeatDelay, onUpdate } = this.options;
|
|
/**
|
|
* requestAnimationFrame timestamps can come through as lower than
|
|
* the startTime as set by performance.now(). Here we prevent this,
|
|
* though in the future it could be possible to make setting startTime
|
|
* a pending operation that gets resolved here.
|
|
*/
|
|
if (this.speed > 0) {
|
|
this.startTime = Math.min(this.startTime, timestamp);
|
|
}
|
|
else if (this.speed < 0) {
|
|
this.startTime = Math.min(timestamp - totalDuration / this.speed, this.startTime);
|
|
}
|
|
// Update currentTime
|
|
if (sample) {
|
|
this.currentTime = timestamp;
|
|
}
|
|
else if (this.holdTime !== null) {
|
|
this.currentTime = this.holdTime;
|
|
}
|
|
else {
|
|
// Rounding the time because floating point arithmetic is not always accurate, e.g. 3000.367 - 1000.367 =
|
|
// 2000.0000000000002. This is a problem when we are comparing the currentTime with the duration, for
|
|
// example.
|
|
this.currentTime =
|
|
Math.round(timestamp - this.startTime) * this.speed;
|
|
}
|
|
// Rebase on delay
|
|
const timeWithoutDelay = this.currentTime - delay * (this.speed >= 0 ? 1 : -1);
|
|
const isInDelayPhase = this.speed >= 0
|
|
? timeWithoutDelay < 0
|
|
: timeWithoutDelay > totalDuration;
|
|
this.currentTime = Math.max(timeWithoutDelay, 0);
|
|
// If this animation has finished, set the current time to the total duration.
|
|
if (this.state === "finished" && this.holdTime === null) {
|
|
this.currentTime = totalDuration;
|
|
}
|
|
let elapsed = this.currentTime;
|
|
let frameGenerator = generator;
|
|
if (repeat) {
|
|
/**
|
|
* Get the current progress (0-1) of the animation. If t is >
|
|
* than duration we'll get values like 2.5 (midway through the
|
|
* third iteration)
|
|
*/
|
|
const progress = Math.min(this.currentTime, totalDuration) / resolvedDuration;
|
|
/**
|
|
* Get the current iteration (0 indexed). For instance the floor of
|
|
* 2.5 is 2.
|
|
*/
|
|
let currentIteration = Math.floor(progress);
|
|
/**
|
|
* Get the current progress of the iteration by taking the remainder
|
|
* so 2.5 is 0.5 through iteration 2
|
|
*/
|
|
let iterationProgress = progress % 1.0;
|
|
/**
|
|
* If iteration progress is 1 we count that as the end
|
|
* of the previous iteration.
|
|
*/
|
|
if (!iterationProgress && progress >= 1) {
|
|
iterationProgress = 1;
|
|
}
|
|
iterationProgress === 1 && currentIteration--;
|
|
currentIteration = Math.min(currentIteration, repeat + 1);
|
|
/**
|
|
* Reverse progress if we're not running in "normal" direction
|
|
*/
|
|
const isOddIteration = Boolean(currentIteration % 2);
|
|
if (isOddIteration) {
|
|
if (repeatType === "reverse") {
|
|
iterationProgress = 1 - iterationProgress;
|
|
if (repeatDelay) {
|
|
iterationProgress -= repeatDelay / resolvedDuration;
|
|
}
|
|
}
|
|
else if (repeatType === "mirror") {
|
|
frameGenerator = mirroredGenerator;
|
|
}
|
|
}
|
|
elapsed = clamp(0, 1, iterationProgress) * resolvedDuration;
|
|
}
|
|
/**
|
|
* If we're in negative time, set state as the initial keyframe.
|
|
* This prevents delay: x, duration: 0 animations from finishing
|
|
* instantly.
|
|
*/
|
|
const state = isInDelayPhase
|
|
? { done: false, value: keyframes[0] }
|
|
: frameGenerator.next(elapsed);
|
|
if (mapPercentToKeyframes) {
|
|
state.value = mapPercentToKeyframes(state.value);
|
|
}
|
|
let { done } = state;
|
|
if (!isInDelayPhase && calculatedDuration !== null) {
|
|
done =
|
|
this.speed >= 0
|
|
? this.currentTime >= totalDuration
|
|
: this.currentTime <= 0;
|
|
}
|
|
const isAnimationFinished = this.holdTime === null &&
|
|
(this.state === "finished" || (this.state === "running" && done));
|
|
if (isAnimationFinished && finalKeyframe !== undefined) {
|
|
state.value = getFinalKeyframe(keyframes, this.options, finalKeyframe);
|
|
}
|
|
if (onUpdate) {
|
|
onUpdate(state.value);
|
|
}
|
|
if (isAnimationFinished) {
|
|
this.finish();
|
|
}
|
|
return state;
|
|
}
|
|
get duration() {
|
|
const { resolved } = this;
|
|
return resolved ? millisecondsToSeconds(resolved.calculatedDuration) : 0;
|
|
}
|
|
get time() {
|
|
return millisecondsToSeconds(this.currentTime);
|
|
}
|
|
set time(newTime) {
|
|
newTime = secondsToMilliseconds(newTime);
|
|
this.currentTime = newTime;
|
|
if (this.holdTime !== null || this.speed === 0) {
|
|
this.holdTime = newTime;
|
|
}
|
|
else if (this.driver) {
|
|
this.startTime = this.driver.now() - newTime / this.speed;
|
|
}
|
|
}
|
|
get speed() {
|
|
return this.playbackSpeed;
|
|
}
|
|
set speed(newSpeed) {
|
|
const hasChanged = this.playbackSpeed !== newSpeed;
|
|
this.playbackSpeed = newSpeed;
|
|
if (hasChanged) {
|
|
this.time = millisecondsToSeconds(this.currentTime);
|
|
}
|
|
}
|
|
play() {
|
|
if (!this.resolver.isScheduled) {
|
|
this.resolver.resume();
|
|
}
|
|
if (!this._resolved) {
|
|
this.pendingPlayState = "running";
|
|
return;
|
|
}
|
|
if (this.isStopped)
|
|
return;
|
|
const { driver = frameloopDriver, onPlay, startTime } = this.options;
|
|
if (!this.driver) {
|
|
this.driver = driver((timestamp) => this.tick(timestamp));
|
|
}
|
|
onPlay && onPlay();
|
|
const now = this.driver.now();
|
|
if (this.holdTime !== null) {
|
|
this.startTime = now - this.holdTime;
|
|
}
|
|
else if (!this.startTime) {
|
|
this.startTime = startTime !== null && startTime !== void 0 ? startTime : this.calcStartTime();
|
|
}
|
|
else if (this.state === "finished") {
|
|
this.startTime = now;
|
|
}
|
|
if (this.state === "finished") {
|
|
this.updateFinishedPromise();
|
|
}
|
|
this.cancelTime = this.startTime;
|
|
this.holdTime = null;
|
|
/**
|
|
* Set playState to running only after we've used it in
|
|
* the previous logic.
|
|
*/
|
|
this.state = "running";
|
|
this.driver.start();
|
|
}
|
|
pause() {
|
|
var _a;
|
|
if (!this._resolved) {
|
|
this.pendingPlayState = "paused";
|
|
return;
|
|
}
|
|
this.state = "paused";
|
|
this.holdTime = (_a = this.currentTime) !== null && _a !== void 0 ? _a : 0;
|
|
}
|
|
complete() {
|
|
if (this.state !== "running") {
|
|
this.play();
|
|
}
|
|
this.pendingPlayState = this.state = "finished";
|
|
this.holdTime = null;
|
|
}
|
|
finish() {
|
|
this.teardown();
|
|
this.state = "finished";
|
|
const { onComplete } = this.options;
|
|
onComplete && onComplete();
|
|
}
|
|
cancel() {
|
|
if (this.cancelTime !== null) {
|
|
this.tick(this.cancelTime);
|
|
}
|
|
this.teardown();
|
|
this.updateFinishedPromise();
|
|
}
|
|
teardown() {
|
|
this.state = "idle";
|
|
this.stopDriver();
|
|
this.resolveFinishedPromise();
|
|
this.updateFinishedPromise();
|
|
this.startTime = this.cancelTime = null;
|
|
this.resolver.cancel();
|
|
}
|
|
stopDriver() {
|
|
if (!this.driver)
|
|
return;
|
|
this.driver.stop();
|
|
this.driver = undefined;
|
|
}
|
|
sample(time) {
|
|
this.startTime = 0;
|
|
return this.tick(time, true);
|
|
}
|
|
}
|
|
// Legacy interface
|
|
function animateValue(options) {
|
|
return new MainThreadAnimation(options);
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/easing/utils/is-bezier-definition.mjs
|
|
const isBezierDefinition = (easing) => Array.isArray(easing) && typeof easing[0] === "number";
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/animation/animators/waapi/easing.mjs
|
|
|
|
|
|
function isWaapiSupportedEasing(easing) {
|
|
return Boolean(!easing ||
|
|
(typeof easing === "string" && easing in supportedWaapiEasing) ||
|
|
isBezierDefinition(easing) ||
|
|
(Array.isArray(easing) && easing.every(isWaapiSupportedEasing)));
|
|
}
|
|
const cubicBezierAsString = ([a, b, c, d]) => `cubic-bezier(${a}, ${b}, ${c}, ${d})`;
|
|
const supportedWaapiEasing = {
|
|
linear: "linear",
|
|
ease: "ease",
|
|
easeIn: "ease-in",
|
|
easeOut: "ease-out",
|
|
easeInOut: "ease-in-out",
|
|
circIn: cubicBezierAsString([0, 0.65, 0.55, 1]),
|
|
circOut: cubicBezierAsString([0.55, 0, 1, 0.45]),
|
|
backIn: cubicBezierAsString([0.31, 0.01, 0.66, -0.59]),
|
|
backOut: cubicBezierAsString([0.33, 1.53, 0.69, 0.99]),
|
|
};
|
|
function mapEasingToNativeEasingWithDefault(easing) {
|
|
return (mapEasingToNativeEasing(easing) ||
|
|
supportedWaapiEasing.easeOut);
|
|
}
|
|
function mapEasingToNativeEasing(easing) {
|
|
if (!easing) {
|
|
return undefined;
|
|
}
|
|
else if (isBezierDefinition(easing)) {
|
|
return cubicBezierAsString(easing);
|
|
}
|
|
else if (Array.isArray(easing)) {
|
|
return easing.map(mapEasingToNativeEasingWithDefault);
|
|
}
|
|
else {
|
|
return supportedWaapiEasing[easing];
|
|
}
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/animation/animators/waapi/index.mjs
|
|
|
|
|
|
function animateStyle(element, valueName, keyframes, { delay = 0, duration = 300, repeat = 0, repeatType = "loop", ease, times, } = {}) {
|
|
const keyframeOptions = { [valueName]: keyframes };
|
|
if (times)
|
|
keyframeOptions.offset = times;
|
|
const easing = mapEasingToNativeEasing(ease);
|
|
/**
|
|
* If this is an easing array, apply to keyframes, not animation as a whole
|
|
*/
|
|
if (Array.isArray(easing))
|
|
keyframeOptions.easing = easing;
|
|
return element.animate(keyframeOptions, {
|
|
delay,
|
|
duration,
|
|
easing: !Array.isArray(easing) ? easing : "linear",
|
|
fill: "both",
|
|
iterations: repeat + 1,
|
|
direction: repeatType === "reverse" ? "alternate" : "normal",
|
|
});
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/animation/animators/AcceleratedAnimation.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const supportsWaapi = memo(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
|
|
/**
|
|
* 10ms is chosen here as it strikes a balance between smooth
|
|
* results (more than one keyframe per frame at 60fps) and
|
|
* keyframe quantity.
|
|
*/
|
|
const sampleDelta = 10; //ms
|
|
/**
|
|
* Implement a practical max duration for keyframe generation
|
|
* to prevent infinite loops
|
|
*/
|
|
const AcceleratedAnimation_maxDuration = 20000;
|
|
/**
|
|
* Check if an animation can run natively via WAAPI or requires pregenerated keyframes.
|
|
* WAAPI doesn't support spring or function easings so we run these as JS animation before
|
|
* handing off.
|
|
*/
|
|
function requiresPregeneratedKeyframes(options) {
|
|
return options.type === "spring" || !isWaapiSupportedEasing(options.ease);
|
|
}
|
|
function pregenerateKeyframes(keyframes, options) {
|
|
/**
|
|
* Create a main-thread animation to pregenerate keyframes.
|
|
* We sample this at regular intervals to generate keyframes that we then
|
|
* linearly interpolate between.
|
|
*/
|
|
const sampleAnimation = new MainThreadAnimation({
|
|
...options,
|
|
keyframes,
|
|
repeat: 0,
|
|
delay: 0,
|
|
isGenerator: true,
|
|
});
|
|
let state = { done: false, value: keyframes[0] };
|
|
const pregeneratedKeyframes = [];
|
|
/**
|
|
* Bail after 20 seconds of pre-generated keyframes as it's likely
|
|
* we're heading for an infinite loop.
|
|
*/
|
|
let t = 0;
|
|
while (!state.done && t < AcceleratedAnimation_maxDuration) {
|
|
state = sampleAnimation.sample(t);
|
|
pregeneratedKeyframes.push(state.value);
|
|
t += sampleDelta;
|
|
}
|
|
return {
|
|
times: undefined,
|
|
keyframes: pregeneratedKeyframes,
|
|
duration: t - sampleDelta,
|
|
ease: "linear",
|
|
};
|
|
}
|
|
class AcceleratedAnimation extends BaseAnimation {
|
|
constructor(options) {
|
|
super(options);
|
|
const { name, motionValue, element, keyframes } = this.options;
|
|
this.resolver = new DOMKeyframesResolver(keyframes, (resolvedKeyframes, finalKeyframe) => this.onKeyframesResolved(resolvedKeyframes, finalKeyframe), name, motionValue, element);
|
|
this.resolver.scheduleResolve();
|
|
}
|
|
initPlayback(keyframes, finalKeyframe) {
|
|
var _a;
|
|
let { duration = 300, times, ease, type, motionValue, name, startTime, } = this.options;
|
|
/**
|
|
* If element has since been unmounted, return false to indicate
|
|
* the animation failed to initialised.
|
|
*/
|
|
if (!((_a = motionValue.owner) === null || _a === void 0 ? void 0 : _a.current)) {
|
|
return false;
|
|
}
|
|
/**
|
|
* If this animation needs pre-generated keyframes then generate.
|
|
*/
|
|
if (requiresPregeneratedKeyframes(this.options)) {
|
|
const { onComplete, onUpdate, motionValue, element, ...options } = this.options;
|
|
const pregeneratedAnimation = pregenerateKeyframes(keyframes, options);
|
|
keyframes = pregeneratedAnimation.keyframes;
|
|
// If this is a very short animation, ensure we have
|
|
// at least two keyframes to animate between as older browsers
|
|
// can't animate between a single keyframe.
|
|
if (keyframes.length === 1) {
|
|
keyframes[1] = keyframes[0];
|
|
}
|
|
duration = pregeneratedAnimation.duration;
|
|
times = pregeneratedAnimation.times;
|
|
ease = pregeneratedAnimation.ease;
|
|
type = "keyframes";
|
|
}
|
|
const animation = animateStyle(motionValue.owner.current, name, keyframes, { ...this.options, duration, times, ease });
|
|
// Override the browser calculated startTime with one synchronised to other JS
|
|
// and WAAPI animations starting this event loop.
|
|
animation.startTime = startTime !== null && startTime !== void 0 ? startTime : this.calcStartTime();
|
|
if (this.pendingTimeline) {
|
|
animation.timeline = this.pendingTimeline;
|
|
this.pendingTimeline = undefined;
|
|
}
|
|
else {
|
|
/**
|
|
* Prefer the `onfinish` prop as it's more widely supported than
|
|
* the `finished` promise.
|
|
*
|
|
* Here, we synchronously set the provided MotionValue to the end
|
|
* keyframe. If we didn't, when the WAAPI animation is finished it would
|
|
* be removed from the element which would then revert to its old styles.
|
|
*/
|
|
animation.onfinish = () => {
|
|
const { onComplete } = this.options;
|
|
motionValue.set(getFinalKeyframe(keyframes, this.options, finalKeyframe));
|
|
onComplete && onComplete();
|
|
this.cancel();
|
|
this.resolveFinishedPromise();
|
|
};
|
|
}
|
|
return {
|
|
animation,
|
|
duration,
|
|
times,
|
|
type,
|
|
ease,
|
|
keyframes: keyframes,
|
|
};
|
|
}
|
|
get duration() {
|
|
const { resolved } = this;
|
|
if (!resolved)
|
|
return 0;
|
|
const { duration } = resolved;
|
|
return millisecondsToSeconds(duration);
|
|
}
|
|
get time() {
|
|
const { resolved } = this;
|
|
if (!resolved)
|
|
return 0;
|
|
const { animation } = resolved;
|
|
return millisecondsToSeconds(animation.currentTime || 0);
|
|
}
|
|
set time(newTime) {
|
|
const { resolved } = this;
|
|
if (!resolved)
|
|
return;
|
|
const { animation } = resolved;
|
|
animation.currentTime = secondsToMilliseconds(newTime);
|
|
}
|
|
get speed() {
|
|
const { resolved } = this;
|
|
if (!resolved)
|
|
return 1;
|
|
const { animation } = resolved;
|
|
return animation.playbackRate;
|
|
}
|
|
set speed(newSpeed) {
|
|
const { resolved } = this;
|
|
if (!resolved)
|
|
return;
|
|
const { animation } = resolved;
|
|
animation.playbackRate = newSpeed;
|
|
}
|
|
get state() {
|
|
const { resolved } = this;
|
|
if (!resolved)
|
|
return "idle";
|
|
const { animation } = resolved;
|
|
return animation.playState;
|
|
}
|
|
get startTime() {
|
|
const { resolved } = this;
|
|
if (!resolved)
|
|
return null;
|
|
const { animation } = resolved;
|
|
// Coerce to number as TypeScript incorrectly types this
|
|
// as CSSNumberish
|
|
return animation.startTime;
|
|
}
|
|
/**
|
|
* Replace the default DocumentTimeline with another AnimationTimeline.
|
|
* Currently used for scroll animations.
|
|
*/
|
|
attachTimeline(timeline) {
|
|
if (!this._resolved) {
|
|
this.pendingTimeline = timeline;
|
|
}
|
|
else {
|
|
const { resolved } = this;
|
|
if (!resolved)
|
|
return noop/* noop */.l;
|
|
const { animation } = resolved;
|
|
animation.timeline = timeline;
|
|
animation.onfinish = null;
|
|
}
|
|
return noop/* noop */.l;
|
|
}
|
|
play() {
|
|
if (this.isStopped)
|
|
return;
|
|
const { resolved } = this;
|
|
if (!resolved)
|
|
return;
|
|
const { animation } = resolved;
|
|
if (animation.playState === "finished") {
|
|
this.updateFinishedPromise();
|
|
}
|
|
animation.play();
|
|
}
|
|
pause() {
|
|
const { resolved } = this;
|
|
if (!resolved)
|
|
return;
|
|
const { animation } = resolved;
|
|
animation.pause();
|
|
}
|
|
stop() {
|
|
this.resolver.cancel();
|
|
this.isStopped = true;
|
|
if (this.state === "idle")
|
|
return;
|
|
this.resolveFinishedPromise();
|
|
this.updateFinishedPromise();
|
|
const { resolved } = this;
|
|
if (!resolved)
|
|
return;
|
|
const { animation, keyframes, duration, type, ease, times } = resolved;
|
|
if (animation.playState === "idle" ||
|
|
animation.playState === "finished") {
|
|
return;
|
|
}
|
|
/**
|
|
* WAAPI doesn't natively have any interruption capabilities.
|
|
*
|
|
* Rather than read commited styles back out of the DOM, we can
|
|
* create a renderless JS animation and sample it twice to calculate
|
|
* its current value, "previous" value, and therefore allow
|
|
* Motion to calculate velocity for any subsequent animation.
|
|
*/
|
|
if (this.time) {
|
|
const { motionValue, onUpdate, onComplete, element, ...options } = this.options;
|
|
const sampleAnimation = new MainThreadAnimation({
|
|
...options,
|
|
keyframes,
|
|
duration,
|
|
type,
|
|
ease,
|
|
times,
|
|
isGenerator: true,
|
|
});
|
|
const sampleTime = secondsToMilliseconds(this.time);
|
|
motionValue.setWithVelocity(sampleAnimation.sample(sampleTime - sampleDelta).value, sampleAnimation.sample(sampleTime).value, sampleDelta);
|
|
}
|
|
const { onStop } = this.options;
|
|
onStop && onStop();
|
|
this.cancel();
|
|
}
|
|
complete() {
|
|
const { resolved } = this;
|
|
if (!resolved)
|
|
return;
|
|
resolved.animation.finish();
|
|
}
|
|
cancel() {
|
|
const { resolved } = this;
|
|
if (!resolved)
|
|
return;
|
|
resolved.animation.cancel();
|
|
}
|
|
static supports(options) {
|
|
const { motionValue, name, repeatDelay, repeatType, damping, type } = options;
|
|
return (supportsWaapi() &&
|
|
name &&
|
|
acceleratedValues.has(name) &&
|
|
motionValue &&
|
|
motionValue.owner &&
|
|
motionValue.owner.current instanceof HTMLElement &&
|
|
/**
|
|
* If we're outputting values to onUpdate then we can't use WAAPI as there's
|
|
* no way to read the value from WAAPI every frame.
|
|
*/
|
|
!motionValue.owner.getProps().onUpdate &&
|
|
!repeatDelay &&
|
|
repeatType !== "mirror" &&
|
|
damping !== 0 &&
|
|
type !== "inertia");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/dom/scroll/observe.mjs
|
|
|
|
|
|
function observeTimeline(update, timeline) {
|
|
let prevProgress;
|
|
const onFrame = () => {
|
|
const { currentTime } = timeline;
|
|
const percentage = currentTime === null ? 0 : currentTime.value;
|
|
const progress = percentage / 100;
|
|
if (prevProgress !== progress) {
|
|
update(progress);
|
|
}
|
|
prevProgress = progress;
|
|
};
|
|
frameloop_frame/* frame */.Gt.update(onFrame, true);
|
|
return () => (0,frameloop_frame/* cancelFrame */.WG)(onFrame);
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/dom/scroll/supports.mjs
|
|
|
|
|
|
const supportsScrollTimeline = memo(() => window.ScrollTimeline !== undefined);
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/animation/GroupPlaybackControls.mjs
|
|
|
|
|
|
|
|
class GroupPlaybackControls {
|
|
constructor(animations) {
|
|
// Bound to accomodate common `return animation.stop` pattern
|
|
this.stop = () => this.runAll("stop");
|
|
this.animations = animations.filter(Boolean);
|
|
}
|
|
then(onResolve, onReject) {
|
|
return Promise.all(this.animations).then(onResolve).catch(onReject);
|
|
}
|
|
/**
|
|
* TODO: Filter out cancelled or stopped animations before returning
|
|
*/
|
|
getAll(propName) {
|
|
return this.animations[0][propName];
|
|
}
|
|
setAll(propName, newValue) {
|
|
for (let i = 0; i < this.animations.length; i++) {
|
|
this.animations[i][propName] = newValue;
|
|
}
|
|
}
|
|
attachTimeline(timeline) {
|
|
const cancelAll = this.animations.map((animation) => {
|
|
if (supportsScrollTimeline() && animation.attachTimeline) {
|
|
animation.attachTimeline(timeline);
|
|
}
|
|
else {
|
|
animation.pause();
|
|
return observeTimeline((progress) => {
|
|
animation.time = animation.duration * progress;
|
|
}, timeline);
|
|
}
|
|
});
|
|
return () => {
|
|
cancelAll.forEach((cancelTimeline, i) => {
|
|
if (cancelTimeline)
|
|
cancelTimeline();
|
|
this.animations[i].stop();
|
|
});
|
|
};
|
|
}
|
|
get time() {
|
|
return this.getAll("time");
|
|
}
|
|
set time(time) {
|
|
this.setAll("time", time);
|
|
}
|
|
get speed() {
|
|
return this.getAll("speed");
|
|
}
|
|
set speed(speed) {
|
|
this.setAll("speed", speed);
|
|
}
|
|
get startTime() {
|
|
return this.getAll("startTime");
|
|
}
|
|
get duration() {
|
|
let max = 0;
|
|
for (let i = 0; i < this.animations.length; i++) {
|
|
max = Math.max(max, this.animations[i].duration);
|
|
}
|
|
return max;
|
|
}
|
|
runAll(methodName) {
|
|
this.animations.forEach((controls) => controls[methodName]());
|
|
}
|
|
play() {
|
|
this.runAll("play");
|
|
}
|
|
pause() {
|
|
this.runAll("pause");
|
|
}
|
|
cancel() {
|
|
this.runAll("cancel");
|
|
}
|
|
complete() {
|
|
this.runAll("complete");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/animation/interfaces/motion-value.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const animateMotionValue = (name, value, target, transition = {}, element, isHandoff,
|
|
/**
|
|
* Currently used to remove values from will-change when an animation ends.
|
|
* Preferably this would be handled by event listeners on the MotionValue
|
|
* but these aren't consistent enough yet when considering the different ways
|
|
* an animation can be cancelled.
|
|
*/
|
|
onEnd) => (onComplete) => {
|
|
const valueTransition = getValueTransition(transition, name) || {};
|
|
/**
|
|
* Most transition values are currently completely overwritten by value-specific
|
|
* transitions. In the future it'd be nicer to blend these transitions. But for now
|
|
* delay actually does inherit from the root transition if not value-specific.
|
|
*/
|
|
const delay = valueTransition.delay || transition.delay || 0;
|
|
/**
|
|
* Elapsed isn't a public transition option but can be passed through from
|
|
* optimized appear effects in milliseconds.
|
|
*/
|
|
let { elapsed = 0 } = transition;
|
|
elapsed = elapsed - secondsToMilliseconds(delay);
|
|
let options = {
|
|
keyframes: Array.isArray(target) ? target : [null, target],
|
|
ease: "easeOut",
|
|
velocity: value.getVelocity(),
|
|
...valueTransition,
|
|
delay: -elapsed,
|
|
onUpdate: (v) => {
|
|
value.set(v);
|
|
valueTransition.onUpdate && valueTransition.onUpdate(v);
|
|
},
|
|
onComplete: () => {
|
|
onComplete();
|
|
valueTransition.onComplete && valueTransition.onComplete();
|
|
onEnd && onEnd();
|
|
},
|
|
onStop: onEnd,
|
|
name,
|
|
motionValue: value,
|
|
element: isHandoff ? undefined : element,
|
|
};
|
|
/**
|
|
* If there's no transition defined for this value, we can generate
|
|
* unqiue transition settings for this value.
|
|
*/
|
|
if (!isTransitionDefined(valueTransition)) {
|
|
options = {
|
|
...options,
|
|
...getDefaultTransition(name, options),
|
|
};
|
|
}
|
|
/**
|
|
* Both WAAPI and our internal animation functions use durations
|
|
* as defined by milliseconds, while our external API defines them
|
|
* as seconds.
|
|
*/
|
|
if (options.duration) {
|
|
options.duration = secondsToMilliseconds(options.duration);
|
|
}
|
|
if (options.repeatDelay) {
|
|
options.repeatDelay = secondsToMilliseconds(options.repeatDelay);
|
|
}
|
|
if (options.from !== undefined) {
|
|
options.keyframes[0] = options.from;
|
|
}
|
|
let shouldSkip = false;
|
|
if (options.type === false ||
|
|
(options.duration === 0 && !options.repeatDelay)) {
|
|
options.duration = 0;
|
|
if (options.delay === 0) {
|
|
shouldSkip = true;
|
|
}
|
|
}
|
|
if (instantAnimationState.current ||
|
|
GlobalConfig/* MotionGlobalConfig */.W.skipAnimations) {
|
|
shouldSkip = true;
|
|
options.duration = 0;
|
|
options.delay = 0;
|
|
}
|
|
/**
|
|
* If we can or must skip creating the animation, and apply only
|
|
* the final keyframe, do so. We also check once keyframes are resolved but
|
|
* this early check prevents the need to create an animation at all.
|
|
*/
|
|
if (shouldSkip && !isHandoff && value.get() !== undefined) {
|
|
const finalKeyframe = getFinalKeyframe(options.keyframes, valueTransition);
|
|
if (finalKeyframe !== undefined) {
|
|
frameloop_frame/* frame */.Gt.update(() => {
|
|
options.onUpdate(finalKeyframe);
|
|
options.onComplete();
|
|
});
|
|
// We still want to return some animation controls here rather
|
|
// than returning undefined
|
|
return new GroupPlaybackControls([]);
|
|
}
|
|
}
|
|
/**
|
|
* Animate via WAAPI if possible. If this is a handoff animation, the optimised animation will be running via
|
|
* WAAPI. Therefore, this animation must be JS to ensure it runs "under" the
|
|
* optimised animation.
|
|
*/
|
|
if (!isHandoff && AcceleratedAnimation.supports(options)) {
|
|
return new AcceleratedAnimation(options);
|
|
}
|
|
else {
|
|
return new MainThreadAnimation(options);
|
|
}
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/subscription-manager.mjs
|
|
|
|
|
|
class SubscriptionManager {
|
|
constructor() {
|
|
this.subscriptions = [];
|
|
}
|
|
add(handler) {
|
|
addUniqueItem(this.subscriptions, handler);
|
|
return () => removeItem(this.subscriptions, handler);
|
|
}
|
|
notify(a, b, c) {
|
|
const numSubscriptions = this.subscriptions.length;
|
|
if (!numSubscriptions)
|
|
return;
|
|
if (numSubscriptions === 1) {
|
|
/**
|
|
* If there's only a single handler we can just call it without invoking a loop.
|
|
*/
|
|
this.subscriptions[0](a, b, c);
|
|
}
|
|
else {
|
|
for (let i = 0; i < numSubscriptions; i++) {
|
|
/**
|
|
* Check whether the handler exists before firing as it's possible
|
|
* the subscriptions were modified during this loop running.
|
|
*/
|
|
const handler = this.subscriptions[i];
|
|
handler && handler(a, b, c);
|
|
}
|
|
}
|
|
}
|
|
getSize() {
|
|
return this.subscriptions.length;
|
|
}
|
|
clear() {
|
|
this.subscriptions.length = 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/value/index.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Maximum time between the value of two frames, beyond which we
|
|
* assume the velocity has since been 0.
|
|
*/
|
|
const MAX_VELOCITY_DELTA = 30;
|
|
const isFloat = (value) => {
|
|
return !isNaN(parseFloat(value));
|
|
};
|
|
const collectMotionValues = {
|
|
current: undefined,
|
|
};
|
|
/**
|
|
* `MotionValue` is used to track the state and velocity of motion values.
|
|
*
|
|
* @public
|
|
*/
|
|
class MotionValue {
|
|
/**
|
|
* @param init - The initiating value
|
|
* @param config - Optional configuration options
|
|
*
|
|
* - `transformer`: A function to transform incoming values with.
|
|
*
|
|
* @internal
|
|
*/
|
|
constructor(init, options = {}) {
|
|
/**
|
|
* This will be replaced by the build step with the latest version number.
|
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
*/
|
|
this.version = "11.3.30";
|
|
/**
|
|
* Tracks whether this value can output a velocity. Currently this is only true
|
|
* if the value is numerical, but we might be able to widen the scope here and support
|
|
* other value types.
|
|
*
|
|
* @internal
|
|
*/
|
|
this.canTrackVelocity = null;
|
|
/**
|
|
* An object containing a SubscriptionManager for each active event.
|
|
*/
|
|
this.events = {};
|
|
this.updateAndNotify = (v, render = true) => {
|
|
const currentTime = time.now();
|
|
/**
|
|
* If we're updating the value during another frame or eventloop
|
|
* than the previous frame, then the we set the previous frame value
|
|
* to current.
|
|
*/
|
|
if (this.updatedAt !== currentTime) {
|
|
this.setPrevFrameValue();
|
|
}
|
|
this.prev = this.current;
|
|
this.setCurrent(v);
|
|
// Update update subscribers
|
|
if (this.current !== this.prev && this.events.change) {
|
|
this.events.change.notify(this.current);
|
|
}
|
|
// Update render subscribers
|
|
if (render && this.events.renderRequest) {
|
|
this.events.renderRequest.notify(this.current);
|
|
}
|
|
};
|
|
this.hasAnimated = false;
|
|
this.setCurrent(init);
|
|
this.owner = options.owner;
|
|
}
|
|
setCurrent(current) {
|
|
this.current = current;
|
|
this.updatedAt = time.now();
|
|
if (this.canTrackVelocity === null && current !== undefined) {
|
|
this.canTrackVelocity = isFloat(this.current);
|
|
}
|
|
}
|
|
setPrevFrameValue(prevFrameValue = this.current) {
|
|
this.prevFrameValue = prevFrameValue;
|
|
this.prevUpdatedAt = this.updatedAt;
|
|
}
|
|
/**
|
|
* Adds a function that will be notified when the `MotionValue` is updated.
|
|
*
|
|
* It returns a function that, when called, will cancel the subscription.
|
|
*
|
|
* When calling `onChange` inside a React component, it should be wrapped with the
|
|
* `useEffect` hook. As it returns an unsubscribe function, this should be returned
|
|
* from the `useEffect` function to ensure you don't add duplicate subscribers..
|
|
*
|
|
* ```jsx
|
|
* export const MyComponent = () => {
|
|
* const x = useMotionValue(0)
|
|
* const y = useMotionValue(0)
|
|
* const opacity = useMotionValue(1)
|
|
*
|
|
* useEffect(() => {
|
|
* function updateOpacity() {
|
|
* const maxXY = Math.max(x.get(), y.get())
|
|
* const newOpacity = transform(maxXY, [0, 100], [1, 0])
|
|
* opacity.set(newOpacity)
|
|
* }
|
|
*
|
|
* const unsubscribeX = x.on("change", updateOpacity)
|
|
* const unsubscribeY = y.on("change", updateOpacity)
|
|
*
|
|
* return () => {
|
|
* unsubscribeX()
|
|
* unsubscribeY()
|
|
* }
|
|
* }, [])
|
|
*
|
|
* return <motion.div style={{ x }} />
|
|
* }
|
|
* ```
|
|
*
|
|
* @param subscriber - A function that receives the latest value.
|
|
* @returns A function that, when called, will cancel this subscription.
|
|
*
|
|
* @deprecated
|
|
*/
|
|
onChange(subscription) {
|
|
if (false) {}
|
|
return this.on("change", subscription);
|
|
}
|
|
on(eventName, callback) {
|
|
if (!this.events[eventName]) {
|
|
this.events[eventName] = new SubscriptionManager();
|
|
}
|
|
const unsubscribe = this.events[eventName].add(callback);
|
|
if (eventName === "change") {
|
|
return () => {
|
|
unsubscribe();
|
|
/**
|
|
* If we have no more change listeners by the start
|
|
* of the next frame, stop active animations.
|
|
*/
|
|
frameloop_frame/* frame */.Gt.read(() => {
|
|
if (!this.events.change.getSize()) {
|
|
this.stop();
|
|
}
|
|
});
|
|
};
|
|
}
|
|
return unsubscribe;
|
|
}
|
|
clearListeners() {
|
|
for (const eventManagers in this.events) {
|
|
this.events[eventManagers].clear();
|
|
}
|
|
}
|
|
/**
|
|
* Attaches a passive effect to the `MotionValue`.
|
|
*
|
|
* @internal
|
|
*/
|
|
attach(passiveEffect, stopPassiveEffect) {
|
|
this.passiveEffect = passiveEffect;
|
|
this.stopPassiveEffect = stopPassiveEffect;
|
|
}
|
|
/**
|
|
* Sets the state of the `MotionValue`.
|
|
*
|
|
* @remarks
|
|
*
|
|
* ```jsx
|
|
* const x = useMotionValue(0)
|
|
* x.set(10)
|
|
* ```
|
|
*
|
|
* @param latest - Latest value to set.
|
|
* @param render - Whether to notify render subscribers. Defaults to `true`
|
|
*
|
|
* @public
|
|
*/
|
|
set(v, render = true) {
|
|
if (!render || !this.passiveEffect) {
|
|
this.updateAndNotify(v, render);
|
|
}
|
|
else {
|
|
this.passiveEffect(v, this.updateAndNotify);
|
|
}
|
|
}
|
|
setWithVelocity(prev, current, delta) {
|
|
this.set(current);
|
|
this.prev = undefined;
|
|
this.prevFrameValue = prev;
|
|
this.prevUpdatedAt = this.updatedAt - delta;
|
|
}
|
|
/**
|
|
* Set the state of the `MotionValue`, stopping any active animations,
|
|
* effects, and resets velocity to `0`.
|
|
*/
|
|
jump(v, endAnimation = true) {
|
|
this.updateAndNotify(v);
|
|
this.prev = v;
|
|
this.prevUpdatedAt = this.prevFrameValue = undefined;
|
|
endAnimation && this.stop();
|
|
if (this.stopPassiveEffect)
|
|
this.stopPassiveEffect();
|
|
}
|
|
/**
|
|
* Returns the latest state of `MotionValue`
|
|
*
|
|
* @returns - The latest state of `MotionValue`
|
|
*
|
|
* @public
|
|
*/
|
|
get() {
|
|
if (collectMotionValues.current) {
|
|
collectMotionValues.current.push(this);
|
|
}
|
|
return this.current;
|
|
}
|
|
/**
|
|
* @public
|
|
*/
|
|
getPrevious() {
|
|
return this.prev;
|
|
}
|
|
/**
|
|
* Returns the latest velocity of `MotionValue`
|
|
*
|
|
* @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
|
|
*
|
|
* @public
|
|
*/
|
|
getVelocity() {
|
|
const currentTime = time.now();
|
|
if (!this.canTrackVelocity ||
|
|
this.prevFrameValue === undefined ||
|
|
currentTime - this.updatedAt > MAX_VELOCITY_DELTA) {
|
|
return 0;
|
|
}
|
|
const delta = Math.min(this.updatedAt - this.prevUpdatedAt, MAX_VELOCITY_DELTA);
|
|
// Casts because of parseFloat's poor typing
|
|
return velocityPerSecond(parseFloat(this.current) -
|
|
parseFloat(this.prevFrameValue), delta);
|
|
}
|
|
/**
|
|
* Registers a new animation to control this `MotionValue`. Only one
|
|
* animation can drive a `MotionValue` at one time.
|
|
*
|
|
* ```jsx
|
|
* value.start()
|
|
* ```
|
|
*
|
|
* @param animation - A function that starts the provided animation
|
|
*
|
|
* @internal
|
|
*/
|
|
start(startAnimation) {
|
|
this.stop();
|
|
return new Promise((resolve) => {
|
|
this.hasAnimated = true;
|
|
this.animation = startAnimation(resolve);
|
|
if (this.events.animationStart) {
|
|
this.events.animationStart.notify();
|
|
}
|
|
}).then(() => {
|
|
if (this.events.animationComplete) {
|
|
this.events.animationComplete.notify();
|
|
}
|
|
this.clearAnimation();
|
|
});
|
|
}
|
|
/**
|
|
* Stop the currently active animation.
|
|
*
|
|
* @public
|
|
*/
|
|
stop() {
|
|
if (this.animation) {
|
|
this.animation.stop();
|
|
if (this.events.animationCancel) {
|
|
this.events.animationCancel.notify();
|
|
}
|
|
}
|
|
this.clearAnimation();
|
|
}
|
|
/**
|
|
* Returns `true` if this value is currently animating.
|
|
*
|
|
* @public
|
|
*/
|
|
isAnimating() {
|
|
return !!this.animation;
|
|
}
|
|
clearAnimation() {
|
|
delete this.animation;
|
|
}
|
|
/**
|
|
* Destroy and clean up subscribers to this `MotionValue`.
|
|
*
|
|
* The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
|
|
* handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
|
|
* created a `MotionValue` via the `motionValue` function.
|
|
*
|
|
* @public
|
|
*/
|
|
destroy() {
|
|
this.clearListeners();
|
|
this.stop();
|
|
if (this.stopPassiveEffect) {
|
|
this.stopPassiveEffect();
|
|
}
|
|
}
|
|
}
|
|
function motionValue(init, options) {
|
|
return new MotionValue(init, options);
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/utils/setters.mjs
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Set VisualElement's MotionValue, creating a new MotionValue for it if
|
|
* it doesn't exist.
|
|
*/
|
|
function setMotionValue(visualElement, key, value) {
|
|
if (visualElement.hasValue(key)) {
|
|
visualElement.getValue(key).set(value);
|
|
}
|
|
else {
|
|
visualElement.addValue(key, motionValue(value));
|
|
}
|
|
}
|
|
function setTarget(visualElement, definition) {
|
|
const resolved = resolveVariant(visualElement, definition);
|
|
let { transitionEnd = {}, transition = {}, ...target } = resolved || {};
|
|
target = { ...target, ...transitionEnd };
|
|
for (const key in target) {
|
|
const value = resolveFinalValueInKeyframes(target[key]);
|
|
setMotionValue(visualElement, key, value);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/animation/optimized-appear/get-appear-id.mjs
|
|
|
|
|
|
function getOptimisedAppearId(visualElement) {
|
|
return visualElement.getProps()[optimizedAppearDataAttribute];
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/value/use-will-change/WillChangeMotionValue.mjs
|
|
|
|
|
|
|
|
|
|
class WillChangeMotionValue extends MotionValue {
|
|
constructor() {
|
|
super(...arguments);
|
|
this.output = [];
|
|
this.counts = new Map();
|
|
}
|
|
add(name) {
|
|
const styleName = getWillChangeName(name);
|
|
if (!styleName)
|
|
return;
|
|
/**
|
|
* Update counter. Each value has an indepdent counter
|
|
* as multiple sources could be requesting the same value
|
|
* gets added to will-change.
|
|
*/
|
|
const prevCount = this.counts.get(styleName) || 0;
|
|
this.counts.set(styleName, prevCount + 1);
|
|
if (prevCount === 0) {
|
|
this.output.push(styleName);
|
|
this.update();
|
|
}
|
|
/**
|
|
* Prevents the remove function from being called multiple times.
|
|
*/
|
|
let hasRemoved = false;
|
|
return () => {
|
|
if (hasRemoved)
|
|
return;
|
|
hasRemoved = true;
|
|
const newCount = this.counts.get(styleName) - 1;
|
|
this.counts.set(styleName, newCount);
|
|
if (newCount === 0) {
|
|
removeItem(this.output, styleName);
|
|
this.update();
|
|
}
|
|
};
|
|
}
|
|
update() {
|
|
this.set(this.output.length ? this.output.join(", ") : "auto");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/value/use-will-change/is.mjs
|
|
|
|
|
|
function isWillChangeMotionValue(value) {
|
|
return Boolean(isMotionValue(value) && value.add);
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/value/use-will-change/add-will-change.mjs
|
|
|
|
|
|
|
|
function addValueToWillChange(visualElement, key) {
|
|
var _a;
|
|
if (!visualElement.applyWillChange)
|
|
return;
|
|
let willChange = visualElement.getValue("willChange");
|
|
/**
|
|
* If we haven't created a willChange MotionValue, and the we haven't been
|
|
* manually provided one, create one.
|
|
*/
|
|
if (!willChange && !((_a = visualElement.props.style) === null || _a === void 0 ? void 0 : _a.willChange)) {
|
|
willChange = new WillChangeMotionValue("auto");
|
|
visualElement.addValue("willChange", willChange);
|
|
}
|
|
/**
|
|
* It could be that a user has set willChange to a regular MotionValue,
|
|
* in which case we can't add the value to it.
|
|
*/
|
|
if (isWillChangeMotionValue(willChange)) {
|
|
return willChange.add(key);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/animation/interfaces/visual-element-target.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Decide whether we should block this animation. Previously, we achieved this
|
|
* just by checking whether the key was listed in protectedKeys, but this
|
|
* posed problems if an animation was triggered by afterChildren and protectedKeys
|
|
* had been set to true in the meantime.
|
|
*/
|
|
function shouldBlockAnimation({ protectedKeys, needsAnimating }, key) {
|
|
const shouldBlock = protectedKeys.hasOwnProperty(key) && needsAnimating[key] !== true;
|
|
needsAnimating[key] = false;
|
|
return shouldBlock;
|
|
}
|
|
function animateTarget(visualElement, targetAndTransition, { delay = 0, transitionOverride, type } = {}) {
|
|
var _a;
|
|
let { transition = visualElement.getDefaultTransition(), transitionEnd, ...target } = targetAndTransition;
|
|
if (transitionOverride)
|
|
transition = transitionOverride;
|
|
const animations = [];
|
|
const animationTypeState = type &&
|
|
visualElement.animationState &&
|
|
visualElement.animationState.getState()[type];
|
|
for (const key in target) {
|
|
const value = visualElement.getValue(key, (_a = visualElement.latestValues[key]) !== null && _a !== void 0 ? _a : null);
|
|
const valueTarget = target[key];
|
|
if (valueTarget === undefined ||
|
|
(animationTypeState &&
|
|
shouldBlockAnimation(animationTypeState, key))) {
|
|
continue;
|
|
}
|
|
const valueTransition = {
|
|
delay,
|
|
...getValueTransition(transition || {}, key),
|
|
};
|
|
/**
|
|
* If this is the first time a value is being animated, check
|
|
* to see if we're handling off from an existing animation.
|
|
*/
|
|
let isHandoff = false;
|
|
if (window.MotionHandoffAnimation) {
|
|
const appearId = getOptimisedAppearId(visualElement);
|
|
if (appearId) {
|
|
const startTime = window.MotionHandoffAnimation(appearId, key, frameloop_frame/* frame */.Gt);
|
|
if (startTime !== null) {
|
|
valueTransition.startTime = startTime;
|
|
isHandoff = true;
|
|
}
|
|
}
|
|
}
|
|
value.start(animateMotionValue(key, value, valueTarget, visualElement.shouldReduceMotion && transformProps.has(key)
|
|
? { type: false }
|
|
: valueTransition, visualElement, isHandoff, addValueToWillChange(visualElement, key)));
|
|
const animation = value.animation;
|
|
if (animation) {
|
|
animations.push(animation);
|
|
}
|
|
}
|
|
if (transitionEnd) {
|
|
Promise.all(animations).then(() => {
|
|
frameloop_frame/* frame */.Gt.update(() => {
|
|
transitionEnd && setTarget(visualElement, transitionEnd);
|
|
});
|
|
});
|
|
}
|
|
return animations;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/animation/interfaces/visual-element-variant.mjs
|
|
|
|
|
|
|
|
function animateVariant(visualElement, variant, options = {}) {
|
|
var _a;
|
|
const resolved = resolveVariant(visualElement, variant, options.type === "exit"
|
|
? (_a = visualElement.presenceContext) === null || _a === void 0 ? void 0 : _a.custom
|
|
: undefined);
|
|
let { transition = visualElement.getDefaultTransition() || {} } = resolved || {};
|
|
if (options.transitionOverride) {
|
|
transition = options.transitionOverride;
|
|
}
|
|
/**
|
|
* If we have a variant, create a callback that runs it as an animation.
|
|
* Otherwise, we resolve a Promise immediately for a composable no-op.
|
|
*/
|
|
const getAnimation = resolved
|
|
? () => Promise.all(animateTarget(visualElement, resolved, options))
|
|
: () => Promise.resolve();
|
|
/**
|
|
* If we have children, create a callback that runs all their animations.
|
|
* Otherwise, we resolve a Promise immediately for a composable no-op.
|
|
*/
|
|
const getChildAnimations = visualElement.variantChildren && visualElement.variantChildren.size
|
|
? (forwardDelay = 0) => {
|
|
const { delayChildren = 0, staggerChildren, staggerDirection, } = transition;
|
|
return animateChildren(visualElement, variant, delayChildren + forwardDelay, staggerChildren, staggerDirection, options);
|
|
}
|
|
: () => Promise.resolve();
|
|
/**
|
|
* If the transition explicitly defines a "when" option, we need to resolve either
|
|
* this animation or all children animations before playing the other.
|
|
*/
|
|
const { when } = transition;
|
|
if (when) {
|
|
const [first, last] = when === "beforeChildren"
|
|
? [getAnimation, getChildAnimations]
|
|
: [getChildAnimations, getAnimation];
|
|
return first().then(() => last());
|
|
}
|
|
else {
|
|
return Promise.all([getAnimation(), getChildAnimations(options.delay)]);
|
|
}
|
|
}
|
|
function animateChildren(visualElement, variant, delayChildren = 0, staggerChildren = 0, staggerDirection = 1, options) {
|
|
const animations = [];
|
|
const maxStaggerDuration = (visualElement.variantChildren.size - 1) * staggerChildren;
|
|
const generateStaggerDuration = staggerDirection === 1
|
|
? (i = 0) => i * staggerChildren
|
|
: (i = 0) => maxStaggerDuration - i * staggerChildren;
|
|
Array.from(visualElement.variantChildren)
|
|
.sort(sortByTreeOrder)
|
|
.forEach((child, i) => {
|
|
child.notify("AnimationStart", variant);
|
|
animations.push(animateVariant(child, variant, {
|
|
...options,
|
|
delay: delayChildren + generateStaggerDuration(i),
|
|
}).then(() => child.notify("AnimationComplete", variant)));
|
|
});
|
|
return Promise.all(animations);
|
|
}
|
|
function sortByTreeOrder(a, b) {
|
|
return a.sortNodePosition(b);
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/animation/interfaces/visual-element.mjs
|
|
|
|
|
|
|
|
|
|
function animateVisualElement(visualElement, definition, options = {}) {
|
|
visualElement.notify("AnimationStart", definition);
|
|
let animation;
|
|
if (Array.isArray(definition)) {
|
|
const animations = definition.map((variant) => animateVariant(visualElement, variant, options));
|
|
animation = Promise.all(animations);
|
|
}
|
|
else if (typeof definition === "string") {
|
|
animation = animateVariant(visualElement, definition, options);
|
|
}
|
|
else {
|
|
const resolvedDefinition = typeof definition === "function"
|
|
? resolveVariant(visualElement, definition, options.custom)
|
|
: definition;
|
|
animation = Promise.all(animateTarget(visualElement, resolvedDefinition, options));
|
|
}
|
|
return animation.then(() => {
|
|
visualElement.notify("AnimationComplete", definition);
|
|
});
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/utils/animation-state.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const reversePriorityOrder = [...variantPriorityOrder].reverse();
|
|
const numAnimationTypes = variantPriorityOrder.length;
|
|
function animateList(visualElement) {
|
|
return (animations) => Promise.all(animations.map(({ animation, options }) => animateVisualElement(visualElement, animation, options)));
|
|
}
|
|
function createAnimationState(visualElement) {
|
|
let animate = animateList(visualElement);
|
|
let state = createState();
|
|
let isInitialRender = true;
|
|
/**
|
|
* This function will be used to reduce the animation definitions for
|
|
* each active animation type into an object of resolved values for it.
|
|
*/
|
|
const buildResolvedTypeValues = (type) => (acc, definition) => {
|
|
var _a;
|
|
const resolved = resolveVariant(visualElement, definition, type === "exit"
|
|
? (_a = visualElement.presenceContext) === null || _a === void 0 ? void 0 : _a.custom
|
|
: undefined);
|
|
if (resolved) {
|
|
const { transition, transitionEnd, ...target } = resolved;
|
|
acc = { ...acc, ...target, ...transitionEnd };
|
|
}
|
|
return acc;
|
|
};
|
|
/**
|
|
* This just allows us to inject mocked animation functions
|
|
* @internal
|
|
*/
|
|
function setAnimateFunction(makeAnimator) {
|
|
animate = makeAnimator(visualElement);
|
|
}
|
|
/**
|
|
* When we receive new props, we need to:
|
|
* 1. Create a list of protected keys for each type. This is a directory of
|
|
* value keys that are currently being "handled" by types of a higher priority
|
|
* so that whenever an animation is played of a given type, these values are
|
|
* protected from being animated.
|
|
* 2. Determine if an animation type needs animating.
|
|
* 3. Determine if any values have been removed from a type and figure out
|
|
* what to animate those to.
|
|
*/
|
|
function animateChanges(changedActiveType) {
|
|
const props = visualElement.getProps();
|
|
const context = visualElement.getVariantContext(true) || {};
|
|
/**
|
|
* A list of animations that we'll build into as we iterate through the animation
|
|
* types. This will get executed at the end of the function.
|
|
*/
|
|
const animations = [];
|
|
/**
|
|
* Keep track of which values have been removed. Then, as we hit lower priority
|
|
* animation types, we can check if they contain removed values and animate to that.
|
|
*/
|
|
const removedKeys = new Set();
|
|
/**
|
|
* A dictionary of all encountered keys. This is an object to let us build into and
|
|
* copy it without iteration. Each time we hit an animation type we set its protected
|
|
* keys - the keys its not allowed to animate - to the latest version of this object.
|
|
*/
|
|
let encounteredKeys = {};
|
|
/**
|
|
* If a variant has been removed at a given index, and this component is controlling
|
|
* variant animations, we want to ensure lower-priority variants are forced to animate.
|
|
*/
|
|
let removedVariantIndex = Infinity;
|
|
/**
|
|
* Iterate through all animation types in reverse priority order. For each, we want to
|
|
* detect which values it's handling and whether or not they've changed (and therefore
|
|
* need to be animated). If any values have been removed, we want to detect those in
|
|
* lower priority props and flag for animation.
|
|
*/
|
|
for (let i = 0; i < numAnimationTypes; i++) {
|
|
const type = reversePriorityOrder[i];
|
|
const typeState = state[type];
|
|
const prop = props[type] !== undefined
|
|
? props[type]
|
|
: context[type];
|
|
const propIsVariant = isVariantLabel(prop);
|
|
/**
|
|
* If this type has *just* changed isActive status, set activeDelta
|
|
* to that status. Otherwise set to null.
|
|
*/
|
|
const activeDelta = type === changedActiveType ? typeState.isActive : null;
|
|
if (activeDelta === false)
|
|
removedVariantIndex = i;
|
|
/**
|
|
* If this prop is an inherited variant, rather than been set directly on the
|
|
* component itself, we want to make sure we allow the parent to trigger animations.
|
|
*
|
|
* TODO: Can probably change this to a !isControllingVariants check
|
|
*/
|
|
let isInherited = prop === context[type] &&
|
|
prop !== props[type] &&
|
|
propIsVariant;
|
|
/**
|
|
*
|
|
*/
|
|
if (isInherited &&
|
|
isInitialRender &&
|
|
visualElement.manuallyAnimateOnMount) {
|
|
isInherited = false;
|
|
}
|
|
/**
|
|
* Set all encountered keys so far as the protected keys for this type. This will
|
|
* be any key that has been animated or otherwise handled by active, higher-priortiy types.
|
|
*/
|
|
typeState.protectedKeys = { ...encounteredKeys };
|
|
// Check if we can skip analysing this prop early
|
|
if (
|
|
// If it isn't active and hasn't *just* been set as inactive
|
|
(!typeState.isActive && activeDelta === null) ||
|
|
// If we didn't and don't have any defined prop for this animation type
|
|
(!prop && !typeState.prevProp) ||
|
|
// Or if the prop doesn't define an animation
|
|
isAnimationControls(prop) ||
|
|
typeof prop === "boolean") {
|
|
continue;
|
|
}
|
|
/**
|
|
* As we go look through the values defined on this type, if we detect
|
|
* a changed value or a value that was removed in a higher priority, we set
|
|
* this to true and add this prop to the animation list.
|
|
*/
|
|
const variantDidChange = checkVariantsDidChange(typeState.prevProp, prop);
|
|
let shouldAnimateType = variantDidChange ||
|
|
// If we're making this variant active, we want to always make it active
|
|
(type === changedActiveType &&
|
|
typeState.isActive &&
|
|
!isInherited &&
|
|
propIsVariant) ||
|
|
// If we removed a higher-priority variant (i is in reverse order)
|
|
(i > removedVariantIndex && propIsVariant);
|
|
let handledRemovedValues = false;
|
|
/**
|
|
* As animations can be set as variant lists, variants or target objects, we
|
|
* coerce everything to an array if it isn't one already
|
|
*/
|
|
const definitionList = Array.isArray(prop) ? prop : [prop];
|
|
/**
|
|
* Build an object of all the resolved values. We'll use this in the subsequent
|
|
* animateChanges calls to determine whether a value has changed.
|
|
*/
|
|
let resolvedValues = definitionList.reduce(buildResolvedTypeValues(type), {});
|
|
if (activeDelta === false)
|
|
resolvedValues = {};
|
|
/**
|
|
* Now we need to loop through all the keys in the prev prop and this prop,
|
|
* and decide:
|
|
* 1. If the value has changed, and needs animating
|
|
* 2. If it has been removed, and needs adding to the removedKeys set
|
|
* 3. If it has been removed in a higher priority type and needs animating
|
|
* 4. If it hasn't been removed in a higher priority but hasn't changed, and
|
|
* needs adding to the type's protectedKeys list.
|
|
*/
|
|
const { prevResolvedValues = {} } = typeState;
|
|
const allKeys = {
|
|
...prevResolvedValues,
|
|
...resolvedValues,
|
|
};
|
|
const markToAnimate = (key) => {
|
|
shouldAnimateType = true;
|
|
if (removedKeys.has(key)) {
|
|
handledRemovedValues = true;
|
|
removedKeys.delete(key);
|
|
}
|
|
typeState.needsAnimating[key] = true;
|
|
const motionValue = visualElement.getValue(key);
|
|
if (motionValue)
|
|
motionValue.liveStyle = false;
|
|
};
|
|
for (const key in allKeys) {
|
|
const next = resolvedValues[key];
|
|
const prev = prevResolvedValues[key];
|
|
// If we've already handled this we can just skip ahead
|
|
if (encounteredKeys.hasOwnProperty(key))
|
|
continue;
|
|
/**
|
|
* If the value has changed, we probably want to animate it.
|
|
*/
|
|
let valueHasChanged = false;
|
|
if (isKeyframesTarget(next) && isKeyframesTarget(prev)) {
|
|
valueHasChanged = !shallowCompare(next, prev);
|
|
}
|
|
else {
|
|
valueHasChanged = next !== prev;
|
|
}
|
|
if (valueHasChanged) {
|
|
if (next !== undefined && next !== null) {
|
|
// If next is defined and doesn't equal prev, it needs animating
|
|
markToAnimate(key);
|
|
}
|
|
else {
|
|
// If it's undefined, it's been removed.
|
|
removedKeys.add(key);
|
|
}
|
|
}
|
|
else if (next !== undefined && removedKeys.has(key)) {
|
|
/**
|
|
* If next hasn't changed and it isn't undefined, we want to check if it's
|
|
* been removed by a higher priority
|
|
*/
|
|
markToAnimate(key);
|
|
}
|
|
else {
|
|
/**
|
|
* If it hasn't changed, we add it to the list of protected values
|
|
* to ensure it doesn't get animated.
|
|
*/
|
|
typeState.protectedKeys[key] = true;
|
|
}
|
|
}
|
|
/**
|
|
* Update the typeState so next time animateChanges is called we can compare the
|
|
* latest prop and resolvedValues to these.
|
|
*/
|
|
typeState.prevProp = prop;
|
|
typeState.prevResolvedValues = resolvedValues;
|
|
/**
|
|
*
|
|
*/
|
|
if (typeState.isActive) {
|
|
encounteredKeys = { ...encounteredKeys, ...resolvedValues };
|
|
}
|
|
if (isInitialRender && visualElement.blockInitialAnimation) {
|
|
shouldAnimateType = false;
|
|
}
|
|
/**
|
|
* If this is an inherited prop we want to hard-block animations
|
|
*/
|
|
if (shouldAnimateType && (!isInherited || handledRemovedValues)) {
|
|
animations.push(...definitionList.map((animation) => ({
|
|
animation: animation,
|
|
options: { type },
|
|
})));
|
|
}
|
|
}
|
|
/**
|
|
* If there are some removed value that haven't been dealt with,
|
|
* we need to create a new animation that falls back either to the value
|
|
* defined in the style prop, or the last read value.
|
|
*/
|
|
if (removedKeys.size) {
|
|
const fallbackAnimation = {};
|
|
removedKeys.forEach((key) => {
|
|
const fallbackTarget = visualElement.getBaseTarget(key);
|
|
const motionValue = visualElement.getValue(key);
|
|
if (motionValue)
|
|
motionValue.liveStyle = true;
|
|
// @ts-expect-error - @mattgperry to figure if we should do something here
|
|
fallbackAnimation[key] = fallbackTarget !== null && fallbackTarget !== void 0 ? fallbackTarget : null;
|
|
});
|
|
animations.push({ animation: fallbackAnimation });
|
|
}
|
|
let shouldAnimate = Boolean(animations.length);
|
|
if (isInitialRender &&
|
|
(props.initial === false || props.initial === props.animate) &&
|
|
!visualElement.manuallyAnimateOnMount) {
|
|
shouldAnimate = false;
|
|
}
|
|
isInitialRender = false;
|
|
return shouldAnimate ? animate(animations) : Promise.resolve();
|
|
}
|
|
/**
|
|
* Change whether a certain animation type is active.
|
|
*/
|
|
function setActive(type, isActive) {
|
|
var _a;
|
|
// If the active state hasn't changed, we can safely do nothing here
|
|
if (state[type].isActive === isActive)
|
|
return Promise.resolve();
|
|
// Propagate active change to children
|
|
(_a = visualElement.variantChildren) === null || _a === void 0 ? void 0 : _a.forEach((child) => { var _a; return (_a = child.animationState) === null || _a === void 0 ? void 0 : _a.setActive(type, isActive); });
|
|
state[type].isActive = isActive;
|
|
const animations = animateChanges(type);
|
|
for (const key in state) {
|
|
state[key].protectedKeys = {};
|
|
}
|
|
return animations;
|
|
}
|
|
return {
|
|
animateChanges,
|
|
setActive,
|
|
setAnimateFunction,
|
|
getState: () => state,
|
|
reset: () => {
|
|
state = createState();
|
|
isInitialRender = true;
|
|
},
|
|
};
|
|
}
|
|
function checkVariantsDidChange(prev, next) {
|
|
if (typeof next === "string") {
|
|
return next !== prev;
|
|
}
|
|
else if (Array.isArray(next)) {
|
|
return !shallowCompare(next, prev);
|
|
}
|
|
return false;
|
|
}
|
|
function createTypeState(isActive = false) {
|
|
return {
|
|
isActive,
|
|
protectedKeys: {},
|
|
needsAnimating: {},
|
|
prevResolvedValues: {},
|
|
};
|
|
}
|
|
function createState() {
|
|
return {
|
|
animate: createTypeState(true),
|
|
whileInView: createTypeState(),
|
|
whileHover: createTypeState(),
|
|
whileTap: createTypeState(),
|
|
whileDrag: createTypeState(),
|
|
whileFocus: createTypeState(),
|
|
exit: createTypeState(),
|
|
};
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/motion/features/animation/index.mjs
|
|
|
|
|
|
|
|
|
|
class AnimationFeature extends Feature {
|
|
/**
|
|
* We dynamically generate the AnimationState manager as it contains a reference
|
|
* to the underlying animation library. We only want to load that if we load this,
|
|
* so people can optionally code split it out using the `m` component.
|
|
*/
|
|
constructor(node) {
|
|
super(node);
|
|
node.animationState || (node.animationState = createAnimationState(node));
|
|
}
|
|
updateAnimationControlsSubscription() {
|
|
const { animate } = this.node.getProps();
|
|
if (isAnimationControls(animate)) {
|
|
this.unmountControls = animate.subscribe(this.node);
|
|
}
|
|
}
|
|
/**
|
|
* Subscribe any provided AnimationControls to the component's VisualElement
|
|
*/
|
|
mount() {
|
|
this.updateAnimationControlsSubscription();
|
|
}
|
|
update() {
|
|
const { animate } = this.node.getProps();
|
|
const { animate: prevAnimate } = this.node.prevProps || {};
|
|
if (animate !== prevAnimate) {
|
|
this.updateAnimationControlsSubscription();
|
|
}
|
|
}
|
|
unmount() {
|
|
var _a;
|
|
this.node.animationState.reset();
|
|
(_a = this.unmountControls) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/motion/features/animation/exit.mjs
|
|
|
|
|
|
let id = 0;
|
|
class ExitAnimationFeature extends Feature {
|
|
constructor() {
|
|
super(...arguments);
|
|
this.id = id++;
|
|
}
|
|
update() {
|
|
if (!this.node.presenceContext)
|
|
return;
|
|
const { isPresent, onExitComplete } = this.node.presenceContext;
|
|
const { isPresent: prevIsPresent } = this.node.prevPresenceContext || {};
|
|
if (!this.node.animationState || isPresent === prevIsPresent) {
|
|
return;
|
|
}
|
|
const exitAnimation = this.node.animationState.setActive("exit", !isPresent);
|
|
if (onExitComplete && !isPresent) {
|
|
exitAnimation.then(() => onExitComplete(this.id));
|
|
}
|
|
}
|
|
mount() {
|
|
const { register } = this.node.presenceContext || {};
|
|
if (register) {
|
|
this.unmount = register(this.id);
|
|
}
|
|
}
|
|
unmount() { }
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/motion/features/animations.mjs
|
|
|
|
|
|
|
|
const animations = {
|
|
animation: {
|
|
Feature: AnimationFeature,
|
|
},
|
|
exit: {
|
|
Feature: ExitAnimationFeature,
|
|
},
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/distance.mjs
|
|
const distance = (a, b) => Math.abs(a - b);
|
|
function distance2D(a, b) {
|
|
// Multi-dimensional
|
|
const xDelta = distance(a.x, b.x);
|
|
const yDelta = distance(a.y, b.y);
|
|
return Math.sqrt(xDelta ** 2 + yDelta ** 2);
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/gestures/pan/PanSession.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* @internal
|
|
*/
|
|
class PanSession {
|
|
constructor(event, handlers, { transformPagePoint, contextWindow, dragSnapToOrigin = false } = {}) {
|
|
/**
|
|
* @internal
|
|
*/
|
|
this.startEvent = null;
|
|
/**
|
|
* @internal
|
|
*/
|
|
this.lastMoveEvent = null;
|
|
/**
|
|
* @internal
|
|
*/
|
|
this.lastMoveEventInfo = null;
|
|
/**
|
|
* @internal
|
|
*/
|
|
this.handlers = {};
|
|
/**
|
|
* @internal
|
|
*/
|
|
this.contextWindow = window;
|
|
this.updatePoint = () => {
|
|
if (!(this.lastMoveEvent && this.lastMoveEventInfo))
|
|
return;
|
|
const info = getPanInfo(this.lastMoveEventInfo, this.history);
|
|
const isPanStarted = this.startEvent !== null;
|
|
// Only start panning if the offset is larger than 3 pixels. If we make it
|
|
// any larger than this we'll want to reset the pointer history
|
|
// on the first update to avoid visual snapping to the cursoe.
|
|
const isDistancePastThreshold = distance2D(info.offset, { x: 0, y: 0 }) >= 3;
|
|
if (!isPanStarted && !isDistancePastThreshold)
|
|
return;
|
|
const { point } = info;
|
|
const { timestamp } = frameloop_frame/* frameData */.uv;
|
|
this.history.push({ ...point, timestamp });
|
|
const { onStart, onMove } = this.handlers;
|
|
if (!isPanStarted) {
|
|
onStart && onStart(this.lastMoveEvent, info);
|
|
this.startEvent = this.lastMoveEvent;
|
|
}
|
|
onMove && onMove(this.lastMoveEvent, info);
|
|
};
|
|
this.handlePointerMove = (event, info) => {
|
|
this.lastMoveEvent = event;
|
|
this.lastMoveEventInfo = transformPoint(info, this.transformPagePoint);
|
|
// Throttle mouse move event to once per frame
|
|
frameloop_frame/* frame */.Gt.update(this.updatePoint, true);
|
|
};
|
|
this.handlePointerUp = (event, info) => {
|
|
this.end();
|
|
const { onEnd, onSessionEnd, resumeAnimation } = this.handlers;
|
|
if (this.dragSnapToOrigin)
|
|
resumeAnimation && resumeAnimation();
|
|
if (!(this.lastMoveEvent && this.lastMoveEventInfo))
|
|
return;
|
|
const panInfo = getPanInfo(event.type === "pointercancel"
|
|
? this.lastMoveEventInfo
|
|
: transformPoint(info, this.transformPagePoint), this.history);
|
|
if (this.startEvent && onEnd) {
|
|
onEnd(event, panInfo);
|
|
}
|
|
onSessionEnd && onSessionEnd(event, panInfo);
|
|
};
|
|
// If we have more than one touch, don't start detecting this gesture
|
|
if (!isPrimaryPointer(event))
|
|
return;
|
|
this.dragSnapToOrigin = dragSnapToOrigin;
|
|
this.handlers = handlers;
|
|
this.transformPagePoint = transformPagePoint;
|
|
this.contextWindow = contextWindow || window;
|
|
const info = extractEventInfo(event);
|
|
const initialInfo = transformPoint(info, this.transformPagePoint);
|
|
const { point } = initialInfo;
|
|
const { timestamp } = frameloop_frame/* frameData */.uv;
|
|
this.history = [{ ...point, timestamp }];
|
|
const { onSessionStart } = handlers;
|
|
onSessionStart &&
|
|
onSessionStart(event, getPanInfo(initialInfo, this.history));
|
|
this.removeListeners = pipe(addPointerEvent(this.contextWindow, "pointermove", this.handlePointerMove), addPointerEvent(this.contextWindow, "pointerup", this.handlePointerUp), addPointerEvent(this.contextWindow, "pointercancel", this.handlePointerUp));
|
|
}
|
|
updateHandlers(handlers) {
|
|
this.handlers = handlers;
|
|
}
|
|
end() {
|
|
this.removeListeners && this.removeListeners();
|
|
(0,frameloop_frame/* cancelFrame */.WG)(this.updatePoint);
|
|
}
|
|
}
|
|
function transformPoint(info, transformPagePoint) {
|
|
return transformPagePoint ? { point: transformPagePoint(info.point) } : info;
|
|
}
|
|
function subtractPoint(a, b) {
|
|
return { x: a.x - b.x, y: a.y - b.y };
|
|
}
|
|
function getPanInfo({ point }, history) {
|
|
return {
|
|
point,
|
|
delta: subtractPoint(point, lastDevicePoint(history)),
|
|
offset: subtractPoint(point, startDevicePoint(history)),
|
|
velocity: getVelocity(history, 0.1),
|
|
};
|
|
}
|
|
function startDevicePoint(history) {
|
|
return history[0];
|
|
}
|
|
function lastDevicePoint(history) {
|
|
return history[history.length - 1];
|
|
}
|
|
function getVelocity(history, timeDelta) {
|
|
if (history.length < 2) {
|
|
return { x: 0, y: 0 };
|
|
}
|
|
let i = history.length - 1;
|
|
let timestampedPoint = null;
|
|
const lastPoint = lastDevicePoint(history);
|
|
while (i >= 0) {
|
|
timestampedPoint = history[i];
|
|
if (lastPoint.timestamp - timestampedPoint.timestamp >
|
|
secondsToMilliseconds(timeDelta)) {
|
|
break;
|
|
}
|
|
i--;
|
|
}
|
|
if (!timestampedPoint) {
|
|
return { x: 0, y: 0 };
|
|
}
|
|
const time = millisecondsToSeconds(lastPoint.timestamp - timestampedPoint.timestamp);
|
|
if (time === 0) {
|
|
return { x: 0, y: 0 };
|
|
}
|
|
const currentVelocity = {
|
|
x: (lastPoint.x - timestampedPoint.x) / time,
|
|
y: (lastPoint.y - timestampedPoint.y) / time,
|
|
};
|
|
if (currentVelocity.x === Infinity) {
|
|
currentVelocity.x = 0;
|
|
}
|
|
if (currentVelocity.y === Infinity) {
|
|
currentVelocity.y = 0;
|
|
}
|
|
return currentVelocity;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/projection/geometry/delta-calc.mjs
|
|
|
|
|
|
const SCALE_PRECISION = 0.0001;
|
|
const SCALE_MIN = 1 - SCALE_PRECISION;
|
|
const SCALE_MAX = 1 + SCALE_PRECISION;
|
|
const TRANSLATE_PRECISION = 0.01;
|
|
const TRANSLATE_MIN = 0 - TRANSLATE_PRECISION;
|
|
const TRANSLATE_MAX = 0 + TRANSLATE_PRECISION;
|
|
function calcLength(axis) {
|
|
return axis.max - axis.min;
|
|
}
|
|
function isNear(value, target, maxDistance) {
|
|
return Math.abs(value - target) <= maxDistance;
|
|
}
|
|
function calcAxisDelta(delta, source, target, origin = 0.5) {
|
|
delta.origin = origin;
|
|
delta.originPoint = mixNumber(source.min, source.max, delta.origin);
|
|
delta.scale = calcLength(target) / calcLength(source);
|
|
delta.translate =
|
|
mixNumber(target.min, target.max, delta.origin) - delta.originPoint;
|
|
if ((delta.scale >= SCALE_MIN && delta.scale <= SCALE_MAX) ||
|
|
isNaN(delta.scale)) {
|
|
delta.scale = 1.0;
|
|
}
|
|
if ((delta.translate >= TRANSLATE_MIN &&
|
|
delta.translate <= TRANSLATE_MAX) ||
|
|
isNaN(delta.translate)) {
|
|
delta.translate = 0.0;
|
|
}
|
|
}
|
|
function calcBoxDelta(delta, source, target, origin) {
|
|
calcAxisDelta(delta.x, source.x, target.x, origin ? origin.originX : undefined);
|
|
calcAxisDelta(delta.y, source.y, target.y, origin ? origin.originY : undefined);
|
|
}
|
|
function calcRelativeAxis(target, relative, parent) {
|
|
target.min = parent.min + relative.min;
|
|
target.max = target.min + calcLength(relative);
|
|
}
|
|
function calcRelativeBox(target, relative, parent) {
|
|
calcRelativeAxis(target.x, relative.x, parent.x);
|
|
calcRelativeAxis(target.y, relative.y, parent.y);
|
|
}
|
|
function calcRelativeAxisPosition(target, layout, parent) {
|
|
target.min = layout.min - parent.min;
|
|
target.max = target.min + calcLength(layout);
|
|
}
|
|
function calcRelativePosition(target, layout, parent) {
|
|
calcRelativeAxisPosition(target.x, layout.x, parent.x);
|
|
calcRelativeAxisPosition(target.y, layout.y, parent.y);
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/gestures/drag/utils/constraints.mjs
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Apply constraints to a point. These constraints are both physical along an
|
|
* axis, and an elastic factor that determines how much to constrain the point
|
|
* by if it does lie outside the defined parameters.
|
|
*/
|
|
function applyConstraints(point, { min, max }, elastic) {
|
|
if (min !== undefined && point < min) {
|
|
// If we have a min point defined, and this is outside of that, constrain
|
|
point = elastic
|
|
? mixNumber(min, point, elastic.min)
|
|
: Math.max(point, min);
|
|
}
|
|
else if (max !== undefined && point > max) {
|
|
// If we have a max point defined, and this is outside of that, constrain
|
|
point = elastic
|
|
? mixNumber(max, point, elastic.max)
|
|
: Math.min(point, max);
|
|
}
|
|
return point;
|
|
}
|
|
/**
|
|
* Calculate constraints in terms of the viewport when defined relatively to the
|
|
* measured axis. This is measured from the nearest edge, so a max constraint of 200
|
|
* on an axis with a max value of 300 would return a constraint of 500 - axis length
|
|
*/
|
|
function calcRelativeAxisConstraints(axis, min, max) {
|
|
return {
|
|
min: min !== undefined ? axis.min + min : undefined,
|
|
max: max !== undefined
|
|
? axis.max + max - (axis.max - axis.min)
|
|
: undefined,
|
|
};
|
|
}
|
|
/**
|
|
* Calculate constraints in terms of the viewport when
|
|
* defined relatively to the measured bounding box.
|
|
*/
|
|
function calcRelativeConstraints(layoutBox, { top, left, bottom, right }) {
|
|
return {
|
|
x: calcRelativeAxisConstraints(layoutBox.x, left, right),
|
|
y: calcRelativeAxisConstraints(layoutBox.y, top, bottom),
|
|
};
|
|
}
|
|
/**
|
|
* Calculate viewport constraints when defined as another viewport-relative axis
|
|
*/
|
|
function calcViewportAxisConstraints(layoutAxis, constraintsAxis) {
|
|
let min = constraintsAxis.min - layoutAxis.min;
|
|
let max = constraintsAxis.max - layoutAxis.max;
|
|
// If the constraints axis is actually smaller than the layout axis then we can
|
|
// flip the constraints
|
|
if (constraintsAxis.max - constraintsAxis.min <
|
|
layoutAxis.max - layoutAxis.min) {
|
|
[min, max] = [max, min];
|
|
}
|
|
return { min, max };
|
|
}
|
|
/**
|
|
* Calculate viewport constraints when defined as another viewport-relative box
|
|
*/
|
|
function calcViewportConstraints(layoutBox, constraintsBox) {
|
|
return {
|
|
x: calcViewportAxisConstraints(layoutBox.x, constraintsBox.x),
|
|
y: calcViewportAxisConstraints(layoutBox.y, constraintsBox.y),
|
|
};
|
|
}
|
|
/**
|
|
* Calculate a transform origin relative to the source axis, between 0-1, that results
|
|
* in an asthetically pleasing scale/transform needed to project from source to target.
|
|
*/
|
|
function constraints_calcOrigin(source, target) {
|
|
let origin = 0.5;
|
|
const sourceLength = calcLength(source);
|
|
const targetLength = calcLength(target);
|
|
if (targetLength > sourceLength) {
|
|
origin = progress(target.min, target.max - sourceLength, source.min);
|
|
}
|
|
else if (sourceLength > targetLength) {
|
|
origin = progress(source.min, source.max - targetLength, target.min);
|
|
}
|
|
return clamp(0, 1, origin);
|
|
}
|
|
/**
|
|
* Rebase the calculated viewport constraints relative to the layout.min point.
|
|
*/
|
|
function rebaseAxisConstraints(layout, constraints) {
|
|
const relativeConstraints = {};
|
|
if (constraints.min !== undefined) {
|
|
relativeConstraints.min = constraints.min - layout.min;
|
|
}
|
|
if (constraints.max !== undefined) {
|
|
relativeConstraints.max = constraints.max - layout.min;
|
|
}
|
|
return relativeConstraints;
|
|
}
|
|
const defaultElastic = 0.35;
|
|
/**
|
|
* Accepts a dragElastic prop and returns resolved elastic values for each axis.
|
|
*/
|
|
function resolveDragElastic(dragElastic = defaultElastic) {
|
|
if (dragElastic === false) {
|
|
dragElastic = 0;
|
|
}
|
|
else if (dragElastic === true) {
|
|
dragElastic = defaultElastic;
|
|
}
|
|
return {
|
|
x: resolveAxisElastic(dragElastic, "left", "right"),
|
|
y: resolveAxisElastic(dragElastic, "top", "bottom"),
|
|
};
|
|
}
|
|
function resolveAxisElastic(dragElastic, minLabel, maxLabel) {
|
|
return {
|
|
min: resolvePointElastic(dragElastic, minLabel),
|
|
max: resolvePointElastic(dragElastic, maxLabel),
|
|
};
|
|
}
|
|
function resolvePointElastic(dragElastic, label) {
|
|
return typeof dragElastic === "number"
|
|
? dragElastic
|
|
: dragElastic[label] || 0;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/projection/geometry/models.mjs
|
|
const createAxisDelta = () => ({
|
|
translate: 0,
|
|
scale: 1,
|
|
origin: 0,
|
|
originPoint: 0,
|
|
});
|
|
const createDelta = () => ({
|
|
x: createAxisDelta(),
|
|
y: createAxisDelta(),
|
|
});
|
|
const createAxis = () => ({ min: 0, max: 0 });
|
|
const createBox = () => ({
|
|
x: createAxis(),
|
|
y: createAxis(),
|
|
});
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/projection/utils/each-axis.mjs
|
|
function eachAxis(callback) {
|
|
return [callback("x"), callback("y")];
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/projection/geometry/conversion.mjs
|
|
/**
|
|
* Bounding boxes tend to be defined as top, left, right, bottom. For various operations
|
|
* it's easier to consider each axis individually. This function returns a bounding box
|
|
* as a map of single-axis min/max values.
|
|
*/
|
|
function convertBoundingBoxToBox({ top, left, right, bottom, }) {
|
|
return {
|
|
x: { min: left, max: right },
|
|
y: { min: top, max: bottom },
|
|
};
|
|
}
|
|
function convertBoxToBoundingBox({ x, y }) {
|
|
return { top: y.min, right: x.max, bottom: y.max, left: x.min };
|
|
}
|
|
/**
|
|
* Applies a TransformPoint function to a bounding box. TransformPoint is usually a function
|
|
* provided by Framer to allow measured points to be corrected for device scaling. This is used
|
|
* when measuring DOM elements and DOM event points.
|
|
*/
|
|
function transformBoxPoints(point, transformPoint) {
|
|
if (!transformPoint)
|
|
return point;
|
|
const topLeft = transformPoint({ x: point.left, y: point.top });
|
|
const bottomRight = transformPoint({ x: point.right, y: point.bottom });
|
|
return {
|
|
top: topLeft.y,
|
|
left: topLeft.x,
|
|
bottom: bottomRight.y,
|
|
right: bottomRight.x,
|
|
};
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/projection/utils/has-transform.mjs
|
|
function isIdentityScale(scale) {
|
|
return scale === undefined || scale === 1;
|
|
}
|
|
function hasScale({ scale, scaleX, scaleY }) {
|
|
return (!isIdentityScale(scale) ||
|
|
!isIdentityScale(scaleX) ||
|
|
!isIdentityScale(scaleY));
|
|
}
|
|
function hasTransform(values) {
|
|
return (hasScale(values) ||
|
|
has2DTranslate(values) ||
|
|
values.z ||
|
|
values.rotate ||
|
|
values.rotateX ||
|
|
values.rotateY ||
|
|
values.skewX ||
|
|
values.skewY);
|
|
}
|
|
function has2DTranslate(values) {
|
|
return is2DTranslate(values.x) || is2DTranslate(values.y);
|
|
}
|
|
function is2DTranslate(value) {
|
|
return value && value !== "0%";
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/projection/geometry/delta-apply.mjs
|
|
|
|
|
|
|
|
/**
|
|
* Scales a point based on a factor and an originPoint
|
|
*/
|
|
function scalePoint(point, scale, originPoint) {
|
|
const distanceFromOrigin = point - originPoint;
|
|
const scaled = scale * distanceFromOrigin;
|
|
return originPoint + scaled;
|
|
}
|
|
/**
|
|
* Applies a translate/scale delta to a point
|
|
*/
|
|
function applyPointDelta(point, translate, scale, originPoint, boxScale) {
|
|
if (boxScale !== undefined) {
|
|
point = scalePoint(point, boxScale, originPoint);
|
|
}
|
|
return scalePoint(point, scale, originPoint) + translate;
|
|
}
|
|
/**
|
|
* Applies a translate/scale delta to an axis
|
|
*/
|
|
function applyAxisDelta(axis, translate = 0, scale = 1, originPoint, boxScale) {
|
|
axis.min = applyPointDelta(axis.min, translate, scale, originPoint, boxScale);
|
|
axis.max = applyPointDelta(axis.max, translate, scale, originPoint, boxScale);
|
|
}
|
|
/**
|
|
* Applies a translate/scale delta to a box
|
|
*/
|
|
function applyBoxDelta(box, { x, y }) {
|
|
applyAxisDelta(box.x, x.translate, x.scale, x.originPoint);
|
|
applyAxisDelta(box.y, y.translate, y.scale, y.originPoint);
|
|
}
|
|
const TREE_SCALE_SNAP_MIN = 0.999999999999;
|
|
const TREE_SCALE_SNAP_MAX = 1.0000000000001;
|
|
/**
|
|
* Apply a tree of deltas to a box. We do this to calculate the effect of all the transforms
|
|
* in a tree upon our box before then calculating how to project it into our desired viewport-relative box
|
|
*
|
|
* This is the final nested loop within updateLayoutDelta for future refactoring
|
|
*/
|
|
function applyTreeDeltas(box, treeScale, treePath, isSharedTransition = false) {
|
|
const treeLength = treePath.length;
|
|
if (!treeLength)
|
|
return;
|
|
// Reset the treeScale
|
|
treeScale.x = treeScale.y = 1;
|
|
let node;
|
|
let delta;
|
|
for (let i = 0; i < treeLength; i++) {
|
|
node = treePath[i];
|
|
delta = node.projectionDelta;
|
|
/**
|
|
* TODO: Prefer to remove this, but currently we have motion components with
|
|
* display: contents in Framer.
|
|
*/
|
|
const { visualElement } = node.options;
|
|
if (visualElement &&
|
|
visualElement.props.style &&
|
|
visualElement.props.style.display === "contents") {
|
|
continue;
|
|
}
|
|
if (isSharedTransition &&
|
|
node.options.layoutScroll &&
|
|
node.scroll &&
|
|
node !== node.root) {
|
|
transformBox(box, {
|
|
x: -node.scroll.offset.x,
|
|
y: -node.scroll.offset.y,
|
|
});
|
|
}
|
|
if (delta) {
|
|
// Incoporate each ancestor's scale into a culmulative treeScale for this component
|
|
treeScale.x *= delta.x.scale;
|
|
treeScale.y *= delta.y.scale;
|
|
// Apply each ancestor's calculated delta into this component's recorded layout box
|
|
applyBoxDelta(box, delta);
|
|
}
|
|
if (isSharedTransition && hasTransform(node.latestValues)) {
|
|
transformBox(box, node.latestValues);
|
|
}
|
|
}
|
|
/**
|
|
* Snap tree scale back to 1 if it's within a non-perceivable threshold.
|
|
* This will help reduce useless scales getting rendered.
|
|
*/
|
|
if (treeScale.x < TREE_SCALE_SNAP_MAX &&
|
|
treeScale.x > TREE_SCALE_SNAP_MIN) {
|
|
treeScale.x = 1.0;
|
|
}
|
|
if (treeScale.y < TREE_SCALE_SNAP_MAX &&
|
|
treeScale.y > TREE_SCALE_SNAP_MIN) {
|
|
treeScale.y = 1.0;
|
|
}
|
|
}
|
|
function translateAxis(axis, distance) {
|
|
axis.min = axis.min + distance;
|
|
axis.max = axis.max + distance;
|
|
}
|
|
/**
|
|
* Apply a transform to an axis from the latest resolved motion values.
|
|
* This function basically acts as a bridge between a flat motion value map
|
|
* and applyAxisDelta
|
|
*/
|
|
function transformAxis(axis, axisTranslate, axisScale, boxScale, axisOrigin = 0.5) {
|
|
const originPoint = mixNumber(axis.min, axis.max, axisOrigin);
|
|
// Apply the axis delta to the final axis
|
|
applyAxisDelta(axis, axisTranslate, axisScale, originPoint, boxScale);
|
|
}
|
|
/**
|
|
* Apply a transform to a box from the latest resolved motion values.
|
|
*/
|
|
function transformBox(box, transform) {
|
|
transformAxis(box.x, transform.x, transform.scaleX, transform.scale, transform.originX);
|
|
transformAxis(box.y, transform.y, transform.scaleY, transform.scale, transform.originY);
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/projection/utils/measure.mjs
|
|
|
|
|
|
|
|
function measureViewportBox(instance, transformPoint) {
|
|
return convertBoundingBoxToBox(transformBoxPoints(instance.getBoundingClientRect(), transformPoint));
|
|
}
|
|
function measurePageBox(element, rootProjectionNode, transformPagePoint) {
|
|
const viewportBox = measureViewportBox(element, transformPagePoint);
|
|
const { scroll } = rootProjectionNode;
|
|
if (scroll) {
|
|
translateAxis(viewportBox.x, scroll.offset.x);
|
|
translateAxis(viewportBox.y, scroll.offset.y);
|
|
}
|
|
return viewportBox;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/get-context-window.mjs
|
|
// Fixes https://github.com/framer/motion/issues/2270
|
|
const getContextWindow = ({ current }) => {
|
|
return current ? current.ownerDocument.defaultView : null;
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/gestures/drag/VisualElementDragControls.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const elementDragControls = new WeakMap();
|
|
/**
|
|
*
|
|
*/
|
|
// let latestPointerEvent: PointerEvent
|
|
class VisualElementDragControls {
|
|
constructor(visualElement) {
|
|
// This is a reference to the global drag gesture lock, ensuring only one component
|
|
// can "capture" the drag of one or both axes.
|
|
// TODO: Look into moving this into pansession?
|
|
this.openGlobalLock = null;
|
|
this.isDragging = false;
|
|
this.currentDirection = null;
|
|
this.originPoint = { x: 0, y: 0 };
|
|
/**
|
|
* The permitted boundaries of travel, in pixels.
|
|
*/
|
|
this.constraints = false;
|
|
this.hasMutatedConstraints = false;
|
|
/**
|
|
* The per-axis resolved elastic values.
|
|
*/
|
|
this.elastic = createBox();
|
|
this.visualElement = visualElement;
|
|
}
|
|
start(originEvent, { snapToCursor = false } = {}) {
|
|
/**
|
|
* Don't start dragging if this component is exiting
|
|
*/
|
|
const { presenceContext } = this.visualElement;
|
|
if (presenceContext && presenceContext.isPresent === false)
|
|
return;
|
|
const onSessionStart = (event) => {
|
|
const { dragSnapToOrigin } = this.getProps();
|
|
// Stop or pause any animations on both axis values immediately. This allows the user to throw and catch
|
|
// the component.
|
|
dragSnapToOrigin ? this.pauseAnimation() : this.stopAnimation();
|
|
if (snapToCursor) {
|
|
this.snapToCursor(extractEventInfo(event, "page").point);
|
|
}
|
|
};
|
|
const onStart = (event, info) => {
|
|
var _a;
|
|
// Attempt to grab the global drag gesture lock - maybe make this part of PanSession
|
|
const { drag, dragPropagation, onDragStart } = this.getProps();
|
|
if (drag && !dragPropagation) {
|
|
if (this.openGlobalLock)
|
|
this.openGlobalLock();
|
|
this.openGlobalLock = getGlobalLock(drag);
|
|
// If we don 't have the lock, don't start dragging
|
|
if (!this.openGlobalLock)
|
|
return;
|
|
}
|
|
this.isDragging = true;
|
|
this.currentDirection = null;
|
|
this.resolveConstraints();
|
|
if (this.visualElement.projection) {
|
|
this.visualElement.projection.isAnimationBlocked = true;
|
|
this.visualElement.projection.target = undefined;
|
|
}
|
|
/**
|
|
* Record gesture origin
|
|
*/
|
|
eachAxis((axis) => {
|
|
let current = this.getAxisMotionValue(axis).get() || 0;
|
|
/**
|
|
* If the MotionValue is a percentage value convert to px
|
|
*/
|
|
if (percent.test(current)) {
|
|
const { projection } = this.visualElement;
|
|
if (projection && projection.layout) {
|
|
const measuredAxis = projection.layout.layoutBox[axis];
|
|
if (measuredAxis) {
|
|
const length = calcLength(measuredAxis);
|
|
current = length * (parseFloat(current) / 100);
|
|
}
|
|
}
|
|
}
|
|
this.originPoint[axis] = current;
|
|
});
|
|
// Fire onDragStart event
|
|
if (onDragStart) {
|
|
frameloop_frame/* frame */.Gt.postRender(() => onDragStart(event, info));
|
|
}
|
|
(_a = this.removeWillChange) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
this.removeWillChange = addValueToWillChange(this.visualElement, "transform");
|
|
const { animationState } = this.visualElement;
|
|
animationState && animationState.setActive("whileDrag", true);
|
|
};
|
|
const onMove = (event, info) => {
|
|
// latestPointerEvent = event
|
|
const { dragPropagation, dragDirectionLock, onDirectionLock, onDrag, } = this.getProps();
|
|
// If we didn't successfully receive the gesture lock, early return.
|
|
if (!dragPropagation && !this.openGlobalLock)
|
|
return;
|
|
const { offset } = info;
|
|
// Attempt to detect drag direction if directionLock is true
|
|
if (dragDirectionLock && this.currentDirection === null) {
|
|
this.currentDirection = getCurrentDirection(offset);
|
|
// If we've successfully set a direction, notify listener
|
|
if (this.currentDirection !== null) {
|
|
onDirectionLock && onDirectionLock(this.currentDirection);
|
|
}
|
|
return;
|
|
}
|
|
// Update each point with the latest position
|
|
this.updateAxis("x", info.point, offset);
|
|
this.updateAxis("y", info.point, offset);
|
|
/**
|
|
* Ideally we would leave the renderer to fire naturally at the end of
|
|
* this frame but if the element is about to change layout as the result
|
|
* of a re-render we want to ensure the browser can read the latest
|
|
* bounding box to ensure the pointer and element don't fall out of sync.
|
|
*/
|
|
this.visualElement.render();
|
|
/**
|
|
* This must fire after the render call as it might trigger a state
|
|
* change which itself might trigger a layout update.
|
|
*/
|
|
onDrag && onDrag(event, info);
|
|
};
|
|
const onSessionEnd = (event, info) => this.stop(event, info);
|
|
const resumeAnimation = () => eachAxis((axis) => {
|
|
var _a;
|
|
return this.getAnimationState(axis) === "paused" &&
|
|
((_a = this.getAxisMotionValue(axis).animation) === null || _a === void 0 ? void 0 : _a.play());
|
|
});
|
|
const { dragSnapToOrigin } = this.getProps();
|
|
this.panSession = new PanSession(originEvent, {
|
|
onSessionStart,
|
|
onStart,
|
|
onMove,
|
|
onSessionEnd,
|
|
resumeAnimation,
|
|
}, {
|
|
transformPagePoint: this.visualElement.getTransformPagePoint(),
|
|
dragSnapToOrigin,
|
|
contextWindow: getContextWindow(this.visualElement),
|
|
});
|
|
}
|
|
stop(event, info) {
|
|
var _a;
|
|
(_a = this.removeWillChange) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
const isDragging = this.isDragging;
|
|
this.cancel();
|
|
if (!isDragging)
|
|
return;
|
|
const { velocity } = info;
|
|
this.startAnimation(velocity);
|
|
const { onDragEnd } = this.getProps();
|
|
if (onDragEnd) {
|
|
frameloop_frame/* frame */.Gt.postRender(() => onDragEnd(event, info));
|
|
}
|
|
}
|
|
cancel() {
|
|
this.isDragging = false;
|
|
const { projection, animationState } = this.visualElement;
|
|
if (projection) {
|
|
projection.isAnimationBlocked = false;
|
|
}
|
|
this.panSession && this.panSession.end();
|
|
this.panSession = undefined;
|
|
const { dragPropagation } = this.getProps();
|
|
if (!dragPropagation && this.openGlobalLock) {
|
|
this.openGlobalLock();
|
|
this.openGlobalLock = null;
|
|
}
|
|
animationState && animationState.setActive("whileDrag", false);
|
|
}
|
|
updateAxis(axis, _point, offset) {
|
|
const { drag } = this.getProps();
|
|
// If we're not dragging this axis, do an early return.
|
|
if (!offset || !shouldDrag(axis, drag, this.currentDirection))
|
|
return;
|
|
const axisValue = this.getAxisMotionValue(axis);
|
|
let next = this.originPoint[axis] + offset[axis];
|
|
// Apply constraints
|
|
if (this.constraints && this.constraints[axis]) {
|
|
next = applyConstraints(next, this.constraints[axis], this.elastic[axis]);
|
|
}
|
|
axisValue.set(next);
|
|
}
|
|
resolveConstraints() {
|
|
var _a;
|
|
const { dragConstraints, dragElastic } = this.getProps();
|
|
const layout = this.visualElement.projection &&
|
|
!this.visualElement.projection.layout
|
|
? this.visualElement.projection.measure(false)
|
|
: (_a = this.visualElement.projection) === null || _a === void 0 ? void 0 : _a.layout;
|
|
const prevConstraints = this.constraints;
|
|
if (dragConstraints && isRefObject(dragConstraints)) {
|
|
if (!this.constraints) {
|
|
this.constraints = this.resolveRefConstraints();
|
|
}
|
|
}
|
|
else {
|
|
if (dragConstraints && layout) {
|
|
this.constraints = calcRelativeConstraints(layout.layoutBox, dragConstraints);
|
|
}
|
|
else {
|
|
this.constraints = false;
|
|
}
|
|
}
|
|
this.elastic = resolveDragElastic(dragElastic);
|
|
/**
|
|
* If we're outputting to external MotionValues, we want to rebase the measured constraints
|
|
* from viewport-relative to component-relative.
|
|
*/
|
|
if (prevConstraints !== this.constraints &&
|
|
layout &&
|
|
this.constraints &&
|
|
!this.hasMutatedConstraints) {
|
|
eachAxis((axis) => {
|
|
if (this.constraints !== false &&
|
|
this.getAxisMotionValue(axis)) {
|
|
this.constraints[axis] = rebaseAxisConstraints(layout.layoutBox[axis], this.constraints[axis]);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
resolveRefConstraints() {
|
|
const { dragConstraints: constraints, onMeasureDragConstraints } = this.getProps();
|
|
if (!constraints || !isRefObject(constraints))
|
|
return false;
|
|
const constraintsElement = constraints.current;
|
|
invariant(constraintsElement !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");
|
|
const { projection } = this.visualElement;
|
|
// TODO
|
|
if (!projection || !projection.layout)
|
|
return false;
|
|
const constraintsBox = measurePageBox(constraintsElement, projection.root, this.visualElement.getTransformPagePoint());
|
|
let measuredConstraints = calcViewportConstraints(projection.layout.layoutBox, constraintsBox);
|
|
/**
|
|
* If there's an onMeasureDragConstraints listener we call it and
|
|
* if different constraints are returned, set constraints to that
|
|
*/
|
|
if (onMeasureDragConstraints) {
|
|
const userConstraints = onMeasureDragConstraints(convertBoxToBoundingBox(measuredConstraints));
|
|
this.hasMutatedConstraints = !!userConstraints;
|
|
if (userConstraints) {
|
|
measuredConstraints = convertBoundingBoxToBox(userConstraints);
|
|
}
|
|
}
|
|
return measuredConstraints;
|
|
}
|
|
startAnimation(velocity) {
|
|
const { drag, dragMomentum, dragElastic, dragTransition, dragSnapToOrigin, onDragTransitionEnd, } = this.getProps();
|
|
const constraints = this.constraints || {};
|
|
const momentumAnimations = eachAxis((axis) => {
|
|
if (!shouldDrag(axis, drag, this.currentDirection)) {
|
|
return;
|
|
}
|
|
let transition = (constraints && constraints[axis]) || {};
|
|
if (dragSnapToOrigin)
|
|
transition = { min: 0, max: 0 };
|
|
/**
|
|
* Overdamp the boundary spring if `dragElastic` is disabled. There's still a frame
|
|
* of spring animations so we should look into adding a disable spring option to `inertia`.
|
|
* We could do something here where we affect the `bounceStiffness` and `bounceDamping`
|
|
* using the value of `dragElastic`.
|
|
*/
|
|
const bounceStiffness = dragElastic ? 200 : 1000000;
|
|
const bounceDamping = dragElastic ? 40 : 10000000;
|
|
const inertia = {
|
|
type: "inertia",
|
|
velocity: dragMomentum ? velocity[axis] : 0,
|
|
bounceStiffness,
|
|
bounceDamping,
|
|
timeConstant: 750,
|
|
restDelta: 1,
|
|
restSpeed: 10,
|
|
...dragTransition,
|
|
...transition,
|
|
};
|
|
// If we're not animating on an externally-provided `MotionValue` we can use the
|
|
// component's animation controls which will handle interactions with whileHover (etc),
|
|
// otherwise we just have to animate the `MotionValue` itself.
|
|
return this.startAxisValueAnimation(axis, inertia);
|
|
});
|
|
// Run all animations and then resolve the new drag constraints.
|
|
return Promise.all(momentumAnimations).then(onDragTransitionEnd);
|
|
}
|
|
startAxisValueAnimation(axis, transition) {
|
|
const axisValue = this.getAxisMotionValue(axis);
|
|
return axisValue.start(animateMotionValue(axis, axisValue, 0, transition, this.visualElement, false, addValueToWillChange(this.visualElement, axis)));
|
|
}
|
|
stopAnimation() {
|
|
eachAxis((axis) => this.getAxisMotionValue(axis).stop());
|
|
}
|
|
pauseAnimation() {
|
|
eachAxis((axis) => { var _a; return (_a = this.getAxisMotionValue(axis).animation) === null || _a === void 0 ? void 0 : _a.pause(); });
|
|
}
|
|
getAnimationState(axis) {
|
|
var _a;
|
|
return (_a = this.getAxisMotionValue(axis).animation) === null || _a === void 0 ? void 0 : _a.state;
|
|
}
|
|
/**
|
|
* Drag works differently depending on which props are provided.
|
|
*
|
|
* - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.
|
|
* - Otherwise, we apply the delta to the x/y motion values.
|
|
*/
|
|
getAxisMotionValue(axis) {
|
|
const dragKey = `_drag${axis.toUpperCase()}`;
|
|
const props = this.visualElement.getProps();
|
|
const externalMotionValue = props[dragKey];
|
|
return externalMotionValue
|
|
? externalMotionValue
|
|
: this.visualElement.getValue(axis, (props.initial
|
|
? props.initial[axis]
|
|
: undefined) || 0);
|
|
}
|
|
snapToCursor(point) {
|
|
eachAxis((axis) => {
|
|
const { drag } = this.getProps();
|
|
// If we're not dragging this axis, do an early return.
|
|
if (!shouldDrag(axis, drag, this.currentDirection))
|
|
return;
|
|
const { projection } = this.visualElement;
|
|
const axisValue = this.getAxisMotionValue(axis);
|
|
if (projection && projection.layout) {
|
|
const { min, max } = projection.layout.layoutBox[axis];
|
|
axisValue.set(point[axis] - mixNumber(min, max, 0.5));
|
|
}
|
|
});
|
|
}
|
|
/**
|
|
* When the viewport resizes we want to check if the measured constraints
|
|
* have changed and, if so, reposition the element within those new constraints
|
|
* relative to where it was before the resize.
|
|
*/
|
|
scalePositionWithinConstraints() {
|
|
if (!this.visualElement.current)
|
|
return;
|
|
const { drag, dragConstraints } = this.getProps();
|
|
const { projection } = this.visualElement;
|
|
if (!isRefObject(dragConstraints) || !projection || !this.constraints)
|
|
return;
|
|
/**
|
|
* Stop current animations as there can be visual glitching if we try to do
|
|
* this mid-animation
|
|
*/
|
|
this.stopAnimation();
|
|
/**
|
|
* Record the relative position of the dragged element relative to the
|
|
* constraints box and save as a progress value.
|
|
*/
|
|
const boxProgress = { x: 0, y: 0 };
|
|
eachAxis((axis) => {
|
|
const axisValue = this.getAxisMotionValue(axis);
|
|
if (axisValue && this.constraints !== false) {
|
|
const latest = axisValue.get();
|
|
boxProgress[axis] = constraints_calcOrigin({ min: latest, max: latest }, this.constraints[axis]);
|
|
}
|
|
});
|
|
/**
|
|
* Update the layout of this element and resolve the latest drag constraints
|
|
*/
|
|
const { transformTemplate } = this.visualElement.getProps();
|
|
this.visualElement.current.style.transform = transformTemplate
|
|
? transformTemplate({}, "")
|
|
: "none";
|
|
projection.root && projection.root.updateScroll();
|
|
projection.updateLayout();
|
|
this.resolveConstraints();
|
|
/**
|
|
* For each axis, calculate the current progress of the layout axis
|
|
* within the new constraints.
|
|
*/
|
|
eachAxis((axis) => {
|
|
if (!shouldDrag(axis, drag, null))
|
|
return;
|
|
/**
|
|
* Calculate a new transform based on the previous box progress
|
|
*/
|
|
const axisValue = this.getAxisMotionValue(axis);
|
|
const { min, max } = this.constraints[axis];
|
|
axisValue.set(mixNumber(min, max, boxProgress[axis]));
|
|
});
|
|
}
|
|
addListeners() {
|
|
if (!this.visualElement.current)
|
|
return;
|
|
elementDragControls.set(this.visualElement, this);
|
|
const element = this.visualElement.current;
|
|
/**
|
|
* Attach a pointerdown event listener on this DOM element to initiate drag tracking.
|
|
*/
|
|
const stopPointerListener = addPointerEvent(element, "pointerdown", (event) => {
|
|
const { drag, dragListener = true } = this.getProps();
|
|
drag && dragListener && this.start(event);
|
|
});
|
|
const measureDragConstraints = () => {
|
|
const { dragConstraints } = this.getProps();
|
|
if (isRefObject(dragConstraints) && dragConstraints.current) {
|
|
this.constraints = this.resolveRefConstraints();
|
|
}
|
|
};
|
|
const { projection } = this.visualElement;
|
|
const stopMeasureLayoutListener = projection.addEventListener("measure", measureDragConstraints);
|
|
if (projection && !projection.layout) {
|
|
projection.root && projection.root.updateScroll();
|
|
projection.updateLayout();
|
|
}
|
|
frameloop_frame/* frame */.Gt.read(measureDragConstraints);
|
|
/**
|
|
* Attach a window resize listener to scale the draggable target within its defined
|
|
* constraints as the window resizes.
|
|
*/
|
|
const stopResizeListener = addDomEvent(window, "resize", () => this.scalePositionWithinConstraints());
|
|
/**
|
|
* If the element's layout changes, calculate the delta and apply that to
|
|
* the drag gesture's origin point.
|
|
*/
|
|
const stopLayoutUpdateListener = projection.addEventListener("didUpdate", (({ delta, hasLayoutChanged }) => {
|
|
if (this.isDragging && hasLayoutChanged) {
|
|
eachAxis((axis) => {
|
|
const motionValue = this.getAxisMotionValue(axis);
|
|
if (!motionValue)
|
|
return;
|
|
this.originPoint[axis] += delta[axis].translate;
|
|
motionValue.set(motionValue.get() + delta[axis].translate);
|
|
});
|
|
this.visualElement.render();
|
|
}
|
|
}));
|
|
return () => {
|
|
stopResizeListener();
|
|
stopPointerListener();
|
|
stopMeasureLayoutListener();
|
|
stopLayoutUpdateListener && stopLayoutUpdateListener();
|
|
};
|
|
}
|
|
getProps() {
|
|
const props = this.visualElement.getProps();
|
|
const { drag = false, dragDirectionLock = false, dragPropagation = false, dragConstraints = false, dragElastic = defaultElastic, dragMomentum = true, } = props;
|
|
return {
|
|
...props,
|
|
drag,
|
|
dragDirectionLock,
|
|
dragPropagation,
|
|
dragConstraints,
|
|
dragElastic,
|
|
dragMomentum,
|
|
};
|
|
}
|
|
}
|
|
function shouldDrag(direction, drag, currentDirection) {
|
|
return ((drag === true || drag === direction) &&
|
|
(currentDirection === null || currentDirection === direction));
|
|
}
|
|
/**
|
|
* Based on an x/y offset determine the current drag direction. If both axis' offsets are lower
|
|
* than the provided threshold, return `null`.
|
|
*
|
|
* @param offset - The x/y offset from origin.
|
|
* @param lockThreshold - (Optional) - the minimum absolute offset before we can determine a drag direction.
|
|
*/
|
|
function getCurrentDirection(offset, lockThreshold = 10) {
|
|
let direction = null;
|
|
if (Math.abs(offset.y) > lockThreshold) {
|
|
direction = "y";
|
|
}
|
|
else if (Math.abs(offset.x) > lockThreshold) {
|
|
direction = "x";
|
|
}
|
|
return direction;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/gestures/drag/index.mjs
|
|
|
|
|
|
|
|
|
|
class DragGesture extends Feature {
|
|
constructor(node) {
|
|
super(node);
|
|
this.removeGroupControls = noop/* noop */.l;
|
|
this.removeListeners = noop/* noop */.l;
|
|
this.controls = new VisualElementDragControls(node);
|
|
}
|
|
mount() {
|
|
// If we've been provided a DragControls for manual control over the drag gesture,
|
|
// subscribe this component to it on mount.
|
|
const { dragControls } = this.node.getProps();
|
|
if (dragControls) {
|
|
this.removeGroupControls = dragControls.subscribe(this.controls);
|
|
}
|
|
this.removeListeners = this.controls.addListeners() || noop/* noop */.l;
|
|
}
|
|
unmount() {
|
|
this.removeGroupControls();
|
|
this.removeListeners();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/gestures/pan/index.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const asyncHandler = (handler) => (event, info) => {
|
|
if (handler) {
|
|
frameloop_frame/* frame */.Gt.postRender(() => handler(event, info));
|
|
}
|
|
};
|
|
class PanGesture extends Feature {
|
|
constructor() {
|
|
super(...arguments);
|
|
this.removePointerDownListener = noop/* noop */.l;
|
|
}
|
|
onPointerDown(pointerDownEvent) {
|
|
this.session = new PanSession(pointerDownEvent, this.createPanHandlers(), {
|
|
transformPagePoint: this.node.getTransformPagePoint(),
|
|
contextWindow: getContextWindow(this.node),
|
|
});
|
|
}
|
|
createPanHandlers() {
|
|
const { onPanSessionStart, onPanStart, onPan, onPanEnd } = this.node.getProps();
|
|
return {
|
|
onSessionStart: asyncHandler(onPanSessionStart),
|
|
onStart: asyncHandler(onPanStart),
|
|
onMove: onPan,
|
|
onEnd: (event, info) => {
|
|
delete this.session;
|
|
if (onPanEnd) {
|
|
frameloop_frame/* frame */.Gt.postRender(() => onPanEnd(event, info));
|
|
}
|
|
},
|
|
};
|
|
}
|
|
mount() {
|
|
this.removePointerDownListener = addPointerEvent(this.node.current, "pointerdown", (event) => this.onPointerDown(event));
|
|
}
|
|
update() {
|
|
this.session && this.session.updateHandlers(this.createPanHandlers());
|
|
}
|
|
unmount() {
|
|
this.removePointerDownListener();
|
|
this.session && this.session.end();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/components/AnimatePresence/use-presence.mjs
|
|
|
|
|
|
|
|
/**
|
|
* When a component is the child of `AnimatePresence`, it can use `usePresence`
|
|
* to access information about whether it's still present in the React tree.
|
|
*
|
|
* ```jsx
|
|
* import { usePresence } from "framer-motion"
|
|
*
|
|
* export const Component = () => {
|
|
* const [isPresent, safeToRemove] = usePresence()
|
|
*
|
|
* useEffect(() => {
|
|
* !isPresent && setTimeout(safeToRemove, 1000)
|
|
* }, [isPresent])
|
|
*
|
|
* return <div />
|
|
* }
|
|
* ```
|
|
*
|
|
* If `isPresent` is `false`, it means that a component has been removed the tree, but
|
|
* `AnimatePresence` won't really remove it until `safeToRemove` has been called.
|
|
*
|
|
* @public
|
|
*/
|
|
function usePresence() {
|
|
const context = (0,react.useContext)(PresenceContext_PresenceContext);
|
|
if (context === null)
|
|
return [true, null];
|
|
const { isPresent, onExitComplete, register } = context;
|
|
// It's safe to call the following hooks conditionally (after an early return) because the context will always
|
|
// either be null or non-null for the lifespan of the component.
|
|
const id = (0,react.useId)();
|
|
(0,react.useEffect)(() => register(id), []);
|
|
const safeToRemove = (0,react.useCallback)(() => onExitComplete && onExitComplete(id), [id, onExitComplete]);
|
|
return !isPresent && onExitComplete ? [false, safeToRemove] : [true];
|
|
}
|
|
/**
|
|
* Similar to `usePresence`, except `useIsPresent` simply returns whether or not the component is present.
|
|
* There is no `safeToRemove` function.
|
|
*
|
|
* ```jsx
|
|
* import { useIsPresent } from "framer-motion"
|
|
*
|
|
* export const Component = () => {
|
|
* const isPresent = useIsPresent()
|
|
*
|
|
* useEffect(() => {
|
|
* !isPresent && console.log("I've been removed!")
|
|
* }, [isPresent])
|
|
*
|
|
* return <div />
|
|
* }
|
|
* ```
|
|
*
|
|
* @public
|
|
*/
|
|
function useIsPresent() {
|
|
return isPresent(useContext(PresenceContext));
|
|
}
|
|
function isPresent(context) {
|
|
return context === null ? true : context.isPresent;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/projection/node/state.mjs
|
|
/**
|
|
* This should only ever be modified on the client otherwise it'll
|
|
* persist through server requests. If we need instanced states we
|
|
* could lazy-init via root.
|
|
*/
|
|
const globalProjectionState = {
|
|
/**
|
|
* Global flag as to whether the tree has animated since the last time
|
|
* we resized the window
|
|
*/
|
|
hasAnimatedSinceResize: true,
|
|
/**
|
|
* We set this to true once, on the first update. Any nodes added to the tree beyond that
|
|
* update will be given a `data-projection-id` attribute.
|
|
*/
|
|
hasEverUpdated: false,
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/projection/styles/scale-border-radius.mjs
|
|
|
|
|
|
function pixelsToPercent(pixels, axis) {
|
|
if (axis.max === axis.min)
|
|
return 0;
|
|
return (pixels / (axis.max - axis.min)) * 100;
|
|
}
|
|
/**
|
|
* We always correct borderRadius as a percentage rather than pixels to reduce paints.
|
|
* For example, if you are projecting a box that is 100px wide with a 10px borderRadius
|
|
* into a box that is 200px wide with a 20px borderRadius, that is actually a 10%
|
|
* borderRadius in both states. If we animate between the two in pixels that will trigger
|
|
* a paint each time. If we animate between the two in percentage we'll avoid a paint.
|
|
*/
|
|
const correctBorderRadius = {
|
|
correct: (latest, node) => {
|
|
if (!node.target)
|
|
return latest;
|
|
/**
|
|
* If latest is a string, if it's a percentage we can return immediately as it's
|
|
* going to be stretched appropriately. Otherwise, if it's a pixel, convert it to a number.
|
|
*/
|
|
if (typeof latest === "string") {
|
|
if (px.test(latest)) {
|
|
latest = parseFloat(latest);
|
|
}
|
|
else {
|
|
return latest;
|
|
}
|
|
}
|
|
/**
|
|
* If latest is a number, it's a pixel value. We use the current viewportBox to calculate that
|
|
* pixel value as a percentage of each axis
|
|
*/
|
|
const x = pixelsToPercent(latest, node.target.x);
|
|
const y = pixelsToPercent(latest, node.target.y);
|
|
return `${x}% ${y}%`;
|
|
},
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/projection/styles/scale-box-shadow.mjs
|
|
|
|
|
|
|
|
const correctBoxShadow = {
|
|
correct: (latest, { treeScale, projectionDelta }) => {
|
|
const original = latest;
|
|
const shadow = complex.parse(latest);
|
|
// TODO: Doesn't support multiple shadows
|
|
if (shadow.length > 5)
|
|
return original;
|
|
const template = complex.createTransformer(latest);
|
|
const offset = typeof shadow[0] !== "number" ? 1 : 0;
|
|
// Calculate the overall context scale
|
|
const xScale = projectionDelta.x.scale * treeScale.x;
|
|
const yScale = projectionDelta.y.scale * treeScale.y;
|
|
shadow[0 + offset] /= xScale;
|
|
shadow[1 + offset] /= yScale;
|
|
/**
|
|
* Ideally we'd correct x and y scales individually, but because blur and
|
|
* spread apply to both we have to take a scale average and apply that instead.
|
|
* We could potentially improve the outcome of this by incorporating the ratio between
|
|
* the two scales.
|
|
*/
|
|
const averageScale = mixNumber(xScale, yScale, 0.5);
|
|
// Blur
|
|
if (typeof shadow[2 + offset] === "number")
|
|
shadow[2 + offset] /= averageScale;
|
|
// Spread
|
|
if (typeof shadow[3 + offset] === "number")
|
|
shadow[3 + offset] /= averageScale;
|
|
return template(shadow);
|
|
},
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/motion/features/layout/MeasureLayout.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MeasureLayoutWithContext extends react.Component {
|
|
/**
|
|
* This only mounts projection nodes for components that
|
|
* need measuring, we might want to do it for all components
|
|
* in order to incorporate transforms
|
|
*/
|
|
componentDidMount() {
|
|
const { visualElement, layoutGroup, switchLayoutGroup, layoutId } = this.props;
|
|
const { projection } = visualElement;
|
|
addScaleCorrector(defaultScaleCorrectors);
|
|
if (projection) {
|
|
if (layoutGroup.group)
|
|
layoutGroup.group.add(projection);
|
|
if (switchLayoutGroup && switchLayoutGroup.register && layoutId) {
|
|
switchLayoutGroup.register(projection);
|
|
}
|
|
projection.root.didUpdate();
|
|
projection.addEventListener("animationComplete", () => {
|
|
this.safeToRemove();
|
|
});
|
|
projection.setOptions({
|
|
...projection.options,
|
|
onExitComplete: () => this.safeToRemove(),
|
|
});
|
|
}
|
|
globalProjectionState.hasEverUpdated = true;
|
|
}
|
|
getSnapshotBeforeUpdate(prevProps) {
|
|
const { layoutDependency, visualElement, drag, isPresent } = this.props;
|
|
const projection = visualElement.projection;
|
|
if (!projection)
|
|
return null;
|
|
/**
|
|
* TODO: We use this data in relegate to determine whether to
|
|
* promote a previous element. There's no guarantee its presence data
|
|
* will have updated by this point - if a bug like this arises it will
|
|
* have to be that we markForRelegation and then find a new lead some other way,
|
|
* perhaps in didUpdate
|
|
*/
|
|
projection.isPresent = isPresent;
|
|
if (drag ||
|
|
prevProps.layoutDependency !== layoutDependency ||
|
|
layoutDependency === undefined) {
|
|
projection.willUpdate();
|
|
}
|
|
else {
|
|
this.safeToRemove();
|
|
}
|
|
if (prevProps.isPresent !== isPresent) {
|
|
if (isPresent) {
|
|
projection.promote();
|
|
}
|
|
else if (!projection.relegate()) {
|
|
/**
|
|
* If there's another stack member taking over from this one,
|
|
* it's in charge of the exit animation and therefore should
|
|
* be in charge of the safe to remove. Otherwise we call it here.
|
|
*/
|
|
frameloop_frame/* frame */.Gt.postRender(() => {
|
|
const stack = projection.getStack();
|
|
if (!stack || !stack.members.length) {
|
|
this.safeToRemove();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
componentDidUpdate() {
|
|
const { projection } = this.props.visualElement;
|
|
if (projection) {
|
|
projection.root.didUpdate();
|
|
microtask.postRender(() => {
|
|
if (!projection.currentAnimation && projection.isLead()) {
|
|
this.safeToRemove();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
componentWillUnmount() {
|
|
const { visualElement, layoutGroup, switchLayoutGroup: promoteContext, } = this.props;
|
|
const { projection } = visualElement;
|
|
if (projection) {
|
|
projection.scheduleCheckAfterUnmount();
|
|
if (layoutGroup && layoutGroup.group)
|
|
layoutGroup.group.remove(projection);
|
|
if (promoteContext && promoteContext.deregister)
|
|
promoteContext.deregister(projection);
|
|
}
|
|
}
|
|
safeToRemove() {
|
|
const { safeToRemove } = this.props;
|
|
safeToRemove && safeToRemove();
|
|
}
|
|
render() {
|
|
return null;
|
|
}
|
|
}
|
|
function MeasureLayout(props) {
|
|
const [isPresent, safeToRemove] = usePresence();
|
|
const layoutGroup = (0,react.useContext)(LayoutGroupContext/* LayoutGroupContext */.L);
|
|
return ((0,jsx_runtime.jsx)(MeasureLayoutWithContext, { ...props, layoutGroup: layoutGroup, switchLayoutGroup: (0,react.useContext)(SwitchLayoutGroupContext), isPresent: isPresent, safeToRemove: safeToRemove }));
|
|
}
|
|
const defaultScaleCorrectors = {
|
|
borderRadius: {
|
|
...correctBorderRadius,
|
|
applyTo: [
|
|
"borderTopLeftRadius",
|
|
"borderTopRightRadius",
|
|
"borderBottomLeftRadius",
|
|
"borderBottomRightRadius",
|
|
],
|
|
},
|
|
borderTopLeftRadius: correctBorderRadius,
|
|
borderTopRightRadius: correctBorderRadius,
|
|
borderBottomLeftRadius: correctBorderRadius,
|
|
borderBottomRightRadius: correctBorderRadius,
|
|
boxShadow: correctBoxShadow,
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/projection/animation/mix-values.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const borders = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"];
|
|
const numBorders = borders.length;
|
|
const asNumber = (value) => typeof value === "string" ? parseFloat(value) : value;
|
|
const isPx = (value) => typeof value === "number" || px.test(value);
|
|
function mixValues(target, follow, lead, progress, shouldCrossfadeOpacity, isOnlyMember) {
|
|
if (shouldCrossfadeOpacity) {
|
|
target.opacity = mixNumber(0,
|
|
// TODO Reinstate this if only child
|
|
lead.opacity !== undefined ? lead.opacity : 1, easeCrossfadeIn(progress));
|
|
target.opacityExit = mixNumber(follow.opacity !== undefined ? follow.opacity : 1, 0, easeCrossfadeOut(progress));
|
|
}
|
|
else if (isOnlyMember) {
|
|
target.opacity = mixNumber(follow.opacity !== undefined ? follow.opacity : 1, lead.opacity !== undefined ? lead.opacity : 1, progress);
|
|
}
|
|
/**
|
|
* Mix border radius
|
|
*/
|
|
for (let i = 0; i < numBorders; i++) {
|
|
const borderLabel = `border${borders[i]}Radius`;
|
|
let followRadius = getRadius(follow, borderLabel);
|
|
let leadRadius = getRadius(lead, borderLabel);
|
|
if (followRadius === undefined && leadRadius === undefined)
|
|
continue;
|
|
followRadius || (followRadius = 0);
|
|
leadRadius || (leadRadius = 0);
|
|
const canMix = followRadius === 0 ||
|
|
leadRadius === 0 ||
|
|
isPx(followRadius) === isPx(leadRadius);
|
|
if (canMix) {
|
|
target[borderLabel] = Math.max(mixNumber(asNumber(followRadius), asNumber(leadRadius), progress), 0);
|
|
if (percent.test(leadRadius) || percent.test(followRadius)) {
|
|
target[borderLabel] += "%";
|
|
}
|
|
}
|
|
else {
|
|
target[borderLabel] = leadRadius;
|
|
}
|
|
}
|
|
/**
|
|
* Mix rotation
|
|
*/
|
|
if (follow.rotate || lead.rotate) {
|
|
target.rotate = mixNumber(follow.rotate || 0, lead.rotate || 0, progress);
|
|
}
|
|
}
|
|
function getRadius(values, radiusName) {
|
|
return values[radiusName] !== undefined
|
|
? values[radiusName]
|
|
: values.borderRadius;
|
|
}
|
|
// /**
|
|
// * We only want to mix the background color if there's a follow element
|
|
// * that we're not crossfading opacity between. For instance with switch
|
|
// * AnimateSharedLayout animations, this helps the illusion of a continuous
|
|
// * element being animated but also cuts down on the number of paints triggered
|
|
// * for elements where opacity is doing that work for us.
|
|
// */
|
|
// if (
|
|
// !hasFollowElement &&
|
|
// latestLeadValues.backgroundColor &&
|
|
// latestFollowValues.backgroundColor
|
|
// ) {
|
|
// /**
|
|
// * This isn't ideal performance-wise as mixColor is creating a new function every frame.
|
|
// * We could probably create a mixer that runs at the start of the animation but
|
|
// * the idea behind the crossfader is that it runs dynamically between two potentially
|
|
// * changing targets (ie opacity or borderRadius may be animating independently via variants)
|
|
// */
|
|
// leadState.backgroundColor = followState.backgroundColor = mixColor(
|
|
// latestFollowValues.backgroundColor as string,
|
|
// latestLeadValues.backgroundColor as string
|
|
// )(p)
|
|
// }
|
|
const easeCrossfadeIn = compress(0, 0.5, circOut);
|
|
const easeCrossfadeOut = compress(0.5, 0.95, noop/* noop */.l);
|
|
function compress(min, max, easing) {
|
|
return (p) => {
|
|
// Could replace ifs with clamp
|
|
if (p < min)
|
|
return 0;
|
|
if (p > max)
|
|
return 1;
|
|
return easing(progress(min, max, p));
|
|
};
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/projection/geometry/copy.mjs
|
|
/**
|
|
* Reset an axis to the provided origin box.
|
|
*
|
|
* This is a mutative operation.
|
|
*/
|
|
function copyAxisInto(axis, originAxis) {
|
|
axis.min = originAxis.min;
|
|
axis.max = originAxis.max;
|
|
}
|
|
/**
|
|
* Reset a box to the provided origin box.
|
|
*
|
|
* This is a mutative operation.
|
|
*/
|
|
function copyBoxInto(box, originBox) {
|
|
copyAxisInto(box.x, originBox.x);
|
|
copyAxisInto(box.y, originBox.y);
|
|
}
|
|
/**
|
|
* Reset a delta to the provided origin box.
|
|
*
|
|
* This is a mutative operation.
|
|
*/
|
|
function copyAxisDeltaInto(delta, originDelta) {
|
|
delta.translate = originDelta.translate;
|
|
delta.scale = originDelta.scale;
|
|
delta.originPoint = originDelta.originPoint;
|
|
delta.origin = originDelta.origin;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/projection/geometry/delta-remove.mjs
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Remove a delta from a point. This is essentially the steps of applyPointDelta in reverse
|
|
*/
|
|
function removePointDelta(point, translate, scale, originPoint, boxScale) {
|
|
point -= translate;
|
|
point = scalePoint(point, 1 / scale, originPoint);
|
|
if (boxScale !== undefined) {
|
|
point = scalePoint(point, 1 / boxScale, originPoint);
|
|
}
|
|
return point;
|
|
}
|
|
/**
|
|
* Remove a delta from an axis. This is essentially the steps of applyAxisDelta in reverse
|
|
*/
|
|
function removeAxisDelta(axis, translate = 0, scale = 1, origin = 0.5, boxScale, originAxis = axis, sourceAxis = axis) {
|
|
if (percent.test(translate)) {
|
|
translate = parseFloat(translate);
|
|
const relativeProgress = mixNumber(sourceAxis.min, sourceAxis.max, translate / 100);
|
|
translate = relativeProgress - sourceAxis.min;
|
|
}
|
|
if (typeof translate !== "number")
|
|
return;
|
|
let originPoint = mixNumber(originAxis.min, originAxis.max, origin);
|
|
if (axis === originAxis)
|
|
originPoint -= translate;
|
|
axis.min = removePointDelta(axis.min, translate, scale, originPoint, boxScale);
|
|
axis.max = removePointDelta(axis.max, translate, scale, originPoint, boxScale);
|
|
}
|
|
/**
|
|
* Remove a transforms from an axis. This is essentially the steps of applyAxisTransforms in reverse
|
|
* and acts as a bridge between motion values and removeAxisDelta
|
|
*/
|
|
function removeAxisTransforms(axis, transforms, [key, scaleKey, originKey], origin, sourceAxis) {
|
|
removeAxisDelta(axis, transforms[key], transforms[scaleKey], transforms[originKey], transforms.scale, origin, sourceAxis);
|
|
}
|
|
/**
|
|
* The names of the motion values we want to apply as translation, scale and origin.
|
|
*/
|
|
const xKeys = ["x", "scaleX", "originX"];
|
|
const yKeys = ["y", "scaleY", "originY"];
|
|
/**
|
|
* Remove a transforms from an box. This is essentially the steps of applyAxisBox in reverse
|
|
* and acts as a bridge between motion values and removeAxisDelta
|
|
*/
|
|
function removeBoxTransforms(box, transforms, originBox, sourceBox) {
|
|
removeAxisTransforms(box.x, transforms, xKeys, originBox ? originBox.x : undefined, sourceBox ? sourceBox.x : undefined);
|
|
removeAxisTransforms(box.y, transforms, yKeys, originBox ? originBox.y : undefined, sourceBox ? sourceBox.y : undefined);
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/projection/geometry/utils.mjs
|
|
|
|
|
|
function isAxisDeltaZero(delta) {
|
|
return delta.translate === 0 && delta.scale === 1;
|
|
}
|
|
function isDeltaZero(delta) {
|
|
return isAxisDeltaZero(delta.x) && isAxisDeltaZero(delta.y);
|
|
}
|
|
function axisEquals(a, b) {
|
|
return a.min === b.min && a.max === b.max;
|
|
}
|
|
function boxEquals(a, b) {
|
|
return axisEquals(a.x, b.x) && axisEquals(a.y, b.y);
|
|
}
|
|
function axisEqualsRounded(a, b) {
|
|
return (Math.round(a.min) === Math.round(b.min) &&
|
|
Math.round(a.max) === Math.round(b.max));
|
|
}
|
|
function boxEqualsRounded(a, b) {
|
|
return axisEqualsRounded(a.x, b.x) && axisEqualsRounded(a.y, b.y);
|
|
}
|
|
function aspectRatio(box) {
|
|
return calcLength(box.x) / calcLength(box.y);
|
|
}
|
|
function axisDeltaEquals(a, b) {
|
|
return (a.translate === b.translate &&
|
|
a.scale === b.scale &&
|
|
a.originPoint === b.originPoint);
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/projection/shared/stack.mjs
|
|
|
|
|
|
class NodeStack {
|
|
constructor() {
|
|
this.members = [];
|
|
}
|
|
add(node) {
|
|
addUniqueItem(this.members, node);
|
|
node.scheduleRender();
|
|
}
|
|
remove(node) {
|
|
removeItem(this.members, node);
|
|
if (node === this.prevLead) {
|
|
this.prevLead = undefined;
|
|
}
|
|
if (node === this.lead) {
|
|
const prevLead = this.members[this.members.length - 1];
|
|
if (prevLead) {
|
|
this.promote(prevLead);
|
|
}
|
|
}
|
|
}
|
|
relegate(node) {
|
|
const indexOfNode = this.members.findIndex((member) => node === member);
|
|
if (indexOfNode === 0)
|
|
return false;
|
|
/**
|
|
* Find the next projection node that is present
|
|
*/
|
|
let prevLead;
|
|
for (let i = indexOfNode; i >= 0; i--) {
|
|
const member = this.members[i];
|
|
if (member.isPresent !== false) {
|
|
prevLead = member;
|
|
break;
|
|
}
|
|
}
|
|
if (prevLead) {
|
|
this.promote(prevLead);
|
|
return true;
|
|
}
|
|
else {
|
|
return false;
|
|
}
|
|
}
|
|
promote(node, preserveFollowOpacity) {
|
|
const prevLead = this.lead;
|
|
if (node === prevLead)
|
|
return;
|
|
this.prevLead = prevLead;
|
|
this.lead = node;
|
|
node.show();
|
|
if (prevLead) {
|
|
prevLead.instance && prevLead.scheduleRender();
|
|
node.scheduleRender();
|
|
node.resumeFrom = prevLead;
|
|
if (preserveFollowOpacity) {
|
|
node.resumeFrom.preserveOpacity = true;
|
|
}
|
|
if (prevLead.snapshot) {
|
|
node.snapshot = prevLead.snapshot;
|
|
node.snapshot.latestValues =
|
|
prevLead.animationValues || prevLead.latestValues;
|
|
}
|
|
if (node.root && node.root.isUpdating) {
|
|
node.isLayoutDirty = true;
|
|
}
|
|
const { crossfade } = node.options;
|
|
if (crossfade === false) {
|
|
prevLead.hide();
|
|
}
|
|
/**
|
|
* TODO:
|
|
* - Test border radius when previous node was deleted
|
|
* - boxShadow mixing
|
|
* - Shared between element A in scrolled container and element B (scroll stays the same or changes)
|
|
* - Shared between element A in transformed container and element B (transform stays the same or changes)
|
|
* - Shared between element A in scrolled page and element B (scroll stays the same or changes)
|
|
* ---
|
|
* - Crossfade opacity of root nodes
|
|
* - layoutId changes after animation
|
|
* - layoutId changes mid animation
|
|
*/
|
|
}
|
|
}
|
|
exitAnimationComplete() {
|
|
this.members.forEach((node) => {
|
|
const { options, resumingFrom } = node;
|
|
options.onExitComplete && options.onExitComplete();
|
|
if (resumingFrom) {
|
|
resumingFrom.options.onExitComplete &&
|
|
resumingFrom.options.onExitComplete();
|
|
}
|
|
});
|
|
}
|
|
scheduleRender() {
|
|
this.members.forEach((node) => {
|
|
node.instance && node.scheduleRender(false);
|
|
});
|
|
}
|
|
/**
|
|
* Clear any leads that have been removed this render to prevent them from being
|
|
* used in future animations and to prevent memory leaks
|
|
*/
|
|
removeLeadSnapshot() {
|
|
if (this.lead && this.lead.snapshot) {
|
|
this.lead.snapshot = undefined;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/projection/styles/transform.mjs
|
|
function buildProjectionTransform(delta, treeScale, latestTransform) {
|
|
let transform = "";
|
|
/**
|
|
* The translations we use to calculate are always relative to the viewport coordinate space.
|
|
* But when we apply scales, we also scale the coordinate space of an element and its children.
|
|
* For instance if we have a treeScale (the culmination of all parent scales) of 0.5 and we need
|
|
* to move an element 100 pixels, we actually need to move it 200 in within that scaled space.
|
|
*/
|
|
const xTranslate = delta.x.translate / treeScale.x;
|
|
const yTranslate = delta.y.translate / treeScale.y;
|
|
const zTranslate = (latestTransform === null || latestTransform === void 0 ? void 0 : latestTransform.z) || 0;
|
|
if (xTranslate || yTranslate || zTranslate) {
|
|
transform = `translate3d(${xTranslate}px, ${yTranslate}px, ${zTranslate}px) `;
|
|
}
|
|
/**
|
|
* Apply scale correction for the tree transform.
|
|
* This will apply scale to the screen-orientated axes.
|
|
*/
|
|
if (treeScale.x !== 1 || treeScale.y !== 1) {
|
|
transform += `scale(${1 / treeScale.x}, ${1 / treeScale.y}) `;
|
|
}
|
|
if (latestTransform) {
|
|
const { transformPerspective, rotate, rotateX, rotateY, skewX, skewY } = latestTransform;
|
|
if (transformPerspective)
|
|
transform = `perspective(${transformPerspective}px) ${transform}`;
|
|
if (rotate)
|
|
transform += `rotate(${rotate}deg) `;
|
|
if (rotateX)
|
|
transform += `rotateX(${rotateX}deg) `;
|
|
if (rotateY)
|
|
transform += `rotateY(${rotateY}deg) `;
|
|
if (skewX)
|
|
transform += `skewX(${skewX}deg) `;
|
|
if (skewY)
|
|
transform += `skewY(${skewY}deg) `;
|
|
}
|
|
/**
|
|
* Apply scale to match the size of the element to the size we want it.
|
|
* This will apply scale to the element-orientated axes.
|
|
*/
|
|
const elementScaleX = delta.x.scale * treeScale.x;
|
|
const elementScaleY = delta.y.scale * treeScale.y;
|
|
if (elementScaleX !== 1 || elementScaleY !== 1) {
|
|
transform += `scale(${elementScaleX}, ${elementScaleY})`;
|
|
}
|
|
return transform || "none";
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/utils/compare-by-depth.mjs
|
|
const compareByDepth = (a, b) => a.depth - b.depth;
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/utils/flat-tree.mjs
|
|
|
|
|
|
|
|
class FlatTree {
|
|
constructor() {
|
|
this.children = [];
|
|
this.isDirty = false;
|
|
}
|
|
add(child) {
|
|
addUniqueItem(this.children, child);
|
|
this.isDirty = true;
|
|
}
|
|
remove(child) {
|
|
removeItem(this.children, child);
|
|
this.isDirty = true;
|
|
}
|
|
forEach(callback) {
|
|
this.isDirty && this.children.sort(compareByDepth);
|
|
this.isDirty = false;
|
|
this.children.forEach(callback);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/delay.mjs
|
|
|
|
|
|
|
|
/**
|
|
* Timeout defined in ms
|
|
*/
|
|
function delay(callback, timeout) {
|
|
const start = time.now();
|
|
const checkElapsed = ({ timestamp }) => {
|
|
const elapsed = timestamp - start;
|
|
if (elapsed >= timeout) {
|
|
(0,frameloop_frame/* cancelFrame */.WG)(checkElapsed);
|
|
callback(elapsed - timeout);
|
|
}
|
|
};
|
|
frameloop_frame/* frame */.Gt.read(checkElapsed, true);
|
|
return () => (0,frameloop_frame/* cancelFrame */.WG)(checkElapsed);
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/dom/utils/is-svg-element.mjs
|
|
function isSVGElement(element) {
|
|
return element instanceof SVGElement && element.tagName !== "svg";
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/animation/interfaces/single-value.mjs
|
|
|
|
|
|
|
|
|
|
function animateSingleValue(value, keyframes, options) {
|
|
const motionValue$1 = isMotionValue(value) ? value : motionValue(value);
|
|
motionValue$1.start(animateMotionValue("", motionValue$1, keyframes, options));
|
|
return motionValue$1.animation;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/projection/node/create-projection-node.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const metrics = {
|
|
type: "projectionFrame",
|
|
totalNodes: 0,
|
|
resolvedTargetDeltas: 0,
|
|
recalculatedProjection: 0,
|
|
};
|
|
const isDebug = typeof window !== "undefined" && window.MotionDebug !== undefined;
|
|
const transformAxes = ["", "X", "Y", "Z"];
|
|
const hiddenVisibility = { visibility: "hidden" };
|
|
/**
|
|
* We use 1000 as the animation target as 0-1000 maps better to pixels than 0-1
|
|
* which has a noticeable difference in spring animations
|
|
*/
|
|
const animationTarget = 1000;
|
|
let create_projection_node_id = 0;
|
|
function resetDistortingTransform(key, visualElement, values, sharedAnimationValues) {
|
|
const { latestValues } = visualElement;
|
|
// Record the distorting transform and then temporarily set it to 0
|
|
if (latestValues[key]) {
|
|
values[key] = latestValues[key];
|
|
visualElement.setStaticValue(key, 0);
|
|
if (sharedAnimationValues) {
|
|
sharedAnimationValues[key] = 0;
|
|
}
|
|
}
|
|
}
|
|
function cancelTreeOptimisedTransformAnimations(projectionNode) {
|
|
projectionNode.hasCheckedOptimisedAppear = true;
|
|
if (projectionNode.root === projectionNode)
|
|
return;
|
|
const { visualElement } = projectionNode.options;
|
|
if (!visualElement)
|
|
return;
|
|
const appearId = getOptimisedAppearId(visualElement);
|
|
if (window.MotionHasOptimisedTransformAnimation(appearId)) {
|
|
window.MotionCancelOptimisedTransform(appearId);
|
|
}
|
|
const { parent } = projectionNode;
|
|
if (parent && !parent.hasCheckedOptimisedAppear) {
|
|
cancelTreeOptimisedTransformAnimations(parent);
|
|
}
|
|
}
|
|
function create_projection_node_createProjectionNode({ attachResizeListener, defaultParent, measureScroll, checkIsScrollRoot, resetTransform, }) {
|
|
return class ProjectionNode {
|
|
constructor(latestValues = {}, parent = defaultParent === null || defaultParent === void 0 ? void 0 : defaultParent()) {
|
|
/**
|
|
* A unique ID generated for every projection node.
|
|
*/
|
|
this.id = create_projection_node_id++;
|
|
/**
|
|
* An id that represents a unique session instigated by startUpdate.
|
|
*/
|
|
this.animationId = 0;
|
|
/**
|
|
* A Set containing all this component's children. This is used to iterate
|
|
* through the children.
|
|
*
|
|
* TODO: This could be faster to iterate as a flat array stored on the root node.
|
|
*/
|
|
this.children = new Set();
|
|
/**
|
|
* Options for the node. We use this to configure what kind of layout animations
|
|
* we should perform (if any).
|
|
*/
|
|
this.options = {};
|
|
/**
|
|
* We use this to detect when its safe to shut down part of a projection tree.
|
|
* We have to keep projecting children for scale correction and relative projection
|
|
* until all their parents stop performing layout animations.
|
|
*/
|
|
this.isTreeAnimating = false;
|
|
this.isAnimationBlocked = false;
|
|
/**
|
|
* Flag to true if we think this layout has been changed. We can't always know this,
|
|
* currently we set it to true every time a component renders, or if it has a layoutDependency
|
|
* if that has changed between renders. Additionally, components can be grouped by LayoutGroup
|
|
* and if one node is dirtied, they all are.
|
|
*/
|
|
this.isLayoutDirty = false;
|
|
/**
|
|
* Flag to true if we think the projection calculations for this node needs
|
|
* recalculating as a result of an updated transform or layout animation.
|
|
*/
|
|
this.isProjectionDirty = false;
|
|
/**
|
|
* Flag to true if the layout *or* transform has changed. This then gets propagated
|
|
* throughout the projection tree, forcing any element below to recalculate on the next frame.
|
|
*/
|
|
this.isSharedProjectionDirty = false;
|
|
/**
|
|
* Flag transform dirty. This gets propagated throughout the whole tree but is only
|
|
* respected by shared nodes.
|
|
*/
|
|
this.isTransformDirty = false;
|
|
/**
|
|
* Block layout updates for instant layout transitions throughout the tree.
|
|
*/
|
|
this.updateManuallyBlocked = false;
|
|
this.updateBlockedByResize = false;
|
|
/**
|
|
* Set to true between the start of the first `willUpdate` call and the end of the `didUpdate`
|
|
* call.
|
|
*/
|
|
this.isUpdating = false;
|
|
/**
|
|
* If this is an SVG element we currently disable projection transforms
|
|
*/
|
|
this.isSVG = false;
|
|
/**
|
|
* Flag to true (during promotion) if a node doing an instant layout transition needs to reset
|
|
* its projection styles.
|
|
*/
|
|
this.needsReset = false;
|
|
/**
|
|
* Flags whether this node should have its transform reset prior to measuring.
|
|
*/
|
|
this.shouldResetTransform = false;
|
|
/**
|
|
* Store whether this node has been checked for optimised appear animations. As
|
|
* effects fire bottom-up, and we want to look up the tree for appear animations,
|
|
* this makes sure we only check each path once, stopping at nodes that
|
|
* have already been checked.
|
|
*/
|
|
this.hasCheckedOptimisedAppear = false;
|
|
/**
|
|
* An object representing the calculated contextual/accumulated/tree scale.
|
|
* This will be used to scale calculcated projection transforms, as these are
|
|
* calculated in screen-space but need to be scaled for elements to layoutly
|
|
* make it to their calculated destinations.
|
|
*
|
|
* TODO: Lazy-init
|
|
*/
|
|
this.treeScale = { x: 1, y: 1 };
|
|
/**
|
|
*
|
|
*/
|
|
this.eventHandlers = new Map();
|
|
this.hasTreeAnimated = false;
|
|
// Note: Currently only running on root node
|
|
this.updateScheduled = false;
|
|
this.scheduleUpdate = () => this.update();
|
|
this.projectionUpdateScheduled = false;
|
|
this.checkUpdateFailed = () => {
|
|
if (this.isUpdating) {
|
|
this.isUpdating = false;
|
|
this.clearAllSnapshots();
|
|
}
|
|
};
|
|
/**
|
|
* This is a multi-step process as shared nodes might be of different depths. Nodes
|
|
* are sorted by depth order, so we need to resolve the entire tree before moving to
|
|
* the next step.
|
|
*/
|
|
this.updateProjection = () => {
|
|
this.projectionUpdateScheduled = false;
|
|
/**
|
|
* Reset debug counts. Manually resetting rather than creating a new
|
|
* object each frame.
|
|
*/
|
|
if (isDebug) {
|
|
metrics.totalNodes =
|
|
metrics.resolvedTargetDeltas =
|
|
metrics.recalculatedProjection =
|
|
0;
|
|
}
|
|
this.nodes.forEach(propagateDirtyNodes);
|
|
this.nodes.forEach(resolveTargetDelta);
|
|
this.nodes.forEach(calcProjection);
|
|
this.nodes.forEach(cleanDirtyNodes);
|
|
if (isDebug) {
|
|
window.MotionDebug.record(metrics);
|
|
}
|
|
};
|
|
/**
|
|
* Frame calculations
|
|
*/
|
|
this.resolvedRelativeTargetAt = 0.0;
|
|
this.hasProjected = false;
|
|
this.isVisible = true;
|
|
this.animationProgress = 0;
|
|
/**
|
|
* Shared layout
|
|
*/
|
|
// TODO Only running on root node
|
|
this.sharedNodes = new Map();
|
|
this.latestValues = latestValues;
|
|
this.root = parent ? parent.root || parent : this;
|
|
this.path = parent ? [...parent.path, parent] : [];
|
|
this.parent = parent;
|
|
this.depth = parent ? parent.depth + 1 : 0;
|
|
for (let i = 0; i < this.path.length; i++) {
|
|
this.path[i].shouldResetTransform = true;
|
|
}
|
|
if (this.root === this)
|
|
this.nodes = new FlatTree();
|
|
}
|
|
addEventListener(name, handler) {
|
|
if (!this.eventHandlers.has(name)) {
|
|
this.eventHandlers.set(name, new SubscriptionManager());
|
|
}
|
|
return this.eventHandlers.get(name).add(handler);
|
|
}
|
|
notifyListeners(name, ...args) {
|
|
const subscriptionManager = this.eventHandlers.get(name);
|
|
subscriptionManager && subscriptionManager.notify(...args);
|
|
}
|
|
hasListeners(name) {
|
|
return this.eventHandlers.has(name);
|
|
}
|
|
/**
|
|
* Lifecycles
|
|
*/
|
|
mount(instance, isLayoutDirty = this.root.hasTreeAnimated) {
|
|
if (this.instance)
|
|
return;
|
|
this.isSVG = isSVGElement(instance);
|
|
this.instance = instance;
|
|
const { layoutId, layout, visualElement } = this.options;
|
|
if (visualElement && !visualElement.current) {
|
|
visualElement.mount(instance);
|
|
}
|
|
this.root.nodes.add(this);
|
|
this.parent && this.parent.children.add(this);
|
|
if (isLayoutDirty && (layout || layoutId)) {
|
|
this.isLayoutDirty = true;
|
|
}
|
|
if (attachResizeListener) {
|
|
let cancelDelay;
|
|
const resizeUnblockUpdate = () => (this.root.updateBlockedByResize = false);
|
|
attachResizeListener(instance, () => {
|
|
this.root.updateBlockedByResize = true;
|
|
cancelDelay && cancelDelay();
|
|
cancelDelay = delay(resizeUnblockUpdate, 250);
|
|
if (globalProjectionState.hasAnimatedSinceResize) {
|
|
globalProjectionState.hasAnimatedSinceResize = false;
|
|
this.nodes.forEach(finishAnimation);
|
|
}
|
|
});
|
|
}
|
|
if (layoutId) {
|
|
this.root.registerSharedNode(layoutId, this);
|
|
}
|
|
// Only register the handler if it requires layout animation
|
|
if (this.options.animate !== false &&
|
|
visualElement &&
|
|
(layoutId || layout)) {
|
|
this.addEventListener("didUpdate", ({ delta, hasLayoutChanged, hasRelativeTargetChanged, layout: newLayout, }) => {
|
|
if (this.isTreeAnimationBlocked()) {
|
|
this.target = undefined;
|
|
this.relativeTarget = undefined;
|
|
return;
|
|
}
|
|
// TODO: Check here if an animation exists
|
|
const layoutTransition = this.options.transition ||
|
|
visualElement.getDefaultTransition() ||
|
|
defaultLayoutTransition;
|
|
const { onLayoutAnimationStart, onLayoutAnimationComplete, } = visualElement.getProps();
|
|
/**
|
|
* The target layout of the element might stay the same,
|
|
* but its position relative to its parent has changed.
|
|
*/
|
|
const targetChanged = !this.targetLayout ||
|
|
!boxEqualsRounded(this.targetLayout, newLayout) ||
|
|
hasRelativeTargetChanged;
|
|
/**
|
|
* If the layout hasn't seemed to have changed, it might be that the
|
|
* element is visually in the same place in the document but its position
|
|
* relative to its parent has indeed changed. So here we check for that.
|
|
*/
|
|
const hasOnlyRelativeTargetChanged = !hasLayoutChanged && hasRelativeTargetChanged;
|
|
if (this.options.layoutRoot ||
|
|
(this.resumeFrom && this.resumeFrom.instance) ||
|
|
hasOnlyRelativeTargetChanged ||
|
|
(hasLayoutChanged &&
|
|
(targetChanged || !this.currentAnimation))) {
|
|
if (this.resumeFrom) {
|
|
this.resumingFrom = this.resumeFrom;
|
|
this.resumingFrom.resumingFrom = undefined;
|
|
}
|
|
this.setAnimationOrigin(delta, hasOnlyRelativeTargetChanged);
|
|
const animationOptions = {
|
|
...getValueTransition(layoutTransition, "layout"),
|
|
onPlay: onLayoutAnimationStart,
|
|
onComplete: onLayoutAnimationComplete,
|
|
};
|
|
if (visualElement.shouldReduceMotion ||
|
|
this.options.layoutRoot) {
|
|
animationOptions.delay = 0;
|
|
animationOptions.type = false;
|
|
}
|
|
this.startAnimation(animationOptions);
|
|
}
|
|
else {
|
|
/**
|
|
* If the layout hasn't changed and we have an animation that hasn't started yet,
|
|
* finish it immediately. Otherwise it will be animating from a location
|
|
* that was probably never commited to screen and look like a jumpy box.
|
|
*/
|
|
if (!hasLayoutChanged) {
|
|
finishAnimation(this);
|
|
}
|
|
if (this.isLead() && this.options.onExitComplete) {
|
|
this.options.onExitComplete();
|
|
}
|
|
}
|
|
this.targetLayout = newLayout;
|
|
});
|
|
}
|
|
}
|
|
unmount() {
|
|
this.options.layoutId && this.willUpdate();
|
|
this.root.nodes.remove(this);
|
|
const stack = this.getStack();
|
|
stack && stack.remove(this);
|
|
this.parent && this.parent.children.delete(this);
|
|
this.instance = undefined;
|
|
(0,frameloop_frame/* cancelFrame */.WG)(this.updateProjection);
|
|
}
|
|
// only on the root
|
|
blockUpdate() {
|
|
this.updateManuallyBlocked = true;
|
|
}
|
|
unblockUpdate() {
|
|
this.updateManuallyBlocked = false;
|
|
}
|
|
isUpdateBlocked() {
|
|
return this.updateManuallyBlocked || this.updateBlockedByResize;
|
|
}
|
|
isTreeAnimationBlocked() {
|
|
return (this.isAnimationBlocked ||
|
|
(this.parent && this.parent.isTreeAnimationBlocked()) ||
|
|
false);
|
|
}
|
|
// Note: currently only running on root node
|
|
startUpdate() {
|
|
if (this.isUpdateBlocked())
|
|
return;
|
|
this.isUpdating = true;
|
|
this.nodes && this.nodes.forEach(resetSkewAndRotation);
|
|
this.animationId++;
|
|
}
|
|
getTransformTemplate() {
|
|
const { visualElement } = this.options;
|
|
return visualElement && visualElement.getProps().transformTemplate;
|
|
}
|
|
willUpdate(shouldNotifyListeners = true) {
|
|
this.root.hasTreeAnimated = true;
|
|
if (this.root.isUpdateBlocked()) {
|
|
this.options.onExitComplete && this.options.onExitComplete();
|
|
return;
|
|
}
|
|
/**
|
|
* If we're running optimised appear animations then these must be
|
|
* cancelled before measuring the DOM. This is so we can measure
|
|
* the true layout of the element rather than the WAAPI animation
|
|
* which will be unaffected by the resetSkewAndRotate step.
|
|
*
|
|
* Note: This is a DOM write. Worst case scenario is this is sandwiched
|
|
* between other snapshot reads which will cause unnecessary style recalculations.
|
|
* This has to happen here though, as we don't yet know which nodes will need
|
|
* snapshots in startUpdate(), but we only want to cancel optimised animations
|
|
* if a layout animation measurement is actually going to be affected by them.
|
|
*/
|
|
if (window.MotionCancelOptimisedTransform &&
|
|
!this.hasCheckedOptimisedAppear) {
|
|
cancelTreeOptimisedTransformAnimations(this);
|
|
}
|
|
!this.root.isUpdating && this.root.startUpdate();
|
|
if (this.isLayoutDirty)
|
|
return;
|
|
this.isLayoutDirty = true;
|
|
for (let i = 0; i < this.path.length; i++) {
|
|
const node = this.path[i];
|
|
node.shouldResetTransform = true;
|
|
node.updateScroll("snapshot");
|
|
if (node.options.layoutRoot) {
|
|
node.willUpdate(false);
|
|
}
|
|
}
|
|
const { layoutId, layout } = this.options;
|
|
if (layoutId === undefined && !layout)
|
|
return;
|
|
const transformTemplate = this.getTransformTemplate();
|
|
this.prevTransformTemplateValue = transformTemplate
|
|
? transformTemplate(this.latestValues, "")
|
|
: undefined;
|
|
this.updateSnapshot();
|
|
shouldNotifyListeners && this.notifyListeners("willUpdate");
|
|
}
|
|
update() {
|
|
this.updateScheduled = false;
|
|
const updateWasBlocked = this.isUpdateBlocked();
|
|
// When doing an instant transition, we skip the layout update,
|
|
// but should still clean up the measurements so that the next
|
|
// snapshot could be taken correctly.
|
|
if (updateWasBlocked) {
|
|
this.unblockUpdate();
|
|
this.clearAllSnapshots();
|
|
this.nodes.forEach(clearMeasurements);
|
|
return;
|
|
}
|
|
if (!this.isUpdating) {
|
|
this.nodes.forEach(clearIsLayoutDirty);
|
|
}
|
|
this.isUpdating = false;
|
|
/**
|
|
* Write
|
|
*/
|
|
this.nodes.forEach(resetTransformStyle);
|
|
/**
|
|
* Read ==================
|
|
*/
|
|
// Update layout measurements of updated children
|
|
this.nodes.forEach(updateLayout);
|
|
/**
|
|
* Write
|
|
*/
|
|
// Notify listeners that the layout is updated
|
|
this.nodes.forEach(notifyLayoutUpdate);
|
|
this.clearAllSnapshots();
|
|
/**
|
|
* Manually flush any pending updates. Ideally
|
|
* we could leave this to the following requestAnimationFrame but this seems
|
|
* to leave a flash of incorrectly styled content.
|
|
*/
|
|
const now = time.now();
|
|
frameloop_frame/* frameData */.uv.delta = clamp(0, 1000 / 60, now - frameloop_frame/* frameData */.uv.timestamp);
|
|
frameloop_frame/* frameData */.uv.timestamp = now;
|
|
frameloop_frame/* frameData */.uv.isProcessing = true;
|
|
frameloop_frame/* steps */.Ci.update.process(frameloop_frame/* frameData */.uv);
|
|
frameloop_frame/* steps */.Ci.preRender.process(frameloop_frame/* frameData */.uv);
|
|
frameloop_frame/* steps */.Ci.render.process(frameloop_frame/* frameData */.uv);
|
|
frameloop_frame/* frameData */.uv.isProcessing = false;
|
|
}
|
|
didUpdate() {
|
|
if (!this.updateScheduled) {
|
|
this.updateScheduled = true;
|
|
microtask.read(this.scheduleUpdate);
|
|
}
|
|
}
|
|
clearAllSnapshots() {
|
|
this.nodes.forEach(clearSnapshot);
|
|
this.sharedNodes.forEach(removeLeadSnapshots);
|
|
}
|
|
scheduleUpdateProjection() {
|
|
if (!this.projectionUpdateScheduled) {
|
|
this.projectionUpdateScheduled = true;
|
|
frameloop_frame/* frame */.Gt.preRender(this.updateProjection, false, true);
|
|
}
|
|
}
|
|
scheduleCheckAfterUnmount() {
|
|
/**
|
|
* If the unmounting node is in a layoutGroup and did trigger a willUpdate,
|
|
* we manually call didUpdate to give a chance to the siblings to animate.
|
|
* Otherwise, cleanup all snapshots to prevents future nodes from reusing them.
|
|
*/
|
|
frameloop_frame/* frame */.Gt.postRender(() => {
|
|
if (this.isLayoutDirty) {
|
|
this.root.didUpdate();
|
|
}
|
|
else {
|
|
this.root.checkUpdateFailed();
|
|
}
|
|
});
|
|
}
|
|
/**
|
|
* Update measurements
|
|
*/
|
|
updateSnapshot() {
|
|
if (this.snapshot || !this.instance)
|
|
return;
|
|
this.snapshot = this.measure();
|
|
}
|
|
updateLayout() {
|
|
if (!this.instance)
|
|
return;
|
|
// TODO: Incorporate into a forwarded scroll offset
|
|
this.updateScroll();
|
|
if (!(this.options.alwaysMeasureLayout && this.isLead()) &&
|
|
!this.isLayoutDirty) {
|
|
return;
|
|
}
|
|
/**
|
|
* When a node is mounted, it simply resumes from the prevLead's
|
|
* snapshot instead of taking a new one, but the ancestors scroll
|
|
* might have updated while the prevLead is unmounted. We need to
|
|
* update the scroll again to make sure the layout we measure is
|
|
* up to date.
|
|
*/
|
|
if (this.resumeFrom && !this.resumeFrom.instance) {
|
|
for (let i = 0; i < this.path.length; i++) {
|
|
const node = this.path[i];
|
|
node.updateScroll();
|
|
}
|
|
}
|
|
const prevLayout = this.layout;
|
|
this.layout = this.measure(false);
|
|
this.layoutCorrected = createBox();
|
|
this.isLayoutDirty = false;
|
|
this.projectionDelta = undefined;
|
|
this.notifyListeners("measure", this.layout.layoutBox);
|
|
const { visualElement } = this.options;
|
|
visualElement &&
|
|
visualElement.notify("LayoutMeasure", this.layout.layoutBox, prevLayout ? prevLayout.layoutBox : undefined);
|
|
}
|
|
updateScroll(phase = "measure") {
|
|
let needsMeasurement = Boolean(this.options.layoutScroll && this.instance);
|
|
if (this.scroll &&
|
|
this.scroll.animationId === this.root.animationId &&
|
|
this.scroll.phase === phase) {
|
|
needsMeasurement = false;
|
|
}
|
|
if (needsMeasurement) {
|
|
const isRoot = checkIsScrollRoot(this.instance);
|
|
this.scroll = {
|
|
animationId: this.root.animationId,
|
|
phase,
|
|
isRoot,
|
|
offset: measureScroll(this.instance),
|
|
wasRoot: this.scroll ? this.scroll.isRoot : isRoot,
|
|
};
|
|
}
|
|
}
|
|
resetTransform() {
|
|
if (!resetTransform)
|
|
return;
|
|
const isResetRequested = this.isLayoutDirty ||
|
|
this.shouldResetTransform ||
|
|
this.options.alwaysMeasureLayout;
|
|
const hasProjection = this.projectionDelta && !isDeltaZero(this.projectionDelta);
|
|
const transformTemplate = this.getTransformTemplate();
|
|
const transformTemplateValue = transformTemplate
|
|
? transformTemplate(this.latestValues, "")
|
|
: undefined;
|
|
const transformTemplateHasChanged = transformTemplateValue !== this.prevTransformTemplateValue;
|
|
if (isResetRequested &&
|
|
(hasProjection ||
|
|
hasTransform(this.latestValues) ||
|
|
transformTemplateHasChanged)) {
|
|
resetTransform(this.instance, transformTemplateValue);
|
|
this.shouldResetTransform = false;
|
|
this.scheduleRender();
|
|
}
|
|
}
|
|
measure(removeTransform = true) {
|
|
const pageBox = this.measurePageBox();
|
|
let layoutBox = this.removeElementScroll(pageBox);
|
|
/**
|
|
* Measurements taken during the pre-render stage
|
|
* still have transforms applied so we remove them
|
|
* via calculation.
|
|
*/
|
|
if (removeTransform) {
|
|
layoutBox = this.removeTransform(layoutBox);
|
|
}
|
|
roundBox(layoutBox);
|
|
return {
|
|
animationId: this.root.animationId,
|
|
measuredBox: pageBox,
|
|
layoutBox,
|
|
latestValues: {},
|
|
source: this.id,
|
|
};
|
|
}
|
|
measurePageBox() {
|
|
var _a;
|
|
const { visualElement } = this.options;
|
|
if (!visualElement)
|
|
return createBox();
|
|
const box = visualElement.measureViewportBox();
|
|
const wasInScrollRoot = ((_a = this.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot) || this.path.some(checkNodeWasScrollRoot);
|
|
if (!wasInScrollRoot) {
|
|
// Remove viewport scroll to give page-relative coordinates
|
|
const { scroll } = this.root;
|
|
if (scroll) {
|
|
translateAxis(box.x, scroll.offset.x);
|
|
translateAxis(box.y, scroll.offset.y);
|
|
}
|
|
}
|
|
return box;
|
|
}
|
|
removeElementScroll(box) {
|
|
var _a;
|
|
const boxWithoutScroll = createBox();
|
|
copyBoxInto(boxWithoutScroll, box);
|
|
if ((_a = this.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot) {
|
|
return boxWithoutScroll;
|
|
}
|
|
/**
|
|
* Performance TODO: Keep a cumulative scroll offset down the tree
|
|
* rather than loop back up the path.
|
|
*/
|
|
for (let i = 0; i < this.path.length; i++) {
|
|
const node = this.path[i];
|
|
const { scroll, options } = node;
|
|
if (node !== this.root && scroll && options.layoutScroll) {
|
|
/**
|
|
* If this is a new scroll root, we want to remove all previous scrolls
|
|
* from the viewport box.
|
|
*/
|
|
if (scroll.wasRoot) {
|
|
copyBoxInto(boxWithoutScroll, box);
|
|
}
|
|
translateAxis(boxWithoutScroll.x, scroll.offset.x);
|
|
translateAxis(boxWithoutScroll.y, scroll.offset.y);
|
|
}
|
|
}
|
|
return boxWithoutScroll;
|
|
}
|
|
applyTransform(box, transformOnly = false) {
|
|
const withTransforms = createBox();
|
|
copyBoxInto(withTransforms, box);
|
|
for (let i = 0; i < this.path.length; i++) {
|
|
const node = this.path[i];
|
|
if (!transformOnly &&
|
|
node.options.layoutScroll &&
|
|
node.scroll &&
|
|
node !== node.root) {
|
|
transformBox(withTransforms, {
|
|
x: -node.scroll.offset.x,
|
|
y: -node.scroll.offset.y,
|
|
});
|
|
}
|
|
if (!hasTransform(node.latestValues))
|
|
continue;
|
|
transformBox(withTransforms, node.latestValues);
|
|
}
|
|
if (hasTransform(this.latestValues)) {
|
|
transformBox(withTransforms, this.latestValues);
|
|
}
|
|
return withTransforms;
|
|
}
|
|
removeTransform(box) {
|
|
const boxWithoutTransform = createBox();
|
|
copyBoxInto(boxWithoutTransform, box);
|
|
for (let i = 0; i < this.path.length; i++) {
|
|
const node = this.path[i];
|
|
if (!node.instance)
|
|
continue;
|
|
if (!hasTransform(node.latestValues))
|
|
continue;
|
|
hasScale(node.latestValues) && node.updateSnapshot();
|
|
const sourceBox = createBox();
|
|
const nodeBox = node.measurePageBox();
|
|
copyBoxInto(sourceBox, nodeBox);
|
|
removeBoxTransforms(boxWithoutTransform, node.latestValues, node.snapshot ? node.snapshot.layoutBox : undefined, sourceBox);
|
|
}
|
|
if (hasTransform(this.latestValues)) {
|
|
removeBoxTransforms(boxWithoutTransform, this.latestValues);
|
|
}
|
|
return boxWithoutTransform;
|
|
}
|
|
setTargetDelta(delta) {
|
|
this.targetDelta = delta;
|
|
this.root.scheduleUpdateProjection();
|
|
this.isProjectionDirty = true;
|
|
}
|
|
setOptions(options) {
|
|
this.options = {
|
|
...this.options,
|
|
...options,
|
|
crossfade: options.crossfade !== undefined ? options.crossfade : true,
|
|
};
|
|
}
|
|
clearMeasurements() {
|
|
this.scroll = undefined;
|
|
this.layout = undefined;
|
|
this.snapshot = undefined;
|
|
this.prevTransformTemplateValue = undefined;
|
|
this.targetDelta = undefined;
|
|
this.target = undefined;
|
|
this.isLayoutDirty = false;
|
|
}
|
|
forceRelativeParentToResolveTarget() {
|
|
if (!this.relativeParent)
|
|
return;
|
|
/**
|
|
* If the parent target isn't up-to-date, force it to update.
|
|
* This is an unfortunate de-optimisation as it means any updating relative
|
|
* projection will cause all the relative parents to recalculate back
|
|
* up the tree.
|
|
*/
|
|
if (this.relativeParent.resolvedRelativeTargetAt !==
|
|
frameloop_frame/* frameData */.uv.timestamp) {
|
|
this.relativeParent.resolveTargetDelta(true);
|
|
}
|
|
}
|
|
resolveTargetDelta(forceRecalculation = false) {
|
|
var _a;
|
|
/**
|
|
* Once the dirty status of nodes has been spread through the tree, we also
|
|
* need to check if we have a shared node of a different depth that has itself
|
|
* been dirtied.
|
|
*/
|
|
const lead = this.getLead();
|
|
this.isProjectionDirty || (this.isProjectionDirty = lead.isProjectionDirty);
|
|
this.isTransformDirty || (this.isTransformDirty = lead.isTransformDirty);
|
|
this.isSharedProjectionDirty || (this.isSharedProjectionDirty = lead.isSharedProjectionDirty);
|
|
const isShared = Boolean(this.resumingFrom) || this !== lead;
|
|
/**
|
|
* We don't use transform for this step of processing so we don't
|
|
* need to check whether any nodes have changed transform.
|
|
*/
|
|
const canSkip = !(forceRecalculation ||
|
|
(isShared && this.isSharedProjectionDirty) ||
|
|
this.isProjectionDirty ||
|
|
((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isProjectionDirty) ||
|
|
this.attemptToResolveRelativeTarget ||
|
|
this.root.updateBlockedByResize);
|
|
if (canSkip)
|
|
return;
|
|
const { layout, layoutId } = this.options;
|
|
/**
|
|
* If we have no layout, we can't perform projection, so early return
|
|
*/
|
|
if (!this.layout || !(layout || layoutId))
|
|
return;
|
|
this.resolvedRelativeTargetAt = frameloop_frame/* frameData */.uv.timestamp;
|
|
/**
|
|
* If we don't have a targetDelta but do have a layout, we can attempt to resolve
|
|
* a relativeParent. This will allow a component to perform scale correction
|
|
* even if no animation has started.
|
|
*/
|
|
if (!this.targetDelta && !this.relativeTarget) {
|
|
const relativeParent = this.getClosestProjectingParent();
|
|
if (relativeParent &&
|
|
relativeParent.layout &&
|
|
this.animationProgress !== 1) {
|
|
this.relativeParent = relativeParent;
|
|
this.forceRelativeParentToResolveTarget();
|
|
this.relativeTarget = createBox();
|
|
this.relativeTargetOrigin = createBox();
|
|
calcRelativePosition(this.relativeTargetOrigin, this.layout.layoutBox, relativeParent.layout.layoutBox);
|
|
copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
|
|
}
|
|
else {
|
|
this.relativeParent = this.relativeTarget = undefined;
|
|
}
|
|
}
|
|
/**
|
|
* If we have no relative target or no target delta our target isn't valid
|
|
* for this frame.
|
|
*/
|
|
if (!this.relativeTarget && !this.targetDelta)
|
|
return;
|
|
/**
|
|
* Lazy-init target data structure
|
|
*/
|
|
if (!this.target) {
|
|
this.target = createBox();
|
|
this.targetWithTransforms = createBox();
|
|
}
|
|
/**
|
|
* If we've got a relative box for this component, resolve it into a target relative to the parent.
|
|
*/
|
|
if (this.relativeTarget &&
|
|
this.relativeTargetOrigin &&
|
|
this.relativeParent &&
|
|
this.relativeParent.target) {
|
|
this.forceRelativeParentToResolveTarget();
|
|
calcRelativeBox(this.target, this.relativeTarget, this.relativeParent.target);
|
|
/**
|
|
* If we've only got a targetDelta, resolve it into a target
|
|
*/
|
|
}
|
|
else if (this.targetDelta) {
|
|
if (Boolean(this.resumingFrom)) {
|
|
// TODO: This is creating a new object every frame
|
|
this.target = this.applyTransform(this.layout.layoutBox);
|
|
}
|
|
else {
|
|
copyBoxInto(this.target, this.layout.layoutBox);
|
|
}
|
|
applyBoxDelta(this.target, this.targetDelta);
|
|
}
|
|
else {
|
|
/**
|
|
* If no target, use own layout as target
|
|
*/
|
|
copyBoxInto(this.target, this.layout.layoutBox);
|
|
}
|
|
/**
|
|
* If we've been told to attempt to resolve a relative target, do so.
|
|
*/
|
|
if (this.attemptToResolveRelativeTarget) {
|
|
this.attemptToResolveRelativeTarget = false;
|
|
const relativeParent = this.getClosestProjectingParent();
|
|
if (relativeParent &&
|
|
Boolean(relativeParent.resumingFrom) ===
|
|
Boolean(this.resumingFrom) &&
|
|
!relativeParent.options.layoutScroll &&
|
|
relativeParent.target &&
|
|
this.animationProgress !== 1) {
|
|
this.relativeParent = relativeParent;
|
|
this.forceRelativeParentToResolveTarget();
|
|
this.relativeTarget = createBox();
|
|
this.relativeTargetOrigin = createBox();
|
|
calcRelativePosition(this.relativeTargetOrigin, this.target, relativeParent.target);
|
|
copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
|
|
}
|
|
else {
|
|
this.relativeParent = this.relativeTarget = undefined;
|
|
}
|
|
}
|
|
/**
|
|
* Increase debug counter for resolved target deltas
|
|
*/
|
|
if (isDebug) {
|
|
metrics.resolvedTargetDeltas++;
|
|
}
|
|
}
|
|
getClosestProjectingParent() {
|
|
if (!this.parent ||
|
|
hasScale(this.parent.latestValues) ||
|
|
has2DTranslate(this.parent.latestValues)) {
|
|
return undefined;
|
|
}
|
|
if (this.parent.isProjecting()) {
|
|
return this.parent;
|
|
}
|
|
else {
|
|
return this.parent.getClosestProjectingParent();
|
|
}
|
|
}
|
|
isProjecting() {
|
|
return Boolean((this.relativeTarget ||
|
|
this.targetDelta ||
|
|
this.options.layoutRoot) &&
|
|
this.layout);
|
|
}
|
|
calcProjection() {
|
|
var _a;
|
|
const lead = this.getLead();
|
|
const isShared = Boolean(this.resumingFrom) || this !== lead;
|
|
let canSkip = true;
|
|
/**
|
|
* If this is a normal layout animation and neither this node nor its nearest projecting
|
|
* is dirty then we can't skip.
|
|
*/
|
|
if (this.isProjectionDirty || ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isProjectionDirty)) {
|
|
canSkip = false;
|
|
}
|
|
/**
|
|
* If this is a shared layout animation and this node's shared projection is dirty then
|
|
* we can't skip.
|
|
*/
|
|
if (isShared &&
|
|
(this.isSharedProjectionDirty || this.isTransformDirty)) {
|
|
canSkip = false;
|
|
}
|
|
/**
|
|
* If we have resolved the target this frame we must recalculate the
|
|
* projection to ensure it visually represents the internal calculations.
|
|
*/
|
|
if (this.resolvedRelativeTargetAt === frameloop_frame/* frameData */.uv.timestamp) {
|
|
canSkip = false;
|
|
}
|
|
if (canSkip)
|
|
return;
|
|
const { layout, layoutId } = this.options;
|
|
/**
|
|
* If this section of the tree isn't animating we can
|
|
* delete our target sources for the following frame.
|
|
*/
|
|
this.isTreeAnimating = Boolean((this.parent && this.parent.isTreeAnimating) ||
|
|
this.currentAnimation ||
|
|
this.pendingAnimation);
|
|
if (!this.isTreeAnimating) {
|
|
this.targetDelta = this.relativeTarget = undefined;
|
|
}
|
|
if (!this.layout || !(layout || layoutId))
|
|
return;
|
|
/**
|
|
* Reset the corrected box with the latest values from box, as we're then going
|
|
* to perform mutative operations on it.
|
|
*/
|
|
copyBoxInto(this.layoutCorrected, this.layout.layoutBox);
|
|
/**
|
|
* Record previous tree scales before updating.
|
|
*/
|
|
const prevTreeScaleX = this.treeScale.x;
|
|
const prevTreeScaleY = this.treeScale.y;
|
|
/**
|
|
* Apply all the parent deltas to this box to produce the corrected box. This
|
|
* is the layout box, as it will appear on screen as a result of the transforms of its parents.
|
|
*/
|
|
applyTreeDeltas(this.layoutCorrected, this.treeScale, this.path, isShared);
|
|
/**
|
|
* If this layer needs to perform scale correction but doesn't have a target,
|
|
* use the layout as the target.
|
|
*/
|
|
if (lead.layout &&
|
|
!lead.target &&
|
|
(this.treeScale.x !== 1 || this.treeScale.y !== 1)) {
|
|
lead.target = lead.layout.layoutBox;
|
|
lead.targetWithTransforms = createBox();
|
|
}
|
|
const { target } = lead;
|
|
if (!target) {
|
|
/**
|
|
* If we don't have a target to project into, but we were previously
|
|
* projecting, we want to remove the stored transform and schedule
|
|
* a render to ensure the elements reflect the removed transform.
|
|
*/
|
|
if (this.prevProjectionDelta) {
|
|
this.createProjectionDeltas();
|
|
this.scheduleRender();
|
|
}
|
|
return;
|
|
}
|
|
if (!this.projectionDelta || !this.prevProjectionDelta) {
|
|
this.createProjectionDeltas();
|
|
}
|
|
else {
|
|
copyAxisDeltaInto(this.prevProjectionDelta.x, this.projectionDelta.x);
|
|
copyAxisDeltaInto(this.prevProjectionDelta.y, this.projectionDelta.y);
|
|
}
|
|
/**
|
|
* Update the delta between the corrected box and the target box before user-set transforms were applied.
|
|
* This will allow us to calculate the corrected borderRadius and boxShadow to compensate
|
|
* for our layout reprojection, but still allow them to be scaled correctly by the user.
|
|
* It might be that to simplify this we may want to accept that user-set scale is also corrected
|
|
* and we wouldn't have to keep and calc both deltas, OR we could support a user setting
|
|
* to allow people to choose whether these styles are corrected based on just the
|
|
* layout reprojection or the final bounding box.
|
|
*/
|
|
calcBoxDelta(this.projectionDelta, this.layoutCorrected, target, this.latestValues);
|
|
if (this.treeScale.x !== prevTreeScaleX ||
|
|
this.treeScale.y !== prevTreeScaleY ||
|
|
!axisDeltaEquals(this.projectionDelta.x, this.prevProjectionDelta.x) ||
|
|
!axisDeltaEquals(this.projectionDelta.y, this.prevProjectionDelta.y)) {
|
|
this.hasProjected = true;
|
|
this.scheduleRender();
|
|
this.notifyListeners("projectionUpdate", target);
|
|
}
|
|
/**
|
|
* Increase debug counter for recalculated projections
|
|
*/
|
|
if (isDebug) {
|
|
metrics.recalculatedProjection++;
|
|
}
|
|
}
|
|
hide() {
|
|
this.isVisible = false;
|
|
// TODO: Schedule render
|
|
}
|
|
show() {
|
|
this.isVisible = true;
|
|
// TODO: Schedule render
|
|
}
|
|
scheduleRender(notifyAll = true) {
|
|
var _a;
|
|
(_a = this.options.visualElement) === null || _a === void 0 ? void 0 : _a.scheduleRender();
|
|
if (notifyAll) {
|
|
const stack = this.getStack();
|
|
stack && stack.scheduleRender();
|
|
}
|
|
if (this.resumingFrom && !this.resumingFrom.instance) {
|
|
this.resumingFrom = undefined;
|
|
}
|
|
}
|
|
createProjectionDeltas() {
|
|
this.prevProjectionDelta = createDelta();
|
|
this.projectionDelta = createDelta();
|
|
this.projectionDeltaWithTransform = createDelta();
|
|
}
|
|
setAnimationOrigin(delta, hasOnlyRelativeTargetChanged = false) {
|
|
const snapshot = this.snapshot;
|
|
const snapshotLatestValues = snapshot
|
|
? snapshot.latestValues
|
|
: {};
|
|
const mixedValues = { ...this.latestValues };
|
|
const targetDelta = createDelta();
|
|
if (!this.relativeParent ||
|
|
!this.relativeParent.options.layoutRoot) {
|
|
this.relativeTarget = this.relativeTargetOrigin = undefined;
|
|
}
|
|
this.attemptToResolveRelativeTarget = !hasOnlyRelativeTargetChanged;
|
|
const relativeLayout = createBox();
|
|
const snapshotSource = snapshot ? snapshot.source : undefined;
|
|
const layoutSource = this.layout ? this.layout.source : undefined;
|
|
const isSharedLayoutAnimation = snapshotSource !== layoutSource;
|
|
const stack = this.getStack();
|
|
const isOnlyMember = !stack || stack.members.length <= 1;
|
|
const shouldCrossfadeOpacity = Boolean(isSharedLayoutAnimation &&
|
|
!isOnlyMember &&
|
|
this.options.crossfade === true &&
|
|
!this.path.some(hasOpacityCrossfade));
|
|
this.animationProgress = 0;
|
|
let prevRelativeTarget;
|
|
this.mixTargetDelta = (latest) => {
|
|
const progress = latest / 1000;
|
|
mixAxisDelta(targetDelta.x, delta.x, progress);
|
|
mixAxisDelta(targetDelta.y, delta.y, progress);
|
|
this.setTargetDelta(targetDelta);
|
|
if (this.relativeTarget &&
|
|
this.relativeTargetOrigin &&
|
|
this.layout &&
|
|
this.relativeParent &&
|
|
this.relativeParent.layout) {
|
|
calcRelativePosition(relativeLayout, this.layout.layoutBox, this.relativeParent.layout.layoutBox);
|
|
mixBox(this.relativeTarget, this.relativeTargetOrigin, relativeLayout, progress);
|
|
/**
|
|
* If this is an unchanged relative target we can consider the
|
|
* projection not dirty.
|
|
*/
|
|
if (prevRelativeTarget &&
|
|
boxEquals(this.relativeTarget, prevRelativeTarget)) {
|
|
this.isProjectionDirty = false;
|
|
}
|
|
if (!prevRelativeTarget)
|
|
prevRelativeTarget = createBox();
|
|
copyBoxInto(prevRelativeTarget, this.relativeTarget);
|
|
}
|
|
if (isSharedLayoutAnimation) {
|
|
this.animationValues = mixedValues;
|
|
mixValues(mixedValues, snapshotLatestValues, this.latestValues, progress, shouldCrossfadeOpacity, isOnlyMember);
|
|
}
|
|
this.root.scheduleUpdateProjection();
|
|
this.scheduleRender();
|
|
this.animationProgress = progress;
|
|
};
|
|
this.mixTargetDelta(this.options.layoutRoot ? 1000 : 0);
|
|
}
|
|
startAnimation(options) {
|
|
this.notifyListeners("animationStart");
|
|
this.currentAnimation && this.currentAnimation.stop();
|
|
if (this.resumingFrom && this.resumingFrom.currentAnimation) {
|
|
this.resumingFrom.currentAnimation.stop();
|
|
}
|
|
if (this.pendingAnimation) {
|
|
(0,frameloop_frame/* cancelFrame */.WG)(this.pendingAnimation);
|
|
this.pendingAnimation = undefined;
|
|
}
|
|
/**
|
|
* Start the animation in the next frame to have a frame with progress 0,
|
|
* where the target is the same as when the animation started, so we can
|
|
* calculate the relative positions correctly for instant transitions.
|
|
*/
|
|
this.pendingAnimation = frameloop_frame/* frame */.Gt.update(() => {
|
|
globalProjectionState.hasAnimatedSinceResize = true;
|
|
this.currentAnimation = animateSingleValue(0, animationTarget, {
|
|
...options,
|
|
onUpdate: (latest) => {
|
|
this.mixTargetDelta(latest);
|
|
options.onUpdate && options.onUpdate(latest);
|
|
},
|
|
onComplete: () => {
|
|
options.onComplete && options.onComplete();
|
|
this.completeAnimation();
|
|
},
|
|
});
|
|
if (this.resumingFrom) {
|
|
this.resumingFrom.currentAnimation = this.currentAnimation;
|
|
}
|
|
this.pendingAnimation = undefined;
|
|
});
|
|
}
|
|
completeAnimation() {
|
|
if (this.resumingFrom) {
|
|
this.resumingFrom.currentAnimation = undefined;
|
|
this.resumingFrom.preserveOpacity = undefined;
|
|
}
|
|
const stack = this.getStack();
|
|
stack && stack.exitAnimationComplete();
|
|
this.resumingFrom =
|
|
this.currentAnimation =
|
|
this.animationValues =
|
|
undefined;
|
|
this.notifyListeners("animationComplete");
|
|
}
|
|
finishAnimation() {
|
|
if (this.currentAnimation) {
|
|
this.mixTargetDelta && this.mixTargetDelta(animationTarget);
|
|
this.currentAnimation.stop();
|
|
}
|
|
this.completeAnimation();
|
|
}
|
|
applyTransformsToTarget() {
|
|
const lead = this.getLead();
|
|
let { targetWithTransforms, target, layout, latestValues } = lead;
|
|
if (!targetWithTransforms || !target || !layout)
|
|
return;
|
|
/**
|
|
* If we're only animating position, and this element isn't the lead element,
|
|
* then instead of projecting into the lead box we instead want to calculate
|
|
* a new target that aligns the two boxes but maintains the layout shape.
|
|
*/
|
|
if (this !== lead &&
|
|
this.layout &&
|
|
layout &&
|
|
shouldAnimatePositionOnly(this.options.animationType, this.layout.layoutBox, layout.layoutBox)) {
|
|
target = this.target || createBox();
|
|
const xLength = calcLength(this.layout.layoutBox.x);
|
|
target.x.min = lead.target.x.min;
|
|
target.x.max = target.x.min + xLength;
|
|
const yLength = calcLength(this.layout.layoutBox.y);
|
|
target.y.min = lead.target.y.min;
|
|
target.y.max = target.y.min + yLength;
|
|
}
|
|
copyBoxInto(targetWithTransforms, target);
|
|
/**
|
|
* Apply the latest user-set transforms to the targetBox to produce the targetBoxFinal.
|
|
* This is the final box that we will then project into by calculating a transform delta and
|
|
* applying it to the corrected box.
|
|
*/
|
|
transformBox(targetWithTransforms, latestValues);
|
|
/**
|
|
* Update the delta between the corrected box and the final target box, after
|
|
* user-set transforms are applied to it. This will be used by the renderer to
|
|
* create a transform style that will reproject the element from its layout layout
|
|
* into the desired bounding box.
|
|
*/
|
|
calcBoxDelta(this.projectionDeltaWithTransform, this.layoutCorrected, targetWithTransforms, latestValues);
|
|
}
|
|
registerSharedNode(layoutId, node) {
|
|
if (!this.sharedNodes.has(layoutId)) {
|
|
this.sharedNodes.set(layoutId, new NodeStack());
|
|
}
|
|
const stack = this.sharedNodes.get(layoutId);
|
|
stack.add(node);
|
|
const config = node.options.initialPromotionConfig;
|
|
node.promote({
|
|
transition: config ? config.transition : undefined,
|
|
preserveFollowOpacity: config && config.shouldPreserveFollowOpacity
|
|
? config.shouldPreserveFollowOpacity(node)
|
|
: undefined,
|
|
});
|
|
}
|
|
isLead() {
|
|
const stack = this.getStack();
|
|
return stack ? stack.lead === this : true;
|
|
}
|
|
getLead() {
|
|
var _a;
|
|
const { layoutId } = this.options;
|
|
return layoutId ? ((_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.lead) || this : this;
|
|
}
|
|
getPrevLead() {
|
|
var _a;
|
|
const { layoutId } = this.options;
|
|
return layoutId ? (_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.prevLead : undefined;
|
|
}
|
|
getStack() {
|
|
const { layoutId } = this.options;
|
|
if (layoutId)
|
|
return this.root.sharedNodes.get(layoutId);
|
|
}
|
|
promote({ needsReset, transition, preserveFollowOpacity, } = {}) {
|
|
const stack = this.getStack();
|
|
if (stack)
|
|
stack.promote(this, preserveFollowOpacity);
|
|
if (needsReset) {
|
|
this.projectionDelta = undefined;
|
|
this.needsReset = true;
|
|
}
|
|
if (transition)
|
|
this.setOptions({ transition });
|
|
}
|
|
relegate() {
|
|
const stack = this.getStack();
|
|
if (stack) {
|
|
return stack.relegate(this);
|
|
}
|
|
else {
|
|
return false;
|
|
}
|
|
}
|
|
resetSkewAndRotation() {
|
|
const { visualElement } = this.options;
|
|
if (!visualElement)
|
|
return;
|
|
// If there's no detected skew or rotation values, we can early return without a forced render.
|
|
let hasDistortingTransform = false;
|
|
/**
|
|
* An unrolled check for rotation values. Most elements don't have any rotation and
|
|
* skipping the nested loop and new object creation is 50% faster.
|
|
*/
|
|
const { latestValues } = visualElement;
|
|
if (latestValues.z ||
|
|
latestValues.rotate ||
|
|
latestValues.rotateX ||
|
|
latestValues.rotateY ||
|
|
latestValues.rotateZ ||
|
|
latestValues.skewX ||
|
|
latestValues.skewY) {
|
|
hasDistortingTransform = true;
|
|
}
|
|
// If there's no distorting values, we don't need to do any more.
|
|
if (!hasDistortingTransform)
|
|
return;
|
|
const resetValues = {};
|
|
if (latestValues.z) {
|
|
resetDistortingTransform("z", visualElement, resetValues, this.animationValues);
|
|
}
|
|
// Check the skew and rotate value of all axes and reset to 0
|
|
for (let i = 0; i < transformAxes.length; i++) {
|
|
resetDistortingTransform(`rotate${transformAxes[i]}`, visualElement, resetValues, this.animationValues);
|
|
resetDistortingTransform(`skew${transformAxes[i]}`, visualElement, resetValues, this.animationValues);
|
|
}
|
|
// Force a render of this element to apply the transform with all skews and rotations
|
|
// set to 0.
|
|
visualElement.render();
|
|
// Put back all the values we reset
|
|
for (const key in resetValues) {
|
|
visualElement.setStaticValue(key, resetValues[key]);
|
|
if (this.animationValues) {
|
|
this.animationValues[key] = resetValues[key];
|
|
}
|
|
}
|
|
// Schedule a render for the next frame. This ensures we won't visually
|
|
// see the element with the reset rotate value applied.
|
|
visualElement.scheduleRender();
|
|
}
|
|
getProjectionStyles(styleProp) {
|
|
var _a, _b;
|
|
if (!this.instance || this.isSVG)
|
|
return undefined;
|
|
if (!this.isVisible) {
|
|
return hiddenVisibility;
|
|
}
|
|
const styles = {
|
|
visibility: "",
|
|
};
|
|
const transformTemplate = this.getTransformTemplate();
|
|
if (this.needsReset) {
|
|
this.needsReset = false;
|
|
styles.opacity = "";
|
|
styles.pointerEvents =
|
|
resolveMotionValue(styleProp === null || styleProp === void 0 ? void 0 : styleProp.pointerEvents) || "";
|
|
styles.transform = transformTemplate
|
|
? transformTemplate(this.latestValues, "")
|
|
: "none";
|
|
return styles;
|
|
}
|
|
const lead = this.getLead();
|
|
if (!this.projectionDelta || !this.layout || !lead.target) {
|
|
const emptyStyles = {};
|
|
if (this.options.layoutId) {
|
|
emptyStyles.opacity =
|
|
this.latestValues.opacity !== undefined
|
|
? this.latestValues.opacity
|
|
: 1;
|
|
emptyStyles.pointerEvents =
|
|
resolveMotionValue(styleProp === null || styleProp === void 0 ? void 0 : styleProp.pointerEvents) || "";
|
|
}
|
|
if (this.hasProjected && !hasTransform(this.latestValues)) {
|
|
emptyStyles.transform = transformTemplate
|
|
? transformTemplate({}, "")
|
|
: "none";
|
|
this.hasProjected = false;
|
|
}
|
|
return emptyStyles;
|
|
}
|
|
const valuesToRender = lead.animationValues || lead.latestValues;
|
|
this.applyTransformsToTarget();
|
|
styles.transform = buildProjectionTransform(this.projectionDeltaWithTransform, this.treeScale, valuesToRender);
|
|
if (transformTemplate) {
|
|
styles.transform = transformTemplate(valuesToRender, styles.transform);
|
|
}
|
|
const { x, y } = this.projectionDelta;
|
|
styles.transformOrigin = `${x.origin * 100}% ${y.origin * 100}% 0`;
|
|
if (lead.animationValues) {
|
|
/**
|
|
* If the lead component is animating, assign this either the entering/leaving
|
|
* opacity
|
|
*/
|
|
styles.opacity =
|
|
lead === this
|
|
? (_b = (_a = valuesToRender.opacity) !== null && _a !== void 0 ? _a : this.latestValues.opacity) !== null && _b !== void 0 ? _b : 1
|
|
: this.preserveOpacity
|
|
? this.latestValues.opacity
|
|
: valuesToRender.opacityExit;
|
|
}
|
|
else {
|
|
/**
|
|
* Or we're not animating at all, set the lead component to its layout
|
|
* opacity and other components to hidden.
|
|
*/
|
|
styles.opacity =
|
|
lead === this
|
|
? valuesToRender.opacity !== undefined
|
|
? valuesToRender.opacity
|
|
: ""
|
|
: valuesToRender.opacityExit !== undefined
|
|
? valuesToRender.opacityExit
|
|
: 0;
|
|
}
|
|
/**
|
|
* Apply scale correction
|
|
*/
|
|
for (const key in scaleCorrectors) {
|
|
if (valuesToRender[key] === undefined)
|
|
continue;
|
|
const { correct, applyTo } = scaleCorrectors[key];
|
|
/**
|
|
* Only apply scale correction to the value if we have an
|
|
* active projection transform. Otherwise these values become
|
|
* vulnerable to distortion if the element changes size without
|
|
* a corresponding layout animation.
|
|
*/
|
|
const corrected = styles.transform === "none"
|
|
? valuesToRender[key]
|
|
: correct(valuesToRender[key], lead);
|
|
if (applyTo) {
|
|
const num = applyTo.length;
|
|
for (let i = 0; i < num; i++) {
|
|
styles[applyTo[i]] = corrected;
|
|
}
|
|
}
|
|
else {
|
|
styles[key] = corrected;
|
|
}
|
|
}
|
|
/**
|
|
* Disable pointer events on follow components. This is to ensure
|
|
* that if a follow component covers a lead component it doesn't block
|
|
* pointer events on the lead.
|
|
*/
|
|
if (this.options.layoutId) {
|
|
styles.pointerEvents =
|
|
lead === this
|
|
? resolveMotionValue(styleProp === null || styleProp === void 0 ? void 0 : styleProp.pointerEvents) || ""
|
|
: "none";
|
|
}
|
|
return styles;
|
|
}
|
|
clearSnapshot() {
|
|
this.resumeFrom = this.snapshot = undefined;
|
|
}
|
|
// Only run on root
|
|
resetTree() {
|
|
this.root.nodes.forEach((node) => { var _a; return (_a = node.currentAnimation) === null || _a === void 0 ? void 0 : _a.stop(); });
|
|
this.root.nodes.forEach(clearMeasurements);
|
|
this.root.sharedNodes.clear();
|
|
}
|
|
};
|
|
}
|
|
function updateLayout(node) {
|
|
node.updateLayout();
|
|
}
|
|
function notifyLayoutUpdate(node) {
|
|
var _a;
|
|
const snapshot = ((_a = node.resumeFrom) === null || _a === void 0 ? void 0 : _a.snapshot) || node.snapshot;
|
|
if (node.isLead() &&
|
|
node.layout &&
|
|
snapshot &&
|
|
node.hasListeners("didUpdate")) {
|
|
const { layoutBox: layout, measuredBox: measuredLayout } = node.layout;
|
|
const { animationType } = node.options;
|
|
const isShared = snapshot.source !== node.layout.source;
|
|
// TODO Maybe we want to also resize the layout snapshot so we don't trigger
|
|
// animations for instance if layout="size" and an element has only changed position
|
|
if (animationType === "size") {
|
|
eachAxis((axis) => {
|
|
const axisSnapshot = isShared
|
|
? snapshot.measuredBox[axis]
|
|
: snapshot.layoutBox[axis];
|
|
const length = calcLength(axisSnapshot);
|
|
axisSnapshot.min = layout[axis].min;
|
|
axisSnapshot.max = axisSnapshot.min + length;
|
|
});
|
|
}
|
|
else if (shouldAnimatePositionOnly(animationType, snapshot.layoutBox, layout)) {
|
|
eachAxis((axis) => {
|
|
const axisSnapshot = isShared
|
|
? snapshot.measuredBox[axis]
|
|
: snapshot.layoutBox[axis];
|
|
const length = calcLength(layout[axis]);
|
|
axisSnapshot.max = axisSnapshot.min + length;
|
|
/**
|
|
* Ensure relative target gets resized and rerendererd
|
|
*/
|
|
if (node.relativeTarget && !node.currentAnimation) {
|
|
node.isProjectionDirty = true;
|
|
node.relativeTarget[axis].max =
|
|
node.relativeTarget[axis].min + length;
|
|
}
|
|
});
|
|
}
|
|
const layoutDelta = createDelta();
|
|
calcBoxDelta(layoutDelta, layout, snapshot.layoutBox);
|
|
const visualDelta = createDelta();
|
|
if (isShared) {
|
|
calcBoxDelta(visualDelta, node.applyTransform(measuredLayout, true), snapshot.measuredBox);
|
|
}
|
|
else {
|
|
calcBoxDelta(visualDelta, layout, snapshot.layoutBox);
|
|
}
|
|
const hasLayoutChanged = !isDeltaZero(layoutDelta);
|
|
let hasRelativeTargetChanged = false;
|
|
if (!node.resumeFrom) {
|
|
const relativeParent = node.getClosestProjectingParent();
|
|
/**
|
|
* If the relativeParent is itself resuming from a different element then
|
|
* the relative snapshot is not relavent
|
|
*/
|
|
if (relativeParent && !relativeParent.resumeFrom) {
|
|
const { snapshot: parentSnapshot, layout: parentLayout } = relativeParent;
|
|
if (parentSnapshot && parentLayout) {
|
|
const relativeSnapshot = createBox();
|
|
calcRelativePosition(relativeSnapshot, snapshot.layoutBox, parentSnapshot.layoutBox);
|
|
const relativeLayout = createBox();
|
|
calcRelativePosition(relativeLayout, layout, parentLayout.layoutBox);
|
|
if (!boxEqualsRounded(relativeSnapshot, relativeLayout)) {
|
|
hasRelativeTargetChanged = true;
|
|
}
|
|
if (relativeParent.options.layoutRoot) {
|
|
node.relativeTarget = relativeLayout;
|
|
node.relativeTargetOrigin = relativeSnapshot;
|
|
node.relativeParent = relativeParent;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
node.notifyListeners("didUpdate", {
|
|
layout,
|
|
snapshot,
|
|
delta: visualDelta,
|
|
layoutDelta,
|
|
hasLayoutChanged,
|
|
hasRelativeTargetChanged,
|
|
});
|
|
}
|
|
else if (node.isLead()) {
|
|
const { onExitComplete } = node.options;
|
|
onExitComplete && onExitComplete();
|
|
}
|
|
/**
|
|
* Clearing transition
|
|
* TODO: Investigate why this transition is being passed in as {type: false } from Framer
|
|
* and why we need it at all
|
|
*/
|
|
node.options.transition = undefined;
|
|
}
|
|
function propagateDirtyNodes(node) {
|
|
/**
|
|
* Increase debug counter for nodes encountered this frame
|
|
*/
|
|
if (isDebug) {
|
|
metrics.totalNodes++;
|
|
}
|
|
if (!node.parent)
|
|
return;
|
|
/**
|
|
* If this node isn't projecting, propagate isProjectionDirty. It will have
|
|
* no performance impact but it will allow the next child that *is* projecting
|
|
* but *isn't* dirty to just check its parent to see if *any* ancestor needs
|
|
* correcting.
|
|
*/
|
|
if (!node.isProjecting()) {
|
|
node.isProjectionDirty = node.parent.isProjectionDirty;
|
|
}
|
|
/**
|
|
* Propagate isSharedProjectionDirty and isTransformDirty
|
|
* throughout the whole tree. A future revision can take another look at
|
|
* this but for safety we still recalcualte shared nodes.
|
|
*/
|
|
node.isSharedProjectionDirty || (node.isSharedProjectionDirty = Boolean(node.isProjectionDirty ||
|
|
node.parent.isProjectionDirty ||
|
|
node.parent.isSharedProjectionDirty));
|
|
node.isTransformDirty || (node.isTransformDirty = node.parent.isTransformDirty);
|
|
}
|
|
function cleanDirtyNodes(node) {
|
|
node.isProjectionDirty =
|
|
node.isSharedProjectionDirty =
|
|
node.isTransformDirty =
|
|
false;
|
|
}
|
|
function clearSnapshot(node) {
|
|
node.clearSnapshot();
|
|
}
|
|
function clearMeasurements(node) {
|
|
node.clearMeasurements();
|
|
}
|
|
function clearIsLayoutDirty(node) {
|
|
node.isLayoutDirty = false;
|
|
}
|
|
function resetTransformStyle(node) {
|
|
const { visualElement } = node.options;
|
|
if (visualElement && visualElement.getProps().onBeforeLayoutMeasure) {
|
|
visualElement.notify("BeforeLayoutMeasure");
|
|
}
|
|
node.resetTransform();
|
|
}
|
|
function finishAnimation(node) {
|
|
node.finishAnimation();
|
|
node.targetDelta = node.relativeTarget = node.target = undefined;
|
|
node.isProjectionDirty = true;
|
|
}
|
|
function resolveTargetDelta(node) {
|
|
node.resolveTargetDelta();
|
|
}
|
|
function calcProjection(node) {
|
|
node.calcProjection();
|
|
}
|
|
function resetSkewAndRotation(node) {
|
|
node.resetSkewAndRotation();
|
|
}
|
|
function removeLeadSnapshots(stack) {
|
|
stack.removeLeadSnapshot();
|
|
}
|
|
function mixAxisDelta(output, delta, p) {
|
|
output.translate = mixNumber(delta.translate, 0, p);
|
|
output.scale = mixNumber(delta.scale, 1, p);
|
|
output.origin = delta.origin;
|
|
output.originPoint = delta.originPoint;
|
|
}
|
|
function mixAxis(output, from, to, p) {
|
|
output.min = mixNumber(from.min, to.min, p);
|
|
output.max = mixNumber(from.max, to.max, p);
|
|
}
|
|
function mixBox(output, from, to, p) {
|
|
mixAxis(output.x, from.x, to.x, p);
|
|
mixAxis(output.y, from.y, to.y, p);
|
|
}
|
|
function hasOpacityCrossfade(node) {
|
|
return (node.animationValues && node.animationValues.opacityExit !== undefined);
|
|
}
|
|
const defaultLayoutTransition = {
|
|
duration: 0.45,
|
|
ease: [0.4, 0, 0.1, 1],
|
|
};
|
|
const userAgentContains = (string) => typeof navigator !== "undefined" &&
|
|
navigator.userAgent &&
|
|
navigator.userAgent.toLowerCase().includes(string);
|
|
/**
|
|
* Measured bounding boxes must be rounded in Safari and
|
|
* left untouched in Chrome, otherwise non-integer layouts within scaled-up elements
|
|
* can appear to jump.
|
|
*/
|
|
const roundPoint = userAgentContains("applewebkit/") && !userAgentContains("chrome/")
|
|
? Math.round
|
|
: noop/* noop */.l;
|
|
function roundAxis(axis) {
|
|
// Round to the nearest .5 pixels to support subpixel layouts
|
|
axis.min = roundPoint(axis.min);
|
|
axis.max = roundPoint(axis.max);
|
|
}
|
|
function roundBox(box) {
|
|
roundAxis(box.x);
|
|
roundAxis(box.y);
|
|
}
|
|
function shouldAnimatePositionOnly(animationType, snapshot, layout) {
|
|
return (animationType === "position" ||
|
|
(animationType === "preserve-aspect" &&
|
|
!isNear(aspectRatio(snapshot), aspectRatio(layout), 0.2)));
|
|
}
|
|
function checkNodeWasScrollRoot(node) {
|
|
var _a;
|
|
return node !== node.root && ((_a = node.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot);
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/projection/node/DocumentProjectionNode.mjs
|
|
|
|
|
|
|
|
const DocumentProjectionNode = create_projection_node_createProjectionNode({
|
|
attachResizeListener: (ref, notify) => addDomEvent(ref, "resize", notify),
|
|
measureScroll: () => ({
|
|
x: document.documentElement.scrollLeft || document.body.scrollLeft,
|
|
y: document.documentElement.scrollTop || document.body.scrollTop,
|
|
}),
|
|
checkIsScrollRoot: () => true,
|
|
});
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/projection/node/HTMLProjectionNode.mjs
|
|
|
|
|
|
|
|
const rootProjectionNode = {
|
|
current: undefined,
|
|
};
|
|
const HTMLProjectionNode = create_projection_node_createProjectionNode({
|
|
measureScroll: (instance) => ({
|
|
x: instance.scrollLeft,
|
|
y: instance.scrollTop,
|
|
}),
|
|
defaultParent: () => {
|
|
if (!rootProjectionNode.current) {
|
|
const documentNode = new DocumentProjectionNode({});
|
|
documentNode.mount(window);
|
|
documentNode.setOptions({ layoutScroll: true });
|
|
rootProjectionNode.current = documentNode;
|
|
}
|
|
return rootProjectionNode.current;
|
|
},
|
|
resetTransform: (instance, value) => {
|
|
instance.style.transform = value !== undefined ? value : "none";
|
|
},
|
|
checkIsScrollRoot: (instance) => Boolean(window.getComputedStyle(instance).position === "fixed"),
|
|
});
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/motion/features/drag.mjs
|
|
|
|
|
|
|
|
|
|
|
|
const drag = {
|
|
pan: {
|
|
Feature: PanGesture,
|
|
},
|
|
drag: {
|
|
Feature: DragGesture,
|
|
ProjectionNode: HTMLProjectionNode,
|
|
MeasureLayout: MeasureLayout,
|
|
},
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/reduced-motion/state.mjs
|
|
// Does this device prefer reduced motion? Returns `null` server-side.
|
|
const prefersReducedMotion = { current: null };
|
|
const hasReducedMotionListener = { current: false };
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/reduced-motion/index.mjs
|
|
|
|
|
|
|
|
function initPrefersReducedMotion() {
|
|
hasReducedMotionListener.current = true;
|
|
if (!is_browser/* isBrowser */.B)
|
|
return;
|
|
if (window.matchMedia) {
|
|
const motionMediaQuery = window.matchMedia("(prefers-reduced-motion)");
|
|
const setReducedMotionPreferences = () => (prefersReducedMotion.current = motionMediaQuery.matches);
|
|
motionMediaQuery.addListener(setReducedMotionPreferences);
|
|
setReducedMotionPreferences();
|
|
}
|
|
else {
|
|
prefersReducedMotion.current = false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/utils/motion-values.mjs
|
|
|
|
|
|
|
|
|
|
function updateMotionValuesFromProps(element, next, prev) {
|
|
for (const key in next) {
|
|
const nextValue = next[key];
|
|
const prevValue = prev[key];
|
|
if (isMotionValue(nextValue)) {
|
|
/**
|
|
* If this is a motion value found in props or style, we want to add it
|
|
* to our visual element's motion value map.
|
|
*/
|
|
element.addValue(key, nextValue);
|
|
/**
|
|
* Check the version of the incoming motion value with this version
|
|
* and warn against mismatches.
|
|
*/
|
|
if (false) {}
|
|
}
|
|
else if (isMotionValue(prevValue)) {
|
|
/**
|
|
* If we're swapping from a motion value to a static value,
|
|
* create a new motion value from that
|
|
*/
|
|
element.addValue(key, motionValue(nextValue, { owner: element }));
|
|
}
|
|
else if (prevValue !== nextValue) {
|
|
/**
|
|
* If this is a flat value that has changed, update the motion value
|
|
* or create one if it doesn't exist. We only want to do this if we're
|
|
* not handling the value with our animation state.
|
|
*/
|
|
if (element.hasValue(key)) {
|
|
const existingValue = element.getValue(key);
|
|
if (existingValue.liveStyle === true) {
|
|
existingValue.jump(nextValue);
|
|
}
|
|
else if (!existingValue.hasAnimated) {
|
|
existingValue.set(nextValue);
|
|
}
|
|
}
|
|
else {
|
|
const latestValue = element.getStaticValue(key);
|
|
element.addValue(key, motionValue(latestValue !== undefined ? latestValue : nextValue, { owner: element }));
|
|
}
|
|
}
|
|
}
|
|
// Handle removed values
|
|
for (const key in prev) {
|
|
if (next[key] === undefined)
|
|
element.removeValue(key);
|
|
}
|
|
return next;
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/store.mjs
|
|
const visualElementStore = new WeakMap();
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/dom/value-types/find.mjs
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* A list of all ValueTypes
|
|
*/
|
|
const valueTypes = [...dimensionValueTypes, color, complex];
|
|
/**
|
|
* Tests a value against the list of ValueTypes
|
|
*/
|
|
const findValueType = (v) => valueTypes.find(testValueType(v));
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/VisualElement.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const propEventHandlers = [
|
|
"AnimationStart",
|
|
"AnimationComplete",
|
|
"Update",
|
|
"BeforeLayoutMeasure",
|
|
"LayoutMeasure",
|
|
"LayoutAnimationStart",
|
|
"LayoutAnimationComplete",
|
|
];
|
|
const numVariantProps = variantProps.length;
|
|
/**
|
|
* A VisualElement is an imperative abstraction around UI elements such as
|
|
* HTMLElement, SVGElement, Three.Object3D etc.
|
|
*/
|
|
class VisualElement {
|
|
/**
|
|
* This method takes React props and returns found MotionValues. For example, HTML
|
|
* MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
|
|
*
|
|
* This isn't an abstract method as it needs calling in the constructor, but it is
|
|
* intended to be one.
|
|
*/
|
|
scrapeMotionValuesFromProps(_props, _prevProps, _visualElement) {
|
|
return {};
|
|
}
|
|
constructor({ parent, props, presenceContext, reducedMotionConfig, blockInitialAnimation, visualState, }, options = {}) {
|
|
/**
|
|
* If true, will-change will be applied to the element. Only HTMLVisualElements
|
|
* currently support this.
|
|
*/
|
|
this.applyWillChange = false;
|
|
/**
|
|
* A reference to the current underlying Instance, e.g. a HTMLElement
|
|
* or Three.Mesh etc.
|
|
*/
|
|
this.current = null;
|
|
/**
|
|
* A set containing references to this VisualElement's children.
|
|
*/
|
|
this.children = new Set();
|
|
/**
|
|
* Determine what role this visual element should take in the variant tree.
|
|
*/
|
|
this.isVariantNode = false;
|
|
this.isControllingVariants = false;
|
|
/**
|
|
* Decides whether this VisualElement should animate in reduced motion
|
|
* mode.
|
|
*
|
|
* TODO: This is currently set on every individual VisualElement but feels
|
|
* like it could be set globally.
|
|
*/
|
|
this.shouldReduceMotion = null;
|
|
/**
|
|
* A map of all motion values attached to this visual element. Motion
|
|
* values are source of truth for any given animated value. A motion
|
|
* value might be provided externally by the component via props.
|
|
*/
|
|
this.values = new Map();
|
|
this.KeyframeResolver = KeyframeResolver;
|
|
/**
|
|
* Cleanup functions for active features (hover/tap/exit etc)
|
|
*/
|
|
this.features = {};
|
|
/**
|
|
* A map of every subscription that binds the provided or generated
|
|
* motion values onChange listeners to this visual element.
|
|
*/
|
|
this.valueSubscriptions = new Map();
|
|
/**
|
|
* A reference to the previously-provided motion values as returned
|
|
* from scrapeMotionValuesFromProps. We use the keys in here to determine
|
|
* if any motion values need to be removed after props are updated.
|
|
*/
|
|
this.prevMotionValues = {};
|
|
/**
|
|
* An object containing a SubscriptionManager for each active event.
|
|
*/
|
|
this.events = {};
|
|
/**
|
|
* An object containing an unsubscribe function for each prop event subscription.
|
|
* For example, every "Update" event can have multiple subscribers via
|
|
* VisualElement.on(), but only one of those can be defined via the onUpdate prop.
|
|
*/
|
|
this.propEventSubscriptions = {};
|
|
this.notifyUpdate = () => this.notify("Update", this.latestValues);
|
|
this.render = () => {
|
|
this.isRenderScheduled = false;
|
|
if (!this.current)
|
|
return;
|
|
this.triggerBuild();
|
|
this.renderInstance(this.current, this.renderState, this.props.style, this.projection);
|
|
};
|
|
this.isRenderScheduled = false;
|
|
this.scheduleRender = () => {
|
|
if (!this.isRenderScheduled) {
|
|
this.isRenderScheduled = true;
|
|
frameloop_frame/* frame */.Gt.render(this.render, false, true);
|
|
}
|
|
};
|
|
const { latestValues, renderState } = visualState;
|
|
this.latestValues = latestValues;
|
|
this.baseTarget = { ...latestValues };
|
|
this.initialValues = props.initial ? { ...latestValues } : {};
|
|
this.renderState = renderState;
|
|
this.parent = parent;
|
|
this.props = props;
|
|
this.presenceContext = presenceContext;
|
|
this.depth = parent ? parent.depth + 1 : 0;
|
|
this.reducedMotionConfig = reducedMotionConfig;
|
|
this.options = options;
|
|
this.blockInitialAnimation = Boolean(blockInitialAnimation);
|
|
this.isControllingVariants = isControllingVariants(props);
|
|
this.isVariantNode = isVariantNode(props);
|
|
if (this.isVariantNode) {
|
|
this.variantChildren = new Set();
|
|
}
|
|
this.manuallyAnimateOnMount = Boolean(parent && parent.current);
|
|
/**
|
|
* Any motion values that are provided to the element when created
|
|
* aren't yet bound to the element, as this would technically be impure.
|
|
* However, we iterate through the motion values and set them to the
|
|
* initial values for this component.
|
|
*
|
|
* TODO: This is impure and we should look at changing this to run on mount.
|
|
* Doing so will break some tests but this isn't necessarily a breaking change,
|
|
* more a reflection of the test.
|
|
*/
|
|
const { willChange, ...initialMotionValues } = this.scrapeMotionValuesFromProps(props, {}, this);
|
|
for (const key in initialMotionValues) {
|
|
const value = initialMotionValues[key];
|
|
if (latestValues[key] !== undefined && isMotionValue(value)) {
|
|
value.set(latestValues[key], false);
|
|
}
|
|
}
|
|
}
|
|
mount(instance) {
|
|
this.current = instance;
|
|
visualElementStore.set(instance, this);
|
|
if (this.projection && !this.projection.instance) {
|
|
this.projection.mount(instance);
|
|
}
|
|
if (this.parent && this.isVariantNode && !this.isControllingVariants) {
|
|
this.removeFromVariantTree = this.parent.addVariantChild(this);
|
|
}
|
|
this.values.forEach((value, key) => this.bindToMotionValue(key, value));
|
|
if (!hasReducedMotionListener.current) {
|
|
initPrefersReducedMotion();
|
|
}
|
|
this.shouldReduceMotion =
|
|
this.reducedMotionConfig === "never"
|
|
? false
|
|
: this.reducedMotionConfig === "always"
|
|
? true
|
|
: prefersReducedMotion.current;
|
|
if (false) {}
|
|
if (this.parent)
|
|
this.parent.children.add(this);
|
|
this.update(this.props, this.presenceContext);
|
|
}
|
|
unmount() {
|
|
visualElementStore.delete(this.current);
|
|
this.projection && this.projection.unmount();
|
|
(0,frameloop_frame/* cancelFrame */.WG)(this.notifyUpdate);
|
|
(0,frameloop_frame/* cancelFrame */.WG)(this.render);
|
|
this.valueSubscriptions.forEach((remove) => remove());
|
|
this.removeFromVariantTree && this.removeFromVariantTree();
|
|
this.parent && this.parent.children.delete(this);
|
|
for (const key in this.events) {
|
|
this.events[key].clear();
|
|
}
|
|
for (const key in this.features) {
|
|
const feature = this.features[key];
|
|
if (feature) {
|
|
feature.unmount();
|
|
feature.isMounted = false;
|
|
}
|
|
}
|
|
this.current = null;
|
|
}
|
|
bindToMotionValue(key, value) {
|
|
if (this.valueSubscriptions.has(key)) {
|
|
this.valueSubscriptions.get(key)();
|
|
}
|
|
const valueIsTransform = transformProps.has(key);
|
|
const removeOnChange = value.on("change", (latestValue) => {
|
|
this.latestValues[key] = latestValue;
|
|
this.props.onUpdate && frameloop_frame/* frame */.Gt.preRender(this.notifyUpdate);
|
|
if (valueIsTransform && this.projection) {
|
|
this.projection.isTransformDirty = true;
|
|
}
|
|
});
|
|
const removeOnRenderRequest = value.on("renderRequest", this.scheduleRender);
|
|
this.valueSubscriptions.set(key, () => {
|
|
removeOnChange();
|
|
removeOnRenderRequest();
|
|
if (value.owner)
|
|
value.stop();
|
|
});
|
|
}
|
|
sortNodePosition(other) {
|
|
/**
|
|
* If these nodes aren't even of the same type we can't compare their depth.
|
|
*/
|
|
if (!this.current ||
|
|
!this.sortInstanceNodePosition ||
|
|
this.type !== other.type) {
|
|
return 0;
|
|
}
|
|
return this.sortInstanceNodePosition(this.current, other.current);
|
|
}
|
|
updateFeatures() {
|
|
let key = "animation";
|
|
for (key in featureDefinitions) {
|
|
const featureDefinition = featureDefinitions[key];
|
|
if (!featureDefinition)
|
|
continue;
|
|
const { isEnabled, Feature: FeatureConstructor } = featureDefinition;
|
|
/**
|
|
* If this feature is enabled but not active, make a new instance.
|
|
*/
|
|
if (!this.features[key] &&
|
|
FeatureConstructor &&
|
|
isEnabled(this.props)) {
|
|
this.features[key] = new FeatureConstructor(this);
|
|
}
|
|
/**
|
|
* If we have a feature, mount or update it.
|
|
*/
|
|
if (this.features[key]) {
|
|
const feature = this.features[key];
|
|
if (feature.isMounted) {
|
|
feature.update();
|
|
}
|
|
else {
|
|
feature.mount();
|
|
feature.isMounted = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
triggerBuild() {
|
|
this.build(this.renderState, this.latestValues, this.props);
|
|
}
|
|
/**
|
|
* Measure the current viewport box with or without transforms.
|
|
* Only measures axis-aligned boxes, rotate and skew must be manually
|
|
* removed with a re-render to work.
|
|
*/
|
|
measureViewportBox() {
|
|
return this.current
|
|
? this.measureInstanceViewportBox(this.current, this.props)
|
|
: createBox();
|
|
}
|
|
getStaticValue(key) {
|
|
return this.latestValues[key];
|
|
}
|
|
setStaticValue(key, value) {
|
|
this.latestValues[key] = value;
|
|
}
|
|
/**
|
|
* Update the provided props. Ensure any newly-added motion values are
|
|
* added to our map, old ones removed, and listeners updated.
|
|
*/
|
|
update(props, presenceContext) {
|
|
if (props.transformTemplate || this.props.transformTemplate) {
|
|
this.scheduleRender();
|
|
}
|
|
this.prevProps = this.props;
|
|
this.props = props;
|
|
this.prevPresenceContext = this.presenceContext;
|
|
this.presenceContext = presenceContext;
|
|
/**
|
|
* Update prop event handlers ie onAnimationStart, onAnimationComplete
|
|
*/
|
|
for (let i = 0; i < propEventHandlers.length; i++) {
|
|
const key = propEventHandlers[i];
|
|
if (this.propEventSubscriptions[key]) {
|
|
this.propEventSubscriptions[key]();
|
|
delete this.propEventSubscriptions[key];
|
|
}
|
|
const listenerName = ("on" + key);
|
|
const listener = props[listenerName];
|
|
if (listener) {
|
|
this.propEventSubscriptions[key] = this.on(key, listener);
|
|
}
|
|
}
|
|
this.prevMotionValues = updateMotionValuesFromProps(this, this.scrapeMotionValuesFromProps(props, this.prevProps, this), this.prevMotionValues);
|
|
if (this.handleChildMotionValue) {
|
|
this.handleChildMotionValue();
|
|
}
|
|
}
|
|
getProps() {
|
|
return this.props;
|
|
}
|
|
/**
|
|
* Returns the variant definition with a given name.
|
|
*/
|
|
getVariant(name) {
|
|
return this.props.variants ? this.props.variants[name] : undefined;
|
|
}
|
|
/**
|
|
* Returns the defined default transition on this component.
|
|
*/
|
|
getDefaultTransition() {
|
|
return this.props.transition;
|
|
}
|
|
getTransformPagePoint() {
|
|
return this.props.transformPagePoint;
|
|
}
|
|
getClosestVariantNode() {
|
|
return this.isVariantNode
|
|
? this
|
|
: this.parent
|
|
? this.parent.getClosestVariantNode()
|
|
: undefined;
|
|
}
|
|
getVariantContext(startAtParent = false) {
|
|
if (startAtParent) {
|
|
return this.parent ? this.parent.getVariantContext() : undefined;
|
|
}
|
|
if (!this.isControllingVariants) {
|
|
const context = this.parent
|
|
? this.parent.getVariantContext() || {}
|
|
: {};
|
|
if (this.props.initial !== undefined) {
|
|
context.initial = this.props.initial;
|
|
}
|
|
return context;
|
|
}
|
|
const context = {};
|
|
for (let i = 0; i < numVariantProps; i++) {
|
|
const name = variantProps[i];
|
|
const prop = this.props[name];
|
|
if (isVariantLabel(prop) || prop === false) {
|
|
context[name] = prop;
|
|
}
|
|
}
|
|
return context;
|
|
}
|
|
/**
|
|
* Add a child visual element to our set of children.
|
|
*/
|
|
addVariantChild(child) {
|
|
const closestVariantNode = this.getClosestVariantNode();
|
|
if (closestVariantNode) {
|
|
closestVariantNode.variantChildren &&
|
|
closestVariantNode.variantChildren.add(child);
|
|
return () => closestVariantNode.variantChildren.delete(child);
|
|
}
|
|
}
|
|
/**
|
|
* Add a motion value and bind it to this visual element.
|
|
*/
|
|
addValue(key, value) {
|
|
// Remove existing value if it exists
|
|
const existingValue = this.values.get(key);
|
|
if (value !== existingValue) {
|
|
if (existingValue)
|
|
this.removeValue(key);
|
|
this.bindToMotionValue(key, value);
|
|
this.values.set(key, value);
|
|
this.latestValues[key] = value.get();
|
|
}
|
|
}
|
|
/**
|
|
* Remove a motion value and unbind any active subscriptions.
|
|
*/
|
|
removeValue(key) {
|
|
this.values.delete(key);
|
|
const unsubscribe = this.valueSubscriptions.get(key);
|
|
if (unsubscribe) {
|
|
unsubscribe();
|
|
this.valueSubscriptions.delete(key);
|
|
}
|
|
delete this.latestValues[key];
|
|
this.removeValueFromRenderState(key, this.renderState);
|
|
}
|
|
/**
|
|
* Check whether we have a motion value for this key
|
|
*/
|
|
hasValue(key) {
|
|
return this.values.has(key);
|
|
}
|
|
getValue(key, defaultValue) {
|
|
if (this.props.values && this.props.values[key]) {
|
|
return this.props.values[key];
|
|
}
|
|
let value = this.values.get(key);
|
|
if (value === undefined && defaultValue !== undefined) {
|
|
value = motionValue(defaultValue === null ? undefined : defaultValue, { owner: this });
|
|
this.addValue(key, value);
|
|
}
|
|
return value;
|
|
}
|
|
/**
|
|
* If we're trying to animate to a previously unencountered value,
|
|
* we need to check for it in our state and as a last resort read it
|
|
* directly from the instance (which might have performance implications).
|
|
*/
|
|
readValue(key, target) {
|
|
var _a;
|
|
let value = this.latestValues[key] !== undefined || !this.current
|
|
? this.latestValues[key]
|
|
: (_a = this.getBaseTargetFromProps(this.props, key)) !== null && _a !== void 0 ? _a : this.readValueFromInstance(this.current, key, this.options);
|
|
if (value !== undefined && value !== null) {
|
|
if (typeof value === "string" &&
|
|
(isNumericalString(value) || isZeroValueString(value))) {
|
|
// If this is a number read as a string, ie "0" or "200", convert it to a number
|
|
value = parseFloat(value);
|
|
}
|
|
else if (!findValueType(value) && complex.test(target)) {
|
|
value = animatable_none_getAnimatableNone(key, target);
|
|
}
|
|
this.setBaseTarget(key, isMotionValue(value) ? value.get() : value);
|
|
}
|
|
return isMotionValue(value) ? value.get() : value;
|
|
}
|
|
/**
|
|
* Set the base target to later animate back to. This is currently
|
|
* only hydrated on creation and when we first read a value.
|
|
*/
|
|
setBaseTarget(key, value) {
|
|
this.baseTarget[key] = value;
|
|
}
|
|
/**
|
|
* Find the base target for a value thats been removed from all animation
|
|
* props.
|
|
*/
|
|
getBaseTarget(key) {
|
|
var _a;
|
|
const { initial } = this.props;
|
|
let valueFromInitial;
|
|
if (typeof initial === "string" || typeof initial === "object") {
|
|
const variant = resolveVariantFromProps(this.props, initial, (_a = this.presenceContext) === null || _a === void 0 ? void 0 : _a.custom);
|
|
if (variant) {
|
|
valueFromInitial = variant[key];
|
|
}
|
|
}
|
|
/**
|
|
* If this value still exists in the current initial variant, read that.
|
|
*/
|
|
if (initial && valueFromInitial !== undefined) {
|
|
return valueFromInitial;
|
|
}
|
|
/**
|
|
* Alternatively, if this VisualElement config has defined a getBaseTarget
|
|
* so we can read the value from an alternative source, try that.
|
|
*/
|
|
const target = this.getBaseTargetFromProps(this.props, key);
|
|
if (target !== undefined && !isMotionValue(target))
|
|
return target;
|
|
/**
|
|
* If the value was initially defined on initial, but it doesn't any more,
|
|
* return undefined. Otherwise return the value as initially read from the DOM.
|
|
*/
|
|
return this.initialValues[key] !== undefined &&
|
|
valueFromInitial === undefined
|
|
? undefined
|
|
: this.baseTarget[key];
|
|
}
|
|
on(eventName, callback) {
|
|
if (!this.events[eventName]) {
|
|
this.events[eventName] = new SubscriptionManager();
|
|
}
|
|
return this.events[eventName].add(callback);
|
|
}
|
|
notify(eventName, ...args) {
|
|
if (this.events[eventName]) {
|
|
this.events[eventName].notify(...args);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/dom/DOMVisualElement.mjs
|
|
|
|
|
|
|
|
class DOMVisualElement extends VisualElement {
|
|
constructor() {
|
|
super(...arguments);
|
|
this.KeyframeResolver = DOMKeyframesResolver;
|
|
}
|
|
sortInstanceNodePosition(a, b) {
|
|
/**
|
|
* compareDocumentPosition returns a bitmask, by using the bitwise &
|
|
* we're returning true if 2 in that bitmask is set to true. 2 is set
|
|
* to true if b preceeds a.
|
|
*/
|
|
return a.compareDocumentPosition(b) & 2 ? 1 : -1;
|
|
}
|
|
getBaseTargetFromProps(props, key) {
|
|
return props.style
|
|
? props.style[key]
|
|
: undefined;
|
|
}
|
|
removeValueFromRenderState(key, { vars, style }) {
|
|
delete vars[key];
|
|
delete style[key];
|
|
}
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/html/HTMLVisualElement.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getComputedStyle(element) {
|
|
return window.getComputedStyle(element);
|
|
}
|
|
class HTMLVisualElement extends DOMVisualElement {
|
|
constructor() {
|
|
super(...arguments);
|
|
this.type = "html";
|
|
this.applyWillChange = true;
|
|
this.renderInstance = renderHTML;
|
|
}
|
|
readValueFromInstance(instance, key) {
|
|
if (transformProps.has(key)) {
|
|
const defaultType = getDefaultValueType(key);
|
|
return defaultType ? defaultType.default || 0 : 0;
|
|
}
|
|
else {
|
|
const computedStyle = getComputedStyle(instance);
|
|
const value = (isCSSVariableName(key)
|
|
? computedStyle.getPropertyValue(key)
|
|
: computedStyle[key]) || 0;
|
|
return typeof value === "string" ? value.trim() : value;
|
|
}
|
|
}
|
|
measureInstanceViewportBox(instance, { transformPagePoint }) {
|
|
return measureViewportBox(instance, transformPagePoint);
|
|
}
|
|
build(renderState, latestValues, props) {
|
|
buildHTMLStyles(renderState, latestValues, props.transformTemplate);
|
|
}
|
|
scrapeMotionValuesFromProps(props, prevProps, visualElement) {
|
|
return scrapeMotionValuesFromProps(props, prevProps, visualElement);
|
|
}
|
|
handleChildMotionValue() {
|
|
if (this.childSubscription) {
|
|
this.childSubscription();
|
|
delete this.childSubscription;
|
|
}
|
|
const { children } = this.props;
|
|
if (isMotionValue(children)) {
|
|
this.childSubscription = children.on("change", (latest) => {
|
|
if (this.current)
|
|
this.current.textContent = `${latest}`;
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/svg/SVGVisualElement.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SVGVisualElement extends DOMVisualElement {
|
|
constructor() {
|
|
super(...arguments);
|
|
this.type = "svg";
|
|
this.isSVGTag = false;
|
|
this.measureInstanceViewportBox = createBox;
|
|
}
|
|
getBaseTargetFromProps(props, key) {
|
|
return props[key];
|
|
}
|
|
readValueFromInstance(instance, key) {
|
|
if (transformProps.has(key)) {
|
|
const defaultType = getDefaultValueType(key);
|
|
return defaultType ? defaultType.default || 0 : 0;
|
|
}
|
|
key = !camelCaseAttributes.has(key) ? camelToDash(key) : key;
|
|
return instance.getAttribute(key);
|
|
}
|
|
scrapeMotionValuesFromProps(props, prevProps, visualElement) {
|
|
return scrape_motion_values_scrapeMotionValuesFromProps(props, prevProps, visualElement);
|
|
}
|
|
build(renderState, latestValues, props) {
|
|
buildSVGAttrs(renderState, latestValues, this.isSVGTag, props.transformTemplate);
|
|
}
|
|
renderInstance(instance, renderState, styleProp, projection) {
|
|
renderSVG(instance, renderState, styleProp, projection);
|
|
}
|
|
mount(instance) {
|
|
this.isSVGTag = isSVGTag(instance.tagName);
|
|
super.mount(instance);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/dom/create-visual-element.mjs
|
|
|
|
|
|
|
|
|
|
|
|
const create_visual_element_createDomVisualElement = (Component, options) => {
|
|
return isSVGComponent(Component)
|
|
? new SVGVisualElement(options)
|
|
: new HTMLVisualElement(options, {
|
|
allowProjection: Component !== react.Fragment,
|
|
});
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/motion/features/layout.mjs
|
|
|
|
|
|
|
|
const layout = {
|
|
layout: {
|
|
ProjectionNode: HTMLProjectionNode,
|
|
MeasureLayout: MeasureLayout,
|
|
},
|
|
};
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/render/dom/motion.mjs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const preloadedFeatures = {
|
|
...animations,
|
|
...gestureAnimations,
|
|
...drag,
|
|
...layout,
|
|
};
|
|
/**
|
|
* HTML & SVG components, optimised for use with gestures and animation. These can be used as
|
|
* drop-in replacements for any HTML & SVG component, all CSS & SVG properties are supported.
|
|
*
|
|
* @public
|
|
*/
|
|
const motion = /*@__PURE__*/ createMotionProxy((Component, config) => create_config_createDomMotionConfig(Component, config, preloadedFeatures, create_visual_element_createDomVisualElement));
|
|
/**
|
|
* Create a DOM `motion` component with the provided string. This is primarily intended
|
|
* as a full alternative to `motion` for consumers who have to support environments that don't
|
|
* support `Proxy`.
|
|
*
|
|
* ```javascript
|
|
* import { createDomMotionComponent } from "framer-motion"
|
|
*
|
|
* const motion = {
|
|
* div: createDomMotionComponent('div')
|
|
* }
|
|
* ```
|
|
*
|
|
* @public
|
|
*/
|
|
function createDomMotionComponent(key) {
|
|
return createMotionComponent(createDomMotionConfig(key, { forwardMotionProps: false }, preloadedFeatures, createDomVisualElement));
|
|
}
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/GlobalConfig.mjs":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ W: () => (/* binding */ MotionGlobalConfig)
|
|
/* harmony export */ });
|
|
const MotionGlobalConfig = {
|
|
skipAnimations: false,
|
|
useManualTiming: false,
|
|
};
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/is-browser.mjs":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ B: () => (/* binding */ isBrowser)
|
|
/* harmony export */ });
|
|
const isBrowser = typeof window !== "undefined";
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/noop.mjs":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ l: () => (/* binding */ noop)
|
|
/* harmony export */ });
|
|
const noop = (any) => any;
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/use-isomorphic-effect.mjs":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ E: () => (/* binding */ useIsomorphicLayoutEffect)
|
|
/* harmony export */ });
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");
|
|
/* harmony import */ var _is_browser_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/framer-motion@11.3.30_@emotion+is-prop-valid@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/framer-motion/dist/es/utils/is-browser.mjs");
|
|
|
|
|
|
|
|
const useIsomorphicLayoutEffect = _is_browser_mjs__WEBPACK_IMPORTED_MODULE_1__/* .isBrowser */ .B ? react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect : react__WEBPACK_IMPORTED_MODULE_0__.useEffect;
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/hoist-non-react-statics@3.3.2/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js":
|
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
|
|
|
|
|
|
var reactIs = __webpack_require__("../../node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js");
|
|
|
|
/**
|
|
* Copyright 2015, Yahoo! Inc.
|
|
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
|
*/
|
|
var REACT_STATICS = {
|
|
childContextTypes: true,
|
|
contextType: true,
|
|
contextTypes: true,
|
|
defaultProps: true,
|
|
displayName: true,
|
|
getDefaultProps: true,
|
|
getDerivedStateFromError: true,
|
|
getDerivedStateFromProps: true,
|
|
mixins: true,
|
|
propTypes: true,
|
|
type: true
|
|
};
|
|
var KNOWN_STATICS = {
|
|
name: true,
|
|
length: true,
|
|
prototype: true,
|
|
caller: true,
|
|
callee: true,
|
|
arguments: true,
|
|
arity: true
|
|
};
|
|
var FORWARD_REF_STATICS = {
|
|
'$$typeof': true,
|
|
render: true,
|
|
defaultProps: true,
|
|
displayName: true,
|
|
propTypes: true
|
|
};
|
|
var MEMO_STATICS = {
|
|
'$$typeof': true,
|
|
compare: true,
|
|
defaultProps: true,
|
|
displayName: true,
|
|
propTypes: true,
|
|
type: true
|
|
};
|
|
var TYPE_STATICS = {};
|
|
TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
|
|
TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
|
|
|
|
function getStatics(component) {
|
|
// React v16.11 and below
|
|
if (reactIs.isMemo(component)) {
|
|
return MEMO_STATICS;
|
|
} // React v16.12 and above
|
|
|
|
|
|
return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
|
|
}
|
|
|
|
var defineProperty = Object.defineProperty;
|
|
var getOwnPropertyNames = Object.getOwnPropertyNames;
|
|
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
var getPrototypeOf = Object.getPrototypeOf;
|
|
var objectPrototype = Object.prototype;
|
|
function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
|
|
if (typeof sourceComponent !== 'string') {
|
|
// don't hoist over string (html) components
|
|
if (objectPrototype) {
|
|
var inheritedComponent = getPrototypeOf(sourceComponent);
|
|
|
|
if (inheritedComponent && inheritedComponent !== objectPrototype) {
|
|
hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
|
|
}
|
|
}
|
|
|
|
var keys = getOwnPropertyNames(sourceComponent);
|
|
|
|
if (getOwnPropertySymbols) {
|
|
keys = keys.concat(getOwnPropertySymbols(sourceComponent));
|
|
}
|
|
|
|
var targetStatics = getStatics(targetComponent);
|
|
var sourceStatics = getStatics(sourceComponent);
|
|
|
|
for (var i = 0; i < keys.length; ++i) {
|
|
var key = keys[i];
|
|
|
|
if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
|
|
var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
|
|
|
|
try {
|
|
// Avoid failures from read-only properties
|
|
defineProperty(targetComponent, key, descriptor);
|
|
} catch (e) {}
|
|
}
|
|
}
|
|
}
|
|
|
|
return targetComponent;
|
|
}
|
|
|
|
module.exports = hoistNonReactStatics;
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/memize@2.1.0/node_modules/memize/dist/index.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ A: () => (/* binding */ memize)
|
|
/* harmony export */ });
|
|
/**
|
|
* Memize options object.
|
|
*
|
|
* @typedef MemizeOptions
|
|
*
|
|
* @property {number} [maxSize] Maximum size of the cache.
|
|
*/
|
|
|
|
/**
|
|
* Internal cache entry.
|
|
*
|
|
* @typedef MemizeCacheNode
|
|
*
|
|
* @property {?MemizeCacheNode|undefined} [prev] Previous node.
|
|
* @property {?MemizeCacheNode|undefined} [next] Next node.
|
|
* @property {Array<*>} args Function arguments for cache
|
|
* entry.
|
|
* @property {*} val Function result.
|
|
*/
|
|
|
|
/**
|
|
* Properties of the enhanced function for controlling cache.
|
|
*
|
|
* @typedef MemizeMemoizedFunction
|
|
*
|
|
* @property {()=>void} clear Clear the cache.
|
|
*/
|
|
|
|
/**
|
|
* Accepts a function to be memoized, and returns a new memoized function, with
|
|
* optional options.
|
|
*
|
|
* @template {(...args: any[]) => any} F
|
|
*
|
|
* @param {F} fn Function to memoize.
|
|
* @param {MemizeOptions} [options] Options object.
|
|
*
|
|
* @return {((...args: Parameters<F>) => ReturnType<F>) & MemizeMemoizedFunction} Memoized function.
|
|
*/
|
|
function memize(fn, options) {
|
|
var size = 0;
|
|
|
|
/** @type {?MemizeCacheNode|undefined} */
|
|
var head;
|
|
|
|
/** @type {?MemizeCacheNode|undefined} */
|
|
var tail;
|
|
|
|
options = options || {};
|
|
|
|
function memoized(/* ...args */) {
|
|
var node = head,
|
|
len = arguments.length,
|
|
args,
|
|
i;
|
|
|
|
searchCache: while (node) {
|
|
// Perform a shallow equality test to confirm that whether the node
|
|
// under test is a candidate for the arguments passed. Two arrays
|
|
// are shallowly equal if their length matches and each entry is
|
|
// strictly equal between the two sets. Avoid abstracting to a
|
|
// function which could incur an arguments leaking deoptimization.
|
|
|
|
// Check whether node arguments match arguments length
|
|
if (node.args.length !== arguments.length) {
|
|
node = node.next;
|
|
continue;
|
|
}
|
|
|
|
// Check whether node arguments match arguments values
|
|
for (i = 0; i < len; i++) {
|
|
if (node.args[i] !== arguments[i]) {
|
|
node = node.next;
|
|
continue searchCache;
|
|
}
|
|
}
|
|
|
|
// At this point we can assume we've found a match
|
|
|
|
// Surface matched node to head if not already
|
|
if (node !== head) {
|
|
// As tail, shift to previous. Must only shift if not also
|
|
// head, since if both head and tail, there is no previous.
|
|
if (node === tail) {
|
|
tail = node.prev;
|
|
}
|
|
|
|
// Adjust siblings to point to each other. If node was tail,
|
|
// this also handles new tail's empty `next` assignment.
|
|
/** @type {MemizeCacheNode} */ (node.prev).next = node.next;
|
|
if (node.next) {
|
|
node.next.prev = node.prev;
|
|
}
|
|
|
|
node.next = head;
|
|
node.prev = null;
|
|
/** @type {MemizeCacheNode} */ (head).prev = node;
|
|
head = node;
|
|
}
|
|
|
|
// Return immediately
|
|
return node.val;
|
|
}
|
|
|
|
// No cached value found. Continue to insertion phase:
|
|
|
|
// Create a copy of arguments (avoid leaking deoptimization)
|
|
args = new Array(len);
|
|
for (i = 0; i < len; i++) {
|
|
args[i] = arguments[i];
|
|
}
|
|
|
|
node = {
|
|
args: args,
|
|
|
|
// Generate the result from original function
|
|
val: fn.apply(null, args),
|
|
};
|
|
|
|
// Don't need to check whether node is already head, since it would
|
|
// have been returned above already if it was
|
|
|
|
// Shift existing head down list
|
|
if (head) {
|
|
head.prev = node;
|
|
node.next = head;
|
|
} else {
|
|
// If no head, follows that there's no tail (at initial or reset)
|
|
tail = node;
|
|
}
|
|
|
|
// Trim tail if we're reached max size and are pending cache insertion
|
|
if (size === /** @type {MemizeOptions} */ (options).maxSize) {
|
|
tail = /** @type {MemizeCacheNode} */ (tail).prev;
|
|
/** @type {MemizeCacheNode} */ (tail).next = null;
|
|
} else {
|
|
size++;
|
|
}
|
|
|
|
head = node;
|
|
|
|
return node.val;
|
|
}
|
|
|
|
memoized.clear = function () {
|
|
head = null;
|
|
tail = null;
|
|
size = 0;
|
|
};
|
|
|
|
// Ignore reason: There's not a clear solution to create an intersection of
|
|
// the function with additional properties, where the goal is to retain the
|
|
// function signature of the incoming argument and add control properties
|
|
// on the return value.
|
|
|
|
// @ts-ignore
|
|
return memoized;
|
|
}
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/no-case@3.0.4/node_modules/no-case/dist.es2015/index.js":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
W: () => (/* binding */ noCase)
|
|
});
|
|
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/lower-case@2.0.2/node_modules/lower-case/dist.es2015/index.js
|
|
/**
|
|
* Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
|
|
*/
|
|
var SUPPORTED_LOCALE = {
|
|
tr: {
|
|
regexp: /\u0130|\u0049|\u0049\u0307/g,
|
|
map: {
|
|
İ: "\u0069",
|
|
I: "\u0131",
|
|
İ: "\u0069",
|
|
},
|
|
},
|
|
az: {
|
|
regexp: /\u0130/g,
|
|
map: {
|
|
İ: "\u0069",
|
|
I: "\u0131",
|
|
İ: "\u0069",
|
|
},
|
|
},
|
|
lt: {
|
|
regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g,
|
|
map: {
|
|
I: "\u0069\u0307",
|
|
J: "\u006A\u0307",
|
|
Į: "\u012F\u0307",
|
|
Ì: "\u0069\u0307\u0300",
|
|
Í: "\u0069\u0307\u0301",
|
|
Ĩ: "\u0069\u0307\u0303",
|
|
},
|
|
},
|
|
};
|
|
/**
|
|
* Localized lower case.
|
|
*/
|
|
function localeLowerCase(str, locale) {
|
|
var lang = SUPPORTED_LOCALE[locale.toLowerCase()];
|
|
if (lang)
|
|
return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; }));
|
|
return lowerCase(str);
|
|
}
|
|
/**
|
|
* Lower case as a function.
|
|
*/
|
|
function lowerCase(str) {
|
|
return str.toLowerCase();
|
|
}
|
|
//# sourceMappingURL=index.js.map
|
|
;// CONCATENATED MODULE: ../../node_modules/.pnpm/no-case@3.0.4/node_modules/no-case/dist.es2015/index.js
|
|
|
|
// Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case").
|
|
var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
|
|
// Remove all non-word characters.
|
|
var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
|
|
/**
|
|
* Normalize the string into something other libraries can manipulate easier.
|
|
*/
|
|
function noCase(input, options) {
|
|
if (options === void 0) { options = {}; }
|
|
var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d;
|
|
var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
|
|
var start = 0;
|
|
var end = result.length;
|
|
// Trim the delimiter from around the output string.
|
|
while (result.charAt(start) === "\0")
|
|
start++;
|
|
while (result.charAt(end - 1) === "\0")
|
|
end--;
|
|
// Transform each token independently.
|
|
return result.slice(start, end).split("\0").map(transform).join(delimiter);
|
|
}
|
|
/**
|
|
* Replace `re` in the input string with the replacement value.
|
|
*/
|
|
function replace(input, re, value) {
|
|
if (re instanceof RegExp)
|
|
return input.replace(re, value);
|
|
return re.reduce(function (input, re) { return input.replace(re, value); }, input);
|
|
}
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/object-assign@4.1.1/node_modules/object-assign/index.js":
|
|
/***/ ((module) => {
|
|
|
|
/*
|
|
object-assign
|
|
(c) Sindre Sorhus
|
|
@license MIT
|
|
*/
|
|
|
|
|
|
/* eslint-disable no-unused-vars */
|
|
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
|
|
function toObject(val) {
|
|
if (val === null || val === undefined) {
|
|
throw new TypeError('Object.assign cannot be called with null or undefined');
|
|
}
|
|
|
|
return Object(val);
|
|
}
|
|
|
|
function shouldUseNative() {
|
|
try {
|
|
if (!Object.assign) {
|
|
return false;
|
|
}
|
|
|
|
// Detect buggy property enumeration order in older V8 versions.
|
|
|
|
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
|
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
|
test1[5] = 'de';
|
|
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
|
return false;
|
|
}
|
|
|
|
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
var test2 = {};
|
|
for (var i = 0; i < 10; i++) {
|
|
test2['_' + String.fromCharCode(i)] = i;
|
|
}
|
|
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
|
return test2[n];
|
|
});
|
|
if (order2.join('') !== '0123456789') {
|
|
return false;
|
|
}
|
|
|
|
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
var test3 = {};
|
|
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
|
test3[letter] = letter;
|
|
});
|
|
if (Object.keys(Object.assign({}, test3)).join('') !==
|
|
'abcdefghijklmnopqrst') {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
} catch (err) {
|
|
// We don't expect any of the above to throw, but better to be safe.
|
|
return false;
|
|
}
|
|
}
|
|
|
|
module.exports = shouldUseNative() ? Object.assign : function (target, source) {
|
|
var from;
|
|
var to = toObject(target);
|
|
var symbols;
|
|
|
|
for (var s = 1; s < arguments.length; s++) {
|
|
from = Object(arguments[s]);
|
|
|
|
for (var key in from) {
|
|
if (hasOwnProperty.call(from, key)) {
|
|
to[key] = from[key];
|
|
}
|
|
}
|
|
|
|
if (getOwnPropertySymbols) {
|
|
symbols = getOwnPropertySymbols(from);
|
|
for (var i = 0; i < symbols.length; i++) {
|
|
if (propIsEnumerable.call(from, symbols[i])) {
|
|
to[symbols[i]] = from[symbols[i]];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return to;
|
|
};
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.production.min.js":
|
|
/***/ ((__unused_webpack_module, exports) => {
|
|
|
|
/** @license React v16.13.1
|
|
* react-is.production.min.js
|
|
*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
|
|
Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
|
|
function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;
|
|
exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t};
|
|
exports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p};
|
|
exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z;
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js":
|
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
|
|
|
|
|
|
if (true) {
|
|
module.exports = __webpack_require__("../../node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.production.min.js");
|
|
} else {}
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/react@17.0.2/node_modules/react/cjs/react-jsx-runtime.production.min.js":
|
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
|
|
/** @license React v17.0.2
|
|
* react-jsx-runtime.production.min.js
|
|
*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
__webpack_require__("../../node_modules/.pnpm/object-assign@4.1.1/node_modules/object-assign/index.js");var f=__webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js"),g=60103;exports.Fragment=60107;if("function"===typeof Symbol&&Symbol.for){var h=Symbol.for;g=h("react.element");exports.Fragment=h("react.fragment")}var m=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n=Object.prototype.hasOwnProperty,p={key:!0,ref:!0,__self:!0,__source:!0};
|
|
function q(c,a,k){var b,d={},e=null,l=null;void 0!==k&&(e=""+k);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(l=a.ref);for(b in a)n.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:g,type:c,key:e,ref:l,props:d,_owner:m.current}}exports.jsx=q;exports.jsxs=q;
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js":
|
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
|
|
|
|
|
|
if (true) {
|
|
module.exports = __webpack_require__("../../node_modules/.pnpm/react@17.0.2/node_modules/react/cjs/react-jsx-runtime.production.min.js");
|
|
} else {}
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/tslib@2.6.3/node_modules/tslib/tslib.es6.mjs":
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ Cl: () => (/* binding */ __assign),
|
|
/* harmony export */ Tt: () => (/* binding */ __rest)
|
|
/* harmony export */ });
|
|
/* unused harmony exports __extends, __decorate, __param, __esDecorate, __runInitializers, __propKey, __setFunctionName, __metadata, __awaiter, __generator, __createBinding, __exportStar, __values, __read, __spread, __spreadArrays, __spreadArray, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet, __classPrivateFieldIn, __addDisposableResource, __disposeResources */
|
|
/******************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */
|
|
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
|
|
var extendStatics = function(d, b) {
|
|
extendStatics = Object.setPrototypeOf ||
|
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
return extendStatics(d, b);
|
|
};
|
|
|
|
function __extends(d, b) {
|
|
if (typeof b !== "function" && b !== null)
|
|
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
extendStatics(d, b);
|
|
function __() { this.constructor = d; }
|
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
}
|
|
|
|
var __assign = function() {
|
|
__assign = Object.assign || function __assign(t) {
|
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
s = arguments[i];
|
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
}
|
|
return t;
|
|
}
|
|
return __assign.apply(this, arguments);
|
|
}
|
|
|
|
function __rest(s, e) {
|
|
var t = {};
|
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
t[p] = s[p];
|
|
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
t[p[i]] = s[p[i]];
|
|
}
|
|
return t;
|
|
}
|
|
|
|
function __decorate(decorators, target, key, desc) {
|
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
}
|
|
|
|
function __param(paramIndex, decorator) {
|
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
}
|
|
|
|
function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
var _, done = false;
|
|
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
var context = {};
|
|
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
if (kind === "accessor") {
|
|
if (result === void 0) continue;
|
|
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
if (_ = accept(result.get)) descriptor.get = _;
|
|
if (_ = accept(result.set)) descriptor.set = _;
|
|
if (_ = accept(result.init)) initializers.unshift(_);
|
|
}
|
|
else if (_ = accept(result)) {
|
|
if (kind === "field") initializers.unshift(_);
|
|
else descriptor[key] = _;
|
|
}
|
|
}
|
|
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
done = true;
|
|
};
|
|
|
|
function __runInitializers(thisArg, initializers, value) {
|
|
var useValue = arguments.length > 2;
|
|
for (var i = 0; i < initializers.length; i++) {
|
|
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
}
|
|
return useValue ? value : void 0;
|
|
};
|
|
|
|
function __propKey(x) {
|
|
return typeof x === "symbol" ? x : "".concat(x);
|
|
};
|
|
|
|
function __setFunctionName(f, name, prefix) {
|
|
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
};
|
|
|
|
function __metadata(metadataKey, metadataValue) {
|
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
}
|
|
|
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
});
|
|
}
|
|
|
|
function __generator(thisArg, body) {
|
|
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
function step(op) {
|
|
if (f) throw new TypeError("Generator is already executing.");
|
|
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
switch (op[0]) {
|
|
case 0: case 1: t = op; break;
|
|
case 4: _.label++; return { value: op[1], done: false };
|
|
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
default:
|
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
if (t[2]) _.ops.pop();
|
|
_.trys.pop(); continue;
|
|
}
|
|
op = body.call(thisArg, _);
|
|
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
}
|
|
}
|
|
|
|
var __createBinding = Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
}
|
|
Object.defineProperty(o, k2, desc);
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
});
|
|
|
|
function __exportStar(m, o) {
|
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
|
|
}
|
|
|
|
function __values(o) {
|
|
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
if (m) return m.call(o);
|
|
if (o && typeof o.length === "number") return {
|
|
next: function () {
|
|
if (o && i >= o.length) o = void 0;
|
|
return { value: o && o[i++], done: !o };
|
|
}
|
|
};
|
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
}
|
|
|
|
function __read(o, n) {
|
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
if (!m) return o;
|
|
var i = m.call(o), r, ar = [], e;
|
|
try {
|
|
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
}
|
|
catch (error) { e = { error: error }; }
|
|
finally {
|
|
try {
|
|
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
}
|
|
finally { if (e) throw e.error; }
|
|
}
|
|
return ar;
|
|
}
|
|
|
|
/** @deprecated */
|
|
function __spread() {
|
|
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
ar = ar.concat(__read(arguments[i]));
|
|
return ar;
|
|
}
|
|
|
|
/** @deprecated */
|
|
function __spreadArrays() {
|
|
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
r[k] = a[j];
|
|
return r;
|
|
}
|
|
|
|
function __spreadArray(to, from, pack) {
|
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
if (ar || !(i in from)) {
|
|
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
ar[i] = from[i];
|
|
}
|
|
}
|
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
}
|
|
|
|
function __await(v) {
|
|
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
}
|
|
|
|
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
return i = {}, verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
|
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
|
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
function fulfill(value) { resume("next", value); }
|
|
function reject(value) { resume("throw", value); }
|
|
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
}
|
|
|
|
function __asyncDelegator(o) {
|
|
var i, p;
|
|
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
|
|
}
|
|
|
|
function __asyncValues(o) {
|
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
var m = o[Symbol.asyncIterator], i;
|
|
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
}
|
|
|
|
function __makeTemplateObject(cooked, raw) {
|
|
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
return cooked;
|
|
};
|
|
|
|
var __setModuleDefault = Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
};
|
|
|
|
function __importStar(mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
}
|
|
|
|
function __importDefault(mod) {
|
|
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
}
|
|
|
|
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
}
|
|
|
|
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
}
|
|
|
|
function __classPrivateFieldIn(state, receiver) {
|
|
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
|
|
return typeof state === "function" ? receiver === state : state.has(receiver);
|
|
}
|
|
|
|
function __addDisposableResource(env, value, async) {
|
|
if (value !== null && value !== void 0) {
|
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
var dispose, inner;
|
|
if (async) {
|
|
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
dispose = value[Symbol.asyncDispose];
|
|
}
|
|
if (dispose === void 0) {
|
|
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
dispose = value[Symbol.dispose];
|
|
if (async) inner = dispose;
|
|
}
|
|
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
}
|
|
else if (async) {
|
|
env.stack.push({ async: true });
|
|
}
|
|
return value;
|
|
}
|
|
|
|
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
var e = new Error(message);
|
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
};
|
|
|
|
function __disposeResources(env) {
|
|
function fail(e) {
|
|
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
env.hasError = true;
|
|
}
|
|
function next() {
|
|
while (env.stack.length) {
|
|
var rec = env.stack.pop();
|
|
try {
|
|
var result = rec.dispose && rec.dispose.call(rec.value);
|
|
if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
}
|
|
catch (e) {
|
|
fail(e);
|
|
}
|
|
}
|
|
if (env.hasError) throw env.error;
|
|
}
|
|
return next();
|
|
}
|
|
|
|
/* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = ({
|
|
__extends,
|
|
__assign,
|
|
__rest,
|
|
__decorate,
|
|
__param,
|
|
__metadata,
|
|
__awaiter,
|
|
__generator,
|
|
__createBinding,
|
|
__exportStar,
|
|
__values,
|
|
__read,
|
|
__spread,
|
|
__spreadArrays,
|
|
__spreadArray,
|
|
__await,
|
|
__asyncGenerator,
|
|
__asyncDelegator,
|
|
__asyncValues,
|
|
__makeTemplateObject,
|
|
__importStar,
|
|
__importDefault,
|
|
__classPrivateFieldGet,
|
|
__classPrivateFieldSet,
|
|
__classPrivateFieldIn,
|
|
__addDisposableResource,
|
|
__disposeResources,
|
|
});
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@17.0.2/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js":
|
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
|
|
/**
|
|
* @license React
|
|
* use-sync-external-store-shim.production.min.js
|
|
*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
var e=__webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js");function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k="function"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c})},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c})})},[a]);p(d);return d}
|
|
function r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f){return!0}}function t(a,b){return b()}var u="undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement?t:q;exports.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:u;
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@17.0.2/node_modules/use-sync-external-store/shim/index.js":
|
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
|
|
|
|
|
|
if (true) {
|
|
module.exports = __webpack_require__("../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@17.0.2/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js");
|
|
} else {}
|
|
|
|
|
|
/***/ })
|
|
|
|
}]); |