motionary 9.5.0 → 9.7.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 +27 -0
- package/dist/components/design.cjs +117 -0
- package/dist/components/design.cjs.map +1 -0
- package/dist/components/design.d.cts +82 -0
- package/dist/components/design.d.ts +82 -0
- package/dist/components/design.js +112 -0
- package/dist/components/design.js.map +1 -0
- package/dist/components/fx-perf.cjs +161 -0
- package/dist/components/fx-perf.cjs.map +1 -0
- package/dist/components/fx-perf.d.cts +86 -0
- package/dist/components/fx-perf.d.ts +86 -0
- package/dist/components/fx-perf.js +155 -0
- package/dist/components/fx-perf.js.map +1 -0
- package/dist/components/fx2.cjs +8 -0
- package/dist/components/fx2.cjs.map +1 -1
- package/dist/components/fx2.d.cts +42 -1
- package/dist/components/fx2.d.ts +42 -1
- package/dist/components/fx2.js +5 -1
- package/dist/components/fx2.js.map +1 -1
- package/dist/components/marketplace.cjs +1 -0
- package/dist/components/marketplace.cjs.map +1 -1
- package/dist/components/marketplace.js +1 -0
- package/dist/components/marketplace.js.map +1 -1
- package/dist/components/widgets.cjs +418 -227
- package/dist/components/widgets.cjs.map +1 -1
- package/dist/components/widgets.d.cts +79 -2
- package/dist/components/widgets.d.ts +79 -2
- package/dist/components/widgets.js +416 -229
- package/dist/components/widgets.js.map +1 -1
- package/dist/widgets.umd.js +1 -1
- package/dist/widgets.umd.js.map +1 -1
- package/docs/ROADMAP.md +2 -2
- package/docs/components.md +30 -0
- package/figma-plugin/README.md +9 -0
- package/figma-plugin/code.js +26 -0
- package/figma-plugin/manifest.json +9 -0
- package/figma-plugin/ui.html +10 -0
- package/package.json +43 -2
package/docs/ROADMAP.md
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
- ✅ **v9.3** — 生成艺术 2.0:风格化着色器;新组件 背景生成器。
|
|
8
8
|
- ✅ **v9.4** — 视频动效:滚动驱动视频、帧序列;新组件 视频卡片、英雄视频。
|
|
9
9
|
- ✅ **v9.5** — 无障碍动效 2.0:更细的动效偏好分级;新组件 动效偏好面板。
|
|
10
|
-
- **v9.6** — 性能 3.0:OffscreenCanvas、Worker 渲染;新组件 性能监视器。
|
|
11
|
-
- **v9.7** — 设计工具集成:Figma 插件脚手架、Framer 导出。
|
|
10
|
+
- ✅ **v9.6** — 性能 3.0:OffscreenCanvas、Worker 渲染;新组件 性能监视器。
|
|
11
|
+
- ✅ **v9.7** — 设计工具集成:Figma 插件脚手架、Framer 导出。
|
|
12
12
|
- **v9.8** — 原生 2.0:React Native / Flutter 组件示例。
|
|
13
13
|
- **v9.9** — 10.0 预备:10.0 弃用警告、`upgrading-10.md` 与 `usa-codemod-10`。
|
|
14
14
|
- **v10.0** — 全新架构:零依赖核心 < 10 KB、所有特效插件化、默认 WebGPU;npm `latest`。
|
package/docs/components.md
CHANGED
|
@@ -1256,6 +1256,36 @@ console.assert(isFlashSafe(frames, 600, Infinity));
|
|
|
1256
1256
|
- `<usa-pause-all label resume-label scope>`: `paused`, `toggle()`; `usa:pause-all` { paused }.
|
|
1257
1257
|
- Safe: `safe-fade` · `focus-glow` · `color-pulse` (`color`) · `underline-sweep`; `vestibularSafe`, `flashCount`, `isFlashSafe`, `applyMotionPreferences`, `loadMotionPreferences`.
|
|
1258
1258
|
|
|
1259
|
+
### v9.6 Performance 3.0: `<usa-perf-monitor>`, `<usa-worker-canvas>` + perf pack (`motionary/fx/perf`)
|
|
1260
|
+
|
|
1261
|
+
```html
|
|
1262
|
+
<usa-perf-monitor corner="bottom-right"></usa-perf-monitor>
|
|
1263
|
+
<usa-worker-canvas scene="starfield" style="height:240px"></usa-worker-canvas>
|
|
1264
|
+
```
|
|
1265
|
+
```js
|
|
1266
|
+
import { offscreenRender, runInWorker, fpsMeter } from 'motionary/fx/perf';
|
|
1267
|
+
const r = offscreenRender(canvas, (ctx, t, w, h) => { ctx.clearRect(0, 0, w, h); ctx.fillRect((t / 5) % w, h / 2, 8, 8); });
|
|
1268
|
+
console.log(r.backend); // 'worker' when OffscreenCanvas is available
|
|
1269
|
+
const primes = await runInWorker((n) => { /* heavy */ return n * 2; }, 21);
|
|
1270
|
+
```
|
|
1271
|
+
- `<usa-perf-monitor corner collapsed warn>`: `stats`; `usa:jank` { fps }.
|
|
1272
|
+
- `<usa-worker-canvas scene label>`: `program`, `backend`; `usa:backend`.
|
|
1273
|
+
- Perf: `offscreenRender`, `runInWorker`, `fpsMeter`; effects `idle-reveal` (`timeout`), `gpu-lift` (`lift`).
|
|
1274
|
+
|
|
1275
|
+
### v9.7 Design tool integration (`motionary/design`) + `<usa-motion-spec>`
|
|
1276
|
+
|
|
1277
|
+
```html
|
|
1278
|
+
<usa-motion-spec label="Card entrance" rules="enter: fade-up 600ms ease-out stagger 80ms; hover: pop 300ms spring"></usa-motion-spec>
|
|
1279
|
+
```
|
|
1280
|
+
```js
|
|
1281
|
+
import { figmaToMotion, framerComponent, motionToCss } from 'motionary/design';
|
|
1282
|
+
el.dataset.motion = figmaToMotion(figmaNode.reactions); // "click: fade 300ms ease-out"
|
|
1283
|
+
const tsx = framerComponent(describeComponent(card), { name: 'PricingCard' });
|
|
1284
|
+
const css = motionToCss('enter: fade-up 600ms stagger 80ms', '.cards');
|
|
1285
|
+
```
|
|
1286
|
+
- Figma: import `figma-plugin/manifest.json` (Plugins → Development) and run **Motionary export** on layers with prototype interactions.
|
|
1287
|
+
- `<usa-motion-spec rules label>`: `parsed`, `css`, `play()`; `usa:copy` { ok }.
|
|
1288
|
+
|
|
1259
1289
|
## Frameworks
|
|
1260
1290
|
|
|
1261
1291
|
Custom elements work in every framework. Register once (e.g. in your entry file), then use the tags.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Motionary — Figma plugin scaffold (9.7)
|
|
2
|
+
|
|
3
|
+
Turns Figma prototype interactions into Motionary `data-motion` strings.
|
|
4
|
+
|
|
5
|
+
1. Figma → Plugins → Development → Import plugin from manifest… → pick `figma-plugin/manifest.json`.
|
|
6
|
+
2. Select frames / components that have prototype interactions and run **Motionary export**.
|
|
7
|
+
3. Copy the `data-motion="…"` strings into your markup and call `applyMotion()` from `motionary/dsl`.
|
|
8
|
+
|
|
9
|
+
The mapping (DISSOLVE → `fade`, SMART_ANIMATE → `scale`, MOVE_IN / SLIDE_IN / PUSH → `fade-<direction>`, durations, easings, AFTER_TIMEOUT → `load` + `delay`) is the same as `figmaToMotion()` in `motionary/design`; Framer users can generate a code component with `framerComponent()`.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Motionary export — Figma plugin scaffold (9.7).
|
|
2
|
+
// Select frames / components with prototype interactions and run the plugin:
|
|
3
|
+
// it turns each node's reactions into a Motionary `data-motion` string
|
|
4
|
+
// (the same mapping as figmaToMotion() in motionary/design) and shows them
|
|
5
|
+
// in the UI for copying.
|
|
6
|
+
const EASE = { LINEAR: 'linear', EASE_IN: 'ease-in', EASE_OUT: 'ease-out', EASE_IN_AND_OUT: 'ease-in-out', EASE_OUT_BACK: 'cubic-bezier(0.34, 1.56, 0.64, 1)', GENTLE: 'cubic-bezier(0.22, 1, 0.36, 1)' };
|
|
7
|
+
const TRIG = { ON_CLICK: 'click', ON_PRESS: 'click', ON_HOVER: 'hover', MOUSE_ENTER: 'hover', AFTER_TIMEOUT: 'load' };
|
|
8
|
+
const DIR = { LEFT: 'left', RIGHT: 'right', TOP: 'down', BOTTOM: 'up' };
|
|
9
|
+
function toMotion(reactions) {
|
|
10
|
+
return (reactions || [])
|
|
11
|
+
.map((r) => {
|
|
12
|
+
const t = TRIG[r.trigger && r.trigger.type];
|
|
13
|
+
const tr = (r.action && r.action.transition) || (r.actions && r.actions[0] && r.actions[0].transition);
|
|
14
|
+
if (!t || !tr) return null;
|
|
15
|
+
const fx = tr.type === 'DISSOLVE' ? 'fade' : tr.type === 'SMART_ANIMATE' ? 'scale' : 'fade-' + (DIR[tr.direction] || 'up');
|
|
16
|
+
const parts = [t + ': ' + fx, Math.round((tr.duration || 0.3) * 1000) + 'ms'];
|
|
17
|
+
if (tr.easing && EASE[tr.easing.type]) parts.push(EASE[tr.easing.type]);
|
|
18
|
+
return parts.join(' ');
|
|
19
|
+
})
|
|
20
|
+
.filter(Boolean)
|
|
21
|
+
.join('; ');
|
|
22
|
+
}
|
|
23
|
+
figma.showUI(__html__, { width: 360, height: 420 });
|
|
24
|
+
const rows = figma.currentPage.selection.map((n) => ({ name: n.name, motion: 'reactions' in n ? toMotion(n.reactions) : '' }));
|
|
25
|
+
figma.ui.postMessage({ rows });
|
|
26
|
+
figma.ui.onmessage = (m) => m === 'close' && figma.closePlugin();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<style>body{font:12px system-ui;margin:12px}code{display:block;padding:6px;margin:4px 0 10px;background:#f1f5f9;border-radius:6px;white-space:pre-wrap}</style>
|
|
2
|
+
<h3>Motionary export</h3>
|
|
3
|
+
<div id="out">Select layers with prototype interactions…</div>
|
|
4
|
+
<button onclick="parent.postMessage({ pluginMessage: 'close' }, '*')">Close</button>
|
|
5
|
+
<script>
|
|
6
|
+
onmessage = (e) => {
|
|
7
|
+
const rows = (e.data.pluginMessage || {}).rows || [];
|
|
8
|
+
document.getElementById('out').innerHTML = rows.length ? rows.map((r) => `<b>${r.name}</b><code>data-motion="${r.motion || '—'}"</code>`).join('') : 'Nothing selected.';
|
|
9
|
+
};
|
|
10
|
+
</script>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "motionary",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.7.0",
|
|
4
4
|
"description": "Motionary (formerly use-scroll-animate): dependency-free scroll animations + 94 animated Web Components — 214 scroll-reveal presets, card/click/button morphs, physics, page transitions, generative & sound-reactive backgrounds, cursor/gesture effects, themes, micro-interactions, <usa-player>, WebGL. React, Vue, Svelte, Solid, Angular or plain HTML.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -118,6 +118,16 @@
|
|
|
118
118
|
"default": "./dist/components/marketplace.cjs"
|
|
119
119
|
}
|
|
120
120
|
},
|
|
121
|
+
"./design": {
|
|
122
|
+
"import": {
|
|
123
|
+
"types": "./dist/components/design.d.ts",
|
|
124
|
+
"default": "./dist/components/design.js"
|
|
125
|
+
},
|
|
126
|
+
"require": {
|
|
127
|
+
"types": "./dist/components/design.d.cts",
|
|
128
|
+
"default": "./dist/components/design.cjs"
|
|
129
|
+
}
|
|
130
|
+
},
|
|
121
131
|
"./fx": {
|
|
122
132
|
"import": {
|
|
123
133
|
"types": "./dist/components/fx2.d.ts",
|
|
@@ -438,6 +448,16 @@
|
|
|
438
448
|
"default": "./dist/components/fx-safe.cjs"
|
|
439
449
|
}
|
|
440
450
|
},
|
|
451
|
+
"./fx/perf": {
|
|
452
|
+
"import": {
|
|
453
|
+
"types": "./dist/components/fx-perf.d.ts",
|
|
454
|
+
"default": "./dist/components/fx-perf.js"
|
|
455
|
+
},
|
|
456
|
+
"require": {
|
|
457
|
+
"types": "./dist/components/fx-perf.d.cts",
|
|
458
|
+
"default": "./dist/components/fx-perf.cjs"
|
|
459
|
+
}
|
|
460
|
+
},
|
|
441
461
|
"./components/reveal": {
|
|
442
462
|
"import": {
|
|
443
463
|
"types": "./dist/components/reveal.d.ts",
|
|
@@ -1098,6 +1118,26 @@
|
|
|
1098
1118
|
"default": "./dist/components/fx-safe.cjs"
|
|
1099
1119
|
}
|
|
1100
1120
|
},
|
|
1121
|
+
"./components/fx-perf": {
|
|
1122
|
+
"import": {
|
|
1123
|
+
"types": "./dist/components/fx-perf.d.ts",
|
|
1124
|
+
"default": "./dist/components/fx-perf.js"
|
|
1125
|
+
},
|
|
1126
|
+
"require": {
|
|
1127
|
+
"types": "./dist/components/fx-perf.d.cts",
|
|
1128
|
+
"default": "./dist/components/fx-perf.cjs"
|
|
1129
|
+
}
|
|
1130
|
+
},
|
|
1131
|
+
"./components/design": {
|
|
1132
|
+
"import": {
|
|
1133
|
+
"types": "./dist/components/design.d.ts",
|
|
1134
|
+
"default": "./dist/components/design.js"
|
|
1135
|
+
},
|
|
1136
|
+
"require": {
|
|
1137
|
+
"types": "./dist/components/design.d.cts",
|
|
1138
|
+
"default": "./dist/components/design.cjs"
|
|
1139
|
+
}
|
|
1140
|
+
},
|
|
1101
1141
|
"./components/lite": {
|
|
1102
1142
|
"import": {
|
|
1103
1143
|
"types": "./dist/components/lite.d.ts",
|
|
@@ -1138,7 +1178,8 @@
|
|
|
1138
1178
|
"README_zh.md",
|
|
1139
1179
|
"README_ja.md",
|
|
1140
1180
|
"LICENSE",
|
|
1141
|
-
"CHANGELOG.md"
|
|
1181
|
+
"CHANGELOG.md",
|
|
1182
|
+
"figma-plugin"
|
|
1142
1183
|
],
|
|
1143
1184
|
"sideEffects": [
|
|
1144
1185
|
"*.css",
|