motion-v 0.13.0-beta.1 → 0.13.0-beta.3
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/cjs/index.js +414 -1153
- package/dist/es/animation/hooks/animation-controls.mjs +1 -1
- package/dist/es/animation/hooks/use-animate.mjs +1 -1
- package/dist/es/components/animate-presence/use-pop-layout.mjs +1 -1
- package/dist/es/components/reorder/Group.d.ts +1 -1
- package/dist/es/components/reorder/index.d.ts +7088 -7088
- package/dist/es/components/reorder/utils.d.ts +1 -1
- package/dist/es/components/reorder/utils.mjs +1 -1
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/animate/index.mjs +1 -2
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/animate/resolve-subjects.mjs +1 -2
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/animate/single-value.mjs +1 -1
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/animate/subject.mjs +1 -1
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/animators/AcceleratedAnimation.mjs +4 -7
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/animators/BaseAnimation.mjs +3 -1
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/animators/MainThreadAnimation.mjs +5 -4
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/animators/drivers/driver-frameloop.mjs +1 -2
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/animators/utils/can-animate.mjs +2 -2
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/animators/waapi/NativeAnimation.mjs +3 -6
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/animators/waapi/animate-elements.mjs +4 -4
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/animators/waapi/animate-style.mjs +1 -2
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/animators/waapi/index.mjs +9 -2
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/animators/waapi/utils/supports-partial-keyframes.mjs +2 -2
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/animators/waapi/utils/supports-waapi.mjs +2 -2
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/generators/spring/find.mjs +2 -2
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/generators/spring/index.mjs +3 -4
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/generators/utils/velocity.mjs +2 -1
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/interfaces/motion-value.mjs +4 -5
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/interfaces/visual-element-target.mjs +1 -3
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/sequence/create.mjs +4 -5
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/sequence/utils/edit.mjs +2 -1
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/easing/cubic-bezier.mjs +2 -2
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/easing/utils/map.mjs +3 -3
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/projection/animation/mix-values.mjs +3 -3
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/projection/node/create-projection-node.mjs +27 -7
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/projection/shared/stack.mjs +2 -1
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/VisualElement.mjs +4 -5
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/resize/handle-element.mjs +1 -2
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/scroll/index.mjs +3 -3
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/scroll/info.mjs +3 -3
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/scroll/observe.mjs +1 -1
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/scroll/on-scroll-handler.mjs +2 -1
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/scroll/track.mjs +1 -1
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/utils/css-variables-conversion.mjs +1 -1
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/utils/unit-conversion.mjs +3 -18
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/viewport/index.mjs +1 -2
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/html/HTMLVisualElement.mjs +2 -3
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/render/html/utils/parse-transform.mjs +82 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/svg/SVGVisualElement.mjs +1 -1
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/utils/KeyframesResolver.mjs +1 -1
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/utils/flat-tree.mjs +2 -1
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/utils/motion-values.mjs +4 -3
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/utils/setters.mjs +1 -1
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/utils/delay.mjs +3 -4
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/utils/interpolate.mjs +3 -3
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/utils/mix/color.mjs +1 -1
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/utils/mix/complex.mjs +1 -1
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/utils/offsets/fill.mjs +2 -2
- package/dist/es/features/gestures/drag/VisualElementDragControls.mjs +2 -2
- package/dist/es/features/gestures/drag/index.mjs +2 -2
- package/dist/es/features/gestures/focus/index.mjs +1 -1
- package/dist/es/features/gestures/hover/index.mjs +1 -3
- package/dist/es/features/gestures/in-view/index.mjs +2 -2
- package/dist/es/features/gestures/pan/PanSession.mjs +3 -3
- package/dist/es/features/gestures/pan/index.mjs +3 -3
- package/dist/es/features/gestures/press/index.mjs +1 -3
- package/dist/es/features/layout/config.mjs +2 -2
- package/dist/es/features/layout/layout.mjs +2 -2
- package/dist/es/features/layout/projection.mjs +2 -2
- package/dist/es/index.mjs +30 -39
- package/dist/es/state/animate-updates.mjs +4 -4
- package/dist/es/state/create-visual-element.mjs +2 -2
- package/dist/es/state/motion-state.mjs +2 -2
- package/dist/es/state/utils.mjs +0 -1
- package/dist/es/types/framer-motion.d.ts +0 -12
- package/dist/es/utils/use-animation-frame.mjs +1 -1
- package/dist/es/utils/use-in-view.mjs +6 -3
- package/dist/es/value/use-combine-values.mjs +1 -2
- package/dist/es/value/use-computed.mjs +1 -1
- package/dist/es/value/use-motion-value-event.d.ts +1 -2
- package/dist/es/value/use-scroll.d.ts +4 -4
- package/dist/es/value/use-scroll.mjs +26 -24
- package/dist/es/value/use-spring.mjs +2 -3
- package/dist/es/value/use-time.d.ts +1 -1
- package/dist/es/value/use-time.mjs +1 -1
- package/dist/es/value/use-transform.mjs +3 -5
- package/dist/es/value/use-velocity.mjs +1 -2
- package/package.json +4 -3
- package/dist/es/external/.pnpm/framer-motion@12.4.10/external/framer-motion/dist/es/frameloop/batcher.mjs +0 -63
- package/dist/es/external/.pnpm/framer-motion@12.4.10/external/framer-motion/dist/es/frameloop/frame.mjs +0 -10
- package/dist/es/external/.pnpm/framer-motion@12.4.10/external/framer-motion/dist/es/frameloop/index-legacy.mjs +0 -11
- package/dist/es/external/.pnpm/framer-motion@12.4.10/external/framer-motion/dist/es/frameloop/microtask.mjs +0 -6
- package/dist/es/external/.pnpm/framer-motion@12.4.10/external/framer-motion/dist/es/frameloop/order.mjs +0 -17
- package/dist/es/external/.pnpm/framer-motion@12.4.10/external/framer-motion/dist/es/frameloop/render-step.mjs +0 -70
- package/dist/es/external/.pnpm/framer-motion@12.4.10/external/framer-motion/dist/es/frameloop/sync-time.mjs +0 -21
- package/dist/es/external/.pnpm/framer-motion@12.4.10/external/framer-motion/dist/es/stats/buffer.mjs +0 -7
- package/dist/es/external/.pnpm/framer-motion@12.4.10/external/framer-motion/dist/es/utils/GlobalConfig.mjs +0 -7
- package/dist/es/external/.pnpm/framer-motion@12.4.10/external/framer-motion/dist/es/value/index.mjs +0 -282
- package/dist/es/external/.pnpm/motion-dom@12.4.10/external/motion-dom/dist/es/animation/controls/BaseGroup.mjs +0 -79
- package/dist/es/external/.pnpm/motion-dom@12.4.10/external/motion-dom/dist/es/animation/controls/Group.mjs +0 -9
- package/dist/es/external/.pnpm/motion-dom@12.4.10/external/motion-dom/dist/es/animation/generators/utils/calc-duration.mjs +0 -15
- package/dist/es/external/.pnpm/motion-dom@12.4.10/external/motion-dom/dist/es/animation/generators/utils/create-generator-easing.mjs +0 -17
- package/dist/es/external/.pnpm/motion-dom@12.4.10/external/motion-dom/dist/es/animation/generators/utils/is-generator.mjs +0 -6
- package/dist/es/external/.pnpm/motion-dom@12.4.10/external/motion-dom/dist/es/animation/utils/get-value-transition.mjs +0 -6
- package/dist/es/external/.pnpm/motion-dom@12.4.10/external/motion-dom/dist/es/animation/waapi/NativeAnimationControls.mjs +0 -81
- package/dist/es/external/.pnpm/motion-dom@12.4.10/external/motion-dom/dist/es/animation/waapi/utils/attach-timeline.mjs +0 -7
- package/dist/es/external/.pnpm/motion-dom@12.4.10/external/motion-dom/dist/es/animation/waapi/utils/easing.mjs +0 -37
- package/dist/es/external/.pnpm/motion-dom@12.4.10/external/motion-dom/dist/es/animation/waapi/utils/linear.mjs +0 -13
- package/dist/es/external/.pnpm/motion-dom@12.4.10/external/motion-dom/dist/es/gestures/drag/state/is-active.mjs +0 -11
- package/dist/es/external/.pnpm/motion-dom@12.4.10/external/motion-dom/dist/es/gestures/hover.mjs +0 -30
- package/dist/es/external/.pnpm/motion-dom@12.4.10/external/motion-dom/dist/es/gestures/press/index.mjs +0 -74
- package/dist/es/external/.pnpm/motion-dom@12.4.10/external/motion-dom/dist/es/gestures/press/utils/is-keyboard-accessible.mjs +0 -13
- package/dist/es/external/.pnpm/motion-dom@12.4.10/external/motion-dom/dist/es/gestures/press/utils/keyboard.mjs +0 -32
- package/dist/es/external/.pnpm/motion-dom@12.4.10/external/motion-dom/dist/es/gestures/press/utils/state.mjs +0 -4
- package/dist/es/external/.pnpm/motion-dom@12.4.10/external/motion-dom/dist/es/gestures/utils/capture-pointer.mjs +0 -12
- package/dist/es/external/.pnpm/motion-dom@12.4.10/external/motion-dom/dist/es/gestures/utils/is-node-or-child.mjs +0 -12
- package/dist/es/external/.pnpm/motion-dom@12.4.10/external/motion-dom/dist/es/gestures/utils/is-primary-pointer.mjs +0 -10
- package/dist/es/external/.pnpm/motion-dom@12.4.10/external/motion-dom/dist/es/gestures/utils/setup.mjs +0 -15
- package/dist/es/external/.pnpm/motion-dom@12.4.10/external/motion-dom/dist/es/utils/is-bezier-definition.mjs +0 -4
- package/dist/es/external/.pnpm/motion-dom@12.4.10/external/motion-dom/dist/es/utils/resolve-elements.mjs +0 -17
- package/dist/es/external/.pnpm/motion-dom@12.4.10/external/motion-dom/dist/es/utils/supports/flags.mjs +0 -6
- package/dist/es/external/.pnpm/motion-dom@12.4.10/external/motion-dom/dist/es/utils/supports/linear-easing.mjs +0 -12
- package/dist/es/external/.pnpm/motion-dom@12.4.10/external/motion-dom/dist/es/utils/supports/memo.mjs +0 -13
- package/dist/es/external/.pnpm/motion-dom@12.4.10/external/motion-dom/dist/es/utils/supports/scroll-timeline.mjs +0 -6
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/animate/sequence.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/animators/utils/accelerated-values.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/animators/waapi/utils/get-final-keyframe.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/animators/waapi/utils/style.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/generators/inertia.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/generators/keyframes.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/generators/spring/defaults.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/optimized-appear/data-id.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/optimized-appear/get-appear-id.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/sequence/utils/calc-repeat-duration.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/sequence/utils/calc-time.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/sequence/utils/normalize-times.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/sequence/utils/sort.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/utils/create-visual-element.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/utils/default-transitions.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/utils/is-animatable.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/utils/is-animation-controls.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/utils/is-dom-keyframes.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/utils/is-keyframes-target.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/utils/is-none.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/utils/is-transition-defined.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/animation/utils/stagger.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/easing/anticipate.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/easing/back.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/easing/circ.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/easing/ease.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/easing/modifiers/mirror.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/easing/modifiers/reverse.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/easing/steps.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/easing/utils/get-easing-for-segment.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/easing/utils/is-easing-array.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/events/add-dom-event.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/motion/features/definitions.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/motion/utils/is-forced-motion-value.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/projection/geometry/conversion.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/projection/geometry/copy.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/projection/geometry/delta-apply.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/projection/geometry/delta-calc.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/projection/geometry/delta-remove.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/projection/geometry/models.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/projection/geometry/utils.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/projection/node/DocumentProjectionNode.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/projection/node/HTMLProjectionNode.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/projection/node/state.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/projection/styles/scale-border-radius.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/projection/styles/scale-box-shadow.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/projection/styles/scale-correction.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/projection/styles/transform.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/projection/utils/each-axis.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/projection/utils/has-transform.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/projection/utils/measure.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/DOMKeyframesResolver.mjs +0 -0
- package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/DOMVisualElement.mjs +1 -1
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/resize/handle-window.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/resize/index.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/scroll/offsets/edge.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/scroll/offsets/index.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/scroll/offsets/inset.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/scroll/offsets/offset.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/scroll/offsets/presets.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/utils/camel-to-dash.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/utils/is-css-variable.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/utils/is-svg-element.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/value-types/animatable-none.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/value-types/defaults.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/value-types/dimensions.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/value-types/find.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/value-types/get-as-type.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/value-types/number-browser.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/value-types/number.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/value-types/test.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/value-types/transform.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/value-types/type-auto.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/dom/value-types/type-int.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/html/utils/build-styles.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/html/utils/build-transform.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/html/utils/keys-position.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/html/utils/keys-transform.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/html/utils/make-none-animatable.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/html/utils/render.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/html/utils/scrape-motion-values.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/object/ObjectVisualElement.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/store.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/svg/utils/build-attrs.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/svg/utils/camel-case-attrs.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/svg/utils/is-svg-tag.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/svg/utils/measure.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/svg/utils/path.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/svg/utils/render.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/svg/utils/scrape-motion-values.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/svg/utils/transform-origin.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/utils/compare-by-depth.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/utils/is-controlling-variants.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/utils/is-variant-label.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/utils/resolve-dynamic-variants.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/utils/resolve-variants.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/render/utils/variant-props.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/utils/clamp.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/utils/distance.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/utils/hsla-to-rgba.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/utils/is-browser.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/utils/is-numerical-string.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/utils/is-zero-value-string.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/utils/mix/immediate.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/utils/mix/index.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/utils/mix/number.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/utils/mix/visibility.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/utils/offsets/default.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/utils/offsets/time.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/utils/pipe.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/utils/reduced-motion/index.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/utils/reduced-motion/state.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/utils/resolve-value.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/utils/transform.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/utils/wrap.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/value/types/color/hex.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/value/types/color/hsla.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/value/types/color/index.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/value/types/color/rgba.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/value/types/color/utils.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/value/types/complex/filter.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/value/types/complex/index.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/value/types/numbers/index.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/value/types/numbers/units.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/value/types/utils/color-regex.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/value/types/utils/float-regex.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/value/types/utils/is-nullish.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/value/types/utils/sanitize.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/value/types/utils/single-color-regex.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/value/use-will-change/add-will-change.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/value/use-will-change/is.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/value/utils/is-motion-value.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10 → framer-motion@12.5.0}/external/framer-motion/dist/es/value/utils/resolve-motion-value.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10/external/framer-motion/dist/es/utils → motion-utils@12.5.0/external/motion-utils/dist/es}/array.mjs +0 -0
- /package/dist/es/external/.pnpm/{motion-utils@12.4.10 → motion-utils@12.5.0}/external/motion-utils/dist/es/errors.mjs +0 -0
- /package/dist/es/external/.pnpm/{motion-utils@12.4.10 → motion-utils@12.5.0}/external/motion-utils/dist/es/memo.mjs +0 -0
- /package/dist/es/external/.pnpm/{motion-utils@12.4.10 → motion-utils@12.5.0}/external/motion-utils/dist/es/noop.mjs +0 -0
- /package/dist/es/external/.pnpm/{motion-utils@12.4.10 → motion-utils@12.5.0}/external/motion-utils/dist/es/progress.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10/external/framer-motion/dist/es/utils → motion-utils@12.5.0/external/motion-utils/dist/es}/subscription-manager.mjs +0 -0
- /package/dist/es/external/.pnpm/{motion-utils@12.4.10 → motion-utils@12.5.0}/external/motion-utils/dist/es/time-conversion.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10/external/framer-motion/dist/es/utils → motion-utils@12.5.0/external/motion-utils/dist/es}/velocity-per-second.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@12.4.10/external/framer-motion/dist/es/utils → motion-utils@12.5.0/external/motion-utils/dist/es}/warn-once.mjs +0 -0
package/dist/cjs/index.js
CHANGED
|
@@ -3,6 +3,16 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
3
3
|
const vue = require("vue");
|
|
4
4
|
const core = require("@vueuse/core");
|
|
5
5
|
const heyListen = require("hey-listen");
|
|
6
|
+
const motionDom = require("motion-dom");
|
|
7
|
+
function addUniqueItem(arr, item) {
|
|
8
|
+
if (arr.indexOf(item) === -1)
|
|
9
|
+
arr.push(item);
|
|
10
|
+
}
|
|
11
|
+
function removeItem(arr, item) {
|
|
12
|
+
const index = arr.indexOf(item);
|
|
13
|
+
if (index > -1)
|
|
14
|
+
arr.splice(index, 1);
|
|
15
|
+
}
|
|
6
16
|
const noop = /* @__NO_SIDE_EFFECTS__ */ (any) => any;
|
|
7
17
|
let warning = noop;
|
|
8
18
|
exports.invariant = noop;
|
|
@@ -31,433 +41,45 @@ const progress$1 = /* @__NO_SIDE_EFFECTS__ */ (from, to, value) => {
|
|
|
31
41
|
const toFromDifference = to - from;
|
|
32
42
|
return toFromDifference === 0 ? 1 : (value - from) / toFromDifference;
|
|
33
43
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
class BaseGroupPlaybackControls {
|
|
38
|
-
constructor(animations) {
|
|
39
|
-
this.stop = () => this.runAll("stop");
|
|
40
|
-
this.animations = animations.filter(Boolean);
|
|
41
|
-
}
|
|
42
|
-
get finished() {
|
|
43
|
-
return Promise.all(this.animations.map((animation) => "finished" in animation ? animation.finished : animation));
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* TODO: Filter out cancelled or stopped animations before returning
|
|
47
|
-
*/
|
|
48
|
-
getAll(propName) {
|
|
49
|
-
return this.animations[0][propName];
|
|
50
|
-
}
|
|
51
|
-
setAll(propName, newValue) {
|
|
52
|
-
for (let i = 0; i < this.animations.length; i++) {
|
|
53
|
-
this.animations[i][propName] = newValue;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
attachTimeline(timeline, fallback) {
|
|
57
|
-
const subscriptions = this.animations.map((animation) => {
|
|
58
|
-
if (supportsScrollTimeline() && animation.attachTimeline) {
|
|
59
|
-
return animation.attachTimeline(timeline);
|
|
60
|
-
} else if (typeof fallback === "function") {
|
|
61
|
-
return fallback(animation);
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
return () => {
|
|
65
|
-
subscriptions.forEach((cancel, i) => {
|
|
66
|
-
cancel && cancel();
|
|
67
|
-
this.animations[i].stop();
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
get time() {
|
|
72
|
-
return this.getAll("time");
|
|
73
|
-
}
|
|
74
|
-
set time(time2) {
|
|
75
|
-
this.setAll("time", time2);
|
|
76
|
-
}
|
|
77
|
-
get speed() {
|
|
78
|
-
return this.getAll("speed");
|
|
79
|
-
}
|
|
80
|
-
set speed(speed) {
|
|
81
|
-
this.setAll("speed", speed);
|
|
82
|
-
}
|
|
83
|
-
get startTime() {
|
|
84
|
-
return this.getAll("startTime");
|
|
85
|
-
}
|
|
86
|
-
get duration() {
|
|
87
|
-
let max = 0;
|
|
88
|
-
for (let i = 0; i < this.animations.length; i++) {
|
|
89
|
-
max = Math.max(max, this.animations[i].duration);
|
|
90
|
-
}
|
|
91
|
-
return max;
|
|
92
|
-
}
|
|
93
|
-
runAll(methodName) {
|
|
94
|
-
this.animations.forEach((controls) => controls[methodName]());
|
|
95
|
-
}
|
|
96
|
-
flatten() {
|
|
97
|
-
this.runAll("flatten");
|
|
98
|
-
}
|
|
99
|
-
play() {
|
|
100
|
-
this.runAll("play");
|
|
101
|
-
}
|
|
102
|
-
pause() {
|
|
103
|
-
this.runAll("pause");
|
|
104
|
-
}
|
|
105
|
-
cancel() {
|
|
106
|
-
this.runAll("cancel");
|
|
107
|
-
}
|
|
108
|
-
complete() {
|
|
109
|
-
this.runAll("complete");
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
class GroupPlaybackControls extends BaseGroupPlaybackControls {
|
|
113
|
-
then(onResolve, onReject) {
|
|
114
|
-
return Promise.all(this.animations).then(onResolve).catch(onReject);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
function getValueTransition$1(transition, key) {
|
|
118
|
-
return transition ? transition[key] || transition["default"] || transition : void 0;
|
|
119
|
-
}
|
|
120
|
-
const maxGeneratorDuration = 2e4;
|
|
121
|
-
function calcGeneratorDuration(generator) {
|
|
122
|
-
let duration = 0;
|
|
123
|
-
const timeStep = 50;
|
|
124
|
-
let state2 = generator.next(duration);
|
|
125
|
-
while (!state2.done && duration < maxGeneratorDuration) {
|
|
126
|
-
duration += timeStep;
|
|
127
|
-
state2 = generator.next(duration);
|
|
128
|
-
}
|
|
129
|
-
return duration >= maxGeneratorDuration ? Infinity : duration;
|
|
130
|
-
}
|
|
131
|
-
function createGeneratorEasing(options, scale2 = 100, createGenerator) {
|
|
132
|
-
const generator = createGenerator({ ...options, keyframes: [0, scale2] });
|
|
133
|
-
const duration = Math.min(calcGeneratorDuration(generator), maxGeneratorDuration);
|
|
134
|
-
return {
|
|
135
|
-
type: "keyframes",
|
|
136
|
-
ease: (progress2) => {
|
|
137
|
-
return generator.next(duration * progress2).value / scale2;
|
|
138
|
-
},
|
|
139
|
-
duration: /* @__PURE__ */ millisecondsToSeconds$1(duration)
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
function isGenerator(type) {
|
|
143
|
-
return typeof type === "function";
|
|
144
|
-
}
|
|
145
|
-
function attachTimeline(animation, timeline) {
|
|
146
|
-
animation.timeline = timeline;
|
|
147
|
-
animation.onfinish = null;
|
|
148
|
-
}
|
|
149
|
-
class NativeAnimationControls {
|
|
150
|
-
constructor(animation) {
|
|
151
|
-
this.animation = animation;
|
|
152
|
-
}
|
|
153
|
-
get duration() {
|
|
154
|
-
var _a, _b, _c;
|
|
155
|
-
const durationInMs = ((_b = (_a = this.animation) === null || _a === void 0 ? void 0 : _a.effect) === null || _b === void 0 ? void 0 : _b.getComputedTiming().duration) || ((_c = this.options) === null || _c === void 0 ? void 0 : _c.duration) || 300;
|
|
156
|
-
return /* @__PURE__ */ millisecondsToSeconds$1(Number(durationInMs));
|
|
157
|
-
}
|
|
158
|
-
get time() {
|
|
159
|
-
var _a;
|
|
160
|
-
if (this.animation) {
|
|
161
|
-
return /* @__PURE__ */ millisecondsToSeconds$1(((_a = this.animation) === null || _a === void 0 ? void 0 : _a.currentTime) || 0);
|
|
162
|
-
}
|
|
163
|
-
return 0;
|
|
164
|
-
}
|
|
165
|
-
set time(newTime) {
|
|
166
|
-
if (this.animation) {
|
|
167
|
-
this.animation.currentTime = /* @__PURE__ */ secondsToMilliseconds$1(newTime);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
get speed() {
|
|
171
|
-
return this.animation ? this.animation.playbackRate : 1;
|
|
172
|
-
}
|
|
173
|
-
set speed(newSpeed) {
|
|
174
|
-
if (this.animation) {
|
|
175
|
-
this.animation.playbackRate = newSpeed;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
get state() {
|
|
179
|
-
return this.animation ? this.animation.playState : "finished";
|
|
180
|
-
}
|
|
181
|
-
get startTime() {
|
|
182
|
-
return this.animation ? this.animation.startTime : null;
|
|
183
|
-
}
|
|
184
|
-
get finished() {
|
|
185
|
-
return this.animation ? this.animation.finished : Promise.resolve();
|
|
186
|
-
}
|
|
187
|
-
play() {
|
|
188
|
-
this.animation && this.animation.play();
|
|
189
|
-
}
|
|
190
|
-
pause() {
|
|
191
|
-
this.animation && this.animation.pause();
|
|
192
|
-
}
|
|
193
|
-
stop() {
|
|
194
|
-
if (!this.animation || this.state === "idle" || this.state === "finished") {
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
if (this.animation.commitStyles) {
|
|
198
|
-
this.animation.commitStyles();
|
|
199
|
-
}
|
|
200
|
-
this.cancel();
|
|
201
|
-
}
|
|
202
|
-
flatten() {
|
|
203
|
-
var _a;
|
|
204
|
-
if (!this.animation)
|
|
205
|
-
return;
|
|
206
|
-
(_a = this.animation.effect) === null || _a === void 0 ? void 0 : _a.updateTiming({ easing: "linear" });
|
|
207
|
-
}
|
|
208
|
-
attachTimeline(timeline) {
|
|
209
|
-
if (this.animation)
|
|
210
|
-
attachTimeline(this.animation, timeline);
|
|
211
|
-
return noop;
|
|
212
|
-
}
|
|
213
|
-
complete() {
|
|
214
|
-
this.animation && this.animation.finish();
|
|
215
|
-
}
|
|
216
|
-
cancel() {
|
|
217
|
-
try {
|
|
218
|
-
this.animation && this.animation.cancel();
|
|
219
|
-
} catch (e) {
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
const isBezierDefinition = (easing) => Array.isArray(easing) && typeof easing[0] === "number";
|
|
224
|
-
const supportsFlags = {
|
|
225
|
-
linearEasing: void 0
|
|
226
|
-
};
|
|
227
|
-
function memoSupports(callback, supportsFlag) {
|
|
228
|
-
const memoized = /* @__PURE__ */ memo(callback);
|
|
229
|
-
return () => {
|
|
230
|
-
var _a;
|
|
231
|
-
return (_a = supportsFlags[supportsFlag]) !== null && _a !== void 0 ? _a : memoized();
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
const supportsLinearEasing = /* @__PURE__ */ memoSupports(() => {
|
|
235
|
-
try {
|
|
236
|
-
document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" });
|
|
237
|
-
} catch (e) {
|
|
238
|
-
return false;
|
|
239
|
-
}
|
|
240
|
-
return true;
|
|
241
|
-
}, "linearEasing");
|
|
242
|
-
const generateLinearEasing = (easing, duration, resolution = 10) => {
|
|
243
|
-
let points = "";
|
|
244
|
-
const numPoints = Math.max(Math.round(duration / resolution), 2);
|
|
245
|
-
for (let i = 0; i < numPoints; i++) {
|
|
246
|
-
points += easing(/* @__PURE__ */ progress$1(0, numPoints - 1, i)) + ", ";
|
|
247
|
-
}
|
|
248
|
-
return `linear(${points.substring(0, points.length - 2)})`;
|
|
249
|
-
};
|
|
250
|
-
function isWaapiSupportedEasing(easing) {
|
|
251
|
-
return Boolean(typeof easing === "function" && supportsLinearEasing() || !easing || typeof easing === "string" && (easing in supportedWaapiEasing || supportsLinearEasing()) || isBezierDefinition(easing) || Array.isArray(easing) && easing.every(isWaapiSupportedEasing));
|
|
252
|
-
}
|
|
253
|
-
const cubicBezierAsString = ([a, b, c, d]) => `cubic-bezier(${a}, ${b}, ${c}, ${d})`;
|
|
254
|
-
const supportedWaapiEasing = {
|
|
255
|
-
linear: "linear",
|
|
256
|
-
ease: "ease",
|
|
257
|
-
easeIn: "ease-in",
|
|
258
|
-
easeOut: "ease-out",
|
|
259
|
-
easeInOut: "ease-in-out",
|
|
260
|
-
circIn: /* @__PURE__ */ cubicBezierAsString([0, 0.65, 0.55, 1]),
|
|
261
|
-
circOut: /* @__PURE__ */ cubicBezierAsString([0.55, 0, 1, 0.45]),
|
|
262
|
-
backIn: /* @__PURE__ */ cubicBezierAsString([0.31, 0.01, 0.66, -0.59]),
|
|
263
|
-
backOut: /* @__PURE__ */ cubicBezierAsString([0.33, 1.53, 0.69, 0.99])
|
|
264
|
-
};
|
|
265
|
-
function mapEasingToNativeEasing(easing, duration) {
|
|
266
|
-
if (!easing) {
|
|
267
|
-
return void 0;
|
|
268
|
-
} else if (typeof easing === "function" && supportsLinearEasing()) {
|
|
269
|
-
return generateLinearEasing(easing, duration);
|
|
270
|
-
} else if (isBezierDefinition(easing)) {
|
|
271
|
-
return cubicBezierAsString(easing);
|
|
272
|
-
} else if (Array.isArray(easing)) {
|
|
273
|
-
return easing.map((segmentEasing) => mapEasingToNativeEasing(segmentEasing, duration) || supportedWaapiEasing.easeOut);
|
|
274
|
-
} else {
|
|
275
|
-
return supportedWaapiEasing[easing];
|
|
44
|
+
class SubscriptionManager {
|
|
45
|
+
constructor() {
|
|
46
|
+
this.subscriptions = [];
|
|
276
47
|
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
y: false
|
|
281
|
-
};
|
|
282
|
-
function isDragActive() {
|
|
283
|
-
return isDragging.y;
|
|
284
|
-
}
|
|
285
|
-
function resolveElements(elementOrSelector, scope, selectorCache) {
|
|
286
|
-
var _a;
|
|
287
|
-
if (elementOrSelector instanceof EventTarget) {
|
|
288
|
-
return [elementOrSelector];
|
|
289
|
-
} else if (typeof elementOrSelector === "string") {
|
|
290
|
-
let root = document;
|
|
291
|
-
if (scope) {
|
|
292
|
-
root = scope.current;
|
|
293
|
-
}
|
|
294
|
-
const elements = (_a = selectorCache === null || selectorCache === void 0 ? void 0 : selectorCache[elementOrSelector]) !== null && _a !== void 0 ? _a : root.querySelectorAll(elementOrSelector);
|
|
295
|
-
return elements ? Array.from(elements) : [];
|
|
48
|
+
add(handler) {
|
|
49
|
+
addUniqueItem(this.subscriptions, handler);
|
|
50
|
+
return () => removeItem(this.subscriptions, handler);
|
|
296
51
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
const elements = resolveElements(elementOrSelector);
|
|
301
|
-
const gestureAbortController = new AbortController();
|
|
302
|
-
const eventOptions = {
|
|
303
|
-
passive: true,
|
|
304
|
-
...options,
|
|
305
|
-
signal: gestureAbortController.signal
|
|
306
|
-
};
|
|
307
|
-
const cancel = () => gestureAbortController.abort();
|
|
308
|
-
return [elements, eventOptions, cancel];
|
|
309
|
-
}
|
|
310
|
-
function isValidHover(event) {
|
|
311
|
-
return !(event.pointerType === "touch" || isDragActive());
|
|
312
|
-
}
|
|
313
|
-
function hover(elementOrSelector, onHoverStart, options = {}) {
|
|
314
|
-
const [elements, eventOptions, cancel] = setupGesture(elementOrSelector, options);
|
|
315
|
-
const onPointerEnter = (enterEvent) => {
|
|
316
|
-
if (!isValidHover(enterEvent))
|
|
317
|
-
return;
|
|
318
|
-
const { target } = enterEvent;
|
|
319
|
-
const onHoverEnd = onHoverStart(target, enterEvent);
|
|
320
|
-
if (typeof onHoverEnd !== "function" || !target)
|
|
52
|
+
notify(a, b, c) {
|
|
53
|
+
const numSubscriptions = this.subscriptions.length;
|
|
54
|
+
if (!numSubscriptions)
|
|
321
55
|
return;
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
};
|
|
330
|
-
elements.forEach((element) => {
|
|
331
|
-
element.addEventListener("pointerenter", onPointerEnter, eventOptions);
|
|
332
|
-
});
|
|
333
|
-
return cancel;
|
|
334
|
-
}
|
|
335
|
-
function capturePointer(event, action) {
|
|
336
|
-
const actionName = `${action}PointerCapture`;
|
|
337
|
-
if (event.target instanceof Element && actionName in event.target && event.pointerId !== void 0) {
|
|
338
|
-
try {
|
|
339
|
-
event.target[actionName](event.pointerId);
|
|
340
|
-
} catch (e) {
|
|
56
|
+
if (numSubscriptions === 1) {
|
|
57
|
+
this.subscriptions[0](a, b, c);
|
|
58
|
+
} else {
|
|
59
|
+
for (let i = 0; i < numSubscriptions; i++) {
|
|
60
|
+
const handler = this.subscriptions[i];
|
|
61
|
+
handler && handler(a, b, c);
|
|
62
|
+
}
|
|
341
63
|
}
|
|
342
64
|
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
if (!child) {
|
|
346
|
-
return false;
|
|
347
|
-
} else if (parent === child) {
|
|
348
|
-
return true;
|
|
349
|
-
} else {
|
|
350
|
-
return isNodeOrChild(parent, child.parentElement);
|
|
65
|
+
getSize() {
|
|
66
|
+
return this.subscriptions.length;
|
|
351
67
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
if (event.pointerType === "mouse") {
|
|
355
|
-
return typeof event.button !== "number" || event.button <= 0;
|
|
356
|
-
} else {
|
|
357
|
-
return event.isPrimary !== false;
|
|
68
|
+
clear() {
|
|
69
|
+
this.subscriptions.length = 0;
|
|
358
70
|
}
|
|
359
|
-
};
|
|
360
|
-
const focusableElements = /* @__PURE__ */ new Set([
|
|
361
|
-
"BUTTON",
|
|
362
|
-
"INPUT",
|
|
363
|
-
"SELECT",
|
|
364
|
-
"TEXTAREA",
|
|
365
|
-
"A"
|
|
366
|
-
]);
|
|
367
|
-
function isElementKeyboardAccessible(element) {
|
|
368
|
-
return focusableElements.has(element.tagName) || element.tabIndex !== -1;
|
|
369
|
-
}
|
|
370
|
-
const isPressing = /* @__PURE__ */ new WeakSet();
|
|
371
|
-
function filterEvents(callback) {
|
|
372
|
-
return (event) => {
|
|
373
|
-
if (event.key !== "Enter")
|
|
374
|
-
return;
|
|
375
|
-
callback(event);
|
|
376
|
-
};
|
|
377
71
|
}
|
|
378
|
-
|
|
379
|
-
|
|
72
|
+
const secondsToMilliseconds$1 = /* @__NO_SIDE_EFFECTS__ */ (seconds) => seconds * 1e3;
|
|
73
|
+
const millisecondsToSeconds$1 = /* @__NO_SIDE_EFFECTS__ */ (milliseconds) => milliseconds / 1e3;
|
|
74
|
+
function velocityPerSecond(velocity, frameDuration) {
|
|
75
|
+
return frameDuration ? velocity * (1e3 / frameDuration) : 0;
|
|
380
76
|
}
|
|
381
|
-
const
|
|
382
|
-
|
|
383
|
-
if (
|
|
77
|
+
const warned = /* @__PURE__ */ new Set();
|
|
78
|
+
function warnOnce(condition, message, element) {
|
|
79
|
+
if (condition || warned.has(message))
|
|
384
80
|
return;
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
return;
|
|
388
|
-
firePointerEvent(element, "down");
|
|
389
|
-
const handleKeyup = filterEvents(() => {
|
|
390
|
-
firePointerEvent(element, "up");
|
|
391
|
-
});
|
|
392
|
-
const handleBlur = () => firePointerEvent(element, "cancel");
|
|
393
|
-
element.addEventListener("keyup", handleKeyup, eventOptions);
|
|
394
|
-
element.addEventListener("blur", handleBlur, eventOptions);
|
|
395
|
-
});
|
|
396
|
-
element.addEventListener("keydown", handleKeydown, eventOptions);
|
|
397
|
-
element.addEventListener("blur", () => element.removeEventListener("keydown", handleKeydown), eventOptions);
|
|
398
|
-
};
|
|
399
|
-
function isValidPressEvent(event) {
|
|
400
|
-
return isPrimaryPointer$1(event) && !isDragActive();
|
|
401
|
-
}
|
|
402
|
-
function press(targetOrSelector, onPressStart, options = {}) {
|
|
403
|
-
const [targets, eventOptions, cancelEvents] = setupGesture(targetOrSelector, options);
|
|
404
|
-
const startPress = (startEvent) => {
|
|
405
|
-
const target = startEvent.currentTarget;
|
|
406
|
-
if (!target || !isValidPressEvent(startEvent) || isPressing.has(target))
|
|
407
|
-
return;
|
|
408
|
-
isPressing.add(target);
|
|
409
|
-
capturePointer(startEvent, "set");
|
|
410
|
-
const onPressEnd = onPressStart(target, startEvent);
|
|
411
|
-
const onPointerEnd = (endEvent, success) => {
|
|
412
|
-
target.removeEventListener("pointerup", onPointerUp);
|
|
413
|
-
target.removeEventListener("pointercancel", onPointerCancel);
|
|
414
|
-
capturePointer(endEvent, "release");
|
|
415
|
-
if (!isValidPressEvent(endEvent) || !isPressing.has(target)) {
|
|
416
|
-
return;
|
|
417
|
-
}
|
|
418
|
-
isPressing.delete(target);
|
|
419
|
-
if (typeof onPressEnd === "function") {
|
|
420
|
-
onPressEnd(endEvent, { success });
|
|
421
|
-
}
|
|
422
|
-
};
|
|
423
|
-
const onPointerUp = (upEvent) => {
|
|
424
|
-
const isOutside = !upEvent.isTrusted ? false : checkOutside(upEvent, target instanceof Element ? target.getBoundingClientRect() : {
|
|
425
|
-
left: 0,
|
|
426
|
-
top: 0,
|
|
427
|
-
right: window.innerWidth,
|
|
428
|
-
bottom: window.innerHeight
|
|
429
|
-
});
|
|
430
|
-
if (isOutside) {
|
|
431
|
-
onPointerEnd(upEvent, false);
|
|
432
|
-
} else {
|
|
433
|
-
onPointerEnd(upEvent, !(target instanceof Element) || isNodeOrChild(target, upEvent.target));
|
|
434
|
-
}
|
|
435
|
-
};
|
|
436
|
-
const onPointerCancel = (cancelEvent) => {
|
|
437
|
-
onPointerEnd(cancelEvent, false);
|
|
438
|
-
};
|
|
439
|
-
target.addEventListener("pointerup", onPointerUp, eventOptions);
|
|
440
|
-
target.addEventListener("pointercancel", onPointerCancel, eventOptions);
|
|
441
|
-
target.addEventListener("lostpointercapture", onPointerCancel, eventOptions);
|
|
442
|
-
};
|
|
443
|
-
targets.forEach((target) => {
|
|
444
|
-
target = options.useGlobalTarget ? window : target;
|
|
445
|
-
let canAddKeyboardAccessibility = false;
|
|
446
|
-
if (target instanceof HTMLElement) {
|
|
447
|
-
canAddKeyboardAccessibility = true;
|
|
448
|
-
if (!isElementKeyboardAccessible(target) && target.getAttribute("tabindex") === null) {
|
|
449
|
-
target.tabIndex = 0;
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
target.addEventListener("pointerdown", startPress, eventOptions);
|
|
453
|
-
if (canAddKeyboardAccessibility) {
|
|
454
|
-
target.addEventListener("focus", (event) => enableKeyboardPress(event, eventOptions), eventOptions);
|
|
455
|
-
}
|
|
456
|
-
});
|
|
457
|
-
return cancelEvents;
|
|
458
|
-
}
|
|
459
|
-
function checkOutside(event, rect) {
|
|
460
|
-
return event.clientX < rect.left || event.clientX > rect.right || event.clientY < rect.top || event.clientY > rect.bottom;
|
|
81
|
+
console.warn(message);
|
|
82
|
+
warned.add(message);
|
|
461
83
|
}
|
|
462
84
|
const clamp$1 = (min, max, v) => {
|
|
463
85
|
if (v > max)
|
|
@@ -466,9 +88,6 @@ const clamp$1 = (min, max, v) => {
|
|
|
466
88
|
return min;
|
|
467
89
|
return v;
|
|
468
90
|
};
|
|
469
|
-
function velocityPerSecond(velocity, frameDuration) {
|
|
470
|
-
return frameDuration ? velocity * (1e3 / frameDuration) : 0;
|
|
471
|
-
}
|
|
472
91
|
const velocitySampleDuration = 5;
|
|
473
92
|
function calcGeneratorVelocity(resolveValue, t, current) {
|
|
474
93
|
const prevT = Math.max(t - velocitySampleDuration, 0);
|
|
@@ -666,8 +285,8 @@ function spring(optionsOrVisualDuration = springDefaults.visualDuration, bounce
|
|
|
666
285
|
return state2;
|
|
667
286
|
},
|
|
668
287
|
toString: () => {
|
|
669
|
-
const calculatedDuration = Math.min(calcGeneratorDuration(generator), maxGeneratorDuration);
|
|
670
|
-
const easing = generateLinearEasing((progress2) => generator.next(calculatedDuration * progress2).value, calculatedDuration, 30);
|
|
288
|
+
const calculatedDuration = Math.min(motionDom.calcGeneratorDuration(generator), motionDom.maxGeneratorDuration);
|
|
289
|
+
const easing = motionDom.generateLinearEasing((progress2) => generator.next(calculatedDuration * progress2).value, calculatedDuration, 30);
|
|
671
290
|
return calculatedDuration + "ms " + easing;
|
|
672
291
|
}
|
|
673
292
|
};
|
|
@@ -704,7 +323,7 @@ function isDOMKeyframes(keyframes2) {
|
|
|
704
323
|
}
|
|
705
324
|
function resolveSubjects(subject, keyframes2, scope, selectorCache) {
|
|
706
325
|
if (typeof subject === "string" && isDOMKeyframes(keyframes2)) {
|
|
707
|
-
return resolveElements(subject, scope, selectorCache);
|
|
326
|
+
return motionDom.resolveElements(subject, scope, selectorCache);
|
|
708
327
|
} else if (subject instanceof NodeList) {
|
|
709
328
|
return Array.from(subject);
|
|
710
329
|
} else if (Array.isArray(subject)) {
|
|
@@ -728,15 +347,6 @@ function calcNextTime(current, next, prev, labels) {
|
|
|
728
347
|
return (_a = labels.get(next)) !== null && _a !== void 0 ? _a : current;
|
|
729
348
|
}
|
|
730
349
|
}
|
|
731
|
-
function addUniqueItem(arr, item) {
|
|
732
|
-
if (arr.indexOf(item) === -1)
|
|
733
|
-
arr.push(item);
|
|
734
|
-
}
|
|
735
|
-
function removeItem(arr, item) {
|
|
736
|
-
const index = arr.indexOf(item);
|
|
737
|
-
if (index > -1)
|
|
738
|
-
arr.splice(index, 1);
|
|
739
|
-
}
|
|
740
350
|
function eraseKeyframes(sequence, startTime, endTime) {
|
|
741
351
|
for (let i = 0; i < sequence.length; i++) {
|
|
742
352
|
const keyframe = sequence[i];
|
|
@@ -803,7 +413,7 @@ function createAnimationsFromSequence(sequence, { defaultTransition = {}, ...seq
|
|
|
803
413
|
let { ease: ease2 = defaultTransition.ease || "easeOut", duration } = valueTransition;
|
|
804
414
|
const calculatedDelay = typeof delay2 === "function" ? delay2(elementIndex, numSubjects) : delay2;
|
|
805
415
|
const numKeyframes = valueKeyframesAsList.length;
|
|
806
|
-
const createGenerator = isGenerator(type) ? type : generators2 === null || generators2 === void 0 ? void 0 : generators2[type];
|
|
416
|
+
const createGenerator = motionDom.isGenerator(type) ? type : generators2 === null || generators2 === void 0 ? void 0 : generators2[type];
|
|
807
417
|
if (numKeyframes <= 2 && createGenerator) {
|
|
808
418
|
let absoluteDelta = 100;
|
|
809
419
|
if (numKeyframes === 2 && isNumberKeyframesArray(valueKeyframesAsList)) {
|
|
@@ -814,7 +424,7 @@ function createAnimationsFromSequence(sequence, { defaultTransition = {}, ...seq
|
|
|
814
424
|
if (duration !== void 0) {
|
|
815
425
|
springTransition.duration = /* @__PURE__ */ secondsToMilliseconds$1(duration);
|
|
816
426
|
}
|
|
817
|
-
const springEasing = createGeneratorEasing(springTransition, absoluteDelta, createGenerator);
|
|
427
|
+
const springEasing = motionDom.createGeneratorEasing(springTransition, absoluteDelta, createGenerator);
|
|
818
428
|
ease2 = springEasing.ease;
|
|
819
429
|
duration = springEasing.duration;
|
|
820
430
|
}
|
|
@@ -966,476 +576,6 @@ const isCustomValue = (v) => {
|
|
|
966
576
|
const resolveFinalValueInKeyframes = (v) => {
|
|
967
577
|
return isKeyframesTarget(v) ? v[v.length - 1] || 0 : v;
|
|
968
578
|
};
|
|
969
|
-
const MotionGlobalConfig = {
|
|
970
|
-
skipAnimations: false,
|
|
971
|
-
useManualTiming: false
|
|
972
|
-
};
|
|
973
|
-
const stepsOrder = [
|
|
974
|
-
"read",
|
|
975
|
-
// Read
|
|
976
|
-
"resolveKeyframes",
|
|
977
|
-
// Write/Read/Write/Read
|
|
978
|
-
"update",
|
|
979
|
-
// Compute
|
|
980
|
-
"preRender",
|
|
981
|
-
// Compute
|
|
982
|
-
"render",
|
|
983
|
-
// Write
|
|
984
|
-
"postRender"
|
|
985
|
-
// Compute
|
|
986
|
-
];
|
|
987
|
-
const statsBuffer = {
|
|
988
|
-
value: null,
|
|
989
|
-
addProjectionMetrics: null
|
|
990
|
-
};
|
|
991
|
-
function createRenderStep(runNextFrame, stepName) {
|
|
992
|
-
let thisFrame = /* @__PURE__ */ new Set();
|
|
993
|
-
let nextFrame = /* @__PURE__ */ new Set();
|
|
994
|
-
let isProcessing = false;
|
|
995
|
-
let flushNextFrame = false;
|
|
996
|
-
const toKeepAlive = /* @__PURE__ */ new WeakSet();
|
|
997
|
-
let latestFrameData = {
|
|
998
|
-
delta: 0,
|
|
999
|
-
timestamp: 0,
|
|
1000
|
-
isProcessing: false
|
|
1001
|
-
};
|
|
1002
|
-
let numCalls = 0;
|
|
1003
|
-
function triggerCallback(callback) {
|
|
1004
|
-
if (toKeepAlive.has(callback)) {
|
|
1005
|
-
step.schedule(callback);
|
|
1006
|
-
runNextFrame();
|
|
1007
|
-
}
|
|
1008
|
-
numCalls++;
|
|
1009
|
-
callback(latestFrameData);
|
|
1010
|
-
}
|
|
1011
|
-
const step = {
|
|
1012
|
-
/**
|
|
1013
|
-
* Schedule a process to run on the next frame.
|
|
1014
|
-
*/
|
|
1015
|
-
schedule: (callback, keepAlive = false, immediate = false) => {
|
|
1016
|
-
const addToCurrentFrame = immediate && isProcessing;
|
|
1017
|
-
const queue = addToCurrentFrame ? thisFrame : nextFrame;
|
|
1018
|
-
if (keepAlive)
|
|
1019
|
-
toKeepAlive.add(callback);
|
|
1020
|
-
if (!queue.has(callback))
|
|
1021
|
-
queue.add(callback);
|
|
1022
|
-
return callback;
|
|
1023
|
-
},
|
|
1024
|
-
/**
|
|
1025
|
-
* Cancel the provided callback from running on the next frame.
|
|
1026
|
-
*/
|
|
1027
|
-
cancel: (callback) => {
|
|
1028
|
-
nextFrame.delete(callback);
|
|
1029
|
-
toKeepAlive.delete(callback);
|
|
1030
|
-
},
|
|
1031
|
-
/**
|
|
1032
|
-
* Execute all schedule callbacks.
|
|
1033
|
-
*/
|
|
1034
|
-
process: (frameData2) => {
|
|
1035
|
-
latestFrameData = frameData2;
|
|
1036
|
-
if (isProcessing) {
|
|
1037
|
-
flushNextFrame = true;
|
|
1038
|
-
return;
|
|
1039
|
-
}
|
|
1040
|
-
isProcessing = true;
|
|
1041
|
-
[thisFrame, nextFrame] = [nextFrame, thisFrame];
|
|
1042
|
-
thisFrame.forEach(triggerCallback);
|
|
1043
|
-
if (stepName && statsBuffer.value) {
|
|
1044
|
-
statsBuffer.value.frameloop[stepName].push(numCalls);
|
|
1045
|
-
}
|
|
1046
|
-
numCalls = 0;
|
|
1047
|
-
thisFrame.clear();
|
|
1048
|
-
isProcessing = false;
|
|
1049
|
-
if (flushNextFrame) {
|
|
1050
|
-
flushNextFrame = false;
|
|
1051
|
-
step.process(frameData2);
|
|
1052
|
-
}
|
|
1053
|
-
}
|
|
1054
|
-
};
|
|
1055
|
-
return step;
|
|
1056
|
-
}
|
|
1057
|
-
const maxElapsed$1 = 40;
|
|
1058
|
-
function createRenderBatcher(scheduleNextBatch, allowKeepAlive) {
|
|
1059
|
-
let runNextFrame = false;
|
|
1060
|
-
let useDefaultElapsed = true;
|
|
1061
|
-
const state2 = {
|
|
1062
|
-
delta: 0,
|
|
1063
|
-
timestamp: 0,
|
|
1064
|
-
isProcessing: false
|
|
1065
|
-
};
|
|
1066
|
-
const flagRunNextFrame = () => runNextFrame = true;
|
|
1067
|
-
const steps2 = stepsOrder.reduce((acc, key) => {
|
|
1068
|
-
acc[key] = createRenderStep(flagRunNextFrame, allowKeepAlive ? key : void 0);
|
|
1069
|
-
return acc;
|
|
1070
|
-
}, {});
|
|
1071
|
-
const { read, resolveKeyframes, update, preRender, render, postRender } = steps2;
|
|
1072
|
-
const processBatch = () => {
|
|
1073
|
-
const timestamp = performance.now();
|
|
1074
|
-
runNextFrame = false;
|
|
1075
|
-
{
|
|
1076
|
-
state2.delta = useDefaultElapsed ? 1e3 / 60 : Math.max(Math.min(timestamp - state2.timestamp, maxElapsed$1), 1);
|
|
1077
|
-
}
|
|
1078
|
-
state2.timestamp = timestamp;
|
|
1079
|
-
state2.isProcessing = true;
|
|
1080
|
-
read.process(state2);
|
|
1081
|
-
resolveKeyframes.process(state2);
|
|
1082
|
-
update.process(state2);
|
|
1083
|
-
preRender.process(state2);
|
|
1084
|
-
render.process(state2);
|
|
1085
|
-
postRender.process(state2);
|
|
1086
|
-
state2.isProcessing = false;
|
|
1087
|
-
if (runNextFrame && allowKeepAlive) {
|
|
1088
|
-
useDefaultElapsed = false;
|
|
1089
|
-
scheduleNextBatch(processBatch);
|
|
1090
|
-
}
|
|
1091
|
-
};
|
|
1092
|
-
const wake = () => {
|
|
1093
|
-
runNextFrame = true;
|
|
1094
|
-
useDefaultElapsed = true;
|
|
1095
|
-
if (!state2.isProcessing) {
|
|
1096
|
-
scheduleNextBatch(processBatch);
|
|
1097
|
-
}
|
|
1098
|
-
};
|
|
1099
|
-
const schedule = stepsOrder.reduce((acc, key) => {
|
|
1100
|
-
const step = steps2[key];
|
|
1101
|
-
acc[key] = (process2, keepAlive = false, immediate = false) => {
|
|
1102
|
-
if (!runNextFrame)
|
|
1103
|
-
wake();
|
|
1104
|
-
return step.schedule(process2, keepAlive, immediate);
|
|
1105
|
-
};
|
|
1106
|
-
return acc;
|
|
1107
|
-
}, {});
|
|
1108
|
-
const cancel = (process2) => {
|
|
1109
|
-
for (let i = 0; i < stepsOrder.length; i++) {
|
|
1110
|
-
steps2[stepsOrder[i]].cancel(process2);
|
|
1111
|
-
}
|
|
1112
|
-
};
|
|
1113
|
-
return { schedule, cancel, state: state2, steps: steps2 };
|
|
1114
|
-
}
|
|
1115
|
-
const { schedule: frame, cancel: cancelFrame, state: frameData, steps: frameSteps } = createRenderBatcher(typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame : noop, true);
|
|
1116
|
-
let now;
|
|
1117
|
-
function clearTime() {
|
|
1118
|
-
now = void 0;
|
|
1119
|
-
}
|
|
1120
|
-
const time = {
|
|
1121
|
-
now: () => {
|
|
1122
|
-
if (now === void 0) {
|
|
1123
|
-
time.set(frameData.isProcessing || MotionGlobalConfig.useManualTiming ? frameData.timestamp : performance.now());
|
|
1124
|
-
}
|
|
1125
|
-
return now;
|
|
1126
|
-
},
|
|
1127
|
-
set: (newTime) => {
|
|
1128
|
-
now = newTime;
|
|
1129
|
-
queueMicrotask(clearTime);
|
|
1130
|
-
}
|
|
1131
|
-
};
|
|
1132
|
-
class SubscriptionManager {
|
|
1133
|
-
constructor() {
|
|
1134
|
-
this.subscriptions = [];
|
|
1135
|
-
}
|
|
1136
|
-
add(handler) {
|
|
1137
|
-
addUniqueItem(this.subscriptions, handler);
|
|
1138
|
-
return () => removeItem(this.subscriptions, handler);
|
|
1139
|
-
}
|
|
1140
|
-
notify(a, b, c) {
|
|
1141
|
-
const numSubscriptions = this.subscriptions.length;
|
|
1142
|
-
if (!numSubscriptions)
|
|
1143
|
-
return;
|
|
1144
|
-
if (numSubscriptions === 1) {
|
|
1145
|
-
this.subscriptions[0](a, b, c);
|
|
1146
|
-
} else {
|
|
1147
|
-
for (let i = 0; i < numSubscriptions; i++) {
|
|
1148
|
-
const handler = this.subscriptions[i];
|
|
1149
|
-
handler && handler(a, b, c);
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
}
|
|
1153
|
-
getSize() {
|
|
1154
|
-
return this.subscriptions.length;
|
|
1155
|
-
}
|
|
1156
|
-
clear() {
|
|
1157
|
-
this.subscriptions.length = 0;
|
|
1158
|
-
}
|
|
1159
|
-
}
|
|
1160
|
-
const warned = /* @__PURE__ */ new Set();
|
|
1161
|
-
function warnOnce(condition, message, element) {
|
|
1162
|
-
if (condition || warned.has(message))
|
|
1163
|
-
return;
|
|
1164
|
-
console.warn(message);
|
|
1165
|
-
warned.add(message);
|
|
1166
|
-
}
|
|
1167
|
-
const MAX_VELOCITY_DELTA = 30;
|
|
1168
|
-
const isFloat = (value) => {
|
|
1169
|
-
return !isNaN(parseFloat(value));
|
|
1170
|
-
};
|
|
1171
|
-
const collectMotionValues = {
|
|
1172
|
-
current: void 0
|
|
1173
|
-
};
|
|
1174
|
-
class MotionValue {
|
|
1175
|
-
/**
|
|
1176
|
-
* @param init - The initiating value
|
|
1177
|
-
* @param config - Optional configuration options
|
|
1178
|
-
*
|
|
1179
|
-
* - `transformer`: A function to transform incoming values with.
|
|
1180
|
-
*
|
|
1181
|
-
* @internal
|
|
1182
|
-
*/
|
|
1183
|
-
constructor(init, options = {}) {
|
|
1184
|
-
this.version = "12.4.10";
|
|
1185
|
-
this.canTrackVelocity = null;
|
|
1186
|
-
this.events = {};
|
|
1187
|
-
this.updateAndNotify = (v, render = true) => {
|
|
1188
|
-
const currentTime = time.now();
|
|
1189
|
-
if (this.updatedAt !== currentTime) {
|
|
1190
|
-
this.setPrevFrameValue();
|
|
1191
|
-
}
|
|
1192
|
-
this.prev = this.current;
|
|
1193
|
-
this.setCurrent(v);
|
|
1194
|
-
if (this.current !== this.prev && this.events.change) {
|
|
1195
|
-
this.events.change.notify(this.current);
|
|
1196
|
-
}
|
|
1197
|
-
if (render && this.events.renderRequest) {
|
|
1198
|
-
this.events.renderRequest.notify(this.current);
|
|
1199
|
-
}
|
|
1200
|
-
};
|
|
1201
|
-
this.hasAnimated = false;
|
|
1202
|
-
this.setCurrent(init);
|
|
1203
|
-
this.owner = options.owner;
|
|
1204
|
-
}
|
|
1205
|
-
setCurrent(current) {
|
|
1206
|
-
this.current = current;
|
|
1207
|
-
this.updatedAt = time.now();
|
|
1208
|
-
if (this.canTrackVelocity === null && current !== void 0) {
|
|
1209
|
-
this.canTrackVelocity = isFloat(this.current);
|
|
1210
|
-
}
|
|
1211
|
-
}
|
|
1212
|
-
setPrevFrameValue(prevFrameValue = this.current) {
|
|
1213
|
-
this.prevFrameValue = prevFrameValue;
|
|
1214
|
-
this.prevUpdatedAt = this.updatedAt;
|
|
1215
|
-
}
|
|
1216
|
-
/**
|
|
1217
|
-
* Adds a function that will be notified when the `MotionValue` is updated.
|
|
1218
|
-
*
|
|
1219
|
-
* It returns a function that, when called, will cancel the subscription.
|
|
1220
|
-
*
|
|
1221
|
-
* When calling `onChange` inside a React component, it should be wrapped with the
|
|
1222
|
-
* `useEffect` hook. As it returns an unsubscribe function, this should be returned
|
|
1223
|
-
* from the `useEffect` function to ensure you don't add duplicate subscribers..
|
|
1224
|
-
*
|
|
1225
|
-
* ```jsx
|
|
1226
|
-
* export const MyComponent = () => {
|
|
1227
|
-
* const x = useMotionValue(0)
|
|
1228
|
-
* const y = useMotionValue(0)
|
|
1229
|
-
* const opacity = useMotionValue(1)
|
|
1230
|
-
*
|
|
1231
|
-
* useEffect(() => {
|
|
1232
|
-
* function updateOpacity() {
|
|
1233
|
-
* const maxXY = Math.max(x.get(), y.get())
|
|
1234
|
-
* const newOpacity = transform(maxXY, [0, 100], [1, 0])
|
|
1235
|
-
* opacity.set(newOpacity)
|
|
1236
|
-
* }
|
|
1237
|
-
*
|
|
1238
|
-
* const unsubscribeX = x.on("change", updateOpacity)
|
|
1239
|
-
* const unsubscribeY = y.on("change", updateOpacity)
|
|
1240
|
-
*
|
|
1241
|
-
* return () => {
|
|
1242
|
-
* unsubscribeX()
|
|
1243
|
-
* unsubscribeY()
|
|
1244
|
-
* }
|
|
1245
|
-
* }, [])
|
|
1246
|
-
*
|
|
1247
|
-
* return <motion.div style={{ x }} />
|
|
1248
|
-
* }
|
|
1249
|
-
* ```
|
|
1250
|
-
*
|
|
1251
|
-
* @param subscriber - A function that receives the latest value.
|
|
1252
|
-
* @returns A function that, when called, will cancel this subscription.
|
|
1253
|
-
*
|
|
1254
|
-
* @deprecated
|
|
1255
|
-
*/
|
|
1256
|
-
onChange(subscription) {
|
|
1257
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1258
|
-
warnOnce(false, `value.onChange(callback) is deprecated. Switch to value.on("change", callback).`);
|
|
1259
|
-
}
|
|
1260
|
-
return this.on("change", subscription);
|
|
1261
|
-
}
|
|
1262
|
-
on(eventName, callback) {
|
|
1263
|
-
if (!this.events[eventName]) {
|
|
1264
|
-
this.events[eventName] = new SubscriptionManager();
|
|
1265
|
-
}
|
|
1266
|
-
const unsubscribe = this.events[eventName].add(callback);
|
|
1267
|
-
if (eventName === "change") {
|
|
1268
|
-
return () => {
|
|
1269
|
-
unsubscribe();
|
|
1270
|
-
frame.read(() => {
|
|
1271
|
-
if (!this.events.change.getSize()) {
|
|
1272
|
-
this.stop();
|
|
1273
|
-
}
|
|
1274
|
-
});
|
|
1275
|
-
};
|
|
1276
|
-
}
|
|
1277
|
-
return unsubscribe;
|
|
1278
|
-
}
|
|
1279
|
-
clearListeners() {
|
|
1280
|
-
for (const eventManagers in this.events) {
|
|
1281
|
-
this.events[eventManagers].clear();
|
|
1282
|
-
}
|
|
1283
|
-
}
|
|
1284
|
-
/**
|
|
1285
|
-
* Attaches a passive effect to the `MotionValue`.
|
|
1286
|
-
*
|
|
1287
|
-
* @internal
|
|
1288
|
-
*/
|
|
1289
|
-
attach(passiveEffect, stopPassiveEffect) {
|
|
1290
|
-
this.passiveEffect = passiveEffect;
|
|
1291
|
-
this.stopPassiveEffect = stopPassiveEffect;
|
|
1292
|
-
}
|
|
1293
|
-
/**
|
|
1294
|
-
* Sets the state of the `MotionValue`.
|
|
1295
|
-
*
|
|
1296
|
-
* @remarks
|
|
1297
|
-
*
|
|
1298
|
-
* ```jsx
|
|
1299
|
-
* const x = useMotionValue(0)
|
|
1300
|
-
* x.set(10)
|
|
1301
|
-
* ```
|
|
1302
|
-
*
|
|
1303
|
-
* @param latest - Latest value to set.
|
|
1304
|
-
* @param render - Whether to notify render subscribers. Defaults to `true`
|
|
1305
|
-
*
|
|
1306
|
-
* @public
|
|
1307
|
-
*/
|
|
1308
|
-
set(v, render = true) {
|
|
1309
|
-
if (!render || !this.passiveEffect) {
|
|
1310
|
-
this.updateAndNotify(v, render);
|
|
1311
|
-
} else {
|
|
1312
|
-
this.passiveEffect(v, this.updateAndNotify);
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1315
|
-
setWithVelocity(prev, current, delta) {
|
|
1316
|
-
this.set(current);
|
|
1317
|
-
this.prev = void 0;
|
|
1318
|
-
this.prevFrameValue = prev;
|
|
1319
|
-
this.prevUpdatedAt = this.updatedAt - delta;
|
|
1320
|
-
}
|
|
1321
|
-
/**
|
|
1322
|
-
* Set the state of the `MotionValue`, stopping any active animations,
|
|
1323
|
-
* effects, and resets velocity to `0`.
|
|
1324
|
-
*/
|
|
1325
|
-
jump(v, endAnimation = true) {
|
|
1326
|
-
this.updateAndNotify(v);
|
|
1327
|
-
this.prev = v;
|
|
1328
|
-
this.prevUpdatedAt = this.prevFrameValue = void 0;
|
|
1329
|
-
endAnimation && this.stop();
|
|
1330
|
-
if (this.stopPassiveEffect)
|
|
1331
|
-
this.stopPassiveEffect();
|
|
1332
|
-
}
|
|
1333
|
-
/**
|
|
1334
|
-
* Returns the latest state of `MotionValue`
|
|
1335
|
-
*
|
|
1336
|
-
* @returns - The latest state of `MotionValue`
|
|
1337
|
-
*
|
|
1338
|
-
* @public
|
|
1339
|
-
*/
|
|
1340
|
-
get() {
|
|
1341
|
-
if (collectMotionValues.current) {
|
|
1342
|
-
collectMotionValues.current.push(this);
|
|
1343
|
-
}
|
|
1344
|
-
return this.current;
|
|
1345
|
-
}
|
|
1346
|
-
/**
|
|
1347
|
-
* @public
|
|
1348
|
-
*/
|
|
1349
|
-
getPrevious() {
|
|
1350
|
-
return this.prev;
|
|
1351
|
-
}
|
|
1352
|
-
/**
|
|
1353
|
-
* Returns the latest velocity of `MotionValue`
|
|
1354
|
-
*
|
|
1355
|
-
* @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
|
|
1356
|
-
*
|
|
1357
|
-
* @public
|
|
1358
|
-
*/
|
|
1359
|
-
getVelocity() {
|
|
1360
|
-
const currentTime = time.now();
|
|
1361
|
-
if (!this.canTrackVelocity || this.prevFrameValue === void 0 || currentTime - this.updatedAt > MAX_VELOCITY_DELTA) {
|
|
1362
|
-
return 0;
|
|
1363
|
-
}
|
|
1364
|
-
const delta = Math.min(this.updatedAt - this.prevUpdatedAt, MAX_VELOCITY_DELTA);
|
|
1365
|
-
return velocityPerSecond(parseFloat(this.current) - parseFloat(this.prevFrameValue), delta);
|
|
1366
|
-
}
|
|
1367
|
-
/**
|
|
1368
|
-
* Registers a new animation to control this `MotionValue`. Only one
|
|
1369
|
-
* animation can drive a `MotionValue` at one time.
|
|
1370
|
-
*
|
|
1371
|
-
* ```jsx
|
|
1372
|
-
* value.start()
|
|
1373
|
-
* ```
|
|
1374
|
-
*
|
|
1375
|
-
* @param animation - A function that starts the provided animation
|
|
1376
|
-
*
|
|
1377
|
-
* @internal
|
|
1378
|
-
*/
|
|
1379
|
-
start(startAnimation) {
|
|
1380
|
-
this.stop();
|
|
1381
|
-
return new Promise((resolve) => {
|
|
1382
|
-
this.hasAnimated = true;
|
|
1383
|
-
this.animation = startAnimation(resolve);
|
|
1384
|
-
if (this.events.animationStart) {
|
|
1385
|
-
this.events.animationStart.notify();
|
|
1386
|
-
}
|
|
1387
|
-
}).then(() => {
|
|
1388
|
-
if (this.events.animationComplete) {
|
|
1389
|
-
this.events.animationComplete.notify();
|
|
1390
|
-
}
|
|
1391
|
-
this.clearAnimation();
|
|
1392
|
-
});
|
|
1393
|
-
}
|
|
1394
|
-
/**
|
|
1395
|
-
* Stop the currently active animation.
|
|
1396
|
-
*
|
|
1397
|
-
* @public
|
|
1398
|
-
*/
|
|
1399
|
-
stop() {
|
|
1400
|
-
if (this.animation) {
|
|
1401
|
-
this.animation.stop();
|
|
1402
|
-
if (this.events.animationCancel) {
|
|
1403
|
-
this.events.animationCancel.notify();
|
|
1404
|
-
}
|
|
1405
|
-
}
|
|
1406
|
-
this.clearAnimation();
|
|
1407
|
-
}
|
|
1408
|
-
/**
|
|
1409
|
-
* Returns `true` if this value is currently animating.
|
|
1410
|
-
*
|
|
1411
|
-
* @public
|
|
1412
|
-
*/
|
|
1413
|
-
isAnimating() {
|
|
1414
|
-
return !!this.animation;
|
|
1415
|
-
}
|
|
1416
|
-
clearAnimation() {
|
|
1417
|
-
delete this.animation;
|
|
1418
|
-
}
|
|
1419
|
-
/**
|
|
1420
|
-
* Destroy and clean up subscribers to this `MotionValue`.
|
|
1421
|
-
*
|
|
1422
|
-
* The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
|
|
1423
|
-
* handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
|
|
1424
|
-
* created a `MotionValue` via the `motionValue` function.
|
|
1425
|
-
*
|
|
1426
|
-
* @public
|
|
1427
|
-
*/
|
|
1428
|
-
destroy() {
|
|
1429
|
-
this.clearListeners();
|
|
1430
|
-
this.stop();
|
|
1431
|
-
if (this.stopPassiveEffect) {
|
|
1432
|
-
this.stopPassiveEffect();
|
|
1433
|
-
}
|
|
1434
|
-
}
|
|
1435
|
-
}
|
|
1436
|
-
function motionValue(init, options) {
|
|
1437
|
-
return new MotionValue(init, options);
|
|
1438
|
-
}
|
|
1439
579
|
function getValueState(visualElement) {
|
|
1440
580
|
const state2 = [{}, {}];
|
|
1441
581
|
visualElement === null || visualElement === void 0 ? void 0 : visualElement.values.forEach((value, key) => {
|
|
@@ -1466,7 +606,7 @@ function setMotionValue(visualElement, key, value) {
|
|
|
1466
606
|
if (visualElement.hasValue(key)) {
|
|
1467
607
|
visualElement.getValue(key).set(value);
|
|
1468
608
|
} else {
|
|
1469
|
-
visualElement.addValue(key, motionValue(value));
|
|
609
|
+
visualElement.addValue(key, motionDom.motionValue(value));
|
|
1470
610
|
}
|
|
1471
611
|
}
|
|
1472
612
|
function setTarget(visualElement, definition) {
|
|
@@ -1865,23 +1005,85 @@ function makeNoneKeyframesAnimatable(unresolvedKeyframes, noneKeyframeIndexes, n
|
|
|
1865
1005
|
}
|
|
1866
1006
|
}
|
|
1867
1007
|
}
|
|
1868
|
-
const
|
|
1869
|
-
const
|
|
1870
|
-
const
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1008
|
+
const radToDeg = (rad) => rad * 180 / Math.PI;
|
|
1009
|
+
const rotate = (v) => {
|
|
1010
|
+
const angle = radToDeg(Math.atan2(v[1], v[0]));
|
|
1011
|
+
return rebaseAngle(angle);
|
|
1012
|
+
};
|
|
1013
|
+
const matrix2dParsers = {
|
|
1014
|
+
x: 4,
|
|
1015
|
+
y: 5,
|
|
1016
|
+
translateX: 4,
|
|
1017
|
+
translateY: 5,
|
|
1018
|
+
scaleX: 0,
|
|
1019
|
+
scaleY: 3,
|
|
1020
|
+
scale: (v) => (Math.abs(v[0]) + Math.abs(v[3])) / 2,
|
|
1021
|
+
rotate,
|
|
1022
|
+
rotateZ: rotate,
|
|
1023
|
+
skewX: (v) => radToDeg(Math.atan(v[1])),
|
|
1024
|
+
skewY: (v) => radToDeg(Math.atan(v[2])),
|
|
1025
|
+
skew: (v) => (Math.abs(v[1]) + Math.abs(v[2])) / 2
|
|
1026
|
+
};
|
|
1027
|
+
const rebaseAngle = (angle) => {
|
|
1028
|
+
angle = angle % 360;
|
|
1029
|
+
if (angle < 0)
|
|
1030
|
+
angle += 360;
|
|
1031
|
+
return angle;
|
|
1032
|
+
};
|
|
1033
|
+
const rotateZ = rotate;
|
|
1034
|
+
const scaleX = (v) => Math.sqrt(v[0] * v[0] + v[1] * v[1]);
|
|
1035
|
+
const scaleY = (v) => Math.sqrt(v[4] * v[4] + v[5] * v[5]);
|
|
1036
|
+
const matrix3dParsers = {
|
|
1037
|
+
x: 12,
|
|
1038
|
+
y: 13,
|
|
1039
|
+
z: 14,
|
|
1040
|
+
translateX: 12,
|
|
1041
|
+
translateY: 13,
|
|
1042
|
+
translateZ: 14,
|
|
1043
|
+
scaleX,
|
|
1044
|
+
scaleY,
|
|
1045
|
+
scale: (v) => (scaleX(v) + scaleY(v)) / 2,
|
|
1046
|
+
rotateX: (v) => rebaseAngle(radToDeg(Math.atan2(v[6], v[5]))),
|
|
1047
|
+
rotateY: (v) => rebaseAngle(radToDeg(Math.atan2(-v[2], v[0]))),
|
|
1048
|
+
rotateZ,
|
|
1049
|
+
rotate: rotateZ,
|
|
1050
|
+
skewX: (v) => radToDeg(Math.atan(v[4])),
|
|
1051
|
+
skewY: (v) => radToDeg(Math.atan(v[1])),
|
|
1052
|
+
skew: (v) => (Math.abs(v[1]) + Math.abs(v[4])) / 2
|
|
1053
|
+
};
|
|
1054
|
+
function defaultTransformValue(name) {
|
|
1055
|
+
return name.includes("scale") ? 1 : 0;
|
|
1056
|
+
}
|
|
1057
|
+
function parseValueFromTransform(transform2, name) {
|
|
1058
|
+
if (!transform2 || transform2 === "none") {
|
|
1059
|
+
return defaultTransformValue(name);
|
|
1060
|
+
}
|
|
1061
|
+
const matrix3dMatch = transform2.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);
|
|
1062
|
+
let parsers;
|
|
1063
|
+
let match;
|
|
1064
|
+
if (matrix3dMatch) {
|
|
1065
|
+
parsers = matrix3dParsers;
|
|
1066
|
+
match = matrix3dMatch;
|
|
1876
1067
|
} else {
|
|
1877
|
-
const
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1068
|
+
const matrix2dMatch = transform2.match(/^matrix\(([-\d.e\s,]+)\)$/u);
|
|
1069
|
+
parsers = matrix2dParsers;
|
|
1070
|
+
match = matrix2dMatch;
|
|
1071
|
+
}
|
|
1072
|
+
if (!match) {
|
|
1073
|
+
return defaultTransformValue(name);
|
|
1883
1074
|
}
|
|
1075
|
+
const valueParser = parsers[name];
|
|
1076
|
+
const values = match[1].split(",").map(convertTransformToNumber);
|
|
1077
|
+
return typeof valueParser === "function" ? valueParser(values) : values[valueParser];
|
|
1078
|
+
}
|
|
1079
|
+
const readTransformValue = (instance, name) => {
|
|
1080
|
+
const { transform: transform2 = "none" } = getComputedStyle(instance);
|
|
1081
|
+
return parseValueFromTransform(transform2, name);
|
|
1884
1082
|
};
|
|
1083
|
+
function convertTransformToNumber(value) {
|
|
1084
|
+
return parseFloat(value.trim());
|
|
1085
|
+
}
|
|
1086
|
+
const isNumOrPxType = (v) => v === number || v === px;
|
|
1885
1087
|
const transformKeys = /* @__PURE__ */ new Set(["x", "y", "z"]);
|
|
1886
1088
|
const nonTranslationalTransformKeys = transformPropOrder.filter((key) => !transformKeys.has(key));
|
|
1887
1089
|
function removeNonTranslationalTransform(visualElement) {
|
|
@@ -1904,8 +1106,8 @@ const positionalValues = {
|
|
|
1904
1106
|
bottom: ({ y }, { top }) => parseFloat(top) + (y.max - y.min),
|
|
1905
1107
|
right: ({ x }, { left }) => parseFloat(left) + (x.max - x.min),
|
|
1906
1108
|
// Transform
|
|
1907
|
-
x:
|
|
1908
|
-
y:
|
|
1109
|
+
x: (_bbox, { transform: transform2 }) => parseValueFromTransform(transform2, "x"),
|
|
1110
|
+
y: (_bbox, { transform: transform2 }) => parseValueFromTransform(transform2, "y")
|
|
1909
1111
|
};
|
|
1910
1112
|
positionalValues.translateX = positionalValues.x;
|
|
1911
1113
|
positionalValues.translateY = positionalValues.y;
|
|
@@ -1960,7 +1162,7 @@ function flushKeyframeResolvers() {
|
|
|
1960
1162
|
measureAllKeyframes();
|
|
1961
1163
|
}
|
|
1962
1164
|
class KeyframeResolver {
|
|
1963
|
-
constructor(unresolvedKeyframes, onComplete, name,
|
|
1165
|
+
constructor(unresolvedKeyframes, onComplete, name, motionValue, element, isAsync = false) {
|
|
1964
1166
|
this.isComplete = false;
|
|
1965
1167
|
this.isAsync = false;
|
|
1966
1168
|
this.needsMeasurement = false;
|
|
@@ -1968,7 +1170,7 @@ class KeyframeResolver {
|
|
|
1968
1170
|
this.unresolvedKeyframes = [...unresolvedKeyframes];
|
|
1969
1171
|
this.onComplete = onComplete;
|
|
1970
1172
|
this.name = name;
|
|
1971
|
-
this.motionValue =
|
|
1173
|
+
this.motionValue = motionValue;
|
|
1972
1174
|
this.element = element;
|
|
1973
1175
|
this.isAsync = isAsync;
|
|
1974
1176
|
}
|
|
@@ -1978,8 +1180,8 @@ class KeyframeResolver {
|
|
|
1978
1180
|
toResolve.add(this);
|
|
1979
1181
|
if (!isScheduled) {
|
|
1980
1182
|
isScheduled = true;
|
|
1981
|
-
frame.read(readAllKeyframes);
|
|
1982
|
-
frame.resolveKeyframes(measureAllKeyframes);
|
|
1183
|
+
motionDom.frame.read(readAllKeyframes);
|
|
1184
|
+
motionDom.frame.resolveKeyframes(measureAllKeyframes);
|
|
1983
1185
|
}
|
|
1984
1186
|
} else {
|
|
1985
1187
|
this.readKeyframes();
|
|
@@ -1987,11 +1189,11 @@ class KeyframeResolver {
|
|
|
1987
1189
|
}
|
|
1988
1190
|
}
|
|
1989
1191
|
readKeyframes() {
|
|
1990
|
-
const { unresolvedKeyframes, name, element, motionValue
|
|
1192
|
+
const { unresolvedKeyframes, name, element, motionValue } = this;
|
|
1991
1193
|
for (let i = 0; i < unresolvedKeyframes.length; i++) {
|
|
1992
1194
|
if (unresolvedKeyframes[i] === null) {
|
|
1993
1195
|
if (i === 0) {
|
|
1994
|
-
const currentValue =
|
|
1196
|
+
const currentValue = motionValue === null || motionValue === void 0 ? void 0 : motionValue.get();
|
|
1995
1197
|
const finalKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1];
|
|
1996
1198
|
if (currentValue !== void 0) {
|
|
1997
1199
|
unresolvedKeyframes[0] = currentValue;
|
|
@@ -2004,8 +1206,8 @@ class KeyframeResolver {
|
|
|
2004
1206
|
if (unresolvedKeyframes[0] === void 0) {
|
|
2005
1207
|
unresolvedKeyframes[0] = finalKeyframe;
|
|
2006
1208
|
}
|
|
2007
|
-
if (
|
|
2008
|
-
|
|
1209
|
+
if (motionValue && currentValue === void 0) {
|
|
1210
|
+
motionValue.set(unresolvedKeyframes[0]);
|
|
2009
1211
|
}
|
|
2010
1212
|
} else {
|
|
2011
1213
|
unresolvedKeyframes[i] = unresolvedKeyframes[i - 1];
|
|
@@ -2080,8 +1282,8 @@ const auto = {
|
|
|
2080
1282
|
const dimensionValueTypes = [number, px, percent$1, degrees, vw, vh, auto];
|
|
2081
1283
|
const findDimensionValueType = (v) => dimensionValueTypes.find(testValueType(v));
|
|
2082
1284
|
class DOMKeyframesResolver extends KeyframeResolver {
|
|
2083
|
-
constructor(unresolvedKeyframes, onComplete, name,
|
|
2084
|
-
super(unresolvedKeyframes, onComplete, name,
|
|
1285
|
+
constructor(unresolvedKeyframes, onComplete, name, motionValue, element) {
|
|
1286
|
+
super(unresolvedKeyframes, onComplete, name, motionValue, element, true);
|
|
2085
1287
|
}
|
|
2086
1288
|
readKeyframes() {
|
|
2087
1289
|
const { unresolvedKeyframes, element, name } = this;
|
|
@@ -2204,7 +1406,7 @@ function canAnimate(keyframes2, name, type, velocity) {
|
|
|
2204
1406
|
if (!isOriginAnimatable || !isTargetAnimatable) {
|
|
2205
1407
|
return false;
|
|
2206
1408
|
}
|
|
2207
|
-
return hasKeyframesChanged(keyframes2) || (type === "spring" || isGenerator(type)) && velocity;
|
|
1409
|
+
return hasKeyframesChanged(keyframes2) || (type === "spring" || motionDom.isGenerator(type)) && velocity;
|
|
2208
1410
|
}
|
|
2209
1411
|
const isNotNull = (value) => value !== null;
|
|
2210
1412
|
function getFinalKeyframe(keyframes2, { repeat, repeatType = "loop" }, finalKeyframe) {
|
|
@@ -2217,7 +1419,7 @@ class BaseAnimation {
|
|
|
2217
1419
|
constructor({ autoplay = true, delay: delay2 = 0, type = "keyframes", repeat = 0, repeatDelay = 0, repeatType = "loop", ...options }) {
|
|
2218
1420
|
this.isStopped = false;
|
|
2219
1421
|
this.hasAttemptedResolve = false;
|
|
2220
|
-
this.createdAt = time.now();
|
|
1422
|
+
this.createdAt = motionDom.time.now();
|
|
2221
1423
|
this.options = {
|
|
2222
1424
|
autoplay,
|
|
2223
1425
|
delay: delay2,
|
|
@@ -2261,10 +1463,10 @@ class BaseAnimation {
|
|
|
2261
1463
|
* Otherwise, it will call initPlayback on the implementing class.
|
|
2262
1464
|
*/
|
|
2263
1465
|
onKeyframesResolved(keyframes2, finalKeyframe) {
|
|
2264
|
-
this.resolvedAt = time.now();
|
|
1466
|
+
this.resolvedAt = motionDom.time.now();
|
|
2265
1467
|
this.hasAttemptedResolve = true;
|
|
2266
|
-
const { name, type, velocity, delay: delay2, onComplete, onUpdate, isGenerator
|
|
2267
|
-
if (!
|
|
1468
|
+
const { name, type, velocity, delay: delay2, onComplete, onUpdate, isGenerator } = this.options;
|
|
1469
|
+
if (!isGenerator && !canAnimate(keyframes2, name, type, velocity)) {
|
|
2268
1470
|
if (!delay2) {
|
|
2269
1471
|
onUpdate && onUpdate(getFinalKeyframe(keyframes2, this.options, finalKeyframe));
|
|
2270
1472
|
onComplete && onComplete();
|
|
@@ -2295,6 +1497,8 @@ class BaseAnimation {
|
|
|
2295
1497
|
return this.currentFinishedPromise.then(resolve, reject);
|
|
2296
1498
|
}
|
|
2297
1499
|
flatten() {
|
|
1500
|
+
if (!this.options.allowFlatten)
|
|
1501
|
+
return;
|
|
2298
1502
|
this.options.type = "keyframes";
|
|
2299
1503
|
this.options.ease = "linear";
|
|
2300
1504
|
}
|
|
@@ -2541,7 +1745,7 @@ const easingLookup = {
|
|
|
2541
1745
|
anticipate
|
|
2542
1746
|
};
|
|
2543
1747
|
const easingDefinitionToFunction = (definition) => {
|
|
2544
|
-
if (isBezierDefinition(definition)) {
|
|
1748
|
+
if (motionDom.isBezierDefinition(definition)) {
|
|
2545
1749
|
exports.invariant(definition.length === 4, `Cubic bezier arrays must contain four numerical values.`);
|
|
2546
1750
|
const [x1, y1, x2, y2] = definition;
|
|
2547
1751
|
return cubicBezier(x1, y1, x2, y2);
|
|
@@ -2627,13 +1831,13 @@ function keyframes({ duration = 300, keyframes: keyframeValues, times, ease: eas
|
|
|
2627
1831
|
const frameloopDriver = (update) => {
|
|
2628
1832
|
const passTimestamp = ({ timestamp }) => update(timestamp);
|
|
2629
1833
|
return {
|
|
2630
|
-
start: () => frame.update(passTimestamp, true),
|
|
2631
|
-
stop: () => cancelFrame(passTimestamp),
|
|
1834
|
+
start: () => motionDom.frame.update(passTimestamp, true),
|
|
1835
|
+
stop: () => motionDom.cancelFrame(passTimestamp),
|
|
2632
1836
|
/**
|
|
2633
1837
|
* If we're processing this frame we can use the
|
|
2634
1838
|
* framelocked timestamp to keep things in sync.
|
|
2635
1839
|
*/
|
|
2636
|
-
now: () => frameData.isProcessing ? frameData.timestamp : time.now()
|
|
1840
|
+
now: () => motionDom.frameData.isProcessing ? motionDom.frameData.timestamp : motionDom.time.now()
|
|
2637
1841
|
};
|
|
2638
1842
|
};
|
|
2639
1843
|
const generators = {
|
|
@@ -2663,10 +1867,10 @@ class MainThreadAnimation extends BaseAnimation {
|
|
|
2663
1867
|
const { onStop } = this.options;
|
|
2664
1868
|
onStop && onStop();
|
|
2665
1869
|
};
|
|
2666
|
-
const { name, motionValue
|
|
1870
|
+
const { name, motionValue, element, keyframes: keyframes2 } = this.options;
|
|
2667
1871
|
const KeyframeResolver$1 = (element === null || element === void 0 ? void 0 : element.KeyframeResolver) || KeyframeResolver;
|
|
2668
1872
|
const onResolved = (resolvedKeyframes, finalKeyframe) => this.onKeyframesResolved(resolvedKeyframes, finalKeyframe);
|
|
2669
|
-
this.resolver = new KeyframeResolver$1(keyframes2, onResolved, name,
|
|
1873
|
+
this.resolver = new KeyframeResolver$1(keyframes2, onResolved, name, motionValue, element);
|
|
2670
1874
|
this.resolver.scheduleResolve();
|
|
2671
1875
|
}
|
|
2672
1876
|
flatten() {
|
|
@@ -2677,7 +1881,7 @@ class MainThreadAnimation extends BaseAnimation {
|
|
|
2677
1881
|
}
|
|
2678
1882
|
initPlayback(keyframes$1) {
|
|
2679
1883
|
const { type = "keyframes", repeat = 0, repeatDelay = 0, repeatType, velocity = 0 } = this.options;
|
|
2680
|
-
const generatorFactory = isGenerator(type) ? type : generators[type] || keyframes;
|
|
1884
|
+
const generatorFactory = motionDom.isGenerator(type) ? type : generators[type] || keyframes;
|
|
2681
1885
|
let mapPercentToKeyframes;
|
|
2682
1886
|
let mirroredGenerator;
|
|
2683
1887
|
if (process.env.NODE_ENV !== "production" && generatorFactory !== keyframes) {
|
|
@@ -2696,7 +1900,7 @@ class MainThreadAnimation extends BaseAnimation {
|
|
|
2696
1900
|
});
|
|
2697
1901
|
}
|
|
2698
1902
|
if (generator.calculatedDuration === null) {
|
|
2699
|
-
generator.calculatedDuration = calcGeneratorDuration(generator);
|
|
1903
|
+
generator.calculatedDuration = motionDom.calcGeneratorDuration(generator);
|
|
2700
1904
|
}
|
|
2701
1905
|
const { calculatedDuration } = generator;
|
|
2702
1906
|
const resolvedDuration = calculatedDuration + repeatDelay;
|
|
@@ -2712,6 +1916,7 @@ class MainThreadAnimation extends BaseAnimation {
|
|
|
2712
1916
|
}
|
|
2713
1917
|
onPostResolved() {
|
|
2714
1918
|
const { autoplay = true } = this.options;
|
|
1919
|
+
motionDom.activeAnimations.mainThread++;
|
|
2715
1920
|
this.play();
|
|
2716
1921
|
if (this.pendingPlayState === "paused" || !autoplay) {
|
|
2717
1922
|
this.pause();
|
|
@@ -2832,13 +2037,13 @@ class MainThreadAnimation extends BaseAnimation {
|
|
|
2832
2037
|
this.driver = driver((timestamp) => this.tick(timestamp));
|
|
2833
2038
|
}
|
|
2834
2039
|
onPlay && onPlay();
|
|
2835
|
-
const
|
|
2040
|
+
const now = this.driver.now();
|
|
2836
2041
|
if (this.holdTime !== null) {
|
|
2837
|
-
this.startTime =
|
|
2042
|
+
this.startTime = now - this.holdTime;
|
|
2838
2043
|
} else if (!this.startTime) {
|
|
2839
2044
|
this.startTime = startTime !== null && startTime !== void 0 ? startTime : this.calcStartTime();
|
|
2840
2045
|
} else if (this.state === "finished") {
|
|
2841
|
-
this.startTime =
|
|
2046
|
+
this.startTime = now;
|
|
2842
2047
|
}
|
|
2843
2048
|
if (this.state === "finished") {
|
|
2844
2049
|
this.updateFinishedPromise();
|
|
@@ -2884,6 +2089,7 @@ class MainThreadAnimation extends BaseAnimation {
|
|
|
2884
2089
|
this.updateFinishedPromise();
|
|
2885
2090
|
this.startTime = this.cancelTime = null;
|
|
2886
2091
|
this.resolver.cancel();
|
|
2092
|
+
motionDom.activeAnimations.mainThread--;
|
|
2887
2093
|
}
|
|
2888
2094
|
stopDriver() {
|
|
2889
2095
|
if (!this.driver)
|
|
@@ -2891,9 +2097,9 @@ class MainThreadAnimation extends BaseAnimation {
|
|
|
2891
2097
|
this.driver.stop();
|
|
2892
2098
|
this.driver = void 0;
|
|
2893
2099
|
}
|
|
2894
|
-
sample(
|
|
2100
|
+
sample(time) {
|
|
2895
2101
|
this.startTime = 0;
|
|
2896
|
-
return this.tick(
|
|
2102
|
+
return this.tick(time, true);
|
|
2897
2103
|
}
|
|
2898
2104
|
}
|
|
2899
2105
|
function animateValue(options) {
|
|
@@ -2912,9 +2118,12 @@ function startWaapiAnimation(element, valueName, keyframes2, { delay: delay2 = 0
|
|
|
2912
2118
|
const keyframeOptions = { [valueName]: keyframes2 };
|
|
2913
2119
|
if (times)
|
|
2914
2120
|
keyframeOptions.offset = times;
|
|
2915
|
-
const easing = mapEasingToNativeEasing(ease2, duration);
|
|
2121
|
+
const easing = motionDom.mapEasingToNativeEasing(ease2, duration);
|
|
2916
2122
|
if (Array.isArray(easing))
|
|
2917
2123
|
keyframeOptions.easing = easing;
|
|
2124
|
+
if (motionDom.statsBuffer.value) {
|
|
2125
|
+
motionDom.activeAnimations.waapi++;
|
|
2126
|
+
}
|
|
2918
2127
|
const animation = element.animate(keyframeOptions, {
|
|
2919
2128
|
delay: delay2,
|
|
2920
2129
|
duration,
|
|
@@ -2923,13 +2132,18 @@ function startWaapiAnimation(element, valueName, keyframes2, { delay: delay2 = 0
|
|
|
2923
2132
|
iterations: repeat + 1,
|
|
2924
2133
|
direction: repeatType === "reverse" ? "alternate" : "normal"
|
|
2925
2134
|
});
|
|
2135
|
+
if (motionDom.statsBuffer.value) {
|
|
2136
|
+
animation.finished.finally(() => {
|
|
2137
|
+
motionDom.activeAnimations.waapi--;
|
|
2138
|
+
});
|
|
2139
|
+
}
|
|
2926
2140
|
return animation;
|
|
2927
2141
|
}
|
|
2928
2142
|
const supportsWaapi = /* @__PURE__ */ memo(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
|
|
2929
2143
|
const sampleDelta = 10;
|
|
2930
2144
|
const maxDuration = 2e4;
|
|
2931
2145
|
function requiresPregeneratedKeyframes(options) {
|
|
2932
|
-
return isGenerator(options.type) || options.type === "spring" || !isWaapiSupportedEasing(options.ease);
|
|
2146
|
+
return motionDom.isGenerator(options.type) || options.type === "spring" || !motionDom.isWaapiSupportedEasing(options.ease);
|
|
2933
2147
|
}
|
|
2934
2148
|
function pregenerateKeyframes(keyframes2, options) {
|
|
2935
2149
|
const sampleAnimation = new MainThreadAnimation({
|
|
@@ -2965,20 +2179,20 @@ function isUnsupportedEase(key) {
|
|
|
2965
2179
|
class AcceleratedAnimation extends BaseAnimation {
|
|
2966
2180
|
constructor(options) {
|
|
2967
2181
|
super(options);
|
|
2968
|
-
const { name, motionValue
|
|
2969
|
-
this.resolver = new DOMKeyframesResolver(keyframes2, (resolvedKeyframes, finalKeyframe) => this.onKeyframesResolved(resolvedKeyframes, finalKeyframe), name,
|
|
2182
|
+
const { name, motionValue, element, keyframes: keyframes2 } = this.options;
|
|
2183
|
+
this.resolver = new DOMKeyframesResolver(keyframes2, (resolvedKeyframes, finalKeyframe) => this.onKeyframesResolved(resolvedKeyframes, finalKeyframe), name, motionValue, element);
|
|
2970
2184
|
this.resolver.scheduleResolve();
|
|
2971
2185
|
}
|
|
2972
2186
|
initPlayback(keyframes2, finalKeyframe) {
|
|
2973
|
-
let { duration = 300, times, ease: ease2, type, motionValue
|
|
2974
|
-
if (!
|
|
2187
|
+
let { duration = 300, times, ease: ease2, type, motionValue, name, startTime } = this.options;
|
|
2188
|
+
if (!motionValue.owner || !motionValue.owner.current) {
|
|
2975
2189
|
return false;
|
|
2976
2190
|
}
|
|
2977
|
-
if (typeof ease2 === "string" && supportsLinearEasing() && isUnsupportedEase(ease2)) {
|
|
2191
|
+
if (typeof ease2 === "string" && motionDom.supportsLinearEasing() && isUnsupportedEase(ease2)) {
|
|
2978
2192
|
ease2 = unsupportedEasingFunctions[ease2];
|
|
2979
2193
|
}
|
|
2980
2194
|
if (requiresPregeneratedKeyframes(this.options)) {
|
|
2981
|
-
const { onComplete, onUpdate, motionValue:
|
|
2195
|
+
const { onComplete, onUpdate, motionValue: motionValue2, element, ...options } = this.options;
|
|
2982
2196
|
const pregeneratedAnimation = pregenerateKeyframes(keyframes2, options);
|
|
2983
2197
|
keyframes2 = pregeneratedAnimation.keyframes;
|
|
2984
2198
|
if (keyframes2.length === 1) {
|
|
@@ -2989,15 +2203,15 @@ class AcceleratedAnimation extends BaseAnimation {
|
|
|
2989
2203
|
ease2 = pregeneratedAnimation.ease;
|
|
2990
2204
|
type = "keyframes";
|
|
2991
2205
|
}
|
|
2992
|
-
const animation = startWaapiAnimation(
|
|
2206
|
+
const animation = startWaapiAnimation(motionValue.owner.current, name, keyframes2, { ...this.options, duration, times, ease: ease2 });
|
|
2993
2207
|
animation.startTime = startTime !== null && startTime !== void 0 ? startTime : this.calcStartTime();
|
|
2994
2208
|
if (this.pendingTimeline) {
|
|
2995
|
-
attachTimeline(animation, this.pendingTimeline);
|
|
2209
|
+
motionDom.attachTimeline(animation, this.pendingTimeline);
|
|
2996
2210
|
this.pendingTimeline = void 0;
|
|
2997
2211
|
} else {
|
|
2998
2212
|
animation.onfinish = () => {
|
|
2999
2213
|
const { onComplete } = this.options;
|
|
3000
|
-
|
|
2214
|
+
motionValue.set(getFinalKeyframe(keyframes2, this.options, finalKeyframe));
|
|
3001
2215
|
onComplete && onComplete();
|
|
3002
2216
|
this.cancel();
|
|
3003
2217
|
this.resolveFinishedPromise();
|
|
@@ -3073,7 +2287,7 @@ class AcceleratedAnimation extends BaseAnimation {
|
|
|
3073
2287
|
if (!resolved)
|
|
3074
2288
|
return noop;
|
|
3075
2289
|
const { animation } = resolved;
|
|
3076
|
-
attachTimeline(animation, timeline);
|
|
2290
|
+
motionDom.attachTimeline(animation, timeline);
|
|
3077
2291
|
}
|
|
3078
2292
|
return noop;
|
|
3079
2293
|
}
|
|
@@ -3111,7 +2325,7 @@ class AcceleratedAnimation extends BaseAnimation {
|
|
|
3111
2325
|
return;
|
|
3112
2326
|
}
|
|
3113
2327
|
if (this.time) {
|
|
3114
|
-
const { motionValue
|
|
2328
|
+
const { motionValue, onUpdate, onComplete, element, ...options } = this.options;
|
|
3115
2329
|
const sampleAnimation = new MainThreadAnimation({
|
|
3116
2330
|
...options,
|
|
3117
2331
|
keyframes: keyframes2,
|
|
@@ -3122,7 +2336,7 @@ class AcceleratedAnimation extends BaseAnimation {
|
|
|
3122
2336
|
isGenerator: true
|
|
3123
2337
|
});
|
|
3124
2338
|
const sampleTime = /* @__PURE__ */ secondsToMilliseconds$1(this.time);
|
|
3125
|
-
|
|
2339
|
+
motionValue.setWithVelocity(sampleAnimation.sample(sampleTime - sampleDelta).value, sampleAnimation.sample(sampleTime).value, sampleDelta);
|
|
3126
2340
|
}
|
|
3127
2341
|
const { onStop } = this.options;
|
|
3128
2342
|
onStop && onStop();
|
|
@@ -3141,11 +2355,11 @@ class AcceleratedAnimation extends BaseAnimation {
|
|
|
3141
2355
|
resolved.animation.cancel();
|
|
3142
2356
|
}
|
|
3143
2357
|
static supports(options) {
|
|
3144
|
-
const { motionValue
|
|
3145
|
-
if (!
|
|
2358
|
+
const { motionValue, name, repeatDelay, repeatType, damping, type } = options;
|
|
2359
|
+
if (!motionValue || !motionValue.owner || !(motionValue.owner.current instanceof HTMLElement)) {
|
|
3146
2360
|
return false;
|
|
3147
2361
|
}
|
|
3148
|
-
const { onUpdate, transformTemplate } =
|
|
2362
|
+
const { onUpdate, transformTemplate } = motionValue.owner.getProps();
|
|
3149
2363
|
return supportsWaapi() && name && acceleratedValues.has(name) && /**
|
|
3150
2364
|
* If we're outputting values to onUpdate then we can't use WAAPI as there's
|
|
3151
2365
|
* no way to read the value from WAAPI every frame.
|
|
@@ -3186,7 +2400,7 @@ function isTransitionDefined({ when, delay: _delay, delayChildren, staggerChildr
|
|
|
3186
2400
|
return !!Object.keys(transition).length;
|
|
3187
2401
|
}
|
|
3188
2402
|
const animateMotionValue = (name, value, target, transition = {}, element, isHandoff) => (onComplete) => {
|
|
3189
|
-
const valueTransition = getValueTransition
|
|
2403
|
+
const valueTransition = motionDom.getValueTransition(transition, name) || {};
|
|
3190
2404
|
const delay2 = valueTransition.delay || transition.delay || 0;
|
|
3191
2405
|
let { elapsed = 0 } = transition;
|
|
3192
2406
|
elapsed = elapsed - /* @__PURE__ */ secondsToMilliseconds$1(delay2);
|
|
@@ -3230,14 +2444,15 @@ const animateMotionValue = (name, value, target, transition = {}, element, isHan
|
|
|
3230
2444
|
shouldSkip = true;
|
|
3231
2445
|
}
|
|
3232
2446
|
}
|
|
2447
|
+
options.allowFlatten = !valueTransition.type && !valueTransition.ease;
|
|
3233
2448
|
if (shouldSkip && !isHandoff && value.get() !== void 0) {
|
|
3234
2449
|
const finalKeyframe = getFinalKeyframe(options.keyframes, valueTransition);
|
|
3235
2450
|
if (finalKeyframe !== void 0) {
|
|
3236
|
-
frame.update(() => {
|
|
2451
|
+
motionDom.frame.update(() => {
|
|
3237
2452
|
options.onUpdate(finalKeyframe);
|
|
3238
2453
|
options.onComplete();
|
|
3239
2454
|
});
|
|
3240
|
-
return new GroupPlaybackControls([]);
|
|
2455
|
+
return new motionDom.GroupPlaybackControls([]);
|
|
3241
2456
|
}
|
|
3242
2457
|
}
|
|
3243
2458
|
if (!isHandoff && AcceleratedAnimation.supports(options)) {
|
|
@@ -3266,13 +2481,13 @@ function animateTarget(visualElement, targetAndTransition, { delay: delay2 = 0,
|
|
|
3266
2481
|
}
|
|
3267
2482
|
const valueTransition = {
|
|
3268
2483
|
delay: delay2,
|
|
3269
|
-
...getValueTransition
|
|
2484
|
+
...motionDom.getValueTransition(transition || {}, key)
|
|
3270
2485
|
};
|
|
3271
2486
|
let isHandoff = false;
|
|
3272
2487
|
if (window.MotionHandoffAnimation) {
|
|
3273
2488
|
const appearId = getOptimisedAppearId(visualElement);
|
|
3274
2489
|
if (appearId) {
|
|
3275
|
-
const startTime = window.MotionHandoffAnimation(appearId, key, frame);
|
|
2490
|
+
const startTime = window.MotionHandoffAnimation(appearId, key, motionDom.frame);
|
|
3276
2491
|
if (startTime !== null) {
|
|
3277
2492
|
valueTransition.startTime = startTime;
|
|
3278
2493
|
isHandoff = true;
|
|
@@ -3288,7 +2503,7 @@ function animateTarget(visualElement, targetAndTransition, { delay: delay2 = 0,
|
|
|
3288
2503
|
}
|
|
3289
2504
|
if (transitionEnd) {
|
|
3290
2505
|
Promise.all(animations).then(() => {
|
|
3291
|
-
frame.update(() => {
|
|
2506
|
+
motionDom.frame.update(() => {
|
|
3292
2507
|
transitionEnd && setTarget(visualElement, transitionEnd);
|
|
3293
2508
|
});
|
|
3294
2509
|
});
|
|
@@ -3386,10 +2601,10 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
3386
2601
|
if (isMotionValue$1(nextValue)) {
|
|
3387
2602
|
element.addValue(key, nextValue);
|
|
3388
2603
|
if (process.env.NODE_ENV === "development") {
|
|
3389
|
-
warnOnce(nextValue.version === "12.
|
|
2604
|
+
warnOnce(nextValue.version === "12.5.0", `Attempting to mix Motion versions ${nextValue.version} with 12.5.0 may not work as expected.`);
|
|
3390
2605
|
}
|
|
3391
2606
|
} else if (isMotionValue$1(prevValue)) {
|
|
3392
|
-
element.addValue(key, motionValue(nextValue, { owner: element }));
|
|
2607
|
+
element.addValue(key, motionDom.motionValue(nextValue, { owner: element }));
|
|
3393
2608
|
} else if (prevValue !== nextValue) {
|
|
3394
2609
|
if (element.hasValue(key)) {
|
|
3395
2610
|
const existingValue = element.getValue(key);
|
|
@@ -3400,7 +2615,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
3400
2615
|
}
|
|
3401
2616
|
} else {
|
|
3402
2617
|
const latestValue = element.getStaticValue(key);
|
|
3403
|
-
element.addValue(key, motionValue(latestValue !== void 0 ? latestValue : nextValue, { owner: element }));
|
|
2618
|
+
element.addValue(key, motionDom.motionValue(latestValue !== void 0 ? latestValue : nextValue, { owner: element }));
|
|
3404
2619
|
}
|
|
3405
2620
|
}
|
|
3406
2621
|
}
|
|
@@ -3452,10 +2667,10 @@ class VisualElement {
|
|
|
3452
2667
|
};
|
|
3453
2668
|
this.renderScheduledAt = 0;
|
|
3454
2669
|
this.scheduleRender = () => {
|
|
3455
|
-
const
|
|
3456
|
-
if (this.renderScheduledAt <
|
|
3457
|
-
this.renderScheduledAt =
|
|
3458
|
-
frame.render(this.render, false, true);
|
|
2670
|
+
const now = motionDom.time.now();
|
|
2671
|
+
if (this.renderScheduledAt < now) {
|
|
2672
|
+
this.renderScheduledAt = now;
|
|
2673
|
+
motionDom.frame.render(this.render, false, true);
|
|
3459
2674
|
}
|
|
3460
2675
|
};
|
|
3461
2676
|
const { latestValues, renderState, onUpdate } = visualState;
|
|
@@ -3508,8 +2723,8 @@ class VisualElement {
|
|
|
3508
2723
|
}
|
|
3509
2724
|
unmount() {
|
|
3510
2725
|
this.projection && this.projection.unmount();
|
|
3511
|
-
cancelFrame(this.notifyUpdate);
|
|
3512
|
-
cancelFrame(this.render);
|
|
2726
|
+
motionDom.cancelFrame(this.notifyUpdate);
|
|
2727
|
+
motionDom.cancelFrame(this.render);
|
|
3513
2728
|
this.valueSubscriptions.forEach((remove) => remove());
|
|
3514
2729
|
this.valueSubscriptions.clear();
|
|
3515
2730
|
this.removeFromVariantTree && this.removeFromVariantTree();
|
|
@@ -3536,7 +2751,7 @@ class VisualElement {
|
|
|
3536
2751
|
}
|
|
3537
2752
|
const removeOnChange = value.on("change", (latestValue) => {
|
|
3538
2753
|
this.latestValues[key] = latestValue;
|
|
3539
|
-
this.props.onUpdate && frame.preRender(this.notifyUpdate);
|
|
2754
|
+
this.props.onUpdate && motionDom.frame.preRender(this.notifyUpdate);
|
|
3540
2755
|
if (valueIsTransform && this.projection) {
|
|
3541
2756
|
this.projection.isTransformDirty = true;
|
|
3542
2757
|
}
|
|
@@ -3698,7 +2913,7 @@ class VisualElement {
|
|
|
3698
2913
|
}
|
|
3699
2914
|
let value = this.values.get(key);
|
|
3700
2915
|
if (value === void 0 && defaultValue !== void 0) {
|
|
3701
|
-
value = motionValue(defaultValue === null ? void 0 : defaultValue, { owner: this });
|
|
2916
|
+
value = motionDom.motionValue(defaultValue === null ? void 0 : defaultValue, { owner: this });
|
|
3702
2917
|
this.addValue(key, value);
|
|
3703
2918
|
}
|
|
3704
2919
|
return value;
|
|
@@ -4045,7 +3260,7 @@ class SVGVisualElement extends DOMVisualElement {
|
|
|
4045
3260
|
}
|
|
4046
3261
|
onBindTransform() {
|
|
4047
3262
|
if (this.current && !this.renderState.dimensions) {
|
|
4048
|
-
frame.postRender(this.updateDimensions);
|
|
3263
|
+
motionDom.frame.postRender(this.updateDimensions);
|
|
4049
3264
|
}
|
|
4050
3265
|
}
|
|
4051
3266
|
build(renderState, latestValues, props) {
|
|
@@ -4080,8 +3295,8 @@ function transformBoxPoints$1(point2, transformPoint2) {
|
|
|
4080
3295
|
function isIdentityScale(scale2) {
|
|
4081
3296
|
return scale2 === void 0 || scale2 === 1;
|
|
4082
3297
|
}
|
|
4083
|
-
function hasScale({ scale: scale2, scaleX, scaleY }) {
|
|
4084
|
-
return !isIdentityScale(scale2) || !isIdentityScale(
|
|
3298
|
+
function hasScale({ scale: scale2, scaleX: scaleX2, scaleY: scaleY2 }) {
|
|
3299
|
+
return !isIdentityScale(scale2) || !isIdentityScale(scaleX2) || !isIdentityScale(scaleY2);
|
|
4085
3300
|
}
|
|
4086
3301
|
function hasTransform(values) {
|
|
4087
3302
|
return hasScale(values) || has2DTranslate(values) || values.z || values.rotate || values.rotateX || values.rotateY || values.skewX || values.skewY;
|
|
@@ -4175,8 +3390,7 @@ class HTMLVisualElement extends DOMVisualElement {
|
|
|
4175
3390
|
}
|
|
4176
3391
|
readValueFromInstance(instance, key) {
|
|
4177
3392
|
if (transformProps.has(key)) {
|
|
4178
|
-
|
|
4179
|
-
return defaultType ? defaultType.default || 0 : 0;
|
|
3393
|
+
return readTransformValue(instance, key);
|
|
4180
3394
|
} else {
|
|
4181
3395
|
const computedStyle = getComputedStyle$1(instance);
|
|
4182
3396
|
const value = (isCSSVariableName(key) ? computedStyle.getPropertyValue(key) : computedStyle[key]) || 0;
|
|
@@ -4264,7 +3478,7 @@ function createObjectVisualElement(subject) {
|
|
|
4264
3478
|
visualElementStore.set(subject, node);
|
|
4265
3479
|
}
|
|
4266
3480
|
function animateSingleValue(value, keyframes2, options) {
|
|
4267
|
-
const motionValue$1 = isMotionValue$1(value) ? value : motionValue(value);
|
|
3481
|
+
const motionValue$1 = isMotionValue$1(value) ? value : motionDom.motionValue(value);
|
|
4268
3482
|
motionValue$1.start(animateMotionValue("", motionValue$1, keyframes2, options));
|
|
4269
3483
|
return motionValue$1.animation;
|
|
4270
3484
|
}
|
|
@@ -4314,7 +3528,7 @@ function createScopedAnimate(scope) {
|
|
|
4314
3528
|
} else {
|
|
4315
3529
|
animations = animateSubject(subjectOrSequence, optionsOrKeyframes, options, scope);
|
|
4316
3530
|
}
|
|
4317
|
-
const animation = new GroupPlaybackControls(animations);
|
|
3531
|
+
const animation = new motionDom.GroupPlaybackControls(animations);
|
|
4318
3532
|
if (scope) {
|
|
4319
3533
|
scope.animations.push(animation);
|
|
4320
3534
|
}
|
|
@@ -4357,7 +3571,7 @@ function getElementAnimationState(element) {
|
|
|
4357
3571
|
state.set(element, animationState);
|
|
4358
3572
|
return state.get(element);
|
|
4359
3573
|
}
|
|
4360
|
-
class NativeAnimation extends NativeAnimationControls {
|
|
3574
|
+
class NativeAnimation extends motionDom.NativeAnimationControls {
|
|
4361
3575
|
constructor(element, valueName, valueKeyframes, options) {
|
|
4362
3576
|
const isCSSVar = valueName.startsWith("--");
|
|
4363
3577
|
exports.invariant(typeof options.type !== "string", `animateMini doesn't support "type" as a string. Did you mean to import { spring } from "framer-motion"?`);
|
|
@@ -4370,9 +3584,9 @@ class NativeAnimation extends NativeAnimationControls {
|
|
|
4370
3584
|
valueKeyframes = [valueKeyframes];
|
|
4371
3585
|
}
|
|
4372
3586
|
hydrateKeyframes(valueName, valueKeyframes, readInitialKeyframe);
|
|
4373
|
-
if (isGenerator(options.type)) {
|
|
4374
|
-
const generatorOptions = createGeneratorEasing(options, 100, options.type);
|
|
4375
|
-
options.ease = supportsLinearEasing() ? generatorOptions.ease : defaultEasing;
|
|
3587
|
+
if (motionDom.isGenerator(options.type)) {
|
|
3588
|
+
const generatorOptions = motionDom.createGeneratorEasing(options, 100, options.type);
|
|
3589
|
+
options.ease = motionDom.supportsLinearEasing() ? generatorOptions.ease : defaultEasing;
|
|
4376
3590
|
options.duration = /* @__PURE__ */ secondsToMilliseconds$1(generatorOptions.duration);
|
|
4377
3591
|
options.type = "keyframes";
|
|
4378
3592
|
} else {
|
|
@@ -4431,7 +3645,7 @@ class NativeAnimation extends NativeAnimationControls {
|
|
|
4431
3645
|
}
|
|
4432
3646
|
}
|
|
4433
3647
|
function animateElements(elementOrSelector, keyframes2, options, scope) {
|
|
4434
|
-
const elements = resolveElements(elementOrSelector, scope);
|
|
3648
|
+
const elements = motionDom.resolveElements(elementOrSelector, scope);
|
|
4435
3649
|
const numElements = elements.length;
|
|
4436
3650
|
exports.invariant(Boolean(numElements), "No valid element provided.");
|
|
4437
3651
|
const animations = [];
|
|
@@ -4444,10 +3658,11 @@ function animateElements(elementOrSelector, keyframes2, options, scope) {
|
|
|
4444
3658
|
for (const valueName in keyframes2) {
|
|
4445
3659
|
const valueKeyframes = keyframes2[valueName];
|
|
4446
3660
|
const valueOptions = {
|
|
4447
|
-
...getValueTransition
|
|
3661
|
+
...motionDom.getValueTransition(elementTransition, valueName)
|
|
4448
3662
|
};
|
|
4449
3663
|
valueOptions.duration = valueOptions.duration ? /* @__PURE__ */ secondsToMilliseconds$1(valueOptions.duration) : valueOptions.duration;
|
|
4450
3664
|
valueOptions.delay = /* @__PURE__ */ secondsToMilliseconds$1(valueOptions.delay || 0);
|
|
3665
|
+
valueOptions.allowFlatten = !elementTransition.type && !elementTransition.ease;
|
|
4451
3666
|
animations.push(new NativeAnimation(element, valueName, valueKeyframes, valueOptions));
|
|
4452
3667
|
}
|
|
4453
3668
|
}
|
|
@@ -4455,7 +3670,7 @@ function animateElements(elementOrSelector, keyframes2, options, scope) {
|
|
|
4455
3670
|
}
|
|
4456
3671
|
const createScopedWaapiAnimate = (scope) => {
|
|
4457
3672
|
function scopedAnimate(elementOrSelector, keyframes2, options) {
|
|
4458
|
-
return new GroupPlaybackControls(animateElements(elementOrSelector, keyframes2, options, scope));
|
|
3673
|
+
return new motionDom.GroupPlaybackControls(animateElements(elementOrSelector, keyframes2, options, scope));
|
|
4459
3674
|
}
|
|
4460
3675
|
return scopedAnimate;
|
|
4461
3676
|
};
|
|
@@ -4471,8 +3686,8 @@ function observeTimeline(update, timeline) {
|
|
|
4471
3686
|
}
|
|
4472
3687
|
prevProgress = progress2;
|
|
4473
3688
|
};
|
|
4474
|
-
frame.update(onFrame, true);
|
|
4475
|
-
return () => cancelFrame(onFrame);
|
|
3689
|
+
motionDom.frame.update(onFrame, true);
|
|
3690
|
+
return () => motionDom.cancelFrame(onFrame);
|
|
4476
3691
|
}
|
|
4477
3692
|
const resizeHandlers = /* @__PURE__ */ new WeakMap();
|
|
4478
3693
|
let observer;
|
|
@@ -4512,7 +3727,7 @@ function createResizeObserver() {
|
|
|
4512
3727
|
function resizeElement(target, handler) {
|
|
4513
3728
|
if (!observer)
|
|
4514
3729
|
createResizeObserver();
|
|
4515
|
-
const elements = resolveElements(target);
|
|
3730
|
+
const elements = motionDom.resolveElements(target);
|
|
4516
3731
|
elements.forEach((element) => {
|
|
4517
3732
|
let elementHandlers = resizeHandlers.get(element);
|
|
4518
3733
|
if (!elementHandlers) {
|
|
@@ -4589,7 +3804,7 @@ const keys = {
|
|
|
4589
3804
|
position: "Top"
|
|
4590
3805
|
}
|
|
4591
3806
|
};
|
|
4592
|
-
function updateAxisInfo(element, axisName, info,
|
|
3807
|
+
function updateAxisInfo(element, axisName, info, time) {
|
|
4593
3808
|
const axis = info[axisName];
|
|
4594
3809
|
const { length, position } = keys[axisName];
|
|
4595
3810
|
const prev = axis.current;
|
|
@@ -4600,13 +3815,13 @@ function updateAxisInfo(element, axisName, info, time2) {
|
|
|
4600
3815
|
axis.offset[0] = 0;
|
|
4601
3816
|
axis.offset[1] = axis.scrollLength;
|
|
4602
3817
|
axis.progress = /* @__PURE__ */ progress$1(0, axis.scrollLength, axis.current);
|
|
4603
|
-
const elapsed =
|
|
3818
|
+
const elapsed = time - prevTime;
|
|
4604
3819
|
axis.velocity = elapsed > maxElapsed ? 0 : velocityPerSecond(axis.current - prev, elapsed);
|
|
4605
3820
|
}
|
|
4606
|
-
function updateScrollInfo(element, info,
|
|
4607
|
-
updateAxisInfo(element, "x", info,
|
|
4608
|
-
updateAxisInfo(element, "y", info,
|
|
4609
|
-
info.time =
|
|
3821
|
+
function updateScrollInfo(element, info, time) {
|
|
3822
|
+
updateAxisInfo(element, "x", info, time);
|
|
3823
|
+
updateAxisInfo(element, "y", info, time);
|
|
3824
|
+
info.time = time;
|
|
4610
3825
|
}
|
|
4611
3826
|
function calcInset(element, container) {
|
|
4612
3827
|
const inset = { x: 0, y: 0 };
|
|
@@ -4761,8 +3976,8 @@ function measure(container, target = container, info) {
|
|
|
4761
3976
|
function createOnScrollHandler(element, onScroll, info, options = {}) {
|
|
4762
3977
|
return {
|
|
4763
3978
|
measure: () => measure(element, options.target, info),
|
|
4764
|
-
update: (
|
|
4765
|
-
updateScrollInfo(element, info,
|
|
3979
|
+
update: (time) => {
|
|
3980
|
+
updateScrollInfo(element, info, time);
|
|
4766
3981
|
if (options.offset || options.target) {
|
|
4767
3982
|
resolveOffsets(element, info, options);
|
|
4768
3983
|
}
|
|
@@ -4790,7 +4005,7 @@ function scrollInfo(onScroll, { container = document.documentElement, ...options
|
|
|
4790
4005
|
};
|
|
4791
4006
|
const updateAll = () => {
|
|
4792
4007
|
for (const handler of containerHandlers) {
|
|
4793
|
-
handler.update(frameData.timestamp);
|
|
4008
|
+
handler.update(motionDom.frameData.timestamp);
|
|
4794
4009
|
}
|
|
4795
4010
|
};
|
|
4796
4011
|
const notifyAll2 = () => {
|
|
@@ -4798,9 +4013,9 @@ function scrollInfo(onScroll, { container = document.documentElement, ...options
|
|
|
4798
4013
|
handler.notify();
|
|
4799
4014
|
};
|
|
4800
4015
|
const listener2 = () => {
|
|
4801
|
-
frame.read(measureAll, false, true);
|
|
4802
|
-
frame.read(updateAll, false, true);
|
|
4803
|
-
frame.update(notifyAll2, false, true);
|
|
4016
|
+
motionDom.frame.read(measureAll, false, true);
|
|
4017
|
+
motionDom.frame.read(updateAll, false, true);
|
|
4018
|
+
motionDom.frame.update(notifyAll2, false, true);
|
|
4804
4019
|
};
|
|
4805
4020
|
scrollListeners.set(container, listener2);
|
|
4806
4021
|
const target = getEventTarget(container);
|
|
@@ -4811,10 +4026,10 @@ function scrollInfo(onScroll, { container = document.documentElement, ...options
|
|
|
4811
4026
|
target.addEventListener("scroll", listener2, { passive: true });
|
|
4812
4027
|
}
|
|
4813
4028
|
const listener = scrollListeners.get(container);
|
|
4814
|
-
frame.read(listener, false, true);
|
|
4029
|
+
motionDom.frame.read(listener, false, true);
|
|
4815
4030
|
return () => {
|
|
4816
4031
|
var _a;
|
|
4817
|
-
cancelFrame(listener);
|
|
4032
|
+
motionDom.cancelFrame(listener);
|
|
4818
4033
|
const currentHandlers = onScrollHandlers.get(container);
|
|
4819
4034
|
if (!currentHandlers)
|
|
4820
4035
|
return;
|
|
@@ -4848,7 +4063,7 @@ function getTimeline({ source, container = document.documentElement, axis = "y"
|
|
|
4848
4063
|
}
|
|
4849
4064
|
const elementCache = timelineCache.get(container);
|
|
4850
4065
|
if (!elementCache[axis]) {
|
|
4851
|
-
elementCache[axis] = supportsScrollTimeline() ? new ScrollTimeline({ source: container, axis }) : scrollTimelineFallback({ source: container, axis });
|
|
4066
|
+
elementCache[axis] = motionDom.supportsScrollTimeline() ? new ScrollTimeline({ source: container, axis }) : scrollTimelineFallback({ source: container, axis });
|
|
4852
4067
|
}
|
|
4853
4068
|
return elementCache[axis];
|
|
4854
4069
|
}
|
|
@@ -4897,7 +4112,7 @@ const thresholds = {
|
|
|
4897
4112
|
all: 1
|
|
4898
4113
|
};
|
|
4899
4114
|
function inView(elementOrSelector, onStart, { root, margin: rootMargin, amount = "some" } = {}) {
|
|
4900
|
-
const elements = resolveElements(elementOrSelector);
|
|
4115
|
+
const elements = motionDom.resolveElements(elementOrSelector);
|
|
4901
4116
|
const activeIntersections = /* @__PURE__ */ new WeakMap();
|
|
4902
4117
|
const onIntersectionChange = (entries) => {
|
|
4903
4118
|
entries.forEach((entry) => {
|
|
@@ -4955,16 +4170,16 @@ function stagger(duration = 0.1, { startDelay = 0, from = 0, ease: ease2 } = {})
|
|
|
4955
4170
|
};
|
|
4956
4171
|
}
|
|
4957
4172
|
function delay$1(callback, timeout) {
|
|
4958
|
-
const start = time.now();
|
|
4173
|
+
const start = motionDom.time.now();
|
|
4959
4174
|
const checkElapsed = ({ timestamp }) => {
|
|
4960
4175
|
const elapsed = timestamp - start;
|
|
4961
4176
|
if (elapsed >= timeout) {
|
|
4962
|
-
cancelFrame(checkElapsed);
|
|
4177
|
+
motionDom.cancelFrame(checkElapsed);
|
|
4963
4178
|
callback(elapsed - timeout);
|
|
4964
4179
|
}
|
|
4965
4180
|
};
|
|
4966
|
-
frame.read(checkElapsed, true);
|
|
4967
|
-
return () => cancelFrame(checkElapsed);
|
|
4181
|
+
motionDom.frame.read(checkElapsed, true);
|
|
4182
|
+
return () => motionDom.cancelFrame(checkElapsed);
|
|
4968
4183
|
}
|
|
4969
4184
|
function delayInSeconds(callback, timeout) {
|
|
4970
4185
|
return delay$1(callback, /* @__PURE__ */ secondsToMilliseconds$1(timeout));
|
|
@@ -4992,11 +4207,6 @@ function transform(...args) {
|
|
|
4992
4207
|
});
|
|
4993
4208
|
return useImmediate ? interpolator(inputValue) : interpolator;
|
|
4994
4209
|
}
|
|
4995
|
-
const sync = frame;
|
|
4996
|
-
const cancelSync = stepsOrder.reduce((acc, key) => {
|
|
4997
|
-
acc[key] = (process2) => cancelFrame(process2);
|
|
4998
|
-
return acc;
|
|
4999
|
-
}, {});
|
|
5000
4210
|
function createContext(providerComponentName, contextName) {
|
|
5001
4211
|
const symbolDescription = typeof providerComponentName === "string" && !contextName ? `${providerComponentName}Context` : contextName;
|
|
5002
4212
|
const injectionKey = Symbol(symbolDescription);
|
|
@@ -5023,7 +4233,7 @@ function isMotionValue(value) {
|
|
|
5023
4233
|
}
|
|
5024
4234
|
function useInView(domRef, options) {
|
|
5025
4235
|
const isInView = vue.ref(false);
|
|
5026
|
-
vue.watch([domRef, () => vue.isRef(options) ? options.value : options], (_v1, _v2) => {
|
|
4236
|
+
vue.watch([domRef, () => vue.isRef(options) ? options.value : options], (_v1, _v2, onCleanup) => {
|
|
5027
4237
|
const realOptions = vue.unref(options) || {};
|
|
5028
4238
|
const { once } = realOptions;
|
|
5029
4239
|
if (!domRef.value || once && isInView.value) {
|
|
@@ -5035,7 +4245,10 @@ function useInView(domRef, options) {
|
|
|
5035
4245
|
isInView.value = false;
|
|
5036
4246
|
};
|
|
5037
4247
|
};
|
|
5038
|
-
|
|
4248
|
+
const cleanup = inView(domRef.value, onEnter, realOptions);
|
|
4249
|
+
onCleanup(() => {
|
|
4250
|
+
cleanup();
|
|
4251
|
+
});
|
|
5039
4252
|
}, {
|
|
5040
4253
|
immediate: true
|
|
5041
4254
|
});
|
|
@@ -5048,13 +4261,13 @@ function useAnimationFrame(callback) {
|
|
|
5048
4261
|
initialTimestamp = timestamp;
|
|
5049
4262
|
callback(timestamp - initialTimestamp, delta);
|
|
5050
4263
|
};
|
|
5051
|
-
const cancel = () => cancelFrame(provideTimeSinceStart);
|
|
4264
|
+
const cancel = () => motionDom.cancelFrame(provideTimeSinceStart);
|
|
5052
4265
|
vue.onBeforeUpdate(() => {
|
|
5053
4266
|
cancel();
|
|
5054
|
-
frame.update(provideTimeSinceStart, true);
|
|
4267
|
+
motionDom.frame.update(provideTimeSinceStart, true);
|
|
5055
4268
|
});
|
|
5056
4269
|
vue.onUnmounted(() => cancel());
|
|
5057
|
-
frame.update(provideTimeSinceStart, true);
|
|
4270
|
+
motionDom.frame.update(provideTimeSinceStart, true);
|
|
5058
4271
|
}
|
|
5059
4272
|
const secondsToMilliseconds = (seconds) => seconds * 1e3;
|
|
5060
4273
|
function millisecondsToSeconds(milliseconds) {
|
|
@@ -5206,7 +4419,6 @@ function isAnimateChanged(oldOptions, newOptions) {
|
|
|
5206
4419
|
return oldVal !== newVal;
|
|
5207
4420
|
});
|
|
5208
4421
|
}
|
|
5209
|
-
console.log(2344);
|
|
5210
4422
|
return oldAnimate !== newAnimate;
|
|
5211
4423
|
}
|
|
5212
4424
|
const rotation = {
|
|
@@ -5472,7 +4684,7 @@ function handleHoverEvent$1(state2, event, lifecycle) {
|
|
|
5472
4684
|
const eventName = `onHover${lifecycle}`;
|
|
5473
4685
|
const callback = props[eventName];
|
|
5474
4686
|
if (callback) {
|
|
5475
|
-
frame.postRender(() => callback(event, extractEventInfo$1(event)));
|
|
4687
|
+
motionDom.frame.postRender(() => callback(event, extractEventInfo$1(event)));
|
|
5476
4688
|
}
|
|
5477
4689
|
}
|
|
5478
4690
|
class HoverGesture extends Feature {
|
|
@@ -5486,7 +4698,7 @@ class HoverGesture extends Feature {
|
|
|
5486
4698
|
const element = this.state.element;
|
|
5487
4699
|
if (!element)
|
|
5488
4700
|
return;
|
|
5489
|
-
this.unmount = hover(
|
|
4701
|
+
this.unmount = motionDom.hover(
|
|
5490
4702
|
element,
|
|
5491
4703
|
(el, startEvent) => {
|
|
5492
4704
|
handleHoverEvent$1(this.state, startEvent, "Start");
|
|
@@ -5513,7 +4725,7 @@ function handlePressEvent(state2, event, lifecycle) {
|
|
|
5513
4725
|
const eventName = `onPress${lifecycle === "End" ? "" : lifecycle}`;
|
|
5514
4726
|
const callback = props[eventName];
|
|
5515
4727
|
if (callback) {
|
|
5516
|
-
frame.postRender(() => callback(event, extractEventInfo$1(event)));
|
|
4728
|
+
motionDom.frame.postRender(() => callback(event, extractEventInfo$1(event)));
|
|
5517
4729
|
}
|
|
5518
4730
|
}
|
|
5519
4731
|
class PressGesture extends Feature {
|
|
@@ -5538,7 +4750,7 @@ class PressGesture extends Feature {
|
|
|
5538
4750
|
const element = this.state.element;
|
|
5539
4751
|
if (!element)
|
|
5540
4752
|
return;
|
|
5541
|
-
this.unmount = press(
|
|
4753
|
+
this.unmount = motionDom.press(
|
|
5542
4754
|
element,
|
|
5543
4755
|
(el, startEvent) => {
|
|
5544
4756
|
handlePressEvent(this.state, startEvent, "Start");
|
|
@@ -5561,7 +4773,7 @@ function handleHoverEvent(state2, entry, lifecycle) {
|
|
|
5561
4773
|
const eventName = `onViewport${lifecycle}`;
|
|
5562
4774
|
const callback = props[eventName];
|
|
5563
4775
|
if (callback) {
|
|
5564
|
-
frame.postRender(() => callback(entry));
|
|
4776
|
+
motionDom.frame.postRender(() => callback(entry));
|
|
5565
4777
|
}
|
|
5566
4778
|
}
|
|
5567
4779
|
class InViewGesture extends Feature {
|
|
@@ -5781,7 +4993,7 @@ class PanSession {
|
|
|
5781
4993
|
if (!isPanStarted && !isDistancePastThreshold)
|
|
5782
4994
|
return;
|
|
5783
4995
|
const { point: point3 } = info2;
|
|
5784
|
-
const { timestamp: timestamp2 } = frameData;
|
|
4996
|
+
const { timestamp: timestamp2 } = motionDom.frameData;
|
|
5785
4997
|
this.history.push({ ...point3, timestamp: timestamp2 });
|
|
5786
4998
|
const { onStart, onMove } = this.handlers;
|
|
5787
4999
|
if (!isPanStarted) {
|
|
@@ -5793,7 +5005,7 @@ class PanSession {
|
|
|
5793
5005
|
this.handlePointerMove = (event2, info2) => {
|
|
5794
5006
|
this.lastMoveEvent = event2;
|
|
5795
5007
|
this.lastMoveEventInfo = transformPoint(info2, this.transformPagePoint);
|
|
5796
|
-
frame.update(this.updatePoint, true);
|
|
5008
|
+
motionDom.frame.update(this.updatePoint, true);
|
|
5797
5009
|
};
|
|
5798
5010
|
this.handlePointerUp = (event2, info2) => {
|
|
5799
5011
|
this.end();
|
|
@@ -5820,7 +5032,7 @@ class PanSession {
|
|
|
5820
5032
|
const info = extractEventInfo(event);
|
|
5821
5033
|
const initialInfo = transformPoint(info, this.transformPagePoint);
|
|
5822
5034
|
const { point: point2 } = initialInfo;
|
|
5823
|
-
const { timestamp } = frameData;
|
|
5035
|
+
const { timestamp } = motionDom.frameData;
|
|
5824
5036
|
this.history = [{ ...point2, timestamp }];
|
|
5825
5037
|
const { onSessionStart } = handlers;
|
|
5826
5038
|
onSessionStart && onSessionStart(event, getPanInfo(initialInfo, this.history));
|
|
@@ -5847,7 +5059,7 @@ class PanSession {
|
|
|
5847
5059
|
}
|
|
5848
5060
|
end() {
|
|
5849
5061
|
this.removeListeners && this.removeListeners();
|
|
5850
|
-
cancelFrame(this.updatePoint);
|
|
5062
|
+
motionDom.cancelFrame(this.updatePoint);
|
|
5851
5063
|
}
|
|
5852
5064
|
}
|
|
5853
5065
|
function transformPoint(info, transformPagePoint) {
|
|
@@ -5887,15 +5099,15 @@ function getVelocity(history, timeDelta) {
|
|
|
5887
5099
|
if (!timestampedPoint) {
|
|
5888
5100
|
return { x: 0, y: 0 };
|
|
5889
5101
|
}
|
|
5890
|
-
const
|
|
5102
|
+
const time = millisecondsToSeconds(
|
|
5891
5103
|
lastPoint.timestamp - timestampedPoint.timestamp
|
|
5892
5104
|
);
|
|
5893
|
-
if (
|
|
5105
|
+
if (time === 0) {
|
|
5894
5106
|
return { x: 0, y: 0 };
|
|
5895
5107
|
}
|
|
5896
5108
|
const currentVelocity = {
|
|
5897
|
-
x: (lastPoint.x - timestampedPoint.x) /
|
|
5898
|
-
y: (lastPoint.y - timestampedPoint.y) /
|
|
5109
|
+
x: (lastPoint.x - timestampedPoint.x) / time,
|
|
5110
|
+
y: (lastPoint.y - timestampedPoint.y) / time
|
|
5899
5111
|
};
|
|
5900
5112
|
if (currentVelocity.x === Infinity) {
|
|
5901
5113
|
currentVelocity.x = 0;
|
|
@@ -6041,7 +5253,7 @@ class VisualElementDragControls {
|
|
|
6041
5253
|
this.originPoint[axis] = current;
|
|
6042
5254
|
});
|
|
6043
5255
|
if (onDragStart) {
|
|
6044
|
-
frame.postRender(() => onDragStart(event, info));
|
|
5256
|
+
motionDom.frame.postRender(() => onDragStart(event, info));
|
|
6045
5257
|
}
|
|
6046
5258
|
addValueToWillChange(this.visualElement, "transform");
|
|
6047
5259
|
const state2 = this.visualElement.state;
|
|
@@ -6094,15 +5306,15 @@ class VisualElementDragControls {
|
|
|
6094
5306
|
);
|
|
6095
5307
|
}
|
|
6096
5308
|
stop(event, info) {
|
|
6097
|
-
const
|
|
5309
|
+
const isDragging = this.isDragging;
|
|
6098
5310
|
this.cancel();
|
|
6099
|
-
if (!
|
|
5311
|
+
if (!isDragging)
|
|
6100
5312
|
return;
|
|
6101
5313
|
const { velocity } = info;
|
|
6102
5314
|
this.startAnimation(velocity);
|
|
6103
5315
|
const { onDragEnd } = this.getProps();
|
|
6104
5316
|
if (onDragEnd) {
|
|
6105
|
-
frame.postRender(() => onDragEnd(event, info));
|
|
5317
|
+
motionDom.frame.postRender(() => onDragEnd(event, info));
|
|
6106
5318
|
}
|
|
6107
5319
|
}
|
|
6108
5320
|
cancel() {
|
|
@@ -6355,19 +5567,19 @@ class VisualElementDragControls {
|
|
|
6355
5567
|
projection.root && projection.root.updateScroll();
|
|
6356
5568
|
projection.updateLayout();
|
|
6357
5569
|
}
|
|
6358
|
-
frame.read(measureDragConstraints);
|
|
5570
|
+
motionDom.frame.read(measureDragConstraints);
|
|
6359
5571
|
const stopResizeListener = addDomEvent$1(window, "resize", () => this.scalePositionWithinConstraints());
|
|
6360
5572
|
const stopLayoutUpdateListener = projection.addEventListener(
|
|
6361
5573
|
"didUpdate",
|
|
6362
5574
|
({ delta, hasLayoutChanged }) => {
|
|
6363
5575
|
if (this.isDragging && hasLayoutChanged) {
|
|
6364
5576
|
eachAxis$1((axis) => {
|
|
6365
|
-
const
|
|
6366
|
-
if (!
|
|
5577
|
+
const motionValue = this.getAxisMotionValue(axis);
|
|
5578
|
+
if (!motionValue)
|
|
6367
5579
|
return;
|
|
6368
5580
|
this.originPoint[axis] += delta[axis].translate;
|
|
6369
|
-
|
|
6370
|
-
|
|
5581
|
+
motionValue.set(
|
|
5582
|
+
motionValue.get() + delta[axis].translate
|
|
6371
5583
|
);
|
|
6372
5584
|
});
|
|
6373
5585
|
this.visualElement.render();
|
|
@@ -6558,7 +5770,7 @@ class LayoutFeature extends Feature {
|
|
|
6558
5770
|
function asyncHandler(handler) {
|
|
6559
5771
|
return (event, info) => {
|
|
6560
5772
|
if (handler) {
|
|
6561
|
-
frame.postRender(() => handler(event, info));
|
|
5773
|
+
motionDom.frame.postRender(() => handler(event, info));
|
|
6562
5774
|
}
|
|
6563
5775
|
};
|
|
6564
5776
|
}
|
|
@@ -6595,7 +5807,7 @@ class PanGesture extends Feature {
|
|
|
6595
5807
|
const { onPanEnd } = this.state.options;
|
|
6596
5808
|
delete this.session;
|
|
6597
5809
|
if (onPanEnd) {
|
|
6598
|
-
frame.postRender(() => onPanEnd(event, info));
|
|
5810
|
+
motionDom.frame.postRender(() => onPanEnd(event, info));
|
|
6599
5811
|
}
|
|
6600
5812
|
}
|
|
6601
5813
|
};
|
|
@@ -6614,7 +5826,6 @@ class PanGesture extends Feature {
|
|
|
6614
5826
|
this.session && this.session.end();
|
|
6615
5827
|
}
|
|
6616
5828
|
}
|
|
6617
|
-
const { schedule: microtask, cancel: cancelMicrotask } = createRenderBatcher(queueMicrotask, false);
|
|
6618
5829
|
const compareByDepth = (a, b) => a.depth - b.depth;
|
|
6619
5830
|
class FlatTree {
|
|
6620
5831
|
constructor() {
|
|
@@ -6906,11 +6117,11 @@ function buildProjectionTransform(delta, treeScale, latestTransform) {
|
|
|
6906
6117
|
transform2 += `scale(${1 / treeScale.x}, ${1 / treeScale.y}) `;
|
|
6907
6118
|
}
|
|
6908
6119
|
if (latestTransform) {
|
|
6909
|
-
const { transformPerspective, rotate, rotateX, rotateY, skewX, skewY } = latestTransform;
|
|
6120
|
+
const { transformPerspective, rotate: rotate2, rotateX, rotateY, skewX, skewY } = latestTransform;
|
|
6910
6121
|
if (transformPerspective)
|
|
6911
6122
|
transform2 = `perspective(${transformPerspective}px) ${transform2}`;
|
|
6912
|
-
if (
|
|
6913
|
-
transform2 += `rotate(${
|
|
6123
|
+
if (rotate2)
|
|
6124
|
+
transform2 += `rotate(${rotate2}deg) `;
|
|
6914
6125
|
if (rotateX)
|
|
6915
6126
|
transform2 += `rotateX(${rotateX}deg) `;
|
|
6916
6127
|
if (rotateY)
|
|
@@ -6930,6 +6141,11 @@ function buildProjectionTransform(delta, treeScale, latestTransform) {
|
|
|
6930
6141
|
function eachAxis(callback) {
|
|
6931
6142
|
return [callback("x"), callback("y")];
|
|
6932
6143
|
}
|
|
6144
|
+
const metrics = {
|
|
6145
|
+
nodes: 0,
|
|
6146
|
+
calculatedTargetDeltas: 0,
|
|
6147
|
+
calculatedProjections: 0
|
|
6148
|
+
};
|
|
6933
6149
|
const transformAxes = ["", "X", "Y", "Z"];
|
|
6934
6150
|
const hiddenVisibility = { visibility: "hidden" };
|
|
6935
6151
|
const animationTarget = 1e3;
|
|
@@ -6954,7 +6170,7 @@ function cancelTreeOptimisedTransformAnimations(projectionNode) {
|
|
|
6954
6170
|
const appearId = getOptimisedAppearId(visualElement);
|
|
6955
6171
|
if (window.MotionHasOptimisedAnimation(appearId, "transform")) {
|
|
6956
6172
|
const { layout, layoutId } = projectionNode.options;
|
|
6957
|
-
window.MotionCancelOptimisedAnimation(appearId, "transform", frame, !(layout || layoutId));
|
|
6173
|
+
window.MotionCancelOptimisedAnimation(appearId, "transform", motionDom.frame, !(layout || layoutId));
|
|
6958
6174
|
}
|
|
6959
6175
|
const { parent } = projectionNode;
|
|
6960
6176
|
if (parent && !parent.hasCheckedOptimisedAppear) {
|
|
@@ -6995,10 +6211,16 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
6995
6211
|
};
|
|
6996
6212
|
this.updateProjection = () => {
|
|
6997
6213
|
this.projectionUpdateScheduled = false;
|
|
6214
|
+
if (motionDom.statsBuffer.value) {
|
|
6215
|
+
metrics.nodes = metrics.calculatedTargetDeltas = metrics.calculatedProjections = 0;
|
|
6216
|
+
}
|
|
6998
6217
|
this.nodes.forEach(propagateDirtyNodes);
|
|
6999
6218
|
this.nodes.forEach(resolveTargetDelta);
|
|
7000
6219
|
this.nodes.forEach(calcProjection);
|
|
7001
6220
|
this.nodes.forEach(cleanDirtyNodes);
|
|
6221
|
+
if (motionDom.statsBuffer.addProjectionMetrics) {
|
|
6222
|
+
motionDom.statsBuffer.addProjectionMetrics(metrics);
|
|
6223
|
+
}
|
|
7002
6224
|
};
|
|
7003
6225
|
this.resolvedRelativeTargetAt = 0;
|
|
7004
6226
|
this.hasProjected = false;
|
|
@@ -7080,7 +6302,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
7080
6302
|
}
|
|
7081
6303
|
this.setAnimationOrigin(delta, hasOnlyRelativeTargetChanged);
|
|
7082
6304
|
const animationOptions = {
|
|
7083
|
-
...getValueTransition
|
|
6305
|
+
...motionDom.getValueTransition(layoutTransition, "layout"),
|
|
7084
6306
|
onPlay: onLayoutAnimationStart,
|
|
7085
6307
|
onComplete: onLayoutAnimationComplete
|
|
7086
6308
|
};
|
|
@@ -7108,7 +6330,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
7108
6330
|
stack && stack.remove(this);
|
|
7109
6331
|
this.parent && this.parent.children.delete(this);
|
|
7110
6332
|
this.instance = void 0;
|
|
7111
|
-
cancelFrame(this.updateProjection);
|
|
6333
|
+
motionDom.cancelFrame(this.updateProjection);
|
|
7112
6334
|
}
|
|
7113
6335
|
// only on the root
|
|
7114
6336
|
blockUpdate() {
|
|
@@ -7181,19 +6403,19 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
7181
6403
|
this.nodes.forEach(updateLayout);
|
|
7182
6404
|
this.nodes.forEach(notifyLayoutUpdate);
|
|
7183
6405
|
this.clearAllSnapshots();
|
|
7184
|
-
const
|
|
7185
|
-
frameData.delta = clamp$1(0, 1e3 / 60,
|
|
7186
|
-
frameData.timestamp =
|
|
7187
|
-
frameData.isProcessing = true;
|
|
7188
|
-
frameSteps.update.process(frameData);
|
|
7189
|
-
frameSteps.preRender.process(frameData);
|
|
7190
|
-
frameSteps.render.process(frameData);
|
|
7191
|
-
frameData.isProcessing = false;
|
|
6406
|
+
const now = motionDom.time.now();
|
|
6407
|
+
motionDom.frameData.delta = clamp$1(0, 1e3 / 60, now - motionDom.frameData.timestamp);
|
|
6408
|
+
motionDom.frameData.timestamp = now;
|
|
6409
|
+
motionDom.frameData.isProcessing = true;
|
|
6410
|
+
motionDom.frameSteps.update.process(motionDom.frameData);
|
|
6411
|
+
motionDom.frameSteps.preRender.process(motionDom.frameData);
|
|
6412
|
+
motionDom.frameSteps.render.process(motionDom.frameData);
|
|
6413
|
+
motionDom.frameData.isProcessing = false;
|
|
7192
6414
|
}
|
|
7193
6415
|
didUpdate() {
|
|
7194
6416
|
if (!this.updateScheduled) {
|
|
7195
6417
|
this.updateScheduled = true;
|
|
7196
|
-
microtask.read(this.scheduleUpdate);
|
|
6418
|
+
motionDom.microtask.read(this.scheduleUpdate);
|
|
7197
6419
|
}
|
|
7198
6420
|
}
|
|
7199
6421
|
clearAllSnapshots() {
|
|
@@ -7203,11 +6425,11 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
7203
6425
|
scheduleUpdateProjection() {
|
|
7204
6426
|
if (!this.projectionUpdateScheduled) {
|
|
7205
6427
|
this.projectionUpdateScheduled = true;
|
|
7206
|
-
frame.preRender(this.updateProjection, false, true);
|
|
6428
|
+
motionDom.frame.preRender(this.updateProjection, false, true);
|
|
7207
6429
|
}
|
|
7208
6430
|
}
|
|
7209
6431
|
scheduleCheckAfterUnmount() {
|
|
7210
|
-
frame.postRender(() => {
|
|
6432
|
+
motionDom.frame.postRender(() => {
|
|
7211
6433
|
if (this.isLayoutDirty) {
|
|
7212
6434
|
this.root.didUpdate();
|
|
7213
6435
|
} else {
|
|
@@ -7393,7 +6615,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
7393
6615
|
forceRelativeParentToResolveTarget() {
|
|
7394
6616
|
if (!this.relativeParent)
|
|
7395
6617
|
return;
|
|
7396
|
-
if (this.relativeParent.resolvedRelativeTargetAt !== frameData.timestamp) {
|
|
6618
|
+
if (this.relativeParent.resolvedRelativeTargetAt !== motionDom.frameData.timestamp) {
|
|
7397
6619
|
this.relativeParent.resolveTargetDelta(true);
|
|
7398
6620
|
}
|
|
7399
6621
|
}
|
|
@@ -7410,7 +6632,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
7410
6632
|
const { layout, layoutId } = this.options;
|
|
7411
6633
|
if (!this.layout || !(layout || layoutId))
|
|
7412
6634
|
return;
|
|
7413
|
-
this.resolvedRelativeTargetAt = frameData.timestamp;
|
|
6635
|
+
this.resolvedRelativeTargetAt = motionDom.frameData.timestamp;
|
|
7414
6636
|
if (!this.targetDelta && !this.relativeTarget) {
|
|
7415
6637
|
const relativeParent = this.getClosestProjectingParent();
|
|
7416
6638
|
if (relativeParent && relativeParent.layout && this.animationProgress !== 1) {
|
|
@@ -7457,6 +6679,9 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
7457
6679
|
this.relativeParent = this.relativeTarget = void 0;
|
|
7458
6680
|
}
|
|
7459
6681
|
}
|
|
6682
|
+
if (motionDom.statsBuffer.value) {
|
|
6683
|
+
metrics.calculatedTargetDeltas++;
|
|
6684
|
+
}
|
|
7460
6685
|
}
|
|
7461
6686
|
getClosestProjectingParent() {
|
|
7462
6687
|
if (!this.parent || hasScale(this.parent.latestValues) || has2DTranslate(this.parent.latestValues)) {
|
|
@@ -7482,7 +6707,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
7482
6707
|
if (isShared && (this.isSharedProjectionDirty || this.isTransformDirty)) {
|
|
7483
6708
|
canSkip = false;
|
|
7484
6709
|
}
|
|
7485
|
-
if (this.resolvedRelativeTargetAt === frameData.timestamp) {
|
|
6710
|
+
if (this.resolvedRelativeTargetAt === motionDom.frameData.timestamp) {
|
|
7486
6711
|
canSkip = false;
|
|
7487
6712
|
}
|
|
7488
6713
|
if (canSkip)
|
|
@@ -7522,6 +6747,9 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
7522
6747
|
this.scheduleRender();
|
|
7523
6748
|
this.notifyListeners("projectionUpdate", target);
|
|
7524
6749
|
}
|
|
6750
|
+
if (motionDom.statsBuffer.value) {
|
|
6751
|
+
metrics.calculatedProjections++;
|
|
6752
|
+
}
|
|
7525
6753
|
}
|
|
7526
6754
|
hide() {
|
|
7527
6755
|
this.isVisible = false;
|
|
@@ -7595,11 +6823,12 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
7595
6823
|
this.resumingFrom.currentAnimation.stop();
|
|
7596
6824
|
}
|
|
7597
6825
|
if (this.pendingAnimation) {
|
|
7598
|
-
cancelFrame(this.pendingAnimation);
|
|
6826
|
+
motionDom.cancelFrame(this.pendingAnimation);
|
|
7599
6827
|
this.pendingAnimation = void 0;
|
|
7600
6828
|
}
|
|
7601
|
-
this.pendingAnimation = frame.update(() => {
|
|
6829
|
+
this.pendingAnimation = motionDom.frame.update(() => {
|
|
7602
6830
|
globalProjectionState.hasAnimatedSinceResize = true;
|
|
6831
|
+
motionDom.activeAnimations.layout++;
|
|
7603
6832
|
this.currentAnimation = animateSingleValue(0, animationTarget, {
|
|
7604
6833
|
...options,
|
|
7605
6834
|
onUpdate: (latest) => {
|
|
@@ -7607,8 +6836,10 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
7607
6836
|
options.onUpdate && options.onUpdate(latest);
|
|
7608
6837
|
},
|
|
7609
6838
|
onStop: () => {
|
|
6839
|
+
motionDom.activeAnimations.layout--;
|
|
7610
6840
|
},
|
|
7611
6841
|
onComplete: () => {
|
|
6842
|
+
motionDom.activeAnimations.layout--;
|
|
7612
6843
|
options.onComplete && options.onComplete();
|
|
7613
6844
|
this.completeAnimation();
|
|
7614
6845
|
}
|
|
@@ -7886,6 +7117,9 @@ function notifyLayoutUpdate(node) {
|
|
|
7886
7117
|
node.options.transition = void 0;
|
|
7887
7118
|
}
|
|
7888
7119
|
function propagateDirtyNodes(node) {
|
|
7120
|
+
if (motionDom.statsBuffer.value) {
|
|
7121
|
+
metrics.nodes++;
|
|
7122
|
+
}
|
|
7889
7123
|
if (!node.parent)
|
|
7890
7124
|
return;
|
|
7891
7125
|
if (!node.isProjecting()) {
|
|
@@ -8248,7 +7482,7 @@ function createAnimationFactories(prevTarget, animationOptions, controlDelay) {
|
|
|
8248
7482
|
this.element,
|
|
8249
7483
|
{ [key]: keyValue },
|
|
8250
7484
|
{
|
|
8251
|
-
...animationOptions,
|
|
7485
|
+
...(animationOptions == null ? void 0 : animationOptions[key]) || animationOptions,
|
|
8252
7486
|
delay: (((_a2 = animationOptions == null ? void 0 : animationOptions[key]) == null ? void 0 : _a2.delay) || (animationOptions == null ? void 0 : animationOptions.delay) || 0) + controlDelay
|
|
8253
7487
|
}
|
|
8254
7488
|
);
|
|
@@ -8416,14 +7650,14 @@ class MotionState {
|
|
|
8416
7650
|
}
|
|
8417
7651
|
if (this.options.layoutId) {
|
|
8418
7652
|
mountedLayoutIds.add(this.options.layoutId);
|
|
8419
|
-
frame.render(() => {
|
|
7653
|
+
motionDom.frame.render(() => {
|
|
8420
7654
|
mountedLayoutIds.clear();
|
|
8421
7655
|
});
|
|
8422
7656
|
}
|
|
8423
7657
|
}
|
|
8424
7658
|
clearAnimation() {
|
|
8425
7659
|
var _a;
|
|
8426
|
-
this.currentProcess && cancelFrame(this.currentProcess);
|
|
7660
|
+
this.currentProcess && motionDom.cancelFrame(this.currentProcess);
|
|
8427
7661
|
this.currentProcess = null;
|
|
8428
7662
|
(_a = this.visualElement.variantChildren) == null ? void 0 : _a.forEach((child) => {
|
|
8429
7663
|
child.state.clearAnimation();
|
|
@@ -8432,7 +7666,7 @@ class MotionState {
|
|
|
8432
7666
|
// update trigger animation
|
|
8433
7667
|
startAnimation() {
|
|
8434
7668
|
this.clearAnimation();
|
|
8435
|
-
this.currentProcess = frame.render(() => {
|
|
7669
|
+
this.currentProcess = motionDom.frame.render(() => {
|
|
8436
7670
|
this.currentProcess = null;
|
|
8437
7671
|
this.animateUpdates();
|
|
8438
7672
|
});
|
|
@@ -8613,17 +7847,17 @@ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8613
7847
|
dragMomentum: true,
|
|
8614
7848
|
whileDrag: void 0,
|
|
8615
7849
|
crossfade: true,
|
|
8616
|
-
whileHover: ({ hover
|
|
8617
|
-
if (process.env.NODE_ENV === "development" &&
|
|
7850
|
+
whileHover: ({ hover }) => {
|
|
7851
|
+
if (process.env.NODE_ENV === "development" && hover) {
|
|
8618
7852
|
vue.warn("hover is deprecated. Use whileHover instead.");
|
|
8619
7853
|
}
|
|
8620
|
-
return
|
|
7854
|
+
return hover;
|
|
8621
7855
|
},
|
|
8622
|
-
whilePress: ({ press
|
|
8623
|
-
if (process.env.NODE_ENV === "development" &&
|
|
7856
|
+
whilePress: ({ press }) => {
|
|
7857
|
+
if (process.env.NODE_ENV === "development" && press) {
|
|
8624
7858
|
vue.warn("press is deprecated. Use whilePress instead.");
|
|
8625
7859
|
}
|
|
8626
|
-
return
|
|
7860
|
+
return press;
|
|
8627
7861
|
},
|
|
8628
7862
|
whileInView: ({ inView: inView2 }) => {
|
|
8629
7863
|
if (process.env.NODE_ENV === "development" && inView2) {
|
|
@@ -8828,7 +8062,7 @@ function usePopLayout(props) {
|
|
|
8828
8062
|
if (!style2)
|
|
8829
8063
|
return;
|
|
8830
8064
|
styles.delete(state2);
|
|
8831
|
-
frame.render(() => {
|
|
8065
|
+
motionDom.frame.render(() => {
|
|
8832
8066
|
document.head.removeChild(style2);
|
|
8833
8067
|
});
|
|
8834
8068
|
}
|
|
@@ -9015,7 +8249,7 @@ function moveItem([...arr], fromIndex, toIndex) {
|
|
|
9015
8249
|
return arr;
|
|
9016
8250
|
}
|
|
9017
8251
|
function useDefaultMotionValue(value, defaultValue = 0) {
|
|
9018
|
-
return isMotionValue(value) ? value : motionValue(defaultValue);
|
|
8252
|
+
return isMotionValue(value) ? value : motionDom.motionValue(defaultValue);
|
|
9019
8253
|
}
|
|
9020
8254
|
const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
9021
8255
|
...{
|
|
@@ -9147,16 +8381,16 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
|
9147
8381
|
}
|
|
9148
8382
|
});
|
|
9149
8383
|
function useCombineMotionValues(combineValues) {
|
|
9150
|
-
const value = motionValue(combineValues());
|
|
8384
|
+
const value = motionDom.motionValue(combineValues());
|
|
9151
8385
|
const updateValue = () => value.set(combineValues());
|
|
9152
|
-
const scheduleUpdate = () => frame.preRender(updateValue, false, true);
|
|
8386
|
+
const scheduleUpdate = () => motionDom.frame.preRender(updateValue, false, true);
|
|
9153
8387
|
let subscriptions;
|
|
9154
8388
|
const subscribe = (values) => {
|
|
9155
8389
|
subscriptions = values.map((v) => v.on("change", scheduleUpdate));
|
|
9156
8390
|
};
|
|
9157
8391
|
const unsubscribe = () => {
|
|
9158
8392
|
subscriptions.forEach((unsubscribe2) => unsubscribe2());
|
|
9159
|
-
cancelFrame(updateValue);
|
|
8393
|
+
motionDom.cancelFrame(updateValue);
|
|
9160
8394
|
};
|
|
9161
8395
|
vue.onUnmounted(() => {
|
|
9162
8396
|
unsubscribe();
|
|
@@ -9168,16 +8402,16 @@ function useCombineMotionValues(combineValues) {
|
|
|
9168
8402
|
};
|
|
9169
8403
|
}
|
|
9170
8404
|
function useComputed(computed) {
|
|
9171
|
-
collectMotionValues.current = [];
|
|
8405
|
+
motionDom.collectMotionValues.current = [];
|
|
9172
8406
|
const { value, subscribe, unsubscribe } = useCombineMotionValues(computed);
|
|
9173
|
-
subscribe(collectMotionValues.current);
|
|
9174
|
-
collectMotionValues.current = void 0;
|
|
8407
|
+
subscribe(motionDom.collectMotionValues.current);
|
|
8408
|
+
motionDom.collectMotionValues.current = void 0;
|
|
9175
8409
|
vue.onBeforeUpdate(() => {
|
|
9176
8410
|
unsubscribe();
|
|
9177
|
-
collectMotionValues.current = [];
|
|
8411
|
+
motionDom.collectMotionValues.current = [];
|
|
9178
8412
|
computed();
|
|
9179
|
-
subscribe(collectMotionValues.current);
|
|
9180
|
-
collectMotionValues.current = void 0;
|
|
8413
|
+
subscribe(motionDom.collectMotionValues.current);
|
|
8414
|
+
motionDom.collectMotionValues.current = void 0;
|
|
9181
8415
|
});
|
|
9182
8416
|
return value;
|
|
9183
8417
|
}
|
|
@@ -9185,9 +8419,7 @@ function useTransform(input, inputRangeOrTransformer, outputRange, options) {
|
|
|
9185
8419
|
if (typeof input === "function") {
|
|
9186
8420
|
return useComputed(input);
|
|
9187
8421
|
}
|
|
9188
|
-
const transformer = vue.computed(() =>
|
|
9189
|
-
return typeof inputRangeOrTransformer === "function" ? inputRangeOrTransformer : transform(vue.isRef(inputRangeOrTransformer) ? inputRangeOrTransformer.value : inputRangeOrTransformer, outputRange, options);
|
|
9190
|
-
});
|
|
8422
|
+
const transformer = typeof inputRangeOrTransformer === "function" ? inputRangeOrTransformer : vue.isRef(inputRangeOrTransformer) ? vue.computed(() => transform(inputRangeOrTransformer.value, outputRange, options)) : transform(inputRangeOrTransformer, outputRange, options);
|
|
9191
8423
|
return Array.isArray(input) ? useListTransform(
|
|
9192
8424
|
input,
|
|
9193
8425
|
transformer
|
|
@@ -9212,9 +8444,9 @@ function useListTransform(values, transformer) {
|
|
|
9212
8444
|
return value;
|
|
9213
8445
|
}
|
|
9214
8446
|
function useTime() {
|
|
9215
|
-
const
|
|
9216
|
-
useAnimationFrame((t) =>
|
|
9217
|
-
return
|
|
8447
|
+
const time = motionDom.motionValue(0);
|
|
8448
|
+
useAnimationFrame((t) => time.set(t));
|
|
8449
|
+
return time;
|
|
9218
8450
|
}
|
|
9219
8451
|
function useMotionTemplate(fragments, ...values) {
|
|
9220
8452
|
const numFragments = fragments.length;
|
|
@@ -9247,7 +8479,7 @@ function toNumber(v) {
|
|
|
9247
8479
|
}
|
|
9248
8480
|
function useSpring(source, config = {}) {
|
|
9249
8481
|
let activeSpringAnimation = null;
|
|
9250
|
-
const value = motionValue(
|
|
8482
|
+
const value = motionDom.motionValue(
|
|
9251
8483
|
isMotionValue(source) ? toNumber(source.get()) : source
|
|
9252
8484
|
);
|
|
9253
8485
|
let latestValue = value.get();
|
|
@@ -9262,7 +8494,7 @@ function useSpring(source, config = {}) {
|
|
|
9262
8494
|
const startAnimation = () => {
|
|
9263
8495
|
const animation = activeSpringAnimation;
|
|
9264
8496
|
if ((animation == null ? void 0 : animation.time) === 0) {
|
|
9265
|
-
animation.sample(frameData.delta);
|
|
8497
|
+
animation.sample(motionDom.frameData.delta);
|
|
9266
8498
|
}
|
|
9267
8499
|
stopAnimation2();
|
|
9268
8500
|
const springConfig = vue.isRef(config) ? config.value : config;
|
|
@@ -9285,7 +8517,7 @@ function useSpring(source, config = {}) {
|
|
|
9285
8517
|
value.attach((v, set) => {
|
|
9286
8518
|
latestValue = v;
|
|
9287
8519
|
latestSetter = set;
|
|
9288
|
-
frame.update(startAnimation);
|
|
8520
|
+
motionDom.frame.update(startAnimation);
|
|
9289
8521
|
return value.get();
|
|
9290
8522
|
}, stopAnimation2);
|
|
9291
8523
|
}, { immediate: true });
|
|
@@ -9304,10 +8536,10 @@ function refWarning(name, ref) {
|
|
|
9304
8536
|
}
|
|
9305
8537
|
function createScrollMotionValues() {
|
|
9306
8538
|
return {
|
|
9307
|
-
scrollX: motionValue(0),
|
|
9308
|
-
scrollY: motionValue(0),
|
|
9309
|
-
scrollXProgress: motionValue(0),
|
|
9310
|
-
scrollYProgress: motionValue(0)
|
|
8539
|
+
scrollX: motionDom.motionValue(0),
|
|
8540
|
+
scrollY: motionDom.motionValue(0),
|
|
8541
|
+
scrollXProgress: motionDom.motionValue(0),
|
|
8542
|
+
scrollYProgress: motionDom.motionValue(0)
|
|
9311
8543
|
};
|
|
9312
8544
|
}
|
|
9313
8545
|
function useScroll({
|
|
@@ -9316,46 +8548,48 @@ function useScroll({
|
|
|
9316
8548
|
...options
|
|
9317
8549
|
} = {}) {
|
|
9318
8550
|
const values = createScrollMotionValues();
|
|
9319
|
-
let cleanup;
|
|
9320
|
-
const setupScroll = () => {
|
|
9321
|
-
cleanup == null ? void 0 : cleanup();
|
|
9322
|
-
cleanup = scroll(
|
|
9323
|
-
(_progress, { x, y }) => {
|
|
9324
|
-
values.scrollX.set(x.current);
|
|
9325
|
-
values.scrollXProgress.set(x.progress);
|
|
9326
|
-
values.scrollY.set(y.current);
|
|
9327
|
-
values.scrollYProgress.set(y.progress);
|
|
9328
|
-
},
|
|
9329
|
-
{
|
|
9330
|
-
...options,
|
|
9331
|
-
container: (container == null ? void 0 : container.value) ?? void 0,
|
|
9332
|
-
target: (target == null ? void 0 : target.value) ?? void 0
|
|
9333
|
-
}
|
|
9334
|
-
);
|
|
9335
|
-
};
|
|
9336
8551
|
vue.onMounted(() => {
|
|
9337
8552
|
refWarning("target", target);
|
|
9338
8553
|
refWarning("container", container);
|
|
9339
|
-
setupScroll();
|
|
9340
8554
|
});
|
|
9341
|
-
vue.onUnmounted(() => cleanup == null ? void 0 : cleanup());
|
|
9342
8555
|
vue.watch(
|
|
9343
|
-
|
|
9344
|
-
|
|
8556
|
+
[container, target, () => options.offset],
|
|
8557
|
+
(n, o, onCleanup) => {
|
|
8558
|
+
const cleanup = scroll(
|
|
8559
|
+
(_progress, { x, y }) => {
|
|
8560
|
+
values.scrollX.set(x.current);
|
|
8561
|
+
values.scrollXProgress.set(x.progress);
|
|
8562
|
+
values.scrollY.set(y.current);
|
|
8563
|
+
values.scrollYProgress.set(y.progress);
|
|
8564
|
+
},
|
|
8565
|
+
{
|
|
8566
|
+
...options,
|
|
8567
|
+
container: (container == null ? void 0 : container.value) ?? void 0,
|
|
8568
|
+
target: (target == null ? void 0 : target.value) ?? void 0
|
|
8569
|
+
}
|
|
8570
|
+
);
|
|
8571
|
+
onCleanup(() => {
|
|
8572
|
+
cleanup();
|
|
8573
|
+
});
|
|
8574
|
+
},
|
|
8575
|
+
{
|
|
8576
|
+
immediate: true,
|
|
8577
|
+
flush: "post"
|
|
8578
|
+
}
|
|
9345
8579
|
);
|
|
9346
8580
|
return values;
|
|
9347
8581
|
}
|
|
9348
8582
|
function useVelocity(value) {
|
|
9349
|
-
const velocity = motionValue(value.getVelocity());
|
|
8583
|
+
const velocity = motionDom.motionValue(value.getVelocity());
|
|
9350
8584
|
const updateVelocity = () => {
|
|
9351
8585
|
const latest = value.getVelocity();
|
|
9352
8586
|
velocity.set(latest);
|
|
9353
8587
|
if (latest) {
|
|
9354
|
-
frame.update(updateVelocity);
|
|
8588
|
+
motionDom.frame.update(updateVelocity);
|
|
9355
8589
|
}
|
|
9356
8590
|
};
|
|
9357
8591
|
useMotionValueEvent(value, "change", () => {
|
|
9358
|
-
frame.update(updateVelocity, false, true);
|
|
8592
|
+
motionDom.frame.update(updateVelocity, false, true);
|
|
9359
8593
|
});
|
|
9360
8594
|
return velocity;
|
|
9361
8595
|
}
|
|
@@ -9465,7 +8699,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
9465
8699
|
}
|
|
9466
8700
|
return axis.value;
|
|
9467
8701
|
});
|
|
9468
|
-
const
|
|
8702
|
+
const isDragging = vue.ref(false);
|
|
9469
8703
|
return (_ctx, _cache) => {
|
|
9470
8704
|
return vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$6), vue.mergeProps(bindProps(), {
|
|
9471
8705
|
drag: drag.value,
|
|
@@ -9473,17 +8707,17 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
9473
8707
|
onDrag: _cache[0] || (_cache[0] = (event, gesturePoint) => {
|
|
9474
8708
|
const { velocity } = gesturePoint;
|
|
9475
8709
|
velocity[vue.unref(axis)] && vue.unref(updateOrder)(_ctx.value, point2[vue.unref(axis)].get(), velocity[vue.unref(axis)]);
|
|
9476
|
-
!
|
|
8710
|
+
!isDragging.value && (isDragging.value = true);
|
|
9477
8711
|
_ctx.onDrag && _ctx.onDrag(event, gesturePoint);
|
|
9478
8712
|
}),
|
|
9479
8713
|
onDragEnd: _cache[1] || (_cache[1] = (event, gesturePoint) => {
|
|
9480
|
-
|
|
8714
|
+
isDragging.value = false;
|
|
9481
8715
|
_ctx.onDragEnd && _ctx.onDragEnd(event, gesturePoint);
|
|
9482
8716
|
}),
|
|
9483
8717
|
onLayoutMeasure: _cache[2] || (_cache[2] = (measured) => vue.unref(registerItem)(_ctx.value, measured))
|
|
9484
8718
|
}), {
|
|
9485
8719
|
default: vue.withCtx(() => [
|
|
9486
|
-
vue.renderSlot(_ctx.$slots, "default", { isDragging:
|
|
8720
|
+
vue.renderSlot(_ctx.$slots, "default", { isDragging: isDragging.value }),
|
|
9487
8721
|
vue.createTextVNode(" " + vue.toDisplayString(warning2()), 1)
|
|
9488
8722
|
]),
|
|
9489
8723
|
_: 3
|
|
@@ -9761,11 +8995,50 @@ class DragControls {
|
|
|
9761
8995
|
}
|
|
9762
8996
|
const createDragControls = () => new DragControls();
|
|
9763
8997
|
const useDragControls = createDragControls;
|
|
8998
|
+
Object.defineProperty(exports, "MotionValue", {
|
|
8999
|
+
enumerable: true,
|
|
9000
|
+
get: () => motionDom.MotionValue
|
|
9001
|
+
});
|
|
9002
|
+
Object.defineProperty(exports, "cancelFrame", {
|
|
9003
|
+
enumerable: true,
|
|
9004
|
+
get: () => motionDom.cancelFrame
|
|
9005
|
+
});
|
|
9006
|
+
Object.defineProperty(exports, "frame", {
|
|
9007
|
+
enumerable: true,
|
|
9008
|
+
get: () => motionDom.frame
|
|
9009
|
+
});
|
|
9010
|
+
Object.defineProperty(exports, "frameData", {
|
|
9011
|
+
enumerable: true,
|
|
9012
|
+
get: () => motionDom.frameData
|
|
9013
|
+
});
|
|
9014
|
+
Object.defineProperty(exports, "hover", {
|
|
9015
|
+
enumerable: true,
|
|
9016
|
+
get: () => motionDom.hover
|
|
9017
|
+
});
|
|
9018
|
+
Object.defineProperty(exports, "isDragActive", {
|
|
9019
|
+
enumerable: true,
|
|
9020
|
+
get: () => motionDom.isDragActive
|
|
9021
|
+
});
|
|
9022
|
+
Object.defineProperty(exports, "motionValue", {
|
|
9023
|
+
enumerable: true,
|
|
9024
|
+
get: () => motionDom.motionValue
|
|
9025
|
+
});
|
|
9026
|
+
Object.defineProperty(exports, "press", {
|
|
9027
|
+
enumerable: true,
|
|
9028
|
+
get: () => motionDom.press
|
|
9029
|
+
});
|
|
9030
|
+
Object.defineProperty(exports, "time", {
|
|
9031
|
+
enumerable: true,
|
|
9032
|
+
get: () => motionDom.time
|
|
9033
|
+
});
|
|
9034
|
+
Object.defineProperty(exports, "useMotionValue", {
|
|
9035
|
+
enumerable: true,
|
|
9036
|
+
get: () => motionDom.motionValue
|
|
9037
|
+
});
|
|
9764
9038
|
exports.AnimatePresence = _sfc_main$5;
|
|
9765
9039
|
exports.LayoutGroup = _sfc_main;
|
|
9766
9040
|
exports.Motion = _sfc_main$6;
|
|
9767
9041
|
exports.MotionConfig = _sfc_main$4;
|
|
9768
|
-
exports.MotionValue = MotionValue;
|
|
9769
9042
|
exports.Reorder = Reorder;
|
|
9770
9043
|
exports.ReorderGroup = ReorderGroup;
|
|
9771
9044
|
exports.ReorderItem = ReorderItem;
|
|
@@ -9777,8 +9050,6 @@ exports.anticipate = anticipate;
|
|
|
9777
9050
|
exports.backIn = backIn;
|
|
9778
9051
|
exports.backInOut = backInOut;
|
|
9779
9052
|
exports.backOut = backOut;
|
|
9780
|
-
exports.cancelFrame = cancelFrame;
|
|
9781
|
-
exports.cancelSync = cancelSync;
|
|
9782
9053
|
exports.circIn = circIn;
|
|
9783
9054
|
exports.circInOut = circInOut;
|
|
9784
9055
|
exports.circOut = circOut;
|
|
@@ -9792,28 +9063,21 @@ exports.distance2D = distance2D;
|
|
|
9792
9063
|
exports.easeIn = easeIn;
|
|
9793
9064
|
exports.easeInOut = easeInOut;
|
|
9794
9065
|
exports.easeOut = easeOut;
|
|
9795
|
-
exports.frame = frame;
|
|
9796
|
-
exports.frameData = frameData;
|
|
9797
|
-
exports.frameSteps = frameSteps;
|
|
9798
9066
|
exports.getContextWindow = getContextWindow;
|
|
9799
|
-
exports.hover = hover;
|
|
9800
9067
|
exports.inView = inView;
|
|
9801
9068
|
exports.inertia = inertia;
|
|
9802
9069
|
exports.injectLayoutGroup = injectLayoutGroup;
|
|
9803
9070
|
exports.injectMotion = injectMotion;
|
|
9804
9071
|
exports.interpolate = interpolate;
|
|
9805
|
-
exports.isDragActive = isDragActive;
|
|
9806
9072
|
exports.isMotionValue = isMotionValue;
|
|
9807
9073
|
exports.keyframes = keyframes;
|
|
9808
9074
|
exports.millisecondsToSeconds = millisecondsToSeconds;
|
|
9809
9075
|
exports.mirrorEasing = mirrorEasing;
|
|
9810
9076
|
exports.mix = mix;
|
|
9811
9077
|
exports.motion = motion;
|
|
9812
|
-
exports.motionValue = motionValue;
|
|
9813
9078
|
exports.mountedStates = mountedStates;
|
|
9814
9079
|
exports.noop = noop;
|
|
9815
9080
|
exports.pipe = pipe;
|
|
9816
|
-
exports.press = press;
|
|
9817
9081
|
exports.progress = progress$1;
|
|
9818
9082
|
exports.provideLayoutGroup = provideLayoutGroup;
|
|
9819
9083
|
exports.provideMotion = provideMotion;
|
|
@@ -9825,8 +9089,6 @@ exports.secondsToMilliseconds = secondsToMilliseconds;
|
|
|
9825
9089
|
exports.spring = spring;
|
|
9826
9090
|
exports.stagger = stagger;
|
|
9827
9091
|
exports.steps = steps;
|
|
9828
|
-
exports.sync = sync;
|
|
9829
|
-
exports.time = time;
|
|
9830
9092
|
exports.transform = transform;
|
|
9831
9093
|
exports.useAnimate = useAnimate;
|
|
9832
9094
|
exports.useAnimationControls = useAnimationControls;
|
|
@@ -9839,7 +9101,6 @@ exports.useInView = useInView;
|
|
|
9839
9101
|
exports.useLayoutGroup = useLayoutGroup;
|
|
9840
9102
|
exports.useMotionConfig = useMotionConfig;
|
|
9841
9103
|
exports.useMotionTemplate = useMotionTemplate;
|
|
9842
|
-
exports.useMotionValue = motionValue;
|
|
9843
9104
|
exports.useMotionValueEvent = useMotionValueEvent;
|
|
9844
9105
|
exports.useReducedMotion = useReducedMotion;
|
|
9845
9106
|
exports.useScroll = useScroll;
|