@helpdice/ui 1.7.5 → 1.7.8
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/CurrencyInput/index.js +2981 -0
- package/dist/LinearProgress/index.d.ts +2 -0
- package/dist/{css-baseline → LinearProgress}/index.js +25 -317
- package/dist/LinearProgress/linear-progress.d.ts +9 -0
- package/dist/Loadable/index.js +570 -0
- package/dist/PhoneInput/index.js +2136 -314
- package/dist/Placeholder/index.js +2116 -254
- package/dist/auto-complete/index.js +2145 -652
- package/dist/avatar/index.js +2119 -333
- package/dist/badge/index.js +2117 -331
- package/dist/breadcrumbs/index.js +2126 -340
- package/dist/button/button.compact.d.ts +2 -0
- package/dist/button/index.js +2214 -342
- package/dist/button-dropdown/index.js +2120 -291
- package/dist/button-group/index.js +2117 -331
- package/dist/capacity/index.js +2117 -331
- package/dist/card/index.js +2127 -298
- package/dist/checkbox/index.js +2119 -290
- package/dist/code/index.js +2116 -297
- package/dist/collapse/index.js +2117 -475
- package/dist/description/index.js +2117 -331
- package/dist/display/index.js +2117 -331
- package/dist/divider/index.js +2118 -332
- package/dist/dot/index.js +2117 -331
- package/dist/drawer/index.js +2129 -439
- package/dist/fieldset/index.js +2121 -354
- package/dist/grid/index.js +2119 -333
- package/dist/image/index.js +2122 -336
- package/dist/index.d.ts +2 -14
- package/dist/index.js +3175 -1879
- package/dist/input/index.js +2125 -296
- package/dist/keyboard/index.js +2116 -297
- package/dist/link/index.js +2117 -331
- package/dist/list/index.js +2119 -333
- package/dist/loading/index.js +2117 -331
- package/dist/menu/index.js +77 -45
- package/dist/modal/index.js +2145 -452
- package/dist/note/index.js +2117 -331
- package/dist/page/index.js +2117 -331
- package/dist/pagination/index.js +2118 -351
- package/dist/popover/index.js +2123 -354
- package/dist/progress/index.js +2117 -331
- package/dist/radio/index.js +2120 -334
- package/dist/rating/index.js +2118 -332
- package/dist/row/index.js +2115 -296
- package/dist/select/index.js +2151 -688
- package/dist/slider/index.js +2123 -356
- package/dist/snippet/index.js +2118 -421
- package/dist/spacer/index.js +2115 -296
- package/dist/spinner/index.js +2117 -331
- package/dist/table/index.js +2341 -754
- package/dist/tabs/index.js +2123 -344
- package/dist/tag/index.js +2116 -254
- package/dist/text/index.js +2116 -297
- package/dist/textarea/index.js +2117 -288
- package/dist/toggle/index.js +2117 -331
- package/dist/tooltip/index.js +2120 -351
- package/dist/tree/index.js +2123 -459
- package/dist/use-input/index.js +2122 -24
- package/dist/use-modal/index.js +2122 -24
- package/dist/use-network-status/index.d.ts +2 -0
- package/dist/{use-current-state → use-network-status}/index.js +22 -15
- package/dist/use-network-status/use-netowork-status.d.ts +4 -0
- package/dist/use-scale/index.js +2115 -296
- package/dist/use-tabs/index.js +2122 -24
- package/dist/user/index.js +2123 -337
- package/esm/CurrencyInput/components/CurrencyInput.js +342 -0
- package/esm/CurrencyInput/components/CurrencyInputProps.js +1 -0
- package/esm/CurrencyInput/components/utils/addSeparators.js +7 -0
- package/esm/CurrencyInput/components/utils/cleanValue.js +69 -0
- package/esm/CurrencyInput/components/utils/escapeRegExp.js +8 -0
- package/esm/CurrencyInput/components/utils/fixedDecimalValue.js +29 -0
- package/esm/CurrencyInput/components/utils/formatValue.js +124 -0
- package/esm/CurrencyInput/components/utils/getLocaleConfig.js +47 -0
- package/esm/CurrencyInput/components/utils/getSuffix.js +10 -0
- package/esm/CurrencyInput/components/utils/index.js +8 -0
- package/esm/CurrencyInput/components/utils/isNumber.js +3 -0
- package/esm/CurrencyInput/components/utils/padTrimValue.js +27 -0
- package/esm/CurrencyInput/components/utils/parseAbbrValue.js +43 -0
- package/esm/CurrencyInput/components/utils/removeInvalidChars.js +10 -0
- package/esm/CurrencyInput/components/utils/removeSeparators.js +10 -0
- package/esm/CurrencyInput/components/utils/repositionCursor.js +35 -0
- package/esm/CurrencyInput/index.js +4 -0
- package/esm/LinearProgress/index.d.ts +2 -0
- package/esm/LinearProgress/index.js +2 -0
- package/esm/LinearProgress/linear-progress.d.ts +9 -0
- package/esm/LinearProgress/linear-progress.js +28 -0
- package/esm/Loadable/index.js +2 -0
- package/esm/PhoneInput/phone.js +22 -19
- package/esm/auto-complete/auto-complete-dropdown.js +1 -3
- package/esm/auto-complete/auto-complete-item.js +1 -3
- package/esm/auto-complete/auto-complete-searching.js +1 -1
- package/esm/auto-complete/auto-complete.js +1 -1
- package/esm/avatar/avatar-group.js +1 -2
- package/esm/avatar/avatar.js +1 -2
- package/esm/badge/badge.js +1 -2
- package/esm/breadcrumbs/breadcrumbs-item.js +1 -1
- package/esm/breadcrumbs/breadcrumbs-separator.js +1 -1
- package/esm/breadcrumbs/breadcrumbs.js +1 -1
- package/esm/button/button-icon.js +1 -1
- package/esm/button/button.compact.d.ts +2 -0
- package/esm/button/button.compact.js +94 -50
- package/esm/button/button.js +1 -2
- package/esm/button/utils.js +1 -1
- package/esm/button-dropdown/button-dropdown-item.js +1 -1
- package/esm/button-dropdown/button-dropdown.js +1 -2
- package/esm/button-group/button-group.js +1 -2
- package/esm/capacity/capacity.js +1 -2
- package/esm/card/card-content.js +1 -1
- package/esm/card/card-footer.js +1 -2
- package/esm/card/card.js +1 -2
- package/esm/carousal/Arrow.js +18 -0
- package/esm/carousal/Indicator.js +20 -0
- package/esm/carousal/Thumbs.js +302 -0
- package/esm/carousal/animations.js +162 -0
- package/esm/carousal/index.js +683 -0
- package/esm/carousal/types.js +1 -0
- package/esm/carousal/utils.js +49 -0
- package/esm/checkbox/checkbox-group.js +1 -1
- package/esm/checkbox/checkbox.icon.js +1 -1
- package/esm/checkbox/checkbox.js +1 -2
- package/esm/code/code.js +1 -1
- package/esm/collapse/collapse-group.js +1 -2
- package/esm/collapse/collapse.js +1 -4
- package/esm/description/description.js +1 -2
- package/esm/display/display.js +1 -2
- package/esm/divider/divider.js +1 -2
- package/esm/dot/dot.js +1 -2
- package/esm/drawer/drawer-wrapper.js +1 -3
- package/esm/drawer/drawer.js +1 -1
- package/esm/fieldset/fieldset-content.js +1 -1
- package/esm/fieldset/fieldset-footer.js +1 -1
- package/esm/fieldset/fieldset-group.js +1 -3
- package/esm/fieldset/fieldset-title.js +1 -1
- package/esm/fieldset/fieldset.js +1 -2
- package/esm/grid/basic-item.js +1 -2
- package/esm/grid/grid-container.js +1 -1
- package/esm/grid/grid.js +1 -1
- package/esm/image/image-browser.js +1 -2
- package/esm/image/image.js +1 -2
- package/esm/image/image.skeleton.js +1 -1
- package/esm/index.d.ts +2 -14
- package/esm/index.js +5 -9
- package/esm/input/input-block-label.js +1 -1
- package/esm/input/input-icon-clear.js +1 -2
- package/esm/input/input-label.js +1 -1
- package/esm/input/input.js +1 -2
- package/esm/keyboard/keyboard.js +1 -1
- package/esm/link/link.js +1 -2
- package/esm/list/list-item.js +1 -2
- package/esm/loading/loading.js +1 -2
- package/esm/modal/modal-action.js +1 -2
- package/esm/modal/modal-actions.js +1 -1
- package/esm/modal/modal-content.js +1 -1
- package/esm/modal/modal-subtitle.js +1 -1
- package/esm/modal/modal-title.js +1 -1
- package/esm/modal/modal-wrapper.js +1 -3
- package/esm/modal/modal.js +1 -1
- package/esm/note/note.js +1 -2
- package/esm/page/page-header.js +1 -1
- package/esm/page/page.js +1 -1
- package/esm/pagination/pagination-item.js +1 -2
- package/esm/pagination/pagination.js +1 -1
- package/esm/popover/popover-item.js +1 -2
- package/esm/popover/popover.js +1 -1
- package/esm/progress/progress.js +1 -2
- package/esm/radio/radio-description.js +1 -1
- package/esm/radio/radio-group.js +1 -1
- package/esm/radio/radio.js +1 -2
- package/esm/rating/rating.js +1 -2
- package/esm/row/row.js +1 -1
- package/esm/select/select-dropdown.js +1 -3
- package/esm/select/select-icon-clear.js +1 -1
- package/esm/select/select-multiple-value.js +1 -1
- package/esm/select/select-option.js +1 -3
- package/esm/select/select.js +9 -12
- package/esm/slider/slider-dot.js +1 -2
- package/esm/slider/slider-mark.js +1 -1
- package/esm/slider/slider.js +1 -3
- package/esm/snippet/snippet.js +1 -3
- package/esm/spinner/spinner.js +1 -2
- package/esm/table/table-body.js +1 -2
- package/esm/table/table-head.js +3 -2
- package/esm/tabs/tabs-item.js +1 -2
- package/esm/tabs/tabs.js +1 -3
- package/esm/tag/tag.js +1 -1
- package/esm/text/child.js +1 -1
- package/esm/textarea/textarea.js +1 -2
- package/esm/toggle/toggle.js +1 -2
- package/esm/tooltip/tooltip-content.js +1 -3
- package/esm/tooltip/tooltip-icon.js +1 -1
- package/esm/tooltip/tooltip.js +1 -1
- package/esm/tree/tree-file-icon.js +1 -1
- package/esm/tree/tree-file.js +1 -2
- package/esm/tree/tree-folder-icon.js +1 -1
- package/esm/tree/tree-folder.js +1 -3
- package/esm/tree/tree-status-icon.js +1 -1
- package/esm/tree/tree.js +1 -1
- package/esm/use-input/use-input.js +1 -1
- package/esm/use-modal/use-modal.js +1 -1
- package/esm/use-network-status/index.d.ts +2 -0
- package/esm/use-network-status/index.js +2 -0
- package/esm/use-network-status/use-netowork-status.d.ts +4 -0
- package/esm/use-network-status/use-netowork-status.js +29 -0
- package/esm/use-scale/with-scale.js +1 -1
- package/esm/use-tabs/use-tabs.js +1 -1
- package/esm/user/user.js +1 -2
- package/esm/utils/use-context-state/use-context-state.js +1 -1
- package/esm/utils/use-drag.js +1 -1
- package/package.json +12 -4
- package/dist/css-baseline/css-baseline.d.ts +0 -9
- package/dist/css-baseline/index.d.ts +0 -1
- package/dist/shared/backdrop.d.ts +0 -14
- package/dist/shared/css-transition.d.ts +0 -13
- package/dist/shared/dropdown.d.ts +0 -9
- package/dist/shared/ellipsis.d.ts +0 -6
- package/dist/shared/expand.d.ts +0 -7
- package/dist/shared/highlight.d.ts +0 -13
- package/dist/ui-provider/index.d.ts +0 -3
- package/dist/ui-provider/index.js +0 -2186
- package/dist/ui-provider/theme-provider.d.ts +0 -8
- package/dist/ui-provider/ui-provider.d.ts +0 -8
- package/dist/use-all-themes/all-themes-context.d.ts +0 -7
- package/dist/use-all-themes/index.d.ts +0 -3
- package/dist/use-all-themes/index.js +0 -311
- package/dist/use-classes/index.d.ts +0 -2
- package/dist/use-classes/index.js +0 -48
- package/dist/use-classes/use-classes.d.ts +0 -4
- package/dist/use-current-state/index.d.ts +0 -2
- package/dist/use-current-state/use-current-state.d.ts +0 -4
- package/dist/use-media-query/index.d.ts +0 -3
- package/dist/use-media-query/index.js +0 -444
- package/dist/use-media-query/use-media-query.d.ts +0 -12
- package/dist/use-theme/index.d.ts +0 -2
- package/dist/use-theme/index.js +0 -309
- package/dist/use-theme/theme-context.d.ts +0 -4
- package/dist/use-toasts/helpers.d.ts +0 -18
- package/dist/use-toasts/index.d.ts +0 -3
- package/dist/use-toasts/index.js +0 -204
- package/dist/use-toasts/toast-container.d.ts +0 -3
- package/dist/use-toasts/toast-item.d.ts +0 -8
- package/dist/use-toasts/use-toast.d.ts +0 -40
- package/dist/utils/use-current-state.d.ts +0 -2
- package/dist/utils/use-dom-observer.d.ts +0 -3
- package/dist/utils/use-hd-ui-context.d.ts +0 -16
- package/dist/utils/use-previous.d.ts +0 -2
- package/esm/captcha/index.js +0 -128
- package/esm/css-baseline/css-baseline.d.ts +0 -9
- package/esm/css-baseline/css-baseline.js +0 -23
- package/esm/css-baseline/index.d.ts +0 -1
- package/esm/css-baseline/index.js +0 -2
- package/esm/shared/backdrop.d.ts +0 -14
- package/esm/shared/backdrop.js +0 -66
- package/esm/shared/css-transition.d.ts +0 -13
- package/esm/shared/css-transition.js +0 -65
- package/esm/shared/dropdown.d.ts +0 -9
- package/esm/shared/dropdown.js +0 -99
- package/esm/shared/ellipsis.d.ts +0 -6
- package/esm/shared/ellipsis.js +0 -13
- package/esm/shared/expand.d.ts +0 -7
- package/esm/shared/expand.js +0 -86
- package/esm/shared/highlight.d.ts +0 -13
- package/esm/shared/highlight.js +0 -46
- package/esm/ui-provider/index.d.ts +0 -3
- package/esm/ui-provider/index.js +0 -4
- package/esm/ui-provider/theme-provider.d.ts +0 -8
- package/esm/ui-provider/theme-provider.js +0 -45
- package/esm/ui-provider/ui-provider.d.ts +0 -8
- package/esm/ui-provider/ui-provider.js +0 -55
- package/esm/use-all-themes/all-themes-context.d.ts +0 -7
- package/esm/use-all-themes/all-themes-context.js +0 -11
- package/esm/use-all-themes/index.d.ts +0 -3
- package/esm/use-all-themes/index.js +0 -2
- package/esm/use-classes/index.d.ts +0 -2
- package/esm/use-classes/index.js +0 -2
- package/esm/use-classes/use-classes.d.ts +0 -4
- package/esm/use-classes/use-classes.js +0 -34
- package/esm/use-current-state/index.d.ts +0 -2
- package/esm/use-current-state/index.js +0 -2
- package/esm/use-current-state/use-current-state.d.ts +0 -4
- package/esm/use-current-state/use-current-state.js +0 -23
- package/esm/use-media-query/index.d.ts +0 -3
- package/esm/use-media-query/index.js +0 -2
- package/esm/use-media-query/use-media-query.d.ts +0 -12
- package/esm/use-media-query/use-media-query.js +0 -81
- package/esm/use-theme/index.d.ts +0 -2
- package/esm/use-theme/index.js +0 -2
- package/esm/use-theme/theme-context.d.ts +0 -4
- package/esm/use-theme/theme-context.js +0 -9
- package/esm/use-toasts/helpers.d.ts +0 -18
- package/esm/use-toasts/helpers.js +0 -68
- package/esm/use-toasts/index.d.ts +0 -3
- package/esm/use-toasts/index.js +0 -2
- package/esm/use-toasts/toast-container.d.ts +0 -3
- package/esm/use-toasts/toast-container.js +0 -120
- package/esm/use-toasts/toast-item.d.ts +0 -8
- package/esm/use-toasts/toast-item.js +0 -45
- package/esm/use-toasts/use-toast.d.ts +0 -40
- package/esm/use-toasts/use-toast.js +0 -103
- package/esm/utils/use-current-state.d.ts +0 -2
- package/esm/utils/use-current-state.js +0 -2
- package/esm/utils/use-dom-observer.d.ts +0 -3
- package/esm/utils/use-hd-ui-context.d.ts +0 -16
- package/esm/utils/use-previous.d.ts +0 -2
package/dist/menu/index.js
CHANGED
|
@@ -2635,6 +2635,11 @@ function canAnimate(keyframes, name, type, velocity) {
|
|
|
2635
2635
|
((type === "spring" || isGenerator(type)) && velocity));
|
|
2636
2636
|
}
|
|
2637
2637
|
|
|
2638
|
+
function makeAnimationInstant(options) {
|
|
2639
|
+
options.duration = 0;
|
|
2640
|
+
options.type === "keyframes";
|
|
2641
|
+
}
|
|
2642
|
+
|
|
2638
2643
|
/**
|
|
2639
2644
|
* A list of values that can be hardware-accelerated.
|
|
2640
2645
|
*/
|
|
@@ -2727,7 +2732,7 @@ class AsyncMotionValueAnimation extends WithPromise {
|
|
|
2727
2732
|
onUpdate?.(getFinalKeyframe$1(keyframes, options, finalKeyframe));
|
|
2728
2733
|
}
|
|
2729
2734
|
keyframes[0] = keyframes[keyframes.length - 1];
|
|
2730
|
-
options
|
|
2735
|
+
makeAnimationInstant(options);
|
|
2731
2736
|
options.repeat = 0;
|
|
2732
2737
|
}
|
|
2733
2738
|
/**
|
|
@@ -3272,7 +3277,7 @@ class MotionValue {
|
|
|
3272
3277
|
* An object containing a SubscriptionManager for each active event.
|
|
3273
3278
|
*/
|
|
3274
3279
|
this.events = {};
|
|
3275
|
-
this.updateAndNotify = (v
|
|
3280
|
+
this.updateAndNotify = (v) => {
|
|
3276
3281
|
const currentTime = time.now();
|
|
3277
3282
|
/**
|
|
3278
3283
|
* If we're updating the value during another frame or eventloop
|
|
@@ -3293,10 +3298,6 @@ class MotionValue {
|
|
|
3293
3298
|
}
|
|
3294
3299
|
}
|
|
3295
3300
|
}
|
|
3296
|
-
// Update render subscribers
|
|
3297
|
-
if (render) {
|
|
3298
|
-
this.events.renderRequest?.notify(this.current);
|
|
3299
|
-
}
|
|
3300
3301
|
};
|
|
3301
3302
|
this.hasAnimated = false;
|
|
3302
3303
|
this.setCurrent(init);
|
|
@@ -3407,9 +3408,9 @@ class MotionValue {
|
|
|
3407
3408
|
*
|
|
3408
3409
|
* @public
|
|
3409
3410
|
*/
|
|
3410
|
-
set(v
|
|
3411
|
-
if (!
|
|
3412
|
-
this.updateAndNotify(v
|
|
3411
|
+
set(v) {
|
|
3412
|
+
if (!this.passiveEffect) {
|
|
3413
|
+
this.updateAndNotify(v);
|
|
3413
3414
|
}
|
|
3414
3415
|
else {
|
|
3415
3416
|
this.passiveEffect(v, this.updateAndNotify);
|
|
@@ -5045,6 +5046,11 @@ function useVisualElement(Component, visualState, props, createVisualElement, Pr
|
|
|
5045
5046
|
});
|
|
5046
5047
|
wantsHandoff.current = false;
|
|
5047
5048
|
}
|
|
5049
|
+
/**
|
|
5050
|
+
* Now we've finished triggering animations for this element we
|
|
5051
|
+
* can wipe the enteringChildren set for the next render.
|
|
5052
|
+
*/
|
|
5053
|
+
visualElement.enteringChildren = undefined;
|
|
5048
5054
|
});
|
|
5049
5055
|
return visualElement;
|
|
5050
5056
|
}
|
|
@@ -5603,7 +5609,7 @@ class VisualElement {
|
|
|
5603
5609
|
for (const key in initialMotionValues) {
|
|
5604
5610
|
const value = initialMotionValues[key];
|
|
5605
5611
|
if (latestValues[key] !== undefined && isMotionValue(value)) {
|
|
5606
|
-
value.set(latestValues[key]
|
|
5612
|
+
value.set(latestValues[key]);
|
|
5607
5613
|
}
|
|
5608
5614
|
}
|
|
5609
5615
|
}
|
|
@@ -5629,8 +5635,7 @@ class VisualElement {
|
|
|
5629
5635
|
if (process.env.NODE_ENV !== "production") {
|
|
5630
5636
|
warnOnce(this.shouldReduceMotion !== true, "You have Reduced Motion enabled on your device. Animations may not appear as expected.", "reduced-motion-disabled");
|
|
5631
5637
|
}
|
|
5632
|
-
|
|
5633
|
-
this.parent.children.add(this);
|
|
5638
|
+
this.parent?.addChild(this);
|
|
5634
5639
|
this.update(this.props, this.presenceContext);
|
|
5635
5640
|
}
|
|
5636
5641
|
unmount() {
|
|
@@ -5640,7 +5645,7 @@ class VisualElement {
|
|
|
5640
5645
|
this.valueSubscriptions.forEach((remove) => remove());
|
|
5641
5646
|
this.valueSubscriptions.clear();
|
|
5642
5647
|
this.removeFromVariantTree && this.removeFromVariantTree();
|
|
5643
|
-
this.parent
|
|
5648
|
+
this.parent?.removeChild(this);
|
|
5644
5649
|
for (const key in this.events) {
|
|
5645
5650
|
this.events[key].clear();
|
|
5646
5651
|
}
|
|
@@ -5653,6 +5658,15 @@ class VisualElement {
|
|
|
5653
5658
|
}
|
|
5654
5659
|
this.current = null;
|
|
5655
5660
|
}
|
|
5661
|
+
addChild(child) {
|
|
5662
|
+
this.children.add(child);
|
|
5663
|
+
this.enteringChildren ?? (this.enteringChildren = new Set());
|
|
5664
|
+
this.enteringChildren.add(child);
|
|
5665
|
+
}
|
|
5666
|
+
removeChild(child) {
|
|
5667
|
+
this.children.delete(child);
|
|
5668
|
+
this.enteringChildren && this.enteringChildren.delete(child);
|
|
5669
|
+
}
|
|
5656
5670
|
bindToMotionValue(key, value) {
|
|
5657
5671
|
if (this.valueSubscriptions.has(key)) {
|
|
5658
5672
|
this.valueSubscriptions.get(key)();
|
|
@@ -5667,15 +5681,14 @@ class VisualElement {
|
|
|
5667
5681
|
if (valueIsTransform && this.projection) {
|
|
5668
5682
|
this.projection.isTransformDirty = true;
|
|
5669
5683
|
}
|
|
5684
|
+
this.scheduleRender();
|
|
5670
5685
|
});
|
|
5671
|
-
const removeOnRenderRequest = value.on("renderRequest", this.scheduleRender);
|
|
5672
5686
|
let removeSyncCheck;
|
|
5673
5687
|
if (window.MotionCheckAppearSync) {
|
|
5674
5688
|
removeSyncCheck = window.MotionCheckAppearSync(this, key, value);
|
|
5675
5689
|
}
|
|
5676
5690
|
this.valueSubscriptions.set(key, () => {
|
|
5677
5691
|
removeOnChange();
|
|
5678
|
-
removeOnRenderRequest();
|
|
5679
5692
|
if (removeSyncCheck)
|
|
5680
5693
|
removeSyncCheck();
|
|
5681
5694
|
if (value.owner)
|
|
@@ -6270,7 +6283,7 @@ const animateMotionValue = (name, value, target, transition = {}, element, isHan
|
|
|
6270
6283
|
let shouldSkip = false;
|
|
6271
6284
|
if (options.type === false ||
|
|
6272
6285
|
(options.duration === 0 && !options.repeatDelay)) {
|
|
6273
|
-
options
|
|
6286
|
+
makeAnimationInstant(options);
|
|
6274
6287
|
if (options.delay === 0) {
|
|
6275
6288
|
shouldSkip = true;
|
|
6276
6289
|
}
|
|
@@ -6278,7 +6291,7 @@ const animateMotionValue = (name, value, target, transition = {}, element, isHan
|
|
|
6278
6291
|
if (MotionGlobalConfig.instantAnimations ||
|
|
6279
6292
|
MotionGlobalConfig.skipAnimations) {
|
|
6280
6293
|
shouldSkip = true;
|
|
6281
|
-
options
|
|
6294
|
+
makeAnimationInstant(options);
|
|
6282
6295
|
options.delay = 0;
|
|
6283
6296
|
}
|
|
6284
6297
|
/**
|
|
@@ -6382,6 +6395,20 @@ function animateTarget(visualElement, targetAndTransition, { delay = 0, transiti
|
|
|
6382
6395
|
return animations;
|
|
6383
6396
|
}
|
|
6384
6397
|
|
|
6398
|
+
function calcChildStagger(children, child, delayChildren, staggerChildren = 0, staggerDirection = 1) {
|
|
6399
|
+
const index = Array.from(children)
|
|
6400
|
+
.sort((a, b) => a.sortNodePosition(b))
|
|
6401
|
+
.indexOf(child);
|
|
6402
|
+
const numChildren = children.size;
|
|
6403
|
+
const maxStaggerDuration = (numChildren - 1) * staggerChildren;
|
|
6404
|
+
const delayIsFunction = typeof delayChildren === "function";
|
|
6405
|
+
return delayIsFunction
|
|
6406
|
+
? delayChildren(index, numChildren)
|
|
6407
|
+
: staggerDirection === 1
|
|
6408
|
+
? index * staggerChildren
|
|
6409
|
+
: maxStaggerDuration - index * staggerChildren;
|
|
6410
|
+
}
|
|
6411
|
+
|
|
6385
6412
|
function animateVariant(visualElement, variant, options = {}) {
|
|
6386
6413
|
const resolved = resolveVariant(visualElement, variant, options.type === "exit"
|
|
6387
6414
|
? visualElement.presenceContext?.custom
|
|
@@ -6424,31 +6451,17 @@ function animateVariant(visualElement, variant, options = {}) {
|
|
|
6424
6451
|
}
|
|
6425
6452
|
function animateChildren(visualElement, variant, delay = 0, delayChildren = 0, staggerChildren = 0, staggerDirection = 1, options) {
|
|
6426
6453
|
const animations = [];
|
|
6427
|
-
const
|
|
6428
|
-
const maxStaggerDuration = (numChildren - 1) * staggerChildren;
|
|
6429
|
-
const delayIsFunction = typeof delayChildren === "function";
|
|
6430
|
-
const generateStaggerDuration = delayIsFunction
|
|
6431
|
-
? (i) => delayChildren(i, numChildren)
|
|
6432
|
-
: // Support deprecated staggerChildren
|
|
6433
|
-
staggerDirection === 1
|
|
6434
|
-
? (i = 0) => i * staggerChildren
|
|
6435
|
-
: (i = 0) => maxStaggerDuration - i * staggerChildren;
|
|
6436
|
-
Array.from(visualElement.variantChildren)
|
|
6437
|
-
.sort(sortByTreeOrder)
|
|
6438
|
-
.forEach((child, i) => {
|
|
6454
|
+
for (const child of visualElement.variantChildren) {
|
|
6439
6455
|
child.notify("AnimationStart", variant);
|
|
6440
6456
|
animations.push(animateVariant(child, variant, {
|
|
6441
6457
|
...options,
|
|
6442
6458
|
delay: delay +
|
|
6443
|
-
(
|
|
6444
|
-
|
|
6459
|
+
(typeof delayChildren === "function" ? 0 : delayChildren) +
|
|
6460
|
+
calcChildStagger(visualElement.variantChildren, child, delayChildren, staggerChildren, staggerDirection),
|
|
6445
6461
|
}).then(() => child.notify("AnimationComplete", variant)));
|
|
6446
|
-
}
|
|
6462
|
+
}
|
|
6447
6463
|
return Promise.all(animations);
|
|
6448
6464
|
}
|
|
6449
|
-
function sortByTreeOrder(a, b) {
|
|
6450
|
-
return a.sortNodePosition(b);
|
|
6451
|
-
}
|
|
6452
6465
|
|
|
6453
6466
|
function animateVisualElement(visualElement, definition, options = {}) {
|
|
6454
6467
|
visualElement.notify("AnimationStart", definition);
|
|
@@ -6601,9 +6614,6 @@ function createAnimationState(visualElement) {
|
|
|
6601
6614
|
let isInherited = prop === context[type] &&
|
|
6602
6615
|
prop !== props[type] &&
|
|
6603
6616
|
propIsVariant;
|
|
6604
|
-
/**
|
|
6605
|
-
*
|
|
6606
|
-
*/
|
|
6607
6617
|
if (isInherited &&
|
|
6608
6618
|
isInitialRender &&
|
|
6609
6619
|
visualElement.manuallyAnimateOnMount) {
|
|
@@ -6724,9 +6734,6 @@ function createAnimationState(visualElement) {
|
|
|
6724
6734
|
*/
|
|
6725
6735
|
typeState.prevProp = prop;
|
|
6726
6736
|
typeState.prevResolvedValues = resolvedValues;
|
|
6727
|
-
/**
|
|
6728
|
-
*
|
|
6729
|
-
*/
|
|
6730
6737
|
if (typeState.isActive) {
|
|
6731
6738
|
encounteredKeys = { ...encounteredKeys, ...resolvedValues };
|
|
6732
6739
|
}
|
|
@@ -6740,10 +6747,30 @@ function createAnimationState(visualElement) {
|
|
|
6740
6747
|
const willAnimateViaParent = isInherited && variantDidChange;
|
|
6741
6748
|
const needsAnimating = !willAnimateViaParent || handledRemovedValues;
|
|
6742
6749
|
if (shouldAnimateType && needsAnimating) {
|
|
6743
|
-
animations.push(...definitionList.map((animation) =>
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6750
|
+
animations.push(...definitionList.map((animation) => {
|
|
6751
|
+
const options = { type };
|
|
6752
|
+
/**
|
|
6753
|
+
* If we're performing the initial animation, but we're not
|
|
6754
|
+
* rendering at the same time as the variant-controlling parent,
|
|
6755
|
+
* we want to use the parent's transition to calculate the stagger.
|
|
6756
|
+
*/
|
|
6757
|
+
if (typeof animation === "string" &&
|
|
6758
|
+
isInitialRender &&
|
|
6759
|
+
!willAnimateViaParent &&
|
|
6760
|
+
visualElement.manuallyAnimateOnMount &&
|
|
6761
|
+
visualElement.parent) {
|
|
6762
|
+
const { parent } = visualElement;
|
|
6763
|
+
const parentVariant = resolveVariant(parent, animation);
|
|
6764
|
+
if (parent.enteringChildren && parentVariant) {
|
|
6765
|
+
const { delayChildren } = parentVariant.transition || {};
|
|
6766
|
+
options.delay = calcChildStagger(parent.enteringChildren, visualElement, delayChildren);
|
|
6767
|
+
}
|
|
6768
|
+
}
|
|
6769
|
+
return {
|
|
6770
|
+
animation: animation,
|
|
6771
|
+
options,
|
|
6772
|
+
};
|
|
6773
|
+
}));
|
|
6747
6774
|
}
|
|
6748
6775
|
}
|
|
6749
6776
|
/**
|
|
@@ -7917,6 +7944,10 @@ const correctBoxShadow = {
|
|
|
7917
7944
|
/**
|
|
7918
7945
|
* Track whether we've taken any snapshots yet. If not,
|
|
7919
7946
|
* we can safely skip notification of didUpdate.
|
|
7947
|
+
*
|
|
7948
|
+
* Difficult to capture in a test but to prevent flickering
|
|
7949
|
+
* we must set this to true either on update or unmount.
|
|
7950
|
+
* Running `next-env/layout-id` in Safari will show this behaviour if broken.
|
|
7920
7951
|
*/
|
|
7921
7952
|
let hasTakenAnySnapshot = false;
|
|
7922
7953
|
class MeasureLayoutWithContext extends React.Component {
|
|
@@ -8005,6 +8036,7 @@ class MeasureLayoutWithContext extends React.Component {
|
|
|
8005
8036
|
componentWillUnmount() {
|
|
8006
8037
|
const { visualElement, layoutGroup, switchLayoutGroup: promoteContext, } = this.props;
|
|
8007
8038
|
const { projection } = visualElement;
|
|
8039
|
+
hasTakenAnySnapshot = true;
|
|
8008
8040
|
if (projection) {
|
|
8009
8041
|
projection.scheduleCheckAfterUnmount();
|
|
8010
8042
|
if (layoutGroup && layoutGroup.group)
|