motionary 10.0.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 +22 -0
- package/README.md +45 -0
- package/bin/create-motionary-plugin.mjs +124 -0
- 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/registry-C0xLNq3-.cjs +81 -0
- package/dist/chunks/registry-C0xLNq3-.cjs.map +1 -0
- package/dist/chunks/registry-jF8VIA_9.js +69 -0
- package/dist/chunks/registry-jF8VIA_9.js.map +1 -0
- 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/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 +101 -1
- package/dist/components/marketplace.js.map +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 +420 -201
- package/dist/components/widgets.js.map +1 -1
- 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 +69 -38
- package/docs/components.md +55 -0
- package/docs/runtime/core.md +55 -0
- package/docs/runtime/format-css.md +59 -0
- package/docs/runtime/format-motion.md +56 -0
- package/package.json +48 -6
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [10.1.0] - 2026-10-09
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **`motionary/runtime` — Motionary's own zero-dependency animation runtime** (original implementation; no third-party code). Shared ticker (`getTicker()`: one rAF loop, lag smoothing, `timeScale`, `step()` for tests / workers), tween + timeline engine (`tween()`, `timeline()`, `Tween`, `Timeline`: plain objects and elements — CSS lengths, colours, custom properties, transform shorthands `x y rotate scale scaleX scaleY skewX skewY`; positions `<`, `>`, `+=`, `-=`, labels; `repeat`, `yoyo`, `reverse()`, `seek()`, `await`), easing (`EASES`, `cubicBezier()`, `steps()`, `parseEase()`), and the module registry (`use()`, `requireModule()`, `hasModule()`, `RuntimeModuleError` with install / import / CDN instructions). SSR-safe (no `window` at import), works in Web Workers, TypeScript types. CDN: `dist/runtime.iife.js` (`window.MotionaryRuntime`, registers itself) and per-module `dist/runtime/<module>.iife.js`; ESM at `dist/runtime.js` / `dist/runtime/<module>.js`.
|
|
14
|
+
- **Format loaders** (each its own tree-shakable module with a fixed gzip budget): `motionary/runtime/format-css` — CSS `@keyframes` (prefixed rules, selector lists, per-frame `animation-timing-function`, transforms as shorthands) and Web Animations API keyframes (array + property-indexed, offsets distributed like the WAAPI) → runtime timeline (`parseKeyframes`, `fromCssRule`, `fromWaapi`, `toWaapi`, `playKeyframes`); `motionary/runtime/format-motion` — Motion / Framer-style `{ initial, animate, transition }` JSON (array keyframes, `times`, ease names / cubic arrays, `repeat` + `repeatType`, per-property transitions, `type: "spring"` simulated into an easing) (`fromMotion`, `playMotion`, `springEase`, `motionEase`). Compatibility tables in `docs/runtime/format-css.md` and `docs/runtime/format-motion.md`.
|
|
15
|
+
- **Prerequisites system**: `showcase/catalog/prereqs.js` is the single source for every component prerequisite (runtime modules now; official third-party runtimes for formats we cannot implement, from 10.6). Gallery cards get a **Requires** block (install, import & register order, CDN, minimal example), Store cards a **"Requires: motionary/runtime/…"** badge and a Prerequisites section in the detail; code snippets include the prerequisites; `scripts/gen-runtime-docs.mjs` writes `docs/runtime/<module>.md` and the README / `docs/components.md` prerequisite blocks.
|
|
16
|
+
- **`npm run check:peer-docs`** (in CI): every runtime-powered component documents its prerequisites in all five places (gallery card, Store detail, docs page, README, AI manifest); every `runtimeModule()` call is declared on its card; every module has a docs page, a compatibility table and a size budget; generated docs are current.
|
|
17
|
+
- **AI-readable components**: `dist/manifest.json` (npm `motionary/manifest.json`, Pages `/components.json`) with JSON Schema (`motionary/manifest.schema.json`, Pages `/components.schema.json`) — every component's tag, attributes, events, slots, methods, import path, define function, CDN URL, minimal example and prerequisites, plus the runtime modules; `llms.txt` (index) and `llms-full.txt` (full reference) at the Pages root. All generated from the source at build time.
|
|
18
|
+
- **Plugin ecosystem**: `create-motionary-plugin` scaffold (`npx -p motionary create-motionary-plugin my-plugin`: EffectPlugin, node:test test, README, `scripts/sign.mjs` writing the SHA-256 integrity into `motionary-plugin.json`); `motionary/marketplace` adds `pluginIntegrity()`, `verifyPlugin()` (SRI-style sha256/384/512 via Web Crypto), `satisfies()` (semver ranges) and `checkCompat()` (`engines.motionary`).
|
|
19
|
+
- **New components (10.1)** in `motionary/components/widgets`: `<usa-plugin-card>` — plugin detail card with compatibility + signature badges, animated download counter and expandable details (**Requires: motionary/runtime**); `<usa-install-button>` — npm / pnpm / yarn / bun / CDN tabs with copy-to-clipboard.
|
|
20
|
+
- Showcase: new gallery cards with copyable code, live demos and live Store thumbnails; the gallery and thumbnails register the runtime modules.
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
- ROADMAP (track B): no third-party peer libraries and no umbrella bundle — each planned component is powered by a `motionary/runtime` module (scroll, text, smooth, gl, vector, physics, drag-snap) plus a format loader per version; official third-party runtimes only where a format cannot reasonably be implemented (Rive `.riv`, optional Lottie full-fidelity, Draco / KTX2), listed with reasons. `<usa-split-text>` and `<usa-carousel>` already exist, so the planned runtime components are `<usa-text-splitter>` and `<usa-snap-carousel>`.
|
|
24
|
+
|
|
25
|
+
### Accessibility
|
|
26
|
+
- `<usa-plugin-card>` counts and expands without animation under reduced motion; its details button exposes `aria-expanded`. `<usa-install-button>` tabs are a labelled `tablist`; the copy confirmation is announced (`aria-live`). A missing runtime module renders a visible `role="alert"` message instead of failing silently.
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
- The showcase snippet tests now accept the documented `motionary/runtime` and `motionary/runtime/<module>` entry points used by runtime-powered components' code tabs.
|
|
30
|
+
- `<usa-install-button>`: switching package-manager tabs now animates the command in (it changed abruptly); skipped under reduced motion.
|
|
31
|
+
|
|
10
32
|
## [10.0.0] - 2026-10-09
|
|
11
33
|
|
|
12
34
|
### ⚠️ Breaking
|
package/README.md
CHANGED
|
@@ -166,6 +166,51 @@ Import one category (`motionary/components/cards`), everything (`motionary/compo
|
|
|
166
166
|
| **Effect registry** (`/components/fx`) | `<usa-fx>` |
|
|
167
167
|
| **Effect packs** (`/components/effects`) | `<usa-player>` · `<usa-story>` · `<usa-audio>` · `<usa-motion-theme>` · `<usa-gesture-fx>` |
|
|
168
168
|
|
|
169
|
+
<!-- runtime:start -->
|
|
170
|
+
## Runtime (`motionary/runtime`) & prerequisites
|
|
171
|
+
|
|
172
|
+
Motionary ships its own zero-dependency animation runtime — shared ticker, tween + timeline engine, and one tree-shakable module per feature / format (`motionary/runtime/<module>`). `npm i motionary` installs all of it; you pay only for the modules you import. Components that need a module say so with a **Requires:** badge in the gallery and the Store, and throw a clear error (install / import / CDN) when it is missing.
|
|
173
|
+
|
|
174
|
+
| Module | Import | CDN (IIFE) | Register | gzip budget |
|
|
175
|
+
|---|---|---|---|---|
|
|
176
|
+
| [Runtime core](docs/runtime/core.md) | `motionary/runtime` | `https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime.iife.js` | `use();` | 5.5 KB |
|
|
177
|
+
| [CSS @keyframes & WAAPI keyframes loader](docs/runtime/format-css.md) | `motionary/runtime/format-css` | `https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/format-css.iife.js` | `use(formatCss);` | 2.5 KB |
|
|
178
|
+
| [Motion / Framer keyframe JSON loader](docs/runtime/format-motion.md) | `motionary/runtime/format-motion` | `https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/format-motion.iife.js` | `use(formatMotion);` | 2.5 KB |
|
|
179
|
+
|
|
180
|
+
Install once: `npm i motionary`. Plain HTML: load `runtime.iife.js` first, then the module files (each registers itself).
|
|
181
|
+
|
|
182
|
+
#### `<usa-plugin-card>` — Requires: motionary/runtime
|
|
183
|
+
|
|
184
|
+
- **Install:** `npm i motionary`
|
|
185
|
+
- **Import order & registration:** Import motionary/runtime and call use() once at start-up, before any runtime-powered component mounts. CDN: the IIFE registers itself (window.MotionaryRuntime).
|
|
186
|
+
|
|
187
|
+
```js
|
|
188
|
+
import { use } from 'motionary/runtime';
|
|
189
|
+
import { definePluginCard } from 'motionary/components/widgets';
|
|
190
|
+
|
|
191
|
+
use();
|
|
192
|
+
definePluginCard(); // registers <usa-plugin-card> — after the prerequisites
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
- **CDN:**
|
|
196
|
+
|
|
197
|
+
```html
|
|
198
|
+
<script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime.iife.js"></script>
|
|
199
|
+
<!-- then the component bundles -->
|
|
200
|
+
<script src="https://unpkg.com/motionary@10/dist/components.umd.js"></script>
|
|
201
|
+
<script src="https://unpkg.com/motionary@10/dist/widgets.umd.js"></script>
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
- **Minimal example:**
|
|
205
|
+
|
|
206
|
+
```html
|
|
207
|
+
<usa-plugin-card name="retro" title="Retro" version="1.2.0" author="Motionary" engine="^10.0.0" downloads="12400">
|
|
208
|
+
<p>Pixel, CRT, VHS and Y2K effects.</p>
|
|
209
|
+
</usa-plugin-card>
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
<!-- runtime:end -->
|
|
213
|
+
|
|
169
214
|
## Accessibility & reduced motion
|
|
170
215
|
|
|
171
216
|
- With `prefers-reduced-motion: reduce`, scroll reveals show content immediately (no entrance, parallax or scrub motion), and components fall back to calm states (`staticAlternative()` / `adaptKeyframes()`).
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// 10.1: scaffold a Motionary effect plugin.
|
|
3
|
+
// npx -p motionary create-motionary-plugin my-plugin [--dir path] [--force]
|
|
4
|
+
// Writes package.json (motionary as a peer, engines.motionary range), src/index.js
|
|
5
|
+
// (an EffectPlugin for createMotion().use() / usePlugins()), a test, a README and
|
|
6
|
+
// scripts/sign.mjs, which writes the SRI integrity of dist/index.js into
|
|
7
|
+
// motionary-plugin.json (checked by verifyPlugin() / <usa-plugin-card integrity>).
|
|
8
|
+
import { mkdirSync, writeFileSync, existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
9
|
+
import { join, resolve } from 'node:path';
|
|
10
|
+
|
|
11
|
+
const args = process.argv.slice(2);
|
|
12
|
+
if (!args.length || args.includes('--help') || args.includes('-h')) {
|
|
13
|
+
console.log('Usage: create-motionary-plugin <name> [--dir <path>] [--force]\n\nScaffolds a Motionary effect plugin (EffectPlugin) with tests, README and an integrity signing script.');
|
|
14
|
+
process.exit(args.length ? 0 : 1);
|
|
15
|
+
}
|
|
16
|
+
const name = args.find((a) => !a.startsWith('-') && args[args.indexOf(a) - 1] !== '--dir');
|
|
17
|
+
if (!/^(@[a-z0-9-]+\/)?[a-z0-9][a-z0-9._-]*$/.test(name || '')) {
|
|
18
|
+
console.error(`create-motionary-plugin: invalid package name "${name}" (lowercase, npm rules)`);
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
const short = name.split('/').pop().replace(/^motionary-(plugin-)?/, '');
|
|
22
|
+
const dir = resolve(args.includes('--dir') ? args[args.indexOf('--dir') + 1] : short);
|
|
23
|
+
if (existsSync(dir) && readdirSync(dir).length && !args.includes('--force')) {
|
|
24
|
+
console.error(`create-motionary-plugin: ${dir} is not empty (use --force)`);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
const self = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
28
|
+
const major = self.version.split('.')[0];
|
|
29
|
+
const effect = `${short}-pop`;
|
|
30
|
+
const files = {
|
|
31
|
+
'package.json': JSON.stringify({
|
|
32
|
+
name,
|
|
33
|
+
version: '0.1.0',
|
|
34
|
+
description: `Motionary effect plugin: ${short}`,
|
|
35
|
+
type: 'module',
|
|
36
|
+
main: './dist/index.js',
|
|
37
|
+
exports: { '.': './dist/index.js', './motionary-plugin.json': './motionary-plugin.json' },
|
|
38
|
+
files: ['dist', 'motionary-plugin.json'],
|
|
39
|
+
keywords: ['motionary', 'motionary-plugin', 'animation'],
|
|
40
|
+
scripts: { build: 'node -e "require(\'fs\').mkdirSync(\'dist\',{recursive:true});require(\'fs\').copyFileSync(\'src/index.js\',\'dist/index.js\')"', sign: 'node scripts/sign.mjs', test: 'node --test test/plugin.test.mjs', prepublishOnly: 'npm run build && npm run sign && npm test' },
|
|
41
|
+
peerDependencies: { motionary: `>=${major}.0.0` },
|
|
42
|
+
engines: { motionary: `>=${major}.0.0` },
|
|
43
|
+
license: 'MIT',
|
|
44
|
+
}, null, 2) + '\n',
|
|
45
|
+
'src/index.js': `/**
|
|
46
|
+
* ${name} — a Motionary effect plugin.
|
|
47
|
+
*
|
|
48
|
+
* import { createMotion } from 'motionary/core';
|
|
49
|
+
* import ${camel(short)} from '${name}';
|
|
50
|
+
* createMotion().use(${camel(short)});
|
|
51
|
+
* // or: import { usePlugins } from 'motionary/fx2'; usePlugins(${camel(short)});
|
|
52
|
+
*/
|
|
53
|
+
const ${camel(short)} = {
|
|
54
|
+
name: '${short}',
|
|
55
|
+
effects: [
|
|
56
|
+
{
|
|
57
|
+
name: '${effect}',
|
|
58
|
+
kind: 'enter',
|
|
59
|
+
description: 'Scale up with a soft overshoot.',
|
|
60
|
+
// run(el, options, ctx): ctx.animate(el, keyframes, timing) honours reduced motion and pausing
|
|
61
|
+
run(el, options, ctx) {
|
|
62
|
+
if (ctx.reduced) return null;
|
|
63
|
+
return ctx.animate(el, [{ transform: 'scale(.6)', opacity: 0 }, { transform: 'scale(1.08)', opacity: 1, offset: 0.7 }, { transform: 'scale(1)', opacity: 1 }], { duration: 520, easing: 'cubic-bezier(.22,1,.36,1)' });
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
};
|
|
68
|
+
export default ${camel(short)};
|
|
69
|
+
`,
|
|
70
|
+
'test/plugin.test.mjs': `import { test } from 'node:test';
|
|
71
|
+
import assert from 'node:assert/strict';
|
|
72
|
+
import plugin from '../src/index.js';
|
|
73
|
+
|
|
74
|
+
test('exports an EffectPlugin', () => {
|
|
75
|
+
assert.equal(typeof plugin.name, 'string');
|
|
76
|
+
assert.ok(Array.isArray(plugin.effects) && plugin.effects.length > 0);
|
|
77
|
+
for (const e of plugin.effects) assert.equal(typeof e.run, 'function');
|
|
78
|
+
});
|
|
79
|
+
test('respects reduced motion', () => {
|
|
80
|
+
assert.equal(plugin.effects[0].run({}, {}, { reduced: true, animate() { throw new Error('animated'); } }), null);
|
|
81
|
+
});
|
|
82
|
+
`,
|
|
83
|
+
'scripts/sign.mjs': `// Writes motionary-plugin.json with the SRI integrity of dist/index.js.
|
|
84
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
85
|
+
import { createHash } from 'node:crypto';
|
|
86
|
+
const pkg = JSON.parse(readFileSync('package.json', 'utf8'));
|
|
87
|
+
const code = readFileSync('dist/index.js');
|
|
88
|
+
const integrity = 'sha256-' + createHash('sha256').update(code).digest('base64');
|
|
89
|
+
const manifest = { format: 'motionary/plugin', name: pkg.name, version: pkg.version, entry: 'dist/index.js', integrity, engines: pkg.engines };
|
|
90
|
+
writeFileSync('motionary-plugin.json', JSON.stringify(manifest, null, 2) + '\\n');
|
|
91
|
+
console.log('signed', pkg.name, integrity);
|
|
92
|
+
`,
|
|
93
|
+
'README.md': `# ${name}
|
|
94
|
+
|
|
95
|
+
A [Motionary](https://github.com/HarrisonCN/Motionary) effect plugin.
|
|
96
|
+
|
|
97
|
+
\`\`\`bash
|
|
98
|
+
npm i motionary ${name}
|
|
99
|
+
\`\`\`
|
|
100
|
+
|
|
101
|
+
\`\`\`js
|
|
102
|
+
import { createMotion } from 'motionary/core';
|
|
103
|
+
import ${camel(short)} from '${name}';
|
|
104
|
+
|
|
105
|
+
createMotion().use(${camel(short)});
|
|
106
|
+
\`\`\`
|
|
107
|
+
|
|
108
|
+
## Develop
|
|
109
|
+
|
|
110
|
+
- \`npm test\` — node:test
|
|
111
|
+
- \`npm run build && npm run sign\` — writes \`motionary-plugin.json\` with the \`sha256-…\` integrity of \`dist/index.js\`.
|
|
112
|
+
Hosts verify it with \`verifyPlugin(code, integrity)\` from \`motionary/marketplace\`, and
|
|
113
|
+
\`<usa-plugin-card integrity="sha256-…" src=".../dist/index.js">\` shows a Verified badge.
|
|
114
|
+
- \`engines.motionary\` is checked by \`checkCompat(manifest, version)\`.
|
|
115
|
+
`,
|
|
116
|
+
};
|
|
117
|
+
function camel(s) {
|
|
118
|
+
return s.replace(/[-_.](\w)/g, (_, c) => c.toUpperCase()).replace(/^\d/, '_$&');
|
|
119
|
+
}
|
|
120
|
+
for (const [f, s] of Object.entries(files)) {
|
|
121
|
+
mkdirSync(join(dir, f, '..'), { recursive: true });
|
|
122
|
+
writeFileSync(join(dir, f), s);
|
|
123
|
+
}
|
|
124
|
+
console.log(`Created ${name} in ${dir}\n cd ${dir} && npm test`);
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { T as Timeline, a as Tween, p as parseEase, d as parseValue } from './tween-DDObu9iA.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Normalised keyframes shared by the format loaders: a list of frames with
|
|
5
|
+
* offsets in [0, 1], camelCase props and an optional per-segment easing,
|
|
6
|
+
* played as a runtime `Timeline` (one tween per segment).
|
|
7
|
+
*/
|
|
8
|
+
const camelProp = (k) => (k.startsWith('--') ? k : k.trim().replace(/-([a-z])/g, (_, c) => c.toUpperCase()));
|
|
9
|
+
/** Fill in missing offsets (spaced evenly between known ones, first 0 / last 1), as the WAAPI does. */
|
|
10
|
+
function distributeOffsets(frames) {
|
|
11
|
+
const out = frames.map((f) => ({ ...f }));
|
|
12
|
+
if (!out.length)
|
|
13
|
+
return out;
|
|
14
|
+
if (out[0].offset == null)
|
|
15
|
+
out[0].offset = out.length === 1 ? 1 : 0;
|
|
16
|
+
if (out[out.length - 1].offset == null)
|
|
17
|
+
out[out.length - 1].offset = 1;
|
|
18
|
+
let i = 0;
|
|
19
|
+
while (i < out.length) {
|
|
20
|
+
if (out[i].offset != null) {
|
|
21
|
+
i++;
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
const a = i - 1;
|
|
25
|
+
let b = i;
|
|
26
|
+
while (out[b].offset == null)
|
|
27
|
+
b++;
|
|
28
|
+
const from = out[a].offset, to = out[b].offset;
|
|
29
|
+
for (let k = i; k < b; k++)
|
|
30
|
+
out[k].offset = from + ((to - from) * (k - a)) / (b - a);
|
|
31
|
+
i = b;
|
|
32
|
+
}
|
|
33
|
+
return out;
|
|
34
|
+
}
|
|
35
|
+
/** CSS transform functions → runtime transform shorthands (translate/rotate/scale/skew); null when not representable (matrix, 3D, …). */
|
|
36
|
+
function transformToProps(t) {
|
|
37
|
+
if (!t || t === 'none')
|
|
38
|
+
return { x: 0, y: 0, rotate: 0, scale: 1 };
|
|
39
|
+
const out = {};
|
|
40
|
+
const re = /([a-zA-Z][a-zA-Z0-9]*)\(([^)]*)\)/g;
|
|
41
|
+
let m;
|
|
42
|
+
let rest = t;
|
|
43
|
+
while ((m = re.exec(t))) {
|
|
44
|
+
rest = rest.replace(m[0], '');
|
|
45
|
+
const args = m[2].split(/[\s,]+/).filter(Boolean);
|
|
46
|
+
switch (m[1]) {
|
|
47
|
+
case 'translate':
|
|
48
|
+
out.x = args[0];
|
|
49
|
+
out.y = args[1] ?? 0;
|
|
50
|
+
break;
|
|
51
|
+
case 'translateX':
|
|
52
|
+
out.x = args[0];
|
|
53
|
+
break;
|
|
54
|
+
case 'translateY':
|
|
55
|
+
out.y = args[0];
|
|
56
|
+
break;
|
|
57
|
+
case 'translate3d':
|
|
58
|
+
if (parseFloat(args[2] || '0') !== 0)
|
|
59
|
+
return null;
|
|
60
|
+
out.x = args[0];
|
|
61
|
+
out.y = args[1] ?? 0;
|
|
62
|
+
break;
|
|
63
|
+
case 'scale3d':
|
|
64
|
+
if (parseFloat(args[2] ?? '1') !== 1)
|
|
65
|
+
return null;
|
|
66
|
+
if (args[1] !== undefined && args[1] !== args[0]) {
|
|
67
|
+
out.scaleX = +args[0];
|
|
68
|
+
out.scaleY = +args[1];
|
|
69
|
+
}
|
|
70
|
+
else
|
|
71
|
+
out.scale = +args[0];
|
|
72
|
+
break;
|
|
73
|
+
case 'rotate':
|
|
74
|
+
case 'rotateZ':
|
|
75
|
+
out.rotate = args[0];
|
|
76
|
+
break;
|
|
77
|
+
case 'scale':
|
|
78
|
+
if (args[1] !== undefined && args[1] !== args[0]) {
|
|
79
|
+
out.scaleX = +args[0];
|
|
80
|
+
out.scaleY = +args[1];
|
|
81
|
+
}
|
|
82
|
+
else
|
|
83
|
+
out.scale = +args[0];
|
|
84
|
+
break;
|
|
85
|
+
case 'scaleX':
|
|
86
|
+
out.scaleX = +args[0];
|
|
87
|
+
break;
|
|
88
|
+
case 'scaleY':
|
|
89
|
+
out.scaleY = +args[0];
|
|
90
|
+
break;
|
|
91
|
+
case 'skewX':
|
|
92
|
+
out.skewX = args[0];
|
|
93
|
+
break;
|
|
94
|
+
case 'skewY':
|
|
95
|
+
out.skewY = args[0];
|
|
96
|
+
break;
|
|
97
|
+
default: return null;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return rest.trim() ? null : out;
|
|
101
|
+
}
|
|
102
|
+
/** Expand `transform` into shorthands where possible (kept as a discrete prop otherwise). */
|
|
103
|
+
function expandProps(props) {
|
|
104
|
+
const out = {};
|
|
105
|
+
for (const [k, v] of Object.entries(props)) {
|
|
106
|
+
if (k === 'transform' && typeof v === 'string') {
|
|
107
|
+
const t = transformToProps(v);
|
|
108
|
+
if (t) {
|
|
109
|
+
Object.assign(out, t);
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
out[k] = v;
|
|
114
|
+
}
|
|
115
|
+
return out;
|
|
116
|
+
}
|
|
117
|
+
const tweenable = (v) => {
|
|
118
|
+
try {
|
|
119
|
+
parseValue(v);
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Play frames on a target as a `Timeline` (paused unless `paused: false`).
|
|
128
|
+
* Props missing from a frame hold their previous value; non-numeric values
|
|
129
|
+
* (e.g. `display`, `matrix(...)`) switch discretely at the segment midpoint.
|
|
130
|
+
*/
|
|
131
|
+
function framesToTimeline(target, frames, o = {}) {
|
|
132
|
+
const dur = o.duration ?? 1000;
|
|
133
|
+
const fs = [...frames].sort((a, b) => a.offset - b.offset).map((f) => ({ ...f, props: expandProps(f.props) }));
|
|
134
|
+
const tl = new Timeline({ repeat: o.repeat, yoyo: o.yoyo, delay: o.delay, onUpdate: o.onUpdate, onComplete: o.onComplete });
|
|
135
|
+
const keys = Array.from(new Set(fs.flatMap((f) => Object.keys(f.props))));
|
|
136
|
+
// carry values forward / backward so every frame has every key
|
|
137
|
+
const filled = fs.map((f) => ({ ...f, props: { ...f.props } }));
|
|
138
|
+
for (const k of keys) {
|
|
139
|
+
let last;
|
|
140
|
+
for (const f of filled) {
|
|
141
|
+
if (k in f.props)
|
|
142
|
+
last = f.props[k];
|
|
143
|
+
else if (last !== undefined)
|
|
144
|
+
f.props[k] = last;
|
|
145
|
+
}
|
|
146
|
+
let next;
|
|
147
|
+
for (let i = filled.length - 1; i >= 0; i--) {
|
|
148
|
+
if (k in filled[i].props)
|
|
149
|
+
next = filled[i].props[k];
|
|
150
|
+
else if (next !== undefined)
|
|
151
|
+
filled[i].props[k] = next;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const def = o.ease ?? 'linear';
|
|
155
|
+
if (filled.length === 1)
|
|
156
|
+
filled.unshift({ ...filled[0], offset: 0 });
|
|
157
|
+
for (let i = 0; i < filled.length - 1; i++) {
|
|
158
|
+
const a = filled[i], b = filled[i + 1];
|
|
159
|
+
const segDur = Math.max(0, (b.offset - a.offset) * dur);
|
|
160
|
+
const from = {}, to = {};
|
|
161
|
+
const discrete = [];
|
|
162
|
+
for (const k of keys) {
|
|
163
|
+
if (tweenable(a.props[k]) && tweenable(b.props[k])) {
|
|
164
|
+
from[k] = a.props[k];
|
|
165
|
+
to[k] = b.props[k];
|
|
166
|
+
}
|
|
167
|
+
else
|
|
168
|
+
discrete.push([k, b.props[k]]);
|
|
169
|
+
}
|
|
170
|
+
tl.add(new Tween(target, { from, to, duration: segDur, ease: a.easing ? parseEase(a.easing) : def, paused: true }), a.offset * dur);
|
|
171
|
+
for (const [k, v] of discrete)
|
|
172
|
+
tl.call(() => { if (target.style)
|
|
173
|
+
target.style.setProperty(k.replace(/[A-Z]/g, (c) => '-' + c.toLowerCase()), String(v));
|
|
174
|
+
else
|
|
175
|
+
target[k] = v; }, a.offset * dur + segDur / 2);
|
|
176
|
+
}
|
|
177
|
+
if (o.paused === false)
|
|
178
|
+
tl.play();
|
|
179
|
+
return tl;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export { camelProp as c, distributeOffsets as d, framesToTimeline as f };
|
|
183
|
+
//# sourceMappingURL=keyframes-CyH_abhI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyframes-CyH_abhI.js","sources":["../../src/runtime/keyframes.ts"],"sourcesContent":["/**\n * Normalised keyframes shared by the format loaders: a list of frames with\n * offsets in [0, 1], camelCase props and an optional per-segment easing,\n * played as a runtime `Timeline` (one tween per segment).\n */\nimport { Timeline, Tween, parseValue, type Target, type PlayOptions } from './tween';\nimport { parseEase, type Ease } from './ease';\n\nexport interface Frame {\n offset: number;\n props: Record<string, string | number>;\n /** Easing from this frame to the next. */\n easing?: string;\n}\n\nexport interface KeyframesPlayOptions extends PlayOptions {\n /** ms (default 1000). */\n duration?: number;\n /** Default easing for segments without their own (default 'linear', as in CSS / WAAPI keyframes). */\n ease?: string | Ease;\n}\n\nexport const camelProp = (k: string): string => (k.startsWith('--') ? k : k.trim().replace(/-([a-z])/g, (_, c: string) => c.toUpperCase()));\n\n/** Fill in missing offsets (spaced evenly between known ones, first 0 / last 1), as the WAAPI does. */\nexport function distributeOffsets<T extends { offset?: number | null }>(frames: T[]): (T & { offset: number })[] {\n const out = frames.map((f) => ({ ...f })) as (T & { offset: number })[];\n if (!out.length) return out;\n if (out[0].offset == null) out[0].offset = out.length === 1 ? 1 : 0;\n if (out[out.length - 1].offset == null) out[out.length - 1].offset = 1;\n let i = 0;\n while (i < out.length) {\n if (out[i].offset != null) { i++; continue; }\n const a = i - 1;\n let b = i;\n while (out[b].offset == null) b++;\n const from = out[a].offset, to = out[b].offset;\n for (let k = i; k < b; k++) out[k].offset = from + ((to - from) * (k - a)) / (b - a);\n i = b;\n }\n return out;\n}\n\n/** CSS transform functions → runtime transform shorthands (translate/rotate/scale/skew); null when not representable (matrix, 3D, …). */\nexport function transformToProps(t: string): Record<string, string | number> | null {\n if (!t || t === 'none') return { x: 0, y: 0, rotate: 0, scale: 1 };\n const out: Record<string, string | number> = {};\n const re = /([a-zA-Z][a-zA-Z0-9]*)\\(([^)]*)\\)/g;\n let m: RegExpExecArray | null;\n let rest = t;\n while ((m = re.exec(t))) {\n rest = rest.replace(m[0], '');\n const args = m[2].split(/[\\s,]+/).filter(Boolean);\n switch (m[1]) {\n case 'translate': out.x = args[0]; out.y = args[1] ?? 0; break;\n case 'translateX': out.x = args[0]; break;\n case 'translateY': out.y = args[0]; break;\n case 'translate3d': if (parseFloat(args[2] || '0') !== 0) return null; out.x = args[0]; out.y = args[1] ?? 0; break;\n case 'scale3d': if (parseFloat(args[2] ?? '1') !== 1) return null; if (args[1] !== undefined && args[1] !== args[0]) { out.scaleX = +args[0]; out.scaleY = +args[1]; } else out.scale = +args[0]; break;\n case 'rotate': case 'rotateZ': out.rotate = args[0]; break;\n case 'scale': if (args[1] !== undefined && args[1] !== args[0]) { out.scaleX = +args[0]; out.scaleY = +args[1]; } else out.scale = +args[0]; break;\n case 'scaleX': out.scaleX = +args[0]; break;\n case 'scaleY': out.scaleY = +args[0]; break;\n case 'skewX': out.skewX = args[0]; break;\n case 'skewY': out.skewY = args[0]; break;\n default: return null;\n }\n }\n return rest.trim() ? null : out;\n}\n\n/** Expand `transform` into shorthands where possible (kept as a discrete prop otherwise). */\nexport function expandProps(props: Record<string, string | number>): Record<string, string | number> {\n const out: Record<string, string | number> = {};\n for (const [k, v] of Object.entries(props)) {\n if (k === 'transform' && typeof v === 'string') {\n const t = transformToProps(v);\n if (t) { Object.assign(out, t); continue; }\n }\n out[k] = v;\n }\n return out;\n}\n\nconst tweenable = (v: string | number): boolean => {\n try { parseValue(v); return true; } catch { return false; }\n};\n\n/**\n * Play frames on a target as a `Timeline` (paused unless `paused: false`).\n * Props missing from a frame hold their previous value; non-numeric values\n * (e.g. `display`, `matrix(...)`) switch discretely at the segment midpoint.\n */\nexport function framesToTimeline(target: Target, frames: Frame[], o: KeyframesPlayOptions = {}): Timeline {\n const dur = o.duration ?? 1000;\n const fs = [...frames].sort((a, b) => a.offset - b.offset).map((f) => ({ ...f, props: expandProps(f.props) }));\n const tl = new Timeline({ repeat: o.repeat, yoyo: o.yoyo, delay: o.delay, onUpdate: o.onUpdate, onComplete: o.onComplete });\n const keys = Array.from(new Set(fs.flatMap((f) => Object.keys(f.props))));\n // carry values forward / backward so every frame has every key\n const filled = fs.map((f) => ({ ...f, props: { ...f.props } }));\n for (const k of keys) {\n let last: string | number | undefined;\n for (const f of filled) { if (k in f.props) last = f.props[k]; else if (last !== undefined) f.props[k] = last; }\n let next: string | number | undefined;\n for (let i = filled.length - 1; i >= 0; i--) { if (k in filled[i].props) next = filled[i].props[k]; else if (next !== undefined) filled[i].props[k] = next; }\n }\n const def = o.ease ?? 'linear';\n if (filled.length === 1) filled.unshift({ ...filled[0], offset: 0 });\n for (let i = 0; i < filled.length - 1; i++) {\n const a = filled[i], b = filled[i + 1];\n const segDur = Math.max(0, (b.offset - a.offset) * dur);\n const from: Record<string, string | number> = {}, to: Record<string, string | number> = {};\n const discrete: [string, string | number][] = [];\n for (const k of keys) {\n if (tweenable(a.props[k]) && tweenable(b.props[k])) { from[k] = a.props[k]; to[k] = b.props[k]; }\n else discrete.push([k, b.props[k]]);\n }\n tl.add(new Tween(target, { from, to, duration: segDur, ease: a.easing ? parseEase(a.easing) : def, paused: true }), a.offset * dur);\n for (const [k, v] of discrete) tl.call(() => { if ((target as any).style) (target as HTMLElement).style.setProperty(k.replace(/[A-Z]/g, (c) => '-' + c.toLowerCase()), String(v)); else (target as any)[k] = v; }, a.offset * dur + segDur / 2);\n }\n if (o.paused === false) tl.play();\n return tl;\n}\n"],"names":[],"mappings":";;AAAA;;;;AAIG;MAkBU,SAAS,GAAG,CAAC,CAAS,MAAc,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,CAAS,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;AAE1I;AACM,SAAU,iBAAiB,CAAuC,MAAW,EAAA;AACjF,IAAA,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC,CAA+B;IACvE,IAAI,CAAC,GAAG,CAAC,MAAM;AAAE,QAAA,OAAO,GAAG;AAC3B,IAAA,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,IAAI;AAAE,QAAA,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;IACnE,IAAI,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,MAAM,IAAI,IAAI;QAAE,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC;IACtE,IAAI,CAAC,GAAG,CAAC;AACT,IAAA,OAAO,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE;QACrB,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,IAAI,EAAE;AAAE,YAAA,CAAC,EAAE;YAAE;QAAU;AAC5C,QAAA,MAAM,CAAC,GAAG,CAAC,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AC,CAAC,MAAM,GAAG,GAAG,GAAG,MAAM,GAAG,CAAC,CAAC;IACjP;AACA,IAAA,IAAI,CAAC,CAAC,MAAM,KAAK,KAAK;QAAE,EAAE,CAAC,IAAI,EAAE;AACjC,IAAA,OAAO,EAAE;AACX;;;;"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tween = require('./tween-JEthWrjo.cjs');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Normalised keyframes shared by the format loaders: a list of frames with
|
|
7
|
+
* offsets in [0, 1], camelCase props and an optional per-segment easing,
|
|
8
|
+
* played as a runtime `Timeline` (one tween per segment).
|
|
9
|
+
*/
|
|
10
|
+
const camelProp = (k) => (k.startsWith('--') ? k : k.trim().replace(/-([a-z])/g, (_, c) => c.toUpperCase()));
|
|
11
|
+
/** Fill in missing offsets (spaced evenly between known ones, first 0 / last 1), as the WAAPI does. */
|
|
12
|
+
function distributeOffsets(frames) {
|
|
13
|
+
const out = frames.map((f) => ({ ...f }));
|
|
14
|
+
if (!out.length)
|
|
15
|
+
return out;
|
|
16
|
+
if (out[0].offset == null)
|
|
17
|
+
out[0].offset = out.length === 1 ? 1 : 0;
|
|
18
|
+
if (out[out.length - 1].offset == null)
|
|
19
|
+
out[out.length - 1].offset = 1;
|
|
20
|
+
let i = 0;
|
|
21
|
+
while (i < out.length) {
|
|
22
|
+
if (out[i].offset != null) {
|
|
23
|
+
i++;
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
const a = i - 1;
|
|
27
|
+
let b = i;
|
|
28
|
+
while (out[b].offset == null)
|
|
29
|
+
b++;
|
|
30
|
+
const from = out[a].offset, to = out[b].offset;
|
|
31
|
+
for (let k = i; k < b; k++)
|
|
32
|
+
out[k].offset = from + ((to - from) * (k - a)) / (b - a);
|
|
33
|
+
i = b;
|
|
34
|
+
}
|
|
35
|
+
return out;
|
|
36
|
+
}
|
|
37
|
+
/** CSS transform functions → runtime transform shorthands (translate/rotate/scale/skew); null when not representable (matrix, 3D, …). */
|
|
38
|
+
function transformToProps(t) {
|
|
39
|
+
if (!t || t === 'none')
|
|
40
|
+
return { x: 0, y: 0, rotate: 0, scale: 1 };
|
|
41
|
+
const out = {};
|
|
42
|
+
const re = /([a-zA-Z][a-zA-Z0-9]*)\(([^)]*)\)/g;
|
|
43
|
+
let m;
|
|
44
|
+
let rest = t;
|
|
45
|
+
while ((m = re.exec(t))) {
|
|
46
|
+
rest = rest.replace(m[0], '');
|
|
47
|
+
const args = m[2].split(/[\s,]+/).filter(Boolean);
|
|
48
|
+
switch (m[1]) {
|
|
49
|
+
case 'translate':
|
|
50
|
+
out.x = args[0];
|
|
51
|
+
out.y = args[1] ?? 0;
|
|
52
|
+
break;
|
|
53
|
+
case 'translateX':
|
|
54
|
+
out.x = args[0];
|
|
55
|
+
break;
|
|
56
|
+
case 'translateY':
|
|
57
|
+
out.y = args[0];
|
|
58
|
+
break;
|
|
59
|
+
case 'translate3d':
|
|
60
|
+
if (parseFloat(args[2] || '0') !== 0)
|
|
61
|
+
return null;
|
|
62
|
+
out.x = args[0];
|
|
63
|
+
out.y = args[1] ?? 0;
|
|
64
|
+
break;
|
|
65
|
+
case 'scale3d':
|
|
66
|
+
if (parseFloat(args[2] ?? '1') !== 1)
|
|
67
|
+
return null;
|
|
68
|
+
if (args[1] !== undefined && args[1] !== args[0]) {
|
|
69
|
+
out.scaleX = +args[0];
|
|
70
|
+
out.scaleY = +args[1];
|
|
71
|
+
}
|
|
72
|
+
else
|
|
73
|
+
out.scale = +args[0];
|
|
74
|
+
break;
|
|
75
|
+
case 'rotate':
|
|
76
|
+
case 'rotateZ':
|
|
77
|
+
out.rotate = args[0];
|
|
78
|
+
break;
|
|
79
|
+
case 'scale':
|
|
80
|
+
if (args[1] !== undefined && args[1] !== args[0]) {
|
|
81
|
+
out.scaleX = +args[0];
|
|
82
|
+
out.scaleY = +args[1];
|
|
83
|
+
}
|
|
84
|
+
else
|
|
85
|
+
out.scale = +args[0];
|
|
86
|
+
break;
|
|
87
|
+
case 'scaleX':
|
|
88
|
+
out.scaleX = +args[0];
|
|
89
|
+
break;
|
|
90
|
+
case 'scaleY':
|
|
91
|
+
out.scaleY = +args[0];
|
|
92
|
+
break;
|
|
93
|
+
case 'skewX':
|
|
94
|
+
out.skewX = args[0];
|
|
95
|
+
break;
|
|
96
|
+
case 'skewY':
|
|
97
|
+
out.skewY = args[0];
|
|
98
|
+
break;
|
|
99
|
+
default: return null;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return rest.trim() ? null : out;
|
|
103
|
+
}
|
|
104
|
+
/** Expand `transform` into shorthands where possible (kept as a discrete prop otherwise). */
|
|
105
|
+
function expandProps(props) {
|
|
106
|
+
const out = {};
|
|
107
|
+
for (const [k, v] of Object.entries(props)) {
|
|
108
|
+
if (k === 'transform' && typeof v === 'string') {
|
|
109
|
+
const t = transformToProps(v);
|
|
110
|
+
if (t) {
|
|
111
|
+
Object.assign(out, t);
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
out[k] = v;
|
|
116
|
+
}
|
|
117
|
+
return out;
|
|
118
|
+
}
|
|
119
|
+
const tweenable = (v) => {
|
|
120
|
+
try {
|
|
121
|
+
tween.parseValue(v);
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Play frames on a target as a `Timeline` (paused unless `paused: false`).
|
|
130
|
+
* Props missing from a frame hold their previous value; non-numeric values
|
|
131
|
+
* (e.g. `display`, `matrix(...)`) switch discretely at the segment midpoint.
|
|
132
|
+
*/
|
|
133
|
+
function framesToTimeline(target, frames, o = {}) {
|
|
134
|
+
const dur = o.duration ?? 1000;
|
|
135
|
+
const fs = [...frames].sort((a, b) => a.offset - b.offset).map((f) => ({ ...f, props: expandProps(f.props) }));
|
|
136
|
+
const tl = new tween.Timeline({ repeat: o.repeat, yoyo: o.yoyo, delay: o.delay, onUpdate: o.onUpdate, onComplete: o.onComplete });
|
|
137
|
+
const keys = Array.from(new Set(fs.flatMap((f) => Object.keys(f.props))));
|
|
138
|
+
// carry values forward / backward so every frame has every key
|
|
139
|
+
const filled = fs.map((f) => ({ ...f, props: { ...f.props } }));
|
|
140
|
+
for (const k of keys) {
|
|
141
|
+
let last;
|
|
142
|
+
for (const f of filled) {
|
|
143
|
+
if (k in f.props)
|
|
144
|
+
last = f.props[k];
|
|
145
|
+
else if (last !== undefined)
|
|
146
|
+
f.props[k] = last;
|
|
147
|
+
}
|
|
148
|
+
let next;
|
|
149
|
+
for (let i = filled.length - 1; i >= 0; i--) {
|
|
150
|
+
if (k in filled[i].props)
|
|
151
|
+
next = filled[i].props[k];
|
|
152
|
+
else if (next !== undefined)
|
|
153
|
+
filled[i].props[k] = next;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
const def = o.ease ?? 'linear';
|
|
157
|
+
if (filled.length === 1)
|
|
158
|
+
filled.unshift({ ...filled[0], offset: 0 });
|
|
159
|
+
for (let i = 0; i < filled.length - 1; i++) {
|
|
160
|
+
const a = filled[i], b = filled[i + 1];
|
|
161
|
+
const segDur = Math.max(0, (b.offset - a.offset) * dur);
|
|
162
|
+
const from = {}, to = {};
|
|
163
|
+
const discrete = [];
|
|
164
|
+
for (const k of keys) {
|
|
165
|
+
if (tweenable(a.props[k]) && tweenable(b.props[k])) {
|
|
166
|
+
from[k] = a.props[k];
|
|
167
|
+
to[k] = b.props[k];
|
|
168
|
+
}
|
|
169
|
+
else
|
|
170
|
+
discrete.push([k, b.props[k]]);
|
|
171
|
+
}
|
|
172
|
+
tl.add(new tween.Tween(target, { from, to, duration: segDur, ease: a.easing ? tween.parseEase(a.easing) : def, paused: true }), a.offset * dur);
|
|
173
|
+
for (const [k, v] of discrete)
|
|
174
|
+
tl.call(() => { if (target.style)
|
|
175
|
+
target.style.setProperty(k.replace(/[A-Z]/g, (c) => '-' + c.toLowerCase()), String(v));
|
|
176
|
+
else
|
|
177
|
+
target[k] = v; }, a.offset * dur + segDur / 2);
|
|
178
|
+
}
|
|
179
|
+
if (o.paused === false)
|
|
180
|
+
tl.play();
|
|
181
|
+
return tl;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
exports.camelProp = camelProp;
|
|
185
|
+
exports.distributeOffsets = distributeOffsets;
|
|
186
|
+
exports.framesToTimeline = framesToTimeline;
|
|
187
|
+
//# sourceMappingURL=keyframes-cUdsXSXQ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyframes-cUdsXSXQ.cjs","sources":["../../src/runtime/keyframes.ts"],"sourcesContent":["/**\n * Normalised keyframes shared by the format loaders: a list of frames with\n * offsets in [0, 1], camelCase props and an optional per-segment easing,\n * played as a runtime `Timeline` (one tween per segment).\n */\nimport { Timeline, Tween, parseValue, type Target, type PlayOptions } from './tween';\nimport { parseEase, type Ease } from './ease';\n\nexport interface Frame {\n offset: number;\n props: Record<string, string | number>;\n /** Easing from this frame to the next. */\n easing?: string;\n}\n\nexport interface KeyframesPlayOptions extends PlayOptions {\n /** ms (default 1000). */\n duration?: number;\n /** Default easing for segments without their own (default 'linear', as in CSS / WAAPI keyframes). */\n ease?: string | Ease;\n}\n\nexport const camelProp = (k: string): string => (k.startsWith('--') ? k : k.trim().replace(/-([a-z])/g, (_, c: string) => c.toUpperCase()));\n\n/** Fill in missing offsets (spaced evenly between known ones, first 0 / last 1), as the WAAPI does. */\nexport function distributeOffsets<T extends { offset?: number | null }>(frames: T[]): (T & { offset: number })[] {\n const out = frames.map((f) => ({ ...f })) as (T & { offset: number })[];\n if (!out.length) return out;\n if (out[0].offset == null) out[0].offset = out.length === 1 ? 1 : 0;\n if (out[out.length - 1].offset == null) out[out.length - 1].offset = 1;\n let i = 0;\n while (i < out.length) {\n if (out[i].offset != null) { i++; continue; }\n const a = i - 1;\n let b = i;\n while (out[b].offset == null) b++;\n const from = out[a].offset, to = out[b].offset;\n for (let k = i; k < b; k++) out[k].offset = from + ((to - from) * (k - a)) / (b - a);\n i = b;\n }\n return out;\n}\n\n/** CSS transform functions → runtime transform shorthands (translate/rotate/scale/skew); null when not representable (matrix, 3D, …). */\nexport function transformToProps(t: string): Record<string, string | number> | null {\n if (!t || t === 'none') return { x: 0, y: 0, rotate: 0, scale: 1 };\n const out: Record<string, string | number> = {};\n const re = /([a-zA-Z][a-zA-Z0-9]*)\\(([^)]*)\\)/g;\n let m: RegExpExecArray | null;\n let rest = t;\n while ((m = re.exec(t))) {\n rest = rest.replace(m[0], '');\n const args = m[2].split(/[\\s,]+/).filter(Boolean);\n switch (m[1]) {\n case 'translate': out.x = args[0]; out.y = args[1] ?? 0; break;\n case 'translateX': out.x = args[0]; break;\n case 'translateY': out.y = args[0]; break;\n case 'translate3d': if (parseFloat(args[2] || '0') !== 0) return null; out.x = args[0]; out.y = args[1] ?? 0; break;\n case 'scale3d': if (parseFloat(args[2] ?? '1') !== 1) return null; if (args[1] !== undefined && args[1] !== args[0]) { out.scaleX = +args[0]; out.scaleY = +args[1]; } else out.scale = +args[0]; break;\n case 'rotate': case 'rotateZ': out.rotate = args[0]; break;\n case 'scale': if (args[1] !== undefined && args[1] !== args[0]) { out.scaleX = +args[0]; out.scaleY = +args[1]; } else out.scale = +args[0]; break;\n case 'scaleX': out.scaleX = +args[0]; break;\n case 'scaleY': out.scaleY = +args[0]; break;\n case 'skewX': out.skewX = args[0]; break;\n case 'skewY': out.skewY = args[0]; break;\n default: return null;\n }\n }\n return rest.trim() ? null : out;\n}\n\n/** Expand `transform` into shorthands where possible (kept as a discrete prop otherwise). */\nexport function expandProps(props: Record<string, string | number>): Record<string, string | number> {\n const out: Record<string, string | number> = {};\n for (const [k, v] of Object.entries(props)) {\n if (k === 'transform' && typeof v === 'string') {\n const t = transformToProps(v);\n if (t) { Object.assign(out, t); continue; }\n }\n out[k] = v;\n }\n return out;\n}\n\nconst tweenable = (v: string | number): boolean => {\n try { parseValue(v); return true; } catch { return false; }\n};\n\n/**\n * Play frames on a target as a `Timeline` (paused unless `paused: false`).\n * Props missing from a frame hold their previous value; non-numeric values\n * (e.g. `display`, `matrix(...)`) switch discretely at the segment midpoint.\n */\nexport function framesToTimeline(target: Target, frames: Frame[], o: KeyframesPlayOptions = {}): Timeline {\n const dur = o.duration ?? 1000;\n const fs = [...frames].sort((a, b) => a.offset - b.offset).map((f) => ({ ...f, props: expandProps(f.props) }));\n const tl = new Timeline({ repeat: o.repeat, yoyo: o.yoyo, delay: o.delay, onUpdate: o.onUpdate, onComplete: o.onComplete });\n const keys = Array.from(new Set(fs.flatMap((f) => Object.keys(f.props))));\n // carry values forward / backward so every frame has every key\n const filled = fs.map((f) => ({ ...f, props: { ...f.props } }));\n for (const k of keys) {\n let last: string | number | undefined;\n for (const f of filled) { if (k in f.props) last = f.props[k]; else if (last !== undefined) f.props[k] = last; }\n let next: string | number | undefined;\n for (let i = filled.length - 1; i >= 0; i--) { if (k in filled[i].props) next = filled[i].props[k]; else if (next !== undefined) filled[i].props[k] = next; }\n }\n const def = o.ease ?? 'linear';\n if (filled.length === 1) filled.unshift({ ...filled[0], offset: 0 });\n for (let i = 0; i < filled.length - 1; i++) {\n const a = filled[i], b = filled[i + 1];\n const segDur = Math.max(0, (b.offset - a.offset) * dur);\n const from: Record<string, string | number> = {}, to: Record<string, string | number> = {};\n const discrete: [string, string | number][] = [];\n for (const k of keys) {\n if (tweenable(a.props[k]) && tweenable(b.props[k])) { from[k] = a.props[k]; to[k] = b.props[k]; }\n else discrete.push([k, b.props[k]]);\n }\n tl.add(new Tween(target, { from, to, duration: segDur, ease: a.easing ? parseEase(a.easing) : def, paused: true }), a.offset * dur);\n for (const [k, v] of discrete) tl.call(() => { if ((target as any).style) (target as HTMLElement).style.setProperty(k.replace(/[A-Z]/g, (c) => '-' + c.toLowerCase()), String(v)); else (target as any)[k] = v; }, a.offset * dur + segDur / 2);\n }\n if (o.paused === false) tl.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