@eightshift/ui-components 6.1.1 → 6.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/{Button-CFnNdpNZ.js → Button-DtRmB6b8.js} +7 -6
- package/dist/{Dialog-D0jMcN-a.js → Dialog-DTIxSDhz.js} +115 -52
- package/dist/{FocusScope-BJhC1-1e.js → FocusScope-CjFQ7cbd.js} +16 -16
- package/dist/{Hidden-Rfj-STx7.js → Hidden-DOH36apC.js} +23 -6
- package/dist/{Input-B4X6-x6r.js → Input-BG9DaxYN.js} +6 -6
- package/dist/{Label-BDlf9vIY.js → Label-_aSf9-8u.js} +1 -1
- package/dist/{ListBox-BaN0n5h3.js → ListBox-DXFyyj_r.js} +15 -12
- package/dist/{OverlayArrow-Dy0qw7WL.js → OverlayArrow-Fuxj-1QM.js} +27 -9
- package/dist/{RadioGroup-CjCAbUr4.js → RadioGroup-DCeiLxLK.js} +9 -9
- package/dist/{SearchField-CafsA525.js → SearchField-B_yKFXRk.js} +11 -11
- package/dist/{SelectionManager-oojq6MOy.js → SelectionManager-B02LcxLr.js} +143 -96
- package/dist/{Slider-BIbaMdUE.js → Slider-bR3fAmim.js} +7 -7
- package/dist/{VisuallyHidden-CqnizvzQ.js → VisuallyHidden-DZnWrkn8.js} +1 -1
- package/dist/assets/style-admin.css +637 -327
- package/dist/assets/style-editor.css +637 -327
- package/dist/assets/style.css +637 -327
- package/dist/assets/wp-overrides/allow-full-width-blocks.css +1 -1
- package/dist/assets/wp-overrides/fix-label-text-case.css +1 -1
- package/dist/assets/wp-overrides/increase-sidebar-width.css +1 -1
- package/dist/assets/wp-overrides/make-block-messages-nicer.css +7 -7
- package/dist/assets/wp-overrides/replace-fonts.css +5 -5
- package/dist/assets/wp-overrides/restyle-tooltips.css +3 -3
- package/dist/assets/wp-overrides/round-corners.css +1 -1
- package/dist/assets/wp-overrides/unify-button-sizes.css +1 -1
- package/dist/components/base-control/base-control.js +1 -1
- package/dist/components/base-control/container.js +1 -1
- package/dist/components/button/button.js +12 -9
- package/dist/components/checkbox/checkbox.js +10 -10
- package/dist/components/color-pickers/solid-color-picker.js +10 -10
- package/dist/components/expandable/expandable.js +5 -5
- package/dist/components/input-field/input-field.js +6 -9
- package/dist/components/link-input/link-input.js +191 -68
- package/dist/components/matrix-align/matrix-align.js +1 -1
- package/dist/components/menu/menu.js +5 -5
- package/dist/components/modal/modal.js +11 -8
- package/dist/components/notice/notice.js +3 -3
- package/dist/components/number-picker/number-picker.js +7 -7
- package/dist/components/options-panel/options-panel.js +6 -6
- package/dist/components/popover/popover.js +8 -7
- package/dist/components/radio/radio.js +2 -2
- package/dist/components/responsive/mini-responsive.js +81 -70
- package/dist/components/responsive/responsive.js +24 -40
- package/dist/components/responsive-preview/responsive-preview.js +1 -1
- package/dist/components/rich-label/rich-label.js +11 -5
- package/dist/components/select/async-multi-select.js +89 -47
- package/dist/components/select/async-select.js +90 -47
- package/dist/components/select/multi-select.js +161 -117
- package/dist/components/select/shared.js +5 -4
- package/dist/components/select/single-select.js +159 -115
- package/dist/components/slider/column-config-slider.js +3 -3
- package/dist/components/slider/slider.js +3 -3
- package/dist/components/tabs/tabs.js +39 -8
- package/dist/components/toggle/switch.js +5 -5
- package/dist/components/toggle/toggle.js +1 -1
- package/dist/components/toggle-button/toggle-button.js +6 -6
- package/dist/components/tooltip/tooltip.js +11 -9
- package/dist/{proxy-DFlYXk07.js → proxy-CNEXmkdK.js} +205 -137
- package/dist/{shared-CMLCUova.js → shared-CNH8QfV9.js} +50 -15
- package/dist/{textSelection-CeoEP4rL.js → textSelection-DA3VcKpG.js} +1 -1
- package/dist/{useButton-5YL_nmpZ.js → useButton-DyMX0EVr.js} +2 -2
- package/dist/{useEvent-Zze2g7CX.js → useEvent-Bfy68GHZ.js} +1 -1
- package/dist/{useFilter-8S94U4xM.js → useFilter-Bg5C34XC.js} +1 -1
- package/dist/{useFocusRing-rUOwLdTK.js → useFocusRing-B2glEZ25.js} +9 -7
- package/dist/{useFormReset-BxtOoO5Q.js → useFormReset-BoxsKyJ9.js} +1 -1
- package/dist/{useFormValidation-DTmPrTD8.js → useFormValidation-BrbMhS2N.js} +4 -3
- package/dist/{useHover-CmyvqeWX.js → useHover-DkmPQdGE.js} +76 -58
- package/dist/{useListState-B22CApJO.js → useListState-BjnzKozj.js} +3 -3
- package/dist/{useNumberField-CTkI-U9a.js → useNumberField-CsygZKz9.js} +45 -15
- package/dist/{usePress-CNefMs8d.js → usePress-Ck5xMtDr.js} +21 -21
- package/dist/{useToggle-CFFOmZWi.js → useToggle-Ddc7N8pR.js} +4 -4
- package/dist/{useToggleState-BWrKKisg.js → useToggleState-H_lORSWO.js} +1 -1
- package/package.json +22 -21
- package/dist/useSingleSelectListState-CDZGQDLC.js +0 -38
|
@@ -506,8 +506,7 @@ function analyseComplexValue(value) {
|
|
|
506
506
|
function parseComplexValue(v) {
|
|
507
507
|
return analyseComplexValue(v).values;
|
|
508
508
|
}
|
|
509
|
-
function
|
|
510
|
-
const { split, types } = analyseComplexValue(source);
|
|
509
|
+
function buildTransformer({ split, types }) {
|
|
511
510
|
const numSections = split.length;
|
|
512
511
|
return (v) => {
|
|
513
512
|
let output = "";
|
|
@@ -527,11 +526,20 @@ function createTransformer(source) {
|
|
|
527
526
|
return output;
|
|
528
527
|
};
|
|
529
528
|
}
|
|
529
|
+
function createTransformer(source) {
|
|
530
|
+
return buildTransformer(analyseComplexValue(source));
|
|
531
|
+
}
|
|
530
532
|
const convertNumbersToZero = (v) => typeof v === "number" ? 0 : color.test(v) ? color.getAnimatableNone(v) : v;
|
|
533
|
+
const convertToZero = (value, splitBefore) => {
|
|
534
|
+
if (typeof value === "number") {
|
|
535
|
+
return splitBefore?.trim().endsWith("/") ? value : 0;
|
|
536
|
+
}
|
|
537
|
+
return convertNumbersToZero(value);
|
|
538
|
+
};
|
|
531
539
|
function getAnimatableNone$1(v) {
|
|
532
|
-
const
|
|
533
|
-
const transformer =
|
|
534
|
-
return transformer(
|
|
540
|
+
const info = analyseComplexValue(v);
|
|
541
|
+
const transformer = buildTransformer(info);
|
|
542
|
+
return transformer(info.values.map((value, i) => convertToZero(value, info.split[i])));
|
|
535
543
|
}
|
|
536
544
|
const complex = {
|
|
537
545
|
test,
|
|
@@ -739,11 +747,6 @@ function createGeneratorEasing(options, scale2 = 100, createGenerator) {
|
|
|
739
747
|
duration: /* @__PURE__ */ millisecondsToSeconds(duration)
|
|
740
748
|
};
|
|
741
749
|
}
|
|
742
|
-
const velocitySampleDuration = 5;
|
|
743
|
-
function calcGeneratorVelocity(resolveValue, t, current) {
|
|
744
|
-
const prevT = Math.max(t - velocitySampleDuration, 0);
|
|
745
|
-
return velocityPerSecond(current - resolveValue(prevT), t - prevT);
|
|
746
|
-
}
|
|
747
750
|
const springDefaults = {
|
|
748
751
|
// Default spring physics
|
|
749
752
|
stiffness: 100,
|
|
@@ -773,6 +776,17 @@ const springDefaults = {
|
|
|
773
776
|
minDamping: 0.05,
|
|
774
777
|
maxDamping: 1
|
|
775
778
|
};
|
|
779
|
+
function calcAngularFreq(undampedFreq, dampingRatio) {
|
|
780
|
+
return undampedFreq * Math.sqrt(1 - dampingRatio * dampingRatio);
|
|
781
|
+
}
|
|
782
|
+
const rootIterations = 12;
|
|
783
|
+
function approximateRoot(envelope, derivative, initialGuess) {
|
|
784
|
+
let result = initialGuess;
|
|
785
|
+
for (let i = 1; i < rootIterations; i++) {
|
|
786
|
+
result = result - envelope(result) / derivative(result);
|
|
787
|
+
}
|
|
788
|
+
return result;
|
|
789
|
+
}
|
|
776
790
|
const safeMin = 1e-3;
|
|
777
791
|
function findSpring({ duration = springDefaults.duration, bounce = springDefaults.bounce, velocity = springDefaults.velocity, mass = springDefaults.mass }) {
|
|
778
792
|
let envelope;
|
|
@@ -830,17 +844,6 @@ function findSpring({ duration = springDefaults.duration, bounce = springDefault
|
|
|
830
844
|
};
|
|
831
845
|
}
|
|
832
846
|
}
|
|
833
|
-
const rootIterations = 12;
|
|
834
|
-
function approximateRoot(envelope, derivative, initialGuess) {
|
|
835
|
-
let result = initialGuess;
|
|
836
|
-
for (let i = 1; i < rootIterations; i++) {
|
|
837
|
-
result = result - envelope(result) / derivative(result);
|
|
838
|
-
}
|
|
839
|
-
return result;
|
|
840
|
-
}
|
|
841
|
-
function calcAngularFreq(undampedFreq, dampingRatio) {
|
|
842
|
-
return undampedFreq * Math.sqrt(1 - dampingRatio * dampingRatio);
|
|
843
|
-
}
|
|
844
847
|
const durationKeys = ["duration", "bounce"];
|
|
845
848
|
const physicsKeys = ["stiffness", "damping", "mass"];
|
|
846
849
|
function isSpringType(options, keys) {
|
|
@@ -856,6 +859,7 @@ function getSpringOptions(options) {
|
|
|
856
859
|
...options
|
|
857
860
|
};
|
|
858
861
|
if (!isSpringType(options, physicsKeys) && isSpringType(options, durationKeys)) {
|
|
862
|
+
springOptions.velocity = 0;
|
|
859
863
|
if (options.visualDuration) {
|
|
860
864
|
const visualDuration = options.visualDuration;
|
|
861
865
|
const root = 2 * Math.PI / (visualDuration * 1.2);
|
|
@@ -868,7 +872,7 @@ function getSpringOptions(options) {
|
|
|
868
872
|
damping
|
|
869
873
|
};
|
|
870
874
|
} else {
|
|
871
|
-
const derived = findSpring(options);
|
|
875
|
+
const derived = findSpring({ ...options, velocity: 0 });
|
|
872
876
|
springOptions = {
|
|
873
877
|
...springOptions,
|
|
874
878
|
...derived,
|
|
@@ -901,14 +905,28 @@ function spring(optionsOrVisualDuration = springDefaults.visualDuration, bounce
|
|
|
901
905
|
restSpeed || (restSpeed = isGranularScale ? springDefaults.restSpeed.granular : springDefaults.restSpeed.default);
|
|
902
906
|
restDelta || (restDelta = isGranularScale ? springDefaults.restDelta.granular : springDefaults.restDelta.default);
|
|
903
907
|
let resolveSpring;
|
|
908
|
+
let resolveVelocity;
|
|
909
|
+
let angularFreq;
|
|
910
|
+
let A;
|
|
911
|
+
let sinCoeff;
|
|
912
|
+
let cosCoeff;
|
|
904
913
|
if (dampingRatio < 1) {
|
|
905
|
-
|
|
914
|
+
angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio);
|
|
915
|
+
A = (initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) / angularFreq;
|
|
906
916
|
resolveSpring = (t) => {
|
|
907
917
|
const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
|
|
908
|
-
return target - envelope * (
|
|
918
|
+
return target - envelope * (A * Math.sin(angularFreq * t) + initialDelta * Math.cos(angularFreq * t));
|
|
919
|
+
};
|
|
920
|
+
sinCoeff = dampingRatio * undampedAngularFreq * A + initialDelta * angularFreq;
|
|
921
|
+
cosCoeff = dampingRatio * undampedAngularFreq * initialDelta - A * angularFreq;
|
|
922
|
+
resolveVelocity = (t) => {
|
|
923
|
+
const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
|
|
924
|
+
return envelope * (sinCoeff * Math.sin(angularFreq * t) + cosCoeff * Math.cos(angularFreq * t));
|
|
909
925
|
};
|
|
910
926
|
} else if (dampingRatio === 1) {
|
|
911
927
|
resolveSpring = (t) => target - Math.exp(-undampedAngularFreq * t) * (initialDelta + (initialVelocity + undampedAngularFreq * initialDelta) * t);
|
|
928
|
+
const C = initialVelocity + undampedAngularFreq * initialDelta;
|
|
929
|
+
resolveVelocity = (t) => Math.exp(-undampedAngularFreq * t) * (undampedAngularFreq * C * t - initialVelocity);
|
|
912
930
|
} else {
|
|
913
931
|
const dampedAngularFreq = undampedAngularFreq * Math.sqrt(dampingRatio * dampingRatio - 1);
|
|
914
932
|
resolveSpring = (t) => {
|
|
@@ -916,19 +934,33 @@ function spring(optionsOrVisualDuration = springDefaults.visualDuration, bounce
|
|
|
916
934
|
const freqForT = Math.min(dampedAngularFreq * t, 300);
|
|
917
935
|
return target - envelope * ((initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) * Math.sinh(freqForT) + dampedAngularFreq * initialDelta * Math.cosh(freqForT)) / dampedAngularFreq;
|
|
918
936
|
};
|
|
937
|
+
const P = (initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) / dampedAngularFreq;
|
|
938
|
+
const sinhCoeff = dampingRatio * undampedAngularFreq * P - initialDelta * dampedAngularFreq;
|
|
939
|
+
const coshCoeff = dampingRatio * undampedAngularFreq * initialDelta - P * dampedAngularFreq;
|
|
940
|
+
resolveVelocity = (t) => {
|
|
941
|
+
const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
|
|
942
|
+
const freqForT = Math.min(dampedAngularFreq * t, 300);
|
|
943
|
+
return envelope * (sinhCoeff * Math.sinh(freqForT) + coshCoeff * Math.cosh(freqForT));
|
|
944
|
+
};
|
|
919
945
|
}
|
|
920
946
|
const generator = {
|
|
921
947
|
calculatedDuration: isResolvedFromDuration ? duration || null : null,
|
|
948
|
+
velocity: (t) => /* @__PURE__ */ secondsToMilliseconds(resolveVelocity(t)),
|
|
922
949
|
next: (t) => {
|
|
950
|
+
if (!isResolvedFromDuration && dampingRatio < 1) {
|
|
951
|
+
const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
|
|
952
|
+
const sin = Math.sin(angularFreq * t);
|
|
953
|
+
const cos = Math.cos(angularFreq * t);
|
|
954
|
+
const current2 = target - envelope * (A * sin + initialDelta * cos);
|
|
955
|
+
const currentVelocity = /* @__PURE__ */ secondsToMilliseconds(envelope * (sinCoeff * sin + cosCoeff * cos));
|
|
956
|
+
state.done = Math.abs(currentVelocity) <= restSpeed && Math.abs(target - current2) <= restDelta;
|
|
957
|
+
state.value = state.done ? target : current2;
|
|
958
|
+
return state;
|
|
959
|
+
}
|
|
923
960
|
const current = resolveSpring(t);
|
|
924
961
|
if (!isResolvedFromDuration) {
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
currentVelocity = t === 0 ? /* @__PURE__ */ secondsToMilliseconds(initialVelocity) : calcGeneratorVelocity(resolveSpring, t, current);
|
|
928
|
-
}
|
|
929
|
-
const isBelowVelocityThreshold = Math.abs(currentVelocity) <= restSpeed;
|
|
930
|
-
const isBelowDisplacementThreshold = Math.abs(target - current) <= restDelta;
|
|
931
|
-
state.done = isBelowVelocityThreshold && isBelowDisplacementThreshold;
|
|
962
|
+
const currentVelocity = /* @__PURE__ */ secondsToMilliseconds(resolveVelocity(t));
|
|
963
|
+
state.done = Math.abs(currentVelocity) <= restSpeed && Math.abs(target - current) <= restDelta;
|
|
932
964
|
} else {
|
|
933
965
|
state.done = t >= duration;
|
|
934
966
|
}
|
|
@@ -952,6 +984,11 @@ spring.applyToOptions = (options) => {
|
|
|
952
984
|
options.type = "keyframes";
|
|
953
985
|
return options;
|
|
954
986
|
};
|
|
987
|
+
const velocitySampleDuration = 5;
|
|
988
|
+
function getGeneratorVelocity(resolveValue, t, current) {
|
|
989
|
+
const prevT = Math.max(t - velocitySampleDuration, 0);
|
|
990
|
+
return velocityPerSecond(current - resolveValue(prevT), t - prevT);
|
|
991
|
+
}
|
|
955
992
|
function inertia({ keyframes: keyframes2, velocity = 0, power = 0.8, timeConstant = 325, bounceDamping = 10, bounceStiffness = 500, modifyTarget, min, max, restDelta = 0.5, restSpeed }) {
|
|
956
993
|
const origin = keyframes2[0];
|
|
957
994
|
const state = {
|
|
@@ -987,7 +1024,7 @@ function inertia({ keyframes: keyframes2, velocity = 0, power = 0.8, timeConstan
|
|
|
987
1024
|
timeReachedBoundary = t;
|
|
988
1025
|
spring$1 = spring({
|
|
989
1026
|
keyframes: [state.value, nearestBoundary(state.value)],
|
|
990
|
-
velocity:
|
|
1027
|
+
velocity: getGeneratorVelocity(calcLatest, t, state.value),
|
|
991
1028
|
// TODO: This should be passing * 1000
|
|
992
1029
|
damping: bounceDamping,
|
|
993
1030
|
stiffness: bounceStiffness,
|
|
@@ -1253,7 +1290,7 @@ class JSAnimation extends WithPromise {
|
|
|
1253
1290
|
elapsed = clamp(0, 1, iterationProgress) * resolvedDuration;
|
|
1254
1291
|
}
|
|
1255
1292
|
const state = isInDelayPhase ? { done: false, value: keyframes2[0] } : frameGenerator.next(elapsed);
|
|
1256
|
-
if (mixKeyframes) {
|
|
1293
|
+
if (mixKeyframes && !isInDelayPhase) {
|
|
1257
1294
|
state.value = mixKeyframes(state.value);
|
|
1258
1295
|
}
|
|
1259
1296
|
let { done } = state;
|
|
@@ -1298,16 +1335,40 @@ class JSAnimation extends WithPromise {
|
|
|
1298
1335
|
} else if (this.driver) {
|
|
1299
1336
|
this.startTime = this.driver.now() - newTime / this.playbackSpeed;
|
|
1300
1337
|
}
|
|
1301
|
-
this.driver
|
|
1338
|
+
if (this.driver) {
|
|
1339
|
+
this.driver.start(false);
|
|
1340
|
+
} else {
|
|
1341
|
+
this.startTime = 0;
|
|
1342
|
+
this.state = "paused";
|
|
1343
|
+
this.holdTime = newTime;
|
|
1344
|
+
this.tick(newTime);
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
/**
|
|
1348
|
+
* Returns the generator's velocity at the current time in units/second.
|
|
1349
|
+
* Uses the analytical derivative when available (springs), avoiding
|
|
1350
|
+
* the MotionValue's frame-dependent velocity estimation.
|
|
1351
|
+
*/
|
|
1352
|
+
getGeneratorVelocity() {
|
|
1353
|
+
const t = this.currentTime;
|
|
1354
|
+
if (t <= 0)
|
|
1355
|
+
return this.options.velocity || 0;
|
|
1356
|
+
if (this.generator.velocity) {
|
|
1357
|
+
return this.generator.velocity(t);
|
|
1358
|
+
}
|
|
1359
|
+
const current = this.generator.next(t).value;
|
|
1360
|
+
return getGeneratorVelocity((s) => this.generator.next(s).value, t, current);
|
|
1302
1361
|
}
|
|
1303
1362
|
get speed() {
|
|
1304
1363
|
return this.playbackSpeed;
|
|
1305
1364
|
}
|
|
1306
1365
|
set speed(newSpeed) {
|
|
1307
|
-
this.updateTime(time.now());
|
|
1308
1366
|
const hasChanged = this.playbackSpeed !== newSpeed;
|
|
1367
|
+
if (hasChanged && this.driver) {
|
|
1368
|
+
this.updateTime(time.now());
|
|
1369
|
+
}
|
|
1309
1370
|
this.playbackSpeed = newSpeed;
|
|
1310
|
-
if (hasChanged) {
|
|
1371
|
+
if (hasChanged && this.driver) {
|
|
1311
1372
|
this.time = /* @__PURE__ */ millisecondsToSeconds(this.currentTime);
|
|
1312
1373
|
}
|
|
1313
1374
|
}
|
|
@@ -1644,12 +1705,12 @@ const isCSSVar = (name) => name.startsWith("--");
|
|
|
1644
1705
|
function setStyle(element, name, value) {
|
|
1645
1706
|
isCSSVar(name) ? element.style.setProperty(name, value) : element.style[name] = value;
|
|
1646
1707
|
}
|
|
1647
|
-
const supportsScrollTimeline = /* @__PURE__ */ memo(() => window.ScrollTimeline !== void 0);
|
|
1648
1708
|
const supportsFlags = {};
|
|
1649
1709
|
function memoSupports(callback, supportsFlag) {
|
|
1650
1710
|
const memoized = /* @__PURE__ */ memo(callback);
|
|
1651
1711
|
return () => supportsFlags[supportsFlag] ?? memoized();
|
|
1652
1712
|
}
|
|
1713
|
+
const supportsScrollTimeline = /* @__PURE__ */ memoSupports(() => window.ScrollTimeline !== void 0, "scrollTimeline");
|
|
1653
1714
|
const supportsLinearEasing = /* @__PURE__ */ memoSupports(() => {
|
|
1654
1715
|
try {
|
|
1655
1716
|
document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" });
|
|
@@ -1741,9 +1802,8 @@ class NativeAnimation extends WithPromise {
|
|
|
1741
1802
|
const keyframe = getFinalKeyframe$1(keyframes2, this.options, finalKeyframe, this.speed);
|
|
1742
1803
|
if (this.updateMotionValue) {
|
|
1743
1804
|
this.updateMotionValue(keyframe);
|
|
1744
|
-
} else {
|
|
1745
|
-
setStyle(element, name, keyframe);
|
|
1746
1805
|
}
|
|
1806
|
+
setStyle(element, name, keyframe);
|
|
1747
1807
|
this.animation.cancel();
|
|
1748
1808
|
}
|
|
1749
1809
|
onComplete?.();
|
|
@@ -1817,9 +1877,13 @@ class NativeAnimation extends WithPromise {
|
|
|
1817
1877
|
return /* @__PURE__ */ millisecondsToSeconds(Number(this.animation.currentTime) || 0);
|
|
1818
1878
|
}
|
|
1819
1879
|
set time(newTime) {
|
|
1880
|
+
const wasFinished = this.finishedTime !== null;
|
|
1820
1881
|
this.manualStartTime = null;
|
|
1821
1882
|
this.finishedTime = null;
|
|
1822
1883
|
this.animation.currentTime = /* @__PURE__ */ secondsToMilliseconds(newTime);
|
|
1884
|
+
if (wasFinished) {
|
|
1885
|
+
this.animation.pause();
|
|
1886
|
+
}
|
|
1823
1887
|
}
|
|
1824
1888
|
/**
|
|
1825
1889
|
* The playback speed of the animation.
|
|
@@ -1845,13 +1909,17 @@ class NativeAnimation extends WithPromise {
|
|
|
1845
1909
|
/**
|
|
1846
1910
|
* Attaches a timeline to the animation, for instance the `ScrollTimeline`.
|
|
1847
1911
|
*/
|
|
1848
|
-
attachTimeline({ timeline, observe }) {
|
|
1912
|
+
attachTimeline({ timeline, rangeStart, rangeEnd, observe }) {
|
|
1849
1913
|
if (this.allowFlatten) {
|
|
1850
1914
|
this.animation.effect?.updateTiming({ easing: "linear" });
|
|
1851
1915
|
}
|
|
1852
1916
|
this.animation.onfinish = null;
|
|
1853
1917
|
if (timeline && supportsScrollTimeline()) {
|
|
1854
1918
|
this.animation.timeline = timeline;
|
|
1919
|
+
if (rangeStart)
|
|
1920
|
+
this.animation.rangeStart = rangeStart;
|
|
1921
|
+
if (rangeEnd)
|
|
1922
|
+
this.animation.rangeEnd = rangeEnd;
|
|
1855
1923
|
return noop;
|
|
1856
1924
|
} else {
|
|
1857
1925
|
return observe(this);
|
|
@@ -1877,7 +1945,7 @@ class NativeAnimationExtended extends NativeAnimation {
|
|
|
1877
1945
|
replaceStringEasing(options);
|
|
1878
1946
|
replaceTransitionType(options);
|
|
1879
1947
|
super(options);
|
|
1880
|
-
if (options.startTime !== void 0) {
|
|
1948
|
+
if (options.startTime !== void 0 && options.autoplay !== false) {
|
|
1881
1949
|
this.startTime = options.startTime;
|
|
1882
1950
|
}
|
|
1883
1951
|
this.options = options;
|
|
@@ -1904,7 +1972,11 @@ class NativeAnimationExtended extends NativeAnimation {
|
|
|
1904
1972
|
});
|
|
1905
1973
|
const sampleTime = Math.max(sampleDelta, time.now() - this.startTime);
|
|
1906
1974
|
const delta = clamp(0, sampleDelta, sampleTime - sampleDelta);
|
|
1907
|
-
|
|
1975
|
+
const current = sampleAnimation.sample(sampleTime).value;
|
|
1976
|
+
const { name } = this.options;
|
|
1977
|
+
if (element && name)
|
|
1978
|
+
setStyle(element, name, current);
|
|
1979
|
+
motionValue2.setWithVelocity(sampleAnimation.sample(Math.max(0, sampleTime - delta)).value, current, delta);
|
|
1908
1980
|
sampleAnimation.stop();
|
|
1909
1981
|
}
|
|
1910
1982
|
}
|
|
@@ -2737,6 +2809,14 @@ const filter = {
|
|
|
2737
2809
|
return functions ? functions.map(applyDefaultFilter).join(" ") : v;
|
|
2738
2810
|
}
|
|
2739
2811
|
};
|
|
2812
|
+
const mask = {
|
|
2813
|
+
...complex,
|
|
2814
|
+
getAnimatableNone: (v) => {
|
|
2815
|
+
const parsed = complex.parse(v);
|
|
2816
|
+
const transformer = complex.createTransformer(v);
|
|
2817
|
+
return transformer(parsed.map((v2) => typeof v2 === "number" ? 0 : typeof v2 === "object" ? { ...v2, alpha: 1 } : v2));
|
|
2818
|
+
}
|
|
2819
|
+
};
|
|
2740
2820
|
const int = {
|
|
2741
2821
|
...number,
|
|
2742
2822
|
transform: Math.round
|
|
@@ -2845,12 +2925,15 @@ const defaultValueTypes = {
|
|
|
2845
2925
|
borderBottomColor: color,
|
|
2846
2926
|
borderLeftColor: color,
|
|
2847
2927
|
filter,
|
|
2848
|
-
WebkitFilter: filter
|
|
2928
|
+
WebkitFilter: filter,
|
|
2929
|
+
mask,
|
|
2930
|
+
WebkitMask: mask
|
|
2849
2931
|
};
|
|
2850
2932
|
const getDefaultValueType = (key) => defaultValueTypes[key];
|
|
2933
|
+
const customTypes = /* @__PURE__ */ new Set([filter, mask]);
|
|
2851
2934
|
function getAnimatableNone(key, value) {
|
|
2852
2935
|
let defaultValueType = getDefaultValueType(key);
|
|
2853
|
-
if (defaultValueType
|
|
2936
|
+
if (!customTypes.has(defaultValueType))
|
|
2854
2937
|
defaultValueType = complex;
|
|
2855
2938
|
return defaultValueType.getAnimatableNone ? defaultValueType.getAnimatableNone(value) : void 0;
|
|
2856
2939
|
}
|
|
@@ -3900,7 +3983,7 @@ function applyTreeDeltas(box, treeScale, treePath, isSharedTransition = false) {
|
|
|
3900
3983
|
applyBoxDelta(box, delta);
|
|
3901
3984
|
}
|
|
3902
3985
|
if (isSharedTransition && hasTransform(node.latestValues)) {
|
|
3903
|
-
transformBox(box, node.latestValues);
|
|
3986
|
+
transformBox(box, node.latestValues, node.layout?.layoutBox);
|
|
3904
3987
|
}
|
|
3905
3988
|
}
|
|
3906
3989
|
if (treeScale.x < TREE_SCALE_SNAP_MAX && treeScale.x > TREE_SCALE_SNAP_MIN) {
|
|
@@ -3918,9 +4001,16 @@ function transformAxis(axis, axisTranslate, axisScale, boxScale, axisOrigin = 0.
|
|
|
3918
4001
|
const originPoint = mixNumber$1(axis.min, axis.max, axisOrigin);
|
|
3919
4002
|
applyAxisDelta(axis, axisTranslate, axisScale, originPoint, boxScale);
|
|
3920
4003
|
}
|
|
3921
|
-
function
|
|
3922
|
-
|
|
3923
|
-
|
|
4004
|
+
function resolveAxisTranslate(value, axis) {
|
|
4005
|
+
if (typeof value === "string") {
|
|
4006
|
+
return parseFloat(value) / 100 * (axis.max - axis.min);
|
|
4007
|
+
}
|
|
4008
|
+
return value;
|
|
4009
|
+
}
|
|
4010
|
+
function transformBox(box, transform, sourceBox) {
|
|
4011
|
+
const resolveBox = sourceBox ?? box;
|
|
4012
|
+
transformAxis(box.x, resolveAxisTranslate(transform.x, resolveBox.x), transform.scaleX, transform.scale, transform.originX);
|
|
4013
|
+
transformAxis(box.y, resolveAxisTranslate(transform.y, resolveBox.y), transform.scaleY, transform.scale, transform.originY);
|
|
3924
4014
|
}
|
|
3925
4015
|
function measureViewportBox(instance, transformPoint2) {
|
|
3926
4016
|
return convertBoundingBoxToBox(transformBoxPoints(instance.getBoundingClientRect(), transformPoint2));
|
|
@@ -4308,6 +4398,7 @@ function createAnimationState(visualElement) {
|
|
|
4308
4398
|
let animate = createAnimateFunction(visualElement);
|
|
4309
4399
|
let state = createState();
|
|
4310
4400
|
let isInitialRender = true;
|
|
4401
|
+
let wasReset = false;
|
|
4311
4402
|
const buildResolvedTypeValues = (type) => (acc, definition) => {
|
|
4312
4403
|
const resolved = resolveVariant(visualElement, definition, type === "exit" ? visualElement.presenceContext?.custom : void 0);
|
|
4313
4404
|
if (resolved) {
|
|
@@ -4335,7 +4426,7 @@ function createAnimationState(visualElement) {
|
|
|
4335
4426
|
if (activeDelta === false)
|
|
4336
4427
|
removedVariantIndex = i;
|
|
4337
4428
|
let isInherited = prop === context[type] && prop !== props[type] && propIsVariant;
|
|
4338
|
-
if (isInherited && isInitialRender && visualElement.manuallyAnimateOnMount) {
|
|
4429
|
+
if (isInherited && (isInitialRender || wasReset) && visualElement.manuallyAnimateOnMount) {
|
|
4339
4430
|
isInherited = false;
|
|
4340
4431
|
}
|
|
4341
4432
|
typeState.protectedKeys = { ...encounteredKeys };
|
|
@@ -4409,7 +4500,7 @@ function createAnimationState(visualElement) {
|
|
|
4409
4500
|
if (typeState.isActive) {
|
|
4410
4501
|
encounteredKeys = { ...encounteredKeys, ...resolvedValues };
|
|
4411
4502
|
}
|
|
4412
|
-
if (isInitialRender && visualElement.blockInitialAnimation) {
|
|
4503
|
+
if ((isInitialRender || wasReset) && visualElement.blockInitialAnimation) {
|
|
4413
4504
|
shouldAnimateType = false;
|
|
4414
4505
|
}
|
|
4415
4506
|
const willAnimateViaParent = isInherited && variantDidChange;
|
|
@@ -4417,7 +4508,7 @@ function createAnimationState(visualElement) {
|
|
|
4417
4508
|
if (shouldAnimateType && needsAnimating) {
|
|
4418
4509
|
animations2.push(...definitionList.map((animation) => {
|
|
4419
4510
|
const options = { type };
|
|
4420
|
-
if (typeof animation === "string" && isInitialRender && !willAnimateViaParent && visualElement.manuallyAnimateOnMount && visualElement.parent) {
|
|
4511
|
+
if (typeof animation === "string" && (isInitialRender || wasReset) && !willAnimateViaParent && visualElement.manuallyAnimateOnMount && visualElement.parent) {
|
|
4421
4512
|
const { parent } = visualElement;
|
|
4422
4513
|
const parentVariant = resolveVariant(parent, animation);
|
|
4423
4514
|
if (parent.enteringChildren && parentVariant) {
|
|
@@ -4454,6 +4545,7 @@ function createAnimationState(visualElement) {
|
|
|
4454
4545
|
shouldAnimate = false;
|
|
4455
4546
|
}
|
|
4456
4547
|
isInitialRender = false;
|
|
4548
|
+
wasReset = false;
|
|
4457
4549
|
return shouldAnimate ? animate(animations2) : Promise.resolve();
|
|
4458
4550
|
}
|
|
4459
4551
|
function setActive(type, isActive) {
|
|
@@ -4474,6 +4566,7 @@ function createAnimationState(visualElement) {
|
|
|
4474
4566
|
getState: () => state,
|
|
4475
4567
|
reset: () => {
|
|
4476
4568
|
state = createState();
|
|
4569
|
+
wasReset = true;
|
|
4477
4570
|
}
|
|
4478
4571
|
};
|
|
4479
4572
|
}
|
|
@@ -4751,47 +4844,36 @@ class NodeStack {
|
|
|
4751
4844
|
add(node) {
|
|
4752
4845
|
addUniqueItem(this.members, node);
|
|
4753
4846
|
for (let i = this.members.length - 1; i >= 0; i--) {
|
|
4754
|
-
const
|
|
4755
|
-
if (
|
|
4847
|
+
const member = this.members[i];
|
|
4848
|
+
if (member === node || member === this.lead || member === this.prevLead)
|
|
4756
4849
|
continue;
|
|
4757
|
-
const inst =
|
|
4758
|
-
if (inst
|
|
4759
|
-
removeItem(this.members,
|
|
4850
|
+
const inst = member.instance;
|
|
4851
|
+
if ((!inst || inst.isConnected === false) && !member.snapshot) {
|
|
4852
|
+
removeItem(this.members, member);
|
|
4853
|
+
member.unmount();
|
|
4760
4854
|
}
|
|
4761
4855
|
}
|
|
4762
4856
|
node.scheduleRender();
|
|
4763
4857
|
}
|
|
4764
4858
|
remove(node) {
|
|
4765
4859
|
removeItem(this.members, node);
|
|
4766
|
-
if (node === this.prevLead)
|
|
4860
|
+
if (node === this.prevLead)
|
|
4767
4861
|
this.prevLead = void 0;
|
|
4768
|
-
}
|
|
4769
4862
|
if (node === this.lead) {
|
|
4770
4863
|
const prevLead = this.members[this.members.length - 1];
|
|
4771
|
-
if (prevLead)
|
|
4864
|
+
if (prevLead)
|
|
4772
4865
|
this.promote(prevLead);
|
|
4773
|
-
}
|
|
4774
4866
|
}
|
|
4775
4867
|
}
|
|
4776
4868
|
relegate(node) {
|
|
4777
|
-
|
|
4778
|
-
if (indexOfNode === 0)
|
|
4779
|
-
return false;
|
|
4780
|
-
let prevLead;
|
|
4781
|
-
for (let i = indexOfNode; i >= 0; i--) {
|
|
4869
|
+
for (let i = this.members.indexOf(node) - 1; i >= 0; i--) {
|
|
4782
4870
|
const member = this.members[i];
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
break;
|
|
4871
|
+
if (member.isPresent !== false && member.instance?.isConnected !== false) {
|
|
4872
|
+
this.promote(member);
|
|
4873
|
+
return true;
|
|
4787
4874
|
}
|
|
4788
4875
|
}
|
|
4789
|
-
|
|
4790
|
-
this.promote(prevLead);
|
|
4791
|
-
return true;
|
|
4792
|
-
} else {
|
|
4793
|
-
return false;
|
|
4794
|
-
}
|
|
4876
|
+
return false;
|
|
4795
4877
|
}
|
|
4796
4878
|
promote(node, preserveFollowOpacity) {
|
|
4797
4879
|
const prevLead = this.lead;
|
|
@@ -4801,56 +4883,37 @@ class NodeStack {
|
|
|
4801
4883
|
this.lead = node;
|
|
4802
4884
|
node.show();
|
|
4803
4885
|
if (prevLead) {
|
|
4804
|
-
prevLead.
|
|
4886
|
+
prevLead.updateSnapshot();
|
|
4805
4887
|
node.scheduleRender();
|
|
4806
|
-
const prevDep = prevLead.options
|
|
4807
|
-
const nextDep = node.options
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
if (
|
|
4813
|
-
node.
|
|
4814
|
-
|
|
4815
|
-
node.resumeFrom.preserveOpacity = true;
|
|
4816
|
-
}
|
|
4817
|
-
if (prevLead.snapshot) {
|
|
4818
|
-
node.snapshot = prevLead.snapshot;
|
|
4819
|
-
node.snapshot.latestValues = prevLead.animationValues || prevLead.latestValues;
|
|
4820
|
-
}
|
|
4821
|
-
if (node.root && node.root.isUpdating) {
|
|
4822
|
-
node.isLayoutDirty = true;
|
|
4823
|
-
}
|
|
4888
|
+
const { layoutDependency: prevDep } = prevLead.options;
|
|
4889
|
+
const { layoutDependency: nextDep } = node.options;
|
|
4890
|
+
if (prevDep === void 0 || prevDep !== nextDep) {
|
|
4891
|
+
node.resumeFrom = prevLead;
|
|
4892
|
+
if (preserveFollowOpacity)
|
|
4893
|
+
prevLead.preserveOpacity = true;
|
|
4894
|
+
if (prevLead.snapshot) {
|
|
4895
|
+
node.snapshot = prevLead.snapshot;
|
|
4896
|
+
node.snapshot.latestValues = prevLead.animationValues || prevLead.latestValues;
|
|
4824
4897
|
}
|
|
4898
|
+
if (node.root?.isUpdating)
|
|
4899
|
+
node.isLayoutDirty = true;
|
|
4825
4900
|
}
|
|
4826
|
-
|
|
4827
|
-
if (crossfade === false) {
|
|
4901
|
+
if (node.options.crossfade === false)
|
|
4828
4902
|
prevLead.hide();
|
|
4829
|
-
}
|
|
4830
4903
|
}
|
|
4831
4904
|
}
|
|
4832
4905
|
exitAnimationComplete() {
|
|
4833
|
-
this.members.forEach((
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
if (resumingFrom) {
|
|
4837
|
-
resumingFrom.options.onExitComplete && resumingFrom.options.onExitComplete();
|
|
4838
|
-
}
|
|
4906
|
+
this.members.forEach((member) => {
|
|
4907
|
+
member.options.onExitComplete?.();
|
|
4908
|
+
member.resumingFrom?.options.onExitComplete?.();
|
|
4839
4909
|
});
|
|
4840
4910
|
}
|
|
4841
4911
|
scheduleRender() {
|
|
4842
|
-
this.members.forEach((
|
|
4843
|
-
node.instance && node.scheduleRender(false);
|
|
4844
|
-
});
|
|
4912
|
+
this.members.forEach((member) => member.instance && member.scheduleRender(false));
|
|
4845
4913
|
}
|
|
4846
|
-
/**
|
|
4847
|
-
* Clear any leads that have been removed this render to prevent them from being
|
|
4848
|
-
* used in future animations and to prevent memory leaks
|
|
4849
|
-
*/
|
|
4850
4914
|
removeLeadSnapshot() {
|
|
4851
|
-
if (this.lead
|
|
4915
|
+
if (this.lead?.snapshot)
|
|
4852
4916
|
this.lead.snapshot = void 0;
|
|
4853
|
-
}
|
|
4854
4917
|
}
|
|
4855
4918
|
}
|
|
4856
4919
|
const globalProjectionState = {
|
|
@@ -5097,6 +5160,9 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
|
|
|
5097
5160
|
for (let i = 0; i < this.path.length; i++) {
|
|
5098
5161
|
const node = this.path[i];
|
|
5099
5162
|
node.shouldResetTransform = true;
|
|
5163
|
+
if (typeof node.latestValues.x === "string" || typeof node.latestValues.y === "string") {
|
|
5164
|
+
node.isLayoutDirty = true;
|
|
5165
|
+
}
|
|
5100
5166
|
node.updateScroll("snapshot");
|
|
5101
5167
|
if (node.options.layoutRoot) {
|
|
5102
5168
|
node.willUpdate(false);
|
|
@@ -5293,10 +5359,10 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
|
|
|
5293
5359
|
}
|
|
5294
5360
|
if (!hasTransform(node.latestValues))
|
|
5295
5361
|
continue;
|
|
5296
|
-
transformBox(withTransforms, node.latestValues);
|
|
5362
|
+
transformBox(withTransforms, node.latestValues, node.layout?.layoutBox);
|
|
5297
5363
|
}
|
|
5298
5364
|
if (hasTransform(this.latestValues)) {
|
|
5299
|
-
transformBox(withTransforms, this.latestValues);
|
|
5365
|
+
transformBox(withTransforms, this.latestValues, this.layout?.layoutBox);
|
|
5300
5366
|
}
|
|
5301
5367
|
return withTransforms;
|
|
5302
5368
|
}
|
|
@@ -5305,15 +5371,15 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
|
|
|
5305
5371
|
copyBoxInto(boxWithoutTransform, box);
|
|
5306
5372
|
for (let i = 0; i < this.path.length; i++) {
|
|
5307
5373
|
const node = this.path[i];
|
|
5308
|
-
if (!node.instance)
|
|
5309
|
-
continue;
|
|
5310
5374
|
if (!hasTransform(node.latestValues))
|
|
5311
5375
|
continue;
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5376
|
+
let sourceBox;
|
|
5377
|
+
if (node.instance) {
|
|
5378
|
+
hasScale(node.latestValues) && node.updateSnapshot();
|
|
5379
|
+
sourceBox = createBox();
|
|
5380
|
+
copyBoxInto(sourceBox, node.measurePageBox());
|
|
5381
|
+
}
|
|
5382
|
+
removeBoxTransforms(boxWithoutTransform, node.latestValues, node.snapshot?.layoutBox, sourceBox);
|
|
5317
5383
|
}
|
|
5318
5384
|
if (hasTransform(this.latestValues)) {
|
|
5319
5385
|
removeBoxTransforms(boxWithoutTransform, this.latestValues);
|
|
@@ -5551,6 +5617,7 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
|
|
|
5551
5617
|
this.pendingAnimation = frame.update(() => {
|
|
5552
5618
|
globalProjectionState.hasAnimatedSinceResize = true;
|
|
5553
5619
|
this.motionValue || (this.motionValue = motionValue(0));
|
|
5620
|
+
this.motionValue.jump(0, false);
|
|
5554
5621
|
this.currentAnimation = animateSingleValue(this.motionValue, [0, 1e3], {
|
|
5555
5622
|
...options,
|
|
5556
5623
|
velocity: 0,
|
|
@@ -5984,13 +6051,14 @@ function useComposedRefs(...refs) {
|
|
|
5984
6051
|
class PopChildMeasure extends $dbSRa$react.Component {
|
|
5985
6052
|
getSnapshotBeforeUpdate(prevProps) {
|
|
5986
6053
|
const element = this.props.childRef.current;
|
|
5987
|
-
if (element && prevProps.isPresent && !this.props.isPresent && this.props.pop !== false) {
|
|
6054
|
+
if (isHTMLElement(element) && prevProps.isPresent && !this.props.isPresent && this.props.pop !== false) {
|
|
5988
6055
|
const parent = element.offsetParent;
|
|
5989
6056
|
const parentWidth = isHTMLElement(parent) ? parent.offsetWidth || 0 : 0;
|
|
5990
6057
|
const parentHeight = isHTMLElement(parent) ? parent.offsetHeight || 0 : 0;
|
|
6058
|
+
const computedStyle = getComputedStyle(element);
|
|
5991
6059
|
const size = this.props.sizeRef.current;
|
|
5992
|
-
size.height =
|
|
5993
|
-
size.width =
|
|
6060
|
+
size.height = parseFloat(computedStyle.height);
|
|
6061
|
+
size.width = parseFloat(computedStyle.width);
|
|
5994
6062
|
size.top = element.offsetTop;
|
|
5995
6063
|
size.left = element.offsetLeft;
|
|
5996
6064
|
size.right = parentWidth - size.width - size.left;
|
|
@@ -6513,9 +6581,6 @@ function useMotionRef(visualState, visualElement, externalRef) {
|
|
|
6513
6581
|
if (instance) {
|
|
6514
6582
|
visualState.onMount?.(instance);
|
|
6515
6583
|
}
|
|
6516
|
-
if (visualElement) {
|
|
6517
|
-
instance ? visualElement.mount(instance) : visualElement.unmount();
|
|
6518
|
-
}
|
|
6519
6584
|
const ref = externalRefContainer.current;
|
|
6520
6585
|
if (typeof ref === "function") {
|
|
6521
6586
|
if (instance) {
|
|
@@ -6532,6 +6597,9 @@ function useMotionRef(visualState, visualElement, externalRef) {
|
|
|
6532
6597
|
} else if (ref) {
|
|
6533
6598
|
ref.current = instance;
|
|
6534
6599
|
}
|
|
6600
|
+
if (visualElement) {
|
|
6601
|
+
instance ? visualElement.mount(instance) : visualElement.unmount();
|
|
6602
|
+
}
|
|
6535
6603
|
}, [visualElement]);
|
|
6536
6604
|
}
|
|
6537
6605
|
const SwitchLayoutGroupContext = createContext({});
|
|
@@ -6575,7 +6643,7 @@ function useVisualElement(Component2, visualState, props, createVisualElement, P
|
|
|
6575
6643
|
}
|
|
6576
6644
|
});
|
|
6577
6645
|
const optimisedAppearId = props[optimizedAppearDataAttribute];
|
|
6578
|
-
const wantsHandoff = useRef(Boolean(optimisedAppearId) && !window.MotionHandoffIsComplete?.(optimisedAppearId) && window.MotionHasOptimisedAnimation?.(optimisedAppearId));
|
|
6646
|
+
const wantsHandoff = useRef(Boolean(optimisedAppearId) && typeof window !== "undefined" && !window.MotionHandoffIsComplete?.(optimisedAppearId) && window.MotionHasOptimisedAnimation?.(optimisedAppearId));
|
|
6579
6647
|
useIsomorphicLayoutEffect(() => {
|
|
6580
6648
|
hasMountedOnce.current = true;
|
|
6581
6649
|
if (!visualElement)
|
|
@@ -6645,7 +6713,7 @@ function createMotionComponent(Component2, { forwardMotionProps = false, type }
|
|
|
6645
6713
|
const { isStatic } = configAndProps;
|
|
6646
6714
|
const context = useCreateMotionContext(props);
|
|
6647
6715
|
const visualState = useVisualState(props, isStatic);
|
|
6648
|
-
if (!isStatic &&
|
|
6716
|
+
if (!isStatic && typeof window !== "undefined") {
|
|
6649
6717
|
useStrictMode(configAndProps, preloadedFeatures);
|
|
6650
6718
|
const layoutProjection = getProjectionFunctionality(configAndProps);
|
|
6651
6719
|
MeasureLayout2 = layoutProjection.MeasureLayout;
|
|
@@ -6799,9 +6867,7 @@ function extractEventInfo(event) {
|
|
|
6799
6867
|
}
|
|
6800
6868
|
};
|
|
6801
6869
|
}
|
|
6802
|
-
const addPointerInfo = (handler) =>
|
|
6803
|
-
return (event) => isPrimaryPointer(event) && handler(event, extractEventInfo(event));
|
|
6804
|
-
};
|
|
6870
|
+
const addPointerInfo = (handler) => (event) => isPrimaryPointer(event) && handler(event, extractEventInfo(event));
|
|
6805
6871
|
function addPointerEvent(target, eventName, handler, options) {
|
|
6806
6872
|
return addDomEvent(target, eventName, addPointerInfo(handler), options);
|
|
6807
6873
|
}
|
|
@@ -6820,6 +6886,7 @@ class PanSession {
|
|
|
6820
6886
|
this.startEvent = null;
|
|
6821
6887
|
this.lastMoveEvent = null;
|
|
6822
6888
|
this.lastMoveEventInfo = null;
|
|
6889
|
+
this.lastRawMoveEventInfo = null;
|
|
6823
6890
|
this.handlers = {};
|
|
6824
6891
|
this.contextWindow = window;
|
|
6825
6892
|
this.scrollPositions = /* @__PURE__ */ new Map();
|
|
@@ -6833,6 +6900,9 @@ class PanSession {
|
|
|
6833
6900
|
this.updatePoint = () => {
|
|
6834
6901
|
if (!(this.lastMoveEvent && this.lastMoveEventInfo))
|
|
6835
6902
|
return;
|
|
6903
|
+
if (this.lastRawMoveEventInfo) {
|
|
6904
|
+
this.lastMoveEventInfo = transformPoint(this.lastRawMoveEventInfo, this.transformPagePoint);
|
|
6905
|
+
}
|
|
6836
6906
|
const info2 = getPanInfo(this.lastMoveEventInfo, this.history);
|
|
6837
6907
|
const isPanStarted = this.startEvent !== null;
|
|
6838
6908
|
const isDistancePastThreshold = distance2D(info2.offset, { x: 0, y: 0 }) >= this.distanceThreshold;
|
|
@@ -6850,6 +6920,7 @@ class PanSession {
|
|
|
6850
6920
|
};
|
|
6851
6921
|
this.handlePointerMove = (event2, info2) => {
|
|
6852
6922
|
this.lastMoveEvent = event2;
|
|
6923
|
+
this.lastRawMoveEventInfo = info2;
|
|
6853
6924
|
this.lastMoveEventInfo = transformPoint(info2, this.transformPagePoint);
|
|
6854
6925
|
frame.update(this.updatePoint, true);
|
|
6855
6926
|
};
|
|
@@ -6906,12 +6977,9 @@ class PanSession {
|
|
|
6906
6977
|
y: window.scrollY
|
|
6907
6978
|
});
|
|
6908
6979
|
window.addEventListener("scroll", this.onElementScroll, {
|
|
6909
|
-
capture: true
|
|
6910
|
-
passive: true
|
|
6911
|
-
});
|
|
6912
|
-
window.addEventListener("scroll", this.onWindowScroll, {
|
|
6913
|
-
passive: true
|
|
6980
|
+
capture: true
|
|
6914
6981
|
});
|
|
6982
|
+
window.addEventListener("scroll", this.onWindowScroll);
|
|
6915
6983
|
this.removeScrollListeners = () => {
|
|
6916
6984
|
window.removeEventListener("scroll", this.onElementScroll, {
|
|
6917
6985
|
capture: true
|