use-scroll-animate 4.8.0 → 5.0.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 (222) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +2 -1
  3. package/README_ja.md +1 -0
  4. package/README_zh.md +2 -1
  5. package/bin/usa-codemod-5.mjs +79 -0
  6. package/dist/chunks/{base-CxYU2NK_.cjs → base-B5i8qQPR.cjs} +65 -30
  7. package/dist/chunks/base-B5i8qQPR.cjs.map +1 -0
  8. package/dist/chunks/{base-CZiIAMBc.js → base-C3Sw9sAO.js} +63 -31
  9. package/dist/chunks/base-C3Sw9sAO.js.map +1 -0
  10. package/dist/chunks/{core-HLqH3qkA.cjs → core-BDcszY4L.cjs} +2 -2
  11. package/dist/chunks/{core-HLqH3qkA.cjs.map → core-BDcszY4L.cjs.map} +1 -1
  12. package/dist/chunks/{core-COi3DrLx.js → core-BTf__I-8.js} +2 -2
  13. package/dist/chunks/{core-COi3DrLx.js.map → core-BTf__I-8.js.map} +1 -1
  14. package/dist/chunks/{core-CctNfzuP.cjs → core-BjOYKSrV.cjs} +2 -2
  15. package/dist/chunks/{core-CctNfzuP.cjs.map → core-BjOYKSrV.cjs.map} +1 -1
  16. package/dist/chunks/{core-CJHJeMI_.js → core-DN3hHbHh.js} +2 -2
  17. package/dist/chunks/{core-CJHJeMI_.js.map → core-DN3hHbHh.js.map} +1 -1
  18. package/dist/chunks/fx-B8hk1Fby.cjs +114 -0
  19. package/dist/chunks/fx-B8hk1Fby.cjs.map +1 -0
  20. package/dist/chunks/fx-ChjxrMBo.js +109 -0
  21. package/dist/chunks/fx-ChjxrMBo.js.map +1 -0
  22. package/dist/chunks/{index-tags-Dh8nwXqw.js → index-tags-DucKMQr_.js} +2 -1
  23. package/dist/chunks/{index-tags-Dh8nwXqw.js.map → index-tags-DucKMQr_.js.map} +1 -1
  24. package/dist/chunks/{index-tags-CIRY2KnU.cjs → index-tags-wv0R_vkO.cjs} +2 -1
  25. package/dist/chunks/{index-tags-CIRY2KnU.cjs.map → index-tags-wv0R_vkO.cjs.map} +1 -1
  26. package/dist/chunks/{spring-Dkpygsuj.cjs → spring--oZh55tB.cjs} +2 -2
  27. package/dist/chunks/{spring-Dkpygsuj.cjs.map → spring--oZh55tB.cjs.map} +1 -1
  28. package/dist/chunks/{spring-BS5tg6aK.js → spring-CckMe3x0.js} +2 -2
  29. package/dist/chunks/{spring-BS5tg6aK.js.map → spring-CckMe3x0.js.map} +1 -1
  30. package/dist/chunks/{variants-D9n-3x27.js → variants-Bsevy6Xm.js} +2 -2
  31. package/dist/chunks/{variants-D9n-3x27.js.map → variants-Bsevy6Xm.js.map} +1 -1
  32. package/dist/chunks/{variants-CfJzrzMh.cjs → variants-DxPmgrNX.cjs} +2 -2
  33. package/dist/chunks/{variants-CfJzrzMh.cjs.map → variants-DxPmgrNX.cjs.map} +1 -1
  34. package/dist/components/a11y.cjs +39 -2
  35. package/dist/components/a11y.cjs.map +1 -1
  36. package/dist/components/a11y.d.cts +13 -2
  37. package/dist/components/a11y.d.ts +13 -2
  38. package/dist/components/a11y.js +39 -4
  39. package/dist/components/a11y.js.map +1 -1
  40. package/dist/components/angular.cjs +8 -6
  41. package/dist/components/angular.cjs.map +1 -1
  42. package/dist/components/angular.d.cts +33 -4
  43. package/dist/components/angular.d.ts +33 -4
  44. package/dist/components/angular.js +8 -6
  45. package/dist/components/angular.js.map +1 -1
  46. package/dist/components/background.cjs +2 -4
  47. package/dist/components/background.cjs.map +1 -1
  48. package/dist/components/background.d.cts +2 -47
  49. package/dist/components/background.d.ts +2 -47
  50. package/dist/components/background.js +3 -4
  51. package/dist/components/background.js.map +1 -1
  52. package/dist/components/bridge.cjs +1 -1
  53. package/dist/components/bridge.js +1 -1
  54. package/dist/components/cards.cjs +2 -4
  55. package/dist/components/cards.cjs.map +1 -1
  56. package/dist/components/cards.d.cts +2 -47
  57. package/dist/components/cards.d.ts +2 -47
  58. package/dist/components/cards.js +2 -3
  59. package/dist/components/cards.js.map +1 -1
  60. package/dist/components/click.cjs +24 -130
  61. package/dist/components/click.cjs.map +1 -1
  62. package/dist/components/click.d.cts +2 -47
  63. package/dist/components/click.d.ts +2 -47
  64. package/dist/components/click.js +4 -109
  65. package/dist/components/click.js.map +1 -1
  66. package/dist/components/depth.cjs +3 -5
  67. package/dist/components/depth.cjs.map +1 -1
  68. package/dist/components/depth.d.cts +2 -47
  69. package/dist/components/depth.d.ts +2 -47
  70. package/dist/components/depth.js +3 -4
  71. package/dist/components/depth.js.map +1 -1
  72. package/dist/components/feedback.cjs +1 -3
  73. package/dist/components/feedback.cjs.map +1 -1
  74. package/dist/components/feedback.d.cts +2 -47
  75. package/dist/components/feedback.d.ts +2 -47
  76. package/dist/components/feedback.js +1 -2
  77. package/dist/components/feedback.js.map +1 -1
  78. package/dist/components/fx.cjs +285 -0
  79. package/dist/components/fx.cjs.map +1 -0
  80. package/dist/components/fx.css +3 -0
  81. package/dist/components/fx.d.cts +114 -0
  82. package/dist/components/fx.d.ts +114 -0
  83. package/dist/components/fx.js +271 -0
  84. package/dist/components/fx.js.map +1 -0
  85. package/dist/components/gesture.cjs +3 -5
  86. package/dist/components/gesture.cjs.map +1 -1
  87. package/dist/components/gesture.d.cts +2 -47
  88. package/dist/components/gesture.d.ts +2 -47
  89. package/dist/components/gesture.js +4 -5
  90. package/dist/components/gesture.js.map +1 -1
  91. package/dist/components/interaction.cjs +1 -3
  92. package/dist/components/interaction.cjs.map +1 -1
  93. package/dist/components/interaction.d.cts +2 -47
  94. package/dist/components/interaction.d.ts +2 -47
  95. package/dist/components/interaction.js +1 -2
  96. package/dist/components/interaction.js.map +1 -1
  97. package/dist/components/jsx.d.cts +1 -0
  98. package/dist/components/jsx.d.ts +1 -0
  99. package/dist/components/layout.cjs +1 -3
  100. package/dist/components/layout.cjs.map +1 -1
  101. package/dist/components/layout.d.cts +2 -47
  102. package/dist/components/layout.d.ts +2 -47
  103. package/dist/components/layout.js +2 -3
  104. package/dist/components/layout.js.map +1 -1
  105. package/dist/components/lazy.cjs +2 -1
  106. package/dist/components/lazy.cjs.map +1 -1
  107. package/dist/components/lazy.d.cts +1 -0
  108. package/dist/components/lazy.d.ts +1 -0
  109. package/dist/components/lazy.js +2 -1
  110. package/dist/components/lazy.js.map +1 -1
  111. package/dist/components/lite.cjs +413 -42
  112. package/dist/components/lite.cjs.map +1 -1
  113. package/dist/components/lite.js +394 -43
  114. package/dist/components/lite.js.map +1 -1
  115. package/dist/components/packs.cjs +1 -3
  116. package/dist/components/packs.cjs.map +1 -1
  117. package/dist/components/packs.d.cts +2 -47
  118. package/dist/components/packs.d.ts +2 -47
  119. package/dist/components/packs.js +2 -3
  120. package/dist/components/packs.js.map +1 -1
  121. package/dist/components/page.cjs +31 -12
  122. package/dist/components/page.cjs.map +1 -1
  123. package/dist/components/page.d.cts +15 -52
  124. package/dist/components/page.d.ts +15 -52
  125. package/dist/components/page.js +31 -12
  126. package/dist/components/page.js.map +1 -1
  127. package/dist/components/perf.cjs +3 -4
  128. package/dist/components/perf.cjs.map +1 -1
  129. package/dist/components/perf.d.cts +1 -0
  130. package/dist/components/perf.d.ts +1 -0
  131. package/dist/components/perf.js +4 -5
  132. package/dist/components/perf.js.map +1 -1
  133. package/dist/components/physics.cjs +2 -4
  134. package/dist/components/physics.cjs.map +1 -1
  135. package/dist/components/physics.d.cts +2 -47
  136. package/dist/components/physics.d.ts +2 -47
  137. package/dist/components/physics.js +3 -4
  138. package/dist/components/physics.js.map +1 -1
  139. package/dist/components/react.cjs +1 -1
  140. package/dist/components/react.js +1 -1
  141. package/dist/components/reveal.cjs +1 -3
  142. package/dist/components/reveal.cjs.map +1 -1
  143. package/dist/components/reveal.d.cts +2 -47
  144. package/dist/components/reveal.d.ts +2 -47
  145. package/dist/components/reveal.js +1 -2
  146. package/dist/components/reveal.js.map +1 -1
  147. package/dist/components/solid.cjs +8 -6
  148. package/dist/components/solid.cjs.map +1 -1
  149. package/dist/components/solid.d.cts +33 -4
  150. package/dist/components/solid.d.ts +33 -4
  151. package/dist/components/solid.js +8 -6
  152. package/dist/components/solid.js.map +1 -1
  153. package/dist/components/svelte.cjs +8 -6
  154. package/dist/components/svelte.cjs.map +1 -1
  155. package/dist/components/svelte.d.cts +33 -4
  156. package/dist/components/svelte.d.ts +33 -4
  157. package/dist/components/svelte.js +8 -6
  158. package/dist/components/svelte.js.map +1 -1
  159. package/dist/components/svg.cjs +1 -3
  160. package/dist/components/svg.cjs.map +1 -1
  161. package/dist/components/svg.d.cts +2 -47
  162. package/dist/components/svg.d.ts +2 -47
  163. package/dist/components/svg.js +2 -3
  164. package/dist/components/svg.js.map +1 -1
  165. package/dist/components/text.cjs +2 -4
  166. package/dist/components/text.cjs.map +1 -1
  167. package/dist/components/text.d.cts +2 -47
  168. package/dist/components/text.d.ts +2 -47
  169. package/dist/components/text.js +2 -3
  170. package/dist/components/text.js.map +1 -1
  171. package/dist/components/timeline.cjs +3 -5
  172. package/dist/components/timeline.cjs.map +1 -1
  173. package/dist/components/timeline.d.cts +4 -49
  174. package/dist/components/timeline.d.ts +4 -49
  175. package/dist/components/timeline.js +4 -5
  176. package/dist/components/timeline.js.map +1 -1
  177. package/dist/components/transitions.cjs +1 -3
  178. package/dist/components/transitions.cjs.map +1 -1
  179. package/dist/components/transitions.d.cts +2 -47
  180. package/dist/components/transitions.d.ts +2 -47
  181. package/dist/components/transitions.js +2 -3
  182. package/dist/components/transitions.js.map +1 -1
  183. package/dist/components/ui.cjs +3 -5
  184. package/dist/components/ui.cjs.map +1 -1
  185. package/dist/components/ui.d.cts +2 -47
  186. package/dist/components/ui.d.ts +2 -47
  187. package/dist/components/ui.js +4 -5
  188. package/dist/components/ui.js.map +1 -1
  189. package/dist/components/vue.cjs +8 -6
  190. package/dist/components/vue.cjs.map +1 -1
  191. package/dist/components/vue.d.cts +33 -4
  192. package/dist/components/vue.d.ts +33 -4
  193. package/dist/components/vue.js +8 -6
  194. package/dist/components/vue.js.map +1 -1
  195. package/dist/components/webgl.cjs +3 -5
  196. package/dist/components/webgl.cjs.map +1 -1
  197. package/dist/components/webgl.d.cts +2 -47
  198. package/dist/components/webgl.d.ts +2 -47
  199. package/dist/components/webgl.js +3 -4
  200. package/dist/components/webgl.js.map +1 -1
  201. package/dist/components.cjs +33 -10
  202. package/dist/components.cjs.map +1 -1
  203. package/dist/components.css +1 -0
  204. package/dist/components.d.cts +147 -17
  205. package/dist/components.d.ts +147 -17
  206. package/dist/components.js +16 -12
  207. package/dist/components.js.map +1 -1
  208. package/dist/components.umd.js +2 -2
  209. package/dist/components.umd.js.map +1 -1
  210. package/dist/index.cjs +2 -2
  211. package/dist/index.js +2 -2
  212. package/dist/index.umd.js +1 -1
  213. package/dist/index.umd.js.map +1 -1
  214. package/docs/API.md +1 -1
  215. package/docs/ROADMAP.md +12 -12
  216. package/docs/components.md +14 -1
  217. package/docs/deprecations.md +6 -0
  218. package/docs/performance.md +1 -1
  219. package/docs/upgrading-5.md +31 -0
  220. package/package.json +18 -3
  221. package/dist/chunks/base-CZiIAMBc.js.map +0 -1
  222. package/dist/chunks/base-CxYU2NK_.cjs.map +0 -1
@@ -1 +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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BAAsB,GAAA;AACpC,IAAA,iBAAiB,EAAE;AACnB,IAAA,aAAa,EAAE;AACjB;;;;;;;;;;;;"}
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 };\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","prefersReducedMot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YAC1D;AACA,YAAA,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;YACnD,IAAI,CAAC,MAAM,EAAE;QACf;QACA,OAAO,GAAA;AACL,YAAA,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,EAAE;AACtB,YAAA,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAO,CAAiB,CAAC,KAAK,CAAC,SAAS,GAAG,EAAE,EAAG,CAAiB,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC;QAC1H;KACD,EACH,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,CAC5B;AACH;;ACtGA;;;;;AAKG;AAQH;SACgB,sBAAsB,GAAA;AACpC,IAAA,iBAAiB,EAAE;AACnB,IAAA,aAAa,EAAE;AACjB;;;;;;;;;;"}
@@ -1,48 +1,3 @@
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
- * Motion-sensitivity level (v4.4), finer than reduced motion:
32
- * `'full'` (default) · `'gentle'` (no spins, zooms, skews or parallax —
33
- * translations and fades only, safe for vestibular disorders) ·
34
- * `'minimal'` (fades only; components use their reduced-motion variants) ·
35
- * `'static'` (no animation: every component shows its static alternative).
36
- * See `setMotionSensitivity()` in `use-scroll-animate/components/a11y`.
37
- */
38
- motionSensitivity?: MotionSensitivity;
39
- }
40
- type MotionSensitivity = 'full' | 'gentle' | 'minimal' | 'static';
41
- type MotionIntensity = 'off' | 'low' | 'normal' | 'high';
42
- /** Change global component settings (call before `define*()` for `injectStyles`). */
43
- declare function configureComponents(options: ComponentsConfig): void;
44
- /** `true` when animations should be reduced (OS setting or `configureComponents`). */
45
- declare function prefersReducedMotion(): boolean;
46
1
  /**
47
2
  * Members shared by every `<usa-*>` element. Attribute helpers, a cleanup
48
3
  * bag that is emptied on disconnect, and motion helpers that degrade to the
@@ -140,5 +95,5 @@ declare global {
140
95
  }
141
96
  }
142
97
 
143
- export { autoAnimate, configureComponents, defineAutoAnimate, defineLayoutComponents, defineMasonry, flipFrames, masonryLayout, prefersReducedMotion, sharedTransition };
144
- export type { AutoAnimateOptions, ComponentsConfig, SharedOptions, UsaAutoAnimateElement, UsaElement, UsaMasonryElement };
98
+ export { autoAnimate, defineAutoAnimate, defineLayoutComponents, defineMasonry, flipFrames, masonryLayout, sharedTransition };
99
+ export type { AutoAnimateOptions, SharedOptions, UsaAutoAnimateElement, UsaMasonryElement };
@@ -1,48 +1,3 @@
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
- * Motion-sensitivity level (v4.4), finer than reduced motion:
32
- * `'full'` (default) · `'gentle'` (no spins, zooms, skews or parallax —
33
- * translations and fades only, safe for vestibular disorders) ·
34
- * `'minimal'` (fades only; components use their reduced-motion variants) ·
35
- * `'static'` (no animation: every component shows its static alternative).
36
- * See `setMotionSensitivity()` in `use-scroll-animate/components/a11y`.
37
- */
38
- motionSensitivity?: MotionSensitivity;
39
- }
40
- type MotionSensitivity = 'full' | 'gentle' | 'minimal' | 'static';
41
- type MotionIntensity = 'off' | 'low' | 'normal' | 'high';
42
- /** Change global component settings (call before `define*()` for `injectStyles`). */
43
- declare function configureComponents(options: ComponentsConfig): void;
44
- /** `true` when animations should be reduced (OS setting or `configureComponents`). */
45
- declare function prefersReducedMotion(): boolean;
46
1
  /**
47
2
  * Members shared by every `<usa-*>` element. Attribute helpers, a cleanup
48
3
  * bag that is emptied on disconnect, and motion helpers that degrade to the
@@ -140,5 +95,5 @@ declare global {
140
95
  }
141
96
  }
142
97
 
143
- export { autoAnimate, configureComponents, defineAutoAnimate, defineLayoutComponents, defineMasonry, flipFrames, masonryLayout, prefersReducedMotion, sharedTransition };
144
- export type { AutoAnimateOptions, ComponentsConfig, SharedOptions, UsaAutoAnimateElement, UsaElement, UsaMasonryElement };
98
+ export { autoAnimate, defineAutoAnimate, defineLayoutComponents, defineMasonry, flipFrames, masonryLayout, sharedTransition };
99
+ export type { AutoAnimateOptions, SharedOptions, UsaAutoAnimateElement, UsaMasonryElement };
@@ -1,5 +1,4 @@
1
- import { p as prefersReducedMotion, v as EASE_OUT, m as motionScale, u as defineElement } from '../chunks/base-CZiIAMBc.js';
2
- export { f as configureComponents } from '../chunks/base-CZiIAMBc.js';
1
+ import { p as prefersReducedMotion, y as EASE_OUT, m as motionScale, x as defineElement } from '../chunks/base-C3Sw9sAO.js';
3
2
 
4
3
  /** FLIP keyframes from a previous box to the current one (pure). */
5
4
  function flipFrames(from, to, scale = true) {
@@ -246,5 +245,5 @@ function defineLayoutComponents() {
246
245
  defineMasonry();
247
246
  }
248
247
 
249
- export { autoAnimate, defineAutoAnimate, defineLayoutComponents, defineMasonry, flipFrames, masonryLayout, prefersReducedMotion, sharedTransition };
248
+ export { autoAnimate, defineAutoAnimate, defineLayoutComponents, defineMasonry, flipFrames, masonryLayout, sharedTransition };
250
249
  //# sourceMappingURL=layout.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"layout.js","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":[],"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,E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AAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC;QAC1H;KACD,EACH,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,CAC5B;AACH;;ACtGA;;;;;AAKG;AAUH;SACgB,sBAAsB,GAAA;AACpC,IAAA,iBAAiB,EAAE;AACnB,IAAA,aAAa,EAAE;AACjB;;;;"}
1
+ {"version":3,"file":"layout.js","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 };\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":[],"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,WAAW,CAAC,MAAmB,EAAE,IAAwB,EAAE,EAAA;IACzE,IAAI,EAAE,GAAG,IAAI;AACb,IAAA,MAAM,KAAK,GAAG,IAAI,OAAO,EAAgB;AACzC,IAAA,MAAM,GAAG,GAAG,CAAC,EAAW,KAAS;AAC/B,QAAA,MAAM,CAAC,GAAG,EAAE,CAAC,qBAAqB,EAAE;AACpC,QAAA,MAAM,CAAC,GAAG,MAAM,CAAC,qBAAqB,EAAE;AACxC,QAAA,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,GAAG,EAA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AAA,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,UAAU,EAAE,EAAE,EAAE,CAAC,UAAU,EAAE,CAAC,CAAC;YAC1D;AACA,YAAA,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;YACnD,IAAI,CAAC,MAAM,EAAE;QACf;QACA,OAAO,GAAA;AACL,YAAA,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,EAAE;AACtB,YAAA,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAO,CAAiB,CAAC,KAAK,CAAC,SAAS,GAAG,EAAE,EAAG,CAAiB,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC;QAC1H;KACD,EACH,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,CAC5B;AACH;;ACtGA;;;;;AAKG;AAQH;SACgB,sBAAsB,GAAA;AACpC,IAAA,iBAAiB,EAAE;AACnB,IAAA,aAAa,EAAE;AACjB;;;;"}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var indexTags = require('../chunks/index-tags-CIRY2KnU.cjs');
3
+ var indexTags = require('../chunks/index-tags-wv0R_vkO.cjs');
4
4
 
5
5
  /**
6
6
  * use-scroll-animate/components/lazy — lazy, per-category registration (v2.9).
@@ -34,6 +34,7 @@ const LOADERS = {
34
34
  depth: () => Promise.resolve().then(function () { return require('./depth.cjs'); }),
35
35
  layout: () => Promise.resolve().then(function () { return require('./layout.cjs'); }),
36
36
  packs: () => Promise.resolve().then(function () { return require('./packs.cjs'); }),
37
+ fx: () => Promise.resolve().then(function () { return require('./fx.cjs'); }),
37
38
  };
38
39
  const TAG_TO_CAT = new Map();
39
40
  for (const [cat, tags] of Object.entries(indexTags.COMPONENT_CATEGORIES))
@@ -1 +1 @@
1
- {"version":3,"file":"lazy.cjs","sources":["../../src/components/lazy.ts"],"sourcesContent":["/**\n * use-scroll-animate/components/lazy — lazy, per-category registration (v2.9).\n *\n * `lazyDefine()` scans the page (and watches it with a MutationObserver) for\n * `<usa-*>` tags that are not registered yet and dynamically imports only the\n * categories they belong to. Bundlers split each category into its own chunk,\n * so a page that only uses `<usa-button>` loads just the click category.\n *\n * ```js\n * import { lazyDefine } from 'use-scroll-animate/components/lazy';\n * lazyDefine(); // returns a stop() function\n * ```\n */\nimport { COMPONENT_CATEGORIES, type ComponentCategory } from './index-tags';\n\nconst LOADERS: Record<ComponentCategory, () => Promise<Record<string, any>>> = {\n reveal: () => import('./reveal/index'),\n text: () => import('./text/index'),\n interaction: () => import('./interaction/index'),\n feedback: () => import('./feedback/index'),\n background: () => import('./background/index'),\n transitions: () => import('./transitions/index'),\n physics: () => import('./physics/index'),\n cards: () => import('./cards/index'),\n click: () => import('./click/index'),\n ui: () => import('./ui/index'),\n page: () => import('./page/index'),\n timeline: () => import('./timeline/index'),\n gesture: () => import('./gesture/index'),\n svg: () => import('./svg/index'),\n webgl: () => import('./webgl/index'),\n depth: () => import('./depth/index'),\n layout: () => import('./layout/index'),\n packs: () => import('./packs/index'),\n};\n\nconst TAG_TO_CAT = new Map<string, ComponentCategory>();\nfor (const [cat, tags] of Object.entries(COMPONENT_CATEGORIES)) for (const t of tags) TAG_TO_CAT.set(t, cat as ComponentCategory);\nconst loaded = new Map<ComponentCategory, Promise<void>>();\n\n/** Category of a tag (`usa-button` → `click`), or `null`. */\nexport const categoryOfTag = (tag: string): ComponentCategory | null => TAG_TO_CAT.get(tag.toLowerCase()) ?? null;\n\n/** Load and register one category (once). */\nexport function loadCategory(cat: ComponentCategory): Promise<void> {\n let p = loaded.get(cat);\n if (!p) {\n p = LOADERS[cat]().then((m) => {\n const fn = Object.keys(m).find((k) => /^define[A-Z]\\w*Components$/.test(k));\n if (fn) m[fn]();\n });\n loaded.set(cat, p);\n }\n return p;\n}\n\n/** Register the categories needed by the `<usa-*>` tags under `root`. Resolves when they are defined. */\nexport async function defineUsed(root: ParentNode = document): Promise<ComponentCategory[]> {\n if (typeof customElements === 'undefined') return [];\n const cats = new Set<ComponentCategory>();\n const scan = (el: Element) => {\n const c = el.localName.startsWith('usa-') && !customElements.get(el.localName) ? categoryOfTag(el.localName) : null;\n if (c) cats.add(c);\n };\n if ((root as Element).localName) scan(root as Element);\n root.querySelectorAll('*').forEach(scan);\n await Promise.all([...cats].map(loadCategory));\n return [...cats];\n}\n\n/** `defineUsed()` now and whenever new `<usa-*>` elements are added. Returns a stop function. */\nexport function lazyDefine(root: ParentNode = typeof document !== 'undefined' ? document : (undefined as any)): () => void {\n if (!root || typeof MutationObserver === 'undefined') return () => undefined;\n defineUsed(root);\n const mo = new MutationObserver((records) => {\n for (const r of records) r.addedNodes.forEach((n) => n.nodeType === 1 && defineUsed(n as Element));\n });\n mo.observe(root as Node, { childList: true, subtree: true });\n return () => mo.disconnect();\n}\n"],"names":["COMPONENT_CATEGORIES"],"mappings":";;;;AAAA;;;;;;;;;;;;AAYG;AAGH,MAAM,OAAO,GAAkE;AAC7E,IAAA,MAAM,EAAE,MAAM,oDAAO,cAAgB,KAAC;AACtC,IAAA,IAAI,EAAE,MAAM,oDAAO,YAAc,KAAC;AAClC,IAAA,WAAW,EAAE,MAAM,oDAAO,mBAAqB,KAAC;AAChD,IAAA,QAAQ,EAAE,MAAM,oDAAO,gBAAkB,KAAC;AAC1C,IAAA,UAAU,EAAE,MAAM,oDAAO,kBAAoB,KAAC;AAC9C,IAAA,WAAW,EAAE,MAAM,oDAAO,mBAAqB,KAAC;AAChD,IAAA,OAAO,EAAE,MAAM,oDAAO,eAAiB,KAAC;AACxC,IAAA,KAAK,EAAE,MAAM,oDAAO,aAAe,KAAC;AACpC,IAAA,KAAK,EAAE,MAAM,oDAAO,aAAe,KAAC;AACpC,IAAA,EAAE,EAAE,MAAM,oDAAO,UAAY,KAAC;AAC9B,IAAA,IAAI,EAAE,MAAM,oDAAO,Y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AC,CAAC,QAAQ,KAAK,CAAC,IAAI,UAAU,CAAC,CAAY,CAAC,CAAC;AACpG,IAAA,CAAC,CAAC;AACF,IAAA,EAAE,CAAC,OAAO,CAAC,IAAY,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC5D,IAAA,OAAO,MAAM,EAAE,CAAC,UAAU,EAAE;AAC9B;;;;;;;"}
1
+ {"version":3,"file":"lazy.cjs","sources":["../../src/components/lazy.ts"],"sourcesContent":["/**\n * use-scroll-animate/components/lazy — lazy, per-category registration (v2.9).\n *\n * `lazyDefine()` scans the page (and watches it with a MutationObserver) for\n * `<usa-*>` tags that are not registered yet and dynamically imports only the\n * categories they belong to. Bundlers split each category into its own chunk,\n * so a page that only uses `<usa-button>` loads just the click category.\n *\n * ```js\n * import { lazyDefine } from 'use-scroll-animate/components/lazy';\n * lazyDefine(); // returns a stop() function\n * ```\n */\nimport { COMPONENT_CATEGORIES, type ComponentCategory } from './index-tags';\n\nconst LOADERS: Record<ComponentCategory, () => Promise<Record<string, any>>> = {\n reveal: () => import('./reveal/index'),\n text: () => import('./text/index'),\n interaction: () => import('./interaction/index'),\n feedback: () => import('./feedback/index'),\n background: () => import('./background/index'),\n transitions: () => import('./transitions/index'),\n physics: () => import('./physics/index'),\n cards: () => import('./cards/index'),\n click: () => import('./click/index'),\n ui: () => import('./ui/index'),\n page: () => import('./page/index'),\n timeline: () => import('./timeline/index'),\n gesture: () => import('./gesture/index'),\n svg: () => import('./svg/index'),\n webgl: () => import('./webgl/index'),\n depth: () => import('./depth/index'),\n layout: () => import('./layout/index'),\n packs: () => import('./packs/index'),\n fx: () => import('./fx/index'),\n};\n\nconst TAG_TO_CAT = new Map<string, ComponentCategory>();\nfor (const [cat, tags] of Object.entries(COMPONENT_CATEGORIES)) for (const t of tags) TAG_TO_CAT.set(t, cat as ComponentCategory);\nconst loaded = new Map<ComponentCategory, Promise<void>>();\n\n/** Category of a tag (`usa-button` → `click`), or `null`. */\nexport const categoryOfTag = (tag: string): ComponentCategory | null => TAG_TO_CAT.get(tag.toLowerCase()) ?? null;\n\n/** Load and register one category (once). */\nexport function loadCategory(cat: ComponentCategory): Promise<void> {\n let p = loaded.get(cat);\n if (!p) {\n p = LOADERS[cat]().then((m) => {\n const fn = Object.keys(m).find((k) => /^define[A-Z]\\w*Components$/.test(k));\n if (fn) m[fn]();\n });\n loaded.set(cat, p);\n }\n return p;\n}\n\n/** Register the categories needed by the `<usa-*>` tags under `root`. Resolves when they are defined. */\nexport async function defineUsed(root: ParentNode = document): Promise<ComponentCategory[]> {\n if (typeof customElements === 'undefined') return [];\n const cats = new Set<ComponentCategory>();\n const scan = (el: Element) => {\n const c = el.localName.startsWith('usa-') && !customElements.get(el.localName) ? categoryOfTag(el.localName) : null;\n if (c) cats.add(c);\n };\n if ((root as Element).localName) scan(root as Element);\n root.querySelectorAll('*').forEach(scan);\n await Promise.all([...cats].map(loadCategory));\n return [...cats];\n}\n\n/** `defineUsed()` now and whenever new `<usa-*>` elements are added. Returns a stop function. */\nexport function lazyDefine(root: ParentNode = typeof document !== 'undefined' ? document : (undefined as any)): () => void {\n if (!root || typeof MutationObserver === 'undefined') return () => undefined;\n defineUsed(root);\n const mo = new MutationObserver((records) => {\n for (const r of records) r.addedNodes.forEach((n) => n.nodeType === 1 && defineUsed(n as Element));\n });\n mo.observe(root as Node, { childList: true, subtree: true });\n return () => mo.disconnect();\n}\n"],"names":["COMPONENT_CATEGORIES"],"mappings":";;;;AAAA;;;;;;;;;;;;AAYG;AAGH,MAAM,OAAO,GAAkE;AAC7E,IAAA,MAAM,EAAE,MAAM,oDAAO,cAAgB,KAAC;AACtC,IAAA,IAAI,EAAE,MAAM,oDAAO,YAAc,KAAC;AAClC,IAAA,WAAW,EAAE,MAAM,oDAAO,mBAAqB,KAAC;AAChD,IAAA,QAAQ,EAAE,MAAM,oDAAO,gBAAkB,KAAC;AAC1C,IAAA,UAAU,EAAE,MAAM,oDAAO,kBAA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AAmB,OAAO,QAAQ,KAAK,WAAW,GAAG,QAAQ,GAAI,SAAiB,EAAA;AAC3G,IAAA,IAAI,CAAC,IAAI,IAAI,OAAO,gBAAgB,KAAK,WAAW;AAAE,QAAA,OAAO,MAAM,SAAS;IAC5E,UAAU,CAAC,IAAI,CAAC;IAChB,MAAM,EAAE,GAAG,IAAI,gBAAgB,CAAC,CAAC,OAAO,KAAI;QAC1C,KAAK,MAAM,CAAC,IAAI,OAAO;YAAE,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,KAAK,CAAC,IAAI,UAAU,CAAC,CAAY,CAAC,CAAC;AACpG,IAAA,CAAC,CAAC;AACF,IAAA,EAAE,CAAC,OAAO,CAAC,IAAY,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC5D,IAAA,OAAO,MAAM,EAAE,CAAC,UAAU,EAAE;AAC9B;;;;;;;"}
@@ -18,6 +18,7 @@ declare const COMPONENT_CATEGORIES: {
18
18
  readonly depth: readonly ["usa-cube", "usa-depth"];
19
19
  readonly layout: readonly ["usa-auto-animate", "usa-masonry"];
20
20
  readonly packs: readonly ["usa-pack"];
21
+ readonly fx: readonly ["usa-fx"];
21
22
  };
22
23
  type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;
23
24
 
@@ -18,6 +18,7 @@ declare const COMPONENT_CATEGORIES: {
18
18
  readonly depth: readonly ["usa-cube", "usa-depth"];
19
19
  readonly layout: readonly ["usa-auto-animate", "usa-masonry"];
20
20
  readonly packs: readonly ["usa-pack"];
21
+ readonly fx: readonly ["usa-fx"];
21
22
  };
22
23
  type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;
23
24
 
@@ -1,4 +1,4 @@
1
- import { C as COMPONENT_CATEGORIES } from '../chunks/index-tags-Dh8nwXqw.js';
1
+ import { C as COMPONENT_CATEGORIES } from '../chunks/index-tags-DucKMQr_.js';
2
2
 
3
3
  /**
4
4
  * use-scroll-animate/components/lazy — lazy, per-category registration (v2.9).
@@ -32,6 +32,7 @@ const LOADERS = {
32
32
  depth: () => import('./depth.js'),
33
33
  layout: () => import('./layout.js'),
34
34
  packs: () => import('./packs.js'),
35
+ fx: () => import('./fx.js'),
35
36
  };
36
37
  const TAG_TO_CAT = new Map();
37
38
  for (const [cat, tags] of Object.entries(COMPONENT_CATEGORIES))
@@ -1 +1 @@
1
- {"version":3,"file":"lazy.js","sources":["../../src/components/lazy.ts"],"sourcesContent":["/**\n * use-scroll-animate/components/lazy — lazy, per-category registration (v2.9).\n *\n * `lazyDefine()` scans the page (and watches it with a MutationObserver) for\n * `<usa-*>` tags that are not registered yet and dynamically imports only the\n * categories they belong to. Bundlers split each category into its own chunk,\n * so a page that only uses `<usa-button>` loads just the click category.\n *\n * ```js\n * import { lazyDefine } from 'use-scroll-animate/components/lazy';\n * lazyDefine(); // returns a stop() function\n * ```\n */\nimport { COMPONENT_CATEGORIES, type ComponentCategory } from './index-tags';\n\nconst LOADERS: Record<ComponentCategory, () => Promise<Record<string, any>>> = {\n reveal: () => import('./reveal/index'),\n text: () => import('./text/index'),\n interaction: () => import('./interaction/index'),\n feedback: () => import('./feedback/index'),\n background: () => import('./background/index'),\n transitions: () => import('./transitions/index'),\n physics: () => import('./physics/index'),\n cards: () => import('./cards/index'),\n click: () => import('./click/index'),\n ui: () => import('./ui/index'),\n page: () => import('./page/index'),\n timeline: () => import('./timeline/index'),\n gesture: () => import('./gesture/index'),\n svg: () => import('./svg/index'),\n webgl: () => import('./webgl/index'),\n depth: () => import('./depth/index'),\n layout: () => import('./layout/index'),\n packs: () => import('./packs/index'),\n};\n\nconst TAG_TO_CAT = new Map<string, ComponentCategory>();\nfor (const [cat, tags] of Object.entries(COMPONENT_CATEGORIES)) for (const t of tags) TAG_TO_CAT.set(t, cat as ComponentCategory);\nconst loaded = new Map<ComponentCategory, Promise<void>>();\n\n/** Category of a tag (`usa-button` → `click`), or `null`. */\nexport const categoryOfTag = (tag: string): ComponentCategory | null => TAG_TO_CAT.get(tag.toLowerCase()) ?? null;\n\n/** Load and register one category (once). */\nexport function loadCategory(cat: ComponentCategory): Promise<void> {\n let p = loaded.get(cat);\n if (!p) {\n p = LOADERS[cat]().then((m) => {\n const fn = Object.keys(m).find((k) => /^define[A-Z]\\w*Components$/.test(k));\n if (fn) m[fn]();\n });\n loaded.set(cat, p);\n }\n return p;\n}\n\n/** Register the categories needed by the `<usa-*>` tags under `root`. Resolves when they are defined. */\nexport async function defineUsed(root: ParentNode = document): Promise<ComponentCategory[]> {\n if (typeof customElements === 'undefined') return [];\n const cats = new Set<ComponentCategory>();\n const scan = (el: Element) => {\n const c = el.localName.startsWith('usa-') && !customElements.get(el.localName) ? categoryOfTag(el.localName) : null;\n if (c) cats.add(c);\n };\n if ((root as Element).localName) scan(root as Element);\n root.querySelectorAll('*').forEach(scan);\n await Promise.all([...cats].map(loadCategory));\n return [...cats];\n}\n\n/** `defineUsed()` now and whenever new `<usa-*>` elements are added. Returns a stop function. */\nexport function lazyDefine(root: ParentNode = typeof document !== 'undefined' ? document : (undefined as any)): () => void {\n if (!root || typeof MutationObserver === 'undefined') return () => undefined;\n defineUsed(root);\n const mo = new MutationObserver((records) => {\n for (const r of records) r.addedNodes.forEach((n) => n.nodeType === 1 && defineUsed(n as Element));\n });\n mo.observe(root as Node, { childList: true, subtree: true });\n return () => mo.disconnect();\n}\n"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;AAYG;AAGH,MAAM,OAAO,GAAkE;AAC7E,IAAA,MAAM,EAAE,MAAM,OAAO,aAAgB,CAAC;AACtC,IAAA,IAAI,EAAE,MAAM,OAAO,WAAc,CAAC;AAClC,IAAA,WAAW,EAAE,MAAM,OAAO,kBAAqB,CAAC;AAChD,IAAA,QAAQ,EAAE,MAAM,OAAO,eAAkB,CAAC;AAC1C,IAAA,UAAU,EAAE,MAAM,OAAO,iBAAoB,CAAC;AAC9C,IAAA,WAAW,EAAE,MAAM,O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AAgB,KAAK,WAAW;AAAE,QAAA,OAAO,MAAM,SAAS;IAC5E,UAAU,CAAC,IAAI,CAAC;IAChB,MAAM,EAAE,GAAG,IAAI,gBAAgB,CAAC,CAAC,OAAO,KAAI;QAC1C,KAAK,MAAM,CAAC,IAAI,OAAO;YAAE,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,KAAK,CAAC,IAAI,UAAU,CAAC,CAAY,CAAC,CAAC;AACpG,IAAA,CAAC,CAAC;AACF,IAAA,EAAE,CAAC,OAAO,CAAC,IAAY,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC5D,IAAA,OAAO,MAAM,EAAE,CAAC,UAAU,EAAE;AAC9B;;;;"}
1
+ {"version":3,"file":"lazy.js","sources":["../../src/components/lazy.ts"],"sourcesContent":["/**\n * use-scroll-animate/components/lazy — lazy, per-category registration (v2.9).\n *\n * `lazyDefine()` scans the page (and watches it with a MutationObserver) for\n * `<usa-*>` tags that are not registered yet and dynamically imports only the\n * categories they belong to. Bundlers split each category into its own chunk,\n * so a page that only uses `<usa-button>` loads just the click category.\n *\n * ```js\n * import { lazyDefine } from 'use-scroll-animate/components/lazy';\n * lazyDefine(); // returns a stop() function\n * ```\n */\nimport { COMPONENT_CATEGORIES, type ComponentCategory } from './index-tags';\n\nconst LOADERS: Record<ComponentCategory, () => Promise<Record<string, any>>> = {\n reveal: () => import('./reveal/index'),\n text: () => import('./text/index'),\n interaction: () => import('./interaction/index'),\n feedback: () => import('./feedback/index'),\n background: () => import('./background/index'),\n transitions: () => import('./transitions/index'),\n physics: () => import('./physics/index'),\n cards: () => import('./cards/index'),\n click: () => import('./click/index'),\n ui: () => import('./ui/index'),\n page: () => import('./page/index'),\n timeline: () => import('./timeline/index'),\n gesture: () => import('./gesture/index'),\n svg: () => import('./svg/index'),\n webgl: () => import('./webgl/index'),\n depth: () => import('./depth/index'),\n layout: () => import('./layout/index'),\n packs: () => import('./packs/index'),\n fx: () => import('./fx/index'),\n};\n\nconst TAG_TO_CAT = new Map<string, ComponentCategory>();\nfor (const [cat, tags] of Object.entries(COMPONENT_CATEGORIES)) for (const t of tags) TAG_TO_CAT.set(t, cat as ComponentCategory);\nconst loaded = new Map<ComponentCategory, Promise<void>>();\n\n/** Category of a tag (`usa-button` → `click`), or `null`. */\nexport const categoryOfTag = (tag: string): ComponentCategory | null => TAG_TO_CAT.get(tag.toLowerCase()) ?? null;\n\n/** Load and register one category (once). */\nexport function loadCategory(cat: ComponentCategory): Promise<void> {\n let p = loaded.get(cat);\n if (!p) {\n p = LOADERS[cat]().then((m) => {\n const fn = Object.keys(m).find((k) => /^define[A-Z]\\w*Components$/.test(k));\n if (fn) m[fn]();\n });\n loaded.set(cat, p);\n }\n return p;\n}\n\n/** Register the categories needed by the `<usa-*>` tags under `root`. Resolves when they are defined. */\nexport async function defineUsed(root: ParentNode = document): Promise<ComponentCategory[]> {\n if (typeof customElements === 'undefined') return [];\n const cats = new Set<ComponentCategory>();\n const scan = (el: Element) => {\n const c = el.localName.startsWith('usa-') && !customElements.get(el.localName) ? categoryOfTag(el.localName) : null;\n if (c) cats.add(c);\n };\n if ((root as Element).localName) scan(root as Element);\n root.querySelectorAll('*').forEach(scan);\n await Promise.all([...cats].map(loadCategory));\n return [...cats];\n}\n\n/** `defineUsed()` now and whenever new `<usa-*>` elements are added. Returns a stop function. */\nexport function lazyDefine(root: ParentNode = typeof document !== 'undefined' ? document : (undefined as any)): () => void {\n if (!root || typeof MutationObserver === 'undefined') return () => undefined;\n defineUsed(root);\n const mo = new MutationObserver((records) => {\n for (const r of records) r.addedNodes.forEach((n) => n.nodeType === 1 && defineUsed(n as Element));\n });\n mo.observe(root as Node, { childList: true, subtree: true });\n return () => mo.disconnect();\n}\n"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;AAYG;AAGH,MAAM,OAAO,GAAkE;AAC7E,IAAA,MAAM,EAAE,MAAM,OA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