use-scroll-animate 2.5.0 → 2.6.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 +20 -0
- package/README.md +1 -0
- package/README_ja.md +1 -0
- package/README_zh.md +1 -0
- package/dist/chunks/{base-CuvCgqLy.js → base-08OYzphB.js} +2 -2
- package/dist/chunks/{base-CuvCgqLy.js.map → base-08OYzphB.js.map} +1 -1
- package/dist/chunks/{base-CJ7XfidP.cjs → base-5DFCAnvH.cjs} +3 -1
- package/dist/chunks/{base-CJ7XfidP.cjs.map → base-5DFCAnvH.cjs.map} +1 -1
- package/dist/chunks/{spring-CGO9Jd9b.cjs → spring-Bi4qY0pL.cjs} +2 -2
- package/dist/chunks/{spring-CGO9Jd9b.cjs.map → spring-Bi4qY0pL.cjs.map} +1 -1
- package/dist/chunks/{spring-BKUU7-Xm.js → spring-CpeFkxNd.js} +2 -2
- package/dist/chunks/{spring-BKUU7-Xm.js.map → spring-CpeFkxNd.js.map} +1 -1
- package/dist/components/background.cjs +1 -1
- package/dist/components/background.js +2 -2
- package/dist/components/cards.cjs +2 -2
- package/dist/components/cards.js +3 -3
- package/dist/components/click.cjs +2 -2
- package/dist/components/click.js +3 -3
- package/dist/components/feedback.cjs +2 -2
- package/dist/components/feedback.css +1 -1
- package/dist/components/feedback.js +3 -3
- package/dist/components/interaction.cjs +2 -2
- package/dist/components/interaction.css +1 -1
- package/dist/components/interaction.js +3 -3
- package/dist/components/physics.cjs +2 -2
- package/dist/components/physics.js +4 -4
- package/dist/components/reveal.cjs +1 -1
- package/dist/components/reveal.js +2 -2
- package/dist/components/text.cjs +1 -1
- package/dist/components/text.js +2 -2
- package/dist/components/transitions.cjs +1 -1
- package/dist/components/transitions.js +2 -2
- package/dist/components/ui.cjs +1082 -0
- package/dist/components/ui.cjs.map +1 -0
- package/dist/components/ui.css +14 -0
- package/dist/components/ui.d.cts +251 -0
- package/dist/components/ui.d.ts +251 -0
- package/dist/components/ui.js +1064 -0
- package/dist/components/ui.js.map +1 -0
- package/dist/components.cjs +25 -4
- package/dist/components.cjs.map +1 -1
- package/dist/components.css +14 -2
- package/dist/components.d.cts +215 -2
- package/dist/components.d.ts +215 -2
- package/dist/components.js +10 -3
- package/dist/components.js.map +1 -1
- package/dist/components.umd.js +2 -2
- package/dist/components.umd.js.map +1 -1
- package/docs/components.md +20 -0
- package/package.json +13 -2
package/dist/components.d.cts
CHANGED
|
@@ -1212,6 +1212,218 @@ declare global {
|
|
|
1212
1212
|
}
|
|
1213
1213
|
}
|
|
1214
1214
|
|
|
1215
|
+
/**
|
|
1216
|
+
* `<usa-tabs>` — accessible tabs with a sliding (spring) indicator.
|
|
1217
|
+
* Tabs: `[data-tab]` children (buttons); panels: `[data-panel]` children, in
|
|
1218
|
+
* the same order. Arrow keys / Home / End move between tabs (roving tabindex).
|
|
1219
|
+
*
|
|
1220
|
+
* Attributes: `selected` (index, 0), `indicator` (`line` default, `pill`),
|
|
1221
|
+
* `variant`. Events: `usa:change` (`{ index }`). Panels fade/slide in;
|
|
1222
|
+
* reduced motion: the indicator jumps and panels switch instantly.
|
|
1223
|
+
*/
|
|
1224
|
+
interface UsaTabsElement extends UsaElement {
|
|
1225
|
+
selected: number;
|
|
1226
|
+
select(i: number, focus?: boolean): void;
|
|
1227
|
+
}
|
|
1228
|
+
declare function defineTabs(tag?: string): CustomElementConstructor | undefined;
|
|
1229
|
+
|
|
1230
|
+
/**
|
|
1231
|
+
* `<usa-drawer>` — a side panel that slides in with a spring and can be
|
|
1232
|
+
* dragged / swiped closed. Modal: backdrop, Esc, focus returns on close.
|
|
1233
|
+
* Attributes: `open`, `side` (`left` default, `right`, `top`, `bottom`),
|
|
1234
|
+
* `label`, `variant`. Events: `usa:open`, `usa:close`. `[data-close]` closes.
|
|
1235
|
+
* Reduced motion: opens and closes instantly.
|
|
1236
|
+
*/
|
|
1237
|
+
interface UsaDrawerElement extends UsaElement {
|
|
1238
|
+
open: boolean;
|
|
1239
|
+
show(): void;
|
|
1240
|
+
close(): void;
|
|
1241
|
+
}
|
|
1242
|
+
/**
|
|
1243
|
+
* `<usa-bottom-sheet>` — a draggable bottom sheet with snap points
|
|
1244
|
+
* (`snap="0.3,0.6,0.92"`, fractions of the viewport height; default
|
|
1245
|
+
* `0.5,0.92`; `start` = index of the snap it opens at, default 0), inertia and drag-down-to-dismiss. `[data-handle]` (or the
|
|
1246
|
+
* built-in grabber) drags it. Attributes: `open`, `snap`, `start` (initial
|
|
1247
|
+
* snap index), `label`, `variant`. Events: `usa:open`, `usa:close`, `usa:snap`.
|
|
1248
|
+
*/
|
|
1249
|
+
interface UsaBottomSheetElement extends UsaDrawerElement {
|
|
1250
|
+
}
|
|
1251
|
+
declare function defineDrawer(tag?: string): CustomElementConstructor | undefined;
|
|
1252
|
+
declare function defineBottomSheet(tag?: string): CustomElementConstructor | undefined;
|
|
1253
|
+
|
|
1254
|
+
/**
|
|
1255
|
+
* `<usa-pull-refresh>` — pull-to-refresh for a scroll container (itself):
|
|
1256
|
+
* pull down at the top (touch / pointer) and a spinner stretches in; past
|
|
1257
|
+
* `threshold` (px, 70) releasing fires `usa:refresh` — call
|
|
1258
|
+
* `event.detail.done()` (or return a promise to `onrefresh`) to finish.
|
|
1259
|
+
* Also exposes `refresh()` for a keyboard / button path.
|
|
1260
|
+
* Attributes: `threshold`, `disabled`, `label` (status text, "Refreshing").
|
|
1261
|
+
* Reduced motion: no stretch; the spinner simply appears while refreshing.
|
|
1262
|
+
*/
|
|
1263
|
+
interface UsaPullRefreshElement extends UsaElement {
|
|
1264
|
+
readonly refreshing: boolean;
|
|
1265
|
+
refresh(): Promise<void>;
|
|
1266
|
+
}
|
|
1267
|
+
declare function definePullRefresh(tag?: string): CustomElementConstructor | undefined;
|
|
1268
|
+
|
|
1269
|
+
/**
|
|
1270
|
+
* `<usa-fab>` — floating action button with a speed dial. The first element
|
|
1271
|
+
* child is the main button; the others are actions that fan out with a
|
|
1272
|
+
* staggered spring when it opens (`direction="up"` default, `down`, `left`,
|
|
1273
|
+
* `right`, `radial`). Esc / outside click closes; `aria-expanded` on the
|
|
1274
|
+
* main button; actions are hidden from AT while closed.
|
|
1275
|
+
* Attributes: `open`, `direction`, `position` (`bottom-right` default, `bottom-left`,
|
|
1276
|
+
* `inline`), `gap` (px, 56), `variant`. Events: `usa:toggle` (`{ open }`).
|
|
1277
|
+
* Reduced motion: actions appear without travel.
|
|
1278
|
+
*/
|
|
1279
|
+
interface UsaFabElement extends UsaElement {
|
|
1280
|
+
open: boolean;
|
|
1281
|
+
toggle(force?: boolean): void;
|
|
1282
|
+
}
|
|
1283
|
+
declare function defineFab(tag?: string): CustomElementConstructor | undefined;
|
|
1284
|
+
|
|
1285
|
+
/**
|
|
1286
|
+
* `<usa-navbar>` — an app bar that hides while you scroll down and returns
|
|
1287
|
+
* as soon as you scroll up (or reach the top); `shrink` makes it compact
|
|
1288
|
+
* once scrolled. Focus inside always reveals it.
|
|
1289
|
+
* Attributes: `threshold` (px of scroll before hiding, 64), `shrink`,
|
|
1290
|
+
* `target` (selector of a scroll container instead of the page), `variant`.
|
|
1291
|
+
* State attributes: `data-hidden`, `data-scrolled`. Events: `usa:hide`, `usa:show`.
|
|
1292
|
+
* Reduced motion: hides/shows without sliding (instant).
|
|
1293
|
+
*/
|
|
1294
|
+
interface UsaNavbarElement extends UsaElement {
|
|
1295
|
+
readonly hiddenByScroll: boolean;
|
|
1296
|
+
show(): void;
|
|
1297
|
+
}
|
|
1298
|
+
declare function defineNavbar(tag?: string): CustomElementConstructor | undefined;
|
|
1299
|
+
|
|
1300
|
+
/**
|
|
1301
|
+
* `<usa-slider>` — a form-associated range slider (`role="slider"`). The
|
|
1302
|
+
* thumb follows with a spring, grows while dragged and shows a value bubble.
|
|
1303
|
+
* Keyboard: arrows (step), PageUp/PageDown (10 steps), Home/End.
|
|
1304
|
+
* Attributes: `value`, `min` (0), `max` (100), `step` (1), `name`, `label`,
|
|
1305
|
+
* `bubble` (show the value while dragging), `disabled`, `variant`.
|
|
1306
|
+
* Events: `input` + `usa:input` while moving, `change` + `usa:change` on release.
|
|
1307
|
+
* Reduced motion: the thumb jumps (no spring).
|
|
1308
|
+
*/
|
|
1309
|
+
interface UsaSliderElement extends UsaElement {
|
|
1310
|
+
value: number;
|
|
1311
|
+
}
|
|
1312
|
+
declare function defineSlider(tag?: string): CustomElementConstructor | undefined;
|
|
1313
|
+
|
|
1314
|
+
/**
|
|
1315
|
+
* `<usa-rating>` — star rating with hover preview and a springy pop when a
|
|
1316
|
+
* value is chosen. `role="slider"` (arrow keys, Home/End, number keys).
|
|
1317
|
+
* Attributes: `value` (0), `max` (5), `icon` (★), `readonly`, `label`
|
|
1318
|
+
* ("Rating"), `name` (form value), `variant`. Events: `change`, `usa:change` (`{ value }`).
|
|
1319
|
+
* Reduced motion: no pop.
|
|
1320
|
+
*/
|
|
1321
|
+
interface UsaRatingElement extends UsaElement {
|
|
1322
|
+
value: number;
|
|
1323
|
+
}
|
|
1324
|
+
declare function defineRating(tag?: string): CustomElementConstructor | undefined;
|
|
1325
|
+
|
|
1326
|
+
/**
|
|
1327
|
+
* `<usa-tooltip text="…">` — a tooltip for the element it wraps, shown on
|
|
1328
|
+
* hover (after `delay` ms, 300) and on keyboard focus, hidden on Esc / blur.
|
|
1329
|
+
* It springs in from its placement side and flips to stay on screen; the
|
|
1330
|
+
* trigger gets `aria-describedby`.
|
|
1331
|
+
* Attributes: `text`, `placement` (`top` default, `bottom`, `left`, `right`),
|
|
1332
|
+
* `delay`, `variant`. Reduced motion: fades only.
|
|
1333
|
+
*/
|
|
1334
|
+
interface UsaTooltipElement extends UsaElement {
|
|
1335
|
+
show(): void;
|
|
1336
|
+
hide(): void;
|
|
1337
|
+
}
|
|
1338
|
+
declare function defineTooltip(tag?: string): CustomElementConstructor | undefined;
|
|
1339
|
+
|
|
1340
|
+
/**
|
|
1341
|
+
* `<usa-popover>` — a click-to-open popover: the first element child is the
|
|
1342
|
+
* trigger, `[data-popover]` is the content. Springs open from the trigger,
|
|
1343
|
+
* flips to stay on screen; Esc or an outside click closes and focus returns
|
|
1344
|
+
* to the trigger. `aria-expanded` / `aria-controls` on the trigger.
|
|
1345
|
+
* Attributes: `open`, `placement` (`bottom` default), `variant`. Events:
|
|
1346
|
+
* `usa:open`, `usa:close`. Reduced motion: fades only.
|
|
1347
|
+
*/
|
|
1348
|
+
interface UsaPopoverElement extends UsaElement {
|
|
1349
|
+
open: boolean;
|
|
1350
|
+
toggle(force?: boolean): void;
|
|
1351
|
+
}
|
|
1352
|
+
declare function definePopover(tag?: string): CustomElementConstructor | undefined;
|
|
1353
|
+
|
|
1354
|
+
/**
|
|
1355
|
+
* `<usa-badge>` — a count / dot badge on whatever it wraps; bumps with a
|
|
1356
|
+
* spring whenever the value changes and pulses with `pulse`.
|
|
1357
|
+
* Attributes: `value` (number or text; 0 / empty hides it unless
|
|
1358
|
+
* `show-zero`), `max` (99 → "99+"), `dot`, `pulse`, `label` (accessible
|
|
1359
|
+
* text, default "{n} new"), `variant`. Reduced motion: no bump or pulse.
|
|
1360
|
+
*/
|
|
1361
|
+
interface UsaBadgeElement extends UsaElement {
|
|
1362
|
+
value: string;
|
|
1363
|
+
}
|
|
1364
|
+
declare function defineBadge(tag?: string): CustomElementConstructor | undefined;
|
|
1365
|
+
|
|
1366
|
+
/**
|
|
1367
|
+
* `<usa-avatar-stack>` — overlapping avatars (its children: `<img>` or any
|
|
1368
|
+
* element) that spread apart with a spring on hover / focus; extra ones
|
|
1369
|
+
* collapse into a "+N" chip.
|
|
1370
|
+
* Attributes: `max` (visible avatars, 5), `size` (px, 36), `overlap` (0–1,
|
|
1371
|
+
* 0.35), `label` (group name), `variant`. Reduced motion: no spreading.
|
|
1372
|
+
*/
|
|
1373
|
+
interface UsaAvatarStackElement extends UsaElement {
|
|
1374
|
+
}
|
|
1375
|
+
declare function defineAvatarStack(tag?: string): CustomElementConstructor | undefined;
|
|
1376
|
+
|
|
1377
|
+
/**
|
|
1378
|
+
* Style variants (v2.6): `variant="minimal | neon | glass | brutalist |
|
|
1379
|
+
* fluent | material"` on any `<usa-*>` element — or on any ancestor as
|
|
1380
|
+
* `data-usa-variant`, or page-wide with `setVariant()` — sets the shared
|
|
1381
|
+
* design tokens every component reads:
|
|
1382
|
+
*
|
|
1383
|
+
* `--usa-accent`, `--usa-accent-text`, `--usa-surface`, `--usa-text`,
|
|
1384
|
+
* `--usa-radius`, `--usa-border`, `--usa-shadow`, `--usa-blur`, `--usa-font`.
|
|
1385
|
+
*
|
|
1386
|
+
* (`<usa-spinner>`, `<usa-check>` and `<usa-dialog>` already use `variant`
|
|
1387
|
+
* for their kind; the token names never clash with those values except
|
|
1388
|
+
* `fluent`, which means the same thing there.)
|
|
1389
|
+
*/
|
|
1390
|
+
declare const VARIANTS: readonly ["minimal", "neon", "glass", "brutalist", "fluent", "material"];
|
|
1391
|
+
type Variant = (typeof VARIANTS)[number];
|
|
1392
|
+
/** Inject the variant token sheet (done automatically by every `ui` component). */
|
|
1393
|
+
declare function adoptVariants(): void;
|
|
1394
|
+
/** Apply a variant to the whole page (or `root`); `null` removes it. */
|
|
1395
|
+
declare function setVariant(variant: Variant | null, root?: Element | null): void;
|
|
1396
|
+
|
|
1397
|
+
type Placement = 'top' | 'bottom' | 'left' | 'right';
|
|
1398
|
+
|
|
1399
|
+
/**
|
|
1400
|
+
* use-scroll-animate/components/ui — animated UI components + style variants (v2.6).
|
|
1401
|
+
* `<usa-tabs>`, `<usa-drawer>`, `<usa-bottom-sheet>`, `<usa-pull-refresh>`,
|
|
1402
|
+
* `<usa-fab>`, `<usa-navbar>`, `<usa-slider>`, `<usa-rating>`,
|
|
1403
|
+
* `<usa-tooltip>`, `<usa-popover>`, `<usa-badge>`, `<usa-avatar-stack>`,
|
|
1404
|
+
* and `variant="minimal | neon | glass | brutalist | fluent | material"`
|
|
1405
|
+
* design tokens (`setVariant()`, `VARIANTS`).
|
|
1406
|
+
*/
|
|
1407
|
+
|
|
1408
|
+
/** Register every component of this category under its default tag. */
|
|
1409
|
+
declare function defineUiComponents(): void;
|
|
1410
|
+
declare global {
|
|
1411
|
+
interface HTMLElementTagNameMap {
|
|
1412
|
+
'usa-tabs': UsaTabsElement;
|
|
1413
|
+
'usa-drawer': UsaDrawerElement;
|
|
1414
|
+
'usa-bottom-sheet': UsaBottomSheetElement;
|
|
1415
|
+
'usa-pull-refresh': UsaPullRefreshElement;
|
|
1416
|
+
'usa-fab': UsaFabElement;
|
|
1417
|
+
'usa-navbar': UsaNavbarElement;
|
|
1418
|
+
'usa-slider': UsaSliderElement;
|
|
1419
|
+
'usa-rating': UsaRatingElement;
|
|
1420
|
+
'usa-tooltip': UsaTooltipElement;
|
|
1421
|
+
'usa-popover': UsaPopoverElement;
|
|
1422
|
+
'usa-badge': UsaBadgeElement;
|
|
1423
|
+
'usa-avatar-stack': UsaAvatarStackElement;
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1215
1427
|
/** The component categories and their default tags. */
|
|
1216
1428
|
declare const COMPONENT_CATEGORIES: {
|
|
1217
1429
|
readonly reveal: readonly ["usa-reveal", "usa-stagger", "usa-scroll-progress", "usa-scrolly"];
|
|
@@ -1223,6 +1435,7 @@ declare const COMPONENT_CATEGORIES: {
|
|
|
1223
1435
|
readonly physics: readonly ["usa-spring", "usa-draggable", "usa-overscroll"];
|
|
1224
1436
|
readonly cards: readonly ["usa-card", "usa-card-stack", "usa-sticky-stack", "usa-carousel-3d"];
|
|
1225
1437
|
readonly click: readonly ["usa-click", "usa-button", "usa-icon-morph", "usa-like", "usa-hold", "usa-double-tap", "usa-checkbox"];
|
|
1438
|
+
readonly ui: readonly ["usa-tabs", "usa-drawer", "usa-bottom-sheet", "usa-pull-refresh", "usa-fab", "usa-navbar", "usa-slider", "usa-rating", "usa-tooltip", "usa-popover", "usa-badge", "usa-avatar-stack"];
|
|
1226
1439
|
};
|
|
1227
1440
|
type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;
|
|
1228
1441
|
/**
|
|
@@ -1231,5 +1444,5 @@ type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;
|
|
|
1231
1444
|
*/
|
|
1232
1445
|
declare function defineComponents(categories?: ComponentCategory[]): void;
|
|
1233
1446
|
|
|
1234
|
-
export { BUTTON_DEFORMS, CARD_EFFECTS, CLICK_EFFECTS, COMPONENT_CATEGORIES, MORPH_ICONS, REVEAL_EFFECTS, SPINNER_VARIANTS, SPRING_EFFECTS, SPRING_PRESETS, burst, confetti, configureComponents, connectedAnimation, createSpring, defineAccordion, defineAcrylic, defineAurora, defineBackgroundComponents, defineButton, defineCard, defineCardComponents, defineCardStack, defineCarousel3d, defineCheck, defineCheckbox, defineClick, defineClickComponents, defineComponents, defineCounter, defineDialog, defineDoubleTap, defineDraggable, defineFeedbackComponents, defineFlipList, defineGrain, defineHold, defineIconMorph, defineInteractionComponents, defineLike, defineMagnetic, defineMarquee, defineOverscroll, defineParticles, definePhysicsComponents, definePress, defineProgress, defineReveal, defineRevealComponents, defineRipple, defineScramble, defineScrollProgress, defineScrolly, defineShimmerText, defineSkeleton, defineSpinner, defineSplitText, defineSpotlight, defineSpring, defineStagger, defineStickyStack, defineTextComponents, defineTextRotate, defineTilt, defineToaster, defineToggle, defineTransitionComponents, defineTypewriter, defineViewSwitch, easeOutExpo, flip, haptic, linearEasing, morphPath, prefersReducedMotion, projectInertia, readScrollProgress, resolveSpring, revealKeyframes, rubberBand, scrambleFrame, shake, snapTo, spring, springEasing, springEffectKeyframes, springSamples, stepSpring, supportsLinearEasing, toast, viewTransition };
|
|
1235
|
-
export type { BurstOptions, ButtonDeform, ButtonShape, ButtonState, CardEffect, ClickEffect, ComponentCategory, ComponentsConfig, ConfettiOptions, ConnectedOptions, DialogVariant, FlipOptions, RevealEffect, SpinnerVariant, SpringConfig, SpringEffect, SpringInput, SpringPreset, SpringValue, SpringValueOptions, ToastHandle, ToastOptions, ToastType, UsaAccordionElement, UsaAcrylicElement, UsaAuroraElement, UsaButtonElement, UsaCardElement, UsaCardStackElement, UsaCarousel3dElement, UsaCheckElement, UsaCheckboxElement, UsaClickElement, UsaCounterElement, UsaDialogElement, UsaDoubleTapElement, UsaDraggableElement, UsaElement, UsaFlipListElement, UsaGrainElement, UsaHoldElement, UsaIconMorphElement, UsaLikeElement, UsaMagneticElement, UsaMarqueeElement, UsaOverscrollElement, UsaParticlesElement, UsaPressElement, UsaProgressElement, UsaRevealElement, UsaRippleElement, UsaScrambleElement, UsaScrollProgressElement, UsaScrollyElement, UsaShimmerTextElement, UsaSkeletonElement, UsaSpinnerElement, UsaSplitTextElement, UsaSpotlightElement, UsaSpringElement, UsaStaggerElement, UsaStickyStackElement, UsaTextRotateElement, UsaTiltElement, UsaToasterElement, UsaToggleElement, UsaTypewriterElement, UsaViewSwitchElement, ViewTransitionOptions };
|
|
1447
|
+
export { BUTTON_DEFORMS, CARD_EFFECTS, CLICK_EFFECTS, COMPONENT_CATEGORIES, MORPH_ICONS, REVEAL_EFFECTS, SPINNER_VARIANTS, SPRING_EFFECTS, SPRING_PRESETS, VARIANTS, adoptVariants, burst, confetti, configureComponents, connectedAnimation, createSpring, defineAccordion, defineAcrylic, defineAurora, defineAvatarStack, defineBackgroundComponents, defineBadge, defineBottomSheet, defineButton, defineCard, defineCardComponents, defineCardStack, defineCarousel3d, defineCheck, defineCheckbox, defineClick, defineClickComponents, defineComponents, defineCounter, defineDialog, defineDoubleTap, defineDraggable, defineDrawer, defineFab, defineFeedbackComponents, defineFlipList, defineGrain, defineHold, defineIconMorph, defineInteractionComponents, defineLike, defineMagnetic, defineMarquee, defineNavbar, defineOverscroll, defineParticles, definePhysicsComponents, definePopover, definePress, defineProgress, definePullRefresh, defineRating, defineReveal, defineRevealComponents, defineRipple, defineScramble, defineScrollProgress, defineScrolly, defineShimmerText, defineSkeleton, defineSlider, defineSpinner, defineSplitText, defineSpotlight, defineSpring, defineStagger, defineStickyStack, defineTabs, defineTextComponents, defineTextRotate, defineTilt, defineToaster, defineToggle, defineTooltip, defineTransitionComponents, defineTypewriter, defineUiComponents, defineViewSwitch, easeOutExpo, flip, haptic, linearEasing, morphPath, prefersReducedMotion, projectInertia, readScrollProgress, resolveSpring, revealKeyframes, rubberBand, scrambleFrame, setVariant, shake, snapTo, spring, springEasing, springEffectKeyframes, springSamples, stepSpring, supportsLinearEasing, toast, viewTransition };
|
|
1448
|
+
export type { BurstOptions, ButtonDeform, ButtonShape, ButtonState, CardEffect, ClickEffect, ComponentCategory, ComponentsConfig, ConfettiOptions, ConnectedOptions, DialogVariant, FlipOptions, Placement, RevealEffect, SpinnerVariant, SpringConfig, SpringEffect, SpringInput, SpringPreset, SpringValue, SpringValueOptions, ToastHandle, ToastOptions, ToastType, UsaAccordionElement, UsaAcrylicElement, UsaAuroraElement, UsaAvatarStackElement, UsaBadgeElement, UsaBottomSheetElement, UsaButtonElement, UsaCardElement, UsaCardStackElement, UsaCarousel3dElement, UsaCheckElement, UsaCheckboxElement, UsaClickElement, UsaCounterElement, UsaDialogElement, UsaDoubleTapElement, UsaDraggableElement, UsaDrawerElement, UsaElement, UsaFabElement, UsaFlipListElement, UsaGrainElement, UsaHoldElement, UsaIconMorphElement, UsaLikeElement, UsaMagneticElement, UsaMarqueeElement, UsaNavbarElement, UsaOverscrollElement, UsaParticlesElement, UsaPopoverElement, UsaPressElement, UsaProgressElement, UsaPullRefreshElement, UsaRatingElement, UsaRevealElement, UsaRippleElement, UsaScrambleElement, UsaScrollProgressElement, UsaScrollyElement, UsaShimmerTextElement, UsaSkeletonElement, UsaSliderElement, UsaSpinnerElement, UsaSplitTextElement, UsaSpotlightElement, UsaSpringElement, UsaStaggerElement, UsaStickyStackElement, UsaTabsElement, UsaTextRotateElement, UsaTiltElement, UsaToasterElement, UsaToggleElement, UsaTooltipElement, UsaTypewriterElement, UsaViewSwitchElement, Variant, ViewTransitionOptions };
|
package/dist/components.d.ts
CHANGED
|
@@ -1212,6 +1212,218 @@ declare global {
|
|
|
1212
1212
|
}
|
|
1213
1213
|
}
|
|
1214
1214
|
|
|
1215
|
+
/**
|
|
1216
|
+
* `<usa-tabs>` — accessible tabs with a sliding (spring) indicator.
|
|
1217
|
+
* Tabs: `[data-tab]` children (buttons); panels: `[data-panel]` children, in
|
|
1218
|
+
* the same order. Arrow keys / Home / End move between tabs (roving tabindex).
|
|
1219
|
+
*
|
|
1220
|
+
* Attributes: `selected` (index, 0), `indicator` (`line` default, `pill`),
|
|
1221
|
+
* `variant`. Events: `usa:change` (`{ index }`). Panels fade/slide in;
|
|
1222
|
+
* reduced motion: the indicator jumps and panels switch instantly.
|
|
1223
|
+
*/
|
|
1224
|
+
interface UsaTabsElement extends UsaElement {
|
|
1225
|
+
selected: number;
|
|
1226
|
+
select(i: number, focus?: boolean): void;
|
|
1227
|
+
}
|
|
1228
|
+
declare function defineTabs(tag?: string): CustomElementConstructor | undefined;
|
|
1229
|
+
|
|
1230
|
+
/**
|
|
1231
|
+
* `<usa-drawer>` — a side panel that slides in with a spring and can be
|
|
1232
|
+
* dragged / swiped closed. Modal: backdrop, Esc, focus returns on close.
|
|
1233
|
+
* Attributes: `open`, `side` (`left` default, `right`, `top`, `bottom`),
|
|
1234
|
+
* `label`, `variant`. Events: `usa:open`, `usa:close`. `[data-close]` closes.
|
|
1235
|
+
* Reduced motion: opens and closes instantly.
|
|
1236
|
+
*/
|
|
1237
|
+
interface UsaDrawerElement extends UsaElement {
|
|
1238
|
+
open: boolean;
|
|
1239
|
+
show(): void;
|
|
1240
|
+
close(): void;
|
|
1241
|
+
}
|
|
1242
|
+
/**
|
|
1243
|
+
* `<usa-bottom-sheet>` — a draggable bottom sheet with snap points
|
|
1244
|
+
* (`snap="0.3,0.6,0.92"`, fractions of the viewport height; default
|
|
1245
|
+
* `0.5,0.92`; `start` = index of the snap it opens at, default 0), inertia and drag-down-to-dismiss. `[data-handle]` (or the
|
|
1246
|
+
* built-in grabber) drags it. Attributes: `open`, `snap`, `start` (initial
|
|
1247
|
+
* snap index), `label`, `variant`. Events: `usa:open`, `usa:close`, `usa:snap`.
|
|
1248
|
+
*/
|
|
1249
|
+
interface UsaBottomSheetElement extends UsaDrawerElement {
|
|
1250
|
+
}
|
|
1251
|
+
declare function defineDrawer(tag?: string): CustomElementConstructor | undefined;
|
|
1252
|
+
declare function defineBottomSheet(tag?: string): CustomElementConstructor | undefined;
|
|
1253
|
+
|
|
1254
|
+
/**
|
|
1255
|
+
* `<usa-pull-refresh>` — pull-to-refresh for a scroll container (itself):
|
|
1256
|
+
* pull down at the top (touch / pointer) and a spinner stretches in; past
|
|
1257
|
+
* `threshold` (px, 70) releasing fires `usa:refresh` — call
|
|
1258
|
+
* `event.detail.done()` (or return a promise to `onrefresh`) to finish.
|
|
1259
|
+
* Also exposes `refresh()` for a keyboard / button path.
|
|
1260
|
+
* Attributes: `threshold`, `disabled`, `label` (status text, "Refreshing").
|
|
1261
|
+
* Reduced motion: no stretch; the spinner simply appears while refreshing.
|
|
1262
|
+
*/
|
|
1263
|
+
interface UsaPullRefreshElement extends UsaElement {
|
|
1264
|
+
readonly refreshing: boolean;
|
|
1265
|
+
refresh(): Promise<void>;
|
|
1266
|
+
}
|
|
1267
|
+
declare function definePullRefresh(tag?: string): CustomElementConstructor | undefined;
|
|
1268
|
+
|
|
1269
|
+
/**
|
|
1270
|
+
* `<usa-fab>` — floating action button with a speed dial. The first element
|
|
1271
|
+
* child is the main button; the others are actions that fan out with a
|
|
1272
|
+
* staggered spring when it opens (`direction="up"` default, `down`, `left`,
|
|
1273
|
+
* `right`, `radial`). Esc / outside click closes; `aria-expanded` on the
|
|
1274
|
+
* main button; actions are hidden from AT while closed.
|
|
1275
|
+
* Attributes: `open`, `direction`, `position` (`bottom-right` default, `bottom-left`,
|
|
1276
|
+
* `inline`), `gap` (px, 56), `variant`. Events: `usa:toggle` (`{ open }`).
|
|
1277
|
+
* Reduced motion: actions appear without travel.
|
|
1278
|
+
*/
|
|
1279
|
+
interface UsaFabElement extends UsaElement {
|
|
1280
|
+
open: boolean;
|
|
1281
|
+
toggle(force?: boolean): void;
|
|
1282
|
+
}
|
|
1283
|
+
declare function defineFab(tag?: string): CustomElementConstructor | undefined;
|
|
1284
|
+
|
|
1285
|
+
/**
|
|
1286
|
+
* `<usa-navbar>` — an app bar that hides while you scroll down and returns
|
|
1287
|
+
* as soon as you scroll up (or reach the top); `shrink` makes it compact
|
|
1288
|
+
* once scrolled. Focus inside always reveals it.
|
|
1289
|
+
* Attributes: `threshold` (px of scroll before hiding, 64), `shrink`,
|
|
1290
|
+
* `target` (selector of a scroll container instead of the page), `variant`.
|
|
1291
|
+
* State attributes: `data-hidden`, `data-scrolled`. Events: `usa:hide`, `usa:show`.
|
|
1292
|
+
* Reduced motion: hides/shows without sliding (instant).
|
|
1293
|
+
*/
|
|
1294
|
+
interface UsaNavbarElement extends UsaElement {
|
|
1295
|
+
readonly hiddenByScroll: boolean;
|
|
1296
|
+
show(): void;
|
|
1297
|
+
}
|
|
1298
|
+
declare function defineNavbar(tag?: string): CustomElementConstructor | undefined;
|
|
1299
|
+
|
|
1300
|
+
/**
|
|
1301
|
+
* `<usa-slider>` — a form-associated range slider (`role="slider"`). The
|
|
1302
|
+
* thumb follows with a spring, grows while dragged and shows a value bubble.
|
|
1303
|
+
* Keyboard: arrows (step), PageUp/PageDown (10 steps), Home/End.
|
|
1304
|
+
* Attributes: `value`, `min` (0), `max` (100), `step` (1), `name`, `label`,
|
|
1305
|
+
* `bubble` (show the value while dragging), `disabled`, `variant`.
|
|
1306
|
+
* Events: `input` + `usa:input` while moving, `change` + `usa:change` on release.
|
|
1307
|
+
* Reduced motion: the thumb jumps (no spring).
|
|
1308
|
+
*/
|
|
1309
|
+
interface UsaSliderElement extends UsaElement {
|
|
1310
|
+
value: number;
|
|
1311
|
+
}
|
|
1312
|
+
declare function defineSlider(tag?: string): CustomElementConstructor | undefined;
|
|
1313
|
+
|
|
1314
|
+
/**
|
|
1315
|
+
* `<usa-rating>` — star rating with hover preview and a springy pop when a
|
|
1316
|
+
* value is chosen. `role="slider"` (arrow keys, Home/End, number keys).
|
|
1317
|
+
* Attributes: `value` (0), `max` (5), `icon` (★), `readonly`, `label`
|
|
1318
|
+
* ("Rating"), `name` (form value), `variant`. Events: `change`, `usa:change` (`{ value }`).
|
|
1319
|
+
* Reduced motion: no pop.
|
|
1320
|
+
*/
|
|
1321
|
+
interface UsaRatingElement extends UsaElement {
|
|
1322
|
+
value: number;
|
|
1323
|
+
}
|
|
1324
|
+
declare function defineRating(tag?: string): CustomElementConstructor | undefined;
|
|
1325
|
+
|
|
1326
|
+
/**
|
|
1327
|
+
* `<usa-tooltip text="…">` — a tooltip for the element it wraps, shown on
|
|
1328
|
+
* hover (after `delay` ms, 300) and on keyboard focus, hidden on Esc / blur.
|
|
1329
|
+
* It springs in from its placement side and flips to stay on screen; the
|
|
1330
|
+
* trigger gets `aria-describedby`.
|
|
1331
|
+
* Attributes: `text`, `placement` (`top` default, `bottom`, `left`, `right`),
|
|
1332
|
+
* `delay`, `variant`. Reduced motion: fades only.
|
|
1333
|
+
*/
|
|
1334
|
+
interface UsaTooltipElement extends UsaElement {
|
|
1335
|
+
show(): void;
|
|
1336
|
+
hide(): void;
|
|
1337
|
+
}
|
|
1338
|
+
declare function defineTooltip(tag?: string): CustomElementConstructor | undefined;
|
|
1339
|
+
|
|
1340
|
+
/**
|
|
1341
|
+
* `<usa-popover>` — a click-to-open popover: the first element child is the
|
|
1342
|
+
* trigger, `[data-popover]` is the content. Springs open from the trigger,
|
|
1343
|
+
* flips to stay on screen; Esc or an outside click closes and focus returns
|
|
1344
|
+
* to the trigger. `aria-expanded` / `aria-controls` on the trigger.
|
|
1345
|
+
* Attributes: `open`, `placement` (`bottom` default), `variant`. Events:
|
|
1346
|
+
* `usa:open`, `usa:close`. Reduced motion: fades only.
|
|
1347
|
+
*/
|
|
1348
|
+
interface UsaPopoverElement extends UsaElement {
|
|
1349
|
+
open: boolean;
|
|
1350
|
+
toggle(force?: boolean): void;
|
|
1351
|
+
}
|
|
1352
|
+
declare function definePopover(tag?: string): CustomElementConstructor | undefined;
|
|
1353
|
+
|
|
1354
|
+
/**
|
|
1355
|
+
* `<usa-badge>` — a count / dot badge on whatever it wraps; bumps with a
|
|
1356
|
+
* spring whenever the value changes and pulses with `pulse`.
|
|
1357
|
+
* Attributes: `value` (number or text; 0 / empty hides it unless
|
|
1358
|
+
* `show-zero`), `max` (99 → "99+"), `dot`, `pulse`, `label` (accessible
|
|
1359
|
+
* text, default "{n} new"), `variant`. Reduced motion: no bump or pulse.
|
|
1360
|
+
*/
|
|
1361
|
+
interface UsaBadgeElement extends UsaElement {
|
|
1362
|
+
value: string;
|
|
1363
|
+
}
|
|
1364
|
+
declare function defineBadge(tag?: string): CustomElementConstructor | undefined;
|
|
1365
|
+
|
|
1366
|
+
/**
|
|
1367
|
+
* `<usa-avatar-stack>` — overlapping avatars (its children: `<img>` or any
|
|
1368
|
+
* element) that spread apart with a spring on hover / focus; extra ones
|
|
1369
|
+
* collapse into a "+N" chip.
|
|
1370
|
+
* Attributes: `max` (visible avatars, 5), `size` (px, 36), `overlap` (0–1,
|
|
1371
|
+
* 0.35), `label` (group name), `variant`. Reduced motion: no spreading.
|
|
1372
|
+
*/
|
|
1373
|
+
interface UsaAvatarStackElement extends UsaElement {
|
|
1374
|
+
}
|
|
1375
|
+
declare function defineAvatarStack(tag?: string): CustomElementConstructor | undefined;
|
|
1376
|
+
|
|
1377
|
+
/**
|
|
1378
|
+
* Style variants (v2.6): `variant="minimal | neon | glass | brutalist |
|
|
1379
|
+
* fluent | material"` on any `<usa-*>` element — or on any ancestor as
|
|
1380
|
+
* `data-usa-variant`, or page-wide with `setVariant()` — sets the shared
|
|
1381
|
+
* design tokens every component reads:
|
|
1382
|
+
*
|
|
1383
|
+
* `--usa-accent`, `--usa-accent-text`, `--usa-surface`, `--usa-text`,
|
|
1384
|
+
* `--usa-radius`, `--usa-border`, `--usa-shadow`, `--usa-blur`, `--usa-font`.
|
|
1385
|
+
*
|
|
1386
|
+
* (`<usa-spinner>`, `<usa-check>` and `<usa-dialog>` already use `variant`
|
|
1387
|
+
* for their kind; the token names never clash with those values except
|
|
1388
|
+
* `fluent`, which means the same thing there.)
|
|
1389
|
+
*/
|
|
1390
|
+
declare const VARIANTS: readonly ["minimal", "neon", "glass", "brutalist", "fluent", "material"];
|
|
1391
|
+
type Variant = (typeof VARIANTS)[number];
|
|
1392
|
+
/** Inject the variant token sheet (done automatically by every `ui` component). */
|
|
1393
|
+
declare function adoptVariants(): void;
|
|
1394
|
+
/** Apply a variant to the whole page (or `root`); `null` removes it. */
|
|
1395
|
+
declare function setVariant(variant: Variant | null, root?: Element | null): void;
|
|
1396
|
+
|
|
1397
|
+
type Placement = 'top' | 'bottom' | 'left' | 'right';
|
|
1398
|
+
|
|
1399
|
+
/**
|
|
1400
|
+
* use-scroll-animate/components/ui — animated UI components + style variants (v2.6).
|
|
1401
|
+
* `<usa-tabs>`, `<usa-drawer>`, `<usa-bottom-sheet>`, `<usa-pull-refresh>`,
|
|
1402
|
+
* `<usa-fab>`, `<usa-navbar>`, `<usa-slider>`, `<usa-rating>`,
|
|
1403
|
+
* `<usa-tooltip>`, `<usa-popover>`, `<usa-badge>`, `<usa-avatar-stack>`,
|
|
1404
|
+
* and `variant="minimal | neon | glass | brutalist | fluent | material"`
|
|
1405
|
+
* design tokens (`setVariant()`, `VARIANTS`).
|
|
1406
|
+
*/
|
|
1407
|
+
|
|
1408
|
+
/** Register every component of this category under its default tag. */
|
|
1409
|
+
declare function defineUiComponents(): void;
|
|
1410
|
+
declare global {
|
|
1411
|
+
interface HTMLElementTagNameMap {
|
|
1412
|
+
'usa-tabs': UsaTabsElement;
|
|
1413
|
+
'usa-drawer': UsaDrawerElement;
|
|
1414
|
+
'usa-bottom-sheet': UsaBottomSheetElement;
|
|
1415
|
+
'usa-pull-refresh': UsaPullRefreshElement;
|
|
1416
|
+
'usa-fab': UsaFabElement;
|
|
1417
|
+
'usa-navbar': UsaNavbarElement;
|
|
1418
|
+
'usa-slider': UsaSliderElement;
|
|
1419
|
+
'usa-rating': UsaRatingElement;
|
|
1420
|
+
'usa-tooltip': UsaTooltipElement;
|
|
1421
|
+
'usa-popover': UsaPopoverElement;
|
|
1422
|
+
'usa-badge': UsaBadgeElement;
|
|
1423
|
+
'usa-avatar-stack': UsaAvatarStackElement;
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1215
1427
|
/** The component categories and their default tags. */
|
|
1216
1428
|
declare const COMPONENT_CATEGORIES: {
|
|
1217
1429
|
readonly reveal: readonly ["usa-reveal", "usa-stagger", "usa-scroll-progress", "usa-scrolly"];
|
|
@@ -1223,6 +1435,7 @@ declare const COMPONENT_CATEGORIES: {
|
|
|
1223
1435
|
readonly physics: readonly ["usa-spring", "usa-draggable", "usa-overscroll"];
|
|
1224
1436
|
readonly cards: readonly ["usa-card", "usa-card-stack", "usa-sticky-stack", "usa-carousel-3d"];
|
|
1225
1437
|
readonly click: readonly ["usa-click", "usa-button", "usa-icon-morph", "usa-like", "usa-hold", "usa-double-tap", "usa-checkbox"];
|
|
1438
|
+
readonly ui: readonly ["usa-tabs", "usa-drawer", "usa-bottom-sheet", "usa-pull-refresh", "usa-fab", "usa-navbar", "usa-slider", "usa-rating", "usa-tooltip", "usa-popover", "usa-badge", "usa-avatar-stack"];
|
|
1226
1439
|
};
|
|
1227
1440
|
type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;
|
|
1228
1441
|
/**
|
|
@@ -1231,5 +1444,5 @@ type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;
|
|
|
1231
1444
|
*/
|
|
1232
1445
|
declare function defineComponents(categories?: ComponentCategory[]): void;
|
|
1233
1446
|
|
|
1234
|
-
export { BUTTON_DEFORMS, CARD_EFFECTS, CLICK_EFFECTS, COMPONENT_CATEGORIES, MORPH_ICONS, REVEAL_EFFECTS, SPINNER_VARIANTS, SPRING_EFFECTS, SPRING_PRESETS, burst, confetti, configureComponents, connectedAnimation, createSpring, defineAccordion, defineAcrylic, defineAurora, defineBackgroundComponents, defineButton, defineCard, defineCardComponents, defineCardStack, defineCarousel3d, defineCheck, defineCheckbox, defineClick, defineClickComponents, defineComponents, defineCounter, defineDialog, defineDoubleTap, defineDraggable, defineFeedbackComponents, defineFlipList, defineGrain, defineHold, defineIconMorph, defineInteractionComponents, defineLike, defineMagnetic, defineMarquee, defineOverscroll, defineParticles, definePhysicsComponents, definePress, defineProgress, defineReveal, defineRevealComponents, defineRipple, defineScramble, defineScrollProgress, defineScrolly, defineShimmerText, defineSkeleton, defineSpinner, defineSplitText, defineSpotlight, defineSpring, defineStagger, defineStickyStack, defineTextComponents, defineTextRotate, defineTilt, defineToaster, defineToggle, defineTransitionComponents, defineTypewriter, defineViewSwitch, easeOutExpo, flip, haptic, linearEasing, morphPath, prefersReducedMotion, projectInertia, readScrollProgress, resolveSpring, revealKeyframes, rubberBand, scrambleFrame, shake, snapTo, spring, springEasing, springEffectKeyframes, springSamples, stepSpring, supportsLinearEasing, toast, viewTransition };
|
|
1235
|
-
export type { BurstOptions, ButtonDeform, ButtonShape, ButtonState, CardEffect, ClickEffect, ComponentCategory, ComponentsConfig, ConfettiOptions, ConnectedOptions, DialogVariant, FlipOptions, RevealEffect, SpinnerVariant, SpringConfig, SpringEffect, SpringInput, SpringPreset, SpringValue, SpringValueOptions, ToastHandle, ToastOptions, ToastType, UsaAccordionElement, UsaAcrylicElement, UsaAuroraElement, UsaButtonElement, UsaCardElement, UsaCardStackElement, UsaCarousel3dElement, UsaCheckElement, UsaCheckboxElement, UsaClickElement, UsaCounterElement, UsaDialogElement, UsaDoubleTapElement, UsaDraggableElement, UsaElement, UsaFlipListElement, UsaGrainElement, UsaHoldElement, UsaIconMorphElement, UsaLikeElement, UsaMagneticElement, UsaMarqueeElement, UsaOverscrollElement, UsaParticlesElement, UsaPressElement, UsaProgressElement, UsaRevealElement, UsaRippleElement, UsaScrambleElement, UsaScrollProgressElement, UsaScrollyElement, UsaShimmerTextElement, UsaSkeletonElement, UsaSpinnerElement, UsaSplitTextElement, UsaSpotlightElement, UsaSpringElement, UsaStaggerElement, UsaStickyStackElement, UsaTextRotateElement, UsaTiltElement, UsaToasterElement, UsaToggleElement, UsaTypewriterElement, UsaViewSwitchElement, ViewTransitionOptions };
|
|
1447
|
+
export { BUTTON_DEFORMS, CARD_EFFECTS, CLICK_EFFECTS, COMPONENT_CATEGORIES, MORPH_ICONS, REVEAL_EFFECTS, SPINNER_VARIANTS, SPRING_EFFECTS, SPRING_PRESETS, VARIANTS, adoptVariants, burst, confetti, configureComponents, connectedAnimation, createSpring, defineAccordion, defineAcrylic, defineAurora, defineAvatarStack, defineBackgroundComponents, defineBadge, defineBottomSheet, defineButton, defineCard, defineCardComponents, defineCardStack, defineCarousel3d, defineCheck, defineCheckbox, defineClick, defineClickComponents, defineComponents, defineCounter, defineDialog, defineDoubleTap, defineDraggable, defineDrawer, defineFab, defineFeedbackComponents, defineFlipList, defineGrain, defineHold, defineIconMorph, defineInteractionComponents, defineLike, defineMagnetic, defineMarquee, defineNavbar, defineOverscroll, defineParticles, definePhysicsComponents, definePopover, definePress, defineProgress, definePullRefresh, defineRating, defineReveal, defineRevealComponents, defineRipple, defineScramble, defineScrollProgress, defineScrolly, defineShimmerText, defineSkeleton, defineSlider, defineSpinner, defineSplitText, defineSpotlight, defineSpring, defineStagger, defineStickyStack, defineTabs, defineTextComponents, defineTextRotate, defineTilt, defineToaster, defineToggle, defineTooltip, defineTransitionComponents, defineTypewriter, defineUiComponents, defineViewSwitch, easeOutExpo, flip, haptic, linearEasing, morphPath, prefersReducedMotion, projectInertia, readScrollProgress, resolveSpring, revealKeyframes, rubberBand, scrambleFrame, setVariant, shake, snapTo, spring, springEasing, springEffectKeyframes, springSamples, stepSpring, supportsLinearEasing, toast, viewTransition };
|
|
1448
|
+
export type { BurstOptions, ButtonDeform, ButtonShape, ButtonState, CardEffect, ClickEffect, ComponentCategory, ComponentsConfig, ConfettiOptions, ConnectedOptions, DialogVariant, FlipOptions, Placement, RevealEffect, SpinnerVariant, SpringConfig, SpringEffect, SpringInput, SpringPreset, SpringValue, SpringValueOptions, ToastHandle, ToastOptions, ToastType, UsaAccordionElement, UsaAcrylicElement, UsaAuroraElement, UsaAvatarStackElement, UsaBadgeElement, UsaBottomSheetElement, UsaButtonElement, UsaCardElement, UsaCardStackElement, UsaCarousel3dElement, UsaCheckElement, UsaCheckboxElement, UsaClickElement, UsaCounterElement, UsaDialogElement, UsaDoubleTapElement, UsaDraggableElement, UsaDrawerElement, UsaElement, UsaFabElement, UsaFlipListElement, UsaGrainElement, UsaHoldElement, UsaIconMorphElement, UsaLikeElement, UsaMagneticElement, UsaMarqueeElement, UsaNavbarElement, UsaOverscrollElement, UsaParticlesElement, UsaPopoverElement, UsaPressElement, UsaProgressElement, UsaPullRefreshElement, UsaRatingElement, UsaRevealElement, UsaRippleElement, UsaScrambleElement, UsaScrollProgressElement, UsaScrollyElement, UsaShimmerTextElement, UsaSkeletonElement, UsaSliderElement, UsaSpinnerElement, UsaSplitTextElement, UsaSpotlightElement, UsaSpringElement, UsaStaggerElement, UsaStickyStackElement, UsaTabsElement, UsaTextRotateElement, UsaTiltElement, UsaToasterElement, UsaToggleElement, UsaTooltipElement, UsaTypewriterElement, UsaViewSwitchElement, Variant, ViewTransitionOptions };
|
package/dist/components.js
CHANGED
|
@@ -16,8 +16,11 @@ import { defineCardComponents } from './components/cards.js';
|
|
|
16
16
|
export { CARD_EFFECTS, defineCard, defineCardStack, defineCarousel3d, defineStickyStack } from './components/cards.js';
|
|
17
17
|
import { defineClickComponents } from './components/click.js';
|
|
18
18
|
export { BUTTON_DEFORMS, CLICK_EFFECTS, MORPH_ICONS, burst, confetti, defineButton, defineCheckbox, defineClick, defineDoubleTap, defineHold, defineIconMorph, defineLike, haptic, morphPath, shake } from './components/click.js';
|
|
19
|
-
|
|
20
|
-
export {
|
|
19
|
+
import { adoptVariants, defineUiComponents } from './components/ui.js';
|
|
20
|
+
export { VARIANTS, defineAvatarStack, defineBadge, defineBottomSheet, defineDrawer, defineFab, defineNavbar, definePopover, definePullRefresh, defineRating, defineSlider, defineTabs, defineTooltip, setVariant } from './components/ui.js';
|
|
21
|
+
import { c as canDefine } from './chunks/base-08OYzphB.js';
|
|
22
|
+
export { a as configureComponents, p as prefersReducedMotion } from './chunks/base-08OYzphB.js';
|
|
23
|
+
export { S as SPRING_PRESETS, c as createSpring, l as linearEasing, p as projectInertia, r as resolveSpring, a as rubberBand, s as snapTo, b as spring, d as springEasing, e as springSamples, f as stepSpring, g as supportsLinearEasing } from './chunks/spring-CpeFkxNd.js';
|
|
21
24
|
|
|
22
25
|
/**
|
|
23
26
|
* use-scroll-animate/components
|
|
@@ -50,6 +53,7 @@ const COMPONENT_CATEGORIES = {
|
|
|
50
53
|
physics: ['usa-spring', 'usa-draggable', 'usa-overscroll'],
|
|
51
54
|
cards: ['usa-card', 'usa-card-stack', 'usa-sticky-stack', 'usa-carousel-3d'],
|
|
52
55
|
click: ['usa-click', 'usa-button', 'usa-icon-morph', 'usa-like', 'usa-hold', 'usa-double-tap', 'usa-checkbox'],
|
|
56
|
+
ui: ['usa-tabs', 'usa-drawer', 'usa-bottom-sheet', 'usa-pull-refresh', 'usa-fab', 'usa-navbar', 'usa-slider', 'usa-rating', 'usa-tooltip', 'usa-popover', 'usa-badge', 'usa-avatar-stack'],
|
|
53
57
|
};
|
|
54
58
|
const BY_CATEGORY = {
|
|
55
59
|
reveal: defineRevealComponents,
|
|
@@ -61,14 +65,17 @@ const BY_CATEGORY = {
|
|
|
61
65
|
physics: definePhysicsComponents,
|
|
62
66
|
cards: defineCardComponents,
|
|
63
67
|
click: defineClickComponents,
|
|
68
|
+
ui: defineUiComponents,
|
|
64
69
|
};
|
|
65
70
|
/**
|
|
66
71
|
* Register every `<usa-*>` component (or only the given categories).
|
|
67
72
|
* Safe to call more than once and on the server (no-op without DOM).
|
|
68
73
|
*/
|
|
69
74
|
function defineComponents(categories) {
|
|
75
|
+
if (canDefine())
|
|
76
|
+
adoptVariants();
|
|
70
77
|
(categories || Object.keys(BY_CATEGORY)).forEach((c) => BY_CATEGORY[c]?.());
|
|
71
78
|
}
|
|
72
79
|
|
|
73
|
-
export { COMPONENT_CATEGORIES, defineBackgroundComponents, defineCardComponents, defineClickComponents, defineComponents, defineFeedbackComponents, defineInteractionComponents, definePhysicsComponents, defineRevealComponents, defineTextComponents, defineTransitionComponents };
|
|
80
|
+
export { COMPONENT_CATEGORIES, adoptVariants, defineBackgroundComponents, defineCardComponents, defineClickComponents, defineComponents, defineFeedbackComponents, defineInteractionComponents, definePhysicsComponents, defineRevealComponents, defineTextComponents, defineTransitionComponents, defineUiComponents };
|
|
74
81
|
//# sourceMappingURL=components.js.map
|
package/dist/components.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.js","sources":["../src/components/index.ts"],"sourcesContent":["/**\n * use-scroll-animate/components\n *\n * Framework-agnostic, dependency-free animated UI components built on\n * Custom Elements + CSS + the Web Animations API. They run in any browser\n * and in Windows desktop apps that render with a web view: Electron, Tauri\n * (WebView2), WinUI 3 / WPF / WinForms with WebView2, and installed PWAs.\n *\n * ```js\n * import { defineComponents } from 'use-scroll-animate/components';\n * defineComponents(); // registers every <usa-*> element\n * // or only what you use (tree-shakable):\n * import { defineTypewriter } from 'use-scroll-animate/components/text';\n * ```\n *\n * Importing has no side effects and is SSR-safe; nothing is registered\n * until a `define*()` function runs in a browser.\n *\n * @license MIT\n */\nimport { defineRevealComponents } from './reveal/index';\nimport { defineTextComponents } from './text/index';\nimport { defineInteractionComponents } from './interaction/index';\nimport { defineFeedbackComponents } from './feedback/index';\nimport { defineBackgroundComponents } from './background/index';\nimport { defineTransitionComponents } from './transitions/index';\nimport { definePhysicsComponents } from './physics/index';\nimport { defineCardComponents } from './cards/index';\nimport { defineClickComponents } from './click/index';\n\nexport * from './reveal/index';\nexport * from './text/index';\nexport * from './interaction/index';\nexport * from './feedback/index';\nexport * from './background/index';\nexport * from './transitions/index';\nexport * from './physics/index';\nexport * from './cards/index';\nexport * from './click/index';\n\n/** The component categories and their default tags. */\nexport const COMPONENT_CATEGORIES = {\n reveal: ['usa-reveal', 'usa-stagger', 'usa-scroll-progress', 'usa-scrolly'],\n text: ['usa-typewriter', 'usa-split-text', 'usa-scramble', 'usa-counter', 'usa-shimmer-text', 'usa-text-rotate'],\n interaction: ['usa-ripple', 'usa-magnetic', 'usa-tilt', 'usa-spotlight', 'usa-press', 'usa-toggle'],\n feedback: ['usa-spinner', 'usa-skeleton', 'usa-progress', 'usa-toaster', 'usa-check'],\n background: ['usa-aurora', 'usa-particles', 'usa-grain', 'usa-marquee', 'usa-acrylic'],\n transitions: ['usa-dialog', 'usa-accordion', 'usa-flip-list', 'usa-view-switch'],\n physics: ['usa-spring', 'usa-draggable', 'usa-overscroll'],\n cards: ['usa-card', 'usa-card-stack', 'usa-sticky-stack', 'usa-carousel-3d'],\n click: ['usa-click', 'usa-button', 'usa-icon-morph', 'usa-like', 'usa-hold', 'usa-double-tap', 'usa-checkbox'],\n} as const;\n\nexport type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;\n\nconst BY_CATEGORY: Record<ComponentCategory, () => void> = {\n reveal: defineRevealComponents,\n text: defineTextComponents,\n interaction: defineInteractionComponents,\n feedback: defineFeedbackComponents,\n background: defineBackgroundComponents,\n transitions: defineTransitionComponents,\n physics: definePhysicsComponents,\n cards: defineCardComponents,\n click: defineClickComponents,\n};\n\n/**\n * Register every `<usa-*>` component (or only the given categories).\n * Safe to call more than once and on the server (no-op without DOM).\n */\nexport function defineComponents(categories?: ComponentCategory[]): void {\n (categories || (Object.keys(BY_CATEGORY) as ComponentCategory[])).forEach((c) => BY_CATEGORY[c]?.());\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"components.js","sources":["../src/components/index.ts"],"sourcesContent":["/**\n * use-scroll-animate/components\n *\n * Framework-agnostic, dependency-free animated UI components built on\n * Custom Elements + CSS + the Web Animations API. They run in any browser\n * and in Windows desktop apps that render with a web view: Electron, Tauri\n * (WebView2), WinUI 3 / WPF / WinForms with WebView2, and installed PWAs.\n *\n * ```js\n * import { defineComponents } from 'use-scroll-animate/components';\n * defineComponents(); // registers every <usa-*> element\n * // or only what you use (tree-shakable):\n * import { defineTypewriter } from 'use-scroll-animate/components/text';\n * ```\n *\n * Importing has no side effects and is SSR-safe; nothing is registered\n * until a `define*()` function runs in a browser.\n *\n * @license MIT\n */\nimport { defineRevealComponents } from './reveal/index';\nimport { defineTextComponents } from './text/index';\nimport { defineInteractionComponents } from './interaction/index';\nimport { defineFeedbackComponents } from './feedback/index';\nimport { defineBackgroundComponents } from './background/index';\nimport { defineTransitionComponents } from './transitions/index';\nimport { definePhysicsComponents } from './physics/index';\nimport { defineCardComponents } from './cards/index';\nimport { defineClickComponents } from './click/index';\nimport { defineUiComponents } from './ui/index';\nimport { adoptVariants } from './ui/variants';\nimport { canDefine } from './base';\n\nexport * from './reveal/index';\nexport * from './text/index';\nexport * from './interaction/index';\nexport * from './feedback/index';\nexport * from './background/index';\nexport * from './transitions/index';\nexport * from './physics/index';\nexport * from './cards/index';\nexport * from './click/index';\nexport * from './ui/index';\n\n/** The component categories and their default tags. */\nexport const COMPONENT_CATEGORIES = {\n reveal: ['usa-reveal', 'usa-stagger', 'usa-scroll-progress', 'usa-scrolly'],\n text: ['usa-typewriter', 'usa-split-text', 'usa-scramble', 'usa-counter', 'usa-shimmer-text', 'usa-text-rotate'],\n interaction: ['usa-ripple', 'usa-magnetic', 'usa-tilt', 'usa-spotlight', 'usa-press', 'usa-toggle'],\n feedback: ['usa-spinner', 'usa-skeleton', 'usa-progress', 'usa-toaster', 'usa-check'],\n background: ['usa-aurora', 'usa-particles', 'usa-grain', 'usa-marquee', 'usa-acrylic'],\n transitions: ['usa-dialog', 'usa-accordion', 'usa-flip-list', 'usa-view-switch'],\n physics: ['usa-spring', 'usa-draggable', 'usa-overscroll'],\n cards: ['usa-card', 'usa-card-stack', 'usa-sticky-stack', 'usa-carousel-3d'],\n click: ['usa-click', 'usa-button', 'usa-icon-morph', 'usa-like', 'usa-hold', 'usa-double-tap', 'usa-checkbox'],\n ui: ['usa-tabs', 'usa-drawer', 'usa-bottom-sheet', 'usa-pull-refresh', 'usa-fab', 'usa-navbar', 'usa-slider', 'usa-rating', 'usa-tooltip', 'usa-popover', 'usa-badge', 'usa-avatar-stack'],\n} as const;\n\nexport type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;\n\nconst BY_CATEGORY: Record<ComponentCategory, () => void> = {\n reveal: defineRevealComponents,\n text: defineTextComponents,\n interaction: defineInteractionComponents,\n feedback: defineFeedbackComponents,\n background: defineBackgroundComponents,\n transitions: defineTransitionComponents,\n physics: definePhysicsComponents,\n cards: defineCardComponents,\n click: defineClickComponents,\n ui: defineUiComponents,\n};\n\n/**\n * Register every `<usa-*>` component (or only the given categories).\n * Safe to call more than once and on the server (no-op without DOM).\n */\nexport function defineComponents(categories?: ComponentCategory[]): void {\n if (canDefine()) adoptVariants();\n (categories || (Object.keys(BY_CATEGORY) as ComponentCategory[])).forEach((c) => BY_CATEGORY[c]?.());\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AAyBH;AACO,MAAM,oBAAoB,GAAG;IAClC,MAAM,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,qBAAqB,EAAE,aAAa,CAAC;AAC3E,IAAA,IAAI,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,kBAAkB,EAAE,iBAAiB,CAAC;AAChH,IAAA,WAAW,EAAE,CAAC,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,eAAe,EAAE,WAAW,EAAE,YAAY,CAAC;IACnG,QAAQ,EAAE,CAAC,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,CAAC;IACrF,UAAU,EAAE,CAAC,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,CAAC;IACtF,WAAW,EAAE,CAAC,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,iBAAiB,CAAC;AAChF,IAAA,OAAO,EAAE,CAAC,YAAY,EAAE,eAAe,EAAE,gBAAgB,CAAC;IAC1D,KAAK,EAAE,CAAC,UAAU,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,iBAAiB,CAAC;AAC5E,IAAA,KAAK,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,UAAU,EAAE,gBAAgB,EAAE,cAAc,CAAC;IAC9G,EAAE,EAAE,CAAC,UAAU,EAAE,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,kBAAkB,CAAC;;AAK5L,MAAM,WAAW,GAA0C;AACzD,IAAA,MAAM,EAAE,sBAAsB;AAC9B,IAAA,IAAI,EAAE,oBAAoB;AAC1B,IAAA,WAAW,EAAE,2BAA2B;AACxC,IAAA,QAAQ,EAAE,wBAAwB;AAClC,IAAA,UAAU,EAAE,0BAA0B;AACtC,IAAA,WAAW,EAAE,0BAA0B;AACvC,IAAA,OAAO,EAAE,uBAAuB;AAChC,IAAA,KAAK,EAAE,oBAAoB;AAC3B,IAAA,KAAK,EAAE,qBAAqB;AAC5B,IAAA,EAAE,EAAE,kBAAkB;CACvB;AAED;;;AAGG;AACG,SAAU,gBAAgB,CAAC,UAAgC,EAAA;AAC/D,IAAA,IAAI,SAAS,EAAE;AAAE,QAAA,aAAa,EAAE;IAChC,CAAC,UAAU,IAAK,MAAM,CAAC,IAAI,CAAC,WAAW,CAAyB,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC;AACtG;;;;"}
|