@eightshift/ui-components 8.1.0 → 8.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Autocomplete-BUU44AuW.js → Autocomplete-Dqkum3dO.js} +29 -25
- package/dist/{Button-_E2Z5G2l.js → Button-DHgs_rCq.js} +15 -9
- package/dist/{Dialog-3XLIaepk.js → Dialog-CldDJ_4u.js} +390 -189
- package/dist/{Disclosure-Dh0z_DEQ.js → Disclosure-BHNgL5Is.js} +33 -29
- package/dist/{FocusScope-BKGWN6UK.js → FocusScope-CUuL5wjz.js} +13 -8
- package/dist/{Heading-BWTs9ckA.js → Heading-BQje2nS2.js} +1 -1
- package/dist/{I18nProvider-BskRMK8G.js → I18nProvider-R_4IDnf9.js} +1 -1
- package/dist/{Label-UpU4cKPh.js → Label-C4bJkVti.js} +1 -1
- package/dist/{ListBox-DepY-52g.js → ListBox-CZXso3mJ.js} +14 -38
- package/dist/{NumberFormatter-WKBRKiEA.js → NumberFormatter-Bwdv413k.js} +4 -2
- package/dist/{RadioGroup-Br9Mn9QJ.js → RadioGroup-BTByPMrl.js} +35 -35
- package/dist/{SearchField-q2Fj0L9K.js → SearchField-DkX1vqMN.js} +29 -26
- package/dist/{Slider-B8icnyOo.js → Slider-Dw-JjfLx.js} +55 -44
- package/dist/{Text-D4y19vs8.js → Text-CA2_mHEB.js} +4 -3
- package/dist/{VisuallyHidden-B_LZ_kn7.js → VisuallyHidden-ZZwHZDro.js} +2 -2
- package/dist/{animation-DpSgtWyu.js → animation-COc9P6ap.js} +2 -4
- package/dist/assets/{image-analysis-worker-BuHru-CI.js → image-analysis-worker-CBOB71mx.js} +1 -1
- package/dist/assets/style-admin.css +1 -1
- package/dist/assets/style-editor.css +1 -1
- package/dist/assets/style.css +1 -1
- package/dist/assets/wp-overrides/make-block-messages-nicer.css +1 -1
- package/dist/{build-module-DG6ZK7Ty.js → build-module-BISCoQjQ.js} +4 -4
- package/dist/{button-XSk_8UW7.js → button-ldR_tlvk.js} +64 -13
- package/dist/{checkbox-BYaS9tQ5.js → checkbox-DDyLJRY8.js} +8 -8
- package/dist/{color-swatch-6ZEIXej3.js → color-swatch-DmhdOhe4.js} +15 -16
- package/dist/components/animated-visibility/animated-visibility.js +5 -3
- package/dist/components/base-control/base-control.d.ts +1 -1
- package/dist/components/base-control/base-control.js +1 -1
- package/dist/components/base-control/container.d.ts +4 -30
- package/dist/components/base-control/container.js +5 -32
- package/dist/components/breakpoint-preview/breakpoint-preview.js +1 -1
- package/dist/components/button/button.d.ts +1 -1
- package/dist/components/button/button.js +1 -1
- package/dist/components/checkbox/checkbox.js +1 -1
- package/dist/components/color-pickers/color-picker.js +8 -8
- package/dist/components/color-pickers/color-swatch.js +1 -1
- package/dist/components/color-pickers/gradient-editor.js +1 -1
- package/dist/components/color-pickers/solid-color-picker.js +1 -1
- package/dist/components/component-toggle/component-toggle.d.ts +1 -1
- package/dist/components/component-toggle/component-toggle.js +4 -4
- package/dist/components/container-panel/container-panel.js +11 -11
- package/dist/components/contextual-help/contextual-help.js +3 -3
- package/dist/components/draggable/draggable.d.ts +3 -3
- package/dist/components/draggable/draggable.js +1 -1
- package/dist/components/draggable-list/draggable-list.d.ts +3 -3
- package/dist/components/draggable-list/draggable-list.js +9 -9
- package/dist/components/expandable/expandable.js +4 -4
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +18 -17
- package/dist/components/input-field/input-field.d.ts +1 -1
- package/dist/components/input-field/input-field.js +1 -1
- package/dist/components/item-collection/item-collection.d.ts +3 -28
- package/dist/components/item-collection/item-collection.js +7 -7
- package/dist/components/link-input/link-input.d.ts +0 -2
- package/dist/components/link-input/link-input.js +1 -1
- package/dist/components/matrix-align/matrix-align.js +5 -4
- package/dist/components/menu/menu.d.ts +8 -29
- package/dist/components/menu/menu.js +11 -8
- package/dist/components/modal/modal.js +1 -1
- package/dist/components/notice/notice.js +8 -8
- package/dist/components/number-picker/number-picker.d.ts +1 -1
- package/dist/components/number-picker/number-picker.js +1 -1
- package/dist/components/option-select/option-select.d.ts +1 -1
- package/dist/components/option-select/option-select.js +22 -16
- package/dist/components/options-panel/options-panel.js +4 -4
- package/dist/components/placeholders/file-picker-shell.js +4 -3
- package/dist/components/placeholders/file-placeholder.js +3 -2
- package/dist/components/popover/popover.js +5 -5
- package/dist/components/portal-provider/portal-provider.js +2 -1
- package/dist/components/prompt-popover/prompt-popover.d.ts +56 -0
- package/dist/components/prompt-popover/prompt-popover.js +81 -0
- package/dist/components/radio/radio.d.ts +2 -1
- package/dist/components/radio/radio.js +2 -2
- package/dist/components/repeater/repeater-context.d.ts +0 -1
- package/dist/components/repeater/repeater-item.js +2 -2
- package/dist/components/repeater/repeater.d.ts +5 -38
- package/dist/components/repeater/repeater.js +8 -11
- package/dist/components/responsive/mini-responsive.d.ts +0 -1
- package/dist/components/responsive/mini-responsive.js +31 -31
- package/dist/components/responsive/responsive-legacy.d.ts +0 -1
- package/dist/components/responsive/responsive-legacy.js +13 -11
- package/dist/components/responsive/responsive.d.ts +0 -1
- package/dist/components/responsive/responsive.js +29 -29
- package/dist/components/responsive-preview/responsive-preview.js +4 -4
- package/dist/components/rich-label/rich-label.d.ts +1 -1
- package/dist/components/rich-label/rich-label.js +2 -2
- package/dist/components/select/async-multi-select.d.ts +12 -13
- package/dist/components/select/async-multi-select.js +40 -21
- package/dist/components/select/async-select.d.ts +12 -13
- package/dist/components/select/async-select.js +39 -21
- package/dist/components/select/multi-select.d.ts +2 -8
- package/dist/components/select/multi-select.js +20 -20
- package/dist/components/select/shared.d.ts +7 -11
- package/dist/components/select/shared.js +2 -2
- package/dist/components/select/single-select.d.ts +2 -8
- package/dist/components/select/single-select.js +17 -17
- package/dist/components/select/styles.d.ts +2 -2
- package/dist/components/slider/column-config-slider.js +8 -6
- package/dist/components/slider/slider.js +16 -12
- package/dist/components/slider/utils.js +1 -1
- package/dist/components/smart-image/smart-image.d.ts +1 -2
- package/dist/components/smart-image/smart-image.js +53 -51
- package/dist/components/tabs/tabs.d.ts +16 -64
- package/dist/components/tabs/tabs.js +1 -1
- package/dist/components/toggle/switch.d.ts +1 -1
- package/dist/components/toggle/switch.js +1 -1
- package/dist/components/toggle/toggle.js +2 -2
- package/dist/components/toggle-button/toggle-button.d.ts +2 -2
- package/dist/components/toggle-button/toggle-button.js +1 -1
- package/dist/components/tooltip/tooltip.js +1 -1
- package/dist/{draggable-9MfdTVWP.js → draggable-oS68xcYX.js} +130 -125
- package/dist/{es-dash-DunirOmV.js → es-dash-DPtJSRjw.js} +23 -52
- package/dist/{gradient-editor-yqSw0uPA.js → gradient-editor-DP8ioFX1.js} +39 -30
- package/dist/icons/block-icon.js +1 -1
- package/dist/icons/icon.d.ts +3 -3
- package/dist/icons/icon.js +21 -9
- package/dist/icons/icons.d.ts +210 -1
- package/dist/icons/index.js +1 -1
- package/dist/icons/jsx-svg.d.ts +5 -4
- package/dist/icons/jsx-svg.js +1 -1
- package/dist/index.js +18 -17
- package/dist/{input-field-nN6BO0oz.js → input-field-C-XvZeCZ.js} +8 -8
- package/dist/{jsx-svg-BjGQUBLh.js → jsx-svg-DRwJdRpA.js} +171 -129
- package/dist/{keyboard-g5Amam-c.js → keyboard-Cdqi5ZQQ.js} +1 -1
- package/dist/{link-input-BhlPElU8.js → link-input-DdwuqoMg.js} +147 -89
- package/dist/{modal-B5axB0Fc.js → modal-DZco5MDu.js} +15 -14
- package/dist/{number-picker-nnOf0XnN.js → number-picker-XqKW0BNi.js} +9 -9
- package/dist/{react-y40Dt3ab.js → react-O71mlJXS.js} +250 -266
- package/dist/{shared-Ba_bt4s9.js → shared-YXMIX2ka.js} +60 -44
- package/dist/{solid-color-picker-CsosgTVa.js → solid-color-picker-D5LEdmDM.js} +78 -58
- package/dist/{switch-BJ4_OyUm.js → switch-Bo6nmed_.js} +8 -8
- package/dist/{tabs-wAe0AAyu.js → tabs-DE-qb7Kt.js} +35 -30
- package/dist/{text-helpers-2j9DuxP1.js → text-helpers-QrwKKaOh.js} +3 -2
- package/dist/{textSelection-B_Nv6Jz3.js → textSelection-C17LWYmO.js} +3 -3
- package/dist/{toggle-button-BLJdEp8V.js → toggle-button-Cb4yCEua.js} +39 -8
- package/dist/{tooltip-BW9nj5-V.js → tooltip-CT-vzIdz.js} +68 -62
- package/dist/{useAsyncList-B3-uyJgA.js → useAsyncList-CjKVLGN0.js} +8 -4
- package/dist/{useButton-CPMVLXoX.js → useButton-V65TBDGM.js} +3 -3
- package/dist/{useCollection-PzY6FI39.js → useCollection-DqUS7tjk.js} +281 -184
- package/dist/useEvent-C9zwSNzZ.js +18 -0
- package/dist/{useField-DrfR8j9h.js → useField-B_ibsWst.js} +2 -2
- package/dist/{useFilter-CiCjo6Na.js → useFilter-C75IzdIZ.js} +1 -1
- package/dist/{useFocusRing-CrYHpV7C.js → useFocusRing-JidySWlU.js} +1 -1
- package/dist/{useFormReset-U6c35PHq.js → useFormReset-Sp8-miDa.js} +1 -1
- package/dist/{useFormValidation-B2q2MGWN.js → useFormValidation-CpmQEh8J.js} +2 -2
- package/dist/{useHover-CNsbAR0V.js → useHover-CaY3sRjL.js} +250 -46
- package/dist/{useLabel-DuxAjaic.js → useLabel-gfFDE4bn.js} +2 -2
- package/dist/{useLabels-NUsp5IW3.js → useLabels-Dcg-cEyM.js} +1 -1
- package/dist/{useListState-FLxa7R_U.js → useListState-CzB3v6M9.js} +6 -11
- package/dist/{useLocalizedStringFormatter-Ccm8EL_u.js → useLocalizedStringFormatter-CTCqjYu4.js} +6 -1
- package/dist/{useNumberFieldState-DWvm7CXu.js → useNumberFieldState-DC3XY3DQ.js} +79 -62
- package/dist/{useNumberFormatter-B0_D7a_o.js → useNumberFormatter-DbAt_fC_.js} +2 -2
- package/dist/{useOverlayTriggerState-zZ7homyI.js → useOverlayTriggerState-BKmSTK_5.js} +16 -11
- package/dist/{usePress-DRoujMNm.js → usePress-CUCWcP-m.js} +50 -28
- package/dist/{useSlot-pRz-v9kC.js → useSlot-CnQHcvd4.js} +1 -1
- package/dist/{useTextField-e8jIFT3s.js → useTextField-C3QIkMON.js} +6 -6
- package/dist/{useToggle-CR_ZKvr_.js → useToggle-bbGRUbo4.js} +6 -6
- package/dist/{useToggleState-ButQxGrJ.js → useToggleState-D_rLMrVW.js} +1 -1
- package/dist/utilities/array-helpers.d.ts +2 -2
- package/dist/utilities/array-helpers.js +4 -3
- package/dist/utilities/debounce-throttle.d.ts +9 -2
- package/dist/utilities/es-dash.d.ts +11 -8
- package/dist/utilities/es-dash.js +1 -1
- package/dist/utilities/index.js +2 -2
- package/dist/utilities/text-helpers.js +1 -1
- package/dist/utilities/web-workers.d.ts +7 -7
- package/dist/utilities/web-workers.js +5 -5
- package/dist/{utils-Czi6q2Ub.js → utils-ClM91CuL.js} +30 -19
- package/package.json +23 -27
- package/dist/useEvent-CzuFZ2HT.js +0 -22
|
@@ -1,48 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Children, Component, Fragment, createContext, createElement, forwardRef, isValidElement, useCallback, useContext, useEffect, useId, useInsertionEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
//#region \0rolldown/runtime.js
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __esmMin = (fn, res, err) => () => {
|
|
10
|
-
if (err) throw err[0];
|
|
11
|
-
try {
|
|
12
|
-
return fn && (res = fn(fn = 0)), res;
|
|
13
|
-
} catch (e) {
|
|
14
|
-
throw err = [e], e;
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var __exportAll = (all, no_symbols) => {
|
|
18
|
-
let target = {};
|
|
19
|
-
for (var name in all) {
|
|
20
|
-
__defProp(target, name, {
|
|
21
|
-
get: all[name],
|
|
22
|
-
enumerable: true
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
if (!no_symbols) {
|
|
26
|
-
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
27
|
-
}
|
|
28
|
-
return target;
|
|
29
|
-
};
|
|
30
|
-
var __copyProps = (to, from, except, desc) => {
|
|
31
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
32
|
-
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
33
|
-
key = keys[i];
|
|
34
|
-
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
35
|
-
__defProp(to, key, {
|
|
36
|
-
get: ((k) => from[k]).bind(null, key),
|
|
37
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return to;
|
|
43
|
-
};
|
|
44
|
-
var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
45
|
-
//#endregion
|
|
46
4
|
//#region node_modules/framer-motion/dist/es/context/LayoutGroupContext.mjs
|
|
47
5
|
var LayoutGroupContext = createContext({});
|
|
48
6
|
//#endregion
|
|
@@ -61,10 +19,10 @@ function useConstant(init) {
|
|
|
61
19
|
}
|
|
62
20
|
//#endregion
|
|
63
21
|
//#region node_modules/framer-motion/dist/es/utils/is-browser.mjs
|
|
64
|
-
var isBrowser$
|
|
22
|
+
var isBrowser$2 = typeof window !== "undefined";
|
|
65
23
|
//#endregion
|
|
66
24
|
//#region node_modules/framer-motion/dist/es/utils/use-isomorphic-effect.mjs
|
|
67
|
-
var useIsomorphicLayoutEffect = isBrowser$
|
|
25
|
+
var useIsomorphicLayoutEffect = isBrowser$2 ? useLayoutEffect : useEffect;
|
|
68
26
|
//#endregion
|
|
69
27
|
//#region node_modules/framer-motion/dist/es/context/PresenceContext.mjs
|
|
70
28
|
/**
|
|
@@ -851,7 +809,8 @@ function matchOrder(origin, target) {
|
|
|
851
809
|
for (let i = 0; i < target.values.length; i++) {
|
|
852
810
|
const type = target.types[i];
|
|
853
811
|
const originIndex = origin.indexes[type][pointers[type]];
|
|
854
|
-
|
|
812
|
+
const originValue = origin.values[originIndex] ?? 0;
|
|
813
|
+
orderedOrigin[i] = originValue;
|
|
855
814
|
pointers[type]++;
|
|
856
815
|
}
|
|
857
816
|
return orderedOrigin;
|
|
@@ -903,15 +862,16 @@ var generateLinearEasing = (easing, duration, resolution = 10) => {
|
|
|
903
862
|
* to prevent infinite loops
|
|
904
863
|
*/
|
|
905
864
|
var maxGeneratorDuration = 2e4;
|
|
906
|
-
function calcGeneratorDuration(generator) {
|
|
865
|
+
function calcGeneratorDuration(generator, timeStep = 50, maxDuration = maxGeneratorDuration, keyframes) {
|
|
907
866
|
let duration = 0;
|
|
908
|
-
const timeStep = 50;
|
|
909
867
|
let state = generator.next(duration);
|
|
910
|
-
|
|
868
|
+
keyframes?.push(state.value);
|
|
869
|
+
while (!state.done && duration < maxDuration) {
|
|
911
870
|
duration += timeStep;
|
|
912
871
|
state = generator.next(duration);
|
|
872
|
+
keyframes?.push(state.value);
|
|
913
873
|
}
|
|
914
|
-
return duration >=
|
|
874
|
+
return duration >= maxDuration ? Infinity : duration;
|
|
915
875
|
}
|
|
916
876
|
//#endregion
|
|
917
877
|
//#region node_modules/motion-dom/dist/es/animation/generators/utils/create-generator-easing.mjs
|
|
@@ -993,9 +953,9 @@ function findSpring({ duration = springDefaults.duration, bounce = springDefault
|
|
|
993
953
|
derivative = (undampedFreq) => {
|
|
994
954
|
const delta = undampedFreq * dampingRatio * duration;
|
|
995
955
|
const d = delta * velocity + velocity;
|
|
996
|
-
const e =
|
|
956
|
+
const e = dampingRatio * dampingRatio * undampedFreq * undampedFreq * duration;
|
|
997
957
|
const f = Math.exp(-delta);
|
|
998
|
-
const g = calcAngularFreq(
|
|
958
|
+
const g = calcAngularFreq(undampedFreq * undampedFreq, dampingRatio);
|
|
999
959
|
return (-envelope(undampedFreq) + safeMin > 0 ? -1 : 1) * ((d - e) * f) / g;
|
|
1000
960
|
};
|
|
1001
961
|
} else {
|
|
@@ -1018,7 +978,7 @@ function findSpring({ duration = springDefaults.duration, bounce = springDefault
|
|
|
1018
978
|
duration
|
|
1019
979
|
};
|
|
1020
980
|
else {
|
|
1021
|
-
const stiffness =
|
|
981
|
+
const stiffness = undampedFreq * undampedFreq * mass;
|
|
1022
982
|
return {
|
|
1023
983
|
stiffness,
|
|
1024
984
|
damping: dampingRatio * 2 * Math.sqrt(mass * stiffness),
|
|
@@ -1097,6 +1057,7 @@ function spring(optionsOrVisualDuration = springDefaults.visualDuration, bounce
|
|
|
1097
1057
|
const dampingRatio = damping / (2 * Math.sqrt(stiffness * mass));
|
|
1098
1058
|
const initialDelta = target - origin;
|
|
1099
1059
|
const undampedAngularFreq = millisecondsToSeconds(Math.sqrt(stiffness / mass));
|
|
1060
|
+
const decay = dampingRatio * undampedAngularFreq;
|
|
1100
1061
|
/**
|
|
1101
1062
|
* If we're working on a granular scale, use smaller defaults for determining
|
|
1102
1063
|
* when the spring is finished.
|
|
@@ -1109,21 +1070,36 @@ function spring(optionsOrVisualDuration = springDefaults.visualDuration, bounce
|
|
|
1109
1070
|
restDelta || (restDelta = isGranularScale ? springDefaults.restDelta.granular : springDefaults.restDelta.default);
|
|
1110
1071
|
let resolveSpring;
|
|
1111
1072
|
let resolveVelocity;
|
|
1112
|
-
let angularFreq;
|
|
1113
|
-
let A;
|
|
1114
|
-
let sinCoeff;
|
|
1115
|
-
let cosCoeff;
|
|
1116
1073
|
if (dampingRatio < 1) {
|
|
1117
|
-
angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio);
|
|
1118
|
-
A = (initialVelocity +
|
|
1074
|
+
const angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio);
|
|
1075
|
+
const A = (initialVelocity + decay * initialDelta) / angularFreq;
|
|
1076
|
+
const sinCoeff = decay * A + initialDelta * angularFreq;
|
|
1077
|
+
const cosCoeff = decay * initialDelta - A * angularFreq;
|
|
1078
|
+
/**
|
|
1079
|
+
* The underdamped hot path needs both position and velocity every
|
|
1080
|
+
* frame and they share the same exp/sin/cos terms, so sample both
|
|
1081
|
+
* at once, memoized by t, to only calculate them once per frame.
|
|
1082
|
+
*/
|
|
1083
|
+
let sampledT = -1;
|
|
1084
|
+
let position = 0;
|
|
1085
|
+
let velocityAtT = 0;
|
|
1086
|
+
const sample = (t) => {
|
|
1087
|
+
if (t !== sampledT) {
|
|
1088
|
+
sampledT = t;
|
|
1089
|
+
const envelope = Math.exp(-decay * t);
|
|
1090
|
+
const sin = Math.sin(angularFreq * t);
|
|
1091
|
+
const cos = Math.cos(angularFreq * t);
|
|
1092
|
+
position = target - envelope * (A * sin + initialDelta * cos);
|
|
1093
|
+
velocityAtT = envelope * (sinCoeff * sin + cosCoeff * cos);
|
|
1094
|
+
}
|
|
1095
|
+
};
|
|
1119
1096
|
resolveSpring = (t) => {
|
|
1120
|
-
|
|
1121
|
-
return
|
|
1097
|
+
sample(t);
|
|
1098
|
+
return position;
|
|
1122
1099
|
};
|
|
1123
|
-
sinCoeff = dampingRatio * undampedAngularFreq * A + initialDelta * angularFreq;
|
|
1124
|
-
cosCoeff = dampingRatio * undampedAngularFreq * initialDelta - A * angularFreq;
|
|
1125
1100
|
resolveVelocity = (t) => {
|
|
1126
|
-
|
|
1101
|
+
sample(t);
|
|
1102
|
+
return velocityAtT;
|
|
1127
1103
|
};
|
|
1128
1104
|
} else if (dampingRatio === 1) {
|
|
1129
1105
|
resolveSpring = (t) => target - Math.exp(-undampedAngularFreq * t) * (initialDelta + (initialVelocity + undampedAngularFreq * initialDelta) * t);
|
|
@@ -1132,15 +1108,15 @@ function spring(optionsOrVisualDuration = springDefaults.visualDuration, bounce
|
|
|
1132
1108
|
} else {
|
|
1133
1109
|
const dampedAngularFreq = undampedAngularFreq * Math.sqrt(dampingRatio * dampingRatio - 1);
|
|
1134
1110
|
resolveSpring = (t) => {
|
|
1135
|
-
const envelope = Math.exp(-
|
|
1111
|
+
const envelope = Math.exp(-decay * t);
|
|
1136
1112
|
const freqForT = Math.min(dampedAngularFreq * t, 300);
|
|
1137
|
-
return target - envelope * ((initialVelocity +
|
|
1113
|
+
return target - envelope * ((initialVelocity + decay * initialDelta) * Math.sinh(freqForT) + dampedAngularFreq * initialDelta * Math.cosh(freqForT)) / dampedAngularFreq;
|
|
1138
1114
|
};
|
|
1139
|
-
const P = (initialVelocity +
|
|
1140
|
-
const sinhCoeff =
|
|
1141
|
-
const coshCoeff =
|
|
1115
|
+
const P = (initialVelocity + decay * initialDelta) / dampedAngularFreq;
|
|
1116
|
+
const sinhCoeff = decay * P - initialDelta * dampedAngularFreq;
|
|
1117
|
+
const coshCoeff = decay * initialDelta - P * dampedAngularFreq;
|
|
1142
1118
|
resolveVelocity = (t) => {
|
|
1143
|
-
const envelope = Math.exp(-
|
|
1119
|
+
const envelope = Math.exp(-decay * t);
|
|
1144
1120
|
const freqForT = Math.min(dampedAngularFreq * t, 300);
|
|
1145
1121
|
return envelope * (sinhCoeff * Math.sinh(freqForT) + coshCoeff * Math.cosh(freqForT));
|
|
1146
1122
|
};
|
|
@@ -1149,21 +1125,6 @@ function spring(optionsOrVisualDuration = springDefaults.visualDuration, bounce
|
|
|
1149
1125
|
calculatedDuration: isResolvedFromDuration ? duration || null : null,
|
|
1150
1126
|
velocity: (t) => secondsToMilliseconds(resolveVelocity(t)),
|
|
1151
1127
|
next: (t) => {
|
|
1152
|
-
/**
|
|
1153
|
-
* For underdamped physics springs we need both position and
|
|
1154
|
-
* velocity each tick. Compute shared trig values once to avoid
|
|
1155
|
-
* duplicate Math.exp/sin/cos calls on the hot path.
|
|
1156
|
-
*/
|
|
1157
|
-
if (!isResolvedFromDuration && dampingRatio < 1) {
|
|
1158
|
-
const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
|
|
1159
|
-
const sin = Math.sin(angularFreq * t);
|
|
1160
|
-
const cos = Math.cos(angularFreq * t);
|
|
1161
|
-
const current = target - envelope * (A * sin + initialDelta * cos);
|
|
1162
|
-
const currentVelocity = secondsToMilliseconds(envelope * (sinCoeff * sin + cosCoeff * cos));
|
|
1163
|
-
state.done = Math.abs(currentVelocity) <= restSpeed && Math.abs(target - current) <= restDelta;
|
|
1164
|
-
state.value = state.done ? target : current;
|
|
1165
|
-
return state;
|
|
1166
|
-
}
|
|
1167
1128
|
const current = resolveSpring(t);
|
|
1168
1129
|
if (!isResolvedFromDuration) {
|
|
1169
1130
|
const currentVelocity = secondsToMilliseconds(resolveVelocity(t));
|
|
@@ -1189,13 +1150,6 @@ spring.applyToOptions = (options) => {
|
|
|
1189
1150
|
return options;
|
|
1190
1151
|
};
|
|
1191
1152
|
//#endregion
|
|
1192
|
-
//#region node_modules/motion-dom/dist/es/animation/generators/utils/velocity.mjs
|
|
1193
|
-
var velocitySampleDuration = 5;
|
|
1194
|
-
function getGeneratorVelocity(resolveValue, t, current) {
|
|
1195
|
-
const prevT = Math.max(t - velocitySampleDuration, 0);
|
|
1196
|
-
return velocityPerSecond(current - resolveValue(prevT), t - prevT);
|
|
1197
|
-
}
|
|
1198
|
-
//#endregion
|
|
1199
1153
|
//#region node_modules/motion-dom/dist/es/animation/generators/inertia.mjs
|
|
1200
1154
|
function inertia({ keyframes, velocity = 0, power = .8, timeConstant = 325, bounceDamping = 10, bounceStiffness = 500, modifyTarget, min, max, restDelta = .5, restSpeed }) {
|
|
1201
1155
|
const origin = keyframes[0];
|
|
@@ -1203,7 +1157,7 @@ function inertia({ keyframes, velocity = 0, power = .8, timeConstant = 325, boun
|
|
|
1203
1157
|
done: false,
|
|
1204
1158
|
value: origin
|
|
1205
1159
|
};
|
|
1206
|
-
const isOutOfBounds = (v) =>
|
|
1160
|
+
const isOutOfBounds = (v) => v < min || v > max;
|
|
1207
1161
|
const nearestBoundary = (v) => {
|
|
1208
1162
|
if (min === void 0) return max;
|
|
1209
1163
|
if (max === void 0) return min;
|
|
@@ -1218,12 +1172,10 @@ function inertia({ keyframes, velocity = 0, power = .8, timeConstant = 325, boun
|
|
|
1218
1172
|
*/
|
|
1219
1173
|
if (target !== ideal) amplitude = target - origin;
|
|
1220
1174
|
const calcDelta = (t) => -amplitude * Math.exp(-t / timeConstant);
|
|
1221
|
-
const calcLatest = (t) => target + calcDelta(t);
|
|
1222
1175
|
const applyFriction = (t) => {
|
|
1223
1176
|
const delta = calcDelta(t);
|
|
1224
|
-
const latest = calcLatest(t);
|
|
1225
1177
|
state.done = Math.abs(delta) <= restDelta;
|
|
1226
|
-
state.value = state.done ? target :
|
|
1178
|
+
state.value = state.done ? target : target + delta;
|
|
1227
1179
|
};
|
|
1228
1180
|
/**
|
|
1229
1181
|
* Ideally this would resolve for t in a stateless way, we could
|
|
@@ -1238,7 +1190,12 @@ function inertia({ keyframes, velocity = 0, power = .8, timeConstant = 325, boun
|
|
|
1238
1190
|
timeReachedBoundary = t;
|
|
1239
1191
|
spring$1 = spring({
|
|
1240
1192
|
keyframes: [state.value, nearestBoundary(state.value)],
|
|
1241
|
-
|
|
1193
|
+
/**
|
|
1194
|
+
* The friction curve is target + calcDelta(t), so its exact
|
|
1195
|
+
* derivative is -calcDelta(t) / timeConstant in units/ms,
|
|
1196
|
+
* converted here to the units/second expected by spring.
|
|
1197
|
+
*/
|
|
1198
|
+
velocity: -calcDelta(t) / timeConstant * 1e3,
|
|
1242
1199
|
damping: bounceDamping,
|
|
1243
1200
|
stiffness: bounceStiffness,
|
|
1244
1201
|
restDelta,
|
|
@@ -1281,7 +1238,10 @@ function createMixers(output, ease, customMixer) {
|
|
|
1281
1238
|
const numMixers = output.length - 1;
|
|
1282
1239
|
for (let i = 0; i < numMixers; i++) {
|
|
1283
1240
|
let mixer = mixerFactory(output[i], output[i + 1]);
|
|
1284
|
-
if (ease)
|
|
1241
|
+
if (ease) {
|
|
1242
|
+
const easingFunction = Array.isArray(ease) ? ease[i] || noop : ease;
|
|
1243
|
+
mixer = pipe(easingFunction, mixer);
|
|
1244
|
+
}
|
|
1285
1245
|
mixers.push(mixer);
|
|
1286
1246
|
}
|
|
1287
1247
|
return mixers;
|
|
@@ -1372,7 +1332,11 @@ function keyframes({ duration = 300, keyframes: keyframeValues, times, ease = "e
|
|
|
1372
1332
|
done: false,
|
|
1373
1333
|
value: keyframeValues[0]
|
|
1374
1334
|
};
|
|
1375
|
-
|
|
1335
|
+
/**
|
|
1336
|
+
* Create a times array based on the provided 0-1 offsets
|
|
1337
|
+
*/
|
|
1338
|
+
const absoluteTimes = convertOffsetToTimes(times && times.length === keyframeValues.length ? times : defaultOffset(keyframeValues), duration);
|
|
1339
|
+
const mapTimeToKeyframe = interpolate(absoluteTimes, keyframeValues, { ease: Array.isArray(easingFunctions) ? easingFunctions : defaultEasing(keyframeValues, easingFunctions) });
|
|
1376
1340
|
return {
|
|
1377
1341
|
calculatedDuration: duration,
|
|
1378
1342
|
next: (t) => {
|
|
@@ -1383,6 +1347,13 @@ function keyframes({ duration = 300, keyframes: keyframeValues, times, ease = "e
|
|
|
1383
1347
|
};
|
|
1384
1348
|
}
|
|
1385
1349
|
//#endregion
|
|
1350
|
+
//#region node_modules/motion-dom/dist/es/animation/generators/utils/velocity.mjs
|
|
1351
|
+
var velocitySampleDuration = 5;
|
|
1352
|
+
function getGeneratorVelocity(resolveValue, t, current) {
|
|
1353
|
+
const prevT = Math.max(t - velocitySampleDuration, 0);
|
|
1354
|
+
return velocityPerSecond(current - resolveValue(prevT), t - prevT);
|
|
1355
|
+
}
|
|
1356
|
+
//#endregion
|
|
1386
1357
|
//#region node_modules/motion-dom/dist/es/animation/keyframes/get-final.mjs
|
|
1387
1358
|
var isNotNull = (value) => value !== null;
|
|
1388
1359
|
function getFinalKeyframe(keyframes, { repeat, repeatType = "loop" }, finalKeyframe, speed = 1) {
|
|
@@ -2382,7 +2353,8 @@ var acceleratedValues = new Set([
|
|
|
2382
2353
|
"opacity",
|
|
2383
2354
|
"clipPath",
|
|
2384
2355
|
"filter",
|
|
2385
|
-
"transform"
|
|
2356
|
+
"transform",
|
|
2357
|
+
"backgroundColor"
|
|
2386
2358
|
]);
|
|
2387
2359
|
//#endregion
|
|
2388
2360
|
//#region node_modules/motion-dom/dist/es/animation/waapi/utils/is-browser-color.mjs
|
|
@@ -2408,13 +2380,15 @@ var colorProperties = new Set([
|
|
|
2408
2380
|
var supportsWaapi = memo$1(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
|
|
2409
2381
|
function supportsBrowserAnimation(options) {
|
|
2410
2382
|
const { motionValue, name, repeatDelay, repeatType, damping, type, keyframes } = options;
|
|
2383
|
+
const subject = motionValue?.owner?.current;
|
|
2411
2384
|
/**
|
|
2412
|
-
* We use
|
|
2413
|
-
* **don't** want elements in different timing
|
|
2414
|
-
* to be accelerated, as it's not possible to sync
|
|
2415
|
-
* properly with those driven from the main window
|
|
2385
|
+
* We use instanceof checks instead of isHTMLElement()/isSVGElement()
|
|
2386
|
+
* because we explicitly **don't** want elements in different timing
|
|
2387
|
+
* contexts (i.e. popups) to be accelerated, as it's not possible to sync
|
|
2388
|
+
* these animations properly with those driven from the main window
|
|
2389
|
+
* frameloop.
|
|
2416
2390
|
*/
|
|
2417
|
-
if (!(
|
|
2391
|
+
if (!(subject instanceof HTMLElement) && !(subject instanceof SVGElement)) return false;
|
|
2418
2392
|
const { onUpdate, transformTemplate } = motionValue.owner.getProps();
|
|
2419
2393
|
return supportsWaapi() && name && (acceleratedValues.has(name) || colorProperties.has(name) && hasBrowserOnlyColors(keyframes)) && (name !== "transform" || !transformTemplate) && !onUpdate && !repeatDelay && repeatType !== "mirror" && damping !== 0 && type !== "inertia";
|
|
2420
2394
|
}
|
|
@@ -3160,6 +3134,7 @@ function getOptimisedAppearId(visualElement) {
|
|
|
3160
3134
|
}
|
|
3161
3135
|
//#endregion
|
|
3162
3136
|
//#region node_modules/motion-dom/dist/es/animation/interfaces/visual-element-target.mjs
|
|
3137
|
+
var isBrowser$1 = typeof window !== "undefined";
|
|
3163
3138
|
/**
|
|
3164
3139
|
* Decide whether we should block this animation. Previously, we achieved this
|
|
3165
3140
|
* just by checking whether the key was listed in protectedKeys, but this
|
|
@@ -3206,7 +3181,7 @@ function animateTarget(visualElement, targetAndTransition, { delay = 0, transiti
|
|
|
3206
3181
|
* to see if we're handling off from an existing animation.
|
|
3207
3182
|
*/
|
|
3208
3183
|
let isHandoff = false;
|
|
3209
|
-
if (window.MotionHandoffAnimation) {
|
|
3184
|
+
if (isBrowser$1 && window.MotionHandoffAnimation) {
|
|
3210
3185
|
const appearId = getOptimisedAppearId(visualElement);
|
|
3211
3186
|
if (appearId) {
|
|
3212
3187
|
const startTime = window.MotionHandoffAnimation(appearId, key, frame);
|
|
@@ -3676,14 +3651,15 @@ function isDragActive() {
|
|
|
3676
3651
|
//#endregion
|
|
3677
3652
|
//#region node_modules/motion-dom/dist/es/gestures/drag/state/set-active.mjs
|
|
3678
3653
|
function setDragLock(axis) {
|
|
3679
|
-
if (axis === "x" || axis === "y")
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3654
|
+
if (axis === "x" || axis === "y") {
|
|
3655
|
+
if (isDragging[axis]) return null;
|
|
3656
|
+
else {
|
|
3657
|
+
isDragging[axis] = true;
|
|
3658
|
+
return () => {
|
|
3659
|
+
isDragging[axis] = false;
|
|
3660
|
+
};
|
|
3661
|
+
}
|
|
3662
|
+
} else if (isDragging.x || isDragging.y) return null;
|
|
3687
3663
|
else {
|
|
3688
3664
|
isDragging.x = isDragging.y = true;
|
|
3689
3665
|
return () => {
|
|
@@ -4147,19 +4123,20 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
4147
4123
|
* create a new motion value from that
|
|
4148
4124
|
*/
|
|
4149
4125
|
element.addValue(key, motionValue(nextValue, { owner: element }));
|
|
4150
|
-
else if (prevValue !== nextValue)
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4126
|
+
else if (prevValue !== nextValue) {
|
|
4127
|
+
/**
|
|
4128
|
+
* If this is a flat value that has changed, update the motion value
|
|
4129
|
+
* or create one if it doesn't exist. We only want to do this if we're
|
|
4130
|
+
* not handling the value with our animation state.
|
|
4131
|
+
*/
|
|
4132
|
+
if (element.hasValue(key)) {
|
|
4133
|
+
const existingValue = element.getValue(key);
|
|
4134
|
+
if (existingValue.liveStyle === true) existingValue.jump(nextValue);
|
|
4135
|
+
else if (!existingValue.hasAnimated) existingValue.set(nextValue);
|
|
4136
|
+
} else {
|
|
4137
|
+
const latestValue = element.getStaticValue(key);
|
|
4138
|
+
element.addValue(key, motionValue(latestValue !== void 0 ? latestValue : nextValue, { owner: element }));
|
|
4139
|
+
}
|
|
4163
4140
|
}
|
|
4164
4141
|
}
|
|
4165
4142
|
for (const key in prev) if (next[key] === void 0) element.removeValue(key);
|
|
@@ -4983,8 +4960,10 @@ var correctBorderRadius = { correct: (latest, node) => {
|
|
|
4983
4960
|
* If latest is a string, if it's a percentage we can return immediately as it's
|
|
4984
4961
|
* going to be stretched appropriately. Otherwise, if it's a pixel, convert it to a number.
|
|
4985
4962
|
*/
|
|
4986
|
-
if (typeof latest === "string")
|
|
4987
|
-
|
|
4963
|
+
if (typeof latest === "string") {
|
|
4964
|
+
if (px.test(latest)) latest = parseFloat(latest);
|
|
4965
|
+
else return latest;
|
|
4966
|
+
}
|
|
4988
4967
|
return `${pixelsToPercent(latest, node.target.x)}% ${pixelsToPercent(latest, node.target.y)}%`;
|
|
4989
4968
|
} };
|
|
4990
4969
|
//#endregion
|
|
@@ -5049,6 +5028,15 @@ var HTMLVisualElement = class extends DOMVisualElement {
|
|
|
5049
5028
|
this.type = "html";
|
|
5050
5029
|
this.renderInstance = renderHTML;
|
|
5051
5030
|
}
|
|
5031
|
+
mount(instance) {
|
|
5032
|
+
/**
|
|
5033
|
+
* If a custom component forwards its ref to something other than a
|
|
5034
|
+
* HTML/SVG element (a class instance, an imperative handle) there's
|
|
5035
|
+
* nothing for Motion to style, measure or attach gestures to. #2777
|
|
5036
|
+
*/
|
|
5037
|
+
invariant(Boolean(instance.style), "motion.create() components must forward their ref to a HTML or SVG element", "custom-component-ref");
|
|
5038
|
+
super.mount(instance);
|
|
5039
|
+
}
|
|
5052
5040
|
readValueFromInstance(instance, key) {
|
|
5053
5041
|
if (transformProps.has(key)) return this.projection?.isProjecting ? defaultTransformValue(key) : readTransformValue(instance, key);
|
|
5054
5042
|
else {
|
|
@@ -5095,10 +5083,9 @@ function buildSVGPath(attrs, length, spacing = 1, offset = 0, useDashCase = true
|
|
|
5095
5083
|
}
|
|
5096
5084
|
//#endregion
|
|
5097
5085
|
//#region node_modules/motion-dom/dist/es/render/svg/utils/build-attrs.mjs
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
var cssMotionPathProperties = [
|
|
5086
|
+
var cssStyleProperties = [
|
|
5087
|
+
"transform",
|
|
5088
|
+
"opacity",
|
|
5102
5089
|
"offsetDistance",
|
|
5103
5090
|
"offsetPath",
|
|
5104
5091
|
"offsetRotate",
|
|
@@ -5120,13 +5107,9 @@ function buildSVGAttrs(state, { attrX, attrY, attrScale, pathLength, pathSpacing
|
|
|
5120
5107
|
state.attrs = state.style;
|
|
5121
5108
|
state.style = {};
|
|
5122
5109
|
const { attrs, style } = state;
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
*/
|
|
5127
|
-
if (attrs.transform) {
|
|
5128
|
-
style.transform = attrs.transform;
|
|
5129
|
-
delete attrs.transform;
|
|
5110
|
+
for (const key of cssStyleProperties) if (attrs[key] !== void 0) {
|
|
5111
|
+
style[key] = attrs[key];
|
|
5112
|
+
delete attrs[key];
|
|
5130
5113
|
}
|
|
5131
5114
|
if (style.transform || attrs.transformOrigin) {
|
|
5132
5115
|
style.transformOrigin = attrs.transformOrigin ?? "50% 50%";
|
|
@@ -5140,10 +5123,6 @@ function buildSVGAttrs(state, { attrX, attrY, attrScale, pathLength, pathSpacing
|
|
|
5140
5123
|
style.transformBox = styleProp?.transformBox ?? "fill-box";
|
|
5141
5124
|
delete attrs.transformBox;
|
|
5142
5125
|
}
|
|
5143
|
-
for (const key of cssMotionPathProperties) if (attrs[key] !== void 0) {
|
|
5144
|
-
style[key] = attrs[key];
|
|
5145
|
-
delete attrs[key];
|
|
5146
|
-
}
|
|
5147
5126
|
if (attrX !== void 0) attrs.x = attrX;
|
|
5148
5127
|
if (attrY !== void 0) attrs.y = attrY;
|
|
5149
5128
|
if (attrScale !== void 0) attrs.scale = attrScale;
|
|
@@ -5215,6 +5194,10 @@ var SVGVisualElement = class extends DOMVisualElement {
|
|
|
5215
5194
|
const defaultType = getDefaultValueType(key);
|
|
5216
5195
|
return defaultType ? defaultType.default || 0 : 0;
|
|
5217
5196
|
}
|
|
5197
|
+
if (cssStyleProperties.includes(key)) {
|
|
5198
|
+
const value = getComputedStyle(instance)[key];
|
|
5199
|
+
if (typeof value === "string" && value) return value.trim();
|
|
5200
|
+
}
|
|
5218
5201
|
key = !camelCaseAttributes.has(key) ? camelToDash(key) : key;
|
|
5219
5202
|
return instance.getAttribute(key);
|
|
5220
5203
|
}
|
|
@@ -5439,9 +5422,10 @@ function createAnimationState(visualElement) {
|
|
|
5439
5422
|
let valueHasChanged = false;
|
|
5440
5423
|
if (isKeyframesTarget(next) && isKeyframesTarget(prev)) valueHasChanged = !shallowCompare(next, prev) || variantDidChange;
|
|
5441
5424
|
else valueHasChanged = next !== prev;
|
|
5442
|
-
if (valueHasChanged)
|
|
5443
|
-
|
|
5444
|
-
|
|
5425
|
+
if (valueHasChanged) {
|
|
5426
|
+
if (next !== void 0 && next !== null) markToAnimate(key);
|
|
5427
|
+
else removedKeys.add(key);
|
|
5428
|
+
} else if (next !== void 0 && removedKeys.has(key))
|
|
5445
5429
|
/**
|
|
5446
5430
|
* If next hasn't changed and it isn't undefined, we want to check if it's
|
|
5447
5431
|
* been removed by a higher priority
|
|
@@ -6597,8 +6581,10 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
|
|
|
6597
6581
|
* a relativeParent. This will allow a component to perform scale correction
|
|
6598
6582
|
* even if no animation has started.
|
|
6599
6583
|
*/
|
|
6600
|
-
if (!this.targetDelta && !this.relativeTarget)
|
|
6601
|
-
|
|
6584
|
+
if (!this.targetDelta && !this.relativeTarget) {
|
|
6585
|
+
if (this.options.layoutAnchor !== false && relativeParent && relativeParent.layout) this.createRelativeTarget(relativeParent, this.layout.layoutBox, relativeParent.layout.layoutBox);
|
|
6586
|
+
else this.removeRelativeTarget();
|
|
6587
|
+
}
|
|
6602
6588
|
/**
|
|
6603
6589
|
* If we have no relative target or no target delta our target isn't valid
|
|
6604
6590
|
* for this frame.
|
|
@@ -7380,7 +7366,16 @@ function PopChild({ children, isPresent, anchorX, anchorY, root, pop }) {
|
|
|
7380
7366
|
direction: "ltr"
|
|
7381
7367
|
});
|
|
7382
7368
|
const { nonce } = useContext(MotionConfigContext);
|
|
7383
|
-
|
|
7369
|
+
/**
|
|
7370
|
+
* In React 19, refs are passed via props.ref instead of element.ref.
|
|
7371
|
+
* We check props.ref first (React 19) and fall back to element.ref (React 18).
|
|
7372
|
+
*
|
|
7373
|
+
* The composed ref is only used when popping the child out (pop !== false),
|
|
7374
|
+
* so we avoid reading children.props.ref otherwise. In React 18.3 that read
|
|
7375
|
+
* triggers a spurious "`ref` is not a prop" warning getter (#3745).
|
|
7376
|
+
*/
|
|
7377
|
+
const childRef = pop !== false ? children.props?.ref ?? children?.ref : void 0;
|
|
7378
|
+
const composedRef = useComposedRefs(ref, childRef);
|
|
7384
7379
|
/**
|
|
7385
7380
|
* We create and inject a style block so we can apply this explicit
|
|
7386
7381
|
* sizing in a non-destructive manner by just deleting the style block.
|
|
@@ -7613,6 +7608,14 @@ var AnimatePresence = ({ children, custom, initial = true, onExitComplete, prese
|
|
|
7613
7608
|
*/
|
|
7614
7609
|
const [diffedChildren, setDiffedChildren] = useState(presentChildren);
|
|
7615
7610
|
const [renderedChildren, setRenderedChildren] = useState(presentChildren);
|
|
7611
|
+
useIsomorphicLayoutEffect(() => {
|
|
7612
|
+
if (propagate && !isParentPresent && !renderedChildren.length) safeToRemove?.();
|
|
7613
|
+
}, [
|
|
7614
|
+
isParentPresent,
|
|
7615
|
+
propagate,
|
|
7616
|
+
renderedChildren.length,
|
|
7617
|
+
safeToRemove
|
|
7618
|
+
]);
|
|
7616
7619
|
useIsomorphicLayoutEffect(() => {
|
|
7617
7620
|
isInitialRender.current = false;
|
|
7618
7621
|
pendingPresentChildren.current = presentChildren;
|
|
@@ -7639,14 +7642,20 @@ var AnimatePresence = ({ children, custom, initial = true, onExitComplete, prese
|
|
|
7639
7642
|
/**
|
|
7640
7643
|
* Loop through all the currently rendered components and decide which
|
|
7641
7644
|
* are exiting.
|
|
7645
|
+
*
|
|
7646
|
+
* Exiting children are reinserted directly after the child they
|
|
7647
|
+
* previously followed. Splicing at their index within the previously
|
|
7648
|
+
* rendered children, as we used to, indexes into the wrong list: it
|
|
7649
|
+
* can interleave them with entering children and push present children
|
|
7650
|
+
* to new positions, remounting them (#3746).
|
|
7642
7651
|
*/
|
|
7643
|
-
|
|
7644
|
-
|
|
7645
|
-
const
|
|
7646
|
-
if (
|
|
7647
|
-
nextChildren.splice(
|
|
7652
|
+
let insertionIndex = 0;
|
|
7653
|
+
for (const child of renderedChildren) {
|
|
7654
|
+
const presentIndex = presentKeys.indexOf(getChildKey(child));
|
|
7655
|
+
if (presentIndex === -1) {
|
|
7656
|
+
nextChildren.splice(insertionIndex++, 0, child);
|
|
7648
7657
|
exitingChildren.push(child);
|
|
7649
|
-
}
|
|
7658
|
+
} else insertionIndex = presentIndex + exitingChildren.length + 1;
|
|
7650
7659
|
}
|
|
7651
7660
|
/**
|
|
7652
7661
|
* If we're in "wait" mode, and we have exiting children, we want to
|
|
@@ -7775,105 +7784,6 @@ function loadFeatures(features) {
|
|
|
7775
7784
|
setFeatureDefinitions(featureDefinitions);
|
|
7776
7785
|
}
|
|
7777
7786
|
//#endregion
|
|
7778
|
-
//#region node_modules/framer-motion/dist/es/motion/utils/valid-prop.mjs
|
|
7779
|
-
/**
|
|
7780
|
-
* A list of all valid MotionProps.
|
|
7781
|
-
*
|
|
7782
|
-
* @privateRemarks
|
|
7783
|
-
* This doesn't throw if a `MotionProp` name is missing - it should.
|
|
7784
|
-
*/
|
|
7785
|
-
var validMotionProps = new Set([
|
|
7786
|
-
"animate",
|
|
7787
|
-
"exit",
|
|
7788
|
-
"variants",
|
|
7789
|
-
"initial",
|
|
7790
|
-
"style",
|
|
7791
|
-
"values",
|
|
7792
|
-
"variants",
|
|
7793
|
-
"transition",
|
|
7794
|
-
"transformTemplate",
|
|
7795
|
-
"custom",
|
|
7796
|
-
"inherit",
|
|
7797
|
-
"onBeforeLayoutMeasure",
|
|
7798
|
-
"onAnimationStart",
|
|
7799
|
-
"onAnimationComplete",
|
|
7800
|
-
"onUpdate",
|
|
7801
|
-
"onDragStart",
|
|
7802
|
-
"onDrag",
|
|
7803
|
-
"onDragEnd",
|
|
7804
|
-
"onMeasureDragConstraints",
|
|
7805
|
-
"onDirectionLock",
|
|
7806
|
-
"onDragTransitionEnd",
|
|
7807
|
-
"_dragX",
|
|
7808
|
-
"_dragY",
|
|
7809
|
-
"onHoverStart",
|
|
7810
|
-
"onHoverEnd",
|
|
7811
|
-
"onViewportEnter",
|
|
7812
|
-
"onViewportLeave",
|
|
7813
|
-
"globalTapTarget",
|
|
7814
|
-
"propagate",
|
|
7815
|
-
"ignoreStrict",
|
|
7816
|
-
"viewport"
|
|
7817
|
-
]);
|
|
7818
|
-
/**
|
|
7819
|
-
* Check whether a prop name is a valid `MotionProp` key.
|
|
7820
|
-
*
|
|
7821
|
-
* @param key - Name of the property to check
|
|
7822
|
-
* @returns `true` is key is a valid `MotionProp`.
|
|
7823
|
-
*
|
|
7824
|
-
* @public
|
|
7825
|
-
*/
|
|
7826
|
-
function isValidMotionProp(key) {
|
|
7827
|
-
return key.startsWith("while") || key.startsWith("drag") && key !== "draggable" || key.startsWith("layout") || key.startsWith("onTap") || key.startsWith("onPan") || key.startsWith("onLayout") || validMotionProps.has(key);
|
|
7828
|
-
}
|
|
7829
|
-
//#endregion
|
|
7830
|
-
//#region __vite-optional-peer-dep:@emotion/is-prop-valid:framer-motion
|
|
7831
|
-
var is_prop_valid_framer_motion_exports = __exportAll({ default: () => is_prop_valid_framer_motion_default });
|
|
7832
|
-
var is_prop_valid_framer_motion_default;
|
|
7833
|
-
var init_is_prop_valid_framer_motion = __esmMin((() => {
|
|
7834
|
-
is_prop_valid_framer_motion_default = {};
|
|
7835
|
-
throw new Error(`Could not resolve "@emotion/is-prop-valid" imported by "framer-motion". Is it installed?`);
|
|
7836
|
-
}));
|
|
7837
|
-
//#endregion
|
|
7838
|
-
//#region node_modules/framer-motion/dist/es/render/dom/utils/filter-props.mjs
|
|
7839
|
-
var shouldForward = (key) => !isValidMotionProp(key);
|
|
7840
|
-
function loadExternalIsValidProp(isValidProp) {
|
|
7841
|
-
if (typeof isValidProp !== "function") return;
|
|
7842
|
-
shouldForward = (key) => key.startsWith("on") ? !isValidMotionProp(key) : isValidProp(key);
|
|
7843
|
-
}
|
|
7844
|
-
/**
|
|
7845
|
-
* Emotion and Styled Components both allow users to pass through arbitrary props to their components
|
|
7846
|
-
* to dynamically generate CSS. They both use the `@emotion/is-prop-valid` package to determine which
|
|
7847
|
-
* of these should be passed to the underlying DOM node.
|
|
7848
|
-
*
|
|
7849
|
-
* However, when styling a Motion component `styled(motion.div)`, both packages pass through *all* props
|
|
7850
|
-
* as it's seen as an arbitrary component rather than a DOM node. Motion only allows arbitrary props
|
|
7851
|
-
* passed through the `custom` prop so it doesn't *need* the payload or computational overhead of
|
|
7852
|
-
* `@emotion/is-prop-valid`, however to fix this problem we need to use it.
|
|
7853
|
-
*
|
|
7854
|
-
* By making it an optionalDependency we can offer this functionality only in the situations where it's
|
|
7855
|
-
* actually required.
|
|
7856
|
-
*/
|
|
7857
|
-
try {
|
|
7858
|
-
loadExternalIsValidProp((init_is_prop_valid_framer_motion(), __toCommonJS(is_prop_valid_framer_motion_exports)).default);
|
|
7859
|
-
} catch {}
|
|
7860
|
-
function filterProps(props, isDom, forwardMotionProps) {
|
|
7861
|
-
const filteredProps = {};
|
|
7862
|
-
for (const key in props) {
|
|
7863
|
-
/**
|
|
7864
|
-
* values is considered a valid prop by Emotion, so if it's present
|
|
7865
|
-
* this will be rendered out to the DOM unless explicitly filtered.
|
|
7866
|
-
*
|
|
7867
|
-
* We check the type as it could be used with the `feColorMatrix`
|
|
7868
|
-
* element, which we support.
|
|
7869
|
-
*/
|
|
7870
|
-
if (key === "values" && typeof props.values === "object") continue;
|
|
7871
|
-
if (isMotionValue(props[key])) continue;
|
|
7872
|
-
if (shouldForward(key) || forwardMotionProps === true && isValidMotionProp(key) || !isDom && !isValidMotionProp(key) || props["draggable"] && key.startsWith("onDrag")) filteredProps[key] = props[key];
|
|
7873
|
-
}
|
|
7874
|
-
return filteredProps;
|
|
7875
|
-
}
|
|
7876
|
-
//#endregion
|
|
7877
7787
|
//#region node_modules/framer-motion/dist/es/context/MotionContext/index.mjs
|
|
7878
7788
|
var MotionContext = createContext({});
|
|
7879
7789
|
//#endregion
|
|
@@ -7970,6 +7880,79 @@ function useSVGProps(props, visualState, _isStatic, Component) {
|
|
|
7970
7880
|
return visualProps;
|
|
7971
7881
|
}
|
|
7972
7882
|
//#endregion
|
|
7883
|
+
//#region node_modules/framer-motion/dist/es/motion/utils/valid-prop.mjs
|
|
7884
|
+
/**
|
|
7885
|
+
* A list of all valid MotionProps.
|
|
7886
|
+
*
|
|
7887
|
+
* @privateRemarks
|
|
7888
|
+
* This doesn't throw if a `MotionProp` name is missing - it should.
|
|
7889
|
+
*/
|
|
7890
|
+
var validMotionProps = new Set([
|
|
7891
|
+
"animate",
|
|
7892
|
+
"exit",
|
|
7893
|
+
"variants",
|
|
7894
|
+
"initial",
|
|
7895
|
+
"style",
|
|
7896
|
+
"values",
|
|
7897
|
+
"variants",
|
|
7898
|
+
"transition",
|
|
7899
|
+
"transformTemplate",
|
|
7900
|
+
"custom",
|
|
7901
|
+
"inherit",
|
|
7902
|
+
"onBeforeLayoutMeasure",
|
|
7903
|
+
"onAnimationStart",
|
|
7904
|
+
"onAnimationComplete",
|
|
7905
|
+
"onUpdate",
|
|
7906
|
+
"onDragStart",
|
|
7907
|
+
"onDrag",
|
|
7908
|
+
"onDragEnd",
|
|
7909
|
+
"onMeasureDragConstraints",
|
|
7910
|
+
"onDirectionLock",
|
|
7911
|
+
"onDragTransitionEnd",
|
|
7912
|
+
"_dragX",
|
|
7913
|
+
"_dragY",
|
|
7914
|
+
"onHoverStart",
|
|
7915
|
+
"onHoverEnd",
|
|
7916
|
+
"onViewportEnter",
|
|
7917
|
+
"onViewportLeave",
|
|
7918
|
+
"globalTapTarget",
|
|
7919
|
+
"propagate",
|
|
7920
|
+
"ignoreStrict",
|
|
7921
|
+
"viewport"
|
|
7922
|
+
]);
|
|
7923
|
+
/**
|
|
7924
|
+
* Check whether a prop name is a valid `MotionProp` key.
|
|
7925
|
+
*
|
|
7926
|
+
* @param key - Name of the property to check
|
|
7927
|
+
* @returns `true` is key is a valid `MotionProp`.
|
|
7928
|
+
*
|
|
7929
|
+
* @public
|
|
7930
|
+
*/
|
|
7931
|
+
function isValidMotionProp(key) {
|
|
7932
|
+
return key.startsWith("while") || key.startsWith("drag") && key !== "draggable" || key.startsWith("layout") || key.startsWith("onTap") || key.startsWith("onPan") || key.startsWith("onLayout") || validMotionProps.has(key);
|
|
7933
|
+
}
|
|
7934
|
+
//#endregion
|
|
7935
|
+
//#region node_modules/framer-motion/dist/es/render/dom/utils/filter-props.mjs
|
|
7936
|
+
function shouldForward(key, isValidProp) {
|
|
7937
|
+
return key.startsWith("on") ? !isValidMotionProp(key) : isValidProp?.(key) ?? !isValidMotionProp(key);
|
|
7938
|
+
}
|
|
7939
|
+
function filterProps(props, isDom, forwardMotionProps, isValidProp) {
|
|
7940
|
+
const filteredProps = {};
|
|
7941
|
+
for (const key in props) {
|
|
7942
|
+
/**
|
|
7943
|
+
* values is considered a valid prop by Emotion, so if it's present
|
|
7944
|
+
* this will be rendered out to the DOM unless explicitly filtered.
|
|
7945
|
+
*
|
|
7946
|
+
* We check the type as it could be used with the `feColorMatrix`
|
|
7947
|
+
* element, which we support.
|
|
7948
|
+
*/
|
|
7949
|
+
if (key === "values" && typeof props.values === "object") continue;
|
|
7950
|
+
if (isMotionValue(props[key])) continue;
|
|
7951
|
+
if (shouldForward(key, isValidProp) || forwardMotionProps === true && isValidMotionProp(key) || !isDom && !isValidMotionProp(key) || props["draggable"] && key.startsWith("onDrag")) filteredProps[key] = props[key];
|
|
7952
|
+
}
|
|
7953
|
+
return filteredProps;
|
|
7954
|
+
}
|
|
7955
|
+
//#endregion
|
|
7973
7956
|
//#region node_modules/framer-motion/dist/es/render/svg/lowercase-elements.mjs
|
|
7974
7957
|
/**
|
|
7975
7958
|
* We keep these listed separately as we use the lowercase tag names as part
|
|
@@ -8011,9 +7994,9 @@ function isSVGComponent(Component) {
|
|
|
8011
7994
|
}
|
|
8012
7995
|
//#endregion
|
|
8013
7996
|
//#region node_modules/framer-motion/dist/es/render/dom/use-render.mjs
|
|
8014
|
-
function useRender(Component, props, ref, { latestValues }, isStatic, forwardMotionProps = false, isSVG) {
|
|
7997
|
+
function useRender(Component, props, ref, { latestValues }, isStatic, forwardMotionProps = false, isSVG, isValidProp) {
|
|
8015
7998
|
const visualProps = (isSVG ?? isSVGComponent(Component) ? useSVGProps : useHTMLProps)(props, latestValues, isStatic, Component);
|
|
8016
|
-
const filteredProps = filterProps(props, typeof Component === "string", forwardMotionProps);
|
|
7999
|
+
const filteredProps = filterProps(props, typeof Component === "string", forwardMotionProps, isValidProp);
|
|
8017
8000
|
const elementProps = Component !== Fragment ? {
|
|
8018
8001
|
...filteredProps,
|
|
8019
8002
|
...visualProps,
|
|
@@ -8121,14 +8104,15 @@ function useMotionRef(visualState, visualElement, externalRef) {
|
|
|
8121
8104
|
if (instance) visualState.onMount?.(instance);
|
|
8122
8105
|
if (visualElement) instance ? visualElement.mount(instance) : visualElement.unmount();
|
|
8123
8106
|
const ref = externalRefContainer.current;
|
|
8124
|
-
if (typeof ref === "function")
|
|
8125
|
-
|
|
8126
|
-
|
|
8127
|
-
|
|
8128
|
-
refCleanup.current
|
|
8129
|
-
|
|
8130
|
-
|
|
8131
|
-
|
|
8107
|
+
if (typeof ref === "function") {
|
|
8108
|
+
if (instance) {
|
|
8109
|
+
const cleanup = ref(instance);
|
|
8110
|
+
if (typeof cleanup === "function") refCleanup.current = cleanup;
|
|
8111
|
+
} else if (refCleanup.current) {
|
|
8112
|
+
refCleanup.current();
|
|
8113
|
+
refCleanup.current = null;
|
|
8114
|
+
} else ref(instance);
|
|
8115
|
+
} else if (ref) ref.current = instance;
|
|
8132
8116
|
}, [visualElement]);
|
|
8133
8117
|
}
|
|
8134
8118
|
//#endregion
|
|
@@ -8299,7 +8283,7 @@ function createMotionComponent(Component, { forwardMotionProps = false, type } =
|
|
|
8299
8283
|
...props,
|
|
8300
8284
|
layoutId: useLayoutId(props)
|
|
8301
8285
|
};
|
|
8302
|
-
const { isStatic } = configAndProps;
|
|
8286
|
+
const { isStatic, isValidProp } = configAndProps;
|
|
8303
8287
|
const context = useCreateMotionContext(props);
|
|
8304
8288
|
const visualState = useVisualState(props, isStatic);
|
|
8305
8289
|
if (!isStatic && typeof window !== "undefined") {
|
|
@@ -8323,7 +8307,7 @@ function createMotionComponent(Component, { forwardMotionProps = false, type } =
|
|
|
8323
8307
|
children: [MeasureLayout && context.visualElement ? jsx(MeasureLayout, {
|
|
8324
8308
|
visualElement: context.visualElement,
|
|
8325
8309
|
...configAndProps
|
|
8326
|
-
}) : null, useRender(Component, props, useMotionRef(visualState, context.visualElement, externalRef), visualState, isStatic, forwardMotionProps, isSVG)]
|
|
8310
|
+
}) : null, useRender(Component, props, useMotionRef(visualState, context.visualElement, externalRef), visualState, isStatic, forwardMotionProps, isSVG, isValidProp)]
|
|
8327
8311
|
});
|
|
8328
8312
|
}
|
|
8329
8313
|
MotionDOMComponent.displayName = `motion.${typeof Component === "string" ? Component : `create(${Component.displayName ?? Component.name ?? ""})`}`;
|