motion-v 0.12.0 → 0.13.0-beta.2
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 +415 -1182
- package/dist/es/animation/hooks/animation-controls.mjs +1 -1
- package/dist/es/animation/hooks/use-animate.mjs +1 -1
- package/dist/es/animation/hooks/use-reduced-motion.d.ts +7 -0
- package/dist/es/animation/hooks/use-reduced-motion.mjs +9 -0
- package/dist/es/animation/index.d.ts +1 -0
- package/dist/es/components/animate-presence/use-pop-layout.mjs +1 -1
- package/dist/es/components/reorder/index.d.ts +7020 -7020
- 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.d.ts +0 -1
- package/dist/es/index.mjs +32 -42
- 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 +22 -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/dist/nuxt/index.cjs +39 -27
- package/dist/nuxt/index.d.cts +7 -3
- package/dist/nuxt/index.d.mts +7 -3
- package/dist/nuxt/index.mjs +39 -27
- package/package.json +4 -3
- package/dist/es/constants/index.d.ts +0 -9
- package/dist/es/constants/index.mjs +0 -31
- 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/es/external/.pnpm/framer-motion@12.4.10/external/framer-motion/dist/es/value/index.mjs
DELETED
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
import { time } from "../frameloop/sync-time.mjs";
|
|
2
|
-
import { SubscriptionManager } from "../utils/subscription-manager.mjs";
|
|
3
|
-
import { velocityPerSecond } from "../utils/velocity-per-second.mjs";
|
|
4
|
-
import { warnOnce } from "../utils/warn-once.mjs";
|
|
5
|
-
import { frame } from "../frameloop/frame.mjs";
|
|
6
|
-
const MAX_VELOCITY_DELTA = 30;
|
|
7
|
-
const isFloat = (value) => {
|
|
8
|
-
return !isNaN(parseFloat(value));
|
|
9
|
-
};
|
|
10
|
-
const collectMotionValues = {
|
|
11
|
-
current: void 0
|
|
12
|
-
};
|
|
13
|
-
class MotionValue {
|
|
14
|
-
/**
|
|
15
|
-
* @param init - The initiating value
|
|
16
|
-
* @param config - Optional configuration options
|
|
17
|
-
*
|
|
18
|
-
* - `transformer`: A function to transform incoming values with.
|
|
19
|
-
*
|
|
20
|
-
* @internal
|
|
21
|
-
*/
|
|
22
|
-
constructor(init, options = {}) {
|
|
23
|
-
this.version = "12.4.10";
|
|
24
|
-
this.canTrackVelocity = null;
|
|
25
|
-
this.events = {};
|
|
26
|
-
this.updateAndNotify = (v, render = true) => {
|
|
27
|
-
const currentTime = time.now();
|
|
28
|
-
if (this.updatedAt !== currentTime) {
|
|
29
|
-
this.setPrevFrameValue();
|
|
30
|
-
}
|
|
31
|
-
this.prev = this.current;
|
|
32
|
-
this.setCurrent(v);
|
|
33
|
-
if (this.current !== this.prev && this.events.change) {
|
|
34
|
-
this.events.change.notify(this.current);
|
|
35
|
-
}
|
|
36
|
-
if (render && this.events.renderRequest) {
|
|
37
|
-
this.events.renderRequest.notify(this.current);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
this.hasAnimated = false;
|
|
41
|
-
this.setCurrent(init);
|
|
42
|
-
this.owner = options.owner;
|
|
43
|
-
}
|
|
44
|
-
setCurrent(current) {
|
|
45
|
-
this.current = current;
|
|
46
|
-
this.updatedAt = time.now();
|
|
47
|
-
if (this.canTrackVelocity === null && current !== void 0) {
|
|
48
|
-
this.canTrackVelocity = isFloat(this.current);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
setPrevFrameValue(prevFrameValue = this.current) {
|
|
52
|
-
this.prevFrameValue = prevFrameValue;
|
|
53
|
-
this.prevUpdatedAt = this.updatedAt;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Adds a function that will be notified when the `MotionValue` is updated.
|
|
57
|
-
*
|
|
58
|
-
* It returns a function that, when called, will cancel the subscription.
|
|
59
|
-
*
|
|
60
|
-
* When calling `onChange` inside a React component, it should be wrapped with the
|
|
61
|
-
* `useEffect` hook. As it returns an unsubscribe function, this should be returned
|
|
62
|
-
* from the `useEffect` function to ensure you don't add duplicate subscribers..
|
|
63
|
-
*
|
|
64
|
-
* ```jsx
|
|
65
|
-
* export const MyComponent = () => {
|
|
66
|
-
* const x = useMotionValue(0)
|
|
67
|
-
* const y = useMotionValue(0)
|
|
68
|
-
* const opacity = useMotionValue(1)
|
|
69
|
-
*
|
|
70
|
-
* useEffect(() => {
|
|
71
|
-
* function updateOpacity() {
|
|
72
|
-
* const maxXY = Math.max(x.get(), y.get())
|
|
73
|
-
* const newOpacity = transform(maxXY, [0, 100], [1, 0])
|
|
74
|
-
* opacity.set(newOpacity)
|
|
75
|
-
* }
|
|
76
|
-
*
|
|
77
|
-
* const unsubscribeX = x.on("change", updateOpacity)
|
|
78
|
-
* const unsubscribeY = y.on("change", updateOpacity)
|
|
79
|
-
*
|
|
80
|
-
* return () => {
|
|
81
|
-
* unsubscribeX()
|
|
82
|
-
* unsubscribeY()
|
|
83
|
-
* }
|
|
84
|
-
* }, [])
|
|
85
|
-
*
|
|
86
|
-
* return <motion.div style={{ x }} />
|
|
87
|
-
* }
|
|
88
|
-
* ```
|
|
89
|
-
*
|
|
90
|
-
* @param subscriber - A function that receives the latest value.
|
|
91
|
-
* @returns A function that, when called, will cancel this subscription.
|
|
92
|
-
*
|
|
93
|
-
* @deprecated
|
|
94
|
-
*/
|
|
95
|
-
onChange(subscription) {
|
|
96
|
-
if (process.env.NODE_ENV !== "production") {
|
|
97
|
-
warnOnce(false, `value.onChange(callback) is deprecated. Switch to value.on("change", callback).`);
|
|
98
|
-
}
|
|
99
|
-
return this.on("change", subscription);
|
|
100
|
-
}
|
|
101
|
-
on(eventName, callback) {
|
|
102
|
-
if (!this.events[eventName]) {
|
|
103
|
-
this.events[eventName] = new SubscriptionManager();
|
|
104
|
-
}
|
|
105
|
-
const unsubscribe = this.events[eventName].add(callback);
|
|
106
|
-
if (eventName === "change") {
|
|
107
|
-
return () => {
|
|
108
|
-
unsubscribe();
|
|
109
|
-
frame.read(() => {
|
|
110
|
-
if (!this.events.change.getSize()) {
|
|
111
|
-
this.stop();
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
return unsubscribe;
|
|
117
|
-
}
|
|
118
|
-
clearListeners() {
|
|
119
|
-
for (const eventManagers in this.events) {
|
|
120
|
-
this.events[eventManagers].clear();
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Attaches a passive effect to the `MotionValue`.
|
|
125
|
-
*
|
|
126
|
-
* @internal
|
|
127
|
-
*/
|
|
128
|
-
attach(passiveEffect, stopPassiveEffect) {
|
|
129
|
-
this.passiveEffect = passiveEffect;
|
|
130
|
-
this.stopPassiveEffect = stopPassiveEffect;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Sets the state of the `MotionValue`.
|
|
134
|
-
*
|
|
135
|
-
* @remarks
|
|
136
|
-
*
|
|
137
|
-
* ```jsx
|
|
138
|
-
* const x = useMotionValue(0)
|
|
139
|
-
* x.set(10)
|
|
140
|
-
* ```
|
|
141
|
-
*
|
|
142
|
-
* @param latest - Latest value to set.
|
|
143
|
-
* @param render - Whether to notify render subscribers. Defaults to `true`
|
|
144
|
-
*
|
|
145
|
-
* @public
|
|
146
|
-
*/
|
|
147
|
-
set(v, render = true) {
|
|
148
|
-
if (!render || !this.passiveEffect) {
|
|
149
|
-
this.updateAndNotify(v, render);
|
|
150
|
-
} else {
|
|
151
|
-
this.passiveEffect(v, this.updateAndNotify);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
setWithVelocity(prev, current, delta) {
|
|
155
|
-
this.set(current);
|
|
156
|
-
this.prev = void 0;
|
|
157
|
-
this.prevFrameValue = prev;
|
|
158
|
-
this.prevUpdatedAt = this.updatedAt - delta;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Set the state of the `MotionValue`, stopping any active animations,
|
|
162
|
-
* effects, and resets velocity to `0`.
|
|
163
|
-
*/
|
|
164
|
-
jump(v, endAnimation = true) {
|
|
165
|
-
this.updateAndNotify(v);
|
|
166
|
-
this.prev = v;
|
|
167
|
-
this.prevUpdatedAt = this.prevFrameValue = void 0;
|
|
168
|
-
endAnimation && this.stop();
|
|
169
|
-
if (this.stopPassiveEffect)
|
|
170
|
-
this.stopPassiveEffect();
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Returns the latest state of `MotionValue`
|
|
174
|
-
*
|
|
175
|
-
* @returns - The latest state of `MotionValue`
|
|
176
|
-
*
|
|
177
|
-
* @public
|
|
178
|
-
*/
|
|
179
|
-
get() {
|
|
180
|
-
if (collectMotionValues.current) {
|
|
181
|
-
collectMotionValues.current.push(this);
|
|
182
|
-
}
|
|
183
|
-
return this.current;
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* @public
|
|
187
|
-
*/
|
|
188
|
-
getPrevious() {
|
|
189
|
-
return this.prev;
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Returns the latest velocity of `MotionValue`
|
|
193
|
-
*
|
|
194
|
-
* @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
|
|
195
|
-
*
|
|
196
|
-
* @public
|
|
197
|
-
*/
|
|
198
|
-
getVelocity() {
|
|
199
|
-
const currentTime = time.now();
|
|
200
|
-
if (!this.canTrackVelocity || this.prevFrameValue === void 0 || currentTime - this.updatedAt > MAX_VELOCITY_DELTA) {
|
|
201
|
-
return 0;
|
|
202
|
-
}
|
|
203
|
-
const delta = Math.min(this.updatedAt - this.prevUpdatedAt, MAX_VELOCITY_DELTA);
|
|
204
|
-
return velocityPerSecond(parseFloat(this.current) - parseFloat(this.prevFrameValue), delta);
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Registers a new animation to control this `MotionValue`. Only one
|
|
208
|
-
* animation can drive a `MotionValue` at one time.
|
|
209
|
-
*
|
|
210
|
-
* ```jsx
|
|
211
|
-
* value.start()
|
|
212
|
-
* ```
|
|
213
|
-
*
|
|
214
|
-
* @param animation - A function that starts the provided animation
|
|
215
|
-
*
|
|
216
|
-
* @internal
|
|
217
|
-
*/
|
|
218
|
-
start(startAnimation) {
|
|
219
|
-
this.stop();
|
|
220
|
-
return new Promise((resolve) => {
|
|
221
|
-
this.hasAnimated = true;
|
|
222
|
-
this.animation = startAnimation(resolve);
|
|
223
|
-
if (this.events.animationStart) {
|
|
224
|
-
this.events.animationStart.notify();
|
|
225
|
-
}
|
|
226
|
-
}).then(() => {
|
|
227
|
-
if (this.events.animationComplete) {
|
|
228
|
-
this.events.animationComplete.notify();
|
|
229
|
-
}
|
|
230
|
-
this.clearAnimation();
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Stop the currently active animation.
|
|
235
|
-
*
|
|
236
|
-
* @public
|
|
237
|
-
*/
|
|
238
|
-
stop() {
|
|
239
|
-
if (this.animation) {
|
|
240
|
-
this.animation.stop();
|
|
241
|
-
if (this.events.animationCancel) {
|
|
242
|
-
this.events.animationCancel.notify();
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
this.clearAnimation();
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Returns `true` if this value is currently animating.
|
|
249
|
-
*
|
|
250
|
-
* @public
|
|
251
|
-
*/
|
|
252
|
-
isAnimating() {
|
|
253
|
-
return !!this.animation;
|
|
254
|
-
}
|
|
255
|
-
clearAnimation() {
|
|
256
|
-
delete this.animation;
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* Destroy and clean up subscribers to this `MotionValue`.
|
|
260
|
-
*
|
|
261
|
-
* The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
|
|
262
|
-
* handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
|
|
263
|
-
* created a `MotionValue` via the `motionValue` function.
|
|
264
|
-
*
|
|
265
|
-
* @public
|
|
266
|
-
*/
|
|
267
|
-
destroy() {
|
|
268
|
-
this.clearListeners();
|
|
269
|
-
this.stop();
|
|
270
|
-
if (this.stopPassiveEffect) {
|
|
271
|
-
this.stopPassiveEffect();
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
function motionValue(init, options) {
|
|
276
|
-
return new MotionValue(init, options);
|
|
277
|
-
}
|
|
278
|
-
export {
|
|
279
|
-
MotionValue,
|
|
280
|
-
collectMotionValues,
|
|
281
|
-
motionValue
|
|
282
|
-
};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { supportsScrollTimeline } from "../../utils/supports/scroll-timeline.mjs";
|
|
2
|
-
class BaseGroupPlaybackControls {
|
|
3
|
-
constructor(animations) {
|
|
4
|
-
this.stop = () => this.runAll("stop");
|
|
5
|
-
this.animations = animations.filter(Boolean);
|
|
6
|
-
}
|
|
7
|
-
get finished() {
|
|
8
|
-
return Promise.all(this.animations.map((animation) => "finished" in animation ? animation.finished : animation));
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* TODO: Filter out cancelled or stopped animations before returning
|
|
12
|
-
*/
|
|
13
|
-
getAll(propName) {
|
|
14
|
-
return this.animations[0][propName];
|
|
15
|
-
}
|
|
16
|
-
setAll(propName, newValue) {
|
|
17
|
-
for (let i = 0; i < this.animations.length; i++) {
|
|
18
|
-
this.animations[i][propName] = newValue;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
attachTimeline(timeline, fallback) {
|
|
22
|
-
const subscriptions = this.animations.map((animation) => {
|
|
23
|
-
if (supportsScrollTimeline() && animation.attachTimeline) {
|
|
24
|
-
return animation.attachTimeline(timeline);
|
|
25
|
-
} else if (typeof fallback === "function") {
|
|
26
|
-
return fallback(animation);
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
return () => {
|
|
30
|
-
subscriptions.forEach((cancel, i) => {
|
|
31
|
-
cancel && cancel();
|
|
32
|
-
this.animations[i].stop();
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
get time() {
|
|
37
|
-
return this.getAll("time");
|
|
38
|
-
}
|
|
39
|
-
set time(time) {
|
|
40
|
-
this.setAll("time", time);
|
|
41
|
-
}
|
|
42
|
-
get speed() {
|
|
43
|
-
return this.getAll("speed");
|
|
44
|
-
}
|
|
45
|
-
set speed(speed) {
|
|
46
|
-
this.setAll("speed", speed);
|
|
47
|
-
}
|
|
48
|
-
get startTime() {
|
|
49
|
-
return this.getAll("startTime");
|
|
50
|
-
}
|
|
51
|
-
get duration() {
|
|
52
|
-
let max = 0;
|
|
53
|
-
for (let i = 0; i < this.animations.length; i++) {
|
|
54
|
-
max = Math.max(max, this.animations[i].duration);
|
|
55
|
-
}
|
|
56
|
-
return max;
|
|
57
|
-
}
|
|
58
|
-
runAll(methodName) {
|
|
59
|
-
this.animations.forEach((controls) => controls[methodName]());
|
|
60
|
-
}
|
|
61
|
-
flatten() {
|
|
62
|
-
this.runAll("flatten");
|
|
63
|
-
}
|
|
64
|
-
play() {
|
|
65
|
-
this.runAll("play");
|
|
66
|
-
}
|
|
67
|
-
pause() {
|
|
68
|
-
this.runAll("pause");
|
|
69
|
-
}
|
|
70
|
-
cancel() {
|
|
71
|
-
this.runAll("cancel");
|
|
72
|
-
}
|
|
73
|
-
complete() {
|
|
74
|
-
this.runAll("complete");
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
export {
|
|
78
|
-
BaseGroupPlaybackControls
|
|
79
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { BaseGroupPlaybackControls } from "./BaseGroup.mjs";
|
|
2
|
-
class GroupPlaybackControls extends BaseGroupPlaybackControls {
|
|
3
|
-
then(onResolve, onReject) {
|
|
4
|
-
return Promise.all(this.animations).then(onResolve).catch(onReject);
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
export {
|
|
8
|
-
GroupPlaybackControls
|
|
9
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const maxGeneratorDuration = 2e4;
|
|
2
|
-
function calcGeneratorDuration(generator) {
|
|
3
|
-
let duration = 0;
|
|
4
|
-
const timeStep = 50;
|
|
5
|
-
let state = generator.next(duration);
|
|
6
|
-
while (!state.done && duration < maxGeneratorDuration) {
|
|
7
|
-
duration += timeStep;
|
|
8
|
-
state = generator.next(duration);
|
|
9
|
-
}
|
|
10
|
-
return duration >= maxGeneratorDuration ? Infinity : duration;
|
|
11
|
-
}
|
|
12
|
-
export {
|
|
13
|
-
calcGeneratorDuration,
|
|
14
|
-
maxGeneratorDuration
|
|
15
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import "../../../../../../../../motion-utils@12.4.10/external/motion-utils/dist/es/errors.mjs";
|
|
2
|
-
import { millisecondsToSeconds } from "../../../../../../../../motion-utils@12.4.10/external/motion-utils/dist/es/time-conversion.mjs";
|
|
3
|
-
import { calcGeneratorDuration, maxGeneratorDuration } from "./calc-duration.mjs";
|
|
4
|
-
function createGeneratorEasing(options, scale = 100, createGenerator) {
|
|
5
|
-
const generator = createGenerator({ ...options, keyframes: [0, scale] });
|
|
6
|
-
const duration = Math.min(calcGeneratorDuration(generator), maxGeneratorDuration);
|
|
7
|
-
return {
|
|
8
|
-
type: "keyframes",
|
|
9
|
-
ease: (progress) => {
|
|
10
|
-
return generator.next(duration * progress).value / scale;
|
|
11
|
-
},
|
|
12
|
-
duration: millisecondsToSeconds(duration)
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export {
|
|
16
|
-
createGeneratorEasing
|
|
17
|
-
};
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import "../../../../../../../motion-utils@12.4.10/external/motion-utils/dist/es/errors.mjs";
|
|
2
|
-
import { noop } from "../../../../../../../motion-utils@12.4.10/external/motion-utils/dist/es/noop.mjs";
|
|
3
|
-
import { millisecondsToSeconds, secondsToMilliseconds } from "../../../../../../../motion-utils@12.4.10/external/motion-utils/dist/es/time-conversion.mjs";
|
|
4
|
-
import { attachTimeline } from "./utils/attach-timeline.mjs";
|
|
5
|
-
class NativeAnimationControls {
|
|
6
|
-
constructor(animation) {
|
|
7
|
-
this.animation = animation;
|
|
8
|
-
}
|
|
9
|
-
get duration() {
|
|
10
|
-
var _a, _b, _c;
|
|
11
|
-
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;
|
|
12
|
-
return millisecondsToSeconds(Number(durationInMs));
|
|
13
|
-
}
|
|
14
|
-
get time() {
|
|
15
|
-
var _a;
|
|
16
|
-
if (this.animation) {
|
|
17
|
-
return millisecondsToSeconds(((_a = this.animation) === null || _a === void 0 ? void 0 : _a.currentTime) || 0);
|
|
18
|
-
}
|
|
19
|
-
return 0;
|
|
20
|
-
}
|
|
21
|
-
set time(newTime) {
|
|
22
|
-
if (this.animation) {
|
|
23
|
-
this.animation.currentTime = secondsToMilliseconds(newTime);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
get speed() {
|
|
27
|
-
return this.animation ? this.animation.playbackRate : 1;
|
|
28
|
-
}
|
|
29
|
-
set speed(newSpeed) {
|
|
30
|
-
if (this.animation) {
|
|
31
|
-
this.animation.playbackRate = newSpeed;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
get state() {
|
|
35
|
-
return this.animation ? this.animation.playState : "finished";
|
|
36
|
-
}
|
|
37
|
-
get startTime() {
|
|
38
|
-
return this.animation ? this.animation.startTime : null;
|
|
39
|
-
}
|
|
40
|
-
get finished() {
|
|
41
|
-
return this.animation ? this.animation.finished : Promise.resolve();
|
|
42
|
-
}
|
|
43
|
-
play() {
|
|
44
|
-
this.animation && this.animation.play();
|
|
45
|
-
}
|
|
46
|
-
pause() {
|
|
47
|
-
this.animation && this.animation.pause();
|
|
48
|
-
}
|
|
49
|
-
stop() {
|
|
50
|
-
if (!this.animation || this.state === "idle" || this.state === "finished") {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
if (this.animation.commitStyles) {
|
|
54
|
-
this.animation.commitStyles();
|
|
55
|
-
}
|
|
56
|
-
this.cancel();
|
|
57
|
-
}
|
|
58
|
-
flatten() {
|
|
59
|
-
var _a;
|
|
60
|
-
if (!this.animation)
|
|
61
|
-
return;
|
|
62
|
-
(_a = this.animation.effect) === null || _a === void 0 ? void 0 : _a.updateTiming({ easing: "linear" });
|
|
63
|
-
}
|
|
64
|
-
attachTimeline(timeline) {
|
|
65
|
-
if (this.animation)
|
|
66
|
-
attachTimeline(this.animation, timeline);
|
|
67
|
-
return noop;
|
|
68
|
-
}
|
|
69
|
-
complete() {
|
|
70
|
-
this.animation && this.animation.finish();
|
|
71
|
-
}
|
|
72
|
-
cancel() {
|
|
73
|
-
try {
|
|
74
|
-
this.animation && this.animation.cancel();
|
|
75
|
-
} catch (e) {
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
export {
|
|
80
|
-
NativeAnimationControls
|
|
81
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { isBezierDefinition } from "../../../utils/is-bezier-definition.mjs";
|
|
2
|
-
import { supportsLinearEasing } from "../../../utils/supports/linear-easing.mjs";
|
|
3
|
-
import { generateLinearEasing } from "./linear.mjs";
|
|
4
|
-
function isWaapiSupportedEasing(easing) {
|
|
5
|
-
return Boolean(typeof easing === "function" && supportsLinearEasing() || !easing || typeof easing === "string" && (easing in supportedWaapiEasing || supportsLinearEasing()) || isBezierDefinition(easing) || Array.isArray(easing) && easing.every(isWaapiSupportedEasing));
|
|
6
|
-
}
|
|
7
|
-
const cubicBezierAsString = ([a, b, c, d]) => `cubic-bezier(${a}, ${b}, ${c}, ${d})`;
|
|
8
|
-
const supportedWaapiEasing = {
|
|
9
|
-
linear: "linear",
|
|
10
|
-
ease: "ease",
|
|
11
|
-
easeIn: "ease-in",
|
|
12
|
-
easeOut: "ease-out",
|
|
13
|
-
easeInOut: "ease-in-out",
|
|
14
|
-
circIn: /* @__PURE__ */ cubicBezierAsString([0, 0.65, 0.55, 1]),
|
|
15
|
-
circOut: /* @__PURE__ */ cubicBezierAsString([0.55, 0, 1, 0.45]),
|
|
16
|
-
backIn: /* @__PURE__ */ cubicBezierAsString([0.31, 0.01, 0.66, -0.59]),
|
|
17
|
-
backOut: /* @__PURE__ */ cubicBezierAsString([0.33, 1.53, 0.69, 0.99])
|
|
18
|
-
};
|
|
19
|
-
function mapEasingToNativeEasing(easing, duration) {
|
|
20
|
-
if (!easing) {
|
|
21
|
-
return void 0;
|
|
22
|
-
} else if (typeof easing === "function" && supportsLinearEasing()) {
|
|
23
|
-
return generateLinearEasing(easing, duration);
|
|
24
|
-
} else if (isBezierDefinition(easing)) {
|
|
25
|
-
return cubicBezierAsString(easing);
|
|
26
|
-
} else if (Array.isArray(easing)) {
|
|
27
|
-
return easing.map((segmentEasing) => mapEasingToNativeEasing(segmentEasing, duration) || supportedWaapiEasing.easeOut);
|
|
28
|
-
} else {
|
|
29
|
-
return supportedWaapiEasing[easing];
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
export {
|
|
33
|
-
cubicBezierAsString,
|
|
34
|
-
isWaapiSupportedEasing,
|
|
35
|
-
mapEasingToNativeEasing,
|
|
36
|
-
supportedWaapiEasing
|
|
37
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import "../../../../../../../../motion-utils@12.4.10/external/motion-utils/dist/es/errors.mjs";
|
|
2
|
-
import { progress } from "../../../../../../../../motion-utils@12.4.10/external/motion-utils/dist/es/progress.mjs";
|
|
3
|
-
const generateLinearEasing = (easing, duration, resolution = 10) => {
|
|
4
|
-
let points = "";
|
|
5
|
-
const numPoints = Math.max(Math.round(duration / resolution), 2);
|
|
6
|
-
for (let i = 0; i < numPoints; i++) {
|
|
7
|
-
points += easing(progress(0, numPoints - 1, i)) + ", ";
|
|
8
|
-
}
|
|
9
|
-
return `linear(${points.substring(0, points.length - 2)})`;
|
|
10
|
-
};
|
|
11
|
-
export {
|
|
12
|
-
generateLinearEasing
|
|
13
|
-
};
|
package/dist/es/external/.pnpm/motion-dom@12.4.10/external/motion-dom/dist/es/gestures/hover.mjs
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { isDragActive } from "./drag/state/is-active.mjs";
|
|
2
|
-
import { setupGesture } from "./utils/setup.mjs";
|
|
3
|
-
function isValidHover(event) {
|
|
4
|
-
return !(event.pointerType === "touch" || isDragActive());
|
|
5
|
-
}
|
|
6
|
-
function hover(elementOrSelector, onHoverStart, options = {}) {
|
|
7
|
-
const [elements, eventOptions, cancel] = setupGesture(elementOrSelector, options);
|
|
8
|
-
const onPointerEnter = (enterEvent) => {
|
|
9
|
-
if (!isValidHover(enterEvent))
|
|
10
|
-
return;
|
|
11
|
-
const { target } = enterEvent;
|
|
12
|
-
const onHoverEnd = onHoverStart(target, enterEvent);
|
|
13
|
-
if (typeof onHoverEnd !== "function" || !target)
|
|
14
|
-
return;
|
|
15
|
-
const onPointerLeave = (leaveEvent) => {
|
|
16
|
-
if (!isValidHover(leaveEvent))
|
|
17
|
-
return;
|
|
18
|
-
onHoverEnd(leaveEvent);
|
|
19
|
-
target.removeEventListener("pointerleave", onPointerLeave);
|
|
20
|
-
};
|
|
21
|
-
target.addEventListener("pointerleave", onPointerLeave, eventOptions);
|
|
22
|
-
};
|
|
23
|
-
elements.forEach((element) => {
|
|
24
|
-
element.addEventListener("pointerenter", onPointerEnter, eventOptions);
|
|
25
|
-
});
|
|
26
|
-
return cancel;
|
|
27
|
-
}
|
|
28
|
-
export {
|
|
29
|
-
hover
|
|
30
|
-
};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { isDragActive } from "../drag/state/is-active.mjs";
|
|
2
|
-
import { capturePointer } from "../utils/capture-pointer.mjs";
|
|
3
|
-
import { isNodeOrChild } from "../utils/is-node-or-child.mjs";
|
|
4
|
-
import { isPrimaryPointer } from "../utils/is-primary-pointer.mjs";
|
|
5
|
-
import { setupGesture } from "../utils/setup.mjs";
|
|
6
|
-
import { isElementKeyboardAccessible } from "./utils/is-keyboard-accessible.mjs";
|
|
7
|
-
import { enableKeyboardPress } from "./utils/keyboard.mjs";
|
|
8
|
-
import { isPressing } from "./utils/state.mjs";
|
|
9
|
-
function isValidPressEvent(event) {
|
|
10
|
-
return isPrimaryPointer(event) && !isDragActive();
|
|
11
|
-
}
|
|
12
|
-
function press(targetOrSelector, onPressStart, options = {}) {
|
|
13
|
-
const [targets, eventOptions, cancelEvents] = setupGesture(targetOrSelector, options);
|
|
14
|
-
const startPress = (startEvent) => {
|
|
15
|
-
const target = startEvent.currentTarget;
|
|
16
|
-
if (!target || !isValidPressEvent(startEvent) || isPressing.has(target))
|
|
17
|
-
return;
|
|
18
|
-
isPressing.add(target);
|
|
19
|
-
capturePointer(startEvent, "set");
|
|
20
|
-
const onPressEnd = onPressStart(target, startEvent);
|
|
21
|
-
const onPointerEnd = (endEvent, success) => {
|
|
22
|
-
target.removeEventListener("pointerup", onPointerUp);
|
|
23
|
-
target.removeEventListener("pointercancel", onPointerCancel);
|
|
24
|
-
capturePointer(endEvent, "release");
|
|
25
|
-
if (!isValidPressEvent(endEvent) || !isPressing.has(target)) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
isPressing.delete(target);
|
|
29
|
-
if (typeof onPressEnd === "function") {
|
|
30
|
-
onPressEnd(endEvent, { success });
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
const onPointerUp = (upEvent) => {
|
|
34
|
-
const isOutside = !upEvent.isTrusted ? false : checkOutside(upEvent, target instanceof Element ? target.getBoundingClientRect() : {
|
|
35
|
-
left: 0,
|
|
36
|
-
top: 0,
|
|
37
|
-
right: window.innerWidth,
|
|
38
|
-
bottom: window.innerHeight
|
|
39
|
-
});
|
|
40
|
-
if (isOutside) {
|
|
41
|
-
onPointerEnd(upEvent, false);
|
|
42
|
-
} else {
|
|
43
|
-
onPointerEnd(upEvent, !(target instanceof Element) || isNodeOrChild(target, upEvent.target));
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
const onPointerCancel = (cancelEvent) => {
|
|
47
|
-
onPointerEnd(cancelEvent, false);
|
|
48
|
-
};
|
|
49
|
-
target.addEventListener("pointerup", onPointerUp, eventOptions);
|
|
50
|
-
target.addEventListener("pointercancel", onPointerCancel, eventOptions);
|
|
51
|
-
target.addEventListener("lostpointercapture", onPointerCancel, eventOptions);
|
|
52
|
-
};
|
|
53
|
-
targets.forEach((target) => {
|
|
54
|
-
target = options.useGlobalTarget ? window : target;
|
|
55
|
-
let canAddKeyboardAccessibility = false;
|
|
56
|
-
if (target instanceof HTMLElement) {
|
|
57
|
-
canAddKeyboardAccessibility = true;
|
|
58
|
-
if (!isElementKeyboardAccessible(target) && target.getAttribute("tabindex") === null) {
|
|
59
|
-
target.tabIndex = 0;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
target.addEventListener("pointerdown", startPress, eventOptions);
|
|
63
|
-
if (canAddKeyboardAccessibility) {
|
|
64
|
-
target.addEventListener("focus", (event) => enableKeyboardPress(event, eventOptions), eventOptions);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
return cancelEvents;
|
|
68
|
-
}
|
|
69
|
-
function checkOutside(event, rect) {
|
|
70
|
-
return event.clientX < rect.left || event.clientX > rect.right || event.clientY < rect.top || event.clientY > rect.bottom;
|
|
71
|
-
}
|
|
72
|
-
export {
|
|
73
|
-
press
|
|
74
|
-
};
|