motion-v 0.2.6 → 0.3.1-beta.1

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.
Files changed (244) hide show
  1. package/dist/cjs/index.js +5858 -0
  2. package/dist/es/animation/use-animate.mjs +31 -0
  3. package/dist/es/components/AnimatePresence.vue.mjs +71 -0
  4. package/dist/es/components/AnimatePresence.vue2.mjs +4 -0
  5. package/dist/es/components/Motion.vue.mjs +116 -0
  6. package/dist/es/components/Motion.vue2.mjs +4 -0
  7. package/dist/es/components/Primitive.mjs +29 -0
  8. package/dist/es/components/Slot.mjs +36 -0
  9. package/dist/es/components/context.mjs +6 -0
  10. package/dist/es/components/presence.mjs +16 -0
  11. package/dist/es/components/renderSlotFragments.mjs +13 -0
  12. package/dist/es/constants/index.mjs +20 -0
  13. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/GroupPlaybackControls.mjs +76 -0
  14. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animate/index.mjs +27 -0
  15. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animate/resolve-subjects.mjs +16 -0
  16. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animate/sequence.mjs +14 -0
  17. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animate/single-value.mjs +11 -0
  18. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animate/subject.mjs +38 -0
  19. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/AcceleratedAnimation.mjs +243 -0
  20. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/BaseAnimation.mjs +95 -0
  21. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/MainThreadAnimation.mjs +275 -0
  22. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/drivers/driver-frameloop.mjs +17 -0
  23. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/utils/accelerated-values.mjs +12 -0
  24. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/utils/can-animate.mjs +30 -0
  25. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/waapi/NativeAnimation.mjs +162 -0
  26. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/waapi/animate-elements.mjs +31 -0
  27. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/waapi/animate-style.mjs +13 -0
  28. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/waapi/easing.mjs +37 -0
  29. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/waapi/index.mjs +20 -0
  30. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/waapi/utils/attach-timeline.mjs +7 -0
  31. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/waapi/utils/get-final-keyframe.mjs +9 -0
  32. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/waapi/utils/linear.mjs +13 -0
  33. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/waapi/utils/memo-supports.mjs +12 -0
  34. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/waapi/utils/style.mjs +10 -0
  35. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/waapi/utils/supports-flags.mjs +6 -0
  36. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/waapi/utils/supports-linear-easing.mjs +12 -0
  37. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/waapi/utils/supports-partial-keyframes.mjs +12 -0
  38. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/waapi/utils/supports-waapi.mjs +5 -0
  39. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/generators/inertia.mjs +67 -0
  40. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/generators/keyframes.mjs +37 -0
  41. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/generators/spring/find.mjs +83 -0
  42. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/generators/spring/index.mjs +83 -0
  43. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/generators/utils/calc-duration.mjs +15 -0
  44. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/generators/utils/is-generator.mjs +6 -0
  45. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/generators/utils/velocity.mjs +9 -0
  46. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/interfaces/motion-value.mjs +73 -0
  47. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/interfaces/visual-element-target.mjs +59 -0
  48. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/optimized-appear/data-id.mjs +7 -0
  49. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/optimized-appear/get-appear-id.mjs +7 -0
  50. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/sequence/create.mjs +153 -0
  51. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/sequence/utils/calc-time.mjs +15 -0
  52. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/sequence/utils/edit.mjs +26 -0
  53. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/sequence/utils/sort.mjs +14 -0
  54. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/utils/create-visual-element.mjs +43 -0
  55. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/utils/default-transitions.mjs +33 -0
  56. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/utils/get-value-transition.mjs +6 -0
  57. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/utils/is-animatable.mjs +16 -0
  58. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/utils/is-animation-controls.mjs +6 -0
  59. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/utils/is-dom-keyframes.mjs +6 -0
  60. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/utils/is-keyframes-target.mjs +6 -0
  61. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/utils/is-none.mjs +13 -0
  62. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/utils/is-transition-defined.mjs +6 -0
  63. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/utils/stagger.mjs +26 -0
  64. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/easing/anticipate.mjs +5 -0
  65. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/easing/back.mjs +11 -0
  66. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/easing/circ.mjs +10 -0
  67. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/easing/cubic-bezier.mjs +28 -0
  68. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/easing/ease.mjs +9 -0
  69. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/easing/modifiers/mirror.mjs +4 -0
  70. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/easing/modifiers/reverse.mjs +4 -0
  71. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/easing/steps.mjs +12 -0
  72. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/easing/utils/create-generator-easing.mjs +14 -0
  73. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/easing/utils/get-easing-for-segment.mjs +8 -0
  74. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/easing/utils/is-bezier-definition.mjs +4 -0
  75. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/easing/utils/is-easing-array.mjs +6 -0
  76. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/easing/utils/map.mjs +35 -0
  77. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/frameloop/batcher.mjs +75 -0
  78. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/frameloop/frame.mjs +9 -0
  79. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/frameloop/index-legacy.mjs +11 -0
  80. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/frameloop/render-step.mjs +63 -0
  81. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/frameloop/sync-time.mjs +21 -0
  82. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/motion/features/definitions.mjs +29 -0
  83. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/motion/utils/is-forced-motion-value.mjs +8 -0
  84. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/projection/geometry/conversion.mjs +22 -0
  85. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/projection/geometry/models.mjs +9 -0
  86. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/projection/styles/scale-correction.mjs +4 -0
  87. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/projection/utils/measure.mjs +7 -0
  88. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/VisualElement.mjs +372 -0
  89. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/DOMKeyframesResolver.mjs +101 -0
  90. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/DOMVisualElement.mjs +21 -0
  91. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/resize/handle-element.mjs +62 -0
  92. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/resize/handle-window.mjs +31 -0
  93. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/resize/index.mjs +8 -0
  94. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/scroll/index.mjs +63 -0
  95. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/scroll/info.mjs +51 -0
  96. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/scroll/observe.mjs +18 -0
  97. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/scroll/offsets/edge.mjs +33 -0
  98. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/scroll/offsets/index.mjs +38 -0
  99. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/scroll/offsets/inset.mjs +36 -0
  100. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/scroll/offsets/offset.mjs +23 -0
  101. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/scroll/offsets/presets.mjs +21 -0
  102. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/scroll/on-scroll-handler.mjs +39 -0
  103. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/scroll/supports.mjs +5 -0
  104. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/scroll/track.mjs +67 -0
  105. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/utils/camel-to-dash.mjs +4 -0
  106. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/utils/css-variables-conversion.mjs +31 -0
  107. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/utils/is-css-variable.mjs +14 -0
  108. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/utils/is-svg-element.mjs +6 -0
  109. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/utils/resolve-element.mjs +23 -0
  110. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/utils/unit-conversion.mjs +65 -0
  111. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/value-types/animatable-none.mjs +12 -0
  112. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/value-types/defaults.mjs +25 -0
  113. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/value-types/dimensions.mjs +10 -0
  114. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/value-types/find.mjs +9 -0
  115. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/value-types/get-as-type.mjs +6 -0
  116. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/value-types/number-browser.mjs +41 -0
  117. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/value-types/number.mjs +18 -0
  118. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/value-types/test.mjs +4 -0
  119. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/value-types/transform.mjs +31 -0
  120. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/value-types/type-auto.mjs +7 -0
  121. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/value-types/type-int.mjs +8 -0
  122. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/viewport/index.mjs +37 -0
  123. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/html/HTMLVisualElement.mjs +55 -0
  124. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/html/utils/build-styles.mjs +42 -0
  125. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/html/utils/build-transform.mjs +47 -0
  126. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/html/utils/make-none-animatable.mjs +22 -0
  127. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/html/utils/render.mjs +9 -0
  128. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/html/utils/scrape-motion-values.mjs +16 -0
  129. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/html/utils/transform.mjs +24 -0
  130. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/object/ObjectVisualElement.mjs +41 -0
  131. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/store.mjs +4 -0
  132. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/svg/SVGVisualElement.mjs +45 -0
  133. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/svg/utils/build-attrs.mjs +46 -0
  134. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/svg/utils/camel-case-attrs.mjs +28 -0
  135. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/svg/utils/is-svg-tag.mjs +4 -0
  136. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/svg/utils/path.mjs +20 -0
  137. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/svg/utils/render.mjs +12 -0
  138. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/svg/utils/scrape-motion-values.mjs +16 -0
  139. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/svg/utils/transform-origin.mjs +12 -0
  140. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/utils/KeyframesResolver.mjs +134 -0
  141. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/utils/is-controlling-variants.mjs +13 -0
  142. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/utils/is-variant-label.mjs +6 -0
  143. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/utils/motion-values.mjs +37 -0
  144. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/utils/resolve-dynamic-variants.mjs +8 -0
  145. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/utils/resolve-variants.mjs +25 -0
  146. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/utils/setters.mjs +22 -0
  147. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/utils/variant-props.mjs +14 -0
  148. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/GlobalConfig.mjs +7 -0
  149. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/array.mjs +13 -0
  150. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/clamp.mjs +10 -0
  151. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/delay.mjs +22 -0
  152. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/distance.mjs +10 -0
  153. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/errors.mjs +19 -0
  154. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/hsla-to-rgba.mjs +39 -0
  155. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/interpolate.mjs +49 -0
  156. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/is-browser.mjs +4 -0
  157. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/is-numerical-string.mjs +4 -0
  158. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/is-zero-value-string.mjs +4 -0
  159. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/memo.mjs +11 -0
  160. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/mix/color.mjs +44 -0
  161. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/mix/complex.mjs +84 -0
  162. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/mix/immediate.mjs +6 -0
  163. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/mix/index.mjs +12 -0
  164. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/mix/number.mjs +6 -0
  165. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/mix/visibility.mjs +12 -0
  166. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/noop.mjs +4 -0
  167. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/offsets/default.mjs +9 -0
  168. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/offsets/fill.mjs +12 -0
  169. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/offsets/time.mjs +6 -0
  170. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/pipe.mjs +5 -0
  171. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/progress.mjs +7 -0
  172. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/reduced-motion/index.mjs +18 -0
  173. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/reduced-motion/state.mjs +6 -0
  174. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/resolve-value.mjs +7 -0
  175. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/subscription-manager.mjs +32 -0
  176. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/time-conversion.mjs +6 -0
  177. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/transform.mjs +21 -0
  178. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/velocity-per-second.mjs +6 -0
  179. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/warn-once.mjs +10 -0
  180. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/wrap.mjs +7 -0
  181. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/index.mjs +282 -0
  182. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/types/color/hex.mjs +37 -0
  183. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/types/color/hsla.mjs +14 -0
  184. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/types/color/index.mjs +21 -0
  185. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/types/color/rgba.mjs +18 -0
  186. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/types/color/utils.mjs +21 -0
  187. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/types/complex/filter.mjs +27 -0
  188. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/types/complex/index.mjs +84 -0
  189. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/types/numbers/index.mjs +19 -0
  190. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/types/numbers/units.mjs +23 -0
  191. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/types/utils/color-regex.mjs +4 -0
  192. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/types/utils/float-regex.mjs +4 -0
  193. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/types/utils/is-nullish.mjs +6 -0
  194. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/types/utils/sanitize.mjs +4 -0
  195. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/types/utils/single-color-regex.mjs +4 -0
  196. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/use-will-change/add-will-change.mjs +10 -0
  197. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/use-will-change/is.mjs +7 -0
  198. package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/utils/is-motion-value.mjs +4 -0
  199. package/dist/es/external/.pnpm/hey-listen@1.0.8/external/hey-listen/dist/hey-listen.es.mjs +20 -0
  200. package/dist/es/features/events.mjs +69 -0
  201. package/dist/es/features/feature-manager.mjs +29 -0
  202. package/dist/es/features/feature.mjs +10 -0
  203. package/dist/es/features/gestures/base.mjs +19 -0
  204. package/dist/es/features/gestures/hover.mjs +42 -0
  205. package/dist/es/features/gestures/in-view.mjs +35 -0
  206. package/dist/es/features/gestures/press.mjs +37 -0
  207. package/dist/es/features/svg.mjs +31 -0
  208. package/dist/es/index.mjs +104 -0
  209. package/dist/es/state/event.mjs +6 -0
  210. package/dist/es/state/motion-state.mjs +175 -0
  211. package/dist/es/state/schedule.mjs +30 -0
  212. package/dist/es/state/style.mjs +117 -0
  213. package/dist/es/state/transform.mjs +68 -0
  214. package/dist/es/state/utils.mjs +119 -0
  215. package/dist/es/utils/createContext.mjs +25 -0
  216. package/dist/es/utils/events.mjs +8 -0
  217. package/dist/es/utils/motion-value.mjs +6 -0
  218. package/dist/es/utils/use-animation-frame.mjs +20 -0
  219. package/dist/es/utils/use-in-view.mjs +25 -0
  220. package/dist/es/value/use-combine-values.mjs +27 -0
  221. package/dist/es/value/use-computed.mjs +20 -0
  222. package/dist/es/value/use-motion-template.mjs +22 -0
  223. package/dist/es/value/use-scroll.mjs +56 -0
  224. package/dist/es/value/use-spring.mjs +59 -0
  225. package/dist/es/value/use-time.mjs +10 -0
  226. package/dist/es/value/use-transform.mjs +29 -0
  227. package/dist/src/animation/index.d.ts +1 -0
  228. package/dist/src/animation/use-animate.d.ts +8 -0
  229. package/dist/src/components/Motion.d.ts +3 -3
  230. package/dist/src/features/events.d.ts +1 -1
  231. package/dist/src/features/feature-manager.d.ts +9 -0
  232. package/dist/src/features/feature.d.ts +0 -7
  233. package/dist/src/features/index.d.ts +2 -1
  234. package/dist/src/index.d.ts +3 -0
  235. package/dist/src/state/motion-state.d.ts +1 -1
  236. package/dist/src/state/utils.d.ts +1 -1
  237. package/dist/src/types/state.d.ts +3 -2
  238. package/dist/src/utils/index.d.ts +2 -0
  239. package/dist/src/utils/use-dom-ref.d.ts +1 -0
  240. package/dist/src/utils/use-in-view.d.ts +3 -0
  241. package/package.json +8 -7
  242. package/dist/index.js +0 -4011
  243. package/dist/index.umd.cjs +0 -1
  244. package/dist/src/components/usePrimitiveElement.d.ts +0 -5
@@ -0,0 +1,372 @@
1
+ import { initPrefersReducedMotion } from "../utils/reduced-motion/index.mjs";
2
+ import { hasReducedMotionListener, prefersReducedMotion } from "../utils/reduced-motion/state.mjs";
3
+ import { SubscriptionManager } from "../utils/subscription-manager.mjs";
4
+ import { motionValue } from "../value/index.mjs";
5
+ import { isMotionValue } from "../value/utils/is-motion-value.mjs";
6
+ import { transformProps } from "./html/utils/transform.mjs";
7
+ import { isControllingVariants, isVariantNode } from "./utils/is-controlling-variants.mjs";
8
+ import { updateMotionValuesFromProps } from "./utils/motion-values.mjs";
9
+ import { resolveVariantFromProps } from "./utils/resolve-variants.mjs";
10
+ import { warnOnce } from "../utils/warn-once.mjs";
11
+ import { featureDefinitions } from "../motion/features/definitions.mjs";
12
+ import { visualElementStore } from "./store.mjs";
13
+ import { KeyframeResolver } from "./utils/KeyframesResolver.mjs";
14
+ import { isNumericalString } from "../utils/is-numerical-string.mjs";
15
+ import { isZeroValueString } from "../utils/is-zero-value-string.mjs";
16
+ import { findValueType } from "./dom/value-types/find.mjs";
17
+ import { complex } from "../value/types/complex/index.mjs";
18
+ import { getAnimatableNone } from "./dom/value-types/animatable-none.mjs";
19
+ import { createBox } from "../projection/geometry/models.mjs";
20
+ import { time } from "../frameloop/sync-time.mjs";
21
+ import { frame, cancelFrame } from "../frameloop/frame.mjs";
22
+ const propEventHandlers = [
23
+ "AnimationStart",
24
+ "AnimationComplete",
25
+ "Update",
26
+ "BeforeLayoutMeasure",
27
+ "LayoutMeasure",
28
+ "LayoutAnimationStart",
29
+ "LayoutAnimationComplete"
30
+ ];
31
+ class VisualElement {
32
+ /**
33
+ * This method takes React props and returns found MotionValues. For example, HTML
34
+ * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
35
+ *
36
+ * This isn't an abstract method as it needs calling in the constructor, but it is
37
+ * intended to be one.
38
+ */
39
+ scrapeMotionValuesFromProps(_props, _prevProps, _visualElement) {
40
+ return {};
41
+ }
42
+ constructor({ parent, props, presenceContext, reducedMotionConfig, blockInitialAnimation, visualState }, options = {}) {
43
+ this.current = null;
44
+ this.children = /* @__PURE__ */ new Set();
45
+ this.isVariantNode = false;
46
+ this.isControllingVariants = false;
47
+ this.shouldReduceMotion = null;
48
+ this.values = /* @__PURE__ */ new Map();
49
+ this.KeyframeResolver = KeyframeResolver;
50
+ this.features = {};
51
+ this.valueSubscriptions = /* @__PURE__ */ new Map();
52
+ this.prevMotionValues = {};
53
+ this.events = {};
54
+ this.propEventSubscriptions = {};
55
+ this.notifyUpdate = () => this.notify("Update", this.latestValues);
56
+ this.render = () => {
57
+ if (!this.current)
58
+ return;
59
+ this.triggerBuild();
60
+ this.renderInstance(this.current, this.renderState, this.props.style, this.projection);
61
+ };
62
+ this.renderScheduledAt = 0;
63
+ this.scheduleRender = () => {
64
+ const now = time.now();
65
+ if (this.renderScheduledAt < now) {
66
+ this.renderScheduledAt = now;
67
+ frame.render(this.render, false, true);
68
+ }
69
+ };
70
+ const { latestValues, renderState } = visualState;
71
+ this.latestValues = latestValues;
72
+ this.baseTarget = { ...latestValues };
73
+ this.initialValues = props.initial ? { ...latestValues } : {};
74
+ this.renderState = renderState;
75
+ this.parent = parent;
76
+ this.props = props;
77
+ this.presenceContext = presenceContext;
78
+ this.depth = parent ? parent.depth + 1 : 0;
79
+ this.reducedMotionConfig = reducedMotionConfig;
80
+ this.options = options;
81
+ this.blockInitialAnimation = Boolean(blockInitialAnimation);
82
+ this.isControllingVariants = isControllingVariants(props);
83
+ this.isVariantNode = isVariantNode(props);
84
+ if (this.isVariantNode) {
85
+ this.variantChildren = /* @__PURE__ */ new Set();
86
+ }
87
+ this.manuallyAnimateOnMount = Boolean(parent && parent.current);
88
+ const { willChange, ...initialMotionValues } = this.scrapeMotionValuesFromProps(props, {}, this);
89
+ for (const key in initialMotionValues) {
90
+ const value = initialMotionValues[key];
91
+ if (latestValues[key] !== void 0 && isMotionValue(value)) {
92
+ value.set(latestValues[key], false);
93
+ }
94
+ }
95
+ }
96
+ mount(instance) {
97
+ this.current = instance;
98
+ visualElementStore.set(instance, this);
99
+ if (this.projection && !this.projection.instance) {
100
+ this.projection.mount(instance);
101
+ }
102
+ if (this.parent && this.isVariantNode && !this.isControllingVariants) {
103
+ this.removeFromVariantTree = this.parent.addVariantChild(this);
104
+ }
105
+ this.values.forEach((value, key) => this.bindToMotionValue(key, value));
106
+ if (!hasReducedMotionListener.current) {
107
+ initPrefersReducedMotion();
108
+ }
109
+ this.shouldReduceMotion = this.reducedMotionConfig === "never" ? false : this.reducedMotionConfig === "always" ? true : prefersReducedMotion.current;
110
+ if (process.env.NODE_ENV !== "production") {
111
+ warnOnce(this.shouldReduceMotion !== true, "You have Reduced Motion enabled on your device. Animations may not appear as expected.");
112
+ }
113
+ if (this.parent)
114
+ this.parent.children.add(this);
115
+ this.update(this.props, this.presenceContext);
116
+ }
117
+ unmount() {
118
+ visualElementStore.delete(this.current);
119
+ this.projection && this.projection.unmount();
120
+ cancelFrame(this.notifyUpdate);
121
+ cancelFrame(this.render);
122
+ this.valueSubscriptions.forEach((remove) => remove());
123
+ this.valueSubscriptions.clear();
124
+ this.removeFromVariantTree && this.removeFromVariantTree();
125
+ this.parent && this.parent.children.delete(this);
126
+ for (const key in this.events) {
127
+ this.events[key].clear();
128
+ }
129
+ for (const key in this.features) {
130
+ const feature = this.features[key];
131
+ if (feature) {
132
+ feature.unmount();
133
+ feature.isMounted = false;
134
+ }
135
+ }
136
+ this.current = null;
137
+ }
138
+ bindToMotionValue(key, value) {
139
+ if (this.valueSubscriptions.has(key)) {
140
+ this.valueSubscriptions.get(key)();
141
+ }
142
+ const valueIsTransform = transformProps.has(key);
143
+ const removeOnChange = value.on("change", (latestValue) => {
144
+ this.latestValues[key] = latestValue;
145
+ this.props.onUpdate && frame.preRender(this.notifyUpdate);
146
+ if (valueIsTransform && this.projection) {
147
+ this.projection.isTransformDirty = true;
148
+ }
149
+ });
150
+ const removeOnRenderRequest = value.on("renderRequest", this.scheduleRender);
151
+ let removeSyncCheck;
152
+ if (window.MotionCheckAppearSync) {
153
+ removeSyncCheck = window.MotionCheckAppearSync(this, key, value);
154
+ }
155
+ this.valueSubscriptions.set(key, () => {
156
+ removeOnChange();
157
+ removeOnRenderRequest();
158
+ if (removeSyncCheck)
159
+ removeSyncCheck();
160
+ if (value.owner)
161
+ value.stop();
162
+ });
163
+ }
164
+ sortNodePosition(other) {
165
+ if (!this.current || !this.sortInstanceNodePosition || this.type !== other.type) {
166
+ return 0;
167
+ }
168
+ return this.sortInstanceNodePosition(this.current, other.current);
169
+ }
170
+ updateFeatures() {
171
+ let key = "animation";
172
+ for (key in featureDefinitions) {
173
+ const featureDefinition = featureDefinitions[key];
174
+ if (!featureDefinition)
175
+ continue;
176
+ const { isEnabled, Feature: FeatureConstructor } = featureDefinition;
177
+ if (!this.features[key] && FeatureConstructor && isEnabled(this.props)) {
178
+ this.features[key] = new FeatureConstructor(this);
179
+ }
180
+ if (this.features[key]) {
181
+ const feature = this.features[key];
182
+ if (feature.isMounted) {
183
+ feature.update();
184
+ } else {
185
+ feature.mount();
186
+ feature.isMounted = true;
187
+ }
188
+ }
189
+ }
190
+ }
191
+ triggerBuild() {
192
+ this.build(this.renderState, this.latestValues, this.props);
193
+ }
194
+ /**
195
+ * Measure the current viewport box with or without transforms.
196
+ * Only measures axis-aligned boxes, rotate and skew must be manually
197
+ * removed with a re-render to work.
198
+ */
199
+ measureViewportBox() {
200
+ return this.current ? this.measureInstanceViewportBox(this.current, this.props) : createBox();
201
+ }
202
+ getStaticValue(key) {
203
+ return this.latestValues[key];
204
+ }
205
+ setStaticValue(key, value) {
206
+ this.latestValues[key] = value;
207
+ }
208
+ /**
209
+ * Update the provided props. Ensure any newly-added motion values are
210
+ * added to our map, old ones removed, and listeners updated.
211
+ */
212
+ update(props, presenceContext) {
213
+ if (props.transformTemplate || this.props.transformTemplate) {
214
+ this.scheduleRender();
215
+ }
216
+ this.prevProps = this.props;
217
+ this.props = props;
218
+ this.prevPresenceContext = this.presenceContext;
219
+ this.presenceContext = presenceContext;
220
+ for (let i = 0; i < propEventHandlers.length; i++) {
221
+ const key = propEventHandlers[i];
222
+ if (this.propEventSubscriptions[key]) {
223
+ this.propEventSubscriptions[key]();
224
+ delete this.propEventSubscriptions[key];
225
+ }
226
+ const listenerName = "on" + key;
227
+ const listener = props[listenerName];
228
+ if (listener) {
229
+ this.propEventSubscriptions[key] = this.on(key, listener);
230
+ }
231
+ }
232
+ this.prevMotionValues = updateMotionValuesFromProps(this, this.scrapeMotionValuesFromProps(props, this.prevProps, this), this.prevMotionValues);
233
+ if (this.handleChildMotionValue) {
234
+ this.handleChildMotionValue();
235
+ }
236
+ }
237
+ getProps() {
238
+ return this.props;
239
+ }
240
+ /**
241
+ * Returns the variant definition with a given name.
242
+ */
243
+ getVariant(name) {
244
+ return this.props.variants ? this.props.variants[name] : void 0;
245
+ }
246
+ /**
247
+ * Returns the defined default transition on this component.
248
+ */
249
+ getDefaultTransition() {
250
+ return this.props.transition;
251
+ }
252
+ getTransformPagePoint() {
253
+ return this.props.transformPagePoint;
254
+ }
255
+ getClosestVariantNode() {
256
+ return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : void 0;
257
+ }
258
+ /**
259
+ * Add a child visual element to our set of children.
260
+ */
261
+ addVariantChild(child) {
262
+ const closestVariantNode = this.getClosestVariantNode();
263
+ if (closestVariantNode) {
264
+ closestVariantNode.variantChildren && closestVariantNode.variantChildren.add(child);
265
+ return () => closestVariantNode.variantChildren.delete(child);
266
+ }
267
+ }
268
+ /**
269
+ * Add a motion value and bind it to this visual element.
270
+ */
271
+ addValue(key, value) {
272
+ const existingValue = this.values.get(key);
273
+ if (value !== existingValue) {
274
+ if (existingValue)
275
+ this.removeValue(key);
276
+ this.bindToMotionValue(key, value);
277
+ this.values.set(key, value);
278
+ this.latestValues[key] = value.get();
279
+ }
280
+ }
281
+ /**
282
+ * Remove a motion value and unbind any active subscriptions.
283
+ */
284
+ removeValue(key) {
285
+ this.values.delete(key);
286
+ const unsubscribe = this.valueSubscriptions.get(key);
287
+ if (unsubscribe) {
288
+ unsubscribe();
289
+ this.valueSubscriptions.delete(key);
290
+ }
291
+ delete this.latestValues[key];
292
+ this.removeValueFromRenderState(key, this.renderState);
293
+ }
294
+ /**
295
+ * Check whether we have a motion value for this key
296
+ */
297
+ hasValue(key) {
298
+ return this.values.has(key);
299
+ }
300
+ getValue(key, defaultValue) {
301
+ if (this.props.values && this.props.values[key]) {
302
+ return this.props.values[key];
303
+ }
304
+ let value = this.values.get(key);
305
+ if (value === void 0 && defaultValue !== void 0) {
306
+ value = motionValue(defaultValue === null ? void 0 : defaultValue, { owner: this });
307
+ this.addValue(key, value);
308
+ }
309
+ return value;
310
+ }
311
+ /**
312
+ * If we're trying to animate to a previously unencountered value,
313
+ * we need to check for it in our state and as a last resort read it
314
+ * directly from the instance (which might have performance implications).
315
+ */
316
+ readValue(key, target) {
317
+ var _a;
318
+ let value = this.latestValues[key] !== void 0 || !this.current ? this.latestValues[key] : (_a = this.getBaseTargetFromProps(this.props, key)) !== null && _a !== void 0 ? _a : this.readValueFromInstance(this.current, key, this.options);
319
+ if (value !== void 0 && value !== null) {
320
+ if (typeof value === "string" && (isNumericalString(value) || isZeroValueString(value))) {
321
+ value = parseFloat(value);
322
+ } else if (!findValueType(value) && complex.test(target)) {
323
+ value = getAnimatableNone(key, target);
324
+ }
325
+ this.setBaseTarget(key, isMotionValue(value) ? value.get() : value);
326
+ }
327
+ return isMotionValue(value) ? value.get() : value;
328
+ }
329
+ /**
330
+ * Set the base target to later animate back to. This is currently
331
+ * only hydrated on creation and when we first read a value.
332
+ */
333
+ setBaseTarget(key, value) {
334
+ this.baseTarget[key] = value;
335
+ }
336
+ /**
337
+ * Find the base target for a value thats been removed from all animation
338
+ * props.
339
+ */
340
+ getBaseTarget(key) {
341
+ var _a;
342
+ const { initial } = this.props;
343
+ let valueFromInitial;
344
+ if (typeof initial === "string" || typeof initial === "object") {
345
+ const variant = resolveVariantFromProps(this.props, initial, (_a = this.presenceContext) === null || _a === void 0 ? void 0 : _a.custom);
346
+ if (variant) {
347
+ valueFromInitial = variant[key];
348
+ }
349
+ }
350
+ if (initial && valueFromInitial !== void 0) {
351
+ return valueFromInitial;
352
+ }
353
+ const target = this.getBaseTargetFromProps(this.props, key);
354
+ if (target !== void 0 && !isMotionValue(target))
355
+ return target;
356
+ return this.initialValues[key] !== void 0 && valueFromInitial === void 0 ? void 0 : this.baseTarget[key];
357
+ }
358
+ on(eventName, callback) {
359
+ if (!this.events[eventName]) {
360
+ this.events[eventName] = new SubscriptionManager();
361
+ }
362
+ return this.events[eventName].add(callback);
363
+ }
364
+ notify(eventName, ...args) {
365
+ if (this.events[eventName]) {
366
+ this.events[eventName].notify(...args);
367
+ }
368
+ }
369
+ }
370
+ export {
371
+ VisualElement
372
+ };
@@ -0,0 +1,101 @@
1
+ import { isNone } from "../../animation/utils/is-none.mjs";
2
+ import { getVariableValue } from "./utils/css-variables-conversion.mjs";
3
+ import { isCSSVariableToken } from "./utils/is-css-variable.mjs";
4
+ import { positionalKeys, isNumOrPxType, positionalValues } from "./utils/unit-conversion.mjs";
5
+ import { findDimensionValueType } from "./value-types/dimensions.mjs";
6
+ import { KeyframeResolver } from "../utils/KeyframesResolver.mjs";
7
+ import { makeNoneKeyframesAnimatable } from "../html/utils/make-none-animatable.mjs";
8
+ class DOMKeyframesResolver extends KeyframeResolver {
9
+ constructor(unresolvedKeyframes, onComplete, name, motionValue, element) {
10
+ super(unresolvedKeyframes, onComplete, name, motionValue, element, true);
11
+ }
12
+ readKeyframes() {
13
+ const { unresolvedKeyframes, element, name } = this;
14
+ if (!element || !element.current)
15
+ return;
16
+ super.readKeyframes();
17
+ for (let i = 0; i < unresolvedKeyframes.length; i++) {
18
+ let keyframe = unresolvedKeyframes[i];
19
+ if (typeof keyframe === "string") {
20
+ keyframe = keyframe.trim();
21
+ if (isCSSVariableToken(keyframe)) {
22
+ const resolved = getVariableValue(keyframe, element.current);
23
+ if (resolved !== void 0) {
24
+ unresolvedKeyframes[i] = resolved;
25
+ }
26
+ if (i === unresolvedKeyframes.length - 1) {
27
+ this.finalKeyframe = keyframe;
28
+ }
29
+ }
30
+ }
31
+ }
32
+ this.resolveNoneKeyframes();
33
+ if (!positionalKeys.has(name) || unresolvedKeyframes.length !== 2) {
34
+ return;
35
+ }
36
+ const [origin, target] = unresolvedKeyframes;
37
+ const originType = findDimensionValueType(origin);
38
+ const targetType = findDimensionValueType(target);
39
+ if (originType === targetType)
40
+ return;
41
+ if (isNumOrPxType(originType) && isNumOrPxType(targetType)) {
42
+ for (let i = 0; i < unresolvedKeyframes.length; i++) {
43
+ const value = unresolvedKeyframes[i];
44
+ if (typeof value === "string") {
45
+ unresolvedKeyframes[i] = parseFloat(value);
46
+ }
47
+ }
48
+ } else {
49
+ this.needsMeasurement = true;
50
+ }
51
+ }
52
+ resolveNoneKeyframes() {
53
+ const { unresolvedKeyframes, name } = this;
54
+ const noneKeyframeIndexes = [];
55
+ for (let i = 0; i < unresolvedKeyframes.length; i++) {
56
+ if (isNone(unresolvedKeyframes[i])) {
57
+ noneKeyframeIndexes.push(i);
58
+ }
59
+ }
60
+ if (noneKeyframeIndexes.length) {
61
+ makeNoneKeyframesAnimatable(unresolvedKeyframes, noneKeyframeIndexes, name);
62
+ }
63
+ }
64
+ measureInitialState() {
65
+ const { element, unresolvedKeyframes, name } = this;
66
+ if (!element || !element.current)
67
+ return;
68
+ if (name === "height") {
69
+ this.suspendedScrollY = window.pageYOffset;
70
+ }
71
+ this.measuredOrigin = positionalValues[name](element.measureViewportBox(), window.getComputedStyle(element.current));
72
+ unresolvedKeyframes[0] = this.measuredOrigin;
73
+ const measureKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1];
74
+ if (measureKeyframe !== void 0) {
75
+ element.getValue(name, measureKeyframe).jump(measureKeyframe, false);
76
+ }
77
+ }
78
+ measureEndState() {
79
+ var _a;
80
+ const { element, name, unresolvedKeyframes } = this;
81
+ if (!element || !element.current)
82
+ return;
83
+ const value = element.getValue(name);
84
+ value && value.jump(this.measuredOrigin, false);
85
+ const finalKeyframeIndex = unresolvedKeyframes.length - 1;
86
+ const finalKeyframe = unresolvedKeyframes[finalKeyframeIndex];
87
+ unresolvedKeyframes[finalKeyframeIndex] = positionalValues[name](element.measureViewportBox(), window.getComputedStyle(element.current));
88
+ if (finalKeyframe !== null && this.finalKeyframe === void 0) {
89
+ this.finalKeyframe = finalKeyframe;
90
+ }
91
+ if ((_a = this.removedTransforms) === null || _a === void 0 ? void 0 : _a.length) {
92
+ this.removedTransforms.forEach(([unsetTransformName, unsetTransformValue]) => {
93
+ element.getValue(unsetTransformName).set(unsetTransformValue);
94
+ });
95
+ }
96
+ this.resolveNoneKeyframes();
97
+ }
98
+ }
99
+ export {
100
+ DOMKeyframesResolver
101
+ };
@@ -0,0 +1,21 @@
1
+ import { VisualElement } from "../VisualElement.mjs";
2
+ import { DOMKeyframesResolver } from "./DOMKeyframesResolver.mjs";
3
+ class DOMVisualElement extends VisualElement {
4
+ constructor() {
5
+ super(...arguments);
6
+ this.KeyframeResolver = DOMKeyframesResolver;
7
+ }
8
+ sortInstanceNodePosition(a, b) {
9
+ return a.compareDocumentPosition(b) & 2 ? 1 : -1;
10
+ }
11
+ getBaseTargetFromProps(props, key) {
12
+ return props.style ? props.style[key] : void 0;
13
+ }
14
+ removeValueFromRenderState(key, { vars, style }) {
15
+ delete vars[key];
16
+ delete style[key];
17
+ }
18
+ }
19
+ export {
20
+ DOMVisualElement
21
+ };
@@ -0,0 +1,62 @@
1
+ import { resolveElements } from "../utils/resolve-element.mjs";
2
+ const resizeHandlers = /* @__PURE__ */ new WeakMap();
3
+ let observer;
4
+ function getElementSize(target, borderBoxSize) {
5
+ if (borderBoxSize) {
6
+ const { inlineSize, blockSize } = borderBoxSize[0];
7
+ return { width: inlineSize, height: blockSize };
8
+ } else if (target instanceof SVGElement && "getBBox" in target) {
9
+ return target.getBBox();
10
+ } else {
11
+ return {
12
+ width: target.offsetWidth,
13
+ height: target.offsetHeight
14
+ };
15
+ }
16
+ }
17
+ function notifyTarget({ target, contentRect, borderBoxSize }) {
18
+ var _a;
19
+ (_a = resizeHandlers.get(target)) === null || _a === void 0 ? void 0 : _a.forEach((handler) => {
20
+ handler({
21
+ target,
22
+ contentSize: contentRect,
23
+ get size() {
24
+ return getElementSize(target, borderBoxSize);
25
+ }
26
+ });
27
+ });
28
+ }
29
+ function notifyAll(entries) {
30
+ entries.forEach(notifyTarget);
31
+ }
32
+ function createResizeObserver() {
33
+ if (typeof ResizeObserver === "undefined")
34
+ return;
35
+ observer = new ResizeObserver(notifyAll);
36
+ }
37
+ function resizeElement(target, handler) {
38
+ if (!observer)
39
+ createResizeObserver();
40
+ const elements = resolveElements(target);
41
+ elements.forEach((element) => {
42
+ let elementHandlers = resizeHandlers.get(element);
43
+ if (!elementHandlers) {
44
+ elementHandlers = /* @__PURE__ */ new Set();
45
+ resizeHandlers.set(element, elementHandlers);
46
+ }
47
+ elementHandlers.add(handler);
48
+ observer === null || observer === void 0 ? void 0 : observer.observe(element);
49
+ });
50
+ return () => {
51
+ elements.forEach((element) => {
52
+ const elementHandlers = resizeHandlers.get(element);
53
+ elementHandlers === null || elementHandlers === void 0 ? void 0 : elementHandlers.delete(handler);
54
+ if (!(elementHandlers === null || elementHandlers === void 0 ? void 0 : elementHandlers.size)) {
55
+ observer === null || observer === void 0 ? void 0 : observer.unobserve(element);
56
+ }
57
+ });
58
+ };
59
+ }
60
+ export {
61
+ resizeElement
62
+ };
@@ -0,0 +1,31 @@
1
+ const windowCallbacks = /* @__PURE__ */ new Set();
2
+ let windowResizeHandler;
3
+ function createWindowResizeHandler() {
4
+ windowResizeHandler = () => {
5
+ const size = {
6
+ width: window.innerWidth,
7
+ height: window.innerHeight
8
+ };
9
+ const info = {
10
+ target: window,
11
+ size,
12
+ contentSize: size
13
+ };
14
+ windowCallbacks.forEach((callback) => callback(info));
15
+ };
16
+ window.addEventListener("resize", windowResizeHandler);
17
+ }
18
+ function resizeWindow(callback) {
19
+ windowCallbacks.add(callback);
20
+ if (!windowResizeHandler)
21
+ createWindowResizeHandler();
22
+ return () => {
23
+ windowCallbacks.delete(callback);
24
+ if (!windowCallbacks.size && windowResizeHandler) {
25
+ windowResizeHandler = void 0;
26
+ }
27
+ };
28
+ }
29
+ export {
30
+ resizeWindow
31
+ };
@@ -0,0 +1,8 @@
1
+ import { resizeElement } from "./handle-element.mjs";
2
+ import { resizeWindow } from "./handle-window.mjs";
3
+ function resize(a, b) {
4
+ return typeof a === "function" ? resizeWindow(a) : resizeElement(a, b);
5
+ }
6
+ export {
7
+ resize
8
+ };
@@ -0,0 +1,63 @@
1
+ import { scrollInfo } from "./track.mjs";
2
+ import { observeTimeline } from "./observe.mjs";
3
+ import { supportsScrollTimeline } from "./supports.mjs";
4
+ function scrollTimelineFallback({ source, container, axis = "y" }) {
5
+ if (source)
6
+ container = source;
7
+ const currentTime = { value: 0 };
8
+ const cancel = scrollInfo((info) => {
9
+ currentTime.value = info[axis].progress * 100;
10
+ }, { container, axis });
11
+ return { currentTime, cancel };
12
+ }
13
+ const timelineCache = /* @__PURE__ */ new Map();
14
+ function getTimeline({ source, container = document.documentElement, axis = "y" } = {}) {
15
+ if (source)
16
+ container = source;
17
+ if (!timelineCache.has(container)) {
18
+ timelineCache.set(container, {});
19
+ }
20
+ const elementCache = timelineCache.get(container);
21
+ if (!elementCache[axis]) {
22
+ elementCache[axis] = supportsScrollTimeline() ? new ScrollTimeline({ source: container, axis }) : scrollTimelineFallback({ source: container, axis });
23
+ }
24
+ return elementCache[axis];
25
+ }
26
+ function isOnScrollWithInfo(onScroll) {
27
+ return onScroll.length === 2;
28
+ }
29
+ function needsElementTracking(options) {
30
+ return options && (options.target || options.offset);
31
+ }
32
+ function scrollFunction(onScroll, options) {
33
+ if (isOnScrollWithInfo(onScroll) || needsElementTracking(options)) {
34
+ return scrollInfo((info) => {
35
+ onScroll(info[options.axis].progress, info);
36
+ }, options);
37
+ } else {
38
+ return observeTimeline(onScroll, getTimeline(options));
39
+ }
40
+ }
41
+ function scrollAnimation(animation, options) {
42
+ if (needsElementTracking(options)) {
43
+ animation.pause();
44
+ return scrollInfo((info) => {
45
+ animation.time = animation.duration * info[options.axis].progress;
46
+ }, options);
47
+ } else {
48
+ const timeline = getTimeline(options);
49
+ return animation.attachTimeline(timeline, (valueAnimation) => {
50
+ valueAnimation.pause();
51
+ return observeTimeline((progress) => {
52
+ valueAnimation.time = valueAnimation.duration * progress;
53
+ }, timeline);
54
+ });
55
+ }
56
+ }
57
+ function scroll(onScroll, { axis = "y", ...options } = {}) {
58
+ const optionsWithDefaults = { axis, ...options };
59
+ return typeof onScroll === "function" ? scrollFunction(onScroll, optionsWithDefaults) : scrollAnimation(onScroll, optionsWithDefaults);
60
+ }
61
+ export {
62
+ scroll
63
+ };