motionary 10.0.0 → 10.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. package/AGENTS.md +61 -0
  2. package/CHANGELOG.md +36 -0
  3. package/README.md +82 -0
  4. package/bin/create-motionary-plugin.mjs +124 -0
  5. package/dist/chunks/keyframes-W-474DMc.js +183 -0
  6. package/dist/chunks/keyframes-W-474DMc.js.map +1 -0
  7. package/dist/chunks/keyframes-ZheOkpt0.cjs +187 -0
  8. package/dist/chunks/keyframes-ZheOkpt0.cjs.map +1 -0
  9. package/dist/chunks/registry-BIEjKngP.js +69 -0
  10. package/dist/chunks/registry-BIEjKngP.js.map +1 -0
  11. package/dist/chunks/registry-eJgpFAzI.cjs +81 -0
  12. package/dist/chunks/registry-eJgpFAzI.cjs.map +1 -0
  13. package/dist/chunks/ticker-CM_56oVy.js +70 -0
  14. package/dist/chunks/ticker-CM_56oVy.js.map +1 -0
  15. package/dist/chunks/ticker-D4o6enH0.cjs +72 -0
  16. package/dist/chunks/ticker-D4o6enH0.cjs.map +1 -0
  17. package/dist/chunks/tween-CBuWYpI-.cjs +487 -0
  18. package/dist/chunks/tween-CBuWYpI-.cjs.map +1 -0
  19. package/dist/chunks/tween-CqX1JBuj.js +476 -0
  20. package/dist/chunks/tween-CqX1JBuj.js.map +1 -0
  21. package/dist/components/core.cjs +106 -0
  22. package/dist/components/core.cjs.map +1 -1
  23. package/dist/components/core.d.cts +44 -2
  24. package/dist/components/core.d.ts +44 -2
  25. package/dist/components/core.js +105 -1
  26. package/dist/components/core.js.map +1 -1
  27. package/dist/components/marketplace.cjs +104 -0
  28. package/dist/components/marketplace.cjs.map +1 -1
  29. package/dist/components/marketplace.d.cts +33 -2
  30. package/dist/components/marketplace.d.ts +33 -2
  31. package/dist/components/marketplace.js +101 -1
  32. package/dist/components/marketplace.js.map +1 -1
  33. package/dist/components/widgets.cjs +623 -199
  34. package/dist/components/widgets.cjs.map +1 -1
  35. package/dist/components/widgets.d.cts +186 -2
  36. package/dist/components/widgets.d.ts +186 -2
  37. package/dist/components/widgets.js +620 -201
  38. package/dist/components/widgets.js.map +1 -1
  39. package/dist/llms-full.txt +3115 -0
  40. package/dist/llms.txt +211 -0
  41. package/dist/manifest.json +7820 -0
  42. package/dist/manifest.schema.json +85 -0
  43. package/dist/runtime/format-css.cjs +185 -0
  44. package/dist/runtime/format-css.cjs.map +1 -0
  45. package/dist/runtime/format-css.d.cts +174 -0
  46. package/dist/runtime/format-css.d.ts +174 -0
  47. package/dist/runtime/format-css.iife.js +2 -0
  48. package/dist/runtime/format-css.iife.js.map +1 -0
  49. package/dist/runtime/format-css.js +177 -0
  50. package/dist/runtime/format-css.js.map +1 -0
  51. package/dist/runtime/format-motion.cjs +139 -0
  52. package/dist/runtime/format-motion.cjs.map +1 -0
  53. package/dist/runtime/format-motion.d.cts +208 -0
  54. package/dist/runtime/format-motion.d.ts +208 -0
  55. package/dist/runtime/format-motion.iife.js +2 -0
  56. package/dist/runtime/format-motion.iife.js.map +1 -0
  57. package/dist/runtime/format-motion.js +133 -0
  58. package/dist/runtime/format-motion.js.map +1 -0
  59. package/dist/runtime/format-svg.cjs +457 -0
  60. package/dist/runtime/format-svg.cjs.map +1 -0
  61. package/dist/runtime/format-svg.d.cts +214 -0
  62. package/dist/runtime/format-svg.d.ts +214 -0
  63. package/dist/runtime/format-svg.iife.js +2 -0
  64. package/dist/runtime/format-svg.iife.js.map +1 -0
  65. package/dist/runtime/format-svg.js +446 -0
  66. package/dist/runtime/format-svg.js.map +1 -0
  67. package/dist/runtime/scroll.cjs +301 -0
  68. package/dist/runtime/scroll.cjs.map +1 -0
  69. package/dist/runtime/scroll.d.cts +236 -0
  70. package/dist/runtime/scroll.d.ts +236 -0
  71. package/dist/runtime/scroll.iife.js +2 -0
  72. package/dist/runtime/scroll.iife.js.map +1 -0
  73. package/dist/runtime/scroll.js +292 -0
  74. package/dist/runtime/scroll.js.map +1 -0
  75. package/dist/runtime.cjs +79 -0
  76. package/dist/runtime.cjs.map +1 -0
  77. package/dist/runtime.d.cts +236 -0
  78. package/dist/runtime.d.ts +236 -0
  79. package/dist/runtime.iife.js +2 -0
  80. package/dist/runtime.iife.js.map +1 -0
  81. package/dist/runtime.js +55 -0
  82. package/dist/runtime.js.map +1 -0
  83. package/dist/widgets.umd.js +1 -1
  84. package/dist/widgets.umd.js.map +1 -1
  85. package/docs/ROADMAP.md +69 -38
  86. package/docs/ai-prompt-guide.md +54 -0
  87. package/docs/components/README.md +253 -0
  88. package/docs/components/usa-accordion.md +38 -0
  89. package/docs/components/usa-acrylic.md +38 -0
  90. package/docs/components/usa-add-to-cart.md +40 -0
  91. package/docs/components/usa-ambient.md +32 -0
  92. package/docs/components/usa-anim-icon.md +34 -0
  93. package/docs/components/usa-audio.md +38 -0
  94. package/docs/components/usa-aurora.md +36 -0
  95. package/docs/components/usa-auto-animate.md +44 -0
  96. package/docs/components/usa-auto-skeleton.md +38 -0
  97. package/docs/components/usa-avatar-stack.md +38 -0
  98. package/docs/components/usa-back-to-top.md +32 -0
  99. package/docs/components/usa-badge-wall.md +39 -0
  100. package/docs/components/usa-badge.md +36 -0
  101. package/docs/components/usa-bar-chart.md +33 -0
  102. package/docs/components/usa-bg-generator.md +32 -0
  103. package/docs/components/usa-blobs.md +32 -0
  104. package/docs/components/usa-bottom-sheet.md +32 -0
  105. package/docs/components/usa-button.md +78 -0
  106. package/docs/components/usa-card-stack.md +40 -0
  107. package/docs/components/usa-card.md +94 -0
  108. package/docs/components/usa-carousel-3d.md +40 -0
  109. package/docs/components/usa-carousel.md +40 -0
  110. package/docs/components/usa-cart-drawer.md +33 -0
  111. package/docs/components/usa-chapter-nav.md +40 -0
  112. package/docs/components/usa-chat-composer.md +33 -0
  113. package/docs/components/usa-check.md +32 -0
  114. package/docs/components/usa-checkbox.md +32 -0
  115. package/docs/components/usa-click.md +36 -0
  116. package/docs/components/usa-clock-control.md +37 -0
  117. package/docs/components/usa-code-export.md +36 -0
  118. package/docs/components/usa-color-picker.md +32 -0
  119. package/docs/components/usa-command-palette.md +39 -0
  120. package/docs/components/usa-compare.md +38 -0
  121. package/docs/components/usa-countdown.md +32 -0
  122. package/docs/components/usa-counter.md +32 -0
  123. package/docs/components/usa-cube-gallery.md +40 -0
  124. package/docs/components/usa-cube.md +36 -0
  125. package/docs/components/usa-cursor.md +32 -0
  126. package/docs/components/usa-date-picker.md +32 -0
  127. package/docs/components/usa-depth.md +44 -0
  128. package/docs/components/usa-dialog.md +40 -0
  129. package/docs/components/usa-disclosure.md +38 -0
  130. package/docs/components/usa-distort.md +36 -0
  131. package/docs/components/usa-dock.md +40 -0
  132. package/docs/components/usa-dot-network.md +32 -0
  133. package/docs/components/usa-double-tap.md +36 -0
  134. package/docs/components/usa-draggable.md +38 -0
  135. package/docs/components/usa-draw.md +36 -0
  136. package/docs/components/usa-drawer.md +34 -0
  137. package/docs/components/usa-equalizer.md +33 -0
  138. package/docs/components/usa-fab.md +40 -0
  139. package/docs/components/usa-festival-banner.md +32 -0
  140. package/docs/components/usa-field.md +34 -0
  141. package/docs/components/usa-file-drop.md +35 -0
  142. package/docs/components/usa-fullpage.md +38 -0
  143. package/docs/components/usa-fx.md +851 -0
  144. package/docs/components/usa-gauge.md +32 -0
  145. package/docs/components/usa-gen-art.md +32 -0
  146. package/docs/components/usa-gesture-fx.md +36 -0
  147. package/docs/components/usa-gesture-sticker.md +36 -0
  148. package/docs/components/usa-glitch.md +32 -0
  149. package/docs/components/usa-globe.md +33 -0
  150. package/docs/components/usa-gradient-text.md +32 -0
  151. package/docs/components/usa-grain.md +36 -0
  152. package/docs/components/usa-grid-glow.md +36 -0
  153. package/docs/components/usa-gyro-card.md +38 -0
  154. package/docs/components/usa-handwriting.md +32 -0
  155. package/docs/components/usa-hero-video.md +38 -0
  156. package/docs/components/usa-hold.md +32 -0
  157. package/docs/components/usa-hud-panel.md +38 -0
  158. package/docs/components/usa-hydrate.md +42 -0
  159. package/docs/components/usa-icon-morph.md +34 -0
  160. package/docs/components/usa-install-button.md +32 -0
  161. package/docs/components/usa-kanban.md +46 -0
  162. package/docs/components/usa-keyframe-editor.md +37 -0
  163. package/docs/components/usa-kpi.md +32 -0
  164. package/docs/components/usa-leaderboard.md +41 -0
  165. package/docs/components/usa-like.md +32 -0
  166. package/docs/components/usa-liquid-nav.md +36 -0
  167. package/docs/components/usa-liquid.md +36 -0
  168. package/docs/components/usa-loading-bar.md +35 -0
  169. package/docs/components/usa-location-card.md +34 -0
  170. package/docs/components/usa-lottie-icon.md +34 -0
  171. package/docs/components/usa-lottie.md +32 -0
  172. package/docs/components/usa-lyrics.md +38 -0
  173. package/docs/components/usa-magnetic.md +32 -0
  174. package/docs/components/usa-marquee.md +38 -0
  175. package/docs/components/usa-mask-reveal.md +36 -0
  176. package/docs/components/usa-masonry-flow.md +42 -0
  177. package/docs/components/usa-masonry.md +38 -0
  178. package/docs/components/usa-menu-toggle.md +34 -0
  179. package/docs/components/usa-menu.md +44 -0
  180. package/docs/components/usa-message-list.md +39 -0
  181. package/docs/components/usa-milestones.md +40 -0
  182. package/docs/components/usa-modal.md +42 -0
  183. package/docs/components/usa-morph.md +34 -0
  184. package/docs/components/usa-motion-inspector.md +32 -0
  185. package/docs/components/usa-motion-prefs.md +32 -0
  186. package/docs/components/usa-motion-spec.md +32 -0
  187. package/docs/components/usa-motion-switch.md +34 -0
  188. package/docs/components/usa-motion-theme.md +40 -0
  189. package/docs/components/usa-motion.md +42 -0
  190. package/docs/components/usa-music-player.md +36 -0
  191. package/docs/components/usa-native-preview.md +36 -0
  192. package/docs/components/usa-nav-morph.md +40 -0
  193. package/docs/components/usa-navbar.md +36 -0
  194. package/docs/components/usa-notification-bell.md +37 -0
  195. package/docs/components/usa-odometer.md +34 -0
  196. package/docs/components/usa-organic-card.md +36 -0
  197. package/docs/components/usa-otp.md +33 -0
  198. package/docs/components/usa-overscroll.md +36 -0
  199. package/docs/components/usa-pack.md +111 -0
  200. package/docs/components/usa-pagination.md +32 -0
  201. package/docs/components/usa-panorama.md +32 -0
  202. package/docs/components/usa-particles.md +32 -0
  203. package/docs/components/usa-pause-all.md +32 -0
  204. package/docs/components/usa-perf-monitor.md +32 -0
  205. package/docs/components/usa-pinch-zoom.md +36 -0
  206. package/docs/components/usa-player.md +38 -0
  207. package/docs/components/usa-plugin-card.md +61 -0
  208. package/docs/components/usa-plugin-store.md +36 -0
  209. package/docs/components/usa-popover.md +38 -0
  210. package/docs/components/usa-post-fx.md +36 -0
  211. package/docs/components/usa-presence.md +36 -0
  212. package/docs/components/usa-press.md +32 -0
  213. package/docs/components/usa-prize-wheel.md +32 -0
  214. package/docs/components/usa-product-gallery.md +40 -0
  215. package/docs/components/usa-progress-ring.md +38 -0
  216. package/docs/components/usa-progress.md +34 -0
  217. package/docs/components/usa-prop-panel.md +34 -0
  218. package/docs/components/usa-pull-cord.md +32 -0
  219. package/docs/components/usa-pull-refresh.md +37 -0
  220. package/docs/components/usa-radar.md +32 -0
  221. package/docs/components/usa-reactions.md +32 -0
  222. package/docs/components/usa-red-envelope.md +32 -0
  223. package/docs/components/usa-retro-button.md +34 -0
  224. package/docs/components/usa-reveal.md +36 -0
  225. package/docs/components/usa-ripple.md +32 -0
  226. package/docs/components/usa-scene.md +38 -0
  227. package/docs/components/usa-scramble.md +32 -0
  228. package/docs/components/usa-scroll-highlight.md +34 -0
  229. package/docs/components/usa-scroll-progress.md +36 -0
  230. package/docs/components/usa-scroll-scene.md +66 -0
  231. package/docs/components/usa-scrolly.md +40 -0
  232. package/docs/components/usa-segmented.md +40 -0
  233. package/docs/components/usa-shader.md +74 -0
  234. package/docs/components/usa-sheet.md +42 -0
  235. package/docs/components/usa-shimmer-text.md +32 -0
  236. package/docs/components/usa-shortcut.md +34 -0
  237. package/docs/components/usa-skeleton-reveal.md +42 -0
  238. package/docs/components/usa-skeleton.md +36 -0
  239. package/docs/components/usa-sketch-chart.md +32 -0
  240. package/docs/components/usa-slider.md +32 -0
  241. package/docs/components/usa-sparkline.md +32 -0
  242. package/docs/components/usa-spatial-card.md +40 -0
  243. package/docs/components/usa-spinner.md +34 -0
  244. package/docs/components/usa-splash.md +36 -0
  245. package/docs/components/usa-split-text.md +32 -0
  246. package/docs/components/usa-spotlight.md +40 -0
  247. package/docs/components/usa-spring.md +42 -0
  248. package/docs/components/usa-stagger.md +40 -0
  249. package/docs/components/usa-star-rating.md +34 -0
  250. package/docs/components/usa-stepper.md +42 -0
  251. package/docs/components/usa-sticky-stack.md +40 -0
  252. package/docs/components/usa-sticky-wall.md +40 -0
  253. package/docs/components/usa-stories.md +38 -0
  254. package/docs/components/usa-story.md +80 -0
  255. package/docs/components/usa-suggestion-chips.md +32 -0
  256. package/docs/components/usa-swipe-deck.md +40 -0
  257. package/docs/components/usa-swipeable.md +36 -0
  258. package/docs/components/usa-switch.md +32 -0
  259. package/docs/components/usa-tab-bar.md +46 -0
  260. package/docs/components/usa-tabs.md +40 -0
  261. package/docs/components/usa-terminal.md +38 -0
  262. package/docs/components/usa-text-rotate.md +32 -0
  263. package/docs/components/usa-theme-surface.md +36 -0
  264. package/docs/components/usa-theme-switcher.md +32 -0
  265. package/docs/components/usa-tilt.md +36 -0
  266. package/docs/components/usa-timeline.md +40 -0
  267. package/docs/components/usa-tip.md +44 -0
  268. package/docs/components/usa-toast-stack.md +36 -0
  269. package/docs/components/usa-toaster.md +36 -0
  270. package/docs/components/usa-typewriter.md +32 -0
  271. package/docs/components/usa-upload-progress.md +33 -0
  272. package/docs/components/usa-video-card.md +40 -0
  273. package/docs/components/usa-view-switch.md +38 -0
  274. package/docs/components/usa-voice-button.md +33 -0
  275. package/docs/components/usa-volume-knob.md +32 -0
  276. package/docs/components/usa-water-ripple.md +36 -0
  277. package/docs/components/usa-wave-text.md +32 -0
  278. package/docs/components/usa-weather-card.md +32 -0
  279. package/docs/components/usa-worker-canvas.md +32 -0
  280. package/docs/components/usa-xp-bar.md +33 -0
  281. package/docs/components.md +105 -0
  282. package/docs/runtime/core.md +55 -0
  283. package/docs/runtime/format-css.md +59 -0
  284. package/docs/runtime/format-motion.md +56 -0
  285. package/docs/runtime/format-svg.md +62 -0
  286. package/docs/runtime/scroll.md +61 -0
  287. package/package.json +71 -7
@@ -0,0 +1,214 @@
1
+ /** A runtime module: `{ id, version, api }`, registered with `use()`. */
2
+ interface RuntimeModule<A = unknown> {
3
+ /** Module id: 'core', 'format-css', 'scroll', … (import path `motionary/runtime/<id>`). */
4
+ id: string;
5
+ version: string;
6
+ /** Other modules this one needs (registered first by `use()` callers). */
7
+ requires?: string[];
8
+ /** The module's public API (what `requireModule(id)` returns). */
9
+ api: A;
10
+ /** Optional one-time setup, called on first registration. */
11
+ setup?(registry: RuntimeRegistry): void;
12
+ }
13
+ interface RuntimeRegistry {
14
+ version: string;
15
+ modules: Map<string, RuntimeModule>;
16
+ /** Shared per-page state slots (the ticker lives here). */
17
+ slots: Record<string, unknown>;
18
+ }
19
+
20
+ /** Easing functions (t ∈ [0, 1] → progress). Original implementations of the standard Penner-style curves. */
21
+ type Ease = (t: number) => number;
22
+
23
+ type Target = object | Element;
24
+ type Props = Record<string, number | string>;
25
+ interface PlayOptions {
26
+ /** Delay before the first iteration, ms. */
27
+ delay?: number;
28
+ /** Extra iterations (-1 = forever). */
29
+ repeat?: number;
30
+ /** Alternate direction on every other iteration. */
31
+ yoyo?: boolean;
32
+ /** Start paused (`play()` to start). */
33
+ paused?: boolean;
34
+ onUpdate?: (progress: number) => void;
35
+ onComplete?: () => void;
36
+ }
37
+ interface TweenOptions extends PlayOptions {
38
+ to?: Props;
39
+ from?: Props;
40
+ /** ms (default 600). */
41
+ duration?: number;
42
+ ease?: string | Ease;
43
+ /** Delay added per target index (ms) when several targets are given. */
44
+ stagger?: number;
45
+ }
46
+ /** Common playback: delay, repeat, yoyo, direction, ticker attachment, promise. */
47
+ declare abstract class Playable {
48
+ delay: number;
49
+ repeat: number;
50
+ yoyo: boolean;
51
+ /** Playback rate multiplier. */
52
+ timeScale: number;
53
+ onUpdate?: (progress: number) => void;
54
+ onComplete?: () => void;
55
+ protected _t: number;
56
+ private _dir;
57
+ private _off;
58
+ private _done;
59
+ private _resolve;
60
+ /** Resolves on completion (forward end, or start when reversed). */
61
+ finished: Promise<void>;
62
+ /** Set when owned by a timeline (then the ticker never drives it). */
63
+ parent: Timeline | null;
64
+ constructor(o: PlayOptions);
65
+ /** One iteration, ms. */
66
+ abstract get duration(): number;
67
+ /** Render at `ms` into one iteration. */
68
+ protected abstract renderLocal(ms: number, iterationEnded: boolean): void;
69
+ get totalDuration(): number;
70
+ get time(): number;
71
+ get progress(): number;
72
+ set progress(p: number);
73
+ get isActive(): boolean;
74
+ get reversed(): boolean;
75
+ /** Jump to `ms` (total time, including the delay) and render. */
76
+ seek(ms: number): this;
77
+ play(): this;
78
+ pause(): this;
79
+ /** Play backwards from the current time. */
80
+ reverse(): this;
81
+ restart(): this;
82
+ /** Stop and detach for good. */
83
+ kill(): void;
84
+ /** Promise-like: `await tween(...)`. */
85
+ then<R>(ok?: (v: void) => R, err?: (e: unknown) => R): Promise<R>;
86
+ private attach;
87
+ private advance;
88
+ protected complete(): void;
89
+ }
90
+ /** Position: ms number, '<' (start of previous), '>' (end of previous, default), '+=200' / '-=200' (relative to the end), 'label', 'label+=100', '<+=100'. */
91
+ type Position = number | string;
92
+ interface TimelineOptions extends PlayOptions {
93
+ /** Defaults merged into every `.to()`. */
94
+ defaults?: Omit<TweenOptions, 'to' | 'from'>;
95
+ }
96
+ /** A sequence of tweens, nested timelines and callbacks. */
97
+ declare class Timeline extends Playable {
98
+ private children;
99
+ private labels;
100
+ private prevStart;
101
+ private prevEnd;
102
+ private defaults;
103
+ private lastLocal;
104
+ constructor(o?: TimelineOptions);
105
+ get duration(): number;
106
+ private resolve;
107
+ /** Add a tween, timeline or callback at a position. */
108
+ add(item: Playable | (() => void), position?: Position): this;
109
+ /** `tween(target, vars)` placed at `position` (stagger across several targets). */
110
+ to(target: Target | Target[] | ArrayLike<Target>, vars: TweenOptions, position?: Position): this;
111
+ call(fn: () => void, position?: Position): this;
112
+ label(name: string, position?: Position): this;
113
+ /** Time of a label, ms. */
114
+ labelTime(name: string): number | undefined;
115
+ remove(item: Playable): void;
116
+ /** Children in start order (callbacks excluded). */
117
+ getChildren(): Playable[];
118
+ protected renderLocal(ms: number): void;
119
+ }
120
+
121
+ /**
122
+ * `motionary/runtime/format-svg` (10.2) — SVG animation with the runtime
123
+ * (original implementation):
124
+ *
125
+ * - **Path geometry** without the DOM (SSR / workers): `parsePath(d)` (all
126
+ * commands, relative + absolute, arcs), `flattenPath(d)`, `pathLength(d)`,
127
+ * `pointAtLength(d, len)`, `samplePath(d, n)`.
128
+ * - **Path morphing**: `morphPath(from, to, { points })` → `(p) => d` — both
129
+ * paths are resampled to the same number of points (any command mix, any
130
+ * point counts), aligned to the closest start point, then interpolated.
131
+ * - **SMIL playback**: `playSmil(svg)` reads `<animate>`, `<set>`,
132
+ * `<animateTransform>` (translate / scale / rotate / skewX / skewY) and
133
+ * `<animateMotion>` (`path` or `<mpath>`, `rotate="auto"`) — `from` / `to` /
134
+ * `by` / `values`, `keyTimes`, `keySplines` (`calcMode="spline"`),
135
+ * `calcMode="discrete"`, `dur`, numeric `begin` offsets, `repeatCount`
136
+ * (incl. `indefinite`), `fill="freeze"` — and replays them as a runtime
137
+ * timeline (seek, scrub, reverse, timeScale) instead of the browser's SMIL clock.
138
+ * - CSS-animated SVG: use `motionary/runtime/format-css` (`@keyframes` in the SVG's `<style>`).
139
+ *
140
+ * Not supported (documented): event / syncbase `begin` values (`click`,
141
+ * `a.end`), `accumulate` / `additive="sum"`, `<animateColor>` (deprecated).
142
+ */
143
+
144
+ type Pt = [number, number];
145
+ type PathCommand = [string, ...number[]];
146
+ /** Parse path data into absolute commands (M L C Q A Z; H/V/S/T expanded). */
147
+ declare function parsePath(d: string): PathCommand[];
148
+ /** Flatten a path into polylines (one per subpath); `segments` points per curve. */
149
+ declare function flattenPath(d: string | PathCommand[], segments?: number): Pt[][];
150
+ /** Total length of a path. */
151
+ declare function pathLength(d: string | PathCommand[]): number;
152
+ /** Point (and tangent angle, degrees) at a distance along the path. */
153
+ declare function pointAtLength(d: string | PathCommand[], len: number): {
154
+ x: number;
155
+ y: number;
156
+ angle: number;
157
+ };
158
+ /** `n` points evenly spaced along the path (all subpaths joined). */
159
+ declare function samplePath(d: string | PathCommand[], n?: number): Pt[];
160
+ /**
161
+ * Morph between two paths of any shape: `const f = morphPath(a, b); el.setAttribute('d', f(0.5))`.
162
+ * Closed paths are rotated so their start points line up (less twisting).
163
+ */
164
+ declare function morphPath(from: string, to: string, o?: {
165
+ points?: number;
166
+ }): (p: number) => string;
167
+ /** '2s', '150ms', '1.5', 'indefinite' → ms (NaN for indefinite / unsupported). */
168
+ declare function smilTime(v: string | null | undefined): number;
169
+ interface SmilAnimationInfo {
170
+ kind: 'animate' | 'set' | 'animateTransform' | 'animateMotion';
171
+ target: Element;
172
+ attribute: string;
173
+ begin: number;
174
+ dur: number;
175
+ repeat: number;
176
+ freeze: boolean;
177
+ values: string[];
178
+ keyTimes: number[];
179
+ calcMode: string;
180
+ type?: string;
181
+ }
182
+ /** Read the SMIL animation elements of an SVG (without playing them). */
183
+ declare function readSmil(svg: Element): SmilAnimationInfo[];
184
+ interface SmilPlayer {
185
+ timeline: Timeline;
186
+ animations: SmilAnimationInfo[];
187
+ /** Put the original SMIL elements back (the browser's clock takes over again). */
188
+ restore(): void;
189
+ }
190
+ /**
191
+ * Replay an SVG's SMIL animations with the runtime. The SMIL elements are
192
+ * detached while the runtime drives the attributes (call `restore()` to put
193
+ * them back). Playing unless `paused: true`.
194
+ */
195
+ declare function playSmil(svg: Element, o?: {
196
+ paused?: boolean;
197
+ timeScale?: number;
198
+ }): SmilPlayer;
199
+ interface FormatSvgApi {
200
+ parsePath: typeof parsePath;
201
+ flattenPath: typeof flattenPath;
202
+ pathLength: typeof pathLength;
203
+ pointAtLength: typeof pointAtLength;
204
+ samplePath: typeof samplePath;
205
+ morphPath: typeof morphPath;
206
+ readSmil: typeof readSmil;
207
+ playSmil: typeof playSmil;
208
+ smilTime: typeof smilTime;
209
+ }
210
+ /** The module object for `use(formatSvg)`. */
211
+ declare const formatSvg: RuntimeModule<FormatSvgApi>;
212
+
213
+ export { flattenPath, formatSvg, morphPath, parsePath, pathLength, playSmil, pointAtLength, readSmil, samplePath, smilTime };
214
+ export type { FormatSvgApi, PathCommand, SmilAnimationInfo, SmilPlayer };
@@ -0,0 +1,214 @@
1
+ /** A runtime module: `{ id, version, api }`, registered with `use()`. */
2
+ interface RuntimeModule<A = unknown> {
3
+ /** Module id: 'core', 'format-css', 'scroll', … (import path `motionary/runtime/<id>`). */
4
+ id: string;
5
+ version: string;
6
+ /** Other modules this one needs (registered first by `use()` callers). */
7
+ requires?: string[];
8
+ /** The module's public API (what `requireModule(id)` returns). */
9
+ api: A;
10
+ /** Optional one-time setup, called on first registration. */
11
+ setup?(registry: RuntimeRegistry): void;
12
+ }
13
+ interface RuntimeRegistry {
14
+ version: string;
15
+ modules: Map<string, RuntimeModule>;
16
+ /** Shared per-page state slots (the ticker lives here). */
17
+ slots: Record<string, unknown>;
18
+ }
19
+
20
+ /** Easing functions (t ∈ [0, 1] → progress). Original implementations of the standard Penner-style curves. */
21
+ type Ease = (t: number) => number;
22
+
23
+ type Target = object | Element;
24
+ type Props = Record<string, number | string>;
25
+ interface PlayOptions {
26
+ /** Delay before the first iteration, ms. */
27
+ delay?: number;
28
+ /** Extra iterations (-1 = forever). */
29
+ repeat?: number;
30
+ /** Alternate direction on every other iteration. */
31
+ yoyo?: boolean;
32
+ /** Start paused (`play()` to start). */
33
+ paused?: boolean;
34
+ onUpdate?: (progress: number) => void;
35
+ onComplete?: () => void;
36
+ }
37
+ interface TweenOptions extends PlayOptions {
38
+ to?: Props;
39
+ from?: Props;
40
+ /** ms (default 600). */
41
+ duration?: number;
42
+ ease?: string | Ease;
43
+ /** Delay added per target index (ms) when several targets are given. */
44
+ stagger?: number;
45
+ }
46
+ /** Common playback: delay, repeat, yoyo, direction, ticker attachment, promise. */
47
+ declare abstract class Playable {
48
+ delay: number;
49
+ repeat: number;
50
+ yoyo: boolean;
51
+ /** Playback rate multiplier. */
52
+ timeScale: number;
53
+ onUpdate?: (progress: number) => void;
54
+ onComplete?: () => void;
55
+ protected _t: number;
56
+ private _dir;
57
+ private _off;
58
+ private _done;
59
+ private _resolve;
60
+ /** Resolves on completion (forward end, or start when reversed). */
61
+ finished: Promise<void>;
62
+ /** Set when owned by a timeline (then the ticker never drives it). */
63
+ parent: Timeline | null;
64
+ constructor(o: PlayOptions);
65
+ /** One iteration, ms. */
66
+ abstract get duration(): number;
67
+ /** Render at `ms` into one iteration. */
68
+ protected abstract renderLocal(ms: number, iterationEnded: boolean): void;
69
+ get totalDuration(): number;
70
+ get time(): number;
71
+ get progress(): number;
72
+ set progress(p: number);
73
+ get isActive(): boolean;
74
+ get reversed(): boolean;
75
+ /** Jump to `ms` (total time, including the delay) and render. */
76
+ seek(ms: number): this;
77
+ play(): this;
78
+ pause(): this;
79
+ /** Play backwards from the current time. */
80
+ reverse(): this;
81
+ restart(): this;
82
+ /** Stop and detach for good. */
83
+ kill(): void;
84
+ /** Promise-like: `await tween(...)`. */
85
+ then<R>(ok?: (v: void) => R, err?: (e: unknown) => R): Promise<R>;
86
+ private attach;
87
+ private advance;
88
+ protected complete(): void;
89
+ }
90
+ /** Position: ms number, '<' (start of previous), '>' (end of previous, default), '+=200' / '-=200' (relative to the end), 'label', 'label+=100', '<+=100'. */
91
+ type Position = number | string;
92
+ interface TimelineOptions extends PlayOptions {
93
+ /** Defaults merged into every `.to()`. */
94
+ defaults?: Omit<TweenOptions, 'to' | 'from'>;
95
+ }
96
+ /** A sequence of tweens, nested timelines and callbacks. */
97
+ declare class Timeline extends Playable {
98
+ private children;
99
+ private labels;
100
+ private prevStart;
101
+ private prevEnd;
102
+ private defaults;
103
+ private lastLocal;
104
+ constructor(o?: TimelineOptions);
105
+ get duration(): number;
106
+ private resolve;
107
+ /** Add a tween, timeline or callback at a position. */
108
+ add(item: Playable | (() => void), position?: Position): this;
109
+ /** `tween(target, vars)` placed at `position` (stagger across several targets). */
110
+ to(target: Target | Target[] | ArrayLike<Target>, vars: TweenOptions, position?: Position): this;
111
+ call(fn: () => void, position?: Position): this;
112
+ label(name: string, position?: Position): this;
113
+ /** Time of a label, ms. */
114
+ labelTime(name: string): number | undefined;
115
+ remove(item: Playable): void;
116
+ /** Children in start order (callbacks excluded). */
117
+ getChildren(): Playable[];
118
+ protected renderLocal(ms: number): void;
119
+ }
120
+
121
+ /**
122
+ * `motionary/runtime/format-svg` (10.2) — SVG animation with the runtime
123
+ * (original implementation):
124
+ *
125
+ * - **Path geometry** without the DOM (SSR / workers): `parsePath(d)` (all
126
+ * commands, relative + absolute, arcs), `flattenPath(d)`, `pathLength(d)`,
127
+ * `pointAtLength(d, len)`, `samplePath(d, n)`.
128
+ * - **Path morphing**: `morphPath(from, to, { points })` → `(p) => d` — both
129
+ * paths are resampled to the same number of points (any command mix, any
130
+ * point counts), aligned to the closest start point, then interpolated.
131
+ * - **SMIL playback**: `playSmil(svg)` reads `<animate>`, `<set>`,
132
+ * `<animateTransform>` (translate / scale / rotate / skewX / skewY) and
133
+ * `<animateMotion>` (`path` or `<mpath>`, `rotate="auto"`) — `from` / `to` /
134
+ * `by` / `values`, `keyTimes`, `keySplines` (`calcMode="spline"`),
135
+ * `calcMode="discrete"`, `dur`, numeric `begin` offsets, `repeatCount`
136
+ * (incl. `indefinite`), `fill="freeze"` — and replays them as a runtime
137
+ * timeline (seek, scrub, reverse, timeScale) instead of the browser's SMIL clock.
138
+ * - CSS-animated SVG: use `motionary/runtime/format-css` (`@keyframes` in the SVG's `<style>`).
139
+ *
140
+ * Not supported (documented): event / syncbase `begin` values (`click`,
141
+ * `a.end`), `accumulate` / `additive="sum"`, `<animateColor>` (deprecated).
142
+ */
143
+
144
+ type Pt = [number, number];
145
+ type PathCommand = [string, ...number[]];
146
+ /** Parse path data into absolute commands (M L C Q A Z; H/V/S/T expanded). */
147
+ declare function parsePath(d: string): PathCommand[];
148
+ /** Flatten a path into polylines (one per subpath); `segments` points per curve. */
149
+ declare function flattenPath(d: string | PathCommand[], segments?: number): Pt[][];
150
+ /** Total length of a path. */
151
+ declare function pathLength(d: string | PathCommand[]): number;
152
+ /** Point (and tangent angle, degrees) at a distance along the path. */
153
+ declare function pointAtLength(d: string | PathCommand[], len: number): {
154
+ x: number;
155
+ y: number;
156
+ angle: number;
157
+ };
158
+ /** `n` points evenly spaced along the path (all subpaths joined). */
159
+ declare function samplePath(d: string | PathCommand[], n?: number): Pt[];
160
+ /**
161
+ * Morph between two paths of any shape: `const f = morphPath(a, b); el.setAttribute('d', f(0.5))`.
162
+ * Closed paths are rotated so their start points line up (less twisting).
163
+ */
164
+ declare function morphPath(from: string, to: string, o?: {
165
+ points?: number;
166
+ }): (p: number) => string;
167
+ /** '2s', '150ms', '1.5', 'indefinite' → ms (NaN for indefinite / unsupported). */
168
+ declare function smilTime(v: string | null | undefined): number;
169
+ interface SmilAnimationInfo {
170
+ kind: 'animate' | 'set' | 'animateTransform' | 'animateMotion';
171
+ target: Element;
172
+ attribute: string;
173
+ begin: number;
174
+ dur: number;
175
+ repeat: number;
176
+ freeze: boolean;
177
+ values: string[];
178
+ keyTimes: number[];
179
+ calcMode: string;
180
+ type?: string;
181
+ }
182
+ /** Read the SMIL animation elements of an SVG (without playing them). */
183
+ declare function readSmil(svg: Element): SmilAnimationInfo[];
184
+ interface SmilPlayer {
185
+ timeline: Timeline;
186
+ animations: SmilAnimationInfo[];
187
+ /** Put the original SMIL elements back (the browser's clock takes over again). */
188
+ restore(): void;
189
+ }
190
+ /**
191
+ * Replay an SVG's SMIL animations with the runtime. The SMIL elements are
192
+ * detached while the runtime drives the attributes (call `restore()` to put
193
+ * them back). Playing unless `paused: true`.
194
+ */
195
+ declare function playSmil(svg: Element, o?: {
196
+ paused?: boolean;
197
+ timeScale?: number;
198
+ }): SmilPlayer;
199
+ interface FormatSvgApi {
200
+ parsePath: typeof parsePath;
201
+ flattenPath: typeof flattenPath;
202
+ pathLength: typeof pathLength;
203
+ pointAtLength: typeof pointAtLength;
204
+ samplePath: typeof samplePath;
205
+ morphPath: typeof morphPath;
206
+ readSmil: typeof readSmil;
207
+ playSmil: typeof playSmil;
208
+ smilTime: typeof smilTime;
209
+ }
210
+ /** The module object for `use(formatSvg)`. */
211
+ declare const formatSvg: RuntimeModule<FormatSvgApi>;
212
+
213
+ export { flattenPath, formatSvg, morphPath, parsePath, pathLength, playSmil, pointAtLength, readSmil, samplePath, smilTime };
214
+ export type { FormatSvgApi, PathCommand, SmilAnimationInfo, SmilPlayer };
@@ -0,0 +1,2 @@
1
+ !function(t,e,r,n){"use strict";const i={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0};function a(t){const e=t.match(/[a-zA-Z]|[-+]?(?:\d*\.\d+|\d+\.?)(?:[eE][-+]?\d+)?/g)||[],r=[];let n=0,a="",s=0,o=0,u=0,l=0,h=null,c=null;const m=()=>parseFloat(e[n++]);for(;n<e.length;){if(/[a-zA-Z]/.test(e[n]))a=e[n++];else if(!a)throw new Error("[motionary] format-svg: path must start with a command");const t=a.toUpperCase(),p=a!==t,f=i[t];if(void 0===f)throw new Error(`[motionary] format-svg: unknown path command "${a}"`);if("Z"===t){r.push(["Z"]),s=u,o=l,h=c=null;continue}const g=[];for(let t=0;t<f;t++)g.push(m());if(g.some(t=>Number.isNaN(t)))break;const b=p?s:0,d=p?o:0;switch(t){case"M":s=g[0]+b,o=g[1]+d,u=s,l=o,r.push(["M",s,o]),a=p?"l":"L",h=c=null;break;case"L":s=g[0]+b,o=g[1]+d,r.push(["L",s,o]),h=c=null;break;case"H":s=g[0]+b,r.push(["L",s,o]),h=c=null;break;case"V":o=g[0]+(p?o:0),r.push(["L",s,o]),h=c=null;break;case"C":{const t=[g[0]+b,g[1]+d,g[2]+b,g[3]+d,g[4]+b,g[5]+d];r.push(["C",...t]),h=[t[2],t[3]],s=t[4],o=t[5],c=null;break}case"S":{const t=h?[2*s-h[0],2*o-h[1]]:[s,o],e=[g[0]+b,g[1]+d,g[2]+b,g[3]+d];r.push(["C",t[0],t[1],...e]),h=[e[0],e[1]],s=e[2],o=e[3],c=null;break}case"Q":{const t=[g[0]+b,g[1]+d,g[2]+b,g[3]+d];r.push(["Q",...t]),c=[t[0],t[1]],s=t[2],o=t[3],h=null;break}case"T":{const t=c?[2*s-c[0],2*o-c[1]]:[s,o];s=g[0]+b,o=g[1]+d,r.push(["Q",t[0],t[1],s,o]),c=t,h=null;break}case"A":s=g[5]+b,o=g[6]+d,r.push(["A",g[0],g[1],g[2],g[3],g[4],s,o]),h=c=null}}return r}function s(t,e,r,n,i,a,s,o,u,l){if(!r||!n)return[[o,u]];r=Math.abs(r),n=Math.abs(n);const h=i*Math.PI/180,c=Math.cos(h),m=Math.sin(h),p=(t-o)/2,f=(e-u)/2,g=c*p+m*f,b=-m*p+c*f,d=g*g/(r*r)+b*b/(n*n);d>1&&(r*=Math.sqrt(d),n*=Math.sqrt(d));const M=r*r*n*n-r*r*b*b-n*n*g*g,A=r*r*b*b+n*n*g*g;let y=Math.sqrt(Math.max(0,M/A));a===s&&(y=-y);const k=y*r*b/n,S=-y*n*g/r,v=c*k-m*S+(t+o)/2,$=m*k+c*S+(e+u)/2,N=(t,e,r,n)=>Math.atan2(t*n-e*r,t*r+e*n),T=N(1,0,(g-k)/r,(b-S)/n);let w=N((g-k)/r,(b-S)/n,(-g-k)/r,(-b-S)/n);!s&&w>0&&(w-=2*Math.PI),s&&w<0&&(w+=2*Math.PI);const x=Math.max(2,Math.ceil(Math.abs(w)/(Math.PI/2)*l)),P=[];for(let t=1;t<=x;t++){const e=T+w*t/x;P.push([v+r*Math.cos(e)*c-n*Math.sin(e)*m,$+r*Math.cos(e)*m+n*Math.sin(e)*c])}return P}function o(t,e=16){const r="string"==typeof t?a(t):t,n=[];let i=[],o=0,u=0;for(const t of r){const[r,...a]=t;if("M"===r){i.length&&n.push(i),i=[[a[0],a[1]]],o=a[0],u=a[1];continue}if(i.length||(i=[[o,u]]),"L"===r)i.push([a[0],a[1]]);else if("C"===r)for(let t=1;t<=e;t++){const r=t/e,n=1-r;i.push([n*n*n*o+3*n*n*r*a[0]+3*n*r*r*a[2]+r*r*r*a[4],n*n*n*u+3*n*n*r*a[1]+3*n*r*r*a[3]+r*r*r*a[5]])}else if("Q"===r)for(let t=1;t<=e;t++){const r=t/e,n=1-r;i.push([n*n*o+2*n*r*a[0]+r*r*a[2],n*n*u+2*n*r*a[1]+r*r*a[3]])}else if("A"===r)i.push(...s(o,u,a[0],a[1],a[2],a[3],a[4],a[5],a[6],e/4));else if("Z"===r){i.push([i[0][0],i[0][1]]),n.push(i),o=i[0][0],u=i[0][1],i=[];continue}const l=i[i.length-1];o=l[0],u=l[1]}return i.length&&n.push(i),n}const u=(t,e)=>Math.hypot(e[0]-t[0],e[1]-t[1]);function l(t){return o(t,48).reduce((t,e)=>t+e.slice(1).reduce((t,r,n)=>t+u(e[n],r),0),0)}function h(t,e){const r=o(t,48).flat();let n=0;for(let t=1;t<r.length;t++){const i=u(r[t-1],r[t]);if(n+i>=e||t===r.length-1){const a=i?Math.min(1,Math.max(0,(e-n)/i)):0;return{x:r[t-1][0]+(r[t][0]-r[t-1][0])*a,y:r[t-1][1]+(r[t][1]-r[t-1][1])*a,angle:180*Math.atan2(r[t][1]-r[t-1][1],r[t][0]-r[t-1][0])/Math.PI}}n+=i}return{x:r[0]?.[0]??0,y:r[0]?.[1]??0,angle:0}}function c(t,e=64){const r=l(t);return Array.from({length:e},(n,i)=>{const a=h(t,r*i/(e-1||1));return[a.x,a.y]})}const m=t=>Math.round(1e3*t)/1e3,p=t=>/z\s*$/i.test(t.trim());function f(t,e,r={}){const n=r.points??64,i=c(t,n);let a=c(e,n);const s=p(t)&&p(e);if(s){let t=0,e=1/0;for(let r=0;r<n;r++){let s=0;for(let t=0;t<n;t+=4)s+=u(i[t],a[(t+r)%n]);s<e&&(e=s,t=r)}a=a.map((e,r)=>a[(r+t)%n])}return r=>r<=0?t:r>=1?e:"M"+i.map((t,e)=>`${m(t[0]+(a[e][0]-t[0])*r)} ${m(t[1]+(a[e][1]-t[1])*r)}`).join("L")+(s?"Z":"")}function g(t){if(!t)return NaN;const e=t.trim(),r=/^(-?[\d.]+)(ms|s|min|h)?$/.exec(e);if(!r){const t=/^(?:(\d+):)?(\d+):(\d+(?:\.\d+)?)$/.exec(e);return t?1e3*(60*(60*+(t[1]||0)+ +t[2])+ +t[3]):NaN}const n=parseFloat(r[1]);return"ms"===r[2]?n:"min"===r[2]?6e4*n:"h"===r[2]?36e5*n:1e3*n}const b=t=>t.trim().split(/[\s,]+/).filter(Boolean).map(Number),d=(t,e,r)=>{const n=b(t),i=b(e);return n.map((t,e)=>m(t+((i[e]??t)-t)*r)).join(" ")},M=(t,e,n)=>{try{const i=r.parseValue(t),a=r.parseValue(e);if("str"===i.kind||"str"===a.kind)throw 0;if("col"===i.kind||"col"===a.kind){const t="col"===i.kind?i.c:[0,0,0,1],e="col"===a.kind?a.c:[0,0,0,1],r=t.map((t,r)=>t+(e[r]-t)*n);return`rgba(${Math.round(r[0])},${Math.round(r[1])},${Math.round(r[2])},${m(r[3])})`}return`${m(i.v+(a.v-i.v)*n)}${a.u||i.u}`}catch{return/^[-\d.\s,e]+$/i.test(t)&&/^[-\d.\s,e]+$/i.test(e)?d(t,e,n):n<.5?t:e}};function A(t){const e=[];return t.querySelectorAll("animate, set, animateTransform, animateMotion").forEach(r=>{const n=r.localName,i=r.getAttribute("href")||r.getAttribute("xlink:href"),a=i?t.querySelector(i):r.parentElement;if(!a)return;const s=g((r.getAttribute("begin")||"0").split(";")[0]),o="set"===n?g(r.getAttribute("dur"))||0:g(r.getAttribute("dur")),u=r.getAttribute("repeatCount"),l=g(r.getAttribute("repeatDur"));let h="indefinite"===u||"indefinite"===r.getAttribute("repeatDur")?-1:u?Math.max(0,Math.ceil(parseFloat(u))-1):0;!u&&l>0&&o>0&&(h=Math.ceil(l/o)-1);const c="animateTransform"===n||"animateMotion"===n?"transform":r.getAttribute("attributeName")||"";let m;const p=r.getAttribute("values");if("set"===n)m=[r.getAttribute("to")||""];else if("animateMotion"===n){const e=r.querySelector("mpath"),n=e&&(e.getAttribute("href")||e.getAttribute("xlink:href"));m=[n&&t.querySelector(n)?.getAttribute("d")||r.getAttribute("path")||""]}else if(p)m=p.split(";").map(t=>t.trim()).filter(t=>""!==t);else{const t=a.getAttribute(c)||("opacity"===c?"1":"0"),e=r.getAttribute("from")??t,n=r.getAttribute("by");m=[e,r.getAttribute("to")??(null!==n?b(e).map((t,e)=>t+(b(n)[e]??0)).join(" "):t)]}const f=r.getAttribute("keyTimes");e.push({kind:n,target:a,attribute:c,begin:Number.isFinite(s)?s:0,dur:Number.isFinite(o)?o:0,repeat:h,freeze:"freeze"===r.getAttribute("fill")||"set"===n&&!r.getAttribute("dur"),values:m,keyTimes:f?f.split(";").map(Number):[],calcMode:r.getAttribute("calcMode")||("animateMotion"===n?"paced":"linear"),type:r.getAttribute("type")||void 0,...r.getAttribute("rotate")?{rotate:r.getAttribute("rotate")}:{},...r.getAttribute("keySplines")?{keySplines:r.getAttribute("keySplines")}:{}})}),e}class y extends r.Playable{constructor(t){super({repeat:t.repeat}),this.info=t,this.morphs=[],this.base=t.target.getAttribute(t.attribute),this.interp="d"===t.attribute?(t,e,r)=>this.morph(t,e)(r):"animateTransform"===t.kind?d:M,this.splines=(t.keySplines||"").split(";").filter(t=>t.trim()).map(t=>{const e=b(t);return n.cubicBezier(e[0],e[1],e[2],e[3])})}morph(t,e){const r=t+"|"+e;return this.morphs[r]||(this.morphs[r]=f(t,e))}get duration(){return this.info.dur}write(t){const{kind:e,target:r,type:n}=this.info;"animateTransform"===e?r.setAttribute("transform",`${n||"translate"}(${t})`):r.setAttribute(this.info.attribute,t)}renderLocal(t,e){const r=this.info;if(e&&t>=r.dur&&!r.freeze&&this.repeat>=0)return void(null===this.base?r.target.removeAttribute(r.attribute):r.target.setAttribute(r.attribute,this.base));const n=r.dur?Math.min(1,t/r.dur):1;if("set"===r.kind)return this.write(r.values[0]);if("animateMotion"===r.kind){const t=r.values[0],e=h(t,l(t)*n),i=r.rotate,a="auto"===i?e.angle:"auto-reverse"===i?e.angle+180:parseFloat(i)||0;return void r.target.setAttribute("transform",`translate(${m(e.x)} ${m(e.y)})${a?` rotate(${m(a)})`:""}`)}const i=r.values;if(1===i.length)return this.write(i[0]);const a=r.keyTimes.length===i.length?r.keyTimes:i.map((t,e)=>e/(i.length-1));if("discrete"===r.calcMode){const t=r.keyTimes.length===i.length?r.keyTimes:i.map((t,e)=>e/i.length);let e=0;for(;e<t.length-1&&n>=t[e+1];)e++;return this.write(i[e])}let s=0;for(;s<a.length-2&&n>a[s+1];)s++;const o=a[s+1]-a[s]||1;let u=Math.min(1,Math.max(0,(n-a[s])/o));"spline"===r.calcMode&&this.splines[s]&&(u=this.splines[s](u)),this.write(this.interp(i[s],i[s+1],u))}}function k(t,e={}){const n=A(t),i=Array.from(t.querySelectorAll("animate, set, animateTransform, animateMotion")),a=i.map(t=>[t,t.parentNode,t.nextSibling]);i.forEach(t=>t.remove());const s=new r.Timeline({});for(const t of n)s.add(new y(t),t.begin);return e.timeScale&&(s.timeScale=e.timeScale),e.paused||s.play(),{timeline:s,animations:n,restore(){s.kill(),a.forEach(([t,e,r])=>e?.insertBefore(t,r&&r.parentNode===e?r:null))}}}const S={id:"format-svg",version:e.RUNTIME_VERSION,requires:["core"],api:{parsePath:a,flattenPath:o,pathLength:l,pointAtLength:h,samplePath:c,morphPath:f,readSmil:A,playSmil:k,smilTime:g}};e.register(S),t.flattenPath=o,t.formatSvg=S,t.morphPath=f,t.parsePath=a,t.pathLength=l,t.playSmil=k,t.pointAtLength=h,t.readSmil=A,t.samplePath=c,t.smilTime=g}(this.MotionaryRuntime=this.MotionaryRuntime||{},MotionaryRuntime,MotionaryRuntime,MotionaryRuntime);
2
+ //# sourceMappingURL=format-svg.iife.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-svg.iife.js","sources":["../../src/runtime/format-svg.ts","../../src/runtime/iife/format-svg.ts"],"sourcesContent":["/**\n * `motionary/runtime/format-svg` (10.2) — SVG animation with the runtime\n * (original implementation):\n *\n * - **Path geometry** without the DOM (SSR / workers): `parsePath(d)` (all\n * commands, relative + absolute, arcs), `flattenPath(d)`, `pathLength(d)`,\n * `pointAtLength(d, len)`, `samplePath(d, n)`.\n * - **Path morphing**: `morphPath(from, to, { points })` → `(p) => d` — both\n * paths are resampled to the same number of points (any command mix, any\n * point counts), aligned to the closest start point, then interpolated.\n * - **SMIL playback**: `playSmil(svg)` reads `<animate>`, `<set>`,\n * `<animateTransform>` (translate / scale / rotate / skewX / skewY) and\n * `<animateMotion>` (`path` or `<mpath>`, `rotate=\"auto\"`) — `from` / `to` /\n * `by` / `values`, `keyTimes`, `keySplines` (`calcMode=\"spline\"`),\n * `calcMode=\"discrete\"`, `dur`, numeric `begin` offsets, `repeatCount`\n * (incl. `indefinite`), `fill=\"freeze\"` — and replays them as a runtime\n * timeline (seek, scrub, reverse, timeScale) instead of the browser's SMIL clock.\n * - CSS-animated SVG: use `motionary/runtime/format-css` (`@keyframes` in the SVG's `<style>`).\n *\n * Not supported (documented): event / syncbase `begin` values (`click`,\n * `a.end`), `accumulate` / `additive=\"sum\"`, `<animateColor>` (deprecated).\n */\nimport { RUNTIME_VERSION, type RuntimeModule } from './registry';\nimport { Playable, Timeline, parseValue } from './tween';\nimport { cubicBezier, type Ease } from './ease';\n\ntype Pt = [number, number];\nexport type PathCommand = [string, ...number[]];\n\nconst ARGS: Record<string, number> = { M: 2, L: 2, H: 1, V: 1, C: 6, S: 4, Q: 4, T: 2, A: 7, Z: 0 };\n\n/** Parse path data into absolute commands (M L C Q A Z; H/V/S/T expanded). */\nexport function parsePath(d: string): PathCommand[] {\n const toks = d.match(/[a-zA-Z]|[-+]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][-+]?\\d+)?/g) || [];\n const out: PathCommand[] = [];\n let i = 0, cmd = '', x = 0, y = 0, sx = 0, sy = 0, lc: Pt | null = null, lq: Pt | null = null;\n const num = () => parseFloat(toks[i++]);\n while (i < toks.length) {\n if (/[a-zA-Z]/.test(toks[i])) cmd = toks[i++];\n else if (!cmd) throw new Error('[motionary] format-svg: path must start with a command');\n const C = cmd.toUpperCase(), rel = cmd !== C;\n const n = ARGS[C];\n if (n === undefined) throw new Error(`[motionary] format-svg: unknown path command \"${cmd}\"`);\n if (C === 'Z') {\n out.push(['Z']);\n x = sx; y = sy; lc = lq = null;\n continue;\n }\n const a: number[] = [];\n for (let k = 0; k < n; k++) a.push(num());\n if (a.some((v) => Number.isNaN(v))) break;\n const ox = rel ? x : 0, oy = rel ? y : 0;\n switch (C) {\n case 'M': x = a[0] + ox; y = a[1] + oy; sx = x; sy = y; out.push(['M', x, y]); cmd = rel ? 'l' : 'L'; lc = lq = null; break;\n case 'L': x = a[0] + ox; y = a[1] + oy; out.push(['L', x, y]); lc = lq = null; break;\n case 'H': x = a[0] + ox; out.push(['L', x, y]); lc = lq = null; break;\n case 'V': y = a[0] + (rel ? y : 0); out.push(['L', x, y]); lc = lq = null; break;\n case 'C': { const c = [a[0] + ox, a[1] + oy, a[2] + ox, a[3] + oy, a[4] + ox, a[5] + oy]; out.push(['C', ...c]); lc = [c[2], c[3]]; x = c[4]; y = c[5]; lq = null; break; }\n case 'S': { const c1: Pt = lc ? [2 * x - lc[0], 2 * y - lc[1]] : [x, y]; const c = [a[0] + ox, a[1] + oy, a[2] + ox, a[3] + oy]; out.push(['C', c1[0], c1[1], ...c]); lc = [c[0], c[1]]; x = c[2]; y = c[3]; lq = null; break; }\n case 'Q': { const c = [a[0] + ox, a[1] + oy, a[2] + ox, a[3] + oy]; out.push(['Q', ...c]); lq = [c[0], c[1]]; x = c[2]; y = c[3]; lc = null; break; }\n case 'T': { const c1: Pt = lq ? [2 * x - lq[0], 2 * y - lq[1]] : [x, y]; x = a[0] + ox; y = a[1] + oy; out.push(['Q', c1[0], c1[1], x, y]); lq = c1; lc = null; break; }\n case 'A': { x = a[5] + ox; y = a[6] + oy; out.push(['A', a[0], a[1], a[2], a[3], a[4], x, y]); lc = lq = null; break; }\n }\n }\n return out;\n}\n\n/** Endpoint-parameterised arc → points (SVG spec F.6.5 conversion). */\nfunction arcPoints(x1: number, y1: number, rx: number, ry: number, phiDeg: number, large: number, sweep: number, x2: number, y2: number, seg: number): Pt[] {\n if (!rx || !ry) return [[x2, y2]];\n rx = Math.abs(rx); ry = Math.abs(ry);\n const phi = (phiDeg * Math.PI) / 180, cos = Math.cos(phi), sin = Math.sin(phi);\n const dx = (x1 - x2) / 2, dy = (y1 - y2) / 2;\n const xp = cos * dx + sin * dy, yp = -sin * dx + cos * dy;\n const lam = (xp * xp) / (rx * rx) + (yp * yp) / (ry * ry);\n if (lam > 1) { rx *= Math.sqrt(lam); ry *= Math.sqrt(lam); }\n const num = rx * rx * ry * ry - rx * rx * yp * yp - ry * ry * xp * xp;\n const den = rx * rx * yp * yp + ry * ry * xp * xp;\n let co = Math.sqrt(Math.max(0, num / den));\n if (large === sweep) co = -co;\n const cxp = (co * rx * yp) / ry, cyp = (-co * ry * xp) / rx;\n const cx = cos * cxp - sin * cyp + (x1 + x2) / 2, cy = sin * cxp + cos * cyp + (y1 + y2) / 2;\n const ang = (ux: number, uy: number, vx: number, vy: number) => Math.atan2(ux * vy - uy * vx, ux * vx + uy * vy);\n const t1 = ang(1, 0, (xp - cxp) / rx, (yp - cyp) / ry);\n let dt = ang((xp - cxp) / rx, (yp - cyp) / ry, (-xp - cxp) / rx, (-yp - cyp) / ry);\n if (!sweep && dt > 0) dt -= 2 * Math.PI;\n if (sweep && dt < 0) dt += 2 * Math.PI;\n const n = Math.max(2, Math.ceil((Math.abs(dt) / (Math.PI / 2)) * seg));\n const pts: Pt[] = [];\n for (let k = 1; k <= n; k++) {\n const t = t1 + (dt * k) / n;\n pts.push([cx + rx * Math.cos(t) * cos - ry * Math.sin(t) * sin, cy + rx * Math.cos(t) * sin + ry * Math.sin(t) * cos]);\n }\n return pts;\n}\n\n/** Flatten a path into polylines (one per subpath); `segments` points per curve. */\nexport function flattenPath(d: string | PathCommand[], segments = 16): Pt[][] {\n const cmds = typeof d === 'string' ? parsePath(d) : d;\n const subs: Pt[][] = [];\n let cur: Pt[] = [], x = 0, y = 0;\n for (const c of cmds) {\n const [k, ...a] = c;\n if (k === 'M') { if (cur.length) subs.push(cur); cur = [[a[0], a[1]]]; x = a[0]; y = a[1]; continue; }\n if (!cur.length) cur = [[x, y]];\n if (k === 'L') cur.push([a[0], a[1]]);\n else if (k === 'C') for (let i = 1; i <= segments; i++) { const t = i / segments, u = 1 - t; cur.push([u * u * u * x + 3 * u * u * t * a[0] + 3 * u * t * t * a[2] + t * t * t * a[4], u * u * u * y + 3 * u * u * t * a[1] + 3 * u * t * t * a[3] + t * t * t * a[5]]); }\n else if (k === 'Q') for (let i = 1; i <= segments; i++) { const t = i / segments, u = 1 - t; cur.push([u * u * x + 2 * u * t * a[0] + t * t * a[2], u * u * y + 2 * u * t * a[1] + t * t * a[3]]); }\n else if (k === 'A') cur.push(...arcPoints(x, y, a[0], a[1], a[2], a[3], a[4], a[5], a[6], segments / 4));\n else if (k === 'Z') { cur.push([cur[0][0], cur[0][1]]); subs.push(cur); x = cur[0][0]; y = cur[0][1]; cur = []; continue; }\n const last = cur[cur.length - 1];\n x = last[0]; y = last[1];\n }\n if (cur.length) subs.push(cur);\n return subs;\n}\n\nconst dist = (a: Pt, b: Pt) => Math.hypot(b[0] - a[0], b[1] - a[1]);\n\n/** Total length of a path. */\nexport function pathLength(d: string | PathCommand[]): number {\n return flattenPath(d, 48).reduce((s, pl) => s + pl.slice(1).reduce((t, p, i) => t + dist(pl[i], p), 0), 0);\n}\n\n/** Point (and tangent angle, degrees) at a distance along the path. */\nexport function pointAtLength(d: string | PathCommand[], len: number): { x: number; y: number; angle: number } {\n const pl = flattenPath(d, 48).flat();\n let acc = 0;\n for (let i = 1; i < pl.length; i++) {\n const s = dist(pl[i - 1], pl[i]);\n if (acc + s >= len || i === pl.length - 1) {\n const t = s ? Math.min(1, Math.max(0, (len - acc) / s)) : 0;\n return { x: pl[i - 1][0] + (pl[i][0] - pl[i - 1][0]) * t, y: pl[i - 1][1] + (pl[i][1] - pl[i - 1][1]) * t, angle: (Math.atan2(pl[i][1] - pl[i - 1][1], pl[i][0] - pl[i - 1][0]) * 180) / Math.PI };\n }\n acc += s;\n }\n return { x: pl[0]?.[0] ?? 0, y: pl[0]?.[1] ?? 0, angle: 0 };\n}\n\n/** `n` points evenly spaced along the path (all subpaths joined). */\nexport function samplePath(d: string | PathCommand[], n = 64): Pt[] {\n const total = pathLength(d);\n return Array.from({ length: n }, (_, i) => {\n const p = pointAtLength(d, (total * i) / (n - 1 || 1));\n return [p.x, p.y] as Pt;\n });\n}\n\nconst r3 = (v: number) => Math.round(v * 1000) / 1000;\nconst closed = (d: string) => /z\\s*$/i.test(d.trim());\n\n/**\n * Morph between two paths of any shape: `const f = morphPath(a, b); el.setAttribute('d', f(0.5))`.\n * Closed paths are rotated so their start points line up (less twisting).\n */\nexport function morphPath(from: string, to: string, o: { points?: number } = {}): (p: number) => string {\n const n = o.points ?? 64;\n const A = samplePath(from, n);\n let B = samplePath(to, n);\n const isClosed = closed(from) && closed(to);\n if (isClosed) {\n let best = 0, bestD = Infinity;\n for (let s = 0; s < n; s++) {\n let sum = 0;\n for (let i = 0; i < n; i += 4) sum += dist(A[i], B[(i + s) % n]);\n if (sum < bestD) { bestD = sum; best = s; }\n }\n B = B.map((_, i) => B[(i + best) % n]);\n }\n return (p) => {\n if (p <= 0) return from;\n if (p >= 1) return to;\n return 'M' + A.map((a, i) => `${r3(a[0] + (B[i][0] - a[0]) * p)} ${r3(a[1] + (B[i][1] - a[1]) * p)}`).join('L') + (isClosed ? 'Z' : '');\n };\n}\n\n/* ------------------------------------------------------------------ SMIL */\n\n/** '2s', '150ms', '1.5', 'indefinite' → ms (NaN for indefinite / unsupported). */\nexport function smilTime(v: string | null | undefined): number {\n if (!v) return NaN;\n const s = v.trim();\n const m = /^(-?[\\d.]+)(ms|s|min|h)?$/.exec(s);\n if (!m) {\n const c = /^(?:(\\d+):)?(\\d+):(\\d+(?:\\.\\d+)?)$/.exec(s);\n return c ? ((+(c[1] || 0) * 60 + +c[2]) * 60 + +c[3]) * 1000 : NaN;\n }\n const n = parseFloat(m[1]);\n return m[2] === 'ms' ? n : m[2] === 'min' ? n * 60000 : m[2] === 'h' ? n * 3600000 : n * 1000;\n}\n\ntype Interp = (a: string, b: string, p: number) => string;\nconst numList = (s: string) => s.trim().split(/[\\s,]+/).filter(Boolean).map(Number);\nconst lerpNumbers: Interp = (a, b, p) => {\n const x = numList(a), y = numList(b);\n return x.map((v, i) => r3(v + ((y[i] ?? v) - v) * p)).join(' ');\n};\nconst lerpAny: Interp = (a, b, p) => {\n try {\n const x = parseValue(a), y = parseValue(b);\n if ((x as { kind: string }).kind === 'str' || (y as { kind: string }).kind === 'str') throw 0; // number lists / keywords: handled below\n if (x.kind === 'col' || y.kind === 'col') {\n const ca = x.kind === 'col' ? x.c : [0, 0, 0, 1], cb = y.kind === 'col' ? y.c : [0, 0, 0, 1];\n const c = ca.map((v, i) => v + (cb[i] - v) * p);\n return `rgba(${Math.round(c[0])},${Math.round(c[1])},${Math.round(c[2])},${r3(c[3])})`;\n }\n return `${r3(x.v + (y.v - x.v) * p)}${y.u || x.u}`;\n } catch {\n if (/^[-\\d.\\s,e]+$/i.test(a) && /^[-\\d.\\s,e]+$/i.test(b)) return lerpNumbers(a, b, p);\n return p < 0.5 ? a : b;\n }\n};\n\nexport interface SmilAnimationInfo {\n kind: 'animate' | 'set' | 'animateTransform' | 'animateMotion';\n target: Element;\n attribute: string;\n begin: number;\n dur: number;\n repeat: number;\n freeze: boolean;\n values: string[];\n keyTimes: number[];\n calcMode: string;\n type?: string;\n}\n\n/** Read the SMIL animation elements of an SVG (without playing them). */\nexport function readSmil(svg: Element): SmilAnimationInfo[] {\n const out: SmilAnimationInfo[] = [];\n svg.querySelectorAll('animate, set, animateTransform, animateMotion').forEach((el) => {\n const kind = el.localName as SmilAnimationInfo['kind'];\n const href = el.getAttribute('href') || el.getAttribute('xlink:href');\n const target = href ? svg.querySelector(href) : el.parentElement;\n if (!target) return;\n const begin = smilTime((el.getAttribute('begin') || '0').split(';')[0]);\n const dur = kind === 'set' ? smilTime(el.getAttribute('dur')) || 0 : smilTime(el.getAttribute('dur'));\n const rc = el.getAttribute('repeatCount');\n const rd = smilTime(el.getAttribute('repeatDur'));\n let repeat = rc === 'indefinite' || el.getAttribute('repeatDur') === 'indefinite' ? -1 : rc ? Math.max(0, Math.ceil(parseFloat(rc)) - 1) : 0;\n if (!rc && rd > 0 && dur > 0) repeat = Math.ceil(rd / dur) - 1;\n const attribute = kind === 'animateTransform' ? 'transform' : kind === 'animateMotion' ? 'transform' : el.getAttribute('attributeName') || '';\n let values: string[];\n const v = el.getAttribute('values');\n if (kind === 'set') values = [el.getAttribute('to') || ''];\n else if (kind === 'animateMotion') {\n const mp = el.querySelector('mpath');\n const ref = mp && (mp.getAttribute('href') || mp.getAttribute('xlink:href'));\n values = [(ref && svg.querySelector(ref)?.getAttribute('d')) || el.getAttribute('path') || ''];\n } else if (v) values = v.split(';').map((s) => s.trim()).filter((s) => s !== '');\n else {\n const base = target.getAttribute(attribute) || (attribute === 'opacity' ? '1' : '0');\n const from = el.getAttribute('from') ?? base;\n const by = el.getAttribute('by');\n const to = el.getAttribute('to') ?? (by !== null ? numList(from).map((x, i) => x + (numList(by)[i] ?? 0)).join(' ') : base);\n values = [from, to];\n }\n const kt = el.getAttribute('keyTimes');\n out.push({ kind, target, attribute, begin: Number.isFinite(begin) ? begin : 0, dur: Number.isFinite(dur) ? dur : 0, repeat, freeze: el.getAttribute('fill') === 'freeze' || (kind === 'set' && !el.getAttribute('dur')) /* a <set> without dur holds its value */, values, keyTimes: kt ? kt.split(';').map(Number) : [], calcMode: el.getAttribute('calcMode') || (kind === 'animateMotion' ? 'paced' : 'linear'), type: el.getAttribute('type') || undefined, ...(el.getAttribute('rotate') ? { rotate: el.getAttribute('rotate') } : {}), ...(el.getAttribute('keySplines') ? { keySplines: el.getAttribute('keySplines') } : {}) } as SmilAnimationInfo);\n });\n return out;\n}\n\n/** One SMIL animation replayed as a runtime Playable. */\nclass SmilTrack extends Playable {\n private interp: Interp;\n private splines: Ease[];\n private base: string | null;\n private morphs: ((p: number) => string)[] = [];\n constructor(private info: SmilAnimationInfo & { rotate?: string; keySplines?: string }) {\n super({ repeat: info.repeat });\n this.base = info.target.getAttribute(info.attribute);\n this.interp = info.attribute === 'd' ? (a, b, p) => this.morph(a, b)(p) : info.kind === 'animateTransform' ? lerpNumbers : lerpAny;\n this.splines = (info.keySplines || '').split(';').filter((s) => s.trim()).map((s) => { const n = numList(s); return cubicBezier(n[0], n[1], n[2], n[3]); });\n }\n private morph(a: string, b: string): (p: number) => string {\n const key = a + '|' + b;\n const hit = (this.morphs as any)[key];\n return hit || ((this.morphs as any)[key] = morphPath(a, b));\n }\n get duration(): number {\n return this.info.dur;\n }\n private write(v: string): void {\n const { kind, target, type } = this.info;\n if (kind === 'animateTransform') target.setAttribute('transform', `${type || 'translate'}(${v})`);\n else target.setAttribute(this.info.attribute, v);\n }\n protected renderLocal(ms: number, ended: boolean): void {\n const i = this.info;\n if (ended && ms >= i.dur && !i.freeze && this.repeat >= 0) {\n if (this.base === null) i.target.removeAttribute(i.attribute);\n else i.target.setAttribute(i.attribute, this.base);\n return;\n }\n const p = i.dur ? Math.min(1, ms / i.dur) : 1;\n if (i.kind === 'set') return this.write(i.values[0]);\n if (i.kind === 'animateMotion') {\n const d = i.values[0];\n const len = pathLength(d);\n const pt = pointAtLength(d, len * p);\n const rot = (i as any).rotate;\n const a = rot === 'auto' ? pt.angle : rot === 'auto-reverse' ? pt.angle + 180 : parseFloat(rot) || 0;\n i.target.setAttribute('transform', `translate(${r3(pt.x)} ${r3(pt.y)})${a ? ` rotate(${r3(a)})` : ''}`);\n return;\n }\n const vals = i.values;\n if (vals.length === 1) return this.write(vals[0]);\n const kt = i.keyTimes.length === vals.length ? i.keyTimes : vals.map((_, k) => k / (vals.length - 1));\n if (i.calcMode === 'discrete') {\n const kd = i.keyTimes.length === vals.length ? i.keyTimes : vals.map((_, k) => k / vals.length);\n let k = 0;\n while (k < kd.length - 1 && p >= kd[k + 1]) k++;\n return this.write(vals[k]);\n }\n let k = 0;\n while (k < kt.length - 2 && p > kt[k + 1]) k++;\n const span = kt[k + 1] - kt[k] || 1;\n let local = Math.min(1, Math.max(0, (p - kt[k]) / span));\n if (i.calcMode === 'spline' && this.splines[k]) local = this.splines[k](local);\n this.write(this.interp(vals[k], vals[k + 1], local));\n }\n}\n\nexport interface SmilPlayer {\n timeline: Timeline;\n animations: SmilAnimationInfo[];\n /** Put the original SMIL elements back (the browser's clock takes over again). */\n restore(): void;\n}\n\n/**\n * Replay an SVG's SMIL animations with the runtime. The SMIL elements are\n * detached while the runtime drives the attributes (call `restore()` to put\n * them back). Playing unless `paused: true`.\n */\nexport function playSmil(svg: Element, o: { paused?: boolean; timeScale?: number } = {}): SmilPlayer {\n const animations = readSmil(svg);\n const els = Array.from(svg.querySelectorAll('animate, set, animateTransform, animateMotion'));\n const parents = els.map((e) => [e, e.parentNode, e.nextSibling] as const);\n els.forEach((e) => e.remove());\n const tl = new Timeline({});\n for (const a of animations) tl.add(new SmilTrack(a), a.begin);\n if (o.timeScale) tl.timeScale = o.timeScale;\n if (!o.paused) tl.play();\n return {\n timeline: tl,\n animations,\n restore() {\n tl.kill();\n parents.forEach(([e, p, next]) => p?.insertBefore(e, next && next.parentNode === p ? next : null));\n },\n };\n}\n\nexport interface FormatSvgApi {\n parsePath: typeof parsePath;\n flattenPath: typeof flattenPath;\n pathLength: typeof pathLength;\n pointAtLength: typeof pointAtLength;\n samplePath: typeof samplePath;\n morphPath: typeof morphPath;\n readSmil: typeof readSmil;\n playSmil: typeof playSmil;\n smilTime: typeof smilTime;\n}\n\n/** The module object for `use(formatSvg)`. */\nexport const formatSvg: RuntimeModule<FormatSvgApi> = { id: 'format-svg', version: RUNTIME_VERSION, requires: ['core'], api: { parsePath, flattenPath, pathLength, pointAtLength, samplePath, morphPath, readSmil, playSmil, smilTime } };\n","// CDN build: load runtime.iife.js first, then this file → registers motionary/runtime/format-svg and adds its API to window.MotionaryRuntime.\nimport { register } from '../registry';\nimport { formatSvg } from '../format-svg';\nexport * from '../format-svg';\nregister(formatSvg);\n"],"names":["ARGS","M","L","H","V","C","S","Q","T","A","Z","parsePath","d","toks","match","out","i","cmd","x","y","sx","sy","lc","lq","num","parseFloat","length","test","Error","toUpperCase","rel","n","undefined","push","a","k","some","v","Number","isNaN","ox","oy","c","c1","arcPoints","x1","y1","rx","ry","phiDeg","large","sweep","x2","y2","seg","Math","abs","phi","PI","cos","sin","dx","dy","xp","yp","lam","sqrt","den","co","max","cxp","cyp","cx","cy","ang","ux","uy","vx","vy","atan2","t1","dt","ceil","pts","t","flattenPath","segments","cmds","subs","cur","u","last","dist","b","hypot","pathLength","reduce","s","pl","slice","p","pointAtLength","len","flat","acc","min","angle","samplePath","total","Array","from","_","r3","round","closed","trim","morphPath","to","o","points","B","isClosed","best","bestD","Infinity","sum","map","join","smilTime","NaN","m","exec","numList","split","filter","Boolean","lerpNumbers","lerpAny","parseValue","kind","ca","cb","readSmil","svg","querySelectorAll","forEach","el","localName","href","getAttribute","target","querySelector","parentElement","begin","dur","rc","rd","repeat","attribute","values","mp","ref","base","by","kt","isFinite","freeze","keyTimes","calcMode","type","rotate","keySplines","SmilTrack","Playable","constructor","info","super","this","morphs","interp","morph","splines","cubicBezier","key","duration","write","setAttribute","renderLocal","ms","ended","removeAttribute","pt","rot","vals","kd","span","local","playSmil","animations","els","parents","e","parentNode","nextSibling","remove","tl","Timeline","add","timeScale","paused","play","timeline","restore","kill","next","insertBefore","formatSvg","id","version","RUNTIME_VERSION","requires","api","register"],"mappings":"gCA6BA,MAAMA,E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