use-scroll-animate 4.2.0 → 4.4.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 +24 -0
- package/dist/chunks/{base-BPG5zvex.js → base-BtJDNCB6.js} +45 -5
- package/dist/chunks/base-BtJDNCB6.js.map +1 -0
- package/dist/chunks/{base-CXx7jZ-o.cjs → base-DE2yzxE7.cjs} +47 -4
- package/dist/chunks/base-DE2yzxE7.cjs.map +1 -0
- package/dist/chunks/{core-BRIIoKeS.cjs → core-BC9S2osy.cjs} +2 -2
- package/dist/chunks/{core-BRIIoKeS.cjs.map → core-BC9S2osy.cjs.map} +1 -1
- package/dist/chunks/{core-IaorbTdu.cjs → core-DPYjLqA0.cjs} +2 -2
- package/dist/chunks/{core-IaorbTdu.cjs.map → core-DPYjLqA0.cjs.map} +1 -1
- package/dist/chunks/{core-LkGRmgES.js → core-DS1nrx5L.js} +2 -2
- package/dist/chunks/{core-LkGRmgES.js.map → core-DS1nrx5L.js.map} +1 -1
- package/dist/chunks/{core-eXX8rB_b.js → core-DX6pdOoY.js} +2 -2
- package/dist/chunks/{core-eXX8rB_b.js.map → core-DX6pdOoY.js.map} +1 -1
- package/dist/chunks/{spring-BziPsW3r.js → spring-CxRz49Wk.js} +2 -2
- package/dist/chunks/{spring-BziPsW3r.js.map → spring-CxRz49Wk.js.map} +1 -1
- package/dist/chunks/{spring-2OTnYCzm.cjs → spring-hsmgd7ml.cjs} +2 -2
- package/dist/chunks/{spring-2OTnYCzm.cjs.map → spring-hsmgd7ml.cjs.map} +1 -1
- package/dist/chunks/{variants-BNIrn4ch.cjs → variants-CM2zaG8v.cjs} +2 -2
- package/dist/chunks/{variants-BNIrn4ch.cjs.map → variants-CM2zaG8v.cjs.map} +1 -1
- package/dist/chunks/{variants-BVYMcxRv.js → variants-dD6SbUMR.js} +2 -2
- package/dist/chunks/{variants-BVYMcxRv.js.map → variants-dD6SbUMR.js.map} +1 -1
- package/dist/components/a11y.cjs +239 -0
- package/dist/components/a11y.cjs.map +1 -0
- package/dist/components/a11y.d.cts +120 -0
- package/dist/components/a11y.d.ts +120 -0
- package/dist/components/a11y.js +224 -0
- package/dist/components/a11y.js.map +1 -0
- package/dist/components/angular.cjs +7 -6
- package/dist/components/angular.cjs.map +1 -1
- package/dist/components/angular.d.cts +80 -76
- package/dist/components/angular.d.ts +80 -76
- package/dist/components/angular.js +7 -6
- package/dist/components/angular.js.map +1 -1
- package/dist/components/background.cjs +2 -2
- package/dist/components/background.d.cts +10 -0
- package/dist/components/background.d.ts +10 -0
- package/dist/components/background.js +3 -3
- package/dist/components/cards.cjs +2 -2
- package/dist/components/cards.d.cts +10 -0
- package/dist/components/cards.d.ts +10 -0
- package/dist/components/cards.js +3 -3
- package/dist/components/click.cjs +2 -2
- package/dist/components/click.d.cts +10 -0
- package/dist/components/click.d.ts +10 -0
- package/dist/components/click.js +3 -3
- package/dist/components/depth.cjs +3 -3
- package/dist/components/depth.d.cts +10 -0
- package/dist/components/depth.d.ts +10 -0
- package/dist/components/depth.js +4 -4
- package/dist/components/feedback.cjs +1 -1
- package/dist/components/feedback.d.cts +10 -0
- package/dist/components/feedback.d.ts +10 -0
- package/dist/components/feedback.js +2 -2
- package/dist/components/gesture.cjs +3 -3
- package/dist/components/gesture.d.cts +10 -0
- package/dist/components/gesture.d.ts +10 -0
- package/dist/components/gesture.js +5 -5
- package/dist/components/interaction.cjs +1 -1
- package/dist/components/interaction.d.cts +10 -0
- package/dist/components/interaction.d.ts +10 -0
- package/dist/components/interaction.js +2 -2
- package/dist/components/layout.cjs +1 -1
- package/dist/components/layout.d.cts +10 -0
- package/dist/components/layout.d.ts +10 -0
- package/dist/components/layout.js +2 -2
- package/dist/components/packs.cjs +1 -1
- package/dist/components/packs.d.cts +10 -0
- package/dist/components/packs.d.ts +10 -0
- package/dist/components/packs.js +2 -2
- package/dist/components/page.cjs +6 -3
- package/dist/components/page.cjs.map +1 -1
- package/dist/components/page.d.cts +10 -0
- package/dist/components/page.d.ts +10 -0
- package/dist/components/page.js +7 -4
- package/dist/components/page.js.map +1 -1
- package/dist/components/physics.cjs +2 -2
- package/dist/components/physics.d.cts +10 -0
- package/dist/components/physics.d.ts +10 -0
- package/dist/components/physics.js +4 -4
- package/dist/components/reveal.cjs +1 -1
- package/dist/components/reveal.d.cts +10 -0
- package/dist/components/reveal.d.ts +10 -0
- package/dist/components/reveal.js +2 -2
- package/dist/components/solid.cjs +7 -6
- package/dist/components/solid.cjs.map +1 -1
- package/dist/components/solid.d.cts +80 -76
- package/dist/components/solid.d.ts +80 -76
- package/dist/components/solid.js +7 -6
- package/dist/components/solid.js.map +1 -1
- package/dist/components/svelte.cjs +7 -6
- package/dist/components/svelte.cjs.map +1 -1
- package/dist/components/svelte.d.cts +80 -76
- package/dist/components/svelte.d.ts +80 -76
- package/dist/components/svelte.js +7 -6
- package/dist/components/svelte.js.map +1 -1
- package/dist/components/svg.cjs +1 -1
- package/dist/components/svg.d.cts +10 -0
- package/dist/components/svg.d.ts +10 -0
- package/dist/components/svg.js +2 -2
- package/dist/components/text.cjs +284 -11
- package/dist/components/text.cjs.map +1 -1
- package/dist/components/text.d.cts +166 -3
- package/dist/components/text.d.ts +166 -3
- package/dist/components/text.js +280 -13
- package/dist/components/text.js.map +1 -1
- package/dist/components/timeline.cjs +2 -2
- package/dist/components/timeline.d.cts +10 -0
- package/dist/components/timeline.d.ts +10 -0
- package/dist/components/timeline.js +4 -4
- package/dist/components/transitions.cjs +1 -1
- package/dist/components/transitions.d.cts +10 -0
- package/dist/components/transitions.d.ts +10 -0
- package/dist/components/transitions.js +2 -2
- package/dist/components/ui.cjs +3 -3
- package/dist/components/ui.d.cts +10 -0
- package/dist/components/ui.d.ts +10 -0
- package/dist/components/ui.js +5 -5
- package/dist/components/vue.cjs +7 -6
- package/dist/components/vue.cjs.map +1 -1
- package/dist/components/vue.d.cts +80 -76
- package/dist/components/vue.d.ts +80 -76
- package/dist/components/vue.js +7 -6
- package/dist/components/vue.js.map +1 -1
- package/dist/components/webgl.cjs +1 -1
- package/dist/components/webgl.d.cts +10 -0
- package/dist/components/webgl.d.ts +10 -0
- package/dist/components/webgl.js +2 -2
- package/dist/components.cjs +27 -5
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +289 -108
- package/dist/components.d.ts +289 -108
- package/dist/components.js +9 -8
- 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.cjs +2 -2
- package/dist/index.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/docs/ROADMAP.md +2 -2
- package/docs/accessibility.md +28 -0
- package/package.json +11 -1
- package/dist/chunks/base-BPG5zvex.js.map +0 -1
- package/dist/chunks/base-CXx7jZ-o.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solid.cjs","sources":["../../src/components/frameworks/solid.ts"],"sourcesContent":["/**\n * use-scroll-animate/components/solid — Solid integration (v3.8).\n * Solid renders custom elements natively: set properties with `prop:` and\n * listen with `on:` (`<usa-toggle prop:checked={on()} on:usa:change={…}>`).\n * This entry adds `defineUsa()` (client only, SolidStart-safe), a `usa`\n * directive for `use:usa={{ props, on }}`, and JSX types.\n *\n * ```tsx\n * import { defineUsa, usa } from 'use-scroll-animate/components/solid';\n * import type {} from 'use-scroll-animate/components/solid'; // JSX types\n * onMount(() => defineUsa());\n * false && usa; // keep the directive import (Solid convention)\n * <usa-card use:usa={{ on: { flip: (e) => console.log(e.detail) } }} effect=\"flip\">…</usa-card>\n * ```\n */\nimport { createRenderEffect, onCleanup } from 'solid-js';\nimport { defineComponents, type ComponentCategory } from '../index';\nimport { bindUsa, type UsaBinding } from './bind';\nimport type { UsaIntrinsicElements } from './jsx';\n\nexport { bindUsa, usaEventName } from './bind';\nexport type { UsaBinding } from './bind';\n\n/**\n * Solid directive (`use:usa`). Solid calls it with the element and an\n * accessor; since 4.0.1 the binding is tracked with `createRenderEffect`, so\n * signals read inside `{{ props, on }}` update the element automatically and\n * the listeners are removed on cleanup. `refresh()` is kept for code that\n * calls the directive outside a reactive owner.\n */\nexport function usa(el: HTMLElement, accessor: () => UsaBinding | undefined): { refresh(): void; destroy(): void } {\n let b: ReturnType<typeof bindUsa> | null = null;\n const run = () => {\n const v = accessor() || {};\n if (b) b.update(v);\n else b = bindUsa(el, v);\n };\n createRenderEffect(run);\n if (!b) run();\n const destroy = () => b?.destroy();\n onCleanup(destroy);\n return { refresh: run, destroy };\n}\n\n/** Register the elements (all, or some categories) — call from `onMount` in SSR apps. */\nexport function defineUsa(categories?: ComponentCategory[]): void {\n if (typeof window !== 'undefined') defineComponents(categories);\n}\n\n/** JSX intrinsic elements for Solid (same attribute types as the React/Preact ones). */\nexport type SolidUsaIntrinsicElements = UsaIntrinsicElements;\n"],"names":["bindUsa","createRenderEffect","onCleanup","defineComponents"],"mappings":"
|
|
1
|
+
{"version":3,"file":"solid.cjs","sources":["../../src/components/frameworks/solid.ts"],"sourcesContent":["/**\n * use-scroll-animate/components/solid — Solid integration (v3.8).\n * Solid renders custom elements natively: set properties with `prop:` and\n * listen with `on:` (`<usa-toggle prop:checked={on()} on:usa:change={…}>`).\n * This entry adds `defineUsa()` (client only, SolidStart-safe), a `usa`\n * directive for `use:usa={{ props, on }}`, and JSX types.\n *\n * ```tsx\n * import { defineUsa, usa } from 'use-scroll-animate/components/solid';\n * import type {} from 'use-scroll-animate/components/solid'; // JSX types\n * onMount(() => defineUsa());\n * false && usa; // keep the directive import (Solid convention)\n * <usa-card use:usa={{ on: { flip: (e) => console.log(e.detail) } }} effect=\"flip\">…</usa-card>\n * ```\n */\nimport { createRenderEffect, onCleanup } from 'solid-js';\nimport { defineComponents, type ComponentCategory } from '../index';\nimport { bindUsa, type UsaBinding } from './bind';\nimport type { UsaIntrinsicElements } from './jsx';\n\nexport { bindUsa, usaEventName } from './bind';\nexport type { UsaBinding } from './bind';\n\n/**\n * Solid directive (`use:usa`). Solid calls it with the element and an\n * accessor; since 4.0.1 the binding is tracked with `createRenderEffect`, so\n * signals read inside `{{ props, on }}` update the element automatically and\n * the listeners are removed on cleanup. `refresh()` is kept for code that\n * calls the directive outside a reactive owner.\n */\nexport function usa(el: HTMLElement, accessor: () => UsaBinding | undefined): { refresh(): void; destroy(): void } {\n let b: ReturnType<typeof bindUsa> | null = null;\n const run = () => {\n const v = accessor() || {};\n if (b) b.update(v);\n else b = bindUsa(el, v);\n };\n createRenderEffect(run);\n if (!b) run();\n const destroy = () => b?.destroy();\n onCleanup(destroy);\n return { refresh: run, destroy };\n}\n\n/** Register the elements (all, or some categories) — call from `onMount` in SSR apps. */\nexport function defineUsa(categories?: ComponentCategory[]): void {\n if (typeof window !== 'undefined') defineComponents(categories);\n}\n\n/** JSX intrinsic elements for Solid (same attribute types as the React/Preact ones). */\nexport type SolidUsaIntrinsicElements = UsaIntrinsicElements;\n"],"names":["bindUsa","createRenderEffect","onCleanup","defineComponents"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;AAcG;AASH;;;;;;AAMG;AACG,SAAU,GAAG,CAAC,EAAe,EAAE,QAAsC,EAAA;IACzE,IAAI,CAAC,GAAsC,IAAI;IAC/C,MAAM,GAAG,GAAG,MAAK;AACf,QAAA,MAAM,CAAC,GAAG,QAAQ,EAAE,IAAI,EAAE;AAC1B,QAAA,IAAI,CAAC;AAAE,YAAA,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;;AACb,YAAA,CAAC,GAAGA,YAAO,CAAC,EAAE,EAAE,CAAC,CAAC;AACzB,IAAA,CAAC;IACDC,0BAAkB,CAAC,GAAG,CAAC;AACvB,IAAA,IAAI,CAAC,CAAC;AAAE,QAAA,GAAG,EAAE;IACb,MAAM,OAAO,GAAG,MAAM,CAAC,EAAE,OAAO,EAAE;IAClCC,iBAAS,CAAC,OAAO,CAAC;AAClB,IAAA,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE;AAClC;AAEA;AACM,SAAU,SAAS,CAAC,UAAgC,EAAA;IACxD,IAAI,OAAO,MAAM,KAAK,WAAW;QAAEC,2BAAgB,CAAC,UAAU,CAAC;AACjE;;;;;;;"}
|
|
@@ -117,7 +117,11 @@ interface UsaTypewriterElement extends UsaElement {
|
|
|
117
117
|
* them in a cascade (pure CSS animation per unit, transform / opacity /
|
|
118
118
|
* filter only). Words never break across lines.
|
|
119
119
|
*
|
|
120
|
-
*
|
|
120
|
+
* 4.3: `Intl.Segmenter`-aware (emoji, CJK words), Arabic-script words are
|
|
121
|
+
* never split below the word, `by="lines"` reveals line by line, and `from`
|
|
122
|
+
* (`start` · `end` · `center` · `edges` · `random`) sets the cascade order.
|
|
123
|
+
*
|
|
124
|
+
* Attributes: `by` (`chars` | `words` | `lines`, default `chars`), `effect`
|
|
121
125
|
* (`rise` | `fade` | `blur` | `flip` | `pop`, default `rise`), `stagger`
|
|
122
126
|
* (ms between units, 28 for chars / 70 for words), `duration` (ms, 620),
|
|
123
127
|
* `delay` (ms, 0), `trigger` (`view` | `load` | `manual`, default `view`),
|
|
@@ -230,6 +234,81 @@ interface UsaScrollHighlightElement extends UsaElement {
|
|
|
230
234
|
readonly progress: number;
|
|
231
235
|
}
|
|
232
236
|
|
|
237
|
+
/**
|
|
238
|
+
* Where a step starts on a timeline:
|
|
239
|
+
* - a number: absolute time in ms
|
|
240
|
+
* - `'>'` (default): when the previous step ends · `'<'`: when it starts
|
|
241
|
+
* - `'+=200'` / `'-=200'`: after / overlapping the previous end
|
|
242
|
+
* - `'<+=100'`: 100ms after the previous step's start
|
|
243
|
+
* - `'intro'` / `'intro+=150'`: at (or relative to) a label
|
|
244
|
+
*/
|
|
245
|
+
type TimelinePosition = number | string;
|
|
246
|
+
interface TimelineStepOptions {
|
|
247
|
+
/** Duration in ms or a motion token name (`'fast'`, `'slow'`…; 4.2). Default: timeline default, 600. */
|
|
248
|
+
duration?: number | string;
|
|
249
|
+
/** CSS easing or a motion token name (`'emphasized'`, `'spring'`…; 4.2). Default `cubic-bezier(0.22, 1, 0.36, 1)`. */
|
|
250
|
+
easing?: string;
|
|
251
|
+
/** Start position, see `TimelinePosition`. */
|
|
252
|
+
at?: TimelinePosition;
|
|
253
|
+
/** ms between targets when the selector matches several elements. */
|
|
254
|
+
stagger?: number;
|
|
255
|
+
}
|
|
256
|
+
interface ScrubOptions {
|
|
257
|
+
/** Scroll offset (px) before the source's top reaches the viewport bottom where progress starts (JS engine only). */
|
|
258
|
+
offset?: number;
|
|
259
|
+
/** Smoothing 0–1 (0 = immediate, default 0). Smoothing needs the JS engine. */
|
|
260
|
+
smooth?: number;
|
|
261
|
+
/**
|
|
262
|
+
* 4.1: which progress source drives the timeline.
|
|
263
|
+
* - `'view'` (default): `source` moving through the viewport (CSS `ViewTimeline`, range `cover`).
|
|
264
|
+
* - `'scroll'`: the scroll position of `source` itself (a scroll container; CSS `ScrollTimeline`).
|
|
265
|
+
*/
|
|
266
|
+
source?: 'view' | 'scroll';
|
|
267
|
+
/** 4.1: `'auto'` (default) uses the browser's native scroll-driven animations when available, `'js'` forces the fallback. */
|
|
268
|
+
engine?: 'auto' | 'native' | 'js';
|
|
269
|
+
/** 4.1: scroll axis, `'block'` (default) · `'inline'` · `'x'` · `'y'`. */
|
|
270
|
+
axis?: 'block' | 'inline' | 'x' | 'y';
|
|
271
|
+
}
|
|
272
|
+
/** The function `scrub()` returns: call it to stop. `native` tells which engine runs it. */
|
|
273
|
+
interface ScrubHandle {
|
|
274
|
+
(): void;
|
|
275
|
+
/** `true` when the browser's ScrollTimeline / ViewTimeline drives it (compositor, no JS per frame). */
|
|
276
|
+
readonly native: boolean;
|
|
277
|
+
}
|
|
278
|
+
interface Timeline {
|
|
279
|
+
/** Total length in ms. */
|
|
280
|
+
readonly duration: number;
|
|
281
|
+
/** Label positions in ms. */
|
|
282
|
+
readonly labels: Readonly<Record<string, number>>;
|
|
283
|
+
/** Current playhead in ms. */
|
|
284
|
+
readonly time: number;
|
|
285
|
+
/** Add a step: animate `target` with keyframes or a preset name (`fade-up`, `scale`…). */
|
|
286
|
+
to(target: string | Element | Element[] | NodeList, frames: Keyframe[] | string, options?: TimelineStepOptions): Timeline;
|
|
287
|
+
/** Name a position (default: the current end). */
|
|
288
|
+
label(name: string, at?: TimelinePosition): Timeline;
|
|
289
|
+
/** Run `fn` when the playhead passes `at`. */
|
|
290
|
+
call(fn: () => void, at?: TimelinePosition): Timeline;
|
|
291
|
+
/** Play forwards from the playhead (from 0 when at the end). Resolves at the end. */
|
|
292
|
+
play(from?: TimelinePosition): Promise<void>;
|
|
293
|
+
/** Play backwards to 0. */
|
|
294
|
+
reverse(): Promise<void>;
|
|
295
|
+
pause(): Timeline;
|
|
296
|
+
/** Jump to a time (ms) or label. */
|
|
297
|
+
seek(to: TimelinePosition): Timeline;
|
|
298
|
+
/** Get or set progress 0–1. */
|
|
299
|
+
progress(p?: number): number;
|
|
300
|
+
/**
|
|
301
|
+
* Tie progress to scroll: `source` moving through the viewport (or, with
|
|
302
|
+
* `{ source: 'scroll' }`, a scroll container's own position). Runs on native
|
|
303
|
+
* ScrollTimeline / ViewTimeline when available (and no `smooth`, `offset`,
|
|
304
|
+
* `call()` cues or `onUpdate` need JS), else on a rAF-throttled listener.
|
|
305
|
+
* Returns a stop function with a `native` flag.
|
|
306
|
+
*/
|
|
307
|
+
scrub(source: Element, options?: ScrubOptions): ScrubHandle;
|
|
308
|
+
/** Stop and drop every animation (elements keep their last frame). */
|
|
309
|
+
cancel(): void;
|
|
310
|
+
}
|
|
311
|
+
|
|
233
312
|
/**
|
|
234
313
|
* use-scroll-animate/components/text — text effects.
|
|
235
314
|
* `<usa-typewriter>`, `<usa-split-text>`, `<usa-scramble>`, `<usa-counter>`,
|
|
@@ -1275,81 +1354,6 @@ declare global {
|
|
|
1275
1354
|
}
|
|
1276
1355
|
}
|
|
1277
1356
|
|
|
1278
|
-
/**
|
|
1279
|
-
* Where a step starts on a timeline:
|
|
1280
|
-
* - a number: absolute time in ms
|
|
1281
|
-
* - `'>'` (default): when the previous step ends · `'<'`: when it starts
|
|
1282
|
-
* - `'+=200'` / `'-=200'`: after / overlapping the previous end
|
|
1283
|
-
* - `'<+=100'`: 100ms after the previous step's start
|
|
1284
|
-
* - `'intro'` / `'intro+=150'`: at (or relative to) a label
|
|
1285
|
-
*/
|
|
1286
|
-
type TimelinePosition = number | string;
|
|
1287
|
-
interface TimelineStepOptions {
|
|
1288
|
-
/** Duration in ms or a motion token name (`'fast'`, `'slow'`…; 4.2). Default: timeline default, 600. */
|
|
1289
|
-
duration?: number | string;
|
|
1290
|
-
/** CSS easing or a motion token name (`'emphasized'`, `'spring'`…; 4.2). Default `cubic-bezier(0.22, 1, 0.36, 1)`. */
|
|
1291
|
-
easing?: string;
|
|
1292
|
-
/** Start position, see `TimelinePosition`. */
|
|
1293
|
-
at?: TimelinePosition;
|
|
1294
|
-
/** ms between targets when the selector matches several elements. */
|
|
1295
|
-
stagger?: number;
|
|
1296
|
-
}
|
|
1297
|
-
interface ScrubOptions {
|
|
1298
|
-
/** Scroll offset (px) before the source's top reaches the viewport bottom where progress starts (JS engine only). */
|
|
1299
|
-
offset?: number;
|
|
1300
|
-
/** Smoothing 0–1 (0 = immediate, default 0). Smoothing needs the JS engine. */
|
|
1301
|
-
smooth?: number;
|
|
1302
|
-
/**
|
|
1303
|
-
* 4.1: which progress source drives the timeline.
|
|
1304
|
-
* - `'view'` (default): `source` moving through the viewport (CSS `ViewTimeline`, range `cover`).
|
|
1305
|
-
* - `'scroll'`: the scroll position of `source` itself (a scroll container; CSS `ScrollTimeline`).
|
|
1306
|
-
*/
|
|
1307
|
-
source?: 'view' | 'scroll';
|
|
1308
|
-
/** 4.1: `'auto'` (default) uses the browser's native scroll-driven animations when available, `'js'` forces the fallback. */
|
|
1309
|
-
engine?: 'auto' | 'native' | 'js';
|
|
1310
|
-
/** 4.1: scroll axis, `'block'` (default) · `'inline'` · `'x'` · `'y'`. */
|
|
1311
|
-
axis?: 'block' | 'inline' | 'x' | 'y';
|
|
1312
|
-
}
|
|
1313
|
-
/** The function `scrub()` returns: call it to stop. `native` tells which engine runs it. */
|
|
1314
|
-
interface ScrubHandle {
|
|
1315
|
-
(): void;
|
|
1316
|
-
/** `true` when the browser's ScrollTimeline / ViewTimeline drives it (compositor, no JS per frame). */
|
|
1317
|
-
readonly native: boolean;
|
|
1318
|
-
}
|
|
1319
|
-
interface Timeline {
|
|
1320
|
-
/** Total length in ms. */
|
|
1321
|
-
readonly duration: number;
|
|
1322
|
-
/** Label positions in ms. */
|
|
1323
|
-
readonly labels: Readonly<Record<string, number>>;
|
|
1324
|
-
/** Current playhead in ms. */
|
|
1325
|
-
readonly time: number;
|
|
1326
|
-
/** Add a step: animate `target` with keyframes or a preset name (`fade-up`, `scale`…). */
|
|
1327
|
-
to(target: string | Element | Element[] | NodeList, frames: Keyframe[] | string, options?: TimelineStepOptions): Timeline;
|
|
1328
|
-
/** Name a position (default: the current end). */
|
|
1329
|
-
label(name: string, at?: TimelinePosition): Timeline;
|
|
1330
|
-
/** Run `fn` when the playhead passes `at`. */
|
|
1331
|
-
call(fn: () => void, at?: TimelinePosition): Timeline;
|
|
1332
|
-
/** Play forwards from the playhead (from 0 when at the end). Resolves at the end. */
|
|
1333
|
-
play(from?: TimelinePosition): Promise<void>;
|
|
1334
|
-
/** Play backwards to 0. */
|
|
1335
|
-
reverse(): Promise<void>;
|
|
1336
|
-
pause(): Timeline;
|
|
1337
|
-
/** Jump to a time (ms) or label. */
|
|
1338
|
-
seek(to: TimelinePosition): Timeline;
|
|
1339
|
-
/** Get or set progress 0–1. */
|
|
1340
|
-
progress(p?: number): number;
|
|
1341
|
-
/**
|
|
1342
|
-
* Tie progress to scroll: `source` moving through the viewport (or, with
|
|
1343
|
-
* `{ source: 'scroll' }`, a scroll container's own position). Runs on native
|
|
1344
|
-
* ScrollTimeline / ViewTimeline when available (and no `smooth`, `offset`,
|
|
1345
|
-
* `call()` cues or `onUpdate` need JS), else on a rAF-throttled listener.
|
|
1346
|
-
* Returns a stop function with a `native` flag.
|
|
1347
|
-
*/
|
|
1348
|
-
scrub(source: Element, options?: ScrubOptions): ScrubHandle;
|
|
1349
|
-
/** Stop and drop every animation (elements keep their last frame). */
|
|
1350
|
-
cancel(): void;
|
|
1351
|
-
}
|
|
1352
|
-
|
|
1353
1357
|
/**
|
|
1354
1358
|
* `<usa-timeline>` — declarative choreography. Every descendant with
|
|
1355
1359
|
* `data-tl="<preset>"` becomes a step, in document order; `data-at`
|
|
@@ -117,7 +117,11 @@ interface UsaTypewriterElement extends UsaElement {
|
|
|
117
117
|
* them in a cascade (pure CSS animation per unit, transform / opacity /
|
|
118
118
|
* filter only). Words never break across lines.
|
|
119
119
|
*
|
|
120
|
-
*
|
|
120
|
+
* 4.3: `Intl.Segmenter`-aware (emoji, CJK words), Arabic-script words are
|
|
121
|
+
* never split below the word, `by="lines"` reveals line by line, and `from`
|
|
122
|
+
* (`start` · `end` · `center` · `edges` · `random`) sets the cascade order.
|
|
123
|
+
*
|
|
124
|
+
* Attributes: `by` (`chars` | `words` | `lines`, default `chars`), `effect`
|
|
121
125
|
* (`rise` | `fade` | `blur` | `flip` | `pop`, default `rise`), `stagger`
|
|
122
126
|
* (ms between units, 28 for chars / 70 for words), `duration` (ms, 620),
|
|
123
127
|
* `delay` (ms, 0), `trigger` (`view` | `load` | `manual`, default `view`),
|
|
@@ -230,6 +234,81 @@ interface UsaScrollHighlightElement extends UsaElement {
|
|
|
230
234
|
readonly progress: number;
|
|
231
235
|
}
|
|
232
236
|
|
|
237
|
+
/**
|
|
238
|
+
* Where a step starts on a timeline:
|
|
239
|
+
* - a number: absolute time in ms
|
|
240
|
+
* - `'>'` (default): when the previous step ends · `'<'`: when it starts
|
|
241
|
+
* - `'+=200'` / `'-=200'`: after / overlapping the previous end
|
|
242
|
+
* - `'<+=100'`: 100ms after the previous step's start
|
|
243
|
+
* - `'intro'` / `'intro+=150'`: at (or relative to) a label
|
|
244
|
+
*/
|
|
245
|
+
type TimelinePosition = number | string;
|
|
246
|
+
interface TimelineStepOptions {
|
|
247
|
+
/** Duration in ms or a motion token name (`'fast'`, `'slow'`…; 4.2). Default: timeline default, 600. */
|
|
248
|
+
duration?: number | string;
|
|
249
|
+
/** CSS easing or a motion token name (`'emphasized'`, `'spring'`…; 4.2). Default `cubic-bezier(0.22, 1, 0.36, 1)`. */
|
|
250
|
+
easing?: string;
|
|
251
|
+
/** Start position, see `TimelinePosition`. */
|
|
252
|
+
at?: TimelinePosition;
|
|
253
|
+
/** ms between targets when the selector matches several elements. */
|
|
254
|
+
stagger?: number;
|
|
255
|
+
}
|
|
256
|
+
interface ScrubOptions {
|
|
257
|
+
/** Scroll offset (px) before the source's top reaches the viewport bottom where progress starts (JS engine only). */
|
|
258
|
+
offset?: number;
|
|
259
|
+
/** Smoothing 0–1 (0 = immediate, default 0). Smoothing needs the JS engine. */
|
|
260
|
+
smooth?: number;
|
|
261
|
+
/**
|
|
262
|
+
* 4.1: which progress source drives the timeline.
|
|
263
|
+
* - `'view'` (default): `source` moving through the viewport (CSS `ViewTimeline`, range `cover`).
|
|
264
|
+
* - `'scroll'`: the scroll position of `source` itself (a scroll container; CSS `ScrollTimeline`).
|
|
265
|
+
*/
|
|
266
|
+
source?: 'view' | 'scroll';
|
|
267
|
+
/** 4.1: `'auto'` (default) uses the browser's native scroll-driven animations when available, `'js'` forces the fallback. */
|
|
268
|
+
engine?: 'auto' | 'native' | 'js';
|
|
269
|
+
/** 4.1: scroll axis, `'block'` (default) · `'inline'` · `'x'` · `'y'`. */
|
|
270
|
+
axis?: 'block' | 'inline' | 'x' | 'y';
|
|
271
|
+
}
|
|
272
|
+
/** The function `scrub()` returns: call it to stop. `native` tells which engine runs it. */
|
|
273
|
+
interface ScrubHandle {
|
|
274
|
+
(): void;
|
|
275
|
+
/** `true` when the browser's ScrollTimeline / ViewTimeline drives it (compositor, no JS per frame). */
|
|
276
|
+
readonly native: boolean;
|
|
277
|
+
}
|
|
278
|
+
interface Timeline {
|
|
279
|
+
/** Total length in ms. */
|
|
280
|
+
readonly duration: number;
|
|
281
|
+
/** Label positions in ms. */
|
|
282
|
+
readonly labels: Readonly<Record<string, number>>;
|
|
283
|
+
/** Current playhead in ms. */
|
|
284
|
+
readonly time: number;
|
|
285
|
+
/** Add a step: animate `target` with keyframes or a preset name (`fade-up`, `scale`…). */
|
|
286
|
+
to(target: string | Element | Element[] | NodeList, frames: Keyframe[] | string, options?: TimelineStepOptions): Timeline;
|
|
287
|
+
/** Name a position (default: the current end). */
|
|
288
|
+
label(name: string, at?: TimelinePosition): Timeline;
|
|
289
|
+
/** Run `fn` when the playhead passes `at`. */
|
|
290
|
+
call(fn: () => void, at?: TimelinePosition): Timeline;
|
|
291
|
+
/** Play forwards from the playhead (from 0 when at the end). Resolves at the end. */
|
|
292
|
+
play(from?: TimelinePosition): Promise<void>;
|
|
293
|
+
/** Play backwards to 0. */
|
|
294
|
+
reverse(): Promise<void>;
|
|
295
|
+
pause(): Timeline;
|
|
296
|
+
/** Jump to a time (ms) or label. */
|
|
297
|
+
seek(to: TimelinePosition): Timeline;
|
|
298
|
+
/** Get or set progress 0–1. */
|
|
299
|
+
progress(p?: number): number;
|
|
300
|
+
/**
|
|
301
|
+
* Tie progress to scroll: `source` moving through the viewport (or, with
|
|
302
|
+
* `{ source: 'scroll' }`, a scroll container's own position). Runs on native
|
|
303
|
+
* ScrollTimeline / ViewTimeline when available (and no `smooth`, `offset`,
|
|
304
|
+
* `call()` cues or `onUpdate` need JS), else on a rAF-throttled listener.
|
|
305
|
+
* Returns a stop function with a `native` flag.
|
|
306
|
+
*/
|
|
307
|
+
scrub(source: Element, options?: ScrubOptions): ScrubHandle;
|
|
308
|
+
/** Stop and drop every animation (elements keep their last frame). */
|
|
309
|
+
cancel(): void;
|
|
310
|
+
}
|
|
311
|
+
|
|
233
312
|
/**
|
|
234
313
|
* use-scroll-animate/components/text — text effects.
|
|
235
314
|
* `<usa-typewriter>`, `<usa-split-text>`, `<usa-scramble>`, `<usa-counter>`,
|
|
@@ -1275,81 +1354,6 @@ declare global {
|
|
|
1275
1354
|
}
|
|
1276
1355
|
}
|
|
1277
1356
|
|
|
1278
|
-
/**
|
|
1279
|
-
* Where a step starts on a timeline:
|
|
1280
|
-
* - a number: absolute time in ms
|
|
1281
|
-
* - `'>'` (default): when the previous step ends · `'<'`: when it starts
|
|
1282
|
-
* - `'+=200'` / `'-=200'`: after / overlapping the previous end
|
|
1283
|
-
* - `'<+=100'`: 100ms after the previous step's start
|
|
1284
|
-
* - `'intro'` / `'intro+=150'`: at (or relative to) a label
|
|
1285
|
-
*/
|
|
1286
|
-
type TimelinePosition = number | string;
|
|
1287
|
-
interface TimelineStepOptions {
|
|
1288
|
-
/** Duration in ms or a motion token name (`'fast'`, `'slow'`…; 4.2). Default: timeline default, 600. */
|
|
1289
|
-
duration?: number | string;
|
|
1290
|
-
/** CSS easing or a motion token name (`'emphasized'`, `'spring'`…; 4.2). Default `cubic-bezier(0.22, 1, 0.36, 1)`. */
|
|
1291
|
-
easing?: string;
|
|
1292
|
-
/** Start position, see `TimelinePosition`. */
|
|
1293
|
-
at?: TimelinePosition;
|
|
1294
|
-
/** ms between targets when the selector matches several elements. */
|
|
1295
|
-
stagger?: number;
|
|
1296
|
-
}
|
|
1297
|
-
interface ScrubOptions {
|
|
1298
|
-
/** Scroll offset (px) before the source's top reaches the viewport bottom where progress starts (JS engine only). */
|
|
1299
|
-
offset?: number;
|
|
1300
|
-
/** Smoothing 0–1 (0 = immediate, default 0). Smoothing needs the JS engine. */
|
|
1301
|
-
smooth?: number;
|
|
1302
|
-
/**
|
|
1303
|
-
* 4.1: which progress source drives the timeline.
|
|
1304
|
-
* - `'view'` (default): `source` moving through the viewport (CSS `ViewTimeline`, range `cover`).
|
|
1305
|
-
* - `'scroll'`: the scroll position of `source` itself (a scroll container; CSS `ScrollTimeline`).
|
|
1306
|
-
*/
|
|
1307
|
-
source?: 'view' | 'scroll';
|
|
1308
|
-
/** 4.1: `'auto'` (default) uses the browser's native scroll-driven animations when available, `'js'` forces the fallback. */
|
|
1309
|
-
engine?: 'auto' | 'native' | 'js';
|
|
1310
|
-
/** 4.1: scroll axis, `'block'` (default) · `'inline'` · `'x'` · `'y'`. */
|
|
1311
|
-
axis?: 'block' | 'inline' | 'x' | 'y';
|
|
1312
|
-
}
|
|
1313
|
-
/** The function `scrub()` returns: call it to stop. `native` tells which engine runs it. */
|
|
1314
|
-
interface ScrubHandle {
|
|
1315
|
-
(): void;
|
|
1316
|
-
/** `true` when the browser's ScrollTimeline / ViewTimeline drives it (compositor, no JS per frame). */
|
|
1317
|
-
readonly native: boolean;
|
|
1318
|
-
}
|
|
1319
|
-
interface Timeline {
|
|
1320
|
-
/** Total length in ms. */
|
|
1321
|
-
readonly duration: number;
|
|
1322
|
-
/** Label positions in ms. */
|
|
1323
|
-
readonly labels: Readonly<Record<string, number>>;
|
|
1324
|
-
/** Current playhead in ms. */
|
|
1325
|
-
readonly time: number;
|
|
1326
|
-
/** Add a step: animate `target` with keyframes or a preset name (`fade-up`, `scale`…). */
|
|
1327
|
-
to(target: string | Element | Element[] | NodeList, frames: Keyframe[] | string, options?: TimelineStepOptions): Timeline;
|
|
1328
|
-
/** Name a position (default: the current end). */
|
|
1329
|
-
label(name: string, at?: TimelinePosition): Timeline;
|
|
1330
|
-
/** Run `fn` when the playhead passes `at`. */
|
|
1331
|
-
call(fn: () => void, at?: TimelinePosition): Timeline;
|
|
1332
|
-
/** Play forwards from the playhead (from 0 when at the end). Resolves at the end. */
|
|
1333
|
-
play(from?: TimelinePosition): Promise<void>;
|
|
1334
|
-
/** Play backwards to 0. */
|
|
1335
|
-
reverse(): Promise<void>;
|
|
1336
|
-
pause(): Timeline;
|
|
1337
|
-
/** Jump to a time (ms) or label. */
|
|
1338
|
-
seek(to: TimelinePosition): Timeline;
|
|
1339
|
-
/** Get or set progress 0–1. */
|
|
1340
|
-
progress(p?: number): number;
|
|
1341
|
-
/**
|
|
1342
|
-
* Tie progress to scroll: `source` moving through the viewport (or, with
|
|
1343
|
-
* `{ source: 'scroll' }`, a scroll container's own position). Runs on native
|
|
1344
|
-
* ScrollTimeline / ViewTimeline when available (and no `smooth`, `offset`,
|
|
1345
|
-
* `call()` cues or `onUpdate` need JS), else on a rAF-throttled listener.
|
|
1346
|
-
* Returns a stop function with a `native` flag.
|
|
1347
|
-
*/
|
|
1348
|
-
scrub(source: Element, options?: ScrubOptions): ScrubHandle;
|
|
1349
|
-
/** Stop and drop every animation (elements keep their last frame). */
|
|
1350
|
-
cancel(): void;
|
|
1351
|
-
}
|
|
1352
|
-
|
|
1353
1357
|
/**
|
|
1354
1358
|
* `<usa-timeline>` — declarative choreography. Every descendant with
|
|
1355
1359
|
* `data-tl="<preset>"` becomes a step, in document order; `data-at`
|
package/dist/components/solid.js
CHANGED
|
@@ -3,29 +3,30 @@ import { defineComponents } from '../components.js';
|
|
|
3
3
|
import { b as bindUsa } from '../chunks/bind-B_CTL6Qn.js';
|
|
4
4
|
export { u as usaEventName } from '../chunks/bind-B_CTL6Qn.js';
|
|
5
5
|
import './reveal.js';
|
|
6
|
-
import '../chunks/base-
|
|
6
|
+
import '../chunks/base-BtJDNCB6.js';
|
|
7
7
|
import './text.js';
|
|
8
|
+
import '../chunks/core-DS1nrx5L.js';
|
|
9
|
+
import './tokens.js';
|
|
8
10
|
import './interaction.js';
|
|
9
11
|
import './feedback.js';
|
|
10
12
|
import './background.js';
|
|
11
|
-
import '../chunks/variants-
|
|
13
|
+
import '../chunks/variants-dD6SbUMR.js';
|
|
12
14
|
import './transitions.js';
|
|
13
15
|
import './physics.js';
|
|
14
|
-
import '../chunks/spring-
|
|
16
|
+
import '../chunks/spring-CxRz49Wk.js';
|
|
15
17
|
import './cards.js';
|
|
16
18
|
import './click.js';
|
|
17
19
|
import './ui.js';
|
|
18
20
|
import './page.js';
|
|
19
21
|
import './timeline.js';
|
|
20
|
-
import '../chunks/core-LkGRmgES.js';
|
|
21
|
-
import './tokens.js';
|
|
22
22
|
import './gesture.js';
|
|
23
|
-
import '../chunks/core-
|
|
23
|
+
import '../chunks/core-DX6pdOoY.js';
|
|
24
24
|
import './svg.js';
|
|
25
25
|
import './webgl.js';
|
|
26
26
|
import './depth.js';
|
|
27
27
|
import './layout.js';
|
|
28
28
|
import './packs.js';
|
|
29
|
+
import './a11y.js';
|
|
29
30
|
import '../chunks/index-tags-43Xtd01A.js';
|
|
30
31
|
|
|
31
32
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solid.js","sources":["../../src/components/frameworks/solid.ts"],"sourcesContent":["/**\n * use-scroll-animate/components/solid — Solid integration (v3.8).\n * Solid renders custom elements natively: set properties with `prop:` and\n * listen with `on:` (`<usa-toggle prop:checked={on()} on:usa:change={…}>`).\n * This entry adds `defineUsa()` (client only, SolidStart-safe), a `usa`\n * directive for `use:usa={{ props, on }}`, and JSX types.\n *\n * ```tsx\n * import { defineUsa, usa } from 'use-scroll-animate/components/solid';\n * import type {} from 'use-scroll-animate/components/solid'; // JSX types\n * onMount(() => defineUsa());\n * false && usa; // keep the directive import (Solid convention)\n * <usa-card use:usa={{ on: { flip: (e) => console.log(e.detail) } }} effect=\"flip\">…</usa-card>\n * ```\n */\nimport { createRenderEffect, onCleanup } from 'solid-js';\nimport { defineComponents, type ComponentCategory } from '../index';\nimport { bindUsa, type UsaBinding } from './bind';\nimport type { UsaIntrinsicElements } from './jsx';\n\nexport { bindUsa, usaEventName } from './bind';\nexport type { UsaBinding } from './bind';\n\n/**\n * Solid directive (`use:usa`). Solid calls it with the element and an\n * accessor; since 4.0.1 the binding is tracked with `createRenderEffect`, so\n * signals read inside `{{ props, on }}` update the element automatically and\n * the listeners are removed on cleanup. `refresh()` is kept for code that\n * calls the directive outside a reactive owner.\n */\nexport function usa(el: HTMLElement, accessor: () => UsaBinding | undefined): { refresh(): void; destroy(): void } {\n let b: ReturnType<typeof bindUsa> | null = null;\n const run = () => {\n const v = accessor() || {};\n if (b) b.update(v);\n else b = bindUsa(el, v);\n };\n createRenderEffect(run);\n if (!b) run();\n const destroy = () => b?.destroy();\n onCleanup(destroy);\n return { refresh: run, destroy };\n}\n\n/** Register the elements (all, or some categories) — call from `onMount` in SSR apps. */\nexport function defineUsa(categories?: ComponentCategory[]): void {\n if (typeof window !== 'undefined') defineComponents(categories);\n}\n\n/** JSX intrinsic elements for Solid (same attribute types as the React/Preact ones). */\nexport type SolidUsaIntrinsicElements = UsaIntrinsicElements;\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"solid.js","sources":["../../src/components/frameworks/solid.ts"],"sourcesContent":["/**\n * use-scroll-animate/components/solid — Solid integration (v3.8).\n * Solid renders custom elements natively: set properties with `prop:` and\n * listen with `on:` (`<usa-toggle prop:checked={on()} on:usa:change={…}>`).\n * This entry adds `defineUsa()` (client only, SolidStart-safe), a `usa`\n * directive for `use:usa={{ props, on }}`, and JSX types.\n *\n * ```tsx\n * import { defineUsa, usa } from 'use-scroll-animate/components/solid';\n * import type {} from 'use-scroll-animate/components/solid'; // JSX types\n * onMount(() => defineUsa());\n * false && usa; // keep the directive import (Solid convention)\n * <usa-card use:usa={{ on: { flip: (e) => console.log(e.detail) } }} effect=\"flip\">…</usa-card>\n * ```\n */\nimport { createRenderEffect, onCleanup } from 'solid-js';\nimport { defineComponents, type ComponentCategory } from '../index';\nimport { bindUsa, type UsaBinding } from './bind';\nimport type { UsaIntrinsicElements } from './jsx';\n\nexport { bindUsa, usaEventName } from './bind';\nexport type { UsaBinding } from './bind';\n\n/**\n * Solid directive (`use:usa`). Solid calls it with the element and an\n * accessor; since 4.0.1 the binding is tracked with `createRenderEffect`, so\n * signals read inside `{{ props, on }}` update the element automatically and\n * the listeners are removed on cleanup. `refresh()` is kept for code that\n * calls the directive outside a reactive owner.\n */\nexport function usa(el: HTMLElement, accessor: () => UsaBinding | undefined): { refresh(): void; destroy(): void } {\n let b: ReturnType<typeof bindUsa> | null = null;\n const run = () => {\n const v = accessor() || {};\n if (b) b.update(v);\n else b = bindUsa(el, v);\n };\n createRenderEffect(run);\n if (!b) run();\n const destroy = () => b?.destroy();\n onCleanup(destroy);\n return { refresh: run, destroy };\n}\n\n/** Register the elements (all, or some categories) — call from `onMount` in SSR apps. */\nexport function defineUsa(categories?: ComponentCategory[]): void {\n if (typeof window !== 'undefined') defineComponents(categories);\n}\n\n/** JSX intrinsic elements for Solid (same attribute types as the React/Preact ones). */\nexport type SolidUsaIntrinsicElements = UsaIntrinsicElements;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;AAcG;AASH;;;;;;AAMG;AACG,SAAU,GAAG,CAAC,EAAe,EAAE,QAAsC,EAAA;IACzE,IAAI,CAAC,GAAsC,IAAI;IAC/C,MAAM,GAAG,GAAG,MAAK;AACf,QAAA,MAAM,CAAC,GAAG,QAAQ,EAAE,IAAI,EAAE;AAC1B,QAAA,IAAI,CAAC;AAAE,YAAA,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;;AACb,YAAA,CAAC,GAAG,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;AACzB,IAAA,CAAC;IACD,kBAAkB,CAAC,GAAG,CAAC;AACvB,IAAA,IAAI,CAAC,CAAC;AAAE,QAAA,GAAG,EAAE;IACb,MAAM,OAAO,GAAG,MAAM,CAAC,EAAE,OAAO,EAAE;IAClC,SAAS,CAAC,OAAO,CAAC;AAClB,IAAA,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE;AAClC;AAEA;AACM,SAAU,SAAS,CAAC,UAAgC,EAAA;IACxD,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,gBAAgB,CAAC,UAAU,CAAC;AACjE;;;;"}
|
|
@@ -3,29 +3,30 @@
|
|
|
3
3
|
var components = require('../components.cjs');
|
|
4
4
|
var bind = require('../chunks/bind-Ui43-n2d.cjs');
|
|
5
5
|
require('./reveal.cjs');
|
|
6
|
-
require('../chunks/base-
|
|
6
|
+
require('../chunks/base-DE2yzxE7.cjs');
|
|
7
7
|
require('./text.cjs');
|
|
8
|
+
require('../chunks/core-BC9S2osy.cjs');
|
|
9
|
+
require('./tokens.cjs');
|
|
8
10
|
require('./interaction.cjs');
|
|
9
11
|
require('./feedback.cjs');
|
|
10
12
|
require('./background.cjs');
|
|
11
|
-
require('../chunks/variants-
|
|
13
|
+
require('../chunks/variants-CM2zaG8v.cjs');
|
|
12
14
|
require('./transitions.cjs');
|
|
13
15
|
require('./physics.cjs');
|
|
14
|
-
require('../chunks/spring-
|
|
16
|
+
require('../chunks/spring-hsmgd7ml.cjs');
|
|
15
17
|
require('./cards.cjs');
|
|
16
18
|
require('./click.cjs');
|
|
17
19
|
require('./ui.cjs');
|
|
18
20
|
require('./page.cjs');
|
|
19
21
|
require('./timeline.cjs');
|
|
20
|
-
require('../chunks/core-BRIIoKeS.cjs');
|
|
21
|
-
require('./tokens.cjs');
|
|
22
22
|
require('./gesture.cjs');
|
|
23
|
-
require('../chunks/core-
|
|
23
|
+
require('../chunks/core-DPYjLqA0.cjs');
|
|
24
24
|
require('./svg.cjs');
|
|
25
25
|
require('./webgl.cjs');
|
|
26
26
|
require('./depth.cjs');
|
|
27
27
|
require('./layout.cjs');
|
|
28
28
|
require('./packs.cjs');
|
|
29
|
+
require('./a11y.cjs');
|
|
29
30
|
require('../chunks/index-tags-BQh_uGqH.cjs');
|
|
30
31
|
|
|
31
32
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svelte.cjs","sources":["../../src/components/frameworks/svelte.ts"],"sourcesContent":["/**\n * use-scroll-animate/components/svelte — Svelte integration (v3.8).\n * Svelte (3, 4, 5) renders `<usa-*>` tags natively; `use:usa` sets\n * **properties** and `usa:*` listeners in one place, and `defineUsa()`\n * registers the elements on the client only (safe in SvelteKit SSR).\n *\n * ```svelte\n * <script>\n * import { usa, defineUsa } from 'use-scroll-animate/components/svelte';\n * import { onMount } from 'svelte';\n * onMount(() => defineUsa(['click', 'ui']));\n * let on = false;\n * </script>\n * <usa-toggle use:usa={{ props: { checked: on }, on: { change: (e) => (on = e.detail.checked) } }}></usa-toggle>\n * ```\n * Plain `on:usa:change` does not compile in Svelte 3/4 (colon); use the action or `onusa:change` in Svelte 5.\n */\nimport { defineComponents, type ComponentCategory } from '../index';\nimport { bindUsa, type UsaBinding } from './bind';\n\nexport { bindUsa, usaEventName } from './bind';\nexport type { UsaBinding } from './bind';\n\n/** Svelte action: `use:usa={{ props, on }}`. */\nexport function usa(node: HTMLElement, binding: UsaBinding = {}): { update(b: UsaBinding): void; destroy(): void } {\n return bindUsa(node, binding);\n}\n\n/** Register the elements (all, or some categories) — call from `onMount` for SSR apps. */\nexport function defineUsa(categories?: ComponentCategory[]): void {\n if (typeof window !== 'undefined') defineComponents(categories);\n}\n"],"names":["bindUsa","defineComponents"],"mappings":"
|
|
1
|
+
{"version":3,"file":"svelte.cjs","sources":["../../src/components/frameworks/svelte.ts"],"sourcesContent":["/**\n * use-scroll-animate/components/svelte — Svelte integration (v3.8).\n * Svelte (3, 4, 5) renders `<usa-*>` tags natively; `use:usa` sets\n * **properties** and `usa:*` listeners in one place, and `defineUsa()`\n * registers the elements on the client only (safe in SvelteKit SSR).\n *\n * ```svelte\n * <script>\n * import { usa, defineUsa } from 'use-scroll-animate/components/svelte';\n * import { onMount } from 'svelte';\n * onMount(() => defineUsa(['click', 'ui']));\n * let on = false;\n * </script>\n * <usa-toggle use:usa={{ props: { checked: on }, on: { change: (e) => (on = e.detail.checked) } }}></usa-toggle>\n * ```\n * Plain `on:usa:change` does not compile in Svelte 3/4 (colon); use the action or `onusa:change` in Svelte 5.\n */\nimport { defineComponents, type ComponentCategory } from '../index';\nimport { bindUsa, type UsaBinding } from './bind';\n\nexport { bindUsa, usaEventName } from './bind';\nexport type { UsaBinding } from './bind';\n\n/** Svelte action: `use:usa={{ props, on }}`. */\nexport function usa(node: HTMLElement, binding: UsaBinding = {}): { update(b: UsaBinding): void; destroy(): void } {\n return bindUsa(node, binding);\n}\n\n/** Register the elements (all, or some categories) — call from `onMount` for SSR apps. */\nexport function defineUsa(categories?: ComponentCategory[]): void {\n if (typeof window !== 'undefined') defineComponents(categories);\n}\n"],"names":["bindUsa","defineComponents"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;AAgBG;AAOH;SACgB,GAAG,CAAC,IAAiB,EAAE,UAAsB,EAAE,EAAA;AAC7D,IAAA,OAAOA,YAAO,CAAC,IAAI,EAAE,OAAO,CAAC;AAC/B;AAEA;AACM,SAAU,SAAS,CAAC,UAAgC,EAAA;IACxD,IAAI,OAAO,MAAM,KAAK,WAAW;QAAEC,2BAAgB,CAAC,UAAU,CAAC;AACjE;;;;;;;"}
|
|
@@ -117,7 +117,11 @@ interface UsaTypewriterElement extends UsaElement {
|
|
|
117
117
|
* them in a cascade (pure CSS animation per unit, transform / opacity /
|
|
118
118
|
* filter only). Words never break across lines.
|
|
119
119
|
*
|
|
120
|
-
*
|
|
120
|
+
* 4.3: `Intl.Segmenter`-aware (emoji, CJK words), Arabic-script words are
|
|
121
|
+
* never split below the word, `by="lines"` reveals line by line, and `from`
|
|
122
|
+
* (`start` · `end` · `center` · `edges` · `random`) sets the cascade order.
|
|
123
|
+
*
|
|
124
|
+
* Attributes: `by` (`chars` | `words` | `lines`, default `chars`), `effect`
|
|
121
125
|
* (`rise` | `fade` | `blur` | `flip` | `pop`, default `rise`), `stagger`
|
|
122
126
|
* (ms between units, 28 for chars / 70 for words), `duration` (ms, 620),
|
|
123
127
|
* `delay` (ms, 0), `trigger` (`view` | `load` | `manual`, default `view`),
|
|
@@ -230,6 +234,81 @@ interface UsaScrollHighlightElement extends UsaElement {
|
|
|
230
234
|
readonly progress: number;
|
|
231
235
|
}
|
|
232
236
|
|
|
237
|
+
/**
|
|
238
|
+
* Where a step starts on a timeline:
|
|
239
|
+
* - a number: absolute time in ms
|
|
240
|
+
* - `'>'` (default): when the previous step ends · `'<'`: when it starts
|
|
241
|
+
* - `'+=200'` / `'-=200'`: after / overlapping the previous end
|
|
242
|
+
* - `'<+=100'`: 100ms after the previous step's start
|
|
243
|
+
* - `'intro'` / `'intro+=150'`: at (or relative to) a label
|
|
244
|
+
*/
|
|
245
|
+
type TimelinePosition = number | string;
|
|
246
|
+
interface TimelineStepOptions {
|
|
247
|
+
/** Duration in ms or a motion token name (`'fast'`, `'slow'`…; 4.2). Default: timeline default, 600. */
|
|
248
|
+
duration?: number | string;
|
|
249
|
+
/** CSS easing or a motion token name (`'emphasized'`, `'spring'`…; 4.2). Default `cubic-bezier(0.22, 1, 0.36, 1)`. */
|
|
250
|
+
easing?: string;
|
|
251
|
+
/** Start position, see `TimelinePosition`. */
|
|
252
|
+
at?: TimelinePosition;
|
|
253
|
+
/** ms between targets when the selector matches several elements. */
|
|
254
|
+
stagger?: number;
|
|
255
|
+
}
|
|
256
|
+
interface ScrubOptions {
|
|
257
|
+
/** Scroll offset (px) before the source's top reaches the viewport bottom where progress starts (JS engine only). */
|
|
258
|
+
offset?: number;
|
|
259
|
+
/** Smoothing 0–1 (0 = immediate, default 0). Smoothing needs the JS engine. */
|
|
260
|
+
smooth?: number;
|
|
261
|
+
/**
|
|
262
|
+
* 4.1: which progress source drives the timeline.
|
|
263
|
+
* - `'view'` (default): `source` moving through the viewport (CSS `ViewTimeline`, range `cover`).
|
|
264
|
+
* - `'scroll'`: the scroll position of `source` itself (a scroll container; CSS `ScrollTimeline`).
|
|
265
|
+
*/
|
|
266
|
+
source?: 'view' | 'scroll';
|
|
267
|
+
/** 4.1: `'auto'` (default) uses the browser's native scroll-driven animations when available, `'js'` forces the fallback. */
|
|
268
|
+
engine?: 'auto' | 'native' | 'js';
|
|
269
|
+
/** 4.1: scroll axis, `'block'` (default) · `'inline'` · `'x'` · `'y'`. */
|
|
270
|
+
axis?: 'block' | 'inline' | 'x' | 'y';
|
|
271
|
+
}
|
|
272
|
+
/** The function `scrub()` returns: call it to stop. `native` tells which engine runs it. */
|
|
273
|
+
interface ScrubHandle {
|
|
274
|
+
(): void;
|
|
275
|
+
/** `true` when the browser's ScrollTimeline / ViewTimeline drives it (compositor, no JS per frame). */
|
|
276
|
+
readonly native: boolean;
|
|
277
|
+
}
|
|
278
|
+
interface Timeline {
|
|
279
|
+
/** Total length in ms. */
|
|
280
|
+
readonly duration: number;
|
|
281
|
+
/** Label positions in ms. */
|
|
282
|
+
readonly labels: Readonly<Record<string, number>>;
|
|
283
|
+
/** Current playhead in ms. */
|
|
284
|
+
readonly time: number;
|
|
285
|
+
/** Add a step: animate `target` with keyframes or a preset name (`fade-up`, `scale`…). */
|
|
286
|
+
to(target: string | Element | Element[] | NodeList, frames: Keyframe[] | string, options?: TimelineStepOptions): Timeline;
|
|
287
|
+
/** Name a position (default: the current end). */
|
|
288
|
+
label(name: string, at?: TimelinePosition): Timeline;
|
|
289
|
+
/** Run `fn` when the playhead passes `at`. */
|
|
290
|
+
call(fn: () => void, at?: TimelinePosition): Timeline;
|
|
291
|
+
/** Play forwards from the playhead (from 0 when at the end). Resolves at the end. */
|
|
292
|
+
play(from?: TimelinePosition): Promise<void>;
|
|
293
|
+
/** Play backwards to 0. */
|
|
294
|
+
reverse(): Promise<void>;
|
|
295
|
+
pause(): Timeline;
|
|
296
|
+
/** Jump to a time (ms) or label. */
|
|
297
|
+
seek(to: TimelinePosition): Timeline;
|
|
298
|
+
/** Get or set progress 0–1. */
|
|
299
|
+
progress(p?: number): number;
|
|
300
|
+
/**
|
|
301
|
+
* Tie progress to scroll: `source` moving through the viewport (or, with
|
|
302
|
+
* `{ source: 'scroll' }`, a scroll container's own position). Runs on native
|
|
303
|
+
* ScrollTimeline / ViewTimeline when available (and no `smooth`, `offset`,
|
|
304
|
+
* `call()` cues or `onUpdate` need JS), else on a rAF-throttled listener.
|
|
305
|
+
* Returns a stop function with a `native` flag.
|
|
306
|
+
*/
|
|
307
|
+
scrub(source: Element, options?: ScrubOptions): ScrubHandle;
|
|
308
|
+
/** Stop and drop every animation (elements keep their last frame). */
|
|
309
|
+
cancel(): void;
|
|
310
|
+
}
|
|
311
|
+
|
|
233
312
|
/**
|
|
234
313
|
* use-scroll-animate/components/text — text effects.
|
|
235
314
|
* `<usa-typewriter>`, `<usa-split-text>`, `<usa-scramble>`, `<usa-counter>`,
|
|
@@ -1275,81 +1354,6 @@ declare global {
|
|
|
1275
1354
|
}
|
|
1276
1355
|
}
|
|
1277
1356
|
|
|
1278
|
-
/**
|
|
1279
|
-
* Where a step starts on a timeline:
|
|
1280
|
-
* - a number: absolute time in ms
|
|
1281
|
-
* - `'>'` (default): when the previous step ends · `'<'`: when it starts
|
|
1282
|
-
* - `'+=200'` / `'-=200'`: after / overlapping the previous end
|
|
1283
|
-
* - `'<+=100'`: 100ms after the previous step's start
|
|
1284
|
-
* - `'intro'` / `'intro+=150'`: at (or relative to) a label
|
|
1285
|
-
*/
|
|
1286
|
-
type TimelinePosition = number | string;
|
|
1287
|
-
interface TimelineStepOptions {
|
|
1288
|
-
/** Duration in ms or a motion token name (`'fast'`, `'slow'`…; 4.2). Default: timeline default, 600. */
|
|
1289
|
-
duration?: number | string;
|
|
1290
|
-
/** CSS easing or a motion token name (`'emphasized'`, `'spring'`…; 4.2). Default `cubic-bezier(0.22, 1, 0.36, 1)`. */
|
|
1291
|
-
easing?: string;
|
|
1292
|
-
/** Start position, see `TimelinePosition`. */
|
|
1293
|
-
at?: TimelinePosition;
|
|
1294
|
-
/** ms between targets when the selector matches several elements. */
|
|
1295
|
-
stagger?: number;
|
|
1296
|
-
}
|
|
1297
|
-
interface ScrubOptions {
|
|
1298
|
-
/** Scroll offset (px) before the source's top reaches the viewport bottom where progress starts (JS engine only). */
|
|
1299
|
-
offset?: number;
|
|
1300
|
-
/** Smoothing 0–1 (0 = immediate, default 0). Smoothing needs the JS engine. */
|
|
1301
|
-
smooth?: number;
|
|
1302
|
-
/**
|
|
1303
|
-
* 4.1: which progress source drives the timeline.
|
|
1304
|
-
* - `'view'` (default): `source` moving through the viewport (CSS `ViewTimeline`, range `cover`).
|
|
1305
|
-
* - `'scroll'`: the scroll position of `source` itself (a scroll container; CSS `ScrollTimeline`).
|
|
1306
|
-
*/
|
|
1307
|
-
source?: 'view' | 'scroll';
|
|
1308
|
-
/** 4.1: `'auto'` (default) uses the browser's native scroll-driven animations when available, `'js'` forces the fallback. */
|
|
1309
|
-
engine?: 'auto' | 'native' | 'js';
|
|
1310
|
-
/** 4.1: scroll axis, `'block'` (default) · `'inline'` · `'x'` · `'y'`. */
|
|
1311
|
-
axis?: 'block' | 'inline' | 'x' | 'y';
|
|
1312
|
-
}
|
|
1313
|
-
/** The function `scrub()` returns: call it to stop. `native` tells which engine runs it. */
|
|
1314
|
-
interface ScrubHandle {
|
|
1315
|
-
(): void;
|
|
1316
|
-
/** `true` when the browser's ScrollTimeline / ViewTimeline drives it (compositor, no JS per frame). */
|
|
1317
|
-
readonly native: boolean;
|
|
1318
|
-
}
|
|
1319
|
-
interface Timeline {
|
|
1320
|
-
/** Total length in ms. */
|
|
1321
|
-
readonly duration: number;
|
|
1322
|
-
/** Label positions in ms. */
|
|
1323
|
-
readonly labels: Readonly<Record<string, number>>;
|
|
1324
|
-
/** Current playhead in ms. */
|
|
1325
|
-
readonly time: number;
|
|
1326
|
-
/** Add a step: animate `target` with keyframes or a preset name (`fade-up`, `scale`…). */
|
|
1327
|
-
to(target: string | Element | Element[] | NodeList, frames: Keyframe[] | string, options?: TimelineStepOptions): Timeline;
|
|
1328
|
-
/** Name a position (default: the current end). */
|
|
1329
|
-
label(name: string, at?: TimelinePosition): Timeline;
|
|
1330
|
-
/** Run `fn` when the playhead passes `at`. */
|
|
1331
|
-
call(fn: () => void, at?: TimelinePosition): Timeline;
|
|
1332
|
-
/** Play forwards from the playhead (from 0 when at the end). Resolves at the end. */
|
|
1333
|
-
play(from?: TimelinePosition): Promise<void>;
|
|
1334
|
-
/** Play backwards to 0. */
|
|
1335
|
-
reverse(): Promise<void>;
|
|
1336
|
-
pause(): Timeline;
|
|
1337
|
-
/** Jump to a time (ms) or label. */
|
|
1338
|
-
seek(to: TimelinePosition): Timeline;
|
|
1339
|
-
/** Get or set progress 0–1. */
|
|
1340
|
-
progress(p?: number): number;
|
|
1341
|
-
/**
|
|
1342
|
-
* Tie progress to scroll: `source` moving through the viewport (or, with
|
|
1343
|
-
* `{ source: 'scroll' }`, a scroll container's own position). Runs on native
|
|
1344
|
-
* ScrollTimeline / ViewTimeline when available (and no `smooth`, `offset`,
|
|
1345
|
-
* `call()` cues or `onUpdate` need JS), else on a rAF-throttled listener.
|
|
1346
|
-
* Returns a stop function with a `native` flag.
|
|
1347
|
-
*/
|
|
1348
|
-
scrub(source: Element, options?: ScrubOptions): ScrubHandle;
|
|
1349
|
-
/** Stop and drop every animation (elements keep their last frame). */
|
|
1350
|
-
cancel(): void;
|
|
1351
|
-
}
|
|
1352
|
-
|
|
1353
1357
|
/**
|
|
1354
1358
|
* `<usa-timeline>` — declarative choreography. Every descendant with
|
|
1355
1359
|
* `data-tl="<preset>"` becomes a step, in document order; `data-at`
|