use-scroll-animate 7.1.0 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/components/fx-chart.cjs +158 -0
- package/dist/components/fx-chart.cjs.map +1 -0
- package/dist/components/fx-chart.d.cts +73 -0
- package/dist/components/fx-chart.d.ts +73 -0
- package/dist/components/fx-chart.js +154 -0
- package/dist/components/fx-chart.js.map +1 -0
- package/dist/components/fx2.cjs +6 -0
- package/dist/components/fx2.cjs.map +1 -1
- package/dist/components/fx2.d.cts +30 -1
- package/dist/components/fx2.d.ts +30 -1
- package/dist/components/fx2.js +5 -1
- package/dist/components/fx2.js.map +1 -1
- package/dist/components/widgets.cjs +480 -69
- package/dist/components/widgets.cjs.map +1 -1
- package/dist/components/widgets.d.cts +66 -2
- package/dist/components/widgets.d.ts +66 -2
- package/dist/components/widgets.js +475 -70
- 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 +1 -1
- package/docs/components.md +24 -0
- package/package.json +21 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [7.2.0] - 2026-10-08
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **4 new components (7.2)** in `motionary/components/widgets` (also in `dist/widgets.umd.js`):
|
|
14
|
+
- `<usa-bar-chart>` — animated bar chart from `values` + `labels`, `<data>` children or the `data` property: bars grow in a stagger on first view, value labels show with `unit`; new data glides every bar (appearing bars grow, leaving bars shrink away); `horizontal`, `max`. A labelled `figure` with a list of “label: value” items.
|
|
15
|
+
- `<usa-gauge>` — semicircular gauge: the needle swings to `value` on a damped spring, the arc fills in the colour of its `zones` (`"60:#22c55e,85:#f59e0b,100:#ef4444"`), the number counts; `min` / `max` / `unit` / `label`; `role="meter"` with `aria-valuetext`.
|
|
16
|
+
- `<usa-sparkline>` — inline trend line (`values` or `data`): draws on first view, area fades in, the last point pulses, new data morphs point by point; `variant="line | area | bars"`, `color`; hover tooltip; text summary as `aria-label`. `SPARK_VARIANTS`, `sparkPoints()`.
|
|
17
|
+
- `<usa-kpi>` — KPI card: the value counts up keeping prefix / suffix / decimals, the `delta` chip slides in with a ▲ / ▼ coloured by sign (`invert` when down is good), optional `trend` sparkline, `caption`; setting `value` rolls from the old number and flashes the card.
|
|
18
|
+
- **Data-viz motion — `motionary/fx/chart`** (= `motionary/components/fx-chart`, `registerChartPack()`, also in `registerEffectPacks()`): entrances for charts you already have (any SVG / HTML chart library) — `bars-grow`, `line-draw`, `ring-sweep`, `dots-pop`, `number-roll` (enter) and `sankey-flow` (loop). `parseFigure()`.
|
|
19
|
+
- Showcase: 7 new gallery cards with copyable code and live “new data” buttons; Animation Store 292 → 299 items.
|
|
20
|
+
|
|
21
|
+
### Accessibility
|
|
22
|
+
- Bar chart = `figure` + list items labelled “label: value”; gauge = `meter` with `aria-valuenow` / `aria-valuetext`; sparkline = `img` with a trend summary; KPI = labelled `group`. Reduced motion: no growth, glide, swing, count, draw, morph, pulse or flash — final values are shown at once; chart effects end in their final state with a short fade and `sankey-flow` is static.
|
|
23
|
+
|
|
10
24
|
## [7.1.0] - 2026-10-08
|
|
11
25
|
|
|
12
26
|
### Added
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var registry = require('../chunks/registry-DehBVRDV.cjs');
|
|
4
|
+
var shared = require('../chunks/shared-jkgRH-Hx.cjs');
|
|
5
|
+
require('../chunks/base-BaQV-2ha.cjs');
|
|
6
|
+
|
|
7
|
+
const fade = (el, ctx) => ctx.animate(el, [{ opacity: 0 }, { opacity: 1 }], { duration: 250 });
|
|
8
|
+
const pick = (el, sel) => Array.from(el.querySelectorAll(sel));
|
|
9
|
+
/** Parse a number out of text like "$1,234.5k" → { n, pre, post, dec }. */
|
|
10
|
+
function parseFigure(s) {
|
|
11
|
+
const m = /^(\D*?)(-?[\d,]*\.?\d+)(.*)$/.exec(s.trim());
|
|
12
|
+
if (!m)
|
|
13
|
+
return null;
|
|
14
|
+
const raw = m[2].replace(/,/g, '');
|
|
15
|
+
return { n: Number(raw), pre: m[1], post: m[3], dec: (raw.split('.')[1] || '').length };
|
|
16
|
+
}
|
|
17
|
+
const CHART_FX = [
|
|
18
|
+
{
|
|
19
|
+
name: 'bars-grow',
|
|
20
|
+
kind: 'enter',
|
|
21
|
+
description: 'Bars (`[data-bar]`, SVG `rect`, or the children) grow from the baseline in a stagger (`axis` y | x, `stagger`, `duration`).',
|
|
22
|
+
defaults: { axis: 'y', stagger: 60, duration: 700 },
|
|
23
|
+
run: (el, o, ctx) => {
|
|
24
|
+
let bars = pick(el, '[data-bar]');
|
|
25
|
+
if (!bars.length)
|
|
26
|
+
bars = pick(el, 'rect');
|
|
27
|
+
if (!bars.length)
|
|
28
|
+
bars = Array.from(el.children);
|
|
29
|
+
if (ctx.reduced)
|
|
30
|
+
return fade(el, ctx);
|
|
31
|
+
const x = o.axis === 'x';
|
|
32
|
+
return shared.all(bars.map((b, i) => {
|
|
33
|
+
b.style.transformOrigin = x ? '0% 50%' : '50% 100%';
|
|
34
|
+
b.style.transformBox = 'fill-box';
|
|
35
|
+
return ctx.animate(b, [{ transform: x ? 'scaleX(0)' : 'scaleY(0)' }, { transform: x ? 'scaleX(1.04)' : 'scaleY(1.04)', offset: 0.75 }, { transform: 'none' }], { duration: o.duration, delay: i * o.stagger, easing: 'cubic-bezier(.2,.8,.3,1)', fill: 'backwards' });
|
|
36
|
+
}));
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'line-draw',
|
|
41
|
+
kind: 'enter',
|
|
42
|
+
description: 'Every SVG `path` / `polyline` / `line` draws itself, then area fills fade in (`duration`, `stagger`).',
|
|
43
|
+
defaults: { duration: 1100, stagger: 120 },
|
|
44
|
+
run: (el, o, ctx) => {
|
|
45
|
+
const lines = pick(el, 'path, polyline, line');
|
|
46
|
+
if (ctx.reduced || !lines.length)
|
|
47
|
+
return fade(el, ctx);
|
|
48
|
+
return shared.all(lines.map((p, i) => {
|
|
49
|
+
const len = typeof p.getTotalLength === 'function' ? p.getTotalLength() || 1000 : 1000;
|
|
50
|
+
const fill = getComputedStyle(p).fill;
|
|
51
|
+
const hasFill = fill && fill !== 'none' && fill !== 'rgba(0, 0, 0, 0)';
|
|
52
|
+
return ctx.animate(p, [{ strokeDasharray: `${len}`, strokeDashoffset: len, fillOpacity: hasFill ? 0 : 1 }, { strokeDasharray: `${len}`, strokeDashoffset: 0, fillOpacity: hasFill ? 0 : 1, offset: 0.8 }, { strokeDasharray: `${len}`, strokeDashoffset: 0, fillOpacity: 1 }], { duration: o.duration, delay: i * o.stagger, easing: 'cubic-bezier(.6,.05,.3,1)', fill: 'backwards' });
|
|
53
|
+
}));
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'ring-sweep',
|
|
58
|
+
kind: 'enter',
|
|
59
|
+
description: "SVG `circle` arcs (donut / ring charts) sweep around from 12 o'clock (`duration`, `stagger`).",
|
|
60
|
+
defaults: { duration: 1000, stagger: 150 },
|
|
61
|
+
run: (el, o, ctx) => {
|
|
62
|
+
const rings = pick(el, 'circle');
|
|
63
|
+
if (ctx.reduced || !rings.length)
|
|
64
|
+
return fade(el, ctx);
|
|
65
|
+
return shared.all(rings.map((c, i) => {
|
|
66
|
+
const r = Number(c.getAttribute('r')) || 0;
|
|
67
|
+
const len = 2 * Math.PI * r || 100;
|
|
68
|
+
const dash = c.getAttribute('stroke-dasharray') || `${len} ${len}`;
|
|
69
|
+
const visible = Number(String(dash).split(/[ ,]+/)[0]) || len;
|
|
70
|
+
return ctx.animate(c, [{ strokeDasharray: `0 ${len}` }, { strokeDasharray: `${visible} ${len}` }], { duration: o.duration, delay: i * o.stagger, easing: 'cubic-bezier(.6,.05,.3,1)', fill: 'backwards' });
|
|
71
|
+
}));
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'sankey-flow',
|
|
76
|
+
kind: 'loop',
|
|
77
|
+
description: 'Dashes flow along the SVG links (`[data-flow]` or every stroked `path`) to show direction (`speed`, `dash`).',
|
|
78
|
+
defaults: { speed: 1, dash: '6 10' },
|
|
79
|
+
reduced: 'run',
|
|
80
|
+
run: (el, o, ctx) => {
|
|
81
|
+
let links = pick(el, '[data-flow]');
|
|
82
|
+
if (!links.length)
|
|
83
|
+
links = pick(el, 'path');
|
|
84
|
+
const prev = links.map((l) => l.getAttribute('stroke-dasharray'));
|
|
85
|
+
links.forEach((l) => l.setAttribute('stroke-dasharray', o.dash));
|
|
86
|
+
const anims = ctx.reduced ? [] : links.map((l, i) => ctx.animate(l, [{ strokeDashoffset: 0 }, { strokeDashoffset: -32 }], { duration: (1200 + (i % 3) * 300) / Math.max(0.1, o.speed), iterations: Infinity }));
|
|
87
|
+
const stop = () => {
|
|
88
|
+
anims.forEach((a) => a?.cancel());
|
|
89
|
+
links.forEach((l, i) => (prev[i] === null ? l.removeAttribute('stroke-dasharray') : l.setAttribute('stroke-dasharray', prev[i])));
|
|
90
|
+
};
|
|
91
|
+
ctx.onCleanup(stop);
|
|
92
|
+
return stop;
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'number-roll',
|
|
97
|
+
kind: 'enter',
|
|
98
|
+
description: 'Numbers (`[data-value]` or the text of the element) count up with locale formatting, keeping prefixes and suffixes (`duration`).',
|
|
99
|
+
defaults: { duration: 1200, locale: undefined },
|
|
100
|
+
run: (el, o, ctx) => {
|
|
101
|
+
const targets = pick(el, '[data-value]');
|
|
102
|
+
const list = targets.length ? targets : [el];
|
|
103
|
+
const jobs = list.map((t) => {
|
|
104
|
+
const f = t.dataset.value !== undefined ? { ...(parseFigure(t.textContent || '') || { pre: '', post: '', dec: 0 }), n: Number(t.dataset.value) } : parseFigure(t.textContent || '');
|
|
105
|
+
return f && Number.isFinite(f.n) ? { t, f } : null;
|
|
106
|
+
}).filter(Boolean);
|
|
107
|
+
const out = (f, v) => f.pre + v.toLocaleString(o.locale, { minimumFractionDigits: f.dec, maximumFractionDigits: f.dec }) + f.post;
|
|
108
|
+
if (ctx.reduced || typeof requestAnimationFrame !== 'function') {
|
|
109
|
+
jobs.forEach(({ t, f }) => (t.textContent = out(f, f.n)));
|
|
110
|
+
return fade(el, ctx);
|
|
111
|
+
}
|
|
112
|
+
return new Promise((resolve) => {
|
|
113
|
+
const t0 = performance.now();
|
|
114
|
+
let raf = 0;
|
|
115
|
+
const step = (now) => {
|
|
116
|
+
const k = Math.min(1, (now - t0) / o.duration);
|
|
117
|
+
const e = 1 - Math.pow(1 - k, 3);
|
|
118
|
+
jobs.forEach(({ t, f }) => (t.textContent = out(f, f.n * e)));
|
|
119
|
+
if (k < 1)
|
|
120
|
+
raf = requestAnimationFrame(step);
|
|
121
|
+
else
|
|
122
|
+
resolve();
|
|
123
|
+
};
|
|
124
|
+
raf = requestAnimationFrame(step);
|
|
125
|
+
ctx.onCleanup(() => cancelAnimationFrame(raf));
|
|
126
|
+
});
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: 'dots-pop',
|
|
131
|
+
kind: 'enter',
|
|
132
|
+
description: 'Scatter / line-chart points (`circle`, `[data-dot]`) pop in with an overshoot, left to right (`stagger`).',
|
|
133
|
+
defaults: { stagger: 40, duration: 420 },
|
|
134
|
+
run: (el, o, ctx) => {
|
|
135
|
+
let dots = pick(el, '[data-dot]');
|
|
136
|
+
if (!dots.length)
|
|
137
|
+
dots = pick(el, 'circle');
|
|
138
|
+
if (ctx.reduced || !dots.length)
|
|
139
|
+
return fade(el, ctx);
|
|
140
|
+
const xOf = (d) => Number(d.getAttribute('cx')) || d.offsetLeft || 0;
|
|
141
|
+
const sorted = dots.slice().sort((a, b) => xOf(a) - xOf(b));
|
|
142
|
+
return shared.all(sorted.map((d, i) => {
|
|
143
|
+
d.style.transformBox = 'fill-box';
|
|
144
|
+
d.style.transformOrigin = '50% 50%';
|
|
145
|
+
return ctx.animate(d, [{ transform: 'scale(0)', opacity: 0 }, { transform: 'scale(1.5)', opacity: 1, offset: 0.6 }, { transform: 'scale(1)', opacity: 1 }], { duration: o.duration, delay: i * o.stagger, easing: 'ease-out', fill: 'backwards' });
|
|
146
|
+
}));
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
];
|
|
150
|
+
/** Register the 7.2 data-viz motion pack (idempotent). */
|
|
151
|
+
function registerChartPack() {
|
|
152
|
+
registry.registerEffects(CHART_FX);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
exports.CHART_FX = CHART_FX;
|
|
156
|
+
exports.parseFigure = parseFigure;
|
|
157
|
+
exports.registerChartPack = registerChartPack;
|
|
158
|
+
//# sourceMappingURL=fx-chart.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fx-chart.cjs","sources":["../../src/components/fx2/chart.ts"],"sourcesContent":["/**\n * 7.2 — Data-viz motion (`motionary/fx/chart`, also\n * `motionary/components/fx-chart`): entrances for the charts you already\n * have (any SVG or HTML chart library), registered through `registerEffect()`:\n *\n * - `bars-grow` (enter) — bars (`[data-bar]`, `rect`, or the children) grow\n * from the baseline in a stagger.\n * - `line-draw` (enter) — every SVG `path` / `polyline` / `line` draws itself.\n * - `ring-sweep` (enter) — SVG `circle` arcs sweep around from 12 o'clock.\n * - `sankey-flow` (loop) — dashes flow along the SVG links (`[data-flow]` or\n * every stroked `path`) to show direction and volume.\n * - `number-roll` (enter) — numbers (`[data-value]` or the text) count up\n * with locale formatting.\n * - `dots-pop` (enter) — scatter / line points (`circle`, `[data-dot]`) pop in.\n *\n * Reduced motion: final state with a short fade (sankey-flow is static).\n */\nimport type { EffectContext, EffectDefinition } from '../fx/registry';\nimport { registerEffects } from '../fx/registry';\nimport { all } from '../effects/shared';\n\nconst fade = (el: Element, ctx: EffectContext) => ctx.animate(el, [{ opacity: 0 }, { opacity: 1 }], { duration: 250 });\nconst pick = <T extends Element>(el: Element, sel: string): T[] => Array.from(el.querySelectorAll<T>(sel));\n\n/** Parse a number out of text like \"$1,234.5k\" → { n, pre, post, dec }. */\nexport function parseFigure(s: string): { n: number; pre: string; post: string; dec: number } | null {\n const m = /^(\\D*?)(-?[\\d,]*\\.?\\d+)(.*)$/.exec(s.trim());\n if (!m) return null;\n const raw = m[2].replace(/,/g, '');\n return { n: Number(raw), pre: m[1], post: m[3], dec: (raw.split('.')[1] || '').length };\n}\n\nexport const CHART_FX: EffectDefinition[] = [\n {\n name: 'bars-grow',\n kind: 'enter',\n description: 'Bars (`[data-bar]`, SVG `rect`, or the children) grow from the baseline in a stagger (`axis` y | x, `stagger`, `duration`).',\n defaults: { axis: 'y', stagger: 60, duration: 700 },\n run: (el: HTMLElement, o: any, ctx: EffectContext) => {\n let bars = pick<HTMLElement>(el, '[data-bar]');\n if (!bars.length) bars = pick<HTMLElement>(el, 'rect');\n if (!bars.length) bars = Array.from(el.children) as HTMLElement[];\n if (ctx.reduced) return fade(el, ctx);\n const x = o.axis === 'x';\n return all(\n bars.map((b, i) => {\n (b.style as CSSStyleDeclaration).transformOrigin = x ? '0% 50%' : '50% 100%';\n (b.style as CSSStyleDeclaration).transformBox = 'fill-box';\n return ctx.animate(b, [{ transform: x ? 'scaleX(0)' : 'scaleY(0)' }, { transform: x ? 'scaleX(1.04)' : 'scaleY(1.04)', offset: 0.75 }, { transform: 'none' }], { duration: o.duration, delay: i * o.stagger, easing: 'cubic-bezier(.2,.8,.3,1)', fill: 'backwards' });\n })\n );\n },\n },\n {\n name: 'line-draw',\n kind: 'enter',\n description: 'Every SVG `path` / `polyline` / `line` draws itself, then area fills fade in (`duration`, `stagger`).',\n defaults: { duration: 1100, stagger: 120 },\n run: (el: HTMLElement, o: any, ctx: EffectContext) => {\n const lines = pick<SVGGeometryElement>(el, 'path, polyline, line');\n if (ctx.reduced || !lines.length) return fade(el, ctx);\n return all(\n lines.map((p, i) => {\n const len = typeof p.getTotalLength === 'function' ? p.getTotalLength() || 1000 : 1000;\n const fill = getComputedStyle(p).fill;\n const hasFill = fill && fill !== 'none' && fill !== 'rgba(0, 0, 0, 0)';\n return ctx.animate(p, [{ strokeDasharray: `${len}`, strokeDashoffset: len, fillOpacity: hasFill ? 0 : 1 }, { strokeDasharray: `${len}`, strokeDashoffset: 0, fillOpacity: hasFill ? 0 : 1, offset: 0.8 }, { strokeDasharray: `${len}`, strokeDashoffset: 0, fillOpacity: 1 }], { duration: o.duration, delay: i * o.stagger, easing: 'cubic-bezier(.6,.05,.3,1)', fill: 'backwards' });\n })\n );\n },\n },\n {\n name: 'ring-sweep',\n kind: 'enter',\n description: \"SVG `circle` arcs (donut / ring charts) sweep around from 12 o'clock (`duration`, `stagger`).\",\n defaults: { duration: 1000, stagger: 150 },\n run: (el: HTMLElement, o: any, ctx: EffectContext) => {\n const rings = pick<SVGCircleElement>(el, 'circle');\n if (ctx.reduced || !rings.length) return fade(el, ctx);\n return all(\n rings.map((c, i) => {\n const r = Number(c.getAttribute('r')) || 0;\n const len = 2 * Math.PI * r || 100;\n const dash = c.getAttribute('stroke-dasharray') || `${len} ${len}`;\n const visible = Number(String(dash).split(/[ ,]+/)[0]) || len;\n return ctx.animate(c, [{ strokeDasharray: `0 ${len}` }, { strokeDasharray: `${visible} ${len}` }], { duration: o.duration, delay: i * o.stagger, easing: 'cubic-bezier(.6,.05,.3,1)', fill: 'backwards' });\n })\n );\n },\n },\n {\n name: 'sankey-flow',\n kind: 'loop',\n description: 'Dashes flow along the SVG links (`[data-flow]` or every stroked `path`) to show direction (`speed`, `dash`).',\n defaults: { speed: 1, dash: '6 10' },\n reduced: 'run',\n run: (el: HTMLElement, o: any, ctx: EffectContext) => {\n let links = pick<SVGPathElement>(el, '[data-flow]');\n if (!links.length) links = pick<SVGPathElement>(el, 'path');\n const prev = links.map((l) => l.getAttribute('stroke-dasharray'));\n links.forEach((l) => l.setAttribute('stroke-dasharray', o.dash));\n const anims = ctx.reduced ? [] : links.map((l, i) => ctx.animate(l, [{ strokeDashoffset: 0 }, { strokeDashoffset: -32 }], { duration: (1200 + (i % 3) * 300) / Math.max(0.1, o.speed), iterations: Infinity }));\n const stop = () => {\n anims.forEach((a) => a?.cancel());\n links.forEach((l, i) => (prev[i] === null ? l.removeAttribute('stroke-dasharray') : l.setAttribute('stroke-dasharray', prev[i]!)));\n };\n ctx.onCleanup(stop);\n return stop;\n },\n },\n {\n name: 'number-roll',\n kind: 'enter',\n description: 'Numbers (`[data-value]` or the text of the element) count up with locale formatting, keeping prefixes and suffixes (`duration`).',\n defaults: { duration: 1200, locale: undefined },\n run: (el: HTMLElement, o: any, ctx: EffectContext) => {\n const targets = pick<HTMLElement>(el, '[data-value]');\n const list = targets.length ? targets : [el];\n const jobs = list.map((t) => {\n const f = t.dataset.value !== undefined ? { ...(parseFigure(t.textContent || '') || { pre: '', post: '', dec: 0 }), n: Number(t.dataset.value) } : parseFigure(t.textContent || '');\n return f && Number.isFinite(f.n) ? { t, f } : null;\n }).filter(Boolean) as { t: HTMLElement; f: NonNullable<ReturnType<typeof parseFigure>> }[];\n const out = (f: NonNullable<ReturnType<typeof parseFigure>>, v: number) => f.pre + v.toLocaleString(o.locale, { minimumFractionDigits: f.dec, maximumFractionDigits: f.dec }) + f.post;\n if (ctx.reduced || typeof requestAnimationFrame !== 'function') {\n jobs.forEach(({ t, f }) => (t.textContent = out(f, f.n)));\n return fade(el, ctx);\n }\n return new Promise<void>((resolve) => {\n const t0 = performance.now();\n let raf = 0;\n const step = (now: number) => {\n const k = Math.min(1, (now - t0) / o.duration);\n const e = 1 - Math.pow(1 - k, 3);\n jobs.forEach(({ t, f }) => (t.textContent = out(f, f.n * e)));\n if (k < 1) raf = requestAnimationFrame(step);\n else resolve();\n };\n raf = requestAnimationFrame(step);\n ctx.onCleanup(() => cancelAnimationFrame(raf));\n });\n },\n },\n {\n name: 'dots-pop',\n kind: 'enter',\n description: 'Scatter / line-chart points (`circle`, `[data-dot]`) pop in with an overshoot, left to right (`stagger`).',\n defaults: { stagger: 40, duration: 420 },\n run: (el: HTMLElement, o: any, ctx: EffectContext) => {\n let dots = pick<SVGElement>(el, '[data-dot]');\n if (!dots.length) dots = pick<SVGElement>(el, 'circle');\n if (ctx.reduced || !dots.length) return fade(el, ctx);\n const xOf = (d: Element) => Number(d.getAttribute('cx')) || (d as HTMLElement).offsetLeft || 0;\n const sorted = dots.slice().sort((a, b) => xOf(a) - xOf(b));\n return all(\n sorted.map((d, i) => {\n (d.style as CSSStyleDeclaration).transformBox = 'fill-box';\n (d.style as CSSStyleDeclaration).transformOrigin = '50% 50%';\n return ctx.animate(d, [{ transform: 'scale(0)', opacity: 0 }, { transform: 'scale(1.5)', opacity: 1, offset: 0.6 }, { transform: 'scale(1)', opacity: 1 }], { duration: o.duration, delay: i * o.stagger, easing: 'ease-out', fill: 'backwards' });\n })\n );\n },\n },\n];\n\n/** Register the 7.2 data-viz motion pack (idempotent). */\nexport function registerChartPack(): void {\n registerEffects(CHART_FX);\n}\n"],"names":["all","registerEffects"],"mappings":";;;;;;AAqBA,MAAM,IAAI,GAAG,CAAC,EAAW,EAAE,GAAkB,KAAK,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC;AACtH,MAAM,IAAI,GAAG,CAAoB,EAAW,EAAE,GAAW,KAAU,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,gBAAgB,CAAI,GAAG,CAAC,CAAC;AAE1G;AACM,SAAU,WAAW,CAAC,CAAS,EAAA;IACnC,MAAM,CAAC,GAAG,8BAA8B,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EA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,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;YACpP,CAAC,CAAC,CACH;QACH,CAAC;AACF,KAAA;;AAGH;SACgB,iBAAiB,GAAA;IAC/BC,wBAAe,CAAC,QAAQ,CAAC;AAC3B;;;;;;"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
type MotionSensitivity = 'full' | 'gentle' | 'minimal' | 'static';
|
|
2
|
+
type Cleanup = () => void;
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 5.0 — unified plugin-style effect registration. Every effect (built-in or
|
|
6
|
+
* yours) is a plain object registered once and played the same way:
|
|
7
|
+
* `playEffect(el, name)`, `bindEffect(el, name, { trigger })` or
|
|
8
|
+
* `<usa-fx effect="name" trigger="click">`. Effects get a context that
|
|
9
|
+
* already applies reduced motion, motion sensitivity, intensity and the
|
|
10
|
+
* animation budget.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
declare const EFFECT_KINDS: readonly ["enter", "exit", "attention", "click", "hover", "card", "loop", "page", "background", "text", "cursor", "scroll"];
|
|
14
|
+
type EffectKind = (typeof EFFECT_KINDS)[number];
|
|
15
|
+
interface EffectContext {
|
|
16
|
+
/** Reduced motion applies (OS setting, `minimal` / `static` sensitivity). */
|
|
17
|
+
readonly reduced: boolean;
|
|
18
|
+
readonly sensitivity: MotionSensitivity;
|
|
19
|
+
/** The triggering event (pointer position for click effects), if any. */
|
|
20
|
+
readonly event?: Event;
|
|
21
|
+
/** `el.animate()` with the library's motion rules (may return `null`). */
|
|
22
|
+
animate(el: Element, keyframes: Keyframe[], options: KeyframeAnimationOptions): Animation | null;
|
|
23
|
+
/** Register teardown for long-running effects (loops, listeners). */
|
|
24
|
+
onCleanup(fn: Cleanup): void;
|
|
25
|
+
}
|
|
26
|
+
interface EffectDefinition<O extends Record<string, unknown> = Record<string, any>> {
|
|
27
|
+
/** Unique, kebab-case. */
|
|
28
|
+
name: string;
|
|
29
|
+
kind: EffectKind;
|
|
30
|
+
/** One line for docs and the gallery. */
|
|
31
|
+
description?: string;
|
|
32
|
+
/** Option defaults (merged under the caller's options). */
|
|
33
|
+
defaults?: Partial<O>;
|
|
34
|
+
/**
|
|
35
|
+
* Under reduced motion: `'skip'` (do nothing — default for loop, background
|
|
36
|
+
* and cursor effects) or `'run'` (run with `ctx.reduced === true`, the
|
|
37
|
+
* effect degrades itself — default for everything else).
|
|
38
|
+
*/
|
|
39
|
+
reduced?: 'skip' | 'run';
|
|
40
|
+
/** Play the effect. Return an Animation / Promise to be awaited, or a cleanup. */
|
|
41
|
+
run(el: HTMLElement, options: O, ctx: EffectContext): void | Cleanup | Animation | null | Promise<unknown>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 7.2 — Data-viz motion (`motionary/fx/chart`, also
|
|
46
|
+
* `motionary/components/fx-chart`): entrances for the charts you already
|
|
47
|
+
* have (any SVG or HTML chart library), registered through `registerEffect()`:
|
|
48
|
+
*
|
|
49
|
+
* - `bars-grow` (enter) — bars (`[data-bar]`, `rect`, or the children) grow
|
|
50
|
+
* from the baseline in a stagger.
|
|
51
|
+
* - `line-draw` (enter) — every SVG `path` / `polyline` / `line` draws itself.
|
|
52
|
+
* - `ring-sweep` (enter) — SVG `circle` arcs sweep around from 12 o'clock.
|
|
53
|
+
* - `sankey-flow` (loop) — dashes flow along the SVG links (`[data-flow]` or
|
|
54
|
+
* every stroked `path`) to show direction and volume.
|
|
55
|
+
* - `number-roll` (enter) — numbers (`[data-value]` or the text) count up
|
|
56
|
+
* with locale formatting.
|
|
57
|
+
* - `dots-pop` (enter) — scatter / line points (`circle`, `[data-dot]`) pop in.
|
|
58
|
+
*
|
|
59
|
+
* Reduced motion: final state with a short fade (sankey-flow is static).
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
/** Parse a number out of text like "$1,234.5k" → { n, pre, post, dec }. */
|
|
63
|
+
declare function parseFigure(s: string): {
|
|
64
|
+
n: number;
|
|
65
|
+
pre: string;
|
|
66
|
+
post: string;
|
|
67
|
+
dec: number;
|
|
68
|
+
} | null;
|
|
69
|
+
declare const CHART_FX: EffectDefinition[];
|
|
70
|
+
/** Register the 7.2 data-viz motion pack (idempotent). */
|
|
71
|
+
declare function registerChartPack(): void;
|
|
72
|
+
|
|
73
|
+
export { CHART_FX, parseFigure, registerChartPack };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
type MotionSensitivity = 'full' | 'gentle' | 'minimal' | 'static';
|
|
2
|
+
type Cleanup = () => void;
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 5.0 — unified plugin-style effect registration. Every effect (built-in or
|
|
6
|
+
* yours) is a plain object registered once and played the same way:
|
|
7
|
+
* `playEffect(el, name)`, `bindEffect(el, name, { trigger })` or
|
|
8
|
+
* `<usa-fx effect="name" trigger="click">`. Effects get a context that
|
|
9
|
+
* already applies reduced motion, motion sensitivity, intensity and the
|
|
10
|
+
* animation budget.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
declare const EFFECT_KINDS: readonly ["enter", "exit", "attention", "click", "hover", "card", "loop", "page", "background", "text", "cursor", "scroll"];
|
|
14
|
+
type EffectKind = (typeof EFFECT_KINDS)[number];
|
|
15
|
+
interface EffectContext {
|
|
16
|
+
/** Reduced motion applies (OS setting, `minimal` / `static` sensitivity). */
|
|
17
|
+
readonly reduced: boolean;
|
|
18
|
+
readonly sensitivity: MotionSensitivity;
|
|
19
|
+
/** The triggering event (pointer position for click effects), if any. */
|
|
20
|
+
readonly event?: Event;
|
|
21
|
+
/** `el.animate()` with the library's motion rules (may return `null`). */
|
|
22
|
+
animate(el: Element, keyframes: Keyframe[], options: KeyframeAnimationOptions): Animation | null;
|
|
23
|
+
/** Register teardown for long-running effects (loops, listeners). */
|
|
24
|
+
onCleanup(fn: Cleanup): void;
|
|
25
|
+
}
|
|
26
|
+
interface EffectDefinition<O extends Record<string, unknown> = Record<string, any>> {
|
|
27
|
+
/** Unique, kebab-case. */
|
|
28
|
+
name: string;
|
|
29
|
+
kind: EffectKind;
|
|
30
|
+
/** One line for docs and the gallery. */
|
|
31
|
+
description?: string;
|
|
32
|
+
/** Option defaults (merged under the caller's options). */
|
|
33
|
+
defaults?: Partial<O>;
|
|
34
|
+
/**
|
|
35
|
+
* Under reduced motion: `'skip'` (do nothing — default for loop, background
|
|
36
|
+
* and cursor effects) or `'run'` (run with `ctx.reduced === true`, the
|
|
37
|
+
* effect degrades itself — default for everything else).
|
|
38
|
+
*/
|
|
39
|
+
reduced?: 'skip' | 'run';
|
|
40
|
+
/** Play the effect. Return an Animation / Promise to be awaited, or a cleanup. */
|
|
41
|
+
run(el: HTMLElement, options: O, ctx: EffectContext): void | Cleanup | Animation | null | Promise<unknown>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 7.2 — Data-viz motion (`motionary/fx/chart`, also
|
|
46
|
+
* `motionary/components/fx-chart`): entrances for the charts you already
|
|
47
|
+
* have (any SVG or HTML chart library), registered through `registerEffect()`:
|
|
48
|
+
*
|
|
49
|
+
* - `bars-grow` (enter) — bars (`[data-bar]`, `rect`, or the children) grow
|
|
50
|
+
* from the baseline in a stagger.
|
|
51
|
+
* - `line-draw` (enter) — every SVG `path` / `polyline` / `line` draws itself.
|
|
52
|
+
* - `ring-sweep` (enter) — SVG `circle` arcs sweep around from 12 o'clock.
|
|
53
|
+
* - `sankey-flow` (loop) — dashes flow along the SVG links (`[data-flow]` or
|
|
54
|
+
* every stroked `path`) to show direction and volume.
|
|
55
|
+
* - `number-roll` (enter) — numbers (`[data-value]` or the text) count up
|
|
56
|
+
* with locale formatting.
|
|
57
|
+
* - `dots-pop` (enter) — scatter / line points (`circle`, `[data-dot]`) pop in.
|
|
58
|
+
*
|
|
59
|
+
* Reduced motion: final state with a short fade (sankey-flow is static).
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
/** Parse a number out of text like "$1,234.5k" → { n, pre, post, dec }. */
|
|
63
|
+
declare function parseFigure(s: string): {
|
|
64
|
+
n: number;
|
|
65
|
+
pre: string;
|
|
66
|
+
post: string;
|
|
67
|
+
dec: number;
|
|
68
|
+
} | null;
|
|
69
|
+
declare const CHART_FX: EffectDefinition[];
|
|
70
|
+
/** Register the 7.2 data-viz motion pack (idempotent). */
|
|
71
|
+
declare function registerChartPack(): void;
|
|
72
|
+
|
|
73
|
+
export { CHART_FX, parseFigure, registerChartPack };
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { registerEffects } from '../chunks/registry-CyKExAmE.js';
|
|
2
|
+
import { a as all } from '../chunks/shared-CkKHWrtJ.js';
|
|
3
|
+
import '../chunks/base-2-yYc93C.js';
|
|
4
|
+
|
|
5
|
+
const fade = (el, ctx) => ctx.animate(el, [{ opacity: 0 }, { opacity: 1 }], { duration: 250 });
|
|
6
|
+
const pick = (el, sel) => Array.from(el.querySelectorAll(sel));
|
|
7
|
+
/** Parse a number out of text like "$1,234.5k" → { n, pre, post, dec }. */
|
|
8
|
+
function parseFigure(s) {
|
|
9
|
+
const m = /^(\D*?)(-?[\d,]*\.?\d+)(.*)$/.exec(s.trim());
|
|
10
|
+
if (!m)
|
|
11
|
+
return null;
|
|
12
|
+
const raw = m[2].replace(/,/g, '');
|
|
13
|
+
return { n: Number(raw), pre: m[1], post: m[3], dec: (raw.split('.')[1] || '').length };
|
|
14
|
+
}
|
|
15
|
+
const CHART_FX = [
|
|
16
|
+
{
|
|
17
|
+
name: 'bars-grow',
|
|
18
|
+
kind: 'enter',
|
|
19
|
+
description: 'Bars (`[data-bar]`, SVG `rect`, or the children) grow from the baseline in a stagger (`axis` y | x, `stagger`, `duration`).',
|
|
20
|
+
defaults: { axis: 'y', stagger: 60, duration: 700 },
|
|
21
|
+
run: (el, o, ctx) => {
|
|
22
|
+
let bars = pick(el, '[data-bar]');
|
|
23
|
+
if (!bars.length)
|
|
24
|
+
bars = pick(el, 'rect');
|
|
25
|
+
if (!bars.length)
|
|
26
|
+
bars = Array.from(el.children);
|
|
27
|
+
if (ctx.reduced)
|
|
28
|
+
return fade(el, ctx);
|
|
29
|
+
const x = o.axis === 'x';
|
|
30
|
+
return all(bars.map((b, i) => {
|
|
31
|
+
b.style.transformOrigin = x ? '0% 50%' : '50% 100%';
|
|
32
|
+
b.style.transformBox = 'fill-box';
|
|
33
|
+
return ctx.animate(b, [{ transform: x ? 'scaleX(0)' : 'scaleY(0)' }, { transform: x ? 'scaleX(1.04)' : 'scaleY(1.04)', offset: 0.75 }, { transform: 'none' }], { duration: o.duration, delay: i * o.stagger, easing: 'cubic-bezier(.2,.8,.3,1)', fill: 'backwards' });
|
|
34
|
+
}));
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'line-draw',
|
|
39
|
+
kind: 'enter',
|
|
40
|
+
description: 'Every SVG `path` / `polyline` / `line` draws itself, then area fills fade in (`duration`, `stagger`).',
|
|
41
|
+
defaults: { duration: 1100, stagger: 120 },
|
|
42
|
+
run: (el, o, ctx) => {
|
|
43
|
+
const lines = pick(el, 'path, polyline, line');
|
|
44
|
+
if (ctx.reduced || !lines.length)
|
|
45
|
+
return fade(el, ctx);
|
|
46
|
+
return all(lines.map((p, i) => {
|
|
47
|
+
const len = typeof p.getTotalLength === 'function' ? p.getTotalLength() || 1000 : 1000;
|
|
48
|
+
const fill = getComputedStyle(p).fill;
|
|
49
|
+
const hasFill = fill && fill !== 'none' && fill !== 'rgba(0, 0, 0, 0)';
|
|
50
|
+
return ctx.animate(p, [{ strokeDasharray: `${len}`, strokeDashoffset: len, fillOpacity: hasFill ? 0 : 1 }, { strokeDasharray: `${len}`, strokeDashoffset: 0, fillOpacity: hasFill ? 0 : 1, offset: 0.8 }, { strokeDasharray: `${len}`, strokeDashoffset: 0, fillOpacity: 1 }], { duration: o.duration, delay: i * o.stagger, easing: 'cubic-bezier(.6,.05,.3,1)', fill: 'backwards' });
|
|
51
|
+
}));
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: 'ring-sweep',
|
|
56
|
+
kind: 'enter',
|
|
57
|
+
description: "SVG `circle` arcs (donut / ring charts) sweep around from 12 o'clock (`duration`, `stagger`).",
|
|
58
|
+
defaults: { duration: 1000, stagger: 150 },
|
|
59
|
+
run: (el, o, ctx) => {
|
|
60
|
+
const rings = pick(el, 'circle');
|
|
61
|
+
if (ctx.reduced || !rings.length)
|
|
62
|
+
return fade(el, ctx);
|
|
63
|
+
return all(rings.map((c, i) => {
|
|
64
|
+
const r = Number(c.getAttribute('r')) || 0;
|
|
65
|
+
const len = 2 * Math.PI * r || 100;
|
|
66
|
+
const dash = c.getAttribute('stroke-dasharray') || `${len} ${len}`;
|
|
67
|
+
const visible = Number(String(dash).split(/[ ,]+/)[0]) || len;
|
|
68
|
+
return ctx.animate(c, [{ strokeDasharray: `0 ${len}` }, { strokeDasharray: `${visible} ${len}` }], { duration: o.duration, delay: i * o.stagger, easing: 'cubic-bezier(.6,.05,.3,1)', fill: 'backwards' });
|
|
69
|
+
}));
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'sankey-flow',
|
|
74
|
+
kind: 'loop',
|
|
75
|
+
description: 'Dashes flow along the SVG links (`[data-flow]` or every stroked `path`) to show direction (`speed`, `dash`).',
|
|
76
|
+
defaults: { speed: 1, dash: '6 10' },
|
|
77
|
+
reduced: 'run',
|
|
78
|
+
run: (el, o, ctx) => {
|
|
79
|
+
let links = pick(el, '[data-flow]');
|
|
80
|
+
if (!links.length)
|
|
81
|
+
links = pick(el, 'path');
|
|
82
|
+
const prev = links.map((l) => l.getAttribute('stroke-dasharray'));
|
|
83
|
+
links.forEach((l) => l.setAttribute('stroke-dasharray', o.dash));
|
|
84
|
+
const anims = ctx.reduced ? [] : links.map((l, i) => ctx.animate(l, [{ strokeDashoffset: 0 }, { strokeDashoffset: -32 }], { duration: (1200 + (i % 3) * 300) / Math.max(0.1, o.speed), iterations: Infinity }));
|
|
85
|
+
const stop = () => {
|
|
86
|
+
anims.forEach((a) => a?.cancel());
|
|
87
|
+
links.forEach((l, i) => (prev[i] === null ? l.removeAttribute('stroke-dasharray') : l.setAttribute('stroke-dasharray', prev[i])));
|
|
88
|
+
};
|
|
89
|
+
ctx.onCleanup(stop);
|
|
90
|
+
return stop;
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: 'number-roll',
|
|
95
|
+
kind: 'enter',
|
|
96
|
+
description: 'Numbers (`[data-value]` or the text of the element) count up with locale formatting, keeping prefixes and suffixes (`duration`).',
|
|
97
|
+
defaults: { duration: 1200, locale: undefined },
|
|
98
|
+
run: (el, o, ctx) => {
|
|
99
|
+
const targets = pick(el, '[data-value]');
|
|
100
|
+
const list = targets.length ? targets : [el];
|
|
101
|
+
const jobs = list.map((t) => {
|
|
102
|
+
const f = t.dataset.value !== undefined ? { ...(parseFigure(t.textContent || '') || { pre: '', post: '', dec: 0 }), n: Number(t.dataset.value) } : parseFigure(t.textContent || '');
|
|
103
|
+
return f && Number.isFinite(f.n) ? { t, f } : null;
|
|
104
|
+
}).filter(Boolean);
|
|
105
|
+
const out = (f, v) => f.pre + v.toLocaleString(o.locale, { minimumFractionDigits: f.dec, maximumFractionDigits: f.dec }) + f.post;
|
|
106
|
+
if (ctx.reduced || typeof requestAnimationFrame !== 'function') {
|
|
107
|
+
jobs.forEach(({ t, f }) => (t.textContent = out(f, f.n)));
|
|
108
|
+
return fade(el, ctx);
|
|
109
|
+
}
|
|
110
|
+
return new Promise((resolve) => {
|
|
111
|
+
const t0 = performance.now();
|
|
112
|
+
let raf = 0;
|
|
113
|
+
const step = (now) => {
|
|
114
|
+
const k = Math.min(1, (now - t0) / o.duration);
|
|
115
|
+
const e = 1 - Math.pow(1 - k, 3);
|
|
116
|
+
jobs.forEach(({ t, f }) => (t.textContent = out(f, f.n * e)));
|
|
117
|
+
if (k < 1)
|
|
118
|
+
raf = requestAnimationFrame(step);
|
|
119
|
+
else
|
|
120
|
+
resolve();
|
|
121
|
+
};
|
|
122
|
+
raf = requestAnimationFrame(step);
|
|
123
|
+
ctx.onCleanup(() => cancelAnimationFrame(raf));
|
|
124
|
+
});
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: 'dots-pop',
|
|
129
|
+
kind: 'enter',
|
|
130
|
+
description: 'Scatter / line-chart points (`circle`, `[data-dot]`) pop in with an overshoot, left to right (`stagger`).',
|
|
131
|
+
defaults: { stagger: 40, duration: 420 },
|
|
132
|
+
run: (el, o, ctx) => {
|
|
133
|
+
let dots = pick(el, '[data-dot]');
|
|
134
|
+
if (!dots.length)
|
|
135
|
+
dots = pick(el, 'circle');
|
|
136
|
+
if (ctx.reduced || !dots.length)
|
|
137
|
+
return fade(el, ctx);
|
|
138
|
+
const xOf = (d) => Number(d.getAttribute('cx')) || d.offsetLeft || 0;
|
|
139
|
+
const sorted = dots.slice().sort((a, b) => xOf(a) - xOf(b));
|
|
140
|
+
return all(sorted.map((d, i) => {
|
|
141
|
+
d.style.transformBox = 'fill-box';
|
|
142
|
+
d.style.transformOrigin = '50% 50%';
|
|
143
|
+
return ctx.animate(d, [{ transform: 'scale(0)', opacity: 0 }, { transform: 'scale(1.5)', opacity: 1, offset: 0.6 }, { transform: 'scale(1)', opacity: 1 }], { duration: o.duration, delay: i * o.stagger, easing: 'ease-out', fill: 'backwards' });
|
|
144
|
+
}));
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
];
|
|
148
|
+
/** Register the 7.2 data-viz motion pack (idempotent). */
|
|
149
|
+
function registerChartPack() {
|
|
150
|
+
registerEffects(CHART_FX);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export { CHART_FX, parseFigure, registerChartPack };
|
|
154
|
+
//# sourceMappingURL=fx-chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fx-chart.js","sources":["../../src/components/fx2/chart.ts"],"sourcesContent":["/**\n * 7.2 — Data-viz motion (`motionary/fx/chart`, also\n * `motionary/components/fx-chart`): entrances for the charts you already\n * have (any SVG or HTML chart library), registered through `registerEffect()`:\n *\n * - `bars-grow` (enter) — bars (`[data-bar]`, `rect`, or the children) grow\n * from the baseline in a stagger.\n * - `line-draw` (enter) — every SVG `path` / `polyline` / `line` draws itself.\n * - `ring-sweep` (enter) — SVG `circle` arcs sweep around from 12 o'clock.\n * - `sankey-flow` (loop) — dashes flow along the SVG links (`[data-flow]` or\n * every stroked `path`) to show direction and volume.\n * - `number-roll` (enter) — numbers (`[data-value]` or the text) count up\n * with locale formatting.\n * - `dots-pop` (enter) — scatter / line points (`circle`, `[data-dot]`) pop in.\n *\n * Reduced motion: final state with a short fade (sankey-flow is static).\n */\nimport type { EffectContext, EffectDefinition } from '../fx/registry';\nimport { registerEffects } from '../fx/registry';\nimport { all } from '../effects/shared';\n\nconst fade = (el: Element, ctx: EffectContext) => ctx.animate(el, [{ opacity: 0 }, { opacity: 1 }], { duration: 250 });\nconst pick = <T extends Element>(el: Element, sel: string): T[] => Array.from(el.querySelectorAll<T>(sel));\n\n/** Parse a number out of text like \"$1,234.5k\" → { n, pre, post, dec }. */\nexport function parseFigure(s: string): { n: number; pre: string; post: string; dec: number } | null {\n const m = /^(\\D*?)(-?[\\d,]*\\.?\\d+)(.*)$/.exec(s.trim());\n if (!m) return null;\n const raw = m[2].replace(/,/g, '');\n return { n: Number(raw), pre: m[1], post: m[3], dec: (raw.split('.')[1] || '').length };\n}\n\nexport const CHART_FX: EffectDefinition[] = [\n {\n name: 'bars-grow',\n kind: 'enter',\n description: 'Bars (`[data-bar]`, SVG `rect`, or the children) grow from the baseline in a stagger (`axis` y | x, `stagger`, `duration`).',\n defaults: { axis: 'y', stagger: 60, duration: 700 },\n run: (el: HTMLElement, o: any, ctx: EffectContext) => {\n let bars = pick<HTMLElement>(el, '[data-bar]');\n if (!bars.length) bars = pick<HTMLElement>(el, 'rect');\n if (!bars.length) bars = Array.from(el.children) as HTMLElement[];\n if (ctx.reduced) return fade(el, ctx);\n const x = o.axis === 'x';\n return all(\n bars.map((b, i) => {\n (b.style as CSSStyleDeclaration).transformOrigin = x ? '0% 50%' : '50% 100%';\n (b.style as CSSStyleDeclaration).transformBox = 'fill-box';\n return ctx.animate(b, [{ transform: x ? 'scaleX(0)' : 'scaleY(0)' }, { transform: x ? 'scaleX(1.04)' : 'scaleY(1.04)', offset: 0.75 }, { transform: 'none' }], { duration: o.duration, delay: i * o.stagger, easing: 'cubic-bezier(.2,.8,.3,1)', fill: 'backwards' });\n })\n );\n },\n },\n {\n name: 'line-draw',\n kind: 'enter',\n description: 'Every SVG `path` / `polyline` / `line` draws itself, then area fills fade in (`duration`, `stagger`).',\n defaults: { duration: 1100, stagger: 120 },\n run: (el: HTMLElement, o: any, ctx: EffectContext) => {\n const lines = pick<SVGGeometryElement>(el, 'path, polyline, line');\n if (ctx.reduced || !lines.length) return fade(el, ctx);\n return all(\n lines.map((p, i) => {\n const len = typeof p.getTotalLength === 'function' ? p.getTotalLength() || 1000 : 1000;\n const fill = getComputedStyle(p).fill;\n const hasFill = fill && fill !== 'none' && fill !== 'rgba(0, 0, 0, 0)';\n return ctx.animate(p, [{ strokeDasharray: `${len}`, strokeDashoffset: len, fillOpacity: hasFill ? 0 : 1 }, { strokeDasharray: `${len}`, strokeDashoffset: 0, fillOpacity: hasFill ? 0 : 1, offset: 0.8 }, { strokeDasharray: `${len}`, strokeDashoffset: 0, fillOpacity: 1 }], { duration: o.duration, delay: i * o.stagger, easing: 'cubic-bezier(.6,.05,.3,1)', fill: 'backwards' });\n })\n );\n },\n },\n {\n name: 'ring-sweep',\n kind: 'enter',\n description: \"SVG `circle` arcs (donut / ring charts) sweep around from 12 o'clock (`duration`, `stagger`).\",\n defaults: { duration: 1000, stagger: 150 },\n run: (el: HTMLElement, o: any, ctx: EffectContext) => {\n const rings = pick<SVGCircleElement>(el, 'circle');\n if (ctx.reduced || !rings.length) return fade(el, ctx);\n return all(\n rings.map((c, i) => {\n const r = Number(c.getAttribute('r')) || 0;\n const len = 2 * Math.PI * r || 100;\n const dash = c.getAttribute('stroke-dasharray') || `${len} ${len}`;\n const visible = Number(String(dash).split(/[ ,]+/)[0]) || len;\n return ctx.animate(c, [{ strokeDasharray: `0 ${len}` }, { strokeDasharray: `${visible} ${len}` }], { duration: o.duration, delay: i * o.stagger, easing: 'cubic-bezier(.6,.05,.3,1)', fill: 'backwards' });\n })\n );\n },\n },\n {\n name: 'sankey-flow',\n kind: 'loop',\n description: 'Dashes flow along the SVG links (`[data-flow]` or every stroked `path`) to show direction (`speed`, `dash`).',\n defaults: { speed: 1, dash: '6 10' },\n reduced: 'run',\n run: (el: HTMLElement, o: any, ctx: EffectContext) => {\n let links = pick<SVGPathElement>(el, '[data-flow]');\n if (!links.length) links = pick<SVGPathElement>(el, 'path');\n const prev = links.map((l) => l.getAttribute('stroke-dasharray'));\n links.forEach((l) => l.setAttribute('stroke-dasharray', o.dash));\n const anims = ctx.reduced ? [] : links.map((l, i) => ctx.animate(l, [{ strokeDashoffset: 0 }, { strokeDashoffset: -32 }], { duration: (1200 + (i % 3) * 300) / Math.max(0.1, o.speed), iterations: Infinity }));\n const stop = () => {\n anims.forEach((a) => a?.cancel());\n links.forEach((l, i) => (prev[i] === null ? l.removeAttribute('stroke-dasharray') : l.setAttribute('stroke-dasharray', prev[i]!)));\n };\n ctx.onCleanup(stop);\n return stop;\n },\n },\n {\n name: 'number-roll',\n kind: 'enter',\n description: 'Numbers (`[data-value]` or the text of the element) count up with locale formatting, keeping prefixes and suffixes (`duration`).',\n defaults: { duration: 1200, locale: undefined },\n run: (el: HTMLElement, o: any, ctx: EffectContext) => {\n const targets = pick<HTMLElement>(el, '[data-value]');\n const list = targets.length ? targets : [el];\n const jobs = list.map((t) => {\n const f = t.dataset.value !== undefined ? { ...(parseFigure(t.textContent || '') || { pre: '', post: '', dec: 0 }), n: Number(t.dataset.value) } : parseFigure(t.textContent || '');\n return f && Number.isFinite(f.n) ? { t, f } : null;\n }).filter(Boolean) as { t: HTMLElement; f: NonNullable<ReturnType<typeof parseFigure>> }[];\n const out = (f: NonNullable<ReturnType<typeof parseFigure>>, v: number) => f.pre + v.toLocaleString(o.locale, { minimumFractionDigits: f.dec, maximumFractionDigits: f.dec }) + f.post;\n if (ctx.reduced || typeof requestAnimationFrame !== 'function') {\n jobs.forEach(({ t, f }) => (t.textContent = out(f, f.n)));\n return fade(el, ctx);\n }\n return new Promise<void>((resolve) => {\n const t0 = performance.now();\n let raf = 0;\n const step = (now: number) => {\n const k = Math.min(1, (now - t0) / o.duration);\n const e = 1 - Math.pow(1 - k, 3);\n jobs.forEach(({ t, f }) => (t.textContent = out(f, f.n * e)));\n if (k < 1) raf = requestAnimationFrame(step);\n else resolve();\n };\n raf = requestAnimationFrame(step);\n ctx.onCleanup(() => cancelAnimationFrame(raf));\n });\n },\n },\n {\n name: 'dots-pop',\n kind: 'enter',\n description: 'Scatter / line-chart points (`circle`, `[data-dot]`) pop in with an overshoot, left to right (`stagger`).',\n defaults: { stagger: 40, duration: 420 },\n run: (el: HTMLElement, o: any, ctx: EffectContext) => {\n let dots = pick<SVGElement>(el, '[data-dot]');\n if (!dots.length) dots = pick<SVGElement>(el, 'circle');\n if (ctx.reduced || !dots.length) return fade(el, ctx);\n const xOf = (d: Element) => Number(d.getAttribute('cx')) || (d as HTMLElement).offsetLeft || 0;\n const sorted = dots.slice().sort((a, b) => xOf(a) - xOf(b));\n return all(\n sorted.map((d, i) => {\n (d.style as CSSStyleDeclaration).transformBox = 'fill-box';\n (d.style as CSSStyleDeclaration).transformOrigin = '50% 50%';\n return ctx.animate(d, [{ transform: 'scale(0)', opacity: 0 }, { transform: 'scale(1.5)', opacity: 1, offset: 0.6 }, { transform: 'scale(1)', opacity: 1 }], { duration: o.duration, delay: i * o.stagger, easing: 'ease-out', fill: 'backwards' });\n })\n );\n },\n },\n];\n\n/** Register the 7.2 data-viz motion pack (idempotent). */\nexport function registerChart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,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,KAAI;AACjB,gBAAA,CAAC,CAAC,KAA6B,CAAC,YAAY,GAAG,UAAU;AACzD,gBAAA,CAAC,CAAC,KAA6B,CAAC,eAAe,GAAG,SAAS;AAC5D,gBAAA,OAAO,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;YACpP,CAAC,CAAC,CACH;QACH,CAAC;AACF,KAAA;;AAGH;SACgB,iBAAiB,GAAA;IAC/B,eAAe,CAAC,QAAQ,CAAC;AAC3B;;;;"}
|
package/dist/components/fx2.cjs
CHANGED
|
@@ -11,6 +11,7 @@ var components_fxWeather = require('./fx-weather.cjs');
|
|
|
11
11
|
var components_fxPhysics = require('./fx-physics.cjs');
|
|
12
12
|
var components_fxFocus = require('./fx-focus.cjs');
|
|
13
13
|
var components_fxMusic = require('./fx-music.cjs');
|
|
14
|
+
var components_fxChart = require('./fx-chart.cjs');
|
|
14
15
|
require('../chunks/registry-DehBVRDV.cjs');
|
|
15
16
|
require('../chunks/base-BaQV-2ha.cjs');
|
|
16
17
|
require('../chunks/generative-BHIj-NU0.cjs');
|
|
@@ -29,6 +30,7 @@ const EFFECT_PACKS = {
|
|
|
29
30
|
physics: components_fxPhysics.PHYSICS2_FX,
|
|
30
31
|
focus: components_fxFocus.FOCUS_FX,
|
|
31
32
|
music: components_fxMusic.MUSIC_FX,
|
|
33
|
+
chart: components_fxChart.CHART_FX,
|
|
32
34
|
};
|
|
33
35
|
/** Register every 6.x effect pack (idempotent). */
|
|
34
36
|
function registerEffectPacks() {
|
|
@@ -42,6 +44,7 @@ function registerEffectPacks() {
|
|
|
42
44
|
components_fxPhysics.registerPhysicsPack();
|
|
43
45
|
components_fxFocus.registerFocusPack();
|
|
44
46
|
components_fxMusic.registerMusicPack();
|
|
47
|
+
components_fxChart.registerChartPack();
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
exports.EFFECT_PACK_FORMAT = components_marketplace.EFFECT_PACK_FORMAT;
|
|
@@ -87,6 +90,9 @@ exports.MUSIC_FX = components_fxMusic.MUSIC_FX;
|
|
|
87
90
|
exports.musicSample = components_fxMusic.musicSample;
|
|
88
91
|
exports.registerMusicPack = components_fxMusic.registerMusicPack;
|
|
89
92
|
exports.syntheticSample = components_fxMusic.syntheticSample;
|
|
93
|
+
exports.CHART_FX = components_fxChart.CHART_FX;
|
|
94
|
+
exports.parseFigure = components_fxChart.parseFigure;
|
|
95
|
+
exports.registerChartPack = components_fxChart.registerChartPack;
|
|
90
96
|
exports.EFFECT_PACKS = EFFECT_PACKS;
|
|
91
97
|
exports.registerEffectPacks = registerEffectPacks;
|
|
92
98
|
//# sourceMappingURL=fx2.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fx2.cjs","sources":["../../src/components/fx2/index.ts"],"sourcesContent":["/**\n * The 6.x effect packs, one entry each (`motionary/components/fx-gpu`, …) so\n * their size budgets stay separate. This module (`registerFx2()`) registers\n * them all — used by dist/widgets.umd.js and the showcase.\n */\nimport type { EffectDefinition } from '../fx/registry';\nexport { EFFECT_PACK_FORMAT, packManifest, validateManifest, loadEffectPack } from './manifest';\nexport type { EffectPackManifest } from './manifest';\nimport { GPU_FX, registerGpuPack } from './gpu';\nimport { TEXT3_FX, registerTextPack, splitChars } from './text3';\nimport { LIGHT_FX, registerLightPack, trackPointer } from './light';\nimport { DEPTH3_FX, register3dPack } from './depth3';\nimport { MORPH2_FX, registerMorphPack, samplePath, pointsToPath } from './morph2';\nimport { TRANSITIONS2_FX, registerTransitionsPack, pageTransition, crossDocumentTransitions } from './transitions2';\nimport { WEATHER_FX, registerWeatherPack, skyAt } from './weather';\nimport { PHYSICS2_FX, registerPhysicsPack, VerletWorld } from './physics2';\nimport { FOCUS_FX, registerFocusPack } from './focus';\nimport { MUSIC_FX, registerMusicPack, syntheticSample, musicSample } from './music';\n\nexport { GPU_FX, registerGpuPack, TEXT3_FX, registerTextPack, splitChars };\nexport { shaderBackground, supportsWebGL2, fieldFallback, GLSL_HEAD } from './gl';\nexport { supportsWebGPU, glslToWgsl, wgslModule, webgpuBackground, WGSL_HEAD } from './webgpu';\nexport type { ShaderSpec } from './gl';\n\nexport { LIGHT_FX, registerLightPack, trackPointer };\n\nexport { DEPTH3_FX, register3dPack };\n\nexport { MORPH2_FX, registerMorphPack, samplePath, pointsToPath };\n\nexport { TRANSITIONS2_FX, registerTransitionsPack, pageTransition, crossDocumentTransitions };\n\nexport { WEATHER_FX, registerWeatherPack, skyAt };\n\nexport { PHYSICS2_FX, registerPhysicsPack, VerletWorld };\n\nexport { FOCUS_FX, registerFocusPack };\n\nexport { MUSIC_FX, registerMusicPack, syntheticSample, musicSample };\n\n/** The 6.x effect packs by name. */\nexport const EFFECT_PACKS: Record<string, EffectDefinition[]> = {\n gpu: GPU_FX,\n text: TEXT3_FX,\n light: LIGHT_FX,\n depth: DEPTH3_FX,\n morph: MORPH2_FX,\n transitions: TRANSITIONS2_FX,\n weather: WEATHER_FX,\n physics: PHYSICS2_FX,\n focus: FOCUS_FX,\n music: MUSIC_FX,\n};\n\n/** Register every 6.x effect pack (idempotent). */\nexport function registerEffectPacks(): void {\n registerGpuPack();\n registerTextPack();\n registerLightPack();\n register3dPack();\n registerMorphPack();\n registerTransitionsPack();\n registerWeatherPack();\n registerPhysicsPack();\n registerFocusPack();\n registerMusicPack();\n}\n\n\n"],"names":["GPU_FX","TEXT3_FX","LIGHT_FX","DEPTH3_FX","MORPH2_FX","TRANSITIONS2_FX","WEATHER_FX","PHYSICS2_FX","FOCUS_FX","MUSIC_FX","registerGpuPack","registerTextPack","registerLightPack","register3dPack","registerMorphPack","registerTransitionsPack","registerWeatherPack","registerPhysicsPack","registerFocusPack","registerMusicPack"],"mappings":"
|
|
1
|
+
{"version":3,"file":"fx2.cjs","sources":["../../src/components/fx2/index.ts"],"sourcesContent":["/**\n * The 6.x effect packs, one entry each (`motionary/components/fx-gpu`, …) so\n * their size budgets stay separate. This module (`registerFx2()`) registers\n * them all — used by dist/widgets.umd.js and the showcase.\n */\nimport type { EffectDefinition } from '../fx/registry';\nexport { EFFECT_PACK_FORMAT, packManifest, validateManifest, loadEffectPack } from './manifest';\nexport type { EffectPackManifest } from './manifest';\nimport { GPU_FX, registerGpuPack } from './gpu';\nimport { TEXT3_FX, registerTextPack, splitChars } from './text3';\nimport { LIGHT_FX, registerLightPack, trackPointer } from './light';\nimport { DEPTH3_FX, register3dPack } from './depth3';\nimport { MORPH2_FX, registerMorphPack, samplePath, pointsToPath } from './morph2';\nimport { TRANSITIONS2_FX, registerTransitionsPack, pageTransition, crossDocumentTransitions } from './transitions2';\nimport { WEATHER_FX, registerWeatherPack, skyAt } from './weather';\nimport { PHYSICS2_FX, registerPhysicsPack, VerletWorld } from './physics2';\nimport { FOCUS_FX, registerFocusPack } from './focus';\nimport { MUSIC_FX, registerMusicPack, syntheticSample, musicSample } from './music';\nimport { CHART_FX, registerChartPack, parseFigure } from './chart';\n\nexport { GPU_FX, registerGpuPack, TEXT3_FX, registerTextPack, splitChars };\nexport { shaderBackground, supportsWebGL2, fieldFallback, GLSL_HEAD } from './gl';\nexport { supportsWebGPU, glslToWgsl, wgslModule, webgpuBackground, WGSL_HEAD } from './webgpu';\nexport type { ShaderSpec } from './gl';\n\nexport { LIGHT_FX, registerLightPack, trackPointer };\n\nexport { DEPTH3_FX, register3dPack };\n\nexport { MORPH2_FX, registerMorphPack, samplePath, pointsToPath };\n\nexport { TRANSITIONS2_FX, registerTransitionsPack, pageTransition, crossDocumentTransitions };\n\nexport { WEATHER_FX, registerWeatherPack, skyAt };\n\nexport { PHYSICS2_FX, registerPhysicsPack, VerletWorld };\n\nexport { FOCUS_FX, registerFocusPack };\n\nexport { MUSIC_FX, registerMusicPack, syntheticSample, musicSample };\n\nexport { CHART_FX, registerChartPack, parseFigure };\n\n/** The 6.x effect packs by name. */\nexport const EFFECT_PACKS: Record<string, EffectDefinition[]> = {\n gpu: GPU_FX,\n text: TEXT3_FX,\n light: LIGHT_FX,\n depth: DEPTH3_FX,\n morph: MORPH2_FX,\n transitions: TRANSITIONS2_FX,\n weather: WEATHER_FX,\n physics: PHYSICS2_FX,\n focus: FOCUS_FX,\n music: MUSIC_FX,\n chart: CHART_FX,\n};\n\n/** Register every 6.x effect pack (idempotent). */\nexport function registerEffectPacks(): void {\n registerGpuPack();\n registerTextPack();\n registerLightPack();\n register3dPack();\n registerMorphPack();\n registerTransitionsPack();\n registerWeatherPack();\n registerPhysicsPack();\n registerFocusPack();\n registerMusicPack();\n registerChartPack();\n}\n\n\n"],"names":["GPU_FX","TEXT3_FX","LIGHT_FX","DEPTH3_FX","MORPH2_FX","TRANSITIONS2_FX","WEATHER_FX","PHYSICS2_FX","FOCUS_FX","MUSIC_FX","CHART_FX","registerGpuPack","registerTextPack","registerLightPack","register3dPack","registerMorphPack","registerTransitionsPack","registerWeatherPack","registerPhysicsPack","registerFocusPack","registerMusicPack","registerChartPack"],"mappings":";;;;;;;;;;;;;;;;;;;;AA2CA;AACO,MAAM,YAAY,GAAuC;AAC9D,IAAA,GAAG,EAAEA,uBAAM;AACX,IAAA,IAAI,EAAEC,0BAAQ;AACd,IAAA,KAAK,EAAEC,2BAAQ;AACf,IAAA,KAAK,EAAEC,yBAAS;AAChB,IAAA,KAAK,EAAEC,4BAAS;AAChB,IAAA,WAAW,EAAEC,wCAAe;AAC5B,IAAA,OAAO,EAAEC,+BAAU;AACnB,IAAA,OAAO,EAAEC,gCAAW;AACpB,IAAA,KAAK,EAAEC,2BAAQ;AACf,IAAA,KAAK,EAAEC,2BAAQ;AACf,IAAA,KAAK,EAAEC,2BAAQ;;AAGjB;SACgB,mBAAmB,GAAA;AACjC,IAAAC,gCAAe,EAAE;AACjB,IAAAC,kCAAgB,EAAE;AAClB,IAAAC,oCAAiB,EAAE;AACnB,IAAAC,8BAAc,EAAE;AAChB,IAAAC,oCAAiB,EAAE;AACnB,IAAAC,gDAAuB,EAAE;AACzB,IAAAC,wCAAmB,EAAE;AACrB,IAAAC,wCAAmB,EAAE;AACrB,IAAAC,oCAAiB,EAAE;AACnB,IAAAC,oCAAiB,EAAE;AACnB,IAAAC,oCAAiB,EAAE;AACrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|