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.
- package/README.md +3 -5
- package/dist/cjs/client.js +1 -1
- package/dist/cjs/client.js.map +1 -1
- package/dist/cjs/dom-mini.js.map +1 -1
- package/dist/cjs/dom.js +8 -16
- package/dist/cjs/dom.js.map +1 -1
- package/dist/cjs/{feature-bundle-Cb13qNcx.js → feature-bundle-CUI5saed.js} +2 -5
- package/dist/cjs/feature-bundle-CUI5saed.js.map +1 -0
- package/dist/cjs/index.js +9 -17
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/m.js +3 -9
- package/dist/cjs/m.js.map +1 -1
- package/dist/cjs/mini.js.map +1 -1
- package/dist/dom-mini.d.ts +1 -0
- package/dist/dom.d.ts +1 -0
- package/dist/dom.js +1 -1
- package/dist/es/animation/animate/index.mjs +6 -2
- package/dist/es/animation/animate/index.mjs.map +1 -1
- package/dist/es/animation/animate/resolve-subjects.mjs.map +1 -1
- package/dist/es/animation/animate/sequence.mjs.map +1 -1
- package/dist/es/animation/animate/subject.mjs.map +1 -1
- package/dist/es/animation/animators/waapi/animate-elements.mjs.map +1 -1
- package/dist/es/animation/animators/waapi/animate-sequence.mjs.map +1 -1
- package/dist/es/animation/animators/waapi/animate-style.mjs.map +1 -1
- package/dist/es/animation/hooks/animation-controls.mjs.map +1 -1
- package/dist/es/animation/optimized-appear/handoff.mjs.map +1 -1
- package/dist/es/animation/optimized-appear/start.mjs.map +1 -1
- package/dist/es/animation/optimized-appear/store-id.mjs.map +1 -1
- package/dist/es/animation/optimized-appear/store.mjs.map +1 -1
- package/dist/es/animation/sequence/create.mjs.map +1 -1
- package/dist/es/animation/sequence/utils/calc-repeat-duration.mjs.map +1 -1
- package/dist/es/animation/sequence/utils/calc-time.mjs.map +1 -1
- package/dist/es/animation/sequence/utils/edit.mjs.map +1 -1
- package/dist/es/animation/sequence/utils/normalize-times.mjs.map +1 -1
- package/dist/es/animation/sequence/utils/sort.mjs.map +1 -1
- package/dist/es/animation/utils/create-visual-element.mjs.map +1 -1
- package/dist/es/animation/utils/is-dom-keyframes.mjs.map +1 -1
- package/dist/es/components/AnimatePresence/PopChild.mjs.map +1 -1
- package/dist/es/components/AnimatePresence/PresenceChild.mjs.map +1 -1
- package/dist/es/components/AnimatePresence/index.mjs.map +1 -1
- package/dist/es/components/AnimatePresence/use-presence.mjs.map +1 -1
- package/dist/es/components/AnimatePresence/utils.mjs.map +1 -1
- package/dist/es/components/Reorder/Group.mjs.map +1 -1
- package/dist/es/components/Reorder/Item.mjs.map +1 -1
- package/dist/es/components/Reorder/utils/auto-scroll.mjs.map +1 -1
- package/dist/es/components/Reorder/utils/check-reorder.mjs.map +1 -1
- package/dist/es/context/MotionContext/index.mjs.map +1 -1
- package/dist/es/context/MotionContext/utils.mjs.map +1 -1
- package/dist/es/events/add-pointer-event.mjs.map +1 -1
- package/dist/es/events/event-info.mjs.map +1 -1
- package/dist/es/gestures/drag/VisualElementDragControls.mjs +1 -1
- package/dist/es/gestures/drag/VisualElementDragControls.mjs.map +1 -1
- package/dist/es/gestures/drag/index.mjs.map +1 -1
- package/dist/es/gestures/drag/use-drag-controls.mjs.map +1 -1
- package/dist/es/gestures/drag/utils/constraints.mjs.map +1 -1
- package/dist/es/gestures/focus.mjs.map +1 -1
- package/dist/es/gestures/hover.mjs.map +1 -1
- package/dist/es/gestures/pan/PanSession.mjs +2 -5
- package/dist/es/gestures/pan/PanSession.mjs.map +1 -1
- package/dist/es/gestures/pan/index.mjs.map +1 -1
- package/dist/es/gestures/press.mjs.map +1 -1
- package/dist/es/index.mjs +2 -2
- package/dist/es/m.mjs +1 -1
- package/dist/es/motion/features/animation/exit.mjs.map +1 -1
- package/dist/es/motion/features/animation/index.mjs.map +1 -1
- package/dist/es/motion/features/animations.mjs.map +1 -1
- package/dist/es/motion/features/definitions.mjs.map +1 -1
- package/dist/es/motion/features/drag.mjs.map +1 -1
- package/dist/es/motion/features/gestures.mjs.map +1 -1
- package/dist/es/motion/features/layout.mjs.map +1 -1
- package/dist/es/motion/features/load-features.mjs.map +1 -1
- package/dist/es/motion/features/viewport/index.mjs.map +1 -1
- package/dist/es/motion/features/viewport/observers.mjs.map +1 -1
- package/dist/es/motion/utils/is-motion-component.mjs.map +1 -1
- package/dist/es/motion/utils/symbol.mjs.map +1 -1
- package/dist/es/motion/utils/unwrap-motion-component.mjs.map +1 -1
- package/dist/es/motion/utils/use-visual-element.mjs.map +1 -1
- package/dist/es/motion/utils/valid-prop.mjs.map +1 -1
- package/dist/es/projection/use-instant-layout-transition.mjs.map +1 -1
- package/dist/es/projection/use-reset-projection.mjs.map +1 -1
- package/dist/es/render/components/create-proxy.mjs.map +1 -1
- package/dist/es/render/components/m/create.mjs.map +1 -1
- package/dist/es/render/components/m/elements.mjs.map +1 -1
- package/dist/es/render/components/motion/create.mjs.map +1 -1
- package/dist/es/render/components/motion/elements.mjs.map +1 -1
- package/dist/es/render/components/motion/feature-bundle.mjs.map +1 -1
- package/dist/es/render/dom/create-visual-element.mjs.map +1 -1
- package/dist/es/render/dom/features-animation.mjs.map +1 -1
- package/dist/es/render/dom/features-max.mjs.map +1 -1
- package/dist/es/render/dom/features-min.mjs.map +1 -1
- package/dist/es/render/dom/scroll/attach-animation.mjs.map +1 -1
- package/dist/es/render/dom/scroll/attach-function.mjs.map +1 -1
- package/dist/es/render/dom/scroll/index.mjs.map +1 -1
- package/dist/es/render/dom/scroll/info.mjs.map +1 -1
- package/dist/es/render/dom/scroll/offsets/edge.mjs.map +1 -1
- package/dist/es/render/dom/scroll/offsets/index.mjs.map +1 -1
- package/dist/es/render/dom/scroll/offsets/inset.mjs.map +1 -1
- package/dist/es/render/dom/scroll/offsets/offset.mjs.map +1 -1
- package/dist/es/render/dom/scroll/offsets/presets.mjs +0 -12
- package/dist/es/render/dom/scroll/offsets/presets.mjs.map +1 -1
- package/dist/es/render/dom/scroll/on-scroll-handler.mjs.map +1 -1
- package/dist/es/render/dom/scroll/track.mjs +2 -2
- package/dist/es/render/dom/scroll/track.mjs.map +1 -1
- package/dist/es/render/dom/scroll/utils/can-use-native-timeline.mjs.map +1 -1
- package/dist/es/render/dom/scroll/utils/get-timeline.mjs.map +1 -1
- package/dist/es/render/dom/utils/filter-props.mjs.map +1 -1
- package/dist/es/render/dom/utils/is-svg-component.mjs.map +1 -1
- package/dist/es/render/dom/viewport/index.mjs.map +1 -1
- package/dist/es/render/html/use-html-visual-state.mjs.map +1 -1
- package/dist/es/render/html/use-props.mjs.map +1 -1
- package/dist/es/render/html/utils/create-render-state.mjs.map +1 -1
- package/dist/es/render/svg/lowercase-elements.mjs.map +1 -1
- package/dist/es/render/svg/use-svg-visual-state.mjs.map +1 -1
- package/dist/es/render/svg/utils/create-render-state.mjs.map +1 -1
- package/dist/es/utils/distance.mjs.map +1 -1
- package/dist/es/utils/get-context-window.mjs.map +1 -1
- package/dist/es/utils/is-ref-object.mjs.map +1 -1
- package/dist/es/utils/transform-viewbox-point.mjs.map +1 -1
- package/dist/es/utils/use-composed-ref.mjs.map +1 -1
- package/dist/es/utils/use-cycle.mjs.map +1 -1
- package/dist/es/value/scroll/use-element-scroll.mjs.map +1 -1
- package/dist/es/value/scroll/use-viewport-scroll.mjs.map +1 -1
- package/dist/es/value/use-combine-values.mjs.map +1 -1
- package/dist/es/value/use-will-change/WillChangeMotionValue.mjs.map +1 -1
- package/dist/framer-motion.dev.js +15 -9
- package/dist/framer-motion.js +1 -1
- package/dist/size-rollup-animate.js +1 -1
- package/dist/size-rollup-animate.js.map +1 -1
- package/dist/size-rollup-dom-animation-assets.js +1 -1
- package/dist/size-rollup-dom-animation.js +1 -1
- package/dist/size-rollup-dom-max-assets.js +1 -1
- package/dist/size-rollup-dom-max.js +1 -1
- package/dist/size-rollup-m.js.map +1 -1
- package/dist/size-rollup-motion.js +1 -1
- package/dist/size-rollup-motion.js.map +1 -1
- package/dist/size-rollup-scroll.js +1 -1
- package/dist/size-rollup-scroll.js.map +1 -1
- package/dist/size-rollup-waapi-animate.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types.d-DOCC-kZB.d.ts +223 -0
- package/package.json +3 -3
- package/dist/cjs/feature-bundle-Cb13qNcx.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.mjs","sources":["../../../../../src/render/components/motion/create.ts"],"sourcesContent":["import { createMotionComponent, MotionComponentOptions } from \"../../../motion\"\nimport { createDomVisualElement } from \"../../dom/create-visual-element\"\nimport { DOMMotionComponents } from \"../../dom/types\"\nimport { CreateVisualElement } from \"../../types\"\nimport { featureBundle } from \"./feature-bundle\"\n\nexport function createMotionComponentWithFeatures<\n Props,\n TagName extends keyof DOMMotionComponents | string = \"div\"\n>(\n Component: TagName | string | React.ComponentType<Props>,\n options?: MotionComponentOptions\n) {\n return createMotionComponent(\n Component,\n options,\n featureBundle,\n createDomVisualElement as CreateVisualElement<Props, TagName>\n )\n}\n"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"create.mjs","sources":["../../../../../src/render/components/motion/create.ts"],"sourcesContent":["import { createMotionComponent, MotionComponentOptions } from \"../../../motion\"\nimport { createDomVisualElement } from \"../../dom/create-visual-element\"\nimport { DOMMotionComponents } from \"../../dom/types\"\nimport { CreateVisualElement } from \"../../types\"\nimport { featureBundle } from \"./feature-bundle\"\n\nexport function createMotionComponentWithFeatures<\n Props,\n TagName extends keyof DOMMotionComponents | string = \"div\"\n>(\n Component: TagName | string | React.ComponentType<Props>,\n options?: MotionComponentOptions\n) {\n return createMotionComponent(\n Component,\n options,\n featureBundle,\n createDomVisualElement as CreateVisualElement<Props, TagName>\n )\n}\n"],"names":[],"mappings":";;;;AAMM,SAAU,iCAAiC,CAI7C,SAAwD,EACxD,OAAgC,EAAA;IAEhC,OAAO,qBAAqB,CACxB,SAAS,EACT,OAAO,EACP,aAAa,EACb,sBAA6D,CAChE;AACL;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elements.mjs","sources":["../../../../../src/render/components/motion/elements.ts"],"sourcesContent":["\"use client\"\n\nimport { createMotionComponentWithFeatures as createMotionComponent } from \"./create\"\n\n/**\n * HTML components\n */\nexport const MotionA = /*@__PURE__*/ createMotionComponent(\"a\")\nexport const MotionAbbr = /*@__PURE__*/ createMotionComponent(\"abbr\")\nexport const MotionAddress = /*@__PURE__*/ createMotionComponent(\"address\")\nexport const MotionArea = /*@__PURE__*/ createMotionComponent(\"area\")\nexport const MotionArticle = /*@__PURE__*/ createMotionComponent(\"article\")\nexport const MotionAside = /*@__PURE__*/ createMotionComponent(\"aside\")\nexport const MotionAudio = /*@__PURE__*/ createMotionComponent(\"audio\")\nexport const MotionB = /*@__PURE__*/ createMotionComponent(\"b\")\nexport const MotionBase = /*@__PURE__*/ createMotionComponent(\"base\")\nexport const MotionBdi = /*@__PURE__*/ createMotionComponent(\"bdi\")\nexport const MotionBdo = /*@__PURE__*/ createMotionComponent(\"bdo\")\nexport const MotionBig = /*@__PURE__*/ createMotionComponent(\"big\")\nexport const MotionBlockquote =\n /*@__PURE__*/ createMotionComponent(\"blockquote\")\nexport const MotionBody = /*@__PURE__*/ createMotionComponent(\"body\")\nexport const MotionButton = /*@__PURE__*/ createMotionComponent(\"button\")\nexport const MotionCanvas = /*@__PURE__*/ createMotionComponent(\"canvas\")\nexport const MotionCaption = /*@__PURE__*/ createMotionComponent(\"caption\")\nexport const MotionCite = /*@__PURE__*/ createMotionComponent(\"cite\")\nexport const MotionCode = /*@__PURE__*/ createMotionComponent(\"code\")\nexport const MotionCol = /*@__PURE__*/ createMotionComponent(\"col\")\nexport const MotionColgroup = /*@__PURE__*/ createMotionComponent(\"colgroup\")\nexport const MotionData = /*@__PURE__*/ createMotionComponent(\"data\")\nexport const MotionDatalist = /*@__PURE__*/ createMotionComponent(\"datalist\")\nexport const MotionDd = /*@__PURE__*/ createMotionComponent(\"dd\")\nexport const MotionDel = /*@__PURE__*/ createMotionComponent(\"del\")\nexport const MotionDetails = /*@__PURE__*/ createMotionComponent(\"details\")\nexport const MotionDfn = /*@__PURE__*/ createMotionComponent(\"dfn\")\nexport const MotionDialog = /*@__PURE__*/ createMotionComponent(\"dialog\")\nexport const MotionDiv = /*@__PURE__*/ createMotionComponent(\"div\")\nexport const MotionDl = /*@__PURE__*/ createMotionComponent(\"dl\")\nexport const MotionDt = /*@__PURE__*/ createMotionComponent(\"dt\")\nexport const MotionEm = /*@__PURE__*/ createMotionComponent(\"em\")\nexport const MotionEmbed = /*@__PURE__*/ createMotionComponent(\"embed\")\nexport const MotionFieldset = /*@__PURE__*/ createMotionComponent(\"fieldset\")\nexport const MotionFigcaption =\n /*@__PURE__*/ createMotionComponent(\"figcaption\")\nexport const MotionFigure = /*@__PURE__*/ createMotionComponent(\"figure\")\nexport const MotionFooter = /*@__PURE__*/ createMotionComponent(\"footer\")\nexport const MotionForm = /*@__PURE__*/ createMotionComponent(\"form\")\nexport const MotionH1 = /*@__PURE__*/ createMotionComponent(\"h1\")\nexport const MotionH2 = /*@__PURE__*/ createMotionComponent(\"h2\")\nexport const MotionH3 = /*@__PURE__*/ createMotionComponent(\"h3\")\nexport const MotionH4 = /*@__PURE__*/ createMotionComponent(\"h4\")\nexport const MotionH5 = /*@__PURE__*/ createMotionComponent(\"h5\")\nexport const MotionH6 = /*@__PURE__*/ createMotionComponent(\"h6\")\nexport const MotionHead = /*@__PURE__*/ createMotionComponent(\"head\")\nexport const MotionHeader = /*@__PURE__*/ createMotionComponent(\"header\")\nexport const MotionHgroup = /*@__PURE__*/ createMotionComponent(\"hgroup\")\nexport const MotionHr = /*@__PURE__*/ createMotionComponent(\"hr\")\nexport const MotionHtml = /*@__PURE__*/ createMotionComponent(\"html\")\nexport const MotionI = /*@__PURE__*/ createMotionComponent(\"i\")\nexport const MotionIframe = /*@__PURE__*/ createMotionComponent(\"iframe\")\nexport const MotionImg = /*@__PURE__*/ createMotionComponent(\"img\")\nexport const MotionInput = /*@__PURE__*/ createMotionComponent(\"input\")\nexport const MotionIns = /*@__PURE__*/ createMotionComponent(\"ins\")\nexport const MotionKbd = /*@__PURE__*/ createMotionComponent(\"kbd\")\nexport const MotionKeygen = /*@__PURE__*/ createMotionComponent(\"keygen\")\nexport const MotionLabel = /*@__PURE__*/ createMotionComponent(\"label\")\nexport const MotionLegend = /*@__PURE__*/ createMotionComponent(\"legend\")\nexport const MotionLi = /*@__PURE__*/ createMotionComponent(\"li\")\nexport const MotionLink = /*@__PURE__*/ createMotionComponent(\"link\")\nexport const MotionMain = /*@__PURE__*/ createMotionComponent(\"main\")\nexport const MotionMap = /*@__PURE__*/ createMotionComponent(\"map\")\nexport const MotionMark = /*@__PURE__*/ createMotionComponent(\"mark\")\nexport const MotionMenu = /*@__PURE__*/ createMotionComponent(\"menu\")\nexport const MotionMenuitem = /*@__PURE__*/ createMotionComponent(\"menuitem\")\nexport const MotionMeter = /*@__PURE__*/ createMotionComponent(\"meter\")\nexport const MotionNav = /*@__PURE__*/ createMotionComponent(\"nav\")\nexport const MotionObject = /*@__PURE__*/ createMotionComponent(\"object\")\nexport const MotionOl = /*@__PURE__*/ createMotionComponent(\"ol\")\nexport const MotionOptgroup = /*@__PURE__*/ createMotionComponent(\"optgroup\")\nexport const MotionOption = /*@__PURE__*/ createMotionComponent(\"option\")\nexport const MotionOutput = /*@__PURE__*/ createMotionComponent(\"output\")\nexport const MotionP = /*@__PURE__*/ createMotionComponent(\"p\")\nexport const MotionParam = /*@__PURE__*/ createMotionComponent(\"param\")\nexport const MotionPicture = /*@__PURE__*/ createMotionComponent(\"picture\")\nexport const MotionPre = /*@__PURE__*/ createMotionComponent(\"pre\")\nexport const MotionProgress = /*@__PURE__*/ createMotionComponent(\"progress\")\nexport const MotionQ = /*@__PURE__*/ createMotionComponent(\"q\")\nexport const MotionRp = /*@__PURE__*/ createMotionComponent(\"rp\")\nexport const MotionRt = /*@__PURE__*/ createMotionComponent(\"rt\")\nexport const MotionRuby = /*@__PURE__*/ createMotionComponent(\"ruby\")\nexport const MotionS = /*@__PURE__*/ createMotionComponent(\"s\")\nexport const MotionSamp = /*@__PURE__*/ createMotionComponent(\"samp\")\nexport const MotionScript = /*@__PURE__*/ createMotionComponent(\"script\")\nexport const MotionSection = /*@__PURE__*/ createMotionComponent(\"section\")\nexport const MotionSelect = /*@__PURE__*/ createMotionComponent(\"select\")\nexport const MotionSmall = /*@__PURE__*/ createMotionComponent(\"small\")\nexport const MotionSource = /*@__PURE__*/ createMotionComponent(\"source\")\nexport const MotionSpan = /*@__PURE__*/ createMotionComponent(\"span\")\nexport const MotionStrong = /*@__PURE__*/ createMotionComponent(\"strong\")\nexport const MotionStyle = /*@__PURE__*/ createMotionComponent(\"style\")\nexport const MotionSub = /*@__PURE__*/ createMotionComponent(\"sub\")\nexport const MotionSummary = /*@__PURE__*/ createMotionComponent(\"summary\")\nexport const MotionSup = /*@__PURE__*/ createMotionComponent(\"sup\")\nexport const MotionTable = /*@__PURE__*/ createMotionComponent(\"table\")\nexport const MotionTbody = /*@__PURE__*/ createMotionComponent(\"tbody\")\nexport const MotionTd = /*@__PURE__*/ createMotionComponent(\"td\")\nexport const MotionTextarea = /*@__PURE__*/ createMotionComponent(\"textarea\")\nexport const MotionTfoot = /*@__PURE__*/ createMotionComponent(\"tfoot\")\nexport const MotionTh = /*@__PURE__*/ createMotionComponent(\"th\")\nexport const MotionThead = /*@__PURE__*/ createMotionComponent(\"thead\")\nexport const MotionTime = /*@__PURE__*/ createMotionComponent(\"time\")\nexport const MotionTitle = /*@__PURE__*/ createMotionComponent(\"title\")\nexport const MotionTr = /*@__PURE__*/ createMotionComponent(\"tr\")\nexport const MotionTrack = /*@__PURE__*/ createMotionComponent(\"track\")\nexport const MotionU = /*@__PURE__*/ createMotionComponent(\"u\")\nexport const MotionUl = /*@__PURE__*/ createMotionComponent(\"ul\")\nexport const MotionVideo = /*@__PURE__*/ createMotionComponent(\"video\")\nexport const MotionWbr = /*@__PURE__*/ createMotionComponent(\"wbr\")\nexport const MotionWebview = /*@__PURE__*/ createMotionComponent(\"webview\")\n\n/**\n * SVG components\n */\nexport const MotionAnimate = /*@__PURE__*/ createMotionComponent(\"animate\")\nexport const MotionCircle = /*@__PURE__*/ createMotionComponent(\"circle\")\nexport const MotionDefs = /*@__PURE__*/ createMotionComponent(\"defs\")\nexport const MotionDesc = /*@__PURE__*/ createMotionComponent(\"desc\")\nexport const MotionEllipse = /*@__PURE__*/ createMotionComponent(\"ellipse\")\nexport const MotionG = /*@__PURE__*/ createMotionComponent(\"g\")\nexport const MotionImage = /*@__PURE__*/ createMotionComponent(\"image\")\nexport const MotionLine = /*@__PURE__*/ createMotionComponent(\"line\")\nexport const MotionFilter = /*@__PURE__*/ createMotionComponent(\"filter\")\nexport const MotionMarker = /*@__PURE__*/ createMotionComponent(\"marker\")\nexport const MotionMask = /*@__PURE__*/ createMotionComponent(\"mask\")\nexport const MotionMetadata = /*@__PURE__*/ createMotionComponent(\"metadata\")\nexport const MotionPath = /*@__PURE__*/ createMotionComponent(\"path\")\nexport const MotionPattern = /*@__PURE__*/ createMotionComponent(\"pattern\")\nexport const MotionPolygon = /*@__PURE__*/ createMotionComponent(\"polygon\")\nexport const MotionPolyline = /*@__PURE__*/ createMotionComponent(\"polyline\")\nexport const MotionRect = /*@__PURE__*/ createMotionComponent(\"rect\")\nexport const MotionStop = /*@__PURE__*/ createMotionComponent(\"stop\")\nexport const MotionSvg = /*@__PURE__*/ createMotionComponent(\"svg\")\nexport const MotionSymbol = /*@__PURE__*/ createMotionComponent(\"symbol\")\nexport const MotionText = /*@__PURE__*/ createMotionComponent(\"text\")\nexport const MotionTspan = /*@__PURE__*/ createMotionComponent(\"tspan\")\nexport const MotionUse = /*@__PURE__*/ createMotionComponent(\"use\")\nexport const MotionView = /*@__PURE__*/ createMotionComponent(\"view\")\nexport const MotionClipPath = /*@__PURE__*/ createMotionComponent(\"clipPath\")\nexport const MotionFeBlend = /*@__PURE__*/ createMotionComponent(\"feBlend\")\nexport const MotionFeColorMatrix =\n /*@__PURE__*/ createMotionComponent(\"feColorMatrix\")\nexport const MotionFeComponentTransfer = /*@__PURE__*/ createMotionComponent(\n \"feComponentTransfer\"\n)\nexport const MotionFeComposite =\n /*@__PURE__*/ createMotionComponent(\"feComposite\")\nexport const MotionFeConvolveMatrix =\n /*@__PURE__*/ createMotionComponent(\"feConvolveMatrix\")\nexport const MotionFeDiffuseLighting =\n /*@__PURE__*/ createMotionComponent(\"feDiffuseLighting\")\nexport const MotionFeDisplacementMap =\n /*@__PURE__*/ createMotionComponent(\"feDisplacementMap\")\nexport const MotionFeDistantLight =\n /*@__PURE__*/ createMotionComponent(\"feDistantLight\")\nexport const MotionFeDropShadow =\n /*@__PURE__*/ createMotionComponent(\"feDropShadow\")\nexport const MotionFeFlood = /*@__PURE__*/ createMotionComponent(\"feFlood\")\nexport const MotionFeFuncA = /*@__PURE__*/ createMotionComponent(\"feFuncA\")\nexport const MotionFeFuncB = /*@__PURE__*/ createMotionComponent(\"feFuncB\")\nexport const MotionFeFuncG = /*@__PURE__*/ createMotionComponent(\"feFuncG\")\nexport const MotionFeFuncR = /*@__PURE__*/ createMotionComponent(\"feFuncR\")\nexport const MotionFeGaussianBlur =\n /*@__PURE__*/ createMotionComponent(\"feGaussianBlur\")\nexport const MotionFeImage = /*@__PURE__*/ createMotionComponent(\"feImage\")\nexport const MotionFeMerge = /*@__PURE__*/ createMotionComponent(\"feMerge\")\nexport const MotionFeMergeNode =\n /*@__PURE__*/ createMotionComponent(\"feMergeNode\")\nexport const MotionFeMorphology =\n /*@__PURE__*/ createMotionComponent(\"feMorphology\")\nexport const MotionFeOffset = /*@__PURE__*/ createMotionComponent(\"feOffset\")\nexport const MotionFePointLight =\n /*@__PURE__*/ createMotionComponent(\"fePointLight\")\nexport const MotionFeSpecularLighting =\n /*@__PURE__*/ createMotionComponent(\"feSpecularLighting\")\nexport const MotionFeSpotLight =\n /*@__PURE__*/ createMotionComponent(\"feSpotLight\")\nexport const MotionFeTile = /*@__PURE__*/ createMotionComponent(\"feTile\")\nexport const MotionFeTurbulence =\n /*@__PURE__*/ createMotionComponent(\"feTurbulence\")\nexport const MotionForeignObject =\n /*@__PURE__*/ createMotionComponent(\"foreignObject\")\nexport const MotionLinearGradient =\n /*@__PURE__*/ createMotionComponent(\"linearGradient\")\nexport const MotionRadialGradient =\n /*@__PURE__*/ createMotionComponent(\"radialGradient\")\nexport const MotionTextPath = /*@__PURE__*/ createMotionComponent(\"textPath\")\n"],"names":[],"mappings":";;;AAIA;;AAEG;AACU;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAET;AACS;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;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;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEb;;AAEG;AACU;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;;AAIT;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACS;AACA;AACA;AACA;AACA;;AAET;AACS;AACA;;AAET;;AAEA;AACS;;AAET;;AAEA;;AAEA;AACS;;AAET;;AAEA;;AAEA;;AAEA;AACS;;"}
|
|
1
|
+
{"version":3,"file":"elements.mjs","sources":["../../../../../src/render/components/motion/elements.ts"],"sourcesContent":["\"use client\"\n\nimport { createMotionComponentWithFeatures as createMotionComponent } from \"./create\"\n\n/**\n * HTML components\n */\nexport const MotionA = /*@__PURE__*/ createMotionComponent(\"a\")\nexport const MotionAbbr = /*@__PURE__*/ createMotionComponent(\"abbr\")\nexport const MotionAddress = /*@__PURE__*/ createMotionComponent(\"address\")\nexport const MotionArea = /*@__PURE__*/ createMotionComponent(\"area\")\nexport const MotionArticle = /*@__PURE__*/ createMotionComponent(\"article\")\nexport const MotionAside = /*@__PURE__*/ createMotionComponent(\"aside\")\nexport const MotionAudio = /*@__PURE__*/ createMotionComponent(\"audio\")\nexport const MotionB = /*@__PURE__*/ createMotionComponent(\"b\")\nexport const MotionBase = /*@__PURE__*/ createMotionComponent(\"base\")\nexport const MotionBdi = /*@__PURE__*/ createMotionComponent(\"bdi\")\nexport const MotionBdo = /*@__PURE__*/ createMotionComponent(\"bdo\")\nexport const MotionBig = /*@__PURE__*/ createMotionComponent(\"big\")\nexport const MotionBlockquote =\n /*@__PURE__*/ createMotionComponent(\"blockquote\")\nexport const MotionBody = /*@__PURE__*/ createMotionComponent(\"body\")\nexport const MotionButton = /*@__PURE__*/ createMotionComponent(\"button\")\nexport const MotionCanvas = /*@__PURE__*/ createMotionComponent(\"canvas\")\nexport const MotionCaption = /*@__PURE__*/ createMotionComponent(\"caption\")\nexport const MotionCite = /*@__PURE__*/ createMotionComponent(\"cite\")\nexport const MotionCode = /*@__PURE__*/ createMotionComponent(\"code\")\nexport const MotionCol = /*@__PURE__*/ createMotionComponent(\"col\")\nexport const MotionColgroup = /*@__PURE__*/ createMotionComponent(\"colgroup\")\nexport const MotionData = /*@__PURE__*/ createMotionComponent(\"data\")\nexport const MotionDatalist = /*@__PURE__*/ createMotionComponent(\"datalist\")\nexport const MotionDd = /*@__PURE__*/ createMotionComponent(\"dd\")\nexport const MotionDel = /*@__PURE__*/ createMotionComponent(\"del\")\nexport const MotionDetails = /*@__PURE__*/ createMotionComponent(\"details\")\nexport const MotionDfn = /*@__PURE__*/ createMotionComponent(\"dfn\")\nexport const MotionDialog = /*@__PURE__*/ createMotionComponent(\"dialog\")\nexport const MotionDiv = /*@__PURE__*/ createMotionComponent(\"div\")\nexport const MotionDl = /*@__PURE__*/ createMotionComponent(\"dl\")\nexport const MotionDt = /*@__PURE__*/ createMotionComponent(\"dt\")\nexport const MotionEm = /*@__PURE__*/ createMotionComponent(\"em\")\nexport const MotionEmbed = /*@__PURE__*/ createMotionComponent(\"embed\")\nexport const MotionFieldset = /*@__PURE__*/ createMotionComponent(\"fieldset\")\nexport const MotionFigcaption =\n /*@__PURE__*/ createMotionComponent(\"figcaption\")\nexport const MotionFigure = /*@__PURE__*/ createMotionComponent(\"figure\")\nexport const MotionFooter = /*@__PURE__*/ createMotionComponent(\"footer\")\nexport const MotionForm = /*@__PURE__*/ createMotionComponent(\"form\")\nexport const MotionH1 = /*@__PURE__*/ createMotionComponent(\"h1\")\nexport const MotionH2 = /*@__PURE__*/ createMotionComponent(\"h2\")\nexport const MotionH3 = /*@__PURE__*/ createMotionComponent(\"h3\")\nexport const MotionH4 = /*@__PURE__*/ createMotionComponent(\"h4\")\nexport const MotionH5 = /*@__PURE__*/ createMotionComponent(\"h5\")\nexport const MotionH6 = /*@__PURE__*/ createMotionComponent(\"h6\")\nexport const MotionHead = /*@__PURE__*/ createMotionComponent(\"head\")\nexport const MotionHeader = /*@__PURE__*/ createMotionComponent(\"header\")\nexport const MotionHgroup = /*@__PURE__*/ createMotionComponent(\"hgroup\")\nexport const MotionHr = /*@__PURE__*/ createMotionComponent(\"hr\")\nexport const MotionHtml = /*@__PURE__*/ createMotionComponent(\"html\")\nexport const MotionI = /*@__PURE__*/ createMotionComponent(\"i\")\nexport const MotionIframe = /*@__PURE__*/ createMotionComponent(\"iframe\")\nexport const MotionImg = /*@__PURE__*/ createMotionComponent(\"img\")\nexport const MotionInput = /*@__PURE__*/ createMotionComponent(\"input\")\nexport const MotionIns = /*@__PURE__*/ createMotionComponent(\"ins\")\nexport const MotionKbd = /*@__PURE__*/ createMotionComponent(\"kbd\")\nexport const MotionKeygen = /*@__PURE__*/ createMotionComponent(\"keygen\")\nexport const MotionLabel = /*@__PURE__*/ createMotionComponent(\"label\")\nexport const MotionLegend = /*@__PURE__*/ createMotionComponent(\"legend\")\nexport const MotionLi = /*@__PURE__*/ createMotionComponent(\"li\")\nexport const MotionLink = /*@__PURE__*/ createMotionComponent(\"link\")\nexport const MotionMain = /*@__PURE__*/ createMotionComponent(\"main\")\nexport const MotionMap = /*@__PURE__*/ createMotionComponent(\"map\")\nexport const MotionMark = /*@__PURE__*/ createMotionComponent(\"mark\")\nexport const MotionMenu = /*@__PURE__*/ createMotionComponent(\"menu\")\nexport const MotionMenuitem = /*@__PURE__*/ createMotionComponent(\"menuitem\")\nexport const MotionMeter = /*@__PURE__*/ createMotionComponent(\"meter\")\nexport const MotionNav = /*@__PURE__*/ createMotionComponent(\"nav\")\nexport const MotionObject = /*@__PURE__*/ createMotionComponent(\"object\")\nexport const MotionOl = /*@__PURE__*/ createMotionComponent(\"ol\")\nexport const MotionOptgroup = /*@__PURE__*/ createMotionComponent(\"optgroup\")\nexport const MotionOption = /*@__PURE__*/ createMotionComponent(\"option\")\nexport const MotionOutput = /*@__PURE__*/ createMotionComponent(\"output\")\nexport const MotionP = /*@__PURE__*/ createMotionComponent(\"p\")\nexport const MotionParam = /*@__PURE__*/ createMotionComponent(\"param\")\nexport const MotionPicture = /*@__PURE__*/ createMotionComponent(\"picture\")\nexport const MotionPre = /*@__PURE__*/ createMotionComponent(\"pre\")\nexport const MotionProgress = /*@__PURE__*/ createMotionComponent(\"progress\")\nexport const MotionQ = /*@__PURE__*/ createMotionComponent(\"q\")\nexport const MotionRp = /*@__PURE__*/ createMotionComponent(\"rp\")\nexport const MotionRt = /*@__PURE__*/ createMotionComponent(\"rt\")\nexport const MotionRuby = /*@__PURE__*/ createMotionComponent(\"ruby\")\nexport const MotionS = /*@__PURE__*/ createMotionComponent(\"s\")\nexport const MotionSamp = /*@__PURE__*/ createMotionComponent(\"samp\")\nexport const MotionScript = /*@__PURE__*/ createMotionComponent(\"script\")\nexport const MotionSection = /*@__PURE__*/ createMotionComponent(\"section\")\nexport const MotionSelect = /*@__PURE__*/ createMotionComponent(\"select\")\nexport const MotionSmall = /*@__PURE__*/ createMotionComponent(\"small\")\nexport const MotionSource = /*@__PURE__*/ createMotionComponent(\"source\")\nexport const MotionSpan = /*@__PURE__*/ createMotionComponent(\"span\")\nexport const MotionStrong = /*@__PURE__*/ createMotionComponent(\"strong\")\nexport const MotionStyle = /*@__PURE__*/ createMotionComponent(\"style\")\nexport const MotionSub = /*@__PURE__*/ createMotionComponent(\"sub\")\nexport const MotionSummary = /*@__PURE__*/ createMotionComponent(\"summary\")\nexport const MotionSup = /*@__PURE__*/ createMotionComponent(\"sup\")\nexport const MotionTable = /*@__PURE__*/ createMotionComponent(\"table\")\nexport const MotionTbody = /*@__PURE__*/ createMotionComponent(\"tbody\")\nexport const MotionTd = /*@__PURE__*/ createMotionComponent(\"td\")\nexport const MotionTextarea = /*@__PURE__*/ createMotionComponent(\"textarea\")\nexport const MotionTfoot = /*@__PURE__*/ createMotionComponent(\"tfoot\")\nexport const MotionTh = /*@__PURE__*/ createMotionComponent(\"th\")\nexport const MotionThead = /*@__PURE__*/ createMotionComponent(\"thead\")\nexport const MotionTime = /*@__PURE__*/ createMotionComponent(\"time\")\nexport const MotionTitle = /*@__PURE__*/ createMotionComponent(\"title\")\nexport const MotionTr = /*@__PURE__*/ createMotionComponent(\"tr\")\nexport const MotionTrack = /*@__PURE__*/ createMotionComponent(\"track\")\nexport const MotionU = /*@__PURE__*/ createMotionComponent(\"u\")\nexport const MotionUl = /*@__PURE__*/ createMotionComponent(\"ul\")\nexport const MotionVideo = /*@__PURE__*/ createMotionComponent(\"video\")\nexport const MotionWbr = /*@__PURE__*/ createMotionComponent(\"wbr\")\nexport const MotionWebview = /*@__PURE__*/ createMotionComponent(\"webview\")\n\n/**\n * SVG components\n */\nexport const MotionAnimate = /*@__PURE__*/ createMotionComponent(\"animate\")\nexport const MotionCircle = /*@__PURE__*/ createMotionComponent(\"circle\")\nexport const MotionDefs = /*@__PURE__*/ createMotionComponent(\"defs\")\nexport const MotionDesc = /*@__PURE__*/ createMotionComponent(\"desc\")\nexport const MotionEllipse = /*@__PURE__*/ createMotionComponent(\"ellipse\")\nexport const MotionG = /*@__PURE__*/ createMotionComponent(\"g\")\nexport const MotionImage = /*@__PURE__*/ createMotionComponent(\"image\")\nexport const MotionLine = /*@__PURE__*/ createMotionComponent(\"line\")\nexport const MotionFilter = /*@__PURE__*/ createMotionComponent(\"filter\")\nexport const MotionMarker = /*@__PURE__*/ createMotionComponent(\"marker\")\nexport const MotionMask = /*@__PURE__*/ createMotionComponent(\"mask\")\nexport const MotionMetadata = /*@__PURE__*/ createMotionComponent(\"metadata\")\nexport const MotionPath = /*@__PURE__*/ createMotionComponent(\"path\")\nexport const MotionPattern = /*@__PURE__*/ createMotionComponent(\"pattern\")\nexport const MotionPolygon = /*@__PURE__*/ createMotionComponent(\"polygon\")\nexport const MotionPolyline = /*@__PURE__*/ createMotionComponent(\"polyline\")\nexport const MotionRect = /*@__PURE__*/ createMotionComponent(\"rect\")\nexport const MotionStop = /*@__PURE__*/ createMotionComponent(\"stop\")\nexport const MotionSvg = /*@__PURE__*/ createMotionComponent(\"svg\")\nexport const MotionSymbol = /*@__PURE__*/ createMotionComponent(\"symbol\")\nexport const MotionText = /*@__PURE__*/ createMotionComponent(\"text\")\nexport const MotionTspan = /*@__PURE__*/ createMotionComponent(\"tspan\")\nexport const MotionUse = /*@__PURE__*/ createMotionComponent(\"use\")\nexport const MotionView = /*@__PURE__*/ createMotionComponent(\"view\")\nexport const MotionClipPath = /*@__PURE__*/ createMotionComponent(\"clipPath\")\nexport const MotionFeBlend = /*@__PURE__*/ createMotionComponent(\"feBlend\")\nexport const MotionFeColorMatrix =\n /*@__PURE__*/ createMotionComponent(\"feColorMatrix\")\nexport const MotionFeComponentTransfer = /*@__PURE__*/ createMotionComponent(\n \"feComponentTransfer\"\n)\nexport const MotionFeComposite =\n /*@__PURE__*/ createMotionComponent(\"feComposite\")\nexport const MotionFeConvolveMatrix =\n /*@__PURE__*/ createMotionComponent(\"feConvolveMatrix\")\nexport const MotionFeDiffuseLighting =\n /*@__PURE__*/ createMotionComponent(\"feDiffuseLighting\")\nexport const MotionFeDisplacementMap =\n /*@__PURE__*/ createMotionComponent(\"feDisplacementMap\")\nexport const MotionFeDistantLight =\n /*@__PURE__*/ createMotionComponent(\"feDistantLight\")\nexport const MotionFeDropShadow =\n /*@__PURE__*/ createMotionComponent(\"feDropShadow\")\nexport const MotionFeFlood = /*@__PURE__*/ createMotionComponent(\"feFlood\")\nexport const MotionFeFuncA = /*@__PURE__*/ createMotionComponent(\"feFuncA\")\nexport const MotionFeFuncB = /*@__PURE__*/ createMotionComponent(\"feFuncB\")\nexport const MotionFeFuncG = /*@__PURE__*/ createMotionComponent(\"feFuncG\")\nexport const MotionFeFuncR = /*@__PURE__*/ createMotionComponent(\"feFuncR\")\nexport const MotionFeGaussianBlur =\n /*@__PURE__*/ createMotionComponent(\"feGaussianBlur\")\nexport const MotionFeImage = /*@__PURE__*/ createMotionComponent(\"feImage\")\nexport const MotionFeMerge = /*@__PURE__*/ createMotionComponent(\"feMerge\")\nexport const MotionFeMergeNode =\n /*@__PURE__*/ createMotionComponent(\"feMergeNode\")\nexport const MotionFeMorphology =\n /*@__PURE__*/ createMotionComponent(\"feMorphology\")\nexport const MotionFeOffset = /*@__PURE__*/ createMotionComponent(\"feOffset\")\nexport const MotionFePointLight =\n /*@__PURE__*/ createMotionComponent(\"fePointLight\")\nexport const MotionFeSpecularLighting =\n /*@__PURE__*/ createMotionComponent(\"feSpecularLighting\")\nexport const MotionFeSpotLight =\n /*@__PURE__*/ createMotionComponent(\"feSpotLight\")\nexport const MotionFeTile = /*@__PURE__*/ createMotionComponent(\"feTile\")\nexport const MotionFeTurbulence =\n /*@__PURE__*/ createMotionComponent(\"feTurbulence\")\nexport const MotionForeignObject =\n /*@__PURE__*/ createMotionComponent(\"foreignObject\")\nexport const MotionLinearGradient =\n /*@__PURE__*/ createMotionComponent(\"linearGradient\")\nexport const MotionRadialGradient =\n /*@__PURE__*/ createMotionComponent(\"radialGradient\")\nexport const MotionTextPath = /*@__PURE__*/ createMotionComponent(\"textPath\")\n"],"names":[],"mappings":";;;AAIA;;AAEG;AACI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEH;AACG;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;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;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEP;;AAEG;AACI;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;;AAIH;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACG;AACA;AACA;AACA;AACA;;AAEH;AACG;AACA;;AAEH;;AAEA;AACG;;AAEH;;AAEA;;AAEA;AACG;;AAEH;;AAEA;;AAEA;;AAEA;AACG;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-bundle.mjs","sources":["../../../../../src/render/components/motion/feature-bundle.ts"],"sourcesContent":["import { animations } from \"../../../motion/features/animations\"\nimport { drag } from \"../../../motion/features/drag\"\nimport { gestureAnimations } from \"../../../motion/features/gestures\"\nimport { layout } from \"../../../motion/features/layout\"\n\nexport const featureBundle = {\n ...animations,\n ...gestureAnimations,\n ...drag,\n ...layout,\n}\n"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"feature-bundle.mjs","sources":["../../../../../src/render/components/motion/feature-bundle.ts"],"sourcesContent":["import { animations } from \"../../../motion/features/animations\"\nimport { drag } from \"../../../motion/features/drag\"\nimport { gestureAnimations } from \"../../../motion/features/gestures\"\nimport { layout } from \"../../../motion/features/layout\"\n\nexport const featureBundle = {\n ...animations,\n ...gestureAnimations,\n ...drag,\n ...layout,\n}\n"],"names":[],"mappings":";;;;;AAKO,MAAM,aAAa,GAAG;AACzB,IAAA,GAAG,UAAU;AACb,IAAA,GAAG,iBAAiB;AACpB,IAAA,GAAG,IAAI;AACP,IAAA,GAAG,MAAM;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-visual-element.mjs","sources":["../../../../src/render/dom/create-visual-element.ts"],"sourcesContent":["import { HTMLVisualElement, SVGVisualElement } from \"motion-dom\"\nimport { ComponentType, Fragment } from \"react\"\nimport { CreateVisualElement, VisualElementOptions } from \"../types\"\nimport { isSVGComponent } from \"./utils/is-svg-component\"\n\nexport const createDomVisualElement: CreateVisualElement = (\n Component: string | ComponentType<React.PropsWithChildren<unknown>>,\n options: VisualElementOptions<HTMLElement | SVGElement>\n) => {\n /**\n * Use explicit isSVG override if provided, otherwise auto-detect\n */\n const isSVG = options.isSVG ?? isSVGComponent(Component)\n\n return isSVG\n ? new SVGVisualElement(options)\n : new HTMLVisualElement(options, {\n allowProjection: Component !== Fragment,\n })\n}\n"],"names":[],"mappings":";;;;MAKa,sBAAsB,GAAwB,CACvD,SAAmE,EACnE,OAAuD,KACvD;AACA;;AAEG;IACH,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,cAAc,CAAC,SAAS,CAAC
|
|
1
|
+
{"version":3,"file":"create-visual-element.mjs","sources":["../../../../src/render/dom/create-visual-element.ts"],"sourcesContent":["import { HTMLVisualElement, SVGVisualElement } from \"motion-dom\"\nimport { ComponentType, Fragment } from \"react\"\nimport { CreateVisualElement, VisualElementOptions } from \"../types\"\nimport { isSVGComponent } from \"./utils/is-svg-component\"\n\nexport const createDomVisualElement: CreateVisualElement = (\n Component: string | ComponentType<React.PropsWithChildren<unknown>>,\n options: VisualElementOptions<HTMLElement | SVGElement>\n) => {\n /**\n * Use explicit isSVG override if provided, otherwise auto-detect\n */\n const isSVG = options.isSVG ?? isSVGComponent(Component)\n\n return isSVG\n ? new SVGVisualElement(options)\n : new HTMLVisualElement(options, {\n allowProjection: Component !== Fragment,\n })\n}\n"],"names":[],"mappings":";;;;MAKa,sBAAsB,GAAwB,CACvD,SAAmE,EACnE,OAAuD,KACvD;AACA;;AAEG;IACH,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,cAAc,CAAC,SAAS,CAAC;AAExD,IAAA,OAAO;AACH,UAAE,IAAI,gBAAgB,CAAC,OAAO;AAC9B,UAAE,IAAI,iBAAiB,CAAC,OAAO,EAAE;YAC3B,eAAe,EAAE,SAAS,KAAK,QAAQ;AAC1C,SAAA,CAAC;AACZ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features-animation.mjs","sources":["../../../../src/render/dom/features-animation.ts"],"sourcesContent":["\"use client\"\n\nimport { animations } from \"../../motion/features/animations\"\nimport { gestureAnimations } from \"../../motion/features/gestures\"\nimport { FeatureBundle } from \"../../motion/features/types\"\nimport { createDomVisualElement } from \"./create-visual-element\"\n\n/**\n * @public\n */\nexport const domAnimation: FeatureBundle = {\n renderer: createDomVisualElement,\n ...animations,\n ...gestureAnimations,\n}\n"],"names":[],"mappings":";;;;;AAOA;;AAEG;
|
|
1
|
+
{"version":3,"file":"features-animation.mjs","sources":["../../../../src/render/dom/features-animation.ts"],"sourcesContent":["\"use client\"\n\nimport { animations } from \"../../motion/features/animations\"\nimport { gestureAnimations } from \"../../motion/features/gestures\"\nimport { FeatureBundle } from \"../../motion/features/types\"\nimport { createDomVisualElement } from \"./create-visual-element\"\n\n/**\n * @public\n */\nexport const domAnimation: FeatureBundle = {\n renderer: createDomVisualElement,\n ...animations,\n ...gestureAnimations,\n}\n"],"names":[],"mappings":";;;;;AAOA;;AAEG;AACI;AACH;AACA;AACA;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features-max.mjs","sources":["../../../../src/render/dom/features-max.ts"],"sourcesContent":["\"use client\"\n\nimport { drag } from \"../../motion/features/drag\"\nimport { layout } from \"../../motion/features/layout\"\nimport { FeatureBundle } from \"../../motion/features/types\"\nimport { domAnimation } from \"./features-animation\"\n\n/**\n * @public\n */\nexport const domMax: FeatureBundle = {\n ...domAnimation,\n ...drag,\n ...layout,\n}\n"],"names":[],"mappings":";;;;;AAOA;;AAEG;
|
|
1
|
+
{"version":3,"file":"features-max.mjs","sources":["../../../../src/render/dom/features-max.ts"],"sourcesContent":["\"use client\"\n\nimport { drag } from \"../../motion/features/drag\"\nimport { layout } from \"../../motion/features/layout\"\nimport { FeatureBundle } from \"../../motion/features/types\"\nimport { domAnimation } from \"./features-animation\"\n\n/**\n * @public\n */\nexport const domMax: FeatureBundle = {\n ...domAnimation,\n ...drag,\n ...layout,\n}\n"],"names":[],"mappings":";;;;;AAOA;;AAEG;AACI;AACH;AACA;AACA;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features-min.mjs","sources":["../../../../src/render/dom/features-min.ts"],"sourcesContent":["\"use client\"\n\nimport { animations } from \"../../motion/features/animations\"\nimport { FeatureBundle } from \"../../motion/features/types\"\nimport { createDomVisualElement } from \"./create-visual-element\"\n\n/**\n * @public\n */\nexport const domMin: FeatureBundle = {\n renderer: createDomVisualElement,\n ...animations,\n}\n"],"names":[],"mappings":";;;;AAMA;;AAEG;
|
|
1
|
+
{"version":3,"file":"features-min.mjs","sources":["../../../../src/render/dom/features-min.ts"],"sourcesContent":["\"use client\"\n\nimport { animations } from \"../../motion/features/animations\"\nimport { FeatureBundle } from \"../../motion/features/types\"\nimport { createDomVisualElement } from \"./create-visual-element\"\n\n/**\n * @public\n */\nexport const domMin: FeatureBundle = {\n renderer: createDomVisualElement,\n ...animations,\n}\n"],"names":[],"mappings":";;;;AAMA;;AAEG;AACI;AACH;AACA;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attach-animation.mjs","sources":["../../../../../src/render/dom/scroll/attach-animation.ts"],"sourcesContent":["import { AnimationPlaybackControls, observeTimeline } from \"motion-dom\"\nimport { ScrollOptionsWithDefaults } from \"./types\"\nimport { getTimeline } from \"./utils/get-timeline\"\n\nexport function attachToAnimation(\n animation: AnimationPlaybackControls,\n options: ScrollOptionsWithDefaults\n) {\n const timeline = getTimeline(options)\n\n return animation.attachTimeline({\n timeline: options.target ? undefined : timeline,\n observe: (valueAnimation) => {\n valueAnimation.pause()\n\n return observeTimeline((progress) => {\n valueAnimation.time =\n valueAnimation.iterationDuration * progress\n }, timeline)\n },\n })\n}\n"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"attach-animation.mjs","sources":["../../../../../src/render/dom/scroll/attach-animation.ts"],"sourcesContent":["import { AnimationPlaybackControls, observeTimeline } from \"motion-dom\"\nimport { ScrollOptionsWithDefaults } from \"./types\"\nimport { getTimeline } from \"./utils/get-timeline\"\n\nexport function attachToAnimation(\n animation: AnimationPlaybackControls,\n options: ScrollOptionsWithDefaults\n) {\n const timeline = getTimeline(options)\n\n return animation.attachTimeline({\n timeline: options.target ? undefined : timeline,\n observe: (valueAnimation) => {\n valueAnimation.pause()\n\n return observeTimeline((progress) => {\n valueAnimation.time =\n valueAnimation.iterationDuration * progress\n }, timeline)\n },\n })\n}\n"],"names":[],"mappings":";;;AAIM,SAAU,iBAAiB,CAC7B,SAAoC,EACpC,OAAkC,EAAA;AAElC,IAAA,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC;IAErC,OAAO,SAAS,CAAC,cAAc,CAAC;QAC5B,QAAQ,EAAE,OAAO,CAAC,MAAM,GAAG,SAAS,GAAG,QAAQ;AAC/C,QAAA,OAAO,EAAE,CAAC,cAAc,KAAI;YACxB,cAAc,CAAC,KAAK,EAAE;AAEtB,YAAA,OAAO,eAAe,CAAC,CAAC,QAAQ,KAAI;AAChC,gBAAA,cAAc,CAAC,IAAI;AACf,oBAAA,cAAc,CAAC,iBAAiB,GAAG,QAAQ;YACnD,CAAC,EAAE,QAAQ,CAAC;QAChB,CAAC;AACJ,KAAA,CAAC;AACN;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attach-function.mjs","sources":["../../../../../src/render/dom/scroll/attach-function.ts"],"sourcesContent":["import { observeTimeline } from \"motion-dom\"\nimport { scrollInfo } from \"./track\"\nimport { OnScroll, OnScrollWithInfo, ScrollOptionsWithDefaults } from \"./types\"\nimport { getTimeline } from \"./utils/get-timeline\"\n\n/**\n * If the onScroll function has two arguments, it's expecting\n * more specific information about the scroll from scrollInfo.\n */\nfunction isOnScrollWithInfo(onScroll: OnScroll): onScroll is OnScrollWithInfo {\n return onScroll.length === 2\n}\n\nexport function attachToFunction(\n onScroll: OnScroll,\n options: ScrollOptionsWithDefaults\n) {\n if (isOnScrollWithInfo(onScroll)) {\n return scrollInfo((info) => {\n onScroll(info[options.axis!].progress, info)\n }, options)\n } else {\n return observeTimeline(onScroll, getTimeline(options))\n }\n}\n"],"names":[],"mappings":";;;;AAKA;;;AAGG;AACH,SAAS,kBAAkB,CAAC,QAAkB,EAAA;AAC1C,IAAA,OAAO,QAAQ,CAAC,MAAM,KAAK,CAAC
|
|
1
|
+
{"version":3,"file":"attach-function.mjs","sources":["../../../../../src/render/dom/scroll/attach-function.ts"],"sourcesContent":["import { observeTimeline } from \"motion-dom\"\nimport { scrollInfo } from \"./track\"\nimport { OnScroll, OnScrollWithInfo, ScrollOptionsWithDefaults } from \"./types\"\nimport { getTimeline } from \"./utils/get-timeline\"\n\n/**\n * If the onScroll function has two arguments, it's expecting\n * more specific information about the scroll from scrollInfo.\n */\nfunction isOnScrollWithInfo(onScroll: OnScroll): onScroll is OnScrollWithInfo {\n return onScroll.length === 2\n}\n\nexport function attachToFunction(\n onScroll: OnScroll,\n options: ScrollOptionsWithDefaults\n) {\n if (isOnScrollWithInfo(onScroll)) {\n return scrollInfo((info) => {\n onScroll(info[options.axis!].progress, info)\n }, options)\n } else {\n return observeTimeline(onScroll, getTimeline(options))\n }\n}\n"],"names":[],"mappings":";;;;AAKA;;;AAGG;AACH,SAAS,kBAAkB,CAAC,QAAkB,EAAA;AAC1C,IAAA,OAAO,QAAQ,CAAC,MAAM,KAAK,CAAC;AAChC;AAEM,SAAU,gBAAgB,CAC5B,QAAkB,EAClB,OAAkC,EAAA;AAElC,IAAA,IAAI,kBAAkB,CAAC,QAAQ,CAAC,EAAE;AAC9B,QAAA,OAAO,UAAU,CAAC,CAAC,IAAI,KAAI;AACvB,YAAA,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,IAAK,CAAC,CAAC,QAAQ,EAAE,IAAI,CAAC;QAChD,CAAC,EAAE,OAAO,CAAC;IACf;SAAO;QACH,OAAO,eAAe,CAAC,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAC1D;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../../../src/render/dom/scroll/index.ts"],"sourcesContent":["import { AnimationPlaybackControls } from \"motion-dom\"\nimport { noop } from \"motion-utils\"\nimport { attachToAnimation } from \"./attach-animation\"\nimport { attachToFunction } from \"./attach-function\"\nimport { OnScroll, ScrollOptions } from \"./types\"\n\nexport function scroll(\n onScroll: OnScroll | AnimationPlaybackControls,\n {\n axis = \"y\",\n container = document.scrollingElement as Element,\n ...options\n }: ScrollOptions = {}\n): VoidFunction {\n if (!container) return noop as VoidFunction\n\n const optionsWithDefaults = { axis, container, ...options }\n\n return typeof onScroll === \"function\"\n ? attachToFunction(onScroll, optionsWithDefaults)\n : attachToAnimation(onScroll, optionsWithDefaults)\n}\n"],"names":[],"mappings":";;;;SAMgB,MAAM,CAClB,QAA8C,EAC9C,EACI,IAAI,GAAG,GAAG,EACV,SAAS,GAAG,QAAQ,CAAC,gBAA2B,EAChD,GAAG,OAAO,KACK,EAAE,EAAA;AAErB,IAAA,IAAI,CAAC,SAAS;AAAE,QAAA,OAAO,IAAoB
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../../src/render/dom/scroll/index.ts"],"sourcesContent":["import { AnimationPlaybackControls } from \"motion-dom\"\nimport { noop } from \"motion-utils\"\nimport { attachToAnimation } from \"./attach-animation\"\nimport { attachToFunction } from \"./attach-function\"\nimport { OnScroll, ScrollOptions } from \"./types\"\n\nexport function scroll(\n onScroll: OnScroll | AnimationPlaybackControls,\n {\n axis = \"y\",\n container = document.scrollingElement as Element,\n ...options\n }: ScrollOptions = {}\n): VoidFunction {\n if (!container) return noop as VoidFunction\n\n const optionsWithDefaults = { axis, container, ...options }\n\n return typeof onScroll === \"function\"\n ? attachToFunction(onScroll, optionsWithDefaults)\n : attachToAnimation(onScroll, optionsWithDefaults)\n}\n"],"names":[],"mappings":";;;;SAMgB,MAAM,CAClB,QAA8C,EAC9C,EACI,IAAI,GAAG,GAAG,EACV,SAAS,GAAG,QAAQ,CAAC,gBAA2B,EAChD,GAAG,OAAO,KACK,EAAE,EAAA;AAErB,IAAA,IAAI,CAAC,SAAS;AAAE,QAAA,OAAO,IAAoB;IAE3C,MAAM,mBAAmB,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,OAAO,EAAE;IAE3D,OAAO,OAAO,QAAQ,KAAK;AACvB,UAAE,gBAAgB,CAAC,QAAQ,EAAE,mBAAmB;AAChD,UAAE,iBAAiB,CAAC,QAAQ,EAAE,mBAAmB,CAAC;AAC1D;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"info.mjs","sources":["../../../../../src/render/dom/scroll/info.ts"],"sourcesContent":["import { progress, velocityPerSecond } from \"motion-utils\"\nimport { AxisScrollInfo, ScrollInfo } from \"./types\"\n\n/**\n * A time in milliseconds, beyond which we consider the scroll velocity to be 0.\n */\nconst maxElapsed = 50\n\nconst createAxisInfo = (): AxisScrollInfo => ({\n current: 0,\n offset: [],\n progress: 0,\n scrollLength: 0,\n targetOffset: 0,\n targetLength: 0,\n containerLength: 0,\n velocity: 0,\n})\n\nexport const createScrollInfo = (): ScrollInfo => ({\n time: 0,\n x: createAxisInfo(),\n y: createAxisInfo(),\n})\n\nconst keys = {\n x: {\n length: \"Width\",\n position: \"Left\",\n },\n y: {\n length: \"Height\",\n position: \"Top\",\n },\n} as const\n\nfunction updateAxisInfo(\n element: Element,\n axisName: \"x\" | \"y\",\n info: ScrollInfo,\n time: number\n) {\n const axis = info[axisName]\n const { length, position } = keys[axisName]\n\n const prev = axis.current\n const prevTime = info.time\n\n axis.current = element[`scroll${position}`]\n axis.scrollLength = element[`scroll${length}`] - element[`client${length}`]\n\n axis.offset.length = 0\n axis.offset[0] = 0\n axis.offset[1] = axis.scrollLength\n axis.progress = progress(0, axis.scrollLength, axis.current)\n\n const elapsed = time - prevTime\n axis.velocity =\n elapsed > maxElapsed\n ? 0\n : velocityPerSecond(axis.current - prev, elapsed)\n}\n\nexport function updateScrollInfo(\n element: Element,\n info: ScrollInfo,\n time: number\n) {\n updateAxisInfo(element, \"x\", info, time)\n updateAxisInfo(element, \"y\", info, time)\n info.time = time\n}\n"],"names":[],"mappings":";;AAGA;;AAEG;AACH,MAAM,UAAU,GAAG,EAAE
|
|
1
|
+
{"version":3,"file":"info.mjs","sources":["../../../../../src/render/dom/scroll/info.ts"],"sourcesContent":["import { progress, velocityPerSecond } from \"motion-utils\"\nimport { AxisScrollInfo, ScrollInfo } from \"./types\"\n\n/**\n * A time in milliseconds, beyond which we consider the scroll velocity to be 0.\n */\nconst maxElapsed = 50\n\nconst createAxisInfo = (): AxisScrollInfo => ({\n current: 0,\n offset: [],\n progress: 0,\n scrollLength: 0,\n targetOffset: 0,\n targetLength: 0,\n containerLength: 0,\n velocity: 0,\n})\n\nexport const createScrollInfo = (): ScrollInfo => ({\n time: 0,\n x: createAxisInfo(),\n y: createAxisInfo(),\n})\n\nconst keys = {\n x: {\n length: \"Width\",\n position: \"Left\",\n },\n y: {\n length: \"Height\",\n position: \"Top\",\n },\n} as const\n\nfunction updateAxisInfo(\n element: Element,\n axisName: \"x\" | \"y\",\n info: ScrollInfo,\n time: number\n) {\n const axis = info[axisName]\n const { length, position } = keys[axisName]\n\n const prev = axis.current\n const prevTime = info.time\n\n axis.current = element[`scroll${position}`]\n axis.scrollLength = element[`scroll${length}`] - element[`client${length}`]\n\n axis.offset.length = 0\n axis.offset[0] = 0\n axis.offset[1] = axis.scrollLength\n axis.progress = progress(0, axis.scrollLength, axis.current)\n\n const elapsed = time - prevTime\n axis.velocity =\n elapsed > maxElapsed\n ? 0\n : velocityPerSecond(axis.current - prev, elapsed)\n}\n\nexport function updateScrollInfo(\n element: Element,\n info: ScrollInfo,\n time: number\n) {\n updateAxisInfo(element, \"x\", info, time)\n updateAxisInfo(element, \"y\", info, time)\n info.time = time\n}\n"],"names":[],"mappings":";;AAGA;;AAEG;AACH,MAAM,UAAU,GAAG,EAAE;AAErB,MAAM,cAAc,GAAG,OAAuB;AAC1C,IAAA,OAAO,EAAE,CAAC;AACV,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,QAAQ,EAAE,CAAC;AACX,IAAA,YAAY,EAAE,CAAC;AACf,IAAA,YAAY,EAAE,CAAC;AACf,IAAA,YAAY,EAAE,CAAC;AACf,IAAA,eAAe,EAAE,CAAC;AAClB,IAAA,QAAQ,EAAE,CAAC;AACd,CAAA,CAAC;AAEK,MAAM,gBAAgB,GAAG,OAAmB;AAC/C,IAAA,IAAI,EAAE,CAAC;IACP,CAAC,EAAE,cAAc,EAAE;IACnB,CAAC,EAAE,cAAc,EAAE;AACtB,CAAA;AAED,MAAM,IAAI,GAAG;AACT,IAAA,CAAC,EAAE;AACC,QAAA,MAAM,EAAE,OAAO;AACf,QAAA,QAAQ,EAAE,MAAM;AACnB,KAAA;AACD,IAAA,CAAC,EAAE;AACC,QAAA,MAAM,EAAE,QAAQ;AAChB,QAAA,QAAQ,EAAE,KAAK;AAClB,KAAA;CACK;AAEV,SAAS,cAAc,CACnB,OAAgB,EAChB,QAAmB,EACnB,IAAgB,EAChB,IAAY,EAAA;AAEZ,IAAA,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC;IAC3B,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC;AAE3C,IAAA,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO;AACzB,IAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI;IAE1B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,CAAA,MAAA,EAAS,QAAQ,CAAA,CAAE,CAAC;AAC3C,IAAA,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,SAAS,MAAM,CAAA,CAAE,CAAC,GAAG,OAAO,CAAC,CAAA,MAAA,EAAS,MAAM,CAAA,CAAE,CAAC;AAE3E,IAAA,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;AACtB,IAAA,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC;IAClB,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,YAAY;AAClC,IAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC;AAE5D,IAAA,MAAM,OAAO,GAAG,IAAI,GAAG,QAAQ;AAC/B,IAAA,IAAI,CAAC,QAAQ;AACT,QAAA,OAAO,GAAG;AACN,cAAE;cACA,iBAAiB,CAAC,IAAI,CAAC,OAAO,GAAG,IAAI,EAAE,OAAO,CAAC;AAC7D;SAEgB,gBAAgB,CAC5B,OAAgB,EAChB,IAAgB,EAChB,IAAY,EAAA;IAEZ,cAAc,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC;IACxC,cAAc,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC;AACxC,IAAA,IAAI,CAAC,IAAI,GAAG,IAAI;AACpB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edge.mjs","sources":["../../../../../../src/render/dom/scroll/offsets/edge.ts"],"sourcesContent":["import { Edge, NamedEdges } from \"../types\"\n\nexport const namedEdges: Record<NamedEdges, number> = {\n start: 0,\n center: 0.5,\n end: 1,\n}\n\nexport function resolveEdge(edge: Edge, length: number, inset = 0) {\n let delta = 0\n\n /**\n * If we have this edge defined as a preset, replace the definition\n * with the numerical value.\n */\n if (edge in namedEdges) {\n edge = namedEdges[edge as NamedEdges]\n }\n\n /**\n * Handle unit values\n */\n if (typeof edge === \"string\") {\n const asNumber = parseFloat(edge)\n\n if (edge.endsWith(\"px\")) {\n delta = asNumber\n } else if (edge.endsWith(\"%\")) {\n edge = asNumber / 100\n } else if (edge.endsWith(\"vw\")) {\n delta = (asNumber / 100) * document.documentElement.clientWidth\n } else if (edge.endsWith(\"vh\")) {\n delta = (asNumber / 100) * document.documentElement.clientHeight\n } else {\n edge = asNumber\n }\n }\n\n /**\n * If the edge is defined as a number, handle as a progress value.\n */\n if (typeof edge === \"number\") {\n delta = length * edge\n }\n\n return inset + delta\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"edge.mjs","sources":["../../../../../../src/render/dom/scroll/offsets/edge.ts"],"sourcesContent":["import { Edge, NamedEdges } from \"../types\"\n\nexport const namedEdges: Record<NamedEdges, number> = {\n start: 0,\n center: 0.5,\n end: 1,\n}\n\nexport function resolveEdge(edge: Edge, length: number, inset = 0) {\n let delta = 0\n\n /**\n * If we have this edge defined as a preset, replace the definition\n * with the numerical value.\n */\n if (edge in namedEdges) {\n edge = namedEdges[edge as NamedEdges]\n }\n\n /**\n * Handle unit values\n */\n if (typeof edge === \"string\") {\n const asNumber = parseFloat(edge)\n\n if (edge.endsWith(\"px\")) {\n delta = asNumber\n } else if (edge.endsWith(\"%\")) {\n edge = asNumber / 100\n } else if (edge.endsWith(\"vw\")) {\n delta = (asNumber / 100) * document.documentElement.clientWidth\n } else if (edge.endsWith(\"vh\")) {\n delta = (asNumber / 100) * document.documentElement.clientHeight\n } else {\n edge = asNumber\n }\n }\n\n /**\n * If the edge is defined as a number, handle as a progress value.\n */\n if (typeof edge === \"number\") {\n delta = length * edge\n }\n\n return inset + delta\n}\n"],"names":[],"mappings":"AAEO,MAAM,UAAU,GAA+B;AAClD,IAAA,KAAK,EAAE,CAAC;AACR,IAAA,MAAM,EAAE,GAAG;AACX,IAAA,GAAG,EAAE,CAAC;;AAGJ,SAAU,WAAW,CAAC,IAAU,EAAE,MAAc,EAAE,KAAK,GAAG,CAAC,EAAA;IAC7D,IAAI,KAAK,GAAG,CAAC;AAEb;;;AAGG;AACH,IAAA,IAAI,IAAI,IAAI,UAAU,EAAE;AACpB,QAAA,IAAI,GAAG,UAAU,CAAC,IAAkB,CAAC;IACzC;AAEA;;AAEG;AACH,IAAA,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;AAC1B,QAAA,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC;AAEjC,QAAA,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YACrB,KAAK,GAAG,QAAQ;QACpB;AAAO,aAAA,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;AAC3B,YAAA,IAAI,GAAG,QAAQ,GAAG,GAAG;QACzB;AAAO,aAAA,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;AAC5B,YAAA,KAAK,GAAG,CAAC,QAAQ,GAAG,GAAG,IAAI,QAAQ,CAAC,eAAe,CAAC,WAAW;QACnE;AAAO,aAAA,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;AAC5B,YAAA,KAAK,GAAG,CAAC,QAAQ,GAAG,GAAG,IAAI,QAAQ,CAAC,eAAe,CAAC,YAAY;QACpE;aAAO;YACH,IAAI,GAAG,QAAQ;QACnB;IACJ;AAEA;;AAEG;AACH,IAAA,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;AAC1B,QAAA,KAAK,GAAG,MAAM,GAAG,IAAI;IACzB;IAEA,OAAO,KAAK,GAAG,KAAK;AACxB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../../../../src/render/dom/scroll/offsets/index.ts"],"sourcesContent":["import { defaultOffset, interpolate } from \"motion-dom\"\nimport { clamp } from \"motion-utils\"\nimport { ScrollInfo, ScrollInfoOptions } from \"../types\"\nimport { calcInset } from \"./inset\"\nimport { resolveOffset } from \"./offset\"\nimport { ScrollOffset } from \"./presets\"\n\nconst point = { x: 0, y: 0 }\n\nfunction getTargetSize(target: Element) {\n return \"getBBox\" in target && target.tagName !== \"svg\"\n ? (target as SVGGraphicsElement).getBBox()\n : { width: target.clientWidth, height: target.clientHeight }\n}\n\nexport function resolveOffsets(\n container: Element,\n info: ScrollInfo,\n options: ScrollInfoOptions\n) {\n const { offset: offsetDefinition = ScrollOffset.All } = options\n const { target = container, axis = \"y\" } = options\n const lengthLabel = axis === \"y\" ? \"height\" : \"width\"\n\n const inset = target !== container ? calcInset(target, container) : point\n\n /**\n * Measure the target and container. If they're the same thing then we\n * use the container's scrollWidth/Height as the target, from there\n * all other calculations can remain the same.\n */\n const targetSize =\n target === container\n ? { width: container.scrollWidth, height: container.scrollHeight }\n : getTargetSize(target)\n\n const containerSize = {\n width: container.clientWidth,\n height: container.clientHeight,\n }\n\n /**\n * Reset the length of the resolved offset array rather than creating a new one.\n * TODO: More reusable data structures for targetSize/containerSize would also be good.\n */\n info[axis].offset.length = 0\n\n /**\n * Populate the offset array by resolving the user's offset definition into\n * a list of pixel scroll offets.\n */\n let hasChanged = !info[axis].interpolate\n\n const numOffsets = offsetDefinition.length\n for (let i = 0; i < numOffsets; i++) {\n const offset = resolveOffset(\n offsetDefinition[i],\n containerSize[lengthLabel],\n targetSize[lengthLabel],\n inset[axis]\n )\n\n if (!hasChanged && offset !== info[axis].interpolatorOffsets![i]) {\n hasChanged = true\n }\n\n info[axis].offset[i] = offset\n }\n\n /**\n * If the pixel scroll offsets have changed, create a new interpolator function\n * to map scroll value into a progress.\n */\n if (hasChanged) {\n info[axis].interpolate = interpolate(\n info[axis].offset,\n defaultOffset(offsetDefinition),\n { clamp: false }\n )\n\n info[axis].interpolatorOffsets = [...info[axis].offset]\n }\n\n info[axis].progress = clamp(\n 0,\n 1,\n info[axis].interpolate!(info[axis].current)\n )\n}\n"],"names":[],"mappings":";;;;;;AAOA,MAAM,KAAK,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../../../src/render/dom/scroll/offsets/index.ts"],"sourcesContent":["import { defaultOffset, interpolate } from \"motion-dom\"\nimport { clamp } from \"motion-utils\"\nimport { ScrollInfo, ScrollInfoOptions } from \"../types\"\nimport { calcInset } from \"./inset\"\nimport { resolveOffset } from \"./offset\"\nimport { ScrollOffset } from \"./presets\"\n\nconst point = { x: 0, y: 0 }\n\nfunction getTargetSize(target: Element) {\n return \"getBBox\" in target && target.tagName !== \"svg\"\n ? (target as SVGGraphicsElement).getBBox()\n : { width: target.clientWidth, height: target.clientHeight }\n}\n\nexport function resolveOffsets(\n container: Element,\n info: ScrollInfo,\n options: ScrollInfoOptions\n) {\n const { offset: offsetDefinition = ScrollOffset.All } = options\n const { target = container, axis = \"y\" } = options\n const lengthLabel = axis === \"y\" ? \"height\" : \"width\"\n\n const inset = target !== container ? calcInset(target, container) : point\n\n /**\n * Measure the target and container. If they're the same thing then we\n * use the container's scrollWidth/Height as the target, from there\n * all other calculations can remain the same.\n */\n const targetSize =\n target === container\n ? { width: container.scrollWidth, height: container.scrollHeight }\n : getTargetSize(target)\n\n const containerSize = {\n width: container.clientWidth,\n height: container.clientHeight,\n }\n\n /**\n * Reset the length of the resolved offset array rather than creating a new one.\n * TODO: More reusable data structures for targetSize/containerSize would also be good.\n */\n info[axis].offset.length = 0\n\n /**\n * Populate the offset array by resolving the user's offset definition into\n * a list of pixel scroll offets.\n */\n let hasChanged = !info[axis].interpolate\n\n const numOffsets = offsetDefinition.length\n for (let i = 0; i < numOffsets; i++) {\n const offset = resolveOffset(\n offsetDefinition[i],\n containerSize[lengthLabel],\n targetSize[lengthLabel],\n inset[axis]\n )\n\n if (!hasChanged && offset !== info[axis].interpolatorOffsets![i]) {\n hasChanged = true\n }\n\n info[axis].offset[i] = offset\n }\n\n /**\n * If the pixel scroll offsets have changed, create a new interpolator function\n * to map scroll value into a progress.\n */\n if (hasChanged) {\n info[axis].interpolate = interpolate(\n info[axis].offset,\n defaultOffset(offsetDefinition),\n { clamp: false }\n )\n\n info[axis].interpolatorOffsets = [...info[axis].offset]\n }\n\n info[axis].progress = clamp(\n 0,\n 1,\n info[axis].interpolate!(info[axis].current)\n )\n}\n"],"names":[],"mappings":";;;;;;AAOA,MAAM,KAAK,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;AAE5B,SAAS,aAAa,CAAC,MAAe,EAAA;IAClC,OAAO,SAAS,IAAI,MAAM,IAAI,MAAM,CAAC,OAAO,KAAK;AAC7C,UAAG,MAA6B,CAAC,OAAO;AACxC,UAAE,EAAE,KAAK,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,YAAY,EAAE;AACpE;SAEgB,cAAc,CAC1B,SAAkB,EAClB,IAAgB,EAChB,OAA0B,EAAA;IAE1B,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,YAAY,CAAC,GAAG,EAAE,GAAG,OAAO;IAC/D,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,GAAG,GAAG,EAAE,GAAG,OAAO;AAClD,IAAA,MAAM,WAAW,GAAG,IAAI,KAAK,GAAG,GAAG,QAAQ,GAAG,OAAO;AAErD,IAAA,MAAM,KAAK,GAAG,MAAM,KAAK,SAAS,GAAG,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,KAAK;AAEzE;;;;AAIG;AACH,IAAA,MAAM,UAAU,GACZ,MAAM,KAAK;AACP,UAAE,EAAE,KAAK,EAAE,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,CAAC,YAAY;AAChE,UAAE,aAAa,CAAC,MAAM,CAAC;AAE/B,IAAA,MAAM,aAAa,GAAG;QAClB,KAAK,EAAE,SAAS,CAAC,WAAW;QAC5B,MAAM,EAAE,SAAS,CAAC,YAAY;KACjC;AAED;;;AAGG;IACH,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;AAE5B;;;AAGG;IACH,IAAI,UAAU,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW;AAExC,IAAA,MAAM,UAAU,GAAG,gBAAgB,CAAC,MAAM;AAC1C,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,EAAE,CAAC,EAAE,EAAE;QACjC,MAAM,MAAM,GAAG,aAAa,CACxB,gBAAgB,CAAC,CAAC,CAAC,EACnB,aAAa,CAAC,WAAW,CAAC,EAC1B,UAAU,CAAC,WAAW,CAAC,EACvB,KAAK,CAAC,IAAI,CAAC,CACd;AAED,QAAA,IAAI,CAAC,UAAU,IAAI,MAAM,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,mBAAoB,CAAC,CAAC,CAAC,EAAE;YAC9D,UAAU,GAAG,IAAI;QACrB;QAEA,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM;IACjC;AAEA;;;AAGG;IACH,IAAI,UAAU,EAAE;QACZ,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,GAAG,WAAW,CAChC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,EACjB,aAAa,CAAC,gBAAgB,CAAC,EAC/B,EAAE,KAAK,EAAE,KAAK,EAAE,CACnB;AAED,QAAA,IAAI,CAAC,IAAI,CAAC,CAAC,mBAAmB,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;IAC3D;IAEA,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,GAAG,KAAK,CACvB,CAAC,EACD,CAAC,EACD,IAAI,CAAC,IAAI,CAAC,CAAC,WAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAC9C;AACL;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inset.mjs","sources":["../../../../../../src/render/dom/scroll/offsets/inset.ts"],"sourcesContent":["import { isHTMLElement } from \"motion-dom\"\n\nexport function calcInset(element: Element, container: Element) {\n const inset = { x: 0, y: 0 }\n\n let current: Element | null = element\n while (current && current !== container) {\n if (isHTMLElement(current)) {\n inset.x += current.offsetLeft\n inset.y += current.offsetTop\n current = current.offsetParent\n } else if (current.tagName === \"svg\") {\n /**\n * This isn't an ideal approach to measuring the offset of <svg /> tags.\n * It would be preferable, given they behave like HTMLElements in most ways\n * to use offsetLeft/Top. But these don't exist on <svg />. Likewise we\n * can't use .getBBox() like most SVG elements as these provide the offset\n * relative to the SVG itself, which for <svg /> is usually 0x0.\n */\n const svgBoundingBox = current.getBoundingClientRect()\n current = current.parentElement!\n const parentBoundingBox = current.getBoundingClientRect()\n inset.x += svgBoundingBox.left - parentBoundingBox.left\n inset.y += svgBoundingBox.top - parentBoundingBox.top\n } else if (current instanceof SVGGraphicsElement) {\n const { x, y } = current.getBBox()\n inset.x += x\n inset.y += y\n\n let svg: SVGElement | null = null\n let parent: SVGElement = current.parentNode as SVGElement\n while (!svg) {\n if (parent.tagName === \"svg\") {\n svg = parent\n }\n parent = current.parentNode as SVGElement\n }\n current = svg\n } else {\n break\n }\n }\n\n return inset\n}\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"inset.mjs","sources":["../../../../../../src/render/dom/scroll/offsets/inset.ts"],"sourcesContent":["import { isHTMLElement } from \"motion-dom\"\n\nexport function calcInset(element: Element, container: Element) {\n const inset = { x: 0, y: 0 }\n\n let current: Element | null = element\n while (current && current !== container) {\n if (isHTMLElement(current)) {\n inset.x += current.offsetLeft\n inset.y += current.offsetTop\n current = current.offsetParent\n } else if (current.tagName === \"svg\") {\n /**\n * This isn't an ideal approach to measuring the offset of <svg /> tags.\n * It would be preferable, given they behave like HTMLElements in most ways\n * to use offsetLeft/Top. But these don't exist on <svg />. Likewise we\n * can't use .getBBox() like most SVG elements as these provide the offset\n * relative to the SVG itself, which for <svg /> is usually 0x0.\n */\n const svgBoundingBox = current.getBoundingClientRect()\n current = current.parentElement!\n const parentBoundingBox = current.getBoundingClientRect()\n inset.x += svgBoundingBox.left - parentBoundingBox.left\n inset.y += svgBoundingBox.top - parentBoundingBox.top\n } else if (current instanceof SVGGraphicsElement) {\n const { x, y } = current.getBBox()\n inset.x += x\n inset.y += y\n\n let svg: SVGElement | null = null\n let parent: SVGElement = current.parentNode as SVGElement\n while (!svg) {\n if (parent.tagName === \"svg\") {\n svg = parent\n }\n parent = current.parentNode as SVGElement\n }\n current = svg\n } else {\n break\n }\n }\n\n return inset\n}\n"],"names":[],"mappings":";;AAEM,SAAU,SAAS,CAAC,OAAgB,EAAE,SAAkB,EAAA;IAC1D,MAAM,KAAK,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;IAE5B,IAAI,OAAO,GAAmB,OAAO;AACrC,IAAA,OAAO,OAAO,IAAI,OAAO,KAAK,SAAS,EAAE;AACrC,QAAA,IAAI,aAAa,CAAC,OAAO,CAAC,EAAE;AACxB,YAAA,KAAK,CAAC,CAAC,IAAI,OAAO,CAAC,UAAU;AAC7B,YAAA,KAAK,CAAC,CAAC,IAAI,OAAO,CAAC,SAAS;AAC5B,YAAA,OAAO,GAAG,OAAO,CAAC,YAAY;QAClC;AAAO,aAAA,IAAI,OAAO,CAAC,OAAO,KAAK,KAAK,EAAE;AAClC;;;;;;AAMG;AACH,YAAA,MAAM,cAAc,GAAG,OAAO,CAAC,qBAAqB,EAAE;AACtD,YAAA,OAAO,GAAG,OAAO,CAAC,aAAc;AAChC,YAAA,MAAM,iBAAiB,GAAG,OAAO,CAAC,qBAAqB,EAAE;YACzD,KAAK,CAAC,CAAC,IAAI,cAAc,CAAC,IAAI,GAAG,iBAAiB,CAAC,IAAI;YACvD,KAAK,CAAC,CAAC,IAAI,cAAc,CAAC,GAAG,GAAG,iBAAiB,CAAC,GAAG;QACzD;AAAO,aAAA,IAAI,OAAO,YAAY,kBAAkB,EAAE;YAC9C,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE;AAClC,YAAA,KAAK,CAAC,CAAC,IAAI,CAAC;AACZ,YAAA,KAAK,CAAC,CAAC,IAAI,CAAC;YAEZ,IAAI,GAAG,GAAsB,IAAI;AACjC,YAAA,IAAI,MAAM,GAAe,OAAO,CAAC,UAAwB;YACzD,OAAO,CAAC,GAAG,EAAE;AACT,gBAAA,IAAI,MAAM,CAAC,OAAO,KAAK,KAAK,EAAE;oBAC1B,GAAG,GAAG,MAAM;gBAChB;AACA,gBAAA,MAAM,GAAG,OAAO,CAAC,UAAwB;YAC7C;YACA,OAAO,GAAG,GAAG;QACjB;aAAO;YACH;QACJ;IACJ;AAEA,IAAA,OAAO,KAAK;AAChB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"offset.mjs","sources":["../../../../../../src/render/dom/scroll/offsets/offset.ts"],"sourcesContent":["import { Edge, EdgeString, Intersection, ProgressIntersection } from \"../types\"\nimport { namedEdges, resolveEdge } from \"./edge\"\n\nconst defaultOffset: ProgressIntersection = [0, 0]\n\nexport function resolveOffset(\n offset: Edge | Intersection | ProgressIntersection,\n containerLength: number,\n targetLength: number,\n targetInset: number\n) {\n let offsetDefinition: ProgressIntersection | [EdgeString, EdgeString] =\n Array.isArray(offset) ? offset : defaultOffset\n\n let targetPoint = 0\n let containerPoint = 0\n\n if (typeof offset === \"number\") {\n /**\n * If we're provided offset: [0, 0.5, 1] then each number x should become\n * [x, x], so we default to the behaviour of mapping 0 => 0 of both target\n * and container etc.\n */\n offsetDefinition = [offset, offset]\n } else if (typeof offset === \"string\") {\n offset = offset.trim() as EdgeString\n\n if (offset.includes(\" \")) {\n offsetDefinition = offset.split(\" \") as [EdgeString, EdgeString]\n } else {\n /**\n * If we're provided a definition like \"100px\" then we want to apply\n * that only to the top of the target point, leaving the container at 0.\n * Whereas a named offset like \"end\" should be applied to both.\n */\n offsetDefinition = [offset, namedEdges[offset as keyof typeof namedEdges] ? offset : `0`]\n }\n }\n\n targetPoint = resolveEdge(offsetDefinition[0], targetLength, targetInset)\n containerPoint = resolveEdge(offsetDefinition[1], containerLength)\n\n return targetPoint - containerPoint\n}\n"],"names":[],"mappings":";;AAGA,MAAM,aAAa,GAAyB,CAAC,CAAC,EAAE,CAAC,CAAC
|
|
1
|
+
{"version":3,"file":"offset.mjs","sources":["../../../../../../src/render/dom/scroll/offsets/offset.ts"],"sourcesContent":["import { Edge, EdgeString, Intersection, ProgressIntersection } from \"../types\"\nimport { namedEdges, resolveEdge } from \"./edge\"\n\nconst defaultOffset: ProgressIntersection = [0, 0]\n\nexport function resolveOffset(\n offset: Edge | Intersection | ProgressIntersection,\n containerLength: number,\n targetLength: number,\n targetInset: number\n) {\n let offsetDefinition: ProgressIntersection | [EdgeString, EdgeString] =\n Array.isArray(offset) ? offset : defaultOffset\n\n let targetPoint = 0\n let containerPoint = 0\n\n if (typeof offset === \"number\") {\n /**\n * If we're provided offset: [0, 0.5, 1] then each number x should become\n * [x, x], so we default to the behaviour of mapping 0 => 0 of both target\n * and container etc.\n */\n offsetDefinition = [offset, offset]\n } else if (typeof offset === \"string\") {\n offset = offset.trim() as EdgeString\n\n if (offset.includes(\" \")) {\n offsetDefinition = offset.split(\" \") as [EdgeString, EdgeString]\n } else {\n /**\n * If we're provided a definition like \"100px\" then we want to apply\n * that only to the top of the target point, leaving the container at 0.\n * Whereas a named offset like \"end\" should be applied to both.\n */\n offsetDefinition = [offset, namedEdges[offset as keyof typeof namedEdges] ? offset : `0`]\n }\n }\n\n targetPoint = resolveEdge(offsetDefinition[0], targetLength, targetInset)\n containerPoint = resolveEdge(offsetDefinition[1], containerLength)\n\n return targetPoint - containerPoint\n}\n"],"names":[],"mappings":";;AAGA,MAAM,aAAa,GAAyB,CAAC,CAAC,EAAE,CAAC,CAAC;AAE5C,SAAU,aAAa,CACzB,MAAkD,EAClD,eAAuB,EACvB,YAAoB,EACpB,WAAmB,EAAA;AAEnB,IAAA,IAAI,gBAAgB,GAChB,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,aAAa;IAElD,IAAI,WAAW,GAAG,CAAC;IACnB,IAAI,cAAc,GAAG,CAAC;AAEtB,IAAA,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;AAC5B;;;;AAIG;AACH,QAAA,gBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;IACvC;AAAO,SAAA,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;AACnC,QAAA,MAAM,GAAG,MAAM,CAAC,IAAI,EAAgB;AAEpC,QAAA,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;AACtB,YAAA,gBAAgB,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAA6B;QACpE;aAAO;AACH;;;;AAIG;AACH,YAAA,gBAAgB,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,MAAiC,CAAC,GAAG,MAAM,GAAG,CAAA,CAAA,CAAG,CAAC;QAC7F;IACJ;AAEA,IAAA,WAAW,GAAG,WAAW,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,WAAW,CAAC;IACzE,cAAc,GAAG,WAAW,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,eAAe,CAAC;IAElE,OAAO,WAAW,GAAG,cAAc;AACvC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presets.mjs","sources":["../../../../../../src/render/dom/scroll/offsets/presets.ts"],"sourcesContent":["import { ProgressIntersection } from \"../types\"\n\nexport const ScrollOffset: Record<string, ProgressIntersection[]> = {\n Enter: [\n [0, 1],\n [1, 1],\n ],\n Exit: [\n [0, 0],\n [1, 0],\n ],\n Any: [\n [1, 0],\n [0, 1],\n ],\n All: [\n [0, 0],\n [1, 1],\n ],\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"presets.mjs","sources":["../../../../../../src/render/dom/scroll/offsets/presets.ts"],"sourcesContent":["import { ProgressIntersection } from \"../types\"\n\nexport const ScrollOffset: Record<string, ProgressIntersection[]> = {\n Enter: [\n [0, 1],\n [1, 1],\n ],\n Exit: [\n [0, 0],\n [1, 0],\n ],\n Any: [\n [1, 0],\n [0, 1],\n ],\n All: [\n [0, 0],\n [1, 1],\n ],\n}\n"],"names":[],"mappings":"AAEO,MAAM,YAAY,GAA2C;AAClE,IAYA,GAAG,EAAE;QACH,CAAC,CAAC,EAAE,CAAC,CAAC;QACN,CAAC,CAAC,EAAE,CAAC,CAAC;AACP,KAAA;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"on-scroll-handler.mjs","sources":["../../../../../src/render/dom/scroll/on-scroll-handler.ts"],"sourcesContent":["import { warnOnce } from \"motion-utils\"\nimport { updateScrollInfo } from \"./info\"\nimport { resolveOffsets } from \"./offsets/index\"\nimport {\n OnScrollHandler,\n OnScrollInfo,\n ScrollInfo,\n ScrollInfoOptions,\n} from \"./types\"\n\nfunction measure(\n container: Element,\n target: Element = container,\n info: ScrollInfo\n) {\n /**\n * Find inset of target within scrollable container\n */\n info.x.targetOffset = 0\n info.y.targetOffset = 0\n if (target !== container) {\n let node = target as HTMLElement\n while (node && node !== container) {\n info.x.targetOffset += node.offsetLeft\n info.y.targetOffset += node.offsetTop\n node = node.offsetParent as HTMLElement\n }\n }\n\n info.x.targetLength =\n target === container ? target.scrollWidth : target.clientWidth\n info.y.targetLength =\n target === container ? target.scrollHeight : target.clientHeight\n info.x.containerLength = container.clientWidth\n info.y.containerLength = container.clientHeight\n\n /**\n * In development mode ensure scroll containers aren't position: static as this makes\n * it difficult to measure their relative positions.\n */\n if (process.env.NODE_ENV !== \"production\") {\n if (container && target && target !== container) {\n warnOnce(\n getComputedStyle(container).position !== \"static\",\n \"Please ensure that the container has a non-static position, like 'relative', 'fixed', or 'absolute' to ensure scroll offset is calculated correctly.\"\n )\n }\n }\n}\n\nexport function createOnScrollHandler(\n element: Element,\n onScroll: OnScrollInfo,\n info: ScrollInfo,\n options: ScrollInfoOptions = {}\n): OnScrollHandler {\n return {\n measure: (time) => {\n measure(element, options.target, info)\n updateScrollInfo(element, info, time)\n\n if (options.offset || options.target) {\n resolveOffsets(element, info, options)\n }\n },\n notify: () => onScroll(info),\n }\n}\n"],"names":[],"mappings":";;;;AAUA,SAAS,OAAO,CACZ,SAAkB,EAClB,
|
|
1
|
+
{"version":3,"file":"on-scroll-handler.mjs","sources":["../../../../../src/render/dom/scroll/on-scroll-handler.ts"],"sourcesContent":["import { warnOnce } from \"motion-utils\"\nimport { updateScrollInfo } from \"./info\"\nimport { resolveOffsets } from \"./offsets/index\"\nimport {\n OnScrollHandler,\n OnScrollInfo,\n ScrollInfo,\n ScrollInfoOptions,\n} from \"./types\"\n\nfunction measure(\n container: Element,\n target: Element = container,\n info: ScrollInfo\n) {\n /**\n * Find inset of target within scrollable container\n */\n info.x.targetOffset = 0\n info.y.targetOffset = 0\n if (target !== container) {\n let node = target as HTMLElement\n while (node && node !== container) {\n info.x.targetOffset += node.offsetLeft\n info.y.targetOffset += node.offsetTop\n node = node.offsetParent as HTMLElement\n }\n }\n\n info.x.targetLength =\n target === container ? target.scrollWidth : target.clientWidth\n info.y.targetLength =\n target === container ? target.scrollHeight : target.clientHeight\n info.x.containerLength = container.clientWidth\n info.y.containerLength = container.clientHeight\n\n /**\n * In development mode ensure scroll containers aren't position: static as this makes\n * it difficult to measure their relative positions.\n */\n if (process.env.NODE_ENV !== \"production\") {\n if (container && target && target !== container) {\n warnOnce(\n getComputedStyle(container).position !== \"static\",\n \"Please ensure that the container has a non-static position, like 'relative', 'fixed', or 'absolute' to ensure scroll offset is calculated correctly.\"\n )\n }\n }\n}\n\nexport function createOnScrollHandler(\n element: Element,\n onScroll: OnScrollInfo,\n info: ScrollInfo,\n options: ScrollInfoOptions = {}\n): OnScrollHandler {\n return {\n measure: (time) => {\n measure(element, options.target, info)\n updateScrollInfo(element, info, time)\n\n if (options.offset || options.target) {\n resolveOffsets(element, info, options)\n }\n },\n notify: () => onScroll(info),\n }\n}\n"],"names":[],"mappings":";;;;AAUA,SAAS,OAAO,CACZ,SAAkB,EAClB,MAAA,GAAkB,SAAS,EAC3B,IAAgB,EAAA;AAEhB;;AAEG;AACH,IAAA,IAAI,CAAC,CAAC,CAAC,YAAY,GAAG,CAAC;AACvB,IAAA,IAAI,CAAC,CAAC,CAAC,YAAY,GAAG,CAAC;AACvB,IAAA,IAAI,MAAM,KAAK,SAAS,EAAE;QACtB,IAAI,IAAI,GAAG,MAAqB;AAChC,QAAA,OAAO,IAAI,IAAI,IAAI,KAAK,SAAS,EAAE;YAC/B,IAAI,CAAC,CAAC,CAAC,YAAY,IAAI,IAAI,CAAC,UAAU;YACtC,IAAI,CAAC,CAAC,CAAC,YAAY,IAAI,IAAI,CAAC,SAAS;AACrC,YAAA,IAAI,GAAG,IAAI,CAAC,YAA2B;QAC3C;IACJ;IAEA,IAAI,CAAC,CAAC,CAAC,YAAY;AACf,QAAA,MAAM,KAAK,SAAS,GAAG,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW;IAClE,IAAI,CAAC,CAAC,CAAC,YAAY;AACf,QAAA,MAAM,KAAK,SAAS,GAAG,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY;IACpE,IAAI,CAAC,CAAC,CAAC,eAAe,GAAG,SAAS,CAAC,WAAW;IAC9C,IAAI,CAAC,CAAC,CAAC,eAAe,GAAG,SAAS,CAAC,YAAY;AAE/C;;;AAGG;IACH,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QACvC,IAAI,SAAS,IAAI,MAAM,IAAI,MAAM,KAAK,SAAS,EAAE;AAC7C,YAAA,QAAQ,CACJ,gBAAgB,CAAC,SAAS,CAAC,CAAC,QAAQ,KAAK,QAAQ,EACjD,sJAAsJ,CACzJ;QACL;IACJ;AACJ;AAEM,SAAU,qBAAqB,CACjC,OAAgB,EAChB,QAAsB,EACtB,IAAgB,EAChB,OAAA,GAA6B,EAAE,EAAA;IAE/B,OAAO;AACH,QAAA,OAAO,EAAE,CAAC,IAAI,KAAI;YACd,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC;AACtC,YAAA,gBAAgB,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC;YAErC,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,EAAE;AAClC,gBAAA,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC;YAC1C;QACJ,CAAC;AACD,QAAA,MAAM,EAAE,MAAM,QAAQ,CAAC,IAAI,CAAC;KAC/B;AACL;;;;"}
|
|
@@ -46,11 +46,11 @@ function scrollInfo(onScroll, { container = document.scrollingElement, trackCont
|
|
|
46
46
|
const listener = () => frame.read(measureAll);
|
|
47
47
|
scrollListeners.set(container, listener);
|
|
48
48
|
const target = getEventTarget(container);
|
|
49
|
-
window.addEventListener("resize", listener
|
|
49
|
+
window.addEventListener("resize", listener);
|
|
50
50
|
if (container !== document.documentElement) {
|
|
51
51
|
resizeListeners.set(container, resize(container, listener));
|
|
52
52
|
}
|
|
53
|
-
target.addEventListener("scroll", listener
|
|
53
|
+
target.addEventListener("scroll", listener);
|
|
54
54
|
listener();
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"track.mjs","sources":["../../../../../src/render/dom/scroll/track.ts"],"sourcesContent":["import { cancelFrame, frame, frameData, resize, Process } from \"motion-dom\"\nimport { noop } from \"motion-utils\"\nimport { createScrollInfo } from \"./info\"\nimport { createOnScrollHandler } from \"./on-scroll-handler\"\nimport { OnScrollHandler, OnScrollInfo, ScrollInfoOptions } from \"./types\"\n\nconst scrollListeners = new WeakMap<Element, VoidFunction>()\nconst resizeListeners = new WeakMap<Element, VoidFunction>()\nconst onScrollHandlers = new WeakMap<Element, Set<OnScrollHandler>>()\nconst scrollSize = new WeakMap<Element, { width: number; height: number }>()\nconst dimensionCheckProcesses = new WeakMap<Element, Process>()\n\nexport type ScrollTargets = Array<HTMLElement>\n\nconst getEventTarget = (element: Element) =>\n element === document.scrollingElement ? window : element\n\nexport function scrollInfo(\n onScroll: OnScrollInfo,\n {\n container = document.scrollingElement as Element,\n trackContentSize = false,\n ...options\n }: ScrollInfoOptions = {}\n) {\n if (!container) return noop as VoidFunction\n\n let containerHandlers = onScrollHandlers.get(container)\n\n /**\n * Get the onScroll handlers for this container.\n * If one isn't found, create a new one.\n */\n if (!containerHandlers) {\n containerHandlers = new Set()\n onScrollHandlers.set(container, containerHandlers)\n }\n\n /**\n * Create a new onScroll handler for the provided callback.\n */\n const info = createScrollInfo()\n const containerHandler = createOnScrollHandler(\n container,\n onScroll,\n info,\n options\n )\n containerHandlers.add(containerHandler)\n\n /**\n * Check if there's a scroll event listener for this container.\n * If not, create one.\n */\n if (!scrollListeners.has(container)) {\n const measureAll = () => {\n for (const handler of containerHandlers) {\n handler.measure(frameData.timestamp)\n }\n\n frame.preUpdate(notifyAll)\n }\n\n const notifyAll = () => {\n for (const handler of containerHandlers) {\n handler.notify()\n }\n }\n\n const listener = () => frame.read(measureAll)\n\n scrollListeners.set(container, listener)\n\n const target = getEventTarget(container)\n window.addEventListener(\"resize\", listener
|
|
1
|
+
{"version":3,"file":"track.mjs","sources":["../../../../../src/render/dom/scroll/track.ts"],"sourcesContent":["import { cancelFrame, frame, frameData, resize, Process } from \"motion-dom\"\nimport { noop } from \"motion-utils\"\nimport { createScrollInfo } from \"./info\"\nimport { createOnScrollHandler } from \"./on-scroll-handler\"\nimport { OnScrollHandler, OnScrollInfo, ScrollInfoOptions } from \"./types\"\n\nconst scrollListeners = new WeakMap<Element, VoidFunction>()\nconst resizeListeners = new WeakMap<Element, VoidFunction>()\nconst onScrollHandlers = new WeakMap<Element, Set<OnScrollHandler>>()\nconst scrollSize = new WeakMap<Element, { width: number; height: number }>()\nconst dimensionCheckProcesses = new WeakMap<Element, Process>()\n\nexport type ScrollTargets = Array<HTMLElement>\n\nconst getEventTarget = (element: Element) =>\n element === document.scrollingElement ? window : element\n\nexport function scrollInfo(\n onScroll: OnScrollInfo,\n {\n container = document.scrollingElement as Element,\n trackContentSize = false,\n ...options\n }: ScrollInfoOptions = {}\n) {\n if (!container) return noop as VoidFunction\n\n let containerHandlers = onScrollHandlers.get(container)\n\n /**\n * Get the onScroll handlers for this container.\n * If one isn't found, create a new one.\n */\n if (!containerHandlers) {\n containerHandlers = new Set()\n onScrollHandlers.set(container, containerHandlers)\n }\n\n /**\n * Create a new onScroll handler for the provided callback.\n */\n const info = createScrollInfo()\n const containerHandler = createOnScrollHandler(\n container,\n onScroll,\n info,\n options\n )\n containerHandlers.add(containerHandler)\n\n /**\n * Check if there's a scroll event listener for this container.\n * If not, create one.\n */\n if (!scrollListeners.has(container)) {\n const measureAll = () => {\n for (const handler of containerHandlers) {\n handler.measure(frameData.timestamp)\n }\n\n frame.preUpdate(notifyAll)\n }\n\n const notifyAll = () => {\n for (const handler of containerHandlers) {\n handler.notify()\n }\n }\n\n const listener = () => frame.read(measureAll)\n\n scrollListeners.set(container, listener)\n\n const target = getEventTarget(container)\n window.addEventListener(\"resize\", listener)\n if (container !== document.documentElement) {\n resizeListeners.set(container, resize(container, listener))\n }\n\n target.addEventListener(\"scroll\", listener)\n\n listener()\n }\n\n /**\n * Enable content size tracking if requested and not already enabled.\n */\n if (trackContentSize && !dimensionCheckProcesses.has(container)) {\n const listener = scrollListeners.get(container)!\n\n // Store initial scroll dimensions (object is reused to avoid allocation)\n const size = {\n width: container.scrollWidth,\n height: container.scrollHeight,\n }\n scrollSize.set(container, size)\n\n // Add frame-based scroll dimension checking to detect content changes\n const checkScrollDimensions: Process = () => {\n const newWidth = container.scrollWidth\n const newHeight = container.scrollHeight\n\n if (size.width !== newWidth || size.height !== newHeight) {\n listener()\n size.width = newWidth\n size.height = newHeight\n }\n }\n\n // Schedule with keepAlive=true to run every frame\n const dimensionCheckProcess = frame.read(checkScrollDimensions, true)\n dimensionCheckProcesses.set(container, dimensionCheckProcess)\n }\n\n const listener = scrollListeners.get(container)!\n frame.read(listener, false, true)\n\n return () => {\n cancelFrame(listener)\n\n /**\n * Check if we even have any handlers for this container.\n */\n const currentHandlers = onScrollHandlers.get(container)\n if (!currentHandlers) return\n\n currentHandlers.delete(containerHandler)\n\n if (currentHandlers.size) return\n\n /**\n * If no more handlers, remove the scroll listener too.\n */\n const scrollListener = scrollListeners.get(container)\n scrollListeners.delete(container)\n\n if (scrollListener) {\n getEventTarget(container).removeEventListener(\n \"scroll\",\n scrollListener\n )\n resizeListeners.get(container)?.()\n window.removeEventListener(\"resize\", scrollListener)\n }\n\n // Clean up scroll dimension checking\n const dimensionCheckProcess = dimensionCheckProcesses.get(container)\n if (dimensionCheckProcess) {\n cancelFrame(dimensionCheckProcess)\n dimensionCheckProcesses.delete(container)\n }\n scrollSize.delete(container)\n }\n}\n"],"names":[],"mappings":";;;;;AAMA,MAAM,eAAe,GAAG,IAAI,OAAO,EAAyB;AAC5D,MAAM,eAAe,GAAG,IAAI,OAAO,EAAyB;AAC5D,MAAM,gBAAgB,GAAG,IAAI,OAAO,EAAiC;AACrE,MAAM,UAAU,GAAG,IAAI,OAAO,EAA8C;AAC5E,MAAM,uBAAuB,GAAG,IAAI,OAAO,EAAoB;AAI/D,MAAM,cAAc,GAAG,CAAC,OAAgB,KACpC,OAAO,KAAK,QAAQ,CAAC,gBAAgB,GAAG,MAAM,GAAG,OAAO;SAE5C,UAAU,CACtB,QAAsB,EACtB,EACI,SAAS,GAAG,QAAQ,CAAC,gBAA2B,EAChD,gBAAgB,GAAG,KAAK,EACxB,GAAG,OAAO,KACS,EAAE,EAAA;AAEzB,IAAA,IAAI,CAAC,SAAS;AAAE,QAAA,OAAO,IAAoB;IAE3C,IAAI,iBAAiB,GAAG,gBAAgB,CAAC,GAAG,CAAC,SAAS,CAAC;AAEvD;;;AAGG;IACH,IAAI,CAAC,iBAAiB,EAAE;AACpB,QAAA,iBAAiB,GAAG,IAAI,GAAG,EAAE;AAC7B,QAAA,gBAAgB,CAAC,GAAG,CAAC,SAAS,EAAE,iBAAiB,CAAC;IACtD;AAEA;;AAEG;AACH,IAAA,MAAM,IAAI,GAAG,gBAAgB,EAAE;AAC/B,IAAA,MAAM,gBAAgB,GAAG,qBAAqB,CAC1C,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,OAAO,CACV;AACD,IAAA,iBAAiB,CAAC,GAAG,CAAC,gBAAgB,CAAC;AAEvC;;;AAGG;IACH,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;QACjC,MAAM,UAAU,GAAG,MAAK;AACpB,YAAA,KAAK,MAAM,OAAO,IAAI,iBAAiB,EAAE;AACrC,gBAAA,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC;YACxC;AAEA,YAAA,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC;AAC9B,QAAA,CAAC;QAED,MAAM,SAAS,GAAG,MAAK;AACnB,YAAA,KAAK,MAAM,OAAO,IAAI,iBAAiB,EAAE;gBACrC,OAAO,CAAC,MAAM,EAAE;YACpB;AACJ,QAAA,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC;AAE7C,QAAA,eAAe,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC;AAExC,QAAA,MAAM,MAAM,GAAG,cAAc,CAAC,SAAS,CAAC;AACxC,QAAA,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC;AAC3C,QAAA,IAAI,SAAS,KAAK,QAAQ,CAAC,eAAe,EAAE;AACxC,YAAA,eAAe,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAC/D;AAEA,QAAA,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC;AAE3C,QAAA,QAAQ,EAAE;IACd;AAEA;;AAEG;IACH,IAAI,gBAAgB,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;QAC7D,MAAM,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAC,SAAS,CAAE;;AAGhD,QAAA,MAAM,IAAI,GAAG;YACT,KAAK,EAAE,SAAS,CAAC,WAAW;YAC5B,MAAM,EAAE,SAAS,CAAC,YAAY;SACjC;AACD,QAAA,UAAU,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC;;QAG/B,MAAM,qBAAqB,GAAY,MAAK;AACxC,YAAA,MAAM,QAAQ,GAAG,SAAS,CAAC,WAAW;AACtC,YAAA,MAAM,SAAS,GAAG,SAAS,CAAC,YAAY;AAExC,YAAA,IAAI,IAAI,CAAC,KAAK,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE;AACtD,gBAAA,QAAQ,EAAE;AACV,gBAAA,IAAI,CAAC,KAAK,GAAG,QAAQ;AACrB,gBAAA,IAAI,CAAC,MAAM,GAAG,SAAS;YAC3B;AACJ,QAAA,CAAC;;QAGD,MAAM,qBAAqB,GAAG,KAAK,CAAC,IAAI,CAAC,qBAAqB,EAAE,IAAI,CAAC;AACrE,QAAA,uBAAuB,CAAC,GAAG,CAAC,SAAS,EAAE,qBAAqB,CAAC;IACjE;IAEA,MAAM,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAC,SAAS,CAAE;IAChD,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC;AAEjC,IAAA,OAAO,MAAK;QACR,WAAW,CAAC,QAAQ,CAAC;AAErB;;AAEG;QACH,MAAM,eAAe,GAAG,gBAAgB,CAAC,GAAG,CAAC,SAAS,CAAC;AACvD,QAAA,IAAI,CAAC,eAAe;YAAE;AAEtB,QAAA,eAAe,CAAC,MAAM,CAAC,gBAAgB,CAAC;QAExC,IAAI,eAAe,CAAC,IAAI;YAAE;AAE1B;;AAEG;QACH,MAAM,cAAc,GAAG,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC;AACrD,QAAA,eAAe,CAAC,MAAM,CAAC,SAAS,CAAC;QAEjC,IAAI,cAAc,EAAE;YAChB,cAAc,CAAC,SAAS,CAAC,CAAC,mBAAmB,CACzC,QAAQ,EACR,cAAc,CACjB;AACD,YAAA,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI;AAClC,YAAA,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,cAAc,CAAC;QACxD;;QAGA,MAAM,qBAAqB,GAAG,uBAAuB,CAAC,GAAG,CAAC,SAAS,CAAC;QACpE,IAAI,qBAAqB,EAAE;YACvB,WAAW,CAAC,qBAAqB,CAAC;AAClC,YAAA,uBAAuB,CAAC,MAAM,CAAC,SAAS,CAAC;QAC7C;AACA,QAAA,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC;AAChC,IAAA,CAAC;AACL;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"can-use-native-timeline.mjs","sources":["../../../../../../src/render/dom/scroll/utils/can-use-native-timeline.ts"],"sourcesContent":["import { supportsScrollTimeline } from \"motion-dom\"\n\nexport function canUseNativeTimeline(target?: Element) {\n return (\n typeof window !== \"undefined\" && !target && supportsScrollTimeline()\n )\n}\n"],"names":[],"mappings":";;AAEM,SAAU,oBAAoB,CAAC,MAAgB,EAAA;AACjD,IAAA,QACI,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,MAAM,IAAI,sBAAsB,EAAE
|
|
1
|
+
{"version":3,"file":"can-use-native-timeline.mjs","sources":["../../../../../../src/render/dom/scroll/utils/can-use-native-timeline.ts"],"sourcesContent":["import { supportsScrollTimeline } from \"motion-dom\"\n\nexport function canUseNativeTimeline(target?: Element) {\n return (\n typeof window !== \"undefined\" && !target && supportsScrollTimeline()\n )\n}\n"],"names":[],"mappings":";;AAEM,SAAU,oBAAoB,CAAC,MAAgB,EAAA;AACjD,IAAA,QACI,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,MAAM,IAAI,sBAAsB,EAAE;AAE5E;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-timeline.mjs","sources":["../../../../../../src/render/dom/scroll/utils/get-timeline.ts"],"sourcesContent":["import { ProgressTimeline } from \"motion-dom\"\nimport { scrollInfo } from \"../track\"\nimport { ScrollOptionsWithDefaults } from \"../types\"\nimport { canUseNativeTimeline } from \"./can-use-native-timeline\"\n\ndeclare global {\n interface Window {\n ScrollTimeline: ScrollTimeline\n }\n}\n\ndeclare class ScrollTimeline implements ProgressTimeline {\n constructor(options: ScrollOptions)\n\n currentTime: null | { value: number }\n\n cancel?: VoidFunction\n}\n\nconst timelineCache = new Map<\n Element,\n Map<Element | \"self\", { x?: ProgressTimeline; y?: ProgressTimeline }>\n>()\n\nfunction scrollTimelineFallback(options: ScrollOptionsWithDefaults) {\n const currentTime = { value: 0 }\n\n const cancel = scrollInfo((info) => {\n currentTime.value = info[options.axis!].progress * 100\n }, options)\n\n return { currentTime, cancel }\n}\n\nexport function getTimeline({\n source,\n container,\n ...options\n}: ScrollOptionsWithDefaults): ProgressTimeline {\n const { axis } = options\n\n if (source) container = source\n\n const containerCache = timelineCache.get(container) ?? new Map()\n timelineCache.set(container, containerCache)\n\n const targetKey = options.target ?? \"self\"\n const targetCache = containerCache.get(targetKey) ?? {}\n\n const axisKey = axis + (options.offset ?? []).join(\",\")\n\n if (!targetCache[axisKey]) {\n targetCache[axisKey] =\n canUseNativeTimeline(options.target)\n ? new ScrollTimeline({ source: container, axis } as any)\n : scrollTimelineFallback({ container, ...options })\n }\n\n return targetCache[axisKey]!\n}\n"],"names":[],"mappings":";;;AAmBA,MAAM,aAAa,GAAG,IAAI,GAAG,EAG1B
|
|
1
|
+
{"version":3,"file":"get-timeline.mjs","sources":["../../../../../../src/render/dom/scroll/utils/get-timeline.ts"],"sourcesContent":["import { ProgressTimeline } from \"motion-dom\"\nimport { scrollInfo } from \"../track\"\nimport { ScrollOptionsWithDefaults } from \"../types\"\nimport { canUseNativeTimeline } from \"./can-use-native-timeline\"\n\ndeclare global {\n interface Window {\n ScrollTimeline: ScrollTimeline\n }\n}\n\ndeclare class ScrollTimeline implements ProgressTimeline {\n constructor(options: ScrollOptions)\n\n currentTime: null | { value: number }\n\n cancel?: VoidFunction\n}\n\nconst timelineCache = new Map<\n Element,\n Map<Element | \"self\", { x?: ProgressTimeline; y?: ProgressTimeline }>\n>()\n\nfunction scrollTimelineFallback(options: ScrollOptionsWithDefaults) {\n const currentTime = { value: 0 }\n\n const cancel = scrollInfo((info) => {\n currentTime.value = info[options.axis!].progress * 100\n }, options)\n\n return { currentTime, cancel }\n}\n\nexport function getTimeline({\n source,\n container,\n ...options\n}: ScrollOptionsWithDefaults): ProgressTimeline {\n const { axis } = options\n\n if (source) container = source\n\n const containerCache = timelineCache.get(container) ?? new Map()\n timelineCache.set(container, containerCache)\n\n const targetKey = options.target ?? \"self\"\n const targetCache = containerCache.get(targetKey) ?? {}\n\n const axisKey = axis + (options.offset ?? []).join(\",\")\n\n if (!targetCache[axisKey]) {\n targetCache[axisKey] =\n canUseNativeTimeline(options.target)\n ? new ScrollTimeline({ source: container, axis } as any)\n : scrollTimelineFallback({ container, ...options })\n }\n\n return targetCache[axisKey]!\n}\n"],"names":[],"mappings":";;;AAmBA,MAAM,aAAa,GAAG,IAAI,GAAG,EAG1B;AAEH,SAAS,sBAAsB,CAAC,OAAkC,EAAA;AAC9D,IAAA,MAAM,WAAW,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE;AAEhC,IAAA,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,IAAI,KAAI;AAC/B,QAAA,WAAW,CAAC,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,IAAK,CAAC,CAAC,QAAQ,GAAG,GAAG;IAC1D,CAAC,EAAE,OAAO,CAAC;AAEX,IAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE;AAClC;AAEM,SAAU,WAAW,CAAC,EACxB,MAAM,EACN,SAAS,EACT,GAAG,OAAO,EACc,EAAA;AACxB,IAAA,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO;AAExB,IAAA,IAAI,MAAM;QAAE,SAAS,GAAG,MAAM;AAE9B,IAAA,MAAM,cAAc,GAAG,aAAa,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,IAAI,GAAG,EAAE;AAChE,IAAA,aAAa,CAAC,GAAG,CAAC,SAAS,EAAE,cAAc,CAAC;AAE5C,IAAA,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,IAAI,MAAM;IAC1C,MAAM,WAAW,GAAG,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE;AAEvD,IAAA,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC;AAEvD,IAAA,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE;QACvB,WAAW,CAAC,OAAO,CAAC;AAChB,YAAA,oBAAoB,CAAC,OAAO,CAAC,MAAM;kBAC7B,IAAI,cAAc,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAS;kBACrD,sBAAsB,CAAC,EAAE,SAAS,EAAE,GAAG,OAAO,EAAE,CAAC;IAC/D;AAEA,IAAA,OAAO,WAAW,CAAC,OAAO,CAAE;AAChC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-props.mjs","sources":["../../../../../src/render/dom/utils/filter-props.ts"],"sourcesContent":["import type { MotionProps } from \"../../../motion/types\"\nimport { isValidMotionProp } from \"../../../motion/utils/valid-prop\"\n\nlet shouldForward = (key: string) => !isValidMotionProp(key)\n\nexport type IsValidProp = (key: string) => boolean\n\nexport function loadExternalIsValidProp(isValidProp?: IsValidProp) {\n if (typeof isValidProp !== \"function\") return\n\n // Explicitly filter our events\n shouldForward = (key: string) =>\n key.startsWith(\"on\") ? !isValidMotionProp(key) : isValidProp(key)\n}\n\n/**\n * Emotion and Styled Components both allow users to pass through arbitrary props to their components\n * to dynamically generate CSS. They both use the `@emotion/is-prop-valid` package to determine which\n * of these should be passed to the underlying DOM node.\n *\n * However, when styling a Motion component `styled(motion.div)`, both packages pass through *all* props\n * as it's seen as an arbitrary component rather than a DOM node. Motion only allows arbitrary props\n * passed through the `custom` prop so it doesn't *need* the payload or computational overhead of\n * `@emotion/is-prop-valid`, however to fix this problem we need to use it.\n *\n * By making it an optionalDependency we can offer this functionality only in the situations where it's\n * actually required.\n */\ntry {\n /**\n * We attempt to import this package but require won't be defined in esm environments, in that case\n * isPropValid will have to be provided via `MotionContext`. In a 6.0.0 this should probably be removed\n * in favour of explicit injection.\n */\n loadExternalIsValidProp(require(\"@emotion/is-prop-valid\").default)\n} catch {\n // We don't need to actually do anything here - the fallback is the existing `isPropValid`.\n}\n\nexport function filterProps(\n props: MotionProps,\n isDom: boolean,\n forwardMotionProps: boolean\n) {\n const filteredProps: MotionProps = {}\n\n for (const key in props) {\n /**\n * values is considered a valid prop by Emotion, so if it's present\n * this will be rendered out to the DOM unless explicitly filtered.\n *\n * We check the type as it could be used with the `feColorMatrix`\n * element, which we support.\n */\n if (key === \"values\" && typeof props.values === \"object\") continue\n\n if (\n shouldForward(key) ||\n (forwardMotionProps === true && isValidMotionProp(key)) ||\n (!isDom && !isValidMotionProp(key)) ||\n // If trying to use native HTML drag events, forward drag listeners\n (props[\"draggable\" as keyof MotionProps] &&\n key.startsWith(\"onDrag\"))\n ) {\n filteredProps[key as keyof MotionProps] =\n props[key as keyof MotionProps]\n }\n }\n\n return filteredProps\n}\n"],"names":[],"mappings":";;AAGA,IAAI,aAAa,GAAG,CAAC,GAAW,KAAK,CAAC,iBAAiB,CAAC,GAAG,CAAC
|
|
1
|
+
{"version":3,"file":"filter-props.mjs","sources":["../../../../../src/render/dom/utils/filter-props.ts"],"sourcesContent":["import type { MotionProps } from \"../../../motion/types\"\nimport { isValidMotionProp } from \"../../../motion/utils/valid-prop\"\n\nlet shouldForward = (key: string) => !isValidMotionProp(key)\n\nexport type IsValidProp = (key: string) => boolean\n\nexport function loadExternalIsValidProp(isValidProp?: IsValidProp) {\n if (typeof isValidProp !== \"function\") return\n\n // Explicitly filter our events\n shouldForward = (key: string) =>\n key.startsWith(\"on\") ? !isValidMotionProp(key) : isValidProp(key)\n}\n\n/**\n * Emotion and Styled Components both allow users to pass through arbitrary props to their components\n * to dynamically generate CSS. They both use the `@emotion/is-prop-valid` package to determine which\n * of these should be passed to the underlying DOM node.\n *\n * However, when styling a Motion component `styled(motion.div)`, both packages pass through *all* props\n * as it's seen as an arbitrary component rather than a DOM node. Motion only allows arbitrary props\n * passed through the `custom` prop so it doesn't *need* the payload or computational overhead of\n * `@emotion/is-prop-valid`, however to fix this problem we need to use it.\n *\n * By making it an optionalDependency we can offer this functionality only in the situations where it's\n * actually required.\n */\ntry {\n /**\n * We attempt to import this package but require won't be defined in esm environments, in that case\n * isPropValid will have to be provided via `MotionContext`. In a 6.0.0 this should probably be removed\n * in favour of explicit injection.\n */\n loadExternalIsValidProp(require(\"@emotion/is-prop-valid\").default)\n} catch {\n // We don't need to actually do anything here - the fallback is the existing `isPropValid`.\n}\n\nexport function filterProps(\n props: MotionProps,\n isDom: boolean,\n forwardMotionProps: boolean\n) {\n const filteredProps: MotionProps = {}\n\n for (const key in props) {\n /**\n * values is considered a valid prop by Emotion, so if it's present\n * this will be rendered out to the DOM unless explicitly filtered.\n *\n * We check the type as it could be used with the `feColorMatrix`\n * element, which we support.\n */\n if (key === \"values\" && typeof props.values === \"object\") continue\n\n if (\n shouldForward(key) ||\n (forwardMotionProps === true && isValidMotionProp(key)) ||\n (!isDom && !isValidMotionProp(key)) ||\n // If trying to use native HTML drag events, forward drag listeners\n (props[\"draggable\" as keyof MotionProps] &&\n key.startsWith(\"onDrag\"))\n ) {\n filteredProps[key as keyof MotionProps] =\n props[key as keyof MotionProps]\n }\n }\n\n return filteredProps\n}\n"],"names":[],"mappings":";;AAGA,IAAI,aAAa,GAAG,CAAC,GAAW,KAAK,CAAC,iBAAiB,CAAC,GAAG,CAAC;AAItD,SAAU,uBAAuB,CAAC,WAAyB,EAAA;IAC7D,IAAI,OAAO,WAAW,KAAK,UAAU;QAAE;;IAGvC,aAAa,GAAG,CAAC,GAAW,KACxB,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC;AACzE;AAEA;;;;;;;;;;;;AAYG;AACH,IAAI;AACA;;;;AAIG;IACH,uBAAuB,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC,OAAO,CAAC;AACtE;AAAE,MAAM;;AAER;SAEgB,WAAW,CACvB,KAAkB,EAClB,KAAc,EACd,kBAA2B,EAAA;IAE3B,MAAM,aAAa,GAAgB,EAAE;AAErC,IAAA,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE;AACrB;;;;;;AAMG;QACH,IAAI,GAAG,KAAK,QAAQ,IAAI,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ;YAAE;QAE1D,IACI,aAAa,CAAC,GAAG,CAAC;aACjB,kBAAkB,KAAK,IAAI,IAAI,iBAAiB,CAAC,GAAG,CAAC,CAAC;aACtD,CAAC,KAAK,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;;aAElC,KAAK,CAAC,WAAgC,CAAC;AACpC,gBAAA,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,EAC/B;YACE,aAAa,CAAC,GAAwB,CAAC;gBACnC,KAAK,CAAC,GAAwB,CAAC;QACvC;IACJ;AAEA,IAAA,OAAO,aAAa;AACxB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-svg-component.mjs","sources":["../../../../../src/render/dom/utils/is-svg-component.ts"],"sourcesContent":["import * as React from \"react\"\nimport { lowercaseSVGElements } from \"../../svg/lowercase-elements\"\n\nexport function isSVGComponent(Component: string | React.ComponentType<any>) {\n if (\n /**\n * If it's not a string, it's a custom React component. Currently we only support\n * HTML custom React components.\n */\n typeof Component !== \"string\" ||\n /**\n * If it contains a dash, the element is a custom HTML webcomponent.\n */\n Component.includes(\"-\")\n ) {\n return false\n } else if (\n /**\n * If it's in our list of lowercase SVG tags, it's an SVG component\n */\n lowercaseSVGElements.indexOf(Component) > -1 ||\n /**\n * If it contains a capital letter, it's an SVG component\n */\n /[A-Z]/u.test(Component)\n ) {\n return true\n }\n\n return false\n}\n"],"names":[],"mappings":";;AAGM,SAAU,cAAc,CAAC,SAA4C,EAAA;AACvE,IAAA;AACI;;;AAGG;IACH,OAAO,SAAS,KAAK,QAAQ;AAC7B;;AAEG;AACH,QAAA,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EACzB;AACE,QAAA,OAAO,KAAK
|
|
1
|
+
{"version":3,"file":"is-svg-component.mjs","sources":["../../../../../src/render/dom/utils/is-svg-component.ts"],"sourcesContent":["import * as React from \"react\"\nimport { lowercaseSVGElements } from \"../../svg/lowercase-elements\"\n\nexport function isSVGComponent(Component: string | React.ComponentType<any>) {\n if (\n /**\n * If it's not a string, it's a custom React component. Currently we only support\n * HTML custom React components.\n */\n typeof Component !== \"string\" ||\n /**\n * If it contains a dash, the element is a custom HTML webcomponent.\n */\n Component.includes(\"-\")\n ) {\n return false\n } else if (\n /**\n * If it's in our list of lowercase SVG tags, it's an SVG component\n */\n lowercaseSVGElements.indexOf(Component) > -1 ||\n /**\n * If it contains a capital letter, it's an SVG component\n */\n /[A-Z]/u.test(Component)\n ) {\n return true\n }\n\n return false\n}\n"],"names":[],"mappings":";;AAGM,SAAU,cAAc,CAAC,SAA4C,EAAA;AACvE,IAAA;AACI;;;AAGG;IACH,OAAO,SAAS,KAAK,QAAQ;AAC7B;;AAEG;AACH,QAAA,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EACzB;AACE,QAAA,OAAO,KAAK;IAChB;AAAO,SAAA;AACH;;AAEG;AACH,IAAA,oBAAoB,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE;AAC5C;;AAEG;AACH,QAAA,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,EAC1B;AACE,QAAA,OAAO,IAAI;IACf;AAEA,IAAA,OAAO,KAAK;AAChB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../../../src/render/dom/viewport/index.ts"],"sourcesContent":["import { ElementOrSelector, resolveElements } from \"motion-dom\"\n\nexport type ViewChangeHandler = (entry: IntersectionObserverEntry) => void\n\ntype MarginValue = `${number}${\"px\" | \"%\"}`\ntype MarginType =\n | MarginValue\n | `${MarginValue} ${MarginValue}`\n | `${MarginValue} ${MarginValue} ${MarginValue}`\n | `${MarginValue} ${MarginValue} ${MarginValue} ${MarginValue}`\n\nexport interface InViewOptions {\n root?: Element | Document\n margin?: MarginType\n amount?: \"some\" | \"all\" | number\n}\n\nconst thresholds = {\n some: 0,\n all: 1,\n}\n\nexport function inView(\n elementOrSelector: ElementOrSelector,\n onStart: (\n element: Element,\n entry: IntersectionObserverEntry\n ) => void | ViewChangeHandler,\n { root, margin: rootMargin, amount = \"some\" }: InViewOptions = {}\n): VoidFunction {\n const elements = resolveElements(elementOrSelector)\n\n const activeIntersections = new WeakMap<Element, ViewChangeHandler>()\n\n const onIntersectionChange: IntersectionObserverCallback = (entries) => {\n entries.forEach((entry) => {\n const onEnd = activeIntersections.get(entry.target)\n\n /**\n * If there's no change to the intersection, we don't need to\n * do anything here.\n */\n if (entry.isIntersecting === Boolean(onEnd)) return\n\n if (entry.isIntersecting) {\n const newOnEnd = onStart(entry.target, entry)\n if (typeof newOnEnd === \"function\") {\n activeIntersections.set(entry.target, newOnEnd)\n } else {\n observer.unobserve(entry.target)\n }\n } else if (typeof onEnd === \"function\") {\n onEnd(entry)\n activeIntersections.delete(entry.target)\n }\n })\n }\n\n const observer = new IntersectionObserver(onIntersectionChange, {\n root,\n rootMargin,\n threshold: typeof amount === \"number\" ? amount : thresholds[amount],\n })\n\n elements.forEach((element) => observer.observe(element))\n\n return () => observer.disconnect()\n}\n"],"names":[],"mappings":";;AAiBA,MAAM,UAAU,GAAG;AACf,IAAA,IAAI,EAAE,CAAC;AACP,IAAA,GAAG,EAAE,CAAC;CACT
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../../src/render/dom/viewport/index.ts"],"sourcesContent":["import { ElementOrSelector, resolveElements } from \"motion-dom\"\n\nexport type ViewChangeHandler = (entry: IntersectionObserverEntry) => void\n\ntype MarginValue = `${number}${\"px\" | \"%\"}`\ntype MarginType =\n | MarginValue\n | `${MarginValue} ${MarginValue}`\n | `${MarginValue} ${MarginValue} ${MarginValue}`\n | `${MarginValue} ${MarginValue} ${MarginValue} ${MarginValue}`\n\nexport interface InViewOptions {\n root?: Element | Document\n margin?: MarginType\n amount?: \"some\" | \"all\" | number\n}\n\nconst thresholds = {\n some: 0,\n all: 1,\n}\n\nexport function inView(\n elementOrSelector: ElementOrSelector,\n onStart: (\n element: Element,\n entry: IntersectionObserverEntry\n ) => void | ViewChangeHandler,\n { root, margin: rootMargin, amount = \"some\" }: InViewOptions = {}\n): VoidFunction {\n const elements = resolveElements(elementOrSelector)\n\n const activeIntersections = new WeakMap<Element, ViewChangeHandler>()\n\n const onIntersectionChange: IntersectionObserverCallback = (entries) => {\n entries.forEach((entry) => {\n const onEnd = activeIntersections.get(entry.target)\n\n /**\n * If there's no change to the intersection, we don't need to\n * do anything here.\n */\n if (entry.isIntersecting === Boolean(onEnd)) return\n\n if (entry.isIntersecting) {\n const newOnEnd = onStart(entry.target, entry)\n if (typeof newOnEnd === \"function\") {\n activeIntersections.set(entry.target, newOnEnd)\n } else {\n observer.unobserve(entry.target)\n }\n } else if (typeof onEnd === \"function\") {\n onEnd(entry)\n activeIntersections.delete(entry.target)\n }\n })\n }\n\n const observer = new IntersectionObserver(onIntersectionChange, {\n root,\n rootMargin,\n threshold: typeof amount === \"number\" ? amount : thresholds[amount],\n })\n\n elements.forEach((element) => observer.observe(element))\n\n return () => observer.disconnect()\n}\n"],"names":[],"mappings":";;AAiBA,MAAM,UAAU,GAAG;AACf,IAAA,IAAI,EAAE,CAAC;AACP,IAAA,GAAG,EAAE,CAAC;CACT;SAEe,MAAM,CAClB,iBAAoC,EACpC,OAG6B,EAC7B,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,KAAoB,EAAE,EAAA;AAEjE,IAAA,MAAM,QAAQ,GAAG,eAAe,CAAC,iBAAiB,CAAC;AAEnD,IAAA,MAAM,mBAAmB,GAAG,IAAI,OAAO,EAA8B;AAErE,IAAA,MAAM,oBAAoB,GAAiC,CAAC,OAAO,KAAI;AACnE,QAAA,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,KAAI;YACtB,MAAM,KAAK,GAAG,mBAAmB,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC;AAEnD;;;AAGG;AACH,YAAA,IAAI,KAAK,CAAC,cAAc,KAAK,OAAO,CAAC,KAAK,CAAC;gBAAE;AAE7C,YAAA,IAAI,KAAK,CAAC,cAAc,EAAE;gBACtB,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC;AAC7C,gBAAA,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;oBAChC,mBAAmB,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC;gBACnD;qBAAO;AACH,oBAAA,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC;gBACpC;YACJ;AAAO,iBAAA,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE;gBACpC,KAAK,CAAC,KAAK,CAAC;AACZ,gBAAA,mBAAmB,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;YAC5C;AACJ,QAAA,CAAC,CAAC;AACN,IAAA,CAAC;AAED,IAAA,MAAM,QAAQ,GAAG,IAAI,oBAAoB,CAAC,oBAAoB,EAAE;QAC5D,IAAI;QACJ,UAAU;AACV,QAAA,SAAS,EAAE,OAAO,MAAM,KAAK,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;AACtE,KAAA,CAAC;AAEF,IAAA,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,KAAK,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AAExD,IAAA,OAAO,MAAM,QAAQ,CAAC,UAAU,EAAE;AACtC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-html-visual-state.mjs","sources":["../../../../src/render/html/use-html-visual-state.ts"],"sourcesContent":["\"use client\"\n\nimport { scrapeHTMLMotionValuesFromProps } from \"motion-dom\"\nimport { makeUseVisualState } from \"../../motion/utils/use-visual-state\"\nimport { createHtmlRenderState } from \"./utils/create-render-state\"\n\nexport const useHTMLVisualState = /*@__PURE__*/ makeUseVisualState({\n scrapeMotionValuesFromProps: scrapeHTMLMotionValuesFromProps,\n createRenderState: createHtmlRenderState,\n})\n"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"use-html-visual-state.mjs","sources":["../../../../src/render/html/use-html-visual-state.ts"],"sourcesContent":["\"use client\"\n\nimport { scrapeHTMLMotionValuesFromProps } from \"motion-dom\"\nimport { makeUseVisualState } from \"../../motion/utils/use-visual-state\"\nimport { createHtmlRenderState } from \"./utils/create-render-state\"\n\nexport const useHTMLVisualState = /*@__PURE__*/ makeUseVisualState({\n scrapeMotionValuesFromProps: scrapeHTMLMotionValuesFromProps,\n createRenderState: createHtmlRenderState,\n})\n"],"names":[],"mappings":";;;;;AAMO;AACH;AACA;AACH;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-props.mjs","sources":["../../../../src/render/html/use-props.ts"],"sourcesContent":["\"use client\"\n\nimport { AnyResolvedKeyframe, buildHTMLStyles, isForcedMotionValue, isMotionValue, MotionValue } from \"motion-dom\"\nimport { HTMLProps, useMemo } from \"react\"\nimport { MotionProps } from \"../../motion/types\"\nimport { ResolvedValues } from \"../types\"\nimport { createHtmlRenderState } from \"./utils/create-render-state\"\n\nexport function copyRawValuesOnly(\n target: ResolvedValues,\n source: { [key: string]: AnyResolvedKeyframe | MotionValue },\n props: MotionProps\n) {\n for (const key in source) {\n if (!isMotionValue(source[key]) && !isForcedMotionValue(key, props)) {\n target[key] = source[key] as AnyResolvedKeyframe\n }\n }\n}\n\nfunction useInitialMotionValues(\n { transformTemplate }: MotionProps,\n visualState: ResolvedValues\n) {\n return useMemo(() => {\n const state = createHtmlRenderState()\n\n buildHTMLStyles(state, visualState, transformTemplate)\n\n return Object.assign({}, state.vars, state.style)\n }, [visualState])\n}\n\nfunction useStyle(\n props: MotionProps,\n visualState: ResolvedValues\n): ResolvedValues {\n const styleProp = props.style || {}\n const style = {}\n\n /**\n * Copy non-Motion Values straight into style\n */\n copyRawValuesOnly(style, styleProp as any, props)\n\n Object.assign(style, useInitialMotionValues(props, visualState))\n\n return style\n}\n\nexport function useHTMLProps(\n props: MotionProps & HTMLProps<HTMLElement>,\n visualState: ResolvedValues\n) {\n // The `any` isn't ideal but it is the type of createElement props argument\n const htmlProps: any = {}\n const style = useStyle(props, visualState)\n\n if (props.drag && props.dragListener !== false) {\n // Disable the ghost element when a user drags\n htmlProps.draggable = false\n\n // Disable text selection\n style.userSelect =\n style.WebkitUserSelect =\n style.WebkitTouchCallout =\n \"none\"\n\n // Disable scrolling on the draggable direction\n style.touchAction =\n props.drag === true\n ? \"none\"\n : `pan-${props.drag === \"x\" ? \"y\" : \"x\"}`\n }\n\n if (\n props.tabIndex === undefined &&\n (props.onTap || props.onTapStart || props.whileTap)\n ) {\n htmlProps.tabIndex = 0\n }\n\n htmlProps.style = style\n\n return htmlProps\n}\n"],"names":[],"mappings":";;;;;;AAaI;AACI;;;;AAIR;AAEA;;AAKQ;AAEA;AAEA;AACJ;AACJ;AAEA;AAII;;AAGA;;AAEG;AACH;AAEA;AAEA;AACJ;
|
|
1
|
+
{"version":3,"file":"use-props.mjs","sources":["../../../../src/render/html/use-props.ts"],"sourcesContent":["\"use client\"\n\nimport { AnyResolvedKeyframe, buildHTMLStyles, isForcedMotionValue, isMotionValue, MotionValue } from \"motion-dom\"\nimport { HTMLProps, useMemo } from \"react\"\nimport { MotionProps } from \"../../motion/types\"\nimport { ResolvedValues } from \"../types\"\nimport { createHtmlRenderState } from \"./utils/create-render-state\"\n\nexport function copyRawValuesOnly(\n target: ResolvedValues,\n source: { [key: string]: AnyResolvedKeyframe | MotionValue },\n props: MotionProps\n) {\n for (const key in source) {\n if (!isMotionValue(source[key]) && !isForcedMotionValue(key, props)) {\n target[key] = source[key] as AnyResolvedKeyframe\n }\n }\n}\n\nfunction useInitialMotionValues(\n { transformTemplate }: MotionProps,\n visualState: ResolvedValues\n) {\n return useMemo(() => {\n const state = createHtmlRenderState()\n\n buildHTMLStyles(state, visualState, transformTemplate)\n\n return Object.assign({}, state.vars, state.style)\n }, [visualState])\n}\n\nfunction useStyle(\n props: MotionProps,\n visualState: ResolvedValues\n): ResolvedValues {\n const styleProp = props.style || {}\n const style = {}\n\n /**\n * Copy non-Motion Values straight into style\n */\n copyRawValuesOnly(style, styleProp as any, props)\n\n Object.assign(style, useInitialMotionValues(props, visualState))\n\n return style\n}\n\nexport function useHTMLProps(\n props: MotionProps & HTMLProps<HTMLElement>,\n visualState: ResolvedValues\n) {\n // The `any` isn't ideal but it is the type of createElement props argument\n const htmlProps: any = {}\n const style = useStyle(props, visualState)\n\n if (props.drag && props.dragListener !== false) {\n // Disable the ghost element when a user drags\n htmlProps.draggable = false\n\n // Disable text selection\n style.userSelect =\n style.WebkitUserSelect =\n style.WebkitTouchCallout =\n \"none\"\n\n // Disable scrolling on the draggable direction\n style.touchAction =\n props.drag === true\n ? \"none\"\n : `pan-${props.drag === \"x\" ? \"y\" : \"x\"}`\n }\n\n if (\n props.tabIndex === undefined &&\n (props.onTap || props.onTapStart || props.whileTap)\n ) {\n htmlProps.tabIndex = 0\n }\n\n htmlProps.style = style\n\n return htmlProps\n}\n"],"names":[],"mappings":";;;;;;AAaI;AACI;;;;AAIR;AAEA;;AAKQ;AAEA;AAEA;AACJ;AACJ;AAEA;AAII;;AAGA;;AAEG;AACH;AAEA;AAEA;AACJ;AAEM;;;;;;AAUE;;AAGA;AACI;AACA;AACI;;AAGR;;AAEQ;AACA;;AAGZ;AAEI;AAEA;;AAGJ;AAEA;AACJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-render-state.mjs","sources":["../../../../../src/render/html/utils/create-render-state.ts"],"sourcesContent":["import { HTMLRenderState } from \"../types\"\n\nexport const createHtmlRenderState = (): HTMLRenderState => ({\n style: {},\n transform: {},\n transformOrigin: {},\n vars: {},\n})\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-render-state.mjs","sources":["../../../../../src/render/html/utils/create-render-state.ts"],"sourcesContent":["import { HTMLRenderState } from \"../types\"\n\nexport const createHtmlRenderState = (): HTMLRenderState => ({\n style: {},\n transform: {},\n transformOrigin: {},\n vars: {},\n})\n"],"names":[],"mappings":"AAEO,MAAM,qBAAqB,GAAG,OAAwB;AACzD,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,SAAS,EAAE,EAAE;AACb,IAAA,eAAe,EAAE,EAAE;AACnB,IAAA,IAAI,EAAE,EAAE;AACX,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lowercase-elements.mjs","sources":["../../../../src/render/svg/lowercase-elements.ts"],"sourcesContent":["/**\n * We keep these listed separately as we use the lowercase tag names as part\n * of the runtime bundle to detect SVG components\n */\nexport const lowercaseSVGElements = [\n \"animate\",\n \"circle\",\n \"defs\",\n \"desc\",\n \"ellipse\",\n \"g\",\n \"image\",\n \"line\",\n \"filter\",\n \"marker\",\n \"mask\",\n \"metadata\",\n \"path\",\n \"pattern\",\n \"polygon\",\n \"polyline\",\n \"rect\",\n \"stop\",\n \"switch\",\n \"symbol\",\n \"svg\",\n \"text\",\n \"tspan\",\n \"use\",\n \"view\",\n]\n"],"names":[],"mappings":"AAAA;;;AAGG;
|
|
1
|
+
{"version":3,"file":"lowercase-elements.mjs","sources":["../../../../src/render/svg/lowercase-elements.ts"],"sourcesContent":["/**\n * We keep these listed separately as we use the lowercase tag names as part\n * of the runtime bundle to detect SVG components\n */\nexport const lowercaseSVGElements = [\n \"animate\",\n \"circle\",\n \"defs\",\n \"desc\",\n \"ellipse\",\n \"g\",\n \"image\",\n \"line\",\n \"filter\",\n \"marker\",\n \"mask\",\n \"metadata\",\n \"path\",\n \"pattern\",\n \"polygon\",\n \"polyline\",\n \"rect\",\n \"stop\",\n \"switch\",\n \"symbol\",\n \"svg\",\n \"text\",\n \"tspan\",\n \"use\",\n \"view\",\n]\n"],"names":[],"mappings":"AAAA;;;AAGG;AACI,MAAM,oBAAoB,GAAG;IAChC,SAAS;IACT,QAAQ;IACR,MAAM;IACN,MAAM;IACN,SAAS;IACT,GAAG;IACH,OAAO;IACP,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,UAAU;IACV,MAAM;IACN,SAAS;IACT,SAAS;IACT,UAAU;IACV,MAAM;IACN,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,KAAK;IACL,MAAM;IACN,OAAO;IACP,KAAK;IACL,MAAM;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-svg-visual-state.mjs","sources":["../../../../src/render/svg/use-svg-visual-state.ts"],"sourcesContent":["\"use client\"\n\nimport { scrapeSVGMotionValuesFromProps } from \"motion-dom\"\nimport { makeUseVisualState } from \"../../motion/utils/use-visual-state\"\nimport { createSvgRenderState } from \"./utils/create-render-state\"\n\nexport const useSVGVisualState = /*@__PURE__*/ makeUseVisualState({\n scrapeMotionValuesFromProps: scrapeSVGMotionValuesFromProps,\n createRenderState: createSvgRenderState,\n})\n"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"use-svg-visual-state.mjs","sources":["../../../../src/render/svg/use-svg-visual-state.ts"],"sourcesContent":["\"use client\"\n\nimport { scrapeSVGMotionValuesFromProps } from \"motion-dom\"\nimport { makeUseVisualState } from \"../../motion/utils/use-visual-state\"\nimport { createSvgRenderState } from \"./utils/create-render-state\"\n\nexport const useSVGVisualState = /*@__PURE__*/ makeUseVisualState({\n scrapeMotionValuesFromProps: scrapeSVGMotionValuesFromProps,\n createRenderState: createSvgRenderState,\n})\n"],"names":[],"mappings":";;;;;AAMO;AACH;AACA;AACH;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-render-state.mjs","sources":["../../../../../src/render/svg/utils/create-render-state.ts"],"sourcesContent":["import { createHtmlRenderState } from \"../../html/utils/create-render-state\"\nimport { SVGRenderState } from \"../types\"\n\nexport const createSvgRenderState = (): SVGRenderState => ({\n ...createHtmlRenderState(),\n attrs: {},\n})\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"create-render-state.mjs","sources":["../../../../../src/render/svg/utils/create-render-state.ts"],"sourcesContent":["import { createHtmlRenderState } from \"../../html/utils/create-render-state\"\nimport { SVGRenderState } from \"../types\"\n\nexport const createSvgRenderState = (): SVGRenderState => ({\n ...createHtmlRenderState(),\n attrs: {},\n})\n"],"names":[],"mappings":";;AAGO,MAAM,oBAAoB,GAAG,OAAuB;AACvD,IAAA,GAAG,qBAAqB,EAAE;AAC1B,IAAA,KAAK,EAAE,EAAE;AACZ,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"distance.mjs","sources":["../../../src/utils/distance.ts"],"sourcesContent":["import { Point } from \"motion-utils\"\n\nexport const distance = (a: number, b: number) => Math.abs(a - b)\n\nexport function distance2D(a: Point, b: Point): number {\n // Multi-dimensional\n const xDelta = distance(a.x, b.x)\n const yDelta = distance(a.y, b.y)\n return Math.sqrt(xDelta ** 2 + yDelta ** 2)\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"distance.mjs","sources":["../../../src/utils/distance.ts"],"sourcesContent":["import { Point } from \"motion-utils\"\n\nexport const distance = (a: number, b: number) => Math.abs(a - b)\n\nexport function distance2D(a: Point, b: Point): number {\n // Multi-dimensional\n const xDelta = distance(a.x, b.x)\n const yDelta = distance(a.y, b.y)\n return Math.sqrt(xDelta ** 2 + yDelta ** 2)\n}\n"],"names":[],"mappings":"AAEO,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAE,CAAS,KAAK,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC;AAE1D,SAAU,UAAU,CAAC,CAAQ,EAAE,CAAQ,EAAA;;AAEzC,IAAA,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACjC,IAAA,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACjC,IAAA,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,GAAG,MAAM,IAAI,CAAC,CAAC;AAC/C;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-context-window.mjs","sources":["../../../src/utils/get-context-window.ts"],"sourcesContent":["import type { VisualElement } from \"motion-dom\"\n\n// Fixes https://github.com/motiondivision/motion/issues/2270\nexport const getContextWindow = ({ current }: VisualElement<Element>) => {\n return current ? current.ownerDocument.defaultView : null\n}\n"],"names":[],"mappings":"AAEA;MACa,gBAAgB,GAAG,CAAC,EAAE,OAAO,EAA0B,KAAI;AACpE,IAAA,OAAO,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,WAAW,GAAG,IAAI
|
|
1
|
+
{"version":3,"file":"get-context-window.mjs","sources":["../../../src/utils/get-context-window.ts"],"sourcesContent":["import type { VisualElement } from \"motion-dom\"\n\n// Fixes https://github.com/motiondivision/motion/issues/2270\nexport const getContextWindow = ({ current }: VisualElement<Element>) => {\n return current ? current.ownerDocument.defaultView : null\n}\n"],"names":[],"mappings":"AAEA;MACa,gBAAgB,GAAG,CAAC,EAAE,OAAO,EAA0B,KAAI;AACpE,IAAA,OAAO,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,WAAW,GAAG,IAAI;AAC7D;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-ref-object.mjs","sources":["../../../src/utils/is-ref-object.ts"],"sourcesContent":["import { MutableRefObject } from \"./safe-react-types\"\n\nexport function isRefObject<E = any>(ref: any): ref is MutableRefObject<E> {\n return (\n ref &&\n typeof ref === \"object\" &&\n Object.prototype.hasOwnProperty.call(ref, \"current\")\n )\n}\n"],"names":[],"mappings":"AAEM,SAAU,WAAW,CAAU,GAAQ,EAAA;AACzC,IAAA,QACI,GAAG;QACH,OAAO,GAAG,KAAK,QAAQ;AACvB,QAAA,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC
|
|
1
|
+
{"version":3,"file":"is-ref-object.mjs","sources":["../../../src/utils/is-ref-object.ts"],"sourcesContent":["import { MutableRefObject } from \"./safe-react-types\"\n\nexport function isRefObject<E = any>(ref: any): ref is MutableRefObject<E> {\n return (\n ref &&\n typeof ref === \"object\" &&\n Object.prototype.hasOwnProperty.call(ref, \"current\")\n )\n}\n"],"names":[],"mappings":"AAEM,SAAU,WAAW,CAAU,GAAQ,EAAA;AACzC,IAAA,QACI,GAAG;QACH,OAAO,GAAG,KAAK,QAAQ;AACvB,QAAA,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC;AAE5D;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform-viewbox-point.mjs","sources":["../../../src/utils/transform-viewbox-point.ts"],"sourcesContent":["import type { Point, TransformPoint } from \"motion-utils\"\nimport type { RefObject } from \"react\"\n\n/**\n * Creates a `transformPagePoint` function that accounts for SVG viewBox scaling.\n *\n * When dragging SVG elements inside an SVG with a viewBox that differs from\n * the rendered dimensions (e.g., `viewBox=\"0 0 100 100\"` but rendered at 500x500 pixels),\n * pointer coordinates need to be transformed to match the SVG's coordinate system.\n *\n * @example\n * ```jsx\n * function App() {\n * const svgRef = useRef<SVGSVGElement>(null)\n *\n * return (\n * <MotionConfig transformPagePoint={transformViewBoxPoint(svgRef)}>\n * <svg ref={svgRef} viewBox=\"0 0 100 100\" width={500} height={500}>\n * <motion.rect drag width={10} height={10} />\n * </svg>\n * </MotionConfig>\n * )\n * }\n * ```\n *\n * @param svgRef - A React ref to the SVG element\n * @returns A transformPagePoint function for use with MotionConfig\n *\n * @public\n */\nexport function transformViewBoxPoint(\n svgRef: RefObject<SVGSVGElement | null>\n): TransformPoint {\n return (point: Point): Point => {\n const svg = svgRef.current\n if (!svg) {\n return point\n }\n\n // Get the viewBox attribute\n const viewBox = svg.viewBox?.baseVal\n if (!viewBox || (viewBox.width === 0 && viewBox.height === 0)) {\n // No viewBox or empty viewBox - no transformation needed\n return point\n }\n\n // Get the rendered dimensions of the SVG\n const bbox = svg.getBoundingClientRect()\n if (bbox.width === 0 || bbox.height === 0) {\n return point\n }\n\n // Calculate scale factors\n const scaleX = viewBox.width / bbox.width\n const scaleY = viewBox.height / bbox.height\n\n // Get the SVG's position on the page\n const svgX = bbox.left + window.scrollX\n const svgY = bbox.top + window.scrollY\n\n // Transform the point:\n // 1. Calculate position relative to SVG\n // 2. Scale by viewBox/viewport ratio\n // 3. Add back the SVG position (but in SVG coordinates)\n return {\n x: (point.x - svgX) * scaleX + svgX,\n y: (point.y - svgY) * scaleY + svgY,\n }\n }\n}\n"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BG;AACG,SAAU,qBAAqB,CACjC,MAAuC,EAAA;IAEvC,OAAO,CAAC,KAAY,KAAW;AAC3B,QAAA,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO
|
|
1
|
+
{"version":3,"file":"transform-viewbox-point.mjs","sources":["../../../src/utils/transform-viewbox-point.ts"],"sourcesContent":["import type { Point, TransformPoint } from \"motion-utils\"\nimport type { RefObject } from \"react\"\n\n/**\n * Creates a `transformPagePoint` function that accounts for SVG viewBox scaling.\n *\n * When dragging SVG elements inside an SVG with a viewBox that differs from\n * the rendered dimensions (e.g., `viewBox=\"0 0 100 100\"` but rendered at 500x500 pixels),\n * pointer coordinates need to be transformed to match the SVG's coordinate system.\n *\n * @example\n * ```jsx\n * function App() {\n * const svgRef = useRef<SVGSVGElement>(null)\n *\n * return (\n * <MotionConfig transformPagePoint={transformViewBoxPoint(svgRef)}>\n * <svg ref={svgRef} viewBox=\"0 0 100 100\" width={500} height={500}>\n * <motion.rect drag width={10} height={10} />\n * </svg>\n * </MotionConfig>\n * )\n * }\n * ```\n *\n * @param svgRef - A React ref to the SVG element\n * @returns A transformPagePoint function for use with MotionConfig\n *\n * @public\n */\nexport function transformViewBoxPoint(\n svgRef: RefObject<SVGSVGElement | null>\n): TransformPoint {\n return (point: Point): Point => {\n const svg = svgRef.current\n if (!svg) {\n return point\n }\n\n // Get the viewBox attribute\n const viewBox = svg.viewBox?.baseVal\n if (!viewBox || (viewBox.width === 0 && viewBox.height === 0)) {\n // No viewBox or empty viewBox - no transformation needed\n return point\n }\n\n // Get the rendered dimensions of the SVG\n const bbox = svg.getBoundingClientRect()\n if (bbox.width === 0 || bbox.height === 0) {\n return point\n }\n\n // Calculate scale factors\n const scaleX = viewBox.width / bbox.width\n const scaleY = viewBox.height / bbox.height\n\n // Get the SVG's position on the page\n const svgX = bbox.left + window.scrollX\n const svgY = bbox.top + window.scrollY\n\n // Transform the point:\n // 1. Calculate position relative to SVG\n // 2. Scale by viewBox/viewport ratio\n // 3. Add back the SVG position (but in SVG coordinates)\n return {\n x: (point.x - svgX) * scaleX + svgX,\n y: (point.y - svgY) * scaleY + svgY,\n }\n }\n}\n"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BG;AACG,SAAU,qBAAqB,CACjC,MAAuC,EAAA;IAEvC,OAAO,CAAC,KAAY,KAAW;AAC3B,QAAA,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO;QAC1B,IAAI,CAAC,GAAG,EAAE;AACN,YAAA,OAAO,KAAK;QAChB;;AAGA,QAAA,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,OAAO;AACpC,QAAA,IAAI,CAAC,OAAO,KAAK,OAAO,CAAC,KAAK,KAAK,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,EAAE;;AAE3D,YAAA,OAAO,KAAK;QAChB;;AAGA,QAAA,MAAM,IAAI,GAAG,GAAG,CAAC,qBAAqB,EAAE;AACxC,QAAA,IAAI,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;AACvC,YAAA,OAAO,KAAK;QAChB;;QAGA,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK;QACzC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM;;QAG3C,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,OAAO;QACvC,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,OAAO;;;;;QAMtC,OAAO;YACH,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,IAAI,MAAM,GAAG,IAAI;YACnC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,IAAI,MAAM,GAAG,IAAI;SACtC;AACL,IAAA,CAAC;AACL;;;;"}
|