motion-v 0.3.1-beta.1 → 0.4.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/index.js +1826 -47
- package/dist/es/animation/use-animate.mjs +1 -1
- package/dist/es/components/LayoutGroup.vue.mjs +39 -0
- package/dist/es/components/LayoutGroup.vue2.mjs +4 -0
- package/dist/es/components/Motion.vue.mjs +22 -10
- package/dist/es/components/context.mjs +12 -1
- package/dist/es/components/group.mjs +30 -0
- package/dist/es/components/use-force-update.mjs +11 -0
- package/dist/es/constants/index.mjs +8 -2
- package/dist/es/features/events.mjs +2 -2
- package/dist/es/features/feature-manager.mjs +3 -1
- package/dist/es/features/gestures/hover.mjs +1 -1
- package/dist/es/features/gestures/in-view.mjs +2 -2
- package/dist/es/features/gestures/press.mjs +1 -1
- package/dist/es/features/layout/config.mjs +21 -0
- package/dist/es/features/layout/layout.mjs +74 -0
- package/dist/es/features/layout/utils.mjs +8 -0
- package/dist/es/features/svg.mjs +2 -2
- package/dist/es/index.mjs +47 -30
- package/dist/es/node_modules/.pnpm/@vueuse_shared@12.0.0_typescript@5.5.4/node_modules/@vueuse/shared/index.mjs +6 -0
- package/dist/es/node_modules/.pnpm/framer-motion@11.11.11/node_modules/framer-motion/dist/es/events/add-dom-event.mjs +7 -0
- package/dist/es/node_modules/.pnpm/framer-motion@11.11.11/node_modules/framer-motion/dist/es/frameloop/microtask.mjs +6 -0
- package/dist/es/node_modules/.pnpm/framer-motion@11.11.11/node_modules/framer-motion/dist/es/projection/animation/mix-values.mjs +60 -0
- package/dist/es/node_modules/.pnpm/framer-motion@11.11.11/node_modules/framer-motion/dist/es/projection/geometry/copy.mjs +19 -0
- package/dist/es/node_modules/.pnpm/framer-motion@11.11.11/node_modules/framer-motion/dist/es/projection/geometry/delta-apply.mjs +81 -0
- package/dist/es/node_modules/.pnpm/framer-motion@11.11.11/node_modules/framer-motion/dist/es/projection/geometry/delta-calc.mjs +55 -0
- package/dist/es/node_modules/.pnpm/framer-motion@11.11.11/node_modules/framer-motion/dist/es/projection/geometry/delta-remove.mjs +40 -0
- package/dist/es/node_modules/.pnpm/framer-motion@11.11.11/node_modules/framer-motion/dist/es/projection/geometry/models.mjs +21 -0
- package/dist/es/node_modules/.pnpm/framer-motion@11.11.11/node_modules/framer-motion/dist/es/projection/geometry/utils.mjs +34 -0
- package/dist/es/node_modules/.pnpm/framer-motion@11.11.11/node_modules/framer-motion/dist/es/projection/node/DocumentProjectionNode.mjs +13 -0
- package/dist/es/node_modules/.pnpm/framer-motion@11.11.11/node_modules/framer-motion/dist/es/projection/node/HTMLProjectionNode.mjs +28 -0
- package/dist/es/node_modules/.pnpm/framer-motion@11.11.11/node_modules/framer-motion/dist/es/projection/node/create-projection-node.mjs +1086 -0
- package/dist/es/node_modules/.pnpm/framer-motion@11.11.11/node_modules/framer-motion/dist/es/projection/node/state.mjs +15 -0
- package/dist/es/node_modules/.pnpm/framer-motion@11.11.11/node_modules/framer-motion/dist/es/projection/shared/stack.mjs +94 -0
- package/dist/es/node_modules/.pnpm/framer-motion@11.11.11/node_modules/framer-motion/dist/es/projection/styles/scale-border-radius.mjs +26 -0
- package/dist/es/node_modules/.pnpm/framer-motion@11.11.11/node_modules/framer-motion/dist/es/projection/styles/scale-box-shadow.mjs +25 -0
- package/dist/es/node_modules/.pnpm/framer-motion@11.11.11/node_modules/framer-motion/dist/es/projection/styles/scale-correction.mjs +8 -0
- package/dist/es/node_modules/.pnpm/framer-motion@11.11.11/node_modules/framer-motion/dist/es/projection/styles/transform.mjs +36 -0
- package/dist/es/node_modules/.pnpm/framer-motion@11.11.11/node_modules/framer-motion/dist/es/projection/utils/each-axis.mjs +6 -0
- package/dist/es/node_modules/.pnpm/framer-motion@11.11.11/node_modules/framer-motion/dist/es/projection/utils/has-transform.mjs +20 -0
- package/dist/es/node_modules/.pnpm/framer-motion@11.11.11/node_modules/framer-motion/dist/es/render/utils/compare-by-depth.mjs +4 -0
- package/dist/es/node_modules/.pnpm/framer-motion@11.11.11/node_modules/framer-motion/dist/es/render/utils/flat-tree.mjs +24 -0
- package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/resolve-value.mjs +4 -0
- package/dist/es/node_modules/.pnpm/framer-motion@11.11.11/node_modules/framer-motion/dist/es/value/utils/resolve-motion-value.mjs +9 -0
- package/dist/es/state/create-visual-element.mjs +9 -0
- package/dist/es/state/motion-state.mjs +27 -14
- package/dist/es/state/style.mjs +2 -2
- package/dist/es/state/transform.mjs +0 -1
- package/dist/es/utils/use-animation-frame.mjs +1 -1
- package/dist/es/utils/use-in-view.mjs +1 -1
- package/dist/es/value/use-combine-values.mjs +2 -2
- package/dist/es/value/use-computed.mjs +1 -1
- package/dist/es/value/use-motion-value-event.mjs +11 -0
- package/dist/es/value/use-scroll.mjs +3 -3
- package/dist/es/value/use-spring.mjs +3 -3
- package/dist/es/value/use-time.mjs +1 -1
- package/dist/es/value/use-transform.mjs +1 -1
- package/dist/es/value/use-velocity.mjs +20 -0
- package/dist/src/components/LayoutGroup.d.ts +30 -0
- package/dist/src/components/context.d.ts +17 -0
- package/dist/src/components/group.d.ts +7 -0
- package/dist/src/components/use-force-update.d.ts +2 -0
- package/dist/src/features/index.d.ts +1 -0
- package/dist/src/features/layout/config.d.ts +8 -0
- package/dist/src/features/layout/layout.d.ts +10 -0
- package/dist/src/features/layout/types.d.ts +7 -0
- package/dist/src/features/layout/utils.d.ts +4 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/state/create-visual-element.d.ts +1 -0
- package/dist/src/state/motion-state.d.ts +1 -2
- package/dist/src/types/state.d.ts +2 -1
- package/dist/src/value/index.d.ts +4 -0
- package/package.json +1 -1
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/projection/geometry/models.mjs +0 -9
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/projection/styles/scale-correction.mjs +0 -4
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/GroupPlaybackControls.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/animate/index.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/animate/resolve-subjects.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/animate/sequence.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/animate/single-value.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/animate/subject.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/animators/AcceleratedAnimation.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/animators/BaseAnimation.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/animators/MainThreadAnimation.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/animators/drivers/driver-frameloop.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/animators/utils/accelerated-values.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/animators/utils/can-animate.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/animators/waapi/NativeAnimation.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/animators/waapi/animate-elements.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/animators/waapi/animate-style.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/animators/waapi/easing.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/animators/waapi/index.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/animators/waapi/utils/attach-timeline.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/animators/waapi/utils/get-final-keyframe.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/animators/waapi/utils/linear.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/animators/waapi/utils/memo-supports.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/animators/waapi/utils/style.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/animators/waapi/utils/supports-flags.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/animators/waapi/utils/supports-linear-easing.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/animators/waapi/utils/supports-partial-keyframes.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/animators/waapi/utils/supports-waapi.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/generators/inertia.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/generators/keyframes.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/generators/spring/find.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/generators/spring/index.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/generators/utils/calc-duration.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/generators/utils/is-generator.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/generators/utils/velocity.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/interfaces/motion-value.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/interfaces/visual-element-target.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/optimized-appear/data-id.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/optimized-appear/get-appear-id.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/sequence/create.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/sequence/utils/calc-time.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/sequence/utils/edit.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/sequence/utils/sort.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/utils/create-visual-element.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/utils/default-transitions.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/utils/get-value-transition.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/utils/is-animatable.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/utils/is-animation-controls.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/utils/is-dom-keyframes.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/utils/is-keyframes-target.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/utils/is-none.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/utils/is-transition-defined.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/animation/utils/stagger.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/easing/anticipate.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/easing/back.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/easing/circ.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/easing/cubic-bezier.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/easing/ease.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/easing/modifiers/mirror.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/easing/modifiers/reverse.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/easing/steps.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/easing/utils/create-generator-easing.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/easing/utils/get-easing-for-segment.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/easing/utils/is-bezier-definition.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/easing/utils/is-easing-array.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/easing/utils/map.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/frameloop/batcher.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/frameloop/frame.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/frameloop/index-legacy.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/frameloop/render-step.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/frameloop/sync-time.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/motion/features/definitions.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/motion/utils/is-forced-motion-value.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/projection/geometry/conversion.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/projection/utils/measure.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/VisualElement.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/DOMKeyframesResolver.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/DOMVisualElement.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/resize/handle-element.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/resize/handle-window.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/resize/index.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/scroll/index.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/scroll/info.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/scroll/observe.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/scroll/offsets/edge.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/scroll/offsets/index.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/scroll/offsets/inset.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/scroll/offsets/offset.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/scroll/offsets/presets.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/scroll/on-scroll-handler.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/scroll/supports.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/scroll/track.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/utils/camel-to-dash.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/utils/css-variables-conversion.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/utils/is-css-variable.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/utils/is-svg-element.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/utils/resolve-element.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/utils/unit-conversion.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/value-types/animatable-none.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/value-types/defaults.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/value-types/dimensions.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/value-types/find.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/value-types/get-as-type.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/value-types/number-browser.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/value-types/number.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/value-types/test.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/value-types/transform.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/value-types/type-auto.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/value-types/type-int.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/dom/viewport/index.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/html/HTMLVisualElement.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/html/utils/build-styles.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/html/utils/build-transform.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/html/utils/make-none-animatable.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/html/utils/render.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/html/utils/scrape-motion-values.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/html/utils/transform.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/object/ObjectVisualElement.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/store.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/svg/SVGVisualElement.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/svg/utils/build-attrs.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/svg/utils/camel-case-attrs.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/svg/utils/is-svg-tag.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/svg/utils/path.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/svg/utils/render.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/svg/utils/scrape-motion-values.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/svg/utils/transform-origin.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/utils/KeyframesResolver.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/utils/is-controlling-variants.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/utils/is-variant-label.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/utils/motion-values.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/utils/resolve-dynamic-variants.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/utils/resolve-variants.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/utils/setters.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/render/utils/variant-props.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/GlobalConfig.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/array.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/clamp.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/delay.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/distance.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/errors.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/hsla-to-rgba.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/interpolate.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/is-browser.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/is-numerical-string.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/is-zero-value-string.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/memo.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/mix/color.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/mix/complex.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/mix/immediate.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/mix/index.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/mix/number.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/mix/visibility.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/noop.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/offsets/default.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/offsets/fill.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/offsets/time.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/pipe.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/progress.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/reduced-motion/index.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/reduced-motion/state.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/subscription-manager.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/time-conversion.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/transform.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/velocity-per-second.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/warn-once.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/utils/wrap.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/value/index.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/value/types/color/hex.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/value/types/color/hsla.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/value/types/color/index.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/value/types/color/rgba.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/value/types/color/utils.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/value/types/complex/filter.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/value/types/complex/index.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/value/types/numbers/index.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/value/types/numbers/units.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/value/types/utils/color-regex.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/value/types/utils/float-regex.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/value/types/utils/is-nullish.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/value/types/utils/sanitize.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/value/types/utils/single-color-regex.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/value/use-will-change/add-will-change.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/value/use-will-change/is.mjs +0 -0
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external → node_modules/.pnpm/framer-motion@11.11.11/node_modules}/framer-motion/dist/es/value/utils/is-motion-value.mjs +0 -0
- /package/dist/es/{external/.pnpm/hey-listen@1.0.8/external → node_modules/.pnpm/hey-listen@1.0.8/node_modules}/hey-listen/dist/hey-listen.es.mjs +0 -0
|
@@ -0,0 +1,1086 @@
|
|
|
1
|
+
import { SubscriptionManager } from "../../utils/subscription-manager.mjs";
|
|
2
|
+
import { mixValues } from "../animation/mix-values.mjs";
|
|
3
|
+
import { copyBoxInto, copyAxisDeltaInto } from "../geometry/copy.mjs";
|
|
4
|
+
import { translateAxis, transformBox, applyBoxDelta, applyTreeDeltas } from "../geometry/delta-apply.mjs";
|
|
5
|
+
import { calcRelativePosition, calcRelativeBox, calcBoxDelta, calcLength, isNear } from "../geometry/delta-calc.mjs";
|
|
6
|
+
import { removeBoxTransforms } from "../geometry/delta-remove.mjs";
|
|
7
|
+
import { getValueTransition } from "../../animation/utils/get-value-transition.mjs";
|
|
8
|
+
import { boxEqualsRounded, isDeltaZero, axisDeltaEquals, aspectRatio, boxEquals } from "../geometry/utils.mjs";
|
|
9
|
+
import { NodeStack } from "../shared/stack.mjs";
|
|
10
|
+
import { scaleCorrectors } from "../styles/scale-correction.mjs";
|
|
11
|
+
import { buildProjectionTransform } from "../styles/transform.mjs";
|
|
12
|
+
import { eachAxis } from "../utils/each-axis.mjs";
|
|
13
|
+
import { hasTransform, hasScale, has2DTranslate } from "../utils/has-transform.mjs";
|
|
14
|
+
import { FlatTree } from "../../render/utils/flat-tree.mjs";
|
|
15
|
+
import { resolveMotionValue } from "../../value/utils/resolve-motion-value.mjs";
|
|
16
|
+
import { globalProjectionState } from "./state.mjs";
|
|
17
|
+
import { delay } from "../../utils/delay.mjs";
|
|
18
|
+
import { mixNumber } from "../../utils/mix/number.mjs";
|
|
19
|
+
import { isSVGElement } from "../../render/dom/utils/is-svg-element.mjs";
|
|
20
|
+
import { animateSingleValue } from "../../animation/animate/single-value.mjs";
|
|
21
|
+
import { clamp } from "../../utils/clamp.mjs";
|
|
22
|
+
import { cancelFrame, frameData, frameSteps, frame } from "../../frameloop/frame.mjs";
|
|
23
|
+
import { noop } from "../../utils/noop.mjs";
|
|
24
|
+
import { time } from "../../frameloop/sync-time.mjs";
|
|
25
|
+
import { microtask } from "../../frameloop/microtask.mjs";
|
|
26
|
+
import { getOptimisedAppearId } from "../../animation/optimized-appear/get-appear-id.mjs";
|
|
27
|
+
import { createBox, createDelta } from "../geometry/models.mjs";
|
|
28
|
+
const metrics = {
|
|
29
|
+
type: "projectionFrame",
|
|
30
|
+
totalNodes: 0,
|
|
31
|
+
resolvedTargetDeltas: 0,
|
|
32
|
+
recalculatedProjection: 0
|
|
33
|
+
};
|
|
34
|
+
const isDebug = typeof window !== "undefined" && window.MotionDebug !== void 0;
|
|
35
|
+
const transformAxes = ["", "X", "Y", "Z"];
|
|
36
|
+
const hiddenVisibility = { visibility: "hidden" };
|
|
37
|
+
const animationTarget = 1e3;
|
|
38
|
+
let id = 0;
|
|
39
|
+
function resetDistortingTransform(key, visualElement, values, sharedAnimationValues) {
|
|
40
|
+
const { latestValues } = visualElement;
|
|
41
|
+
if (latestValues[key]) {
|
|
42
|
+
values[key] = latestValues[key];
|
|
43
|
+
visualElement.setStaticValue(key, 0);
|
|
44
|
+
if (sharedAnimationValues) {
|
|
45
|
+
sharedAnimationValues[key] = 0;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function cancelTreeOptimisedTransformAnimations(projectionNode) {
|
|
50
|
+
projectionNode.hasCheckedOptimisedAppear = true;
|
|
51
|
+
if (projectionNode.root === projectionNode)
|
|
52
|
+
return;
|
|
53
|
+
const { visualElement } = projectionNode.options;
|
|
54
|
+
if (!visualElement)
|
|
55
|
+
return;
|
|
56
|
+
const appearId = getOptimisedAppearId(visualElement);
|
|
57
|
+
if (window.MotionHasOptimisedAnimation(appearId, "transform")) {
|
|
58
|
+
const { layout, layoutId } = projectionNode.options;
|
|
59
|
+
window.MotionCancelOptimisedAnimation(appearId, "transform", frame, !(layout || layoutId));
|
|
60
|
+
}
|
|
61
|
+
const { parent } = projectionNode;
|
|
62
|
+
if (parent && !parent.hasCheckedOptimisedAppear) {
|
|
63
|
+
cancelTreeOptimisedTransformAnimations(parent);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function createProjectionNode({ attachResizeListener, defaultParent, measureScroll, checkIsScrollRoot, resetTransform }) {
|
|
67
|
+
return class ProjectionNode {
|
|
68
|
+
constructor(latestValues = {}, parent = defaultParent === null || defaultParent === void 0 ? void 0 : defaultParent()) {
|
|
69
|
+
this.id = id++;
|
|
70
|
+
this.animationId = 0;
|
|
71
|
+
this.children = /* @__PURE__ */ new Set();
|
|
72
|
+
this.options = {};
|
|
73
|
+
this.isTreeAnimating = false;
|
|
74
|
+
this.isAnimationBlocked = false;
|
|
75
|
+
this.isLayoutDirty = false;
|
|
76
|
+
this.isProjectionDirty = false;
|
|
77
|
+
this.isSharedProjectionDirty = false;
|
|
78
|
+
this.isTransformDirty = false;
|
|
79
|
+
this.updateManuallyBlocked = false;
|
|
80
|
+
this.updateBlockedByResize = false;
|
|
81
|
+
this.isUpdating = false;
|
|
82
|
+
this.isSVG = false;
|
|
83
|
+
this.needsReset = false;
|
|
84
|
+
this.shouldResetTransform = false;
|
|
85
|
+
this.hasCheckedOptimisedAppear = false;
|
|
86
|
+
this.treeScale = { x: 1, y: 1 };
|
|
87
|
+
this.eventHandlers = /* @__PURE__ */ new Map();
|
|
88
|
+
this.hasTreeAnimated = false;
|
|
89
|
+
this.updateScheduled = false;
|
|
90
|
+
this.scheduleUpdate = () => this.update();
|
|
91
|
+
this.projectionUpdateScheduled = false;
|
|
92
|
+
this.checkUpdateFailed = () => {
|
|
93
|
+
if (this.isUpdating) {
|
|
94
|
+
this.isUpdating = false;
|
|
95
|
+
this.clearAllSnapshots();
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
this.updateProjection = () => {
|
|
99
|
+
this.projectionUpdateScheduled = false;
|
|
100
|
+
if (isDebug) {
|
|
101
|
+
metrics.totalNodes = metrics.resolvedTargetDeltas = metrics.recalculatedProjection = 0;
|
|
102
|
+
}
|
|
103
|
+
this.nodes.forEach(propagateDirtyNodes);
|
|
104
|
+
this.nodes.forEach(resolveTargetDelta);
|
|
105
|
+
this.nodes.forEach(calcProjection);
|
|
106
|
+
this.nodes.forEach(cleanDirtyNodes);
|
|
107
|
+
if (isDebug) {
|
|
108
|
+
window.MotionDebug.record(metrics);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
this.resolvedRelativeTargetAt = 0;
|
|
112
|
+
this.hasProjected = false;
|
|
113
|
+
this.isVisible = true;
|
|
114
|
+
this.animationProgress = 0;
|
|
115
|
+
this.sharedNodes = /* @__PURE__ */ new Map();
|
|
116
|
+
this.latestValues = latestValues;
|
|
117
|
+
this.root = parent ? parent.root || parent : this;
|
|
118
|
+
this.path = parent ? [...parent.path, parent] : [];
|
|
119
|
+
this.parent = parent;
|
|
120
|
+
this.depth = parent ? parent.depth + 1 : 0;
|
|
121
|
+
for (let i = 0; i < this.path.length; i++) {
|
|
122
|
+
this.path[i].shouldResetTransform = true;
|
|
123
|
+
}
|
|
124
|
+
if (this.root === this)
|
|
125
|
+
this.nodes = new FlatTree();
|
|
126
|
+
}
|
|
127
|
+
addEventListener(name, handler) {
|
|
128
|
+
if (!this.eventHandlers.has(name)) {
|
|
129
|
+
this.eventHandlers.set(name, new SubscriptionManager());
|
|
130
|
+
}
|
|
131
|
+
return this.eventHandlers.get(name).add(handler);
|
|
132
|
+
}
|
|
133
|
+
notifyListeners(name, ...args) {
|
|
134
|
+
const subscriptionManager = this.eventHandlers.get(name);
|
|
135
|
+
subscriptionManager && subscriptionManager.notify(...args);
|
|
136
|
+
}
|
|
137
|
+
hasListeners(name) {
|
|
138
|
+
return this.eventHandlers.has(name);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Lifecycles
|
|
142
|
+
*/
|
|
143
|
+
mount(instance, isLayoutDirty = this.root.hasTreeAnimated) {
|
|
144
|
+
if (this.instance)
|
|
145
|
+
return;
|
|
146
|
+
this.isSVG = isSVGElement(instance);
|
|
147
|
+
this.instance = instance;
|
|
148
|
+
const { layoutId, layout, visualElement } = this.options;
|
|
149
|
+
if (visualElement && !visualElement.current) {
|
|
150
|
+
visualElement.mount(instance);
|
|
151
|
+
}
|
|
152
|
+
this.root.nodes.add(this);
|
|
153
|
+
this.parent && this.parent.children.add(this);
|
|
154
|
+
if (isLayoutDirty && (layout || layoutId)) {
|
|
155
|
+
this.isLayoutDirty = true;
|
|
156
|
+
}
|
|
157
|
+
if (attachResizeListener) {
|
|
158
|
+
let cancelDelay;
|
|
159
|
+
const resizeUnblockUpdate = () => this.root.updateBlockedByResize = false;
|
|
160
|
+
attachResizeListener(instance, () => {
|
|
161
|
+
this.root.updateBlockedByResize = true;
|
|
162
|
+
cancelDelay && cancelDelay();
|
|
163
|
+
cancelDelay = delay(resizeUnblockUpdate, 250);
|
|
164
|
+
if (globalProjectionState.hasAnimatedSinceResize) {
|
|
165
|
+
globalProjectionState.hasAnimatedSinceResize = false;
|
|
166
|
+
this.nodes.forEach(finishAnimation);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
if (layoutId) {
|
|
171
|
+
this.root.registerSharedNode(layoutId, this);
|
|
172
|
+
}
|
|
173
|
+
if (this.options.animate !== false && visualElement && (layoutId || layout)) {
|
|
174
|
+
this.addEventListener("didUpdate", ({ delta, hasLayoutChanged, hasRelativeTargetChanged, layout: newLayout }) => {
|
|
175
|
+
if (this.isTreeAnimationBlocked()) {
|
|
176
|
+
this.target = void 0;
|
|
177
|
+
this.relativeTarget = void 0;
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
const layoutTransition = this.options.transition || visualElement.getDefaultTransition() || defaultLayoutTransition;
|
|
181
|
+
const { onLayoutAnimationStart, onLayoutAnimationComplete } = visualElement.getProps();
|
|
182
|
+
const targetChanged = !this.targetLayout || !boxEqualsRounded(this.targetLayout, newLayout) || hasRelativeTargetChanged;
|
|
183
|
+
const hasOnlyRelativeTargetChanged = !hasLayoutChanged && hasRelativeTargetChanged;
|
|
184
|
+
if (this.options.layoutRoot || this.resumeFrom && this.resumeFrom.instance || hasOnlyRelativeTargetChanged || hasLayoutChanged && (targetChanged || !this.currentAnimation)) {
|
|
185
|
+
if (this.resumeFrom) {
|
|
186
|
+
this.resumingFrom = this.resumeFrom;
|
|
187
|
+
this.resumingFrom.resumingFrom = void 0;
|
|
188
|
+
}
|
|
189
|
+
this.setAnimationOrigin(delta, hasOnlyRelativeTargetChanged);
|
|
190
|
+
const animationOptions = {
|
|
191
|
+
...getValueTransition(layoutTransition, "layout"),
|
|
192
|
+
onPlay: onLayoutAnimationStart,
|
|
193
|
+
onComplete: onLayoutAnimationComplete
|
|
194
|
+
};
|
|
195
|
+
if (visualElement.shouldReduceMotion || this.options.layoutRoot) {
|
|
196
|
+
animationOptions.delay = 0;
|
|
197
|
+
animationOptions.type = false;
|
|
198
|
+
}
|
|
199
|
+
this.startAnimation(animationOptions);
|
|
200
|
+
} else {
|
|
201
|
+
if (!hasLayoutChanged) {
|
|
202
|
+
finishAnimation(this);
|
|
203
|
+
}
|
|
204
|
+
if (this.isLead() && this.options.onExitComplete) {
|
|
205
|
+
this.options.onExitComplete();
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
this.targetLayout = newLayout;
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
unmount() {
|
|
213
|
+
this.options.layoutId && this.willUpdate();
|
|
214
|
+
this.root.nodes.remove(this);
|
|
215
|
+
const stack = this.getStack();
|
|
216
|
+
stack && stack.remove(this);
|
|
217
|
+
this.parent && this.parent.children.delete(this);
|
|
218
|
+
this.instance = void 0;
|
|
219
|
+
cancelFrame(this.updateProjection);
|
|
220
|
+
}
|
|
221
|
+
// only on the root
|
|
222
|
+
blockUpdate() {
|
|
223
|
+
this.updateManuallyBlocked = true;
|
|
224
|
+
}
|
|
225
|
+
unblockUpdate() {
|
|
226
|
+
this.updateManuallyBlocked = false;
|
|
227
|
+
}
|
|
228
|
+
isUpdateBlocked() {
|
|
229
|
+
return this.updateManuallyBlocked || this.updateBlockedByResize;
|
|
230
|
+
}
|
|
231
|
+
isTreeAnimationBlocked() {
|
|
232
|
+
return this.isAnimationBlocked || this.parent && this.parent.isTreeAnimationBlocked() || false;
|
|
233
|
+
}
|
|
234
|
+
// Note: currently only running on root node
|
|
235
|
+
startUpdate() {
|
|
236
|
+
if (this.isUpdateBlocked())
|
|
237
|
+
return;
|
|
238
|
+
this.isUpdating = true;
|
|
239
|
+
this.nodes && this.nodes.forEach(resetSkewAndRotation);
|
|
240
|
+
this.animationId++;
|
|
241
|
+
}
|
|
242
|
+
getTransformTemplate() {
|
|
243
|
+
const { visualElement } = this.options;
|
|
244
|
+
return visualElement && visualElement.getProps().transformTemplate;
|
|
245
|
+
}
|
|
246
|
+
willUpdate(shouldNotifyListeners = true) {
|
|
247
|
+
this.root.hasTreeAnimated = true;
|
|
248
|
+
if (this.root.isUpdateBlocked()) {
|
|
249
|
+
this.options.onExitComplete && this.options.onExitComplete();
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear) {
|
|
253
|
+
cancelTreeOptimisedTransformAnimations(this);
|
|
254
|
+
}
|
|
255
|
+
!this.root.isUpdating && this.root.startUpdate();
|
|
256
|
+
if (this.isLayoutDirty)
|
|
257
|
+
return;
|
|
258
|
+
this.isLayoutDirty = true;
|
|
259
|
+
for (let i = 0; i < this.path.length; i++) {
|
|
260
|
+
const node = this.path[i];
|
|
261
|
+
node.shouldResetTransform = true;
|
|
262
|
+
node.updateScroll("snapshot");
|
|
263
|
+
if (node.options.layoutRoot) {
|
|
264
|
+
node.willUpdate(false);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
const { layoutId, layout } = this.options;
|
|
268
|
+
if (layoutId === void 0 && !layout)
|
|
269
|
+
return;
|
|
270
|
+
const transformTemplate = this.getTransformTemplate();
|
|
271
|
+
this.prevTransformTemplateValue = transformTemplate ? transformTemplate(this.latestValues, "") : void 0;
|
|
272
|
+
this.updateSnapshot();
|
|
273
|
+
shouldNotifyListeners && this.notifyListeners("willUpdate");
|
|
274
|
+
}
|
|
275
|
+
update() {
|
|
276
|
+
this.updateScheduled = false;
|
|
277
|
+
const updateWasBlocked = this.isUpdateBlocked();
|
|
278
|
+
if (updateWasBlocked) {
|
|
279
|
+
this.unblockUpdate();
|
|
280
|
+
this.clearAllSnapshots();
|
|
281
|
+
this.nodes.forEach(clearMeasurements);
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
if (!this.isUpdating) {
|
|
285
|
+
this.nodes.forEach(clearIsLayoutDirty);
|
|
286
|
+
}
|
|
287
|
+
this.isUpdating = false;
|
|
288
|
+
this.nodes.forEach(resetTransformStyle);
|
|
289
|
+
this.nodes.forEach(updateLayout);
|
|
290
|
+
this.nodes.forEach(notifyLayoutUpdate);
|
|
291
|
+
this.clearAllSnapshots();
|
|
292
|
+
const now = time.now();
|
|
293
|
+
frameData.delta = clamp(0, 1e3 / 60, now - frameData.timestamp);
|
|
294
|
+
frameData.timestamp = now;
|
|
295
|
+
frameData.isProcessing = true;
|
|
296
|
+
frameSteps.update.process(frameData);
|
|
297
|
+
frameSteps.preRender.process(frameData);
|
|
298
|
+
frameSteps.render.process(frameData);
|
|
299
|
+
frameData.isProcessing = false;
|
|
300
|
+
}
|
|
301
|
+
didUpdate() {
|
|
302
|
+
if (!this.updateScheduled) {
|
|
303
|
+
this.updateScheduled = true;
|
|
304
|
+
microtask.read(this.scheduleUpdate);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
clearAllSnapshots() {
|
|
308
|
+
this.nodes.forEach(clearSnapshot);
|
|
309
|
+
this.sharedNodes.forEach(removeLeadSnapshots);
|
|
310
|
+
}
|
|
311
|
+
scheduleUpdateProjection() {
|
|
312
|
+
if (!this.projectionUpdateScheduled) {
|
|
313
|
+
this.projectionUpdateScheduled = true;
|
|
314
|
+
frame.preRender(this.updateProjection, false, true);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
scheduleCheckAfterUnmount() {
|
|
318
|
+
frame.postRender(() => {
|
|
319
|
+
if (this.isLayoutDirty) {
|
|
320
|
+
this.root.didUpdate();
|
|
321
|
+
} else {
|
|
322
|
+
this.root.checkUpdateFailed();
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Update measurements
|
|
328
|
+
*/
|
|
329
|
+
updateSnapshot() {
|
|
330
|
+
if (this.snapshot || !this.instance)
|
|
331
|
+
return;
|
|
332
|
+
this.snapshot = this.measure();
|
|
333
|
+
}
|
|
334
|
+
updateLayout() {
|
|
335
|
+
if (!this.instance)
|
|
336
|
+
return;
|
|
337
|
+
this.updateScroll();
|
|
338
|
+
if (!(this.options.alwaysMeasureLayout && this.isLead()) && !this.isLayoutDirty) {
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
if (this.resumeFrom && !this.resumeFrom.instance) {
|
|
342
|
+
for (let i = 0; i < this.path.length; i++) {
|
|
343
|
+
const node = this.path[i];
|
|
344
|
+
node.updateScroll();
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
const prevLayout = this.layout;
|
|
348
|
+
this.layout = this.measure(false);
|
|
349
|
+
this.layoutCorrected = createBox();
|
|
350
|
+
this.isLayoutDirty = false;
|
|
351
|
+
this.projectionDelta = void 0;
|
|
352
|
+
this.notifyListeners("measure", this.layout.layoutBox);
|
|
353
|
+
const { visualElement } = this.options;
|
|
354
|
+
visualElement && visualElement.notify("LayoutMeasure", this.layout.layoutBox, prevLayout ? prevLayout.layoutBox : void 0);
|
|
355
|
+
}
|
|
356
|
+
updateScroll(phase = "measure") {
|
|
357
|
+
let needsMeasurement = Boolean(this.options.layoutScroll && this.instance);
|
|
358
|
+
if (this.scroll && this.scroll.animationId === this.root.animationId && this.scroll.phase === phase) {
|
|
359
|
+
needsMeasurement = false;
|
|
360
|
+
}
|
|
361
|
+
if (needsMeasurement) {
|
|
362
|
+
const isRoot = checkIsScrollRoot(this.instance);
|
|
363
|
+
this.scroll = {
|
|
364
|
+
animationId: this.root.animationId,
|
|
365
|
+
phase,
|
|
366
|
+
isRoot,
|
|
367
|
+
offset: measureScroll(this.instance),
|
|
368
|
+
wasRoot: this.scroll ? this.scroll.isRoot : isRoot
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
resetTransform() {
|
|
373
|
+
if (!resetTransform)
|
|
374
|
+
return;
|
|
375
|
+
const isResetRequested = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout;
|
|
376
|
+
const hasProjection = this.projectionDelta && !isDeltaZero(this.projectionDelta);
|
|
377
|
+
const transformTemplate = this.getTransformTemplate();
|
|
378
|
+
const transformTemplateValue = transformTemplate ? transformTemplate(this.latestValues, "") : void 0;
|
|
379
|
+
const transformTemplateHasChanged = transformTemplateValue !== this.prevTransformTemplateValue;
|
|
380
|
+
if (isResetRequested && (hasProjection || hasTransform(this.latestValues) || transformTemplateHasChanged)) {
|
|
381
|
+
resetTransform(this.instance, transformTemplateValue);
|
|
382
|
+
this.shouldResetTransform = false;
|
|
383
|
+
this.scheduleRender();
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
measure(removeTransform = true) {
|
|
387
|
+
const pageBox = this.measurePageBox();
|
|
388
|
+
let layoutBox = this.removeElementScroll(pageBox);
|
|
389
|
+
if (removeTransform) {
|
|
390
|
+
layoutBox = this.removeTransform(layoutBox);
|
|
391
|
+
}
|
|
392
|
+
roundBox(layoutBox);
|
|
393
|
+
return {
|
|
394
|
+
animationId: this.root.animationId,
|
|
395
|
+
measuredBox: pageBox,
|
|
396
|
+
layoutBox,
|
|
397
|
+
latestValues: {},
|
|
398
|
+
source: this.id
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
measurePageBox() {
|
|
402
|
+
var _a;
|
|
403
|
+
const { visualElement } = this.options;
|
|
404
|
+
if (!visualElement)
|
|
405
|
+
return createBox();
|
|
406
|
+
const box = visualElement.measureViewportBox();
|
|
407
|
+
const wasInScrollRoot = ((_a = this.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot) || this.path.some(checkNodeWasScrollRoot);
|
|
408
|
+
if (!wasInScrollRoot) {
|
|
409
|
+
const { scroll } = this.root;
|
|
410
|
+
if (scroll) {
|
|
411
|
+
translateAxis(box.x, scroll.offset.x);
|
|
412
|
+
translateAxis(box.y, scroll.offset.y);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
return box;
|
|
416
|
+
}
|
|
417
|
+
removeElementScroll(box) {
|
|
418
|
+
var _a;
|
|
419
|
+
const boxWithoutScroll = createBox();
|
|
420
|
+
copyBoxInto(boxWithoutScroll, box);
|
|
421
|
+
if ((_a = this.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot) {
|
|
422
|
+
return boxWithoutScroll;
|
|
423
|
+
}
|
|
424
|
+
for (let i = 0; i < this.path.length; i++) {
|
|
425
|
+
const node = this.path[i];
|
|
426
|
+
const { scroll, options } = node;
|
|
427
|
+
if (node !== this.root && scroll && options.layoutScroll) {
|
|
428
|
+
if (scroll.wasRoot) {
|
|
429
|
+
copyBoxInto(boxWithoutScroll, box);
|
|
430
|
+
}
|
|
431
|
+
translateAxis(boxWithoutScroll.x, scroll.offset.x);
|
|
432
|
+
translateAxis(boxWithoutScroll.y, scroll.offset.y);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
return boxWithoutScroll;
|
|
436
|
+
}
|
|
437
|
+
applyTransform(box, transformOnly = false) {
|
|
438
|
+
const withTransforms = createBox();
|
|
439
|
+
copyBoxInto(withTransforms, box);
|
|
440
|
+
for (let i = 0; i < this.path.length; i++) {
|
|
441
|
+
const node = this.path[i];
|
|
442
|
+
if (!transformOnly && node.options.layoutScroll && node.scroll && node !== node.root) {
|
|
443
|
+
transformBox(withTransforms, {
|
|
444
|
+
x: -node.scroll.offset.x,
|
|
445
|
+
y: -node.scroll.offset.y
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
if (!hasTransform(node.latestValues))
|
|
449
|
+
continue;
|
|
450
|
+
transformBox(withTransforms, node.latestValues);
|
|
451
|
+
}
|
|
452
|
+
if (hasTransform(this.latestValues)) {
|
|
453
|
+
transformBox(withTransforms, this.latestValues);
|
|
454
|
+
}
|
|
455
|
+
return withTransforms;
|
|
456
|
+
}
|
|
457
|
+
removeTransform(box) {
|
|
458
|
+
const boxWithoutTransform = createBox();
|
|
459
|
+
copyBoxInto(boxWithoutTransform, box);
|
|
460
|
+
for (let i = 0; i < this.path.length; i++) {
|
|
461
|
+
const node = this.path[i];
|
|
462
|
+
if (!node.instance)
|
|
463
|
+
continue;
|
|
464
|
+
if (!hasTransform(node.latestValues))
|
|
465
|
+
continue;
|
|
466
|
+
hasScale(node.latestValues) && node.updateSnapshot();
|
|
467
|
+
const sourceBox = createBox();
|
|
468
|
+
const nodeBox = node.measurePageBox();
|
|
469
|
+
copyBoxInto(sourceBox, nodeBox);
|
|
470
|
+
removeBoxTransforms(boxWithoutTransform, node.latestValues, node.snapshot ? node.snapshot.layoutBox : void 0, sourceBox);
|
|
471
|
+
}
|
|
472
|
+
if (hasTransform(this.latestValues)) {
|
|
473
|
+
removeBoxTransforms(boxWithoutTransform, this.latestValues);
|
|
474
|
+
}
|
|
475
|
+
return boxWithoutTransform;
|
|
476
|
+
}
|
|
477
|
+
setTargetDelta(delta) {
|
|
478
|
+
this.targetDelta = delta;
|
|
479
|
+
this.root.scheduleUpdateProjection();
|
|
480
|
+
this.isProjectionDirty = true;
|
|
481
|
+
}
|
|
482
|
+
setOptions(options) {
|
|
483
|
+
this.options = {
|
|
484
|
+
...this.options,
|
|
485
|
+
...options,
|
|
486
|
+
crossfade: options.crossfade !== void 0 ? options.crossfade : true
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
clearMeasurements() {
|
|
490
|
+
this.scroll = void 0;
|
|
491
|
+
this.layout = void 0;
|
|
492
|
+
this.snapshot = void 0;
|
|
493
|
+
this.prevTransformTemplateValue = void 0;
|
|
494
|
+
this.targetDelta = void 0;
|
|
495
|
+
this.target = void 0;
|
|
496
|
+
this.isLayoutDirty = false;
|
|
497
|
+
}
|
|
498
|
+
forceRelativeParentToResolveTarget() {
|
|
499
|
+
if (!this.relativeParent)
|
|
500
|
+
return;
|
|
501
|
+
if (this.relativeParent.resolvedRelativeTargetAt !== frameData.timestamp) {
|
|
502
|
+
this.relativeParent.resolveTargetDelta(true);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
resolveTargetDelta(forceRecalculation = false) {
|
|
506
|
+
var _a;
|
|
507
|
+
const lead = this.getLead();
|
|
508
|
+
this.isProjectionDirty || (this.isProjectionDirty = lead.isProjectionDirty);
|
|
509
|
+
this.isTransformDirty || (this.isTransformDirty = lead.isTransformDirty);
|
|
510
|
+
this.isSharedProjectionDirty || (this.isSharedProjectionDirty = lead.isSharedProjectionDirty);
|
|
511
|
+
const isShared = Boolean(this.resumingFrom) || this !== lead;
|
|
512
|
+
const canSkip = !(forceRecalculation || isShared && this.isSharedProjectionDirty || this.isProjectionDirty || ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isProjectionDirty) || this.attemptToResolveRelativeTarget || this.root.updateBlockedByResize);
|
|
513
|
+
if (canSkip)
|
|
514
|
+
return;
|
|
515
|
+
const { layout, layoutId } = this.options;
|
|
516
|
+
if (!this.layout || !(layout || layoutId))
|
|
517
|
+
return;
|
|
518
|
+
this.resolvedRelativeTargetAt = frameData.timestamp;
|
|
519
|
+
if (!this.targetDelta && !this.relativeTarget) {
|
|
520
|
+
const relativeParent = this.getClosestProjectingParent();
|
|
521
|
+
if (relativeParent && relativeParent.layout && this.animationProgress !== 1) {
|
|
522
|
+
this.relativeParent = relativeParent;
|
|
523
|
+
this.forceRelativeParentToResolveTarget();
|
|
524
|
+
this.relativeTarget = createBox();
|
|
525
|
+
this.relativeTargetOrigin = createBox();
|
|
526
|
+
calcRelativePosition(this.relativeTargetOrigin, this.layout.layoutBox, relativeParent.layout.layoutBox);
|
|
527
|
+
copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
|
|
528
|
+
} else {
|
|
529
|
+
this.relativeParent = this.relativeTarget = void 0;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
if (!this.relativeTarget && !this.targetDelta)
|
|
533
|
+
return;
|
|
534
|
+
if (!this.target) {
|
|
535
|
+
this.target = createBox();
|
|
536
|
+
this.targetWithTransforms = createBox();
|
|
537
|
+
}
|
|
538
|
+
if (this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target) {
|
|
539
|
+
this.forceRelativeParentToResolveTarget();
|
|
540
|
+
calcRelativeBox(this.target, this.relativeTarget, this.relativeParent.target);
|
|
541
|
+
} else if (this.targetDelta) {
|
|
542
|
+
if (Boolean(this.resumingFrom)) {
|
|
543
|
+
this.target = this.applyTransform(this.layout.layoutBox);
|
|
544
|
+
} else {
|
|
545
|
+
copyBoxInto(this.target, this.layout.layoutBox);
|
|
546
|
+
}
|
|
547
|
+
applyBoxDelta(this.target, this.targetDelta);
|
|
548
|
+
} else {
|
|
549
|
+
copyBoxInto(this.target, this.layout.layoutBox);
|
|
550
|
+
}
|
|
551
|
+
if (this.attemptToResolveRelativeTarget) {
|
|
552
|
+
this.attemptToResolveRelativeTarget = false;
|
|
553
|
+
const relativeParent = this.getClosestProjectingParent();
|
|
554
|
+
if (relativeParent && Boolean(relativeParent.resumingFrom) === Boolean(this.resumingFrom) && !relativeParent.options.layoutScroll && relativeParent.target && this.animationProgress !== 1) {
|
|
555
|
+
this.relativeParent = relativeParent;
|
|
556
|
+
this.forceRelativeParentToResolveTarget();
|
|
557
|
+
this.relativeTarget = createBox();
|
|
558
|
+
this.relativeTargetOrigin = createBox();
|
|
559
|
+
calcRelativePosition(this.relativeTargetOrigin, this.target, relativeParent.target);
|
|
560
|
+
copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
|
|
561
|
+
} else {
|
|
562
|
+
this.relativeParent = this.relativeTarget = void 0;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
if (isDebug) {
|
|
566
|
+
metrics.resolvedTargetDeltas++;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
getClosestProjectingParent() {
|
|
570
|
+
if (!this.parent || hasScale(this.parent.latestValues) || has2DTranslate(this.parent.latestValues)) {
|
|
571
|
+
return void 0;
|
|
572
|
+
}
|
|
573
|
+
if (this.parent.isProjecting()) {
|
|
574
|
+
return this.parent;
|
|
575
|
+
} else {
|
|
576
|
+
return this.parent.getClosestProjectingParent();
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
isProjecting() {
|
|
580
|
+
return Boolean((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout);
|
|
581
|
+
}
|
|
582
|
+
calcProjection() {
|
|
583
|
+
var _a;
|
|
584
|
+
const lead = this.getLead();
|
|
585
|
+
const isShared = Boolean(this.resumingFrom) || this !== lead;
|
|
586
|
+
let canSkip = true;
|
|
587
|
+
if (this.isProjectionDirty || ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isProjectionDirty)) {
|
|
588
|
+
canSkip = false;
|
|
589
|
+
}
|
|
590
|
+
if (isShared && (this.isSharedProjectionDirty || this.isTransformDirty)) {
|
|
591
|
+
canSkip = false;
|
|
592
|
+
}
|
|
593
|
+
if (this.resolvedRelativeTargetAt === frameData.timestamp) {
|
|
594
|
+
canSkip = false;
|
|
595
|
+
}
|
|
596
|
+
if (canSkip)
|
|
597
|
+
return;
|
|
598
|
+
const { layout, layoutId } = this.options;
|
|
599
|
+
this.isTreeAnimating = Boolean(this.parent && this.parent.isTreeAnimating || this.currentAnimation || this.pendingAnimation);
|
|
600
|
+
if (!this.isTreeAnimating) {
|
|
601
|
+
this.targetDelta = this.relativeTarget = void 0;
|
|
602
|
+
}
|
|
603
|
+
if (!this.layout || !(layout || layoutId))
|
|
604
|
+
return;
|
|
605
|
+
copyBoxInto(this.layoutCorrected, this.layout.layoutBox);
|
|
606
|
+
const prevTreeScaleX = this.treeScale.x;
|
|
607
|
+
const prevTreeScaleY = this.treeScale.y;
|
|
608
|
+
applyTreeDeltas(this.layoutCorrected, this.treeScale, this.path, isShared);
|
|
609
|
+
if (lead.layout && !lead.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1)) {
|
|
610
|
+
lead.target = lead.layout.layoutBox;
|
|
611
|
+
lead.targetWithTransforms = createBox();
|
|
612
|
+
}
|
|
613
|
+
const { target } = lead;
|
|
614
|
+
if (!target) {
|
|
615
|
+
if (this.prevProjectionDelta) {
|
|
616
|
+
this.createProjectionDeltas();
|
|
617
|
+
this.scheduleRender();
|
|
618
|
+
}
|
|
619
|
+
return;
|
|
620
|
+
}
|
|
621
|
+
if (!this.projectionDelta || !this.prevProjectionDelta) {
|
|
622
|
+
this.createProjectionDeltas();
|
|
623
|
+
} else {
|
|
624
|
+
copyAxisDeltaInto(this.prevProjectionDelta.x, this.projectionDelta.x);
|
|
625
|
+
copyAxisDeltaInto(this.prevProjectionDelta.y, this.projectionDelta.y);
|
|
626
|
+
}
|
|
627
|
+
calcBoxDelta(this.projectionDelta, this.layoutCorrected, target, this.latestValues);
|
|
628
|
+
if (this.treeScale.x !== prevTreeScaleX || this.treeScale.y !== prevTreeScaleY || !axisDeltaEquals(this.projectionDelta.x, this.prevProjectionDelta.x) || !axisDeltaEquals(this.projectionDelta.y, this.prevProjectionDelta.y)) {
|
|
629
|
+
this.hasProjected = true;
|
|
630
|
+
this.scheduleRender();
|
|
631
|
+
this.notifyListeners("projectionUpdate", target);
|
|
632
|
+
}
|
|
633
|
+
if (isDebug) {
|
|
634
|
+
metrics.recalculatedProjection++;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
hide() {
|
|
638
|
+
this.isVisible = false;
|
|
639
|
+
}
|
|
640
|
+
show() {
|
|
641
|
+
this.isVisible = true;
|
|
642
|
+
}
|
|
643
|
+
scheduleRender(notifyAll = true) {
|
|
644
|
+
var _a;
|
|
645
|
+
(_a = this.options.visualElement) === null || _a === void 0 ? void 0 : _a.scheduleRender();
|
|
646
|
+
if (notifyAll) {
|
|
647
|
+
const stack = this.getStack();
|
|
648
|
+
stack && stack.scheduleRender();
|
|
649
|
+
}
|
|
650
|
+
if (this.resumingFrom && !this.resumingFrom.instance) {
|
|
651
|
+
this.resumingFrom = void 0;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
createProjectionDeltas() {
|
|
655
|
+
this.prevProjectionDelta = createDelta();
|
|
656
|
+
this.projectionDelta = createDelta();
|
|
657
|
+
this.projectionDeltaWithTransform = createDelta();
|
|
658
|
+
}
|
|
659
|
+
setAnimationOrigin(delta, hasOnlyRelativeTargetChanged = false) {
|
|
660
|
+
const snapshot = this.snapshot;
|
|
661
|
+
const snapshotLatestValues = snapshot ? snapshot.latestValues : {};
|
|
662
|
+
const mixedValues = { ...this.latestValues };
|
|
663
|
+
const targetDelta = createDelta();
|
|
664
|
+
if (!this.relativeParent || !this.relativeParent.options.layoutRoot) {
|
|
665
|
+
this.relativeTarget = this.relativeTargetOrigin = void 0;
|
|
666
|
+
}
|
|
667
|
+
this.attemptToResolveRelativeTarget = !hasOnlyRelativeTargetChanged;
|
|
668
|
+
const relativeLayout = createBox();
|
|
669
|
+
const snapshotSource = snapshot ? snapshot.source : void 0;
|
|
670
|
+
const layoutSource = this.layout ? this.layout.source : void 0;
|
|
671
|
+
const isSharedLayoutAnimation = snapshotSource !== layoutSource;
|
|
672
|
+
const stack = this.getStack();
|
|
673
|
+
const isOnlyMember = !stack || stack.members.length <= 1;
|
|
674
|
+
const shouldCrossfadeOpacity = Boolean(isSharedLayoutAnimation && !isOnlyMember && this.options.crossfade === true && !this.path.some(hasOpacityCrossfade));
|
|
675
|
+
this.animationProgress = 0;
|
|
676
|
+
let prevRelativeTarget;
|
|
677
|
+
this.mixTargetDelta = (latest) => {
|
|
678
|
+
const progress = latest / 1e3;
|
|
679
|
+
mixAxisDelta(targetDelta.x, delta.x, progress);
|
|
680
|
+
mixAxisDelta(targetDelta.y, delta.y, progress);
|
|
681
|
+
this.setTargetDelta(targetDelta);
|
|
682
|
+
if (this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout) {
|
|
683
|
+
calcRelativePosition(relativeLayout, this.layout.layoutBox, this.relativeParent.layout.layoutBox);
|
|
684
|
+
mixBox(this.relativeTarget, this.relativeTargetOrigin, relativeLayout, progress);
|
|
685
|
+
if (prevRelativeTarget && boxEquals(this.relativeTarget, prevRelativeTarget)) {
|
|
686
|
+
this.isProjectionDirty = false;
|
|
687
|
+
}
|
|
688
|
+
if (!prevRelativeTarget)
|
|
689
|
+
prevRelativeTarget = createBox();
|
|
690
|
+
copyBoxInto(prevRelativeTarget, this.relativeTarget);
|
|
691
|
+
}
|
|
692
|
+
if (isSharedLayoutAnimation) {
|
|
693
|
+
this.animationValues = mixedValues;
|
|
694
|
+
mixValues(mixedValues, snapshotLatestValues, this.latestValues, progress, shouldCrossfadeOpacity, isOnlyMember);
|
|
695
|
+
}
|
|
696
|
+
this.root.scheduleUpdateProjection();
|
|
697
|
+
this.scheduleRender();
|
|
698
|
+
this.animationProgress = progress;
|
|
699
|
+
};
|
|
700
|
+
this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0);
|
|
701
|
+
}
|
|
702
|
+
startAnimation(options) {
|
|
703
|
+
this.notifyListeners("animationStart");
|
|
704
|
+
this.currentAnimation && this.currentAnimation.stop();
|
|
705
|
+
if (this.resumingFrom && this.resumingFrom.currentAnimation) {
|
|
706
|
+
this.resumingFrom.currentAnimation.stop();
|
|
707
|
+
}
|
|
708
|
+
if (this.pendingAnimation) {
|
|
709
|
+
cancelFrame(this.pendingAnimation);
|
|
710
|
+
this.pendingAnimation = void 0;
|
|
711
|
+
}
|
|
712
|
+
this.pendingAnimation = frame.update(() => {
|
|
713
|
+
globalProjectionState.hasAnimatedSinceResize = true;
|
|
714
|
+
this.currentAnimation = animateSingleValue(0, animationTarget, {
|
|
715
|
+
...options,
|
|
716
|
+
onUpdate: (latest) => {
|
|
717
|
+
this.mixTargetDelta(latest);
|
|
718
|
+
options.onUpdate && options.onUpdate(latest);
|
|
719
|
+
},
|
|
720
|
+
onComplete: () => {
|
|
721
|
+
options.onComplete && options.onComplete();
|
|
722
|
+
this.completeAnimation();
|
|
723
|
+
}
|
|
724
|
+
});
|
|
725
|
+
if (this.resumingFrom) {
|
|
726
|
+
this.resumingFrom.currentAnimation = this.currentAnimation;
|
|
727
|
+
}
|
|
728
|
+
this.pendingAnimation = void 0;
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
completeAnimation() {
|
|
732
|
+
if (this.resumingFrom) {
|
|
733
|
+
this.resumingFrom.currentAnimation = void 0;
|
|
734
|
+
this.resumingFrom.preserveOpacity = void 0;
|
|
735
|
+
}
|
|
736
|
+
const stack = this.getStack();
|
|
737
|
+
stack && stack.exitAnimationComplete();
|
|
738
|
+
this.resumingFrom = this.currentAnimation = this.animationValues = void 0;
|
|
739
|
+
this.notifyListeners("animationComplete");
|
|
740
|
+
}
|
|
741
|
+
finishAnimation() {
|
|
742
|
+
if (this.currentAnimation) {
|
|
743
|
+
this.mixTargetDelta && this.mixTargetDelta(animationTarget);
|
|
744
|
+
this.currentAnimation.stop();
|
|
745
|
+
}
|
|
746
|
+
this.completeAnimation();
|
|
747
|
+
}
|
|
748
|
+
applyTransformsToTarget() {
|
|
749
|
+
const lead = this.getLead();
|
|
750
|
+
let { targetWithTransforms, target, layout, latestValues } = lead;
|
|
751
|
+
if (!targetWithTransforms || !target || !layout)
|
|
752
|
+
return;
|
|
753
|
+
if (this !== lead && this.layout && layout && shouldAnimatePositionOnly(this.options.animationType, this.layout.layoutBox, layout.layoutBox)) {
|
|
754
|
+
target = this.target || createBox();
|
|
755
|
+
const xLength = calcLength(this.layout.layoutBox.x);
|
|
756
|
+
target.x.min = lead.target.x.min;
|
|
757
|
+
target.x.max = target.x.min + xLength;
|
|
758
|
+
const yLength = calcLength(this.layout.layoutBox.y);
|
|
759
|
+
target.y.min = lead.target.y.min;
|
|
760
|
+
target.y.max = target.y.min + yLength;
|
|
761
|
+
}
|
|
762
|
+
copyBoxInto(targetWithTransforms, target);
|
|
763
|
+
transformBox(targetWithTransforms, latestValues);
|
|
764
|
+
calcBoxDelta(this.projectionDeltaWithTransform, this.layoutCorrected, targetWithTransforms, latestValues);
|
|
765
|
+
}
|
|
766
|
+
registerSharedNode(layoutId, node) {
|
|
767
|
+
if (!this.sharedNodes.has(layoutId)) {
|
|
768
|
+
this.sharedNodes.set(layoutId, new NodeStack());
|
|
769
|
+
}
|
|
770
|
+
const stack = this.sharedNodes.get(layoutId);
|
|
771
|
+
stack.add(node);
|
|
772
|
+
const config = node.options.initialPromotionConfig;
|
|
773
|
+
node.promote({
|
|
774
|
+
transition: config ? config.transition : void 0,
|
|
775
|
+
preserveFollowOpacity: config && config.shouldPreserveFollowOpacity ? config.shouldPreserveFollowOpacity(node) : void 0
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
isLead() {
|
|
779
|
+
const stack = this.getStack();
|
|
780
|
+
return stack ? stack.lead === this : true;
|
|
781
|
+
}
|
|
782
|
+
getLead() {
|
|
783
|
+
var _a;
|
|
784
|
+
const { layoutId } = this.options;
|
|
785
|
+
return layoutId ? ((_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.lead) || this : this;
|
|
786
|
+
}
|
|
787
|
+
getPrevLead() {
|
|
788
|
+
var _a;
|
|
789
|
+
const { layoutId } = this.options;
|
|
790
|
+
return layoutId ? (_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.prevLead : void 0;
|
|
791
|
+
}
|
|
792
|
+
getStack() {
|
|
793
|
+
const { layoutId } = this.options;
|
|
794
|
+
if (layoutId)
|
|
795
|
+
return this.root.sharedNodes.get(layoutId);
|
|
796
|
+
}
|
|
797
|
+
promote({ needsReset, transition, preserveFollowOpacity } = {}) {
|
|
798
|
+
const stack = this.getStack();
|
|
799
|
+
if (stack)
|
|
800
|
+
stack.promote(this, preserveFollowOpacity);
|
|
801
|
+
if (needsReset) {
|
|
802
|
+
this.projectionDelta = void 0;
|
|
803
|
+
this.needsReset = true;
|
|
804
|
+
}
|
|
805
|
+
if (transition)
|
|
806
|
+
this.setOptions({ transition });
|
|
807
|
+
}
|
|
808
|
+
relegate() {
|
|
809
|
+
const stack = this.getStack();
|
|
810
|
+
if (stack) {
|
|
811
|
+
return stack.relegate(this);
|
|
812
|
+
} else {
|
|
813
|
+
return false;
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
resetSkewAndRotation() {
|
|
817
|
+
const { visualElement } = this.options;
|
|
818
|
+
if (!visualElement)
|
|
819
|
+
return;
|
|
820
|
+
let hasDistortingTransform = false;
|
|
821
|
+
const { latestValues } = visualElement;
|
|
822
|
+
if (latestValues.z || latestValues.rotate || latestValues.rotateX || latestValues.rotateY || latestValues.rotateZ || latestValues.skewX || latestValues.skewY) {
|
|
823
|
+
hasDistortingTransform = true;
|
|
824
|
+
}
|
|
825
|
+
if (!hasDistortingTransform)
|
|
826
|
+
return;
|
|
827
|
+
const resetValues = {};
|
|
828
|
+
if (latestValues.z) {
|
|
829
|
+
resetDistortingTransform("z", visualElement, resetValues, this.animationValues);
|
|
830
|
+
}
|
|
831
|
+
for (let i = 0; i < transformAxes.length; i++) {
|
|
832
|
+
resetDistortingTransform(`rotate${transformAxes[i]}`, visualElement, resetValues, this.animationValues);
|
|
833
|
+
resetDistortingTransform(`skew${transformAxes[i]}`, visualElement, resetValues, this.animationValues);
|
|
834
|
+
}
|
|
835
|
+
visualElement.render();
|
|
836
|
+
for (const key in resetValues) {
|
|
837
|
+
visualElement.setStaticValue(key, resetValues[key]);
|
|
838
|
+
if (this.animationValues) {
|
|
839
|
+
this.animationValues[key] = resetValues[key];
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
visualElement.scheduleRender();
|
|
843
|
+
}
|
|
844
|
+
getProjectionStyles(styleProp) {
|
|
845
|
+
var _a, _b;
|
|
846
|
+
if (!this.instance || this.isSVG)
|
|
847
|
+
return void 0;
|
|
848
|
+
if (!this.isVisible) {
|
|
849
|
+
return hiddenVisibility;
|
|
850
|
+
}
|
|
851
|
+
const styles = {
|
|
852
|
+
visibility: ""
|
|
853
|
+
};
|
|
854
|
+
const transformTemplate = this.getTransformTemplate();
|
|
855
|
+
if (this.needsReset) {
|
|
856
|
+
this.needsReset = false;
|
|
857
|
+
styles.opacity = "";
|
|
858
|
+
styles.pointerEvents = resolveMotionValue(styleProp === null || styleProp === void 0 ? void 0 : styleProp.pointerEvents) || "";
|
|
859
|
+
styles.transform = transformTemplate ? transformTemplate(this.latestValues, "") : "none";
|
|
860
|
+
return styles;
|
|
861
|
+
}
|
|
862
|
+
const lead = this.getLead();
|
|
863
|
+
if (!this.projectionDelta || !this.layout || !lead.target) {
|
|
864
|
+
const emptyStyles = {};
|
|
865
|
+
if (this.options.layoutId) {
|
|
866
|
+
emptyStyles.opacity = this.latestValues.opacity !== void 0 ? this.latestValues.opacity : 1;
|
|
867
|
+
emptyStyles.pointerEvents = resolveMotionValue(styleProp === null || styleProp === void 0 ? void 0 : styleProp.pointerEvents) || "";
|
|
868
|
+
}
|
|
869
|
+
if (this.hasProjected && !hasTransform(this.latestValues)) {
|
|
870
|
+
emptyStyles.transform = transformTemplate ? transformTemplate({}, "") : "none";
|
|
871
|
+
this.hasProjected = false;
|
|
872
|
+
}
|
|
873
|
+
return emptyStyles;
|
|
874
|
+
}
|
|
875
|
+
const valuesToRender = lead.animationValues || lead.latestValues;
|
|
876
|
+
this.applyTransformsToTarget();
|
|
877
|
+
styles.transform = buildProjectionTransform(this.projectionDeltaWithTransform, this.treeScale, valuesToRender);
|
|
878
|
+
if (transformTemplate) {
|
|
879
|
+
styles.transform = transformTemplate(valuesToRender, styles.transform);
|
|
880
|
+
}
|
|
881
|
+
const { x, y } = this.projectionDelta;
|
|
882
|
+
styles.transformOrigin = `${x.origin * 100}% ${y.origin * 100}% 0`;
|
|
883
|
+
if (lead.animationValues) {
|
|
884
|
+
styles.opacity = lead === this ? (_b = (_a = valuesToRender.opacity) !== null && _a !== void 0 ? _a : this.latestValues.opacity) !== null && _b !== void 0 ? _b : 1 : this.preserveOpacity ? this.latestValues.opacity : valuesToRender.opacityExit;
|
|
885
|
+
} else {
|
|
886
|
+
styles.opacity = lead === this ? valuesToRender.opacity !== void 0 ? valuesToRender.opacity : "" : valuesToRender.opacityExit !== void 0 ? valuesToRender.opacityExit : 0;
|
|
887
|
+
}
|
|
888
|
+
for (const key in scaleCorrectors) {
|
|
889
|
+
if (valuesToRender[key] === void 0)
|
|
890
|
+
continue;
|
|
891
|
+
const { correct, applyTo } = scaleCorrectors[key];
|
|
892
|
+
const corrected = styles.transform === "none" ? valuesToRender[key] : correct(valuesToRender[key], lead);
|
|
893
|
+
if (applyTo) {
|
|
894
|
+
const num = applyTo.length;
|
|
895
|
+
for (let i = 0; i < num; i++) {
|
|
896
|
+
styles[applyTo[i]] = corrected;
|
|
897
|
+
}
|
|
898
|
+
} else {
|
|
899
|
+
styles[key] = corrected;
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
if (this.options.layoutId) {
|
|
903
|
+
styles.pointerEvents = lead === this ? resolveMotionValue(styleProp === null || styleProp === void 0 ? void 0 : styleProp.pointerEvents) || "" : "none";
|
|
904
|
+
}
|
|
905
|
+
return styles;
|
|
906
|
+
}
|
|
907
|
+
clearSnapshot() {
|
|
908
|
+
this.resumeFrom = this.snapshot = void 0;
|
|
909
|
+
}
|
|
910
|
+
// Only run on root
|
|
911
|
+
resetTree() {
|
|
912
|
+
this.root.nodes.forEach((node) => {
|
|
913
|
+
var _a;
|
|
914
|
+
return (_a = node.currentAnimation) === null || _a === void 0 ? void 0 : _a.stop();
|
|
915
|
+
});
|
|
916
|
+
this.root.nodes.forEach(clearMeasurements);
|
|
917
|
+
this.root.sharedNodes.clear();
|
|
918
|
+
}
|
|
919
|
+
};
|
|
920
|
+
}
|
|
921
|
+
function updateLayout(node) {
|
|
922
|
+
node.updateLayout();
|
|
923
|
+
}
|
|
924
|
+
function notifyLayoutUpdate(node) {
|
|
925
|
+
var _a;
|
|
926
|
+
const snapshot = ((_a = node.resumeFrom) === null || _a === void 0 ? void 0 : _a.snapshot) || node.snapshot;
|
|
927
|
+
if (node.isLead() && node.layout && snapshot && node.hasListeners("didUpdate")) {
|
|
928
|
+
const { layoutBox: layout, measuredBox: measuredLayout } = node.layout;
|
|
929
|
+
const { animationType } = node.options;
|
|
930
|
+
const isShared = snapshot.source !== node.layout.source;
|
|
931
|
+
if (animationType === "size") {
|
|
932
|
+
eachAxis((axis) => {
|
|
933
|
+
const axisSnapshot = isShared ? snapshot.measuredBox[axis] : snapshot.layoutBox[axis];
|
|
934
|
+
const length = calcLength(axisSnapshot);
|
|
935
|
+
axisSnapshot.min = layout[axis].min;
|
|
936
|
+
axisSnapshot.max = axisSnapshot.min + length;
|
|
937
|
+
});
|
|
938
|
+
} else if (shouldAnimatePositionOnly(animationType, snapshot.layoutBox, layout)) {
|
|
939
|
+
eachAxis((axis) => {
|
|
940
|
+
const axisSnapshot = isShared ? snapshot.measuredBox[axis] : snapshot.layoutBox[axis];
|
|
941
|
+
const length = calcLength(layout[axis]);
|
|
942
|
+
axisSnapshot.max = axisSnapshot.min + length;
|
|
943
|
+
if (node.relativeTarget && !node.currentAnimation) {
|
|
944
|
+
node.isProjectionDirty = true;
|
|
945
|
+
node.relativeTarget[axis].max = node.relativeTarget[axis].min + length;
|
|
946
|
+
}
|
|
947
|
+
});
|
|
948
|
+
}
|
|
949
|
+
const layoutDelta = createDelta();
|
|
950
|
+
calcBoxDelta(layoutDelta, layout, snapshot.layoutBox);
|
|
951
|
+
const visualDelta = createDelta();
|
|
952
|
+
if (isShared) {
|
|
953
|
+
calcBoxDelta(visualDelta, node.applyTransform(measuredLayout, true), snapshot.measuredBox);
|
|
954
|
+
} else {
|
|
955
|
+
calcBoxDelta(visualDelta, layout, snapshot.layoutBox);
|
|
956
|
+
}
|
|
957
|
+
const hasLayoutChanged = !isDeltaZero(layoutDelta);
|
|
958
|
+
let hasRelativeTargetChanged = false;
|
|
959
|
+
if (!node.resumeFrom) {
|
|
960
|
+
const relativeParent = node.getClosestProjectingParent();
|
|
961
|
+
if (relativeParent && !relativeParent.resumeFrom) {
|
|
962
|
+
const { snapshot: parentSnapshot, layout: parentLayout } = relativeParent;
|
|
963
|
+
if (parentSnapshot && parentLayout) {
|
|
964
|
+
const relativeSnapshot = createBox();
|
|
965
|
+
calcRelativePosition(relativeSnapshot, snapshot.layoutBox, parentSnapshot.layoutBox);
|
|
966
|
+
const relativeLayout = createBox();
|
|
967
|
+
calcRelativePosition(relativeLayout, layout, parentLayout.layoutBox);
|
|
968
|
+
if (!boxEqualsRounded(relativeSnapshot, relativeLayout)) {
|
|
969
|
+
hasRelativeTargetChanged = true;
|
|
970
|
+
}
|
|
971
|
+
if (relativeParent.options.layoutRoot) {
|
|
972
|
+
node.relativeTarget = relativeLayout;
|
|
973
|
+
node.relativeTargetOrigin = relativeSnapshot;
|
|
974
|
+
node.relativeParent = relativeParent;
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
node.notifyListeners("didUpdate", {
|
|
980
|
+
layout,
|
|
981
|
+
snapshot,
|
|
982
|
+
delta: visualDelta,
|
|
983
|
+
layoutDelta,
|
|
984
|
+
hasLayoutChanged,
|
|
985
|
+
hasRelativeTargetChanged
|
|
986
|
+
});
|
|
987
|
+
} else if (node.isLead()) {
|
|
988
|
+
const { onExitComplete } = node.options;
|
|
989
|
+
onExitComplete && onExitComplete();
|
|
990
|
+
}
|
|
991
|
+
node.options.transition = void 0;
|
|
992
|
+
}
|
|
993
|
+
function propagateDirtyNodes(node) {
|
|
994
|
+
if (isDebug) {
|
|
995
|
+
metrics.totalNodes++;
|
|
996
|
+
}
|
|
997
|
+
if (!node.parent)
|
|
998
|
+
return;
|
|
999
|
+
if (!node.isProjecting()) {
|
|
1000
|
+
node.isProjectionDirty = node.parent.isProjectionDirty;
|
|
1001
|
+
}
|
|
1002
|
+
node.isSharedProjectionDirty || (node.isSharedProjectionDirty = Boolean(node.isProjectionDirty || node.parent.isProjectionDirty || node.parent.isSharedProjectionDirty));
|
|
1003
|
+
node.isTransformDirty || (node.isTransformDirty = node.parent.isTransformDirty);
|
|
1004
|
+
}
|
|
1005
|
+
function cleanDirtyNodes(node) {
|
|
1006
|
+
node.isProjectionDirty = node.isSharedProjectionDirty = node.isTransformDirty = false;
|
|
1007
|
+
}
|
|
1008
|
+
function clearSnapshot(node) {
|
|
1009
|
+
node.clearSnapshot();
|
|
1010
|
+
}
|
|
1011
|
+
function clearMeasurements(node) {
|
|
1012
|
+
node.clearMeasurements();
|
|
1013
|
+
}
|
|
1014
|
+
function clearIsLayoutDirty(node) {
|
|
1015
|
+
node.isLayoutDirty = false;
|
|
1016
|
+
}
|
|
1017
|
+
function resetTransformStyle(node) {
|
|
1018
|
+
const { visualElement } = node.options;
|
|
1019
|
+
if (visualElement && visualElement.getProps().onBeforeLayoutMeasure) {
|
|
1020
|
+
visualElement.notify("BeforeLayoutMeasure");
|
|
1021
|
+
}
|
|
1022
|
+
node.resetTransform();
|
|
1023
|
+
}
|
|
1024
|
+
function finishAnimation(node) {
|
|
1025
|
+
node.finishAnimation();
|
|
1026
|
+
node.targetDelta = node.relativeTarget = node.target = void 0;
|
|
1027
|
+
node.isProjectionDirty = true;
|
|
1028
|
+
}
|
|
1029
|
+
function resolveTargetDelta(node) {
|
|
1030
|
+
node.resolveTargetDelta();
|
|
1031
|
+
}
|
|
1032
|
+
function calcProjection(node) {
|
|
1033
|
+
node.calcProjection();
|
|
1034
|
+
}
|
|
1035
|
+
function resetSkewAndRotation(node) {
|
|
1036
|
+
node.resetSkewAndRotation();
|
|
1037
|
+
}
|
|
1038
|
+
function removeLeadSnapshots(stack) {
|
|
1039
|
+
stack.removeLeadSnapshot();
|
|
1040
|
+
}
|
|
1041
|
+
function mixAxisDelta(output, delta, p) {
|
|
1042
|
+
output.translate = mixNumber(delta.translate, 0, p);
|
|
1043
|
+
output.scale = mixNumber(delta.scale, 1, p);
|
|
1044
|
+
output.origin = delta.origin;
|
|
1045
|
+
output.originPoint = delta.originPoint;
|
|
1046
|
+
}
|
|
1047
|
+
function mixAxis(output, from, to, p) {
|
|
1048
|
+
output.min = mixNumber(from.min, to.min, p);
|
|
1049
|
+
output.max = mixNumber(from.max, to.max, p);
|
|
1050
|
+
}
|
|
1051
|
+
function mixBox(output, from, to, p) {
|
|
1052
|
+
mixAxis(output.x, from.x, to.x, p);
|
|
1053
|
+
mixAxis(output.y, from.y, to.y, p);
|
|
1054
|
+
}
|
|
1055
|
+
function hasOpacityCrossfade(node) {
|
|
1056
|
+
return node.animationValues && node.animationValues.opacityExit !== void 0;
|
|
1057
|
+
}
|
|
1058
|
+
const defaultLayoutTransition = {
|
|
1059
|
+
duration: 0.45,
|
|
1060
|
+
ease: [0.4, 0, 0.1, 1]
|
|
1061
|
+
};
|
|
1062
|
+
const userAgentContains = (string) => typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(string);
|
|
1063
|
+
const roundPoint = userAgentContains("applewebkit/") && !userAgentContains("chrome/") ? Math.round : noop;
|
|
1064
|
+
function roundAxis(axis) {
|
|
1065
|
+
axis.min = roundPoint(axis.min);
|
|
1066
|
+
axis.max = roundPoint(axis.max);
|
|
1067
|
+
}
|
|
1068
|
+
function roundBox(box) {
|
|
1069
|
+
roundAxis(box.x);
|
|
1070
|
+
roundAxis(box.y);
|
|
1071
|
+
}
|
|
1072
|
+
function shouldAnimatePositionOnly(animationType, snapshot, layout) {
|
|
1073
|
+
return animationType === "position" || animationType === "preserve-aspect" && !isNear(aspectRatio(snapshot), aspectRatio(layout), 0.2);
|
|
1074
|
+
}
|
|
1075
|
+
function checkNodeWasScrollRoot(node) {
|
|
1076
|
+
var _a;
|
|
1077
|
+
return node !== node.root && ((_a = node.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot);
|
|
1078
|
+
}
|
|
1079
|
+
export {
|
|
1080
|
+
cleanDirtyNodes,
|
|
1081
|
+
createProjectionNode,
|
|
1082
|
+
mixAxis,
|
|
1083
|
+
mixAxisDelta,
|
|
1084
|
+
mixBox,
|
|
1085
|
+
propagateDirtyNodes
|
|
1086
|
+
};
|