use-scroll-animate 4.9.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 (220) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +2 -1
  3. package/README_ja.md +1 -0
  4. package/README_zh.md +2 -1
  5. package/dist/chunks/{base-BvpQ4Ggj.cjs → base-B5i8qQPR.cjs} +46 -40
  6. package/dist/chunks/base-B5i8qQPR.cjs.map +1 -0
  7. package/dist/chunks/{base-DbbRUxaa.js → base-C3Sw9sAO.js} +46 -41
  8. package/dist/chunks/base-C3Sw9sAO.js.map +1 -0
  9. package/dist/chunks/{core-BWO7JKJ5.cjs → core-BDcszY4L.cjs} +2 -2
  10. package/dist/chunks/{core-BWO7JKJ5.cjs.map → core-BDcszY4L.cjs.map} +1 -1
  11. package/dist/chunks/{core-CcaSsbV8.js → core-BTf__I-8.js} +2 -2
  12. package/dist/chunks/{core-CcaSsbV8.js.map → core-BTf__I-8.js.map} +1 -1
  13. package/dist/chunks/{core-CCAM3nKw.cjs → core-BjOYKSrV.cjs} +2 -2
  14. package/dist/chunks/{core-CCAM3nKw.cjs.map → core-BjOYKSrV.cjs.map} +1 -1
  15. package/dist/chunks/{core-BVTuet9o.js → core-DN3hHbHh.js} +2 -2
  16. package/dist/chunks/{core-BVTuet9o.js.map → core-DN3hHbHh.js.map} +1 -1
  17. package/dist/chunks/fx-B8hk1Fby.cjs +114 -0
  18. package/dist/chunks/fx-B8hk1Fby.cjs.map +1 -0
  19. package/dist/chunks/fx-ChjxrMBo.js +109 -0
  20. package/dist/chunks/fx-ChjxrMBo.js.map +1 -0
  21. package/dist/chunks/{index-tags-Dh8nwXqw.js → index-tags-DucKMQr_.js} +2 -1
  22. package/dist/chunks/{index-tags-Dh8nwXqw.js.map → index-tags-DucKMQr_.js.map} +1 -1
  23. package/dist/chunks/{index-tags-CIRY2KnU.cjs → index-tags-wv0R_vkO.cjs} +2 -1
  24. package/dist/chunks/{index-tags-CIRY2KnU.cjs.map → index-tags-wv0R_vkO.cjs.map} +1 -1
  25. package/dist/chunks/{spring-fFkqE9J0.cjs → spring--oZh55tB.cjs} +2 -2
  26. package/dist/chunks/{spring-fFkqE9J0.cjs.map → spring--oZh55tB.cjs.map} +1 -1
  27. package/dist/chunks/{spring-B6w7mVCU.js → spring-CckMe3x0.js} +2 -2
  28. package/dist/chunks/{spring-B6w7mVCU.js.map → spring-CckMe3x0.js.map} +1 -1
  29. package/dist/chunks/{variants-Cal4DB0E.js → variants-Bsevy6Xm.js} +2 -2
  30. package/dist/chunks/{variants-Cal4DB0E.js.map → variants-Bsevy6Xm.js.map} +1 -1
  31. package/dist/chunks/{variants-C8xj8gfd.cjs → variants-DxPmgrNX.cjs} +2 -2
  32. package/dist/chunks/{variants-C8xj8gfd.cjs.map → variants-DxPmgrNX.cjs.map} +1 -1
  33. package/dist/components/a11y.cjs +3 -2
  34. package/dist/components/a11y.cjs.map +1 -1
  35. package/dist/components/a11y.d.cts +1 -0
  36. package/dist/components/a11y.d.ts +1 -0
  37. package/dist/components/a11y.js +4 -3
  38. package/dist/components/a11y.js.map +1 -1
  39. package/dist/components/angular.cjs +8 -6
  40. package/dist/components/angular.cjs.map +1 -1
  41. package/dist/components/angular.d.cts +33 -4
  42. package/dist/components/angular.d.ts +33 -4
  43. package/dist/components/angular.js +8 -6
  44. package/dist/components/angular.js.map +1 -1
  45. package/dist/components/background.cjs +2 -4
  46. package/dist/components/background.cjs.map +1 -1
  47. package/dist/components/background.d.cts +2 -47
  48. package/dist/components/background.d.ts +2 -47
  49. package/dist/components/background.js +3 -4
  50. package/dist/components/background.js.map +1 -1
  51. package/dist/components/bridge.cjs +1 -1
  52. package/dist/components/bridge.js +1 -1
  53. package/dist/components/cards.cjs +2 -4
  54. package/dist/components/cards.cjs.map +1 -1
  55. package/dist/components/cards.d.cts +2 -47
  56. package/dist/components/cards.d.ts +2 -47
  57. package/dist/components/cards.js +2 -3
  58. package/dist/components/cards.js.map +1 -1
  59. package/dist/components/click.cjs +24 -130
  60. package/dist/components/click.cjs.map +1 -1
  61. package/dist/components/click.d.cts +2 -47
  62. package/dist/components/click.d.ts +2 -47
  63. package/dist/components/click.js +4 -109
  64. package/dist/components/click.js.map +1 -1
  65. package/dist/components/depth.cjs +3 -5
  66. package/dist/components/depth.cjs.map +1 -1
  67. package/dist/components/depth.d.cts +2 -47
  68. package/dist/components/depth.d.ts +2 -47
  69. package/dist/components/depth.js +3 -4
  70. package/dist/components/depth.js.map +1 -1
  71. package/dist/components/feedback.cjs +1 -3
  72. package/dist/components/feedback.cjs.map +1 -1
  73. package/dist/components/feedback.d.cts +2 -47
  74. package/dist/components/feedback.d.ts +2 -47
  75. package/dist/components/feedback.js +1 -2
  76. package/dist/components/feedback.js.map +1 -1
  77. package/dist/components/fx.cjs +285 -0
  78. package/dist/components/fx.cjs.map +1 -0
  79. package/dist/components/fx.css +3 -0
  80. package/dist/components/fx.d.cts +114 -0
  81. package/dist/components/fx.d.ts +114 -0
  82. package/dist/components/fx.js +271 -0
  83. package/dist/components/fx.js.map +1 -0
  84. package/dist/components/gesture.cjs +3 -5
  85. package/dist/components/gesture.cjs.map +1 -1
  86. package/dist/components/gesture.d.cts +2 -47
  87. package/dist/components/gesture.d.ts +2 -47
  88. package/dist/components/gesture.js +4 -5
  89. package/dist/components/gesture.js.map +1 -1
  90. package/dist/components/interaction.cjs +1 -3
  91. package/dist/components/interaction.cjs.map +1 -1
  92. package/dist/components/interaction.d.cts +2 -47
  93. package/dist/components/interaction.d.ts +2 -47
  94. package/dist/components/interaction.js +1 -2
  95. package/dist/components/interaction.js.map +1 -1
  96. package/dist/components/jsx.d.cts +1 -0
  97. package/dist/components/jsx.d.ts +1 -0
  98. package/dist/components/layout.cjs +1 -3
  99. package/dist/components/layout.cjs.map +1 -1
  100. package/dist/components/layout.d.cts +2 -47
  101. package/dist/components/layout.d.ts +2 -47
  102. package/dist/components/layout.js +2 -3
  103. package/dist/components/layout.js.map +1 -1
  104. package/dist/components/lazy.cjs +2 -1
  105. package/dist/components/lazy.cjs.map +1 -1
  106. package/dist/components/lazy.d.cts +1 -0
  107. package/dist/components/lazy.d.ts +1 -0
  108. package/dist/components/lazy.js +2 -1
  109. package/dist/components/lazy.js.map +1 -1
  110. package/dist/components/lite.cjs +362 -64
  111. package/dist/components/lite.cjs.map +1 -1
  112. package/dist/components/lite.js +345 -65
  113. package/dist/components/lite.js.map +1 -1
  114. package/dist/components/packs.cjs +1 -3
  115. package/dist/components/packs.cjs.map +1 -1
  116. package/dist/components/packs.d.cts +2 -47
  117. package/dist/components/packs.d.ts +2 -47
  118. package/dist/components/packs.js +2 -3
  119. package/dist/components/packs.js.map +1 -1
  120. package/dist/components/page.cjs +33 -22
  121. package/dist/components/page.cjs.map +1 -1
  122. package/dist/components/page.d.cts +15 -52
  123. package/dist/components/page.d.ts +15 -52
  124. package/dist/components/page.js +33 -22
  125. package/dist/components/page.js.map +1 -1
  126. package/dist/components/perf.cjs +3 -4
  127. package/dist/components/perf.cjs.map +1 -1
  128. package/dist/components/perf.d.cts +1 -0
  129. package/dist/components/perf.d.ts +1 -0
  130. package/dist/components/perf.js +4 -5
  131. package/dist/components/perf.js.map +1 -1
  132. package/dist/components/physics.cjs +2 -4
  133. package/dist/components/physics.cjs.map +1 -1
  134. package/dist/components/physics.d.cts +2 -47
  135. package/dist/components/physics.d.ts +2 -47
  136. package/dist/components/physics.js +3 -4
  137. package/dist/components/physics.js.map +1 -1
  138. package/dist/components/react.cjs +1 -1
  139. package/dist/components/react.js +1 -1
  140. package/dist/components/reveal.cjs +1 -3
  141. package/dist/components/reveal.cjs.map +1 -1
  142. package/dist/components/reveal.d.cts +2 -47
  143. package/dist/components/reveal.d.ts +2 -47
  144. package/dist/components/reveal.js +1 -2
  145. package/dist/components/reveal.js.map +1 -1
  146. package/dist/components/solid.cjs +8 -6
  147. package/dist/components/solid.cjs.map +1 -1
  148. package/dist/components/solid.d.cts +33 -4
  149. package/dist/components/solid.d.ts +33 -4
  150. package/dist/components/solid.js +8 -6
  151. package/dist/components/solid.js.map +1 -1
  152. package/dist/components/svelte.cjs +8 -6
  153. package/dist/components/svelte.cjs.map +1 -1
  154. package/dist/components/svelte.d.cts +33 -4
  155. package/dist/components/svelte.d.ts +33 -4
  156. package/dist/components/svelte.js +8 -6
  157. package/dist/components/svelte.js.map +1 -1
  158. package/dist/components/svg.cjs +1 -3
  159. package/dist/components/svg.cjs.map +1 -1
  160. package/dist/components/svg.d.cts +2 -47
  161. package/dist/components/svg.d.ts +2 -47
  162. package/dist/components/svg.js +2 -3
  163. package/dist/components/svg.js.map +1 -1
  164. package/dist/components/text.cjs +2 -4
  165. package/dist/components/text.cjs.map +1 -1
  166. package/dist/components/text.d.cts +2 -47
  167. package/dist/components/text.d.ts +2 -47
  168. package/dist/components/text.js +2 -3
  169. package/dist/components/text.js.map +1 -1
  170. package/dist/components/timeline.cjs +3 -7
  171. package/dist/components/timeline.cjs.map +1 -1
  172. package/dist/components/timeline.d.cts +4 -49
  173. package/dist/components/timeline.d.ts +4 -49
  174. package/dist/components/timeline.js +4 -7
  175. package/dist/components/timeline.js.map +1 -1
  176. package/dist/components/transitions.cjs +1 -3
  177. package/dist/components/transitions.cjs.map +1 -1
  178. package/dist/components/transitions.d.cts +2 -47
  179. package/dist/components/transitions.d.ts +2 -47
  180. package/dist/components/transitions.js +2 -3
  181. package/dist/components/transitions.js.map +1 -1
  182. package/dist/components/ui.cjs +3 -5
  183. package/dist/components/ui.cjs.map +1 -1
  184. package/dist/components/ui.d.cts +2 -47
  185. package/dist/components/ui.d.ts +2 -47
  186. package/dist/components/ui.js +4 -5
  187. package/dist/components/ui.js.map +1 -1
  188. package/dist/components/vue.cjs +8 -6
  189. package/dist/components/vue.cjs.map +1 -1
  190. package/dist/components/vue.d.cts +33 -4
  191. package/dist/components/vue.d.ts +33 -4
  192. package/dist/components/vue.js +8 -6
  193. package/dist/components/vue.js.map +1 -1
  194. package/dist/components/webgl.cjs +3 -5
  195. package/dist/components/webgl.cjs.map +1 -1
  196. package/dist/components/webgl.d.cts +2 -47
  197. package/dist/components/webgl.d.ts +2 -47
  198. package/dist/components/webgl.js +3 -4
  199. package/dist/components/webgl.js.map +1 -1
  200. package/dist/components.cjs +31 -10
  201. package/dist/components.cjs.map +1 -1
  202. package/dist/components.css +1 -0
  203. package/dist/components.d.cts +137 -17
  204. package/dist/components.d.ts +137 -17
  205. package/dist/components.js +15 -11
  206. package/dist/components.js.map +1 -1
  207. package/dist/components.umd.js +2 -2
  208. package/dist/components.umd.js.map +1 -1
  209. package/dist/index.cjs +2 -2
  210. package/dist/index.js +2 -2
  211. package/dist/index.umd.js +1 -1
  212. package/dist/index.umd.js.map +1 -1
  213. package/docs/API.md +1 -1
  214. package/docs/ROADMAP.md +12 -12
  215. package/docs/components.md +14 -1
  216. package/docs/performance.md +1 -1
  217. package/docs/upgrading-5.md +2 -2
  218. package/package.json +14 -3
  219. package/dist/chunks/base-BvpQ4Ggj.cjs.map +0 -1
  220. package/dist/chunks/base-DbbRUxaa.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var base = require('../chunks/base-BvpQ4Ggj.cjs');
3
+ var base = require('../chunks/base-B5i8qQPR.cjs');
4
4
 
5
5
  const anim = (el, frames, o) => {
6
6
  if (typeof el.animate !== 'function')
@@ -182,8 +182,6 @@ function definePacksComponents() {
182
182
  definePack();
183
183
  }
184
184
 
185
- exports.configureComponents = base.configureComponents;
186
- exports.prefersReducedMotion = base.prefersReducedMotion;
187
185
  exports.PACKS = PACKS;
188
186
  exports.PACK_PRIMITIVES = PACK_PRIMITIVES;
189
187
  exports.applyPack = applyPack;
@@ -1 +1 @@
1
- {"version":3,"file":"packs.cjs","sources":["../../src/components/packs/core.ts","../../src/components/packs/pack-el.ts","../../src/components/packs/index.ts"],"sourcesContent":["import { prefersReducedMotion, motionScale, EASE_OUT, EASE_SPRING, raf, now, clamp } from '../base';\n\ntype Cleanup = () => void;\n/** A pack primitive: wire one element, return a cleanup. */\ntype Effect = (el: HTMLElement, ctx: PackContext) => Cleanup | void;\n\nexport interface PackContext {\n root: HTMLElement;\n /** Index of the element among those with the same role (for staggering). */\n index: number;\n reduced: boolean;\n}\n\nconst anim = (el: Element, frames: Keyframe[], o: KeyframeAnimationOptions): Animation | null => {\n if (typeof (el as HTMLElement).animate !== 'function') return null;\n const k = motionScale();\n return (el as HTMLElement).animate(frames, { ...o, duration: ((o.duration as number) ?? 400) * k, delay: (o.delay ?? 0) * k });\n};\nconst on = (el: EventTarget, type: string, fn: (e: any) => void): Cleanup => {\n el.addEventListener(type, fn);\n return () => el.removeEventListener(type, fn);\n};\nconst io = (el: Element, cb: () => void): Cleanup => {\n if (typeof IntersectionObserver === 'undefined') return void cb() as unknown as Cleanup;\n const o = new IntersectionObserver((es) => es.some((e) => e.isIntersecting) && (o.disconnect(), cb()), { threshold: 0.15 });\n o.observe(el);\n return () => o.disconnect();\n};\n\n/** Count `el`'s number up from 0 when it enters the view (keeps prefix / suffix / decimals). */\nexport function countUp(el: HTMLElement, duration = 1200): Cleanup {\n const text = el.textContent || '';\n const m = /(-?[\\d,]*\\.?\\d+)/.exec(text);\n if (!m || prefersReducedMotion()) return () => {};\n const target = Number(m[1].replace(/,/g, ''));\n const dec = (m[1].split('.')[1] || '').length;\n const fmt = (v: number) => text.replace(m[1], v.toLocaleString('en-US', { minimumFractionDigits: dec, maximumFractionDigits: dec }));\n el.setAttribute('aria-label', text.trim());\n el.textContent = fmt(0);\n let stop = false;\n const off = io(el, () => {\n const t0 = now();\n const d = duration * motionScale() || 1;\n const step = () => {\n if (stop) return;\n const p = clamp((now() - t0) / d, 0, 1);\n el.textContent = fmt(target * (1 - Math.pow(1 - p, 3)));\n if (p < 1) raf(step);\n };\n raf(step);\n });\n return () => {\n stop = true;\n off();\n el.textContent = text;\n };\n}\n\n/**\n * Fly a copy of `from` (e.g. a product image) into `to` (the cart icon) along\n * an arc, then bump the target. Resolves when it lands. Instant under\n * reduced motion (only the bump's state change, no flight).\n */\nexport async function flyToCart(from: Element, to: Element, o: { duration?: number } = {}): Promise<void> {\n if (prefersReducedMotion() || typeof document === 'undefined') return;\n const a = from.getBoundingClientRect();\n const b = to.getBoundingClientRect();\n const ghost = from.cloneNode(true) as HTMLElement;\n ghost.setAttribute('aria-hidden', 'true');\n Object.assign(ghost.style, { position: 'fixed', left: `${a.left}px`, top: `${a.top}px`, width: `${a.width}px`, height: `${a.height}px`, margin: '0', zIndex: '2147483000', pointerEvents: 'none' });\n document.body.appendChild(ghost);\n const dx = b.left + b.width / 2 - (a.left + a.width / 2);\n const dy = b.top + b.height / 2 - (a.top + a.height / 2);\n const f = anim(ghost, [\n { transform: 'translate(0, 0) scale(1)', opacity: 1 },\n { transform: `translate(${dx * 0.5}px, ${dy * 0.5 - 80}px) scale(0.6)`, opacity: 0.9, offset: 0.5 },\n { transform: `translate(${dx}px, ${dy}px) scale(0.15)`, opacity: 0.4 },\n ], { duration: o.duration ?? 700, easing: 'cubic-bezier(0.5, 0, 0.5, 1)' });\n await f?.finished.catch(() => undefined);\n ghost.remove();\n anim(to, [{ transform: 'scale(1)' }, { transform: 'scale(1.3)' }, { transform: 'scale(1)' }], { duration: 380, easing: EASE_SPRING });\n}\n\nconst PRIMITIVES: Record<string, Effect> = {\n reveal: (el, c) => {\n if (c.reduced) return;\n el.style.opacity = '0';\n const off = io(el, () => {\n el.style.opacity = '';\n anim(el, [{ opacity: 0, transform: 'translateY(24px)' }, { opacity: 1, transform: 'none' }], { duration: 600, delay: Math.min(c.index, 8) * 70, easing: EASE_OUT, fill: 'backwards' });\n });\n return () => (off(), (el.style.opacity = ''));\n },\n lift: (el, c) => {\n if (c.reduced) return;\n const a = on(el, 'pointerenter', () => anim(el, [{ transform: 'none' }, { transform: 'translateY(-6px) scale(1.02)' }], { duration: 220, easing: EASE_OUT, fill: 'forwards' }));\n const b = on(el, 'pointerleave', () => anim(el, [{ transform: 'translateY(-6px) scale(1.02)' }, { transform: 'none' }], { duration: 260, easing: EASE_OUT, fill: 'forwards' }));\n return () => (a(), b());\n },\n press: (el, c) => (c.reduced ? undefined : on(el, 'pointerdown', () => anim(el, [{ transform: 'scale(1)' }, { transform: 'scale(0.94)' }, { transform: 'scale(1)' }], { duration: 260, easing: EASE_SPRING }))),\n 'count-up': (el) => countUp(el),\n pulse: (el, c) => {\n if (c.reduced) return;\n const a = anim(el, [{ boxShadow: '0 0 0 0 rgba(124, 92, 255, 0.55)' }, { boxShadow: '0 0 0 14px rgba(124, 92, 255, 0)' }], { duration: 1600, iterations: Infinity });\n return () => a?.cancel();\n },\n float: (el, c) => {\n if (c.reduced) return;\n const a = anim(el, [{ transform: 'translateY(0)' }, { transform: 'translateY(-8px)' }, { transform: 'translateY(0)' }], { duration: 3000, delay: c.index * 300, iterations: Infinity, easing: 'ease-in-out' });\n return () => a?.cancel();\n },\n shake: (el, c) => (c.reduced ? undefined : on(el, 'click', () => anim(el, [0, -8, 8, -6, 6, -3, 0].map((x) => ({ transform: `translateX(${x}px)` })), { duration: 420 }))),\n bump: (el, c) => (c.reduced ? undefined : on(el, 'usa:bump', () => anim(el, [{ transform: 'scale(1)' }, { transform: 'scale(1.25)' }, { transform: 'scale(1)' }], { duration: 360, easing: EASE_SPRING }))),\n 'fly-to-cart': (el, c) =>\n on(el, 'click', () => {\n const cart = c.root.querySelector('[data-role=\"cart\"]') || document.querySelector('[data-role=\"cart\"]');\n const item = el.closest('[data-role=\"product\"]')?.querySelector('img, [data-role=\"thumb\"]') || el;\n if (cart) void flyToCart(item, cart).then(() => cart.dispatchEvent(new CustomEvent('usa:added', { bubbles: true })));\n }),\n};\n\n/** The five effect packs: `data-role` → primitives. */\nexport const PACKS: Record<string, Record<string, string[]>> = {\n ecommerce: { product: ['reveal', 'lift'], 'add-to-cart': ['press', 'fly-to-cart'], cart: ['bump'], price: ['count-up'], badge: ['pulse'] },\n portfolio: { project: ['reveal', 'lift'], heading: ['reveal'], stat: ['count-up'], contact: ['press', 'pulse'] },\n dashboard: { card: ['reveal'], stat: ['count-up'], alert: ['pulse'], action: ['press'] },\n game: { button: ['press'], score: ['count-up', 'bump'], item: ['float'], hit: ['shake'], reward: ['pulse'] },\n landing: { hero: ['reveal'], feature: ['reveal', 'lift'], cta: ['press', 'pulse'], logo: ['float'], stat: ['count-up'] },\n};\n\nexport type PackName = keyof typeof PACKS;\n\n/**\n * Apply an effect pack to `root`: every descendant with a `data-role` the\n * pack knows gets its effects (staggered by index). Returns an undo function.\n * Reduced motion: only non-motion behaviour (e.g. the cart event) remains.\n *\n * @example\n * applyPack('ecommerce', document.querySelector('main'));\n * // <article data-role=\"product\">… <button data-role=\"add-to-cart\"> … <a data-role=\"cart\">\n */\nexport function applyPack(name: PackName | string, root: HTMLElement | Document = document): Cleanup {\n const pack = PACKS[name];\n if (!pack || typeof document === 'undefined') return () => {};\n const r = (root as Document).documentElement ? (root as Document).body : (root as HTMLElement);\n const reduced = prefersReducedMotion();\n const cleanups: Cleanup[] = [];\n for (const [role, fx] of Object.entries(pack)) {\n r.querySelectorAll<HTMLElement>(`[data-role=\"${role}\"]`).forEach((el, index) => {\n for (const f of fx) {\n const c = PRIMITIVES[f]?.(el, { root: r, index, reduced });\n if (c) cleanups.push(c);\n }\n });\n }\n return () => cleanups.splice(0).forEach((c) => c());\n}\n\n/** Primitive names a pack uses (for docs / tooling). */\nexport const PACK_PRIMITIVES = Object.keys(PRIMITIVES);\n","import { defineElement, type UsaElement } from '../base';\nimport { applyPack, PACKS } from './core';\n\n/**\n * `<usa-pack name=\"ecommerce\">` — applies an effect pack (`ecommerce` ·\n * `portfolio` · `dashboard` · `game` · `landing`) to its subtree:\n * descendants opt in with `data-role` (see `PACKS`). Re-applies when\n * `name` changes; undone on disconnect.\n */\nexport interface UsaPackElement extends UsaElement {\n readonly roles: string[];\n}\n\nexport function definePack(tag = 'usa-pack'): CustomElementConstructor | undefined {\n return defineElement(tag, (Base) =>\n class UsaPack extends Base {\n static get observedAttributes(): string[] {\n return ['name'];\n }\n get roles(): string[] {\n return Object.keys(PACKS[this.str('name', 'landing')] || {});\n }\n mount(): void {\n this.style.display ||= 'block';\n this.onCleanup(applyPack(this.str('name', 'landing'), this));\n }\n }\n );\n}\n","/**\n * use-scroll-animate/components/packs — effect packs (v3.9).\n * Ready-made motion for e-commerce, portfolio, dashboard, game UI and\n * landing pages: mark elements with `data-role` and apply a pack with\n * `<usa-pack name=\"…\">` or `applyPack(name, root)`. Includes `flyToCart()`\n * and `countUp()`.\n */\nimport { definePack, type UsaPackElement } from './pack-el';\n\nexport { definePack };\nexport { applyPack, flyToCart, countUp, PACKS, PACK_PRIMITIVES } from './core';\nexport type { PackName, PackContext } from './core';\nexport type { UsaPackElement };\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 definePacksComponents(): void {\n definePack();\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'usa-pack': UsaPackElement;\n }\n}\n"],"names":["motionScale","prefersReducedMotion","now","clamp","raf","EASE_SPRING","EASE_OUT","defineElement"],"mappings":";;;;AAaA,MAAM,IAAI,GAAG,CAAC,EAAW,EAAE,MAAkB,EAAE,CAA2B,KAAsB;AAC9F,IAAA,IAAI,OAAQ,EAAkB,CAAC,OAAO,KAAK,UAAU;AAAE,QAAA,OAAO,IAAI;AAClE,IAAA,MAAM,CAAC,GAAGA,gBAAW,EAAE;AACvB,IAAA,OAAQ,EAAkB,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,QAAQ,EAAE,CAAE,CAAC,CAAC,QAAmB,IAAI,GAAG,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AAChI,CAAC;AACD,MAAM,EAAE,GAAG,CAAC,EAAe,EAAE,IAAY,EAAE,EAAoB,KAAa;AAC1E,IAAA,EAAE,CAAC,gBAAgB,CAAC,IA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A;;;;;;AAMG;AAUH;SACgB,qBAAqB,GAAA;AACnC,IAAA,UAAU,EAAE;AACd;;;;;;;;;;;;"}
1
+ {"version":3,"file":"packs.cjs","sources":["../../src/components/packs/core.ts","../../src/components/packs/pack-el.ts","../../src/components/packs/index.ts"],"sourcesContent":["import { prefersReducedMotion, motionScale, EASE_OUT, EASE_SPRING, raf, now, clamp } from '../base';\n\ntype Cleanup = () => void;\n/** A pack primitive: wire one element, return a cleanup. */\ntype Effect = (el: HTMLElement, ctx: PackContext) => Cleanup | void;\n\nexport interface PackContext {\n root: HTMLElement;\n /** Index of the element among those with the same role (for staggering). */\n index: number;\n reduced: boolean;\n}\n\nconst anim = (el: Element, frames: Keyframe[], o: KeyframeAnimationOptions): Animation | null => {\n if (typeof (el as HTMLElement).animate !== 'function') return null;\n const k = motionScale();\n return (el as HTMLElement).animate(frames, { ...o, duration: ((o.duration as number) ?? 400) * k, delay: (o.delay ?? 0) * k });\n};\nconst on = (el: EventTarget, type: string, fn: (e: any) => void): Cleanup => {\n el.addEventListener(type, fn);\n return () => el.removeEventListener(type, fn);\n};\nconst io = (el: Element, cb: () => void): Cleanup => {\n if (typeof IntersectionObserver === 'undefined') return void cb() as unknown as Cleanup;\n const o = new IntersectionObserver((es) => es.some((e) => e.isIntersecting) && (o.disconnect(), cb()), { threshold: 0.15 });\n o.observe(el);\n return () => o.disconnect();\n};\n\n/** Count `el`'s number up from 0 when it enters the view (keeps prefix / suffix / decimals). */\nexport function countUp(el: HTMLElement, duration = 1200): Cleanup {\n const text = el.textContent || '';\n const m = /(-?[\\d,]*\\.?\\d+)/.exec(text);\n if (!m || prefersReducedMotion()) return () => {};\n const target = Number(m[1].replace(/,/g, ''));\n const dec = (m[1].split('.')[1] || '').length;\n const fmt = (v: number) => text.replace(m[1], v.toLocaleString('en-US', { minimumFractionDigits: dec, maximumFractionDigits: dec }));\n el.setAttribute('aria-label', text.trim());\n el.textContent = fmt(0);\n let stop = false;\n const off = io(el, () => {\n const t0 = now();\n const d = duration * motionScale() || 1;\n const step = () => {\n if (stop) return;\n const p = clamp((now() - t0) / d, 0, 1);\n el.textContent = fmt(target * (1 - Math.pow(1 - p, 3)));\n if (p < 1) raf(step);\n };\n raf(step);\n });\n return () => {\n stop = true;\n off();\n el.textContent = text;\n };\n}\n\n/**\n * Fly a copy of `from` (e.g. a product image) into `to` (the cart icon) along\n * an arc, then bump the target. Resolves when it lands. Instant under\n * reduced motion (only the bump's state change, no flight).\n */\nexport async function flyToCart(from: Element, to: Element, o: { duration?: number } = {}): Promise<void> {\n if (prefersReducedMotion() || typeof document === 'undefined') return;\n const a = from.getBoundingClientRect();\n const b = to.getBoundingClientRect();\n const ghost = from.cloneNode(true) as HTMLElement;\n ghost.setAttribute('aria-hidden', 'true');\n Object.assign(ghost.style, { position: 'fixed', left: `${a.left}px`, top: `${a.top}px`, width: `${a.width}px`, height: `${a.height}px`, margin: '0', zIndex: '2147483000', pointerEvents: 'none' });\n document.body.appendChild(ghost);\n const dx = b.left + b.width / 2 - (a.left + a.width / 2);\n const dy = b.top + b.height / 2 - (a.top + a.height / 2);\n const f = anim(ghost, [\n { transform: 'translate(0, 0) scale(1)', opacity: 1 },\n { transform: `translate(${dx * 0.5}px, ${dy * 0.5 - 80}px) scale(0.6)`, opacity: 0.9, offset: 0.5 },\n { transform: `translate(${dx}px, ${dy}px) scale(0.15)`, opacity: 0.4 },\n ], { duration: o.duration ?? 700, easing: 'cubic-bezier(0.5, 0, 0.5, 1)' });\n await f?.finished.catch(() => undefined);\n ghost.remove();\n anim(to, [{ transform: 'scale(1)' }, { transform: 'scale(1.3)' }, { transform: 'scale(1)' }], { duration: 380, easing: EASE_SPRING });\n}\n\nconst PRIMITIVES: Record<string, Effect> = {\n reveal: (el, c) => {\n if (c.reduced) return;\n el.style.opacity = '0';\n const off = io(el, () => {\n el.style.opacity = '';\n anim(el, [{ opacity: 0, transform: 'translateY(24px)' }, { opacity: 1, transform: 'none' }], { duration: 600, delay: Math.min(c.index, 8) * 70, easing: EASE_OUT, fill: 'backwards' });\n });\n return () => (off(), (el.style.opacity = ''));\n },\n lift: (el, c) => {\n if (c.reduced) return;\n const a = on(el, 'pointerenter', () => anim(el, [{ transform: 'none' }, { transform: 'translateY(-6px) scale(1.02)' }], { duration: 220, easing: EASE_OUT, fill: 'forwards' }));\n const b = on(el, 'pointerleave', () => anim(el, [{ transform: 'translateY(-6px) scale(1.02)' }, { transform: 'none' }], { duration: 260, easing: EASE_OUT, fill: 'forwards' }));\n return () => (a(), b());\n },\n press: (el, c) => (c.reduced ? undefined : on(el, 'pointerdown', () => anim(el, [{ transform: 'scale(1)' }, { transform: 'scale(0.94)' }, { transform: 'scale(1)' }], { duration: 260, easing: EASE_SPRING }))),\n 'count-up': (el) => countUp(el),\n pulse: (el, c) => {\n if (c.reduced) return;\n const a = anim(el, [{ boxShadow: '0 0 0 0 rgba(124, 92, 255, 0.55)' }, { boxShadow: '0 0 0 14px rgba(124, 92, 255, 0)' }], { duration: 1600, iterations: Infinity });\n return () => a?.cancel();\n },\n float: (el, c) => {\n if (c.reduced) return;\n const a = anim(el, [{ transform: 'translateY(0)' }, { transform: 'translateY(-8px)' }, { transform: 'translateY(0)' }], { duration: 3000, delay: c.index * 300, iterations: Infinity, easing: 'ease-in-out' });\n return () => a?.cancel();\n },\n shake: (el, c) => (c.reduced ? undefined : on(el, 'click', () => anim(el, [0, -8, 8, -6, 6, -3, 0].map((x) => ({ transform: `translateX(${x}px)` })), { duration: 420 }))),\n bump: (el, c) => (c.reduced ? undefined : on(el, 'usa:bump', () => anim(el, [{ transform: 'scale(1)' }, { transform: 'scale(1.25)' }, { transform: 'scale(1)' }], { duration: 360, easing: EASE_SPRING }))),\n 'fly-to-cart': (el, c) =>\n on(el, 'click', () => {\n const cart = c.root.querySelector('[data-role=\"cart\"]') || document.querySelector('[data-role=\"cart\"]');\n const item = el.closest('[data-role=\"product\"]')?.querySelector('img, [data-role=\"thumb\"]') || el;\n if (cart) void flyToCart(item, cart).then(() => cart.dispatchEvent(new CustomEvent('usa:added', { bubbles: true })));\n }),\n};\n\n/** The five effect packs: `data-role` → primitives. */\nexport const PACKS: Record<string, Record<string, string[]>> = {\n ecommerce: { product: ['reveal', 'lift'], 'add-to-cart': ['press', 'fly-to-cart'], cart: ['bump'], price: ['count-up'], badge: ['pulse'] },\n portfolio: { project: ['reveal', 'lift'], heading: ['reveal'], stat: ['count-up'], contact: ['press', 'pulse'] },\n dashboard: { card: ['reveal'], stat: ['count-up'], alert: ['pulse'], action: ['press'] },\n game: { button: ['press'], score: ['count-up', 'bump'], item: ['float'], hit: ['shake'], reward: ['pulse'] },\n landing: { hero: ['reveal'], feature: ['reveal', 'lift'], cta: ['press', 'pulse'], logo: ['float'], stat: ['count-up'] },\n};\n\nexport type PackName = keyof typeof PACKS;\n\n/**\n * Apply an effect pack to `root`: every descendant with a `data-role` the\n * pack knows gets its effects (staggered by index). Returns an undo function.\n * Reduced motion: only non-motion behaviour (e.g. the cart event) remains.\n *\n * @example\n * applyPack('ecommerce', document.querySelector('main'));\n * // <article data-role=\"product\">… <button data-role=\"add-to-cart\"> … <a data-role=\"cart\">\n */\nexport function applyPack(name: PackName | string, root: HTMLElement | Document = document): Cleanup {\n const pack = PACKS[name];\n if (!pack || typeof document === 'undefined') return () => {};\n const r = (root as Document).documentElement ? (root as Document).body : (root as HTMLElement);\n const reduced = prefersReducedMotion();\n const cleanups: Cleanup[] = [];\n for (const [role, fx] of Object.entries(pack)) {\n r.querySelectorAll<HTMLElement>(`[data-role=\"${role}\"]`).forEach((el, index) => {\n for (const f of fx) {\n const c = PRIMITIVES[f]?.(el, { root: r, index, reduced });\n if (c) cleanups.push(c);\n }\n });\n }\n return () => cleanups.splice(0).forEach((c) => c());\n}\n\n/** Primitive names a pack uses (for docs / tooling). */\nexport const PACK_PRIMITIVES = Object.keys(PRIMITIVES);\n","import { defineElement, type UsaElement } from '../base';\nimport { applyPack, PACKS } from './core';\n\n/**\n * `<usa-pack name=\"ecommerce\">` — applies an effect pack (`ecommerce` ·\n * `portfolio` · `dashboard` · `game` · `landing`) to its subtree:\n * descendants opt in with `data-role` (see `PACKS`). Re-applies when\n * `name` changes; undone on disconnect.\n */\nexport interface UsaPackElement extends UsaElement {\n readonly roles: string[];\n}\n\nexport function definePack(tag = 'usa-pack'): CustomElementConstructor | undefined {\n return defineElement(tag, (Base) =>\n class UsaPack extends Base {\n static get observedAttributes(): string[] {\n return ['name'];\n }\n get roles(): string[] {\n return Object.keys(PACKS[this.str('name', 'landing')] || {});\n }\n mount(): void {\n this.style.display ||= 'block';\n this.onCleanup(applyPack(this.str('name', 'landing'), this));\n }\n }\n );\n}\n","/**\n * use-scroll-animate/components/packs — effect packs (v3.9).\n * Ready-made motion for e-commerce, portfolio, dashboard, game UI and\n * landing pages: mark elements with `data-role` and apply a pack with\n * `<usa-pack name=\"…\">` or `applyPack(name, root)`. Includes `flyToCart()`\n * and `countUp()`.\n */\nimport { definePack, type UsaPackElement } from './pack-el';\n\nexport { definePack };\nexport { applyPack, flyToCart, countUp, PACKS, PACK_PRIMITIVES } from './core';\nexport type { PackName, PackContext } from './core';\nexport type { UsaPackElement };\n\n/** Register every component of this category under its default tag. */\nexport function definePacksComponents(): void {\n definePack();\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'usa-pack': UsaPackElement;\n }\n}\n"],"names":["motionScale","prefersReducedMotion","now","clamp","raf","EASE_SPRING","EASE_OUT","defineElement"],"mappings":";;;;AAaA,MAAM,IAAI,GAAG,CAAC,EAAW,EAAE,MAAkB,EAAE,CAA2B,KAAsB;AAC9F,IAAA,IAAI,OAAQ,EAAkB,CAAC,OAAO,KAAK,UAAU;AAAE,QAAA,OAAO,IAAI;AAClE,IAAA,MAAM,CAAC,GAAGA,gBAAW,EAAE;AACvB,IAAA,OAAQ,EAAkB,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,QAAQ,EAAE,CAAE,CAAC,CAAC,QAAmB,IAAI,GAAG,IAAI,C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OAAO,KAAA,EAAA,CAAP,OAAO,GAAK,OAAO,CAAA;AAC9B,YAAA,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,IAAI,CAAC,CAAC;QAC9D;AACD,KAAA,CACF;AACH;;AC5BA;;;;;;AAMG;AAQH;SACgB,qBAAqB,GAAA;AACnC,IAAA,UAAU,EAAE;AACd;;;;;;;;;;"}
@@ -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
@@ -113,5 +68,5 @@ declare global {
113
68
  }
114
69
  }
115
70
 
116
- export { PACKS, PACK_PRIMITIVES, applyPack, configureComponents, countUp, definePack, definePacksComponents, flyToCart, prefersReducedMotion };
117
- export type { ComponentsConfig, PackContext, PackName, UsaElement, UsaPackElement };
71
+ export { PACKS, PACK_PRIMITIVES, applyPack, countUp, definePack, definePacksComponents, flyToCart };
72
+ export type { PackContext, PackName, UsaPackElement };
@@ -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
@@ -113,5 +68,5 @@ declare global {
113
68
  }
114
69
  }
115
70
 
116
- export { PACKS, PACK_PRIMITIVES, applyPack, configureComponents, countUp, definePack, definePacksComponents, flyToCart, prefersReducedMotion };
117
- export type { ComponentsConfig, PackContext, PackName, UsaElement, UsaPackElement };
71
+ export { PACKS, PACK_PRIMITIVES, applyPack, countUp, definePack, definePacksComponents, flyToCart };
72
+ export type { PackContext, PackName, UsaPackElement };
@@ -1,5 +1,4 @@
1
- import { p as prefersReducedMotion, n as now, m as motionScale, r as raf, w as EASE_OUT, j as clamp, E as EASE_SPRING, v as defineElement } from '../chunks/base-DbbRUxaa.js';
2
- export { f as configureComponents } from '../chunks/base-DbbRUxaa.js';
1
+ import { p as prefersReducedMotion, n as now, m as motionScale, r as raf, y as EASE_OUT, k as clamp, E as EASE_SPRING, x as defineElement } from '../chunks/base-C3Sw9sAO.js';
3
2
 
4
3
  const anim = (el, frames, o) => {
5
4
  if (typeof el.animate !== 'function')
@@ -181,5 +180,5 @@ function definePacksComponents() {
181
180
  definePack();
182
181
  }
183
182
 
184
- export { PACKS, PACK_PRIMITIVES, applyPack, countUp, definePack, definePacksComponents, flyToCart, prefersReducedMotion };
183
+ export { PACKS, PACK_PRIMITIVES, applyPack, countUp, definePack, definePacksComponents, flyToCart };
185
184
  //# sourceMappingURL=packs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packs.js","sources":["../../src/components/packs/core.ts","../../src/components/packs/pack-el.ts","../../src/components/packs/index.ts"],"sourcesContent":["import { prefersReducedMotion, motionScale, EASE_OUT, EASE_SPRING, raf, now, clamp } from '../base';\n\ntype Cleanup = () => void;\n/** A pack primitive: wire one element, return a cleanup. */\ntype Effect = (el: HTMLElement, ctx: PackContext) => Cleanup | void;\n\nexport interface PackContext {\n root: HTMLElement;\n /** Index of the element among those with the same role (for staggering). */\n index: number;\n reduced: boolean;\n}\n\nconst anim = (el: Element, frames: Keyframe[], o: KeyframeAnimationOptions): Animation | null => {\n if (typeof (el as HTMLElement).animate !== 'function') return null;\n const k = motionScale();\n return (el as HTMLElement).animate(frames, { ...o, duration: ((o.duration as number) ?? 400) * k, delay: (o.delay ?? 0) * k });\n};\nconst on = (el: EventTarget, type: string, fn: (e: any) => void): Cleanup => {\n el.addEventListener(type, fn);\n return () => el.removeEventListener(type, fn);\n};\nconst io = (el: Element, cb: () => void): Cleanup => {\n if (typeof IntersectionObserver === 'undefined') return void cb() as unknown as Cleanup;\n const o = new IntersectionObserver((es) => es.some((e) => e.isIntersecting) && (o.disconnect(), cb()), { threshold: 0.15 });\n o.observe(el);\n return () => o.disconnect();\n};\n\n/** Count `el`'s number up from 0 when it enters the view (keeps prefix / suffix / decimals). */\nexport function countUp(el: HTMLElement, duration = 1200): Cleanup {\n const text = el.textContent || '';\n const m = /(-?[\\d,]*\\.?\\d+)/.exec(text);\n if (!m || prefersReducedMotion()) return () => {};\n const target = Number(m[1].replace(/,/g, ''));\n const dec = (m[1].split('.')[1] || '').length;\n const fmt = (v: number) => text.replace(m[1], v.toLocaleString('en-US', { minimumFractionDigits: dec, maximumFractionDigits: dec }));\n el.setAttribute('aria-label', text.trim());\n el.textContent = fmt(0);\n let stop = false;\n const off = io(el, () => {\n const t0 = now();\n const d = duration * motionScale() || 1;\n const step = () => {\n if (stop) return;\n const p = clamp((now() - t0) / d, 0, 1);\n el.textContent = fmt(target * (1 - Math.pow(1 - p, 3)));\n if (p < 1) raf(step);\n };\n raf(step);\n });\n return () => {\n stop = true;\n off();\n el.textContent = text;\n };\n}\n\n/**\n * Fly a copy of `from` (e.g. a product image) into `to` (the cart icon) along\n * an arc, then bump the target. Resolves when it lands. Instant under\n * reduced motion (only the bump's state change, no flight).\n */\nexport async function flyToCart(from: Element, to: Element, o: { duration?: number } = {}): Promise<void> {\n if (prefersReducedMotion() || typeof document === 'undefined') return;\n const a = from.getBoundingClientRect();\n const b = to.getBoundingClientRect();\n const ghost = from.cloneNode(true) as HTMLElement;\n ghost.setAttribute('aria-hidden', 'true');\n Object.assign(ghost.style, { position: 'fixed', left: `${a.left}px`, top: `${a.top}px`, width: `${a.width}px`, height: `${a.height}px`, margin: '0', zIndex: '2147483000', pointerEvents: 'none' });\n document.body.appendChild(ghost);\n const dx = b.left + b.width / 2 - (a.left + a.width / 2);\n const dy = b.top + b.height / 2 - (a.top + a.height / 2);\n const f = anim(ghost, [\n { transform: 'translate(0, 0) scale(1)', opacity: 1 },\n { transform: `translate(${dx * 0.5}px, ${dy * 0.5 - 80}px) scale(0.6)`, opacity: 0.9, offset: 0.5 },\n { transform: `translate(${dx}px, ${dy}px) scale(0.15)`, opacity: 0.4 },\n ], { duration: o.duration ?? 700, easing: 'cubic-bezier(0.5, 0, 0.5, 1)' });\n await f?.finished.catch(() => undefined);\n ghost.remove();\n anim(to, [{ transform: 'scale(1)' }, { transform: 'scale(1.3)' }, { transform: 'scale(1)' }], { duration: 380, easing: EASE_SPRING });\n}\n\nconst PRIMITIVES: Record<string, Effect> = {\n reveal: (el, c) => {\n if (c.reduced) return;\n el.style.opacity = '0';\n const off = io(el, () => {\n el.style.opacity = '';\n anim(el, [{ opacity: 0, transform: 'translateY(24px)' }, { opacity: 1, transform: 'none' }], { duration: 600, delay: Math.min(c.index, 8) * 70, easing: EASE_OUT, fill: 'backwards' });\n });\n return () => (off(), (el.style.opacity = ''));\n },\n lift: (el, c) => {\n if (c.reduced) return;\n const a = on(el, 'pointerenter', () => anim(el, [{ transform: 'none' }, { transform: 'translateY(-6px) scale(1.02)' }], { duration: 220, easing: EASE_OUT, fill: 'forwards' }));\n const b = on(el, 'pointerleave', () => anim(el, [{ transform: 'translateY(-6px) scale(1.02)' }, { transform: 'none' }], { duration: 260, easing: EASE_OUT, fill: 'forwards' }));\n return () => (a(), b());\n },\n press: (el, c) => (c.reduced ? undefined : on(el, 'pointerdown', () => anim(el, [{ transform: 'scale(1)' }, { transform: 'scale(0.94)' }, { transform: 'scale(1)' }], { duration: 260, easing: EASE_SPRING }))),\n 'count-up': (el) => countUp(el),\n pulse: (el, c) => {\n if (c.reduced) return;\n const a = anim(el, [{ boxShadow: '0 0 0 0 rgba(124, 92, 255, 0.55)' }, { boxShadow: '0 0 0 14px rgba(124, 92, 255, 0)' }], { duration: 1600, iterations: Infinity });\n return () => a?.cancel();\n },\n float: (el, c) => {\n if (c.reduced) return;\n const a = anim(el, [{ transform: 'translateY(0)' }, { transform: 'translateY(-8px)' }, { transform: 'translateY(0)' }], { duration: 3000, delay: c.index * 300, iterations: Infinity, easing: 'ease-in-out' });\n return () => a?.cancel();\n },\n shake: (el, c) => (c.reduced ? undefined : on(el, 'click', () => anim(el, [0, -8, 8, -6, 6, -3, 0].map((x) => ({ transform: `translateX(${x}px)` })), { duration: 420 }))),\n bump: (el, c) => (c.reduced ? undefined : on(el, 'usa:bump', () => anim(el, [{ transform: 'scale(1)' }, { transform: 'scale(1.25)' }, { transform: 'scale(1)' }], { duration: 360, easing: EASE_SPRING }))),\n 'fly-to-cart': (el, c) =>\n on(el, 'click', () => {\n const cart = c.root.querySelector('[data-role=\"cart\"]') || document.querySelector('[data-role=\"cart\"]');\n const item = el.closest('[data-role=\"product\"]')?.querySelector('img, [data-role=\"thumb\"]') || el;\n if (cart) void flyToCart(item, cart).then(() => cart.dispatchEvent(new CustomEvent('usa:added', { bubbles: true })));\n }),\n};\n\n/** The five effect packs: `data-role` → primitives. */\nexport const PACKS: Record<string, Record<string, string[]>> = {\n ecommerce: { product: ['reveal', 'lift'], 'add-to-cart': ['press', 'fly-to-cart'], cart: ['bump'], price: ['count-up'], badge: ['pulse'] },\n portfolio: { project: ['reveal', 'lift'], heading: ['reveal'], stat: ['count-up'], contact: ['press', 'pulse'] },\n dashboard: { card: ['reveal'], stat: ['count-up'], alert: ['pulse'], action: ['press'] },\n game: { button: ['press'], score: ['count-up', 'bump'], item: ['float'], hit: ['shake'], reward: ['pulse'] },\n landing: { hero: ['reveal'], feature: ['reveal', 'lift'], cta: ['press', 'pulse'], logo: ['float'], stat: ['count-up'] },\n};\n\nexport type PackName = keyof typeof PACKS;\n\n/**\n * Apply an effect pack to `root`: every descendant with a `data-role` the\n * pack knows gets its effects (staggered by index). Returns an undo function.\n * Reduced motion: only non-motion behaviour (e.g. the cart event) remains.\n *\n * @example\n * applyPack('ecommerce', document.querySelector('main'));\n * // <article data-role=\"product\">… <button data-role=\"add-to-cart\"> … <a data-role=\"cart\">\n */\nexport function applyPack(name: PackName | string, root: HTMLElement | Document = document): Cleanup {\n const pack = PACKS[name];\n if (!pack || typeof document === 'undefined') return () => {};\n const r = (root as Document).documentElement ? (root as Document).body : (root as HTMLElement);\n const reduced = prefersReducedMotion();\n const cleanups: Cleanup[] = [];\n for (const [role, fx] of Object.entries(pack)) {\n r.querySelectorAll<HTMLElement>(`[data-role=\"${role}\"]`).forEach((el, index) => {\n for (const f of fx) {\n const c = PRIMITIVES[f]?.(el, { root: r, index, reduced });\n if (c) cleanups.push(c);\n }\n });\n }\n return () => cleanups.splice(0).forEach((c) => c());\n}\n\n/** Primitive names a pack uses (for docs / tooling). */\nexport const PACK_PRIMITIVES = Object.keys(PRIMITIVES);\n","import { defineElement, type UsaElement } from '../base';\nimport { applyPack, PACKS } from './core';\n\n/**\n * `<usa-pack name=\"ecommerce\">` — applies an effect pack (`ecommerce` ·\n * `portfolio` · `dashboard` · `game` · `landing`) to its subtree:\n * descendants opt in with `data-role` (see `PACKS`). Re-applies when\n * `name` changes; undone on disconnect.\n */\nexport interface UsaPackElement extends UsaElement {\n readonly roles: string[];\n}\n\nexport function definePack(tag = 'usa-pack'): CustomElementConstructor | undefined {\n return defineElement(tag, (Base) =>\n class UsaPack extends Base {\n static get observedAttributes(): string[] {\n return ['name'];\n }\n get roles(): string[] {\n return Object.keys(PACKS[this.str('name', 'landing')] || {});\n }\n mount(): void {\n this.style.display ||= 'block';\n this.onCleanup(applyPack(this.str('name', 'landing'), this));\n }\n }\n );\n}\n","/**\n * use-scroll-animate/components/packs — effect packs (v3.9).\n * Ready-made motion for e-commerce, portfolio, dashboard, game UI and\n * landing pages: mark elements with `data-role` and apply a pack with\n * `<usa-pack name=\"…\">` or `applyPack(name, root)`. Includes `flyToCart()`\n * and `countUp()`.\n */\nimport { definePack, type UsaPackElement } from './pack-el';\n\nexport { definePack };\nexport { applyPack, flyToCart, countUp, PACKS, PACK_PRIMITIVES } from './core';\nexport type { PackName, PackContext } from './core';\nexport type { UsaPackElement };\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 definePacksComponents(): void {\n definePack();\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'us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AE,CAAC,IAAI,KAC7B,MAAM,OAAQ,SAAQ,IAAI,CAAA;AACxB,QAAA,WAAW,kBAAkB,GAAA;YAC3B,OAAO,CAAC,MAAM,CAAC;QACjB;AACA,QAAA,IAAI,KAAK,GAAA;AACP,YAAA,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,IAAI,EAAE,CAAC;QAC9D;QACA,KAAK,GAAA;;YACH,CAAA,EAAA,GAAA,IAAI,CAAC,KAAK,EAAC,OAAO,KAAA,EAAA,CAAP,OAAO,GAAK,OAAO,CAAA;AAC9B,YAAA,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,IAAI,CAAC,CAAC;QAC9D;AACD,KAAA,CACF;AACH;;AC5BA;;;;;;AAMG;AAUH;SACgB,qBAAqB,GAAA;AACnC,IAAA,UAAU,EAAE;AACd;;;;"}
1
+ {"version":3,"file":"packs.js","sources":["../../src/components/packs/core.ts","../../src/components/packs/pack-el.ts","../../src/components/packs/index.ts"],"sourcesContent":["import { prefersReducedMotion, motionScale, EASE_OUT, EASE_SPRING, raf, now, clamp } from '../base';\n\ntype Cleanup = () => void;\n/** A pack primitive: wire one element, return a cleanup. */\ntype Effect = (el: HTMLElement, ctx: PackContext) => Cleanup | void;\n\nexport interface PackContext {\n root: HTMLElement;\n /** Index of the element among those with the same role (for staggering). */\n index: number;\n reduced: boolean;\n}\n\nconst anim = (el: Element, frames: Keyframe[], o: KeyframeAnimationOptions): Animation | null => {\n if (typeof (el as HTMLElement).animate !== 'function') return null;\n const k = motionScale();\n return (el as HTMLElement).animate(frames, { ...o, duration: ((o.duration as number) ?? 400) * k, delay: (o.delay ?? 0) * k });\n};\nconst on = (el: EventTarget, type: string, fn: (e: any) => void): Cleanup => {\n el.addEventListener(type, fn);\n return () => el.removeEventListener(type, fn);\n};\nconst io = (el: Element, cb: () => void): Cleanup => {\n if (typeof IntersectionObserver === 'undefined') return void cb() as unknown as Cleanup;\n const o = new IntersectionObserver((es) => es.some((e) => e.isIntersecting) && (o.disconnect(), cb()), { threshold: 0.15 });\n o.observe(el);\n return () => o.disconnect();\n};\n\n/** Count `el`'s number up from 0 when it enters the view (keeps prefix / suffix / decimals). */\nexport function countUp(el: HTMLElement, duration = 1200): Cleanup {\n const text = el.textContent || '';\n const m = /(-?[\\d,]*\\.?\\d+)/.exec(text);\n if (!m || prefersReducedMotion()) return () => {};\n const target = Number(m[1].replace(/,/g, ''));\n const dec = (m[1].split('.')[1] || '').length;\n const fmt = (v: number) => text.replace(m[1], v.toLocaleString('en-US', { minimumFractionDigits: dec, maximumFractionDigits: dec }));\n el.setAttribute('aria-label', text.trim());\n el.textContent = fmt(0);\n let stop = false;\n const off = io(el, () => {\n const t0 = now();\n const d = duration * motionScale() || 1;\n const step = () => {\n if (stop) return;\n const p = clamp((now() - t0) / d, 0, 1);\n el.textContent = fmt(target * (1 - Math.pow(1 - p, 3)));\n if (p < 1) raf(step);\n };\n raf(step);\n });\n return () => {\n stop = true;\n off();\n el.textContent = text;\n };\n}\n\n/**\n * Fly a copy of `from` (e.g. a product image) into `to` (the cart icon) along\n * an arc, then bump the target. Resolves when it lands. Instant under\n * reduced motion (only the bump's state change, no flight).\n */\nexport async function flyToCart(from: Element, to: Element, o: { duration?: number } = {}): Promise<void> {\n if (prefersReducedMotion() || typeof document === 'undefined') return;\n const a = from.getBoundingClientRect();\n const b = to.getBoundingClientRect();\n const ghost = from.cloneNode(true) as HTMLElement;\n ghost.setAttribute('aria-hidden', 'true');\n Object.assign(ghost.style, { position: 'fixed', left: `${a.left}px`, top: `${a.top}px`, width: `${a.width}px`, height: `${a.height}px`, margin: '0', zIndex: '2147483000', pointerEvents: 'none' });\n document.body.appendChild(ghost);\n const dx = b.left + b.width / 2 - (a.left + a.width / 2);\n const dy = b.top + b.height / 2 - (a.top + a.height / 2);\n const f = anim(ghost, [\n { transform: 'translate(0, 0) scale(1)', opacity: 1 },\n { transform: `translate(${dx * 0.5}px, ${dy * 0.5 - 80}px) scale(0.6)`, opacity: 0.9, offset: 0.5 },\n { transform: `translate(${dx}px, ${dy}px) scale(0.15)`, opacity: 0.4 },\n ], { duration: o.duration ?? 700, easing: 'cubic-bezier(0.5, 0, 0.5, 1)' });\n await f?.finished.catch(() => undefined);\n ghost.remove();\n anim(to, [{ transform: 'scale(1)' }, { transform: 'scale(1.3)' }, { transform: 'scale(1)' }], { duration: 380, easing: EASE_SPRING });\n}\n\nconst PRIMITIVES: Record<string, Effect> = {\n reveal: (el, c) => {\n if (c.reduced) return;\n el.style.opacity = '0';\n const off = io(el, () => {\n el.style.opacity = '';\n anim(el, [{ opacity: 0, transform: 'translateY(24px)' }, { opacity: 1, transform: 'none' }], { duration: 600, delay: Math.min(c.index, 8) * 70, easing: EASE_OUT, fill: 'backwards' });\n });\n return () => (off(), (el.style.opacity = ''));\n },\n lift: (el, c) => {\n if (c.reduced) return;\n const a = on(el, 'pointerenter', () => anim(el, [{ transform: 'none' }, { transform: 'translateY(-6px) scale(1.02)' }], { duration: 220, easing: EASE_OUT, fill: 'forwards' }));\n const b = on(el, 'pointerleave', () => anim(el, [{ transform: 'translateY(-6px) scale(1.02)' }, { transform: 'none' }], { duration: 260, easing: EASE_OUT, fill: 'forwards' }));\n return () => (a(), b());\n },\n press: (el, c) => (c.reduced ? undefined : on(el, 'pointerdown', () => anim(el, [{ transform: 'scale(1)' }, { transform: 'scale(0.94)' }, { transform: 'scale(1)' }], { duration: 260, easing: EASE_SPRING }))),\n 'count-up': (el) => countUp(el),\n pulse: (el, c) => {\n if (c.reduced) return;\n const a = anim(el, [{ boxShadow: '0 0 0 0 rgba(124, 92, 255, 0.55)' }, { boxShadow: '0 0 0 14px rgba(124, 92, 255, 0)' }], { duration: 1600, iterations: Infinity });\n return () => a?.cancel();\n },\n float: (el, c) => {\n if (c.reduced) return;\n const a = anim(el, [{ transform: 'translateY(0)' }, { transform: 'translateY(-8px)' }, { transform: 'translateY(0)' }], { duration: 3000, delay: c.index * 300, iterations: Infinity, easing: 'ease-in-out' });\n return () => a?.cancel();\n },\n shake: (el, c) => (c.reduced ? undefined : on(el, 'click', () => anim(el, [0, -8, 8, -6, 6, -3, 0].map((x) => ({ transform: `translateX(${x}px)` })), { duration: 420 }))),\n bump: (el, c) => (c.reduced ? undefined : on(el, 'usa:bump', () => anim(el, [{ transform: 'scale(1)' }, { transform: 'scale(1.25)' }, { transform: 'scale(1)' }], { duration: 360, easing: EASE_SPRING }))),\n 'fly-to-cart': (el, c) =>\n on(el, 'click', () => {\n const cart = c.root.querySelector('[data-role=\"cart\"]') || document.querySelector('[data-role=\"cart\"]');\n const item = el.closest('[data-role=\"product\"]')?.querySelector('img, [data-role=\"thumb\"]') || el;\n if (cart) void flyToCart(item, cart).then(() => cart.dispatchEvent(new CustomEvent('usa:added', { bubbles: true })));\n }),\n};\n\n/** The five effect packs: `data-role` → primitives. */\nexport const PACKS: Record<string, Record<string, string[]>> = {\n ecommerce: { product: ['reveal', 'lift'], 'add-to-cart': ['press', 'fly-to-cart'], cart: ['bump'], price: ['count-up'], badge: ['pulse'] },\n portfolio: { project: ['reveal', 'lift'], heading: ['reveal'], stat: ['count-up'], contact: ['press', 'pulse'] },\n dashboard: { card: ['reveal'], stat: ['count-up'], alert: ['pulse'], action: ['press'] },\n game: { button: ['press'], score: ['count-up', 'bump'], item: ['float'], hit: ['shake'], reward: ['pulse'] },\n landing: { hero: ['reveal'], feature: ['reveal', 'lift'], cta: ['press', 'pulse'], logo: ['float'], stat: ['count-up'] },\n};\n\nexport type PackName = keyof typeof PACKS;\n\n/**\n * Apply an effect pack to `root`: every descendant with a `data-role` the\n * pack knows gets its effects (staggered by index). Returns an undo function.\n * Reduced motion: only non-motion behaviour (e.g. the cart event) remains.\n *\n * @example\n * applyPack('ecommerce', document.querySelector('main'));\n * // <article data-role=\"product\">… <button data-role=\"add-to-cart\"> … <a data-role=\"cart\">\n */\nexport function applyPack(name: PackName | string, root: HTMLElement | Document = document): Cleanup {\n const pack = PACKS[name];\n if (!pack || typeof document === 'undefined') return () => {};\n const r = (root as Document).documentElement ? (root as Document).body : (root as HTMLElement);\n const reduced = prefersReducedMotion();\n const cleanups: Cleanup[] = [];\n for (const [role, fx] of Object.entries(pack)) {\n r.querySelectorAll<HTMLElement>(`[data-role=\"${role}\"]`).forEach((el, index) => {\n for (const f of fx) {\n const c = PRIMITIVES[f]?.(el, { root: r, index, reduced });\n if (c) cleanups.push(c);\n }\n });\n }\n return () => cleanups.splice(0).forEach((c) => c());\n}\n\n/** Primitive names a pack uses (for docs / tooling). */\nexport const PACK_PRIMITIVES = Object.keys(PRIMITIVES);\n","import { defineElement, type UsaElement } from '../base';\nimport { applyPack, PACKS } from './core';\n\n/**\n * `<usa-pack name=\"ecommerce\">` — applies an effect pack (`ecommerce` ·\n * `portfolio` · `dashboard` · `game` · `landing`) to its subtree:\n * descendants opt in with `data-role` (see `PACKS`). Re-applies when\n * `name` changes; undone on disconnect.\n */\nexport interface UsaPackElement extends UsaElement {\n readonly roles: string[];\n}\n\nexport function definePack(tag = 'usa-pack'): CustomElementConstructor | undefined {\n return defineElement(tag, (Base) =>\n class UsaPack extends Base {\n static get observedAttributes(): string[] {\n return ['name'];\n }\n get roles(): string[] {\n return Object.keys(PACKS[this.str('name', 'landing')] || {});\n }\n mount(): void {\n this.style.display ||= 'block';\n this.onCleanup(applyPack(this.str('name', 'landing'), this));\n }\n }\n );\n}\n","/**\n * use-scroll-animate/components/packs — effect packs (v3.9).\n * Ready-made motion for e-commerce, portfolio, dashboard, game UI and\n * landing pages: mark elements with `data-role` and apply a pack with\n * `<usa-pack name=\"…\">` or `applyPack(name, root)`. Includes `flyToCart()`\n * and `countUp()`.\n */\nimport { definePack, type UsaPackElement } from './pack-el';\n\nexport { definePack };\nexport { applyPack, flyToCart, countUp, PACKS, PACK_PRIMITIVES } from './core';\nexport type { PackName, PackContext } from './core';\nexport type { UsaPackElement };\n\n/** Register every component of this category under its default tag. */\nexport function definePacksComponents(): void {\n definePack();\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'usa-pack': UsaPackElement;\n }\n}\n"],"names":[],"mappings":";;AAaA,MAAM,IAAI,GAAG,CAAC,EAAW,EAAE,MAAkB,EAAE,CAA2B,KAAsB;AAC9F,IAAA,IAAI,OAAQ,EAAkB,CAAC,OAAO,KAAK,UAAU;AAAE,QAAA,OAAO,IAAI;AAClE,IAAA,MAAM,CAAC,GAAG,WAAW,EAAE;AACvB,IAAA,OAAQ,EAAkB,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,QAAQ,EAAE,CAAE,CAAC,CAAC,QAAmB,IAAI,GAAG,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AAChI,CAAC;AACD,MAAM,EAAE,GAAG,CAAC,EAAe,EAAE,IAAY,EAAE,EAAoB,KAAa;AAC1E,IAAA,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,EAAE,CAAC;IAC7B,OAAO,MAAM,EAAE,CAAC,mBAAmB,CAAC,IAAI,EAAE,EAAE,CAAC;AAC/C,CAAC;AACD,MAAM,EAAE,GAAG,CAAC,EAAW,EAAE,EAAc,KAAa;IAClD,IAAI,OAAO,oBAAoB,KAAK,WAAW;QAAE,OAAO,KAAK,EAAE,EAAwB;AACvF,IAAA,MAAM,CAAC,GAAG,IAAI,oBAAoB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AAC3H,IAAA,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;AACb,IAAA,OAAO,MAAM,CAAC,CAAC,UAA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AAI,CAAC,UAAU;;AClJ/C,SAAU,UAAU,CAAC,GAAG,GAAG,UAAU,EAAA;AACzC,IAAA,OAAO,aAAa,CAAC,GAAG,EAAE,CAAC,IAAI,KAC7B,MAAM,OAAQ,SAAQ,IAAI,CAAA;AACxB,QAAA,WAAW,kBAAkB,GAAA;YAC3B,OAAO,CAAC,MAAM,CAAC;QACjB;AACA,QAAA,IAAI,KAAK,GAAA;AACP,YAAA,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,IAAI,EAAE,CAAC;QAC9D;QACA,KAAK,GAAA;;YACH,CAAA,EAAA,GAAA,IAAI,CAAC,KAAK,EAAC,OAAO,KAAA,EAAA,CAAP,OAAO,GAAK,OAAO,CAAA;AAC9B,YAAA,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,IAAI,CAAC,CAAC;QAC9D;AACD,KAAA,CACF;AACH;;AC5BA;;;;;;AAMG;AAQH;SACgB,qBAAqB,GAAA;AACnC,IAAA,UAAU,EAAE;AACd;;;;"}
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var base = require('../chunks/base-BvpQ4Ggj.cjs');
4
- var spring = require('../chunks/spring-fFkqE9J0.cjs');
3
+ var base = require('../chunks/base-B5i8qQPR.cjs');
4
+ var spring = require('../chunks/spring--oZh55tB.cjs');
5
5
 
6
6
  var css$8 = "usa-cursor{--usa-cursor-color:var(--usa-accent,#7c5cff);--usa-cursor-size:28px;position:fixed;inset:0;pointer-events:none;z-index:2147483600;opacity:0;transition:opacity 0.2s ease;contain:strict}usa-cursor[data-active]{opacity:1}usa-cursor .usa-cursor-ring{position:absolute;left:0;top:0;width:var(--usa-cursor-size);height:var(--usa-cursor-size);margin:calc(var(--usa-cursor-size) / -2) 0 0 calc(var(--usa-cursor-size) / -2);border:1.5px solid var(--usa-cursor-color);border-radius:999px;box-sizing:border-box;transition:width 0.25s cubic-bezier(0.34,1.56,0.64,1),height 0.25s cubic-bezier(0.34,1.56,0.64,1),margin 0.25s ease,border-radius 0.25s ease,background-color 0.2s ease;will-change:transform}usa-cursor[mode=\"trail\"] .usa-cursor-ring{border:0;background:var(--usa-cursor-color);width:calc(var(--usa-cursor-size) * (0.45 - var(--i) * 0.04));height:calc(var(--usa-cursor-size) * (0.45 - var(--i) * 0.04));margin:calc(var(--usa-cursor-size) * (0.45 - var(--i) * 0.04) / -2) 0 0 calc(var(--usa-cursor-size) * (0.45 - var(--i) * 0.04) / -2);opacity:calc(1 - var(--i) * 0.11)}usa-cursor[data-hover] .usa-cursor-ring:first-child{width:calc(var(--usa-cursor-size) * 1.6);height:calc(var(--usa-cursor-size) * 1.6);margin:calc(var(--usa-cursor-size) * -0.8) 0 0 calc(var(--usa-cursor-size) * -0.8);background:color-mix(in srgb,var(--usa-cursor-color) 15%,transparent)}usa-cursor[data-snapped] .usa-cursor-ring{border-radius:12px;background:color-mix(in srgb,var(--usa-cursor-color) 12%,transparent);translate:-50% -50%;margin:0}usa-cursor[data-down] .usa-cursor-ring:first-child{scale:0.8}usa-cursor .usa-cursor-dot{position:absolute;left:-3px;top:-3px;width:6px;height:6px;border-radius:50%;background:var(--usa-cursor-color)}usa-cursor[data-snapped] .usa-cursor-dot{opacity:0}usa-cursor .usa-cursor-glow{position:absolute;left:-200px;top:-200px;width:400px;height:400px;border-radius:50%;background:radial-gradient(circle,color-mix(in srgb,var(--usa-cursor-color) 35%,transparent),transparent 65%);mix-blend-mode:screen}.usa-cursor-none,.usa-cursor-none *{cursor:none !important}@media (pointer:coarse),(prefers-reduced-motion:reduce){usa-cursor{display:none}.usa-cursor-none,.usa-cursor-none *{cursor:auto !important}}";
7
7
 
@@ -589,21 +589,23 @@ function defineAutoSkeleton(tag = 'usa-auto-skeleton') {
589
589
 
590
590
  var css$1 = "usa-motion-switch{--usa-motion-i:2;position:relative;display:inline-grid;grid-auto-flow:column;grid-auto-columns:1fr;padding:3px;border-radius:999px;background:color-mix(in srgb,currentColor 9%,transparent);isolation:isolate}usa-motion-switch button{position:relative;z-index:1;padding:6px 12px;border:0;background:none;color:inherit;font:inherit;font-size:0.85em;border-radius:999px;cursor:pointer}usa-motion-switch button[aria-checked=\"true\"]{color:var(--usa-accent-text,#fff)}usa-motion-switch button:focus-visible{outline:2px solid var(--usa-accent,#7c5cff);outline-offset:1px}usa-motion-switch .usa-motion-thumb{position:absolute;z-index:0;top:3px;bottom:3px;left:3px;width:calc((100% - 6px) / 4);border-radius:999px;background:var(--usa-accent,#7c5cff);transform:translateX(calc(var(--usa-motion-i) * 100%));transition:transform 0.4s cubic-bezier(0.34,1.4,0.64,1)}@media (prefers-reduced-motion:reduce){usa-motion-switch .usa-motion-thumb{transition:none}}";
591
591
 
592
+ const INTENSITIES = ['low', 'normal', 'high'];
592
593
  const LEVELS = ['off', 'low', 'normal', 'high'];
593
594
  const KEY = 'usa:motion';
594
- let fromSwitch = false;
595
595
  /**
596
596
  * Set the global motion intensity for every `<usa-*>` component:
597
- * `'off'` (like reduced motion), `'low'`, `'normal'` (default), `'high'`.
598
- * Sets `--usa-motion` and `data-usa-motion` on `<html>`; with `persist`
599
- * the choice is remembered (localStorage) and restored by `restoreMotionIntensity()`.
597
+ * `'low'`, `'normal'` (default), `'high'`. Sets `--usa-motion` and
598
+ * `data-usa-motion` on `<html>`; with `persist` the choice is remembered
599
+ * (localStorage) and restored by `restoreMotionIntensity()`.
600
+ * 5.0: `'off'` was removed — use `setMotionSensitivity('minimal')`.
600
601
  */
601
602
  function setMotionIntensity(level, persist = false) {
602
- if (!LEVELS.includes(level))
603
+ if (!INTENSITIES.includes(level))
603
604
  return;
604
- if (level === 'off' && !fromSwitch)
605
- base.deprecate('set-intensity-off', "setMotionIntensity('off') is deprecated and will be removed in 5.0 — use setMotionSensitivity('minimal') from use-scroll-animate/components/a11y.");
606
- base.withoutDeprecations(() => base.configureComponents({ motionIntensity: level }));
605
+ base.configureComponents({ motionIntensity: level });
606
+ store(level, persist);
607
+ }
608
+ function store(level, persist) {
607
609
  if (persist) {
608
610
  try {
609
611
  localStorage.setItem(KEY, level);
@@ -615,30 +617,39 @@ function setMotionIntensity(level, persist = false) {
615
617
  if (typeof document !== 'undefined')
616
618
  document.dispatchEvent(new CustomEvent('usa:motion', { detail: { level } }));
617
619
  }
618
- /** Re-apply a persisted intensity (call early on page load). Returns it. */
620
+ /** Apply a switch level: `'off'` = motion sensitivity `minimal`, otherwise full motion at that intensity. */
621
+ function setMotionLevel(level, persist = false) {
622
+ if (!LEVELS.includes(level))
623
+ return;
624
+ if (level === 'off')
625
+ base.configureComponents({ motionSensitivity: 'minimal' });
626
+ else
627
+ base.configureComponents({ motionIntensity: level, ...(base.getMotionSensitivity() === 'minimal' ? { motionSensitivity: 'full' } : {}) });
628
+ store(level, persist);
629
+ }
630
+ /** The current switch level. */
631
+ function getMotionLevel() {
632
+ return base.getMotionSensitivity() === 'minimal' || base.getMotionSensitivity() === 'static' ? 'off' : base.getMotionIntensity();
633
+ }
634
+ /** Re-apply a persisted level (call early on page load). Returns the active intensity. */
619
635
  function restoreMotionIntensity() {
620
636
  try {
621
637
  const v = localStorage.getItem(KEY);
622
- if (v && LEVELS.includes(v)) {
623
- fromSwitch = true;
624
- setMotionIntensity(v);
625
- }
638
+ if (v && LEVELS.includes(v))
639
+ setMotionLevel(v);
626
640
  }
627
641
  catch {
628
642
  /* ignore */
629
643
  }
630
- fromSwitch = false;
631
644
  return base.getMotionIntensity();
632
645
  }
633
646
  function defineMotionSwitch(tag = 'usa-motion-switch') {
634
647
  return base.defineElement(tag, (Base) => class UsaMotionSwitch extends Base {
635
648
  get value() {
636
- return base.getMotionIntensity();
649
+ return getMotionLevel();
637
650
  }
638
651
  set value(v) {
639
- fromSwitch = true;
640
- setMotionIntensity(v, true);
641
- fromSwitch = false;
652
+ setMotionLevel(v, true);
642
653
  this.sync();
643
654
  }
644
655
  mount() {
@@ -785,9 +796,7 @@ function definePageComponents() {
785
796
  }
786
797
 
787
798
  exports.MOTION_SCALE = base.MOTION_SCALE;
788
- exports.configureComponents = base.configureComponents;
789
799
  exports.getMotionIntensity = base.getMotionIntensity;
790
- exports.prefersReducedMotion = base.prefersReducedMotion;
791
800
  exports.AMBIENT_EFFECTS = AMBIENT_EFFECTS;
792
801
  exports.CURSOR_MODES = CURSOR_MODES;
793
802
  exports.PAGE_EFFECTS = PAGE_EFFECTS;
@@ -801,11 +810,13 @@ exports.defineMotionSwitch = defineMotionSwitch;
801
810
  exports.definePageComponents = definePageComponents;
802
811
  exports.defineSplash = defineSplash;
803
812
  exports.enableMpaTransitions = enableMpaTransitions;
813
+ exports.getMotionLevel = getMotionLevel;
804
814
  exports.loadingBar = loadingBar;
805
815
  exports.pageTransition = pageTransition;
806
816
  exports.restoreMotionIntensity = restoreMotionIntensity;
807
817
  exports.scrollToTarget = scrollToTarget;
808
818
  exports.setMotionIntensity = setMotionIntensity;
819
+ exports.setMotionLevel = setMotionLevel;
809
820
  exports.smoothScroll = smoothScroll;
810
821
  exports.supportsViewTransitions = supportsViewTransitions;
811
822
  exports.themeTransition = themeTransition;