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
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Members shared by every `<usa-*>` element. Attribute helpers, a cleanup
|
|
3
|
+
* bag that is emptied on disconnect, and motion helpers that degrade to the
|
|
4
|
+
* final state without WAAPI or under reduced motion.
|
|
5
|
+
*/
|
|
6
|
+
interface UsaElement extends HTMLElement {
|
|
7
|
+
/** `true` while reduced motion applies to this element. */
|
|
8
|
+
readonly reduced: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* `<usa-carousel>` (6.2) — swipeable carousel / slider. Each child is a slide.
|
|
13
|
+
* Attributes: `effect` (`slide` · `fade` · `scale` · `cards` — 3D coverflow),
|
|
14
|
+
* `autoplay` (ms; pauses on hover, focus, when off screen and under reduced
|
|
15
|
+
* motion), `loop`, `index`, `label` ("Carousel"), `no-controls`, `no-dots`.
|
|
16
|
+
* Drag / swipe with a pointer, arrow keys when focused. API: `next()`,
|
|
17
|
+
* `prev()`, `goTo(i)`, `index`, `length`. Events: `usa:change` (`{ index, from }`).
|
|
18
|
+
* Reduced motion: slides switch without movement.
|
|
19
|
+
*/
|
|
20
|
+
interface UsaCarouselElement extends UsaElement {
|
|
21
|
+
index: number;
|
|
22
|
+
readonly length: number;
|
|
23
|
+
next(): void;
|
|
24
|
+
prev(): void;
|
|
25
|
+
goTo(i: number): void;
|
|
26
|
+
}
|
|
27
|
+
declare const CAROUSEL_EFFECTS: readonly ["slide", "fade", "scale", "cards"];
|
|
28
|
+
declare function defineCarousel(tag?: string): CustomElementConstructor | undefined;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* `<usa-tab-bar>` (6.2) — tabs with an animated indicator that stretches
|
|
32
|
+
* from the old tab to the new one (leading edge first, then the trailing edge
|
|
33
|
+
* catches up). Children: `<button>` tabs, and optional panels marked
|
|
34
|
+
* `data-panel` (in the same order). Attributes: `indicator` (`pill` ·
|
|
35
|
+
* `underline` · `glow` · `gooey`), `selected` (index), `label`. Arrow keys,
|
|
36
|
+
* Home/End. API: `select(i)`, `selected`. Events: `usa:change` (`{ index, from }`).
|
|
37
|
+
* Panels slide in from the side of travel. Reduced motion: no stretch / slide.
|
|
38
|
+
*/
|
|
39
|
+
interface UsaTabBarElement extends UsaElement {
|
|
40
|
+
selected: number;
|
|
41
|
+
select(i: number): void;
|
|
42
|
+
}
|
|
43
|
+
declare const TAB_INDICATORS: readonly ["pill", "underline", "glow", "gooey"];
|
|
44
|
+
declare function defineTabBar(tag?: string): CustomElementConstructor | undefined;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* `<usa-disclosure>` (6.2) — accordion 2.0 on native `<details>`: the
|
|
48
|
+
* content springs open / closed (height + fade), the chevron flips with an
|
|
49
|
+
* overshoot. Children: `<details><summary>…</summary>…</details>`.
|
|
50
|
+
* Attributes: `multiple` (allow several open; default: one at a time),
|
|
51
|
+
* `spring` (preset, default `gentle`), `variant="cards"`. API: `openAll()`,
|
|
52
|
+
* `closeAll()`, `toggle(i, force?)`. Events: `usa:toggle` (`{ index, open }`).
|
|
53
|
+
* Native semantics (keyboard, find-in-page) kept. Reduced motion: instant.
|
|
54
|
+
*/
|
|
55
|
+
interface UsaDisclosureElement extends UsaElement {
|
|
56
|
+
toggle(i: number, force?: boolean): void;
|
|
57
|
+
openAll(): void;
|
|
58
|
+
closeAll(): void;
|
|
59
|
+
}
|
|
60
|
+
declare function defineDisclosure(tag?: string): CustomElementConstructor | undefined;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* `<usa-stories>` (6.2) — story viewer: segmented progress bars at the top,
|
|
64
|
+
* auto-advance, tap the left / right third to go back / forward, press and
|
|
65
|
+
* hold to pause, a pause button (WCAG 2.2.2). Each child is one story.
|
|
66
|
+
* Attributes: `duration` (ms per story, 5000), `loop`, `paused`.
|
|
67
|
+
* API: `next()`, `prev()`, `goTo(i)`, `pause()`, `play()`, `index`.
|
|
68
|
+
* Events: `usa:change` (`{ index }`), `usa:end`. Reduced motion: no
|
|
69
|
+
* auto-advance (paused until the user navigates), cross-fade only.
|
|
70
|
+
*/
|
|
71
|
+
interface UsaStoriesElement extends UsaElement {
|
|
72
|
+
readonly index: number;
|
|
73
|
+
next(): void;
|
|
74
|
+
prev(): void;
|
|
75
|
+
goTo(i: number): void;
|
|
76
|
+
pause(): void;
|
|
77
|
+
play(): void;
|
|
78
|
+
}
|
|
79
|
+
declare function defineStories(tag?: string): CustomElementConstructor | undefined;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* `<usa-toast-stack>` (6.3) — notifications that pile up into a collapsed
|
|
83
|
+
* stack (newest in front, older ones peeking behind), fan out on hover or
|
|
84
|
+
* focus, auto-dismiss (paused while hovered), and can be swiped away.
|
|
85
|
+
*
|
|
86
|
+
* Attributes: `position` (`bottom-right` · `bottom-left` · `bottom-center` ·
|
|
87
|
+
* `top-right` · `top-left` · `top-center`), `duration` (ms, `0` = sticky),
|
|
88
|
+
* `max` (visible in the stack), `contained` (positioned inside its parent
|
|
89
|
+
* instead of the viewport). API: `show(message | options)` → id,
|
|
90
|
+
* `dismiss(id)`, `clear()`; module helper `stackToast()` uses the first stack on
|
|
91
|
+
* the page (creating one). Any `[data-usa-toast="message"]` element shows a
|
|
92
|
+
* toast on click (`data-usa-toast-type`, `data-usa-target`). Events:
|
|
93
|
+
* `usa:show`, `usa:dismiss` (`{ id, reason }`). Toasts live in a polite live
|
|
94
|
+
* region. Reduced motion: no slide or swipe animation.
|
|
95
|
+
*/
|
|
96
|
+
interface StackToastOptions {
|
|
97
|
+
message?: string;
|
|
98
|
+
title?: string;
|
|
99
|
+
type?: 'info' | 'success' | 'warning' | 'error';
|
|
100
|
+
/** ms; 0 = stays until dismissed. Defaults to the stack's `duration`. */
|
|
101
|
+
duration?: number;
|
|
102
|
+
/** An action button. */
|
|
103
|
+
action?: {
|
|
104
|
+
label: string;
|
|
105
|
+
onClick?: () => void;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
interface UsaToastStackElement extends UsaElement {
|
|
109
|
+
show(input: string | StackToastOptions): string;
|
|
110
|
+
dismiss(id: string, reason?: string): void;
|
|
111
|
+
clear(): void;
|
|
112
|
+
readonly count: number;
|
|
113
|
+
}
|
|
114
|
+
declare const TOAST_POSITIONS: readonly ["bottom-right", "bottom-left", "bottom-center", "top-right", "top-left", "top-center"];
|
|
115
|
+
declare function defineToastStack(tag?: string): CustomElementConstructor | undefined;
|
|
116
|
+
/** Show a toast on the first `<usa-toast-stack>` of the page (one is created when missing). */
|
|
117
|
+
declare function stackToast(input: string | StackToastOptions, stack?: UsaToastStackElement | null): string;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* `<usa-modal>` and `<usa-sheet>` (6.3) — modal overlays on the native
|
|
121
|
+
* `<dialog>` (top layer, focus trap, Esc, inert page), with animated open
|
|
122
|
+
* and close and a fading, blurred backdrop.
|
|
123
|
+
*
|
|
124
|
+
* - `<usa-modal effect="scale | slide-up | flip | origin">` — `origin`
|
|
125
|
+
* grows the dialog out of the button that opened it.
|
|
126
|
+
* - `<usa-sheet side="right | left | bottom | top">` — a side sheet; a
|
|
127
|
+
* bottom sheet can be dragged down to dismiss (`<div data-handle>` or the
|
|
128
|
+
* built-in grab handle).
|
|
129
|
+
*
|
|
130
|
+
* Attributes: `open` (initial), `label`, `persistent` (backdrop click / Esc
|
|
131
|
+
* don't close). Any element with `data-usa-open="<id>"` opens the overlay
|
|
132
|
+
* with that id; `[data-usa-close]` inside closes it. API: `show(trigger?)`,
|
|
133
|
+
* `close(value?)`, `toggle()`, `opened`. Events: `usa:open`, `usa:close`
|
|
134
|
+
* (`{ value }`). Focus returns to the opener. Reduced motion: no movement,
|
|
135
|
+
* a short fade.
|
|
136
|
+
*/
|
|
137
|
+
interface UsaOverlayElement extends UsaElement {
|
|
138
|
+
readonly opened: boolean;
|
|
139
|
+
readonly returnValue: string;
|
|
140
|
+
show(trigger?: Element | null): void;
|
|
141
|
+
close(value?: string): Promise<void>;
|
|
142
|
+
toggle(): void;
|
|
143
|
+
}
|
|
144
|
+
type UsaModalElement = UsaOverlayElement;
|
|
145
|
+
type UsaSheetElement = UsaOverlayElement;
|
|
146
|
+
declare const MODAL_EFFECTS: readonly ["scale", "slide-up", "flip", "origin"];
|
|
147
|
+
declare const SHEET_SIDES: readonly ["right", "left", "bottom", "top"];
|
|
148
|
+
declare const defineModal: (tag?: string) => CustomElementConstructor | undefined;
|
|
149
|
+
declare const defineSheet: (tag?: string) => CustomElementConstructor | undefined;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* `<usa-menu>` (6.3) — a dropdown menu that unfolds from its button: the
|
|
153
|
+
* list scales out of the trigger corner and the items cascade in. The first
|
|
154
|
+
* child is the trigger (or `[data-trigger]`); the other children (`<button>`,
|
|
155
|
+
* `<a>`, `<hr>` separators) become menu items.
|
|
156
|
+
*
|
|
157
|
+
* Attributes: `placement` (`bottom-start` · `bottom-end` · `top-start` ·
|
|
158
|
+
* `top-end`), `effect` (`scale` · `fold` · `slide`). Keyboard: Enter / Space /
|
|
159
|
+
* ArrowDown open, arrows and Home / End move, Esc closes, Tab leaves; outside
|
|
160
|
+
* clicks close. API: `open()`, `close()`, `toggle()`, `opened`. Events:
|
|
161
|
+
* `usa:select` (`{ index, value, item }`), `usa:open`, `usa:close`. Reduced
|
|
162
|
+
* motion: a short fade.
|
|
163
|
+
*/
|
|
164
|
+
interface UsaMenuElement extends UsaElement {
|
|
165
|
+
readonly opened: boolean;
|
|
166
|
+
open(focus?: 'first' | 'last'): void;
|
|
167
|
+
close(focusTrigger?: boolean): void;
|
|
168
|
+
toggle(): void;
|
|
169
|
+
}
|
|
170
|
+
declare const MENU_EFFECTS: readonly ["scale", "fold", "slide"];
|
|
171
|
+
declare function defineMenu(tag?: string): CustomElementConstructor | undefined;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* motionary/components/widgets — the 6.x animated UI widgets, in their own
|
|
175
|
+
* entry so `motionary/components` and `components/lite` keep their size
|
|
176
|
+
* budgets. Every widget is reduced-motion safe and keyboard accessible.
|
|
177
|
+
*
|
|
178
|
+
* ```ts
|
|
179
|
+
* import { defineWidgets } from 'motionary/components/widgets';
|
|
180
|
+
* defineWidgets(); // or defineCarousel(), defineTabBar(), …
|
|
181
|
+
* ```
|
|
182
|
+
* No build step: `<script src="https://unpkg.com/motionary@6/dist/widgets.umd.js">`
|
|
183
|
+
* (registers every widget and every 6.x effect pack; `window.UsaWidgets`).
|
|
184
|
+
*/
|
|
185
|
+
|
|
186
|
+
/** The widgets by release (tag → define function). */
|
|
187
|
+
declare const WIDGETS: Record<string, Record<string, (tag?: string) => CustomElementConstructor | undefined>>;
|
|
188
|
+
/** Every widget tag, in release order. */
|
|
189
|
+
declare const WIDGET_TAGS: string[];
|
|
190
|
+
/** Register every widget (or only those of one release, e.g. `'6.2'`) under its default tag. */
|
|
191
|
+
declare function defineWidgets(release?: string): void;
|
|
192
|
+
declare global {
|
|
193
|
+
interface HTMLElementTagNameMap {
|
|
194
|
+
'usa-carousel': UsaCarouselElement;
|
|
195
|
+
'usa-tab-bar': UsaTabBarElement;
|
|
196
|
+
'usa-disclosure': UsaDisclosureElement;
|
|
197
|
+
'usa-stories': UsaStoriesElement;
|
|
198
|
+
'usa-toast-stack': UsaToastStackElement;
|
|
199
|
+
'usa-modal': UsaModalElement;
|
|
200
|
+
'usa-sheet': UsaSheetElement;
|
|
201
|
+
'usa-menu': UsaMenuElement;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export { CAROUSEL_EFFECTS, MENU_EFFECTS, MODAL_EFFECTS, SHEET_SIDES, TAB_INDICATORS, TOAST_POSITIONS, WIDGETS, WIDGET_TAGS, defineCarousel, defineDisclosure, defineMenu, defineModal, defineSheet, defineStories, defineTabBar, defineToastStack, defineWidgets, stackToast };
|
|
206
|
+
export type { StackToastOptions, UsaCarouselElement, UsaDisclosureElement, UsaMenuElement, UsaModalElement, UsaSheetElement, UsaStoriesElement, UsaTabBarElement, UsaToastStackElement };
|