motionary 9.9.0 → 10.1.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.
- package/CHANGELOG.md +41 -0
- package/README.md +45 -0
- package/bin/create-motionary-plugin.mjs +124 -0
- package/dist/chunks/{audio-C1uFaOKQ.js → audio-D95jwlOh.js} +3 -3
- package/dist/chunks/{audio-C1uFaOKQ.js.map → audio-D95jwlOh.js.map} +1 -1
- package/dist/chunks/{base-DWYNLg6P.js → base-BnRyfuyM.js} +2 -2
- package/dist/chunks/{base-DWYNLg6P.js.map → base-BnRyfuyM.js.map} +1 -1
- package/dist/chunks/{builtins-DoCY96r9.js → builtins-CqIq1zBv.js} +3 -3
- package/dist/chunks/{builtins-DoCY96r9.js.map → builtins-CqIq1zBv.js.map} +1 -1
- package/dist/chunks/{core-DoR4w-E4.js → core-DsGoL9EY.js} +2 -2
- package/dist/chunks/{core-DoR4w-E4.js.map → core-DsGoL9EY.js.map} +1 -1
- package/dist/chunks/{core-BhuojMcL.js → core-XA2yhn1b.js} +2 -2
- package/dist/chunks/{core-BhuojMcL.js.map → core-XA2yhn1b.js.map} +1 -1
- package/dist/chunks/{fx-XBDr7-dH.js → fx-CtnrFEg9.js} +2 -2
- package/dist/chunks/{fx-XBDr7-dH.js.map → fx-CtnrFEg9.js.map} +1 -1
- package/dist/chunks/{gpu-DvLHwLxy.js → gpu-CDcXiNA8.js} +2 -2
- package/dist/chunks/{gpu-DvLHwLxy.js.map → gpu-CDcXiNA8.js.map} +1 -1
- package/dist/chunks/keyframes-CyH_abhI.js +183 -0
- package/dist/chunks/keyframes-CyH_abhI.js.map +1 -0
- package/dist/chunks/keyframes-cUdsXSXQ.cjs +187 -0
- package/dist/chunks/keyframes-cUdsXSXQ.cjs.map +1 -0
- package/dist/chunks/{manifest-BDpbuI-9.js → manifest-D58HXVY-.js} +2 -2
- package/dist/chunks/{manifest-BDpbuI-9.js.map → manifest-D58HXVY-.js.map} +1 -1
- package/dist/chunks/{player-CYGvna09.js → player-48Zy_NBG.js} +4 -4
- package/dist/chunks/{player-CYGvna09.js.map → player-48Zy_NBG.js.map} +1 -1
- package/dist/chunks/registry-C0xLNq3-.cjs +81 -0
- package/dist/chunks/registry-C0xLNq3-.cjs.map +1 -0
- package/dist/chunks/{registry-BRM2BRRY.js → registry-gFJRpPES.js} +2 -2
- package/dist/chunks/{registry-BRM2BRRY.js.map → registry-gFJRpPES.js.map} +1 -1
- package/dist/chunks/registry-jF8VIA_9.js +69 -0
- package/dist/chunks/registry-jF8VIA_9.js.map +1 -0
- package/dist/chunks/{spring-CAlkc1co.js → spring-CZDNyqWp.js} +2 -2
- package/dist/chunks/{spring-CAlkc1co.js.map → spring-CZDNyqWp.js.map} +1 -1
- package/dist/chunks/tween-DDObu9iA.js +542 -0
- package/dist/chunks/tween-DDObu9iA.js.map +1 -0
- package/dist/chunks/tween-JEthWrjo.cjs +554 -0
- package/dist/chunks/tween-JEthWrjo.cjs.map +1 -0
- package/dist/chunks/{variants-BBfyVPYm.js → variants-GU3yIL4F.js} +2 -2
- package/dist/chunks/{variants-BBfyVPYm.js.map → variants-GU3yIL4F.js.map} +1 -1
- package/dist/components/a11y.js +2 -2
- package/dist/components/angular.js +8 -8
- package/dist/components/background.js +2 -2
- package/dist/components/bridge.js +1 -1
- package/dist/components/cards.js +2 -2
- package/dist/components/click.js +3 -3
- package/dist/components/core.cjs +219 -0
- package/dist/components/core.cjs.map +1 -0
- package/dist/components/core.d.cts +81 -0
- package/dist/components/core.d.ts +81 -0
- package/dist/components/core.js +214 -0
- package/dist/components/core.js.map +1 -0
- package/dist/components/depth.js +3 -3
- package/dist/components/design.js +3 -3
- package/dist/components/dsl.js +2 -2
- package/dist/components/effects.js +9 -9
- package/dist/components/engine.js +2 -2
- package/dist/components/feedback.js +1 -1
- package/dist/components/fx-3d.js +2 -2
- package/dist/components/fx-ai.js +2 -2
- package/dist/components/fx-chart.js +2 -2
- package/dist/components/fx-cinema.js +2 -2
- package/dist/components/fx-cyber.js +2 -2
- package/dist/components/fx-festival.js +2 -2
- package/dist/components/fx-focus.js +2 -2
- package/dist/components/fx-form.js +2 -2
- package/dist/components/fx-game.js +2 -2
- package/dist/components/fx-genart.js +2 -2
- package/dist/components/fx-geo.js +2 -2
- package/dist/components/fx-gesture.js +2 -2
- package/dist/components/fx-gpu.js +3 -3
- package/dist/components/fx-light.js +2 -2
- package/dist/components/fx-lottie.js +2 -2
- package/dist/components/fx-morph.js +2 -2
- package/dist/components/fx-music.js +3 -3
- package/dist/components/fx-organic.js +2 -2
- package/dist/components/fx-paper.js +2 -2
- package/dist/components/fx-perf.js +2 -2
- package/dist/components/fx-physics.js +2 -2
- package/dist/components/fx-retro.js +2 -2
- package/dist/components/fx-safe.js +2 -2
- package/dist/components/fx-shop.js +2 -2
- package/dist/components/fx-social.js +2 -2
- package/dist/components/fx-spatial.js +2 -2
- package/dist/components/fx-surface.js +2 -2
- package/dist/components/fx-text.js +2 -2
- package/dist/components/fx-transitions.js +3 -3
- package/dist/components/fx-video.js +2 -2
- package/dist/components/fx-weather.js +2 -2
- package/dist/components/fx.js +6 -6
- package/dist/components/fx2.cjs +1 -10
- package/dist/components/fx2.cjs.map +1 -1
- package/dist/components/fx2.d.cts +1 -6
- package/dist/components/fx2.d.ts +1 -6
- package/dist/components/fx2.js +7 -15
- package/dist/components/fx2.js.map +1 -1
- package/dist/components/gesture.js +4 -4
- package/dist/components/interaction.js +1 -1
- package/dist/components/layout.js +1 -1
- package/dist/components/marketplace.cjs +104 -0
- package/dist/components/marketplace.cjs.map +1 -1
- package/dist/components/marketplace.d.cts +33 -2
- package/dist/components/marketplace.d.ts +33 -2
- package/dist/components/marketplace.js +105 -5
- package/dist/components/marketplace.js.map +1 -1
- package/dist/components/native.js +3 -3
- package/dist/components/packs.js +1 -1
- package/dist/components/page.js +3 -3
- package/dist/components/perf.js +2 -2
- package/dist/components/physics.js +3 -3
- package/dist/components/plugins.cjs +138 -0
- package/dist/components/plugins.cjs.map +1 -0
- package/dist/components/plugins.d.cts +120 -0
- package/dist/components/plugins.d.ts +120 -0
- package/dist/components/plugins.js +105 -0
- package/dist/components/plugins.js.map +1 -0
- package/dist/components/reveal.js +1 -1
- package/dist/components/solid.js +8 -8
- package/dist/components/svelte.js +8 -8
- package/dist/components/svg.js +1 -1
- package/dist/components/text.js +2 -2
- package/dist/components/timeline.js +3 -3
- package/dist/components/transitions.js +1 -1
- package/dist/components/ui.js +4 -4
- package/dist/components/vue.js +8 -8
- package/dist/components/webgl.js +1 -1
- package/dist/components/widgets.cjs +420 -199
- package/dist/components/widgets.cjs.map +1 -1
- package/dist/components/widgets.d.cts +42 -2
- package/dist/components/widgets.d.ts +42 -2
- package/dist/components/widgets.js +428 -209
- package/dist/components/widgets.js.map +1 -1
- package/dist/components.js +10 -10
- package/dist/index.js +2 -2
- package/dist/llms-full.txt +3018 -0
- package/dist/llms.txt +207 -0
- package/dist/manifest.json +7562 -0
- package/dist/manifest.schema.json +85 -0
- package/dist/runtime/format-css.cjs +184 -0
- package/dist/runtime/format-css.cjs.map +1 -0
- package/dist/runtime/format-css.d.cts +174 -0
- package/dist/runtime/format-css.d.ts +174 -0
- package/dist/runtime/format-css.iife.js +2 -0
- package/dist/runtime/format-css.iife.js.map +1 -0
- package/dist/runtime/format-css.js +176 -0
- package/dist/runtime/format-css.js.map +1 -0
- package/dist/runtime/format-motion.cjs +138 -0
- package/dist/runtime/format-motion.cjs.map +1 -0
- package/dist/runtime/format-motion.d.cts +208 -0
- package/dist/runtime/format-motion.d.ts +208 -0
- package/dist/runtime/format-motion.iife.js +2 -0
- package/dist/runtime/format-motion.iife.js.map +1 -0
- package/dist/runtime/format-motion.js +132 -0
- package/dist/runtime/format-motion.js.map +1 -0
- package/dist/runtime.cjs +78 -0
- package/dist/runtime.cjs.map +1 -0
- package/dist/runtime.d.cts +236 -0
- package/dist/runtime.d.ts +236 -0
- package/dist/runtime.iife.js +2 -0
- package/dist/runtime.iife.js.map +1 -0
- package/dist/runtime.js +54 -0
- package/dist/runtime.js.map +1 -0
- package/dist/widgets.umd.js +1 -1
- package/dist/widgets.umd.js.map +1 -1
- package/docs/ROADMAP.md +85 -14
- package/docs/components.md +66 -0
- package/docs/core.md +47 -0
- package/docs/deprecations.md +1 -1
- package/docs/runtime/core.md +55 -0
- package/docs/runtime/format-css.md +59 -0
- package/docs/runtime/format-motion.md +56 -0
- package/docs/upgrading-10.md +1 -1
- package/package.json +88 -6
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/** Easing functions (t ∈ [0, 1] → progress). Original implementations of the standard Penner-style curves. */
|
|
2
|
+
type Ease = (t: number) => number;
|
|
3
|
+
/** cubic-bezier(x1, y1, x2, y2), solved with Newton steps + bisection fallback. */
|
|
4
|
+
declare function cubicBezier(x1: number, y1: number, x2: number, y2: number): Ease;
|
|
5
|
+
/** steps(n, 'end' | 'start'). */
|
|
6
|
+
declare const steps: (n: number, pos?: "start" | "end") => Ease;
|
|
7
|
+
declare const EASES: Record<string, Ease>;
|
|
8
|
+
/** Resolve an ease: a function, a name ('cubic-out', 'ease-in-out', 'linear'), 'cubic-bezier(a,b,c,d)' or 'steps(n[, start|end])'. Unknown names throw. */
|
|
9
|
+
declare function parseEase(e?: string | Ease): Ease;
|
|
10
|
+
|
|
11
|
+
type Target = object | Element;
|
|
12
|
+
type Props = Record<string, number | string>;
|
|
13
|
+
interface PlayOptions {
|
|
14
|
+
/** Delay before the first iteration, ms. */
|
|
15
|
+
delay?: number;
|
|
16
|
+
/** Extra iterations (-1 = forever). */
|
|
17
|
+
repeat?: number;
|
|
18
|
+
/** Alternate direction on every other iteration. */
|
|
19
|
+
yoyo?: boolean;
|
|
20
|
+
/** Start paused (`play()` to start). */
|
|
21
|
+
paused?: boolean;
|
|
22
|
+
onUpdate?: (progress: number) => void;
|
|
23
|
+
onComplete?: () => void;
|
|
24
|
+
}
|
|
25
|
+
interface TweenOptions extends PlayOptions {
|
|
26
|
+
to?: Props;
|
|
27
|
+
from?: Props;
|
|
28
|
+
/** ms (default 600). */
|
|
29
|
+
duration?: number;
|
|
30
|
+
ease?: string | Ease;
|
|
31
|
+
/** Delay added per target index (ms) when several targets are given. */
|
|
32
|
+
stagger?: number;
|
|
33
|
+
}
|
|
34
|
+
interface Num {
|
|
35
|
+
kind: 'num';
|
|
36
|
+
v: number;
|
|
37
|
+
u: string;
|
|
38
|
+
}
|
|
39
|
+
interface Col {
|
|
40
|
+
kind: 'col';
|
|
41
|
+
c: number[];
|
|
42
|
+
}
|
|
43
|
+
type Val = Num | Col;
|
|
44
|
+
/** Parse '12px', '-3.5', '50%', '#0af', 'rgb(1 2 3 / .5)', 'rgba(…)'. */
|
|
45
|
+
declare function parseValue(v: number | string): Val;
|
|
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
|
+
/** A tween of one target. */
|
|
91
|
+
declare class Tween extends Playable {
|
|
92
|
+
readonly target: Target;
|
|
93
|
+
private _dur;
|
|
94
|
+
private ease;
|
|
95
|
+
private tracks;
|
|
96
|
+
private toProps;
|
|
97
|
+
private fromProps;
|
|
98
|
+
constructor(target: Target, o: TweenOptions);
|
|
99
|
+
get duration(): number;
|
|
100
|
+
/** Capture start values (first render). */
|
|
101
|
+
private init;
|
|
102
|
+
protected renderLocal(ms: number, ended: boolean): void;
|
|
103
|
+
}
|
|
104
|
+
/** Position: ms number, '<' (start of previous), '>' (end of previous, default), '+=200' / '-=200' (relative to the end), 'label', 'label+=100', '<+=100'. */
|
|
105
|
+
type Position = number | string;
|
|
106
|
+
interface TimelineOptions extends PlayOptions {
|
|
107
|
+
/** Defaults merged into every `.to()`. */
|
|
108
|
+
defaults?: Omit<TweenOptions, 'to' | 'from'>;
|
|
109
|
+
}
|
|
110
|
+
/** A sequence of tweens, nested timelines and callbacks. */
|
|
111
|
+
declare class Timeline extends Playable {
|
|
112
|
+
private children;
|
|
113
|
+
private labels;
|
|
114
|
+
private prevStart;
|
|
115
|
+
private prevEnd;
|
|
116
|
+
private defaults;
|
|
117
|
+
private lastLocal;
|
|
118
|
+
constructor(o?: TimelineOptions);
|
|
119
|
+
get duration(): number;
|
|
120
|
+
private resolve;
|
|
121
|
+
/** Add a tween, timeline or callback at a position. */
|
|
122
|
+
add(item: Playable | (() => void), position?: Position): this;
|
|
123
|
+
/** `tween(target, vars)` placed at `position` (stagger across several targets). */
|
|
124
|
+
to(target: Target | Target[] | ArrayLike<Target>, vars: TweenOptions, position?: Position): this;
|
|
125
|
+
call(fn: () => void, position?: Position): this;
|
|
126
|
+
label(name: string, position?: Position): this;
|
|
127
|
+
/** Time of a label, ms. */
|
|
128
|
+
labelTime(name: string): number | undefined;
|
|
129
|
+
remove(item: Playable): void;
|
|
130
|
+
/** Children in start order (callbacks excluded). */
|
|
131
|
+
getChildren(): Playable[];
|
|
132
|
+
protected renderLocal(ms: number): void;
|
|
133
|
+
}
|
|
134
|
+
/** A new timeline (plays on the next frame unless `paused`). */
|
|
135
|
+
declare function timeline(o?: TimelineOptions): Timeline;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Module registry shared by every copy of `motionary/runtime` on the page
|
|
139
|
+
* (ESM, CJS and the CDN IIFE builds all read the same `globalThis` slot),
|
|
140
|
+
* so a component never needs to import the runtime itself — it asks for a
|
|
141
|
+
* module with `requireModule()` and gets a clear error when it is missing.
|
|
142
|
+
* Nothing here touches `window` / `document`: safe to import during SSR and
|
|
143
|
+
* inside Web Workers.
|
|
144
|
+
*/
|
|
145
|
+
/** Runtime version (kept in sync with the package version by the release script). */
|
|
146
|
+
declare const RUNTIME_VERSION = "10.1.0";
|
|
147
|
+
/** Where the CDN builds live (major-pinned). */
|
|
148
|
+
declare const RUNTIME_CDN = "https://cdn.jsdelivr.net/npm/motionary@10/dist/";
|
|
149
|
+
/** A runtime module: `{ id, version, api }`, registered with `use()`. */
|
|
150
|
+
interface RuntimeModule<A = unknown> {
|
|
151
|
+
/** Module id: 'core', 'format-css', 'scroll', … (import path `motionary/runtime/<id>`). */
|
|
152
|
+
id: string;
|
|
153
|
+
version: string;
|
|
154
|
+
/** Other modules this one needs (registered first by `use()` callers). */
|
|
155
|
+
requires?: string[];
|
|
156
|
+
/** The module's public API (what `requireModule(id)` returns). */
|
|
157
|
+
api: A;
|
|
158
|
+
/** Optional one-time setup, called on first registration. */
|
|
159
|
+
setup?(registry: RuntimeRegistry): void;
|
|
160
|
+
}
|
|
161
|
+
interface RuntimeRegistry {
|
|
162
|
+
version: string;
|
|
163
|
+
modules: Map<string, RuntimeModule>;
|
|
164
|
+
/** Shared per-page state slots (the ticker lives here). */
|
|
165
|
+
slots: Record<string, unknown>;
|
|
166
|
+
}
|
|
167
|
+
/** The page-wide registry (created on first use). */
|
|
168
|
+
declare function registry(): RuntimeRegistry;
|
|
169
|
+
/** The import path of a module id. */
|
|
170
|
+
declare const modulePath: (id: string) => string;
|
|
171
|
+
/** The CDN IIFE file of a module id. */
|
|
172
|
+
declare const moduleCdn: (id: string) => string;
|
|
173
|
+
/** The text of the "module missing" error (shared with the components). */
|
|
174
|
+
declare function missingMessage(id: string, who?: string): string;
|
|
175
|
+
/** Thrown by `requireModule()` when a module is not registered. */
|
|
176
|
+
declare class RuntimeModuleError extends Error {
|
|
177
|
+
readonly module: string;
|
|
178
|
+
constructor(id: string, who?: string);
|
|
179
|
+
}
|
|
180
|
+
/** Register modules (each once; re-registering the same id keeps the first). Returns the registry. */
|
|
181
|
+
declare function register(...mods: RuntimeModule[]): RuntimeRegistry;
|
|
182
|
+
/** Is a module registered? */
|
|
183
|
+
declare const hasModule: (id: string) => boolean;
|
|
184
|
+
/** The API of a registered module, or a `RuntimeModuleError` with install / import / CDN instructions. */
|
|
185
|
+
declare function requireModule<A = unknown>(id: string, who?: string): A;
|
|
186
|
+
/** Ids of the registered modules. */
|
|
187
|
+
declare const registeredModules: () => string[];
|
|
188
|
+
|
|
189
|
+
type TickFn = (time: number, delta: number) => void;
|
|
190
|
+
interface Ticker {
|
|
191
|
+
/** Add a listener; returns a remover. */
|
|
192
|
+
add(fn: TickFn): () => void;
|
|
193
|
+
remove(fn: TickFn): void;
|
|
194
|
+
/** ms since the ticker started (frozen while sleeping). */
|
|
195
|
+
readonly time: number;
|
|
196
|
+
/** Smoothed frames per second. */
|
|
197
|
+
readonly fps: number;
|
|
198
|
+
/** Listener count (0 = asleep). */
|
|
199
|
+
readonly size: number;
|
|
200
|
+
/** Cap a single frame's delta (default 100 ms) so a background tab does not jump animations. */
|
|
201
|
+
lagSmoothing(maxDelta: number): void;
|
|
202
|
+
/** Global time scale (1 = normal, 0.5 = half speed, 0 = frozen). */
|
|
203
|
+
timeScale: number;
|
|
204
|
+
/** Advance by `ms` synchronously (tests, offline rendering, worker loops). */
|
|
205
|
+
step(ms: number): void;
|
|
206
|
+
}
|
|
207
|
+
/** The page-wide ticker (shared across every copy of the runtime). */
|
|
208
|
+
declare function getTicker(): Ticker;
|
|
209
|
+
|
|
210
|
+
/** The core module's API (what `requireModule('core')` returns). */
|
|
211
|
+
interface CoreApi {
|
|
212
|
+
version: string;
|
|
213
|
+
getTicker: typeof getTicker;
|
|
214
|
+
tween: (target: any, o: TweenOptions) => Playable;
|
|
215
|
+
timeline: typeof timeline;
|
|
216
|
+
Tween: typeof Tween;
|
|
217
|
+
Timeline: typeof Timeline;
|
|
218
|
+
EASES: typeof EASES;
|
|
219
|
+
parseEase: typeof parseEase;
|
|
220
|
+
cubicBezier: typeof cubicBezier;
|
|
221
|
+
steps: typeof steps;
|
|
222
|
+
}
|
|
223
|
+
/** The core as a module object. */
|
|
224
|
+
declare const core: RuntimeModule<CoreApi>;
|
|
225
|
+
/** Tween targets (objects, elements, lists or a CSS selector). See `TweenOptions`. */
|
|
226
|
+
declare function tween(target: any, o: TweenOptions): Playable;
|
|
227
|
+
/** Selector strings become element lists (only where `document` exists). */
|
|
228
|
+
declare function resolveTargets(t: any): any;
|
|
229
|
+
/**
|
|
230
|
+
* Register the core plus any modules (`use(formatCss, formatMotion)`).
|
|
231
|
+
* Call once at start-up, before runtime-powered components mount.
|
|
232
|
+
*/
|
|
233
|
+
declare function use(...mods: RuntimeModule[]): RuntimeRegistry;
|
|
234
|
+
|
|
235
|
+
export { EASES, Playable, RUNTIME_CDN, RUNTIME_VERSION, RuntimeModuleError, Timeline, Tween, core, cubicBezier, getTicker, hasModule, missingMessage, moduleCdn, modulePath, parseEase, parseValue, register, registeredModules, registry, requireModule, resolveTargets, steps, timeline, tween, use };
|
|
236
|
+
export type { CoreApi, Ease, PlayOptions, Position, Props, RuntimeModule, RuntimeRegistry, Target, TickFn, Ticker, TimelineOptions, TweenOptions };
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/** Easing functions (t ∈ [0, 1] → progress). Original implementations of the standard Penner-style curves. */
|
|
2
|
+
type Ease = (t: number) => number;
|
|
3
|
+
/** cubic-bezier(x1, y1, x2, y2), solved with Newton steps + bisection fallback. */
|
|
4
|
+
declare function cubicBezier(x1: number, y1: number, x2: number, y2: number): Ease;
|
|
5
|
+
/** steps(n, 'end' | 'start'). */
|
|
6
|
+
declare const steps: (n: number, pos?: "start" | "end") => Ease;
|
|
7
|
+
declare const EASES: Record<string, Ease>;
|
|
8
|
+
/** Resolve an ease: a function, a name ('cubic-out', 'ease-in-out', 'linear'), 'cubic-bezier(a,b,c,d)' or 'steps(n[, start|end])'. Unknown names throw. */
|
|
9
|
+
declare function parseEase(e?: string | Ease): Ease;
|
|
10
|
+
|
|
11
|
+
type Target = object | Element;
|
|
12
|
+
type Props = Record<string, number | string>;
|
|
13
|
+
interface PlayOptions {
|
|
14
|
+
/** Delay before the first iteration, ms. */
|
|
15
|
+
delay?: number;
|
|
16
|
+
/** Extra iterations (-1 = forever). */
|
|
17
|
+
repeat?: number;
|
|
18
|
+
/** Alternate direction on every other iteration. */
|
|
19
|
+
yoyo?: boolean;
|
|
20
|
+
/** Start paused (`play()` to start). */
|
|
21
|
+
paused?: boolean;
|
|
22
|
+
onUpdate?: (progress: number) => void;
|
|
23
|
+
onComplete?: () => void;
|
|
24
|
+
}
|
|
25
|
+
interface TweenOptions extends PlayOptions {
|
|
26
|
+
to?: Props;
|
|
27
|
+
from?: Props;
|
|
28
|
+
/** ms (default 600). */
|
|
29
|
+
duration?: number;
|
|
30
|
+
ease?: string | Ease;
|
|
31
|
+
/** Delay added per target index (ms) when several targets are given. */
|
|
32
|
+
stagger?: number;
|
|
33
|
+
}
|
|
34
|
+
interface Num {
|
|
35
|
+
kind: 'num';
|
|
36
|
+
v: number;
|
|
37
|
+
u: string;
|
|
38
|
+
}
|
|
39
|
+
interface Col {
|
|
40
|
+
kind: 'col';
|
|
41
|
+
c: number[];
|
|
42
|
+
}
|
|
43
|
+
type Val = Num | Col;
|
|
44
|
+
/** Parse '12px', '-3.5', '50%', '#0af', 'rgb(1 2 3 / .5)', 'rgba(…)'. */
|
|
45
|
+
declare function parseValue(v: number | string): Val;
|
|
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
|
+
/** A tween of one target. */
|
|
91
|
+
declare class Tween extends Playable {
|
|
92
|
+
readonly target: Target;
|
|
93
|
+
private _dur;
|
|
94
|
+
private ease;
|
|
95
|
+
private tracks;
|
|
96
|
+
private toProps;
|
|
97
|
+
private fromProps;
|
|
98
|
+
constructor(target: Target, o: TweenOptions);
|
|
99
|
+
get duration(): number;
|
|
100
|
+
/** Capture start values (first render). */
|
|
101
|
+
private init;
|
|
102
|
+
protected renderLocal(ms: number, ended: boolean): void;
|
|
103
|
+
}
|
|
104
|
+
/** Position: ms number, '<' (start of previous), '>' (end of previous, default), '+=200' / '-=200' (relative to the end), 'label', 'label+=100', '<+=100'. */
|
|
105
|
+
type Position = number | string;
|
|
106
|
+
interface TimelineOptions extends PlayOptions {
|
|
107
|
+
/** Defaults merged into every `.to()`. */
|
|
108
|
+
defaults?: Omit<TweenOptions, 'to' | 'from'>;
|
|
109
|
+
}
|
|
110
|
+
/** A sequence of tweens, nested timelines and callbacks. */
|
|
111
|
+
declare class Timeline extends Playable {
|
|
112
|
+
private children;
|
|
113
|
+
private labels;
|
|
114
|
+
private prevStart;
|
|
115
|
+
private prevEnd;
|
|
116
|
+
private defaults;
|
|
117
|
+
private lastLocal;
|
|
118
|
+
constructor(o?: TimelineOptions);
|
|
119
|
+
get duration(): number;
|
|
120
|
+
private resolve;
|
|
121
|
+
/** Add a tween, timeline or callback at a position. */
|
|
122
|
+
add(item: Playable | (() => void), position?: Position): this;
|
|
123
|
+
/** `tween(target, vars)` placed at `position` (stagger across several targets). */
|
|
124
|
+
to(target: Target | Target[] | ArrayLike<Target>, vars: TweenOptions, position?: Position): this;
|
|
125
|
+
call(fn: () => void, position?: Position): this;
|
|
126
|
+
label(name: string, position?: Position): this;
|
|
127
|
+
/** Time of a label, ms. */
|
|
128
|
+
labelTime(name: string): number | undefined;
|
|
129
|
+
remove(item: Playable): void;
|
|
130
|
+
/** Children in start order (callbacks excluded). */
|
|
131
|
+
getChildren(): Playable[];
|
|
132
|
+
protected renderLocal(ms: number): void;
|
|
133
|
+
}
|
|
134
|
+
/** A new timeline (plays on the next frame unless `paused`). */
|
|
135
|
+
declare function timeline(o?: TimelineOptions): Timeline;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Module registry shared by every copy of `motionary/runtime` on the page
|
|
139
|
+
* (ESM, CJS and the CDN IIFE builds all read the same `globalThis` slot),
|
|
140
|
+
* so a component never needs to import the runtime itself — it asks for a
|
|
141
|
+
* module with `requireModule()` and gets a clear error when it is missing.
|
|
142
|
+
* Nothing here touches `window` / `document`: safe to import during SSR and
|
|
143
|
+
* inside Web Workers.
|
|
144
|
+
*/
|
|
145
|
+
/** Runtime version (kept in sync with the package version by the release script). */
|
|
146
|
+
declare const RUNTIME_VERSION = "10.1.0";
|
|
147
|
+
/** Where the CDN builds live (major-pinned). */
|
|
148
|
+
declare const RUNTIME_CDN = "https://cdn.jsdelivr.net/npm/motionary@10/dist/";
|
|
149
|
+
/** A runtime module: `{ id, version, api }`, registered with `use()`. */
|
|
150
|
+
interface RuntimeModule<A = unknown> {
|
|
151
|
+
/** Module id: 'core', 'format-css', 'scroll', … (import path `motionary/runtime/<id>`). */
|
|
152
|
+
id: string;
|
|
153
|
+
version: string;
|
|
154
|
+
/** Other modules this one needs (registered first by `use()` callers). */
|
|
155
|
+
requires?: string[];
|
|
156
|
+
/** The module's public API (what `requireModule(id)` returns). */
|
|
157
|
+
api: A;
|
|
158
|
+
/** Optional one-time setup, called on first registration. */
|
|
159
|
+
setup?(registry: RuntimeRegistry): void;
|
|
160
|
+
}
|
|
161
|
+
interface RuntimeRegistry {
|
|
162
|
+
version: string;
|
|
163
|
+
modules: Map<string, RuntimeModule>;
|
|
164
|
+
/** Shared per-page state slots (the ticker lives here). */
|
|
165
|
+
slots: Record<string, unknown>;
|
|
166
|
+
}
|
|
167
|
+
/** The page-wide registry (created on first use). */
|
|
168
|
+
declare function registry(): RuntimeRegistry;
|
|
169
|
+
/** The import path of a module id. */
|
|
170
|
+
declare const modulePath: (id: string) => string;
|
|
171
|
+
/** The CDN IIFE file of a module id. */
|
|
172
|
+
declare const moduleCdn: (id: string) => string;
|
|
173
|
+
/** The text of the "module missing" error (shared with the components). */
|
|
174
|
+
declare function missingMessage(id: string, who?: string): string;
|
|
175
|
+
/** Thrown by `requireModule()` when a module is not registered. */
|
|
176
|
+
declare class RuntimeModuleError extends Error {
|
|
177
|
+
readonly module: string;
|
|
178
|
+
constructor(id: string, who?: string);
|
|
179
|
+
}
|
|
180
|
+
/** Register modules (each once; re-registering the same id keeps the first). Returns the registry. */
|
|
181
|
+
declare function register(...mods: RuntimeModule[]): RuntimeRegistry;
|
|
182
|
+
/** Is a module registered? */
|
|
183
|
+
declare const hasModule: (id: string) => boolean;
|
|
184
|
+
/** The API of a registered module, or a `RuntimeModuleError` with install / import / CDN instructions. */
|
|
185
|
+
declare function requireModule<A = unknown>(id: string, who?: string): A;
|
|
186
|
+
/** Ids of the registered modules. */
|
|
187
|
+
declare const registeredModules: () => string[];
|
|
188
|
+
|
|
189
|
+
type TickFn = (time: number, delta: number) => void;
|
|
190
|
+
interface Ticker {
|
|
191
|
+
/** Add a listener; returns a remover. */
|
|
192
|
+
add(fn: TickFn): () => void;
|
|
193
|
+
remove(fn: TickFn): void;
|
|
194
|
+
/** ms since the ticker started (frozen while sleeping). */
|
|
195
|
+
readonly time: number;
|
|
196
|
+
/** Smoothed frames per second. */
|
|
197
|
+
readonly fps: number;
|
|
198
|
+
/** Listener count (0 = asleep). */
|
|
199
|
+
readonly size: number;
|
|
200
|
+
/** Cap a single frame's delta (default 100 ms) so a background tab does not jump animations. */
|
|
201
|
+
lagSmoothing(maxDelta: number): void;
|
|
202
|
+
/** Global time scale (1 = normal, 0.5 = half speed, 0 = frozen). */
|
|
203
|
+
timeScale: number;
|
|
204
|
+
/** Advance by `ms` synchronously (tests, offline rendering, worker loops). */
|
|
205
|
+
step(ms: number): void;
|
|
206
|
+
}
|
|
207
|
+
/** The page-wide ticker (shared across every copy of the runtime). */
|
|
208
|
+
declare function getTicker(): Ticker;
|
|
209
|
+
|
|
210
|
+
/** The core module's API (what `requireModule('core')` returns). */
|
|
211
|
+
interface CoreApi {
|
|
212
|
+
version: string;
|
|
213
|
+
getTicker: typeof getTicker;
|
|
214
|
+
tween: (target: any, o: TweenOptions) => Playable;
|
|
215
|
+
timeline: typeof timeline;
|
|
216
|
+
Tween: typeof Tween;
|
|
217
|
+
Timeline: typeof Timeline;
|
|
218
|
+
EASES: typeof EASES;
|
|
219
|
+
parseEase: typeof parseEase;
|
|
220
|
+
cubicBezier: typeof cubicBezier;
|
|
221
|
+
steps: typeof steps;
|
|
222
|
+
}
|
|
223
|
+
/** The core as a module object. */
|
|
224
|
+
declare const core: RuntimeModule<CoreApi>;
|
|
225
|
+
/** Tween targets (objects, elements, lists or a CSS selector). See `TweenOptions`. */
|
|
226
|
+
declare function tween(target: any, o: TweenOptions): Playable;
|
|
227
|
+
/** Selector strings become element lists (only where `document` exists). */
|
|
228
|
+
declare function resolveTargets(t: any): any;
|
|
229
|
+
/**
|
|
230
|
+
* Register the core plus any modules (`use(formatCss, formatMotion)`).
|
|
231
|
+
* Call once at start-up, before runtime-powered components mount.
|
|
232
|
+
*/
|
|
233
|
+
declare function use(...mods: RuntimeModule[]): RuntimeRegistry;
|
|
234
|
+
|
|
235
|
+
export { EASES, Playable, RUNTIME_CDN, RUNTIME_VERSION, RuntimeModuleError, Timeline, Tween, core, cubicBezier, getTicker, hasModule, missingMessage, moduleCdn, modulePath, parseEase, parseValue, register, registeredModules, registry, requireModule, resolveTargets, steps, timeline, tween, use };
|
|
236
|
+
export type { CoreApi, Ease, PlayOptions, Position, Props, RuntimeModule, RuntimeRegistry, Target, TickFn, Ticker, TimelineOptions, TweenOptions };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(t){"use strict";const e="10.1.0",r="https://cdn.jsdelivr.net/npm/motionary@10/dist/",s=Symbol.for("motionary.runtime");function i(){const t=globalThis;return t[s]||(t[s]={version:e,modules:new Map,slots:{}})}const o=t=>"core"===t?"motionary/runtime":`motionary/runtime/${t}`,n=t=>r+("core"===t?"runtime.iife.js":`runtime/${t}.iife.js`);function a(t,e="This feature"){const r=o(t);return`[motionary] ${e} requires ${r}. Install once: npm i motionary — then register it before the component mounts: ${"core"===t?"import { use } from 'motionary/runtime'; use();":`import { use } from 'motionary/runtime'; import { ${u(t)} } from '${r}'; use(${u(t)});`} Or from a CDN (core first): ${"core"===t?`<script src="${n("core")}"><\/script>`:`<script src="${n("core")}"><\/script><script src="${n(t)}"><\/script>`} Docs: https://github.com/HarrisonCN/Motionary/blob/main/docs/runtime/${t}.md`}const u=t=>t.replace(/-(\w)/g,(t,e)=>e.toUpperCase());class h extends Error{constructor(t,e){super(a(t,e)),this.name="RuntimeModuleError",this.module=t}}function l(...t){const e=i();for(const r of t){if(!r||"string"!=typeof r.id)throw new TypeError("[motionary] use(): not a runtime module — pass the object exported by motionary/runtime/<module>");if(!e.modules.has(r.id)){for(const t of r.requires||[])if(!e.modules.has(t))throw new h(t,`motionary/runtime/${r.id}`);e.modules.set(r.id,r),r.setup?.(e)}}return e}function c(){const t=new Set;let e=0,r=-1,s=60,i=100,o=null;const n=globalThis,a=()=>n.performance?.now?n.performance.now():Date.now(),u=t=>"function"==typeof n.requestAnimationFrame?n.requestAnimationFrame(t):setTimeout(()=>t(a()),16),h=(r,s=!0)=>{const o=(s?Math.min(r,i):r)*c.timeScale;e+=o;for(const r of Array.from(t))r(e,o)},l=e=>{if(o=null,!t.size)return;const i="number"==typeof e&&e>0?e:a(),n=r<0?0:i-r;r=i,n>0&&(s=.9*s+1e3/n*.1),h(n),t.size&&(o=u(l))},c={add:e=>(t.add(e),null===o&&t.size&&(r=-1,o=u(l)),()=>c.remove(e)),remove(e){var r;t.delete(e),t.size||null===o||(r=o,"function"==typeof n.cancelAnimationFrame?n.cancelAnimationFrame(r):clearTimeout(r),o=null)},get time(){return e},get fps(){return Math.round(s)},get size(){return t.size},lagSmoothing(t){i=t>0?t:1/0},timeScale:1,step(t){h(t,!1)}};return c}function d(){const t=i().slots;return t.ticker||(t.ticker=c())}const f=t=>e=>1-t(1-e),m=t=>e=>e<.5?t(2*e)/2:1-t(2*(1-e))/2,p=t=>e=>Math.pow(e,t);function y(t,e,r,s){const i=(t,e)=>1-3*e+3*t,o=(t,e)=>3*e-6*t,n=t=>3*t,a=(t,e,r)=>((i(e,r)*t+o(e,r))*t+n(e))*t,u=(t,e,r)=>3*i(e,r)*t*t+2*o(e,r)*t+n(e);return i=>{if(i<=0||i>=1)return i<=0?0:1;let o=i;for(let e=0;e<6;e++){const e=u(o,t,r);if(Math.abs(e)<1e-6)break;o-=(a(o,t,r)-i)/e}if(o<0||o>1||Math.abs(a(o,t,r)-i)>1e-4){let e=0,s=1;o=i;for(let n=0;n<30;n++){const n=a(o,t,r);if(Math.abs(n-i)<1e-6)break;n<i?e=o:s=o,o=(e+s)/2}}return a(o,e,s)}}const g=(t,e="end")=>r=>{const s="start"===e?Math.ceil(r*t):Math.floor(r*t);return Math.min(1,Math.max(0,s/t))},w={quad:p(2),cubic:p(3),quart:p(4),quint:p(5),sine:t=>1-Math.cos(t*Math.PI/2),expo:t=>0===t?0:Math.pow(2,10*t-10),circ:t=>1-Math.sqrt(1-t*t),back:((t=1.70158)=>e=>e*e*((t+1)*e-t))(),elastic:t=>0===t||1===t?t:-Math.pow(2,10*t-10)*Math.sin((10*t-10.75)*(2*Math.PI/3)),bounce:f(t=>{const e=7.5625,r=2.75;return t<1/r?e*t*t:t<2/r?e*(t-=1.5/r)*t+.75:t<2.5/r?e*(t-=2.25/r)*t+.9375:e*(t-=2.625/r)*t+.984375})},k={linear:t=>t,ease:y(.25,.1,.25,1),"ease-in":y(.42,0,1,1),"ease-out":y(0,0,.58,1),"ease-in-out":y(.42,0,.58,1),smooth:y(.22,1,.36,1)};for(const[t,e]of Object.entries(w))k[`${t}-in`]=e,k[`${t}-out`]=f(e),k[`${t}-in-out`]=m(e);function b(t){if("function"==typeof t)return t;if(!t)return k["cubic-out"];const e=t.trim();if(k[e])return k[e];let r=/^cubic-bezier\(\s*([-\d.]+)\s*,\s*([-\d.]+)\s*,\s*([-\d.]+)\s*,\s*([-\d.]+)\s*\)$/.exec(e);if(r)return y(+r[1],+r[2],+r[3],+r[4]);if(r=/^steps\(\s*(\d+)\s*(?:,\s*(jump-)?(start|end)\s*)?\)$/.exec(e),r)return g(+r[1],r[3]||"end");if("step-start"===e)return g(1,"start");if("step-end"===e)return g(1,"end");throw new Error(`[motionary] unknown ease "${e}" — use a name from EASES, cubic-bezier(…) or steps(…)`)}const $=["x","y","rotate","scale","scaleX","scaleY","skewX","skewY"],v={x:"px",y:"px",rotate:"deg",skewX:"deg",skewY:"deg",scale:"",scaleX:"",scaleY:""},_=new WeakMap,M=t=>"undefined"!=typeof Element&&t instanceof Element;function x(t){if("number"==typeof t)return{kind:"num",v:t,u:""};const e=t.trim();let r=/^#([0-9a-f]{3,8})$/i.exec(e);if(r){let t=r[1];t.length<=4&&(t=t.split("").map(t=>t+t).join(""));const e=e=>parseInt(t.slice(e,e+2),16);return{kind:"col",c:[e(0),e(2),e(4),8===t.length?e(6)/255:1]}}if(r=/^rgba?\(([^)]+)\)$/i.exec(e),r){const t=r[1].split(/[\s,/]+/).filter(Boolean).map(t=>t.endsWith("%")?parseFloat(t)/100*255:parseFloat(t));return{kind:"col",c:[t[0],t[1],t[2],void 0===t[3]?1:t[3]>1?t[3]/255:t[3]]}}if("transparent"===e)return{kind:"col",c:[0,0,0,0]};if(r=/^(-?[\d.]+(?:e-?\d+)?)([a-z%]*)$/i.exec(e),r)return{kind:"num",v:parseFloat(r[1]),u:r[2]};throw new Error(`[motionary] cannot tween value "${e}"`)}const E=(t,e,r)=>{if("col"===t.kind||"col"===e.kind){const s="col"===t.kind?t.c:[0,0,0,0],i="col"===e.kind?e.c:[0,0,0,0],o=s.map((t,e)=>t+(i[e]-t)*r);return`rgba(${Math.round(o[0])}, ${Math.round(o[1])}, ${Math.round(o[2])}, ${+o[3].toFixed(3)})`}const s=t.v+(e.v-t.v)*r,i=e.u||t.u;return i?`${+s.toFixed(4)}${i}`:+s.toFixed(6)},S=t=>t.startsWith("--")?t:t.replace(/[A-Z]/g,t=>"-"+t.toLowerCase());function A(t,e){if(!M(t))return t[e]??0;if($.includes(e)){const r=_.get(t)?.[e];return r?r.v+r.u:e.startsWith("scale")?1:0}const r=t.style.getPropertyValue(S(e));if(r)return r;return("function"==typeof getComputedStyle?getComputedStyle(t).getPropertyValue(S(e)):"")||("opacity"===e?1:0)}function D(t,e,r){if(M(t)){if($.includes(e)){const s=x(r),i=_.get(t)||{};return i[e]={v:s.v,u:s.u},void _.set(t,i)}t.style.setProperty(S(e),"number"!=typeof r||["opacity","zIndex","z-index"].includes(e)||e.startsWith("--")?String(r):r+"px")}else t[e]="string"==typeof r&&"number"==typeof t[e]?parseFloat(r):r}class P{constructor(t){this.timeScale=1,this._t=0,this._dir=1,this._off=null,this._done=!1,this.parent=null,this.delay=t.delay||0,this.repeat=t.repeat||0,this.yoyo=!!t.yoyo,this.onUpdate=t.onUpdate,this.onComplete=t.onComplete,this.finished=new Promise(t=>this._resolve=t)}get totalDuration(){return this.repeat<0?1/0:this.delay+this.duration*(this.repeat+1)}get time(){return this._t}get progress(){const t=this.totalDuration;return t===1/0?(this._t-this.delay)%this.duration/this.duration:t?this._t/t:1}set progress(t){this.seek(t*(this.totalDuration===1/0?this.delay+this.duration:this.totalDuration))}get isActive(){return!!this._off}get reversed(){return this._dir<0}seek(t){const e=this.totalDuration;this._t=Math.max(0,Math.min(t,e));const r=this._t-this.delay,s=this.duration||0;if(r<0)this.renderLocal(0,!1);else if(s){let t=Math.floor(r/s),i=r-t*s;r>=e-this.delay&&e!==1/0&&(t=this.repeat,i=s);const o=this.yoyo&&t%2==1;this.renderLocal(o?s-i:i,i===s)}else this.renderLocal(0,!0);return this.onUpdate?.(this.progress),this}play(){return this._dir=1,this._t>=this.totalDuration&&(this._t=0),this.attach()}pause(){return this._off?.(),this._off=null,this}reverse(){return this._dir=-1,this._t<=0&&(this._t=this.totalDuration===1/0?this.delay+this.duration:this.totalDuration),this.attach()}restart(){return this._done=!1,this.seek(0),this.play()}kill(){this.pause(),this.parent?.remove(this)}then(t,e){return this.finished.then(t,e)}attach(){return this.parent||this._off||(this._done=!1,this._off=d().add((t,e)=>this.advance(e))),this}advance(t){const e=this.totalDuration;this.seek(this._t+t*this._dir*this.timeScale),(this._dir>0&&this._t>=e||this._dir<0&&this._t<=0)&&this.complete()}complete(){this.pause(),this._done||(this._done=!0,this.onComplete?.(),this._resolve())}}class T extends P{constructor(t,e){super(e),this.tracks=null,this.target=t,this._dur=e.duration??600,this.ease=b(e.ease),this.toProps=e.to||{},this.fromProps=e.from||{}}get duration(){return this._dur}init(){return Array.from(new Set([...Object.keys(this.fromProps),...Object.keys(this.toProps)])).map(t=>{const e=t in this.fromProps?this.fromProps[t]:A(this.target,t),r=t in this.toProps?this.toProps[t]:A(this.target,t);return{k:t,fromRaw:e,toRaw:r,from:x(e),to:x(r)}})}renderLocal(t,e){this.tracks||(this.tracks=this.init());const r=this._dur?e?this.ease(t>=this._dur?1:0):this.ease(t/this._dur):1;let s=!1;for(const t of this.tracks)D(this.target,t.k,E(t.from,t.to,r)),$.includes(t.k)&&(s=!0);s&&M(this.target)&&function(t){const e=_.get(t),r=(t,r)=>e[t]?e[t].v:r,s=t=>e[t]?.u??v[t],i=[];(e.x||e.y)&&i.push(`translate(${r("x",0)}${s("x")||"px"}, ${r("y",0)}${s("y")||"px"})`),e.rotate&&i.push(`rotate(${r("rotate",0)}${s("rotate")||"deg"})`),e.scale&&i.push(`scale(${r("scale",1)})`),(e.scaleX||e.scaleY)&&i.push(`scale(${r("scaleX",1)}, ${r("scaleY",1)})`),e.skewX&&i.push(`skewX(${r("skewX",0)}${s("skewX")||"deg"})`),e.skewY&&i.push(`skewY(${r("skewY",0)}${s("skewY")||"deg"})`),t.style.transform=i.join(" ")}(this.target)}}class C extends P{constructor(t={}){super(t),this.children=[],this.labels={},this.prevStart=0,this.prevEnd=0,this.lastLocal=0,this.defaults=t.defaults}get duration(){let t=0;for(const e of this.children)t=Math.max(t,e.start+("function"==typeof e.item?0:e.item.totalDuration));return t}resolve(t){if(void 0===t||">"===t)return this.prevEnd;if("number"==typeof t)return Math.max(0,t);const e=/^([<>]|[\w-]+)?\s*(?:([+-])=\s*([\d.]+))?$/.exec(t.trim());if(!e)throw new Error(`[motionary] bad timeline position "${t}"`);let r=this.prevEnd;if("<"===e[1])r=this.prevStart;else if(e[1]&&">"!==e[1]){if(!(e[1]in this.labels))throw new Error(`[motionary] unknown timeline label "${e[1]}"`);r=this.labels[e[1]]}const s=e[2]?("+"===e[2]?1:-1)*parseFloat(e[3]):0;return Math.max(0,r+s)}add(t,e){const r=this.resolve(e);return"function"!=typeof t&&(t.pause(),t.parent=this),this.children.push({item:t,start:r}),this.prevStart=r,this.prevEnd=r+("function"==typeof t?0:t.totalDuration),this}to(t,e,r){const s=z(t),i=this.resolve(r);let o=i;return s.forEach((t,r)=>{const s=new T(t,{...this.defaults,...e,delay:(e.delay||0)+(e.stagger||0)*r,paused:!0});s.parent=this,this.children.push({item:s,start:i}),o=Math.max(o,i+s.totalDuration)}),this.prevStart=i,this.prevEnd=o,this}call(t,e){return this.add(t,e)}label(t,e){return this.labels[t]=this.resolve(e),this}labelTime(t){return this.labels[t]}remove(t){this.children=this.children.filter(e=>e.item!==t)}getChildren(){return this.children.filter(t=>"function"!=typeof t.item).map(t=>t.item)}renderLocal(t){const e=t>=this.lastLocal,r=[...this.children].sort((t,r)=>e?t.start-r.start:r.start-t.start);for(const s of r){if("function"==typeof s.item){e&&!s.fired&&t>=s.start&&this.lastLocal<=s.start?(s.fired=!0,s.item()):!e&&t<s.start&&(s.fired=!1);continue}const r=t-s.start,i=s.item;r<0?i._started&&i.seek(0):(i._started=!0,i.seek(Math.min(r,i.totalDuration)))}this.lastLocal=t}}function z(t){return Array.isArray(t)?t:t&&"number"==typeof t.length&&!M(t)?Array.from(t):[t]}function F(t={}){const e=new C(t);return t.paused||e.play(),e}const j={id:"core",version:e,api:{version:e,getTicker:d,tween:q,timeline:F,Tween:T,Timeline:C,EASES:k,parseEase:b,cubicBezier:y,steps:g}};function q(t,e){return function(t,e){const r=z(t);let s;if(1===r.length)s=new T(r[0],e);else{const t=new C({repeat:e.repeat,yoyo:e.yoyo,onUpdate:e.onUpdate,onComplete:e.onComplete,delay:e.delay});t.to(r,{...e,delay:0,repeat:0,yoyo:!1,onUpdate:void 0,onComplete:void 0},0),s=t}return e.paused||s.play(),s}(L(t),e)}function L(t){if("string"==typeof t){if("undefined"==typeof document)throw new Error("[motionary] selector targets need a document — pass objects or elements instead");return Array.from(document.querySelectorAll(t))}return t}function X(...t){return l(j,...t)}X(),t.EASES=k,t.Playable=P,t.RUNTIME_CDN=r,t.RUNTIME_VERSION=e,t.RuntimeModuleError=h,t.Timeline=C,t.Tween=T,t.core=j,t.cubicBezier=y,t.getTicker=d,t.hasModule=t=>i().modules.has(t),t.missingMessage=a,t.moduleCdn=n,t.modulePath=o,t.parseEase=b,t.parseValue=x,t.register=l,t.registeredModules=()=>Array.from(i().modules.keys()),t.registry=i,t.requireModule=function(t,e){const r=i().modules.get(t);if(!r)throw new h(t,e);return r.api},t.resolveTargets=L,t.steps=g,t.timeline=F,t.tween=q,t.use=X}(this.MotionaryRuntime=this.MotionaryRuntime||{});
|
|
2
|
+
//# sourceMappingURL=runtime.iife.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.iife.js","sources":["../src/runtime/registry.ts","../src/runtime/ticker.ts","../src/runtime/ease.ts","../src/runtime/tween.ts","../src/runtime/index.ts","../src/runtime/iife/core.ts"],"sourcesContent":["/**\n * Module registry shared by every copy of `motionary/runtime` on the page\n * (ESM, CJS and the CDN IIFE builds all read the same `globalThis` slot),\n * so a component never needs to import the runtime itself — it asks for a\n * module with `requireModule()` and gets a clear error when it is missing.\n * Nothing here touches `window` / `document`: safe to import during SSR and\n * inside Web Workers.\n */\n\n/** Runtime version (kept in sync with the package version by the release script). */\nexport const RUNTIME_VERSION = '10.1.0';\n\n/** Where the CDN builds live (major-pinned). */\nexport const RUNTIME_CDN = 'https://cdn.jsdelivr.net/npm/motionary@10/dist/';\n\n/** A runtime module: `{ id, version, api }`, registered with `use()`. */\nexport interface RuntimeModule<A = unknown> {\n /** Module id: 'core', 'format-css', 'scroll', … (import path `motionary/runtime/<id>`). */\n id: string;\n version: string;\n /** Other modules this one needs (registered first by `use()` callers). */\n requires?: string[];\n /** The module's public API (what `requireModule(id)` returns). */\n api: A;\n /** Optional one-time setup, called on first registration. */\n setup?(registry: RuntimeRegistry): void;\n}\n\nexport interface RuntimeRegistry {\n version: string;\n modules: Map<string, RuntimeModule>;\n /** Shared per-page state slots (the ticker lives here). */\n slots: Record<string, unknown>;\n}\n\nconst KEY = Symbol.for('motionary.runtime');\n\n/** The page-wide registry (created on first use). */\nexport function registry(): RuntimeRegistry {\n const g = globalThis as unknown as Record<symbol, RuntimeRegistry | undefined>;\n return (g[KEY] ||= { version: RUNTIME_VERSION, modules: new Map(), slots: {} });\n}\n\n/** The import path of a module id. */\nexport const modulePath = (id: string): string => (id === 'core' ? 'motionary/runtime' : `motionary/runtime/${id}`);\n\n/** The CDN IIFE file of a module id. */\nexport const moduleCdn = (id: string): string => RUNTIME_CDN + (id === 'core' ? 'runtime.iife.js' : `runtime/${id}.iife.js`);\n\n/** The text of the \"module missing\" error (shared with the components). */\nexport function missingMessage(id: string, who = 'This feature'): string {\n const path = modulePath(id);\n const reg = id === 'core' ? `import { use } from 'motionary/runtime'; use();` : `import { use } from 'motionary/runtime'; import { ${camel(id)} } from '${path}'; use(${camel(id)});`;\n const cdn = id === 'core' ? `<script src=\"${moduleCdn('core')}\"></script>` : `<script src=\"${moduleCdn('core')}\"></script><script src=\"${moduleCdn(id)}\"></script>`;\n return `[motionary] ${who} requires ${path}. Install once: npm i motionary — then register it before the component mounts: ${reg} Or from a CDN (core first): ${cdn} Docs: https://github.com/HarrisonCN/Motionary/blob/main/docs/runtime/${id}.md`;\n}\n\n/** 'format-css' → 'formatCss' (the module object's export name). */\nexport const camel = (id: string): string => id.replace(/-(\\w)/g, (_, c: string) => c.toUpperCase());\n\n/** Thrown by `requireModule()` when a module is not registered. */\nexport class RuntimeModuleError extends Error {\n readonly module: string;\n constructor(id: string, who?: string) {\n super(missingMessage(id, who));\n this.name = 'RuntimeModuleError';\n this.module = id;\n }\n}\n\n/** Register modules (each once; re-registering the same id keeps the first). Returns the registry. */\nexport function register(...mods: RuntimeModule[]): RuntimeRegistry {\n const r = registry();\n for (const m of mods) {\n if (!m || typeof m.id !== 'string') throw new TypeError('[motionary] use(): not a runtime module — pass the object exported by motionary/runtime/<module>');\n if (r.modules.has(m.id)) continue;\n for (const dep of m.requires || []) if (!r.modules.has(dep)) throw new RuntimeModuleError(dep, `motionary/runtime/${m.id}`);\n r.modules.set(m.id, m as RuntimeModule);\n m.setup?.(r);\n }\n return r;\n}\n\n/** Is a module registered? */\nexport const hasModule = (id: string): boolean => registry().modules.has(id);\n\n/** The API of a registered module, or a `RuntimeModuleError` with install / import / CDN instructions. */\nexport function requireModule<A = unknown>(id: string, who?: string): A {\n const m = registry().modules.get(id);\n if (!m) throw new RuntimeModuleError(id, who);\n return m.api as A;\n}\n\n/** Ids of the registered modules. */\nexport const registeredModules = (): string[] => Array.from(registry().modules.keys());\n","/**\n * The shared ticker: one requestAnimationFrame loop per page (or worker) for\n * every runtime animation, with lag smoothing and a frame budget readout.\n * Falls back to a 16 ms timer where rAF is missing (Node, some workers).\n * Nothing runs until the first listener is added (SSR-safe).\n */\nimport { registry } from './registry';\n\nexport type TickFn = (time: number, delta: number) => void;\n\nexport interface Ticker {\n /** Add a listener; returns a remover. */\n add(fn: TickFn): () => void;\n remove(fn: TickFn): void;\n /** ms since the ticker started (frozen while sleeping). */\n readonly time: number;\n /** Smoothed frames per second. */\n readonly fps: number;\n /** Listener count (0 = asleep). */\n readonly size: number;\n /** Cap a single frame's delta (default 100 ms) so a background tab does not jump animations. */\n lagSmoothing(maxDelta: number): void;\n /** Global time scale (1 = normal, 0.5 = half speed, 0 = frozen). */\n timeScale: number;\n /** Advance by `ms` synchronously (tests, offline rendering, worker loops). */\n step(ms: number): void;\n}\n\nfunction createTicker(): Ticker {\n const fns = new Set<TickFn>();\n let time = 0, last = -1, fps = 60, maxDelta = 100, handle: unknown = null;\n const g = globalThis as any;\n const now = (): number => (g.performance?.now ? g.performance.now() : Date.now());\n const raf = (cb: (t: number) => void): unknown => (typeof g.requestAnimationFrame === 'function' ? g.requestAnimationFrame(cb) : setTimeout(() => cb(now()), 16));\n const caf = (h: unknown): void => (typeof g.cancelAnimationFrame === 'function' ? g.cancelAnimationFrame(h) : clearTimeout(h as any));\n const run = (dt: number, cap = true): void => {\n const d = (cap ? Math.min(dt, maxDelta) : dt) * t.timeScale;\n time += d;\n for (const fn of Array.from(fns)) fn(time, d);\n };\n const frame = (ts: number): void => {\n handle = null;\n if (!fns.size) return;\n const n = typeof ts === 'number' && ts > 0 ? ts : now();\n const dt = last < 0 ? 0 : n - last;\n last = n;\n if (dt > 0) fps = fps * 0.9 + (1000 / dt) * 0.1;\n run(dt);\n if (fns.size) handle = raf(frame);\n };\n const wake = (): void => {\n if (handle === null && fns.size) {\n last = -1;\n handle = raf(frame);\n }\n };\n const t: Ticker = {\n add(fn) {\n fns.add(fn);\n wake();\n return () => t.remove(fn);\n },\n remove(fn) {\n fns.delete(fn);\n if (!fns.size && handle !== null) {\n caf(handle);\n handle = null;\n }\n },\n get time() { return time; },\n get fps() { return Math.round(fps); },\n get size() { return fns.size; },\n lagSmoothing(ms) { maxDelta = ms > 0 ? ms : Infinity; },\n timeScale: 1,\n step(ms) { run(ms, false); },\n };\n return t;\n}\n\n/** The page-wide ticker (shared across every copy of the runtime). */\nexport function getTicker(): Ticker {\n const s = registry().slots;\n return (s.ticker ||= createTicker()) as Ticker;\n}\n","/** Easing functions (t ∈ [0, 1] → progress). Original implementations of the standard Penner-style curves. */\nexport type Ease = (t: number) => number;\n\nconst out = (f: Ease): Ease => (t) => 1 - f(1 - t);\nconst inOut = (f: Ease): Ease => (t) => (t < 0.5 ? f(t * 2) / 2 : 1 - f((1 - t) * 2) / 2);\nconst pow = (p: number): Ease => (t) => Math.pow(t, p);\nconst sine: Ease = (t) => 1 - Math.cos((t * Math.PI) / 2);\nconst expo: Ease = (t) => (t === 0 ? 0 : Math.pow(2, 10 * t - 10));\nconst circ: Ease = (t) => 1 - Math.sqrt(1 - t * t);\nconst back = (s = 1.70158): Ease => (t) => t * t * ((s + 1) * t - s);\nconst elastic: Ease = (t) => (t === 0 || t === 1 ? t : -Math.pow(2, 10 * t - 10) * Math.sin((t * 10 - 10.75) * ((2 * Math.PI) / 3)));\nconst bounceOut: Ease = (t) => {\n const n = 7.5625, d = 2.75;\n if (t < 1 / d) return n * t * t;\n if (t < 2 / d) return n * (t -= 1.5 / d) * t + 0.75;\n if (t < 2.5 / d) return n * (t -= 2.25 / d) * t + 0.9375;\n return n * (t -= 2.625 / d) * t + 0.984375;\n};\n\n/** cubic-bezier(x1, y1, x2, y2), solved with Newton steps + bisection fallback. */\nexport function cubicBezier(x1: number, y1: number, x2: number, y2: number): Ease {\n const a = (p1: number, p2: number) => 1 - 3 * p2 + 3 * p1;\n const b = (p1: number, p2: number) => 3 * p2 - 6 * p1;\n const c = (p1: number) => 3 * p1;\n const at = (t: number, p1: number, p2: number) => ((a(p1, p2) * t + b(p1, p2)) * t + c(p1)) * t;\n const slope = (t: number, p1: number, p2: number) => 3 * a(p1, p2) * t * t + 2 * b(p1, p2) * t + c(p1);\n return (x) => {\n if (x <= 0 || x >= 1) return x <= 0 ? 0 : 1;\n let t = x;\n for (let i = 0; i < 6; i++) {\n const s = slope(t, x1, x2);\n if (Math.abs(s) < 1e-6) break;\n t -= (at(t, x1, x2) - x) / s;\n }\n if (t < 0 || t > 1 || Math.abs(at(t, x1, x2) - x) > 1e-4) {\n let lo = 0, hi = 1;\n t = x;\n for (let i = 0; i < 30; i++) {\n const v = at(t, x1, x2);\n if (Math.abs(v - x) < 1e-6) break;\n if (v < x) lo = t; else hi = t;\n t = (lo + hi) / 2;\n }\n }\n return at(t, y1, y2);\n };\n}\n\n/** steps(n, 'end' | 'start'). */\nexport const steps = (n: number, pos: 'start' | 'end' = 'end'): Ease => (t) => {\n const k = pos === 'start' ? Math.ceil(t * n) : Math.floor(t * n);\n return Math.min(1, Math.max(0, k / n));\n};\n\n/** Named eases: linear, quad/cubic/quart/quint, sine, expo, circ, back, elastic, bounce — each `.in`, `.out`, `.inOut` via 'name-in' | 'name-out' | 'name-in-out'. */\nconst BASE: Record<string, Ease> = { quad: pow(2), cubic: pow(3), quart: pow(4), quint: pow(5), sine, expo, circ, back: back(), elastic, bounce: out(bounceOut) };\nexport const EASES: Record<string, Ease> = { linear: (t) => t, ease: cubicBezier(0.25, 0.1, 0.25, 1), 'ease-in': cubicBezier(0.42, 0, 1, 1), 'ease-out': cubicBezier(0, 0, 0.58, 1), 'ease-in-out': cubicBezier(0.42, 0, 0.58, 1), smooth: cubicBezier(0.22, 1, 0.36, 1) };\nfor (const [k, f] of Object.entries(BASE)) {\n EASES[`${k}-in`] = f;\n EASES[`${k}-out`] = out(f);\n EASES[`${k}-in-out`] = inOut(f);\n}\n\n/** Resolve an ease: a function, a name ('cubic-out', 'ease-in-out', 'linear'), 'cubic-bezier(a,b,c,d)' or 'steps(n[, start|end])'. Unknown names throw. */\nexport function parseEase(e?: string | Ease): Ease {\n if (typeof e === 'function') return e;\n if (!e) return EASES['cubic-out'];\n const s = e.trim();\n if (EASES[s]) return EASES[s];\n let m = /^cubic-bezier\\(\\s*([-\\d.]+)\\s*,\\s*([-\\d.]+)\\s*,\\s*([-\\d.]+)\\s*,\\s*([-\\d.]+)\\s*\\)$/.exec(s);\n if (m) return cubicBezier(+m[1], +m[2], +m[3], +m[4]);\n m = /^steps\\(\\s*(\\d+)\\s*(?:,\\s*(jump-)?(start|end)\\s*)?\\)$/.exec(s);\n if (m) return steps(+m[1], (m[3] as 'start' | 'end') || 'end');\n if (s === 'step-start') return steps(1, 'start');\n if (s === 'step-end') return steps(1, 'end');\n throw new Error(`[motionary] unknown ease \"${s}\" — use a name from EASES, cubic-bezier(…) or steps(…)`);\n}\n","/**\n * Tween + timeline engine (original implementation). Times are in\n * milliseconds. Targets are plain objects (numeric props) or elements\n * (CSS: numbers with units, colours, `opacity`, custom properties, and the\n * transform shorthands `x y rotate scale scaleX scaleY skewX skewY`,\n * composed in that order). Driven by the shared ticker; a tween placed in a\n * timeline is driven by the timeline instead.\n */\nimport { getTicker } from './ticker';\nimport { parseEase, type Ease } from './ease';\n\nexport type Target = object | Element;\nexport type Props = Record<string, number | string>;\n\nexport interface PlayOptions {\n /** Delay before the first iteration, ms. */\n delay?: number;\n /** Extra iterations (-1 = forever). */\n repeat?: number;\n /** Alternate direction on every other iteration. */\n yoyo?: boolean;\n /** Start paused (`play()` to start). */\n paused?: boolean;\n onUpdate?: (progress: number) => void;\n onComplete?: () => void;\n}\n\nexport interface TweenOptions extends PlayOptions {\n to?: Props;\n from?: Props;\n /** ms (default 600). */\n duration?: number;\n ease?: string | Ease;\n /** Delay added per target index (ms) when several targets are given. */\n stagger?: number;\n}\n\nconst TRANSFORM = ['x', 'y', 'rotate', 'scale', 'scaleX', 'scaleY', 'skewX', 'skewY'];\nconst DEFAULT_UNIT: Record<string, string> = { x: 'px', y: 'px', rotate: 'deg', skewX: 'deg', skewY: 'deg', scale: '', scaleX: '', scaleY: '' };\ntype TState = Record<string, { v: number; u: string }>;\nconst tstate = new WeakMap<Element, TState>();\n\nconst isEl = (t: unknown): t is HTMLElement => typeof Element !== 'undefined' && t instanceof Element;\n\ninterface Num { kind: 'num'; v: number; u: string }\ninterface Col { kind: 'col'; c: number[] }\ntype Val = Num | Col;\n\n/** Parse '12px', '-3.5', '50%', '#0af', 'rgb(1 2 3 / .5)', 'rgba(…)'. */\nexport function parseValue(v: number | string): Val {\n if (typeof v === 'number') return { kind: 'num', v, u: '' };\n const s = v.trim();\n let m = /^#([0-9a-f]{3,8})$/i.exec(s);\n if (m) {\n let h = m[1];\n if (h.length <= 4) h = h.split('').map((c) => c + c).join('');\n const n = (i: number) => parseInt(h.slice(i, i + 2), 16);\n return { kind: 'col', c: [n(0), n(2), n(4), h.length === 8 ? n(6) / 255 : 1] };\n }\n m = /^rgba?\\(([^)]+)\\)$/i.exec(s);\n if (m) {\n const p = m[1].split(/[\\s,/]+/).filter(Boolean).map((x) => (x.endsWith('%') ? (parseFloat(x) / 100) * 255 : parseFloat(x)));\n return { kind: 'col', c: [p[0], p[1], p[2], p[3] === undefined ? 1 : p[3] > 1 ? p[3] / 255 : p[3]] };\n }\n if (s === 'transparent') return { kind: 'col', c: [0, 0, 0, 0] };\n m = /^(-?[\\d.]+(?:e-?\\d+)?)([a-z%]*)$/i.exec(s);\n if (m) return { kind: 'num', v: parseFloat(m[1]), u: m[2] };\n throw new Error(`[motionary] cannot tween value \"${s}\"`);\n}\n\nconst lerpVal = (a: Val, b: Val, p: number): string | number => {\n if (a.kind === 'col' || b.kind === 'col') {\n const ca = a.kind === 'col' ? a.c : [0, 0, 0, 0], cb = b.kind === 'col' ? b.c : [0, 0, 0, 0];\n const c = ca.map((x, i) => x + (cb[i] - x) * p);\n return `rgba(${Math.round(c[0])}, ${Math.round(c[1])}, ${Math.round(c[2])}, ${+c[3].toFixed(3)})`;\n }\n const v = a.v + (b.v - a.v) * p;\n const u = b.u || a.u;\n return u ? `${+v.toFixed(4)}${u}` : +v.toFixed(6);\n};\n\nconst kebab = (k: string) => (k.startsWith('--') ? k : k.replace(/[A-Z]/g, (c) => '-' + c.toLowerCase()));\n\nfunction readProp(t: Target, k: string): number | string {\n if (!isEl(t)) return (t as any)[k] ?? 0;\n if (TRANSFORM.includes(k)) {\n const s = tstate.get(t)?.[k];\n return s ? s.v + s.u : k.startsWith('scale') ? 1 : 0;\n }\n const inline = t.style.getPropertyValue(kebab(k));\n if (inline) return inline;\n const cs = typeof getComputedStyle === 'function' ? getComputedStyle(t).getPropertyValue(kebab(k)) : '';\n return cs || (k === 'opacity' ? 1 : 0);\n}\n\nfunction writeTransform(el: HTMLElement): void {\n const s = tstate.get(el)!;\n const g = (k: string, d: number) => (s[k] ? s[k].v : d);\n const u = (k: string) => (s[k]?.u ?? DEFAULT_UNIT[k]);\n const parts: string[] = [];\n if (s.x || s.y) parts.push(`translate(${g('x', 0)}${u('x') || 'px'}, ${g('y', 0)}${u('y') || 'px'})`);\n if (s.rotate) parts.push(`rotate(${g('rotate', 0)}${u('rotate') || 'deg'})`);\n if (s.scale) parts.push(`scale(${g('scale', 1)})`);\n if (s.scaleX || s.scaleY) parts.push(`scale(${g('scaleX', 1)}, ${g('scaleY', 1)})`);\n if (s.skewX) parts.push(`skewX(${g('skewX', 0)}${u('skewX') || 'deg'})`);\n if (s.skewY) parts.push(`skewY(${g('skewY', 0)}${u('skewY') || 'deg'})`);\n el.style.transform = parts.join(' ');\n}\n\nfunction writeProp(t: Target, k: string, v: string | number): void {\n if (!isEl(t)) {\n (t as any)[k] = typeof v === 'string' && typeof (t as any)[k] === 'number' ? parseFloat(v) : v;\n return;\n }\n if (TRANSFORM.includes(k)) {\n const p = parseValue(v) as Num;\n const s = tstate.get(t) || {};\n s[k] = { v: p.v, u: p.u };\n tstate.set(t, s);\n return;\n }\n t.style.setProperty(kebab(k), typeof v === 'number' && !['opacity', 'zIndex', 'z-index'].includes(k) && !k.startsWith('--') ? v + 'px' : String(v));\n}\n\n/** Common playback: delay, repeat, yoyo, direction, ticker attachment, promise. */\nexport abstract class Playable {\n delay: number;\n repeat: number;\n yoyo: boolean;\n /** Playback rate multiplier. */\n timeScale = 1;\n onUpdate?: (progress: number) => void;\n onComplete?: () => void;\n protected _t = 0;\n private _dir = 1;\n private _off: (() => void) | null = null;\n private _done = false;\n private _resolve!: () => void;\n /** Resolves on completion (forward end, or start when reversed). */\n finished: Promise<void>;\n /** Set when owned by a timeline (then the ticker never drives it). */\n parent: Timeline | null = null;\n\n constructor(o: PlayOptions) {\n this.delay = o.delay || 0;\n this.repeat = o.repeat || 0;\n this.yoyo = !!o.yoyo;\n this.onUpdate = o.onUpdate;\n this.onComplete = o.onComplete;\n this.finished = new Promise((r) => (this._resolve = r));\n }\n /** One iteration, ms. */\n abstract get duration(): number;\n /** Render at `ms` into one iteration. */\n protected abstract renderLocal(ms: number, iterationEnded: boolean): void;\n\n get totalDuration(): number {\n return this.repeat < 0 ? Infinity : this.delay + this.duration * (this.repeat + 1);\n }\n get time(): number {\n return this._t;\n }\n get progress(): number {\n const td = this.totalDuration;\n return td === Infinity ? ((this._t - this.delay) % this.duration) / this.duration : td ? this._t / td : 1;\n }\n set progress(p: number) {\n this.seek(p * (this.totalDuration === Infinity ? this.delay + this.duration : this.totalDuration));\n }\n get isActive(): boolean {\n return !!this._off;\n }\n get reversed(): boolean {\n return this._dir < 0;\n }\n\n /** Jump to `ms` (total time, including the delay) and render. */\n seek(ms: number): this {\n const td = this.totalDuration;\n this._t = Math.max(0, Math.min(ms, td));\n const t = this._t - this.delay;\n const d = this.duration || 0;\n if (t < 0) this.renderLocal(0, false);\n else if (!d) this.renderLocal(0, true);\n else {\n let it = Math.floor(t / d);\n let local = t - it * d;\n if (t >= td - this.delay && td !== Infinity) {\n it = this.repeat;\n local = d;\n }\n const back = this.yoyo && it % 2 === 1;\n this.renderLocal(back ? d - local : local, local === d);\n }\n this.onUpdate?.(this.progress);\n return this;\n }\n\n play(): this {\n this._dir = 1;\n if (this._t >= this.totalDuration) this._t = 0;\n return this.attach();\n }\n pause(): this {\n this._off?.();\n this._off = null;\n return this;\n }\n /** Play backwards from the current time. */\n reverse(): this {\n this._dir = -1;\n if (this._t <= 0) this._t = this.totalDuration === Infinity ? this.delay + this.duration : this.totalDuration;\n return this.attach();\n }\n restart(): this {\n this._done = false;\n this.seek(0);\n return this.play();\n }\n /** Stop and detach for good. */\n kill(): void {\n this.pause();\n this.parent?.remove(this);\n }\n /** Promise-like: `await tween(...)`. */\n then<R>(ok?: (v: void) => R, err?: (e: unknown) => R): Promise<R> {\n return this.finished.then(ok, err);\n }\n\n private attach(): this {\n if (this.parent || this._off) return this;\n this._done = false;\n this._off = getTicker().add((_, dt) => this.advance(dt));\n return this;\n }\n private advance(dt: number): void {\n const td = this.totalDuration;\n this.seek(this._t + dt * this._dir * this.timeScale);\n if ((this._dir > 0 && this._t >= td) || (this._dir < 0 && this._t <= 0)) this.complete();\n }\n protected complete(): void {\n this.pause();\n if (this._done) return;\n this._done = true;\n this.onComplete?.();\n this._resolve();\n }\n}\n\ninterface Track { k: string; from?: Val; to: Val; fromRaw?: number | string; toRaw: number | string }\n\n/** A tween of one target. */\nexport class Tween extends Playable {\n readonly target: Target;\n private _dur: number;\n private ease: Ease;\n private tracks: Track[] | null = null;\n private toProps: Props;\n private fromProps: Props;\n constructor(target: Target, o: TweenOptions) {\n super(o);\n this.target = target;\n this._dur = o.duration ?? 600;\n this.ease = parseEase(o.ease);\n this.toProps = o.to || {};\n this.fromProps = o.from || {};\n }\n get duration(): number {\n return this._dur;\n }\n /** Capture start values (first render). */\n private init(): Track[] {\n const keys = Array.from(new Set([...Object.keys(this.fromProps), ...Object.keys(this.toProps)]));\n return keys.map((k) => {\n const fromRaw = k in this.fromProps ? this.fromProps[k] : readProp(this.target, k);\n const toRaw = k in this.toProps ? this.toProps[k] : readProp(this.target, k);\n return { k, fromRaw, toRaw, from: parseValue(fromRaw), to: parseValue(toRaw) };\n });\n }\n protected renderLocal(ms: number, ended: boolean): void {\n this.tracks ||= this.init();\n const p = this._dur ? (ended ? this.ease(ms >= this._dur ? 1 : 0) : this.ease(ms / this._dur)) : 1;\n let tr = false;\n for (const t of this.tracks) {\n writeProp(this.target, t.k, lerpVal(t.from!, t.to, p));\n if (TRANSFORM.includes(t.k)) tr = true;\n }\n if (tr && isEl(this.target)) writeTransform(this.target);\n }\n}\n\ntype Child = { item: Playable | (() => void); start: number; fired?: boolean };\n\n/** Position: ms number, '<' (start of previous), '>' (end of previous, default), '+=200' / '-=200' (relative to the end), 'label', 'label+=100', '<+=100'. */\nexport type Position = number | string;\n\nexport interface TimelineOptions extends PlayOptions {\n /** Defaults merged into every `.to()`. */\n defaults?: Omit<TweenOptions, 'to' | 'from'>;\n}\n\n/** A sequence of tweens, nested timelines and callbacks. */\nexport class Timeline extends Playable {\n private children: Child[] = [];\n private labels: Record<string, number> = {};\n private prevStart = 0;\n private prevEnd = 0;\n private defaults: TimelineOptions['defaults'];\n private lastLocal = 0;\n constructor(o: TimelineOptions = {}) {\n super(o);\n this.defaults = o.defaults;\n }\n get duration(): number {\n let d = 0;\n for (const c of this.children) d = Math.max(d, c.start + (typeof c.item === 'function' ? 0 : c.item.totalDuration));\n return d;\n }\n private resolve(pos: Position | undefined): number {\n if (pos === undefined || pos === '>') return this.prevEnd;\n if (typeof pos === 'number') return Math.max(0, pos);\n const m = /^([<>]|[\\w-]+)?\\s*(?:([+-])=\\s*([\\d.]+))?$/.exec(pos.trim());\n if (!m) throw new Error(`[motionary] bad timeline position \"${pos}\"`);\n let base = this.prevEnd;\n if (m[1] === '<') base = this.prevStart;\n else if (m[1] && m[1] !== '>') {\n if (!(m[1] in this.labels)) throw new Error(`[motionary] unknown timeline label \"${m[1]}\"`);\n base = this.labels[m[1]];\n }\n const off = m[2] ? (m[2] === '+' ? 1 : -1) * parseFloat(m[3]) : 0;\n return Math.max(0, base + off);\n }\n /** Add a tween, timeline or callback at a position. */\n add(item: Playable | (() => void), position?: Position): this {\n const start = this.resolve(position);\n if (typeof item !== 'function') {\n item.pause();\n item.parent = this;\n }\n this.children.push({ item, start });\n this.prevStart = start;\n this.prevEnd = start + (typeof item === 'function' ? 0 : item.totalDuration);\n return this;\n }\n /** `tween(target, vars)` placed at `position` (stagger across several targets). */\n to(target: Target | Target[] | ArrayLike<Target>, vars: TweenOptions, position?: Position): this {\n const list = toList(target);\n const start = this.resolve(position);\n let end = start;\n list.forEach((t, i) => {\n const tw = new Tween(t, { ...this.defaults, ...vars, delay: (vars.delay || 0) + (vars.stagger || 0) * i, paused: true });\n tw.parent = this;\n this.children.push({ item: tw, start });\n end = Math.max(end, start + tw.totalDuration);\n });\n this.prevStart = start;\n this.prevEnd = end;\n return this;\n }\n call(fn: () => void, position?: Position): this {\n return this.add(fn, position);\n }\n label(name: string, position?: Position): this {\n this.labels[name] = this.resolve(position);\n return this;\n }\n /** Time of a label, ms. */\n labelTime(name: string): number | undefined {\n return this.labels[name];\n }\n remove(item: Playable): void {\n this.children = this.children.filter((c) => c.item !== item);\n }\n /** Children in start order (callbacks excluded). */\n getChildren(): Playable[] {\n return this.children.filter((c) => typeof c.item !== 'function').map((c) => c.item as Playable);\n }\n protected renderLocal(ms: number): void {\n const forward = ms >= this.lastLocal;\n const list = [...this.children].sort((a, b) => (forward ? a.start - b.start : b.start - a.start));\n for (const c of list) {\n if (typeof c.item === 'function') {\n if (forward && !c.fired && ms >= c.start && this.lastLocal <= c.start) {\n c.fired = true;\n c.item();\n } else if (!forward && ms < c.start) c.fired = false;\n continue;\n }\n const local = ms - c.start;\n const p = c.item as Playable & { _started?: boolean };\n if (local < 0) {\n if (p._started) p.seek(0);\n continue;\n }\n p._started = true;\n p.seek(Math.min(local, p.totalDuration));\n }\n this.lastLocal = ms;\n }\n}\n\nfunction toList(t: Target | Target[] | ArrayLike<Target>): Target[] {\n if (Array.isArray(t)) return t;\n if (t && typeof (t as ArrayLike<Target>).length === 'number' && !isEl(t)) return Array.from(t as ArrayLike<Target>);\n return [t as Target];\n}\n\n/**\n * Tween one or more targets. Returns a `Tween` (or a `Timeline` holding one\n * tween per target when several are given) that starts on the next frame\n * unless `paused`. `await` it for completion.\n */\nexport function tween(target: Target | Target[] | ArrayLike<Target>, o: TweenOptions): Playable {\n const list = toList(target);\n let p: Playable;\n if (list.length === 1) p = new Tween(list[0], o);\n else {\n const tl = new Timeline({ repeat: o.repeat, yoyo: o.yoyo, onUpdate: o.onUpdate, onComplete: o.onComplete, delay: o.delay });\n tl.to(list, { ...o, delay: 0, repeat: 0, yoyo: false, onUpdate: undefined, onComplete: undefined }, 0);\n p = tl;\n }\n if (!o.paused) p.play();\n return p;\n}\n\n/** A new timeline (plays on the next frame unless `paused`). */\nexport function timeline(o: TimelineOptions = {}): Timeline {\n const tl = new Timeline(o);\n if (!o.paused) tl.play();\n return tl;\n}\n","/**\n * `motionary/runtime` (10.1) — Motionary's own zero-dependency animation\n * runtime, the one prerequisite for runtime-powered components:\n *\n * - shared **ticker** (`getTicker()`): one rAF loop for everything;\n * - **tween + timeline** engine with easing (`tween()`, `timeline()`, `EASES`, `cubicBezier()`);\n * - **module registry** (`use()`, `requireModule()`, `hasModule()`) with a\n * clear `RuntimeModuleError` (install / import / CDN instructions) when a\n * component needs a module that was not registered.\n *\n * Every other module lives at its own subpath (`motionary/runtime/format-css`,\n * `motionary/runtime/format-motion`, …) so you only pay for what you import.\n * SSR-safe (no `window` access at import) and usable in Web Workers.\n *\n * ```ts\n * import { use, tween } from 'motionary/runtime';\n * use(); // registers the core (components can now find it)\n * tween('.box', { to: { x: 120, opacity: 1 }, duration: 500, ease: 'back-out' });\n * ```\n */\nimport { register, RUNTIME_VERSION, type RuntimeModule, type RuntimeRegistry } from './registry';\nimport { getTicker } from './ticker';\nimport { tween as rawTween, timeline, Tween, Timeline, type TweenOptions, type Playable } from './tween';\nimport { EASES, parseEase, cubicBezier, steps } from './ease';\n\nexport { registry, register, requireModule, hasModule, registeredModules, missingMessage, modulePath, moduleCdn, RuntimeModuleError, RUNTIME_VERSION, RUNTIME_CDN } from './registry';\nexport type { RuntimeModule, RuntimeRegistry } from './registry';\nexport { getTicker } from './ticker';\nexport type { Ticker, TickFn } from './ticker';\nexport { timeline, Tween, Timeline, Playable, parseValue } from './tween';\nexport type { TweenOptions, TimelineOptions, PlayOptions, Props, Target, Position } from './tween';\nexport { EASES, parseEase, cubicBezier, steps } from './ease';\nexport type { Ease } from './ease';\n\n/** The core module's API (what `requireModule('core')` returns). */\nexport interface CoreApi {\n version: string;\n getTicker: typeof getTicker;\n tween: (target: any, o: import('./tween').TweenOptions) => import('./tween').Playable;\n timeline: typeof timeline;\n Tween: typeof Tween;\n Timeline: typeof Timeline;\n EASES: typeof EASES;\n parseEase: typeof parseEase;\n cubicBezier: typeof cubicBezier;\n steps: typeof steps;\n}\n\n/** The core as a module object. */\nexport const core: RuntimeModule<CoreApi> = {\n id: 'core',\n version: RUNTIME_VERSION,\n api: { version: RUNTIME_VERSION, getTicker, tween, timeline, Tween, Timeline, EASES, parseEase, cubicBezier, steps },\n};\n\n/** Tween targets (objects, elements, lists or a CSS selector). See `TweenOptions`. */\nexport function tween(target: any, o: TweenOptions): Playable {\n return rawTween(resolveTargets(target), o);\n}\n\n/** Selector strings become element lists (only where `document` exists). */\nexport function resolveTargets(t: any): any {\n if (typeof t === 'string') {\n if (typeof document === 'undefined') throw new Error('[motionary] selector targets need a document — pass objects or elements instead');\n return Array.from(document.querySelectorAll(t));\n }\n return t;\n}\n\n/**\n * Register the core plus any modules (`use(formatCss, formatMotion)`).\n * Call once at start-up, before runtime-powered components mount.\n */\nexport function use(...mods: RuntimeModule[]): RuntimeRegistry {\n return register(core as RuntimeModule, ...mods);\n}\n","// CDN build: <script src=\".../dist/runtime.iife.js\"> → window.MotionaryRuntime, core registered.\nimport { use } from '../index';\nexport * from '../index';\nuse();\n"],"names":["RUNTIME_VERSION","RUNTIME_CDN","KEY","Symbol","for","registry","g","globalThis","version","modules","Map","slots","modulePath","id","moduleCdn","missingMessage","who","path","camel","replace","_","c","toUpperCase","RuntimeModuleError","Error","constructor","super","this","name","module","register","mods","r","m","TypeError","has","dep","requires","set","setup","createTicker","fns","Set","time","last","fps","maxDelta","handle","now","performance","Date","raf","cb","requestAnimationFrame","setTimeout","run","dt","cap","d","Math","min","t","timeScale","fn","Array","from","frame","ts","size","n","add","remove","h","delete","cancelAnimationFrame","clearTimeout","round","lagSmoothing","ms","Infinity","step","getTicker","s","ticker","out","f","inOut","pow","p","cubicBezier","x1","y1","x2","y2","a","p1","p2","b","at","slope","x","i","abs","lo","hi","v","steps","pos","k","ceil","floor","max","BASE","quad","cubic","quart","quint","sine","cos","PI","expo","circ","sqrt","back","elastic","sin","bounce","EASES","linear","ease","smooth","Object","entries","parseEase","e","trim","exec","TRANSFORM","DEFAULT_UNIT","y","rotate","skewX","skewY","scale","scaleX","scaleY","tstate","WeakMap","isEl","Element","parseValue","kind","u","length","split","map","join","parseInt","slice","filter","Boolean","endsWith","parseFloat","undefined","lerpVal","ca","toFixed","kebab","startsWith","toLowerCase","readProp","includes","get","inline","style","getPropertyValue","getComputedStyle","writeProp","setProperty","String","Playable","o","_t","_dir","_off","_done","parent","delay","repeat","yoyo","onUpdate","onComplete","finished","Promise","_resolve","totalDuration","duration","progress","td","seek","isActive","reversed","renderLocal","it","local","play","attach","pause","reverse","restart","kill","then","ok","err","advance","complete","Tween","target","tracks","_dur","toProps","to","fromProps","init","keys","fromRaw","toRaw","ended","tr","el","parts","push","transform","writeTransform","Timeline","children","labels","prevStart","prevEnd","lastLocal","defaults","start","item","resolve","base","off","position","vars","list","toList","end","forEach","tw","stagger","paused","call","label","labelTime","getChildren","forward","sort","fired","_started","isArray","timeline","tl","core","api","tween","rawTween","resolveTargets","document","querySelectorAll","use"],"mappings":"0BAUO,MAAMA,EAAkB,SAGlBC,EAAc,kDAsBrBC,EAAMC,OAAOC,IAAI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