@eightshift/ui-components 1.3.2 → 1.4.1
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/{Button-DTARR6Ff.js → Button-uYE9D_E3.js} +6 -5
- package/dist/{ColorSwatch-5bZ_yIMB.js → ColorSwatch-Bev-9Vbr.js} +4 -4
- package/dist/{Dialog-DJgS0mAg.js → Dialog-CGE2ficT.js} +17 -15
- package/dist/{FieldError-CviphIN5.js → FieldError-CBPJ4Xx8.js} +2 -2
- package/dist/{FocusScope-BjM5iOQC.js → FocusScope-CVd6C65L.js} +24 -8
- package/dist/{GridList-DjRnMEae.js → GridList-PBJsm70G.js} +156 -116
- package/dist/{Group-BQu67pVS.js → Group-WZgNv9RE.js} +3 -3
- package/dist/Hidden-YSmyVF_5.js +45 -0
- package/dist/{Input-DWRQF0ro.js → Input-CaS4qmLb.js} +10 -9
- package/dist/{Label-BXvY41yE.js → Label-yZgqvhXc.js} +3 -2
- package/dist/ListBox-MZyPpwvj.js +567 -0
- package/dist/{Select-49a62830.esm-BnlXlUnT.js → Select-49a62830.esm-CqLHaIei.js} +1 -1
- package/dist/{SelectionManager-JxXmb3-k.js → SelectionManager-CvRaua4m.js} +1580 -1484
- package/dist/{Separator-CX64zwq8.js → Separator-C7Few7L6.js} +80 -62
- package/dist/{Slider-Clme2C36.js → Slider-D8a63VhT.js} +14 -12
- package/dist/{Text-qjognpzK.js → Text-D8qh3_U7.js} +1 -1
- package/dist/{VisuallyHidden-BZPezMV5.js → VisuallyHidden-DD480kAb.js} +2 -2
- package/dist/_commonjsHelpers-CUmg6egw.js +6 -0
- package/dist/{ariaHideOutside-BZ5z6iCD.js → ariaHideOutside-BzxkODNq.js} +1 -9
- package/dist/assets/style.css +1 -1
- package/dist/assets/wp-ui-enhancements.css +1 -1
- package/dist/components/animated-visibility/animated-visibility.js +311 -198
- package/dist/components/base-control/base-control.js +1 -1
- package/dist/components/button/button.js +274 -9
- package/dist/components/checkbox/checkbox.js +171 -1
- package/dist/components/color-pickers/color-picker.js +1 -1
- package/dist/components/color-pickers/color-swatch.js +3 -3
- package/dist/components/color-pickers/gradient-editor.js +3 -3
- package/dist/components/color-pickers/solid-color-picker.js +46 -32
- package/dist/components/component-toggle/component-toggle.js +2 -2
- package/dist/components/container-panel/container-panel.js +2 -2
- package/dist/components/draggable-list/draggable-list-item.js +3 -3
- package/dist/components/draggable-list/draggable-list.js +3671 -6
- package/dist/components/expandable/expandable.js +7 -4
- package/dist/components/index.js +4 -4
- package/dist/components/input-field/input-field.js +7 -7
- package/dist/components/link-input/link-input.js +1519 -489
- package/dist/components/list-box/list-box.js +2 -2
- package/dist/components/matrix-align/matrix-align.js +3 -3
- package/dist/components/menu/menu.js +164 -466
- package/dist/components/modal/modal.js +7 -7
- package/dist/components/number-picker/number-picker.js +22 -17
- package/dist/components/option-select/option-select.js +2 -2
- package/dist/components/placeholders/file-placeholder.js +1 -1
- package/dist/components/popover/popover.js +3 -3
- package/dist/components/radio/radio.js +13 -13
- package/dist/components/repeater/repeater-context.js +5 -0
- package/dist/components/repeater/repeater-item.js +46 -91
- package/dist/components/repeater/repeater.js +5130 -175
- package/dist/components/responsive/responsive-legacy.js +3 -3
- package/dist/components/responsive/responsive.js +3 -3
- package/dist/components/responsive-preview/responsive-preview.js +1 -1
- package/dist/components/select/async-multi-select.js +3 -3
- package/dist/components/select/async-single-select.js +2 -2
- package/dist/components/select/custom-select-default-components.js +1 -1
- package/dist/components/select/multi-select-components.js +1 -1
- package/dist/components/select/multi-select.js +5 -5
- package/dist/components/select/react-select-component-wrappers.js +1 -1
- package/dist/components/select/single-select.js +2 -2
- package/dist/components/select/styles.js +1 -1
- package/dist/components/slider/column-config-slider.js +3 -3
- package/dist/components/slider/slider.js +3 -3
- package/dist/components/slider/utils.js +1 -1
- package/dist/components/tabs/tabs.js +46 -71
- package/dist/components/toggle/switch.js +6 -6
- package/dist/components/toggle/toggle.js +1 -1
- package/dist/components/toggle-button/toggle-button.js +7 -7
- package/dist/components/tooltip/tooltip.js +3 -3
- package/dist/{context-BG_1RnbC.js → context-Bon2Gyx5.js} +1 -1
- package/dist/{default-i18n-BqwLkgZv.js → default-i18n-BqWys-1G.js} +1 -1
- package/dist/{focusSafely-DGZ4R5fj.js → focusSafely-PMGZgZ9-.js} +33 -26
- package/dist/getScrollParent-B3XgpXBL.js +10 -0
- package/dist/icons/icons.js +205 -0
- package/dist/icons/jsx-svg.js +2 -2
- package/dist/{index-CAPcSs9K.js → index-BTCzc3zb.js} +1 -1
- package/dist/{index-a301f526.esm-ByOfDxiG.js → index-a301f526.esm-B9tWL9yi.js} +80 -603
- package/dist/index.js +4 -4
- package/dist/{intlStrings-CkuKCPkT.js → intlStrings-KQxgp5tS.js} +14 -9
- package/dist/{multi-select-components-7vKCF8dG.js → multi-select-components-DTvEidE3.js} +1 -1
- package/dist/react-jsx-parser.min-CAGfntg1.js +13425 -0
- package/dist/{react-select-async.esm-5zW9Dv9E.js → react-select-async.esm-8Rba_3KV.js} +3 -3
- package/dist/{react-select.esm-Bi6uzjbT.js → react-select.esm-DkSeQzOP.js} +3 -3
- package/dist/{textSelection-BLyBtNe2.js → textSelection-DS7-670U.js} +1 -1
- package/dist/{tooltip-DSk8I1SO.js → tooltip-C9mg1CP5.js} +54 -18
- package/dist/{useButton-EJ9c8fmq.js → useButton-BPY4yXUo.js} +3 -3
- package/dist/{useEvent-Cxq_BzP_.js → useEvent-DDLT851Z.js} +1 -1
- package/dist/{useFocusRing-Dg5Y_10S.js → useFocusRing-DsxEaA2J.js} +1 -1
- package/dist/{useFocusable-CQZyQp4q.js → useFocusable-BFKHuYS9.js} +2 -2
- package/dist/{useFormReset-DJMtIgSL.js → useFormReset-BCPbwfnH.js} +1 -1
- package/dist/{useFormValidationState-DDC_nImg.js → useFormValidationState-DC5jbhBW.js} +2 -2
- package/dist/{useHasTabbableChild-M3O3VIil.js → useHasTabbableChild-Byd7ylXD.js} +2 -2
- package/dist/{useLabel-6NqYraET.js → useLabel-DuJhImKc.js} +2 -2
- package/dist/{useLabels-D2RG7TdI.js → useLabels-JaBafrnV.js} +1 -1
- package/dist/{useListData-BpYQj7kK.js → useListData-B5Pk32vd.js} +6 -3
- package/dist/{useListState-IllYYnXV.js → useListState-Csx05BmT.js} +6 -3
- package/dist/{useLocalizedStringFormatter-Cwm_siat.js → useLocalizedStringFormatter-CVIIVTgz.js} +1 -1
- package/dist/useMenuTrigger-CMgzyMKW.js +246 -0
- package/dist/{useNumberFieldState-CVJOJnF1.js → useNumberFieldState-BVFqhboT.js} +12 -11
- package/dist/{useNumberFormatter-DVZRQXk3.js → useNumberFormatter-BEeBSV-N.js} +1 -1
- package/dist/{usePress-CiXj8dLE.js → usePress-CY8MpqYD.js} +58 -16
- package/dist/useSingleSelectListState-CzZUgAt0.js +37 -0
- package/dist/{useToggle-CV-IX6nL.js → useToggle-CJp2Fh_L.js} +4 -4
- package/dist/{useToggleState-DHIdITtQ.js → useToggleState-B4--Ski0.js} +1 -1
- package/dist/{utils-DC-UMp1n.js → utils-B4IdLYb8.js} +48 -85
- package/package.json +24 -21
- package/dist/Checkbox-CiJIVbAP.js +0 -174
- package/dist/ListBox-DTKMdjQC.js +0 -4216
- package/dist/_commonjsHelpers-DWwsNxpa.js +0 -8
- package/dist/button-IxfzzzbP.js +0 -277
- package/dist/react-jsx-parser.min-DhrYeqLL.js +0 -4563
|
@@ -8,7 +8,7 @@ const MotionConfigContext = createContext({
|
|
|
8
8
|
});
|
|
9
9
|
const MotionContext = createContext({});
|
|
10
10
|
const PresenceContext = createContext(null);
|
|
11
|
-
const isBrowser = typeof
|
|
11
|
+
const isBrowser = typeof window !== "undefined";
|
|
12
12
|
const useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect : useEffect;
|
|
13
13
|
const LazyContext = createContext({ strict: false });
|
|
14
14
|
const camelToDash = (str) => str.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase();
|
|
@@ -18,37 +18,24 @@ const MotionGlobalConfig = {
|
|
|
18
18
|
skipAnimations: false,
|
|
19
19
|
useManualTiming: false
|
|
20
20
|
};
|
|
21
|
-
class Queue {
|
|
22
|
-
constructor() {
|
|
23
|
-
this.order = [];
|
|
24
|
-
this.scheduled = /* @__PURE__ */ new Set();
|
|
25
|
-
}
|
|
26
|
-
add(process2) {
|
|
27
|
-
if (!this.scheduled.has(process2)) {
|
|
28
|
-
this.scheduled.add(process2);
|
|
29
|
-
this.order.push(process2);
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
remove(process2) {
|
|
34
|
-
const index = this.order.indexOf(process2);
|
|
35
|
-
if (index !== -1) {
|
|
36
|
-
this.order.splice(index, 1);
|
|
37
|
-
this.scheduled.delete(process2);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
clear() {
|
|
41
|
-
this.order.length = 0;
|
|
42
|
-
this.scheduled.clear();
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
21
|
function createRenderStep(runNextFrame) {
|
|
46
|
-
let thisFrame = new
|
|
47
|
-
let nextFrame = new
|
|
48
|
-
let numToRun = 0;
|
|
22
|
+
let thisFrame = /* @__PURE__ */ new Set();
|
|
23
|
+
let nextFrame = /* @__PURE__ */ new Set();
|
|
49
24
|
let isProcessing = false;
|
|
50
25
|
let flushNextFrame = false;
|
|
51
26
|
const toKeepAlive = /* @__PURE__ */ new WeakSet();
|
|
27
|
+
let latestFrameData = {
|
|
28
|
+
delta: 0,
|
|
29
|
+
timestamp: 0,
|
|
30
|
+
isProcessing: false
|
|
31
|
+
};
|
|
32
|
+
function triggerCallback(callback) {
|
|
33
|
+
if (toKeepAlive.has(callback)) {
|
|
34
|
+
step.schedule(callback);
|
|
35
|
+
runNextFrame();
|
|
36
|
+
}
|
|
37
|
+
callback(latestFrameData);
|
|
38
|
+
}
|
|
52
39
|
const step = {
|
|
53
40
|
/**
|
|
54
41
|
* Schedule a process to run on the next frame.
|
|
@@ -58,22 +45,22 @@ function createRenderStep(runNextFrame) {
|
|
|
58
45
|
const queue = addToCurrentFrame ? thisFrame : nextFrame;
|
|
59
46
|
if (keepAlive)
|
|
60
47
|
toKeepAlive.add(callback);
|
|
61
|
-
if (queue.
|
|
62
|
-
|
|
63
|
-
}
|
|
48
|
+
if (!queue.has(callback))
|
|
49
|
+
queue.add(callback);
|
|
64
50
|
return callback;
|
|
65
51
|
},
|
|
66
52
|
/**
|
|
67
53
|
* Cancel the provided callback from running on the next frame.
|
|
68
54
|
*/
|
|
69
55
|
cancel: (callback) => {
|
|
70
|
-
nextFrame.
|
|
56
|
+
nextFrame.delete(callback);
|
|
71
57
|
toKeepAlive.delete(callback);
|
|
72
58
|
},
|
|
73
59
|
/**
|
|
74
60
|
* Execute all schedule callbacks.
|
|
75
61
|
*/
|
|
76
62
|
process: (frameData2) => {
|
|
63
|
+
latestFrameData = frameData2;
|
|
77
64
|
if (isProcessing) {
|
|
78
65
|
flushNextFrame = true;
|
|
79
66
|
return;
|
|
@@ -81,17 +68,7 @@ function createRenderStep(runNextFrame) {
|
|
|
81
68
|
isProcessing = true;
|
|
82
69
|
[thisFrame, nextFrame] = [nextFrame, thisFrame];
|
|
83
70
|
nextFrame.clear();
|
|
84
|
-
|
|
85
|
-
if (numToRun) {
|
|
86
|
-
for (let i = 0; i < numToRun; i++) {
|
|
87
|
-
const callback = thisFrame.order[i];
|
|
88
|
-
if (toKeepAlive.has(callback)) {
|
|
89
|
-
step.schedule(callback);
|
|
90
|
-
runNextFrame();
|
|
91
|
-
}
|
|
92
|
-
callback(frameData2);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
71
|
+
thisFrame.forEach(triggerCallback);
|
|
95
72
|
isProcessing = false;
|
|
96
73
|
if (flushNextFrame) {
|
|
97
74
|
flushNextFrame = false;
|
|
@@ -124,20 +101,24 @@ function createRenderBatcher(scheduleNextBatch, allowKeepAlive) {
|
|
|
124
101
|
timestamp: 0,
|
|
125
102
|
isProcessing: false
|
|
126
103
|
};
|
|
104
|
+
const flagRunNextFrame = () => runNextFrame = true;
|
|
127
105
|
const steps2 = stepsOrder.reduce((acc, key) => {
|
|
128
|
-
acc[key] = createRenderStep(
|
|
106
|
+
acc[key] = createRenderStep(flagRunNextFrame);
|
|
129
107
|
return acc;
|
|
130
108
|
}, {});
|
|
131
|
-
const
|
|
132
|
-
steps2[stepId].process(state);
|
|
133
|
-
};
|
|
109
|
+
const { read, resolveKeyframes, update, preRender, render, postRender } = steps2;
|
|
134
110
|
const processBatch = () => {
|
|
135
111
|
const timestamp = performance.now();
|
|
136
112
|
runNextFrame = false;
|
|
137
113
|
state.delta = useDefaultElapsed ? 1e3 / 60 : Math.max(Math.min(timestamp - state.timestamp, maxElapsed), 1);
|
|
138
114
|
state.timestamp = timestamp;
|
|
139
115
|
state.isProcessing = true;
|
|
140
|
-
|
|
116
|
+
read.process(state);
|
|
117
|
+
resolveKeyframes.process(state);
|
|
118
|
+
update.process(state);
|
|
119
|
+
preRender.process(state);
|
|
120
|
+
render.process(state);
|
|
121
|
+
postRender.process(state);
|
|
141
122
|
state.isProcessing = false;
|
|
142
123
|
if (runNextFrame && allowKeepAlive) {
|
|
143
124
|
useDefaultElapsed = false;
|
|
@@ -160,7 +141,11 @@ function createRenderBatcher(scheduleNextBatch, allowKeepAlive) {
|
|
|
160
141
|
};
|
|
161
142
|
return acc;
|
|
162
143
|
}, {});
|
|
163
|
-
const cancel = (process2) =>
|
|
144
|
+
const cancel = (process2) => {
|
|
145
|
+
for (let i = 0; i < stepsOrder.length; i++) {
|
|
146
|
+
steps2[stepsOrder[i]].cancel(process2);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
164
149
|
return { schedule, cancel, state, steps: steps2 };
|
|
165
150
|
}
|
|
166
151
|
const { schedule: microtask, cancel: cancelMicrotask } = createRenderBatcher(queueMicrotask, false);
|
|
@@ -231,7 +216,6 @@ function createProjectionNode$1(visualElement, props, ProjectionNodeConstructor,
|
|
|
231
216
|
layout: layout2,
|
|
232
217
|
alwaysMeasureLayout: Boolean(drag2) || dragConstraints && isRefObject(dragConstraints),
|
|
233
218
|
visualElement,
|
|
234
|
-
scheduleRender: () => visualElement.scheduleRender(),
|
|
235
219
|
/**
|
|
236
220
|
* TODO: Update options in an effect. This could be tricky as it'll be too late
|
|
237
221
|
* to update by the time layout animations run.
|
|
@@ -521,7 +505,7 @@ const translateAlias = {
|
|
|
521
505
|
transformPerspective: "perspective"
|
|
522
506
|
};
|
|
523
507
|
const numTransforms = transformPropOrder.length;
|
|
524
|
-
function buildTransform(transform,
|
|
508
|
+
function buildTransform(transform, transformIsDefault, transformTemplate) {
|
|
525
509
|
let transformString = "";
|
|
526
510
|
for (let i = 0; i < numTransforms; i++) {
|
|
527
511
|
const key = transformPropOrder[i];
|
|
@@ -530,13 +514,10 @@ function buildTransform(transform, { enableHardwareAcceleration = true, allowTra
|
|
|
530
514
|
transformString += `${transformName}(${transform[key]}) `;
|
|
531
515
|
}
|
|
532
516
|
}
|
|
533
|
-
if (enableHardwareAcceleration && !transform.z) {
|
|
534
|
-
transformString += "translateZ(0)";
|
|
535
|
-
}
|
|
536
517
|
transformString = transformString.trim();
|
|
537
518
|
if (transformTemplate) {
|
|
538
519
|
transformString = transformTemplate(transform, transformIsDefault ? "" : transformString);
|
|
539
|
-
} else if (
|
|
520
|
+
} else if (transformIsDefault) {
|
|
540
521
|
transformString = "none";
|
|
541
522
|
}
|
|
542
523
|
return transformString;
|
|
@@ -581,6 +562,9 @@ const singleColorRegex = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){
|
|
|
581
562
|
function isString(v) {
|
|
582
563
|
return typeof v === "string";
|
|
583
564
|
}
|
|
565
|
+
function isNullish(v) {
|
|
566
|
+
return v == null;
|
|
567
|
+
}
|
|
584
568
|
const createUnitType = (unit) => ({
|
|
585
569
|
test: (v) => isString(v) && v.endsWith(unit) && v.split(" ").length === 1,
|
|
586
570
|
parse: parseFloat,
|
|
@@ -668,7 +652,7 @@ const numberValueTypes = {
|
|
|
668
652
|
strokeOpacity: alpha,
|
|
669
653
|
numOctaves: int
|
|
670
654
|
};
|
|
671
|
-
function buildHTMLStyles(state, latestValues,
|
|
655
|
+
function buildHTMLStyles(state, latestValues, transformTemplate) {
|
|
672
656
|
const { style, vars, transform, transformOrigin } = state;
|
|
673
657
|
let hasTransform2 = false;
|
|
674
658
|
let hasTransformOrigin = false;
|
|
@@ -697,7 +681,7 @@ function buildHTMLStyles(state, latestValues, options, transformTemplate) {
|
|
|
697
681
|
}
|
|
698
682
|
if (!latestValues.transform) {
|
|
699
683
|
if (hasTransform2 || transformTemplate) {
|
|
700
|
-
style.transform = buildTransform(state.transform,
|
|
684
|
+
style.transform = buildTransform(state.transform, transformIsNone, transformTemplate);
|
|
701
685
|
} else if (style.transform) {
|
|
702
686
|
style.transform = "none";
|
|
703
687
|
}
|
|
@@ -720,23 +704,23 @@ function copyRawValuesOnly(target, source, props) {
|
|
|
720
704
|
}
|
|
721
705
|
}
|
|
722
706
|
}
|
|
723
|
-
function useInitialMotionValues({ transformTemplate }, visualState
|
|
707
|
+
function useInitialMotionValues({ transformTemplate }, visualState) {
|
|
724
708
|
return useMemo(() => {
|
|
725
709
|
const state = createHtmlRenderState();
|
|
726
|
-
buildHTMLStyles(state, visualState,
|
|
710
|
+
buildHTMLStyles(state, visualState, transformTemplate);
|
|
727
711
|
return Object.assign({}, state.vars, state.style);
|
|
728
712
|
}, [visualState]);
|
|
729
713
|
}
|
|
730
|
-
function useStyle(props, visualState
|
|
714
|
+
function useStyle(props, visualState) {
|
|
731
715
|
const styleProp = props.style || {};
|
|
732
716
|
const style = {};
|
|
733
717
|
copyRawValuesOnly(style, styleProp, props);
|
|
734
|
-
Object.assign(style, useInitialMotionValues(props, visualState
|
|
718
|
+
Object.assign(style, useInitialMotionValues(props, visualState));
|
|
735
719
|
return style;
|
|
736
720
|
}
|
|
737
|
-
function useHTMLProps(props, visualState
|
|
721
|
+
function useHTMLProps(props, visualState) {
|
|
738
722
|
const htmlProps = {};
|
|
739
|
-
const style = useStyle(props, visualState
|
|
723
|
+
const style = useStyle(props, visualState);
|
|
740
724
|
if (props.drag && props.dragListener !== false) {
|
|
741
725
|
htmlProps.draggable = false;
|
|
742
726
|
style.userSelect = style.WebkitUserSelect = style.WebkitTouchCallout = "none";
|
|
@@ -840,8 +824,8 @@ function buildSVGAttrs(state, {
|
|
|
840
824
|
pathOffset = 0,
|
|
841
825
|
// This is object creation, which we try to avoid per-frame.
|
|
842
826
|
...latest
|
|
843
|
-
},
|
|
844
|
-
buildHTMLStyles(state, latest,
|
|
827
|
+
}, isSVGTag2, transformTemplate) {
|
|
828
|
+
buildHTMLStyles(state, latest, transformTemplate);
|
|
845
829
|
if (isSVGTag2) {
|
|
846
830
|
if (state.style.viewBox) {
|
|
847
831
|
state.attrs.viewBox = state.style.viewBox;
|
|
@@ -877,7 +861,7 @@ const isSVGTag = (tag) => typeof tag === "string" && tag.toLowerCase() === "svg"
|
|
|
877
861
|
function useSVGProps(props, visualState, _isStatic, Component2) {
|
|
878
862
|
const visualProps = useMemo(() => {
|
|
879
863
|
const state = createSvgRenderState();
|
|
880
|
-
buildSVGAttrs(state, visualState,
|
|
864
|
+
buildSVGAttrs(state, visualState, isSVGTag(Component2), props.transformTemplate);
|
|
881
865
|
return {
|
|
882
866
|
...state.attrs,
|
|
883
867
|
style: { ...state.style }
|
|
@@ -951,6 +935,9 @@ function scrapeMotionValuesFromProps$1(props, prevProps, visualElement) {
|
|
|
951
935
|
newValues[key] = style[key];
|
|
952
936
|
}
|
|
953
937
|
}
|
|
938
|
+
if (visualElement && style && typeof style.willChange === "string") {
|
|
939
|
+
visualElement.applyWillChange = false;
|
|
940
|
+
}
|
|
954
941
|
return newValues;
|
|
955
942
|
}
|
|
956
943
|
function scrapeMotionValuesFromProps(props, prevProps, visualElement) {
|
|
@@ -1005,9 +992,34 @@ function resolveMotionValue(value) {
|
|
|
1005
992
|
const unwrappedValue = isMotionValue(value) ? value.get() : value;
|
|
1006
993
|
return isCustomValue(unwrappedValue) ? unwrappedValue.toValue() : unwrappedValue;
|
|
1007
994
|
}
|
|
1008
|
-
|
|
995
|
+
const acceleratedValues = /* @__PURE__ */ new Set([
|
|
996
|
+
"opacity",
|
|
997
|
+
"clipPath",
|
|
998
|
+
"filter",
|
|
999
|
+
"transform"
|
|
1000
|
+
// TODO: Can be accelerated but currently disabled until https://issues.chromium.org/issues/41491098 is resolved
|
|
1001
|
+
// or until we implement support for linear() easing.
|
|
1002
|
+
// "background-color"
|
|
1003
|
+
]);
|
|
1004
|
+
function getWillChangeName(name) {
|
|
1005
|
+
if (transformProps.has(name)) {
|
|
1006
|
+
return "transform";
|
|
1007
|
+
} else if (acceleratedValues.has(name)) {
|
|
1008
|
+
return camelToDash(name);
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
function addUniqueItem(arr, item) {
|
|
1012
|
+
if (arr.indexOf(item) === -1)
|
|
1013
|
+
arr.push(item);
|
|
1014
|
+
}
|
|
1015
|
+
function removeItem(arr, item) {
|
|
1016
|
+
const index = arr.indexOf(item);
|
|
1017
|
+
if (index > -1)
|
|
1018
|
+
arr.splice(index, 1);
|
|
1019
|
+
}
|
|
1020
|
+
function makeState({ applyWillChange = false, scrapeMotionValuesFromProps: scrapeMotionValuesFromProps2, createRenderState, onMount }, props, context, presenceContext, isStatic) {
|
|
1009
1021
|
const state = {
|
|
1010
|
-
latestValues: makeLatestValues(props, context, presenceContext, scrapeMotionValuesFromProps2),
|
|
1022
|
+
latestValues: makeLatestValues(props, context, presenceContext, isStatic ? false : applyWillChange, scrapeMotionValuesFromProps2),
|
|
1011
1023
|
renderState: createRenderState()
|
|
1012
1024
|
};
|
|
1013
1025
|
if (onMount) {
|
|
@@ -1018,11 +1030,30 @@ function makeState({ scrapeMotionValuesFromProps: scrapeMotionValuesFromProps2,
|
|
|
1018
1030
|
const makeUseVisualState = (config) => (props, isStatic) => {
|
|
1019
1031
|
const context = useContext(MotionContext);
|
|
1020
1032
|
const presenceContext = useContext(PresenceContext);
|
|
1021
|
-
const make = () => makeState(config, props, context, presenceContext);
|
|
1033
|
+
const make = () => makeState(config, props, context, presenceContext, isStatic);
|
|
1022
1034
|
return isStatic ? make() : useConstant(make);
|
|
1023
1035
|
};
|
|
1024
|
-
function
|
|
1036
|
+
function addWillChange(willChange, name) {
|
|
1037
|
+
const memberName = getWillChangeName(name);
|
|
1038
|
+
if (memberName) {
|
|
1039
|
+
addUniqueItem(willChange, memberName);
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
function forEachDefinition(props, definition, callback) {
|
|
1043
|
+
const list = Array.isArray(definition) ? definition : [definition];
|
|
1044
|
+
for (let i = 0; i < list.length; i++) {
|
|
1045
|
+
const resolved = resolveVariantFromProps(props, list[i]);
|
|
1046
|
+
if (resolved) {
|
|
1047
|
+
const { transitionEnd, transition, ...target } = resolved;
|
|
1048
|
+
callback(target, transitionEnd);
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
function makeLatestValues(props, context, presenceContext, shouldApplyWillChange, scrapeMotionValues) {
|
|
1053
|
+
var _a;
|
|
1025
1054
|
const values = {};
|
|
1055
|
+
const willChange = [];
|
|
1056
|
+
const applyWillChange = shouldApplyWillChange && ((_a = props.style) === null || _a === void 0 ? void 0 : _a.willChange) === void 0;
|
|
1026
1057
|
const motionValues = scrapeMotionValues(props, {});
|
|
1027
1058
|
for (const key in motionValues) {
|
|
1028
1059
|
values[key] = resolveMotionValue(motionValues[key]);
|
|
@@ -1040,12 +1071,7 @@ function makeLatestValues(props, context, presenceContext, scrapeMotionValues) {
|
|
|
1040
1071
|
isInitialAnimationBlocked = isInitialAnimationBlocked || initial === false;
|
|
1041
1072
|
const variantToSet = isInitialAnimationBlocked ? animate : initial;
|
|
1042
1073
|
if (variantToSet && typeof variantToSet !== "boolean" && !isAnimationControls(variantToSet)) {
|
|
1043
|
-
|
|
1044
|
-
list.forEach((definition) => {
|
|
1045
|
-
const resolved = resolveVariantFromProps(props, definition);
|
|
1046
|
-
if (!resolved)
|
|
1047
|
-
return;
|
|
1048
|
-
const { transitionEnd, transition, ...target } = resolved;
|
|
1074
|
+
forEachDefinition(props, variantToSet, (target, transitionEnd) => {
|
|
1049
1075
|
for (const key in target) {
|
|
1050
1076
|
let valueTarget = target[key];
|
|
1051
1077
|
if (Array.isArray(valueTarget)) {
|
|
@@ -1056,10 +1082,23 @@ function makeLatestValues(props, context, presenceContext, scrapeMotionValues) {
|
|
|
1056
1082
|
values[key] = valueTarget;
|
|
1057
1083
|
}
|
|
1058
1084
|
}
|
|
1059
|
-
for (const key in transitionEnd)
|
|
1085
|
+
for (const key in transitionEnd) {
|
|
1060
1086
|
values[key] = transitionEnd[key];
|
|
1087
|
+
}
|
|
1061
1088
|
});
|
|
1062
1089
|
}
|
|
1090
|
+
if (applyWillChange) {
|
|
1091
|
+
if (animate && initial !== false && !isAnimationControls(animate)) {
|
|
1092
|
+
forEachDefinition(props, animate, (target) => {
|
|
1093
|
+
for (const key in target) {
|
|
1094
|
+
addWillChange(willChange, key);
|
|
1095
|
+
}
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1098
|
+
if (willChange.length) {
|
|
1099
|
+
values.willChange = willChange.join(",");
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1063
1102
|
return values;
|
|
1064
1103
|
}
|
|
1065
1104
|
const { schedule: frame, cancel: cancelFrame, state: frameData, steps } = createRenderBatcher(typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame : noop, true);
|
|
@@ -1081,7 +1120,7 @@ const svgMotionConfig = {
|
|
|
1081
1120
|
}
|
|
1082
1121
|
});
|
|
1083
1122
|
frame.render(() => {
|
|
1084
|
-
buildSVGAttrs(renderState, latestValues,
|
|
1123
|
+
buildSVGAttrs(renderState, latestValues, isSVGTag(instance.tagName), props.transformTemplate);
|
|
1085
1124
|
renderSVG(instance, renderState);
|
|
1086
1125
|
});
|
|
1087
1126
|
}
|
|
@@ -1089,6 +1128,7 @@ const svgMotionConfig = {
|
|
|
1089
1128
|
};
|
|
1090
1129
|
const htmlMotionConfig = {
|
|
1091
1130
|
useVisualState: makeUseVisualState({
|
|
1131
|
+
applyWillChange: true,
|
|
1092
1132
|
scrapeMotionValuesFromProps: scrapeMotionValuesFromProps$1,
|
|
1093
1133
|
createRenderState: createHtmlRenderState
|
|
1094
1134
|
})
|
|
@@ -1755,7 +1795,7 @@ class KeyframeResolver {
|
|
|
1755
1795
|
}
|
|
1756
1796
|
}
|
|
1757
1797
|
const isColorString = (type, testProp) => (v) => {
|
|
1758
|
-
return Boolean(isString(v) && singleColorRegex.test(v) && v.startsWith(type) || testProp && Object.prototype.hasOwnProperty.call(v, testProp));
|
|
1798
|
+
return Boolean(isString(v) && singleColorRegex.test(v) && v.startsWith(type) || testProp && !isNullish(v) && Object.prototype.hasOwnProperty.call(v, testProp));
|
|
1759
1799
|
};
|
|
1760
1800
|
const splitColor = (aName, bName, cName) => (v) => {
|
|
1761
1801
|
if (!isString(v))
|
|
@@ -3032,19 +3072,10 @@ function animateStyle(element, valueName, keyframes2, { delay: delay2 = 0, durat
|
|
|
3032
3072
|
});
|
|
3033
3073
|
}
|
|
3034
3074
|
const supportsWaapi = memo(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
|
|
3035
|
-
const acceleratedValues = /* @__PURE__ */ new Set([
|
|
3036
|
-
"opacity",
|
|
3037
|
-
"clipPath",
|
|
3038
|
-
"filter",
|
|
3039
|
-
"transform"
|
|
3040
|
-
// TODO: Can be accelerated but currently disabled until https://issues.chromium.org/issues/41491098 is resolved
|
|
3041
|
-
// or until we implement support for linear() easing.
|
|
3042
|
-
// "background-color"
|
|
3043
|
-
]);
|
|
3044
3075
|
const sampleDelta = 10;
|
|
3045
3076
|
const maxDuration = 2e4;
|
|
3046
3077
|
function requiresPregeneratedKeyframes(options) {
|
|
3047
|
-
return options.type === "spring" ||
|
|
3078
|
+
return options.type === "spring" || !isWaapiSupportedEasing(options.ease);
|
|
3048
3079
|
}
|
|
3049
3080
|
function pregenerateKeyframes(keyframes2, options) {
|
|
3050
3081
|
const sampleAnimation = new MainThreadAnimation({
|
|
@@ -3221,6 +3252,8 @@ class AcceleratedAnimation extends BaseAnimation {
|
|
|
3221
3252
|
const sampleTime = secondsToMilliseconds(this.time);
|
|
3222
3253
|
motionValue2.setWithVelocity(sampleAnimation.sample(sampleTime - sampleDelta).value, sampleAnimation.sample(sampleTime).value, sampleDelta);
|
|
3223
3254
|
}
|
|
3255
|
+
const { onStop } = this.options;
|
|
3256
|
+
onStop && onStop();
|
|
3224
3257
|
this.cancel();
|
|
3225
3258
|
}
|
|
3226
3259
|
complete() {
|
|
@@ -3332,7 +3365,7 @@ class GroupPlaybackControls {
|
|
|
3332
3365
|
this.runAll("complete");
|
|
3333
3366
|
}
|
|
3334
3367
|
}
|
|
3335
|
-
const animateMotionValue = (name, value, target, transition = {}, element, isHandoff) => (onComplete) => {
|
|
3368
|
+
const animateMotionValue = (name, value, target, transition = {}, element, isHandoff, onEnd) => (onComplete) => {
|
|
3336
3369
|
const valueTransition = getValueTransition(transition, name) || {};
|
|
3337
3370
|
const delay2 = valueTransition.delay || transition.delay || 0;
|
|
3338
3371
|
let { elapsed = 0 } = transition;
|
|
@@ -3350,7 +3383,9 @@ const animateMotionValue = (name, value, target, transition = {}, element, isHan
|
|
|
3350
3383
|
onComplete: () => {
|
|
3351
3384
|
onComplete();
|
|
3352
3385
|
valueTransition.onComplete && valueTransition.onComplete();
|
|
3386
|
+
onEnd && onEnd();
|
|
3353
3387
|
},
|
|
3388
|
+
onStop: onEnd,
|
|
3354
3389
|
name,
|
|
3355
3390
|
motionValue: value,
|
|
3356
3391
|
element: isHandoff ? void 0 : element
|
|
@@ -3393,18 +3428,6 @@ const animateMotionValue = (name, value, target, transition = {}, element, isHan
|
|
|
3393
3428
|
return new MainThreadAnimation(options);
|
|
3394
3429
|
}
|
|
3395
3430
|
};
|
|
3396
|
-
function isWillChangeMotionValue(value) {
|
|
3397
|
-
return Boolean(isMotionValue(value) && value.add);
|
|
3398
|
-
}
|
|
3399
|
-
function addUniqueItem(arr, item) {
|
|
3400
|
-
if (arr.indexOf(item) === -1)
|
|
3401
|
-
arr.push(item);
|
|
3402
|
-
}
|
|
3403
|
-
function removeItem(arr, item) {
|
|
3404
|
-
const index = arr.indexOf(item);
|
|
3405
|
-
if (index > -1)
|
|
3406
|
-
arr.splice(index, 1);
|
|
3407
|
-
}
|
|
3408
3431
|
class SubscriptionManager {
|
|
3409
3432
|
constructor() {
|
|
3410
3433
|
this.subscriptions = [];
|
|
@@ -3454,7 +3477,7 @@ class MotionValue {
|
|
|
3454
3477
|
* @internal
|
|
3455
3478
|
*/
|
|
3456
3479
|
constructor(init, options = {}) {
|
|
3457
|
-
this.version = "11.
|
|
3480
|
+
this.version = "11.3.17";
|
|
3458
3481
|
this.canTrackVelocity = null;
|
|
3459
3482
|
this.events = {};
|
|
3460
3483
|
this.updateAndNotify = (v, render = true) => {
|
|
@@ -3725,6 +3748,55 @@ function setTarget(visualElement, definition) {
|
|
|
3725
3748
|
function getOptimisedAppearId(visualElement) {
|
|
3726
3749
|
return visualElement.getProps()[optimizedAppearDataAttribute];
|
|
3727
3750
|
}
|
|
3751
|
+
class WillChangeMotionValue extends MotionValue {
|
|
3752
|
+
constructor() {
|
|
3753
|
+
super(...arguments);
|
|
3754
|
+
this.output = [];
|
|
3755
|
+
this.counts = /* @__PURE__ */ new Map();
|
|
3756
|
+
}
|
|
3757
|
+
add(name) {
|
|
3758
|
+
const styleName = getWillChangeName(name);
|
|
3759
|
+
if (!styleName)
|
|
3760
|
+
return;
|
|
3761
|
+
const prevCount = this.counts.get(styleName) || 0;
|
|
3762
|
+
this.counts.set(styleName, prevCount + 1);
|
|
3763
|
+
if (prevCount === 0) {
|
|
3764
|
+
this.output.push(styleName);
|
|
3765
|
+
this.update();
|
|
3766
|
+
}
|
|
3767
|
+
let hasRemoved = false;
|
|
3768
|
+
return () => {
|
|
3769
|
+
if (hasRemoved)
|
|
3770
|
+
return;
|
|
3771
|
+
hasRemoved = true;
|
|
3772
|
+
const newCount = this.counts.get(styleName) - 1;
|
|
3773
|
+
this.counts.set(styleName, newCount);
|
|
3774
|
+
if (newCount === 0) {
|
|
3775
|
+
removeItem(this.output, styleName);
|
|
3776
|
+
this.update();
|
|
3777
|
+
}
|
|
3778
|
+
};
|
|
3779
|
+
}
|
|
3780
|
+
update() {
|
|
3781
|
+
this.set(this.output.length ? this.output.join(", ") : "auto");
|
|
3782
|
+
}
|
|
3783
|
+
}
|
|
3784
|
+
function isWillChangeMotionValue(value) {
|
|
3785
|
+
return Boolean(isMotionValue(value) && value.add);
|
|
3786
|
+
}
|
|
3787
|
+
function addValueToWillChange(visualElement, key) {
|
|
3788
|
+
var _a;
|
|
3789
|
+
if (!visualElement.applyWillChange)
|
|
3790
|
+
return;
|
|
3791
|
+
let willChange = visualElement.getValue("willChange");
|
|
3792
|
+
if (!willChange && !((_a = visualElement.props.style) === null || _a === void 0 ? void 0 : _a.willChange)) {
|
|
3793
|
+
willChange = new WillChangeMotionValue("auto");
|
|
3794
|
+
visualElement.addValue("willChange", willChange);
|
|
3795
|
+
}
|
|
3796
|
+
if (isWillChangeMotionValue(willChange)) {
|
|
3797
|
+
return willChange.add(key);
|
|
3798
|
+
}
|
|
3799
|
+
}
|
|
3728
3800
|
function shouldBlockAnimation({ protectedKeys, needsAnimating }, key) {
|
|
3729
3801
|
const shouldBlock = protectedKeys.hasOwnProperty(key) && needsAnimating[key] !== true;
|
|
3730
3802
|
needsAnimating[key] = false;
|
|
@@ -3733,7 +3805,6 @@ function shouldBlockAnimation({ protectedKeys, needsAnimating }, key) {
|
|
|
3733
3805
|
function animateTarget(visualElement, targetAndTransition, { delay: delay2 = 0, transitionOverride, type } = {}) {
|
|
3734
3806
|
var _a;
|
|
3735
3807
|
let { transition = visualElement.getDefaultTransition(), transitionEnd, ...target } = targetAndTransition;
|
|
3736
|
-
const willChange = visualElement.getValue("willChange");
|
|
3737
3808
|
if (transitionOverride)
|
|
3738
3809
|
transition = transitionOverride;
|
|
3739
3810
|
const animations2 = [];
|
|
@@ -3760,13 +3831,9 @@ function animateTarget(visualElement, targetAndTransition, { delay: delay2 = 0,
|
|
|
3760
3831
|
}
|
|
3761
3832
|
}
|
|
3762
3833
|
}
|
|
3763
|
-
value.start(animateMotionValue(key, value, valueTarget, visualElement.shouldReduceMotion && transformProps.has(key) ? { type: false } : valueTransition, visualElement, isHandoff));
|
|
3834
|
+
value.start(animateMotionValue(key, value, valueTarget, visualElement.shouldReduceMotion && transformProps.has(key) ? { type: false } : valueTransition, visualElement, isHandoff, addValueToWillChange(visualElement, key)));
|
|
3764
3835
|
const animation = value.animation;
|
|
3765
3836
|
if (animation) {
|
|
3766
|
-
if (isWillChangeMotionValue(willChange)) {
|
|
3767
|
-
willChange.add(key);
|
|
3768
|
-
animation.then(() => willChange.remove(key));
|
|
3769
|
-
}
|
|
3770
3837
|
animations2.push(animation);
|
|
3771
3838
|
}
|
|
3772
3839
|
}
|
|
@@ -4212,21 +4279,29 @@ function getVelocity(history, timeDelta) {
|
|
|
4212
4279
|
}
|
|
4213
4280
|
return currentVelocity;
|
|
4214
4281
|
}
|
|
4282
|
+
const SCALE_PRECISION = 1e-4;
|
|
4283
|
+
const SCALE_MIN = 1 - SCALE_PRECISION;
|
|
4284
|
+
const SCALE_MAX = 1 + SCALE_PRECISION;
|
|
4285
|
+
const TRANSLATE_PRECISION = 0.01;
|
|
4286
|
+
const TRANSLATE_MIN = 0 - TRANSLATE_PRECISION;
|
|
4287
|
+
const TRANSLATE_MAX = 0 + TRANSLATE_PRECISION;
|
|
4215
4288
|
function calcLength(axis) {
|
|
4216
4289
|
return axis.max - axis.min;
|
|
4217
4290
|
}
|
|
4218
|
-
function isNear(value, target
|
|
4291
|
+
function isNear(value, target, maxDistance) {
|
|
4219
4292
|
return Math.abs(value - target) <= maxDistance;
|
|
4220
4293
|
}
|
|
4221
4294
|
function calcAxisDelta(delta, source, target, origin = 0.5) {
|
|
4222
4295
|
delta.origin = origin;
|
|
4223
4296
|
delta.originPoint = mixNumber$1(source.min, source.max, delta.origin);
|
|
4224
4297
|
delta.scale = calcLength(target) / calcLength(source);
|
|
4225
|
-
if (isNear(delta.scale, 1, 1e-4) || isNaN(delta.scale))
|
|
4226
|
-
delta.scale = 1;
|
|
4227
4298
|
delta.translate = mixNumber$1(target.min, target.max, delta.origin) - delta.originPoint;
|
|
4228
|
-
if (
|
|
4299
|
+
if (delta.scale >= SCALE_MIN && delta.scale <= SCALE_MAX || isNaN(delta.scale)) {
|
|
4300
|
+
delta.scale = 1;
|
|
4301
|
+
}
|
|
4302
|
+
if (delta.translate >= TRANSLATE_MIN && delta.translate <= TRANSLATE_MAX || isNaN(delta.translate)) {
|
|
4229
4303
|
delta.translate = 0;
|
|
4304
|
+
}
|
|
4230
4305
|
}
|
|
4231
4306
|
function calcBoxDelta(delta, source, target, origin) {
|
|
4232
4307
|
calcAxisDelta(delta.x, source.x, target.x, origin ? origin.originX : void 0);
|
|
@@ -4397,6 +4472,8 @@ function applyBoxDelta(box, { x, y }) {
|
|
|
4397
4472
|
applyAxisDelta(box.x, x.translate, x.scale, x.originPoint);
|
|
4398
4473
|
applyAxisDelta(box.y, y.translate, y.scale, y.originPoint);
|
|
4399
4474
|
}
|
|
4475
|
+
const TREE_SCALE_SNAP_MIN = 0.999999999999;
|
|
4476
|
+
const TREE_SCALE_SNAP_MAX = 1.0000000000001;
|
|
4400
4477
|
function applyTreeDeltas(box, treeScale, treePath, isSharedTransition = false) {
|
|
4401
4478
|
const treeLength = treePath.length;
|
|
4402
4479
|
if (!treeLength)
|
|
@@ -4407,8 +4484,8 @@ function applyTreeDeltas(box, treeScale, treePath, isSharedTransition = false) {
|
|
|
4407
4484
|
for (let i = 0; i < treeLength; i++) {
|
|
4408
4485
|
node = treePath[i];
|
|
4409
4486
|
delta = node.projectionDelta;
|
|
4410
|
-
const
|
|
4411
|
-
if (
|
|
4487
|
+
const { visualElement } = node.options;
|
|
4488
|
+
if (visualElement && visualElement.props.style && visualElement.props.style.display === "contents") {
|
|
4412
4489
|
continue;
|
|
4413
4490
|
}
|
|
4414
4491
|
if (isSharedTransition && node.options.layoutScroll && node.scroll && node !== node.root) {
|
|
@@ -4426,28 +4503,24 @@ function applyTreeDeltas(box, treeScale, treePath, isSharedTransition = false) {
|
|
|
4426
4503
|
transformBox(box, node.latestValues);
|
|
4427
4504
|
}
|
|
4428
4505
|
}
|
|
4429
|
-
treeScale.x
|
|
4430
|
-
|
|
4431
|
-
}
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
return scale2 > 1.0000000000001 || scale2 < 0.999999999999 ? scale2 : 1;
|
|
4506
|
+
if (treeScale.x < TREE_SCALE_SNAP_MAX && treeScale.x > TREE_SCALE_SNAP_MIN) {
|
|
4507
|
+
treeScale.x = 1;
|
|
4508
|
+
}
|
|
4509
|
+
if (treeScale.y < TREE_SCALE_SNAP_MAX && treeScale.y > TREE_SCALE_SNAP_MIN) {
|
|
4510
|
+
treeScale.y = 1;
|
|
4511
|
+
}
|
|
4436
4512
|
}
|
|
4437
4513
|
function translateAxis(axis, distance2) {
|
|
4438
4514
|
axis.min = axis.min + distance2;
|
|
4439
4515
|
axis.max = axis.max + distance2;
|
|
4440
4516
|
}
|
|
4441
|
-
function transformAxis(axis,
|
|
4442
|
-
const axisOrigin = transforms[originKey] !== void 0 ? transforms[originKey] : 0.5;
|
|
4517
|
+
function transformAxis(axis, axisTranslate, axisScale, boxScale, axisOrigin = 0.5) {
|
|
4443
4518
|
const originPoint = mixNumber$1(axis.min, axis.max, axisOrigin);
|
|
4444
|
-
applyAxisDelta(axis,
|
|
4519
|
+
applyAxisDelta(axis, axisTranslate, axisScale, originPoint, boxScale);
|
|
4445
4520
|
}
|
|
4446
|
-
const xKeys$1 = ["x", "scaleX", "originX"];
|
|
4447
|
-
const yKeys$1 = ["y", "scaleY", "originY"];
|
|
4448
4521
|
function transformBox(box, transform) {
|
|
4449
|
-
transformAxis(box.x, transform,
|
|
4450
|
-
transformAxis(box.y, transform,
|
|
4522
|
+
transformAxis(box.x, transform.x, transform.scaleX, transform.scale, transform.originX);
|
|
4523
|
+
transformAxis(box.y, transform.y, transform.scaleY, transform.scale, transform.originY);
|
|
4451
4524
|
}
|
|
4452
4525
|
function measureViewportBox(instance, transformPoint2) {
|
|
4453
4526
|
return convertBoundingBoxToBox(transformBoxPoints(instance.getBoundingClientRect(), transformPoint2));
|
|
@@ -4488,6 +4561,7 @@ class VisualElementDragControls {
|
|
|
4488
4561
|
}
|
|
4489
4562
|
};
|
|
4490
4563
|
const onStart = (event, info) => {
|
|
4564
|
+
var _a;
|
|
4491
4565
|
const { drag: drag2, dragPropagation, onDragStart } = this.getProps();
|
|
4492
4566
|
if (drag2 && !dragPropagation) {
|
|
4493
4567
|
if (this.openGlobalLock)
|
|
@@ -4520,6 +4594,8 @@ class VisualElementDragControls {
|
|
|
4520
4594
|
if (onDragStart) {
|
|
4521
4595
|
frame.postRender(() => onDragStart(event, info));
|
|
4522
4596
|
}
|
|
4597
|
+
(_a = this.removeWillChange) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
4598
|
+
this.removeWillChange = addValueToWillChange(this.visualElement, "transform");
|
|
4523
4599
|
const { animationState } = this.visualElement;
|
|
4524
4600
|
animationState && animationState.setActive("whileDrag", true);
|
|
4525
4601
|
};
|
|
@@ -4559,6 +4635,8 @@ class VisualElementDragControls {
|
|
|
4559
4635
|
});
|
|
4560
4636
|
}
|
|
4561
4637
|
stop(event, info) {
|
|
4638
|
+
var _a;
|
|
4639
|
+
(_a = this.removeWillChange) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
4562
4640
|
const isDragging = this.isDragging;
|
|
4563
4641
|
this.cancel();
|
|
4564
4642
|
if (!isDragging)
|
|
@@ -4670,7 +4748,7 @@ class VisualElementDragControls {
|
|
|
4670
4748
|
}
|
|
4671
4749
|
startAxisValueAnimation(axis, transition) {
|
|
4672
4750
|
const axisValue = this.getAxisMotionValue(axis);
|
|
4673
|
-
return axisValue.start(animateMotionValue(axis, axisValue, 0, transition, this.visualElement));
|
|
4751
|
+
return axisValue.start(animateMotionValue(axis, axisValue, 0, transition, this.visualElement, false, addValueToWillChange(this.visualElement, axis)));
|
|
4674
4752
|
}
|
|
4675
4753
|
stopAnimation() {
|
|
4676
4754
|
eachAxis((axis) => this.getAxisMotionValue(axis).stop());
|
|
@@ -4879,7 +4957,7 @@ function usePresence() {
|
|
|
4879
4957
|
const { isPresent, onExitComplete, register } = context;
|
|
4880
4958
|
const id2 = useId();
|
|
4881
4959
|
useEffect(() => register(id2), []);
|
|
4882
|
-
const safeToRemove = () => onExitComplete && onExitComplete(id2);
|
|
4960
|
+
const safeToRemove = useCallback(() => onExitComplete && onExitComplete(id2), [id2, onExitComplete]);
|
|
4883
4961
|
return !isPresent && onExitComplete ? [false, safeToRemove] : [true];
|
|
4884
4962
|
}
|
|
4885
4963
|
const globalProjectionState = {
|
|
@@ -5098,6 +5176,12 @@ function copyBoxInto(box, originBox) {
|
|
|
5098
5176
|
copyAxisInto(box.x, originBox.x);
|
|
5099
5177
|
copyAxisInto(box.y, originBox.y);
|
|
5100
5178
|
}
|
|
5179
|
+
function copyAxisDeltaInto(delta, originDelta) {
|
|
5180
|
+
delta.translate = originDelta.translate;
|
|
5181
|
+
delta.scale = originDelta.scale;
|
|
5182
|
+
delta.originPoint = originDelta.originPoint;
|
|
5183
|
+
delta.origin = originDelta.origin;
|
|
5184
|
+
}
|
|
5101
5185
|
function removePointDelta(point, translate, scale2, originPoint, boxScale) {
|
|
5102
5186
|
point -= translate;
|
|
5103
5187
|
point = scalePoint(point, 1 / scale2, originPoint);
|
|
@@ -5135,15 +5219,24 @@ function isAxisDeltaZero(delta) {
|
|
|
5135
5219
|
function isDeltaZero(delta) {
|
|
5136
5220
|
return isAxisDeltaZero(delta.x) && isAxisDeltaZero(delta.y);
|
|
5137
5221
|
}
|
|
5222
|
+
function axisEquals(a, b) {
|
|
5223
|
+
return a.min === b.min && a.max === b.max;
|
|
5224
|
+
}
|
|
5138
5225
|
function boxEquals(a, b) {
|
|
5139
|
-
return a.x
|
|
5226
|
+
return axisEquals(a.x, b.x) && axisEquals(a.y, b.y);
|
|
5227
|
+
}
|
|
5228
|
+
function axisEqualsRounded(a, b) {
|
|
5229
|
+
return Math.round(a.min) === Math.round(b.min) && Math.round(a.max) === Math.round(b.max);
|
|
5140
5230
|
}
|
|
5141
5231
|
function boxEqualsRounded(a, b) {
|
|
5142
|
-
return
|
|
5232
|
+
return axisEqualsRounded(a.x, b.x) && axisEqualsRounded(a.y, b.y);
|
|
5143
5233
|
}
|
|
5144
5234
|
function aspectRatio(box) {
|
|
5145
5235
|
return calcLength(box.x) / calcLength(box.y);
|
|
5146
5236
|
}
|
|
5237
|
+
function axisDeltaEquals(a, b) {
|
|
5238
|
+
return a.translate === b.translate && a.scale === b.scale && a.originPoint === b.originPoint;
|
|
5239
|
+
}
|
|
5147
5240
|
class NodeStack {
|
|
5148
5241
|
constructor() {
|
|
5149
5242
|
this.members = [];
|
|
@@ -5299,11 +5392,6 @@ function delay(callback, timeout) {
|
|
|
5299
5392
|
frame.read(checkElapsed, true);
|
|
5300
5393
|
return () => cancelFrame(checkElapsed);
|
|
5301
5394
|
}
|
|
5302
|
-
function record(data) {
|
|
5303
|
-
if (window.MotionDebug) {
|
|
5304
|
-
window.MotionDebug.record(data);
|
|
5305
|
-
}
|
|
5306
|
-
}
|
|
5307
5395
|
function isSVGElement(element) {
|
|
5308
5396
|
return element instanceof SVGElement && element.tagName !== "svg";
|
|
5309
5397
|
}
|
|
@@ -5312,16 +5400,17 @@ function animateSingleValue(value, keyframes2, options) {
|
|
|
5312
5400
|
motionValue$1.start(animateMotionValue("", motionValue$1, keyframes2, options));
|
|
5313
5401
|
return motionValue$1.animation;
|
|
5314
5402
|
}
|
|
5315
|
-
const
|
|
5316
|
-
const hiddenVisibility = { visibility: "hidden" };
|
|
5317
|
-
const animationTarget = 1e3;
|
|
5318
|
-
let id = 0;
|
|
5319
|
-
const projectionFrameData = {
|
|
5403
|
+
const metrics = {
|
|
5320
5404
|
type: "projectionFrame",
|
|
5321
5405
|
totalNodes: 0,
|
|
5322
5406
|
resolvedTargetDeltas: 0,
|
|
5323
5407
|
recalculatedProjection: 0
|
|
5324
5408
|
};
|
|
5409
|
+
const isDebug = typeof window !== "undefined" && window.MotionDebug !== void 0;
|
|
5410
|
+
const transformAxes = ["", "X", "Y", "Z"];
|
|
5411
|
+
const hiddenVisibility = { visibility: "hidden" };
|
|
5412
|
+
const animationTarget = 1e3;
|
|
5413
|
+
let id = 0;
|
|
5325
5414
|
function resetDistortingTransform(key, visualElement, values, sharedAnimationValues) {
|
|
5326
5415
|
const { latestValues } = visualElement;
|
|
5327
5416
|
if (latestValues[key]) {
|
|
@@ -5381,13 +5470,18 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
5381
5470
|
};
|
|
5382
5471
|
this.updateProjection = () => {
|
|
5383
5472
|
this.projectionUpdateScheduled = false;
|
|
5384
|
-
|
|
5473
|
+
if (isDebug) {
|
|
5474
|
+
metrics.totalNodes = metrics.resolvedTargetDeltas = metrics.recalculatedProjection = 0;
|
|
5475
|
+
}
|
|
5385
5476
|
this.nodes.forEach(propagateDirtyNodes);
|
|
5386
5477
|
this.nodes.forEach(resolveTargetDelta);
|
|
5387
5478
|
this.nodes.forEach(calcProjection);
|
|
5388
5479
|
this.nodes.forEach(cleanDirtyNodes);
|
|
5389
|
-
|
|
5480
|
+
if (isDebug) {
|
|
5481
|
+
window.MotionDebug.record(metrics);
|
|
5482
|
+
}
|
|
5390
5483
|
};
|
|
5484
|
+
this.resolvedRelativeTargetAt = 0;
|
|
5391
5485
|
this.hasProjected = false;
|
|
5392
5486
|
this.isVisible = true;
|
|
5393
5487
|
this.animationProgress = 0;
|
|
@@ -5638,11 +5732,13 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
5638
5732
|
needsMeasurement = false;
|
|
5639
5733
|
}
|
|
5640
5734
|
if (needsMeasurement) {
|
|
5735
|
+
const isRoot = checkIsScrollRoot(this.instance);
|
|
5641
5736
|
this.scroll = {
|
|
5642
5737
|
animationId: this.root.animationId,
|
|
5643
5738
|
phase,
|
|
5644
|
-
isRoot
|
|
5645
|
-
offset: measureScroll(this.instance)
|
|
5739
|
+
isRoot,
|
|
5740
|
+
offset: measureScroll(this.instance),
|
|
5741
|
+
wasRoot: this.scroll ? this.scroll.isRoot : isRoot
|
|
5646
5742
|
};
|
|
5647
5743
|
}
|
|
5648
5744
|
}
|
|
@@ -5676,31 +5772,34 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
5676
5772
|
};
|
|
5677
5773
|
}
|
|
5678
5774
|
measurePageBox() {
|
|
5775
|
+
var _a;
|
|
5679
5776
|
const { visualElement } = this.options;
|
|
5680
5777
|
if (!visualElement)
|
|
5681
5778
|
return createBox();
|
|
5682
5779
|
const box = visualElement.measureViewportBox();
|
|
5683
|
-
const
|
|
5684
|
-
if (
|
|
5685
|
-
|
|
5686
|
-
|
|
5780
|
+
const wasInScrollRoot = ((_a = this.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot) || this.path.some(checkNodeWasScrollRoot);
|
|
5781
|
+
if (!wasInScrollRoot) {
|
|
5782
|
+
const { scroll } = this.root;
|
|
5783
|
+
if (scroll) {
|
|
5784
|
+
translateAxis(box.x, scroll.offset.x);
|
|
5785
|
+
translateAxis(box.y, scroll.offset.y);
|
|
5786
|
+
}
|
|
5687
5787
|
}
|
|
5688
5788
|
return box;
|
|
5689
5789
|
}
|
|
5690
5790
|
removeElementScroll(box) {
|
|
5791
|
+
var _a;
|
|
5691
5792
|
const boxWithoutScroll = createBox();
|
|
5692
5793
|
copyBoxInto(boxWithoutScroll, box);
|
|
5794
|
+
if ((_a = this.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot) {
|
|
5795
|
+
return boxWithoutScroll;
|
|
5796
|
+
}
|
|
5693
5797
|
for (let i = 0; i < this.path.length; i++) {
|
|
5694
5798
|
const node = this.path[i];
|
|
5695
5799
|
const { scroll, options } = node;
|
|
5696
5800
|
if (node !== this.root && scroll && options.layoutScroll) {
|
|
5697
|
-
if (scroll.
|
|
5801
|
+
if (scroll.wasRoot) {
|
|
5698
5802
|
copyBoxInto(boxWithoutScroll, box);
|
|
5699
|
-
const { scroll: rootScroll } = this.root;
|
|
5700
|
-
if (rootScroll) {
|
|
5701
|
-
translateAxis(boxWithoutScroll.x, -rootScroll.offset.x);
|
|
5702
|
-
translateAxis(boxWithoutScroll.y, -rootScroll.offset.y);
|
|
5703
|
-
}
|
|
5704
5803
|
}
|
|
5705
5804
|
translateAxis(boxWithoutScroll.x, scroll.offset.x);
|
|
5706
5805
|
translateAxis(boxWithoutScroll.y, scroll.offset.y);
|
|
@@ -5783,7 +5882,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
5783
5882
|
this.isTransformDirty || (this.isTransformDirty = lead.isTransformDirty);
|
|
5784
5883
|
this.isSharedProjectionDirty || (this.isSharedProjectionDirty = lead.isSharedProjectionDirty);
|
|
5785
5884
|
const isShared = Boolean(this.resumingFrom) || this !== lead;
|
|
5786
|
-
const canSkip = !(forceRecalculation || isShared && this.isSharedProjectionDirty || this.isProjectionDirty || ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isProjectionDirty) || this.attemptToResolveRelativeTarget);
|
|
5885
|
+
const canSkip = !(forceRecalculation || isShared && this.isSharedProjectionDirty || this.isProjectionDirty || ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isProjectionDirty) || this.attemptToResolveRelativeTarget || this.root.updateBlockedByResize);
|
|
5787
5886
|
if (canSkip)
|
|
5788
5887
|
return;
|
|
5789
5888
|
const { layout: layout2, layoutId } = this.options;
|
|
@@ -5836,7 +5935,9 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
5836
5935
|
this.relativeParent = this.relativeTarget = void 0;
|
|
5837
5936
|
}
|
|
5838
5937
|
}
|
|
5839
|
-
|
|
5938
|
+
if (isDebug) {
|
|
5939
|
+
metrics.resolvedTargetDeltas++;
|
|
5940
|
+
}
|
|
5840
5941
|
}
|
|
5841
5942
|
getClosestProjectingParent() {
|
|
5842
5943
|
if (!this.parent || hasScale(this.parent.latestValues) || has2DTranslate(this.parent.latestValues)) {
|
|
@@ -5884,26 +5985,27 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
5884
5985
|
}
|
|
5885
5986
|
const { target } = lead;
|
|
5886
5987
|
if (!target) {
|
|
5887
|
-
if (this.
|
|
5888
|
-
this.
|
|
5889
|
-
this.projectionTransform = "none";
|
|
5988
|
+
if (this.prevProjectionDelta) {
|
|
5989
|
+
this.createProjectionDeltas();
|
|
5890
5990
|
this.scheduleRender();
|
|
5891
5991
|
}
|
|
5892
5992
|
return;
|
|
5893
5993
|
}
|
|
5894
|
-
if (!this.projectionDelta) {
|
|
5895
|
-
this.
|
|
5896
|
-
|
|
5994
|
+
if (!this.projectionDelta || !this.prevProjectionDelta) {
|
|
5995
|
+
this.createProjectionDeltas();
|
|
5996
|
+
} else {
|
|
5997
|
+
copyAxisDeltaInto(this.prevProjectionDelta.x, this.projectionDelta.x);
|
|
5998
|
+
copyAxisDeltaInto(this.prevProjectionDelta.y, this.projectionDelta.y);
|
|
5897
5999
|
}
|
|
5898
|
-
const prevProjectionTransform = this.projectionTransform;
|
|
5899
6000
|
calcBoxDelta(this.projectionDelta, this.layoutCorrected, target, this.latestValues);
|
|
5900
|
-
this.
|
|
5901
|
-
if (this.projectionTransform !== prevProjectionTransform || this.treeScale.x !== prevTreeScaleX || this.treeScale.y !== prevTreeScaleY) {
|
|
6001
|
+
if (this.treeScale.x !== prevTreeScaleX || this.treeScale.y !== prevTreeScaleY || !axisDeltaEquals(this.projectionDelta.x, this.prevProjectionDelta.x) || !axisDeltaEquals(this.projectionDelta.y, this.prevProjectionDelta.y)) {
|
|
5902
6002
|
this.hasProjected = true;
|
|
5903
6003
|
this.scheduleRender();
|
|
5904
6004
|
this.notifyListeners("projectionUpdate", target);
|
|
5905
6005
|
}
|
|
5906
|
-
|
|
6006
|
+
if (isDebug) {
|
|
6007
|
+
metrics.recalculatedProjection++;
|
|
6008
|
+
}
|
|
5907
6009
|
}
|
|
5908
6010
|
hide() {
|
|
5909
6011
|
this.isVisible = false;
|
|
@@ -5912,7 +6014,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
5912
6014
|
this.isVisible = true;
|
|
5913
6015
|
}
|
|
5914
6016
|
scheduleRender(notifyAll = true) {
|
|
5915
|
-
|
|
6017
|
+
var _a;
|
|
6018
|
+
(_a = this.options.visualElement) === null || _a === void 0 ? void 0 : _a.scheduleRender();
|
|
5916
6019
|
if (notifyAll) {
|
|
5917
6020
|
const stack = this.getStack();
|
|
5918
6021
|
stack && stack.scheduleRender();
|
|
@@ -5921,6 +6024,11 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
5921
6024
|
this.resumingFrom = void 0;
|
|
5922
6025
|
}
|
|
5923
6026
|
}
|
|
6027
|
+
createProjectionDeltas() {
|
|
6028
|
+
this.prevProjectionDelta = createDelta();
|
|
6029
|
+
this.projectionDelta = createDelta();
|
|
6030
|
+
this.projectionDeltaWithTransform = createDelta();
|
|
6031
|
+
}
|
|
5924
6032
|
setAnimationOrigin(delta, hasOnlyRelativeTargetChanged = false) {
|
|
5925
6033
|
const snapshot = this.snapshot;
|
|
5926
6034
|
const snapshotLatestValues = snapshot ? snapshot.latestValues : {};
|
|
@@ -6256,7 +6364,9 @@ function notifyLayoutUpdate(node) {
|
|
|
6256
6364
|
node.options.transition = void 0;
|
|
6257
6365
|
}
|
|
6258
6366
|
function propagateDirtyNodes(node) {
|
|
6259
|
-
|
|
6367
|
+
if (isDebug) {
|
|
6368
|
+
metrics.totalNodes++;
|
|
6369
|
+
}
|
|
6260
6370
|
if (!node.parent)
|
|
6261
6371
|
return;
|
|
6262
6372
|
if (!node.isProjecting()) {
|
|
@@ -6335,6 +6445,10 @@ function roundBox(box) {
|
|
|
6335
6445
|
function shouldAnimatePositionOnly(animationType, snapshot, layout2) {
|
|
6336
6446
|
return animationType === "position" || animationType === "preserve-aspect" && !isNear(aspectRatio(snapshot), aspectRatio(layout2), 0.2);
|
|
6337
6447
|
}
|
|
6448
|
+
function checkNodeWasScrollRoot(node) {
|
|
6449
|
+
var _a;
|
|
6450
|
+
return node !== node.root && ((_a = node.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot);
|
|
6451
|
+
}
|
|
6338
6452
|
const DocumentProjectionNode = createProjectionNode({
|
|
6339
6453
|
attachResizeListener: (ref, notify) => addDomEvent(ref, "resize", notify),
|
|
6340
6454
|
measureScroll: () => ({
|
|
@@ -6391,23 +6505,16 @@ function initPrefersReducedMotion() {
|
|
|
6391
6505
|
}
|
|
6392
6506
|
}
|
|
6393
6507
|
function updateMotionValuesFromProps(element, next, prev) {
|
|
6394
|
-
const { willChange } = next;
|
|
6395
6508
|
for (const key in next) {
|
|
6396
6509
|
const nextValue = next[key];
|
|
6397
6510
|
const prevValue = prev[key];
|
|
6398
6511
|
if (isMotionValue(nextValue)) {
|
|
6399
6512
|
element.addValue(key, nextValue);
|
|
6400
|
-
if (isWillChangeMotionValue(willChange)) {
|
|
6401
|
-
willChange.add(key);
|
|
6402
|
-
}
|
|
6403
6513
|
if (process.env.NODE_ENV === "development") {
|
|
6404
|
-
warnOnce(nextValue.version === "11.
|
|
6514
|
+
warnOnce(nextValue.version === "11.3.17", `Attempting to mix Framer Motion versions ${nextValue.version} with 11.3.17 may not work as expected.`);
|
|
6405
6515
|
}
|
|
6406
6516
|
} else if (isMotionValue(prevValue)) {
|
|
6407
6517
|
element.addValue(key, motionValue(nextValue, { owner: element }));
|
|
6408
|
-
if (isWillChangeMotionValue(willChange)) {
|
|
6409
|
-
willChange.remove(key);
|
|
6410
|
-
}
|
|
6411
6518
|
} else if (prevValue !== nextValue) {
|
|
6412
6519
|
if (element.hasValue(key)) {
|
|
6413
6520
|
const existingValue = element.getValue(key);
|
|
@@ -6453,6 +6560,7 @@ class VisualElement {
|
|
|
6453
6560
|
return {};
|
|
6454
6561
|
}
|
|
6455
6562
|
constructor({ parent, props, presenceContext, reducedMotionConfig, blockInitialAnimation, visualState }, options = {}) {
|
|
6563
|
+
this.applyWillChange = false;
|
|
6456
6564
|
this.resolveKeyframes = (keyframes2, onComplete, name, value) => {
|
|
6457
6565
|
return new this.KeyframeResolver(keyframes2, onComplete, name, value, this);
|
|
6458
6566
|
};
|
|
@@ -6470,12 +6578,19 @@ class VisualElement {
|
|
|
6470
6578
|
this.propEventSubscriptions = {};
|
|
6471
6579
|
this.notifyUpdate = () => this.notify("Update", this.latestValues);
|
|
6472
6580
|
this.render = () => {
|
|
6581
|
+
this.isRenderScheduled = false;
|
|
6473
6582
|
if (!this.current)
|
|
6474
6583
|
return;
|
|
6475
6584
|
this.triggerBuild();
|
|
6476
6585
|
this.renderInstance(this.current, this.renderState, this.props.style, this.projection);
|
|
6477
6586
|
};
|
|
6478
|
-
this.
|
|
6587
|
+
this.isRenderScheduled = false;
|
|
6588
|
+
this.scheduleRender = () => {
|
|
6589
|
+
if (!this.isRenderScheduled) {
|
|
6590
|
+
this.isRenderScheduled = true;
|
|
6591
|
+
frame.render(this.render, false, true);
|
|
6592
|
+
}
|
|
6593
|
+
};
|
|
6479
6594
|
const { latestValues, renderState } = visualState;
|
|
6480
6595
|
this.latestValues = latestValues;
|
|
6481
6596
|
this.baseTarget = { ...latestValues };
|
|
@@ -6499,9 +6614,6 @@ class VisualElement {
|
|
|
6499
6614
|
const value = initialMotionValues[key];
|
|
6500
6615
|
if (latestValues[key] !== void 0 && isMotionValue(value)) {
|
|
6501
6616
|
value.set(latestValues[key], false);
|
|
6502
|
-
if (isWillChangeMotionValue(willChange)) {
|
|
6503
|
-
willChange.add(key);
|
|
6504
|
-
}
|
|
6505
6617
|
}
|
|
6506
6618
|
}
|
|
6507
6619
|
}
|
|
@@ -6591,7 +6703,7 @@ class VisualElement {
|
|
|
6591
6703
|
}
|
|
6592
6704
|
}
|
|
6593
6705
|
triggerBuild() {
|
|
6594
|
-
this.build(this.renderState, this.latestValues, this.
|
|
6706
|
+
this.build(this.renderState, this.latestValues, this.props);
|
|
6595
6707
|
}
|
|
6596
6708
|
/**
|
|
6597
6709
|
* Measure the current viewport box with or without transforms.
|
|
@@ -6813,6 +6925,8 @@ class HTMLVisualElement extends DOMVisualElement {
|
|
|
6813
6925
|
constructor() {
|
|
6814
6926
|
super(...arguments);
|
|
6815
6927
|
this.type = "html";
|
|
6928
|
+
this.applyWillChange = true;
|
|
6929
|
+
this.renderInstance = renderHTML;
|
|
6816
6930
|
}
|
|
6817
6931
|
readValueFromInstance(instance, key) {
|
|
6818
6932
|
if (transformProps.has(key)) {
|
|
@@ -6827,8 +6941,8 @@ class HTMLVisualElement extends DOMVisualElement {
|
|
|
6827
6941
|
measureInstanceViewportBox(instance, { transformPagePoint }) {
|
|
6828
6942
|
return measureViewportBox(instance, transformPagePoint);
|
|
6829
6943
|
}
|
|
6830
|
-
build(renderState, latestValues,
|
|
6831
|
-
buildHTMLStyles(renderState, latestValues,
|
|
6944
|
+
build(renderState, latestValues, props) {
|
|
6945
|
+
buildHTMLStyles(renderState, latestValues, props.transformTemplate);
|
|
6832
6946
|
}
|
|
6833
6947
|
scrapeMotionValuesFromProps(props, prevProps, visualElement) {
|
|
6834
6948
|
return scrapeMotionValuesFromProps$1(props, prevProps, visualElement);
|
|
@@ -6846,15 +6960,13 @@ class HTMLVisualElement extends DOMVisualElement {
|
|
|
6846
6960
|
});
|
|
6847
6961
|
}
|
|
6848
6962
|
}
|
|
6849
|
-
renderInstance(instance, renderState, styleProp, projection) {
|
|
6850
|
-
renderHTML(instance, renderState, styleProp, projection);
|
|
6851
|
-
}
|
|
6852
6963
|
}
|
|
6853
6964
|
class SVGVisualElement extends DOMVisualElement {
|
|
6854
6965
|
constructor() {
|
|
6855
6966
|
super(...arguments);
|
|
6856
6967
|
this.type = "svg";
|
|
6857
6968
|
this.isSVGTag = false;
|
|
6969
|
+
this.measureInstanceViewportBox = createBox;
|
|
6858
6970
|
}
|
|
6859
6971
|
getBaseTargetFromProps(props, key) {
|
|
6860
6972
|
return props[key];
|
|
@@ -6867,14 +6979,11 @@ class SVGVisualElement extends DOMVisualElement {
|
|
|
6867
6979
|
key = !camelCaseAttributes.has(key) ? camelToDash(key) : key;
|
|
6868
6980
|
return instance.getAttribute(key);
|
|
6869
6981
|
}
|
|
6870
|
-
measureInstanceViewportBox() {
|
|
6871
|
-
return createBox();
|
|
6872
|
-
}
|
|
6873
6982
|
scrapeMotionValuesFromProps(props, prevProps, visualElement) {
|
|
6874
6983
|
return scrapeMotionValuesFromProps(props, prevProps, visualElement);
|
|
6875
6984
|
}
|
|
6876
|
-
build(renderState, latestValues,
|
|
6877
|
-
buildSVGAttrs(renderState, latestValues,
|
|
6985
|
+
build(renderState, latestValues, props) {
|
|
6986
|
+
buildSVGAttrs(renderState, latestValues, this.isSVGTag, props.transformTemplate);
|
|
6878
6987
|
}
|
|
6879
6988
|
renderInstance(instance, renderState, styleProp, projection) {
|
|
6880
6989
|
renderSVG(instance, renderState, styleProp, projection);
|
|
@@ -6885,9 +6994,8 @@ class SVGVisualElement extends DOMVisualElement {
|
|
|
6885
6994
|
}
|
|
6886
6995
|
}
|
|
6887
6996
|
const createDomVisualElement = (Component2, options) => {
|
|
6888
|
-
return isSVGComponent(Component2) ? new SVGVisualElement(options
|
|
6889
|
-
allowProjection: Component2 !== Fragment
|
|
6890
|
-
enableHardwareAcceleration: true
|
|
6997
|
+
return isSVGComponent(Component2) ? new SVGVisualElement(options) : new HTMLVisualElement(options, {
|
|
6998
|
+
allowProjection: Component2 !== Fragment
|
|
6891
6999
|
});
|
|
6892
7000
|
};
|
|
6893
7001
|
const layout = {
|
|
@@ -7130,7 +7238,7 @@ const AnimatePresence = ({ children, custom, initial = true, onExitComplete, exi
|
|
|
7130
7238
|
*
|
|
7131
7239
|
* @returns {JSX.Element} The AnimatedVisibility component.
|
|
7132
7240
|
*
|
|
7133
|
-
* @typedef {'slideFade' |'scaleFade' | 'scaleRotateFade'} ElementTransition
|
|
7241
|
+
* @typedef {'fade' | 'slideFade' |'scaleFade' | 'scaleRotateFade'} ElementTransition
|
|
7134
7242
|
*
|
|
7135
7243
|
* @example
|
|
7136
7244
|
* const [visible, setVisible] = useState(false);
|
|
@@ -7144,6 +7252,11 @@ const AnimatePresence = ({ children, custom, initial = true, onExitComplete, exi
|
|
|
7144
7252
|
const AnimatedVisibility = (props) => {
|
|
7145
7253
|
const { visible, className, children, noInitial = false, transition = "slideFade", ...other } = props;
|
|
7146
7254
|
const transitions = {
|
|
7255
|
+
fade: {
|
|
7256
|
+
initial: { opacity: 0 },
|
|
7257
|
+
animate: { opacity: 1 },
|
|
7258
|
+
exit: { opacity: 0 }
|
|
7259
|
+
},
|
|
7147
7260
|
slideFade: {
|
|
7148
7261
|
initial: { opacity: 0, y: -5 },
|
|
7149
7262
|
animate: { opacity: 1, y: 0 },
|