use-scroll-animate 6.1.1 → 6.3.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 +33 -0
- package/dist/chunks/{base-Yno7N2eC.js → base-DchG4q_S.js} +2 -2
- package/dist/chunks/{base-Yno7N2eC.js.map → base-DchG4q_S.js.map} +1 -1
- package/dist/chunks/{core-BIOaYdgN.js → core-D2vF8kZb.js} +2 -2
- package/dist/chunks/{core-BIOaYdgN.js.map → core-D2vF8kZb.js.map} +1 -1
- package/dist/chunks/{core-CUGCsMsJ.js → core-DVyTlo9Q.js} +2 -2
- package/dist/chunks/{core-CUGCsMsJ.js.map → core-DVyTlo9Q.js.map} +1 -1
- package/dist/chunks/{fx-BqDeFywO.js → fx-DUMVKSvg.js} +2 -2
- package/dist/chunks/{fx-BqDeFywO.js.map → fx-DUMVKSvg.js.map} +1 -1
- package/dist/chunks/generative-BHIj-NU0.cjs +295 -0
- package/dist/chunks/generative-BHIj-NU0.cjs.map +1 -0
- package/dist/chunks/generative-BRUZaIsX.js +290 -0
- package/dist/chunks/generative-BRUZaIsX.js.map +1 -0
- package/dist/chunks/gpu-BBRLgEzM.cjs +388 -0
- package/dist/chunks/gpu-BBRLgEzM.cjs.map +1 -0
- package/dist/chunks/gpu-XHWzeNb5.js +381 -0
- package/dist/chunks/gpu-XHWzeNb5.js.map +1 -0
- package/dist/chunks/registry-Bu5NrAyA.js +121 -0
- package/dist/chunks/registry-Bu5NrAyA.js.map +1 -0
- package/dist/chunks/registry-DehBVRDV.cjs +131 -0
- package/dist/chunks/registry-DehBVRDV.cjs.map +1 -0
- package/dist/chunks/shared-eweTlzxv.js +50 -0
- package/dist/chunks/shared-eweTlzxv.js.map +1 -0
- package/dist/chunks/shared-jkgRH-Hx.cjs +58 -0
- package/dist/chunks/shared-jkgRH-Hx.cjs.map +1 -0
- package/dist/chunks/{spring-DfQO5USi.js → spring-BhoT09Qb.js} +2 -2
- package/dist/chunks/{spring-DfQO5USi.js.map → spring-BhoT09Qb.js.map} +1 -1
- package/dist/chunks/{variants-VNscPeTD.js → variants-C_hv_s23.js} +2 -2
- package/dist/chunks/{variants-VNscPeTD.js.map → variants-C_hv_s23.js.map} +1 -1
- package/dist/components/a11y.js +2 -2
- package/dist/components/angular.cjs +1 -0
- package/dist/components/angular.cjs.map +1 -1
- package/dist/components/angular.js +7 -6
- package/dist/components/angular.js.map +1 -1
- package/dist/components/background.js +2 -2
- package/dist/components/bridge.js +1 -1
- package/dist/components/cards.js +2 -2
- package/dist/components/click.js +3 -3
- package/dist/components/depth.js +3 -3
- package/dist/components/effects.cjs +72 -403
- package/dist/components/effects.cjs.map +1 -1
- package/dist/components/effects.js +9 -339
- package/dist/components/effects.js.map +1 -1
- package/dist/components/feedback.js +1 -1
- package/dist/components/fx-gpu.cjs +13 -0
- package/dist/components/fx-gpu.cjs.map +1 -0
- package/dist/components/fx-gpu.d.cts +63 -0
- package/dist/components/fx-gpu.d.ts +63 -0
- package/dist/components/fx-gpu.js +6 -0
- package/dist/components/fx-gpu.js.map +1 -0
- package/dist/components/fx-text.cjs +267 -0
- package/dist/components/fx-text.cjs.map +1 -0
- package/dist/components/fx-text.d.cts +70 -0
- package/dist/components/fx-text.d.ts +70 -0
- package/dist/components/fx-text.js +263 -0
- package/dist/components/fx-text.js.map +1 -0
- package/dist/components/fx.cjs +13 -133
- package/dist/components/fx.cjs.map +1 -1
- package/dist/components/fx.js +6 -125
- package/dist/components/fx.js.map +1 -1
- package/dist/components/fx2.cjs +32 -0
- package/dist/components/fx2.cjs.map +1 -0
- package/dist/components/fx2.d.cts +162 -0
- package/dist/components/fx2.d.ts +162 -0
- package/dist/components/fx2.js +22 -0
- package/dist/components/fx2.js.map +1 -0
- package/dist/components/gesture.js +4 -4
- package/dist/components/interaction.js +1 -1
- package/dist/components/layout.js +1 -1
- package/dist/components/lite.cjs +5 -9
- package/dist/components/lite.cjs.map +1 -1
- package/dist/components/lite.js +5 -9
- package/dist/components/lite.js.map +1 -1
- package/dist/components/packs.js +1 -1
- package/dist/components/page.js +3 -3
- package/dist/components/perf.js +2 -2
- package/dist/components/physics.js +3 -3
- package/dist/components/reveal.js +1 -1
- package/dist/components/solid.cjs +1 -0
- package/dist/components/solid.cjs.map +1 -1
- package/dist/components/solid.js +7 -6
- package/dist/components/solid.js.map +1 -1
- package/dist/components/svelte.cjs +1 -0
- package/dist/components/svelte.cjs.map +1 -1
- package/dist/components/svelte.js +7 -6
- package/dist/components/svelte.js.map +1 -1
- package/dist/components/svg.js +1 -1
- package/dist/components/text.js +2 -2
- package/dist/components/timeline.js +3 -3
- package/dist/components/transitions.js +1 -1
- package/dist/components/ui.js +4 -4
- package/dist/components/vue.cjs +1 -0
- package/dist/components/vue.cjs.map +1 -1
- package/dist/components/vue.js +7 -6
- package/dist/components/vue.js.map +1 -1
- package/dist/components/webgl.js +1 -1
- package/dist/components/widgets.cjs +1174 -0
- package/dist/components/widgets.cjs.map +1 -0
- package/dist/components/widgets.d.cts +206 -0
- package/dist/components/widgets.d.ts +206 -0
- package/dist/components/widgets.js +1155 -0
- package/dist/components/widgets.js.map +1 -0
- package/dist/components.cjs +10 -9
- package/dist/components.cjs.map +1 -1
- package/dist/components.js +10 -9
- package/dist/components.js.map +1 -1
- package/dist/components.umd.js +2 -2
- package/dist/components.umd.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/widgets.umd.js +2 -0
- package/dist/widgets.umd.js.map +1 -0
- package/docs/ROADMAP.md +10 -11
- package/docs/components.md +61 -0
- package/package.json +41 -1
package/dist/components/fx.js
CHANGED
|
@@ -1,129 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { y as defineElement } from '../chunks/base-DchG4q_S.js';
|
|
2
|
+
import { p as playEffect, b as bindEffect, a as EFFECT_TRIGGERS, c as registerEffects } from '../chunks/registry-Bu5NrAyA.js';
|
|
3
|
+
export { E as EFFECT_KINDS, g as getEffect, h as hasEffect, l as listEffects, r as registerEffect } from '../chunks/registry-Bu5NrAyA.js';
|
|
4
|
+
import { T as TIMELINE_PRESETS } from '../chunks/core-DVyTlo9Q.js';
|
|
5
|
+
import { b as burst, c as confetti, s as shake } from '../chunks/fx-DUMVKSvg.js';
|
|
4
6
|
import './tokens.js';
|
|
5
7
|
|
|
6
|
-
/**
|
|
7
|
-
* 5.0 — unified plugin-style effect registration. Every effect (built-in or
|
|
8
|
-
* yours) is a plain object registered once and played the same way:
|
|
9
|
-
* `playEffect(el, name)`, `bindEffect(el, name, { trigger })` or
|
|
10
|
-
* `<usa-fx effect="name" trigger="click">`. Effects get a context that
|
|
11
|
-
* already applies reduced motion, motion sensitivity, intensity and the
|
|
12
|
-
* animation budget.
|
|
13
|
-
*/
|
|
14
|
-
const EFFECT_KINDS = ['enter', 'exit', 'attention', 'click', 'hover', 'card', 'loop', 'page', 'background', 'text', 'cursor', 'scroll'];
|
|
15
|
-
const EFFECT_TRIGGERS = ['click', 'hover', 'enter', 'load', 'loop', 'manual'];
|
|
16
|
-
const registry = new Map();
|
|
17
|
-
/** Register an effect (throws on a duplicate name unless `override`). Returns an unregister function. */
|
|
18
|
-
function registerEffect(def, opts = {}) {
|
|
19
|
-
if (!/^[a-z][a-z0-9-]*$/.test(def.name))
|
|
20
|
-
throw new Error(`[motionary] invalid effect name "${def.name}"`);
|
|
21
|
-
if (!EFFECT_KINDS.includes(def.kind))
|
|
22
|
-
throw new Error(`[motionary] unknown effect kind "${def.kind}"`);
|
|
23
|
-
if (registry.has(def.name) && !opts.override)
|
|
24
|
-
throw new Error(`[motionary] effect "${def.name}" is already registered`);
|
|
25
|
-
registry.set(def.name, def);
|
|
26
|
-
return () => {
|
|
27
|
-
if (registry.get(def.name) === def)
|
|
28
|
-
registry.delete(def.name);
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
/** Register several effects at once (already-registered names are skipped). */
|
|
32
|
-
function registerEffects(defs) {
|
|
33
|
-
for (const d of defs)
|
|
34
|
-
if (!registry.has(d.name))
|
|
35
|
-
registerEffect(d);
|
|
36
|
-
}
|
|
37
|
-
const getEffect = (name) => registry.get(name);
|
|
38
|
-
const hasEffect = (name) => registry.has(name);
|
|
39
|
-
/** Registered effects (optionally of one kind), sorted by name. */
|
|
40
|
-
function listEffects(kind) {
|
|
41
|
-
return Array.from(registry.values())
|
|
42
|
-
.filter((d) => !kind || d.kind === kind)
|
|
43
|
-
.sort((a, b) => a.name.localeCompare(b.name));
|
|
44
|
-
}
|
|
45
|
-
const SKIP_BY_DEFAULT = ['loop', 'background', 'cursor'];
|
|
46
|
-
function context(event) {
|
|
47
|
-
const cleanups = [];
|
|
48
|
-
return {
|
|
49
|
-
reduced: prefersReducedMotion(),
|
|
50
|
-
sensitivity: getMotionSensitivity(),
|
|
51
|
-
event,
|
|
52
|
-
animate: animateWithMotion,
|
|
53
|
-
onCleanup: (fn) => cleanups.push(fn),
|
|
54
|
-
cleanups,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Play a registered effect once on `el`. Resolves when it finishes (or
|
|
59
|
-
* immediately for fire-and-forget effects). Unknown names reject.
|
|
60
|
-
*/
|
|
61
|
-
async function playEffect(el, name, options = {}, event) {
|
|
62
|
-
const def = registry.get(name);
|
|
63
|
-
if (!def)
|
|
64
|
-
throw new Error(`[motionary] unknown effect "${name}" — registered: ${Array.from(registry.keys()).join(', ')}`);
|
|
65
|
-
const ctx = context(event);
|
|
66
|
-
if (ctx.reduced && (def.reduced ?? (SKIP_BY_DEFAULT.includes(def.kind) ? 'skip' : 'run')) === 'skip')
|
|
67
|
-
return;
|
|
68
|
-
const out = def.run(el, { ...(def.defaults || {}), ...options }, ctx);
|
|
69
|
-
if (out && typeof out.finished?.then === 'function')
|
|
70
|
-
await out.finished.catch(() => undefined);
|
|
71
|
-
else if (out && typeof out.then === 'function')
|
|
72
|
-
await out;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Bind an effect to a trigger on `el`: `click`, `hover` (pointerenter / focus),
|
|
76
|
-
* `enter` (scrolls into view; `once` by default), `load` (now), `loop`
|
|
77
|
-
* (starts now, cleanup stops it) or `manual` (nothing). Returns an unbind.
|
|
78
|
-
*/
|
|
79
|
-
function bindEffect(el, name, options = {}) {
|
|
80
|
-
const { trigger = 'click', once, ...opts } = options;
|
|
81
|
-
const def = registry.get(name);
|
|
82
|
-
if (!def)
|
|
83
|
-
throw new Error(`[motionary] unknown effect "${name}"`);
|
|
84
|
-
const offs = [];
|
|
85
|
-
let current = null;
|
|
86
|
-
const fire = (e) => {
|
|
87
|
-
const ctx = context(e);
|
|
88
|
-
if (ctx.reduced && (def.reduced ?? (SKIP_BY_DEFAULT.includes(def.kind) ? 'skip' : 'run')) === 'skip')
|
|
89
|
-
return;
|
|
90
|
-
// A persistent effect (returns a cleanup) replaces its previous run instead of stacking.
|
|
91
|
-
current?.();
|
|
92
|
-
current = null;
|
|
93
|
-
const out = def.run(el, { ...(def.defaults || {}), ...opts }, ctx);
|
|
94
|
-
const stops = [...ctx.cleanups, ...(typeof out === 'function' ? [out] : [])];
|
|
95
|
-
if (stops.length)
|
|
96
|
-
current = () => stops.splice(0).forEach((f) => f());
|
|
97
|
-
};
|
|
98
|
-
offs.push(() => {
|
|
99
|
-
current?.();
|
|
100
|
-
current = null;
|
|
101
|
-
});
|
|
102
|
-
const on = (type, opt) => {
|
|
103
|
-
el.addEventListener(type, fire, opt);
|
|
104
|
-
offs.push(() => el.removeEventListener(type, fire, opt));
|
|
105
|
-
};
|
|
106
|
-
if (trigger === 'click')
|
|
107
|
-
on('click', { once: !!once });
|
|
108
|
-
else if (trigger === 'hover')
|
|
109
|
-
(on('pointerenter'), on('focusin'));
|
|
110
|
-
else if (trigger === 'load' || trigger === 'loop')
|
|
111
|
-
fire();
|
|
112
|
-
else if (trigger === 'enter' && typeof IntersectionObserver !== 'undefined') {
|
|
113
|
-
const io = new IntersectionObserver((entries) => {
|
|
114
|
-
for (const en of entries)
|
|
115
|
-
if (en.isIntersecting) {
|
|
116
|
-
fire();
|
|
117
|
-
if (once !== false)
|
|
118
|
-
io.disconnect();
|
|
119
|
-
}
|
|
120
|
-
}, { threshold: 0.15 });
|
|
121
|
-
io.observe(el);
|
|
122
|
-
offs.push(() => io.disconnect());
|
|
123
|
-
}
|
|
124
|
-
return () => offs.splice(0).reverse().forEach((f) => f());
|
|
125
|
-
}
|
|
126
|
-
|
|
127
8
|
function defineFx(tag = 'usa-fx') {
|
|
128
9
|
return defineElement(tag, (Base) => class UsaFx extends Base {
|
|
129
10
|
static get observedAttributes() {
|
|
@@ -271,5 +152,5 @@ function defineFxComponents() {
|
|
|
271
152
|
defineFx();
|
|
272
153
|
}
|
|
273
154
|
|
|
274
|
-
export { BUILTIN_EFFECTS,
|
|
155
|
+
export { BUILTIN_EFFECTS, EFFECT_TRIGGERS, bindEffect, defineFx, defineFxComponents, playEffect, registerBuiltinEffects, registerEffects };
|
|
275
156
|
//# sourceMappingURL=fx.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fx.js","sources":["../../src/components/fx/registry.ts","../../src/components/fx/fx-el.ts","../../src/components/fx/builtins.ts","../../src/components/fx/index.ts"],"sourcesContent":["/**\n * 5.0 — unified plugin-style effect registration. Every effect (built-in or\n * yours) is a plain object registered once and played the same way:\n * `playEffect(el, name)`, `bindEffect(el, name, { trigger })` or\n * `<usa-fx effect=\"name\" trigger=\"click\">`. Effects get a context that\n * already applies reduced motion, motion sensitivity, intensity and the\n * animation budget.\n */\nimport { animateWithMotion, prefersReducedMotion, getMotionSensitivity, type MotionSensitivity, type Cleanup } from '../base';\n\nexport const EFFECT_KINDS = ['enter', 'exit', 'attention', 'click', 'hover', 'card', 'loop', 'page', 'background', 'text', 'cursor', 'scroll'] as const;\nexport type EffectKind = (typeof EFFECT_KINDS)[number];\n\nexport const EFFECT_TRIGGERS = ['click', 'hover', 'enter', 'load', 'loop', 'manual'] as const;\nexport type EffectTrigger = (typeof EFFECT_TRIGGERS)[number];\n\nexport interface EffectContext {\n /** Reduced motion applies (OS setting, `minimal` / `static` sensitivity). */\n readonly reduced: boolean;\n readonly sensitivity: MotionSensitivity;\n /** The triggering event (pointer position for click effects), if any. */\n readonly event?: Event;\n /** `el.animate()` with the library's motion rules (may return `null`). */\n animate(el: Element, keyframes: Keyframe[], options: KeyframeAnimationOptions): Animation | null;\n /** Register teardown for long-running effects (loops, listeners). */\n onCleanup(fn: Cleanup): void;\n}\n\nexport interface EffectDefinition<O extends Record<string, unknown> = Record<string, any>> {\n /** Unique, kebab-case. */\n name: string;\n kind: EffectKind;\n /** One line for docs and the gallery. */\n description?: string;\n /** Option defaults (merged under the caller's options). */\n defaults?: Partial<O>;\n /**\n * Under reduced motion: `'skip'` (do nothing — default for loop, background\n * and cursor effects) or `'run'` (run with `ctx.reduced === true`, the\n * effect degrades itself — default for everything else).\n */\n reduced?: 'skip' | 'run';\n /** Play the effect. Return an Animation / Promise to be awaited, or a cleanup. */\n run(el: HTMLElement, options: O, ctx: EffectContext): void | Cleanup | Animation | null | Promise<unknown>;\n}\n\nconst registry = new Map<string, EffectDefinition>();\n\n/** Register an effect (throws on a duplicate name unless `override`). Returns an unregister function. */\nexport function registerEffect<O extends Record<string, unknown>>(def: EffectDefinition<O>, opts: { override?: boolean } = {}): () => void {\n if (!/^[a-z][a-z0-9-]*$/.test(def.name)) throw new Error(`[motionary] invalid effect name \"${def.name}\"`);\n if (!EFFECT_KINDS.includes(def.kind)) throw new Error(`[motionary] unknown effect kind \"${def.kind}\"`);\n if (registry.has(def.name) && !opts.override) throw new Error(`[motionary] effect \"${def.name}\" is already registered`);\n registry.set(def.name, def as unknown as EffectDefinition);\n return () => {\n if (registry.get(def.name) === (def as unknown)) registry.delete(def.name);\n };\n}\n\n/** Register several effects at once (already-registered names are skipped). */\nexport function registerEffects(defs: EffectDefinition<any>[]): void {\n for (const d of defs) if (!registry.has(d.name)) registerEffect(d);\n}\n\nexport const getEffect = (name: string): EffectDefinition | undefined => registry.get(name);\nexport const hasEffect = (name: string): boolean => registry.has(name);\n/** Registered effects (optionally of one kind), sorted by name. */\nexport function listEffects(kind?: EffectKind): EffectDefinition[] {\n return Array.from(registry.values())\n .filter((d) => !kind || d.kind === kind)\n .sort((a, b) => a.name.localeCompare(b.name));\n}\n\nconst SKIP_BY_DEFAULT: EffectKind[] = ['loop', 'background', 'cursor'];\n\nfunction context(event?: Event): EffectContext & { cleanups: Cleanup[] } {\n const cleanups: Cleanup[] = [];\n return {\n reduced: prefersReducedMotion(),\n sensitivity: getMotionSensitivity(),\n event,\n animate: animateWithMotion,\n onCleanup: (fn) => cleanups.push(fn),\n cleanups,\n };\n}\n\n/**\n * Play a registered effect once on `el`. Resolves when it finishes (or\n * immediately for fire-and-forget effects). Unknown names reject.\n */\nexport async function playEffect(el: HTMLElement, name: string, options: Record<string, unknown> = {}, event?: Event): Promise<void> {\n const def = registry.get(name);\n if (!def) throw new Error(`[motionary] unknown effect \"${name}\" — registered: ${Array.from(registry.keys()).join(', ')}`);\n const ctx = context(event);\n if (ctx.reduced && (def.reduced ?? (SKIP_BY_DEFAULT.includes(def.kind) ? 'skip' : 'run')) === 'skip') return;\n const out = def.run(el, { ...(def.defaults || {}), ...options }, ctx);\n if (out && typeof (out as Animation).finished?.then === 'function') await (out as Animation).finished.catch(() => undefined);\n else if (out && typeof (out as Promise<unknown>).then === 'function') await out;\n}\n\n/**\n * Bind an effect to a trigger on `el`: `click`, `hover` (pointerenter / focus),\n * `enter` (scrolls into view; `once` by default), `load` (now), `loop`\n * (starts now, cleanup stops it) or `manual` (nothing). Returns an unbind.\n */\nexport function bindEffect(el: HTMLElement, name: string, options: Record<string, unknown> & { trigger?: EffectTrigger; once?: boolean } = {}): Cleanup {\n const { trigger = 'click', once, ...opts } = options;\n const def = registry.get(name);\n if (!def) throw new Error(`[motionary] unknown effect \"${name}\"`);\n const offs: Cleanup[] = [];\n let current: Cleanup | null = null;\n const fire = (e?: Event) => {\n const ctx = context(e);\n if (ctx.reduced && (def.reduced ?? (SKIP_BY_DEFAULT.includes(def.kind) ? 'skip' : 'run')) === 'skip') return;\n // A persistent effect (returns a cleanup) replaces its previous run instead of stacking.\n current?.();\n current = null;\n const out = def.run(el, { ...(def.defaults || {}), ...opts }, ctx);\n const stops = [...ctx.cleanups, ...(typeof out === 'function' ? [out as Cleanup] : [])];\n if (stops.length) current = () => stops.splice(0).forEach((f) => f());\n };\n offs.push(() => {\n current?.();\n current = null;\n });\n const on = (type: string, opt?: AddEventListenerOptions) => {\n el.addEventListener(type, fire, opt);\n offs.push(() => el.removeEventListener(type, fire, opt));\n };\n if (trigger === 'click') on('click', { once: !!once });\n else if (trigger === 'hover') (on('pointerenter'), on('focusin'));\n else if (trigger === 'load' || trigger === 'loop') fire();\n else if (trigger === 'enter' && typeof IntersectionObserver !== 'undefined') {\n const io = new IntersectionObserver((entries) => {\n for (const en of entries)\n if (en.isIntersecting) {\n fire();\n if (once !== false) io.disconnect();\n }\n }, { threshold: 0.15 });\n io.observe(el);\n offs.push(() => io.disconnect());\n }\n return () => offs.splice(0).reverse().forEach((f) => f());\n}\n","import { defineElement, type UsaElement } from '../base';\nimport { bindEffect, playEffect, EFFECT_TRIGGERS, type EffectTrigger } from './registry';\n\n/**\n * `<usa-fx effect=\"pop\" trigger=\"click\">` — plays any registered effect\n * (`registerEffect()`) on its first element child (or itself with `self`).\n * `trigger`: `click` (default) · `hover` · `enter` · `load` · `loop` · `manual`;\n * `options` (JSON) is passed to the effect; `once`. Method `play()`.\n */\nexport interface UsaFxElement extends UsaElement {\n readonly target: HTMLElement;\n play(): Promise<void>;\n}\n\nexport function defineFx(tag = 'usa-fx'): CustomElementConstructor | undefined {\n return defineElement(tag, (Base) =>\n class UsaFx extends Base {\n static get observedAttributes(): string[] {\n return ['effect', 'trigger', 'options'];\n }\n get target(): HTMLElement {\n return this.flag('self') ? this : ((this.firstElementChild as HTMLElement) || this);\n }\n private opts(): Record<string, unknown> {\n try {\n return JSON.parse(this.str('options', '{}')) || {};\n } catch {\n return {};\n }\n }\n play(): Promise<void> {\n return playEffect(this.target, this.str('effect', 'pop'), this.opts()).catch(() => undefined);\n }\n mount(): void {\n if (!this.style.display) this.style.display = 'inline-block';\n const name = this.str('effect', 'pop');\n const t = this.str('trigger', 'click') as EffectTrigger;\n try {\n this.onCleanup(bindEffect(this.target, name, { ...this.opts(), trigger: EFFECT_TRIGGERS.includes(t) ? t : 'click', once: this.flag('once') }));\n this.removeAttribute('data-unknown');\n } catch {\n this.setAttribute('data-unknown', name); // not registered (yet)\n }\n }\n }\n );\n}\n","/**\n * 5.0 built-in effects, all registered through `registerEffect()`:\n * every timeline preset as an `enter` effect, attention seekers, and the\n * click effects (burst, confetti, shake, ripple).\n */\nimport { TIMELINE_PRESETS } from '../timeline/core';\nimport { burst, confetti, shake } from '../click/fx';\nimport type { EffectDefinition } from './registry';\n\nconst enter: EffectDefinition[] = Object.entries(TIMELINE_PRESETS).map(([name, frames]) => ({\n name,\n kind: 'enter' as const,\n description: `Entrance: ${name} (same keyframes as the timeline preset).`,\n defaults: { duration: 600, delay: 0, easing: 'cubic-bezier(0.22, 1, 0.36, 1)' },\n run: (el: HTMLElement, o: any, ctx) => ctx.animate(el, ctx.reduced ? [{ opacity: 0 }, { opacity: 1 }] : frames, { duration: o.duration, delay: o.delay, easing: o.easing, fill: 'backwards' }),\n}));\n\nconst A = (name: string, description: string, frames: Keyframe[], duration = 700, easing = 'ease-in-out'): EffectDefinition => ({\n name,\n kind: 'attention',\n description,\n defaults: { duration, iterations: 1 },\n run: (el, o: any, ctx) => (ctx.reduced ? ctx.animate(el, [{ opacity: 1 }, { opacity: 0.6 }, { opacity: 1 }], { duration: 400 }) : ctx.animate(el, frames, { duration: o.duration, easing, iterations: o.iterations })),\n});\n\nconst attention: EffectDefinition[] = [\n A('pulse', 'Gentle scale pulse.', [{ transform: 'scale(1)' }, { transform: 'scale(1.08)' }, { transform: 'scale(1)' }], 600),\n A('pop', 'Quick overshoot pop.', [{ transform: 'scale(1)' }, { transform: 'scale(1.18)', offset: 0.4 }, { transform: 'scale(0.96)', offset: 0.7 }, { transform: 'scale(1)' }], 450, 'cubic-bezier(0.34, 1.56, 0.64, 1)'),\n A('jelly', 'Rubbery squash-and-stretch.', [{ transform: 'scale(1,1)' }, { transform: 'scale(1.25,0.75)', offset: 0.3 }, { transform: 'scale(0.75,1.25)', offset: 0.4 }, { transform: 'scale(1.15,0.85)', offset: 0.5 }, { transform: 'scale(0.95,1.05)', offset: 0.65 }, { transform: 'scale(1.05,0.95)', offset: 0.75 }, { transform: 'scale(1,1)' }], 900),\n A('wiggle', 'Playful rotate wiggle.', [{ transform: 'rotate(0)' }, { transform: 'rotate(-8deg)', offset: 0.2 }, { transform: 'rotate(7deg)', offset: 0.4 }, { transform: 'rotate(-5deg)', offset: 0.6 }, { transform: 'rotate(3deg)', offset: 0.8 }, { transform: 'rotate(0)' }], 650),\n A('heartbeat', 'Double-beat heart pulse.', [{ transform: 'scale(1)' }, { transform: 'scale(1.2)', offset: 0.14 }, { transform: 'scale(1)', offset: 0.28 }, { transform: 'scale(1.2)', offset: 0.42 }, { transform: 'scale(1)', offset: 0.7 }], 1100),\n A('bounce', 'Hop up and settle with a squash.', [{ transform: 'translateY(0) scale(1,1)' }, { transform: 'translateY(-22px) scale(0.95,1.05)', offset: 0.35 }, { transform: 'translateY(0) scale(1.08,0.92)', offset: 0.6 }, { transform: 'translateY(-6px) scale(1,1)', offset: 0.8 }, { transform: 'translateY(0) scale(1,1)' }], 800),\n A('flash', 'Two soft flashes (well under 3 per second).', [{ opacity: 1 }, { opacity: 0.25, offset: 0.25 }, { opacity: 1, offset: 0.5 }, { opacity: 0.25, offset: 0.75 }, { opacity: 1 }], 1400),\n A('tada', 'Scale + shake celebration.', [{ transform: 'scale(1) rotate(0)' }, { transform: 'scale(0.9) rotate(-3deg)', offset: 0.1 }, { transform: 'scale(1.1) rotate(3deg)', offset: 0.3 }, { transform: 'scale(1.1) rotate(-3deg)', offset: 0.5 }, { transform: 'scale(1.1) rotate(3deg)', offset: 0.7 }, { transform: 'scale(1) rotate(0)' }], 1000),\n];\n\nconst click: EffectDefinition[] = [\n {\n name: 'burst',\n kind: 'click',\n description: 'Particle burst from the click point (or `x` / `y`, or the element center).',\n defaults: { count: 12 },\n run: (el, o: any, ctx) => {\n if (ctx.reduced) return;\n const r = el.getBoundingClientRect();\n const e = ctx.event as PointerEvent | undefined;\n burst(o.x ?? e?.clientX ?? r.left + r.width / 2, o.y ?? e?.clientY ?? r.top + r.height / 2, o);\n },\n },\n {\n name: 'confetti',\n kind: 'click',\n description: 'Confetti cannon from the element.',\n defaults: { count: 80 },\n run: (el, o: any, ctx) => {\n if (ctx.reduced) return;\n const r = el.getBoundingClientRect();\n confetti({ x: r.left + r.width / 2, y: r.top + r.height / 2, ...o });\n },\n },\n {\n name: 'shake',\n kind: 'attention',\n description: 'Horizontal \"no\" shake (errors, wrong password).',\n defaults: { intensity: 8, duration: 480 },\n run: (el, o: any, ctx) => (ctx.reduced ? ctx.animate(el, [{ opacity: 1 }, { opacity: 0.5 }, { opacity: 1 }], { duration: 300 }) : shake(el, o.intensity, o.duration)),\n },\n {\n name: 'ripple',\n kind: 'click',\n description: 'Material-style ink ripple from the pointer.',\n defaults: { color: 'currentColor', duration: 600 },\n run: (el, o: any, ctx) => {\n if (ctx.reduced) return;\n const r = el.getBoundingClientRect();\n const e = ctx.event as PointerEvent | undefined;\n const d = Math.hypot(r.width, r.height) * 2;\n const dot = document.createElement('span');\n dot.setAttribute('aria-hidden', 'true');\n Object.assign(dot.style, { position: 'absolute', left: `${(e?.clientX ?? r.left + r.width / 2) - r.left - d / 2}px`, top: `${(e?.clientY ?? r.top + r.height / 2) - r.top - d / 2}px`, width: `${d}px`, height: `${d}px`, borderRadius: '50%', background: o.color, opacity: '0.25', pointerEvents: 'none' });\n if (getComputedStyle(el).position === 'static') el.style.position = 'relative';\n el.style.overflow ||= 'hidden';\n el.appendChild(dot);\n const a = ctx.animate(dot, [{ transform: 'scale(0)', opacity: 0.3 }, { transform: 'scale(1)', opacity: 0 }], { duration: o.duration, easing: 'ease-out' });\n const done = () => dot.remove();\n if (a) a.finished.then(done, done);\n else done();\n return a;\n },\n },\n];\n\n/** Every built-in 5.0 effect definition. */\nexport const BUILTIN_EFFECTS: EffectDefinition[] = [...enter, ...attention, ...click];\n","/**\n * motionary/components/fx — unified plugin-style effects (5.0).\n * `registerEffect({ name, kind, run })`, `playEffect(el, name)`,\n * `bindEffect(el, name, { trigger })`, `<usa-fx effect trigger>`. Built-ins:\n * every timeline preset (`enter`), `pulse` · `pop` · `jelly` · `wiggle` ·\n * `heartbeat` · `bounce` · `flash` · `tada` · `shake` (attention),\n * `burst` · `confetti` · `ripple` (click). More packs: `motionary/components/effects`.\n */\nimport { defineFx, type UsaFxElement } from './fx-el';\nimport { registerEffects } from './registry';\nimport { BUILTIN_EFFECTS } from './builtins';\n\nexport { defineFx };\nexport { registerEffect, registerEffects, playEffect, bindEffect, getEffect, hasEffect, listEffects, EFFECT_KINDS, EFFECT_TRIGGERS } from './registry';\nexport type { EffectDefinition, EffectContext, EffectKind, EffectTrigger } from './registry';\nexport { BUILTIN_EFFECTS };\nexport type { UsaFxElement };\n\n/** Register the built-in effects (idempotent; `defineFxComponents()` calls it). */\nexport function registerBuiltinEffects(): void {\n registerEffects(BUILTIN_EFFECTS);\n}\n\n/** Register every component of this category under its default tag (+ the built-in effects). */\nexport function defineFxComponents(): void {\n registerBuiltinEffects();\n defineFx();\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'usa-fx': UsaFxElement;\n }\n}\n"],"names":[],"mappings":";;;;;AAAA;;;;;;;AAOG;AAGI,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ;AAGtI,MAAM,eAAe,GAA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C,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC;;AAC7B,gBAAA,IAAI,EAAE;AACX,YAAA,OAAO,CAAC;QACV,CAAC;AACF,KAAA;CACF;AAED;AACO,MAAM,eAAe,GAAuB,CAAC,GAAG,KAAK,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK;;AC7FpF;;;;;;;AAOG;AAWH;SACgB,sBAAsB,GAAA;IACpC,eAAe,CAAC,eAAe,CAAC;AAClC;AAEA;SACgB,kBAAkB,GAAA;AAChC,IAAA,sBAAsB,EAAE;AACxB,IAAA,QAAQ,EAAE;AACZ;;;;"}
|
|
1
|
+
{"version":3,"file":"fx.js","sources":["../../src/components/fx/fx-el.ts","../../src/components/fx/builtins.ts","../../src/components/fx/index.ts"],"sourcesContent":["import { defineElement, type UsaElement } from '../base';\nimport { bindEffect, playEffect, EFFECT_TRIGGERS, type EffectTrigger } from './registry';\n\n/**\n * `<usa-fx effect=\"pop\" trigger=\"click\">` — plays any registered effect\n * (`registerEffect()`) on its first element child (or itself with `self`).\n * `trigger`: `click` (default) · `hover` · `enter` · `load` · `loop` · `manual`;\n * `options` (JSON) is passed to the effect; `once`. Method `play()`.\n */\nexport interface UsaFxElement extends UsaElement {\n readonly target: HTMLElement;\n play(): Promise<void>;\n}\n\nexport function defineFx(tag = 'usa-fx'): CustomElementConstructor | undefined {\n return defineElement(tag, (Base) =>\n class UsaFx extends Base {\n static get observedAttributes(): string[] {\n return ['effect', 'trigger', 'options'];\n }\n get target(): HTMLElement {\n return this.flag('self') ? this : ((this.firstElementChild as HTMLElement) || this);\n }\n private opts(): Record<string, unknown> {\n try {\n return JSON.parse(this.str('options', '{}')) || {};\n } catch {\n return {};\n }\n }\n play(): Promise<void> {\n return playEffect(this.target, this.str('effect', 'pop'), this.opts()).catch(() => undefined);\n }\n mount(): void {\n if (!this.style.display) this.style.display = 'inline-block';\n const name = this.str('effect', 'pop');\n const t = this.str('trigger', 'click') as EffectTrigger;\n try {\n this.onCleanup(bindEffect(this.target, name, { ...this.opts(), trigger: EFFECT_TRIGGERS.includes(t) ? t : 'click', once: this.flag('once') }));\n this.removeAttribute('data-unknown');\n } catch {\n this.setAttribute('data-unknown', name); // not registered (yet)\n }\n }\n }\n );\n}\n","/**\n * 5.0 built-in effects, all registered through `registerEffect()`:\n * every timeline preset as an `enter` effect, attention seekers, and the\n * click effects (burst, confetti, shake, ripple).\n */\nimport { TIMELINE_PRESETS } from '../timeline/core';\nimport { burst, confetti, shake } from '../click/fx';\nimport type { EffectDefinition } from './registry';\n\nconst enter: EffectDefinition[] = Object.entries(TIMELINE_PRESETS).map(([name, frames]) => ({\n name,\n kind: 'enter' as const,\n description: `Entrance: ${name} (same keyframes as the timeline preset).`,\n defaults: { duration: 600, delay: 0, easing: 'cubic-bezier(0.22, 1, 0.36, 1)' },\n run: (el: HTMLElement, o: any, ctx) => ctx.animate(el, ctx.reduced ? [{ opacity: 0 }, { opacity: 1 }] : frames, { duration: o.duration, delay: o.delay, easing: o.easing, fill: 'backwards' }),\n}));\n\nconst A = (name: string, description: string, frames: Keyframe[], duration = 700, easing = 'ease-in-out'): EffectDefinition => ({\n name,\n kind: 'attention',\n description,\n defaults: { duration, iterations: 1 },\n run: (el, o: any, ctx) => (ctx.reduced ? ctx.animate(el, [{ opacity: 1 }, { opacity: 0.6 }, { opacity: 1 }], { duration: 400 }) : ctx.animate(el, frames, { duration: o.duration, easing, iterations: o.iterations })),\n});\n\nconst attention: EffectDefinition[] = [\n A('pulse', 'Gentle scale pulse.', [{ transform: 'scale(1)' }, { transform: 'scale(1.08)' }, { transform: 'scale(1)' }], 600),\n A('pop', 'Quick overshoot pop.', [{ transform: 'scale(1)' }, { transform: 'scale(1.18)', offset: 0.4 }, { transform: 'scale(0.96)', offset: 0.7 }, { transform: 'scale(1)' }], 450, 'cubic-bezier(0.34, 1.56, 0.64, 1)'),\n A('jelly', 'Rubbery squash-and-stretch.', [{ transform: 'scale(1,1)' }, { transform: 'scale(1.25,0.75)', offset: 0.3 }, { transform: 'scale(0.75,1.25)', offset: 0.4 }, { transform: 'scale(1.15,0.85)', offset: 0.5 }, { transform: 'scale(0.95,1.05)', offset: 0.65 }, { transform: 'scale(1.05,0.95)', offset: 0.75 }, { transform: 'scale(1,1)' }], 900),\n A('wiggle', 'Playful rotate wiggle.', [{ transform: 'rotate(0)' }, { transform: 'rotate(-8deg)', offset: 0.2 }, { transform: 'rotate(7deg)', offset: 0.4 }, { transform: 'rotate(-5deg)', offset: 0.6 }, { transform: 'rotate(3deg)', offset: 0.8 }, { transform: 'rotate(0)' }], 650),\n A('heartbeat', 'Double-beat heart pulse.', [{ transform: 'scale(1)' }, { transform: 'scale(1.2)', offset: 0.14 }, { transform: 'scale(1)', offset: 0.28 }, { transform: 'scale(1.2)', offset: 0.42 }, { transform: 'scale(1)', offset: 0.7 }], 1100),\n A('bounce', 'Hop up and settle with a squash.', [{ transform: 'translateY(0) scale(1,1)' }, { transform: 'translateY(-22px) scale(0.95,1.05)', offset: 0.35 }, { transform: 'translateY(0) scale(1.08,0.92)', offset: 0.6 }, { transform: 'translateY(-6px) scale(1,1)', offset: 0.8 }, { transform: 'translateY(0) scale(1,1)' }], 800),\n A('flash', 'Two soft flashes (well under 3 per second).', [{ opacity: 1 }, { opacity: 0.25, offset: 0.25 }, { opacity: 1, offset: 0.5 }, { opacity: 0.25, offset: 0.75 }, { opacity: 1 }], 1400),\n A('tada', 'Scale + shake celebration.', [{ transform: 'scale(1) rotate(0)' }, { transform: 'scale(0.9) rotate(-3deg)', offset: 0.1 }, { transform: 'scale(1.1) rotate(3deg)', offset: 0.3 }, { transform: 'scale(1.1) rotate(-3deg)', offset: 0.5 }, { transform: 'scale(1.1) rotate(3deg)', offset: 0.7 }, { transform: 'scale(1) rotate(0)' }], 1000),\n];\n\nconst click: EffectDefinition[] = [\n {\n name: 'burst',\n kind: 'click',\n description: 'Particle burst from the click point (or `x` / `y`, or the element center).',\n defaults: { count: 12 },\n run: (el, o: any, ctx) => {\n if (ctx.reduced) return;\n const r = el.getBoundingClientRect();\n const e = ctx.event as PointerEvent | undefined;\n burst(o.x ?? e?.clientX ?? r.left + r.width / 2, o.y ?? e?.clientY ?? r.top + r.height / 2, o);\n },\n },\n {\n name: 'confetti',\n kind: 'click',\n description: 'Confetti cannon from the element.',\n defaults: { count: 80 },\n run: (el, o: any, ctx) => {\n if (ctx.reduced) return;\n const r = el.getBoundingClientRect();\n confetti({ x: r.left + r.width / 2, y: r.top + r.height / 2, ...o });\n },\n },\n {\n name: 'shake',\n kind: 'attention',\n description: 'Horizontal \"no\" shake (errors, wrong password).',\n defaults: { intensity: 8, duration: 480 },\n run: (el, o: any, ctx) => (ctx.reduced ? ctx.animate(el, [{ opacity: 1 }, { opacity: 0.5 }, { opacity: 1 }], { duration: 300 }) : shake(el, o.intensity, o.duration)),\n },\n {\n name: 'ripple',\n kind: 'click',\n description: 'Material-style ink ripple from the pointer.',\n defaults: { color: 'currentColor', duration: 600 },\n run: (el, o: any, ctx) => {\n if (ctx.reduced) return;\n const r = el.getBoundingClientRect();\n const e = ctx.event as PointerEvent | undefined;\n const d = Math.hypot(r.width, r.height) * 2;\n const dot = document.createElement('span');\n dot.setAttribute('aria-hidden', 'true');\n Object.assign(dot.style, { position: 'absolute', left: `${(e?.clientX ?? r.left + r.width / 2) - r.left - d / 2}px`, top: `${(e?.clientY ?? r.top + r.height / 2) - r.top - d / 2}px`, width: `${d}px`, height: `${d}px`, borderRadius: '50%', background: o.color, opacity: '0.25', pointerEvents: 'none' });\n if (getComputedStyle(el).position === 'static') el.style.position = 'relative';\n el.style.overflow ||= 'hidden';\n el.appendChild(dot);\n const a = ctx.animate(dot, [{ transform: 'scale(0)', opacity: 0.3 }, { transform: 'scale(1)', opacity: 0 }], { duration: o.duration, easing: 'ease-out' });\n const done = () => dot.remove();\n if (a) a.finished.then(done, done);\n else done();\n return a;\n },\n },\n];\n\n/** Every built-in 5.0 effect definition. */\nexport const BUILTIN_EFFECTS: EffectDefinition[] = [...enter, ...attention, ...click];\n","/**\n * motionary/components/fx — unified plugin-style effects (5.0).\n * `registerEffect({ name, kind, run })`, `playEffect(el, name)`,\n * `bindEffect(el, name, { trigger })`, `<usa-fx effect trigger>`. Built-ins:\n * every timeline preset (`enter`), `pulse` · `pop` · `jelly` · `wiggle` ·\n * `heartbeat` · `bounce` · `flash` · `tada` · `shake` (attention),\n * `burst` · `confetti` · `ripple` (click). More packs: `motionary/components/effects`.\n */\nimport { defineFx, type UsaFxElement } from './fx-el';\nimport { registerEffects } from './registry';\nimport { BUILTIN_EFFECTS } from './builtins';\n\nexport { defineFx };\nexport { registerEffect, registerEffects, playEffect, bindEffect, getEffect, hasEffect, listEffects, EFFECT_KINDS, EFFECT_TRIGGERS } from './registry';\nexport type { EffectDefinition, EffectContext, EffectKind, EffectTrigger } from './registry';\nexport { BUILTIN_EFFECTS };\nexport type { UsaFxElement };\n\n/** Register the built-in effects (idempotent; `defineFxComponents()` calls it). */\nexport function registerBuiltinEffects(): void {\n registerEffects(BUILTIN_EFFECTS);\n}\n\n/** Register every component of this category under its default tag (+ the built-in effects). */\nexport function defineFxComponents(): void {\n registerBuiltinEffects();\n defineFx();\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'usa-fx': UsaFxElement;\n }\n}\n"],"names":[],"mappings":";;;;;;;AAcM,SAAU,QAAQ,CAAC,GAAG,GAAG,QAAQ,EAAA;AACrC,IAAA,OAAO,aAAa,CAAC,GAAG,EAAE,CAAC,IAAI,KAC7B,MAAM,KAAM,SAAQ,IAAI,CAAA;AACtB,QAAA,WAAW,kBAAkB,GAAA;AAC3B,YAAA,OAAO,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC;QACzC;AACA,QAAA,IAAI,MAAM,GAAA;YACR,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,IAAK,IAAI,CAAC,iBAAiC,IAAI,IAAI,CAAC;QACrF;QACQ,IAAI,GAAA;AACV,YAAA,IAAI;AACF,gBAAA,OA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AAC,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;YAC1J,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,MAAM,EAAE;AAC/B,YAAA,IAAI,CAAC;gBAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC;;AAC7B,gBAAA,IAAI,EAAE;AACX,YAAA,OAAO,CAAC;QACV,CAAC;AACF,KAAA;CACF;AAED;AACO,MAAM,eAAe,GAAuB,CAAC,GAAG,KAAK,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK;;AC7FpF;;;;;;;AAOG;AAWH;SACgB,sBAAsB,GAAA;IACpC,eAAe,CAAC,eAAe,CAAC;AAClC;AAEA;SACgB,kBAAkB,GAAA;AAChC,IAAA,sBAAsB,EAAE;AACxB,IAAA,QAAQ,EAAE;AACZ;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var components_fxGpu = require('../chunks/gpu-BBRLgEzM.cjs');
|
|
4
|
+
var components_fxText = require('./fx-text.cjs');
|
|
5
|
+
require('../chunks/registry-DehBVRDV.cjs');
|
|
6
|
+
require('../chunks/base-BaQV-2ha.cjs');
|
|
7
|
+
require('../chunks/generative-BHIj-NU0.cjs');
|
|
8
|
+
require('../chunks/shared-jkgRH-Hx.cjs');
|
|
9
|
+
|
|
10
|
+
/** The 6.x effect packs by name. */
|
|
11
|
+
const FX2_PACKS = {
|
|
12
|
+
gpu: components_fxGpu.GPU_FX,
|
|
13
|
+
text: components_fxText.TEXT3_FX,
|
|
14
|
+
};
|
|
15
|
+
/** Register every 6.x pack (idempotent). */
|
|
16
|
+
function registerFx2() {
|
|
17
|
+
components_fxGpu.registerGpuEffects();
|
|
18
|
+
components_fxText.registerTextEffects3();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
exports.GLSL_HEAD = components_fxGpu.GLSL_HEAD;
|
|
22
|
+
exports.GPU_FX = components_fxGpu.GPU_FX;
|
|
23
|
+
exports.fieldFallback = components_fxGpu.fieldFallback;
|
|
24
|
+
exports.registerGpuEffects = components_fxGpu.registerGpuEffects;
|
|
25
|
+
exports.shaderBackground = components_fxGpu.shaderBackground;
|
|
26
|
+
exports.supportsWebGL2 = components_fxGpu.supportsWebGL2;
|
|
27
|
+
exports.TEXT3_FX = components_fxText.TEXT3_FX;
|
|
28
|
+
exports.registerTextEffects3 = components_fxText.registerTextEffects3;
|
|
29
|
+
exports.splitChars = components_fxText.splitChars;
|
|
30
|
+
exports.FX2_PACKS = FX2_PACKS;
|
|
31
|
+
exports.registerFx2 = registerFx2;
|
|
32
|
+
//# sourceMappingURL=fx2.cjs.map
|
|
@@ -0,0 +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';\nimport { GPU_FX, registerGpuEffects } from './gpu';\nimport { TEXT3_FX, registerTextEffects3, splitChars } from './text3';\n\nexport { GPU_FX, registerGpuEffects, TEXT3_FX, registerTextEffects3, splitChars };\nexport { shaderBackground, supportsWebGL2, fieldFallback, GLSL_HEAD } from './gl';\nexport type { ShaderSpec } from './gl';\n\n/** The 6.x effect packs by name. */\nexport const FX2_PACKS: Record<string, EffectDefinition[]> = {\n gpu: GPU_FX,\n text: TEXT3_FX,\n};\n\n/** Register every 6.x pack (idempotent). */\nexport function registerFx2(): void {\n registerGpuEffects();\n registerTextEffects3();\n}\n"],"names":["GPU_FX","TEXT3_FX","registerGpuEffects","registerTextEffects3"],"mappings":";;;;;;;;;AAaA;AACO,MAAM,SAAS,GAAuC;AAC3D,IAAA,GAAG,EAAEA,uBAAM;AACX,IAAA,IAAI,EAAEC,0BAAQ;;AAGhB;SACgB,WAAW,GAAA;AACzB,IAAAC,mCAAkB,EAAE;AACpB,IAAAC,sCAAoB,EAAE;AACxB;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,162 @@
|
|
|
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
|
+
* 6.2 — GPU effect pack (`motionary/components/fx-gpu`), registered through
|
|
46
|
+
* `registerEffect()`:
|
|
47
|
+
*
|
|
48
|
+
* - WebGL2 shaders with a Canvas 2D fallback (kind `background`): `fluid`
|
|
49
|
+
* (domain-warped fluid that swirls around the pointer), `smoke`, `fire`,
|
|
50
|
+
* `ink` (ink blooming in water), `fireflies`.
|
|
51
|
+
* - Canvas 2D particles (kind `background`): `sakura` (falling cherry
|
|
52
|
+
* petals), `leaves` (tumbling autumn leaves).
|
|
53
|
+
* - `splash` (kind `click`): droplets + a ring burst from the pointer.
|
|
54
|
+
*
|
|
55
|
+
* Every background renders only while visible, lowers its resolution when
|
|
56
|
+
* frames are slow, and draws one static frame under reduced motion.
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
declare const GPU_FX: EffectDefinition[];
|
|
60
|
+
/** Register the 6.2 GPU pack (idempotent). */
|
|
61
|
+
declare function registerGpuEffects(): void;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* 6.3 — Text effects 3.0 (`motionary/components/fx-text`), registered through
|
|
65
|
+
* `registerEffect()`:
|
|
66
|
+
*
|
|
67
|
+
* - `liquid-text` (loop) — the text ripples like liquid (animated SVG
|
|
68
|
+
* turbulence + displacement filter).
|
|
69
|
+
* - `neon-write` (text) — letters flicker on one by one like a neon sign
|
|
70
|
+
* being switched on, then keep a soft glow.
|
|
71
|
+
* - `particle-text` (text) — particles fly in from around the element and
|
|
72
|
+
* assemble into the glyphs, then hand over to the real text.
|
|
73
|
+
* - `glitch-text` (text) — RGB-split slices jump sideways for a moment.
|
|
74
|
+
* - `text-trail` (cursor) — the letters of a word fall off the pointer.
|
|
75
|
+
* - `font-breathe` (loop) — a variable-font weight wave breathes through the text.
|
|
76
|
+
* - `flip-chars` (text) — every character flips up in 3D, staggered.
|
|
77
|
+
*
|
|
78
|
+
* Splitting keeps a visually hidden copy for screen readers (the animated
|
|
79
|
+
* characters are `aria-hidden`). Reduced motion: loops and the trail are
|
|
80
|
+
* skipped, one-shot effects show the final state without movement.
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
/** Split `el`'s text into `aria-hidden` inline-block characters (idempotent). Returns them. */
|
|
84
|
+
declare function splitChars(el: HTMLElement): HTMLElement[];
|
|
85
|
+
declare const TEXT3_FX: EffectDefinition[];
|
|
86
|
+
/** Register the 6.3 text pack (idempotent). */
|
|
87
|
+
declare function registerTextEffects3(): void;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* 5.5 — generative backgrounds on Canvas 2D, registered through
|
|
91
|
+
* `registerEffect()` (kind `background`): `flow-field`, `voronoi`,
|
|
92
|
+
* `mesh-gradient`, `starfield`, `metaballs`, `contours`.
|
|
93
|
+
*
|
|
94
|
+
* Shared runner (`canvasBackground()`): a canvas behind the element's content
|
|
95
|
+
* (`aria-hidden`, pointer-transparent), rendering only while visible
|
|
96
|
+
* (IntersectionObserver) and the tab is shown, with adaptive quality — the
|
|
97
|
+
* render scale drops when frames get slow and recovers when they are fast.
|
|
98
|
+
* Reduced motion: one static frame, no loop.
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
interface GenFrame {
|
|
102
|
+
ctx: CanvasRenderingContext2D;
|
|
103
|
+
/** CSS-pixel size of the canvas. */
|
|
104
|
+
w: number;
|
|
105
|
+
h: number;
|
|
106
|
+
/** Seconds since start (0 for the static reduced-motion frame). */
|
|
107
|
+
t: number;
|
|
108
|
+
/** Render scale 0.35–1 (adaptive quality). */
|
|
109
|
+
quality: number;
|
|
110
|
+
/** Per-effect state, created by `init`. */
|
|
111
|
+
state: any;
|
|
112
|
+
/** Merged options. */
|
|
113
|
+
o: any;
|
|
114
|
+
}
|
|
115
|
+
interface GenerativeSpec {
|
|
116
|
+
init?: (w: number, h: number, o: any) => any;
|
|
117
|
+
draw: (f: GenFrame) => void;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* 6.2 — tiny WebGL2 full-screen shader runner with a Canvas 2D fallback, shared
|
|
122
|
+
* by the 6.x GPU effect packs. One canvas behind the element (aria-hidden,
|
|
123
|
+
* pointer-transparent), renders only while visible and the tab is shown,
|
|
124
|
+
* adaptive resolution, pointer uniform, and a static first frame under reduced
|
|
125
|
+
* motion. No WebGL2 (or a lost context / compile error) → the Canvas 2D
|
|
126
|
+
* `fallback` spec runs through `canvasBackground()` instead.
|
|
127
|
+
* `el.dataset.usaBackend` tells which one is active: `webgl2` or `canvas`.
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
/** GLSL shared by every shader: uniforms, hash, value noise, fbm. */
|
|
131
|
+
declare const GLSL_HEAD = "#version 300 es\nprecision highp float;\nuniform vec2 u_res;uniform float u_t;uniform vec3 u_c0,u_c1,u_c2;uniform vec2 u_ptr;uniform float u_speed,u_scale;\nout vec4 o;\nfloat h(vec2 p){return fract(sin(dot(p,vec2(127.1,311.7)))*43758.5453);}\nfloat n(vec2 p){vec2 i=floor(p),f=fract(p);f=f*f*(3.-2.*f);return mix(mix(h(i),h(i+vec2(1,0)),f.x),mix(h(i+vec2(0,1)),h(i+1.),f.x),f.y);}\nfloat fbm(vec2 p){float v=0.,a=.5;for(int k=0;k<5;k++){v+=a*n(p);p=p*2.03+vec2(1.7,9.2);a*=.5;}return v;}\n";
|
|
132
|
+
interface ShaderSpec {
|
|
133
|
+
/** GLSL body of `main()`: `uv` (0–1), `p` (aspect-corrected, scaled), `t` (s × speed) are in scope; write `o`. */
|
|
134
|
+
body: string;
|
|
135
|
+
/** Canvas 2D fallback. */
|
|
136
|
+
fallback: GenerativeSpec;
|
|
137
|
+
}
|
|
138
|
+
declare function supportsWebGL2(): boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Mount a shader background behind `el` (options: `colors` [3 hex], `speed`,
|
|
141
|
+
* `scale`, `quality`, `backend` = `'auto' | 'webgl2' | 'canvas'`). Returns the cleanup.
|
|
142
|
+
*/
|
|
143
|
+
declare function shaderBackground(el: HTMLElement, fx: EffectContext, spec: ShaderSpec, o: any): () => void;
|
|
144
|
+
/**
|
|
145
|
+
* Canvas 2D fallback for a scalar field: `color(x, y, t)` (x, y in 0–1)
|
|
146
|
+
* returns `[r, g, b]` (0–255), sampled on a coarse grid and scaled up smoothly.
|
|
147
|
+
*/
|
|
148
|
+
declare function fieldFallback(color: (x: number, y: number, t: number, o: any) => [number, number, number], cell?: number): GenerativeSpec;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* The 6.x effect packs, one entry each (`motionary/components/fx-gpu`, …) so
|
|
152
|
+
* their size budgets stay separate. This module (`registerFx2()`) registers
|
|
153
|
+
* them all — used by dist/widgets.umd.js and the showcase.
|
|
154
|
+
*/
|
|
155
|
+
|
|
156
|
+
/** The 6.x effect packs by name. */
|
|
157
|
+
declare const FX2_PACKS: Record<string, EffectDefinition[]>;
|
|
158
|
+
/** Register every 6.x pack (idempotent). */
|
|
159
|
+
declare function registerFx2(): void;
|
|
160
|
+
|
|
161
|
+
export { FX2_PACKS, GLSL_HEAD, GPU_FX, TEXT3_FX, fieldFallback, registerFx2, registerGpuEffects, registerTextEffects3, shaderBackground, splitChars, supportsWebGL2 };
|
|
162
|
+
export type { ShaderSpec };
|
|
@@ -0,0 +1,162 @@
|
|
|
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
|
+
* 6.2 — GPU effect pack (`motionary/components/fx-gpu`), registered through
|
|
46
|
+
* `registerEffect()`:
|
|
47
|
+
*
|
|
48
|
+
* - WebGL2 shaders with a Canvas 2D fallback (kind `background`): `fluid`
|
|
49
|
+
* (domain-warped fluid that swirls around the pointer), `smoke`, `fire`,
|
|
50
|
+
* `ink` (ink blooming in water), `fireflies`.
|
|
51
|
+
* - Canvas 2D particles (kind `background`): `sakura` (falling cherry
|
|
52
|
+
* petals), `leaves` (tumbling autumn leaves).
|
|
53
|
+
* - `splash` (kind `click`): droplets + a ring burst from the pointer.
|
|
54
|
+
*
|
|
55
|
+
* Every background renders only while visible, lowers its resolution when
|
|
56
|
+
* frames are slow, and draws one static frame under reduced motion.
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
declare const GPU_FX: EffectDefinition[];
|
|
60
|
+
/** Register the 6.2 GPU pack (idempotent). */
|
|
61
|
+
declare function registerGpuEffects(): void;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* 6.3 — Text effects 3.0 (`motionary/components/fx-text`), registered through
|
|
65
|
+
* `registerEffect()`:
|
|
66
|
+
*
|
|
67
|
+
* - `liquid-text` (loop) — the text ripples like liquid (animated SVG
|
|
68
|
+
* turbulence + displacement filter).
|
|
69
|
+
* - `neon-write` (text) — letters flicker on one by one like a neon sign
|
|
70
|
+
* being switched on, then keep a soft glow.
|
|
71
|
+
* - `particle-text` (text) — particles fly in from around the element and
|
|
72
|
+
* assemble into the glyphs, then hand over to the real text.
|
|
73
|
+
* - `glitch-text` (text) — RGB-split slices jump sideways for a moment.
|
|
74
|
+
* - `text-trail` (cursor) — the letters of a word fall off the pointer.
|
|
75
|
+
* - `font-breathe` (loop) — a variable-font weight wave breathes through the text.
|
|
76
|
+
* - `flip-chars` (text) — every character flips up in 3D, staggered.
|
|
77
|
+
*
|
|
78
|
+
* Splitting keeps a visually hidden copy for screen readers (the animated
|
|
79
|
+
* characters are `aria-hidden`). Reduced motion: loops and the trail are
|
|
80
|
+
* skipped, one-shot effects show the final state without movement.
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
/** Split `el`'s text into `aria-hidden` inline-block characters (idempotent). Returns them. */
|
|
84
|
+
declare function splitChars(el: HTMLElement): HTMLElement[];
|
|
85
|
+
declare const TEXT3_FX: EffectDefinition[];
|
|
86
|
+
/** Register the 6.3 text pack (idempotent). */
|
|
87
|
+
declare function registerTextEffects3(): void;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* 5.5 — generative backgrounds on Canvas 2D, registered through
|
|
91
|
+
* `registerEffect()` (kind `background`): `flow-field`, `voronoi`,
|
|
92
|
+
* `mesh-gradient`, `starfield`, `metaballs`, `contours`.
|
|
93
|
+
*
|
|
94
|
+
* Shared runner (`canvasBackground()`): a canvas behind the element's content
|
|
95
|
+
* (`aria-hidden`, pointer-transparent), rendering only while visible
|
|
96
|
+
* (IntersectionObserver) and the tab is shown, with adaptive quality — the
|
|
97
|
+
* render scale drops when frames get slow and recovers when they are fast.
|
|
98
|
+
* Reduced motion: one static frame, no loop.
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
interface GenFrame {
|
|
102
|
+
ctx: CanvasRenderingContext2D;
|
|
103
|
+
/** CSS-pixel size of the canvas. */
|
|
104
|
+
w: number;
|
|
105
|
+
h: number;
|
|
106
|
+
/** Seconds since start (0 for the static reduced-motion frame). */
|
|
107
|
+
t: number;
|
|
108
|
+
/** Render scale 0.35–1 (adaptive quality). */
|
|
109
|
+
quality: number;
|
|
110
|
+
/** Per-effect state, created by `init`. */
|
|
111
|
+
state: any;
|
|
112
|
+
/** Merged options. */
|
|
113
|
+
o: any;
|
|
114
|
+
}
|
|
115
|
+
interface GenerativeSpec {
|
|
116
|
+
init?: (w: number, h: number, o: any) => any;
|
|
117
|
+
draw: (f: GenFrame) => void;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* 6.2 — tiny WebGL2 full-screen shader runner with a Canvas 2D fallback, shared
|
|
122
|
+
* by the 6.x GPU effect packs. One canvas behind the element (aria-hidden,
|
|
123
|
+
* pointer-transparent), renders only while visible and the tab is shown,
|
|
124
|
+
* adaptive resolution, pointer uniform, and a static first frame under reduced
|
|
125
|
+
* motion. No WebGL2 (or a lost context / compile error) → the Canvas 2D
|
|
126
|
+
* `fallback` spec runs through `canvasBackground()` instead.
|
|
127
|
+
* `el.dataset.usaBackend` tells which one is active: `webgl2` or `canvas`.
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
/** GLSL shared by every shader: uniforms, hash, value noise, fbm. */
|
|
131
|
+
declare const GLSL_HEAD = "#version 300 es\nprecision highp float;\nuniform vec2 u_res;uniform float u_t;uniform vec3 u_c0,u_c1,u_c2;uniform vec2 u_ptr;uniform float u_speed,u_scale;\nout vec4 o;\nfloat h(vec2 p){return fract(sin(dot(p,vec2(127.1,311.7)))*43758.5453);}\nfloat n(vec2 p){vec2 i=floor(p),f=fract(p);f=f*f*(3.-2.*f);return mix(mix(h(i),h(i+vec2(1,0)),f.x),mix(h(i+vec2(0,1)),h(i+1.),f.x),f.y);}\nfloat fbm(vec2 p){float v=0.,a=.5;for(int k=0;k<5;k++){v+=a*n(p);p=p*2.03+vec2(1.7,9.2);a*=.5;}return v;}\n";
|
|
132
|
+
interface ShaderSpec {
|
|
133
|
+
/** GLSL body of `main()`: `uv` (0–1), `p` (aspect-corrected, scaled), `t` (s × speed) are in scope; write `o`. */
|
|
134
|
+
body: string;
|
|
135
|
+
/** Canvas 2D fallback. */
|
|
136
|
+
fallback: GenerativeSpec;
|
|
137
|
+
}
|
|
138
|
+
declare function supportsWebGL2(): boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Mount a shader background behind `el` (options: `colors` [3 hex], `speed`,
|
|
141
|
+
* `scale`, `quality`, `backend` = `'auto' | 'webgl2' | 'canvas'`). Returns the cleanup.
|
|
142
|
+
*/
|
|
143
|
+
declare function shaderBackground(el: HTMLElement, fx: EffectContext, spec: ShaderSpec, o: any): () => void;
|
|
144
|
+
/**
|
|
145
|
+
* Canvas 2D fallback for a scalar field: `color(x, y, t)` (x, y in 0–1)
|
|
146
|
+
* returns `[r, g, b]` (0–255), sampled on a coarse grid and scaled up smoothly.
|
|
147
|
+
*/
|
|
148
|
+
declare function fieldFallback(color: (x: number, y: number, t: number, o: any) => [number, number, number], cell?: number): GenerativeSpec;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* The 6.x effect packs, one entry each (`motionary/components/fx-gpu`, …) so
|
|
152
|
+
* their size budgets stay separate. This module (`registerFx2()`) registers
|
|
153
|
+
* them all — used by dist/widgets.umd.js and the showcase.
|
|
154
|
+
*/
|
|
155
|
+
|
|
156
|
+
/** The 6.x effect packs by name. */
|
|
157
|
+
declare const FX2_PACKS: Record<string, EffectDefinition[]>;
|
|
158
|
+
/** Register every 6.x pack (idempotent). */
|
|
159
|
+
declare function registerFx2(): void;
|
|
160
|
+
|
|
161
|
+
export { FX2_PACKS, GLSL_HEAD, GPU_FX, TEXT3_FX, fieldFallback, registerFx2, registerGpuEffects, registerTextEffects3, shaderBackground, splitChars, supportsWebGL2 };
|
|
162
|
+
export type { ShaderSpec };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { G as GPU_FX, r as registerGpuEffects } from '../chunks/gpu-XHWzeNb5.js';
|
|
2
|
+
export { a as GLSL_HEAD, f as fieldFallback, s as shaderBackground, b as supportsWebGL2 } from '../chunks/gpu-XHWzeNb5.js';
|
|
3
|
+
import { TEXT3_FX, registerTextEffects3 } from './fx-text.js';
|
|
4
|
+
export { splitChars } from './fx-text.js';
|
|
5
|
+
import '../chunks/registry-Bu5NrAyA.js';
|
|
6
|
+
import '../chunks/base-DchG4q_S.js';
|
|
7
|
+
import '../chunks/generative-BRUZaIsX.js';
|
|
8
|
+
import '../chunks/shared-eweTlzxv.js';
|
|
9
|
+
|
|
10
|
+
/** The 6.x effect packs by name. */
|
|
11
|
+
const FX2_PACKS = {
|
|
12
|
+
gpu: GPU_FX,
|
|
13
|
+
text: TEXT3_FX,
|
|
14
|
+
};
|
|
15
|
+
/** Register every 6.x pack (idempotent). */
|
|
16
|
+
function registerFx2() {
|
|
17
|
+
registerGpuEffects();
|
|
18
|
+
registerTextEffects3();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { FX2_PACKS, GPU_FX, TEXT3_FX, registerFx2, registerGpuEffects, registerTextEffects3 };
|
|
22
|
+
//# sourceMappingURL=fx2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fx2.js","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';\nimport { GPU_FX, registerGpuEffects } from './gpu';\nimport { TEXT3_FX, registerTextEffects3, splitChars } from './text3';\n\nexport { GPU_FX, registerGpuEffects, TEXT3_FX, registerTextEffects3, splitChars };\nexport { shaderBackground, supportsWebGL2, fieldFallback, GLSL_HEAD } from './gl';\nexport type { ShaderSpec } from './gl';\n\n/** The 6.x effect packs by name. */\nexport const FX2_PACKS: Record<string, EffectDefinition[]> = {\n gpu: GPU_FX,\n text: TEXT3_FX,\n};\n\n/** Register every 6.x pack (idempotent). */\nexport function registerFx2(): void {\n registerGpuEffects();\n registerTextEffects3();\n}\n"],"names":[],"mappings":";;;;;;;;;AAaA;AACO,MAAM,SAAS,GAAuC;AAC3D,IAAA,GAAG,EAAE,MAAM;AACX,IAAA,IAAI,EAAE,QAAQ;;AAGhB;SACgB,WAAW,GAAA;AACzB,IAAA,kBAAkB,EAAE;AACpB,IAAA,oBAAoB,EAAE;AACxB;;;;"}
|