framer-motion 12.34.2 → 12.34.4

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 (142) hide show
  1. package/README.md +3 -5
  2. package/dist/cjs/client.js +1 -1
  3. package/dist/cjs/client.js.map +1 -1
  4. package/dist/cjs/dom-mini.js.map +1 -1
  5. package/dist/cjs/dom.js +8 -16
  6. package/dist/cjs/dom.js.map +1 -1
  7. package/dist/cjs/{feature-bundle-Cb13qNcx.js → feature-bundle-CUI5saed.js} +2 -5
  8. package/dist/cjs/feature-bundle-CUI5saed.js.map +1 -0
  9. package/dist/cjs/index.js +9 -17
  10. package/dist/cjs/index.js.map +1 -1
  11. package/dist/cjs/m.js +3 -9
  12. package/dist/cjs/m.js.map +1 -1
  13. package/dist/cjs/mini.js.map +1 -1
  14. package/dist/dom-mini.d.ts +1 -0
  15. package/dist/dom.d.ts +1 -0
  16. package/dist/dom.js +1 -1
  17. package/dist/es/animation/animate/index.mjs +6 -2
  18. package/dist/es/animation/animate/index.mjs.map +1 -1
  19. package/dist/es/animation/animate/resolve-subjects.mjs.map +1 -1
  20. package/dist/es/animation/animate/sequence.mjs.map +1 -1
  21. package/dist/es/animation/animate/subject.mjs.map +1 -1
  22. package/dist/es/animation/animators/waapi/animate-elements.mjs.map +1 -1
  23. package/dist/es/animation/animators/waapi/animate-sequence.mjs.map +1 -1
  24. package/dist/es/animation/animators/waapi/animate-style.mjs.map +1 -1
  25. package/dist/es/animation/hooks/animation-controls.mjs.map +1 -1
  26. package/dist/es/animation/optimized-appear/handoff.mjs.map +1 -1
  27. package/dist/es/animation/optimized-appear/start.mjs.map +1 -1
  28. package/dist/es/animation/optimized-appear/store-id.mjs.map +1 -1
  29. package/dist/es/animation/optimized-appear/store.mjs.map +1 -1
  30. package/dist/es/animation/sequence/create.mjs.map +1 -1
  31. package/dist/es/animation/sequence/utils/calc-repeat-duration.mjs.map +1 -1
  32. package/dist/es/animation/sequence/utils/calc-time.mjs.map +1 -1
  33. package/dist/es/animation/sequence/utils/edit.mjs.map +1 -1
  34. package/dist/es/animation/sequence/utils/normalize-times.mjs.map +1 -1
  35. package/dist/es/animation/sequence/utils/sort.mjs.map +1 -1
  36. package/dist/es/animation/utils/create-visual-element.mjs.map +1 -1
  37. package/dist/es/animation/utils/is-dom-keyframes.mjs.map +1 -1
  38. package/dist/es/components/AnimatePresence/PopChild.mjs.map +1 -1
  39. package/dist/es/components/AnimatePresence/PresenceChild.mjs.map +1 -1
  40. package/dist/es/components/AnimatePresence/index.mjs.map +1 -1
  41. package/dist/es/components/AnimatePresence/use-presence.mjs.map +1 -1
  42. package/dist/es/components/AnimatePresence/utils.mjs.map +1 -1
  43. package/dist/es/components/Reorder/Group.mjs.map +1 -1
  44. package/dist/es/components/Reorder/Item.mjs.map +1 -1
  45. package/dist/es/components/Reorder/utils/auto-scroll.mjs.map +1 -1
  46. package/dist/es/components/Reorder/utils/check-reorder.mjs.map +1 -1
  47. package/dist/es/context/MotionContext/index.mjs.map +1 -1
  48. package/dist/es/context/MotionContext/utils.mjs.map +1 -1
  49. package/dist/es/events/add-pointer-event.mjs.map +1 -1
  50. package/dist/es/events/event-info.mjs.map +1 -1
  51. package/dist/es/gestures/drag/VisualElementDragControls.mjs +1 -1
  52. package/dist/es/gestures/drag/VisualElementDragControls.mjs.map +1 -1
  53. package/dist/es/gestures/drag/index.mjs.map +1 -1
  54. package/dist/es/gestures/drag/use-drag-controls.mjs.map +1 -1
  55. package/dist/es/gestures/drag/utils/constraints.mjs.map +1 -1
  56. package/dist/es/gestures/focus.mjs.map +1 -1
  57. package/dist/es/gestures/hover.mjs.map +1 -1
  58. package/dist/es/gestures/pan/PanSession.mjs +2 -5
  59. package/dist/es/gestures/pan/PanSession.mjs.map +1 -1
  60. package/dist/es/gestures/pan/index.mjs.map +1 -1
  61. package/dist/es/gestures/press.mjs.map +1 -1
  62. package/dist/es/index.mjs +2 -2
  63. package/dist/es/m.mjs +1 -1
  64. package/dist/es/motion/features/animation/exit.mjs.map +1 -1
  65. package/dist/es/motion/features/animation/index.mjs.map +1 -1
  66. package/dist/es/motion/features/animations.mjs.map +1 -1
  67. package/dist/es/motion/features/definitions.mjs.map +1 -1
  68. package/dist/es/motion/features/drag.mjs.map +1 -1
  69. package/dist/es/motion/features/gestures.mjs.map +1 -1
  70. package/dist/es/motion/features/layout.mjs.map +1 -1
  71. package/dist/es/motion/features/load-features.mjs.map +1 -1
  72. package/dist/es/motion/features/viewport/index.mjs.map +1 -1
  73. package/dist/es/motion/features/viewport/observers.mjs.map +1 -1
  74. package/dist/es/motion/utils/is-motion-component.mjs.map +1 -1
  75. package/dist/es/motion/utils/symbol.mjs.map +1 -1
  76. package/dist/es/motion/utils/unwrap-motion-component.mjs.map +1 -1
  77. package/dist/es/motion/utils/use-visual-element.mjs.map +1 -1
  78. package/dist/es/motion/utils/valid-prop.mjs.map +1 -1
  79. package/dist/es/projection/use-instant-layout-transition.mjs.map +1 -1
  80. package/dist/es/projection/use-reset-projection.mjs.map +1 -1
  81. package/dist/es/render/components/create-proxy.mjs.map +1 -1
  82. package/dist/es/render/components/m/create.mjs.map +1 -1
  83. package/dist/es/render/components/m/elements.mjs.map +1 -1
  84. package/dist/es/render/components/motion/create.mjs.map +1 -1
  85. package/dist/es/render/components/motion/elements.mjs.map +1 -1
  86. package/dist/es/render/components/motion/feature-bundle.mjs.map +1 -1
  87. package/dist/es/render/dom/create-visual-element.mjs.map +1 -1
  88. package/dist/es/render/dom/features-animation.mjs.map +1 -1
  89. package/dist/es/render/dom/features-max.mjs.map +1 -1
  90. package/dist/es/render/dom/features-min.mjs.map +1 -1
  91. package/dist/es/render/dom/scroll/attach-animation.mjs.map +1 -1
  92. package/dist/es/render/dom/scroll/attach-function.mjs.map +1 -1
  93. package/dist/es/render/dom/scroll/index.mjs.map +1 -1
  94. package/dist/es/render/dom/scroll/info.mjs.map +1 -1
  95. package/dist/es/render/dom/scroll/offsets/edge.mjs.map +1 -1
  96. package/dist/es/render/dom/scroll/offsets/index.mjs.map +1 -1
  97. package/dist/es/render/dom/scroll/offsets/inset.mjs.map +1 -1
  98. package/dist/es/render/dom/scroll/offsets/offset.mjs.map +1 -1
  99. package/dist/es/render/dom/scroll/offsets/presets.mjs +0 -12
  100. package/dist/es/render/dom/scroll/offsets/presets.mjs.map +1 -1
  101. package/dist/es/render/dom/scroll/on-scroll-handler.mjs.map +1 -1
  102. package/dist/es/render/dom/scroll/track.mjs +2 -2
  103. package/dist/es/render/dom/scroll/track.mjs.map +1 -1
  104. package/dist/es/render/dom/scroll/utils/can-use-native-timeline.mjs.map +1 -1
  105. package/dist/es/render/dom/scroll/utils/get-timeline.mjs.map +1 -1
  106. package/dist/es/render/dom/utils/filter-props.mjs.map +1 -1
  107. package/dist/es/render/dom/utils/is-svg-component.mjs.map +1 -1
  108. package/dist/es/render/dom/viewport/index.mjs.map +1 -1
  109. package/dist/es/render/html/use-html-visual-state.mjs.map +1 -1
  110. package/dist/es/render/html/use-props.mjs.map +1 -1
  111. package/dist/es/render/html/utils/create-render-state.mjs.map +1 -1
  112. package/dist/es/render/svg/lowercase-elements.mjs.map +1 -1
  113. package/dist/es/render/svg/use-svg-visual-state.mjs.map +1 -1
  114. package/dist/es/render/svg/utils/create-render-state.mjs.map +1 -1
  115. package/dist/es/utils/distance.mjs.map +1 -1
  116. package/dist/es/utils/get-context-window.mjs.map +1 -1
  117. package/dist/es/utils/is-ref-object.mjs.map +1 -1
  118. package/dist/es/utils/transform-viewbox-point.mjs.map +1 -1
  119. package/dist/es/utils/use-composed-ref.mjs.map +1 -1
  120. package/dist/es/utils/use-cycle.mjs.map +1 -1
  121. package/dist/es/value/scroll/use-element-scroll.mjs.map +1 -1
  122. package/dist/es/value/scroll/use-viewport-scroll.mjs.map +1 -1
  123. package/dist/es/value/use-combine-values.mjs.map +1 -1
  124. package/dist/es/value/use-will-change/WillChangeMotionValue.mjs.map +1 -1
  125. package/dist/framer-motion.dev.js +15 -9
  126. package/dist/framer-motion.js +1 -1
  127. package/dist/size-rollup-animate.js +1 -1
  128. package/dist/size-rollup-animate.js.map +1 -1
  129. package/dist/size-rollup-dom-animation-assets.js +1 -1
  130. package/dist/size-rollup-dom-animation.js +1 -1
  131. package/dist/size-rollup-dom-max-assets.js +1 -1
  132. package/dist/size-rollup-dom-max.js +1 -1
  133. package/dist/size-rollup-m.js.map +1 -1
  134. package/dist/size-rollup-motion.js +1 -1
  135. package/dist/size-rollup-motion.js.map +1 -1
  136. package/dist/size-rollup-scroll.js +1 -1
  137. package/dist/size-rollup-scroll.js.map +1 -1
  138. package/dist/size-rollup-waapi-animate.js.map +1 -1
  139. package/dist/types/index.d.ts +1 -0
  140. package/dist/types.d-DOCC-kZB.d.ts +223 -0
  141. package/package.json +3 -3
  142. package/dist/cjs/feature-bundle-Cb13qNcx.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"hover.mjs","sources":["../../../src/gestures/hover.ts"],"sourcesContent":["import { Feature, frame, hover, type VisualElement } from \"motion-dom\"\nimport { extractEventInfo } from \"../events/event-info\"\n\nfunction handleHoverEvent(\n node: VisualElement<Element>,\n event: PointerEvent,\n lifecycle: \"Start\" | \"End\"\n) {\n const { props } = node\n\n if (node.animationState && props.whileHover) {\n node.animationState.setActive(\"whileHover\", lifecycle === \"Start\")\n }\n\n const eventName = (\"onHover\" + lifecycle) as \"onHoverStart\" | \"onHoverEnd\"\n const callback = props[eventName]\n if (callback) {\n frame.postRender(() => callback(event, extractEventInfo(event)))\n }\n}\n\nexport class HoverGesture extends Feature<Element> {\n mount() {\n const { current } = this.node\n if (!current) return\n\n this.unmount = hover(current, (_element, startEvent) => {\n handleHoverEvent(this.node, startEvent, \"Start\")\n\n return (endEvent) => handleHoverEvent(this.node, endEvent, \"End\")\n })\n }\n\n unmount() {}\n}\n"],"names":[],"mappings":";;;AAGA,SAAS,gBAAgB,CACrB,IAA4B,EAC5B,KAAmB,EACnB,SAA0B,EAAA;AAE1B,IAAA,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAA;IAEtB,IAAI,IAAI,CAAC,cAAc,IAAI,KAAK,CAAC,UAAU,EAAE;QACzC,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,YAAY,EAAE,SAAS,KAAK,OAAO,CAAC,CAAA;KACrE;AAED,IAAA,MAAM,SAAS,IAAI,SAAS,GAAG,SAAS,CAAkC,CAAA;AAC1E,IAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,SAAS,CAAC,CAAA;IACjC,IAAI,QAAQ,EAAE;AACV,QAAA,KAAK,CAAC,UAAU,CAAC,MAAM,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;KACnE;AACL,CAAC;AAEK,MAAO,YAAa,SAAQ,OAAgB,CAAA;IAC9C,KAAK,GAAA;AACD,QAAA,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,IAAI,CAAA;AAC7B,QAAA,IAAI,CAAC,OAAO;YAAE,OAAM;AAEpB,QAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,UAAU,KAAI;YACnD,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;AAEhD,YAAA,OAAO,CAAC,QAAQ,KAAK,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAA;AACrE,SAAC,CAAC,CAAA;KACL;AAED,IAAA,OAAO,MAAK;AACf;;;;"}
1
+ {"version":3,"file":"hover.mjs","sources":["../../../src/gestures/hover.ts"],"sourcesContent":["import { Feature, frame, hover, type VisualElement } from \"motion-dom\"\nimport { extractEventInfo } from \"../events/event-info\"\n\nfunction handleHoverEvent(\n node: VisualElement<Element>,\n event: PointerEvent,\n lifecycle: \"Start\" | \"End\"\n) {\n const { props } = node\n\n if (node.animationState && props.whileHover) {\n node.animationState.setActive(\"whileHover\", lifecycle === \"Start\")\n }\n\n const eventName = (\"onHover\" + lifecycle) as \"onHoverStart\" | \"onHoverEnd\"\n const callback = props[eventName]\n if (callback) {\n frame.postRender(() => callback(event, extractEventInfo(event)))\n }\n}\n\nexport class HoverGesture extends Feature<Element> {\n mount() {\n const { current } = this.node\n if (!current) return\n\n this.unmount = hover(current, (_element, startEvent) => {\n handleHoverEvent(this.node, startEvent, \"Start\")\n\n return (endEvent) => handleHoverEvent(this.node, endEvent, \"End\")\n })\n }\n\n unmount() {}\n}\n"],"names":[],"mappings":";;;AAGA,SAAS,gBAAgB,CACrB,IAA4B,EAC5B,KAAmB,EACnB,SAA0B,EAAA;AAE1B,IAAA,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI;IAEtB,IAAI,IAAI,CAAC,cAAc,IAAI,KAAK,CAAC,UAAU,EAAE;QACzC,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,YAAY,EAAE,SAAS,KAAK,OAAO,CAAC;IACtE;AAEA,IAAA,MAAM,SAAS,IAAI,SAAS,GAAG,SAAS,CAAkC;AAC1E,IAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,SAAS,CAAC;IACjC,IAAI,QAAQ,EAAE;AACV,QAAA,KAAK,CAAC,UAAU,CAAC,MAAM,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC;IACpE;AACJ;AAEM,MAAO,YAAa,SAAQ,OAAgB,CAAA;IAC9C,KAAK,GAAA;AACD,QAAA,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,IAAI;AAC7B,QAAA,IAAI,CAAC,OAAO;YAAE;AAEd,QAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,UAAU,KAAI;YACnD,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC;AAEhD,YAAA,OAAO,CAAC,QAAQ,KAAK,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC;AACrE,QAAA,CAAC,CAAC;IACN;AAEA,IAAA,OAAO,KAAI;AACd;;;;"}
@@ -1,4 +1,4 @@
1
- import { frame, isPrimaryPointer, cancelFrame, frameData } from 'motion-dom';
1
+ import { frameData, frame, isPrimaryPointer, cancelFrame } from 'motion-dom';
2
2
  import { pipe, secondsToMilliseconds, millisecondsToSeconds } from 'motion-utils';
3
3
  import { addPointerEvent } from '../../events/add-pointer-event.mjs';
4
4
  import { extractEventInfo } from '../../events/event-info.mjs';
@@ -138,12 +138,9 @@ class PanSession {
138
138
  // Capture listener catches element scroll events as they bubble
139
139
  window.addEventListener("scroll", this.onElementScroll, {
140
140
  capture: true,
141
- passive: true,
142
141
  });
143
142
  // Direct window scroll listener (window scroll doesn't bubble)
144
- window.addEventListener("scroll", this.onWindowScroll, {
145
- passive: true,
146
- });
143
+ window.addEventListener("scroll", this.onWindowScroll);
147
144
  this.removeScrollListeners = () => {
148
145
  window.removeEventListener("scroll", this.onElementScroll, {
149
146
  capture: true,
@@ -1 +1 @@
1
- {"version":3,"file":"PanSession.mjs","sources":["../../../../src/gestures/pan/PanSession.ts"],"sourcesContent":["import type { EventInfo, PanHandler } from \"motion-dom\"\nimport { cancelFrame, frame, frameData, isPrimaryPointer } from \"motion-dom\"\nimport {\n millisecondsToSeconds,\n pipe,\n Point,\n secondsToMilliseconds,\n TransformPoint,\n} from \"motion-utils\"\nimport { addPointerEvent } from \"../../events/add-pointer-event\"\nimport { extractEventInfo } from \"../../events/event-info\"\nimport { distance2D } from \"../../utils/distance\"\n\ninterface PanSessionHandlers {\n onSessionStart: PanHandler\n onStart: PanHandler\n onMove: PanHandler\n onEnd: PanHandler\n onSessionEnd: PanHandler\n resumeAnimation: () => void\n}\n\ninterface PanSessionOptions {\n transformPagePoint?: TransformPoint\n dragSnapToOrigin?: boolean\n distanceThreshold?: number\n contextWindow?: (Window & typeof globalThis) | null\n /**\n * Element being dragged. When provided, scroll events on its\n * ancestors and window are compensated so the gesture continues\n * smoothly during scroll.\n */\n element?: HTMLElement | null\n}\n\ninterface TimestampedPoint extends Point {\n timestamp: number\n}\n\nconst overflowStyles = /*#__PURE__*/ new Set([\"auto\", \"scroll\"])\n\n/**\n * @internal\n */\nexport class PanSession {\n /**\n * @internal\n */\n private history: TimestampedPoint[]\n\n /**\n * @internal\n */\n private startEvent: PointerEvent | null = null\n\n /**\n * @internal\n */\n private lastMoveEvent: PointerEvent | null = null\n\n /**\n * @internal\n */\n private lastMoveEventInfo: EventInfo | null = null\n\n /**\n * @internal\n */\n private transformPagePoint?: TransformPoint\n\n /**\n * @internal\n */\n private handlers: Partial<PanSessionHandlers> = {}\n\n /**\n * @internal\n */\n private removeListeners: Function\n\n /**\n * For determining if an animation should resume after it is interupted\n *\n * @internal\n */\n private dragSnapToOrigin: boolean\n\n /**\n * The distance after which panning should start.\n *\n * @internal\n */\n private distanceThreshold: number\n\n /**\n * @internal\n */\n private contextWindow: PanSessionOptions[\"contextWindow\"] = window\n\n /**\n * Scroll positions of scrollable ancestors and window.\n * @internal\n */\n private scrollPositions: Map<Element | Window, Point> = new Map()\n\n /**\n * Cleanup function for scroll listeners.\n * @internal\n */\n private removeScrollListeners: (() => void) | null = null\n\n constructor(\n event: PointerEvent,\n handlers: Partial<PanSessionHandlers>,\n {\n transformPagePoint,\n contextWindow = window,\n dragSnapToOrigin = false,\n distanceThreshold = 3,\n element,\n }: PanSessionOptions = {}\n ) {\n // If we have more than one touch, don't start detecting this gesture\n if (!isPrimaryPointer(event)) return\n\n this.dragSnapToOrigin = dragSnapToOrigin\n this.handlers = handlers\n this.transformPagePoint = transformPagePoint\n this.distanceThreshold = distanceThreshold\n this.contextWindow = contextWindow || window\n\n const info = extractEventInfo(event)\n const initialInfo = transformPoint(info, this.transformPagePoint)\n const { point } = initialInfo\n\n const { timestamp } = frameData\n\n this.history = [{ ...point, timestamp }]\n\n const { onSessionStart } = handlers\n onSessionStart &&\n onSessionStart(event, getPanInfo(initialInfo, this.history))\n\n this.removeListeners = pipe(\n addPointerEvent(\n this.contextWindow,\n \"pointermove\",\n this.handlePointerMove\n ),\n addPointerEvent(\n this.contextWindow,\n \"pointerup\",\n this.handlePointerUp\n ),\n addPointerEvent(\n this.contextWindow,\n \"pointercancel\",\n this.handlePointerUp\n )\n )\n\n // Start scroll tracking if element provided\n if (element) {\n this.startScrollTracking(element)\n }\n }\n\n /**\n * Start tracking scroll on ancestors and window.\n */\n private startScrollTracking(element: HTMLElement): void {\n // Store initial scroll positions for scrollable ancestors\n let current = element.parentElement\n while (current) {\n const style = getComputedStyle(current)\n if (\n overflowStyles.has(style.overflowX) ||\n overflowStyles.has(style.overflowY)\n ) {\n this.scrollPositions.set(current, {\n x: current.scrollLeft,\n y: current.scrollTop,\n })\n }\n current = current.parentElement\n }\n\n // Track window scroll\n this.scrollPositions.set(window, {\n x: window.scrollX,\n y: window.scrollY,\n })\n\n // Capture listener catches element scroll events as they bubble\n window.addEventListener(\"scroll\", this.onElementScroll, {\n capture: true,\n passive: true,\n })\n\n // Direct window scroll listener (window scroll doesn't bubble)\n window.addEventListener(\"scroll\", this.onWindowScroll, {\n passive: true,\n })\n\n this.removeScrollListeners = () => {\n window.removeEventListener(\"scroll\", this.onElementScroll, {\n capture: true,\n })\n window.removeEventListener(\"scroll\", this.onWindowScroll)\n }\n }\n\n private onElementScroll = (event: Event): void => {\n this.handleScroll(event.target as Element)\n }\n\n private onWindowScroll = (): void => {\n this.handleScroll(window)\n }\n\n /**\n * Handle scroll compensation during drag.\n *\n * For element scroll: adjusts history origin since pageX/pageY doesn't change.\n * For window scroll: adjusts lastMoveEventInfo since pageX/pageY would change.\n */\n private handleScroll(target: Element | Window): void {\n const initial = this.scrollPositions.get(target)\n if (!initial) return\n\n const isWindow = target === window\n const current = isWindow\n ? { x: window.scrollX, y: window.scrollY }\n : {\n x: (target as Element).scrollLeft,\n y: (target as Element).scrollTop,\n }\n\n const delta = { x: current.x - initial.x, y: current.y - initial.y }\n if (delta.x === 0 && delta.y === 0) return\n\n if (isWindow) {\n // Window scroll: pageX/pageY changes, so update lastMoveEventInfo\n if (this.lastMoveEventInfo) {\n this.lastMoveEventInfo.point.x += delta.x\n this.lastMoveEventInfo.point.y += delta.y\n }\n } else {\n // Element scroll: pageX/pageY unchanged, so adjust history origin\n if (this.history.length > 0) {\n this.history[0].x -= delta.x\n this.history[0].y -= delta.y\n }\n }\n\n this.scrollPositions.set(target, current)\n frame.update(this.updatePoint, true)\n }\n\n private updatePoint = () => {\n if (!(this.lastMoveEvent && this.lastMoveEventInfo)) return\n\n const info = getPanInfo(this.lastMoveEventInfo, this.history)\n const isPanStarted = this.startEvent !== null\n\n // Only start panning if the offset is larger than 3 pixels. If we make it\n // any larger than this we'll want to reset the pointer history\n // on the first update to avoid visual snapping to the cursor.\n const isDistancePastThreshold =\n distance2D(info.offset, { x: 0, y: 0 }) >= this.distanceThreshold\n\n if (!isPanStarted && !isDistancePastThreshold) return\n\n const { point } = info\n const { timestamp } = frameData\n this.history.push({ ...point, timestamp })\n\n const { onStart, onMove } = this.handlers\n\n if (!isPanStarted) {\n onStart && onStart(this.lastMoveEvent, info)\n this.startEvent = this.lastMoveEvent\n }\n\n onMove && onMove(this.lastMoveEvent, info)\n }\n\n private handlePointerMove = (event: PointerEvent, info: EventInfo) => {\n this.lastMoveEvent = event\n this.lastMoveEventInfo = transformPoint(info, this.transformPagePoint)\n\n // Throttle mouse move event to once per frame\n frame.update(this.updatePoint, true)\n }\n\n private handlePointerUp = (event: PointerEvent, info: EventInfo) => {\n this.end()\n\n const { onEnd, onSessionEnd, resumeAnimation } = this.handlers\n\n // Resume animation if dragSnapToOrigin is set OR if no drag started (user just clicked)\n // This ensures constraint animations continue when interrupted by a click\n if (this.dragSnapToOrigin || !this.startEvent) {\n resumeAnimation && resumeAnimation()\n }\n if (!(this.lastMoveEvent && this.lastMoveEventInfo)) return\n\n const panInfo = getPanInfo(\n event.type === \"pointercancel\"\n ? this.lastMoveEventInfo\n : transformPoint(info, this.transformPagePoint),\n this.history\n )\n\n if (this.startEvent && onEnd) {\n onEnd(event, panInfo)\n }\n\n onSessionEnd && onSessionEnd(event, panInfo)\n }\n\n updateHandlers(handlers: Partial<PanSessionHandlers>) {\n this.handlers = handlers\n }\n\n end() {\n this.removeListeners && this.removeListeners()\n this.removeScrollListeners && this.removeScrollListeners()\n this.scrollPositions.clear()\n cancelFrame(this.updatePoint)\n }\n}\n\nfunction transformPoint(\n info: EventInfo,\n transformPagePoint?: (point: Point) => Point\n) {\n return transformPagePoint ? { point: transformPagePoint(info.point) } : info\n}\n\nfunction subtractPoint(a: Point, b: Point): Point {\n return { x: a.x - b.x, y: a.y - b.y }\n}\n\nfunction getPanInfo({ point }: EventInfo, history: TimestampedPoint[]) {\n return {\n point,\n delta: subtractPoint(point, lastDevicePoint(history)),\n offset: subtractPoint(point, startDevicePoint(history)),\n velocity: getVelocity(history, 0.1),\n }\n}\n\nfunction startDevicePoint(history: TimestampedPoint[]): TimestampedPoint {\n return history[0]\n}\n\nfunction lastDevicePoint(history: TimestampedPoint[]): TimestampedPoint {\n return history[history.length - 1]\n}\n\nfunction getVelocity(history: TimestampedPoint[], timeDelta: number): Point {\n if (history.length < 2) {\n return { x: 0, y: 0 }\n }\n\n let i = history.length - 1\n let timestampedPoint: TimestampedPoint | null = null\n const lastPoint = lastDevicePoint(history)\n while (i >= 0) {\n timestampedPoint = history[i]\n if (\n lastPoint.timestamp - timestampedPoint.timestamp >\n secondsToMilliseconds(timeDelta)\n ) {\n break\n }\n i--\n }\n\n if (!timestampedPoint) {\n return { x: 0, y: 0 }\n }\n\n /**\n * If the selected point is the pointer-down origin (history[0]),\n * there are better movement points available, and the time gap\n * is suspiciously large (>2x timeDelta), use the next point instead.\n * This prevents stale pointer-down points from diluting velocity\n * in hold-then-flick gestures.\n */\n if (\n timestampedPoint === history[0] &&\n history.length > 2 &&\n lastPoint.timestamp - timestampedPoint.timestamp >\n secondsToMilliseconds(timeDelta) * 2\n ) {\n timestampedPoint = history[1]\n }\n\n const time = millisecondsToSeconds(\n lastPoint.timestamp - timestampedPoint.timestamp\n )\n if (time === 0) {\n return { x: 0, y: 0 }\n }\n\n const currentVelocity = {\n x: (lastPoint.x - timestampedPoint.x) / time,\n y: (lastPoint.y - timestampedPoint.y) / time,\n }\n\n if (currentVelocity.x === Infinity) {\n currentVelocity.x = 0\n }\n if (currentVelocity.y === Infinity) {\n currentVelocity.y = 0\n }\n\n return currentVelocity\n}\n"],"names":[],"mappings":";;;;;;AAuCA,MAAM,cAAc,iBAAiB,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAA;AAEhE;;AAEG;MACU,UAAU,CAAA;IAmEnB,WACI,CAAA,KAAmB,EACnB,QAAqC,EACrC,EACI,kBAAkB,EAClB,aAAa,GAAG,MAAM,EACtB,gBAAgB,GAAG,KAAK,EACxB,iBAAiB,GAAG,CAAC,EACrB,OAAO,GAAA,GACY,EAAE,EAAA;AAtE7B;;AAEG;QACK,IAAU,CAAA,UAAA,GAAwB,IAAI,CAAA;AAE9C;;AAEG;QACK,IAAa,CAAA,aAAA,GAAwB,IAAI,CAAA;AAEjD;;AAEG;QACK,IAAiB,CAAA,iBAAA,GAAqB,IAAI,CAAA;AAOlD;;AAEG;QACK,IAAQ,CAAA,QAAA,GAAgC,EAAE,CAAA;AAqBlD;;AAEG;QACK,IAAa,CAAA,aAAA,GAAuC,MAAM,CAAA;AAElE;;;AAGG;AACK,QAAA,IAAA,CAAA,eAAe,GAAiC,IAAI,GAAG,EAAE,CAAA;AAEjE;;;AAGG;QACK,IAAqB,CAAA,qBAAA,GAAwB,IAAI,CAAA;AAuGjD,QAAA,IAAA,CAAA,eAAe,GAAG,CAAC,KAAY,KAAU;AAC7C,YAAA,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,MAAiB,CAAC,CAAA;AAC9C,SAAC,CAAA;QAEO,IAAc,CAAA,cAAA,GAAG,MAAW;AAChC,YAAA,IAAI,CAAC,YA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AAS,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,IAAI,IAAI;KAC/C,CAAA;AAED,IAAA,IAAI,eAAe,CAAC,CAAC,KAAK,QAAQ,EAAE;AAChC,QAAA,eAAe,CAAC,CAAC,GAAG,CAAC,CAAA;KACxB;AACD,IAAA,IAAI,eAAe,CAAC,CAAC,KAAK,QAAQ,EAAE;AAChC,QAAA,eAAe,CAAC,CAAC,GAAG,CAAC,CAAA;KACxB;AAED,IAAA,OAAO,eAAe,CAAA;AAC1B;;;;"}
1
+ {"version":3,"file":"PanSession.mjs","sources":["../../../../src/gestures/pan/PanSession.ts"],"sourcesContent":["import type { EventInfo, PanHandler } from \"motion-dom\"\nimport { cancelFrame, frame, frameData, isPrimaryPointer } from \"motion-dom\"\nimport {\n millisecondsToSeconds,\n pipe,\n Point,\n secondsToMilliseconds,\n TransformPoint,\n} from \"motion-utils\"\nimport { addPointerEvent } from \"../../events/add-pointer-event\"\nimport { extractEventInfo } from \"../../events/event-info\"\nimport { distance2D } from \"../../utils/distance\"\n\ninterface PanSessionHandlers {\n onSessionStart: PanHandler\n onStart: PanHandler\n onMove: PanHandler\n onEnd: PanHandler\n onSessionEnd: PanHandler\n resumeAnimation: () => void\n}\n\ninterface PanSessionOptions {\n transformPagePoint?: TransformPoint\n dragSnapToOrigin?: boolean\n distanceThreshold?: number\n contextWindow?: (Window & typeof globalThis) | null\n /**\n * Element being dragged. When provided, scroll events on its\n * ancestors and window are compensated so the gesture continues\n * smoothly during scroll.\n */\n element?: HTMLElement | null\n}\n\ninterface TimestampedPoint extends Point {\n timestamp: number\n}\n\nconst overflowStyles = /*#__PURE__*/ new Set([\"auto\", \"scroll\"])\n\n/**\n * @internal\n */\nexport class PanSession {\n /**\n * @internal\n */\n private history: TimestampedPoint[]\n\n /**\n * @internal\n */\n private startEvent: PointerEvent | null = null\n\n /**\n * @internal\n */\n private lastMoveEvent: PointerEvent | null = null\n\n /**\n * @internal\n */\n private lastMoveEventInfo: EventInfo | null = null\n\n /**\n * @internal\n */\n private transformPagePoint?: TransformPoint\n\n /**\n * @internal\n */\n private handlers: Partial<PanSessionHandlers> = {}\n\n /**\n * @internal\n */\n private removeListeners: Function\n\n /**\n * For determining if an animation should resume after it is interupted\n *\n * @internal\n */\n private dragSnapToOrigin: boolean\n\n /**\n * The distance after which panning should start.\n *\n * @internal\n */\n private distanceThreshold: number\n\n /**\n * @internal\n */\n private contextWindow: PanSessionOptions[\"contextWindow\"] = window\n\n /**\n * Scroll positions of scrollable ancestors and window.\n * @internal\n */\n private scrollPositions: Map<Element | Window, Point> = new Map()\n\n /**\n * Cleanup function for scroll listeners.\n * @internal\n */\n private removeScrollListeners: (() => void) | null = null\n\n constructor(\n event: PointerEvent,\n handlers: Partial<PanSessionHandlers>,\n {\n transformPagePoint,\n contextWindow = window,\n dragSnapToOrigin = false,\n distanceThreshold = 3,\n element,\n }: PanSessionOptions = {}\n ) {\n // If we have more than one touch, don't start detecting this gesture\n if (!isPrimaryPointer(event)) return\n\n this.dragSnapToOrigin = dragSnapToOrigin\n this.handlers = handlers\n this.transformPagePoint = transformPagePoint\n this.distanceThreshold = distanceThreshold\n this.contextWindow = contextWindow || window\n\n const info = extractEventInfo(event)\n const initialInfo = transformPoint(info, this.transformPagePoint)\n const { point } = initialInfo\n\n const { timestamp } = frameData\n\n this.history = [{ ...point, timestamp }]\n\n const { onSessionStart } = handlers\n onSessionStart &&\n onSessionStart(event, getPanInfo(initialInfo, this.history))\n\n this.removeListeners = pipe(\n addPointerEvent(\n this.contextWindow,\n \"pointermove\",\n this.handlePointerMove\n ),\n addPointerEvent(\n this.contextWindow,\n \"pointerup\",\n this.handlePointerUp\n ),\n addPointerEvent(\n this.contextWindow,\n \"pointercancel\",\n this.handlePointerUp\n )\n )\n\n // Start scroll tracking if element provided\n if (element) {\n this.startScrollTracking(element)\n }\n }\n\n /**\n * Start tracking scroll on ancestors and window.\n */\n private startScrollTracking(element: HTMLElement): void {\n // Store initial scroll positions for scrollable ancestors\n let current = element.parentElement\n while (current) {\n const style = getComputedStyle(current)\n if (\n overflowStyles.has(style.overflowX) ||\n overflowStyles.has(style.overflowY)\n ) {\n this.scrollPositions.set(current, {\n x: current.scrollLeft,\n y: current.scrollTop,\n })\n }\n current = current.parentElement\n }\n\n // Track window scroll\n this.scrollPositions.set(window, {\n x: window.scrollX,\n y: window.scrollY,\n })\n\n // Capture listener catches element scroll events as they bubble\n window.addEventListener(\"scroll\", this.onElementScroll, {\n capture: true,\n })\n\n // Direct window scroll listener (window scroll doesn't bubble)\n window.addEventListener(\"scroll\", this.onWindowScroll)\n\n this.removeScrollListeners = () => {\n window.removeEventListener(\"scroll\", this.onElementScroll, {\n capture: true,\n })\n window.removeEventListener(\"scroll\", this.onWindowScroll)\n }\n }\n\n private onElementScroll = (event: Event): void => {\n this.handleScroll(event.target as Element)\n }\n\n private onWindowScroll = (): void => {\n this.handleScroll(window)\n }\n\n /**\n * Handle scroll compensation during drag.\n *\n * For element scroll: adjusts history origin since pageX/pageY doesn't change.\n * For window scroll: adjusts lastMoveEventInfo since pageX/pageY would change.\n */\n private handleScroll(target: Element | Window): void {\n const initial = this.scrollPositions.get(target)\n if (!initial) return\n\n const isWindow = target === window\n const current = isWindow\n ? { x: window.scrollX, y: window.scrollY }\n : {\n x: (target as Element).scrollLeft,\n y: (target as Element).scrollTop,\n }\n\n const delta = { x: current.x - initial.x, y: current.y - initial.y }\n if (delta.x === 0 && delta.y === 0) return\n\n if (isWindow) {\n // Window scroll: pageX/pageY changes, so update lastMoveEventInfo\n if (this.lastMoveEventInfo) {\n this.lastMoveEventInfo.point.x += delta.x\n this.lastMoveEventInfo.point.y += delta.y\n }\n } else {\n // Element scroll: pageX/pageY unchanged, so adjust history origin\n if (this.history.length > 0) {\n this.history[0].x -= delta.x\n this.history[0].y -= delta.y\n }\n }\n\n this.scrollPositions.set(target, current)\n frame.update(this.updatePoint, true)\n }\n\n private updatePoint = () => {\n if (!(this.lastMoveEvent && this.lastMoveEventInfo)) return\n\n const info = getPanInfo(this.lastMoveEventInfo, this.history)\n const isPanStarted = this.startEvent !== null\n\n // Only start panning if the offset is larger than 3 pixels. If we make it\n // any larger than this we'll want to reset the pointer history\n // on the first update to avoid visual snapping to the cursor.\n const isDistancePastThreshold =\n distance2D(info.offset, { x: 0, y: 0 }) >= this.distanceThreshold\n\n if (!isPanStarted && !isDistancePastThreshold) return\n\n const { point } = info\n const { timestamp } = frameData\n this.history.push({ ...point, timestamp })\n\n const { onStart, onMove } = this.handlers\n\n if (!isPanStarted) {\n onStart && onStart(this.lastMoveEvent, info)\n this.startEvent = this.lastMoveEvent\n }\n\n onMove && onMove(this.lastMoveEvent, info)\n }\n\n private handlePointerMove = (event: PointerEvent, info: EventInfo) => {\n this.lastMoveEvent = event\n this.lastMoveEventInfo = transformPoint(info, this.transformPagePoint)\n\n // Throttle mouse move event to once per frame\n frame.update(this.updatePoint, true)\n }\n\n private handlePointerUp = (event: PointerEvent, info: EventInfo) => {\n this.end()\n\n const { onEnd, onSessionEnd, resumeAnimation } = this.handlers\n\n // Resume animation if dragSnapToOrigin is set OR if no drag started (user just clicked)\n // This ensures constraint animations continue when interrupted by a click\n if (this.dragSnapToOrigin || !this.startEvent) {\n resumeAnimation && resumeAnimation()\n }\n if (!(this.lastMoveEvent && this.lastMoveEventInfo)) return\n\n const panInfo = getPanInfo(\n event.type === \"pointercancel\"\n ? this.lastMoveEventInfo\n : transformPoint(info, this.transformPagePoint),\n this.history\n )\n\n if (this.startEvent && onEnd) {\n onEnd(event, panInfo)\n }\n\n onSessionEnd && onSessionEnd(event, panInfo)\n }\n\n updateHandlers(handlers: Partial<PanSessionHandlers>) {\n this.handlers = handlers\n }\n\n end() {\n this.removeListeners && this.removeListeners()\n this.removeScrollListeners && this.removeScrollListeners()\n this.scrollPositions.clear()\n cancelFrame(this.updatePoint)\n }\n}\n\nfunction transformPoint(\n info: EventInfo,\n transformPagePoint?: (point: Point) => Point\n) {\n return transformPagePoint ? { point: transformPagePoint(info.point) } : info\n}\n\nfunction subtractPoint(a: Point, b: Point): Point {\n return { x: a.x - b.x, y: a.y - b.y }\n}\n\nfunction getPanInfo({ point }: EventInfo, history: TimestampedPoint[]) {\n return {\n point,\n delta: subtractPoint(point, lastDevicePoint(history)),\n offset: subtractPoint(point, startDevicePoint(history)),\n velocity: getVelocity(history, 0.1),\n }\n}\n\nfunction startDevicePoint(history: TimestampedPoint[]): TimestampedPoint {\n return history[0]\n}\n\nfunction lastDevicePoint(history: TimestampedPoint[]): TimestampedPoint {\n return history[history.length - 1]\n}\n\nfunction getVelocity(history: TimestampedPoint[], timeDelta: number): Point {\n if (history.length < 2) {\n return { x: 0, y: 0 }\n }\n\n let i = history.length - 1\n let timestampedPoint: TimestampedPoint | null = null\n const lastPoint = lastDevicePoint(history)\n while (i >= 0) {\n timestampedPoint = history[i]\n if (\n lastPoint.timestamp - timestampedPoint.timestamp >\n secondsToMilliseconds(timeDelta)\n ) {\n break\n }\n i--\n }\n\n if (!timestampedPoint) {\n return { x: 0, y: 0 }\n }\n\n /**\n * If the selected point is the pointer-down origin (history[0]),\n * there are better movement points available, and the time gap\n * is suspiciously large (>2x timeDelta), use the next point instead.\n * This prevents stale pointer-down points from diluting velocity\n * in hold-then-flick gestures.\n */\n if (\n timestampedPoint === history[0] &&\n history.length > 2 &&\n lastPoint.timestamp - timestampedPoint.timestamp >\n secondsToMilliseconds(timeDelta) * 2\n ) {\n timestampedPoint = history[1]\n }\n\n const time = millisecondsToSeconds(\n lastPoint.timestamp - timestampedPoint.timestamp\n )\n if (time === 0) {\n return { x: 0, y: 0 }\n }\n\n const currentVelocity = {\n x: (lastPoint.x - timestampedPoint.x) / time,\n y: (lastPoint.y - timestampedPoint.y) / time,\n }\n\n if (currentVelocity.x === Infinity) {\n currentVelocity.x = 0\n }\n if (currentVelocity.y === Infinity) {\n currentVelocity.y = 0\n }\n\n return currentVelocity\n}\n"],"names":[],"mappings":";;;;;;AAuCA,MAAM,cAAc,iBAAiB,IAAI,GAAG,CA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,EAAE;QACZ,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;IACzB;AAEA,IAAA,MAAM,eAAe,GAAG;QACpB,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,IAAI,IAAI;QAC5C,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,IAAI,IAAI;KAC/C;AAED,IAAA,IAAI,eAAe,CAAC,CAAC,KAAK,QAAQ,EAAE;AAChC,QAAA,eAAe,CAAC,CAAC,GAAG,CAAC;IACzB;AACA,IAAA,IAAI,eAAe,CAAC,CAAC,KAAK,QAAQ,EAAE;AAChC,QAAA,eAAe,CAAC,CAAC,GAAG,CAAC;IACzB;AAEA,IAAA,OAAO,eAAe;AAC1B;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../../src/gestures/pan/index.ts"],"sourcesContent":["import { Feature, frame, type PanInfo } from \"motion-dom\"\nimport { noop } from \"motion-utils\"\nimport { addPointerEvent } from \"../../events/add-pointer-event\"\nimport { getContextWindow } from \"../../utils/get-context-window\"\nimport { PanSession } from \"./PanSession\"\n\ntype PanEventHandler = (event: PointerEvent, info: PanInfo) => void\nconst asyncHandler =\n (handler?: PanEventHandler) => (event: PointerEvent, info: PanInfo) => {\n if (handler) {\n frame.update(() => handler(event, info), false, true)\n }\n }\n\nexport class PanGesture extends Feature<Element> {\n private session?: PanSession\n\n private removePointerDownListener: Function = noop\n\n onPointerDown(pointerDownEvent: PointerEvent) {\n this.session = new PanSession(\n pointerDownEvent,\n this.createPanHandlers(),\n {\n transformPagePoint: this.node.getTransformPagePoint(),\n contextWindow: getContextWindow(this.node),\n }\n )\n }\n\n createPanHandlers() {\n const { onPanSessionStart, onPanStart, onPan, onPanEnd } =\n this.node.getProps()\n\n return {\n onSessionStart: asyncHandler(onPanSessionStart),\n onStart: asyncHandler(onPanStart),\n onMove: asyncHandler(onPan),\n onEnd: (event: PointerEvent, info: PanInfo) => {\n delete this.session\n if (onPanEnd) {\n frame.postRender(() => onPanEnd(event, info))\n }\n },\n }\n }\n\n mount() {\n this.removePointerDownListener = addPointerEvent(\n this.node.current!,\n \"pointerdown\",\n (event: PointerEvent) => this.onPointerDown(event)\n )\n }\n\n update() {\n this.session && this.session.updateHandlers(this.createPanHandlers())\n }\n\n unmount() {\n this.removePointerDownListener()\n this.session && this.session.end()\n }\n}\n"],"names":[],"mappings":";;;;;;AAOA,MAAM,YAAY,GACd,CAAC,OAAyB,KAAK,CAAC,KAAmB,EAAE,IAAa,KAAI;IAClE,IAAI,OAAO,EAAE;AACT,QAAA,KAAK,CAAC,MAAM,CAAC,MAAM,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;KACxD;AACL,CAAC,CAAA;AAEC,MAAO,UAAW,SAAQ,OAAgB,CAAA;AAAhD,IAAA,WAAA,GAAA;;QAGY,IAAyB,CAAA,yBAAA,GAAa,IAAI,CAAA;KA8CrD;AA5CG,IAAA,aAAa,CAAC,gBAA8B,EAAA;AACxC,QAAA,IAAI,CAAC,OAAO,GAAG,IAAI,UAAU,CACzB,gBAAgB,EAChB,IAAI,CAAC,iBAAiB,EAAE,EACxB;AACI,YAAA,kBAAkB,EAAE,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE;AACrD,YAAA,aAAa,EAAE,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC;AAC7C,SAAA,CACJ,CAAA;KACJ;IAED,iBAAiB,GAAA;AACb,QAAA,MAAM,EAAE,iBAAiB,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,GACpD,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAA;QAExB,OAAO;AACH,YAAA,cAAc,EAAE,YAAY,CAAC,iBAAiB,CAAC;AAC/C,YAAA,OAAO,EAAE,YAAY,CAAC,UAAU,CAAC;AACjC,YAAA,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC;AAC3B,YAAA,KAAK,EAAE,CAAC,KAAmB,EAAE,IAAa,KAAI;gBAC1C,OAAO,IAAI,CAAC,OAAO,CAAA;gBACnB,IAAI,QAAQ,EAAE;AACV,oBAAA,KAAK,CAAC,UAAU,CAAC,MAAM,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAA;iBAChD;aACJ;SACJ,CAAA;KACJ;IAED,KAAK,GAAA;QACD,IAAI,CAAC,yBAAyB,GAAG,eAAe,CAC5C,IAAI,CAAC,IAAI,CAAC,OAAQ,EAClB,aAAa,EACb,CAAC,KAAmB,KAAK,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CACrD,CAAA;KACJ;IAED,MAAM,GAAA;AACF,QAAA,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAA;KACxE;IAED,OAAO,GAAA;QACH,IAAI,CAAC,yBAAyB,EAAE,CAAA;QAChC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAA;KACrC;AACJ;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../../../src/gestures/pan/index.ts"],"sourcesContent":["import { Feature, frame, type PanInfo } from \"motion-dom\"\nimport { noop } from \"motion-utils\"\nimport { addPointerEvent } from \"../../events/add-pointer-event\"\nimport { getContextWindow } from \"../../utils/get-context-window\"\nimport { PanSession } from \"./PanSession\"\n\ntype PanEventHandler = (event: PointerEvent, info: PanInfo) => void\nconst asyncHandler =\n (handler?: PanEventHandler) => (event: PointerEvent, info: PanInfo) => {\n if (handler) {\n frame.update(() => handler(event, info), false, true)\n }\n }\n\nexport class PanGesture extends Feature<Element> {\n private session?: PanSession\n\n private removePointerDownListener: Function = noop\n\n onPointerDown(pointerDownEvent: PointerEvent) {\n this.session = new PanSession(\n pointerDownEvent,\n this.createPanHandlers(),\n {\n transformPagePoint: this.node.getTransformPagePoint(),\n contextWindow: getContextWindow(this.node),\n }\n )\n }\n\n createPanHandlers() {\n const { onPanSessionStart, onPanStart, onPan, onPanEnd } =\n this.node.getProps()\n\n return {\n onSessionStart: asyncHandler(onPanSessionStart),\n onStart: asyncHandler(onPanStart),\n onMove: asyncHandler(onPan),\n onEnd: (event: PointerEvent, info: PanInfo) => {\n delete this.session\n if (onPanEnd) {\n frame.postRender(() => onPanEnd(event, info))\n }\n },\n }\n }\n\n mount() {\n this.removePointerDownListener = addPointerEvent(\n this.node.current!,\n \"pointerdown\",\n (event: PointerEvent) => this.onPointerDown(event)\n )\n }\n\n update() {\n this.session && this.session.updateHandlers(this.createPanHandlers())\n }\n\n unmount() {\n this.removePointerDownListener()\n this.session && this.session.end()\n }\n}\n"],"names":[],"mappings":";;;;;;AAOA,MAAM,YAAY,GACd,CAAC,OAAyB,KAAK,CAAC,KAAmB,EAAE,IAAa,KAAI;IAClE,IAAI,OAAO,EAAE;AACT,QAAA,KAAK,CAAC,MAAM,CAAC,MAAM,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC;IACzD;AACJ,CAAC;AAEC,MAAO,UAAW,SAAQ,OAAgB,CAAA;AAAhD,IAAA,WAAA,GAAA;;QAGY,IAAA,CAAA,yBAAyB,GAAa,IAAI;IA8CtD;AA5CI,IAAA,aAAa,CAAC,gBAA8B,EAAA;AACxC,QAAA,IAAI,CAAC,OAAO,GAAG,IAAI,UAAU,CACzB,gBAAgB,EAChB,IAAI,CAAC,iBAAiB,EAAE,EACxB;AACI,YAAA,kBAAkB,EAAE,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE;AACrD,YAAA,aAAa,EAAE,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC;AAC7C,SAAA,CACJ;IACL;IAEA,iBAAiB,GAAA;AACb,QAAA,MAAM,EAAE,iBAAiB,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,GACpD,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;QAExB,OAAO;AACH,YAAA,cAAc,EAAE,YAAY,CAAC,iBAAiB,CAAC;AAC/C,YAAA,OAAO,EAAE,YAAY,CAAC,UAAU,CAAC;AACjC,YAAA,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC;AAC3B,YAAA,KAAK,EAAE,CAAC,KAAmB,EAAE,IAAa,KAAI;gBAC1C,OAAO,IAAI,CAAC,OAAO;gBACnB,IAAI,QAAQ,EAAE;AACV,oBAAA,KAAK,CAAC,UAAU,CAAC,MAAM,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;gBACjD;YACJ,CAAC;SACJ;IACL;IAEA,KAAK,GAAA;QACD,IAAI,CAAC,yBAAyB,GAAG,eAAe,CAC5C,IAAI,CAAC,IAAI,CAAC,OAAQ,EAClB,aAAa,EACb,CAAC,KAAmB,KAAK,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CACrD;IACL;IAEA,MAAM,GAAA;AACF,QAAA,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC;IACzE;IAEA,OAAO,GAAA;QACH,IAAI,CAAC,yBAAyB,EAAE;QAChC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;IACtC;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"press.mjs","sources":["../../../src/gestures/press.ts"],"sourcesContent":["import { Feature, frame, press, type VisualElement } from \"motion-dom\"\nimport { extractEventInfo } from \"../events/event-info\"\n\nfunction handlePressEvent(\n node: VisualElement<Element>,\n event: PointerEvent,\n lifecycle: \"Start\" | \"End\" | \"Cancel\"\n) {\n const { props } = node\n\n if (node.current instanceof HTMLButtonElement && node.current.disabled) {\n return\n }\n\n if (node.animationState && props.whileTap) {\n node.animationState.setActive(\"whileTap\", lifecycle === \"Start\")\n }\n\n const eventName = (\"onTap\" + (lifecycle === \"End\" ? \"\" : lifecycle)) as\n | \"onTapStart\"\n | \"onTap\"\n | \"onTapCancel\"\n\n const callback = props[eventName]\n if (callback) {\n frame.postRender(() => callback(event, extractEventInfo(event)))\n }\n}\n\nexport class PressGesture extends Feature<Element> {\n mount() {\n const { current } = this.node\n if (!current) return\n\n const { globalTapTarget, propagate } = this.node.props\n\n this.unmount = press(\n current,\n (_element, startEvent) => {\n handlePressEvent(this.node, startEvent, \"Start\")\n\n return (endEvent, { success }) =>\n handlePressEvent(\n this.node,\n endEvent,\n success ? \"End\" : \"Cancel\"\n )\n },\n {\n useGlobalTarget: globalTapTarget,\n stopPropagation: propagate?.tap === false,\n }\n )\n }\n\n unmount() {}\n}\n"],"names":[],"mappings":";;;AAGA,SAAS,gBAAgB,CACrB,IAA4B,EAC5B,KAAmB,EACnB,SAAqC,EAAA;AAErC,IAAA,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAA;AAEtB,IAAA,IAAI,IAAI,CAAC,OAAO,YAAY,iBAAiB,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;QACpE,OAAM;KACT;IAED,IAAI,IAAI,CAAC,cAAc,IAAI,KAAK,CAAC,QAAQ,EAAE;QACvC,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,UAAU,EAAE,SAAS,KAAK,OAAO,CAAC,CAAA;KACnE;AAED,IAAA,MAAM,SAAS,IAAI,OAAO,IAAI,SAAS,KAAK,KAAK,GAAG,EAAE,GAAG,SAAS,CAAC,CAGhD,CAAA;AAEnB,IAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,SAAS,CAAC,CAAA;IACjC,IAAI,QAAQ,EAAE;AACV,QAAA,KAAK,CAAC,UAAU,CAAC,MAAM,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;KACnE;AACL,CAAC;AAEK,MAAO,YAAa,SAAQ,OAAgB,CAAA;IAC9C,KAAK,GAAA;AACD,QAAA,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,IAAI,CAAA;AAC7B,QAAA,IAAI,CAAC,OAAO;YAAE,OAAM;QAEpB,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAA;AAEtD,QAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAChB,OAAO,EACP,CAAC,QAAQ,EAAE,UAAU,KAAI;YACrB,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;YAEhD,OAAO,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,KACzB,gBAAgB,CACZ,IAAI,CAAC,IAAI,EACT,QAAQ,EACR,OAAO,GAAG,KAAK,GAAG,QAAQ,CAC7B,CAAA;AACT,SAAC,EACD;AACI,YAAA,eAAe,EAAE,eAAe;AAChC,YAAA,eAAe,EAAE,SAAS,EAAE,GAAG,KAAK,KAAK;AAC5C,SAAA,CACJ,CAAA;KACJ;AAED,IAAA,OAAO,MAAK;AACf;;;;"}
1
+ {"version":3,"file":"press.mjs","sources":["../../../src/gestures/press.ts"],"sourcesContent":["import { Feature, frame, press, type VisualElement } from \"motion-dom\"\nimport { extractEventInfo } from \"../events/event-info\"\n\nfunction handlePressEvent(\n node: VisualElement<Element>,\n event: PointerEvent,\n lifecycle: \"Start\" | \"End\" | \"Cancel\"\n) {\n const { props } = node\n\n if (node.current instanceof HTMLButtonElement && node.current.disabled) {\n return\n }\n\n if (node.animationState && props.whileTap) {\n node.animationState.setActive(\"whileTap\", lifecycle === \"Start\")\n }\n\n const eventName = (\"onTap\" + (lifecycle === \"End\" ? \"\" : lifecycle)) as\n | \"onTapStart\"\n | \"onTap\"\n | \"onTapCancel\"\n\n const callback = props[eventName]\n if (callback) {\n frame.postRender(() => callback(event, extractEventInfo(event)))\n }\n}\n\nexport class PressGesture extends Feature<Element> {\n mount() {\n const { current } = this.node\n if (!current) return\n\n const { globalTapTarget, propagate } = this.node.props\n\n this.unmount = press(\n current,\n (_element, startEvent) => {\n handlePressEvent(this.node, startEvent, \"Start\")\n\n return (endEvent, { success }) =>\n handlePressEvent(\n this.node,\n endEvent,\n success ? \"End\" : \"Cancel\"\n )\n },\n {\n useGlobalTarget: globalTapTarget,\n stopPropagation: propagate?.tap === false,\n }\n )\n }\n\n unmount() {}\n}\n"],"names":[],"mappings":";;;AAGA,SAAS,gBAAgB,CACrB,IAA4B,EAC5B,KAAmB,EACnB,SAAqC,EAAA;AAErC,IAAA,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI;AAEtB,IAAA,IAAI,IAAI,CAAC,OAAO,YAAY,iBAAiB,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;QACpE;IACJ;IAEA,IAAI,IAAI,CAAC,cAAc,IAAI,KAAK,CAAC,QAAQ,EAAE;QACvC,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,UAAU,EAAE,SAAS,KAAK,OAAO,CAAC;IACpE;AAEA,IAAA,MAAM,SAAS,IAAI,OAAO,IAAI,SAAS,KAAK,KAAK,GAAG,EAAE,GAAG,SAAS,CAAC,CAGhD;AAEnB,IAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,SAAS,CAAC;IACjC,IAAI,QAAQ,EAAE;AACV,QAAA,KAAK,CAAC,UAAU,CAAC,MAAM,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC;IACpE;AACJ;AAEM,MAAO,YAAa,SAAQ,OAAgB,CAAA;IAC9C,KAAK,GAAA;AACD,QAAA,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,IAAI;AAC7B,QAAA,IAAI,CAAC,OAAO;YAAE;QAEd,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK;AAEtD,QAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAChB,OAAO,EACP,CAAC,QAAQ,EAAE,UAAU,KAAI;YACrB,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC;YAEhD,OAAO,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,KACzB,gBAAgB,CACZ,IAAI,CAAC,IAAI,EACT,QAAQ,EACR,OAAO,GAAG,KAAK,GAAG,QAAQ,CAC7B;AACT,QAAA,CAAC,EACD;AACI,YAAA,eAAe,EAAE,eAAe;AAChC,YAAA,eAAe,EAAE,SAAS,EAAE,GAAG,KAAK,KAAK;AAC5C,SAAA,CACJ;IACL;AAEA,IAAA,OAAO,KAAI;AACd;;;;"}
package/dist/es/index.mjs CHANGED
@@ -71,8 +71,8 @@ import * as namespace from './components/Reorder/namespace.mjs';
71
71
  export { namespace as Reorder };
72
72
  export { animate, createScopedAnimate } from './animation/animate/index.mjs';
73
73
  export { animateMini } from './animation/animators/waapi/animate-style.mjs';
74
+ export { distance, distance2D } from './utils/distance.mjs';
75
+ export { inView } from './render/dom/viewport/index.mjs';
74
76
  export { scroll } from './render/dom/scroll/index.mjs';
75
77
  export { scrollInfo } from './render/dom/scroll/track.mjs';
76
- export { inView } from './render/dom/viewport/index.mjs';
77
- export { distance, distance2D } from './utils/distance.mjs';
78
78
  //# sourceMappingURL=index.mjs.map
package/dist/es/m.mjs CHANGED
@@ -1,3 +1,3 @@
1
- export { createMinimalMotionComponent as create } from './render/components/m/create.mjs';
2
1
  export { MotionA as a, MotionAbbr as abbr, MotionAddress as address, MotionAnimate as animate, MotionArea as area, MotionArticle as article, MotionAside as aside, MotionAudio as audio, MotionB as b, MotionBase as base, MotionBdi as bdi, MotionBdo as bdo, MotionBig as big, MotionBlockquote as blockquote, MotionBody as body, MotionButton as button, MotionCanvas as canvas, MotionCaption as caption, MotionCircle as circle, MotionCite as cite, MotionClipPath as clipPath, MotionCode as code, MotionCol as col, MotionColgroup as colgroup, MotionData as data, MotionDatalist as datalist, MotionDd as dd, MotionDefs as defs, MotionDel as del, MotionDesc as desc, MotionDetails as details, MotionDfn as dfn, MotionDialog as dialog, MotionDiv as div, MotionDl as dl, MotionDt as dt, MotionEllipse as ellipse, MotionEm as em, MotionEmbed as embed, MotionFeBlend as feBlend, MotionFeColorMatrix as feColorMatrix, MotionFeComponentTransfer as feComponentTransfer, MotionFeComposite as feComposite, MotionFeConvolveMatrix as feConvolveMatrix, MotionFeDiffuseLighting as feDiffuseLighting, MotionFeDisplacementMap as feDisplacementMap, MotionFeDistantLight as feDistantLight, MotionFeDropShadow as feDropShadow, MotionFeFlood as feFlood, MotionFeFuncA as feFuncA, MotionFeFuncB as feFuncB, MotionFeFuncG as feFuncG, MotionFeFuncR as feFuncR, MotionFeGaussianBlur as feGaussianBlur, MotionFeImage as feImage, MotionFeMerge as feMerge, MotionFeMergeNode as feMergeNode, MotionFeMorphology as feMorphology, MotionFeOffset as feOffset, MotionFePointLight as fePointLight, MotionFeSpecularLighting as feSpecularLighting, MotionFeSpotLight as feSpotLight, MotionFeTile as feTile, MotionFeTurbulence as feTurbulence, MotionFieldset as fieldset, MotionFigcaption as figcaption, MotionFigure as figure, MotionFilter as filter, MotionFooter as footer, MotionForeignObject as foreignObject, MotionForm as form, MotionG as g, MotionH1 as h1, MotionH2 as h2, MotionH3 as h3, MotionH4 as h4, MotionH5 as h5, MotionH6 as h6, MotionHead as head, MotionHeader as header, MotionHgroup as hgroup, MotionHr as hr, MotionHtml as html, MotionI as i, MotionIframe as iframe, MotionImage as image, MotionImg as img, MotionInput as input, MotionIns as ins, MotionKbd as kbd, MotionKeygen as keygen, MotionLabel as label, MotionLegend as legend, MotionLi as li, MotionLine as line, MotionLinearGradient as linearGradient, MotionLink as link, MotionMain as main, MotionMap as map, MotionMark as mark, MotionMarker as marker, MotionMask as mask, MotionMenu as menu, MotionMenuitem as menuitem, MotionMetadata as metadata, MotionMeter as meter, MotionNav as nav, MotionObject as object, MotionOl as ol, MotionOptgroup as optgroup, MotionOption as option, MotionOutput as output, MotionP as p, MotionParam as param, MotionPath as path, MotionPattern as pattern, MotionPicture as picture, MotionPolygon as polygon, MotionPolyline as polyline, MotionPre as pre, MotionProgress as progress, MotionQ as q, MotionRadialGradient as radialGradient, MotionRect as rect, MotionRp as rp, MotionRt as rt, MotionRuby as ruby, MotionS as s, MotionSamp as samp, MotionScript as script, MotionSection as section, MotionSelect as select, MotionSmall as small, MotionSource as source, MotionSpan as span, MotionStop as stop, MotionStrong as strong, MotionStyle as style, MotionSub as sub, MotionSummary as summary, MotionSup as sup, MotionSvg as svg, MotionSymbol as symbol, MotionTable as table, MotionTbody as tbody, MotionTd as td, MotionText as text, MotionTextPath as textPath, MotionTextarea as textarea, MotionTfoot as tfoot, MotionTh as th, MotionThead as thead, MotionTime as time, MotionTitle as title, MotionTr as tr, MotionTrack as track, MotionTspan as tspan, MotionU as u, MotionUl as ul, MotionUse as use, MotionVideo as video, MotionView as view, MotionWbr as wbr, MotionWebview as webview } from './render/components/m/elements.mjs';
2
+ export { createMinimalMotionComponent as create } from './render/components/m/create.mjs';
3
3
  //# sourceMappingURL=m.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"exit.mjs","sources":["../../../../../src/motion/features/animation/exit.ts"],"sourcesContent":["import { Feature } from \"motion-dom\"\n\nlet id = 0\n\nexport class ExitAnimationFeature extends Feature<unknown> {\n private id: number = id++\n\n update() {\n if (!this.node.presenceContext) return\n\n const { isPresent, onExitComplete } = this.node.presenceContext\n const { isPresent: prevIsPresent } = this.node.prevPresenceContext || {}\n\n if (!this.node.animationState || isPresent === prevIsPresent) {\n return\n }\n\n const exitAnimation = this.node.animationState.setActive(\n \"exit\",\n !isPresent\n )\n\n if (onExitComplete && !isPresent) {\n exitAnimation.then(() => {\n onExitComplete(this.id)\n })\n }\n }\n\n mount() {\n const { register, onExitComplete } = this.node.presenceContext || {}\n\n if (onExitComplete) {\n onExitComplete(this.id)\n }\n\n if (register) {\n this.unmount = register(this.id)\n }\n }\n\n unmount() {}\n}\n"],"names":[],"mappings":";;AAEA,IAAI,EAAE,GAAG,CAA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\n\nlet id = 0\n\nexport class ExitAnimationFeature extends Feature<unknown> {\n private id: number = id++\n\n update() {\n if (!this.node.presenceContext) return\n\n const { isPresent, onExitComplete } = this.node.presenceContext\n const { isPresent: prevIsPresent } = this.node.prevPresenceContext || {}\n\n if (!this.node.animationState || isPresent === prevIsPresent) {\n return\n }\n\n const exitAnimation = this.node.animationState.setActive(\n \"exit\",\n !isPresent\n )\n\n if (onExitComplete && !isPresent) {\n exitAnimation.then(() => {\n onExitComplete(this.id)\n })\n }\n }\n\n mount() {\n const { register, onExitComplete } = this.node.presenceContext || {}\n\n if (onExitComplete) {\n onExitComplete(this.id)\n }\n\n if (register) {\n this.unmount = register(this.id)\n }\n }\n\n unmount() {}\n}\n"],"names":[],"mappings":";;AAEA,IAAI,EAAE,GAAG,CAAC;AAEJ,MAAO,oBAAqB,SAAQ,OAAgB,CAAA;AAA1D,IAAA,WAAA,GAAA;;QACY,IAAA,CAAA,EAAE,GAAW,EAAE,EAAE;IAqC7B;IAnCI,MAAM,GAAA;AACF,QAAA,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe;YAAE;QAEhC,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe;AAC/D,QAAA,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,mBAAmB,IAAI,EAAE;QAExE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,IAAI,SAAS,KAAK,aAAa,EAAE;YAC1D;QACJ;AAEA,QAAA,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,SAAS,CACpD,MAAM,EACN,CAAC,SAAS,CACb;AAED,QAAA,IAAI,cAAc,IAAI,CAAC,SAAS,EAAE;AAC9B,YAAA,aAAa,CAAC,IAAI,CAAC,MAAK;AACpB,gBAAA,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;AAC3B,YAAA,CAAC,CAAC;QACN;IACJ;IAEA,KAAK,GAAA;AACD,QAAA,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,EAAE;QAEpE,IAAI,cAAc,EAAE;AAChB,YAAA,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3B;QAEA,IAAI,QAAQ,EAAE;YACV,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACpC;IACJ;AAEA,IAAA,OAAO,KAAI;AACd;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../../../src/motion/features/animation/index.ts"],"sourcesContent":["import {\n createAnimationState,\n Feature,\n isAnimationControls,\n type VisualElement,\n} from \"motion-dom\"\n\nexport class AnimationFeature extends Feature<unknown> {\n unmountControls?: () => void\n\n /**\n * We dynamically generate the AnimationState manager as it contains a reference\n * to the underlying animation library. We only want to load that if we load this,\n * so people can optionally code split it out using the `m` component.\n */\n constructor(node: VisualElement) {\n super(node)\n node.animationState ||= createAnimationState(node)\n }\n\n updateAnimationControlsSubscription() {\n const { animate } = this.node.getProps()\n if (isAnimationControls(animate)) {\n this.unmountControls = animate.subscribe(this.node)\n }\n }\n\n /**\n * Subscribe any provided AnimationControls to the component's VisualElement\n */\n mount() {\n this.updateAnimationControlsSubscription()\n }\n\n update() {\n const { animate } = this.node.getProps()\n const { animate: prevAnimate } = this.node.prevProps || {}\n if (animate !== prevAnimate) {\n this.updateAnimationControlsSubscription()\n }\n }\n\n unmount() {\n this.node.animationState!.reset()\n this.unmountControls?.()\n }\n}\n"],"names":[],"mappings":";;AAOM,MAAO,gBAAiB,SAAQ,OAAgB,CAAA;AAGlD;;;;AAIG;AACH,IAAA,WAAA,CAAY,IAAmB,EAAA;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAA;QACX,IAAI,CAAC,cAAc,KAAnB,IAAI,CAAC,cAAc,GAAK,oBAAoB,CAAC,IAAI,CAAC,CAAA,CAAA;KACrD;IAED,mCAAmC,GAAA;QAC/B,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAA;AACxC,QAAA,IAAI,mBAAmB,CAAC,OAAO,CAAC,EAAE;YAC9B,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;SACtD;KACJ;AAED;;AAEG;IACH,KAAK,GAAA;QACD,IAAI,CAAC,mCAAmC,EAAE,CAAA;KAC7C;IAED,MAAM,GAAA;QACF,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAA;AACxC,QAAA,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAA;AAC1D,QAAA,IAAI,OAAO,KAAK,WAAW,EAAE;YACzB,IAAI,CAAC,mCAAmC,EAAE,CAAA;SAC7C;KACJ;IAED,OAAO,GAAA;AACH,QAAA,IAAI,CAAC,IAAI,CAAC,cAAe,CAAC,KAAK,EAAE,CAAA;AACjC,QAAA,IAAI,CAAC,eAAe,IAAI,CAAA;KAC3B;AACJ;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../../../../src/motion/features/animation/index.ts"],"sourcesContent":["import {\n createAnimationState,\n Feature,\n isAnimationControls,\n type VisualElement,\n} from \"motion-dom\"\n\nexport class AnimationFeature extends Feature<unknown> {\n unmountControls?: () => void\n\n /**\n * We dynamically generate the AnimationState manager as it contains a reference\n * to the underlying animation library. We only want to load that if we load this,\n * so people can optionally code split it out using the `m` component.\n */\n constructor(node: VisualElement) {\n super(node)\n node.animationState ||= createAnimationState(node)\n }\n\n updateAnimationControlsSubscription() {\n const { animate } = this.node.getProps()\n if (isAnimationControls(animate)) {\n this.unmountControls = animate.subscribe(this.node)\n }\n }\n\n /**\n * Subscribe any provided AnimationControls to the component's VisualElement\n */\n mount() {\n this.updateAnimationControlsSubscription()\n }\n\n update() {\n const { animate } = this.node.getProps()\n const { animate: prevAnimate } = this.node.prevProps || {}\n if (animate !== prevAnimate) {\n this.updateAnimationControlsSubscription()\n }\n }\n\n unmount() {\n this.node.animationState!.reset()\n this.unmountControls?.()\n }\n}\n"],"names":[],"mappings":";;AAOM,MAAO,gBAAiB,SAAQ,OAAgB,CAAA;AAGlD;;;;AAIG;AACH,IAAA,WAAA,CAAY,IAAmB,EAAA;QAC3B,KAAK,CAAC,IAAI,CAAC;QACX,IAAI,CAAC,cAAc,KAAnB,IAAI,CAAC,cAAc,GAAK,oBAAoB,CAAC,IAAI,CAAC,CAAA;IACtD;IAEA,mCAAmC,GAAA;QAC/B,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;AACxC,QAAA,IAAI,mBAAmB,CAAC,OAAO,CAAC,EAAE;YAC9B,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;QACvD;IACJ;AAEA;;AAEG;IACH,KAAK,GAAA;QACD,IAAI,CAAC,mCAAmC,EAAE;IAC9C;IAEA,MAAM,GAAA;QACF,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;AACxC,QAAA,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE;AAC1D,QAAA,IAAI,OAAO,KAAK,WAAW,EAAE;YACzB,IAAI,CAAC,mCAAmC,EAAE;QAC9C;IACJ;IAEA,OAAO,GAAA;AACH,QAAA,IAAI,CAAC,IAAI,CAAC,cAAe,CAAC,KAAK,EAAE;AACjC,QAAA,IAAI,CAAC,eAAe,IAAI;IAC5B;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"animations.mjs","sources":["../../../../src/motion/features/animations.ts"],"sourcesContent":["import { AnimationFeature } from \"./animation\"\nimport { ExitAnimationFeature } from \"./animation/exit\"\nimport { FeaturePackages } from \"./types\"\n\nexport const animations: FeaturePackages = {\n animation: {\n Feature: AnimationFeature,\n },\n exit: {\n Feature: ExitAnimationFeature,\n },\n}\n"],"names":[],"mappings":";;;AAIa,MAAA,UAAU,GAAoB;AACvC,IAAA,SAAS,EAAE;AACP,QAAA,OAAO,EAAE,gBAAgB;AAC5B,KAAA;AACD,IAAA,IAAI,EAAE;AACF,QAAA,OAAO,EAAE,oBAAoB;AAChC,KAAA;;;;;"}
1
+ {"version":3,"file":"animations.mjs","sources":["../../../../src/motion/features/animations.ts"],"sourcesContent":["import { AnimationFeature } from \"./animation\"\nimport { ExitAnimationFeature } from \"./animation/exit\"\nimport { FeaturePackages } from \"./types\"\n\nexport const animations: FeaturePackages = {\n animation: {\n Feature: AnimationFeature,\n },\n exit: {\n Feature: ExitAnimationFeature,\n },\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,UAAU,GAAoB;AACvC,IAAA,SAAS,EAAE;AACP,QAAA,OAAO,EAAE,gBAAgB;AAC5B,KAAA;AACD,IAAA,IAAI,EAAE;AACF,QAAA,OAAO,EAAE,oBAAoB;AAChC,KAAA;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.mjs","sources":["../../../../src/motion/features/definitions.ts"],"sourcesContent":["import { getFeatureDefinitions, setFeatureDefinitions } from \"motion-dom\"\nimport { MotionProps } from \"../types\"\nimport { FeatureDefinitions } from \"./types\"\n\nconst featureProps = {\n animation: [\n \"animate\",\n \"variants\",\n \"whileHover\",\n \"whileTap\",\n \"exit\",\n \"whileInView\",\n \"whileFocus\",\n \"whileDrag\",\n ],\n exit: [\"exit\"],\n drag: [\"drag\", \"dragControls\"],\n focus: [\"whileFocus\"],\n hover: [\"whileHover\", \"onHoverStart\", \"onHoverEnd\"],\n tap: [\"whileTap\", \"onTap\", \"onTapStart\", \"onTapCancel\"],\n pan: [\"onPan\", \"onPanStart\", \"onPanSessionStart\", \"onPanEnd\"],\n inView: [\"whileInView\", \"onViewportEnter\", \"onViewportLeave\"],\n layout: [\"layout\", \"layoutId\"],\n}\n\nlet isInitialized = false\n\n/**\n * Initialize feature definitions with isEnabled checks.\n * This must be called before any motion components are rendered.\n */\nexport function initFeatureDefinitions() {\n if (isInitialized) return\n\n const initialFeatureDefinitions: Partial<FeatureDefinitions> = {}\n\n for (const key in featureProps) {\n initialFeatureDefinitions[\n key as keyof typeof initialFeatureDefinitions\n ] = {\n isEnabled: (props: MotionProps) =>\n featureProps[key as keyof typeof featureProps].some(\n (name: string) => !!props[name as keyof typeof props]\n ),\n }\n }\n\n setFeatureDefinitions(initialFeatureDefinitions)\n isInitialized = true\n}\n\n/**\n * Get the current feature definitions, initializing if needed.\n */\nexport function getInitializedFeatureDefinitions(): Partial<FeatureDefinitions> {\n initFeatureDefinitions()\n return getFeatureDefinitions()\n}\n"],"names":[],"mappings":";;AAIA,MAAM,YAAY,GAAG;AACjB,IAAA,SAAS,EAAE;QACP,SAAS;QACT,UAAU;QACV,YAAY;QACZ,UAAU;QACV,MAAM;QACN,aAAa;QACb,YAAY;QACZ,WAAW;AACd,KAAA;IACD,IAAI,EAAE,CAAC,MAAM,CAAC;AACd,IAAA,IAAI,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC;IAC9B,KAAK,EAAE,CAAC,YAAY,CAAC;AACrB,IAAA,KAAK,EAAE,CAAC,YAAY,EAAE,cAAc,EAAE,YAAY,CAAC;IACnD,GAAG,EAAE,CAAC,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,CAAC;IACvD,GAAG,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,UAAU,CAAC;AAC7D,IAAA,MAAM,EAAE,CAAC,aAAa,EAAE,iBAAiB,EAAE,iBAAiB,CAAC;AAC7D,IAAA,MAAM,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC;CACjC,CAAA;AAED,IAAI,aAAa,GAAG,KAAK,CAAA;AAEzB;;;AAGG;SACa,sBAAsB,GAAA;AAClC,IAAA,IAAI,aAAa;QAAE,OAAM;IAEzB,MAAM,yBAAyB,GAAgC,EAAE,CAAA;AAEjE,IAAA,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE;QAC5B,yBAAyB,CACrB,GAA6C,CAChD,GAAG;YACA,SAAS,EAAE,CAAC,KAAkB,KAC1B,YAAY,CAAC,GAAgC,CAAC,CAAC,IAAI,CAC/C,CAAC,IAAY,KAAK,CAAC,CAAC,KAAK,CAAC,IAA0B,CAAC,CACxD;SACR,CAAA;KACJ;IAED,qBAAqB,CAAC,yBAAyB,CAAC,CAAA;IAChD,aAAa,GAAG,IAAI,CAAA;AACxB,CAAC;AAED;;AAEG;SACa,gCAAgC,GAAA;AAC5C,IAAA,sBAAsB,EAAE,CAAA;IACxB,OAAO,qBAAqB,EAAE,CAAA;AAClC;;;;"}
1
+ {"version":3,"file":"definitions.mjs","sources":["../../../../src/motion/features/definitions.ts"],"sourcesContent":["import { getFeatureDefinitions, setFeatureDefinitions } from \"motion-dom\"\nimport { MotionProps } from \"../types\"\nimport { FeatureDefinitions } from \"./types\"\n\nconst featureProps = {\n animation: [\n \"animate\",\n \"variants\",\n \"whileHover\",\n \"whileTap\",\n \"exit\",\n \"whileInView\",\n \"whileFocus\",\n \"whileDrag\",\n ],\n exit: [\"exit\"],\n drag: [\"drag\", \"dragControls\"],\n focus: [\"whileFocus\"],\n hover: [\"whileHover\", \"onHoverStart\", \"onHoverEnd\"],\n tap: [\"whileTap\", \"onTap\", \"onTapStart\", \"onTapCancel\"],\n pan: [\"onPan\", \"onPanStart\", \"onPanSessionStart\", \"onPanEnd\"],\n inView: [\"whileInView\", \"onViewportEnter\", \"onViewportLeave\"],\n layout: [\"layout\", \"layoutId\"],\n}\n\nlet isInitialized = false\n\n/**\n * Initialize feature definitions with isEnabled checks.\n * This must be called before any motion components are rendered.\n */\nexport function initFeatureDefinitions() {\n if (isInitialized) return\n\n const initialFeatureDefinitions: Partial<FeatureDefinitions> = {}\n\n for (const key in featureProps) {\n initialFeatureDefinitions[\n key as keyof typeof initialFeatureDefinitions\n ] = {\n isEnabled: (props: MotionProps) =>\n featureProps[key as keyof typeof featureProps].some(\n (name: string) => !!props[name as keyof typeof props]\n ),\n }\n }\n\n setFeatureDefinitions(initialFeatureDefinitions)\n isInitialized = true\n}\n\n/**\n * Get the current feature definitions, initializing if needed.\n */\nexport function getInitializedFeatureDefinitions(): Partial<FeatureDefinitions> {\n initFeatureDefinitions()\n return getFeatureDefinitions()\n}\n"],"names":[],"mappings":";;AAIA,MAAM,YAAY,GAAG;AACjB,IAAA,SAAS,EAAE;QACP,SAAS;QACT,UAAU;QACV,YAAY;QACZ,UAAU;QACV,MAAM;QACN,aAAa;QACb,YAAY;QACZ,WAAW;AACd,KAAA;IACD,IAAI,EAAE,CAAC,MAAM,CAAC;AACd,IAAA,IAAI,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC;IAC9B,KAAK,EAAE,CAAC,YAAY,CAAC;AACrB,IAAA,KAAK,EAAE,CAAC,YAAY,EAAE,cAAc,EAAE,YAAY,CAAC;IACnD,GAAG,EAAE,CAAC,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,CAAC;IACvD,GAAG,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,UAAU,CAAC;AAC7D,IAAA,MAAM,EAAE,CAAC,aAAa,EAAE,iBAAiB,EAAE,iBAAiB,CAAC;AAC7D,IAAA,MAAM,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC;CACjC;AAED,IAAI,aAAa,GAAG,KAAK;AAEzB;;;AAGG;SACa,sBAAsB,GAAA;AAClC,IAAA,IAAI,aAAa;QAAE;IAEnB,MAAM,yBAAyB,GAAgC,EAAE;AAEjE,IAAA,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE;QAC5B,yBAAyB,CACrB,GAA6C,CAChD,GAAG;YACA,SAAS,EAAE,CAAC,KAAkB,KAC1B,YAAY,CAAC,GAAgC,CAAC,CAAC,IAAI,CAC/C,CAAC,IAAY,KAAK,CAAC,CAAC,KAAK,CAAC,IAA0B,CAAC,CACxD;SACR;IACL;IAEA,qBAAqB,CAAC,yBAAyB,CAAC;IAChD,aAAa,GAAG,IAAI;AACxB;AAEA;;AAEG;SACa,gCAAgC,GAAA;AAC5C,IAAA,sBAAsB,EAAE;IACxB,OAAO,qBAAqB,EAAE;AAClC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"drag.mjs","sources":["../../../../src/motion/features/drag.ts"],"sourcesContent":["import { DragGesture } from \"../../gestures/drag\"\nimport { PanGesture } from \"../../gestures/pan\"\nimport { HTMLProjectionNode } from \"../../projection\"\nimport { MeasureLayout } from \"./layout/MeasureLayout\"\nimport { FeaturePackages } from \"./types\"\n\nexport const drag: FeaturePackages = {\n pan: {\n Feature: PanGesture,\n },\n drag: {\n Feature: DragGesture,\n ProjectionNode: HTMLProjectionNode,\n MeasureLayout,\n },\n}\n"],"names":[],"mappings":";;;;;AAMa,MAAA,IAAI,GAAoB;AACjC,IAAA,GAAG,EAAE;AACD,QAAA,OAAO,EAAE,UAAU;AACtB,KAAA;AACD,IAAA,IAAI,EAAE;AACF,QAAA,OAAO,EAAE,WAAW;AACpB,QAAA,cAAc,EAAE,kBAAkB;QAClC,aAAa;AAChB,KAAA;;;;;"}
1
+ {"version":3,"file":"drag.mjs","sources":["../../../../src/motion/features/drag.ts"],"sourcesContent":["import { DragGesture } from \"../../gestures/drag\"\nimport { PanGesture } from \"../../gestures/pan\"\nimport { HTMLProjectionNode } from \"../../projection\"\nimport { MeasureLayout } from \"./layout/MeasureLayout\"\nimport { FeaturePackages } from \"./types\"\n\nexport const drag: FeaturePackages = {\n pan: {\n Feature: PanGesture,\n },\n drag: {\n Feature: DragGesture,\n ProjectionNode: HTMLProjectionNode,\n MeasureLayout,\n },\n}\n"],"names":[],"mappings":";;;;;AAMO,MAAM,IAAI,GAAoB;AACjC,IAAA,GAAG,EAAE;AACD,QAAA,OAAO,EAAE,UAAU;AACtB,KAAA;AACD,IAAA,IAAI,EAAE;AACF,QAAA,OAAO,EAAE,WAAW;AACpB,QAAA,cAAc,EAAE,kBAAkB;QAClC,aAAa;AAChB,KAAA;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"gestures.mjs","sources":["../../../../src/motion/features/gestures.ts"],"sourcesContent":["import { HoverGesture } from \"../../gestures/hover\"\nimport { FocusGesture } from \"../../gestures/focus\"\nimport { PressGesture } from \"../../gestures/press\"\nimport { InViewFeature } from \"./viewport\"\nimport { FeaturePackages } from \"./types\"\n\nexport const gestureAnimations: FeaturePackages = {\n inView: {\n Feature: InViewFeature,\n },\n tap: {\n Feature: PressGesture,\n },\n focus: {\n Feature: FocusGesture,\n },\n hover: {\n Feature: HoverGesture,\n },\n}\n"],"names":[],"mappings":";;;;;AAMa,MAAA,iBAAiB,GAAoB;AAC9C,IAAA,MAAM,EAAE;AACJ,QAAA,OAAO,EAAE,aAAa;AACzB,KAAA;AACD,IAAA,GAAG,EAAE;AACD,QAAA,OAAO,EAAE,YAAY;AACxB,KAAA;AACD,IAAA,KAAK,EAAE;AACH,QAAA,OAAO,EAAE,YAAY;AACxB,KAAA;AACD,IAAA,KAAK,EAAE;AACH,QAAA,OAAO,EAAE,YAAY;AACxB,KAAA;;;;;"}
1
+ {"version":3,"file":"gestures.mjs","sources":["../../../../src/motion/features/gestures.ts"],"sourcesContent":["import { HoverGesture } from \"../../gestures/hover\"\nimport { FocusGesture } from \"../../gestures/focus\"\nimport { PressGesture } from \"../../gestures/press\"\nimport { InViewFeature } from \"./viewport\"\nimport { FeaturePackages } from \"./types\"\n\nexport const gestureAnimations: FeaturePackages = {\n inView: {\n Feature: InViewFeature,\n },\n tap: {\n Feature: PressGesture,\n },\n focus: {\n Feature: FocusGesture,\n },\n hover: {\n Feature: HoverGesture,\n },\n}\n"],"names":[],"mappings":";;;;;AAMO,MAAM,iBAAiB,GAAoB;AAC9C,IAAA,MAAM,EAAE;AACJ,QAAA,OAAO,EAAE,aAAa;AACzB,KAAA;AACD,IAAA,GAAG,EAAE;AACD,QAAA,OAAO,EAAE,YAAY;AACxB,KAAA;AACD,IAAA,KAAK,EAAE;AACH,QAAA,OAAO,EAAE,YAAY;AACxB,KAAA;AACD,IAAA,KAAK,EAAE;AACH,QAAA,OAAO,EAAE,YAAY;AACxB,KAAA;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"layout.mjs","sources":["../../../../src/motion/features/layout.ts"],"sourcesContent":["import { HTMLProjectionNode } from \"motion-dom\"\nimport { MeasureLayout } from \"./layout/MeasureLayout\"\nimport { FeaturePackages } from \"./types\"\n\nexport const layout: FeaturePackages = {\n layout: {\n ProjectionNode: HTMLProjectionNode,\n MeasureLayout,\n },\n}\n"],"names":[],"mappings":";;;AAIa,MAAA,MAAM,GAAoB;AACnC,IAAA,MAAM,EAAE;AACJ,QAAA,cAAc,EAAE,kBAAkB;QAClC,aAAa;AAChB,KAAA;;;;;"}
1
+ {"version":3,"file":"layout.mjs","sources":["../../../../src/motion/features/layout.ts"],"sourcesContent":["import { HTMLProjectionNode } from \"motion-dom\"\nimport { MeasureLayout } from \"./layout/MeasureLayout\"\nimport { FeaturePackages } from \"./types\"\n\nexport const layout: FeaturePackages = {\n layout: {\n ProjectionNode: HTMLProjectionNode,\n MeasureLayout,\n },\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,MAAM,GAAoB;AACnC,IAAA,MAAM,EAAE;AACJ,QAAA,cAAc,EAAE,kBAAkB;QAClC,aAAa;AAChB,KAAA;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"load-features.mjs","sources":["../../../../src/motion/features/load-features.ts"],"sourcesContent":["import { setFeatureDefinitions } from \"motion-dom\"\nimport { getInitializedFeatureDefinitions } from \"./definitions\"\nimport { FeaturePackages } from \"./types\"\n\nexport function loadFeatures(features: FeaturePackages) {\n const featureDefinitions = getInitializedFeatureDefinitions()\n\n for (const key in features) {\n featureDefinitions[key as keyof typeof featureDefinitions] = {\n ...featureDefinitions[key as keyof typeof featureDefinitions],\n ...features[key as keyof typeof features],\n } as any\n }\n\n setFeatureDefinitions(featureDefinitions)\n}\n"],"names":[],"mappings":";;;AAIM,SAAU,YAAY,CAAC,QAAyB,EAAA;AAClD,IAAA,MAAM,kBAAkB,GAAG,gCAAgC,EAAE,CAAA;AAE7D,IAAA,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE;QACxB,kBAAkB,CAAC,GAAsC,CAAC,GAAG;YACzD,GAAG,kBAAkB,CAAC,GAAsC,CAAC;YAC7D,GAAG,QAAQ,CAAC,GAA4B,CAAC;SACrC,CAAA;KACX;IAED,qBAAqB,CAAC,kBAAkB,CAAC,CAAA;AAC7C;;;;"}
1
+ {"version":3,"file":"load-features.mjs","sources":["../../../../src/motion/features/load-features.ts"],"sourcesContent":["import { setFeatureDefinitions } from \"motion-dom\"\nimport { getInitializedFeatureDefinitions } from \"./definitions\"\nimport { FeaturePackages } from \"./types\"\n\nexport function loadFeatures(features: FeaturePackages) {\n const featureDefinitions = getInitializedFeatureDefinitions()\n\n for (const key in features) {\n featureDefinitions[key as keyof typeof featureDefinitions] = {\n ...featureDefinitions[key as keyof typeof featureDefinitions],\n ...features[key as keyof typeof features],\n } as any\n }\n\n setFeatureDefinitions(featureDefinitions)\n}\n"],"names":[],"mappings":";;;AAIM,SAAU,YAAY,CAAC,QAAyB,EAAA;AAClD,IAAA,MAAM,kBAAkB,GAAG,gCAAgC,EAAE;AAE7D,IAAA,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE;QACxB,kBAAkB,CAAC,GAAsC,CAAC,GAAG;YACzD,GAAG,kBAAkB,CAAC,GAAsC,CAAC;YAC7D,GAAG,QAAQ,CAAC,GAA4B,CAAC;SACrC;IACZ;IAEA,qBAAqB,CAAC,kBAAkB,CAAC;AAC7C;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../../../src/motion/features/viewport/index.ts"],"sourcesContent":["import { Feature } from \"motion-dom\"\nimport { MotionProps } from \"../../types\"\nimport { observeIntersection } from \"./observers\"\n\nconst thresholdNames = {\n some: 0,\n all: 1,\n}\n\nexport class InViewFeature extends Feature<Element> {\n private hasEnteredView = false\n\n private isInView = false\n\n private startObserver() {\n this.unmount()\n\n const { viewport = {} } = this.node.getProps()\n const { root, margin: rootMargin, amount = \"some\", once } = viewport\n\n const options = {\n root: root ? root.current : undefined,\n rootMargin,\n threshold:\n typeof amount === \"number\" ? amount : thresholdNames[amount],\n }\n\n const onIntersectionUpdate = (entry: IntersectionObserverEntry) => {\n const { isIntersecting } = entry\n\n /**\n * If there's been no change in the viewport state, early return.\n */\n if (this.isInView === isIntersecting) return\n\n this.isInView = isIntersecting\n\n /**\n * Handle hasEnteredView. If this is only meant to run once, and\n * element isn't visible, early return. Otherwise set hasEnteredView to true.\n */\n if (once && !isIntersecting && this.hasEnteredView) {\n return\n } else if (isIntersecting) {\n this.hasEnteredView = true\n }\n\n if (this.node.animationState) {\n this.node.animationState.setActive(\n \"whileInView\",\n isIntersecting\n )\n }\n\n /**\n * Use the latest committed props rather than the ones in scope\n * when this observer is created\n */\n const { onViewportEnter, onViewportLeave } = this.node.getProps()\n const callback = isIntersecting ? onViewportEnter : onViewportLeave\n callback && callback(entry)\n }\n\n return observeIntersection(\n this.node.current!,\n options,\n onIntersectionUpdate\n )\n }\n\n mount() {\n this.startObserver()\n }\n\n update() {\n if (typeof IntersectionObserver === \"undefined\") return\n\n const { props, prevProps } = this.node\n const hasOptionsChanged = [\"amount\", \"margin\", \"root\"].some(\n hasViewportOptionChanged(props, prevProps)\n )\n\n if (hasOptionsChanged) {\n this.startObserver()\n }\n }\n\n unmount() {}\n}\n\nfunction hasViewportOptionChanged(\n { viewport = {} }: MotionProps,\n { viewport: prevViewport = {} }: MotionProps = {}\n) {\n return (name: keyof typeof viewport) =>\n viewport[name] !== prevViewport[name]\n}\n"],"names":[],"mappings":";;;AAIA,MAAM,cAAc,GAAG;AACnB,IAAA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,CACjB,CAAA;aACJ;AAED;;;AAGG;AACH,YAAA,MAAM,EAAE,eAAe,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAA;YACjE,MAAM,QAAQ,GAAG,cAAc,GAAG,eAAe,GAAG,eAAe,CAAA;AACnE,YAAA,QAAQ,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAA;AAC/B,SAAC,CAAA;AAED,QAAA,OAAO,mBAAmB,CACtB,IAAI,CAAC,IAAI,CAAC,OAAQ,EAClB,OAAO,EACP,oBAAoB,CACvB,CAAA;KACJ;IAED,KAAK,GAAA;QACD,IAAI,CAAC,aAAa,EAAE,CAAA;KACvB;IAED,MAAM,GAAA;QACF,IAAI,OAAO,oBAAoB,KAAK,WAAW;YAAE,OAAM;QAEvD,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,IAAI,CAAA;AACtC,QAAA,MAAM,iBAAiB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,IAAI,CACvD,wBAAwB,CAAC,KAAK,EAAE,SAAS,CAAC,CAC7C,CAAA;QAED,IAAI,iBAAiB,EAAE;YACnB,IAAI,CAAC,aAAa,EAAE,CAAA;SACvB;KACJ;AAED,IAAA,OAAO,MAAK;AACf,CAAA;AAED,SAAS,wBAAwB,CAC7B,EAAE,QAAQ,GAAG,EAAE,EAAe,EAC9B,EAAE,QAAQ,EAAE,YAAY,GAAG,EAAE,KAAkB,EAAE,EAAA;AAEjD,IAAA,OAAO,CAAC,IAA2B,KAC/B,QAAQ,CAAC,IAAI,CAAC,KAAK,YAAY,CAAC,IAAI,CAAC,CAAA;AAC7C;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../../../../src/motion/features/viewport/index.ts"],"sourcesContent":["import { Feature } from \"motion-dom\"\nimport { MotionProps } from \"../../types\"\nimport { observeIntersection } from \"./observers\"\n\nconst thresholdNames = {\n some: 0,\n all: 1,\n}\n\nexport class InViewFeature extends Feature<Element> {\n private hasEnteredView = false\n\n private isInView = false\n\n private startObserver() {\n this.unmount()\n\n const { viewport = {} } = this.node.getProps()\n const { root, margin: rootMargin, amount = \"some\", once } = viewport\n\n const options = {\n root: root ? root.current : undefined,\n rootMargin,\n threshold:\n typeof amount === \"number\" ? amount : thresholdNames[amount],\n }\n\n const onIntersectionUpdate = (entry: IntersectionObserverEntry) => {\n const { isIntersecting } = entry\n\n /**\n * If there's been no change in the viewport state, early return.\n */\n if (this.isInView === isIntersecting) return\n\n this.isInView = isIntersecting\n\n /**\n * Handle hasEnteredView. If this is only meant to run once, and\n * element isn't visible, early return. Otherwise set hasEnteredView to true.\n */\n if (once && !isIntersecting && this.hasEnteredView) {\n return\n } else if (isIntersecting) {\n this.hasEnteredView = true\n }\n\n if (this.node.animationState) {\n this.node.animationState.setActive(\n \"whileInView\",\n isIntersecting\n )\n }\n\n /**\n * Use the latest committed props rather than the ones in scope\n * when this observer is created\n */\n const { onViewportEnter, onViewportLeave } = this.node.getProps()\n const callback = isIntersecting ? onViewportEnter : onViewportLeave\n callback && callback(entry)\n }\n\n return observeIntersection(\n this.node.current!,\n options,\n onIntersectionUpdate\n )\n }\n\n mount() {\n this.startObserver()\n }\n\n update() {\n if (typeof IntersectionObserver === \"undefined\") return\n\n const { props, prevProps } = this.node\n const hasOptionsChanged = [\"amount\", \"margin\", \"root\"].some(\n hasViewportOptionChanged(props, prevProps)\n )\n\n if (hasOptionsChanged) {\n this.startObserver()\n }\n }\n\n unmount() {}\n}\n\nfunction hasViewportOptionChanged(\n { viewport = {} }: MotionProps,\n { viewport: prevViewport = {} }: MotionProps = {}\n) {\n return (name: keyof typeof viewport) =>\n viewport[name] !== prevViewport[name]\n}\n"],"names":[],"mappings":";;;AAIA,MAAM,cAAc,GAAG;AACnB,IAAA,IAAI,EAAE,CAAC;AACP,IAAA,GAAG,EAAE,CAAC;CACT;AAEK,MAAO,aAAc,SAAQ,OAAgB,CAAA;AAAnD,IAA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AACnE,YAAA,QAAQ,IAAI,QAAQ,CAAC,KAAK,CAAC;AAC/B,QAAA,CAAC;AAED,QAAA,OAAO,mBAAmB,CACtB,IAAI,CAAC,IAAI,CAAC,OAAQ,EAClB,OAAO,EACP,oBAAoB,CACvB;IACL;IAEA,KAAK,GAAA;QACD,IAAI,CAAC,aAAa,EAAE;IACxB;IAEA,MAAM,GAAA;QACF,IAAI,OAAO,oBAAoB,KAAK,WAAW;YAAE;QAEjD,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,IAAI;AACtC,QAAA,MAAM,iBAAiB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,IAAI,CACvD,wBAAwB,CAAC,KAAK,EAAE,SAAS,CAAC,CAC7C;QAED,IAAI,iBAAiB,EAAE;YACnB,IAAI,CAAC,aAAa,EAAE;QACxB;IACJ;AAEA,IAAA,OAAO,KAAI;AACd;AAED,SAAS,wBAAwB,CAC7B,EAAE,QAAQ,GAAG,EAAE,EAAe,EAC9B,EAAE,QAAQ,EAAE,YAAY,GAAG,EAAE,KAAkB,EAAE,EAAA;AAEjD,IAAA,OAAO,CAAC,IAA2B,KAC/B,QAAQ,CAAC,IAAI,CAAC,KAAK,YAAY,CAAC,IAAI,CAAC;AAC7C;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"observers.mjs","sources":["../../../../../src/motion/features/viewport/observers.ts"],"sourcesContent":["type IntersectionHandler = (entry: IntersectionObserverEntry) => void\n\ninterface ElementIntersectionObservers {\n [key: string]: IntersectionObserver\n}\n\n/**\n * Map an IntersectionHandler callback to an element. We only ever make one handler for one\n * element, so even though these handlers might all be triggered by different\n * observers, we can keep them in the same map.\n */\nconst observerCallbacks = new WeakMap<Element, IntersectionHandler>()\n\n/**\n * Multiple observers can be created for multiple element/document roots. Each with\n * different settings. So here we store dictionaries of observers to each root,\n * using serialised settings (threshold/margin) as lookup keys.\n */\nconst observers = new WeakMap<\n Element | Document,\n ElementIntersectionObservers\n>()\n\nconst fireObserverCallback = (entry: IntersectionObserverEntry) => {\n const callback = observerCallbacks.get(entry.target)\n callback && callback(entry)\n}\n\nconst fireAllObserverCallbacks: IntersectionObserverCallback = (entries) => {\n entries.forEach(fireObserverCallback)\n}\n\nfunction initIntersectionObserver({\n root,\n ...options\n}: IntersectionObserverInit): IntersectionObserver {\n const lookupRoot = root || document\n\n /**\n * If we don't have an observer lookup map for this root, create one.\n */\n if (!observers.has(lookupRoot)) {\n observers.set(lookupRoot, {})\n }\n const rootObservers = observers.get(lookupRoot)!\n\n const key = JSON.stringify(options)\n\n /**\n * If we don't have an observer for this combination of root and settings,\n * create one.\n */\n if (!rootObservers[key]) {\n rootObservers[key] = new IntersectionObserver(\n fireAllObserverCallbacks,\n { root, ...options }\n )\n }\n\n return rootObservers[key]\n}\n\nexport function observeIntersection(\n element: Element,\n options: IntersectionObserverInit,\n callback: IntersectionHandler\n) {\n const rootInteresectionObserver = initIntersectionObserver(options)\n\n observerCallbacks.set(element, callback)\n rootInteresectionObserver.observe(element)\n\n return () => {\n observerCallbacks.delete(element)\n rootInteresectionObserver.unobserve(element)\n }\n}\n"],"names":[],"mappings":"AAMA;;;;AAIG;AACH,MAAM,iBAAiB,GAAG,IAAI,OAAO,EAAgC,CAAA;AAErE;;;;AAIG;AACH,MAAM,SAAS,GAAG,IAAI,OAAO,EAG1B,CAAA;AAEH,MAAM,oBAAoB,GAAG,CAAC,KAAgC,KAAI;IAC9D,MAAM,QAAQ,GAAG,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;AACpD,IAAA,QAAQ,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAA;AAC/B,CAAC,CAAA;AAED,MAAM,wBAAwB,GAAiC,CAAC,OAAO,KAAI;AACvE,IAAA,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAA;AACzC,CAAC,CAAA;AAED,SAAS,wBAAwB,CAAC,EAC9B,IAAI,EACJ,GAAG,OAAO,EACa,EAAA;AACvB,IAAA,MAAM,UAAU,GAAG,IAAI,IAAI,QAAQ,CAAA;AAEnC;;AAEG;IACH,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;AAC5B,QAAA,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA;KAChC;IACD,MAAM,aAAa,GAAG,SAAS,CAAC,GAAG,CAAC,UAAU,CAAE,CAAA;IAEhD,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;AAEnC;;;AAGG;AACH,IAAA,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE;AACrB,QAAA,aAAa,CAAC,GAAG,CAAC,GAAG,IAAI,oBAAoB,CACzC,wBAAwB,EACxB,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CACvB,CAAA;KACJ;AAED,IAAA,OAAO,aAAa,CAAC,GAAG,CAAC,CAAA;AAC7B,CAAC;SAEe,mBAAmB,CAC/B,OAAgB,EAChB,OAAiC,EACjC,QAA6B,EAAA;AAE7B,IAAA,MAAM,yBAAyB,GAAG,wBAAwB,CAAC,OAAO,CAAC,CAAA;AAEnE,IAAA,iBAAiB,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;AACxC,IAAA,yBAAyB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;AAE1C,IAAA,OAAO,MAAK;AACR,QAAA,iBAAiB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;AACjC,QAAA,yBAAyB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;AAChD,KAAC,CAAA;AACL;;;;"}
1
+ {"version":3,"file":"observers.mjs","sources":["../../../../../src/motion/features/viewport/observers.ts"],"sourcesContent":["type IntersectionHandler = (entry: IntersectionObserverEntry) => void\n\ninterface ElementIntersectionObservers {\n [key: string]: IntersectionObserver\n}\n\n/**\n * Map an IntersectionHandler callback to an element. We only ever make one handler for one\n * element, so even though these handlers might all be triggered by different\n * observers, we can keep them in the same map.\n */\nconst observerCallbacks = new WeakMap<Element, IntersectionHandler>()\n\n/**\n * Multiple observers can be created for multiple element/document roots. Each with\n * different settings. So here we store dictionaries of observers to each root,\n * using serialised settings (threshold/margin) as lookup keys.\n */\nconst observers = new WeakMap<\n Element | Document,\n ElementIntersectionObservers\n>()\n\nconst fireObserverCallback = (entry: IntersectionObserverEntry) => {\n const callback = observerCallbacks.get(entry.target)\n callback && callback(entry)\n}\n\nconst fireAllObserverCallbacks: IntersectionObserverCallback = (entries) => {\n entries.forEach(fireObserverCallback)\n}\n\nfunction initIntersectionObserver({\n root,\n ...options\n}: IntersectionObserverInit): IntersectionObserver {\n const lookupRoot = root || document\n\n /**\n * If we don't have an observer lookup map for this root, create one.\n */\n if (!observers.has(lookupRoot)) {\n observers.set(lookupRoot, {})\n }\n const rootObservers = observers.get(lookupRoot)!\n\n const key = JSON.stringify(options)\n\n /**\n * If we don't have an observer for this combination of root and settings,\n * create one.\n */\n if (!rootObservers[key]) {\n rootObservers[key] = new IntersectionObserver(\n fireAllObserverCallbacks,\n { root, ...options }\n )\n }\n\n return rootObservers[key]\n}\n\nexport function observeIntersection(\n element: Element,\n options: IntersectionObserverInit,\n callback: IntersectionHandler\n) {\n const rootInteresectionObserver = initIntersectionObserver(options)\n\n observerCallbacks.set(element, callback)\n rootInteresectionObserver.observe(element)\n\n return () => {\n observerCallbacks.delete(element)\n rootInteresectionObserver.unobserve(element)\n }\n}\n"],"names":[],"mappings":"AAMA;;;;AAIG;AACH,MAAM,iBAAiB,GAAG,IAAI,OAAO,EAAgC;AAErE;;;;AAIG;AACH,MAAM,SAAS,GAAG,IAAI,OAAO,EAG1B;AAEH,MAAM,oBAAoB,GAAG,CAAC,KAAgC,KAAI;IAC9D,MAAM,QAAQ,GAAG,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC;AACpD,IAAA,QAAQ,IAAI,QAAQ,CAAC,KAAK,CAAC;AAC/B,CAAC;AAED,MAAM,wBAAwB,GAAiC,CAAC,OAAO,KAAI;AACvE,IAAA,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC;AACzC,CAAC;AAED,SAAS,wBAAwB,CAAC,EAC9B,IAAI,EACJ,GAAG,OAAO,EACa,EAAA;AACvB,IAAA,MAAM,UAAU,GAAG,IAAI,IAAI,QAAQ;AAEnC;;AAEG;IACH,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;AAC5B,QAAA,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,EAAE,CAAC;IACjC;IACA,MAAM,aAAa,GAAG,SAAS,CAAC,GAAG,CAAC,UAAU,CAAE;IAEhD,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;AAEnC;;;AAGG;AACH,IAAA,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE;AACrB,QAAA,aAAa,CAAC,GAAG,CAAC,GAAG,IAAI,oBAAoB,CACzC,wBAAwB,EACxB,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CACvB;IACL;AAEA,IAAA,OAAO,aAAa,CAAC,GAAG,CAAC;AAC7B;SAEgB,mBAAmB,CAC/B,OAAgB,EAChB,OAAiC,EACjC,QAA6B,EAAA;AAE7B,IAAA,MAAM,yBAAyB,GAAG,wBAAwB,CAAC,OAAO,CAAC;AAEnE,IAAA,iBAAiB,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC;AACxC,IAAA,yBAAyB,CAAC,OAAO,CAAC,OAAO,CAAC;AAE1C,IAAA,OAAO,MAAK;AACR,QAAA,iBAAiB,CAAC,MAAM,CAAC,OAAO,CAAC;AACjC,QAAA,yBAAyB,CAAC,SAAS,CAAC,OAAO,CAAC;AAChD,IAAA,CAAC;AACL;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"is-motion-component.mjs","sources":["../../../../src/motion/utils/is-motion-component.ts"],"sourcesContent":["import { motionComponentSymbol } from \"./symbol\"\n\n/**\n * Checks if a component is a `motion` component.\n */\nexport function isMotionComponent(component: React.ComponentType | string) {\n return (\n component !== null &&\n typeof component === \"object\" &&\n motionComponentSymbol in component\n )\n}\n"],"names":[],"mappings":";;AAEA;;AAEG;AACG,SAAU,iBAAiB,CAAC,SAAuC,EAAA;IACrE,QACI,SAAS,KAAK,IAAI;QAClB,OAAO,SAAS,KAAK,QAAQ;QAC7B,qBAAqB,IAAI,SAAS,EACrC;AACL;;;;"}
1
+ {"version":3,"file":"is-motion-component.mjs","sources":["../../../../src/motion/utils/is-motion-component.ts"],"sourcesContent":["import { motionComponentSymbol } from \"./symbol\"\n\n/**\n * Checks if a component is a `motion` component.\n */\nexport function isMotionComponent(component: React.ComponentType | string) {\n return (\n component !== null &&\n typeof component === \"object\" &&\n motionComponentSymbol in component\n )\n}\n"],"names":[],"mappings":";;AAEA;;AAEG;AACG,SAAU,iBAAiB,CAAC,SAAuC,EAAA;IACrE,QACI,SAAS,KAAK,IAAI;QAClB,OAAO,SAAS,KAAK,QAAQ;QAC7B,qBAAqB,IAAI,SAAS;AAE1C;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"symbol.mjs","sources":["../../../../src/motion/utils/symbol.ts"],"sourcesContent":["export const motionComponentSymbol = Symbol.for(\"motionComponentSymbol\")\n"],"names":[],"mappings":"AAAa,MAAA,qBAAqB,GAAG,MAAM,CAAC,GAAG,CAAC,uBAAuB;;;;"}
1
+ {"version":3,"file":"symbol.mjs","sources":["../../../../src/motion/utils/symbol.ts"],"sourcesContent":["export const motionComponentSymbol = Symbol.for(\"motionComponentSymbol\")\n"],"names":[],"mappings":"AAAO,MAAM,qBAAqB,GAAG,MAAM,CAAC,GAAG,CAAC,uBAAuB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"unwrap-motion-component.mjs","sources":["../../../../src/motion/utils/unwrap-motion-component.ts"],"sourcesContent":["import { isMotionComponent } from \"./is-motion-component\"\nimport { motionComponentSymbol } from \"./symbol\"\n\n/**\n * Unwraps a `motion` component and returns either a string for `motion.div` or\n * the React component for `motion(Component)`.\n *\n * If the component is not a `motion` component it returns undefined.\n */\nexport function unwrapMotionComponent(\n component: React.ComponentType | string\n): React.ComponentType | string | undefined {\n if (isMotionComponent(component)) {\n return component[motionComponentSymbol as keyof typeof component]\n }\n\n return undefined\n}\n"],"names":[],"mappings":";;;AAGA;;;;;AAKG;AACG,SAAU,qBAAqB,CACjC,SAAuC,EAAA;AAEvC,IAAA,IAAI,iBAAiB,CAAC,SAAS,CAAC,EAAE;AAC9B,QAAA,OAAO,SAAS,CAAC,qBAA+C,CAAC,CAAA;KACpE;AAED,IAAA,OAAO,SAAS,CAAA;AACpB;;;;"}
1
+ {"version":3,"file":"unwrap-motion-component.mjs","sources":["../../../../src/motion/utils/unwrap-motion-component.ts"],"sourcesContent":["import { isMotionComponent } from \"./is-motion-component\"\nimport { motionComponentSymbol } from \"./symbol\"\n\n/**\n * Unwraps a `motion` component and returns either a string for `motion.div` or\n * the React component for `motion(Component)`.\n *\n * If the component is not a `motion` component it returns undefined.\n */\nexport function unwrapMotionComponent(\n component: React.ComponentType | string\n): React.ComponentType | string | undefined {\n if (isMotionComponent(component)) {\n return component[motionComponentSymbol as keyof typeof component]\n }\n\n return undefined\n}\n"],"names":[],"mappings":";;;AAGA;;;;;AAKG;AACG,SAAU,qBAAqB,CACjC,SAAuC,EAAA;AAEvC,IAAA,IAAI,iBAAiB,CAAC,SAAS,CAAC,EAAE;AAC9B,QAAA,OAAO,SAAS,CAAC,qBAA+C,CAAC;IACrE;AAEA,IAAA,OAAO,SAAS;AACpB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-visual-element.mjs","sources":["../../../../src/motion/utils/use-visual-element.ts"],"sourcesContent":["\"use client\"\n\nimport {\n optimizedAppearDataAttribute,\n type HTMLRenderState,\n type SVGRenderState,\n type VisualElement,\n} from \"motion-dom\"\nimport * as React from \"react\"\nimport { useContext, useEffect, useInsertionEffect, useRef } from \"react\"\nimport { LazyContext } from \"../../context/LazyContext\"\nimport { MotionConfigContext } from \"../../context/MotionConfigContext\"\nimport { MotionContext } from \"../../context/MotionContext\"\nimport { PresenceContext } from \"../../context/PresenceContext\"\nimport {\n InitialPromotionConfig,\n SwitchLayoutGroupContext,\n} from \"../../context/SwitchLayoutGroupContext\"\nimport { MotionProps } from \"../../motion/types\"\nimport type { IProjectionNode } from \"motion-dom\"\nimport { DOMMotionComponents } from \"../../render/dom/types\"\nimport { CreateVisualElement } from \"../../render/types\"\nimport { isRefObject } from \"../../utils/is-ref-object\"\nimport { useIsomorphicLayoutEffect } from \"../../utils/use-isomorphic-effect\"\nimport { VisualState } from \"./use-visual-state\"\n\nexport function useVisualElement<\n Props,\n TagName extends keyof DOMMotionComponents | string\n>(\n Component: TagName | string | React.ComponentType<Props>,\n visualState:\n | VisualState<SVGElement, SVGRenderState>\n | VisualState<HTMLElement, HTMLRenderState>,\n props: MotionProps & Partial<MotionConfigContext>,\n createVisualElement?: CreateVisualElement<Props, TagName>,\n ProjectionNodeConstructor?: any,\n isSVG?: boolean\n): VisualElement<HTMLElement | SVGElement> | undefined {\n const { visualElement: parent } = useContext(MotionContext)\n const lazyContext = useContext(LazyContext)\n const presenceContext = useContext(PresenceContext)\n const motionConfig = useContext(MotionConfigContext)\n const reducedMotionConfig = motionConfig.reducedMotion\n const skipAnimations = motionConfig.skipAnimations\n\n const visualElementRef = useRef<VisualElement<\n HTMLElement | SVGElement\n > | null>(null)\n\n /**\n * Track whether the component has been through React's commit phase.\n * Used to detect when LazyMotion features load after the component has mounted.\n */\n const hasMountedOnce = useRef(false)\n\n /**\n * If we haven't preloaded a renderer, check to see if we have one lazy-loaded\n */\n createVisualElement =\n createVisualElement ||\n (lazyContext.renderer as CreateVisualElement<Props, TagName>)\n\n if (!visualElementRef.current && createVisualElement) {\n visualElementRef.current = createVisualElement(Component, {\n visualState,\n parent,\n props,\n presenceContext,\n blockInitialAnimation: presenceContext\n ? presenceContext.initial === false\n : false,\n reducedMotionConfig,\n skipAnimations,\n isSVG,\n })\n\n /**\n * If the component has already mounted before features loaded (e.g. via\n * LazyMotion with async feature loading), we need to force the initial\n * animation to run. Otherwise state changes that occurred before features\n * loaded will be lost and the element will snap to its final state.\n */\n if (hasMountedOnce.current && visualElementRef.current) {\n visualElementRef.current.manuallyAnimateOnMount = true\n }\n }\n\n const visualElement = visualElementRef.current\n\n /**\n * Load Motion gesture and animation features. These are rendered as renderless\n * components so each feature can optionally make use of React lifecycle methods.\n */\n const initialLayoutGroupConfig = useContext(SwitchLayoutGroupContext)\n\n if (\n visualElement &&\n !visualElement.projection &&\n ProjectionNodeConstructor &&\n (visualElement.type === \"html\" || visualElement.type === \"svg\")\n ) {\n createProjectionNode(\n visualElementRef.current!,\n props,\n ProjectionNodeConstructor,\n initialLayoutGroupConfig\n )\n }\n\n const isMounted = useRef(false)\n useInsertionEffect(() => {\n /**\n * Check the component has already mounted before calling\n * `update` unnecessarily. This ensures we skip the initial update.\n */\n if (visualElement && isMounted.current) {\n visualElement.update(props, presenceContext)\n }\n })\n\n /**\n * Cache this value as we want to know whether HandoffAppearAnimations\n * was present on initial render - it will be deleted after this.\n */\n const optimisedAppearId =\n props[optimizedAppearDataAttribute as keyof typeof props]\n const wantsHandoff = useRef(\n Boolean(optimisedAppearId) &&\n !window.MotionHandoffIsComplete?.(optimisedAppearId) &&\n window.MotionHasOptimisedAnimation?.(optimisedAppearId)\n )\n\n useIsomorphicLayoutEffect(() => {\n /**\n * Track that this component has mounted. This is used to detect when\n * LazyMotion features load after the component has already committed.\n */\n hasMountedOnce.current = true\n\n if (!visualElement) return\n\n isMounted.current = true\n window.MotionIsMounted = true\n\n visualElement.updateFeatures()\n visualElement.scheduleRenderMicrotask()\n\n /**\n * Ideally this function would always run in a useEffect.\n *\n * However, if we have optimised appear animations to handoff from,\n * it needs to happen synchronously to ensure there's no flash of\n * incorrect styles in the event of a hydration error.\n *\n * So if we detect a situtation where optimised appear animations\n * are running, we use useLayoutEffect to trigger animations.\n */\n if (wantsHandoff.current && visualElement.animationState) {\n visualElement.animationState.animateChanges()\n }\n })\n\n useEffect(() => {\n if (!visualElement) return\n\n if (!wantsHandoff.current && visualElement.animationState) {\n visualElement.animationState.animateChanges()\n }\n\n if (wantsHandoff.current) {\n // This ensures all future calls to animateChanges() in this component will run in useEffect\n queueMicrotask(() => {\n window.MotionHandoffMarkAsComplete?.(optimisedAppearId)\n })\n\n wantsHandoff.current = false\n }\n\n /**\n * Now we've finished triggering animations for this element we\n * can wipe the enteringChildren set for the next render.\n */\n visualElement.enteringChildren = undefined\n })\n\n return visualElement!\n}\n\nfunction createProjectionNode(\n visualElement: VisualElement<any>,\n props: MotionProps,\n ProjectionNodeConstructor: any,\n initialPromotionConfig?: InitialPromotionConfig\n) {\n const {\n layoutId,\n layout,\n drag,\n dragConstraints,\n layoutScroll,\n layoutRoot,\n layoutCrossfade,\n } = props\n\n visualElement.projection = new ProjectionNodeConstructor(\n visualElement.latestValues,\n props[\"data-framer-portal-id\"]\n ? undefined\n : getClosestProjectingNode(visualElement.parent)\n ) as IProjectionNode\n\n visualElement.projection.setOptions({\n layoutId,\n layout,\n alwaysMeasureLayout:\n Boolean(drag) || (dragConstraints && isRefObject(dragConstraints)),\n visualElement,\n /**\n * TODO: Update options in an effect. This could be tricky as it'll be too late\n * to update by the time layout animations run.\n * We also need to fix this safeToRemove by linking it up to the one returned by usePresence,\n * ensuring it gets called if there's no potential layout animations.\n *\n */\n animationType: typeof layout === \"string\" ? layout : \"both\",\n initialPromotionConfig,\n crossfade: layoutCrossfade,\n layoutScroll,\n layoutRoot,\n })\n}\n\nfunction getClosestProjectingNode(\n visualElement?: VisualElement<\n unknown,\n unknown,\n { allowProjection?: boolean }\n >\n): IProjectionNode | undefined {\n if (!visualElement) return undefined\n\n return visualElement.options.allowProjection !== false\n ? visualElement.projection\n : getClosestProjectingNode(visualElement.parent)\n}\n"],"names":[],"mappings":";;;;;;;;;;;AA0BgB;;AAcZ;AACA;AACA;AACA;AACA;AAEA;AAIA;;;AAGG;AACH;AAEA;;AAEG;;;;AAKH;AACI;;;;;AAKI;AACI;AACA;;;;AAIP;AAED;;;;;AAKG;;AAEC;;;AAIR;AAEA;;;AAGG;AACH;AAEA;;;AAII;;;AAUJ;;AAEI;;;AAGG;AACH;AACI;;AAER;AAEA;;;AAGG;AACH;AAEA;AAEQ;AACA;;AAIJ;;;AAGG;AACH;AAEA;;AAEA;AACA;;;AAKA;;;;;;;;;AASG;;AAEC;;AAER;;AAGI;;;AAGI;;AAGJ;;;AAGQ;AACJ;AAEA;;AAGJ;;;AAGG;AACH;AACJ;AAEA;AACJ;AAEA;AAMI;AAUA;AAGQ;;AAIR;;;AAGI;;AAGA;;;;;;AAMG;AACH;;AAEA;;;AAGH;AACL;AAEA;AAOI;AAAoB;AAEpB;;AAEI;AACR;;"}
1
+ {"version":3,"file":"use-visual-element.mjs","sources":["../../../../src/motion/utils/use-visual-element.ts"],"sourcesContent":["\"use client\"\n\nimport {\n optimizedAppearDataAttribute,\n type HTMLRenderState,\n type SVGRenderState,\n type VisualElement,\n} from \"motion-dom\"\nimport * as React from \"react\"\nimport { useContext, useEffect, useInsertionEffect, useRef } from \"react\"\nimport { LazyContext } from \"../../context/LazyContext\"\nimport { MotionConfigContext } from \"../../context/MotionConfigContext\"\nimport { MotionContext } from \"../../context/MotionContext\"\nimport { PresenceContext } from \"../../context/PresenceContext\"\nimport {\n InitialPromotionConfig,\n SwitchLayoutGroupContext,\n} from \"../../context/SwitchLayoutGroupContext\"\nimport { MotionProps } from \"../../motion/types\"\nimport type { IProjectionNode } from \"motion-dom\"\nimport { DOMMotionComponents } from \"../../render/dom/types\"\nimport { CreateVisualElement } from \"../../render/types\"\nimport { isRefObject } from \"../../utils/is-ref-object\"\nimport { useIsomorphicLayoutEffect } from \"../../utils/use-isomorphic-effect\"\nimport { VisualState } from \"./use-visual-state\"\n\nexport function useVisualElement<\n Props,\n TagName extends keyof DOMMotionComponents | string\n>(\n Component: TagName | string | React.ComponentType<Props>,\n visualState:\n | VisualState<SVGElement, SVGRenderState>\n | VisualState<HTMLElement, HTMLRenderState>,\n props: MotionProps & Partial<MotionConfigContext>,\n createVisualElement?: CreateVisualElement<Props, TagName>,\n ProjectionNodeConstructor?: any,\n isSVG?: boolean\n): VisualElement<HTMLElement | SVGElement> | undefined {\n const { visualElement: parent } = useContext(MotionContext)\n const lazyContext = useContext(LazyContext)\n const presenceContext = useContext(PresenceContext)\n const motionConfig = useContext(MotionConfigContext)\n const reducedMotionConfig = motionConfig.reducedMotion\n const skipAnimations = motionConfig.skipAnimations\n\n const visualElementRef = useRef<VisualElement<\n HTMLElement | SVGElement\n > | null>(null)\n\n /**\n * Track whether the component has been through React's commit phase.\n * Used to detect when LazyMotion features load after the component has mounted.\n */\n const hasMountedOnce = useRef(false)\n\n /**\n * If we haven't preloaded a renderer, check to see if we have one lazy-loaded\n */\n createVisualElement =\n createVisualElement ||\n (lazyContext.renderer as CreateVisualElement<Props, TagName>)\n\n if (!visualElementRef.current && createVisualElement) {\n visualElementRef.current = createVisualElement(Component, {\n visualState,\n parent,\n props,\n presenceContext,\n blockInitialAnimation: presenceContext\n ? presenceContext.initial === false\n : false,\n reducedMotionConfig,\n skipAnimations,\n isSVG,\n })\n\n /**\n * If the component has already mounted before features loaded (e.g. via\n * LazyMotion with async feature loading), we need to force the initial\n * animation to run. Otherwise state changes that occurred before features\n * loaded will be lost and the element will snap to its final state.\n */\n if (hasMountedOnce.current && visualElementRef.current) {\n visualElementRef.current.manuallyAnimateOnMount = true\n }\n }\n\n const visualElement = visualElementRef.current\n\n /**\n * Load Motion gesture and animation features. These are rendered as renderless\n * components so each feature can optionally make use of React lifecycle methods.\n */\n const initialLayoutGroupConfig = useContext(SwitchLayoutGroupContext)\n\n if (\n visualElement &&\n !visualElement.projection &&\n ProjectionNodeConstructor &&\n (visualElement.type === \"html\" || visualElement.type === \"svg\")\n ) {\n createProjectionNode(\n visualElementRef.current!,\n props,\n ProjectionNodeConstructor,\n initialLayoutGroupConfig\n )\n }\n\n const isMounted = useRef(false)\n useInsertionEffect(() => {\n /**\n * Check the component has already mounted before calling\n * `update` unnecessarily. This ensures we skip the initial update.\n */\n if (visualElement && isMounted.current) {\n visualElement.update(props, presenceContext)\n }\n })\n\n /**\n * Cache this value as we want to know whether HandoffAppearAnimations\n * was present on initial render - it will be deleted after this.\n */\n const optimisedAppearId =\n props[optimizedAppearDataAttribute as keyof typeof props]\n const wantsHandoff = useRef(\n Boolean(optimisedAppearId) &&\n !window.MotionHandoffIsComplete?.(optimisedAppearId) &&\n window.MotionHasOptimisedAnimation?.(optimisedAppearId)\n )\n\n useIsomorphicLayoutEffect(() => {\n /**\n * Track that this component has mounted. This is used to detect when\n * LazyMotion features load after the component has already committed.\n */\n hasMountedOnce.current = true\n\n if (!visualElement) return\n\n isMounted.current = true\n window.MotionIsMounted = true\n\n visualElement.updateFeatures()\n visualElement.scheduleRenderMicrotask()\n\n /**\n * Ideally this function would always run in a useEffect.\n *\n * However, if we have optimised appear animations to handoff from,\n * it needs to happen synchronously to ensure there's no flash of\n * incorrect styles in the event of a hydration error.\n *\n * So if we detect a situtation where optimised appear animations\n * are running, we use useLayoutEffect to trigger animations.\n */\n if (wantsHandoff.current && visualElement.animationState) {\n visualElement.animationState.animateChanges()\n }\n })\n\n useEffect(() => {\n if (!visualElement) return\n\n if (!wantsHandoff.current && visualElement.animationState) {\n visualElement.animationState.animateChanges()\n }\n\n if (wantsHandoff.current) {\n // This ensures all future calls to animateChanges() in this component will run in useEffect\n queueMicrotask(() => {\n window.MotionHandoffMarkAsComplete?.(optimisedAppearId)\n })\n\n wantsHandoff.current = false\n }\n\n /**\n * Now we've finished triggering animations for this element we\n * can wipe the enteringChildren set for the next render.\n */\n visualElement.enteringChildren = undefined\n })\n\n return visualElement!\n}\n\nfunction createProjectionNode(\n visualElement: VisualElement<any>,\n props: MotionProps,\n ProjectionNodeConstructor: any,\n initialPromotionConfig?: InitialPromotionConfig\n) {\n const {\n layoutId,\n layout,\n drag,\n dragConstraints,\n layoutScroll,\n layoutRoot,\n layoutCrossfade,\n } = props\n\n visualElement.projection = new ProjectionNodeConstructor(\n visualElement.latestValues,\n props[\"data-framer-portal-id\"]\n ? undefined\n : getClosestProjectingNode(visualElement.parent)\n ) as IProjectionNode\n\n visualElement.projection.setOptions({\n layoutId,\n layout,\n alwaysMeasureLayout:\n Boolean(drag) || (dragConstraints && isRefObject(dragConstraints)),\n visualElement,\n /**\n * TODO: Update options in an effect. This could be tricky as it'll be too late\n * to update by the time layout animations run.\n * We also need to fix this safeToRemove by linking it up to the one returned by usePresence,\n * ensuring it gets called if there's no potential layout animations.\n *\n */\n animationType: typeof layout === \"string\" ? layout : \"both\",\n initialPromotionConfig,\n crossfade: layoutCrossfade,\n layoutScroll,\n layoutRoot,\n })\n}\n\nfunction getClosestProjectingNode(\n visualElement?: VisualElement<\n unknown,\n unknown,\n { allowProjection?: boolean }\n >\n): IProjectionNode | undefined {\n if (!visualElement) return undefined\n\n return visualElement.options.allowProjection !== false\n ? visualElement.projection\n : getClosestProjectingNode(visualElement.parent)\n}\n"],"names":[],"mappings":";;;;;;;;;;;AA0BM;;AAcF;AACA;AACA;AACA;AACA;AAEA;AAIA;;;AAGG;AACH;AAEA;;AAEG;;;;AAKH;AACI;;;;;AAKI;AACI;AACA;;;;AAIP;AAED;;;;;AAKG;;AAEC;;;AAIR;AAEA;;;AAGG;AACH;AAEA;;;AAII;;;AAUJ;;AAEI;;;AAGG;AACH;AACI;;AAER;AAEA;;;AAGG;AACH;AAEA;AAEQ;AACA;;AAIJ;;;AAGG;AACH;AAEA;;AAEA;AACA;;;AAKA;;;;;;;;;AASG;;AAEC;;AAER;;AAGI;;;AAGI;;AAGJ;;;AAGQ;AACJ;AAEA;;AAGJ;;;AAGG;AACH;AACJ;AAEA;AACJ;AAEA;AAMI;AAUA;AAGQ;;AAIR;;;AAGI;;AAGA;;;;;;AAMG;AACH;;AAEA;;;AAGH;AACL;AAEA;AAOI;AAAoB;AAEpB;;AAEI;AACR;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"valid-prop.mjs","sources":["../../../../src/motion/utils/valid-prop.ts"],"sourcesContent":["import { MotionProps } from \"../types\"\n\n/**\n * A list of all valid MotionProps.\n *\n * @privateRemarks\n * This doesn't throw if a `MotionProp` name is missing - it should.\n */\nconst validMotionProps = new Set<keyof MotionProps>([\n \"animate\",\n \"exit\",\n \"variants\",\n \"initial\",\n \"style\",\n \"values\",\n \"variants\",\n \"transition\",\n \"transformTemplate\",\n \"custom\",\n \"inherit\",\n \"onBeforeLayoutMeasure\",\n \"onAnimationStart\",\n \"onAnimationComplete\",\n \"onUpdate\",\n \"onDragStart\",\n \"onDrag\",\n \"onDragEnd\",\n \"onMeasureDragConstraints\",\n \"onDirectionLock\",\n \"onDragTransitionEnd\",\n \"_dragX\",\n \"_dragY\",\n \"onHoverStart\",\n \"onHoverEnd\",\n \"onViewportEnter\",\n \"onViewportLeave\",\n \"globalTapTarget\",\n \"propagate\",\n \"ignoreStrict\",\n \"viewport\",\n])\n\n/**\n * Check whether a prop name is a valid `MotionProp` key.\n *\n * @param key - Name of the property to check\n * @returns `true` is key is a valid `MotionProp`.\n *\n * @public\n */\nexport function isValidMotionProp(key: string) {\n return (\n key.startsWith(\"while\") ||\n (key.startsWith(\"drag\") && key !== \"draggable\") ||\n key.startsWith(\"layout\") ||\n key.startsWith(\"onTap\") ||\n key.startsWith(\"onPan\") ||\n key.startsWith(\"onLayout\") ||\n validMotionProps.has(key as keyof MotionProps)\n )\n}\n"],"names":[],"mappings":"AAEA;;;;;AAKG;AACH,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAoB;IAChD,SAAS;IACT,MAAM;IACN,UAAU;IACV,SAAS;IACT,OAAO;IACP,QAAQ;IACR,UAAU;IACV,YAAY;IACZ,mBAAmB;IACnB,QAAQ;IACR,SAAS;IACT,uBAAuB;IACvB,kBAAkB;IAClB,qBAAqB;IACrB,UAAU;IACV,aAAa;IACb,QAAQ;IACR,WAAW;IACX,0BAA0B;IAC1B,iBAAiB;IACjB,qBAAqB;IACrB,QAAQ;IACR,QAAQ;IACR,cAAc;IACd,YAAY;IACZ,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,WAAW;IACX,cAAc;IACd,UAAU;AACb,CAAA,CAAC,CAAA;AAEF;;;;;;;AAOG;AACG,SAAU,iBAAiB,CAAC,GAAW,EAAA;AACzC,IAAA,QACI,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC;SACtB,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,GAAG,KAAK,WAAW,CAAC;AAC/C,QAAA,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC;AACxB,QAAA,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC;AACvB,QAAA,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC;AACvB,QAAA,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC;AAC1B,QAAA,gBAAgB,CAAC,GAAG,CAAC,GAAwB,CAAC,EACjD;AACL;;;;"}
1
+ {"version":3,"file":"valid-prop.mjs","sources":["../../../../src/motion/utils/valid-prop.ts"],"sourcesContent":["import { MotionProps } from \"../types\"\n\n/**\n * A list of all valid MotionProps.\n *\n * @privateRemarks\n * This doesn't throw if a `MotionProp` name is missing - it should.\n */\nconst validMotionProps = new Set<keyof MotionProps>([\n \"animate\",\n \"exit\",\n \"variants\",\n \"initial\",\n \"style\",\n \"values\",\n \"variants\",\n \"transition\",\n \"transformTemplate\",\n \"custom\",\n \"inherit\",\n \"onBeforeLayoutMeasure\",\n \"onAnimationStart\",\n \"onAnimationComplete\",\n \"onUpdate\",\n \"onDragStart\",\n \"onDrag\",\n \"onDragEnd\",\n \"onMeasureDragConstraints\",\n \"onDirectionLock\",\n \"onDragTransitionEnd\",\n \"_dragX\",\n \"_dragY\",\n \"onHoverStart\",\n \"onHoverEnd\",\n \"onViewportEnter\",\n \"onViewportLeave\",\n \"globalTapTarget\",\n \"propagate\",\n \"ignoreStrict\",\n \"viewport\",\n])\n\n/**\n * Check whether a prop name is a valid `MotionProp` key.\n *\n * @param key - Name of the property to check\n * @returns `true` is key is a valid `MotionProp`.\n *\n * @public\n */\nexport function isValidMotionProp(key: string) {\n return (\n key.startsWith(\"while\") ||\n (key.startsWith(\"drag\") && key !== \"draggable\") ||\n key.startsWith(\"layout\") ||\n key.startsWith(\"onTap\") ||\n key.startsWith(\"onPan\") ||\n key.startsWith(\"onLayout\") ||\n validMotionProps.has(key as keyof MotionProps)\n )\n}\n"],"names":[],"mappings":"AAEA;;;;;AAKG;AACH,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAoB;IAChD,SAAS;IACT,MAAM;IACN,UAAU;IACV,SAAS;IACT,OAAO;IACP,QAAQ;IACR,UAAU;IACV,YAAY;IACZ,mBAAmB;IACnB,QAAQ;IACR,SAAS;IACT,uBAAuB;IACvB,kBAAkB;IAClB,qBAAqB;IACrB,UAAU;IACV,aAAa;IACb,QAAQ;IACR,WAAW;IACX,0BAA0B;IAC1B,iBAAiB;IACjB,qBAAqB;IACrB,QAAQ;IACR,QAAQ;IACR,cAAc;IACd,YAAY;IACZ,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,WAAW;IACX,cAAc;IACd,UAAU;AACb,CAAA,CAAC;AAEF;;;;;;;AAOG;AACG,SAAU,iBAAiB,CAAC,GAAW,EAAA;AACzC,IAAA,QACI,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC;SACtB,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,GAAG,KAAK,WAAW,CAAC;AAC/C,QAAA,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC;AACxB,QAAA,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC;AACvB,QAAA,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC;AACvB,QAAA,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC;AAC1B,QAAA,gBAAgB,CAAC,GAAG,CAAC,GAAwB,CAAC;AAEtD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-instant-layout-transition.mjs","sources":["../../../src/projection/use-instant-layout-transition.ts"],"sourcesContent":["import { rootProjectionNode } from \"motion-dom\"\n\nexport function useInstantLayoutTransition(): (\n cb?: (() => void) | undefined\n) => void {\n return startTransition\n}\n\nfunction startTransition(callback?: () => void) {\n if (!rootProjectionNode.current) return\n rootProjectionNode.current.isUpdating = false\n rootProjectionNode.current.blockUpdate()\n callback && callback()\n}\n"],"names":[],"mappings":";;SAEgB,0BAA0B,GAAA;AAGtC,IAAA,OAAO,eAAe,CAAA;AAC1B,CAAC;AAED,SAAS,eAAe,CAAC,QAAqB,EAAA;IAC1C,IAAI,CAAC,kBAAkB,CAAC,OAAO;QAAE,OAAM;AACvC,IAAA,kBAAkB,CAAC,OAAO,CAAC,UAAU,GAAG,KAAK,CAAA;AAC7C,IAAA,kBAAkB,CAAC,OAAO,CAAC,WAAW,EAAE,CAAA;IACxC,QAAQ,IAAI,QAAQ,EAAE,CAAA;AAC1B;;;;"}
1
+ {"version":3,"file":"use-instant-layout-transition.mjs","sources":["../../../src/projection/use-instant-layout-transition.ts"],"sourcesContent":["import { rootProjectionNode } from \"motion-dom\"\n\nexport function useInstantLayoutTransition(): (\n cb?: (() => void) | undefined\n) => void {\n return startTransition\n}\n\nfunction startTransition(callback?: () => void) {\n if (!rootProjectionNode.current) return\n rootProjectionNode.current.isUpdating = false\n rootProjectionNode.current.blockUpdate()\n callback && callback()\n}\n"],"names":[],"mappings":";;SAEgB,0BAA0B,GAAA;AAGtC,IAAA,OAAO,eAAe;AAC1B;AAEA,SAAS,eAAe,CAAC,QAAqB,EAAA;IAC1C,IAAI,CAAC,kBAAkB,CAAC,OAAO;QAAE;AACjC,IAAA,kBAAkB,CAAC,OAAO,CAAC,UAAU,GAAG,KAAK;AAC7C,IAAA,kBAAkB,CAAC,OAAO,CAAC,WAAW,EAAE;IACxC,QAAQ,IAAI,QAAQ,EAAE;AAC1B;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-reset-projection.mjs","sources":["../../../src/projection/use-reset-projection.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { rootProjectionNode } from \"motion-dom\"\n\nexport function useResetProjection() {\n const reset = useCallback(() => {\n const root = rootProjectionNode.current\n if (!root) return\n root.resetTree()\n }, [])\n\n return reset\n}\n"],"names":[],"mappings":";;;SAGgB,kBAAkB,GAAA;AAC9B,IAAA,MAAM,KAAK,GAAG,WAAW,CAAC,MAAK;AAC3B,QAAA,MAAM,IAAI,GAAG,kBAAkB,CAAC,OAAO,CAAA;AACvC,QAAA,IAAI,CAAC,IAAI;YAAE,OAAM;QACjB,IAAI,CAAC,SAAS,EAAE,CAAA;KACnB,EAAE,EAAE,CAAC,CAAA;AAEN,IAAA,OAAO,KAAK,CAAA;AAChB;;;;"}
1
+ {"version":3,"file":"use-reset-projection.mjs","sources":["../../../src/projection/use-reset-projection.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { rootProjectionNode } from \"motion-dom\"\n\nexport function useResetProjection() {\n const reset = useCallback(() => {\n const root = rootProjectionNode.current\n if (!root) return\n root.resetTree()\n }, [])\n\n return reset\n}\n"],"names":[],"mappings":";;;SAGgB,kBAAkB,GAAA;AAC9B,IAAA,MAAM,KAAK,GAAG,WAAW,CAAC,MAAK;AAC3B,QAAA,MAAM,IAAI,GAAG,kBAAkB,CAAC,OAAO;AACvC,QAAA,IAAI,CAAC,IAAI;YAAE;QACX,IAAI,CAAC,SAAS,EAAE;IACpB,CAAC,EAAE,EAAE,CAAC;AAEN,IAAA,OAAO,KAAK;AAChB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"create-proxy.mjs","sources":["../../../../src/render/components/create-proxy.ts"],"sourcesContent":["import { warnOnce } from \"motion-utils\"\nimport { createMotionComponent, MotionComponentOptions } from \"../../motion\"\nimport { FeaturePackages } from \"../../motion/features/types\"\nimport { MotionProps } from \"../../motion/types\"\nimport { DOMMotionComponents } from \"../dom/types\"\nimport { CreateVisualElement } from \"../types\"\n\n/**\n * I'd rather the return type of `custom` to be implicit but this throws\n * incorrect relative paths in the exported types and API Extractor throws\n * a wobbly.\n */\ntype ComponentProps<Props> = React.PropsWithoutRef<Props & MotionProps> &\n React.RefAttributes<SVGElement | HTMLElement>\nexport type CustomDomComponent<Props> = React.ComponentType<\n ComponentProps<Props>\n>\n\ntype MotionProxy = typeof createMotionComponent &\n DOMMotionComponents & { create: typeof createMotionComponent }\n\nexport function createMotionProxy(\n preloadedFeatures?: FeaturePackages,\n createVisualElement?: CreateVisualElement<any, any>\n): MotionProxy {\n if (typeof Proxy === \"undefined\") {\n return createMotionComponent as MotionProxy\n }\n\n /**\n * A cache of generated `motion` components, e.g `motion.div`, `motion.input` etc.\n * Rather than generating them anew every render.\n */\n const componentCache = new Map<string, any>()\n\n const factory = (Component: string, options?: MotionComponentOptions) => {\n return createMotionComponent(\n Component,\n options,\n preloadedFeatures,\n createVisualElement\n )\n }\n\n /**\n * Support for deprecated`motion(Component)` pattern\n */\n const deprecatedFactoryFunction = (\n Component: string,\n options?: MotionComponentOptions\n ) => {\n if (process.env.NODE_ENV !== \"production\") {\n warnOnce(\n false,\n \"motion() is deprecated. Use motion.create() instead.\"\n )\n }\n return factory(Component, options)\n }\n\n return new Proxy(deprecatedFactoryFunction, {\n /**\n * Called when `motion` is referenced with a prop: `motion.div`, `motion.input` etc.\n * The prop name is passed through as `key` and we can use that to generate a `motion`\n * DOM component with that name.\n */\n get: (_target, key: string) => {\n if (key === \"create\") return factory\n\n /**\n * If this element doesn't exist in the component cache, create it and cache.\n */\n if (!componentCache.has(key)) {\n componentCache.set(\n key,\n createMotionComponent(\n key,\n undefined,\n preloadedFeatures,\n createVisualElement\n )\n )\n }\n\n return componentCache.get(key)!\n },\n }) as MotionProxy\n}\n"],"names":[],"mappings":";;;AAqBgB,SAAA,iBAAiB,CAC7B,iBAAmC,EACnC,mBAAmD,EAAA;AAEnD,IAAA,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;AAC9B,QAAA,OAAO,qBAAoC,CAAA;KAC9C;AAED;;;AAGG;AACH,IAAA,MAAM,cAAc,GAAG,IAAI,GAAG,EAAe,CAAA;AAE7C,IAAA,MAAM,OAAO,GAAG,CAAC,SAAiB,EAAE,OAAgC,KAAI;QACpE,OAAO,qBAAqB,CACxB,SAAS,EACT,OAAO,EACP,iBAAiB,EACjB,mBAAmB,CACtB,CAAA;AACL,KAAC,CAAA;AAED;;AAEG;AACH,IAAA,MAAM,yBAAyB,GAAG,CAC9B,SAAiB,EACjB,OAAgC,KAChC;QACA,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;AACvC,YAAA,QAAQ,CACJ,KAAK,EACL,sDAAsD,CACzD,CAAA;SACJ;AACD,QAAA,OAAO,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;AACtC,KAAC,CAAA;AAED,IAAA,OAAO,IAAI,KAAK,CAAC,yBAAyB,EAAE;AACxC;;;;AAIG;AACH,QAAA,GAAG,EAAE,CAAC,OAAO,EAAE,GAAW,KAAI;YAC1B,IAAI,GAAG,KAAK,QAAQ;AAAE,gBAAA,OAAO,OAAO,CAAA;AAEpC;;AAEG;YACH,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;AAC1B,gBAAA,cAAc,CAAC,GAAG,CACd,GAAG,EACH,qBAAqB,CACjB,GAAG,EACH,SAAS,EACT,iBAAiB,EACjB,mBAAmB,CACtB,CACJ,CAAA;aACJ;AAED,YAAA,OAAO,cAAc,CAAC,GAAG,CAAC,GAAG,CAAE,CAAA;SAClC;AACJ,KAAA,CAAgB,CAAA;AACrB;;;;"}
1
+ {"version":3,"file":"create-proxy.mjs","sources":["../../../../src/render/components/create-proxy.ts"],"sourcesContent":["import { warnOnce } from \"motion-utils\"\nimport { createMotionComponent, MotionComponentOptions } from \"../../motion\"\nimport { FeaturePackages } from \"../../motion/features/types\"\nimport { MotionProps } from \"../../motion/types\"\nimport { DOMMotionComponents } from \"../dom/types\"\nimport { CreateVisualElement } from \"../types\"\n\n/**\n * I'd rather the return type of `custom` to be implicit but this throws\n * incorrect relative paths in the exported types and API Extractor throws\n * a wobbly.\n */\ntype ComponentProps<Props> = React.PropsWithoutRef<Props & MotionProps> &\n React.RefAttributes<SVGElement | HTMLElement>\nexport type CustomDomComponent<Props> = React.ComponentType<\n ComponentProps<Props>\n>\n\ntype MotionProxy = typeof createMotionComponent &\n DOMMotionComponents & { create: typeof createMotionComponent }\n\nexport function createMotionProxy(\n preloadedFeatures?: FeaturePackages,\n createVisualElement?: CreateVisualElement<any, any>\n): MotionProxy {\n if (typeof Proxy === \"undefined\") {\n return createMotionComponent as MotionProxy\n }\n\n /**\n * A cache of generated `motion` components, e.g `motion.div`, `motion.input` etc.\n * Rather than generating them anew every render.\n */\n const componentCache = new Map<string, any>()\n\n const factory = (Component: string, options?: MotionComponentOptions) => {\n return createMotionComponent(\n Component,\n options,\n preloadedFeatures,\n createVisualElement\n )\n }\n\n /**\n * Support for deprecated`motion(Component)` pattern\n */\n const deprecatedFactoryFunction = (\n Component: string,\n options?: MotionComponentOptions\n ) => {\n if (process.env.NODE_ENV !== \"production\") {\n warnOnce(\n false,\n \"motion() is deprecated. Use motion.create() instead.\"\n )\n }\n return factory(Component, options)\n }\n\n return new Proxy(deprecatedFactoryFunction, {\n /**\n * Called when `motion` is referenced with a prop: `motion.div`, `motion.input` etc.\n * The prop name is passed through as `key` and we can use that to generate a `motion`\n * DOM component with that name.\n */\n get: (_target, key: string) => {\n if (key === \"create\") return factory\n\n /**\n * If this element doesn't exist in the component cache, create it and cache.\n */\n if (!componentCache.has(key)) {\n componentCache.set(\n key,\n createMotionComponent(\n key,\n undefined,\n preloadedFeatures,\n createVisualElement\n )\n )\n }\n\n return componentCache.get(key)!\n },\n }) as MotionProxy\n}\n"],"names":[],"mappings":";;;AAqBM,SAAU,iBAAiB,CAC7B,iBAAmC,EACnC,mBAAmD,EAAA;AAEnD,IAAA,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;AAC9B,QAAA,OAAO,qBAAoC;IAC/C;AAEA;;;AAGG;AACH,IAAA,MAAM,cAAc,GAAG,IAAI,GAAG,EAAe;AAE7C,IAAA,MAAM,OAAO,GAAG,CAAC,SAAiB,EAAE,OAAgC,KAAI;QACpE,OAAO,qBAAqB,CACxB,SAAS,EACT,OAAO,EACP,iBAAiB,EACjB,mBAAmB,CACtB;AACL,IAAA,CAAC;AAED;;AAEG;AACH,IAAA,MAAM,yBAAyB,GAAG,CAC9B,SAAiB,EACjB,OAAgC,KAChC;QACA,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;AACvC,YAAA,QAAQ,CACJ,KAAK,EACL,sDAAsD,CACzD;QACL;AACA,QAAA,OAAO,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC;AACtC,IAAA,CAAC;AAED,IAAA,OAAO,IAAI,KAAK,CAAC,yBAAyB,EAAE;AACxC;;;;AAIG;AACH,QAAA,GAAG,EAAE,CAAC,OAAO,EAAE,GAAW,KAAI;YAC1B,IAAI,GAAG,KAAK,QAAQ;AAAE,gBAAA,OAAO,OAAO;AAEpC;;AAEG;YACH,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;AAC1B,gBAAA,cAAc,CAAC,GAAG,CACd,GAAG,EACH,qBAAqB,CACjB,GAAG,EACH,SAAS,EACT,iBAAiB,EACjB,mBAAmB,CACtB,CACJ;YACL;AAEA,YAAA,OAAO,cAAc,CAAC,GAAG,CAAC,GAAG,CAAE;QACnC,CAAC;AACJ,KAAA,CAAgB;AACrB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"create.mjs","sources":["../../../../../src/render/components/m/create.ts"],"sourcesContent":["import { createMotionComponent, MotionComponentOptions } from \"../../../motion\"\nimport { DOMMotionComponents } from \"../../dom/types\"\n\nexport function createMinimalMotionComponent<\n Props,\n TagName extends keyof DOMMotionComponents | string = \"div\"\n>(\n Component: TagName | string | React.ComponentType<Props>,\n options?: MotionComponentOptions\n) {\n return createMotionComponent(Component, options)\n}\n"],"names":[],"mappings":";;AAGgB,SAAA,4BAA4B,CAIxC,SAAwD,EACxD,OAAgC,EAAA;AAEhC,IAAA,OAAO,qBAAqB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;AACpD;;;;"}
1
+ {"version":3,"file":"create.mjs","sources":["../../../../../src/render/components/m/create.ts"],"sourcesContent":["import { createMotionComponent, MotionComponentOptions } from \"../../../motion\"\nimport { DOMMotionComponents } from \"../../dom/types\"\n\nexport function createMinimalMotionComponent<\n Props,\n TagName extends keyof DOMMotionComponents | string = \"div\"\n>(\n Component: TagName | string | React.ComponentType<Props>,\n options?: MotionComponentOptions\n) {\n return createMotionComponent(Component, options)\n}\n"],"names":[],"mappings":";;AAGM,SAAU,4BAA4B,CAIxC,SAAwD,EACxD,OAAgC,EAAA;AAEhC,IAAA,OAAO,qBAAqB,CAAC,SAAS,EAAE,OAAO,CAAC;AACpD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"elements.mjs","sources":["../../../../../src/render/components/m/elements.ts"],"sourcesContent":["\"use client\"\n\nimport { createMinimalMotionComponent } from \"./create\"\n\n/**\n * HTML components\n */\nexport const MotionA = /*@__PURE__*/ createMinimalMotionComponent(\"a\")\nexport const MotionAbbr = /*@__PURE__*/ createMinimalMotionComponent(\"abbr\")\nexport const MotionAddress =\n /*@__PURE__*/ createMinimalMotionComponent(\"address\")\nexport const MotionArea = /*@__PURE__*/ createMinimalMotionComponent(\"area\")\nexport const MotionArticle =\n /*@__PURE__*/ createMinimalMotionComponent(\"article\")\nexport const MotionAside = /*@__PURE__*/ createMinimalMotionComponent(\"aside\")\nexport const MotionAudio = /*@__PURE__*/ createMinimalMotionComponent(\"audio\")\nexport const MotionB = /*@__PURE__*/ createMinimalMotionComponent(\"b\")\nexport const MotionBase = /*@__PURE__*/ createMinimalMotionComponent(\"base\")\nexport const MotionBdi = /*@__PURE__*/ createMinimalMotionComponent(\"bdi\")\nexport const MotionBdo = /*@__PURE__*/ createMinimalMotionComponent(\"bdo\")\nexport const MotionBig = /*@__PURE__*/ createMinimalMotionComponent(\"big\")\nexport const MotionBlockquote =\n /*@__PURE__*/ createMinimalMotionComponent(\"blockquote\")\nexport const MotionBody = /*@__PURE__*/ createMinimalMotionComponent(\"body\")\nexport const MotionButton = /*@__PURE__*/ createMinimalMotionComponent(\"button\")\nexport const MotionCanvas = /*@__PURE__*/ createMinimalMotionComponent(\"canvas\")\nexport const MotionCaption =\n /*@__PURE__*/ createMinimalMotionComponent(\"caption\")\nexport const MotionCite = /*@__PURE__*/ createMinimalMotionComponent(\"cite\")\nexport const MotionCode = /*@__PURE__*/ createMinimalMotionComponent(\"code\")\nexport const MotionCol = /*@__PURE__*/ createMinimalMotionComponent(\"col\")\nexport const MotionColgroup =\n /*@__PURE__*/ createMinimalMotionComponent(\"colgroup\")\nexport const MotionData = /*@__PURE__*/ createMinimalMotionComponent(\"data\")\nexport const MotionDatalist =\n /*@__PURE__*/ createMinimalMotionComponent(\"datalist\")\nexport const MotionDd = /*@__PURE__*/ createMinimalMotionComponent(\"dd\")\nexport const MotionDel = /*@__PURE__*/ createMinimalMotionComponent(\"del\")\nexport const MotionDetails =\n /*@__PURE__*/ createMinimalMotionComponent(\"details\")\nexport const MotionDfn = /*@__PURE__*/ createMinimalMotionComponent(\"dfn\")\nexport const MotionDialog = /*@__PURE__*/ createMinimalMotionComponent(\"dialog\")\nexport const MotionDiv = /*@__PURE__*/ createMinimalMotionComponent(\"div\")\nexport const MotionDl = /*@__PURE__*/ createMinimalMotionComponent(\"dl\")\nexport const MotionDt = /*@__PURE__*/ createMinimalMotionComponent(\"dt\")\nexport const MotionEm = /*@__PURE__*/ createMinimalMotionComponent(\"em\")\nexport const MotionEmbed = /*@__PURE__*/ createMinimalMotionComponent(\"embed\")\nexport const MotionFieldset =\n /*@__PURE__*/ createMinimalMotionComponent(\"fieldset\")\nexport const MotionFigcaption =\n /*@__PURE__*/ createMinimalMotionComponent(\"figcaption\")\nexport const MotionFigure = /*@__PURE__*/ createMinimalMotionComponent(\"figure\")\nexport const MotionFooter = /*@__PURE__*/ createMinimalMotionComponent(\"footer\")\nexport const MotionForm = /*@__PURE__*/ createMinimalMotionComponent(\"form\")\nexport const MotionH1 = /*@__PURE__*/ createMinimalMotionComponent(\"h1\")\nexport const MotionH2 = /*@__PURE__*/ createMinimalMotionComponent(\"h2\")\nexport const MotionH3 = /*@__PURE__*/ createMinimalMotionComponent(\"h3\")\nexport const MotionH4 = /*@__PURE__*/ createMinimalMotionComponent(\"h4\")\nexport const MotionH5 = /*@__PURE__*/ createMinimalMotionComponent(\"h5\")\nexport const MotionH6 = /*@__PURE__*/ createMinimalMotionComponent(\"h6\")\nexport const MotionHead = /*@__PURE__*/ createMinimalMotionComponent(\"head\")\nexport const MotionHeader = /*@__PURE__*/ createMinimalMotionComponent(\"header\")\nexport const MotionHgroup = /*@__PURE__*/ createMinimalMotionComponent(\"hgroup\")\nexport const MotionHr = /*@__PURE__*/ createMinimalMotionComponent(\"hr\")\nexport const MotionHtml = /*@__PURE__*/ createMinimalMotionComponent(\"html\")\nexport const MotionI = /*@__PURE__*/ createMinimalMotionComponent(\"i\")\nexport const MotionIframe = /*@__PURE__*/ createMinimalMotionComponent(\"iframe\")\nexport const MotionImg = /*@__PURE__*/ createMinimalMotionComponent(\"img\")\nexport const MotionInput = /*@__PURE__*/ createMinimalMotionComponent(\"input\")\nexport const MotionIns = /*@__PURE__*/ createMinimalMotionComponent(\"ins\")\nexport const MotionKbd = /*@__PURE__*/ createMinimalMotionComponent(\"kbd\")\nexport const MotionKeygen = /*@__PURE__*/ createMinimalMotionComponent(\"keygen\")\nexport const MotionLabel = /*@__PURE__*/ createMinimalMotionComponent(\"label\")\nexport const MotionLegend = /*@__PURE__*/ createMinimalMotionComponent(\"legend\")\nexport const MotionLi = /*@__PURE__*/ createMinimalMotionComponent(\"li\")\nexport const MotionLink = /*@__PURE__*/ createMinimalMotionComponent(\"link\")\nexport const MotionMain = /*@__PURE__*/ createMinimalMotionComponent(\"main\")\nexport const MotionMap = /*@__PURE__*/ createMinimalMotionComponent(\"map\")\nexport const MotionMark = /*@__PURE__*/ createMinimalMotionComponent(\"mark\")\nexport const MotionMenu = /*@__PURE__*/ createMinimalMotionComponent(\"menu\")\nexport const MotionMenuitem =\n /*@__PURE__*/ createMinimalMotionComponent(\"menuitem\")\nexport const MotionMeter = /*@__PURE__*/ createMinimalMotionComponent(\"meter\")\nexport const MotionNav = /*@__PURE__*/ createMinimalMotionComponent(\"nav\")\nexport const MotionObject = /*@__PURE__*/ createMinimalMotionComponent(\"object\")\nexport const MotionOl = /*@__PURE__*/ createMinimalMotionComponent(\"ol\")\nexport const MotionOptgroup =\n /*@__PURE__*/ createMinimalMotionComponent(\"optgroup\")\nexport const MotionOption = /*@__PURE__*/ createMinimalMotionComponent(\"option\")\nexport const MotionOutput = /*@__PURE__*/ createMinimalMotionComponent(\"output\")\nexport const MotionP = /*@__PURE__*/ createMinimalMotionComponent(\"p\")\nexport const MotionParam = /*@__PURE__*/ createMinimalMotionComponent(\"param\")\nexport const MotionPicture =\n /*@__PURE__*/ createMinimalMotionComponent(\"picture\")\nexport const MotionPre = /*@__PURE__*/ createMinimalMotionComponent(\"pre\")\nexport const MotionProgress =\n /*@__PURE__*/ createMinimalMotionComponent(\"progress\")\nexport const MotionQ = /*@__PURE__*/ createMinimalMotionComponent(\"q\")\nexport const MotionRp = /*@__PURE__*/ createMinimalMotionComponent(\"rp\")\nexport const MotionRt = /*@__PURE__*/ createMinimalMotionComponent(\"rt\")\nexport const MotionRuby = /*@__PURE__*/ createMinimalMotionComponent(\"ruby\")\nexport const MotionS = /*@__PURE__*/ createMinimalMotionComponent(\"s\")\nexport const MotionSamp = /*@__PURE__*/ createMinimalMotionComponent(\"samp\")\nexport const MotionScript = /*@__PURE__*/ createMinimalMotionComponent(\"script\")\nexport const MotionSection =\n /*@__PURE__*/ createMinimalMotionComponent(\"section\")\nexport const MotionSelect = /*@__PURE__*/ createMinimalMotionComponent(\"select\")\nexport const MotionSmall = /*@__PURE__*/ createMinimalMotionComponent(\"small\")\nexport const MotionSource = /*@__PURE__*/ createMinimalMotionComponent(\"source\")\nexport const MotionSpan = /*@__PURE__*/ createMinimalMotionComponent(\"span\")\nexport const MotionStrong = /*@__PURE__*/ createMinimalMotionComponent(\"strong\")\nexport const MotionStyle = /*@__PURE__*/ createMinimalMotionComponent(\"style\")\nexport const MotionSub = /*@__PURE__*/ createMinimalMotionComponent(\"sub\")\nexport const MotionSummary =\n /*@__PURE__*/ createMinimalMotionComponent(\"summary\")\nexport const MotionSup = /*@__PURE__*/ createMinimalMotionComponent(\"sup\")\nexport const MotionTable = /*@__PURE__*/ createMinimalMotionComponent(\"table\")\nexport const MotionTbody = /*@__PURE__*/ createMinimalMotionComponent(\"tbody\")\nexport const MotionTd = /*@__PURE__*/ createMinimalMotionComponent(\"td\")\nexport const MotionTextarea =\n /*@__PURE__*/ createMinimalMotionComponent(\"textarea\")\nexport const MotionTfoot = /*@__PURE__*/ createMinimalMotionComponent(\"tfoot\")\nexport const MotionTh = /*@__PURE__*/ createMinimalMotionComponent(\"th\")\nexport const MotionThead = /*@__PURE__*/ createMinimalMotionComponent(\"thead\")\nexport const MotionTime = /*@__PURE__*/ createMinimalMotionComponent(\"time\")\nexport const MotionTitle = /*@__PURE__*/ createMinimalMotionComponent(\"title\")\nexport const MotionTr = /*@__PURE__*/ createMinimalMotionComponent(\"tr\")\nexport const MotionTrack = /*@__PURE__*/ createMinimalMotionComponent(\"track\")\nexport const MotionU = /*@__PURE__*/ createMinimalMotionComponent(\"u\")\nexport const MotionUl = /*@__PURE__*/ createMinimalMotionComponent(\"ul\")\nexport const MotionVideo = /*@__PURE__*/ createMinimalMotionComponent(\"video\")\nexport const MotionWbr = /*@__PURE__*/ createMinimalMotionComponent(\"wbr\")\nexport const MotionWebview =\n /*@__PURE__*/ createMinimalMotionComponent(\"webview\")\n\n/**\n * SVG components\n */\nexport const MotionAnimate =\n /*@__PURE__*/ createMinimalMotionComponent(\"animate\")\nexport const MotionCircle = /*@__PURE__*/ createMinimalMotionComponent(\"circle\")\nexport const MotionDefs = /*@__PURE__*/ createMinimalMotionComponent(\"defs\")\nexport const MotionDesc = /*@__PURE__*/ createMinimalMotionComponent(\"desc\")\nexport const MotionEllipse =\n /*@__PURE__*/ createMinimalMotionComponent(\"ellipse\")\nexport const MotionG = /*@__PURE__*/ createMinimalMotionComponent(\"g\")\nexport const MotionImage = /*@__PURE__*/ createMinimalMotionComponent(\"image\")\nexport const MotionLine = /*@__PURE__*/ createMinimalMotionComponent(\"line\")\nexport const MotionFilter = /*@__PURE__*/ createMinimalMotionComponent(\"filter\")\nexport const MotionMarker = /*@__PURE__*/ createMinimalMotionComponent(\"marker\")\nexport const MotionMask = /*@__PURE__*/ createMinimalMotionComponent(\"mask\")\nexport const MotionMetadata =\n /*@__PURE__*/ createMinimalMotionComponent(\"metadata\")\nexport const MotionPath = /*@__PURE__*/ createMinimalMotionComponent(\"path\")\nexport const MotionPattern =\n /*@__PURE__*/ createMinimalMotionComponent(\"pattern\")\nexport const MotionPolygon =\n /*@__PURE__*/ createMinimalMotionComponent(\"polygon\")\nexport const MotionPolyline =\n /*@__PURE__*/ createMinimalMotionComponent(\"polyline\")\nexport const MotionRect = /*@__PURE__*/ createMinimalMotionComponent(\"rect\")\nexport const MotionStop = /*@__PURE__*/ createMinimalMotionComponent(\"stop\")\nexport const MotionSvg = /*@__PURE__*/ createMinimalMotionComponent(\"svg\")\nexport const MotionSymbol = /*@__PURE__*/ createMinimalMotionComponent(\"symbol\")\nexport const MotionText = /*@__PURE__*/ createMinimalMotionComponent(\"text\")\nexport const MotionTspan = /*@__PURE__*/ createMinimalMotionComponent(\"tspan\")\nexport const MotionUse = /*@__PURE__*/ createMinimalMotionComponent(\"use\")\nexport const MotionView = /*@__PURE__*/ createMinimalMotionComponent(\"view\")\nexport const MotionClipPath =\n /*@__PURE__*/ createMinimalMotionComponent(\"clipPath\")\nexport const MotionFeBlend =\n /*@__PURE__*/ createMinimalMotionComponent(\"feBlend\")\nexport const MotionFeColorMatrix =\n /*@__PURE__*/ createMinimalMotionComponent(\"feColorMatrix\")\nexport const MotionFeComponentTransfer =\n /*@__PURE__*/ createMinimalMotionComponent(\"feComponentTransfer\")\nexport const MotionFeComposite =\n /*@__PURE__*/ createMinimalMotionComponent(\"feComposite\")\nexport const MotionFeConvolveMatrix =\n /*@__PURE__*/ createMinimalMotionComponent(\"feConvolveMatrix\")\nexport const MotionFeDiffuseLighting =\n /*@__PURE__*/ createMinimalMotionComponent(\"feDiffuseLighting\")\nexport const MotionFeDisplacementMap =\n /*@__PURE__*/ createMinimalMotionComponent(\"feDisplacementMap\")\nexport const MotionFeDistantLight =\n /*@__PURE__*/ createMinimalMotionComponent(\"feDistantLight\")\nexport const MotionFeDropShadow =\n /*@__PURE__*/ createMinimalMotionComponent(\"feDropShadow\")\nexport const MotionFeFlood =\n /*@__PURE__*/ createMinimalMotionComponent(\"feFlood\")\nexport const MotionFeFuncA =\n /*@__PURE__*/ createMinimalMotionComponent(\"feFuncA\")\nexport const MotionFeFuncB =\n /*@__PURE__*/ createMinimalMotionComponent(\"feFuncB\")\nexport const MotionFeFuncG =\n /*@__PURE__*/ createMinimalMotionComponent(\"feFuncG\")\nexport const MotionFeFuncR =\n /*@__PURE__*/ createMinimalMotionComponent(\"feFuncR\")\nexport const MotionFeGaussianBlur =\n /*@__PURE__*/ createMinimalMotionComponent(\"feGaussianBlur\")\nexport const MotionFeImage =\n /*@__PURE__*/ createMinimalMotionComponent(\"feImage\")\nexport const MotionFeMerge =\n /*@__PURE__*/ createMinimalMotionComponent(\"feMerge\")\nexport const MotionFeMergeNode =\n /*@__PURE__*/ createMinimalMotionComponent(\"feMergeNode\")\nexport const MotionFeMorphology =\n /*@__PURE__*/ createMinimalMotionComponent(\"feMorphology\")\nexport const MotionFeOffset =\n /*@__PURE__*/ createMinimalMotionComponent(\"feOffset\")\nexport const MotionFePointLight =\n /*@__PURE__*/ createMinimalMotionComponent(\"fePointLight\")\nexport const MotionFeSpecularLighting =\n /*@__PURE__*/ createMinimalMotionComponent(\"feSpecularLighting\")\nexport const MotionFeSpotLight =\n /*@__PURE__*/ createMinimalMotionComponent(\"feSpotLight\")\nexport const MotionFeTile = /*@__PURE__*/ createMinimalMotionComponent(\"feTile\")\nexport const MotionFeTurbulence =\n /*@__PURE__*/ createMinimalMotionComponent(\"feTurbulence\")\nexport const MotionForeignObject =\n /*@__PURE__*/ createMinimalMotionComponent(\"foreignObject\")\nexport const MotionLinearGradient =\n /*@__PURE__*/ createMinimalMotionComponent(\"linearGradient\")\nexport const MotionRadialGradient =\n /*@__PURE__*/ createMinimalMotionComponent(\"radialGradient\")\nexport const MotionTextPath =\n /*@__PURE__*/ createMinimalMotionComponent(\"textPath\")\n"],"names":[],"mappings":";;;AAIA;;AAEG;AACU;AACA;;AAET;AACS;;AAET;AACS;AACA;AACA;AACA;AACA;AACA;AACA;;AAET;AACS;AACA;AACA;;AAET;AACS;AACA;AACA;;AAET;AACS;;AAET;AACS;AACA;;AAET;AACS;AACA;AACA;AACA;AACA;AACA;AACA;;AAET;;AAEA;AACS;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAET;AACS;AACA;AACA;AACA;;AAET;AACS;AACA;AACA;AACA;;AAET;AACS;;AAET;AACS;AACA;AACA;AACA;AACA;AACA;AACA;;AAET;AACS;AACA;AACA;AACA;AACA;AACA;AACA;;AAET;AACS;AACA;AACA;AACA;;AAET;AACS;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAET;AAEJ;;AAEG;;AAEC;AACS;AACA;AACA;;AAET;AACS;AACA;AACA;AACA;AACA;AACA;;AAET;AACS;;AAET;;AAEA;;AAEA;AACS;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAET;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACS;;AAET;;AAEA;;AAEA;;AAEA;;AAEA;;"}
1
+ {"version":3,"file":"elements.mjs","sources":["../../../../../src/render/components/m/elements.ts"],"sourcesContent":["\"use client\"\n\nimport { createMinimalMotionComponent } from \"./create\"\n\n/**\n * HTML components\n */\nexport const MotionA = /*@__PURE__*/ createMinimalMotionComponent(\"a\")\nexport const MotionAbbr = /*@__PURE__*/ createMinimalMotionComponent(\"abbr\")\nexport const MotionAddress =\n /*@__PURE__*/ createMinimalMotionComponent(\"address\")\nexport const MotionArea = /*@__PURE__*/ createMinimalMotionComponent(\"area\")\nexport const MotionArticle =\n /*@__PURE__*/ createMinimalMotionComponent(\"article\")\nexport const MotionAside = /*@__PURE__*/ createMinimalMotionComponent(\"aside\")\nexport const MotionAudio = /*@__PURE__*/ createMinimalMotionComponent(\"audio\")\nexport const MotionB = /*@__PURE__*/ createMinimalMotionComponent(\"b\")\nexport const MotionBase = /*@__PURE__*/ createMinimalMotionComponent(\"base\")\nexport const MotionBdi = /*@__PURE__*/ createMinimalMotionComponent(\"bdi\")\nexport const MotionBdo = /*@__PURE__*/ createMinimalMotionComponent(\"bdo\")\nexport const MotionBig = /*@__PURE__*/ createMinimalMotionComponent(\"big\")\nexport const MotionBlockquote =\n /*@__PURE__*/ createMinimalMotionComponent(\"blockquote\")\nexport const MotionBody = /*@__PURE__*/ createMinimalMotionComponent(\"body\")\nexport const MotionButton = /*@__PURE__*/ createMinimalMotionComponent(\"button\")\nexport const MotionCanvas = /*@__PURE__*/ createMinimalMotionComponent(\"canvas\")\nexport const MotionCaption =\n /*@__PURE__*/ createMinimalMotionComponent(\"caption\")\nexport const MotionCite = /*@__PURE__*/ createMinimalMotionComponent(\"cite\")\nexport const MotionCode = /*@__PURE__*/ createMinimalMotionComponent(\"code\")\nexport const MotionCol = /*@__PURE__*/ createMinimalMotionComponent(\"col\")\nexport const MotionColgroup =\n /*@__PURE__*/ createMinimalMotionComponent(\"colgroup\")\nexport const MotionData = /*@__PURE__*/ createMinimalMotionComponent(\"data\")\nexport const MotionDatalist =\n /*@__PURE__*/ createMinimalMotionComponent(\"datalist\")\nexport const MotionDd = /*@__PURE__*/ createMinimalMotionComponent(\"dd\")\nexport const MotionDel = /*@__PURE__*/ createMinimalMotionComponent(\"del\")\nexport const MotionDetails =\n /*@__PURE__*/ createMinimalMotionComponent(\"details\")\nexport const MotionDfn = /*@__PURE__*/ createMinimalMotionComponent(\"dfn\")\nexport const MotionDialog = /*@__PURE__*/ createMinimalMotionComponent(\"dialog\")\nexport const MotionDiv = /*@__PURE__*/ createMinimalMotionComponent(\"div\")\nexport const MotionDl = /*@__PURE__*/ createMinimalMotionComponent(\"dl\")\nexport const MotionDt = /*@__PURE__*/ createMinimalMotionComponent(\"dt\")\nexport const MotionEm = /*@__PURE__*/ createMinimalMotionComponent(\"em\")\nexport const MotionEmbed = /*@__PURE__*/ createMinimalMotionComponent(\"embed\")\nexport const MotionFieldset =\n /*@__PURE__*/ createMinimalMotionComponent(\"fieldset\")\nexport const MotionFigcaption =\n /*@__PURE__*/ createMinimalMotionComponent(\"figcaption\")\nexport const MotionFigure = /*@__PURE__*/ createMinimalMotionComponent(\"figure\")\nexport const MotionFooter = /*@__PURE__*/ createMinimalMotionComponent(\"footer\")\nexport const MotionForm = /*@__PURE__*/ createMinimalMotionComponent(\"form\")\nexport const MotionH1 = /*@__PURE__*/ createMinimalMotionComponent(\"h1\")\nexport const MotionH2 = /*@__PURE__*/ createMinimalMotionComponent(\"h2\")\nexport const MotionH3 = /*@__PURE__*/ createMinimalMotionComponent(\"h3\")\nexport const MotionH4 = /*@__PURE__*/ createMinimalMotionComponent(\"h4\")\nexport const MotionH5 = /*@__PURE__*/ createMinimalMotionComponent(\"h5\")\nexport const MotionH6 = /*@__PURE__*/ createMinimalMotionComponent(\"h6\")\nexport const MotionHead = /*@__PURE__*/ createMinimalMotionComponent(\"head\")\nexport const MotionHeader = /*@__PURE__*/ createMinimalMotionComponent(\"header\")\nexport const MotionHgroup = /*@__PURE__*/ createMinimalMotionComponent(\"hgroup\")\nexport const MotionHr = /*@__PURE__*/ createMinimalMotionComponent(\"hr\")\nexport const MotionHtml = /*@__PURE__*/ createMinimalMotionComponent(\"html\")\nexport const MotionI = /*@__PURE__*/ createMinimalMotionComponent(\"i\")\nexport const MotionIframe = /*@__PURE__*/ createMinimalMotionComponent(\"iframe\")\nexport const MotionImg = /*@__PURE__*/ createMinimalMotionComponent(\"img\")\nexport const MotionInput = /*@__PURE__*/ createMinimalMotionComponent(\"input\")\nexport const MotionIns = /*@__PURE__*/ createMinimalMotionComponent(\"ins\")\nexport const MotionKbd = /*@__PURE__*/ createMinimalMotionComponent(\"kbd\")\nexport const MotionKeygen = /*@__PURE__*/ createMinimalMotionComponent(\"keygen\")\nexport const MotionLabel = /*@__PURE__*/ createMinimalMotionComponent(\"label\")\nexport const MotionLegend = /*@__PURE__*/ createMinimalMotionComponent(\"legend\")\nexport const MotionLi = /*@__PURE__*/ createMinimalMotionComponent(\"li\")\nexport const MotionLink = /*@__PURE__*/ createMinimalMotionComponent(\"link\")\nexport const MotionMain = /*@__PURE__*/ createMinimalMotionComponent(\"main\")\nexport const MotionMap = /*@__PURE__*/ createMinimalMotionComponent(\"map\")\nexport const MotionMark = /*@__PURE__*/ createMinimalMotionComponent(\"mark\")\nexport const MotionMenu = /*@__PURE__*/ createMinimalMotionComponent(\"menu\")\nexport const MotionMenuitem =\n /*@__PURE__*/ createMinimalMotionComponent(\"menuitem\")\nexport const MotionMeter = /*@__PURE__*/ createMinimalMotionComponent(\"meter\")\nexport const MotionNav = /*@__PURE__*/ createMinimalMotionComponent(\"nav\")\nexport const MotionObject = /*@__PURE__*/ createMinimalMotionComponent(\"object\")\nexport const MotionOl = /*@__PURE__*/ createMinimalMotionComponent(\"ol\")\nexport const MotionOptgroup =\n /*@__PURE__*/ createMinimalMotionComponent(\"optgroup\")\nexport const MotionOption = /*@__PURE__*/ createMinimalMotionComponent(\"option\")\nexport const MotionOutput = /*@__PURE__*/ createMinimalMotionComponent(\"output\")\nexport const MotionP = /*@__PURE__*/ createMinimalMotionComponent(\"p\")\nexport const MotionParam = /*@__PURE__*/ createMinimalMotionComponent(\"param\")\nexport const MotionPicture =\n /*@__PURE__*/ createMinimalMotionComponent(\"picture\")\nexport const MotionPre = /*@__PURE__*/ createMinimalMotionComponent(\"pre\")\nexport const MotionProgress =\n /*@__PURE__*/ createMinimalMotionComponent(\"progress\")\nexport const MotionQ = /*@__PURE__*/ createMinimalMotionComponent(\"q\")\nexport const MotionRp = /*@__PURE__*/ createMinimalMotionComponent(\"rp\")\nexport const MotionRt = /*@__PURE__*/ createMinimalMotionComponent(\"rt\")\nexport const MotionRuby = /*@__PURE__*/ createMinimalMotionComponent(\"ruby\")\nexport const MotionS = /*@__PURE__*/ createMinimalMotionComponent(\"s\")\nexport const MotionSamp = /*@__PURE__*/ createMinimalMotionComponent(\"samp\")\nexport const MotionScript = /*@__PURE__*/ createMinimalMotionComponent(\"script\")\nexport const MotionSection =\n /*@__PURE__*/ createMinimalMotionComponent(\"section\")\nexport const MotionSelect = /*@__PURE__*/ createMinimalMotionComponent(\"select\")\nexport const MotionSmall = /*@__PURE__*/ createMinimalMotionComponent(\"small\")\nexport const MotionSource = /*@__PURE__*/ createMinimalMotionComponent(\"source\")\nexport const MotionSpan = /*@__PURE__*/ createMinimalMotionComponent(\"span\")\nexport const MotionStrong = /*@__PURE__*/ createMinimalMotionComponent(\"strong\")\nexport const MotionStyle = /*@__PURE__*/ createMinimalMotionComponent(\"style\")\nexport const MotionSub = /*@__PURE__*/ createMinimalMotionComponent(\"sub\")\nexport const MotionSummary =\n /*@__PURE__*/ createMinimalMotionComponent(\"summary\")\nexport const MotionSup = /*@__PURE__*/ createMinimalMotionComponent(\"sup\")\nexport const MotionTable = /*@__PURE__*/ createMinimalMotionComponent(\"table\")\nexport const MotionTbody = /*@__PURE__*/ createMinimalMotionComponent(\"tbody\")\nexport const MotionTd = /*@__PURE__*/ createMinimalMotionComponent(\"td\")\nexport const MotionTextarea =\n /*@__PURE__*/ createMinimalMotionComponent(\"textarea\")\nexport const MotionTfoot = /*@__PURE__*/ createMinimalMotionComponent(\"tfoot\")\nexport const MotionTh = /*@__PURE__*/ createMinimalMotionComponent(\"th\")\nexport const MotionThead = /*@__PURE__*/ createMinimalMotionComponent(\"thead\")\nexport const MotionTime = /*@__PURE__*/ createMinimalMotionComponent(\"time\")\nexport const MotionTitle = /*@__PURE__*/ createMinimalMotionComponent(\"title\")\nexport const MotionTr = /*@__PURE__*/ createMinimalMotionComponent(\"tr\")\nexport const MotionTrack = /*@__PURE__*/ createMinimalMotionComponent(\"track\")\nexport const MotionU = /*@__PURE__*/ createMinimalMotionComponent(\"u\")\nexport const MotionUl = /*@__PURE__*/ createMinimalMotionComponent(\"ul\")\nexport const MotionVideo = /*@__PURE__*/ createMinimalMotionComponent(\"video\")\nexport const MotionWbr = /*@__PURE__*/ createMinimalMotionComponent(\"wbr\")\nexport const MotionWebview =\n /*@__PURE__*/ createMinimalMotionComponent(\"webview\")\n\n/**\n * SVG components\n */\nexport const MotionAnimate =\n /*@__PURE__*/ createMinimalMotionComponent(\"animate\")\nexport const MotionCircle = /*@__PURE__*/ createMinimalMotionComponent(\"circle\")\nexport const MotionDefs = /*@__PURE__*/ createMinimalMotionComponent(\"defs\")\nexport const MotionDesc = /*@__PURE__*/ createMinimalMotionComponent(\"desc\")\nexport const MotionEllipse =\n /*@__PURE__*/ createMinimalMotionComponent(\"ellipse\")\nexport const MotionG = /*@__PURE__*/ createMinimalMotionComponent(\"g\")\nexport const MotionImage = /*@__PURE__*/ createMinimalMotionComponent(\"image\")\nexport const MotionLine = /*@__PURE__*/ createMinimalMotionComponent(\"line\")\nexport const MotionFilter = /*@__PURE__*/ createMinimalMotionComponent(\"filter\")\nexport const MotionMarker = /*@__PURE__*/ createMinimalMotionComponent(\"marker\")\nexport const MotionMask = /*@__PURE__*/ createMinimalMotionComponent(\"mask\")\nexport const MotionMetadata =\n /*@__PURE__*/ createMinimalMotionComponent(\"metadata\")\nexport const MotionPath = /*@__PURE__*/ createMinimalMotionComponent(\"path\")\nexport const MotionPattern =\n /*@__PURE__*/ createMinimalMotionComponent(\"pattern\")\nexport const MotionPolygon =\n /*@__PURE__*/ createMinimalMotionComponent(\"polygon\")\nexport const MotionPolyline =\n /*@__PURE__*/ createMinimalMotionComponent(\"polyline\")\nexport const MotionRect = /*@__PURE__*/ createMinimalMotionComponent(\"rect\")\nexport const MotionStop = /*@__PURE__*/ createMinimalMotionComponent(\"stop\")\nexport const MotionSvg = /*@__PURE__*/ createMinimalMotionComponent(\"svg\")\nexport const MotionSymbol = /*@__PURE__*/ createMinimalMotionComponent(\"symbol\")\nexport const MotionText = /*@__PURE__*/ createMinimalMotionComponent(\"text\")\nexport const MotionTspan = /*@__PURE__*/ createMinimalMotionComponent(\"tspan\")\nexport const MotionUse = /*@__PURE__*/ createMinimalMotionComponent(\"use\")\nexport const MotionView = /*@__PURE__*/ createMinimalMotionComponent(\"view\")\nexport const MotionClipPath =\n /*@__PURE__*/ createMinimalMotionComponent(\"clipPath\")\nexport const MotionFeBlend =\n /*@__PURE__*/ createMinimalMotionComponent(\"feBlend\")\nexport const MotionFeColorMatrix =\n /*@__PURE__*/ createMinimalMotionComponent(\"feColorMatrix\")\nexport const MotionFeComponentTransfer =\n /*@__PURE__*/ createMinimalMotionComponent(\"feComponentTransfer\")\nexport const MotionFeComposite =\n /*@__PURE__*/ createMinimalMotionComponent(\"feComposite\")\nexport const MotionFeConvolveMatrix =\n /*@__PURE__*/ createMinimalMotionComponent(\"feConvolveMatrix\")\nexport const MotionFeDiffuseLighting =\n /*@__PURE__*/ createMinimalMotionComponent(\"feDiffuseLighting\")\nexport const MotionFeDisplacementMap =\n /*@__PURE__*/ createMinimalMotionComponent(\"feDisplacementMap\")\nexport const MotionFeDistantLight =\n /*@__PURE__*/ createMinimalMotionComponent(\"feDistantLight\")\nexport const MotionFeDropShadow =\n /*@__PURE__*/ createMinimalMotionComponent(\"feDropShadow\")\nexport const MotionFeFlood =\n /*@__PURE__*/ createMinimalMotionComponent(\"feFlood\")\nexport const MotionFeFuncA =\n /*@__PURE__*/ createMinimalMotionComponent(\"feFuncA\")\nexport const MotionFeFuncB =\n /*@__PURE__*/ createMinimalMotionComponent(\"feFuncB\")\nexport const MotionFeFuncG =\n /*@__PURE__*/ createMinimalMotionComponent(\"feFuncG\")\nexport const MotionFeFuncR =\n /*@__PURE__*/ createMinimalMotionComponent(\"feFuncR\")\nexport const MotionFeGaussianBlur =\n /*@__PURE__*/ createMinimalMotionComponent(\"feGaussianBlur\")\nexport const MotionFeImage =\n /*@__PURE__*/ createMinimalMotionComponent(\"feImage\")\nexport const MotionFeMerge =\n /*@__PURE__*/ createMinimalMotionComponent(\"feMerge\")\nexport const MotionFeMergeNode =\n /*@__PURE__*/ createMinimalMotionComponent(\"feMergeNode\")\nexport const MotionFeMorphology =\n /*@__PURE__*/ createMinimalMotionComponent(\"feMorphology\")\nexport const MotionFeOffset =\n /*@__PURE__*/ createMinimalMotionComponent(\"feOffset\")\nexport const MotionFePointLight =\n /*@__PURE__*/ createMinimalMotionComponent(\"fePointLight\")\nexport const MotionFeSpecularLighting =\n /*@__PURE__*/ createMinimalMotionComponent(\"feSpecularLighting\")\nexport const MotionFeSpotLight =\n /*@__PURE__*/ createMinimalMotionComponent(\"feSpotLight\")\nexport const MotionFeTile = /*@__PURE__*/ createMinimalMotionComponent(\"feTile\")\nexport const MotionFeTurbulence =\n /*@__PURE__*/ createMinimalMotionComponent(\"feTurbulence\")\nexport const MotionForeignObject =\n /*@__PURE__*/ createMinimalMotionComponent(\"foreignObject\")\nexport const MotionLinearGradient =\n /*@__PURE__*/ createMinimalMotionComponent(\"linearGradient\")\nexport const MotionRadialGradient =\n /*@__PURE__*/ createMinimalMotionComponent(\"radialGradient\")\nexport const MotionTextPath =\n /*@__PURE__*/ createMinimalMotionComponent(\"textPath\")\n"],"names":[],"mappings":";;;AAIA;;AAEG;AACI;AACA;;AAEH;AACG;;AAEH;AACG;AACA;AACA;AACA;AACA;AACA;AACA;;AAEH;AACG;AACA;AACA;;AAEH;AACG;AACA;AACA;;AAEH;AACG;;AAEH;AACG;AACA;;AAEH;AACG;AACA;AACA;AACA;AACA;AACA;AACA;;AAEH;;AAEA;AACG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEH;AACG;AACA;AACA;AACA;;AAEH;AACG;AACA;AACA;AACA;;AAEH;AACG;;AAEH;AACG;AACA;AACA;AACA;AACA;AACA;AACA;;AAEH;AACG;AACA;AACA;AACA;AACA;AACA;AACA;;AAEH;AACG;AACA;AACA;AACA;;AAEH;AACG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEH;AAEJ;;AAEG;;AAEC;AACG;AACA;AACA;;AAEH;AACG;AACA;AACA;AACA;AACA;AACA;;AAEH;AACG;;AAEH;;AAEA;;AAEA;AACG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEH;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACG;;AAEH;;AAEA;;AAEA;;AAEA;;AAEA;;"}