use-scroll-animate 4.0.1 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/chunks/{base-ZARFccur.js → base-BPG5zvex.js} +2 -2
- package/dist/chunks/{base-ZARFccur.js.map → base-BPG5zvex.js.map} +1 -1
- package/dist/chunks/{core-DXqZm5Il.cjs → core-BRIIoKeS.cjs} +55 -12
- package/dist/chunks/core-BRIIoKeS.cjs.map +1 -0
- package/dist/chunks/{core-Co-6AL0h.js → core-LkGRmgES.js} +56 -14
- package/dist/chunks/core-LkGRmgES.js.map +1 -0
- package/dist/chunks/{core-DKY-fVzR.js → core-eXX8rB_b.js} +2 -2
- package/dist/chunks/{core-DKY-fVzR.js.map → core-eXX8rB_b.js.map} +1 -1
- package/dist/chunks/{spring-E2ickYNI.js → spring-BziPsW3r.js} +2 -2
- package/dist/chunks/{spring-E2ickYNI.js.map → spring-BziPsW3r.js.map} +1 -1
- package/dist/chunks/{variants-DvnxvRCM.js → variants-BVYMcxRv.js} +2 -2
- package/dist/chunks/{variants-DvnxvRCM.js.map → variants-BVYMcxRv.js.map} +1 -1
- package/dist/components/angular.cjs +2 -1
- package/dist/components/angular.cjs.map +1 -1
- package/dist/components/angular.d.cts +32 -8
- package/dist/components/angular.d.ts +32 -8
- package/dist/components/angular.js +6 -5
- package/dist/components/angular.js.map +1 -1
- package/dist/components/background.js +3 -3
- package/dist/components/cards.js +3 -3
- package/dist/components/click.js +3 -3
- package/dist/components/depth.js +4 -4
- package/dist/components/feedback.js +2 -2
- package/dist/components/gesture.js +5 -5
- package/dist/components/interaction.js +2 -2
- package/dist/components/layout.js +2 -2
- package/dist/components/packs.js +2 -2
- package/dist/components/page.js +3 -3
- package/dist/components/physics.js +4 -4
- package/dist/components/reveal.js +2 -2
- package/dist/components/solid.cjs +2 -1
- package/dist/components/solid.cjs.map +1 -1
- package/dist/components/solid.d.cts +32 -8
- package/dist/components/solid.d.ts +32 -8
- package/dist/components/solid.js +6 -5
- package/dist/components/solid.js.map +1 -1
- package/dist/components/svelte.cjs +2 -1
- package/dist/components/svelte.cjs.map +1 -1
- package/dist/components/svelte.d.cts +32 -8
- package/dist/components/svelte.d.ts +32 -8
- package/dist/components/svelte.js +6 -5
- package/dist/components/svelte.js.map +1 -1
- package/dist/components/svg.js +2 -2
- package/dist/components/text.js +2 -2
- package/dist/components/timeline.cjs +10 -2
- package/dist/components/timeline.cjs.map +1 -1
- package/dist/components/timeline.d.cts +36 -10
- package/dist/components/timeline.d.ts +36 -10
- package/dist/components/timeline.js +12 -5
- package/dist/components/timeline.js.map +1 -1
- package/dist/components/tokens.cjs +226 -0
- package/dist/components/tokens.cjs.map +1 -0
- package/dist/components/tokens.d.cts +74 -0
- package/dist/components/tokens.d.ts +74 -0
- package/dist/components/tokens.js +211 -0
- package/dist/components/tokens.js.map +1 -0
- package/dist/components/transitions.js +2 -2
- package/dist/components/ui.js +5 -5
- package/dist/components/vue.cjs +2 -1
- package/dist/components/vue.cjs.map +1 -1
- package/dist/components/vue.d.cts +32 -8
- package/dist/components/vue.d.ts +32 -8
- package/dist/components/vue.js +6 -5
- package/dist/components/vue.js.map +1 -1
- package/dist/components/webgl.js +2 -2
- package/dist/components.cjs +17 -1
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +109 -11
- package/dist/components.d.ts +109 -11
- package/dist/components.js +8 -7
- 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 +3 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +33 -9
- package/dist/index.d.ts +33 -9
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/docs/API.md +3 -1
- package/docs/ROADMAP.md +2 -2
- package/docs/motion-tokens.css +31 -0
- package/docs/motion-tokens.md +46 -0
- package/docs/motion.tokens.json +132 -0
- package/package.json +11 -1
- package/dist/chunks/core-Co-6AL0h.js.map +0 -1
- package/dist/chunks/core-DXqZm5Il.cjs.map +0 -1
package/dist/components.d.cts
CHANGED
|
@@ -1757,9 +1757,9 @@ declare global {
|
|
|
1757
1757
|
*/
|
|
1758
1758
|
type TimelinePosition = number | string;
|
|
1759
1759
|
interface TimelineStepOptions {
|
|
1760
|
-
/** Duration in ms (
|
|
1761
|
-
duration?: number;
|
|
1762
|
-
/** CSS easing (
|
|
1760
|
+
/** Duration in ms or a motion token name (`'fast'`, `'slow'`…; 4.2). Default: timeline default, 600. */
|
|
1761
|
+
duration?: number | string;
|
|
1762
|
+
/** CSS easing or a motion token name (`'emphasized'`, `'spring'`…; 4.2). Default `cubic-bezier(0.22, 1, 0.36, 1)`. */
|
|
1763
1763
|
easing?: string;
|
|
1764
1764
|
/** Start position, see `TimelinePosition`. */
|
|
1765
1765
|
at?: TimelinePosition;
|
|
@@ -1777,11 +1777,29 @@ interface TimelineOptions {
|
|
|
1777
1777
|
onUpdate?: (progress: number) => void;
|
|
1778
1778
|
}
|
|
1779
1779
|
interface ScrubOptions {
|
|
1780
|
-
/** Scroll offset (px) before the source's top reaches the viewport bottom where progress starts. */
|
|
1780
|
+
/** Scroll offset (px) before the source's top reaches the viewport bottom where progress starts (JS engine only). */
|
|
1781
1781
|
offset?: number;
|
|
1782
|
-
/** Smoothing 0–1 (0 = immediate, default 0). */
|
|
1782
|
+
/** Smoothing 0–1 (0 = immediate, default 0). Smoothing needs the JS engine. */
|
|
1783
1783
|
smooth?: number;
|
|
1784
|
-
|
|
1784
|
+
/**
|
|
1785
|
+
* 4.1: which progress source drives the timeline.
|
|
1786
|
+
* - `'view'` (default): `source` moving through the viewport (CSS `ViewTimeline`, range `cover`).
|
|
1787
|
+
* - `'scroll'`: the scroll position of `source` itself (a scroll container; CSS `ScrollTimeline`).
|
|
1788
|
+
*/
|
|
1789
|
+
source?: 'view' | 'scroll';
|
|
1790
|
+
/** 4.1: `'auto'` (default) uses the browser's native scroll-driven animations when available, `'js'` forces the fallback. */
|
|
1791
|
+
engine?: 'auto' | 'native' | 'js';
|
|
1792
|
+
/** 4.1: scroll axis, `'block'` (default) · `'inline'` · `'x'` · `'y'`. */
|
|
1793
|
+
axis?: 'block' | 'inline' | 'x' | 'y';
|
|
1794
|
+
}
|
|
1795
|
+
/** The function `scrub()` returns: call it to stop. `native` tells which engine runs it. */
|
|
1796
|
+
interface ScrubHandle {
|
|
1797
|
+
(): void;
|
|
1798
|
+
/** `true` when the browser's ScrollTimeline / ViewTimeline drives it (compositor, no JS per frame). */
|
|
1799
|
+
readonly native: boolean;
|
|
1800
|
+
}
|
|
1801
|
+
/** 4.1: whether `scrub()` can use native ScrollTimeline / ViewTimeline here. */
|
|
1802
|
+
declare function supportsNativeScrub(source?: 'view' | 'scroll'): boolean;
|
|
1785
1803
|
interface Timeline {
|
|
1786
1804
|
/** Total length in ms. */
|
|
1787
1805
|
readonly duration: number;
|
|
@@ -1804,8 +1822,14 @@ interface Timeline {
|
|
|
1804
1822
|
seek(to: TimelinePosition): Timeline;
|
|
1805
1823
|
/** Get or set progress 0–1. */
|
|
1806
1824
|
progress(p?: number): number;
|
|
1807
|
-
/**
|
|
1808
|
-
|
|
1825
|
+
/**
|
|
1826
|
+
* Tie progress to scroll: `source` moving through the viewport (or, with
|
|
1827
|
+
* `{ source: 'scroll' }`, a scroll container's own position). Runs on native
|
|
1828
|
+
* ScrollTimeline / ViewTimeline when available (and no `smooth`, `offset`,
|
|
1829
|
+
* `call()` cues or `onUpdate` need JS), else on a rAF-throttled listener.
|
|
1830
|
+
* Returns a stop function with a `native` flag.
|
|
1831
|
+
*/
|
|
1832
|
+
scrub(source: Element, options?: ScrubOptions): ScrubHandle;
|
|
1809
1833
|
/** Stop and drop every animation (elements keep their last frame). */
|
|
1810
1834
|
cancel(): void;
|
|
1811
1835
|
}
|
|
@@ -1837,7 +1861,9 @@ declare function timeline(options?: TimelineOptions): Timeline;
|
|
|
1837
1861
|
* Attributes: `trigger` (`view` default · `click` · `manual`), `scrub`
|
|
1838
1862
|
* (progress follows scroll instead of playing), `overlap` (ms each step
|
|
1839
1863
|
* overlaps the previous, default 0), `duration` (600), `stagger` (ms),
|
|
1840
|
-
* `repeat` (replay every time it enters the viewport).
|
|
1864
|
+
* `repeat` (replay every time it enters the viewport). 4.1: `scrub` runs on native
|
|
1865
|
+
* ScrollTimeline / ViewTimeline when supported (`data-native` is set); `scrub="js"`,
|
|
1866
|
+
* `scrub="scroll"` and `smooth` tune it. Methods: `play()`,
|
|
1841
1867
|
* `reverse()`, `seek(t)`; property `timeline`. Event `usa:complete`.
|
|
1842
1868
|
* Reduced motion: steps appear in their final state.
|
|
1843
1869
|
*/
|
|
@@ -2375,6 +2401,78 @@ declare global {
|
|
|
2375
2401
|
}
|
|
2376
2402
|
}
|
|
2377
2403
|
|
|
2404
|
+
/**
|
|
2405
|
+
* use-scroll-animate/components/tokens — motion design tokens (4.2).
|
|
2406
|
+
*
|
|
2407
|
+
* One source of truth for durations, easings and springs: as CSS custom
|
|
2408
|
+
* properties (`--usa-duration-fast`, `--usa-easing-emphasized`,
|
|
2409
|
+
* `--usa-spring-bouncy-stiffness`…), as W3C Design Tokens JSON, and importable
|
|
2410
|
+
* from Figma Tokens (Tokens Studio) or Style Dictionary exports.
|
|
2411
|
+
*
|
|
2412
|
+
* ```ts
|
|
2413
|
+
* import { applyMotionTokens, importMotionTokens, motionToken } from 'use-scroll-animate/components/tokens';
|
|
2414
|
+
* applyMotionTokens(importMotionTokens(await (await fetch('/tokens.json')).json()));
|
|
2415
|
+
* el.animate(frames, { duration: motionToken('duration', 'slow'), easing: motionToken('easing', 'emphasized') });
|
|
2416
|
+
* ```
|
|
2417
|
+
*/
|
|
2418
|
+
interface SpringToken {
|
|
2419
|
+
stiffness: number;
|
|
2420
|
+
damping: number;
|
|
2421
|
+
mass: number;
|
|
2422
|
+
}
|
|
2423
|
+
interface MotionTokens {
|
|
2424
|
+
/** Durations in ms. */
|
|
2425
|
+
duration: Record<string, number>;
|
|
2426
|
+
/** CSS easing strings. */
|
|
2427
|
+
easing: Record<string, string>;
|
|
2428
|
+
/** Spring physics parameters. */
|
|
2429
|
+
spring: Record<string, SpringToken>;
|
|
2430
|
+
}
|
|
2431
|
+
/** The default motion scale (Material / Fluent-inspired). */
|
|
2432
|
+
declare const MOTION_TOKENS: MotionTokens;
|
|
2433
|
+
type MotionTokenGroup = keyof MotionTokens;
|
|
2434
|
+
type DeepPartialTokens = {
|
|
2435
|
+
[K in keyof MotionTokens]?: Partial<MotionTokens[K]>;
|
|
2436
|
+
};
|
|
2437
|
+
/** Merge partial tokens over a base (defaults: the built-in scale). */
|
|
2438
|
+
declare function mergeMotionTokens(partial: DeepPartialTokens, base?: MotionTokens): MotionTokens;
|
|
2439
|
+
/** The custom-property map: `{ '--usa-duration-fast': '150ms', … }`. */
|
|
2440
|
+
declare function motionTokensToVars(tokens?: MotionTokens, prefix?: string): Record<string, string>;
|
|
2441
|
+
/** A stylesheet string: `:root { --usa-duration-fast: 150ms; … }`. */
|
|
2442
|
+
declare function motionTokensToCss(tokens?: MotionTokens, selector?: string, prefix?: string): string;
|
|
2443
|
+
/** W3C Design Tokens (DTCG) JSON: `{ motion: { duration: { fast: { $type: 'duration', $value: '150ms' } } } }`. */
|
|
2444
|
+
declare function motionTokensToJSON(tokens?: MotionTokens): Record<string, unknown>;
|
|
2445
|
+
/** Parse `150ms`, `0.15s`, `150` → ms. */
|
|
2446
|
+
declare function parseDuration(v: unknown): number | undefined;
|
|
2447
|
+
/** Parse `[x1,y1,x2,y2]`, `'cubic-bezier(…)'`, `'0.2, 0, 0, 1'` or a keyword → CSS easing. */
|
|
2448
|
+
declare function parseEasing(v: unknown): string | undefined;
|
|
2449
|
+
/**
|
|
2450
|
+
* Import tokens from W3C DTCG JSON, Figma Tokens / Tokens Studio
|
|
2451
|
+
* (`{ value, type }`) or Style Dictionary (`{ value }`, nested) — anything
|
|
2452
|
+
* under a `duration` / `easing` / `spring` group (any depth, e.g.
|
|
2453
|
+
* `motion.duration.fast` or `global.animation.easing.out`), or typed leaves
|
|
2454
|
+
* (`duration`, `cubicBezier`, `transition`, `spring`). Unknown values are
|
|
2455
|
+
* skipped; the result is merged over the defaults.
|
|
2456
|
+
*/
|
|
2457
|
+
declare function importMotionTokens(json: unknown, base?: MotionTokens): MotionTokens;
|
|
2458
|
+
/** The tokens currently applied (via `applyMotionTokens`), or the defaults. */
|
|
2459
|
+
declare function getMotionTokens(): MotionTokens;
|
|
2460
|
+
/**
|
|
2461
|
+
* Write tokens as CSS custom properties on `root` (default `<html>`) and make
|
|
2462
|
+
* them the active set for `motionToken()`. Returns an undo function.
|
|
2463
|
+
*/
|
|
2464
|
+
declare function applyMotionTokens(tokens?: DeepPartialTokens | MotionTokens, root?: HTMLElement, prefix?: string): () => void;
|
|
2465
|
+
/** Look up a token: `motionToken('duration', 'fast')` → `150`; `motionToken('easing', 'emphasized')` → CSS easing. */
|
|
2466
|
+
declare function motionToken(group: 'duration', name: string): number;
|
|
2467
|
+
declare function motionToken(group: 'easing', name: string): string;
|
|
2468
|
+
declare function motionToken(group: 'spring', name: string): SpringToken;
|
|
2469
|
+
/** `var(--usa-duration-fast, 150ms)` — a CSS reference with the current value as fallback. */
|
|
2470
|
+
declare function motionVar(group: MotionTokenGroup, name: string, prop?: 'stiffness' | 'damping' | 'mass', prefix?: string): string;
|
|
2471
|
+
/** Resolve a duration that may be a token name (`'fast'`) or ms. */
|
|
2472
|
+
declare function resolveDurationToken(v: number | string | undefined, fallback: number): number;
|
|
2473
|
+
/** Resolve an easing that may be a token name (`'emphasized'`) or CSS. */
|
|
2474
|
+
declare function resolveEasingToken(v: string | undefined, fallback: string): string;
|
|
2475
|
+
|
|
2378
2476
|
/** The component categories and their default tags. */
|
|
2379
2477
|
declare const COMPONENT_CATEGORIES: {
|
|
2380
2478
|
readonly reveal: readonly ["usa-reveal", "usa-stagger", "usa-scroll-progress", "usa-scrolly"];
|
|
@@ -2404,5 +2502,5 @@ type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;
|
|
|
2404
2502
|
*/
|
|
2405
2503
|
declare function defineComponents(categories?: ComponentCategory[]): void;
|
|
2406
2504
|
|
|
2407
|
-
export { AMBIENT_EFFECTS, ANIM_ICONS, BUTTON_DEFORMS, CARD_EFFECTS, CLICK_EFFECTS, COMPONENT_CATEGORIES, CURSOR_MODES, MASK_SHAPES, MORPH_ICONS, MOTION_SCALE, PACKS, PACK_PRIMITIVES, PAGE_EFFECTS, REVEAL_EFFECTS, SHADERS, SPINNER_VARIANTS, SPRING_EFFECTS, SPRING_PRESETS, TIMELINE_PRESETS, VARIANTS, adoptVariants, applyPack, autoAnimate, burst, confetti, configureComponents, countUp, createSpring, defineAccordion, defineAcrylic, defineAmbient, defineAnimIcon, defineAurora, defineAutoAnimate, defineAutoSkeleton, defineAvatarStack, defineBackToTop, defineBackgroundComponents, defineBadge, defineBlobs, defineBottomSheet, defineButton, defineCard, defineCardComponents, defineCardStack, defineCarousel3d, defineCheck, defineCheckbox, defineClick, defineClickComponents, defineComponents, defineCounter, defineCube, defineCursor, defineDepth, defineDepthComponents, defineDialog, defineDistort, defineDotNetwork, defineDoubleTap, defineDraggable, defineDraw, defineDrawer, defineFab, defineFeedbackComponents, defineFullpage, defineGestureComponents, defineGlitch, defineGradientText, defineGrain, defineGridGlow, defineHandwriting, defineHold, defineIconMorph, defineInteractionComponents, defineLayoutComponents, defineLike, defineLiquid, defineLoadingBar, defineMagnetic, defineMarquee, defineMaskReveal, defineMasonry, defineMorph, defineMotionSwitch, defineNavbar, defineOverscroll, definePack, definePacksComponents, definePageComponents, defineParticles, definePhysicsComponents, definePinchZoom, definePopover, definePress, defineProgress, definePullRefresh, defineRating, defineReveal, defineRevealComponents, defineRipple, defineScramble, defineScrollHighlight, defineScrollProgress, defineScrolly, defineShader, defineShimmerText, defineSkeleton, defineSlider, defineSpinner, defineSplash, defineSplitText, defineSpotlight, defineSpring, defineStagger, defineStickyStack, defineSvgComponents, defineSwipeable, defineTabs, defineTextComponents, defineTextRotate, defineTilt, defineTimeline, defineTimelineComponents, defineToaster, defineToggle, defineTooltip, defineTransitionComponents, defineTypewriter, defineUiComponents, defineViewSwitch, defineWaterRipple, defineWaveText, defineWebglComponents, deviceTilt, drawLines, easeOutExpo, enableMpaTransitions, flip, flipFrames, fluentPreset, flyToCart, fragmentSource, gesture, getMotionIntensity, glQuad, haptic, interpolatePath, linearEasing, loadingBar, masonryLayout, morphPath, morphTo, orientationToTilt, pageTransition, pathsCompatible, pinchScale, prefersReducedMotion, projectInertia, readScrollProgress, requestOrientationPermission, resolvePosition, resolveSpring, restoreMotionIntensity, revealKeyframes, rubberBand, scrambleFrame, scrollToTarget, setMotionIntensity, setVariant, shake, sharedTransition, smoothScroll, snapTo, spring, springEasing, springEffectKeyframes, springSamples, stepSpring, supportsLinearEasing, supportsOrientation, supportsViewTransitions, supportsWebGL, swipeDirection, themeTransition, timeline, toast, viewTransition };
|
|
2408
|
-
export type { AmbientEffect, AutoAnimateOptions, BurstOptions, ButtonDeform, ButtonShape, ButtonState, CardEffect, ClickEffect, ComponentCategory, ComponentsConfig, ConfettiOptions, CursorMode, DialogVariant, FlipOptions, FluentPresetOptions, GLQuad, GestureHandlers, GestureOptions, MorphOptions, MotionIntensity, PackContext, PackName, PageEffect, PageTransitionOptions, PanState, PinchState, Placement, PressState, RevealEffect, ScrubOptions, SharedOptions, SmoothScrollOptions, SpinnerVariant, SpringConfig, SpringEffect, SpringInput, SpringPreset, SpringValue, SpringValueOptions, SwipeDirection, SwipeState, TiltReading, Timeline, TimelineOptions, TimelinePosition, TimelineStepOptions, ToastHandle, ToastOptions, ToastType, UsaAccordionElement, UsaAcrylicElement, UsaAmbientElement, UsaAnimIconElement, UsaAuroraElement, UsaAutoAnimateElement, UsaAutoSkeletonElement, UsaAvatarStackElement, UsaBackToTopElement, UsaBadgeElement, UsaBlobsElement, UsaBottomSheetElement, UsaButtonElement, UsaCardElement, UsaCardStackElement, UsaCarousel3dElement, UsaCheckElement, UsaCheckboxElement, UsaClickElement, UsaCounterElement, UsaCubeElement, UsaCursorElement, UsaDepthElement, UsaDialogElement, UsaDotNetworkElement, UsaDoubleTapElement, UsaDraggableElement, UsaDrawElement, UsaDrawerElement, UsaElement, UsaFabElement, UsaFullpageElement, UsaGLElement, UsaGlitchElement, UsaGradientTextElement, UsaGrainElement, UsaGridGlowElement, UsaHandwritingElement, UsaHoldElement, UsaIconMorphElement, UsaLikeElement, UsaLoadingBarElement, UsaMagneticElement, UsaMarqueeElement, UsaMaskRevealElement, UsaMasonryElement, UsaMorphElement, UsaMotionSwitchElement, UsaNavbarElement, UsaOverscrollElement, UsaPackElement, UsaParticlesElement, UsaPinchZoomElement, UsaPopoverElement, UsaPressElement, UsaProgressElement, UsaPullRefreshElement, UsaRatingElement, UsaRevealElement, UsaRippleElement, UsaScrambleElement, UsaScrollHighlightElement, UsaScrollProgressElement, UsaScrollyElement, UsaShimmerTextElement, UsaSkeletonElement, UsaSliderElement, UsaSpinnerElement, UsaSplashElement, UsaSplitTextElement, UsaSpotlightElement, UsaSpringElement, UsaStaggerElement, UsaStickyStackElement, UsaSwipeableElement, UsaTabsElement, UsaTextRotateElement, UsaTiltElement, UsaTimelineElement, UsaToasterElement, UsaToggleElement, UsaTooltipElement, UsaTypewriterElement, UsaViewSwitchElement, UsaWaterRippleElement, UsaWaveTextElement, Variant, ViewTransitionOptions };
|
|
2505
|
+
export { AMBIENT_EFFECTS, ANIM_ICONS, BUTTON_DEFORMS, CARD_EFFECTS, CLICK_EFFECTS, COMPONENT_CATEGORIES, CURSOR_MODES, MASK_SHAPES, MORPH_ICONS, MOTION_SCALE, MOTION_TOKENS, PACKS, PACK_PRIMITIVES, PAGE_EFFECTS, REVEAL_EFFECTS, SHADERS, SPINNER_VARIANTS, SPRING_EFFECTS, SPRING_PRESETS, TIMELINE_PRESETS, VARIANTS, adoptVariants, applyMotionTokens, applyPack, autoAnimate, burst, confetti, configureComponents, countUp, createSpring, defineAccordion, defineAcrylic, defineAmbient, defineAnimIcon, defineAurora, defineAutoAnimate, defineAutoSkeleton, defineAvatarStack, defineBackToTop, defineBackgroundComponents, defineBadge, defineBlobs, defineBottomSheet, defineButton, defineCard, defineCardComponents, defineCardStack, defineCarousel3d, defineCheck, defineCheckbox, defineClick, defineClickComponents, defineComponents, defineCounter, defineCube, defineCursor, defineDepth, defineDepthComponents, defineDialog, defineDistort, defineDotNetwork, defineDoubleTap, defineDraggable, defineDraw, defineDrawer, defineFab, defineFeedbackComponents, defineFullpage, defineGestureComponents, defineGlitch, defineGradientText, defineGrain, defineGridGlow, defineHandwriting, defineHold, defineIconMorph, defineInteractionComponents, defineLayoutComponents, defineLike, defineLiquid, defineLoadingBar, defineMagnetic, defineMarquee, defineMaskReveal, defineMasonry, defineMorph, defineMotionSwitch, defineNavbar, defineOverscroll, definePack, definePacksComponents, definePageComponents, defineParticles, definePhysicsComponents, definePinchZoom, definePopover, definePress, defineProgress, definePullRefresh, defineRating, defineReveal, defineRevealComponents, defineRipple, defineScramble, defineScrollHighlight, defineScrollProgress, defineScrolly, defineShader, defineShimmerText, defineSkeleton, defineSlider, defineSpinner, defineSplash, defineSplitText, defineSpotlight, defineSpring, defineStagger, defineStickyStack, defineSvgComponents, defineSwipeable, defineTabs, defineTextComponents, defineTextRotate, defineTilt, defineTimeline, defineTimelineComponents, defineToaster, defineToggle, defineTooltip, defineTransitionComponents, defineTypewriter, defineUiComponents, defineViewSwitch, defineWaterRipple, defineWaveText, defineWebglComponents, deviceTilt, drawLines, easeOutExpo, enableMpaTransitions, flip, flipFrames, fluentPreset, flyToCart, fragmentSource, gesture, getMotionIntensity, getMotionTokens, glQuad, haptic, importMotionTokens, interpolatePath, linearEasing, loadingBar, masonryLayout, mergeMotionTokens, morphPath, morphTo, motionToken, motionTokensToCss, motionTokensToJSON, motionTokensToVars, motionVar, orientationToTilt, pageTransition, parseDuration, parseEasing, pathsCompatible, pinchScale, prefersReducedMotion, projectInertia, readScrollProgress, requestOrientationPermission, resolveDurationToken, resolveEasingToken, resolvePosition, resolveSpring, restoreMotionIntensity, revealKeyframes, rubberBand, scrambleFrame, scrollToTarget, setMotionIntensity, setVariant, shake, sharedTransition, smoothScroll, snapTo, spring, springEasing, springEffectKeyframes, springSamples, stepSpring, supportsLinearEasing, supportsNativeScrub, supportsOrientation, supportsViewTransitions, supportsWebGL, swipeDirection, themeTransition, timeline, toast, viewTransition };
|
|
2506
|
+
export type { AmbientEffect, AutoAnimateOptions, BurstOptions, ButtonDeform, ButtonShape, ButtonState, CardEffect, ClickEffect, ComponentCategory, ComponentsConfig, ConfettiOptions, CursorMode, DeepPartialTokens, DialogVariant, FlipOptions, FluentPresetOptions, GLQuad, GestureHandlers, GestureOptions, MorphOptions, MotionIntensity, MotionTokenGroup, MotionTokens, PackContext, PackName, PageEffect, PageTransitionOptions, PanState, PinchState, Placement, PressState, RevealEffect, ScrubHandle, ScrubOptions, SharedOptions, SmoothScrollOptions, SpinnerVariant, SpringConfig, SpringEffect, SpringInput, SpringPreset, SpringToken, SpringValue, SpringValueOptions, SwipeDirection, SwipeState, TiltReading, Timeline, TimelineOptions, TimelinePosition, TimelineStepOptions, ToastHandle, ToastOptions, ToastType, UsaAccordionElement, UsaAcrylicElement, UsaAmbientElement, UsaAnimIconElement, UsaAuroraElement, UsaAutoAnimateElement, UsaAutoSkeletonElement, UsaAvatarStackElement, UsaBackToTopElement, UsaBadgeElement, UsaBlobsElement, UsaBottomSheetElement, UsaButtonElement, UsaCardElement, UsaCardStackElement, UsaCarousel3dElement, UsaCheckElement, UsaCheckboxElement, UsaClickElement, UsaCounterElement, UsaCubeElement, UsaCursorElement, UsaDepthElement, UsaDialogElement, UsaDotNetworkElement, UsaDoubleTapElement, UsaDraggableElement, UsaDrawElement, UsaDrawerElement, UsaElement, UsaFabElement, UsaFullpageElement, UsaGLElement, UsaGlitchElement, UsaGradientTextElement, UsaGrainElement, UsaGridGlowElement, UsaHandwritingElement, UsaHoldElement, UsaIconMorphElement, UsaLikeElement, UsaLoadingBarElement, UsaMagneticElement, UsaMarqueeElement, UsaMaskRevealElement, UsaMasonryElement, UsaMorphElement, UsaMotionSwitchElement, UsaNavbarElement, UsaOverscrollElement, UsaPackElement, UsaParticlesElement, UsaPinchZoomElement, UsaPopoverElement, UsaPressElement, UsaProgressElement, UsaPullRefreshElement, UsaRatingElement, UsaRevealElement, UsaRippleElement, UsaScrambleElement, UsaScrollHighlightElement, UsaScrollProgressElement, UsaScrollyElement, UsaShimmerTextElement, UsaSkeletonElement, UsaSliderElement, UsaSpinnerElement, UsaSplashElement, UsaSplitTextElement, UsaSpotlightElement, UsaSpringElement, UsaStaggerElement, UsaStickyStackElement, UsaSwipeableElement, UsaTabsElement, UsaTextRotateElement, UsaTiltElement, UsaTimelineElement, UsaToasterElement, UsaToggleElement, UsaTooltipElement, UsaTypewriterElement, UsaViewSwitchElement, UsaWaterRippleElement, UsaWaveTextElement, Variant, ViewTransitionOptions };
|
package/dist/components.d.ts
CHANGED
|
@@ -1757,9 +1757,9 @@ declare global {
|
|
|
1757
1757
|
*/
|
|
1758
1758
|
type TimelinePosition = number | string;
|
|
1759
1759
|
interface TimelineStepOptions {
|
|
1760
|
-
/** Duration in ms (
|
|
1761
|
-
duration?: number;
|
|
1762
|
-
/** CSS easing (
|
|
1760
|
+
/** Duration in ms or a motion token name (`'fast'`, `'slow'`…; 4.2). Default: timeline default, 600. */
|
|
1761
|
+
duration?: number | string;
|
|
1762
|
+
/** CSS easing or a motion token name (`'emphasized'`, `'spring'`…; 4.2). Default `cubic-bezier(0.22, 1, 0.36, 1)`. */
|
|
1763
1763
|
easing?: string;
|
|
1764
1764
|
/** Start position, see `TimelinePosition`. */
|
|
1765
1765
|
at?: TimelinePosition;
|
|
@@ -1777,11 +1777,29 @@ interface TimelineOptions {
|
|
|
1777
1777
|
onUpdate?: (progress: number) => void;
|
|
1778
1778
|
}
|
|
1779
1779
|
interface ScrubOptions {
|
|
1780
|
-
/** Scroll offset (px) before the source's top reaches the viewport bottom where progress starts. */
|
|
1780
|
+
/** Scroll offset (px) before the source's top reaches the viewport bottom where progress starts (JS engine only). */
|
|
1781
1781
|
offset?: number;
|
|
1782
|
-
/** Smoothing 0–1 (0 = immediate, default 0). */
|
|
1782
|
+
/** Smoothing 0–1 (0 = immediate, default 0). Smoothing needs the JS engine. */
|
|
1783
1783
|
smooth?: number;
|
|
1784
|
-
|
|
1784
|
+
/**
|
|
1785
|
+
* 4.1: which progress source drives the timeline.
|
|
1786
|
+
* - `'view'` (default): `source` moving through the viewport (CSS `ViewTimeline`, range `cover`).
|
|
1787
|
+
* - `'scroll'`: the scroll position of `source` itself (a scroll container; CSS `ScrollTimeline`).
|
|
1788
|
+
*/
|
|
1789
|
+
source?: 'view' | 'scroll';
|
|
1790
|
+
/** 4.1: `'auto'` (default) uses the browser's native scroll-driven animations when available, `'js'` forces the fallback. */
|
|
1791
|
+
engine?: 'auto' | 'native' | 'js';
|
|
1792
|
+
/** 4.1: scroll axis, `'block'` (default) · `'inline'` · `'x'` · `'y'`. */
|
|
1793
|
+
axis?: 'block' | 'inline' | 'x' | 'y';
|
|
1794
|
+
}
|
|
1795
|
+
/** The function `scrub()` returns: call it to stop. `native` tells which engine runs it. */
|
|
1796
|
+
interface ScrubHandle {
|
|
1797
|
+
(): void;
|
|
1798
|
+
/** `true` when the browser's ScrollTimeline / ViewTimeline drives it (compositor, no JS per frame). */
|
|
1799
|
+
readonly native: boolean;
|
|
1800
|
+
}
|
|
1801
|
+
/** 4.1: whether `scrub()` can use native ScrollTimeline / ViewTimeline here. */
|
|
1802
|
+
declare function supportsNativeScrub(source?: 'view' | 'scroll'): boolean;
|
|
1785
1803
|
interface Timeline {
|
|
1786
1804
|
/** Total length in ms. */
|
|
1787
1805
|
readonly duration: number;
|
|
@@ -1804,8 +1822,14 @@ interface Timeline {
|
|
|
1804
1822
|
seek(to: TimelinePosition): Timeline;
|
|
1805
1823
|
/** Get or set progress 0–1. */
|
|
1806
1824
|
progress(p?: number): number;
|
|
1807
|
-
/**
|
|
1808
|
-
|
|
1825
|
+
/**
|
|
1826
|
+
* Tie progress to scroll: `source` moving through the viewport (or, with
|
|
1827
|
+
* `{ source: 'scroll' }`, a scroll container's own position). Runs on native
|
|
1828
|
+
* ScrollTimeline / ViewTimeline when available (and no `smooth`, `offset`,
|
|
1829
|
+
* `call()` cues or `onUpdate` need JS), else on a rAF-throttled listener.
|
|
1830
|
+
* Returns a stop function with a `native` flag.
|
|
1831
|
+
*/
|
|
1832
|
+
scrub(source: Element, options?: ScrubOptions): ScrubHandle;
|
|
1809
1833
|
/** Stop and drop every animation (elements keep their last frame). */
|
|
1810
1834
|
cancel(): void;
|
|
1811
1835
|
}
|
|
@@ -1837,7 +1861,9 @@ declare function timeline(options?: TimelineOptions): Timeline;
|
|
|
1837
1861
|
* Attributes: `trigger` (`view` default · `click` · `manual`), `scrub`
|
|
1838
1862
|
* (progress follows scroll instead of playing), `overlap` (ms each step
|
|
1839
1863
|
* overlaps the previous, default 0), `duration` (600), `stagger` (ms),
|
|
1840
|
-
* `repeat` (replay every time it enters the viewport).
|
|
1864
|
+
* `repeat` (replay every time it enters the viewport). 4.1: `scrub` runs on native
|
|
1865
|
+
* ScrollTimeline / ViewTimeline when supported (`data-native` is set); `scrub="js"`,
|
|
1866
|
+
* `scrub="scroll"` and `smooth` tune it. Methods: `play()`,
|
|
1841
1867
|
* `reverse()`, `seek(t)`; property `timeline`. Event `usa:complete`.
|
|
1842
1868
|
* Reduced motion: steps appear in their final state.
|
|
1843
1869
|
*/
|
|
@@ -2375,6 +2401,78 @@ declare global {
|
|
|
2375
2401
|
}
|
|
2376
2402
|
}
|
|
2377
2403
|
|
|
2404
|
+
/**
|
|
2405
|
+
* use-scroll-animate/components/tokens — motion design tokens (4.2).
|
|
2406
|
+
*
|
|
2407
|
+
* One source of truth for durations, easings and springs: as CSS custom
|
|
2408
|
+
* properties (`--usa-duration-fast`, `--usa-easing-emphasized`,
|
|
2409
|
+
* `--usa-spring-bouncy-stiffness`…), as W3C Design Tokens JSON, and importable
|
|
2410
|
+
* from Figma Tokens (Tokens Studio) or Style Dictionary exports.
|
|
2411
|
+
*
|
|
2412
|
+
* ```ts
|
|
2413
|
+
* import { applyMotionTokens, importMotionTokens, motionToken } from 'use-scroll-animate/components/tokens';
|
|
2414
|
+
* applyMotionTokens(importMotionTokens(await (await fetch('/tokens.json')).json()));
|
|
2415
|
+
* el.animate(frames, { duration: motionToken('duration', 'slow'), easing: motionToken('easing', 'emphasized') });
|
|
2416
|
+
* ```
|
|
2417
|
+
*/
|
|
2418
|
+
interface SpringToken {
|
|
2419
|
+
stiffness: number;
|
|
2420
|
+
damping: number;
|
|
2421
|
+
mass: number;
|
|
2422
|
+
}
|
|
2423
|
+
interface MotionTokens {
|
|
2424
|
+
/** Durations in ms. */
|
|
2425
|
+
duration: Record<string, number>;
|
|
2426
|
+
/** CSS easing strings. */
|
|
2427
|
+
easing: Record<string, string>;
|
|
2428
|
+
/** Spring physics parameters. */
|
|
2429
|
+
spring: Record<string, SpringToken>;
|
|
2430
|
+
}
|
|
2431
|
+
/** The default motion scale (Material / Fluent-inspired). */
|
|
2432
|
+
declare const MOTION_TOKENS: MotionTokens;
|
|
2433
|
+
type MotionTokenGroup = keyof MotionTokens;
|
|
2434
|
+
type DeepPartialTokens = {
|
|
2435
|
+
[K in keyof MotionTokens]?: Partial<MotionTokens[K]>;
|
|
2436
|
+
};
|
|
2437
|
+
/** Merge partial tokens over a base (defaults: the built-in scale). */
|
|
2438
|
+
declare function mergeMotionTokens(partial: DeepPartialTokens, base?: MotionTokens): MotionTokens;
|
|
2439
|
+
/** The custom-property map: `{ '--usa-duration-fast': '150ms', … }`. */
|
|
2440
|
+
declare function motionTokensToVars(tokens?: MotionTokens, prefix?: string): Record<string, string>;
|
|
2441
|
+
/** A stylesheet string: `:root { --usa-duration-fast: 150ms; … }`. */
|
|
2442
|
+
declare function motionTokensToCss(tokens?: MotionTokens, selector?: string, prefix?: string): string;
|
|
2443
|
+
/** W3C Design Tokens (DTCG) JSON: `{ motion: { duration: { fast: { $type: 'duration', $value: '150ms' } } } }`. */
|
|
2444
|
+
declare function motionTokensToJSON(tokens?: MotionTokens): Record<string, unknown>;
|
|
2445
|
+
/** Parse `150ms`, `0.15s`, `150` → ms. */
|
|
2446
|
+
declare function parseDuration(v: unknown): number | undefined;
|
|
2447
|
+
/** Parse `[x1,y1,x2,y2]`, `'cubic-bezier(…)'`, `'0.2, 0, 0, 1'` or a keyword → CSS easing. */
|
|
2448
|
+
declare function parseEasing(v: unknown): string | undefined;
|
|
2449
|
+
/**
|
|
2450
|
+
* Import tokens from W3C DTCG JSON, Figma Tokens / Tokens Studio
|
|
2451
|
+
* (`{ value, type }`) or Style Dictionary (`{ value }`, nested) — anything
|
|
2452
|
+
* under a `duration` / `easing` / `spring` group (any depth, e.g.
|
|
2453
|
+
* `motion.duration.fast` or `global.animation.easing.out`), or typed leaves
|
|
2454
|
+
* (`duration`, `cubicBezier`, `transition`, `spring`). Unknown values are
|
|
2455
|
+
* skipped; the result is merged over the defaults.
|
|
2456
|
+
*/
|
|
2457
|
+
declare function importMotionTokens(json: unknown, base?: MotionTokens): MotionTokens;
|
|
2458
|
+
/** The tokens currently applied (via `applyMotionTokens`), or the defaults. */
|
|
2459
|
+
declare function getMotionTokens(): MotionTokens;
|
|
2460
|
+
/**
|
|
2461
|
+
* Write tokens as CSS custom properties on `root` (default `<html>`) and make
|
|
2462
|
+
* them the active set for `motionToken()`. Returns an undo function.
|
|
2463
|
+
*/
|
|
2464
|
+
declare function applyMotionTokens(tokens?: DeepPartialTokens | MotionTokens, root?: HTMLElement, prefix?: string): () => void;
|
|
2465
|
+
/** Look up a token: `motionToken('duration', 'fast')` → `150`; `motionToken('easing', 'emphasized')` → CSS easing. */
|
|
2466
|
+
declare function motionToken(group: 'duration', name: string): number;
|
|
2467
|
+
declare function motionToken(group: 'easing', name: string): string;
|
|
2468
|
+
declare function motionToken(group: 'spring', name: string): SpringToken;
|
|
2469
|
+
/** `var(--usa-duration-fast, 150ms)` — a CSS reference with the current value as fallback. */
|
|
2470
|
+
declare function motionVar(group: MotionTokenGroup, name: string, prop?: 'stiffness' | 'damping' | 'mass', prefix?: string): string;
|
|
2471
|
+
/** Resolve a duration that may be a token name (`'fast'`) or ms. */
|
|
2472
|
+
declare function resolveDurationToken(v: number | string | undefined, fallback: number): number;
|
|
2473
|
+
/** Resolve an easing that may be a token name (`'emphasized'`) or CSS. */
|
|
2474
|
+
declare function resolveEasingToken(v: string | undefined, fallback: string): string;
|
|
2475
|
+
|
|
2378
2476
|
/** The component categories and their default tags. */
|
|
2379
2477
|
declare const COMPONENT_CATEGORIES: {
|
|
2380
2478
|
readonly reveal: readonly ["usa-reveal", "usa-stagger", "usa-scroll-progress", "usa-scrolly"];
|
|
@@ -2404,5 +2502,5 @@ type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;
|
|
|
2404
2502
|
*/
|
|
2405
2503
|
declare function defineComponents(categories?: ComponentCategory[]): void;
|
|
2406
2504
|
|
|
2407
|
-
export { AMBIENT_EFFECTS, ANIM_ICONS, BUTTON_DEFORMS, CARD_EFFECTS, CLICK_EFFECTS, COMPONENT_CATEGORIES, CURSOR_MODES, MASK_SHAPES, MORPH_ICONS, MOTION_SCALE, PACKS, PACK_PRIMITIVES, PAGE_EFFECTS, REVEAL_EFFECTS, SHADERS, SPINNER_VARIANTS, SPRING_EFFECTS, SPRING_PRESETS, TIMELINE_PRESETS, VARIANTS, adoptVariants, applyPack, autoAnimate, burst, confetti, configureComponents, countUp, createSpring, defineAccordion, defineAcrylic, defineAmbient, defineAnimIcon, defineAurora, defineAutoAnimate, defineAutoSkeleton, defineAvatarStack, defineBackToTop, defineBackgroundComponents, defineBadge, defineBlobs, defineBottomSheet, defineButton, defineCard, defineCardComponents, defineCardStack, defineCarousel3d, defineCheck, defineCheckbox, defineClick, defineClickComponents, defineComponents, defineCounter, defineCube, defineCursor, defineDepth, defineDepthComponents, defineDialog, defineDistort, defineDotNetwork, defineDoubleTap, defineDraggable, defineDraw, defineDrawer, defineFab, defineFeedbackComponents, defineFullpage, defineGestureComponents, defineGlitch, defineGradientText, defineGrain, defineGridGlow, defineHandwriting, defineHold, defineIconMorph, defineInteractionComponents, defineLayoutComponents, defineLike, defineLiquid, defineLoadingBar, defineMagnetic, defineMarquee, defineMaskReveal, defineMasonry, defineMorph, defineMotionSwitch, defineNavbar, defineOverscroll, definePack, definePacksComponents, definePageComponents, defineParticles, definePhysicsComponents, definePinchZoom, definePopover, definePress, defineProgress, definePullRefresh, defineRating, defineReveal, defineRevealComponents, defineRipple, defineScramble, defineScrollHighlight, defineScrollProgress, defineScrolly, defineShader, defineShimmerText, defineSkeleton, defineSlider, defineSpinner, defineSplash, defineSplitText, defineSpotlight, defineSpring, defineStagger, defineStickyStack, defineSvgComponents, defineSwipeable, defineTabs, defineTextComponents, defineTextRotate, defineTilt, defineTimeline, defineTimelineComponents, defineToaster, defineToggle, defineTooltip, defineTransitionComponents, defineTypewriter, defineUiComponents, defineViewSwitch, defineWaterRipple, defineWaveText, defineWebglComponents, deviceTilt, drawLines, easeOutExpo, enableMpaTransitions, flip, flipFrames, fluentPreset, flyToCart, fragmentSource, gesture, getMotionIntensity, glQuad, haptic, interpolatePath, linearEasing, loadingBar, masonryLayout, morphPath, morphTo, orientationToTilt, pageTransition, pathsCompatible, pinchScale, prefersReducedMotion, projectInertia, readScrollProgress, requestOrientationPermission, resolvePosition, resolveSpring, restoreMotionIntensity, revealKeyframes, rubberBand, scrambleFrame, scrollToTarget, setMotionIntensity, setVariant, shake, sharedTransition, smoothScroll, snapTo, spring, springEasing, springEffectKeyframes, springSamples, stepSpring, supportsLinearEasing, supportsOrientation, supportsViewTransitions, supportsWebGL, swipeDirection, themeTransition, timeline, toast, viewTransition };
|
|
2408
|
-
export type { AmbientEffect, AutoAnimateOptions, BurstOptions, ButtonDeform, ButtonShape, ButtonState, CardEffect, ClickEffect, ComponentCategory, ComponentsConfig, ConfettiOptions, CursorMode, DialogVariant, FlipOptions, FluentPresetOptions, GLQuad, GestureHandlers, GestureOptions, MorphOptions, MotionIntensity, PackContext, PackName, PageEffect, PageTransitionOptions, PanState, PinchState, Placement, PressState, RevealEffect, ScrubOptions, SharedOptions, SmoothScrollOptions, SpinnerVariant, SpringConfig, SpringEffect, SpringInput, SpringPreset, SpringValue, SpringValueOptions, SwipeDirection, SwipeState, TiltReading, Timeline, TimelineOptions, TimelinePosition, TimelineStepOptions, ToastHandle, ToastOptions, ToastType, UsaAccordionElement, UsaAcrylicElement, UsaAmbientElement, UsaAnimIconElement, UsaAuroraElement, UsaAutoAnimateElement, UsaAutoSkeletonElement, UsaAvatarStackElement, UsaBackToTopElement, UsaBadgeElement, UsaBlobsElement, UsaBottomSheetElement, UsaButtonElement, UsaCardElement, UsaCardStackElement, UsaCarousel3dElement, UsaCheckElement, UsaCheckboxElement, UsaClickElement, UsaCounterElement, UsaCubeElement, UsaCursorElement, UsaDepthElement, UsaDialogElement, UsaDotNetworkElement, UsaDoubleTapElement, UsaDraggableElement, UsaDrawElement, UsaDrawerElement, UsaElement, UsaFabElement, UsaFullpageElement, UsaGLElement, UsaGlitchElement, UsaGradientTextElement, UsaGrainElement, UsaGridGlowElement, UsaHandwritingElement, UsaHoldElement, UsaIconMorphElement, UsaLikeElement, UsaLoadingBarElement, UsaMagneticElement, UsaMarqueeElement, UsaMaskRevealElement, UsaMasonryElement, UsaMorphElement, UsaMotionSwitchElement, UsaNavbarElement, UsaOverscrollElement, UsaPackElement, UsaParticlesElement, UsaPinchZoomElement, UsaPopoverElement, UsaPressElement, UsaProgressElement, UsaPullRefreshElement, UsaRatingElement, UsaRevealElement, UsaRippleElement, UsaScrambleElement, UsaScrollHighlightElement, UsaScrollProgressElement, UsaScrollyElement, UsaShimmerTextElement, UsaSkeletonElement, UsaSliderElement, UsaSpinnerElement, UsaSplashElement, UsaSplitTextElement, UsaSpotlightElement, UsaSpringElement, UsaStaggerElement, UsaStickyStackElement, UsaSwipeableElement, UsaTabsElement, UsaTextRotateElement, UsaTiltElement, UsaTimelineElement, UsaToasterElement, UsaToggleElement, UsaTooltipElement, UsaTypewriterElement, UsaViewSwitchElement, UsaWaterRippleElement, UsaWaveTextElement, Variant, ViewTransitionOptions };
|
|
2505
|
+
export { AMBIENT_EFFECTS, ANIM_ICONS, BUTTON_DEFORMS, CARD_EFFECTS, CLICK_EFFECTS, COMPONENT_CATEGORIES, CURSOR_MODES, MASK_SHAPES, MORPH_ICONS, MOTION_SCALE, MOTION_TOKENS, PACKS, PACK_PRIMITIVES, PAGE_EFFECTS, REVEAL_EFFECTS, SHADERS, SPINNER_VARIANTS, SPRING_EFFECTS, SPRING_PRESETS, TIMELINE_PRESETS, VARIANTS, adoptVariants, applyMotionTokens, applyPack, autoAnimate, burst, confetti, configureComponents, countUp, createSpring, defineAccordion, defineAcrylic, defineAmbient, defineAnimIcon, defineAurora, defineAutoAnimate, defineAutoSkeleton, defineAvatarStack, defineBackToTop, defineBackgroundComponents, defineBadge, defineBlobs, defineBottomSheet, defineButton, defineCard, defineCardComponents, defineCardStack, defineCarousel3d, defineCheck, defineCheckbox, defineClick, defineClickComponents, defineComponents, defineCounter, defineCube, defineCursor, defineDepth, defineDepthComponents, defineDialog, defineDistort, defineDotNetwork, defineDoubleTap, defineDraggable, defineDraw, defineDrawer, defineFab, defineFeedbackComponents, defineFullpage, defineGestureComponents, defineGlitch, defineGradientText, defineGrain, defineGridGlow, defineHandwriting, defineHold, defineIconMorph, defineInteractionComponents, defineLayoutComponents, defineLike, defineLiquid, defineLoadingBar, defineMagnetic, defineMarquee, defineMaskReveal, defineMasonry, defineMorph, defineMotionSwitch, defineNavbar, defineOverscroll, definePack, definePacksComponents, definePageComponents, defineParticles, definePhysicsComponents, definePinchZoom, definePopover, definePress, defineProgress, definePullRefresh, defineRating, defineReveal, defineRevealComponents, defineRipple, defineScramble, defineScrollHighlight, defineScrollProgress, defineScrolly, defineShader, defineShimmerText, defineSkeleton, defineSlider, defineSpinner, defineSplash, defineSplitText, defineSpotlight, defineSpring, defineStagger, defineStickyStack, defineSvgComponents, defineSwipeable, defineTabs, defineTextComponents, defineTextRotate, defineTilt, defineTimeline, defineTimelineComponents, defineToaster, defineToggle, defineTooltip, defineTransitionComponents, defineTypewriter, defineUiComponents, defineViewSwitch, defineWaterRipple, defineWaveText, defineWebglComponents, deviceTilt, drawLines, easeOutExpo, enableMpaTransitions, flip, flipFrames, fluentPreset, flyToCart, fragmentSource, gesture, getMotionIntensity, getMotionTokens, glQuad, haptic, importMotionTokens, interpolatePath, linearEasing, loadingBar, masonryLayout, mergeMotionTokens, morphPath, morphTo, motionToken, motionTokensToCss, motionTokensToJSON, motionTokensToVars, motionVar, orientationToTilt, pageTransition, parseDuration, parseEasing, pathsCompatible, pinchScale, prefersReducedMotion, projectInertia, readScrollProgress, requestOrientationPermission, resolveDurationToken, resolveEasingToken, resolvePosition, resolveSpring, restoreMotionIntensity, revealKeyframes, rubberBand, scrambleFrame, scrollToTarget, setMotionIntensity, setVariant, shake, sharedTransition, smoothScroll, snapTo, spring, springEasing, springEffectKeyframes, springSamples, stepSpring, supportsLinearEasing, supportsNativeScrub, supportsOrientation, supportsViewTransitions, supportsWebGL, swipeDirection, themeTransition, timeline, toast, viewTransition };
|
|
2506
|
+
export type { AmbientEffect, AutoAnimateOptions, BurstOptions, ButtonDeform, ButtonShape, ButtonState, CardEffect, ClickEffect, ComponentCategory, ComponentsConfig, ConfettiOptions, CursorMode, DeepPartialTokens, DialogVariant, FlipOptions, FluentPresetOptions, GLQuad, GestureHandlers, GestureOptions, MorphOptions, MotionIntensity, MotionTokenGroup, MotionTokens, PackContext, PackName, PageEffect, PageTransitionOptions, PanState, PinchState, Placement, PressState, RevealEffect, ScrubHandle, ScrubOptions, SharedOptions, SmoothScrollOptions, SpinnerVariant, SpringConfig, SpringEffect, SpringInput, SpringPreset, SpringToken, SpringValue, SpringValueOptions, SwipeDirection, SwipeState, TiltReading, Timeline, TimelineOptions, TimelinePosition, TimelineStepOptions, ToastHandle, ToastOptions, ToastType, UsaAccordionElement, UsaAcrylicElement, UsaAmbientElement, UsaAnimIconElement, UsaAuroraElement, UsaAutoAnimateElement, UsaAutoSkeletonElement, UsaAvatarStackElement, UsaBackToTopElement, UsaBadgeElement, UsaBlobsElement, UsaBottomSheetElement, UsaButtonElement, UsaCardElement, UsaCardStackElement, UsaCarousel3dElement, UsaCheckElement, UsaCheckboxElement, UsaClickElement, UsaCounterElement, UsaCubeElement, UsaCursorElement, UsaDepthElement, UsaDialogElement, UsaDotNetworkElement, UsaDoubleTapElement, UsaDraggableElement, UsaDrawElement, UsaDrawerElement, UsaElement, UsaFabElement, UsaFullpageElement, UsaGLElement, UsaGlitchElement, UsaGradientTextElement, UsaGrainElement, UsaGridGlowElement, UsaHandwritingElement, UsaHoldElement, UsaIconMorphElement, UsaLikeElement, UsaLoadingBarElement, UsaMagneticElement, UsaMarqueeElement, UsaMaskRevealElement, UsaMasonryElement, UsaMorphElement, UsaMotionSwitchElement, UsaNavbarElement, UsaOverscrollElement, UsaPackElement, UsaParticlesElement, UsaPinchZoomElement, UsaPopoverElement, UsaPressElement, UsaProgressElement, UsaPullRefreshElement, UsaRatingElement, UsaRevealElement, UsaRippleElement, UsaScrambleElement, UsaScrollHighlightElement, UsaScrollProgressElement, UsaScrollyElement, UsaShimmerTextElement, UsaSkeletonElement, UsaSliderElement, UsaSpinnerElement, UsaSplashElement, UsaSplitTextElement, UsaSpotlightElement, UsaSpringElement, UsaStaggerElement, UsaStickyStackElement, UsaSwipeableElement, UsaTabsElement, UsaTextRotateElement, UsaTiltElement, UsaTimelineElement, UsaToasterElement, UsaToggleElement, UsaTooltipElement, UsaTypewriterElement, UsaViewSwitchElement, UsaWaterRippleElement, UsaWaveTextElement, Variant, ViewTransitionOptions };
|
package/dist/components.js
CHANGED
|
@@ -34,14 +34,15 @@ import { defineLayoutComponents } from './components/layout.js';
|
|
|
34
34
|
export { autoAnimate, defineAutoAnimate, defineMasonry, flipFrames, masonryLayout, sharedTransition } from './components/layout.js';
|
|
35
35
|
import { definePacksComponents } from './components/packs.js';
|
|
36
36
|
export { PACKS, PACK_PRIMITIVES, applyPack, countUp, definePack, flyToCart } from './components/packs.js';
|
|
37
|
-
import { a as adoptVariants } from './chunks/variants-
|
|
38
|
-
export { V as VARIANTS, s as setVariant } from './chunks/variants-
|
|
39
|
-
import { c as canDefine } from './chunks/base-
|
|
40
|
-
export { M as MOTION_SCALE, a as configureComponents, g as getMotionIntensity, p as prefersReducedMotion } from './chunks/base-
|
|
37
|
+
import { a as adoptVariants } from './chunks/variants-BVYMcxRv.js';
|
|
38
|
+
export { V as VARIANTS, s as setVariant } from './chunks/variants-BVYMcxRv.js';
|
|
39
|
+
import { c as canDefine } from './chunks/base-BPG5zvex.js';
|
|
40
|
+
export { M as MOTION_SCALE, a as configureComponents, g as getMotionIntensity, p as prefersReducedMotion } from './chunks/base-BPG5zvex.js';
|
|
41
|
+
export { MOTION_TOKENS, applyMotionTokens, getMotionTokens, importMotionTokens, mergeMotionTokens, motionToken, motionTokensToCss, motionTokensToJSON, motionTokensToVars, motionVar, parseDuration, parseEasing, resolveDurationToken, resolveEasingToken } from './components/tokens.js';
|
|
41
42
|
export { C as COMPONENT_CATEGORIES } from './chunks/index-tags-43Xtd01A.js';
|
|
42
|
-
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-
|
|
43
|
-
export { T as TIMELINE_PRESETS, r as resolvePosition, t as timeline } from './chunks/core-
|
|
44
|
-
export { g as gesture, p as pinchScale, s as swipeDirection } from './chunks/core-
|
|
43
|
+
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-BziPsW3r.js';
|
|
44
|
+
export { T as TIMELINE_PRESETS, r as resolvePosition, s as supportsNativeScrub, t as timeline } from './chunks/core-LkGRmgES.js';
|
|
45
|
+
export { g as gesture, p as pinchScale, s as swipeDirection } from './chunks/core-eXX8rB_b.js';
|
|
45
46
|
|
|
46
47
|
/**
|
|
47
48
|
* use-scroll-animate/components
|
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';\nimport { defineUiComponents } from './ui/index';\nimport { definePageComponents } from './page/index';\nimport { defineTimelineComponents } from './timeline/index';\nimport { defineGestureComponents } from './gesture/index';\nimport { defineSvgComponents } from './svg/index';\nimport { defineWebglComponents } from './webgl/index';\nimport { defineDepthComponents } from './depth/index';\nimport { defineLayoutComponents } from './layout/index';\nimport { definePacksComponents } from './packs/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';\nexport * from './page/index';\nexport * from './timeline/index';\nexport * from './gesture/index';\nexport * from './svg/index';\nexport * from './webgl/index';\nexport * from './depth/index';\nexport * from './layout/index';\nexport * from './packs/index';\n\nexport { COMPONENT_CATEGORIES } from './index-tags';\nexport type { ComponentCategory } from './index-tags';\nimport { COMPONENT_CATEGORIES, type ComponentCategory } from './index-tags';\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 page: definePageComponents,\n timeline: defineTimelineComponents,\n gesture: defineGestureComponents,\n svg: defineSvgComponents,\n webgl: defineWebglComponents,\n depth: defineDepthComponents,\n layout: defineLayoutComponents,\n packs: definePacksComponents,\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":"
|
|
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 { definePageComponents } from './page/index';\nimport { defineTimelineComponents } from './timeline/index';\nimport { defineGestureComponents } from './gesture/index';\nimport { defineSvgComponents } from './svg/index';\nimport { defineWebglComponents } from './webgl/index';\nimport { defineDepthComponents } from './depth/index';\nimport { defineLayoutComponents } from './layout/index';\nimport { definePacksComponents } from './packs/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';\nexport * from './page/index';\nexport * from './timeline/index';\nexport * from './gesture/index';\nexport * from './svg/index';\nexport * from './webgl/index';\nexport * from './depth/index';\nexport * from './layout/index';\nexport * from './packs/index';\nexport * from './tokens/index';\n\nexport { COMPONENT_CATEGORIES } from './index-tags';\nexport type { ComponentCategory } from './index-tags';\nimport { COMPONENT_CATEGORIES, type ComponentCategory } from './index-tags';\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 page: definePageComponents,\n timeline: defineTimelineComponents,\n gesture: defineGestureComponents,\n svg: defineSvgComponents,\n webgl: defineWebglComponents,\n depth: defineDepthComponents,\n layout: defineLayoutComponents,\n packs: definePacksComponents,\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;AA8CH,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;AACtB,IAAA,IAAI,EAAE,oBAAoB;AAC1B,IAAA,QAAQ,EAAE,wBAAwB;AAClC,IAAA,OAAO,EAAE,uBAAuB;AAChC,IAAA,GAAG,EAAE,mBAAmB;AACxB,IAAA,KAAK,EAAE,qBAAqB;AAC5B,IAAA,KAAK,EAAE,qBAAqB;AAC5B,IAAA,MAAM,EAAE,sBAAsB;AAC9B,IAAA,KAAK,EAAE,qBAAqB;CAC7B;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;;;;"}
|