use-scroll-animate 3.5.0 → 3.7.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 (42) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +2 -1
  3. package/README_ja.md +1 -0
  4. package/README_zh.md +1 -0
  5. package/dist/chunks/{index-tags-uw1Fospg.js → index-tags-BANJ-e4H.js} +2 -1
  6. package/dist/chunks/{index-tags-uw1Fospg.js.map → index-tags-BANJ-e4H.js.map} +1 -1
  7. package/dist/chunks/{index-tags-CLFrjVR7.cjs → index-tags-wbuPiMR6.cjs} +2 -1
  8. package/dist/chunks/{index-tags-CLFrjVR7.cjs.map → index-tags-wbuPiMR6.cjs.map} +1 -1
  9. package/dist/components/jsx.d.cts +1 -0
  10. package/dist/components/jsx.d.ts +1 -0
  11. package/dist/components/layout.cjs +259 -0
  12. package/dist/components/layout.cjs.map +1 -0
  13. package/dist/components/layout.css +3 -0
  14. package/dist/components/layout.d.cts +134 -0
  15. package/dist/components/layout.d.ts +134 -0
  16. package/dist/components/layout.js +250 -0
  17. package/dist/components/layout.js.map +1 -0
  18. package/dist/components/lazy.cjs +2 -1
  19. package/dist/components/lazy.cjs.map +1 -1
  20. package/dist/components/lazy.d.cts +1 -0
  21. package/dist/components/lazy.d.ts +1 -0
  22. package/dist/components/lazy.js +2 -1
  23. package/dist/components/lazy.js.map +1 -1
  24. package/dist/components/react.cjs +1 -1
  25. package/dist/components/react.js +1 -1
  26. package/dist/components/vue.cjs +2 -1
  27. package/dist/components/vue.cjs.map +1 -1
  28. package/dist/components/vue.d.cts +35 -0
  29. package/dist/components/vue.d.ts +35 -0
  30. package/dist/components/vue.js +2 -1
  31. package/dist/components/vue.js.map +1 -1
  32. package/dist/components.cjs +10 -1
  33. package/dist/components.cjs.map +1 -1
  34. package/dist/components.css +1 -0
  35. package/dist/components.d.cts +90 -2
  36. package/dist/components.d.ts +90 -2
  37. package/dist/components.js +5 -2
  38. package/dist/components.js.map +1 -1
  39. package/dist/components.umd.js +2 -2
  40. package/dist/components.umd.js.map +1 -1
  41. package/docs/components.md +14 -0
  42. package/package.json +13 -2
package/CHANGELOG.md CHANGED
@@ -7,6 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [3.7.0] - 2026-10-07
11
+
12
+ ### Added
13
+ - **Visual playground** — [`showcase/playground.html`](./showcase/playground.html) (no build, dogfoods `dist/components.js` with a CDN fallback):
14
+ - **Compose**: stack effect layers around a card, button, heading or image — scroll reveal, 3D tilt, magnetic, spring, mask reveal, depth, swipeable, click ripple, shader background, glitch and gradient text — and reorder or remove them.
15
+ - **Tweak**: every attribute has a live control (selects, sliders, toggles); the preview re-renders instantly, with a Replay button.
16
+ - **Export**: HTML (CDN, no build), ES module (per-category imports with the right `define*Components()`), React (JSX via `components/jsx` types) and Vue (`isCustomElement` hint) code, copy to clipboard.
17
+ - **Share**: the composition is encoded in the URL hash (`encodeState()` / `decodeState()`), so a link reproduces it.
18
+ - English / 中文, keyboard accessible controls, honours `prefers-reduced-motion` (shows a notice; effects render their final state).
19
+ - Pure, tested playground core in `showcase/playground-core.js` (`PLAYGROUND_EFFECTS`, `composeMarkup()`, `playgroundSnippets()`); the component gallery links to the playground.
20
+
21
+ ## [3.6.0] - 2026-10-07
22
+
23
+ ### Added
24
+ - **Layout animation** — new category `use-scroll-animate/components/layout`:
25
+ - `autoAnimate(parent, { duration, easing, scale })` and `<usa-auto-animate>` — zero-config list / grid reflow: added children fade-scale in, removed children fade out in place (as positioned ghosts), moved or resized ones glide with FLIP (sort, filter, insert, container resize); `enable()` / `disable()` / `stop()`.
26
+ - `<usa-masonry>` — masonry grid (`columns` or `min` column width, `gap`): shortest-column placement, items glide when the width, the set of items or their sizes change (ResizeObserver); CSS multi-column before JS runs.
27
+ - `sharedTransition(update, root?, opts)` — shared-element transitions: elements with the same `data-shared="id"` before and after `update()` morph into each other via the View Transitions API (`view-transition-name` assigned per id) with a FLIP fallback.
28
+ - Pure helpers `flipFrames()`, `masonryLayout()`.
29
+ - Reduced motion: layout changes apply instantly, masonry does not glide, shared transitions just run `update()`.
30
+ - Showcase: new **Layout animation** gallery category (interactive add / shuffle / remove, masonry, shared-element thumbnails → detail).
31
+
10
32
  ## [3.5.0] - 2026-10-07
11
33
 
12
34
  ### Added
package/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  [English](./README.md) | [简体中文](./README_zh.md) | [日本語](./README_ja.md)
12
12
 
13
- **[✨ Live showcase — every effect, live, with copy-paste code](https://harrisoncn.github.io/use-scroll-animate/)** · **[🧩 Component gallery](https://harrisoncn.github.io/use-scroll-animate/showcase/components.html)**
13
+ **[✨ Live showcase — every effect, live, with copy-paste code](https://harrisoncn.github.io/use-scroll-animate/)** · **[🧩 Component gallery](https://harrisoncn.github.io/use-scroll-animate/showcase/components.html)** · **[🎛 Playground](https://harrisoncn.github.io/use-scroll-animate/showcase/playground.html)**
14
14
 
15
15
  </div>
16
16
 
@@ -60,6 +60,7 @@ defineComponents(); // or per category: import { defineTextComponents } from 'us
60
60
  | **SVG** (`/components/svg`) | `<usa-draw>` (line drawing) · `<usa-morph>` (path morph) · `<usa-mask-reveal>` · `<usa-anim-icon>` · `morphTo()` · `interpolatePath()` |
61
61
  | **Canvas & WebGL** (`/components/webgl`) | `<usa-shader>` (gradient · plasma · waves · aurora · custom GLSL) · `<usa-distort>` · `<usa-liquid>` · `glQuad()` — graceful fallback |
62
62
  | **3D & depth** (`/components/depth`) | `<usa-cube>` · `<usa-depth>` (pointer · gyroscope · scroll depth parallax) · `deviceTilt()` · (+ `<usa-carousel-3d>` in cards) |
63
+ | **Layout animation** (`/components/layout`) | `<usa-auto-animate>` / `autoAnimate()` (list & grid reflow) · `<usa-masonry>` · `sharedTransition()` (shared elements) |
63
64
 
64
65
  Whole bundle ≈ 22 kB gzip (JS + CSS); one category 3.5–6.4 kB; a single component ≈ 2 kB. The scroll-animation core below is unaffected.
65
66
 
package/README_ja.md CHANGED
@@ -50,6 +50,7 @@ defineComponents(); // カテゴリ単位: import { defineTextComponents } from
50
50
  | **SVG** (`/components/svg`) | `<usa-draw>`(線描画)· `<usa-morph>`(パスモーフ)· `<usa-mask-reveal>` · `<usa-anim-icon>` · `morphTo()` |
51
51
  | **Canvas / WebGL** (`/components/webgl`) | `<usa-shader>`(gradient · plasma · waves · aurora · カスタム GLSL)· `<usa-distort>` · `<usa-liquid>` · `glQuad()` |
52
52
  | **3D / 奥行き** (`/components/depth`) | `<usa-cube>` · `<usa-depth>`(ポインター · ジャイロ · スクロール視差)· `deviceTilt()` |
53
+ | **レイアウト** (`/components/layout`) | `<usa-auto-animate>` / `autoAnimate()` · `<usa-masonry>` · `sharedTransition()`(共有要素) |
53
54
 
54
55
  ## ドキュメント
55
56
 
package/README_zh.md CHANGED
@@ -59,6 +59,7 @@ defineComponents(); // 或按分类:import { defineTextComponents } from 'use-
59
59
  | **SVG 动画** (`/components/svg`) | `<usa-draw>`(线条描绘)· `<usa-morph>`(路径变形)· `<usa-mask-reveal>` · `<usa-anim-icon>` · `morphTo()` · `interpolatePath()` |
60
60
  | **Canvas 与 WebGL** (`/components/webgl`) | `<usa-shader>`(gradient · plasma · waves · aurora · 自定义 GLSL)· `<usa-distort>` · `<usa-liquid>` · `glQuad()` —— 优雅降级 |
61
61
  | **3D 与景深** (`/components/depth`) | `<usa-cube>` · `<usa-depth>`(指针 · 陀螺仪 · 滚动景深视差)· `deviceTilt()` ·(另见 cards 中的 `<usa-carousel-3d>`) |
62
+ | **布局动画** (`/components/layout`) | `<usa-auto-animate>` / `autoAnimate()`(列表与网格重排)· `<usa-masonry>`(瀑布流)· `sharedTransition()`(共享元素) |
62
63
 
63
64
  完整包约 22 kB gzip(JS + CSS);单个分类 3.5–6.4 kB;单个组件约 2 kB。下方的滚动动画核心不受影响。
64
65
 
@@ -17,7 +17,8 @@ const COMPONENT_CATEGORIES = {
17
17
  svg: ['usa-draw', 'usa-morph', 'usa-mask-reveal', 'usa-anim-icon'],
18
18
  webgl: ['usa-shader', 'usa-distort', 'usa-liquid'],
19
19
  depth: ['usa-cube', 'usa-depth'],
20
+ layout: ['usa-auto-animate', 'usa-masonry'],
20
21
  };
21
22
 
22
23
  export { COMPONENT_CATEGORIES as C };
23
- //# sourceMappingURL=index-tags-uw1Fospg.js.map
24
+ //# sourceMappingURL=index-tags-BANJ-e4H.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-tags-uw1Fospg.js","sources":["../../src/components/index-tags.ts"],"sourcesContent":["// The component categories and their default tags (no imports: safe for lazy loaders).\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', 'usa-wave-text', 'usa-glitch', 'usa-gradient-text', 'usa-handwriting', 'usa-scroll-highlight'],\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', 'usa-grid-glow', 'usa-blobs', 'usa-water-ripple', 'usa-dot-network'],\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 page: ['usa-cursor', 'usa-fullpage', 'usa-loading-bar', 'usa-back-to-top', 'usa-ambient', 'usa-splash', 'usa-auto-skeleton', 'usa-motion-switch'],\n timeline: ['usa-timeline'],\n gesture: ['usa-swipeable', 'usa-pinch-zoom'],\n svg: ['usa-draw', 'usa-morph', 'usa-mask-reveal', 'usa-anim-icon'],\n webgl: ['usa-shader', 'usa-distort', 'usa-liquid'],\n depth: ['usa-cube', 'usa-depth'],\n} as const;\n\nexport type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;\n"],"names":[],"mappings":"AAAA;AACA;AACO,MAAM,oBAAoB,GAAG;IAClC,MAAM,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,qBAAqB,EAAE,aAAa,CAAC;IAC3E,IAAI,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,sBAAsB,CAAC;AAC/M,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;AACrF,IAAA,UAAU,EAAE,CAAC,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,WAAW,EAAE,kBAAkB,EAAE,iBAAiB,CAAC;IAC3J,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;AAC1L,IAAA,IAAI,EAAE,CAAC,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,aAAa,EAAE,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,CAAC;IACjJ,QAAQ,EAAE,CAAC,cAAc,CAAC;AAC1B,IAAA,OAAO,EAAE,CAAC,eAAe,EAAE,gBAAgB,CAAC;IAC5C,GAAG,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,eAAe,CAAC;AAClE,IAAA,KAAK,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,YAAY,CAAC;AAClD,IAAA,KAAK,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC;;;;;"}
1
+ {"version":3,"file":"index-tags-BANJ-e4H.js","sources":["../../src/components/index-tags.ts"],"sourcesContent":["// The component categories and their default tags (no imports: safe for lazy loaders).\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', 'usa-wave-text', 'usa-glitch', 'usa-gradient-text', 'usa-handwriting', 'usa-scroll-highlight'],\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', 'usa-grid-glow', 'usa-blobs', 'usa-water-ripple', 'usa-dot-network'],\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 page: ['usa-cursor', 'usa-fullpage', 'usa-loading-bar', 'usa-back-to-top', 'usa-ambient', 'usa-splash', 'usa-auto-skeleton', 'usa-motion-switch'],\n timeline: ['usa-timeline'],\n gesture: ['usa-swipeable', 'usa-pinch-zoom'],\n svg: ['usa-draw', 'usa-morph', 'usa-mask-reveal', 'usa-anim-icon'],\n webgl: ['usa-shader', 'usa-distort', 'usa-liquid'],\n depth: ['usa-cube', 'usa-depth'],\n layout: ['usa-auto-animate', 'usa-masonry'],\n} as const;\n\nexport type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;\n"],"names":[],"mappings":"AAAA;AACA;AACO,MAAM,oBAAoB,GAAG;IAClC,MAAM,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,qBAAqB,EAAE,aAAa,CAAC;IAC3E,IAAI,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,sBAAsB,CAAC;AAC/M,IAAA,WAAW,EAAE,CAAC,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,eAAe,EAAE,WAAW,EAAE,YAAY,CAAC;IACnG,QAAQ,EAAE,CAAC,aAAa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@ const COMPONENT_CATEGORIES = {
19
19
  svg: ['usa-draw', 'usa-morph', 'usa-mask-reveal', 'usa-anim-icon'],
20
20
  webgl: ['usa-shader', 'usa-distort', 'usa-liquid'],
21
21
  depth: ['usa-cube', 'usa-depth'],
22
+ layout: ['usa-auto-animate', 'usa-masonry'],
22
23
  };
23
24
 
24
25
  exports.COMPONENT_CATEGORIES = COMPONENT_CATEGORIES;
25
- //# sourceMappingURL=index-tags-CLFrjVR7.cjs.map
26
+ //# sourceMappingURL=index-tags-wbuPiMR6.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-tags-CLFrjVR7.cjs","sources":["../../src/components/index-tags.ts"],"sourcesContent":["// The component categories and their default tags (no imports: safe for lazy loaders).\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', 'usa-wave-text', 'usa-glitch', 'usa-gradient-text', 'usa-handwriting', 'usa-scroll-highlight'],\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', 'usa-grid-glow', 'usa-blobs', 'usa-water-ripple', 'usa-dot-network'],\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 page: ['usa-cursor', 'usa-fullpage', 'usa-loading-bar', 'usa-back-to-top', 'usa-ambient', 'usa-splash', 'usa-auto-skeleton', 'usa-motion-switch'],\n timeline: ['usa-timeline'],\n gesture: ['usa-swipeable', 'usa-pinch-zoom'],\n svg: ['usa-draw', 'usa-morph', 'usa-mask-reveal', 'usa-anim-icon'],\n webgl: ['usa-shader', 'usa-distort', 'usa-liquid'],\n depth: ['usa-cube', 'usa-depth'],\n} as const;\n\nexport type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;\n"],"names":[],"mappings":";;AAAA;AACA;AACO,MAAM,oBAAoB,GAAG;IAClC,MAAM,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,qBAAqB,EAAE,aAAa,CAAC;IAC3E,IAAI,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,sBAAsB,CAAC;AAC/M,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;AACrF,IAAA,UAAU,EAAE,CAAC,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,WAAW,EAAE,kBAAkB,EAAE,iBAAiB,CAAC;IAC3J,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;AAC1L,IAAA,IAAI,EAAE,CAAC,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,aAAa,EAAE,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,CAAC;IACjJ,QAAQ,EAAE,CAAC,cAAc,CAAC;AAC1B,IAAA,OAAO,EAAE,CAAC,eAAe,EAAE,gBAAgB,CAAC;IAC5C,GAAG,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,eAAe,CAAC;AAClE,IAAA,KAAK,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,YAAY,CAAC;AAClD,IAAA,KAAK,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC;;;;;"}
1
+ {"version":3,"file":"index-tags-wbuPiMR6.cjs","sources":["../../src/components/index-tags.ts"],"sourcesContent":["// The component categories and their default tags (no imports: safe for lazy loaders).\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', 'usa-wave-text', 'usa-glitch', 'usa-gradient-text', 'usa-handwriting', 'usa-scroll-highlight'],\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', 'usa-grid-glow', 'usa-blobs', 'usa-water-ripple', 'usa-dot-network'],\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 page: ['usa-cursor', 'usa-fullpage', 'usa-loading-bar', 'usa-back-to-top', 'usa-ambient', 'usa-splash', 'usa-auto-skeleton', 'usa-motion-switch'],\n timeline: ['usa-timeline'],\n gesture: ['usa-swipeable', 'usa-pinch-zoom'],\n svg: ['usa-draw', 'usa-morph', 'usa-mask-reveal', 'usa-anim-icon'],\n webgl: ['usa-shader', 'usa-distort', 'usa-liquid'],\n depth: ['usa-cube', 'usa-depth'],\n layout: ['usa-auto-animate', 'usa-masonry'],\n} as const;\n\nexport type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;\n"],"names":[],"mappings":";;AAAA;AACA;AACO,MAAM,oBAAoB,GAAG;IAClC,MAAM,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,qBAAqB,EAAE,aAAa,CAAC;IAC3E,IAAI,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,sBAAsB,CAAC;AAC/M,IAAA,WAAW,EAAE,CAAC,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,eA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EAAE,CAAC,kBAAkB,EAAE,aAAa,CAAC;;;;;"}
@@ -16,6 +16,7 @@ declare const COMPONENT_CATEGORIES: {
16
16
  readonly svg: readonly ["usa-draw", "usa-morph", "usa-mask-reveal", "usa-anim-icon"];
17
17
  readonly webgl: readonly ["usa-shader", "usa-distort", "usa-liquid"];
18
18
  readonly depth: readonly ["usa-cube", "usa-depth"];
19
+ readonly layout: readonly ["usa-auto-animate", "usa-masonry"];
19
20
  };
20
21
 
21
22
  /**
@@ -16,6 +16,7 @@ declare const COMPONENT_CATEGORIES: {
16
16
  readonly svg: readonly ["usa-draw", "usa-morph", "usa-mask-reveal", "usa-anim-icon"];
17
17
  readonly webgl: readonly ["usa-shader", "usa-distort", "usa-liquid"];
18
18
  readonly depth: readonly ["usa-cube", "usa-depth"];
19
+ readonly layout: readonly ["usa-auto-animate", "usa-masonry"];
19
20
  };
20
21
 
21
22
  /**
@@ -0,0 +1,259 @@
1
+ 'use strict';
2
+
3
+ var base = require('../chunks/base-CXx7jZ-o.cjs');
4
+
5
+ /** FLIP keyframes from a previous box to the current one (pure). */
6
+ function flipFrames(from, to, scale = true) {
7
+ const dx = from.left - to.left;
8
+ const dy = from.top - to.top;
9
+ const sx = scale && to.width ? from.width / to.width : 1;
10
+ const sy = scale && to.height ? from.height / to.height : 1;
11
+ return [
12
+ { transformOrigin: '0 0', transform: `translate(${dx}px, ${dy}px) scale(${sx}, ${sy})` },
13
+ { transformOrigin: '0 0', transform: 'none' },
14
+ ];
15
+ }
16
+ /**
17
+ * Auto-animate a container: children that are added fade / scale in, removed
18
+ * ones fade out in place, and moved ones (re-sort, filter, reflow, resize)
19
+ * glide to their new spot — no extra code at the call site. Returns
20
+ * `{ disable, enable, stop }`. Reduced motion: changes apply instantly.
21
+ *
22
+ * @example
23
+ * const ctl = autoAnimate(document.querySelector('ul'));
24
+ * list.append(item); // animates
25
+ */
26
+ function autoAnimate(parent, o = {}) {
27
+ let on = true;
28
+ const boxes = new WeakMap();
29
+ const rel = (el) => {
30
+ const r = el.getBoundingClientRect();
31
+ const p = parent.getBoundingClientRect();
32
+ return { left: r.left - p.left, top: r.top - p.top, width: r.width, height: r.height };
33
+ };
34
+ const snap = () => Array.from(parent.children).forEach((c) => boxes.set(c, rel(c)));
35
+ const dur = () => (o.duration ?? 300) * base.motionScale();
36
+ const timing = () => ({ duration: dur(), easing: o.easing ?? base.EASE_OUT });
37
+ const animate = (el, frames, t = timing()) => (typeof el.animate === 'function' ? el.animate(frames, t) : null);
38
+ const mo = typeof MutationObserver === 'function'
39
+ ? new MutationObserver((records) => {
40
+ if (!on || base.prefersReducedMotion() || dur() <= 0)
41
+ return snap();
42
+ const added = new Set();
43
+ for (const r of records) {
44
+ r.addedNodes.forEach((n) => n instanceof Element && n.parentElement === parent && added.add(n));
45
+ r.removedNodes.forEach((n) => {
46
+ if (!(n instanceof HTMLElement) || n.isConnected)
47
+ return;
48
+ const b = boxes.get(n);
49
+ if (!b)
50
+ return;
51
+ // put a ghost back at its old place and fade it out
52
+ n.style.position = 'absolute';
53
+ n.style.left = `${b.left}px`;
54
+ n.style.top = `${b.top}px`;
55
+ n.style.width = `${b.width}px`;
56
+ n.style.height = `${b.height}px`;
57
+ n.style.margin = '0';
58
+ n.style.pointerEvents = 'none';
59
+ if (getComputedStyle(parent).position === 'static')
60
+ parent.style.position = 'relative';
61
+ parent.appendChild(n);
62
+ n.__usaGhost = true;
63
+ const a = animate(n, [{ opacity: 1, transform: 'none' }, { opacity: 0, transform: 'scale(0.96)' }]);
64
+ const drop = () => {
65
+ n.remove();
66
+ for (const k of ['position', 'left', 'top', 'width', 'height', 'margin', 'pointerEvents'])
67
+ n.style[k] = '';
68
+ };
69
+ if (a)
70
+ a.finished.then(drop, drop);
71
+ else
72
+ drop();
73
+ });
74
+ }
75
+ Array.from(parent.children).forEach((c) => {
76
+ if (c.__usaGhost)
77
+ return;
78
+ if (added.has(c))
79
+ return void animate(c, [{ opacity: 0, transform: 'scale(0.96)' }, { opacity: 1, transform: 'none' }]);
80
+ const prev = boxes.get(c);
81
+ if (!prev)
82
+ return;
83
+ const now = rel(c);
84
+ if (Math.abs(prev.left - now.left) + Math.abs(prev.top - now.top) + Math.abs(prev.width - now.width) + Math.abs(prev.height - now.height) < 1)
85
+ return;
86
+ animate(c, flipFrames(prev, now, o.scale !== false));
87
+ });
88
+ snap();
89
+ })
90
+ : null;
91
+ mo?.observe(parent, { childList: true });
92
+ const ro = typeof ResizeObserver === 'function' ? new ResizeObserver(() => snap()) : null;
93
+ ro?.observe(parent);
94
+ snap();
95
+ // capture boxes right before any change in the same task (events, timers)
96
+ const capture = () => snap();
97
+ parent.addEventListener('pointerdown', capture, true);
98
+ return {
99
+ enable: () => ((on = true), snap()),
100
+ disable: () => (on = false),
101
+ stop: () => {
102
+ mo?.disconnect();
103
+ ro?.disconnect();
104
+ parent.removeEventListener('pointerdown', capture, true);
105
+ },
106
+ };
107
+ }
108
+ /** Masonry placement: shortest-column-first positions for item heights (pure). */
109
+ function masonryLayout(heights, columns, columnWidth, gap) {
110
+ const cols = Array(Math.max(1, columns)).fill(0);
111
+ const out = heights.map((h) => {
112
+ const c = cols.indexOf(Math.min(...cols));
113
+ const pos = { x: c * (columnWidth + gap), y: cols[c] };
114
+ cols[c] += h + gap;
115
+ return pos;
116
+ });
117
+ out.height = Math.max(0, Math.max(...cols) - gap);
118
+ return out;
119
+ }
120
+ /**
121
+ * Shared-element transition between two states of the page: every element
122
+ * with `data-shared="id"` before `update()` flies to the element with the
123
+ * same id afterwards (size and position), the rest cross-fades. Uses the
124
+ * View Transitions API when present (with `view-transition-name` per id),
125
+ * otherwise a FLIP fallback. Reduced motion: just runs `update()`.
126
+ */
127
+ async function sharedTransition(update, root = document, o = {}) {
128
+ if (base.prefersReducedMotion() || typeof document === 'undefined')
129
+ return void (await update());
130
+ const collect = () => new Map(Array.from(root.querySelectorAll('[data-shared]')).map((el) => [el.dataset.shared, el]));
131
+ const doc = document;
132
+ if (typeof doc.startViewTransition === 'function') {
133
+ const named = (m) => m.forEach((el, id) => (el.style.viewTransitionName = `usa-${id.replace(/[^\w-]/g, '_')}`));
134
+ const clear = (m) => m.forEach((el) => (el.style.viewTransitionName = ''));
135
+ const before = collect();
136
+ named(before);
137
+ let after = new Map();
138
+ const vt = doc.startViewTransition(async () => {
139
+ clear(before);
140
+ await update();
141
+ after = collect();
142
+ named(after);
143
+ });
144
+ await vt.finished.catch(() => undefined);
145
+ clear(after);
146
+ return;
147
+ }
148
+ const before = new Map(Array.from(collect()).map(([id, el]) => [id, el.getBoundingClientRect()]));
149
+ await update();
150
+ const anims = [];
151
+ collect().forEach((el, id) => {
152
+ const a = before.get(id);
153
+ if (!a || typeof el.animate !== 'function')
154
+ return;
155
+ const b = el.getBoundingClientRect();
156
+ if (!b.width || !b.height)
157
+ return;
158
+ anims.push(el.animate(flipFrames(a, b), { duration: (o.duration ?? 450) * base.motionScale(), easing: o.easing ?? base.EASE_OUT }).finished.catch(() => undefined));
159
+ });
160
+ await Promise.all(anims);
161
+ }
162
+
163
+ var css = "usa-auto-animate{display:block}usa-masonry{display:block;column-width:220px;column-gap:16px}usa-masonry>*{break-inside:avoid;margin-bottom:16px}usa-masonry[data-js]{position:relative;columns:auto}usa-masonry[data-js]>*{position:absolute;left:0;top:0;margin:0;box-sizing:border-box;transition:transform 0.45s cubic-bezier(0.22,1,0.36,1)}@media (prefers-reduced-motion:reduce){usa-masonry[data-js]>*{transition:none}}";
164
+
165
+ function defineAutoAnimate(tag = 'usa-auto-animate') {
166
+ return base.defineElement(tag, (Base) => class UsaAutoAnimate extends Base {
167
+ constructor() {
168
+ super(...arguments);
169
+ this._c = null;
170
+ }
171
+ enable() {
172
+ this._c?.enable();
173
+ }
174
+ disable() {
175
+ this._c?.disable();
176
+ }
177
+ mount() {
178
+ const c = (this._c = autoAnimate(this, { duration: this.num('duration', 300), scale: !this.flag('no-scale') }));
179
+ this.onCleanup(() => c.stop());
180
+ }
181
+ }, { id: 'layout', text: css });
182
+ }
183
+ function defineMasonry(tag = 'usa-masonry') {
184
+ return base.defineElement(tag, (Base) => class UsaMasonry extends Base {
185
+ static get observedAttributes() {
186
+ return ['columns', 'min', 'gap'];
187
+ }
188
+ changed() {
189
+ this.layout();
190
+ }
191
+ layout() {
192
+ const items = Array.from(this.children).filter((c) => !c.__usaGhost);
193
+ const w = this.clientWidth;
194
+ if (!w)
195
+ return;
196
+ const gap = this.num('gap', 16);
197
+ const cols = this.num('columns', 0) || Math.max(1, Math.floor((w + gap) / (this.num('min', 220) + gap)));
198
+ const cw = (w - gap * (cols - 1)) / cols;
199
+ items.forEach((el) => (el.style.width = `${cw}px`));
200
+ const pos = masonryLayout(items.map((el) => el.offsetHeight), cols, cw, gap);
201
+ items.forEach((el, i) => (el.style.transform = `translate(${pos[i].x}px, ${pos[i].y}px)`));
202
+ this.style.height = `${pos.height}px`;
203
+ this.style.setProperty('--usa-masonry-cols', String(cols));
204
+ }
205
+ mount() {
206
+ this.setAttribute('data-js', '');
207
+ this.onCleanup(() => this.removeAttribute('data-js'));
208
+ let id = 0;
209
+ const queue = () => {
210
+ if (id)
211
+ return;
212
+ id = requestAnimationFrame(() => {
213
+ id = 0;
214
+ this.layout();
215
+ });
216
+ };
217
+ if (typeof ResizeObserver === 'function') {
218
+ const ro = new ResizeObserver(queue);
219
+ ro.observe(this);
220
+ Array.from(this.children).forEach((c) => ro.observe(c));
221
+ const mo = new MutationObserver((recs) => {
222
+ recs.forEach((r) => r.addedNodes.forEach((n) => n instanceof Element && ro.observe(n)));
223
+ queue();
224
+ });
225
+ mo.observe(this, { childList: true });
226
+ this.onCleanup(() => (ro.disconnect(), mo.disconnect()));
227
+ }
228
+ this.listen(this, 'load', queue, { capture: true });
229
+ this.layout();
230
+ }
231
+ unmount() {
232
+ this.style.height = '';
233
+ Array.from(this.children).forEach((c) => (c.style.transform = '', c.style.width = ''));
234
+ }
235
+ }, { id: 'layout', text: css });
236
+ }
237
+
238
+ /**
239
+ * use-scroll-animate/components/layout — layout animation (v3.6).
240
+ * `autoAnimate()` / `<usa-auto-animate>` (list & grid reflow),
241
+ * `<usa-masonry>`, and `sharedTransition()` for shared-element transitions
242
+ * (View Transitions API with a FLIP fallback).
243
+ */
244
+ /** Register every component of this category under its default tag. */
245
+ function defineLayoutComponents() {
246
+ defineAutoAnimate();
247
+ defineMasonry();
248
+ }
249
+
250
+ exports.configureComponents = base.configureComponents;
251
+ exports.prefersReducedMotion = base.prefersReducedMotion;
252
+ exports.autoAnimate = autoAnimate;
253
+ exports.defineAutoAnimate = defineAutoAnimate;
254
+ exports.defineLayoutComponents = defineLayoutComponents;
255
+ exports.defineMasonry = defineMasonry;
256
+ exports.flipFrames = flipFrames;
257
+ exports.masonryLayout = masonryLayout;
258
+ exports.sharedTransition = sharedTransition;
259
+ //# sourceMappingURL=layout.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.cjs","sources":["../../src/components/layout/core.ts","../../src/components/layout/elements.ts","../../src/components/layout/index.ts"],"sourcesContent":["import { prefersReducedMotion, motionScale, EASE_OUT } from '../base';\n\ntype Box = { left: number; top: number; width: number; height: number };\n\n/** FLIP keyframes from a previous box to the current one (pure). */\nexport function flipFrames(from: Box, to: Box, scale = true): Keyframe[] {\n const dx = from.left - to.left;\n const dy = from.top - to.top;\n const sx = scale && to.width ? from.width / to.width : 1;\n const sy = scale && to.height ? from.height / to.height : 1;\n return [\n { transformOrigin: '0 0', transform: `translate(${dx}px, ${dy}px) scale(${sx}, ${sy})` },\n { transformOrigin: '0 0', transform: 'none' },\n ];\n}\n\nexport interface AutoAnimateOptions {\n duration?: number;\n easing?: string;\n /** Also animate size changes (default true). */\n scale?: boolean;\n}\n\n/**\n * Auto-animate a container: children that are added fade / scale in, removed\n * ones fade out in place, and moved ones (re-sort, filter, reflow, resize)\n * glide to their new spot — no extra code at the call site. Returns\n * `{ disable, enable, stop }`. Reduced motion: changes apply instantly.\n *\n * @example\n * const ctl = autoAnimate(document.querySelector('ul'));\n * list.append(item); // animates\n */\nexport function autoAnimate(parent: HTMLElement, o: AutoAnimateOptions = {}): { enable(): void; disable(): void; stop(): void } {\n let on = true;\n const boxes = new WeakMap<Element, Box>();\n const rel = (el: Element): Box => {\n const r = el.getBoundingClientRect();\n const p = parent.getBoundingClientRect();\n return { left: r.left - p.left, top: r.top - p.top, width: r.width, height: r.height };\n };\n const snap = () => Array.from(parent.children).forEach((c) => boxes.set(c, rel(c)));\n const dur = () => (o.duration ?? 300) * motionScale();\n const timing = (): KeyframeAnimationOptions => ({ duration: dur(), easing: o.easing ?? EASE_OUT });\n const animate = (el: Element, frames: Keyframe[], t = timing()) => (typeof (el as HTMLElement).animate === 'function' ? (el as HTMLElement).animate(frames, t) : null);\n\n const mo =\n typeof MutationObserver === 'function'\n ? new MutationObserver((records) => {\n if (!on || prefersReducedMotion() || dur() <= 0) return snap();\n const added = new Set<Element>();\n for (const r of records) {\n r.addedNodes.forEach((n) => n instanceof Element && n.parentElement === parent && added.add(n));\n r.removedNodes.forEach((n) => {\n if (!(n instanceof HTMLElement) || n.isConnected) return;\n const b = boxes.get(n);\n if (!b) return;\n // put a ghost back at its old place and fade it out\n n.style.position = 'absolute';\n n.style.left = `${b.left}px`;\n n.style.top = `${b.top}px`;\n n.style.width = `${b.width}px`;\n n.style.height = `${b.height}px`;\n n.style.margin = '0';\n n.style.pointerEvents = 'none';\n if (getComputedStyle(parent).position === 'static') parent.style.position = 'relative';\n parent.appendChild(n);\n (n as any).__usaGhost = true;\n const a = animate(n, [{ opacity: 1, transform: 'none' }, { opacity: 0, transform: 'scale(0.96)' }]);\n const drop = () => {\n n.remove();\n for (const k of ['position', 'left', 'top', 'width', 'height', 'margin', 'pointerEvents'] as const) n.style[k] = '';\n };\n if (a) a.finished.then(drop, drop);\n else drop();\n });\n }\n Array.from(parent.children).forEach((c) => {\n if ((c as any).__usaGhost) return;\n if (added.has(c)) return void animate(c, [{ opacity: 0, transform: 'scale(0.96)' }, { opacity: 1, transform: 'none' }]);\n const prev = boxes.get(c);\n if (!prev) return;\n const now = rel(c);\n if (Math.abs(prev.left - now.left) + Math.abs(prev.top - now.top) + Math.abs(prev.width - now.width) + Math.abs(prev.height - now.height) < 1) return;\n animate(c, flipFrames(prev, now, o.scale !== false));\n });\n snap();\n })\n : null;\n mo?.observe(parent, { childList: true });\n const ro = typeof ResizeObserver === 'function' ? new ResizeObserver(() => snap()) : null;\n ro?.observe(parent);\n snap();\n // capture boxes right before any change in the same task (events, timers)\n const capture = () => snap();\n parent.addEventListener('pointerdown', capture, true);\n return {\n enable: () => ((on = true), snap()),\n disable: () => (on = false),\n stop: () => {\n mo?.disconnect();\n ro?.disconnect();\n parent.removeEventListener('pointerdown', capture, true);\n },\n };\n}\n\n/** Masonry placement: shortest-column-first positions for item heights (pure). */\nexport function masonryLayout(heights: number[], columns: number, columnWidth: number, gap: number): { x: number; y: number }[] & { height?: number } {\n const cols = Array(Math.max(1, columns)).fill(0);\n const out = heights.map((h) => {\n const c = cols.indexOf(Math.min(...cols));\n const pos = { x: c * (columnWidth + gap), y: cols[c] };\n cols[c] += h + gap;\n return pos;\n }) as { x: number; y: number }[] & { height?: number };\n out.height = Math.max(0, Math.max(...cols) - gap);\n return out;\n}\n\nexport interface SharedOptions {\n duration?: number;\n easing?: string;\n}\n\n/**\n * Shared-element transition between two states of the page: every element\n * with `data-shared=\"id\"` before `update()` flies to the element with the\n * same id afterwards (size and position), the rest cross-fades. Uses the\n * View Transitions API when present (with `view-transition-name` per id),\n * otherwise a FLIP fallback. Reduced motion: just runs `update()`.\n */\nexport async function sharedTransition(update: () => void | Promise<void>, root: ParentNode = document, o: SharedOptions = {}): Promise<void> {\n if (prefersReducedMotion() || typeof document === 'undefined') return void (await update());\n const collect = () => new Map(Array.from(root.querySelectorAll<HTMLElement>('[data-shared]')).map((el) => [el.dataset.shared!, el]));\n const doc = document as any;\n if (typeof doc.startViewTransition === 'function') {\n const named = (m: Map<string, HTMLElement>) => m.forEach((el, id) => (el.style.viewTransitionName = `usa-${id.replace(/[^\\w-]/g, '_')}`));\n const clear = (m: Map<string, HTMLElement>) => m.forEach((el) => (el.style.viewTransitionName = ''));\n const before = collect();\n named(before);\n let after = new Map<string, HTMLElement>();\n const vt = doc.startViewTransition(async () => {\n clear(before);\n await update();\n after = collect();\n named(after);\n });\n await vt.finished.catch(() => undefined);\n clear(after);\n return;\n }\n const before = new Map(Array.from(collect()).map(([id, el]) => [id, el.getBoundingClientRect()]));\n await update();\n const anims: Promise<unknown>[] = [];\n collect().forEach((el, id) => {\n const a = before.get(id);\n if (!a || typeof el.animate !== 'function') return;\n const b = el.getBoundingClientRect();\n if (!b.width || !b.height) return;\n anims.push(el.animate(flipFrames(a, b), { duration: (o.duration ?? 450) * motionScale(), easing: o.easing ?? EASE_OUT }).finished.catch(() => undefined));\n });\n await Promise.all(anims);\n}\n","import { defineElement, type UsaElement } from '../base';\nimport { autoAnimate, masonryLayout } from './core';\nimport css from './layout.css?raw';\n\n/**\n * `<usa-auto-animate>` — wraps `autoAnimate()`: any change to its children\n * (add, remove, re-order, filter, size) animates. Attributes `duration`\n * (300), `no-scale`. Works for lists and CSS grids alike.\n */\nexport interface UsaAutoAnimateElement extends UsaElement {\n enable(): void;\n disable(): void;\n}\n\nexport function defineAutoAnimate(tag = 'usa-auto-animate'): CustomElementConstructor | undefined {\n return defineElement(\n tag,\n (Base) =>\n class UsaAutoAnimate extends Base {\n private _c: ReturnType<typeof autoAnimate> | null = null;\n enable(): void {\n this._c?.enable();\n }\n disable(): void {\n this._c?.disable();\n }\n mount(): void {\n const c = (this._c = autoAnimate(this, { duration: this.num('duration', 300), scale: !this.flag('no-scale') }));\n this.onCleanup(() => c.stop());\n }\n },\n { id: 'layout', text: css }\n );\n}\n\n/**\n * `<usa-masonry>` — a masonry (Pinterest-style) grid: children are placed in\n * the shortest column and glide to new spots when the width, the items or\n * their sizes change. Attributes `columns` (fixed count) or `min` (min\n * column width px, 220), `gap` (16). Without JS layout support it is a\n * plain CSS multi-column flow. Reduced motion: no glide.\n */\nexport interface UsaMasonryElement extends UsaElement {\n layout(): void;\n}\n\nexport function defineMasonry(tag = 'usa-masonry'): CustomElementConstructor | undefined {\n return defineElement(\n tag,\n (Base) =>\n class UsaMasonry extends Base {\n static get observedAttributes(): string[] {\n return ['columns', 'min', 'gap'];\n }\n changed(): void {\n this.layout();\n }\n layout(): void {\n const items = Array.from(this.children).filter((c) => !(c as any).__usaGhost) as HTMLElement[];\n const w = this.clientWidth;\n if (!w) return;\n const gap = this.num('gap', 16);\n const cols = this.num('columns', 0) || Math.max(1, Math.floor((w + gap) / (this.num('min', 220) + gap)));\n const cw = (w - gap * (cols - 1)) / cols;\n items.forEach((el) => (el.style.width = `${cw}px`));\n const pos = masonryLayout(items.map((el) => el.offsetHeight), cols, cw, gap);\n items.forEach((el, i) => (el.style.transform = `translate(${pos[i].x}px, ${pos[i].y}px)`));\n this.style.height = `${pos.height}px`;\n this.style.setProperty('--usa-masonry-cols', String(cols));\n }\n mount(): void {\n this.setAttribute('data-js', '');\n this.onCleanup(() => this.removeAttribute('data-js'));\n let id = 0;\n const queue = () => {\n if (id) return;\n id = requestAnimationFrame(() => {\n id = 0;\n this.layout();\n });\n };\n if (typeof ResizeObserver === 'function') {\n const ro = new ResizeObserver(queue);\n ro.observe(this);\n Array.from(this.children).forEach((c) => ro.observe(c));\n const mo = new MutationObserver((recs) => {\n recs.forEach((r) => r.addedNodes.forEach((n) => n instanceof Element && ro.observe(n)));\n queue();\n });\n mo.observe(this, { childList: true });\n this.onCleanup(() => (ro.disconnect(), mo.disconnect()));\n }\n this.listen(this, 'load', queue, { capture: true });\n this.layout();\n }\n unmount(): void {\n this.style.height = '';\n Array.from(this.children).forEach((c) => ((c as HTMLElement).style.transform = '', (c as HTMLElement).style.width = ''));\n }\n },\n { id: 'layout', text: css }\n );\n}\n","/**\n * use-scroll-animate/components/layout — layout animation (v3.6).\n * `autoAnimate()` / `<usa-auto-animate>` (list & grid reflow),\n * `<usa-masonry>`, and `sharedTransition()` for shared-element transitions\n * (View Transitions API with a FLIP fallback).\n */\nimport { defineAutoAnimate, defineMasonry, type UsaAutoAnimateElement, type UsaMasonryElement } from './elements';\n\nexport { defineAutoAnimate, defineMasonry };\nexport { autoAnimate, masonryLayout, sharedTransition, flipFrames } from './core';\nexport type { AutoAnimateOptions, SharedOptions } from './core';\nexport type { UsaAutoAnimateElement, UsaMasonryElement };\nexport { configureComponents, prefersReducedMotion } from '../base';\nexport type { ComponentsConfig, UsaElement } from '../base';\n\n/** Register every component of this category under its default tag. */\nexport function defineLayoutComponents(): void {\n defineAutoAnimate();\n defineMasonry();\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'usa-auto-animate': UsaAutoAnimateElement;\n 'usa-masonry': UsaMasonryElement;\n }\n}\n"],"names":["motionScale","EASE_OUT","prefersReducedMotion","defineElement"],"mappings":";;;;AAIA;AACM,SAAU,UAAU,CAAC,IAAS,EAAE,EAAO,EAAE,KAAK,GAAG,IAAI,EAAA;IACzD,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI;IAC9B,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG;IAC5B,MAAM,EAAE,GAAG,KAAK,IAAI,EAAE,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,KAAK,GAAG,CAAC;IACxD,MAAM,EAAE,GAAG,KAAK,IAAI,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,MAAM,GAAG,CAAC;IAC3D,OAAO;AACL,QAAA,EAAE,eAAe,EAAE,KAAK,EAAE,SAAS,EAAE,CAAA,UAAA,EAAa,EAAE,CAAA,IAAA,EAAO,EAAE,CAAA,UAAA,EAAa,EAAE,CAAA,EAAA,EAAK,EAAE,GAAG,EAAE;AACxF,QAAA,EAAE,eAAe,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE;KAC9C;AACH;AASA;;;;;;;;;AASG;SACa,W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 0);clip-path:inset(50%);white-space:nowrap;border:0}
3
+ usa-auto-animate{display:block}usa-masonry{display:block;column-width:220px;column-gap:16px}usa-masonry>*{break-inside:avoid;margin-bottom:16px}usa-masonry[data-js]{position:relative;columns:auto}usa-masonry[data-js]>*{position:absolute;left:0;top:0;margin:0;box-sizing:border-box;transition:transform 0.45s cubic-bezier(0.22,1,0.36,1)}@media (prefers-reduced-motion:reduce){usa-masonry[data-js]>*{transition:none}}
@@ -0,0 +1,134 @@
1
+ /**
2
+ * use-scroll-animate/components — shared base for the `<usa-*>` custom elements.
3
+ *
4
+ * Everything here is lazy: nothing touches `window`, `document`,
5
+ * `HTMLElement` or `matchMedia` at import time, so the components can be
6
+ * imported during SSR (Next, Nuxt, Astro…) and in Electron/Tauri preload
7
+ * scripts. Classes are created the first time a `define*()` function runs.
8
+ */
9
+ interface ComponentsConfig {
10
+ /**
11
+ * Inject each component's CSS when it is defined (default `true`). Uses a
12
+ * constructable stylesheet (`document.adoptedStyleSheets`, which a strict
13
+ * `style-src` CSP does not block) and falls back to a `<style>` tag. Set
14
+ * to `false` when you load `use-scroll-animate/components.css` yourself.
15
+ */
16
+ injectStyles?: boolean;
17
+ /**
18
+ * `'user'` (default) follows `prefers-reduced-motion`; `'reduce'` always
19
+ * uses the reduced variants (e.g. a kiosk / battery-saver mode);
20
+ * `'no-preference'` ignores the OS setting (only for demos — respect your users).
21
+ */
22
+ reducedMotion?: 'user' | 'reduce' | 'no-preference';
23
+ /**
24
+ * Global motion intensity (v2.7): `'off'` (same as reduced motion),
25
+ * `'low'` (shorter, calmer), `'normal'` (default) or `'high'`. Scales every
26
+ * component animation's duration and sets `--usa-motion` (0 / 0.6 / 1 /
27
+ * 1.25) on `<html>` for your own CSS. See `setMotionIntensity()`.
28
+ */
29
+ motionIntensity?: MotionIntensity;
30
+ }
31
+ type MotionIntensity = 'off' | 'low' | 'normal' | 'high';
32
+ /** Change global component settings (call before `define*()` for `injectStyles`). */
33
+ declare function configureComponents(options: ComponentsConfig): void;
34
+ /** `true` when animations should be reduced (OS setting or `configureComponents`). */
35
+ declare function prefersReducedMotion(): boolean;
36
+ /**
37
+ * Members shared by every `<usa-*>` element. Attribute helpers, a cleanup
38
+ * bag that is emptied on disconnect, and motion helpers that degrade to the
39
+ * final state without WAAPI or under reduced motion.
40
+ */
41
+ interface UsaElement extends HTMLElement {
42
+ /** `true` while reduced motion applies to this element. */
43
+ readonly reduced: boolean;
44
+ }
45
+
46
+ /**
47
+ * `<usa-auto-animate>` — wraps `autoAnimate()`: any change to its children
48
+ * (add, remove, re-order, filter, size) animates. Attributes `duration`
49
+ * (300), `no-scale`. Works for lists and CSS grids alike.
50
+ */
51
+ interface UsaAutoAnimateElement extends UsaElement {
52
+ enable(): void;
53
+ disable(): void;
54
+ }
55
+ declare function defineAutoAnimate(tag?: string): CustomElementConstructor | undefined;
56
+ /**
57
+ * `<usa-masonry>` — a masonry (Pinterest-style) grid: children are placed in
58
+ * the shortest column and glide to new spots when the width, the items or
59
+ * their sizes change. Attributes `columns` (fixed count) or `min` (min
60
+ * column width px, 220), `gap` (16). Without JS layout support it is a
61
+ * plain CSS multi-column flow. Reduced motion: no glide.
62
+ */
63
+ interface UsaMasonryElement extends UsaElement {
64
+ layout(): void;
65
+ }
66
+ declare function defineMasonry(tag?: string): CustomElementConstructor | undefined;
67
+
68
+ type Box = {
69
+ left: number;
70
+ top: number;
71
+ width: number;
72
+ height: number;
73
+ };
74
+ /** FLIP keyframes from a previous box to the current one (pure). */
75
+ declare function flipFrames(from: Box, to: Box, scale?: boolean): Keyframe[];
76
+ interface AutoAnimateOptions {
77
+ duration?: number;
78
+ easing?: string;
79
+ /** Also animate size changes (default true). */
80
+ scale?: boolean;
81
+ }
82
+ /**
83
+ * Auto-animate a container: children that are added fade / scale in, removed
84
+ * ones fade out in place, and moved ones (re-sort, filter, reflow, resize)
85
+ * glide to their new spot — no extra code at the call site. Returns
86
+ * `{ disable, enable, stop }`. Reduced motion: changes apply instantly.
87
+ *
88
+ * @example
89
+ * const ctl = autoAnimate(document.querySelector('ul'));
90
+ * list.append(item); // animates
91
+ */
92
+ declare function autoAnimate(parent: HTMLElement, o?: AutoAnimateOptions): {
93
+ enable(): void;
94
+ disable(): void;
95
+ stop(): void;
96
+ };
97
+ /** Masonry placement: shortest-column-first positions for item heights (pure). */
98
+ declare function masonryLayout(heights: number[], columns: number, columnWidth: number, gap: number): {
99
+ x: number;
100
+ y: number;
101
+ }[] & {
102
+ height?: number;
103
+ };
104
+ interface SharedOptions {
105
+ duration?: number;
106
+ easing?: string;
107
+ }
108
+ /**
109
+ * Shared-element transition between two states of the page: every element
110
+ * with `data-shared="id"` before `update()` flies to the element with the
111
+ * same id afterwards (size and position), the rest cross-fades. Uses the
112
+ * View Transitions API when present (with `view-transition-name` per id),
113
+ * otherwise a FLIP fallback. Reduced motion: just runs `update()`.
114
+ */
115
+ declare function sharedTransition(update: () => void | Promise<void>, root?: ParentNode, o?: SharedOptions): Promise<void>;
116
+
117
+ /**
118
+ * use-scroll-animate/components/layout — layout animation (v3.6).
119
+ * `autoAnimate()` / `<usa-auto-animate>` (list & grid reflow),
120
+ * `<usa-masonry>`, and `sharedTransition()` for shared-element transitions
121
+ * (View Transitions API with a FLIP fallback).
122
+ */
123
+
124
+ /** Register every component of this category under its default tag. */
125
+ declare function defineLayoutComponents(): void;
126
+ declare global {
127
+ interface HTMLElementTagNameMap {
128
+ 'usa-auto-animate': UsaAutoAnimateElement;
129
+ 'usa-masonry': UsaMasonryElement;
130
+ }
131
+ }
132
+
133
+ export { autoAnimate, configureComponents, defineAutoAnimate, defineLayoutComponents, defineMasonry, flipFrames, masonryLayout, prefersReducedMotion, sharedTransition };
134
+ export type { AutoAnimateOptions, ComponentsConfig, SharedOptions, UsaAutoAnimateElement, UsaElement, UsaMasonryElement };