motion 12.18.1 → 12.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/mini.js +7 -1063
- package/dist/es/debug.mjs +1 -0
- package/dist/es/index.mjs +1 -0
- package/dist/es/mini.mjs +1 -0
- package/dist/es/react-client.mjs +2 -0
- package/dist/es/react-m.mjs +2 -0
- package/dist/es/react-mini.mjs +2 -0
- package/dist/es/react.mjs +2 -0
- package/dist/motion.dev.js +2 -2
- package/dist/motion.js +1 -1
- package/mini/package.json +1 -1
- package/package.json +11 -11
- package/react/package.json +1 -1
- package/react-client/package.json +1 -1
- package/react-m/package.json +1 -1
- package/dist/es/framer-motion/dist/es/animation/animate/index.mjs +0 -34
- package/dist/es/framer-motion/dist/es/animation/animate/resolve-subjects.mjs +0 -19
- package/dist/es/framer-motion/dist/es/animation/animate/sequence.mjs +0 -14
- package/dist/es/framer-motion/dist/es/animation/animate/single-value.mjs +0 -11
- package/dist/es/framer-motion/dist/es/animation/animate/subject.mjs +0 -52
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-elements.mjs +0 -112
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-sequence.mjs +0 -13
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-style.mjs +0 -12
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/get-final-keyframe.mjs +0 -12
- package/dist/es/framer-motion/dist/es/animation/hooks/animation-controls.mjs +0 -80
- package/dist/es/framer-motion/dist/es/animation/hooks/use-animate-style.mjs +0 -17
- package/dist/es/framer-motion/dist/es/animation/hooks/use-animate.mjs +0 -17
- package/dist/es/framer-motion/dist/es/animation/hooks/use-animated-state.mjs +0 -64
- package/dist/es/framer-motion/dist/es/animation/hooks/use-animation.mjs +0 -41
- package/dist/es/framer-motion/dist/es/animation/interfaces/motion-value.mjs +0 -102
- package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element-target.mjs +0 -85
- package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element-variant.mjs +0 -65
- package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element.mjs +0 -26
- package/dist/es/framer-motion/dist/es/animation/optimized-appear/data-id.mjs +0 -6
- package/dist/es/framer-motion/dist/es/animation/optimized-appear/get-appear-id.mjs +0 -7
- package/dist/es/framer-motion/dist/es/animation/optimized-appear/handoff.mjs +0 -38
- package/dist/es/framer-motion/dist/es/animation/optimized-appear/start.mjs +0 -171
- package/dist/es/framer-motion/dist/es/animation/optimized-appear/store-id.mjs +0 -8
- package/dist/es/framer-motion/dist/es/animation/optimized-appear/store.mjs +0 -4
- package/dist/es/framer-motion/dist/es/animation/sequence/create.mjs +0 -256
- package/dist/es/framer-motion/dist/es/animation/sequence/utils/calc-repeat-duration.mjs +0 -5
- package/dist/es/framer-motion/dist/es/animation/sequence/utils/calc-time.mjs +0 -23
- package/dist/es/framer-motion/dist/es/animation/sequence/utils/edit.mjs +0 -31
- package/dist/es/framer-motion/dist/es/animation/sequence/utils/normalize-times.mjs +0 -13
- package/dist/es/framer-motion/dist/es/animation/sequence/utils/sort.mjs +0 -14
- package/dist/es/framer-motion/dist/es/animation/utils/create-visual-element.mjs +0 -45
- package/dist/es/framer-motion/dist/es/animation/utils/default-transitions.mjs +0 -40
- package/dist/es/framer-motion/dist/es/animation/utils/is-animation-controls.mjs +0 -7
- package/dist/es/framer-motion/dist/es/animation/utils/is-dom-keyframes.mjs +0 -5
- package/dist/es/framer-motion/dist/es/animation/utils/is-keyframes-target.mjs +0 -5
- package/dist/es/framer-motion/dist/es/animation/utils/is-transition-defined.mjs +0 -10
- package/dist/es/framer-motion/dist/es/animation/utils/stagger.mjs +0 -26
- package/dist/es/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs +0 -87
- package/dist/es/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs +0 -64
- package/dist/es/framer-motion/dist/es/components/AnimatePresence/index.mjs +0 -166
- package/dist/es/framer-motion/dist/es/components/AnimatePresence/use-presence-data.mjs +0 -9
- package/dist/es/framer-motion/dist/es/components/AnimatePresence/use-presence.mjs +0 -70
- package/dist/es/framer-motion/dist/es/components/AnimatePresence/utils.mjs +0 -14
- package/dist/es/framer-motion/dist/es/components/AnimateSharedLayout.mjs +0 -15
- package/dist/es/framer-motion/dist/es/components/LayoutGroup/index.mjs +0 -32
- package/dist/es/framer-motion/dist/es/components/LazyMotion/index.mjs +0 -68
- package/dist/es/framer-motion/dist/es/components/MotionConfig/index.mjs +0 -48
- package/dist/es/framer-motion/dist/es/components/Reorder/Group.mjs +0 -53
- package/dist/es/framer-motion/dist/es/components/Reorder/Item.mjs +0 -34
- package/dist/es/framer-motion/dist/es/components/Reorder/namespace.mjs +0 -2
- package/dist/es/framer-motion/dist/es/components/Reorder/utils/check-reorder.mjs +0 -24
- package/dist/es/framer-motion/dist/es/context/DeprecatedLayoutGroupContext.mjs +0 -10
- package/dist/es/framer-motion/dist/es/context/LayoutGroupContext.mjs +0 -6
- package/dist/es/framer-motion/dist/es/context/LazyContext.mjs +0 -6
- package/dist/es/framer-motion/dist/es/context/MotionConfigContext.mjs +0 -13
- package/dist/es/framer-motion/dist/es/context/MotionContext/create.mjs +0 -13
- package/dist/es/framer-motion/dist/es/context/MotionContext/index.mjs +0 -6
- package/dist/es/framer-motion/dist/es/context/MotionContext/utils.mjs +0 -17
- package/dist/es/framer-motion/dist/es/context/PresenceContext.mjs +0 -10
- package/dist/es/framer-motion/dist/es/context/ReorderContext.mjs +0 -6
- package/dist/es/framer-motion/dist/es/context/SwitchLayoutGroupContext.mjs +0 -9
- package/dist/es/framer-motion/dist/es/events/add-dom-event.mjs +0 -6
- package/dist/es/framer-motion/dist/es/events/add-pointer-event.mjs +0 -8
- package/dist/es/framer-motion/dist/es/events/event-info.mjs +0 -15
- package/dist/es/framer-motion/dist/es/events/use-dom-event.mjs +0 -34
- package/dist/es/framer-motion/dist/es/gestures/drag/VisualElementDragControls.mjs +0 -479
- package/dist/es/framer-motion/dist/es/gestures/drag/index.mjs +0 -27
- package/dist/es/framer-motion/dist/es/gestures/drag/use-drag-controls.mjs +0 -88
- package/dist/es/framer-motion/dist/es/gestures/drag/utils/constraints.mjs +0 -129
- package/dist/es/framer-motion/dist/es/gestures/focus.mjs +0 -41
- package/dist/es/framer-motion/dist/es/gestures/hover.mjs +0 -30
- package/dist/es/framer-motion/dist/es/gestures/pan/PanSession.mjs +0 -156
- package/dist/es/framer-motion/dist/es/gestures/pan/index.mjs +0 -50
- package/dist/es/framer-motion/dist/es/gestures/press.mjs +0 -33
- package/dist/es/framer-motion/dist/es/motion/features/Feature.mjs +0 -9
- package/dist/es/framer-motion/dist/es/motion/features/animation/exit.mjs +0 -36
- package/dist/es/framer-motion/dist/es/motion/features/animation/index.mjs +0 -40
- package/dist/es/framer-motion/dist/es/motion/features/animations.mjs +0 -13
- package/dist/es/framer-motion/dist/es/motion/features/definitions.mjs +0 -28
- package/dist/es/framer-motion/dist/es/motion/features/drag.mjs +0 -17
- package/dist/es/framer-motion/dist/es/motion/features/gestures.mjs +0 -21
- package/dist/es/framer-motion/dist/es/motion/features/layout/MeasureLayout.mjs +0 -135
- package/dist/es/framer-motion/dist/es/motion/features/layout.mjs +0 -11
- package/dist/es/framer-motion/dist/es/motion/features/load-features.mjs +0 -12
- package/dist/es/framer-motion/dist/es/motion/features/viewport/index.mjs +0 -72
- package/dist/es/framer-motion/dist/es/motion/features/viewport/observers.mjs +0 -49
- package/dist/es/framer-motion/dist/es/motion/index.mjs +0 -101
- package/dist/es/framer-motion/dist/es/motion/utils/is-forced-motion-value.mjs +0 -11
- package/dist/es/framer-motion/dist/es/motion/utils/is-motion-component.mjs +0 -12
- package/dist/es/framer-motion/dist/es/motion/utils/symbol.mjs +0 -3
- package/dist/es/framer-motion/dist/es/motion/utils/unwrap-motion-component.mjs +0 -17
- package/dist/es/framer-motion/dist/es/motion/utils/use-motion-ref.mjs +0 -38
- package/dist/es/framer-motion/dist/es/motion/utils/use-visual-element.mjs +0 -133
- package/dist/es/framer-motion/dist/es/motion/utils/use-visual-state.mjs +0 -79
- package/dist/es/framer-motion/dist/es/motion/utils/valid-prop.mjs +0 -57
- package/dist/es/framer-motion/dist/es/projection/animation/mix-values.mjs +0 -91
- package/dist/es/framer-motion/dist/es/projection/geometry/conversion.mjs +0 -33
- package/dist/es/framer-motion/dist/es/projection/geometry/copy.mjs +0 -31
- package/dist/es/framer-motion/dist/es/projection/geometry/delta-apply.mjs +0 -119
- package/dist/es/framer-motion/dist/es/projection/geometry/delta-calc.mjs +0 -52
- package/dist/es/framer-motion/dist/es/projection/geometry/delta-remove.mjs +0 -54
- package/dist/es/framer-motion/dist/es/projection/geometry/models.mjs +0 -17
- package/dist/es/framer-motion/dist/es/projection/geometry/utils.mjs +0 -31
- package/dist/es/framer-motion/dist/es/projection/node/DocumentProjectionNode.mjs +0 -13
- package/dist/es/framer-motion/dist/es/projection/node/HTMLProjectionNode.mjs +0 -27
- package/dist/es/framer-motion/dist/es/projection/node/create-projection-node.mjs +0 -1605
- package/dist/es/framer-motion/dist/es/projection/node/group.mjs +0 -24
- package/dist/es/framer-motion/dist/es/projection/node/state.mjs +0 -19
- package/dist/es/framer-motion/dist/es/projection/shared/stack.mjs +0 -112
- package/dist/es/framer-motion/dist/es/projection/styles/scale-border-radius.mjs +0 -41
- package/dist/es/framer-motion/dist/es/projection/styles/scale-box-shadow.mjs +0 -35
- package/dist/es/framer-motion/dist/es/projection/styles/scale-correction.mjs +0 -13
- package/dist/es/framer-motion/dist/es/projection/styles/transform.mjs +0 -49
- package/dist/es/framer-motion/dist/es/projection/use-instant-layout-transition.mjs +0 -14
- package/dist/es/framer-motion/dist/es/projection/use-reset-projection.mjs +0 -14
- package/dist/es/framer-motion/dist/es/projection/utils/each-axis.mjs +0 -5
- package/dist/es/framer-motion/dist/es/projection/utils/has-transform.mjs +0 -26
- package/dist/es/framer-motion/dist/es/projection/utils/measure.mjs +0 -17
- package/dist/es/framer-motion/dist/es/render/VisualElement.mjs +0 -478
- package/dist/es/framer-motion/dist/es/render/components/create-factory.mjs +0 -23
- package/dist/es/framer-motion/dist/es/render/components/create-proxy.mjs +0 -38
- package/dist/es/framer-motion/dist/es/render/components/m/create.mjs +0 -6
- package/dist/es/framer-motion/dist/es/render/components/m/elements.mjs +0 -227
- package/dist/es/framer-motion/dist/es/render/components/m/proxy.mjs +0 -6
- package/dist/es/framer-motion/dist/es/render/components/motion/create.mjs +0 -15
- package/dist/es/framer-motion/dist/es/render/components/motion/elements.mjs +0 -194
- package/dist/es/framer-motion/dist/es/render/components/motion/proxy.mjs +0 -6
- package/dist/es/framer-motion/dist/es/render/dom/DOMVisualElement.mjs +0 -43
- package/dist/es/framer-motion/dist/es/render/dom/create-visual-element.mjs +0 -14
- package/dist/es/framer-motion/dist/es/render/dom/features-animation.mjs +0 -14
- package/dist/es/framer-motion/dist/es/render/dom/features-max.mjs +0 -14
- package/dist/es/framer-motion/dist/es/render/dom/features-min.mjs +0 -12
- package/dist/es/framer-motion/dist/es/render/dom/scroll/attach-animation.mjs +0 -17
- package/dist/es/framer-motion/dist/es/render/dom/scroll/attach-function.mjs +0 -23
- package/dist/es/framer-motion/dist/es/render/dom/scroll/index.mjs +0 -14
- package/dist/es/framer-motion/dist/es/render/dom/scroll/info.mjs +0 -56
- package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/edge.mjs +0 -45
- package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/index.mjs +0 -60
- package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/inset.mjs +0 -47
- package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/offset.mjs +0 -35
- package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/presets.mjs +0 -20
- package/dist/es/framer-motion/dist/es/render/dom/scroll/on-scroll-handler.mjs +0 -48
- package/dist/es/framer-motion/dist/es/render/dom/scroll/track.mjs +0 -81
- package/dist/es/framer-motion/dist/es/render/dom/scroll/utils/get-timeline.mjs +0 -30
- package/dist/es/framer-motion/dist/es/render/dom/use-render.mjs +0 -33
- package/dist/es/framer-motion/dist/es/render/dom/utils/camel-to-dash.mjs +0 -6
- package/dist/es/framer-motion/dist/es/render/dom/utils/filter-props.mjs +0 -59
- package/dist/es/framer-motion/dist/es/render/dom/utils/is-svg-component.mjs +0 -30
- package/dist/es/framer-motion/dist/es/render/dom/viewport/index.mjs +0 -43
- package/dist/es/framer-motion/dist/es/render/html/HTMLVisualElement.mjs +0 -44
- package/dist/es/framer-motion/dist/es/render/html/config-motion.mjs +0 -12
- package/dist/es/framer-motion/dist/es/render/html/use-props.mjs +0 -57
- package/dist/es/framer-motion/dist/es/render/html/utils/build-styles.mjs +0 -65
- package/dist/es/framer-motion/dist/es/render/html/utils/build-transform.mjs +0 -62
- package/dist/es/framer-motion/dist/es/render/html/utils/create-render-state.mjs +0 -8
- package/dist/es/framer-motion/dist/es/render/html/utils/render.mjs +0 -9
- package/dist/es/framer-motion/dist/es/render/html/utils/scrape-motion-values.mjs +0 -19
- package/dist/es/framer-motion/dist/es/render/object/ObjectVisualElement.mjs +0 -41
- package/dist/es/framer-motion/dist/es/render/store.mjs +0 -3
- package/dist/es/framer-motion/dist/es/render/svg/SVGVisualElement.mjs +0 -45
- package/dist/es/framer-motion/dist/es/render/svg/config-motion.mjs +0 -12
- package/dist/es/framer-motion/dist/es/render/svg/lowercase-elements.mjs +0 -33
- package/dist/es/framer-motion/dist/es/render/svg/use-props.mjs +0 -24
- package/dist/es/framer-motion/dist/es/render/svg/utils/build-attrs.mjs +0 -57
- package/dist/es/framer-motion/dist/es/render/svg/utils/camel-case-attrs.mjs +0 -30
- package/dist/es/framer-motion/dist/es/render/svg/utils/create-render-state.mjs +0 -8
- package/dist/es/framer-motion/dist/es/render/svg/utils/is-svg-tag.mjs +0 -3
- package/dist/es/framer-motion/dist/es/render/svg/utils/path.mjs +0 -32
- package/dist/es/framer-motion/dist/es/render/svg/utils/render.mjs +0 -12
- package/dist/es/framer-motion/dist/es/render/svg/utils/scrape-motion-values.mjs +0 -19
- package/dist/es/framer-motion/dist/es/render/utils/animation-state.mjs +0 -342
- package/dist/es/framer-motion/dist/es/render/utils/compare-by-depth.mjs +0 -3
- package/dist/es/framer-motion/dist/es/render/utils/flat-tree.mjs +0 -24
- package/dist/es/framer-motion/dist/es/render/utils/get-variant-context.mjs +0 -28
- package/dist/es/framer-motion/dist/es/render/utils/is-controlling-variants.mjs +0 -13
- package/dist/es/framer-motion/dist/es/render/utils/is-variant-label.mjs +0 -8
- package/dist/es/framer-motion/dist/es/render/utils/motion-values.mjs +0 -51
- package/dist/es/framer-motion/dist/es/render/utils/resolve-dynamic-variants.mjs +0 -8
- package/dist/es/framer-motion/dist/es/render/utils/resolve-variants.mjs +0 -36
- package/dist/es/framer-motion/dist/es/render/utils/setters.mjs +0 -31
- package/dist/es/framer-motion/dist/es/render/utils/variant-props.mjs +0 -12
- package/dist/es/framer-motion/dist/es/utils/delay.mjs +0 -24
- package/dist/es/framer-motion/dist/es/utils/distance.mjs +0 -9
- package/dist/es/framer-motion/dist/es/utils/get-context-window.mjs +0 -6
- package/dist/es/framer-motion/dist/es/utils/is-browser.mjs +0 -3
- package/dist/es/framer-motion/dist/es/utils/is-ref-object.mjs +0 -7
- package/dist/es/framer-motion/dist/es/utils/reduced-motion/index.mjs +0 -19
- package/dist/es/framer-motion/dist/es/utils/reduced-motion/state.mjs +0 -5
- package/dist/es/framer-motion/dist/es/utils/reduced-motion/use-reduced-motion-config.mjs +0 -19
- package/dist/es/framer-motion/dist/es/utils/reduced-motion/use-reduced-motion.mjs +0 -47
- package/dist/es/framer-motion/dist/es/utils/shallow-compare.mjs +0 -14
- package/dist/es/framer-motion/dist/es/utils/use-animation-frame.mjs +0 -21
- package/dist/es/framer-motion/dist/es/utils/use-constant.mjs +0 -18
- package/dist/es/framer-motion/dist/es/utils/use-cycle.mjs +0 -47
- package/dist/es/framer-motion/dist/es/utils/use-force-update.mjs +0 -19
- package/dist/es/framer-motion/dist/es/utils/use-in-view.mjs +0 -23
- package/dist/es/framer-motion/dist/es/utils/use-instant-transition.mjs +0 -41
- package/dist/es/framer-motion/dist/es/utils/use-is-mounted.mjs +0 -15
- package/dist/es/framer-motion/dist/es/utils/use-isomorphic-effect.mjs +0 -6
- package/dist/es/framer-motion/dist/es/utils/use-motion-value-event.mjs +0 -13
- package/dist/es/framer-motion/dist/es/utils/use-unmount-effect.mjs +0 -7
- package/dist/es/framer-motion/dist/es/value/scroll/use-element-scroll.mjs +0 -14
- package/dist/es/framer-motion/dist/es/value/scroll/use-viewport-scroll.mjs +0 -14
- package/dist/es/framer-motion/dist/es/value/use-combine-values.mjs +0 -37
- package/dist/es/framer-motion/dist/es/value/use-computed.mjs +0 -19
- package/dist/es/framer-motion/dist/es/value/use-inverted-scale.mjs +0 -52
- package/dist/es/framer-motion/dist/es/value/use-motion-template.mjs +0 -45
- package/dist/es/framer-motion/dist/es/value/use-motion-value.mjs +0 -38
- package/dist/es/framer-motion/dist/es/value/use-scroll.mjs +0 -39
- package/dist/es/framer-motion/dist/es/value/use-spring.mjs +0 -22
- package/dist/es/framer-motion/dist/es/value/use-time.mjs +0 -10
- package/dist/es/framer-motion/dist/es/value/use-transform.mjs +0 -29
- package/dist/es/framer-motion/dist/es/value/use-velocity.mjs +0 -35
- package/dist/es/framer-motion/dist/es/value/use-will-change/WillChangeMotionValue.mjs +0 -21
- package/dist/es/framer-motion/dist/es/value/use-will-change/add-will-change.mjs +0 -20
- package/dist/es/framer-motion/dist/es/value/use-will-change/index.mjs +0 -8
- package/dist/es/framer-motion/dist/es/value/use-will-change/is.mjs +0 -7
- package/dist/es/framer-motion/dist/es/value/utils/resolve-motion-value.mjs +0 -12
- package/dist/es/motion/lib/debug.mjs +0 -1
- package/dist/es/motion/lib/index.mjs +0 -131
- package/dist/es/motion/lib/mini.mjs +0 -2
- package/dist/es/motion/lib/react-client.mjs +0 -3
- package/dist/es/motion/lib/react-m.mjs +0 -3
- package/dist/es/motion/lib/react-mini.mjs +0 -2
- package/dist/es/motion/lib/react.mjs +0 -204
- package/dist/es/motion-dom/dist/es/animation/AsyncMotionValueAnimation.mjs +0 -175
- package/dist/es/motion-dom/dist/es/animation/GroupAnimation.mjs +0 -72
- package/dist/es/motion-dom/dist/es/animation/GroupAnimationWithThen.mjs +0 -9
- package/dist/es/motion-dom/dist/es/animation/JSAnimation.mjs +0 -348
- package/dist/es/motion-dom/dist/es/animation/NativeAnimation.mjs +0 -158
- package/dist/es/motion-dom/dist/es/animation/NativeAnimationExtended.mjs +0 -65
- package/dist/es/motion-dom/dist/es/animation/NativeAnimationWrapper.mjs +0 -14
- package/dist/es/motion-dom/dist/es/animation/drivers/frame.mjs +0 -17
- package/dist/es/motion-dom/dist/es/animation/generators/inertia.mjs +0 -87
- package/dist/es/motion-dom/dist/es/animation/generators/keyframes.mjs +0 -51
- package/dist/es/motion-dom/dist/es/animation/generators/spring/defaults.mjs +0 -27
- package/dist/es/motion-dom/dist/es/animation/generators/spring/find.mjs +0 -86
- package/dist/es/motion-dom/dist/es/animation/generators/spring/index.mjs +0 -176
- package/dist/es/motion-dom/dist/es/animation/generators/utils/calc-duration.mjs +0 -17
- package/dist/es/motion-dom/dist/es/animation/generators/utils/create-generator-easing.mjs +0 -19
- package/dist/es/motion-dom/dist/es/animation/generators/utils/is-generator.mjs +0 -5
- package/dist/es/motion-dom/dist/es/animation/generators/utils/velocity.mjs +0 -9
- package/dist/es/motion-dom/dist/es/animation/keyframes/DOMKeyframesResolver.mjs +0 -131
- package/dist/es/motion-dom/dist/es/animation/keyframes/KeyframesResolver.mjs +0 -147
- package/dist/es/motion-dom/dist/es/animation/keyframes/get-final.mjs +0 -11
- package/dist/es/motion-dom/dist/es/animation/keyframes/offsets/default.mjs +0 -9
- package/dist/es/motion-dom/dist/es/animation/keyframes/offsets/fill.mjs +0 -12
- package/dist/es/motion-dom/dist/es/animation/keyframes/offsets/time.mjs +0 -5
- package/dist/es/motion-dom/dist/es/animation/keyframes/utils/apply-px-defaults.mjs +0 -11
- package/dist/es/motion-dom/dist/es/animation/keyframes/utils/fill-wildcards.mjs +0 -7
- package/dist/es/motion-dom/dist/es/animation/keyframes/utils/is-none.mjs +0 -15
- package/dist/es/motion-dom/dist/es/animation/keyframes/utils/make-none-animatable.mjs +0 -30
- package/dist/es/motion-dom/dist/es/animation/keyframes/utils/unit-conversion.mjs +0 -36
- package/dist/es/motion-dom/dist/es/animation/utils/WithPromise.mjs +0 -26
- package/dist/es/motion-dom/dist/es/animation/utils/active-animations.mjs +0 -9
- package/dist/es/motion-dom/dist/es/animation/utils/can-animate.mjs +0 -42
- package/dist/es/motion-dom/dist/es/animation/utils/css-variables-conversion.mjs +0 -42
- package/dist/es/motion-dom/dist/es/animation/utils/get-value-transition.mjs +0 -7
- package/dist/es/motion-dom/dist/es/animation/utils/is-animatable.mjs +0 -30
- package/dist/es/motion-dom/dist/es/animation/utils/is-css-variable.mjs +0 -15
- package/dist/es/motion-dom/dist/es/animation/utils/replace-transition-type.mjs +0 -18
- package/dist/es/motion-dom/dist/es/animation/waapi/easing/cubic-bezier.mjs +0 -3
- package/dist/es/motion-dom/dist/es/animation/waapi/easing/is-supported.mjs +0 -14
- package/dist/es/motion-dom/dist/es/animation/waapi/easing/map-easing.mjs +0 -28
- package/dist/es/motion-dom/dist/es/animation/waapi/easing/supported.mjs +0 -15
- package/dist/es/motion-dom/dist/es/animation/waapi/start-waapi-animation.mjs +0 -39
- package/dist/es/motion-dom/dist/es/animation/waapi/supports/partial-keyframes.mjs +0 -13
- package/dist/es/motion-dom/dist/es/animation/waapi/supports/waapi.mjs +0 -37
- package/dist/es/motion-dom/dist/es/animation/waapi/utils/accelerated-values.mjs +0 -14
- package/dist/es/motion-dom/dist/es/animation/waapi/utils/apply-generator.mjs +0 -15
- package/dist/es/motion-dom/dist/es/animation/waapi/utils/linear.mjs +0 -12
- package/dist/es/motion-dom/dist/es/animation/waapi/utils/px-values.mjs +0 -39
- package/dist/es/motion-dom/dist/es/animation/waapi/utils/unsupported-easing.mjs +0 -20
- package/dist/es/motion-dom/dist/es/effects/MotionValueState.mjs +0 -47
- package/dist/es/motion-dom/dist/es/effects/attr/index.mjs +0 -41
- package/dist/es/motion-dom/dist/es/effects/prop/index.mjs +0 -9
- package/dist/es/motion-dom/dist/es/effects/style/index.mjs +0 -52
- package/dist/es/motion-dom/dist/es/effects/style/transform.mjs +0 -38
- package/dist/es/motion-dom/dist/es/effects/svg/index.mjs +0 -41
- package/dist/es/motion-dom/dist/es/effects/utils/create-dom-effect.mjs +0 -18
- package/dist/es/motion-dom/dist/es/effects/utils/create-effect.mjs +0 -21
- package/dist/es/motion-dom/dist/es/frameloop/batcher.mjs +0 -71
- package/dist/es/motion-dom/dist/es/frameloop/frame.mjs +0 -6
- package/dist/es/motion-dom/dist/es/frameloop/index-legacy.mjs +0 -20
- package/dist/es/motion-dom/dist/es/frameloop/microtask.mjs +0 -6
- package/dist/es/motion-dom/dist/es/frameloop/order.mjs +0 -12
- package/dist/es/motion-dom/dist/es/frameloop/render-step.mjs +0 -92
- package/dist/es/motion-dom/dist/es/frameloop/sync-time.mjs +0 -31
- package/dist/es/motion-dom/dist/es/gestures/drag/state/is-active.mjs +0 -9
- package/dist/es/motion-dom/dist/es/gestures/drag/state/set-active.mjs +0 -28
- package/dist/es/motion-dom/dist/es/gestures/hover.mjs +0 -37
- package/dist/es/motion-dom/dist/es/gestures/press/index.mjs +0 -83
- package/dist/es/motion-dom/dist/es/gestures/press/utils/is-keyboard-accessible.mjs +0 -13
- package/dist/es/motion-dom/dist/es/gestures/press/utils/keyboard.mjs +0 -38
- package/dist/es/motion-dom/dist/es/gestures/press/utils/state.mjs +0 -3
- package/dist/es/motion-dom/dist/es/gestures/utils/is-node-or-child.mjs +0 -20
- package/dist/es/motion-dom/dist/es/gestures/utils/is-primary-pointer.mjs +0 -18
- package/dist/es/motion-dom/dist/es/gestures/utils/setup.mjs +0 -15
- package/dist/es/motion-dom/dist/es/render/dom/is-css-var.mjs +0 -3
- package/dist/es/motion-dom/dist/es/render/dom/parse-transform.mjs +0 -83
- package/dist/es/motion-dom/dist/es/render/dom/style-computed.mjs +0 -10
- package/dist/es/motion-dom/dist/es/render/dom/style-set.mjs +0 -9
- package/dist/es/motion-dom/dist/es/render/dom/utils/camel-to-dash.mjs +0 -5
- package/dist/es/motion-dom/dist/es/render/utils/keys-position.mjs +0 -13
- package/dist/es/motion-dom/dist/es/render/utils/keys-transform.mjs +0 -28
- package/dist/es/motion-dom/dist/es/resize/handle-element.mjs +0 -63
- package/dist/es/motion-dom/dist/es/resize/handle-window.mjs +0 -31
- package/dist/es/motion-dom/dist/es/resize/index.mjs +0 -8
- package/dist/es/motion-dom/dist/es/scroll/observe.mjs +0 -18
- package/dist/es/motion-dom/dist/es/stats/animation-count.mjs +0 -7
- package/dist/es/motion-dom/dist/es/stats/buffer.mjs +0 -6
- package/dist/es/motion-dom/dist/es/stats/index.mjs +0 -117
- package/dist/es/motion-dom/dist/es/utils/interpolate.mjs +0 -79
- package/dist/es/motion-dom/dist/es/utils/is-html-element.mjs +0 -11
- package/dist/es/motion-dom/dist/es/utils/is-svg-element.mjs +0 -11
- package/dist/es/motion-dom/dist/es/utils/is-svg-svg-element.mjs +0 -11
- package/dist/es/motion-dom/dist/es/utils/mix/color.mjs +0 -47
- package/dist/es/motion-dom/dist/es/utils/mix/complex.mjs +0 -93
- package/dist/es/motion-dom/dist/es/utils/mix/immediate.mjs +0 -5
- package/dist/es/motion-dom/dist/es/utils/mix/index.mjs +0 -14
- package/dist/es/motion-dom/dist/es/utils/mix/number.mjs +0 -26
- package/dist/es/motion-dom/dist/es/utils/mix/visibility.mjs +0 -16
- package/dist/es/motion-dom/dist/es/utils/resolve-elements.mjs +0 -17
- package/dist/es/motion-dom/dist/es/utils/supports/flags.mjs +0 -7
- package/dist/es/motion-dom/dist/es/utils/supports/linear-easing.mjs +0 -15
- package/dist/es/motion-dom/dist/es/utils/supports/memo.mjs +0 -9
- package/dist/es/motion-dom/dist/es/utils/supports/scroll-timeline.mjs +0 -5
- package/dist/es/motion-dom/dist/es/utils/transform.mjs +0 -14
- package/dist/es/motion-dom/dist/es/value/index.mjs +0 -329
- package/dist/es/motion-dom/dist/es/value/map-value.mjs +0 -46
- package/dist/es/motion-dom/dist/es/value/spring-value.mjs +0 -72
- package/dist/es/motion-dom/dist/es/value/subscribe-value.mjs +0 -13
- package/dist/es/motion-dom/dist/es/value/transform-value.mjs +0 -35
- package/dist/es/motion-dom/dist/es/value/types/auto.mjs +0 -9
- package/dist/es/motion-dom/dist/es/value/types/color/hex.mjs +0 -40
- package/dist/es/motion-dom/dist/es/value/types/color/hsla-to-rgba.mjs +0 -42
- package/dist/es/motion-dom/dist/es/value/types/color/hsla.mjs +0 -22
- package/dist/es/motion-dom/dist/es/value/types/color/index.mjs +0 -32
- package/dist/es/motion-dom/dist/es/value/types/color/rgba.mjs +0 -25
- package/dist/es/motion-dom/dist/es/value/types/color/utils.mjs +0 -29
- package/dist/es/motion-dom/dist/es/value/types/complex/filter.mjs +0 -30
- package/dist/es/motion-dom/dist/es/value/types/complex/index.mjs +0 -91
- package/dist/es/motion-dom/dist/es/value/types/dimensions.mjs +0 -15
- package/dist/es/motion-dom/dist/es/value/types/int.mjs +0 -8
- package/dist/es/motion-dom/dist/es/value/types/maps/defaults.mjs +0 -30
- package/dist/es/motion-dom/dist/es/value/types/maps/number.mjs +0 -50
- package/dist/es/motion-dom/dist/es/value/types/maps/transform.mjs +0 -31
- package/dist/es/motion-dom/dist/es/value/types/numbers/index.mjs +0 -17
- package/dist/es/motion-dom/dist/es/value/types/numbers/units.mjs +0 -18
- package/dist/es/motion-dom/dist/es/value/types/test.mjs +0 -6
- package/dist/es/motion-dom/dist/es/value/types/utils/animatable-none.mjs +0 -15
- package/dist/es/motion-dom/dist/es/value/types/utils/color-regex.mjs +0 -3
- package/dist/es/motion-dom/dist/es/value/types/utils/find.mjs +0 -15
- package/dist/es/motion-dom/dist/es/value/types/utils/float-regex.mjs +0 -3
- package/dist/es/motion-dom/dist/es/value/types/utils/get-as-type.mjs +0 -10
- package/dist/es/motion-dom/dist/es/value/types/utils/is-nullish.mjs +0 -5
- package/dist/es/motion-dom/dist/es/value/types/utils/sanitize.mjs +0 -5
- package/dist/es/motion-dom/dist/es/value/types/utils/single-color-regex.mjs +0 -3
- package/dist/es/motion-dom/dist/es/value/utils/is-motion-value.mjs +0 -3
- package/dist/es/motion-dom/dist/es/view/index.mjs +0 -64
- package/dist/es/motion-dom/dist/es/view/queue.mjs +0 -52
- package/dist/es/motion-dom/dist/es/view/start.mjs +0 -155
- package/dist/es/motion-dom/dist/es/view/utils/choose-layer-type.mjs +0 -11
- package/dist/es/motion-dom/dist/es/view/utils/css.mjs +0 -32
- package/dist/es/motion-dom/dist/es/view/utils/get-layer-name.mjs +0 -8
- package/dist/es/motion-dom/dist/es/view/utils/get-view-animations.mjs +0 -12
- package/dist/es/motion-dom/dist/es/view/utils/has-target.mjs +0 -5
- package/dist/es/motion-utils/dist/es/array.mjs +0 -21
- package/dist/es/motion-utils/dist/es/clamp.mjs +0 -9
- package/dist/es/motion-utils/dist/es/easing/anticipate.mjs +0 -5
- package/dist/es/motion-utils/dist/es/easing/back.mjs +0 -9
- package/dist/es/motion-utils/dist/es/easing/circ.mjs +0 -8
- package/dist/es/motion-utils/dist/es/easing/cubic-bezier.mjs +0 -51
- package/dist/es/motion-utils/dist/es/easing/ease.mjs +0 -7
- package/dist/es/motion-utils/dist/es/easing/modifiers/mirror.mjs +0 -5
- package/dist/es/motion-utils/dist/es/easing/modifiers/reverse.mjs +0 -5
- package/dist/es/motion-utils/dist/es/easing/steps.mjs +0 -15
- package/dist/es/motion-utils/dist/es/easing/utils/get-easing-for-segment.mjs +0 -8
- package/dist/es/motion-utils/dist/es/easing/utils/is-bezier-definition.mjs +0 -3
- package/dist/es/motion-utils/dist/es/easing/utils/is-easing-array.mjs +0 -5
- package/dist/es/motion-utils/dist/es/easing/utils/map.mjs +0 -41
- package/dist/es/motion-utils/dist/es/errors.mjs +0 -16
- package/dist/es/motion-utils/dist/es/global-config.mjs +0 -3
- package/dist/es/motion-utils/dist/es/is-numerical-string.mjs +0 -6
- package/dist/es/motion-utils/dist/es/is-object.mjs +0 -5
- package/dist/es/motion-utils/dist/es/is-zero-value-string.mjs +0 -6
- package/dist/es/motion-utils/dist/es/memo.mjs +0 -11
- package/dist/es/motion-utils/dist/es/noop.mjs +0 -4
- package/dist/es/motion-utils/dist/es/pipe.mjs +0 -11
- package/dist/es/motion-utils/dist/es/progress.mjs +0 -19
- package/dist/es/motion-utils/dist/es/subscription-manager.mjs +0 -40
- package/dist/es/motion-utils/dist/es/time-conversion.mjs +0 -12
- package/dist/es/motion-utils/dist/es/velocity-per-second.mjs +0 -11
- package/dist/es/motion-utils/dist/es/warn-once.mjs +0 -14
- package/dist/es/motion-utils/dist/es/wrap.mjs +0 -6
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { progress } from '../../../../../../motion-utils/dist/es/progress.mjs';
|
|
2
|
-
import { velocityPerSecond } from '../../../../../../motion-utils/dist/es/velocity-per-second.mjs';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* A time in milliseconds, beyond which we consider the scroll velocity to be 0.
|
|
6
|
-
*/
|
|
7
|
-
const maxElapsed = 50;
|
|
8
|
-
const createAxisInfo = () => ({
|
|
9
|
-
current: 0,
|
|
10
|
-
offset: [],
|
|
11
|
-
progress: 0,
|
|
12
|
-
scrollLength: 0,
|
|
13
|
-
targetOffset: 0,
|
|
14
|
-
targetLength: 0,
|
|
15
|
-
containerLength: 0,
|
|
16
|
-
velocity: 0,
|
|
17
|
-
});
|
|
18
|
-
const createScrollInfo = () => ({
|
|
19
|
-
time: 0,
|
|
20
|
-
x: createAxisInfo(),
|
|
21
|
-
y: createAxisInfo(),
|
|
22
|
-
});
|
|
23
|
-
const keys = {
|
|
24
|
-
x: {
|
|
25
|
-
length: "Width",
|
|
26
|
-
position: "Left",
|
|
27
|
-
},
|
|
28
|
-
y: {
|
|
29
|
-
length: "Height",
|
|
30
|
-
position: "Top",
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
function updateAxisInfo(element, axisName, info, time) {
|
|
34
|
-
const axis = info[axisName];
|
|
35
|
-
const { length, position } = keys[axisName];
|
|
36
|
-
const prev = axis.current;
|
|
37
|
-
const prevTime = info.time;
|
|
38
|
-
axis.current = element[`scroll${position}`];
|
|
39
|
-
axis.scrollLength = element[`scroll${length}`] - element[`client${length}`];
|
|
40
|
-
axis.offset.length = 0;
|
|
41
|
-
axis.offset[0] = 0;
|
|
42
|
-
axis.offset[1] = axis.scrollLength;
|
|
43
|
-
axis.progress = progress(0, axis.scrollLength, axis.current);
|
|
44
|
-
const elapsed = time - prevTime;
|
|
45
|
-
axis.velocity =
|
|
46
|
-
elapsed > maxElapsed
|
|
47
|
-
? 0
|
|
48
|
-
: velocityPerSecond(axis.current - prev, elapsed);
|
|
49
|
-
}
|
|
50
|
-
function updateScrollInfo(element, info, time) {
|
|
51
|
-
updateAxisInfo(element, "x", info, time);
|
|
52
|
-
updateAxisInfo(element, "y", info, time);
|
|
53
|
-
info.time = time;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export { createScrollInfo, updateScrollInfo };
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
const namedEdges = {
|
|
2
|
-
start: 0,
|
|
3
|
-
center: 0.5,
|
|
4
|
-
end: 1,
|
|
5
|
-
};
|
|
6
|
-
function resolveEdge(edge, length, inset = 0) {
|
|
7
|
-
let delta = 0;
|
|
8
|
-
/**
|
|
9
|
-
* If we have this edge defined as a preset, replace the definition
|
|
10
|
-
* with the numerical value.
|
|
11
|
-
*/
|
|
12
|
-
if (edge in namedEdges) {
|
|
13
|
-
edge = namedEdges[edge];
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Handle unit values
|
|
17
|
-
*/
|
|
18
|
-
if (typeof edge === "string") {
|
|
19
|
-
const asNumber = parseFloat(edge);
|
|
20
|
-
if (edge.endsWith("px")) {
|
|
21
|
-
delta = asNumber;
|
|
22
|
-
}
|
|
23
|
-
else if (edge.endsWith("%")) {
|
|
24
|
-
edge = asNumber / 100;
|
|
25
|
-
}
|
|
26
|
-
else if (edge.endsWith("vw")) {
|
|
27
|
-
delta = (asNumber / 100) * document.documentElement.clientWidth;
|
|
28
|
-
}
|
|
29
|
-
else if (edge.endsWith("vh")) {
|
|
30
|
-
delta = (asNumber / 100) * document.documentElement.clientHeight;
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
edge = asNumber;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* If the edge is defined as a number, handle as a progress value.
|
|
38
|
-
*/
|
|
39
|
-
if (typeof edge === "number") {
|
|
40
|
-
delta = length * edge;
|
|
41
|
-
}
|
|
42
|
-
return inset + delta;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export { namedEdges, resolveEdge };
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { calcInset } from './inset.mjs';
|
|
2
|
-
import { resolveOffset } from './offset.mjs';
|
|
3
|
-
import { ScrollOffset } from './presets.mjs';
|
|
4
|
-
import { interpolate } from '../../../../../../../motion-dom/dist/es/utils/interpolate.mjs';
|
|
5
|
-
import { defaultOffset } from '../../../../../../../motion-dom/dist/es/animation/keyframes/offsets/default.mjs';
|
|
6
|
-
import { clamp } from '../../../../../../../motion-utils/dist/es/clamp.mjs';
|
|
7
|
-
|
|
8
|
-
const point = { x: 0, y: 0 };
|
|
9
|
-
function getTargetSize(target) {
|
|
10
|
-
return "getBBox" in target && target.tagName !== "svg"
|
|
11
|
-
? target.getBBox()
|
|
12
|
-
: { width: target.clientWidth, height: target.clientHeight };
|
|
13
|
-
}
|
|
14
|
-
function resolveOffsets(container, info, options) {
|
|
15
|
-
const { offset: offsetDefinition = ScrollOffset.All } = options;
|
|
16
|
-
const { target = container, axis = "y" } = options;
|
|
17
|
-
const lengthLabel = axis === "y" ? "height" : "width";
|
|
18
|
-
const inset = target !== container ? calcInset(target, container) : point;
|
|
19
|
-
/**
|
|
20
|
-
* Measure the target and container. If they're the same thing then we
|
|
21
|
-
* use the container's scrollWidth/Height as the target, from there
|
|
22
|
-
* all other calculations can remain the same.
|
|
23
|
-
*/
|
|
24
|
-
const targetSize = target === container
|
|
25
|
-
? { width: container.scrollWidth, height: container.scrollHeight }
|
|
26
|
-
: getTargetSize(target);
|
|
27
|
-
const containerSize = {
|
|
28
|
-
width: container.clientWidth,
|
|
29
|
-
height: container.clientHeight,
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Reset the length of the resolved offset array rather than creating a new one.
|
|
33
|
-
* TODO: More reusable data structures for targetSize/containerSize would also be good.
|
|
34
|
-
*/
|
|
35
|
-
info[axis].offset.length = 0;
|
|
36
|
-
/**
|
|
37
|
-
* Populate the offset array by resolving the user's offset definition into
|
|
38
|
-
* a list of pixel scroll offets.
|
|
39
|
-
*/
|
|
40
|
-
let hasChanged = !info[axis].interpolate;
|
|
41
|
-
const numOffsets = offsetDefinition.length;
|
|
42
|
-
for (let i = 0; i < numOffsets; i++) {
|
|
43
|
-
const offset = resolveOffset(offsetDefinition[i], containerSize[lengthLabel], targetSize[lengthLabel], inset[axis]);
|
|
44
|
-
if (!hasChanged && offset !== info[axis].interpolatorOffsets[i]) {
|
|
45
|
-
hasChanged = true;
|
|
46
|
-
}
|
|
47
|
-
info[axis].offset[i] = offset;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* If the pixel scroll offsets have changed, create a new interpolator function
|
|
51
|
-
* to map scroll value into a progress.
|
|
52
|
-
*/
|
|
53
|
-
if (hasChanged) {
|
|
54
|
-
info[axis].interpolate = interpolate(info[axis].offset, defaultOffset(offsetDefinition), { clamp: false });
|
|
55
|
-
info[axis].interpolatorOffsets = [...info[axis].offset];
|
|
56
|
-
}
|
|
57
|
-
info[axis].progress = clamp(0, 1, info[axis].interpolate(info[axis].current));
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export { resolveOffsets };
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { isHTMLElement } from '../../../../../../../motion-dom/dist/es/utils/is-html-element.mjs';
|
|
2
|
-
|
|
3
|
-
function calcInset(element, container) {
|
|
4
|
-
const inset = { x: 0, y: 0 };
|
|
5
|
-
let current = element;
|
|
6
|
-
while (current && current !== container) {
|
|
7
|
-
if (isHTMLElement(current)) {
|
|
8
|
-
inset.x += current.offsetLeft;
|
|
9
|
-
inset.y += current.offsetTop;
|
|
10
|
-
current = current.offsetParent;
|
|
11
|
-
}
|
|
12
|
-
else if (current.tagName === "svg") {
|
|
13
|
-
/**
|
|
14
|
-
* This isn't an ideal approach to measuring the offset of <svg /> tags.
|
|
15
|
-
* It would be preferable, given they behave like HTMLElements in most ways
|
|
16
|
-
* to use offsetLeft/Top. But these don't exist on <svg />. Likewise we
|
|
17
|
-
* can't use .getBBox() like most SVG elements as these provide the offset
|
|
18
|
-
* relative to the SVG itself, which for <svg /> is usually 0x0.
|
|
19
|
-
*/
|
|
20
|
-
const svgBoundingBox = current.getBoundingClientRect();
|
|
21
|
-
current = current.parentElement;
|
|
22
|
-
const parentBoundingBox = current.getBoundingClientRect();
|
|
23
|
-
inset.x += svgBoundingBox.left - parentBoundingBox.left;
|
|
24
|
-
inset.y += svgBoundingBox.top - parentBoundingBox.top;
|
|
25
|
-
}
|
|
26
|
-
else if (current instanceof SVGGraphicsElement) {
|
|
27
|
-
const { x, y } = current.getBBox();
|
|
28
|
-
inset.x += x;
|
|
29
|
-
inset.y += y;
|
|
30
|
-
let svg = null;
|
|
31
|
-
let parent = current.parentNode;
|
|
32
|
-
while (!svg) {
|
|
33
|
-
if (parent.tagName === "svg") {
|
|
34
|
-
svg = parent;
|
|
35
|
-
}
|
|
36
|
-
parent = current.parentNode;
|
|
37
|
-
}
|
|
38
|
-
current = svg;
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return inset;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export { calcInset };
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { resolveEdge, namedEdges } from './edge.mjs';
|
|
2
|
-
|
|
3
|
-
const defaultOffset = [0, 0];
|
|
4
|
-
function resolveOffset(offset, containerLength, targetLength, targetInset) {
|
|
5
|
-
let offsetDefinition = Array.isArray(offset) ? offset : defaultOffset;
|
|
6
|
-
let targetPoint = 0;
|
|
7
|
-
let containerPoint = 0;
|
|
8
|
-
if (typeof offset === "number") {
|
|
9
|
-
/**
|
|
10
|
-
* If we're provided offset: [0, 0.5, 1] then each number x should become
|
|
11
|
-
* [x, x], so we default to the behaviour of mapping 0 => 0 of both target
|
|
12
|
-
* and container etc.
|
|
13
|
-
*/
|
|
14
|
-
offsetDefinition = [offset, offset];
|
|
15
|
-
}
|
|
16
|
-
else if (typeof offset === "string") {
|
|
17
|
-
offset = offset.trim();
|
|
18
|
-
if (offset.includes(" ")) {
|
|
19
|
-
offsetDefinition = offset.split(" ");
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
/**
|
|
23
|
-
* If we're provided a definition like "100px" then we want to apply
|
|
24
|
-
* that only to the top of the target point, leaving the container at 0.
|
|
25
|
-
* Whereas a named offset like "end" should be applied to both.
|
|
26
|
-
*/
|
|
27
|
-
offsetDefinition = [offset, namedEdges[offset] ? offset : `0`];
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
targetPoint = resolveEdge(offsetDefinition[0], targetLength, targetInset);
|
|
31
|
-
containerPoint = resolveEdge(offsetDefinition[1], containerLength);
|
|
32
|
-
return targetPoint - containerPoint;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export { resolveOffset };
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { updateScrollInfo } from './info.mjs';
|
|
2
|
-
import { resolveOffsets } from './offsets/index.mjs';
|
|
3
|
-
import { warnOnce } from '../../../../../../motion-utils/dist/es/warn-once.mjs';
|
|
4
|
-
|
|
5
|
-
function measure(container, target = container, info) {
|
|
6
|
-
/**
|
|
7
|
-
* Find inset of target within scrollable container
|
|
8
|
-
*/
|
|
9
|
-
info.x.targetOffset = 0;
|
|
10
|
-
info.y.targetOffset = 0;
|
|
11
|
-
if (target !== container) {
|
|
12
|
-
let node = target;
|
|
13
|
-
while (node && node !== container) {
|
|
14
|
-
info.x.targetOffset += node.offsetLeft;
|
|
15
|
-
info.y.targetOffset += node.offsetTop;
|
|
16
|
-
node = node.offsetParent;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
info.x.targetLength =
|
|
20
|
-
target === container ? target.scrollWidth : target.clientWidth;
|
|
21
|
-
info.y.targetLength =
|
|
22
|
-
target === container ? target.scrollHeight : target.clientHeight;
|
|
23
|
-
info.x.containerLength = container.clientWidth;
|
|
24
|
-
info.y.containerLength = container.clientHeight;
|
|
25
|
-
/**
|
|
26
|
-
* In development mode ensure scroll containers aren't position: static as this makes
|
|
27
|
-
* it difficult to measure their relative positions.
|
|
28
|
-
*/
|
|
29
|
-
if (process.env.NODE_ENV !== "production") {
|
|
30
|
-
if (container && target && target !== container) {
|
|
31
|
-
warnOnce(getComputedStyle(container).position !== "static", "Please ensure that the container has a non-static position, like 'relative', 'fixed', or 'absolute' to ensure scroll offset is calculated correctly.");
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
function createOnScrollHandler(element, onScroll, info, options = {}) {
|
|
36
|
-
return {
|
|
37
|
-
measure: (time) => {
|
|
38
|
-
measure(element, options.target, info);
|
|
39
|
-
updateScrollInfo(element, info, time);
|
|
40
|
-
if (options.offset || options.target) {
|
|
41
|
-
resolveOffsets(element, info, options);
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
notify: () => onScroll(info),
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export { createOnScrollHandler };
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { createScrollInfo } from './info.mjs';
|
|
2
|
-
import { createOnScrollHandler } from './on-scroll-handler.mjs';
|
|
3
|
-
import { noop } from '../../../../../../motion-utils/dist/es/noop.mjs';
|
|
4
|
-
import { resize } from '../../../../../../motion-dom/dist/es/resize/index.mjs';
|
|
5
|
-
import { frame, cancelFrame, frameData } from '../../../../../../motion-dom/dist/es/frameloop/frame.mjs';
|
|
6
|
-
|
|
7
|
-
const scrollListeners = new WeakMap();
|
|
8
|
-
const resizeListeners = new WeakMap();
|
|
9
|
-
const onScrollHandlers = new WeakMap();
|
|
10
|
-
const getEventTarget = (element) => element === document.scrollingElement ? window : element;
|
|
11
|
-
function scrollInfo(onScroll, { container = document.scrollingElement, ...options } = {}) {
|
|
12
|
-
if (!container)
|
|
13
|
-
return noop;
|
|
14
|
-
let containerHandlers = onScrollHandlers.get(container);
|
|
15
|
-
/**
|
|
16
|
-
* Get the onScroll handlers for this container.
|
|
17
|
-
* If one isn't found, create a new one.
|
|
18
|
-
*/
|
|
19
|
-
if (!containerHandlers) {
|
|
20
|
-
containerHandlers = new Set();
|
|
21
|
-
onScrollHandlers.set(container, containerHandlers);
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Create a new onScroll handler for the provided callback.
|
|
25
|
-
*/
|
|
26
|
-
const info = createScrollInfo();
|
|
27
|
-
const containerHandler = createOnScrollHandler(container, onScroll, info, options);
|
|
28
|
-
containerHandlers.add(containerHandler);
|
|
29
|
-
/**
|
|
30
|
-
* Check if there's a scroll event listener for this container.
|
|
31
|
-
* If not, create one.
|
|
32
|
-
*/
|
|
33
|
-
if (!scrollListeners.has(container)) {
|
|
34
|
-
const measureAll = () => {
|
|
35
|
-
for (const handler of containerHandlers) {
|
|
36
|
-
handler.measure(frameData.timestamp);
|
|
37
|
-
}
|
|
38
|
-
frame.preUpdate(notifyAll);
|
|
39
|
-
};
|
|
40
|
-
const notifyAll = () => {
|
|
41
|
-
for (const handler of containerHandlers) {
|
|
42
|
-
handler.notify();
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
const listener = () => frame.read(measureAll);
|
|
46
|
-
scrollListeners.set(container, listener);
|
|
47
|
-
const target = getEventTarget(container);
|
|
48
|
-
window.addEventListener("resize", listener, { passive: true });
|
|
49
|
-
if (container !== document.documentElement) {
|
|
50
|
-
resizeListeners.set(container, resize(container, listener));
|
|
51
|
-
}
|
|
52
|
-
target.addEventListener("scroll", listener, { passive: true });
|
|
53
|
-
listener();
|
|
54
|
-
}
|
|
55
|
-
const listener = scrollListeners.get(container);
|
|
56
|
-
frame.read(listener, false, true);
|
|
57
|
-
return () => {
|
|
58
|
-
cancelFrame(listener);
|
|
59
|
-
/**
|
|
60
|
-
* Check if we even have any handlers for this container.
|
|
61
|
-
*/
|
|
62
|
-
const currentHandlers = onScrollHandlers.get(container);
|
|
63
|
-
if (!currentHandlers)
|
|
64
|
-
return;
|
|
65
|
-
currentHandlers.delete(containerHandler);
|
|
66
|
-
if (currentHandlers.size)
|
|
67
|
-
return;
|
|
68
|
-
/**
|
|
69
|
-
* If no more handlers, remove the scroll listener too.
|
|
70
|
-
*/
|
|
71
|
-
const scrollListener = scrollListeners.get(container);
|
|
72
|
-
scrollListeners.delete(container);
|
|
73
|
-
if (scrollListener) {
|
|
74
|
-
getEventTarget(container).removeEventListener("scroll", scrollListener);
|
|
75
|
-
resizeListeners.get(container)?.();
|
|
76
|
-
window.removeEventListener("resize", scrollListener);
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export { scrollInfo };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { scrollInfo } from '../track.mjs';
|
|
2
|
-
import { supportsScrollTimeline } from '../../../../../../../motion-dom/dist/es/utils/supports/scroll-timeline.mjs';
|
|
3
|
-
|
|
4
|
-
const timelineCache = new Map();
|
|
5
|
-
function scrollTimelineFallback(options) {
|
|
6
|
-
const currentTime = { value: 0 };
|
|
7
|
-
const cancel = scrollInfo((info) => {
|
|
8
|
-
currentTime.value = info[options.axis].progress * 100;
|
|
9
|
-
}, options);
|
|
10
|
-
return { currentTime, cancel };
|
|
11
|
-
}
|
|
12
|
-
function getTimeline({ source, container, ...options }) {
|
|
13
|
-
const { axis } = options;
|
|
14
|
-
if (source)
|
|
15
|
-
container = source;
|
|
16
|
-
const containerCache = timelineCache.get(container) ?? new Map();
|
|
17
|
-
timelineCache.set(container, containerCache);
|
|
18
|
-
const targetKey = options.target ?? "self";
|
|
19
|
-
const targetCache = containerCache.get(targetKey) ?? {};
|
|
20
|
-
const axisKey = axis + (options.offset ?? []).join(",");
|
|
21
|
-
if (!targetCache[axisKey]) {
|
|
22
|
-
targetCache[axisKey] =
|
|
23
|
-
!options.target && supportsScrollTimeline()
|
|
24
|
-
? new ScrollTimeline({ source: container, axis })
|
|
25
|
-
: scrollTimelineFallback({ container, ...options });
|
|
26
|
-
}
|
|
27
|
-
return targetCache[axisKey];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export { getTimeline };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Fragment, useMemo, createElement } from 'react';
|
|
2
|
-
import { useHTMLProps } from '../html/use-props.mjs';
|
|
3
|
-
import { useSVGProps } from '../svg/use-props.mjs';
|
|
4
|
-
import { filterProps } from './utils/filter-props.mjs';
|
|
5
|
-
import { isSVGComponent } from './utils/is-svg-component.mjs';
|
|
6
|
-
import { isMotionValue } from '../../../../../motion-dom/dist/es/value/utils/is-motion-value.mjs';
|
|
7
|
-
|
|
8
|
-
function createUseRender(forwardMotionProps = false) {
|
|
9
|
-
const useRender = (Component, props, ref, { latestValues }, isStatic) => {
|
|
10
|
-
const useVisualProps = isSVGComponent(Component)
|
|
11
|
-
? useSVGProps
|
|
12
|
-
: useHTMLProps;
|
|
13
|
-
const visualProps = useVisualProps(props, latestValues, isStatic, Component);
|
|
14
|
-
const filteredProps = filterProps(props, typeof Component === "string", forwardMotionProps);
|
|
15
|
-
const elementProps = Component !== Fragment
|
|
16
|
-
? { ...filteredProps, ...visualProps, ref }
|
|
17
|
-
: {};
|
|
18
|
-
/**
|
|
19
|
-
* If component has been handed a motion value as its child,
|
|
20
|
-
* memoise its initial value and render that. Subsequent updates
|
|
21
|
-
* will be handled by the onChange handler
|
|
22
|
-
*/
|
|
23
|
-
const { children } = props;
|
|
24
|
-
const renderedChildren = useMemo(() => (isMotionValue(children) ? children.get() : children), [children]);
|
|
25
|
-
return createElement(Component, {
|
|
26
|
-
...elementProps,
|
|
27
|
-
children: renderedChildren,
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
return useRender;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export { createUseRender };
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { isValidMotionProp } from '../../../motion/utils/valid-prop.mjs';
|
|
2
|
-
|
|
3
|
-
let shouldForward = (key) => !isValidMotionProp(key);
|
|
4
|
-
function loadExternalIsValidProp(isValidProp) {
|
|
5
|
-
if (typeof isValidProp !== "function")
|
|
6
|
-
return;
|
|
7
|
-
// Explicitly filter our events
|
|
8
|
-
shouldForward = (key) => key.startsWith("on") ? !isValidMotionProp(key) : isValidProp(key);
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Emotion and Styled Components both allow users to pass through arbitrary props to their components
|
|
12
|
-
* to dynamically generate CSS. They both use the `@emotion/is-prop-valid` package to determine which
|
|
13
|
-
* of these should be passed to the underlying DOM node.
|
|
14
|
-
*
|
|
15
|
-
* However, when styling a Motion component `styled(motion.div)`, both packages pass through *all* props
|
|
16
|
-
* as it's seen as an arbitrary component rather than a DOM node. Motion only allows arbitrary props
|
|
17
|
-
* passed through the `custom` prop so it doesn't *need* the payload or computational overhead of
|
|
18
|
-
* `@emotion/is-prop-valid`, however to fix this problem we need to use it.
|
|
19
|
-
*
|
|
20
|
-
* By making it an optionalDependency we can offer this functionality only in the situations where it's
|
|
21
|
-
* actually required.
|
|
22
|
-
*/
|
|
23
|
-
try {
|
|
24
|
-
/**
|
|
25
|
-
* We attempt to import this package but require won't be defined in esm environments, in that case
|
|
26
|
-
* isPropValid will have to be provided via `MotionContext`. In a 6.0.0 this should probably be removed
|
|
27
|
-
* in favour of explicit injection.
|
|
28
|
-
*/
|
|
29
|
-
loadExternalIsValidProp(require("@emotion/is-prop-valid").default);
|
|
30
|
-
}
|
|
31
|
-
catch {
|
|
32
|
-
// We don't need to actually do anything here - the fallback is the existing `isPropValid`.
|
|
33
|
-
}
|
|
34
|
-
function filterProps(props, isDom, forwardMotionProps) {
|
|
35
|
-
const filteredProps = {};
|
|
36
|
-
for (const key in props) {
|
|
37
|
-
/**
|
|
38
|
-
* values is considered a valid prop by Emotion, so if it's present
|
|
39
|
-
* this will be rendered out to the DOM unless explicitly filtered.
|
|
40
|
-
*
|
|
41
|
-
* We check the type as it could be used with the `feColorMatrix`
|
|
42
|
-
* element, which we support.
|
|
43
|
-
*/
|
|
44
|
-
if (key === "values" && typeof props.values === "object")
|
|
45
|
-
continue;
|
|
46
|
-
if (shouldForward(key) ||
|
|
47
|
-
(forwardMotionProps === true && isValidMotionProp(key)) ||
|
|
48
|
-
(!isDom && !isValidMotionProp(key)) ||
|
|
49
|
-
// If trying to use native HTML drag events, forward drag listeners
|
|
50
|
-
(props["draggable"] &&
|
|
51
|
-
key.startsWith("onDrag"))) {
|
|
52
|
-
filteredProps[key] =
|
|
53
|
-
props[key];
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return filteredProps;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export { filterProps, loadExternalIsValidProp };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { lowercaseSVGElements } from '../../svg/lowercase-elements.mjs';
|
|
2
|
-
|
|
3
|
-
function isSVGComponent(Component) {
|
|
4
|
-
if (
|
|
5
|
-
/**
|
|
6
|
-
* If it's not a string, it's a custom React component. Currently we only support
|
|
7
|
-
* HTML custom React components.
|
|
8
|
-
*/
|
|
9
|
-
typeof Component !== "string" ||
|
|
10
|
-
/**
|
|
11
|
-
* If it contains a dash, the element is a custom HTML webcomponent.
|
|
12
|
-
*/
|
|
13
|
-
Component.includes("-")) {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
else if (
|
|
17
|
-
/**
|
|
18
|
-
* If it's in our list of lowercase SVG tags, it's an SVG component
|
|
19
|
-
*/
|
|
20
|
-
lowercaseSVGElements.indexOf(Component) > -1 ||
|
|
21
|
-
/**
|
|
22
|
-
* If it contains a capital letter, it's an SVG component
|
|
23
|
-
*/
|
|
24
|
-
/[A-Z]/u.test(Component)) {
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export { isSVGComponent };
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { resolveElements } from '../../../../../../motion-dom/dist/es/utils/resolve-elements.mjs';
|
|
2
|
-
|
|
3
|
-
const thresholds = {
|
|
4
|
-
some: 0,
|
|
5
|
-
all: 1,
|
|
6
|
-
};
|
|
7
|
-
function inView(elementOrSelector, onStart, { root, margin: rootMargin, amount = "some" } = {}) {
|
|
8
|
-
const elements = resolveElements(elementOrSelector);
|
|
9
|
-
const activeIntersections = new WeakMap();
|
|
10
|
-
const onIntersectionChange = (entries) => {
|
|
11
|
-
entries.forEach((entry) => {
|
|
12
|
-
const onEnd = activeIntersections.get(entry.target);
|
|
13
|
-
/**
|
|
14
|
-
* If there's no change to the intersection, we don't need to
|
|
15
|
-
* do anything here.
|
|
16
|
-
*/
|
|
17
|
-
if (entry.isIntersecting === Boolean(onEnd))
|
|
18
|
-
return;
|
|
19
|
-
if (entry.isIntersecting) {
|
|
20
|
-
const newOnEnd = onStart(entry.target, entry);
|
|
21
|
-
if (typeof newOnEnd === "function") {
|
|
22
|
-
activeIntersections.set(entry.target, newOnEnd);
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
observer.unobserve(entry.target);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
else if (typeof onEnd === "function") {
|
|
29
|
-
onEnd(entry);
|
|
30
|
-
activeIntersections.delete(entry.target);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
const observer = new IntersectionObserver(onIntersectionChange, {
|
|
35
|
-
root,
|
|
36
|
-
rootMargin,
|
|
37
|
-
threshold: typeof amount === "number" ? amount : thresholds[amount],
|
|
38
|
-
});
|
|
39
|
-
elements.forEach((element) => observer.observe(element));
|
|
40
|
-
return () => observer.disconnect();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export { inView };
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { measureViewportBox } from '../../projection/utils/measure.mjs';
|
|
2
|
-
import { DOMVisualElement } from '../dom/DOMVisualElement.mjs';
|
|
3
|
-
import { buildHTMLStyles } from './utils/build-styles.mjs';
|
|
4
|
-
import { renderHTML } from './utils/render.mjs';
|
|
5
|
-
import { scrapeMotionValuesFromProps } from './utils/scrape-motion-values.mjs';
|
|
6
|
-
import { transformProps } from '../../../../../motion-dom/dist/es/render/utils/keys-transform.mjs';
|
|
7
|
-
import { defaultTransformValue, readTransformValue } from '../../../../../motion-dom/dist/es/render/dom/parse-transform.mjs';
|
|
8
|
-
import { isCSSVariableName } from '../../../../../motion-dom/dist/es/animation/utils/is-css-variable.mjs';
|
|
9
|
-
|
|
10
|
-
function getComputedStyle(element) {
|
|
11
|
-
return window.getComputedStyle(element);
|
|
12
|
-
}
|
|
13
|
-
class HTMLVisualElement extends DOMVisualElement {
|
|
14
|
-
constructor() {
|
|
15
|
-
super(...arguments);
|
|
16
|
-
this.type = "html";
|
|
17
|
-
this.renderInstance = renderHTML;
|
|
18
|
-
}
|
|
19
|
-
readValueFromInstance(instance, key) {
|
|
20
|
-
if (transformProps.has(key)) {
|
|
21
|
-
return this.projection?.isProjecting
|
|
22
|
-
? defaultTransformValue(key)
|
|
23
|
-
: readTransformValue(instance, key);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
const computedStyle = getComputedStyle(instance);
|
|
27
|
-
const value = (isCSSVariableName(key)
|
|
28
|
-
? computedStyle.getPropertyValue(key)
|
|
29
|
-
: computedStyle[key]) || 0;
|
|
30
|
-
return typeof value === "string" ? value.trim() : value;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
measureInstanceViewportBox(instance, { transformPagePoint }) {
|
|
34
|
-
return measureViewportBox(instance, transformPagePoint);
|
|
35
|
-
}
|
|
36
|
-
build(renderState, latestValues, props) {
|
|
37
|
-
buildHTMLStyles(renderState, latestValues, props.transformTemplate);
|
|
38
|
-
}
|
|
39
|
-
scrapeMotionValuesFromProps(props, prevProps, visualElement) {
|
|
40
|
-
return scrapeMotionValuesFromProps(props, prevProps, visualElement);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export { HTMLVisualElement, getComputedStyle };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { makeUseVisualState } from '../../motion/utils/use-visual-state.mjs';
|
|
2
|
-
import { scrapeMotionValuesFromProps } from './utils/scrape-motion-values.mjs';
|
|
3
|
-
import { createHtmlRenderState } from './utils/create-render-state.mjs';
|
|
4
|
-
|
|
5
|
-
const htmlMotionConfig = {
|
|
6
|
-
useVisualState: makeUseVisualState({
|
|
7
|
-
scrapeMotionValuesFromProps,
|
|
8
|
-
createRenderState: createHtmlRenderState,
|
|
9
|
-
}),
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export { htmlMotionConfig };
|