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,6 @@
1
+ function velocityPerSecond(velocity, frameDuration) {
2
+ return frameDuration ? velocity * (1e3 / frameDuration) : 0;
3
+ }
4
+ export {
5
+ velocityPerSecond
6
+ };
@@ -0,0 +1,10 @@
1
+ const warned = /* @__PURE__ */ new Set();
2
+ function warnOnce(condition, message, element) {
3
+ if (condition || warned.has(message))
4
+ return;
5
+ console.warn(message);
6
+ warned.add(message);
7
+ }
8
+ export {
9
+ warnOnce
10
+ };
@@ -0,0 +1,7 @@
1
+ const wrap = (min, max, v) => {
2
+ const rangeSize = max - min;
3
+ return ((v - min) % rangeSize + rangeSize) % rangeSize + min;
4
+ };
5
+ export {
6
+ wrap
7
+ };
@@ -0,0 +1,282 @@
1
+ import { SubscriptionManager } from "../utils/subscription-manager.mjs";
2
+ import { velocityPerSecond } from "../utils/velocity-per-second.mjs";
3
+ import { warnOnce } from "../utils/warn-once.mjs";
4
+ import { time } from "../frameloop/sync-time.mjs";
5
+ import { frame } from "../frameloop/frame.mjs";
6
+ const MAX_VELOCITY_DELTA = 30;
7
+ const isFloat = (value) => {
8
+ return !isNaN(parseFloat(value));
9
+ };
10
+ const collectMotionValues = {
11
+ current: void 0
12
+ };
13
+ class MotionValue {
14
+ /**
15
+ * @param init - The initiating value
16
+ * @param config - Optional configuration options
17
+ *
18
+ * - `transformer`: A function to transform incoming values with.
19
+ *
20
+ * @internal
21
+ */
22
+ constructor(init, options = {}) {
23
+ this.version = "11.11.11";
24
+ this.canTrackVelocity = null;
25
+ this.events = {};
26
+ this.updateAndNotify = (v, render = true) => {
27
+ const currentTime = time.now();
28
+ if (this.updatedAt !== currentTime) {
29
+ this.setPrevFrameValue();
30
+ }
31
+ this.prev = this.current;
32
+ this.setCurrent(v);
33
+ if (this.current !== this.prev && this.events.change) {
34
+ this.events.change.notify(this.current);
35
+ }
36
+ if (render && this.events.renderRequest) {
37
+ this.events.renderRequest.notify(this.current);
38
+ }
39
+ };
40
+ this.hasAnimated = false;
41
+ this.setCurrent(init);
42
+ this.owner = options.owner;
43
+ }
44
+ setCurrent(current) {
45
+ this.current = current;
46
+ this.updatedAt = time.now();
47
+ if (this.canTrackVelocity === null && current !== void 0) {
48
+ this.canTrackVelocity = isFloat(this.current);
49
+ }
50
+ }
51
+ setPrevFrameValue(prevFrameValue = this.current) {
52
+ this.prevFrameValue = prevFrameValue;
53
+ this.prevUpdatedAt = this.updatedAt;
54
+ }
55
+ /**
56
+ * Adds a function that will be notified when the `MotionValue` is updated.
57
+ *
58
+ * It returns a function that, when called, will cancel the subscription.
59
+ *
60
+ * When calling `onChange` inside a React component, it should be wrapped with the
61
+ * `useEffect` hook. As it returns an unsubscribe function, this should be returned
62
+ * from the `useEffect` function to ensure you don't add duplicate subscribers..
63
+ *
64
+ * ```jsx
65
+ * export const MyComponent = () => {
66
+ * const x = useMotionValue(0)
67
+ * const y = useMotionValue(0)
68
+ * const opacity = useMotionValue(1)
69
+ *
70
+ * useEffect(() => {
71
+ * function updateOpacity() {
72
+ * const maxXY = Math.max(x.get(), y.get())
73
+ * const newOpacity = transform(maxXY, [0, 100], [1, 0])
74
+ * opacity.set(newOpacity)
75
+ * }
76
+ *
77
+ * const unsubscribeX = x.on("change", updateOpacity)
78
+ * const unsubscribeY = y.on("change", updateOpacity)
79
+ *
80
+ * return () => {
81
+ * unsubscribeX()
82
+ * unsubscribeY()
83
+ * }
84
+ * }, [])
85
+ *
86
+ * return <motion.div style={{ x }} />
87
+ * }
88
+ * ```
89
+ *
90
+ * @param subscriber - A function that receives the latest value.
91
+ * @returns A function that, when called, will cancel this subscription.
92
+ *
93
+ * @deprecated
94
+ */
95
+ onChange(subscription) {
96
+ if (process.env.NODE_ENV !== "production") {
97
+ warnOnce(false, `value.onChange(callback) is deprecated. Switch to value.on("change", callback).`);
98
+ }
99
+ return this.on("change", subscription);
100
+ }
101
+ on(eventName, callback) {
102
+ if (!this.events[eventName]) {
103
+ this.events[eventName] = new SubscriptionManager();
104
+ }
105
+ const unsubscribe = this.events[eventName].add(callback);
106
+ if (eventName === "change") {
107
+ return () => {
108
+ unsubscribe();
109
+ frame.read(() => {
110
+ if (!this.events.change.getSize()) {
111
+ this.stop();
112
+ }
113
+ });
114
+ };
115
+ }
116
+ return unsubscribe;
117
+ }
118
+ clearListeners() {
119
+ for (const eventManagers in this.events) {
120
+ this.events[eventManagers].clear();
121
+ }
122
+ }
123
+ /**
124
+ * Attaches a passive effect to the `MotionValue`.
125
+ *
126
+ * @internal
127
+ */
128
+ attach(passiveEffect, stopPassiveEffect) {
129
+ this.passiveEffect = passiveEffect;
130
+ this.stopPassiveEffect = stopPassiveEffect;
131
+ }
132
+ /**
133
+ * Sets the state of the `MotionValue`.
134
+ *
135
+ * @remarks
136
+ *
137
+ * ```jsx
138
+ * const x = useMotionValue(0)
139
+ * x.set(10)
140
+ * ```
141
+ *
142
+ * @param latest - Latest value to set.
143
+ * @param render - Whether to notify render subscribers. Defaults to `true`
144
+ *
145
+ * @public
146
+ */
147
+ set(v, render = true) {
148
+ if (!render || !this.passiveEffect) {
149
+ this.updateAndNotify(v, render);
150
+ } else {
151
+ this.passiveEffect(v, this.updateAndNotify);
152
+ }
153
+ }
154
+ setWithVelocity(prev, current, delta) {
155
+ this.set(current);
156
+ this.prev = void 0;
157
+ this.prevFrameValue = prev;
158
+ this.prevUpdatedAt = this.updatedAt - delta;
159
+ }
160
+ /**
161
+ * Set the state of the `MotionValue`, stopping any active animations,
162
+ * effects, and resets velocity to `0`.
163
+ */
164
+ jump(v, endAnimation = true) {
165
+ this.updateAndNotify(v);
166
+ this.prev = v;
167
+ this.prevUpdatedAt = this.prevFrameValue = void 0;
168
+ endAnimation && this.stop();
169
+ if (this.stopPassiveEffect)
170
+ this.stopPassiveEffect();
171
+ }
172
+ /**
173
+ * Returns the latest state of `MotionValue`
174
+ *
175
+ * @returns - The latest state of `MotionValue`
176
+ *
177
+ * @public
178
+ */
179
+ get() {
180
+ if (collectMotionValues.current) {
181
+ collectMotionValues.current.push(this);
182
+ }
183
+ return this.current;
184
+ }
185
+ /**
186
+ * @public
187
+ */
188
+ getPrevious() {
189
+ return this.prev;
190
+ }
191
+ /**
192
+ * Returns the latest velocity of `MotionValue`
193
+ *
194
+ * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
195
+ *
196
+ * @public
197
+ */
198
+ getVelocity() {
199
+ const currentTime = time.now();
200
+ if (!this.canTrackVelocity || this.prevFrameValue === void 0 || currentTime - this.updatedAt > MAX_VELOCITY_DELTA) {
201
+ return 0;
202
+ }
203
+ const delta = Math.min(this.updatedAt - this.prevUpdatedAt, MAX_VELOCITY_DELTA);
204
+ return velocityPerSecond(parseFloat(this.current) - parseFloat(this.prevFrameValue), delta);
205
+ }
206
+ /**
207
+ * Registers a new animation to control this `MotionValue`. Only one
208
+ * animation can drive a `MotionValue` at one time.
209
+ *
210
+ * ```jsx
211
+ * value.start()
212
+ * ```
213
+ *
214
+ * @param animation - A function that starts the provided animation
215
+ *
216
+ * @internal
217
+ */
218
+ start(startAnimation) {
219
+ this.stop();
220
+ return new Promise((resolve) => {
221
+ this.hasAnimated = true;
222
+ this.animation = startAnimation(resolve);
223
+ if (this.events.animationStart) {
224
+ this.events.animationStart.notify();
225
+ }
226
+ }).then(() => {
227
+ if (this.events.animationComplete) {
228
+ this.events.animationComplete.notify();
229
+ }
230
+ this.clearAnimation();
231
+ });
232
+ }
233
+ /**
234
+ * Stop the currently active animation.
235
+ *
236
+ * @public
237
+ */
238
+ stop() {
239
+ if (this.animation) {
240
+ this.animation.stop();
241
+ if (this.events.animationCancel) {
242
+ this.events.animationCancel.notify();
243
+ }
244
+ }
245
+ this.clearAnimation();
246
+ }
247
+ /**
248
+ * Returns `true` if this value is currently animating.
249
+ *
250
+ * @public
251
+ */
252
+ isAnimating() {
253
+ return !!this.animation;
254
+ }
255
+ clearAnimation() {
256
+ delete this.animation;
257
+ }
258
+ /**
259
+ * Destroy and clean up subscribers to this `MotionValue`.
260
+ *
261
+ * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
262
+ * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
263
+ * created a `MotionValue` via the `motionValue` function.
264
+ *
265
+ * @public
266
+ */
267
+ destroy() {
268
+ this.clearListeners();
269
+ this.stop();
270
+ if (this.stopPassiveEffect) {
271
+ this.stopPassiveEffect();
272
+ }
273
+ }
274
+ }
275
+ function motionValue(init, options) {
276
+ return new MotionValue(init, options);
277
+ }
278
+ export {
279
+ MotionValue,
280
+ collectMotionValues,
281
+ motionValue
282
+ };
@@ -0,0 +1,37 @@
1
+ import { rgba } from "./rgba.mjs";
2
+ import { isColorString } from "./utils.mjs";
3
+ function parseHex(v) {
4
+ let r = "";
5
+ let g = "";
6
+ let b = "";
7
+ let a = "";
8
+ if (v.length > 5) {
9
+ r = v.substring(1, 3);
10
+ g = v.substring(3, 5);
11
+ b = v.substring(5, 7);
12
+ a = v.substring(7, 9);
13
+ } else {
14
+ r = v.substring(1, 2);
15
+ g = v.substring(2, 3);
16
+ b = v.substring(3, 4);
17
+ a = v.substring(4, 5);
18
+ r += r;
19
+ g += g;
20
+ b += b;
21
+ a += a;
22
+ }
23
+ return {
24
+ red: parseInt(r, 16),
25
+ green: parseInt(g, 16),
26
+ blue: parseInt(b, 16),
27
+ alpha: a ? parseInt(a, 16) / 255 : 1
28
+ };
29
+ }
30
+ const hex = {
31
+ test: /* @__PURE__ */ isColorString("#"),
32
+ parse: parseHex,
33
+ transform: rgba.transform
34
+ };
35
+ export {
36
+ hex
37
+ };
@@ -0,0 +1,14 @@
1
+ import { alpha } from "../numbers/index.mjs";
2
+ import { percent } from "../numbers/units.mjs";
3
+ import { sanitize } from "../utils/sanitize.mjs";
4
+ import { isColorString, splitColor } from "./utils.mjs";
5
+ const hsla = {
6
+ test: /* @__PURE__ */ isColorString("hsl", "hue"),
7
+ parse: /* @__PURE__ */ splitColor("hue", "saturation", "lightness"),
8
+ transform: ({ hue, saturation, lightness, alpha: alpha$1 = 1 }) => {
9
+ return "hsla(" + Math.round(hue) + ", " + percent.transform(sanitize(saturation)) + ", " + percent.transform(sanitize(lightness)) + ", " + sanitize(alpha.transform(alpha$1)) + ")";
10
+ }
11
+ };
12
+ export {
13
+ hsla
14
+ };
@@ -0,0 +1,21 @@
1
+ import { hex } from "./hex.mjs";
2
+ import { hsla } from "./hsla.mjs";
3
+ import { rgba } from "./rgba.mjs";
4
+ const color = {
5
+ test: (v) => rgba.test(v) || hex.test(v) || hsla.test(v),
6
+ parse: (v) => {
7
+ if (rgba.test(v)) {
8
+ return rgba.parse(v);
9
+ } else if (hsla.test(v)) {
10
+ return hsla.parse(v);
11
+ } else {
12
+ return hex.parse(v);
13
+ }
14
+ },
15
+ transform: (v) => {
16
+ return typeof v === "string" ? v : v.hasOwnProperty("red") ? rgba.transform(v) : hsla.transform(v);
17
+ }
18
+ };
19
+ export {
20
+ color
21
+ };
@@ -0,0 +1,18 @@
1
+ import { clamp } from "../../../utils/clamp.mjs";
2
+ import { number, alpha } from "../numbers/index.mjs";
3
+ import { sanitize } from "../utils/sanitize.mjs";
4
+ import { isColorString, splitColor } from "./utils.mjs";
5
+ const clampRgbUnit = (v) => clamp(0, 255, v);
6
+ const rgbUnit = {
7
+ ...number,
8
+ transform: (v) => Math.round(clampRgbUnit(v))
9
+ };
10
+ const rgba = {
11
+ test: /* @__PURE__ */ isColorString("rgb", "red"),
12
+ parse: /* @__PURE__ */ splitColor("red", "green", "blue"),
13
+ transform: ({ red, green, blue, alpha: alpha$1 = 1 }) => "rgba(" + rgbUnit.transform(red) + ", " + rgbUnit.transform(green) + ", " + rgbUnit.transform(blue) + ", " + sanitize(alpha.transform(alpha$1)) + ")"
14
+ };
15
+ export {
16
+ rgbUnit,
17
+ rgba
18
+ };
@@ -0,0 +1,21 @@
1
+ import { floatRegex } from "../utils/float-regex.mjs";
2
+ import { isNullish } from "../utils/is-nullish.mjs";
3
+ import { singleColorRegex } from "../utils/single-color-regex.mjs";
4
+ const isColorString = (type, testProp) => (v) => {
5
+ return Boolean(typeof v === "string" && singleColorRegex.test(v) && v.startsWith(type) || testProp && !isNullish(v) && Object.prototype.hasOwnProperty.call(v, testProp));
6
+ };
7
+ const splitColor = (aName, bName, cName) => (v) => {
8
+ if (typeof v !== "string")
9
+ return v;
10
+ const [a, b, c, alpha] = v.match(floatRegex);
11
+ return {
12
+ [aName]: parseFloat(a),
13
+ [bName]: parseFloat(b),
14
+ [cName]: parseFloat(c),
15
+ alpha: alpha !== void 0 ? parseFloat(alpha) : 1
16
+ };
17
+ };
18
+ export {
19
+ isColorString,
20
+ splitColor
21
+ };
@@ -0,0 +1,27 @@
1
+ import { complex } from "./index.mjs";
2
+ import { floatRegex } from "../utils/float-regex.mjs";
3
+ const maxDefaults = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]);
4
+ function applyDefaultFilter(v) {
5
+ const [name, value] = v.slice(0, -1).split("(");
6
+ if (name === "drop-shadow")
7
+ return v;
8
+ const [number] = value.match(floatRegex) || [];
9
+ if (!number)
10
+ return v;
11
+ const unit = value.replace(number, "");
12
+ let defaultValue = maxDefaults.has(name) ? 1 : 0;
13
+ if (number !== value)
14
+ defaultValue *= 100;
15
+ return name + "(" + defaultValue + unit + ")";
16
+ }
17
+ const functionRegex = /\b([a-z-]*)\(.*?\)/gu;
18
+ const filter = {
19
+ ...complex,
20
+ getAnimatableNone: (v) => {
21
+ const functions = v.match(functionRegex);
22
+ return functions ? functions.map(applyDefaultFilter).join(" ") : v;
23
+ }
24
+ };
25
+ export {
26
+ filter
27
+ };
@@ -0,0 +1,84 @@
1
+ import { color } from "../color/index.mjs";
2
+ import { colorRegex } from "../utils/color-regex.mjs";
3
+ import { floatRegex } from "../utils/float-regex.mjs";
4
+ import { sanitize } from "../utils/sanitize.mjs";
5
+ function test(v) {
6
+ var _a, _b;
7
+ return isNaN(v) && typeof v === "string" && (((_a = v.match(floatRegex)) === null || _a === void 0 ? void 0 : _a.length) || 0) + (((_b = v.match(colorRegex)) === null || _b === void 0 ? void 0 : _b.length) || 0) > 0;
8
+ }
9
+ const NUMBER_TOKEN = "number";
10
+ const COLOR_TOKEN = "color";
11
+ const VAR_TOKEN = "var";
12
+ const VAR_FUNCTION_TOKEN = "var(";
13
+ const SPLIT_TOKEN = "${}";
14
+ const complexRegex = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;
15
+ function analyseComplexValue(value) {
16
+ const originalValue = value.toString();
17
+ const values = [];
18
+ const indexes = {
19
+ color: [],
20
+ number: [],
21
+ var: []
22
+ };
23
+ const types = [];
24
+ let i = 0;
25
+ const tokenised = originalValue.replace(complexRegex, (parsedValue) => {
26
+ if (color.test(parsedValue)) {
27
+ indexes.color.push(i);
28
+ types.push(COLOR_TOKEN);
29
+ values.push(color.parse(parsedValue));
30
+ } else if (parsedValue.startsWith(VAR_FUNCTION_TOKEN)) {
31
+ indexes.var.push(i);
32
+ types.push(VAR_TOKEN);
33
+ values.push(parsedValue);
34
+ } else {
35
+ indexes.number.push(i);
36
+ types.push(NUMBER_TOKEN);
37
+ values.push(parseFloat(parsedValue));
38
+ }
39
+ ++i;
40
+ return SPLIT_TOKEN;
41
+ });
42
+ const split = tokenised.split(SPLIT_TOKEN);
43
+ return { values, split, indexes, types };
44
+ }
45
+ function parseComplexValue(v) {
46
+ return analyseComplexValue(v).values;
47
+ }
48
+ function createTransformer(source) {
49
+ const { split, types } = analyseComplexValue(source);
50
+ const numSections = split.length;
51
+ return (v) => {
52
+ let output = "";
53
+ for (let i = 0; i < numSections; i++) {
54
+ output += split[i];
55
+ if (v[i] !== void 0) {
56
+ const type = types[i];
57
+ if (type === NUMBER_TOKEN) {
58
+ output += sanitize(v[i]);
59
+ } else if (type === COLOR_TOKEN) {
60
+ output += color.transform(v[i]);
61
+ } else {
62
+ output += v[i];
63
+ }
64
+ }
65
+ }
66
+ return output;
67
+ };
68
+ }
69
+ const convertNumbersToZero = (v) => typeof v === "number" ? 0 : v;
70
+ function getAnimatableNone(v) {
71
+ const parsed = parseComplexValue(v);
72
+ const transformer = createTransformer(v);
73
+ return transformer(parsed.map(convertNumbersToZero));
74
+ }
75
+ const complex = {
76
+ test,
77
+ parse: parseComplexValue,
78
+ createTransformer,
79
+ getAnimatableNone
80
+ };
81
+ export {
82
+ analyseComplexValue,
83
+ complex
84
+ };
@@ -0,0 +1,19 @@
1
+ import { clamp } from "../../../utils/clamp.mjs";
2
+ const number = {
3
+ test: (v) => typeof v === "number",
4
+ parse: parseFloat,
5
+ transform: (v) => v
6
+ };
7
+ const alpha = {
8
+ ...number,
9
+ transform: (v) => clamp(0, 1, v)
10
+ };
11
+ const scale = {
12
+ ...number,
13
+ default: 1
14
+ };
15
+ export {
16
+ alpha,
17
+ number,
18
+ scale
19
+ };
@@ -0,0 +1,23 @@
1
+ const createUnitType = (unit) => ({
2
+ test: (v) => typeof v === "string" && v.endsWith(unit) && v.split(" ").length === 1,
3
+ parse: parseFloat,
4
+ transform: (v) => `${v}${unit}`
5
+ });
6
+ const degrees = /* @__PURE__ */ createUnitType("deg");
7
+ const percent = /* @__PURE__ */ createUnitType("%");
8
+ const px = /* @__PURE__ */ createUnitType("px");
9
+ const vh = /* @__PURE__ */ createUnitType("vh");
10
+ const vw = /* @__PURE__ */ createUnitType("vw");
11
+ const progressPercentage = {
12
+ ...percent,
13
+ parse: (v) => percent.parse(v) / 100,
14
+ transform: (v) => percent.transform(v * 100)
15
+ };
16
+ export {
17
+ degrees,
18
+ percent,
19
+ progressPercentage,
20
+ px,
21
+ vh,
22
+ vw
23
+ };
@@ -0,0 +1,4 @@
1
+ const colorRegex = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;
2
+ export {
3
+ colorRegex
4
+ };
@@ -0,0 +1,4 @@
1
+ const floatRegex = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu;
2
+ export {
3
+ floatRegex
4
+ };
@@ -0,0 +1,6 @@
1
+ function isNullish(v) {
2
+ return v == null;
3
+ }
4
+ export {
5
+ isNullish
6
+ };
@@ -0,0 +1,4 @@
1
+ const sanitize = (v) => Math.round(v * 1e5) / 1e5;
2
+ export {
3
+ sanitize
4
+ };
@@ -0,0 +1,4 @@
1
+ const singleColorRegex = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;
2
+ export {
3
+ singleColorRegex
4
+ };
@@ -0,0 +1,10 @@
1
+ import { isWillChangeMotionValue } from "./is.mjs";
2
+ function addValueToWillChange(visualElement, key) {
3
+ const willChange = visualElement.getValue("willChange");
4
+ if (isWillChangeMotionValue(willChange)) {
5
+ return willChange.add(key);
6
+ }
7
+ }
8
+ export {
9
+ addValueToWillChange
10
+ };
@@ -0,0 +1,7 @@
1
+ import { isMotionValue } from "../utils/is-motion-value.mjs";
2
+ function isWillChangeMotionValue(value) {
3
+ return Boolean(isMotionValue(value) && value.add);
4
+ }
5
+ export {
6
+ isWillChangeMotionValue
7
+ };
@@ -0,0 +1,4 @@
1
+ const isMotionValue = (value) => Boolean(value && value.getVelocity);
2
+ export {
3
+ isMotionValue
4
+ };
@@ -0,0 +1,20 @@
1
+ var warning = function() {
2
+ };
3
+ var invariant = function() {
4
+ };
5
+ if (process.env.NODE_ENV !== "production") {
6
+ warning = function(check, message) {
7
+ if (!check && typeof console !== "undefined") {
8
+ console.warn(message);
9
+ }
10
+ };
11
+ invariant = function(check, message) {
12
+ if (!check) {
13
+ throw new Error(message);
14
+ }
15
+ };
16
+ }
17
+ export {
18
+ invariant,
19
+ warning
20
+ };