use-scroll-animate 2.2.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +3 -1
  3. package/README_ja.md +2 -0
  4. package/README_zh.md +2 -0
  5. package/dist/chunks/{base-BiTc85p_.cjs → base-CJ7XfidP.cjs} +2 -1
  6. package/dist/chunks/{base-BiTc85p_.cjs.map → base-CJ7XfidP.cjs.map} +1 -1
  7. package/dist/chunks/{base-CFtnmfli.js → base-CuvCgqLy.js} +2 -2
  8. package/dist/chunks/{base-CFtnmfli.js.map → base-CuvCgqLy.js.map} +1 -1
  9. package/dist/chunks/spring-BKUU7-Xm.js +219 -0
  10. package/dist/chunks/spring-BKUU7-Xm.js.map +1 -0
  11. package/dist/chunks/spring-CGO9Jd9b.cjs +232 -0
  12. package/dist/chunks/spring-CGO9Jd9b.cjs.map +1 -0
  13. package/dist/components/background.cjs +1 -1
  14. package/dist/components/background.js +2 -2
  15. package/dist/components/cards.cjs +563 -0
  16. package/dist/components/cards.cjs.map +1 -0
  17. package/dist/components/cards.css +6 -0
  18. package/dist/components/cards.d.cts +142 -0
  19. package/dist/components/cards.d.ts +142 -0
  20. package/dist/components/cards.js +555 -0
  21. package/dist/components/cards.js.map +1 -0
  22. package/dist/components/feedback.cjs +1 -1
  23. package/dist/components/feedback.js +2 -2
  24. package/dist/components/interaction.cjs +1 -1
  25. package/dist/components/interaction.js +2 -2
  26. package/dist/components/physics.cjs +450 -0
  27. package/dist/components/physics.cjs.map +1 -0
  28. package/dist/components/physics.css +5 -0
  29. package/dist/components/physics.d.cts +216 -0
  30. package/dist/components/physics.d.ts +216 -0
  31. package/dist/components/physics.js +431 -0
  32. package/dist/components/physics.js.map +1 -0
  33. package/dist/components/reveal.cjs +1 -1
  34. package/dist/components/reveal.js +2 -2
  35. package/dist/components/text.cjs +1 -1
  36. package/dist/components/text.js +2 -2
  37. package/dist/components/transitions.cjs +1 -1
  38. package/dist/components/transitions.js +2 -2
  39. package/dist/components.cjs +32 -1
  40. package/dist/components.cjs.map +1 -1
  41. package/dist/components.css +7 -0
  42. package/dist/components.d.cts +284 -2
  43. package/dist/components.d.ts +284 -2
  44. package/dist/components.js +11 -2
  45. package/dist/components.js.map +1 -1
  46. package/dist/components.umd.js +2 -2
  47. package/dist/components.umd.js.map +1 -1
  48. package/docs/components.md +23 -0
  49. package/package.json +25 -2
@@ -721,6 +721,286 @@ declare global {
721
721
  }
722
722
  }
723
723
 
724
+ declare const SPRING_EFFECTS: readonly ["bounce-in", "pop", "drop", "jelly", "rubber-band"];
725
+ type SpringEffect = (typeof SPRING_EFFECTS)[number];
726
+ /** Keyframes of a spring effect (entrances use spring timing, attention effects fixed frames). */
727
+ declare function springEffectKeyframes(effect: string, reduced?: boolean): Keyframe[];
728
+ /**
729
+ * `<usa-spring>` — spring / bounce effects on its content.
730
+ *
731
+ * Attributes: `effect` (`bounce-in` default, `pop`, `drop`, `jelly`,
732
+ * `rubber-band`), `trigger` (`view` default, `hover`, `click`, `manual`),
733
+ * `preset` (`gentle`, `wobbly`, `stiff`, `bouncy`, …) or `stiffness` /
734
+ * `damping` / `mass`, `delay` (ms), `duration` (ms, attention effects; 900),
735
+ * `repeat` (replay every time it re-enters the view), `block`.
736
+ * Events: `usa:complete`. Reduced motion: entrances fade, attention effects do nothing.
737
+ */
738
+ interface UsaSpringElement extends UsaElement {
739
+ effect: string;
740
+ play(): Promise<void>;
741
+ reset(): void;
742
+ }
743
+ declare function defineSpring(tag?: string): CustomElementConstructor | undefined;
744
+
745
+ /**
746
+ * `<usa-draggable>` — drag its content with the pointer (mouse, touch, pen)
747
+ * or the arrow keys; physics on release.
748
+ *
749
+ * Attributes: `axis` (`both` default, `x`, `y`), `spring-back` (return to
750
+ * the origin with a spring), `inertia` (keep gliding after a flick),
751
+ * `snap` (grid size like `80`, or points like `0,120,240`), `bounds`
752
+ * (`parent` = stay inside the parent box, rubber-banding past its edges),
753
+ * `preset` (spring, default `wobbly`), `step` (arrow-key step, px, 16),
754
+ * `disabled`. Methods: `moveTo(x, y, animate?)`, `reset()`. Events:
755
+ * `usa:drag-start`, `usa:drag-end` (`{ x, y, vx, vy }`), `usa:settle`.
756
+ * Reduced motion: positions change instantly (no spring or inertia).
757
+ */
758
+ interface UsaDraggableElement extends UsaElement {
759
+ readonly x: number;
760
+ readonly y: number;
761
+ readonly dragging: boolean;
762
+ moveTo(x: number, y: number, animate?: boolean): void;
763
+ reset(): void;
764
+ }
765
+ declare function defineDraggable(tag?: string): CustomElementConstructor | undefined;
766
+
767
+ /**
768
+ * `<usa-overscroll>` — an elastic scroll container: pulling past the top or
769
+ * bottom (touch, trackpad or wheel) stretches the content with iOS-style
770
+ * rubber-band resistance and it springs back on release.
771
+ *
772
+ * Attributes: `axis` (`y` default, `x`), `max` (largest stretch in px, 120),
773
+ * `preset` (spring, default `default`), `disabled`. CSS variable
774
+ * `--usa-overscroll` holds the current offset. Reduced motion: no stretch
775
+ * (a plain scroll container with `overscroll-behavior: contain`).
776
+ */
777
+ interface UsaOverscrollElement extends UsaElement {
778
+ /** Current stretch in px (negative = pulled past the end). */
779
+ readonly offset: number;
780
+ }
781
+ declare function defineOverscroll(tag?: string): CustomElementConstructor | undefined;
782
+
783
+ /**
784
+ * Spring physics core (v2.3). A damped harmonic oscillator integrated in
785
+ * 1 ms steps: `stiffness` (k, N/m), `damping` (c) and `mass` (m). Used by
786
+ * the `<usa-spring>`, `<usa-draggable>` and `<usa-overscroll>` elements and
787
+ * exported for your own animations:
788
+ *
789
+ * - `springEasing()` turns a spring into a CSS `linear()` easing + duration
790
+ * for WAAPI / CSS (falls back to a cubic-bezier overshoot where `linear()`
791
+ * is unsupported);
792
+ * - `spring(el, keyframes, cfg)` animates with it;
793
+ * - `createSpring()` is an interruptible, velocity-preserving value for
794
+ * gestures (drag, inertia, snap).
795
+ */
796
+ interface SpringConfig {
797
+ /** Spring stiffness (default 170). Higher = faster, snappier. */
798
+ stiffness?: number;
799
+ /** Damping / friction (default 26). Lower = more bounces. */
800
+ damping?: number;
801
+ /** Mass (default 1). Higher = slower, heavier. */
802
+ mass?: number;
803
+ /** Initial velocity in progress units per second (default 0). */
804
+ velocity?: number;
805
+ /** Rest threshold (default 0.001). */
806
+ precision?: number;
807
+ }
808
+ type SpringPreset = 'default' | 'gentle' | 'wobbly' | 'stiff' | 'bouncy' | 'slow' | 'molasses';
809
+ declare const SPRING_PRESETS: Record<SpringPreset, Required<Pick<SpringConfig, 'stiffness' | 'damping' | 'mass'>>>;
810
+ type SpringInput = SpringPreset | SpringConfig | string | undefined;
811
+ /** Resolve a preset name or a partial config to a full config. */
812
+ declare function resolveSpring(input?: SpringInput): Required<SpringConfig>;
813
+ /** One integration step (semi-implicit Euler) towards `to`. Returns [x, v]. */
814
+ declare function stepSpring(cfg: Required<SpringConfig>, x: number, v: number, to: number, dt: number): [number, number];
815
+ /**
816
+ * Sample the spring from 0 to 1 at `fps` (default 60). `values` may exceed 1
817
+ * (overshoot); `duration` is the time to rest, in ms (max 10 s).
818
+ */
819
+ declare function springSamples(input?: SpringInput, fps?: number): {
820
+ values: number[];
821
+ duration: number;
822
+ };
823
+ /** `true` when CSS `linear()` easing is supported. */
824
+ declare function supportsLinearEasing(): boolean;
825
+ /**
826
+ * The spring as `{ easing, duration }` for `el.animate()` / CSS. `easing` is
827
+ * a `linear(…)` function with at most `points` stops (default 48), or a
828
+ * cubic-bezier overshoot where `linear()` is unsupported.
829
+ */
830
+ declare function springEasing(input?: SpringInput, points?: number): {
831
+ easing: string;
832
+ duration: number;
833
+ };
834
+ /** Build a CSS `linear()` easing from samples (down-sampled to `points`). */
835
+ declare function linearEasing(values: number[], points?: number): string;
836
+ /**
837
+ * Animate `el` between keyframes with spring timing (WAAPI). Under reduced
838
+ * motion the final frame is applied immediately. Returns the Animation (or
839
+ * `null` without WAAPI / under reduced motion).
840
+ */
841
+ declare function spring(el: Element, keyframes: Keyframe[], input?: SpringInput, options?: KeyframeAnimationOptions): Animation | null;
842
+ interface SpringValueOptions {
843
+ /** Start value (default 0). */
844
+ value?: number;
845
+ /** Spring config or preset (default `'default'`). */
846
+ spring?: SpringInput;
847
+ /** Called with the value every frame (and on `jump()`). */
848
+ onUpdate?: (value: number, velocity: number) => void;
849
+ /** Called when the value comes to rest at its target. */
850
+ onRest?: (value: number) => void;
851
+ }
852
+ interface SpringValue {
853
+ readonly value: number;
854
+ /** Units per second. */
855
+ readonly velocity: number;
856
+ readonly target: number;
857
+ readonly animating: boolean;
858
+ /** Animate to `target`, optionally with a new initial velocity (units/s). */
859
+ set(target: number, velocity?: number): void;
860
+ /** Jump to `value` with no animation. */
861
+ jump(value: number): void;
862
+ /** Stop where it is. */
863
+ stop(): void;
864
+ /** Change the spring config. */
865
+ configure(spring: SpringInput): void;
866
+ }
867
+ /**
868
+ * An interruptible spring-animated number: call `set()` as often as you like,
869
+ * the motion keeps its velocity (like iOS / Framer springs). Reduced motion
870
+ * jumps straight to the target.
871
+ */
872
+ declare function createSpring(opts?: SpringValueOptions): SpringValue;
873
+ /**
874
+ * Where a flick at `velocity` (units/s) comes to rest with exponential
875
+ * decay: `value + velocity · timeConstant` (default 0.325 s, iOS-like).
876
+ */
877
+ declare function projectInertia(value: number, velocity: number, timeConstant?: number): number;
878
+ /** Snap to a grid (`number`) or the nearest of a list of points. */
879
+ declare function snapTo(value: number, to: number | number[] | null | undefined): number;
880
+ /** iOS-style rubber-band resistance: how far content moves when pulled `distance` past an edge. */
881
+ declare function rubberBand(distance: number, dimension: number, constant?: number): number;
882
+
883
+ /**
884
+ * use-scroll-animate/components/physics — spring & bounce physics (v2.3).
885
+ * `<usa-spring>` (bounce-in, pop, drop, jelly, rubber-band), `<usa-draggable>`
886
+ * (spring-back, inertia, snap) and `<usa-overscroll>` (elastic edges), plus
887
+ * the spring core: `spring()`, `springEasing()`, `createSpring()`,
888
+ * `SPRING_PRESETS`, `projectInertia()`, `snapTo()`, `rubberBand()`.
889
+ */
890
+
891
+ /** Register every component of this category under its default tag. */
892
+ declare function definePhysicsComponents(): void;
893
+ declare global {
894
+ interface HTMLElementTagNameMap {
895
+ 'usa-spring': UsaSpringElement;
896
+ 'usa-draggable': UsaDraggableElement;
897
+ 'usa-overscroll': UsaOverscrollElement;
898
+ }
899
+ }
900
+
901
+ declare const CARD_EFFECTS: readonly ["flip", "holo", "glass", "border-glow", "conic-border", "lift", "spotlight", "sheen", "parallax-layers", "expand"];
902
+ type CardEffect = (typeof CARD_EFFECTS)[number];
903
+ /**
904
+ * `<usa-card>` — card effects, combinable: `effect="lift sheen"`.
905
+ *
906
+ * - `flip` — front/back (`[data-front]` / `[data-back]` children) flip on
907
+ * hover or `trigger="click"`, `axis="y"` (default, horizontal flip) or `x`.
908
+ * - `holo` — holographic foil that shifts with the pointer.
909
+ * - `glass` — frosted glass surface (backdrop blur).
910
+ * - `border-glow` — a glow on the border that follows the pointer.
911
+ * - `conic-border` — a rotating conic-gradient border.
912
+ * - `lift` — rises with a deeper shadow and a slight pointer tilt.
913
+ * - `spotlight` — a soft light that follows the pointer.
914
+ * - `sheen` — a light sweep across the card on hover / focus.
915
+ * - `parallax-layers` — children with `data-depth="0.2…1"` move at different depths.
916
+ * - `expand` — click to grow into a full detail view (`[data-detail]`
917
+ * content is shown), FLIP + spring; Esc, `[data-close]` or the backdrop closes.
918
+ *
919
+ * Attributes: `effect`, `axis`, `trigger`, `depth` (parallax px, 16),
920
+ * `color` (glow / spotlight colour), `flipped`, `expanded`, `disabled`.
921
+ * CSS variables: `--usa-card-x/-y` (pointer %, 0–100), `--usa-card-nx/-ny` (−1…1).
922
+ * Methods: `flip(force?)`, `expand()`, `collapse()`. Events: `usa:flip`,
923
+ * `usa:expand`, `usa:collapse`. Reduced motion: no tilt / parallax / sweep;
924
+ * flips and expansions cross-fade.
925
+ */
926
+ interface UsaCardElement extends UsaElement {
927
+ readonly effects: string[];
928
+ flipped: boolean;
929
+ readonly expanded: boolean;
930
+ flip(force?: boolean): void;
931
+ expand(): Promise<void>;
932
+ collapse(): Promise<void>;
933
+ }
934
+ declare function defineCard(tag?: string): CustomElementConstructor | undefined;
935
+
936
+ /**
937
+ * `<usa-card-stack>` — a deck of cards (its element children). The top card
938
+ * can be swiped away left or right (pointer, touch or arrow keys); the rest
939
+ * fan out behind it and move up with a spring.
940
+ *
941
+ * Attributes: `threshold` (px to dismiss, 90), `visible` (cards fanned
942
+ * behind, 3), `offset` (px between cards, 10), `loop` (swiped cards go back
943
+ * to the bottom), `disabled`. Methods: `swipe(direction)`, `top`. Events:
944
+ * `usa:swipe` (`{ direction: 'left' | 'right', card }`), `usa:empty`.
945
+ * Reduced motion: cards are removed instantly, no rotation.
946
+ */
947
+ interface UsaCardStackElement extends UsaElement {
948
+ readonly top: HTMLElement | null;
949
+ swipe(direction: 'left' | 'right'): Promise<void>;
950
+ }
951
+ declare function defineCardStack(tag?: string): CustomElementConstructor | undefined;
952
+
953
+ /**
954
+ * `<usa-sticky-stack>` — cards (element children) stick to the top while
955
+ * scrolling and the ones underneath scale down and dim as the next card
956
+ * slides over them, like a deck building up.
957
+ *
958
+ * Attributes: `top` (px from the viewport top, 80), `gap` (px each card
959
+ * peeks below the previous, 16), `scale` (how much a covered card shrinks,
960
+ * 0.06). Reduced motion: cards still stack (sticky) but do not scale.
961
+ */
962
+ interface UsaStickyStackElement extends UsaElement {
963
+ update(): void;
964
+ }
965
+ declare function defineStickyStack(tag?: string): CustomElementConstructor | undefined;
966
+
967
+ /**
968
+ * `<usa-carousel-3d>` — its element children on a 3D ring. Rotate with the
969
+ * arrow keys, a drag/swipe, the wheel (shift) or `next()` / `prev()`; the
970
+ * front item is `aria-current`. Spring-driven rotation.
971
+ *
972
+ * Attributes: `radius` (px, auto from item width), `autoplay` (ms between
973
+ * steps, pauses on hover/focus), `perspective` (px, 1200), `index`.
974
+ * Events: `usa:change` (`{ index }`). Reduced motion: a flat, instant
975
+ * switch (only the current item is shown, others dimmed).
976
+ */
977
+ interface UsaCarousel3dElement extends UsaElement {
978
+ index: number;
979
+ next(): void;
980
+ prev(): void;
981
+ goTo(i: number): void;
982
+ }
983
+ declare function defineCarousel3d(tag?: string): CustomElementConstructor | undefined;
984
+
985
+ /**
986
+ * use-scroll-animate/components/cards — card effects (v2.4).
987
+ * `<usa-card effect="flip | holo | glass | border-glow | conic-border | lift |
988
+ * spotlight | sheen | parallax-layers | expand">` (combinable),
989
+ * `<usa-card-stack>` (swipeable deck), `<usa-sticky-stack>` (stacking on
990
+ * scroll) and `<usa-carousel-3d>`.
991
+ */
992
+
993
+ /** Register every component of this category under its default tag. */
994
+ declare function defineCardComponents(): void;
995
+ declare global {
996
+ interface HTMLElementTagNameMap {
997
+ 'usa-card': UsaCardElement;
998
+ 'usa-card-stack': UsaCardStackElement;
999
+ 'usa-sticky-stack': UsaStickyStackElement;
1000
+ 'usa-carousel-3d': UsaCarousel3dElement;
1001
+ }
1002
+ }
1003
+
724
1004
  /** The component categories and their default tags. */
725
1005
  declare const COMPONENT_CATEGORIES: {
726
1006
  readonly reveal: readonly ["usa-reveal", "usa-stagger", "usa-scroll-progress", "usa-scrolly"];
@@ -729,6 +1009,8 @@ declare const COMPONENT_CATEGORIES: {
729
1009
  readonly feedback: readonly ["usa-spinner", "usa-skeleton", "usa-progress", "usa-toaster", "usa-check"];
730
1010
  readonly background: readonly ["usa-aurora", "usa-particles", "usa-grain", "usa-marquee", "usa-acrylic"];
731
1011
  readonly transitions: readonly ["usa-dialog", "usa-accordion", "usa-flip-list", "usa-view-switch"];
1012
+ readonly physics: readonly ["usa-spring", "usa-draggable", "usa-overscroll"];
1013
+ readonly cards: readonly ["usa-card", "usa-card-stack", "usa-sticky-stack", "usa-carousel-3d"];
732
1014
  };
733
1015
  type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;
734
1016
  /**
@@ -737,5 +1019,5 @@ type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;
737
1019
  */
738
1020
  declare function defineComponents(categories?: ComponentCategory[]): void;
739
1021
 
740
- export { COMPONENT_CATEGORIES, REVEAL_EFFECTS, SPINNER_VARIANTS, configureComponents, connectedAnimation, defineAccordion, defineAcrylic, defineAurora, defineBackgroundComponents, defineCheck, defineComponents, defineCounter, defineDialog, defineFeedbackComponents, defineFlipList, defineGrain, defineInteractionComponents, defineMagnetic, defineMarquee, defineParticles, definePress, defineProgress, defineReveal, defineRevealComponents, defineRipple, defineScramble, defineScrollProgress, defineScrolly, defineShimmerText, defineSkeleton, defineSpinner, defineSplitText, defineSpotlight, defineStagger, defineTextComponents, defineTextRotate, defineTilt, defineToaster, defineToggle, defineTransitionComponents, defineTypewriter, defineViewSwitch, easeOutExpo, flip, prefersReducedMotion, readScrollProgress, revealKeyframes, scrambleFrame, toast, viewTransition };
741
- export type { ComponentCategory, ComponentsConfig, ConnectedOptions, DialogVariant, FlipOptions, RevealEffect, SpinnerVariant, ToastHandle, ToastOptions, ToastType, UsaAccordionElement, UsaAcrylicElement, UsaAuroraElement, UsaCheckElement, UsaCounterElement, UsaDialogElement, UsaElement, UsaFlipListElement, UsaGrainElement, UsaMagneticElement, UsaMarqueeElement, UsaParticlesElement, UsaPressElement, UsaProgressElement, UsaRevealElement, UsaRippleElement, UsaScrambleElement, UsaScrollProgressElement, UsaScrollyElement, UsaShimmerTextElement, UsaSkeletonElement, UsaSpinnerElement, UsaSplitTextElement, UsaSpotlightElement, UsaStaggerElement, UsaTextRotateElement, UsaTiltElement, UsaToasterElement, UsaToggleElement, UsaTypewriterElement, UsaViewSwitchElement, ViewTransitionOptions };
1022
+ export { CARD_EFFECTS, COMPONENT_CATEGORIES, REVEAL_EFFECTS, SPINNER_VARIANTS, SPRING_EFFECTS, SPRING_PRESETS, configureComponents, connectedAnimation, createSpring, defineAccordion, defineAcrylic, defineAurora, defineBackgroundComponents, defineCard, defineCardComponents, defineCardStack, defineCarousel3d, defineCheck, defineComponents, defineCounter, defineDialog, defineDraggable, defineFeedbackComponents, defineFlipList, defineGrain, defineInteractionComponents, 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, linearEasing, prefersReducedMotion, projectInertia, readScrollProgress, resolveSpring, revealKeyframes, rubberBand, scrambleFrame, snapTo, spring, springEasing, springEffectKeyframes, springSamples, stepSpring, supportsLinearEasing, toast, viewTransition };
1023
+ export type { CardEffect, ComponentCategory, ComponentsConfig, ConnectedOptions, DialogVariant, FlipOptions, RevealEffect, SpinnerVariant, SpringConfig, SpringEffect, SpringInput, SpringPreset, SpringValue, SpringValueOptions, ToastHandle, ToastOptions, ToastType, UsaAccordionElement, UsaAcrylicElement, UsaAuroraElement, UsaCardElement, UsaCardStackElement, UsaCarousel3dElement, UsaCheckElement, UsaCounterElement, UsaDialogElement, UsaDraggableElement, UsaElement, UsaFlipListElement, UsaGrainElement, 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 };
@@ -10,7 +10,12 @@ import { defineBackgroundComponents } from './components/background.js';
10
10
  export { defineAcrylic, defineAurora, defineGrain, defineMarquee, defineParticles } from './components/background.js';
11
11
  import { defineTransitionComponents } from './components/transitions.js';
12
12
  export { connectedAnimation, defineAccordion, defineDialog, defineFlipList, defineViewSwitch, flip, viewTransition } from './components/transitions.js';
13
- export { c as configureComponents, p as prefersReducedMotion } from './chunks/base-CFtnmfli.js';
13
+ import { definePhysicsComponents } from './components/physics.js';
14
+ export { SPRING_EFFECTS, defineDraggable, defineOverscroll, defineSpring, springEffectKeyframes } from './components/physics.js';
15
+ import { defineCardComponents } from './components/cards.js';
16
+ export { CARD_EFFECTS, defineCard, defineCardStack, defineCarousel3d, defineStickyStack } from './components/cards.js';
17
+ 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-BKUU7-Xm.js';
18
+ export { c as configureComponents, p as prefersReducedMotion } from './chunks/base-CuvCgqLy.js';
14
19
 
15
20
  /**
16
21
  * use-scroll-animate/components
@@ -40,6 +45,8 @@ const COMPONENT_CATEGORIES = {
40
45
  feedback: ['usa-spinner', 'usa-skeleton', 'usa-progress', 'usa-toaster', 'usa-check'],
41
46
  background: ['usa-aurora', 'usa-particles', 'usa-grain', 'usa-marquee', 'usa-acrylic'],
42
47
  transitions: ['usa-dialog', 'usa-accordion', 'usa-flip-list', 'usa-view-switch'],
48
+ physics: ['usa-spring', 'usa-draggable', 'usa-overscroll'],
49
+ cards: ['usa-card', 'usa-card-stack', 'usa-sticky-stack', 'usa-carousel-3d'],
43
50
  };
44
51
  const BY_CATEGORY = {
45
52
  reveal: defineRevealComponents,
@@ -48,6 +55,8 @@ const BY_CATEGORY = {
48
55
  feedback: defineFeedbackComponents,
49
56
  background: defineBackgroundComponents,
50
57
  transitions: defineTransitionComponents,
58
+ physics: definePhysicsComponents,
59
+ cards: defineCardComponents,
51
60
  };
52
61
  /**
53
62
  * Register every `<usa-*>` component (or only the given categories).
@@ -57,5 +66,5 @@ function defineComponents(categories) {
57
66
  (categories || Object.keys(BY_CATEGORY)).forEach((c) => BY_CATEGORY[c]?.());
58
67
  }
59
68
 
60
- export { COMPONENT_CATEGORIES, defineBackgroundComponents, defineComponents, defineFeedbackComponents, defineInteractionComponents, defineRevealComponents, defineTextComponents, defineTransitionComponents };
69
+ export { COMPONENT_CATEGORIES, defineBackgroundComponents, defineCardComponents, defineComponents, defineFeedbackComponents, defineInteractionComponents, definePhysicsComponents, defineRevealComponents, defineTextComponents, defineTransitionComponents };
61
70
  //# sourceMappingURL=components.js.map
@@ -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';\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';\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} 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};\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":";;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AAeH;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;;AAKlF,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;CACxC;AAED;;;AAGG;AACG,SAAU,gBAAgB,CAAC,UAAgC,EAAA;IAC/D,CAAC,UAAU,IAAK,MAAM,CAAC,IAAI,CAAC,WAAW,CAAyB,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC;AACtG;;;;"}
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';\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';\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} 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};\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":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AAmBH;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;;AAK9E,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;CAC5B;AAED;;;AAGG;AACG,SAAU,gBAAgB,CAAC,UAAgC,EAAA;IAC/D,CAAC,UAAU,IAAK,MAAM,CAAC,IAAI,CAAC,WAAW,CAAyB,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC;AACtG;;;;"}