use-scroll-animate 3.4.0 → 3.6.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 (77) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +2 -0
  3. package/README_ja.md +2 -0
  4. package/README_zh.md +2 -0
  5. package/dist/chunks/{base-Cu-86Z31.js → base-BpROOcey.js} +2 -2
  6. package/dist/chunks/{base-Cu-86Z31.js.map → base-BpROOcey.js.map} +1 -1
  7. package/dist/chunks/core-IaorbTdu.cjs +185 -0
  8. package/dist/chunks/core-IaorbTdu.cjs.map +1 -0
  9. package/dist/chunks/core-uxs3ETou.js +181 -0
  10. package/dist/chunks/core-uxs3ETou.js.map +1 -0
  11. package/dist/chunks/{index-tags-qc6OWsJ8.js → index-tags-BANJ-e4H.js} +3 -1
  12. package/dist/chunks/{index-tags-qc6OWsJ8.js.map → index-tags-BANJ-e4H.js.map} +1 -1
  13. package/dist/chunks/{index-tags-BKcHAxBK.cjs → index-tags-wbuPiMR6.cjs} +3 -1
  14. package/dist/chunks/{index-tags-BKcHAxBK.cjs.map → index-tags-wbuPiMR6.cjs.map} +1 -1
  15. package/dist/chunks/{spring-BV-cpTHC.js → spring-C-fw7_9f.js} +2 -2
  16. package/dist/chunks/{spring-BV-cpTHC.js.map → spring-C-fw7_9f.js.map} +1 -1
  17. package/dist/chunks/{variants-BQ3gCb5L.js → variants-CHe1VbSn.js} +2 -2
  18. package/dist/chunks/{variants-BQ3gCb5L.js.map → variants-CHe1VbSn.js.map} +1 -1
  19. package/dist/components/background.js +3 -3
  20. package/dist/components/cards.js +3 -3
  21. package/dist/components/click.js +3 -3
  22. package/dist/components/depth.cjs +252 -0
  23. package/dist/components/depth.cjs.map +1 -0
  24. package/dist/components/depth.css +3 -0
  25. package/dist/components/depth.d.cts +121 -0
  26. package/dist/components/depth.d.ts +121 -0
  27. package/dist/components/depth.js +243 -0
  28. package/dist/components/depth.js.map +1 -0
  29. package/dist/components/feedback.js +2 -2
  30. package/dist/components/gesture.cjs +6 -182
  31. package/dist/components/gesture.cjs.map +1 -1
  32. package/dist/components/gesture.js +6 -181
  33. package/dist/components/gesture.js.map +1 -1
  34. package/dist/components/interaction.js +2 -2
  35. package/dist/components/jsx.d.cts +2 -0
  36. package/dist/components/jsx.d.ts +2 -0
  37. package/dist/components/layout.cjs +259 -0
  38. package/dist/components/layout.cjs.map +1 -0
  39. package/dist/components/layout.css +3 -0
  40. package/dist/components/layout.d.cts +134 -0
  41. package/dist/components/layout.d.ts +134 -0
  42. package/dist/components/layout.js +250 -0
  43. package/dist/components/layout.js.map +1 -0
  44. package/dist/components/lazy.cjs +3 -1
  45. package/dist/components/lazy.cjs.map +1 -1
  46. package/dist/components/lazy.d.cts +2 -0
  47. package/dist/components/lazy.d.ts +2 -0
  48. package/dist/components/lazy.js +3 -1
  49. package/dist/components/lazy.js.map +1 -1
  50. package/dist/components/page.js +3 -3
  51. package/dist/components/physics.js +4 -4
  52. package/dist/components/react.cjs +1 -1
  53. package/dist/components/react.js +1 -1
  54. package/dist/components/reveal.js +2 -2
  55. package/dist/components/svg.js +2 -2
  56. package/dist/components/text.js +2 -2
  57. package/dist/components/timeline.js +2 -2
  58. package/dist/components/transitions.js +2 -2
  59. package/dist/components/ui.js +5 -5
  60. package/dist/components/vue.cjs +4 -1
  61. package/dist/components/vue.cjs.map +1 -1
  62. package/dist/components/vue.d.cts +82 -0
  63. package/dist/components/vue.d.ts +82 -0
  64. package/dist/components/vue.js +7 -4
  65. package/dist/components/vue.js.map +1 -1
  66. package/dist/components/webgl.js +2 -2
  67. package/dist/components.cjs +23 -4
  68. package/dist/components.cjs.map +1 -1
  69. package/dist/components.css +2 -0
  70. package/dist/components.d.cts +165 -2
  71. package/dist/components.d.ts +165 -2
  72. package/dist/components.js +15 -8
  73. package/dist/components.js.map +1 -1
  74. package/dist/components.umd.js +2 -2
  75. package/dist/components.umd.js.map +1 -1
  76. package/docs/components.md +20 -0
  77. package/package.json +24 -2
@@ -1 +1 @@
1
- {"version":3,"file":"gesture.js","sources":["../../src/components/gesture/core.ts","../../src/components/gesture/swipeable.ts","../../src/components/gesture/pinch-zoom.ts","../../src/components/gesture/index.ts"],"sourcesContent":["import { clamp } from '../base';\n\nexport interface PanState {\n /** Offset from the gesture start (px). */\n dx: number;\n dy: number;\n /** Velocity (px/s). */\n vx: number;\n vy: number;\n first: boolean;\n last: boolean;\n event: Event;\n}\nexport type SwipeDirection = 'left' | 'right' | 'up' | 'down';\nexport interface SwipeState { direction: SwipeDirection; velocity: number; dx: number; dy: number }\nexport interface PinchState { scale: number; /** Midpoint of the two pointers (client px). */ x: number; y: number; first: boolean; last: boolean }\nexport interface PressState { x: number; y: number }\n\nexport interface GestureHandlers {\n onPan?: (s: PanState) => void;\n onSwipe?: (s: SwipeState) => void;\n onPinch?: (s: PinchState) => void;\n onLongPress?: (s: PressState) => void;\n onTap?: (s: PressState) => void;\n onDoubleTap?: (s: PressState) => void;\n}\n\nexport interface GestureOptions {\n /** Restrict panning to an axis. */\n axis?: 'x' | 'y';\n /** Movement (px) before a pan starts (default 4). */\n threshold?: number;\n /** Minimum distance (px, default 40) and speed (px/s, default 300) for a swipe. */\n swipeDistance?: number;\n swipeVelocity?: number;\n /** Long-press delay (ms, default 500). */\n longPress?: number;\n /** Ctrl/⌘ + wheel (trackpad pinch) counts as pinch (default true). */\n wheelPinch?: boolean;\n}\n\n/** The swipe a pointer release represents, or `null` (pure). */\nexport function swipeDirection(dx: number, dy: number, vx: number, vy: number, o: { distance?: number; velocity?: number; axis?: 'x' | 'y' } = {}): SwipeState | null {\n const dist = o.distance ?? 40;\n const vel = o.velocity ?? 300;\n const horiz = o.axis === 'x' || (o.axis !== 'y' && Math.abs(dx) >= Math.abs(dy));\n const d = horiz ? dx : dy;\n const v = horiz ? vx : vy;\n if (Math.abs(d) < dist && Math.abs(v) < vel * 2) return null;\n if (Math.abs(v) < vel && Math.abs(d) < dist * 3) return null;\n const direction: SwipeDirection = horiz ? (d > 0 ? 'right' : 'left') : d > 0 ? 'down' : 'up';\n return { direction, velocity: Math.abs(v), dx, dy };\n}\n\n/** Scale between two pointer distances, clamped to [min, max] (pure). */\nexport function pinchScale(startDistance: number, distance: number, base = 1, min = 0.5, max = 4): number {\n if (!startDistance) return base;\n return clamp(base * (distance / startDistance), min, max);\n}\n\ntype P = { x: number; y: number };\nconst pid = (e: any): number => (typeof e.pointerId === 'number' ? e.pointerId : 1);\n\n/**\n * One recognizer for pan, swipe, pinch (two pointers or Ctrl + wheel),\n * long-press, tap and double-tap, with velocities ready to hand to a spring\n * (`createSpring().set(target, velocity)`). Works with mouse, touch and pen\n * through Pointer Events. Returns a cleanup function.\n *\n * @example\n * const x = createSpring({ onUpdate: (v) => (card.style.translate = `${v}px`) });\n * gesture(card, {\n * onPan: ({ dx, last, vx }) => (last ? x.set(0, vx) : x.jump(dx)),\n * onSwipe: ({ direction }) => dismiss(direction),\n * }, { axis: 'x' });\n */\nexport function gesture(el: HTMLElement, h: GestureHandlers, o: GestureOptions = {}): () => void {\n const pts = new Map<number, P>();\n let start: P = { x: 0, y: 0 };\n let last: P & { t: number } = { x: 0, y: 0, t: 0 };\n let vx = 0;\n let vy = 0;\n let panning = false;\n let pinch: { d0: number; first: boolean } | null = null;\n let pinchScaleNow = 1;\n let press: ReturnType<typeof setTimeout> | undefined;\n let pressed = false;\n let lastTap = -1e9;\n const th = o.threshold ?? 4;\n const dist = () => {\n const [a, b] = [...pts.values()];\n return Math.hypot(a.x - b.x, a.y - b.y);\n };\n const mid = () => {\n const [a, b] = [...pts.values()];\n return { x: (a.x + b.x) / 2, y: (a.y + b.y) / 2 };\n };\n const t = (e: Event) => (e.timeStamp || Date.now());\n\n const down = (e: PointerEvent) => {\n pts.set(pid(e), { x: e.clientX, y: e.clientY });\n try { el.setPointerCapture?.(pid(e)); } catch { /* jsdom / synthetic */ }\n if (pts.size === 2 && h.onPinch) {\n clearTimeout(press);\n if (panning) h.onPan?.({ dx: last.x - start.x, dy: last.y - start.y, vx: 0, vy: 0, first: false, last: true, event: e });\n panning = false;\n pinch = { d0: dist(), first: true };\n return;\n }\n if (pts.size > 1) return;\n start = { x: e.clientX, y: e.clientY };\n last = { ...start, t: t(e) };\n vx = vy = 0;\n pressed = false;\n if (h.onLongPress) press = setTimeout(() => { pressed = true; h.onLongPress?.({ x: start.x, y: start.y }); }, o.longPress ?? 500);\n };\n const move = (e: PointerEvent) => {\n if (!pts.has(pid(e))) return;\n pts.set(pid(e), { x: e.clientX, y: e.clientY });\n if (pinch && pts.size >= 2) {\n const m = mid();\n pinchScaleNow = pinchScale(pinch.d0, dist(), 1, 0.05, 20);\n h.onPinch?.({ scale: pinchScaleNow, x: m.x, y: m.y, first: pinch.first, last: false });\n pinch.first = false;\n return;\n }\n const dx = e.clientX - start.x;\n const dy = e.clientY - start.y;\n const dt = Math.max(1, t(e) - last.t) / 1000;\n vx = (e.clientX - last.x) / dt;\n vy = (e.clientY - last.y) / dt;\n last = { x: e.clientX, y: e.clientY, t: t(e) };\n if (!panning) {\n const off = o.axis === 'x' ? Math.abs(dx) : o.axis === 'y' ? Math.abs(dy) : Math.hypot(dx, dy);\n if (off < th) return;\n clearTimeout(press);\n if (o.axis && Math.abs(o.axis === 'x' ? dy : dx) > off) { pts.delete(pid(e)); return; } // wrong axis: let the page scroll\n panning = true;\n h.onPan?.({ dx: o.axis === 'y' ? 0 : dx, dy: o.axis === 'x' ? 0 : dy, vx, vy, first: true, last: false, event: e });\n return;\n }\n if (e.cancelable) e.preventDefault();\n h.onPan?.({ dx: o.axis === 'y' ? 0 : dx, dy: o.axis === 'x' ? 0 : dy, vx, vy, first: false, last: false, event: e });\n };\n const up = (e: PointerEvent) => {\n if (!pts.has(pid(e))) return;\n pts.delete(pid(e));\n clearTimeout(press);\n if (pinch) {\n if (pts.size < 2) {\n h.onPinch?.({ scale: pinchScaleNow, ...start, first: false, last: true });\n pinch = null;\n pts.clear();\n }\n return;\n }\n const dx = e.clientX - start.x;\n const dy = e.clientY - start.y;\n if (panning) {\n panning = false;\n if (t(e) - last.t > 80) vx = vy = 0; // paused before release\n h.onPan?.({ dx: o.axis === 'y' ? 0 : dx, dy: o.axis === 'x' ? 0 : dy, vx, vy, first: false, last: true, event: e });\n const s = swipeDirection(dx, dy, vx, vy, { distance: o.swipeDistance, velocity: o.swipeVelocity, axis: o.axis });\n if (s) h.onSwipe?.(s);\n return;\n }\n if (pressed || e.type === 'pointercancel') return;\n const p = { x: e.clientX, y: e.clientY };\n const n = t(e);\n if (h.onDoubleTap && n - lastTap < 300) { lastTap = -1e9; h.onDoubleTap(p); return; }\n lastTap = n;\n h.onTap?.(p);\n };\n const wheel = (e: WheelEvent) => {\n if (!h.onPinch || o.wheelPinch === false || !e.ctrlKey) return;\n e.preventDefault();\n const s = Math.exp(-e.deltaY / 100);\n h.onPinch({ scale: s, x: e.clientX, y: e.clientY, first: true, last: true });\n };\n const opts: AddEventListenerOptions = { passive: false };\n el.addEventListener('pointerdown', down as EventListener);\n el.addEventListener('pointermove', move as EventListener, opts);\n el.addEventListener('pointerup', up as EventListener);\n el.addEventListener('pointercancel', up as EventListener);\n el.addEventListener('wheel', wheel as EventListener, opts);\n if (o.axis && !el.style.touchAction) el.style.touchAction = o.axis === 'x' ? 'pan-y' : 'pan-x';\n else if (!o.axis && !el.style.touchAction && (h.onPan || h.onPinch)) el.style.touchAction = 'none';\n return () => {\n clearTimeout(press);\n el.removeEventListener('pointerdown', down as EventListener);\n el.removeEventListener('pointermove', move as EventListener, opts);\n el.removeEventListener('pointerup', up as EventListener);\n el.removeEventListener('pointercancel', up as EventListener);\n el.removeEventListener('wheel', wheel as EventListener, opts);\n };\n}\n","import { defineElement, type UsaElement } from '../base';\nimport { createSpring, type SpringValue } from '../physics/spring';\nimport { gesture, type SwipeDirection } from './core';\nimport css from './gesture.css?raw';\n\n/**\n * `<usa-swipeable>` — swipe-to-dismiss / swipe actions. The content follows\n * the finger (rubber-banded past `distance`), flies out on a swipe or a drag\n * past `distance`, otherwise springs home with the release velocity.\n *\n * Attributes: `axis` (`x` default · `y`), `distance` (px, 120), `preset`\n * (spring), `dismiss` (remove the element after flying out), `disabled`.\n * Keyboard: Delete/Backspace dismisses, ←/→ swipe. Events `usa:swipe`\n * (`{ direction }`, cancelable), `usa:dismiss`. Methods `swipe(dir)`, `reset()`.\n * Reduced motion: no follow / fly-out animation, events still fire.\n */\nexport interface UsaSwipeableElement extends UsaElement {\n swipe(direction: SwipeDirection): void;\n reset(): void;\n readonly offset: number;\n}\n\nexport function defineSwipeable(tag = 'usa-swipeable'): CustomElementConstructor | undefined {\n return defineElement(\n tag,\n (Base) =>\n class UsaSwipeable extends Base {\n static get observedAttributes(): string[] {\n return ['axis', 'disabled'];\n }\n private _s!: SpringValue;\n private _off = 0;\n\n get offset(): number {\n return this._off;\n }\n\n private put(v: number): void {\n this._off = v;\n this.style.setProperty('--usa-swipe', `${v}px`);\n this.style.setProperty('--usa-swipe-p', String(Math.min(1, Math.abs(v) / this.num('distance', 120))));\n }\n\n swipe(direction: SwipeDirection): void {\n if (!this.emit('swipe', { direction })) return this.reset();\n const sign = direction === 'left' || direction === 'up' ? -1 : 1;\n const far = sign * ((this.str('axis', 'x') === 'y' ? this.offsetHeight : this.offsetWidth) + 80 || 600);\n const done = () => {\n this.emit('dismiss', { direction });\n if (this.flag('dismiss')) this.remove();\n };\n if (this.reduced) {\n this.put(0);\n return done();\n }\n this.setAttribute('data-gone', '');\n this._s = createSpring({ spring: 'stiff', value: this._off, onUpdate: (v) => this.put(v), onRest: done });\n this._s.set(far, sign * 1500);\n }\n\n reset(): void {\n this.removeAttribute('data-gone');\n if (this.reduced) return this.put(0);\n this._s.set(0);\n }\n\n mount(): void {\n this._s = createSpring({ spring: this.str('preset', 'default'), onUpdate: (v) => this.put(v) });\n if (!this.hasAttribute('tabindex')) this.tabIndex = 0;\n const y = this.str('axis', 'x') === 'y';\n const max = () => this.num('distance', 120);\n this.onCleanup(\n gesture(this, {\n onPan: ({ dx, dy, vx, vy, last }) => {\n if (this.flag('disabled')) return;\n const d = y ? dy : dx;\n if (!last) {\n this._s.stop();\n if (!this.reduced) this.put(Math.abs(d) > max() ? Math.sign(d) * (max() + (Math.abs(d) - max()) * 0.35) : d);\n return;\n }\n if (Math.abs(d) > max()) this.swipe(y ? (d > 0 ? 'down' : 'up') : d > 0 ? 'right' : 'left');\n else if (!this.hasAttribute('data-gone')) {\n if (this.reduced) this.put(0);\n else this._s.set(0, y ? vy : vx);\n }\n },\n onSwipe: ({ direction }) => {\n if (this.flag('disabled') || this.hasAttribute('data-gone')) return;\n if (y === (direction === 'up' || direction === 'down')) this.swipe(direction);\n },\n }, { axis: y ? 'y' : 'x' })\n );\n this.listen(this, 'keydown', (e: KeyboardEvent) => {\n if (this.flag('disabled')) return;\n const map: Record<string, SwipeDirection> = y ? { ArrowUp: 'up', ArrowDown: 'down' } : { ArrowLeft: 'left', ArrowRight: 'right' };\n if (e.key === 'Delete' || e.key === 'Backspace') this.swipe(y ? 'up' : 'left');\n else if (map[e.key]) this.swipe(map[e.key]);\n else return;\n e.preventDefault();\n });\n }\n\n unmount(): void {\n this._s?.stop();\n }\n },\n { id: 'gesture', text: css }\n );\n}\n","import { defineElement, clamp, type UsaElement } from '../base';\nimport { createSpring, type SpringValue } from '../physics/spring';\nimport { gesture } from './core';\nimport css from './gesture.css?raw';\n\n/**\n * `<usa-pinch-zoom>` — pinch (two fingers or Ctrl/⌘ + wheel / trackpad\n * pinch) to zoom its content, pan while zoomed, double-tap to toggle zoom;\n * scale and position spring back inside the bounds on release.\n *\n * Attributes: `min` (1), `max` (4), `double-tap` (zoom level, 2), `preset`.\n * Keyboard: `+` / `-` / `0`. Property `scale`, method `zoomTo(scale)`.\n * Event `usa:zoom` (`{ scale }`). Reduced motion: zoom changes instantly.\n */\nexport interface UsaPinchZoomElement extends UsaElement {\n readonly scale: number;\n zoomTo(scale: number): void;\n}\n\nexport function definePinchZoom(tag = 'usa-pinch-zoom'): CustomElementConstructor | undefined {\n return defineElement(\n tag,\n (Base) =>\n class UsaPinchZoom extends Base {\n private _k!: SpringValue;\n private _x!: SpringValue;\n private _y!: SpringValue;\n private _v = { k: 1, x: 0, y: 0 };\n\n get scale(): number {\n return this._v.k;\n }\n\n private paint(): void {\n const { k, x, y } = this._v;\n this.style.setProperty('--usa-zoom', String(k));\n this.style.setProperty('--usa-zoom-x', `${x}px`);\n this.style.setProperty('--usa-zoom-y', `${y}px`);\n this.toggleAttribute('data-zoomed', k > 1.01);\n }\n\n private bound(k: number, x: number, y: number) {\n const w = (this.clientWidth * (k - 1)) / 2;\n const h = (this.clientHeight * (k - 1)) / 2;\n return { x: clamp(x, -w, w), y: clamp(y, -h, h) };\n }\n\n zoomTo(scale: number): void {\n const k = clamp(scale, this.num('min', 1), this.num('max', 4));\n const b = this.bound(k, this._v.x, this._v.y);\n if (this.reduced) {\n this._v = { k, ...b };\n this.paint();\n } else {\n this._k.set(k);\n this._x.set(b.x);\n this._y.set(b.y);\n }\n this.emit('zoom', { scale: k });\n }\n\n mount(): void {\n const preset = this.str('preset', 'gentle');\n this._k = createSpring({ spring: preset, value: this._v.k, onUpdate: (v) => ((this._v.k = v), this.paint()) });\n this._x = createSpring({ spring: preset, value: this._v.x, onUpdate: (v) => ((this._v.x = v), this.paint()) });\n this._y = createSpring({ spring: preset, value: this._v.y, onUpdate: (v) => ((this._v.y = v), this.paint()) });\n if (!this.hasAttribute('tabindex')) this.tabIndex = 0;\n let base = 1;\n let ox = 0;\n let oy = 0;\n this.onCleanup(\n gesture(this, {\n onPinch: ({ scale, first, last }) => {\n if (first) base = this._v.k;\n const k = clamp(base * scale, this.num('min', 1) * 0.7, this.num('max', 4) * 1.3);\n if (last) return this.zoomTo(k);\n this._k.jump(k);\n },\n onPan: ({ dx, dy, vx, vy, first, last }) => {\n if (this._v.k <= 1.01) return;\n if (first) ((ox = this._v.x), (oy = this._v.y));\n if (!last) {\n this._x.jump(ox + dx);\n this._y.jump(oy + dy);\n return;\n }\n const b = this.bound(this._v.k, ox + dx + vx * 0.15, oy + dy + vy * 0.15);\n this._x.set(b.x, vx);\n this._y.set(b.y, vy);\n },\n onDoubleTap: () => this.zoomTo(this._v.k > 1.01 ? 1 : this.num('double-tap', 2)),\n })\n );\n this.listen(this, 'keydown', (e: KeyboardEvent) => {\n if (e.key === '+' || e.key === '=') this.zoomTo(this._v.k * 1.25);\n else if (e.key === '-') this.zoomTo(this._v.k / 1.25);\n else if (e.key === '0') this.zoomTo(1);\n else return;\n e.preventDefault();\n });\n this.paint();\n }\n\n unmount(): void {\n [this._k, this._x, this._y].forEach((s) => s?.stop());\n }\n },\n { id: 'gesture', text: css }\n );\n}\n","/**\n * use-scroll-animate/components/gesture — unified gestures (v3.2).\n * `gesture()` recognises pan, swipe, pinch, long-press, tap and double-tap\n * with release velocities for springs; `<usa-swipeable>` (swipe-to-dismiss)\n * and `<usa-pinch-zoom>` are built on it.\n */\nimport { defineSwipeable, type UsaSwipeableElement } from './swipeable';\nimport { definePinchZoom, type UsaPinchZoomElement } from './pinch-zoom';\n\nexport { defineSwipeable, definePinchZoom };\nexport { gesture, swipeDirection, pinchScale } from './core';\nexport type { GestureHandlers, GestureOptions, PanState, SwipeState, SwipeDirection, PinchState, PressState } from './core';\nexport type { UsaSwipeableElement, UsaPinchZoomElement };\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 defineGestureComponents(): void {\n defineSwipeable();\n definePinchZoom();\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'usa-swipeable': UsaSwipeableElement;\n 'usa-pinch-zoom': UsaPinchZoomElement;\n }\n}\n"],"names":[],"mappings":";;;;AAyCA;AACM,SAAU,cAAc,CAAC,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,CAAA,GAAgE,EAAE,EAAA;AAC/I,IAAA,MAAM,IAAI,GAAG,CAAC,CAAC,QAAQ,IAAI,EAAE;AAC7B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G,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;AACjF,aAAA,CAAC,CACH;YACD,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,CAAgB,KAAI;gBAChD,IAAI,CAAC,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC,GAAG,KAAK,GAAG;oBAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC;AAC5D,qBAAA,IAAI,CAAC,CAAC,GAAG,KAAK,GAAG;oBAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC;AAChD,qBAAA,IAAI,CAAC,CAAC,GAAG,KAAK,GAAG;AAAE,oBAAA,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;;oBACjC;gBACL,CAAC,CAAC,cAAc,EAAE;AACpB,YAAA,CAAC,CAAC;YACF,IAAI,CAAC,KAAK,EAAE;QACd;QAEA,OAAO,GAAA;YACL,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;QACvD;KACD,EACH,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,EAAE,CAC7B;AACH;;AC7GA;;;;;AAKG;AAWH;SACgB,uBAAuB,GAAA;AACrC,IAAA,eAAe,EAAE;AACjB,IAAA,eAAe,EAAE;AACnB;;;;"}
1
+ {"version":3,"file":"gesture.js","sources":["../../src/components/gesture/swipeable.ts","../../src/components/gesture/pinch-zoom.ts","../../src/components/gesture/index.ts"],"sourcesContent":["import { defineElement, type UsaElement } from '../base';\nimport { createSpring, type SpringValue } from '../physics/spring';\nimport { gesture, type SwipeDirection } from './core';\nimport css from './gesture.css?raw';\n\n/**\n * `<usa-swipeable>` — swipe-to-dismiss / swipe actions. The content follows\n * the finger (rubber-banded past `distance`), flies out on a swipe or a drag\n * past `distance`, otherwise springs home with the release velocity.\n *\n * Attributes: `axis` (`x` default · `y`), `distance` (px, 120), `preset`\n * (spring), `dismiss` (remove the element after flying out), `disabled`.\n * Keyboard: Delete/Backspace dismisses, ←/→ swipe. Events `usa:swipe`\n * (`{ direction }`, cancelable), `usa:dismiss`. Methods `swipe(dir)`, `reset()`.\n * Reduced motion: no follow / fly-out animation, events still fire.\n */\nexport interface UsaSwipeableElement extends UsaElement {\n swipe(direction: SwipeDirection): void;\n reset(): void;\n readonly offset: number;\n}\n\nexport function defineSwipeable(tag = 'usa-swipeable'): CustomElementConstructor | undefined {\n return defineElement(\n tag,\n (Base) =>\n class UsaSwipeable extends Base {\n static get observedAttributes(): string[] {\n return ['axis', 'disabled'];\n }\n private _s!: SpringValue;\n private _off = 0;\n\n get offset(): number {\n return this._off;\n }\n\n private put(v: number): void {\n this._off = v;\n this.style.setProperty('--usa-swipe', `${v}px`);\n this.style.setProperty('--usa-swipe-p', String(Math.min(1, Math.abs(v) / this.num('distance', 120))));\n }\n\n swipe(direction: SwipeDirection): void {\n if (!this.emit('swipe', { direction })) return this.reset();\n const sign = direction === 'left' || direction === 'up' ? -1 : 1;\n const far = sign * ((this.str('axis', 'x') === 'y' ? this.offsetHeight : this.offsetWidth) + 80 || 600);\n const done = () => {\n this.emit('dismiss', { direction });\n if (this.flag('dismiss')) this.remove();\n };\n if (this.reduced) {\n this.put(0);\n return done();\n }\n this.setAttribute('data-gone', '');\n this._s = createSpring({ spring: 'stiff', value: this._off, onUpdate: (v) => this.put(v), onRest: done });\n this._s.set(far, sign * 1500);\n }\n\n reset(): void {\n this.removeAttribute('data-gone');\n if (this.reduced) return this.put(0);\n this._s.set(0);\n }\n\n mount(): void {\n this._s = createSpring({ spring: this.str('preset', 'default'), onUpdate: (v) => this.put(v) });\n if (!this.hasAttribute('tabindex')) this.tabIndex = 0;\n const y = this.str('axis', 'x') === 'y';\n const max = () => this.num('distance', 120);\n this.onCleanup(\n gesture(this, {\n onPan: ({ dx, dy, vx, vy, last }) => {\n if (this.flag('disabled')) return;\n const d = y ? dy : dx;\n if (!last) {\n this._s.stop();\n if (!this.reduced) this.put(Math.abs(d) > max() ? Math.sign(d) * (max() + (Math.abs(d) - max()) * 0.35) : d);\n return;\n }\n if (Math.abs(d) > max()) this.swipe(y ? (d > 0 ? 'down' : 'up') : d > 0 ? 'right' : 'left');\n else if (!this.hasAttribute('data-gone')) {\n if (this.reduced) this.put(0);\n else this._s.set(0, y ? vy : vx);\n }\n },\n onSwipe: ({ direction }) => {\n if (this.flag('disabled') || this.hasAttribute('data-gone')) return;\n if (y === (direction === 'up' || direction === 'down')) this.swipe(direction);\n },\n }, { axis: y ? 'y' : 'x' })\n );\n this.listen(this, 'keydown', (e: KeyboardEvent) => {\n if (this.flag('disabled')) return;\n const map: Record<string, SwipeDirection> = y ? { ArrowUp: 'up', ArrowDown: 'down' } : { ArrowLeft: 'left', ArrowRight: 'right' };\n if (e.key === 'Delete' || e.key === 'Backspace') this.swipe(y ? 'up' : 'left');\n else if (map[e.key]) this.swipe(map[e.key]);\n else return;\n e.preventDefault();\n });\n }\n\n unmount(): void {\n this._s?.stop();\n }\n },\n { id: 'gesture', text: css }\n );\n}\n","import { defineElement, clamp, type UsaElement } from '../base';\nimport { createSpring, type SpringValue } from '../physics/spring';\nimport { gesture } from './core';\nimport css from './gesture.css?raw';\n\n/**\n * `<usa-pinch-zoom>` — pinch (two fingers or Ctrl/⌘ + wheel / trackpad\n * pinch) to zoom its content, pan while zoomed, double-tap to toggle zoom;\n * scale and position spring back inside the bounds on release.\n *\n * Attributes: `min` (1), `max` (4), `double-tap` (zoom level, 2), `preset`.\n * Keyboard: `+` / `-` / `0`. Property `scale`, method `zoomTo(scale)`.\n * Event `usa:zoom` (`{ scale }`). Reduced motion: zoom changes instantly.\n */\nexport interface UsaPinchZoomElement extends UsaElement {\n readonly scale: number;\n zoomTo(scale: number): void;\n}\n\nexport function definePinchZoom(tag = 'usa-pinch-zoom'): CustomElementConstructor | undefined {\n return defineElement(\n tag,\n (Base) =>\n class UsaPinchZoom extends Base {\n private _k!: SpringValue;\n private _x!: SpringValue;\n private _y!: SpringValue;\n private _v = { k: 1, x: 0, y: 0 };\n\n get scale(): number {\n return this._v.k;\n }\n\n private paint(): void {\n const { k, x, y } = this._v;\n this.style.setProperty('--usa-zoom', String(k));\n this.style.setProperty('--usa-zoom-x', `${x}px`);\n this.style.setProperty('--usa-zoom-y', `${y}px`);\n this.toggleAttribute('data-zoomed', k > 1.01);\n }\n\n private bound(k: number, x: number, y: number) {\n const w = (this.clientWidth * (k - 1)) / 2;\n const h = (this.clientHeight * (k - 1)) / 2;\n return { x: clamp(x, -w, w), y: clamp(y, -h, h) };\n }\n\n zoomTo(scale: number): void {\n const k = clamp(scale, this.num('min', 1), this.num('max', 4));\n const b = this.bound(k, this._v.x, this._v.y);\n if (this.reduced) {\n this._v = { k, ...b };\n this.paint();\n } else {\n this._k.set(k);\n this._x.set(b.x);\n this._y.set(b.y);\n }\n this.emit('zoom', { scale: k });\n }\n\n mount(): void {\n const preset = this.str('preset', 'gentle');\n this._k = createSpring({ spring: preset, value: this._v.k, onUpdate: (v) => ((this._v.k = v), this.paint()) });\n this._x = createSpring({ spring: preset, value: this._v.x, onUpdate: (v) => ((this._v.x = v), this.paint()) });\n this._y = createSpring({ spring: preset, value: this._v.y, onUpdate: (v) => ((this._v.y = v), this.paint()) });\n if (!this.hasAttribute('tabindex')) this.tabIndex = 0;\n let base = 1;\n let ox = 0;\n let oy = 0;\n this.onCleanup(\n gesture(this, {\n onPinch: ({ scale, first, last }) => {\n if (first) base = this._v.k;\n const k = clamp(base * scale, this.num('min', 1) * 0.7, this.num('max', 4) * 1.3);\n if (last) return this.zoomTo(k);\n this._k.jump(k);\n },\n onPan: ({ dx, dy, vx, vy, first, last }) => {\n if (this._v.k <= 1.01) return;\n if (first) ((ox = this._v.x), (oy = this._v.y));\n if (!last) {\n this._x.jump(ox + dx);\n this._y.jump(oy + dy);\n return;\n }\n const b = this.bound(this._v.k, ox + dx + vx * 0.15, oy + dy + vy * 0.15);\n this._x.set(b.x, vx);\n this._y.set(b.y, vy);\n },\n onDoubleTap: () => this.zoomTo(this._v.k > 1.01 ? 1 : this.num('double-tap', 2)),\n })\n );\n this.listen(this, 'keydown', (e: KeyboardEvent) => {\n if (e.key === '+' || e.key === '=') this.zoomTo(this._v.k * 1.25);\n else if (e.key === '-') this.zoomTo(this._v.k / 1.25);\n else if (e.key === '0') this.zoomTo(1);\n else return;\n e.preventDefault();\n });\n this.paint();\n }\n\n unmount(): void {\n [this._k, this._x, this._y].forEach((s) => s?.stop());\n }\n },\n { id: 'gesture', text: css }\n );\n}\n","/**\n * use-scroll-animate/components/gesture — unified gestures (v3.2).\n * `gesture()` recognises pan, swipe, pinch, long-press, tap and double-tap\n * with release velocities for springs; `<usa-swipeable>` (swipe-to-dismiss)\n * and `<usa-pinch-zoom>` are built on it.\n */\nimport { defineSwipeable, type UsaSwipeableElement } from './swipeable';\nimport { definePinchZoom, type UsaPinchZoomElement } from './pinch-zoom';\n\nexport { defineSwipeable, definePinchZoom };\nexport { gesture, swipeDirection, pinchScale } from './core';\nexport type { GestureHandlers, GestureOptions, PanState, SwipeState, SwipeDirection, PinchState, PressState } from './core';\nexport type { UsaSwipeableElement, UsaPinchZoomElement };\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 defineGestureComponents(): void {\n defineSwipeable();\n definePinchZoom();\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'usa-swipeable': UsaSwipeableElement;\n 'usa-pinch-zoom': UsaPinchZoomElement;\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAsBM,SAAU,eAAe,CAAC,GAAG,GAAG,eAAe,EAAA;AACnD,IAAA,OAAO,aAAa,CAClB,GAAG,EACH,CAAC,IAAI,KACH,MAAM,YAAa,SAAQ,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AC,CAAC,GAAG,KAAK,GAAG;AAAE,oBAAA,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;;oBACjC;gBACL,CAAC,CAAC,cAAc,EAAE;AACpB,YAAA,CAAC,CAAC;YACF,IAAI,CAAC,KAAK,EAAE;QACd;QAEA,OAAO,GAAA;YACL,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;QACvD;KACD,EACH,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,EAAE,CAC7B;AACH;;AC7GA;;;;;AAKG;AAWH;SACgB,uBAAuB,GAAA;AACrC,IAAA,eAAe,EAAE;AACjB,IAAA,eAAe,EAAE;AACnB;;;;"}
@@ -1,5 +1,5 @@
1
- import { h as defineElement, i as EASE_OUT, r as raf, d as caf, f as clamp, E as EASE_SPRING } from '../chunks/base-Cu-86Z31.js';
2
- export { a as configureComponents, p as prefersReducedMotion } from '../chunks/base-Cu-86Z31.js';
1
+ import { h as defineElement, i as EASE_OUT, r as raf, e as caf, b as clamp, E as EASE_SPRING } from '../chunks/base-BpROOcey.js';
2
+ export { a as configureComponents, p as prefersReducedMotion } from '../chunks/base-BpROOcey.js';
3
3
 
4
4
  var css$5 = "usa-ripple{position:relative;display:inline-block;overflow:hidden;isolation:isolate;border-radius:inherit;-webkit-tap-highlight-color:transparent}usa-ripple[block]{display:block}usa-ripple .usa-ripple-wave{position:absolute;border-radius:50%;pointer-events:none;transform:scale(0);z-index:-1;will-change:transform,opacity}";
5
5
 
@@ -15,6 +15,8 @@ declare const COMPONENT_CATEGORIES: {
15
15
  readonly gesture: readonly ["usa-swipeable", "usa-pinch-zoom"];
16
16
  readonly svg: readonly ["usa-draw", "usa-morph", "usa-mask-reveal", "usa-anim-icon"];
17
17
  readonly webgl: readonly ["usa-shader", "usa-distort", "usa-liquid"];
18
+ readonly depth: readonly ["usa-cube", "usa-depth"];
19
+ readonly layout: readonly ["usa-auto-animate", "usa-masonry"];
18
20
  };
19
21
 
20
22
  /**
@@ -15,6 +15,8 @@ declare const COMPONENT_CATEGORIES: {
15
15
  readonly gesture: readonly ["usa-swipeable", "usa-pinch-zoom"];
16
16
  readonly svg: readonly ["usa-draw", "usa-morph", "usa-mask-reveal", "usa-anim-icon"];
17
17
  readonly webgl: readonly ["usa-shader", "usa-distort", "usa-liquid"];
18
+ readonly depth: readonly ["usa-cube", "usa-depth"];
19
+ readonly layout: readonly ["usa-auto-animate", "usa-masonry"];
18
20
  };
19
21
 
20
22
  /**
@@ -0,0 +1,259 @@
1
+ 'use strict';
2
+
3
+ var base = require('../chunks/base-CXx7jZ-o.cjs');
4
+
5
+ /** FLIP keyframes from a previous box to the current one (pure). */
6
+ function flipFrames(from, to, scale = true) {
7
+ const dx = from.left - to.left;
8
+ const dy = from.top - to.top;
9
+ const sx = scale && to.width ? from.width / to.width : 1;
10
+ const sy = scale && to.height ? from.height / to.height : 1;
11
+ return [
12
+ { transformOrigin: '0 0', transform: `translate(${dx}px, ${dy}px) scale(${sx}, ${sy})` },
13
+ { transformOrigin: '0 0', transform: 'none' },
14
+ ];
15
+ }
16
+ /**
17
+ * Auto-animate a container: children that are added fade / scale in, removed
18
+ * ones fade out in place, and moved ones (re-sort, filter, reflow, resize)
19
+ * glide to their new spot — no extra code at the call site. Returns
20
+ * `{ disable, enable, stop }`. Reduced motion: changes apply instantly.
21
+ *
22
+ * @example
23
+ * const ctl = autoAnimate(document.querySelector('ul'));
24
+ * list.append(item); // animates
25
+ */
26
+ function autoAnimate(parent, o = {}) {
27
+ let on = true;
28
+ const boxes = new WeakMap();
29
+ const rel = (el) => {
30
+ const r = el.getBoundingClientRect();
31
+ const p = parent.getBoundingClientRect();
32
+ return { left: r.left - p.left, top: r.top - p.top, width: r.width, height: r.height };
33
+ };
34
+ const snap = () => Array.from(parent.children).forEach((c) => boxes.set(c, rel(c)));
35
+ const dur = () => (o.duration ?? 300) * base.motionScale();
36
+ const timing = () => ({ duration: dur(), easing: o.easing ?? base.EASE_OUT });
37
+ const animate = (el, frames, t = timing()) => (typeof el.animate === 'function' ? el.animate(frames, t) : null);
38
+ const mo = typeof MutationObserver === 'function'
39
+ ? new MutationObserver((records) => {
40
+ if (!on || base.prefersReducedMotion() || dur() <= 0)
41
+ return snap();
42
+ const added = new Set();
43
+ for (const r of records) {
44
+ r.addedNodes.forEach((n) => n instanceof Element && n.parentElement === parent && added.add(n));
45
+ r.removedNodes.forEach((n) => {
46
+ if (!(n instanceof HTMLElement) || n.isConnected)
47
+ return;
48
+ const b = boxes.get(n);
49
+ if (!b)
50
+ return;
51
+ // put a ghost back at its old place and fade it out
52
+ n.style.position = 'absolute';
53
+ n.style.left = `${b.left}px`;
54
+ n.style.top = `${b.top}px`;
55
+ n.style.width = `${b.width}px`;
56
+ n.style.height = `${b.height}px`;
57
+ n.style.margin = '0';
58
+ n.style.pointerEvents = 'none';
59
+ if (getComputedStyle(parent).position === 'static')
60
+ parent.style.position = 'relative';
61
+ parent.appendChild(n);
62
+ n.__usaGhost = true;
63
+ const a = animate(n, [{ opacity: 1, transform: 'none' }, { opacity: 0, transform: 'scale(0.96)' }]);
64
+ const drop = () => {
65
+ n.remove();
66
+ for (const k of ['position', 'left', 'top', 'width', 'height', 'margin', 'pointerEvents'])
67
+ n.style[k] = '';
68
+ };
69
+ if (a)
70
+ a.finished.then(drop, drop);
71
+ else
72
+ drop();
73
+ });
74
+ }
75
+ Array.from(parent.children).forEach((c) => {
76
+ if (c.__usaGhost)
77
+ return;
78
+ if (added.has(c))
79
+ return void animate(c, [{ opacity: 0, transform: 'scale(0.96)' }, { opacity: 1, transform: 'none' }]);
80
+ const prev = boxes.get(c);
81
+ if (!prev)
82
+ return;
83
+ const now = rel(c);
84
+ if (Math.abs(prev.left - now.left) + Math.abs(prev.top - now.top) + Math.abs(prev.width - now.width) + Math.abs(prev.height - now.height) < 1)
85
+ return;
86
+ animate(c, flipFrames(prev, now, o.scale !== false));
87
+ });
88
+ snap();
89
+ })
90
+ : null;
91
+ mo?.observe(parent, { childList: true });
92
+ const ro = typeof ResizeObserver === 'function' ? new ResizeObserver(() => snap()) : null;
93
+ ro?.observe(parent);
94
+ snap();
95
+ // capture boxes right before any change in the same task (events, timers)
96
+ const capture = () => snap();
97
+ parent.addEventListener('pointerdown', capture, true);
98
+ return {
99
+ enable: () => ((on = true), snap()),
100
+ disable: () => (on = false),
101
+ stop: () => {
102
+ mo?.disconnect();
103
+ ro?.disconnect();
104
+ parent.removeEventListener('pointerdown', capture, true);
105
+ },
106
+ };
107
+ }
108
+ /** Masonry placement: shortest-column-first positions for item heights (pure). */
109
+ function masonryLayout(heights, columns, columnWidth, gap) {
110
+ const cols = Array(Math.max(1, columns)).fill(0);
111
+ const out = heights.map((h) => {
112
+ const c = cols.indexOf(Math.min(...cols));
113
+ const pos = { x: c * (columnWidth + gap), y: cols[c] };
114
+ cols[c] += h + gap;
115
+ return pos;
116
+ });
117
+ out.height = Math.max(0, Math.max(...cols) - gap);
118
+ return out;
119
+ }
120
+ /**
121
+ * Shared-element transition between two states of the page: every element
122
+ * with `data-shared="id"` before `update()` flies to the element with the
123
+ * same id afterwards (size and position), the rest cross-fades. Uses the
124
+ * View Transitions API when present (with `view-transition-name` per id),
125
+ * otherwise a FLIP fallback. Reduced motion: just runs `update()`.
126
+ */
127
+ async function sharedTransition(update, root = document, o = {}) {
128
+ if (base.prefersReducedMotion() || typeof document === 'undefined')
129
+ return void (await update());
130
+ const collect = () => new Map(Array.from(root.querySelectorAll('[data-shared]')).map((el) => [el.dataset.shared, el]));
131
+ const doc = document;
132
+ if (typeof doc.startViewTransition === 'function') {
133
+ const named = (m) => m.forEach((el, id) => (el.style.viewTransitionName = `usa-${id.replace(/[^\w-]/g, '_')}`));
134
+ const clear = (m) => m.forEach((el) => (el.style.viewTransitionName = ''));
135
+ const before = collect();
136
+ named(before);
137
+ let after = new Map();
138
+ const vt = doc.startViewTransition(async () => {
139
+ clear(before);
140
+ await update();
141
+ after = collect();
142
+ named(after);
143
+ });
144
+ await vt.finished.catch(() => undefined);
145
+ clear(after);
146
+ return;
147
+ }
148
+ const before = new Map(Array.from(collect()).map(([id, el]) => [id, el.getBoundingClientRect()]));
149
+ await update();
150
+ const anims = [];
151
+ collect().forEach((el, id) => {
152
+ const a = before.get(id);
153
+ if (!a || typeof el.animate !== 'function')
154
+ return;
155
+ const b = el.getBoundingClientRect();
156
+ if (!b.width || !b.height)
157
+ return;
158
+ anims.push(el.animate(flipFrames(a, b), { duration: (o.duration ?? 450) * base.motionScale(), easing: o.easing ?? base.EASE_OUT }).finished.catch(() => undefined));
159
+ });
160
+ await Promise.all(anims);
161
+ }
162
+
163
+ var css = "usa-auto-animate{display:block}usa-masonry{display:block;column-width:220px;column-gap:16px}usa-masonry>*{break-inside:avoid;margin-bottom:16px}usa-masonry[data-js]{position:relative;columns:auto}usa-masonry[data-js]>*{position:absolute;left:0;top:0;margin:0;box-sizing:border-box;transition:transform 0.45s cubic-bezier(0.22,1,0.36,1)}@media (prefers-reduced-motion:reduce){usa-masonry[data-js]>*{transition:none}}";
164
+
165
+ function defineAutoAnimate(tag = 'usa-auto-animate') {
166
+ return base.defineElement(tag, (Base) => class UsaAutoAnimate extends Base {
167
+ constructor() {
168
+ super(...arguments);
169
+ this._c = null;
170
+ }
171
+ enable() {
172
+ this._c?.enable();
173
+ }
174
+ disable() {
175
+ this._c?.disable();
176
+ }
177
+ mount() {
178
+ const c = (this._c = autoAnimate(this, { duration: this.num('duration', 300), scale: !this.flag('no-scale') }));
179
+ this.onCleanup(() => c.stop());
180
+ }
181
+ }, { id: 'layout', text: css });
182
+ }
183
+ function defineMasonry(tag = 'usa-masonry') {
184
+ return base.defineElement(tag, (Base) => class UsaMasonry extends Base {
185
+ static get observedAttributes() {
186
+ return ['columns', 'min', 'gap'];
187
+ }
188
+ changed() {
189
+ this.layout();
190
+ }
191
+ layout() {
192
+ const items = Array.from(this.children).filter((c) => !c.__usaGhost);
193
+ const w = this.clientWidth;
194
+ if (!w)
195
+ return;
196
+ const gap = this.num('gap', 16);
197
+ const cols = this.num('columns', 0) || Math.max(1, Math.floor((w + gap) / (this.num('min', 220) + gap)));
198
+ const cw = (w - gap * (cols - 1)) / cols;
199
+ items.forEach((el) => (el.style.width = `${cw}px`));
200
+ const pos = masonryLayout(items.map((el) => el.offsetHeight), cols, cw, gap);
201
+ items.forEach((el, i) => (el.style.transform = `translate(${pos[i].x}px, ${pos[i].y}px)`));
202
+ this.style.height = `${pos.height}px`;
203
+ this.style.setProperty('--usa-masonry-cols', String(cols));
204
+ }
205
+ mount() {
206
+ this.setAttribute('data-js', '');
207
+ this.onCleanup(() => this.removeAttribute('data-js'));
208
+ let id = 0;
209
+ const queue = () => {
210
+ if (id)
211
+ return;
212
+ id = requestAnimationFrame(() => {
213
+ id = 0;
214
+ this.layout();
215
+ });
216
+ };
217
+ if (typeof ResizeObserver === 'function') {
218
+ const ro = new ResizeObserver(queue);
219
+ ro.observe(this);
220
+ Array.from(this.children).forEach((c) => ro.observe(c));
221
+ const mo = new MutationObserver((recs) => {
222
+ recs.forEach((r) => r.addedNodes.forEach((n) => n instanceof Element && ro.observe(n)));
223
+ queue();
224
+ });
225
+ mo.observe(this, { childList: true });
226
+ this.onCleanup(() => (ro.disconnect(), mo.disconnect()));
227
+ }
228
+ this.listen(this, 'load', queue, { capture: true });
229
+ this.layout();
230
+ }
231
+ unmount() {
232
+ this.style.height = '';
233
+ Array.from(this.children).forEach((c) => (c.style.transform = '', c.style.width = ''));
234
+ }
235
+ }, { id: 'layout', text: css });
236
+ }
237
+
238
+ /**
239
+ * use-scroll-animate/components/layout — layout animation (v3.6).
240
+ * `autoAnimate()` / `<usa-auto-animate>` (list & grid reflow),
241
+ * `<usa-masonry>`, and `sharedTransition()` for shared-element transitions
242
+ * (View Transitions API with a FLIP fallback).
243
+ */
244
+ /** Register every component of this category under its default tag. */
245
+ function defineLayoutComponents() {
246
+ defineAutoAnimate();
247
+ defineMasonry();
248
+ }
249
+
250
+ exports.configureComponents = base.configureComponents;
251
+ exports.prefersReducedMotion = base.prefersReducedMotion;
252
+ exports.autoAnimate = autoAnimate;
253
+ exports.defineAutoAnimate = defineAutoAnimate;
254
+ exports.defineLayoutComponents = defineLayoutComponents;
255
+ exports.defineMasonry = defineMasonry;
256
+ exports.flipFrames = flipFrames;
257
+ exports.masonryLayout = masonryLayout;
258
+ exports.sharedTransition = sharedTransition;
259
+ //# sourceMappingURL=layout.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.cjs","sources":["../../src/components/layout/core.ts","../../src/components/layout/elements.ts","../../src/components/layout/index.ts"],"sourcesContent":["import { prefersReducedMotion, motionScale, EASE_OUT } from '../base';\n\ntype Box = { left: number; top: number; width: number; height: number };\n\n/** FLIP keyframes from a previous box to the current one (pure). */\nexport function flipFrames(from: Box, to: Box, scale = true): Keyframe[] {\n const dx = from.left - to.left;\n const dy = from.top - to.top;\n const sx = scale && to.width ? from.width / to.width : 1;\n const sy = scale && to.height ? from.height / to.height : 1;\n return [\n { transformOrigin: '0 0', transform: `translate(${dx}px, ${dy}px) scale(${sx}, ${sy})` },\n { transformOrigin: '0 0', transform: 'none' },\n ];\n}\n\nexport interface AutoAnimateOptions {\n duration?: number;\n easing?: string;\n /** Also animate size changes (default true). */\n scale?: boolean;\n}\n\n/**\n * Auto-animate a container: children that are added fade / scale in, removed\n * ones fade out in place, and moved ones (re-sort, filter, reflow, resize)\n * glide to their new spot — no extra code at the call site. Returns\n * `{ disable, enable, stop }`. Reduced motion: changes apply instantly.\n *\n * @example\n * const ctl = autoAnimate(document.querySelector('ul'));\n * list.append(item); // animates\n */\nexport function autoAnimate(parent: HTMLElement, o: AutoAnimateOptions = {}): { enable(): void; disable(): void; stop(): void } {\n let on = true;\n const boxes = new WeakMap<Element, Box>();\n const rel = (el: Element): Box => {\n const r = el.getBoundingClientRect();\n const p = parent.getBoundingClientRect();\n return { left: r.left - p.left, top: r.top - p.top, width: r.width, height: r.height };\n };\n const snap = () => Array.from(parent.children).forEach((c) => boxes.set(c, rel(c)));\n const dur = () => (o.duration ?? 300) * motionScale();\n const timing = (): KeyframeAnimationOptions => ({ duration: dur(), easing: o.easing ?? EASE_OUT });\n const animate = (el: Element, frames: Keyframe[], t = timing()) => (typeof (el as HTMLElement).animate === 'function' ? (el as HTMLElement).animate(frames, t) : null);\n\n const mo =\n typeof MutationObserver === 'function'\n ? new MutationObserver((records) => {\n if (!on || prefersReducedMotion() || dur() <= 0) return snap();\n const added = new Set<Element>();\n for (const r of records) {\n r.addedNodes.forEach((n) => n instanceof Element && n.parentElement === parent && added.add(n));\n r.removedNodes.forEach((n) => {\n if (!(n instanceof HTMLElement) || n.isConnected) return;\n const b = boxes.get(n);\n if (!b) return;\n // put a ghost back at its old place and fade it out\n n.style.position = 'absolute';\n n.style.left = `${b.left}px`;\n n.style.top = `${b.top}px`;\n n.style.width = `${b.width}px`;\n n.style.height = `${b.height}px`;\n n.style.margin = '0';\n n.style.pointerEvents = 'none';\n if (getComputedStyle(parent).position === 'static') parent.style.position = 'relative';\n parent.appendChild(n);\n (n as any).__usaGhost = true;\n const a = animate(n, [{ opacity: 1, transform: 'none' }, { opacity: 0, transform: 'scale(0.96)' }]);\n const drop = () => {\n n.remove();\n for (const k of ['position', 'left', 'top', 'width', 'height', 'margin', 'pointerEvents'] as const) n.style[k] = '';\n };\n if (a) a.finished.then(drop, drop);\n else drop();\n });\n }\n Array.from(parent.children).forEach((c) => {\n if ((c as any).__usaGhost) return;\n if (added.has(c)) return void animate(c, [{ opacity: 0, transform: 'scale(0.96)' }, { opacity: 1, transform: 'none' }]);\n const prev = boxes.get(c);\n if (!prev) return;\n const now = rel(c);\n if (Math.abs(prev.left - now.left) + Math.abs(prev.top - now.top) + Math.abs(prev.width - now.width) + Math.abs(prev.height - now.height) < 1) return;\n animate(c, flipFrames(prev, now, o.scale !== false));\n });\n snap();\n })\n : null;\n mo?.observe(parent, { childList: true });\n const ro = typeof ResizeObserver === 'function' ? new ResizeObserver(() => snap()) : null;\n ro?.observe(parent);\n snap();\n // capture boxes right before any change in the same task (events, timers)\n const capture = () => snap();\n parent.addEventListener('pointerdown', capture, true);\n return {\n enable: () => ((on = true), snap()),\n disable: () => (on = false),\n stop: () => {\n mo?.disconnect();\n ro?.disconnect();\n parent.removeEventListener('pointerdown', capture, true);\n },\n };\n}\n\n/** Masonry placement: shortest-column-first positions for item heights (pure). */\nexport function masonryLayout(heights: number[], columns: number, columnWidth: number, gap: number): { x: number; y: number }[] & { height?: number } {\n const cols = Array(Math.max(1, columns)).fill(0);\n const out = heights.map((h) => {\n const c = cols.indexOf(Math.min(...cols));\n const pos = { x: c * (columnWidth + gap), y: cols[c] };\n cols[c] += h + gap;\n return pos;\n }) as { x: number; y: number }[] & { height?: number };\n out.height = Math.max(0, Math.max(...cols) - gap);\n return out;\n}\n\nexport interface SharedOptions {\n duration?: number;\n easing?: string;\n}\n\n/**\n * Shared-element transition between two states of the page: every element\n * with `data-shared=\"id\"` before `update()` flies to the element with the\n * same id afterwards (size and position), the rest cross-fades. Uses the\n * View Transitions API when present (with `view-transition-name` per id),\n * otherwise a FLIP fallback. Reduced motion: just runs `update()`.\n */\nexport async function sharedTransition(update: () => void | Promise<void>, root: ParentNode = document, o: SharedOptions = {}): Promise<void> {\n if (prefersReducedMotion() || typeof document === 'undefined') return void (await update());\n const collect = () => new Map(Array.from(root.querySelectorAll<HTMLElement>('[data-shared]')).map((el) => [el.dataset.shared!, el]));\n const doc = document as any;\n if (typeof doc.startViewTransition === 'function') {\n const named = (m: Map<string, HTMLElement>) => m.forEach((el, id) => (el.style.viewTransitionName = `usa-${id.replace(/[^\\w-]/g, '_')}`));\n const clear = (m: Map<string, HTMLElement>) => m.forEach((el) => (el.style.viewTransitionName = ''));\n const before = collect();\n named(before);\n let after = new Map<string, HTMLElement>();\n const vt = doc.startViewTransition(async () => {\n clear(before);\n await update();\n after = collect();\n named(after);\n });\n await vt.finished.catch(() => undefined);\n clear(after);\n return;\n }\n const before = new Map(Array.from(collect()).map(([id, el]) => [id, el.getBoundingClientRect()]));\n await update();\n const anims: Promise<unknown>[] = [];\n collect().forEach((el, id) => {\n const a = before.get(id);\n if (!a || typeof el.animate !== 'function') return;\n const b = el.getBoundingClientRect();\n if (!b.width || !b.height) return;\n anims.push(el.animate(flipFrames(a, b), { duration: (o.duration ?? 450) * motionScale(), easing: o.easing ?? EASE_OUT }).finished.catch(() => undefined));\n });\n await Promise.all(anims);\n}\n","import { defineElement, type UsaElement } from '../base';\nimport { autoAnimate, masonryLayout } from './core';\nimport css from './layout.css?raw';\n\n/**\n * `<usa-auto-animate>` — wraps `autoAnimate()`: any change to its children\n * (add, remove, re-order, filter, size) animates. Attributes `duration`\n * (300), `no-scale`. Works for lists and CSS grids alike.\n */\nexport interface UsaAutoAnimateElement extends UsaElement {\n enable(): void;\n disable(): void;\n}\n\nexport function defineAutoAnimate(tag = 'usa-auto-animate'): CustomElementConstructor | undefined {\n return defineElement(\n tag,\n (Base) =>\n class UsaAutoAnimate extends Base {\n private _c: ReturnType<typeof autoAnimate> | null = null;\n enable(): void {\n this._c?.enable();\n }\n disable(): void {\n this._c?.disable();\n }\n mount(): void {\n const c = (this._c = autoAnimate(this, { duration: this.num('duration', 300), scale: !this.flag('no-scale') }));\n this.onCleanup(() => c.stop());\n }\n },\n { id: 'layout', text: css }\n );\n}\n\n/**\n * `<usa-masonry>` — a masonry (Pinterest-style) grid: children are placed in\n * the shortest column and glide to new spots when the width, the items or\n * their sizes change. Attributes `columns` (fixed count) or `min` (min\n * column width px, 220), `gap` (16). Without JS layout support it is a\n * plain CSS multi-column flow. Reduced motion: no glide.\n */\nexport interface UsaMasonryElement extends UsaElement {\n layout(): void;\n}\n\nexport function defineMasonry(tag = 'usa-masonry'): CustomElementConstructor | undefined {\n return defineElement(\n tag,\n (Base) =>\n class UsaMasonry extends Base {\n static get observedAttributes(): string[] {\n return ['columns', 'min', 'gap'];\n }\n changed(): void {\n this.layout();\n }\n layout(): void {\n const items = Array.from(this.children).filter((c) => !(c as any).__usaGhost) as HTMLElement[];\n const w = this.clientWidth;\n if (!w) return;\n const gap = this.num('gap', 16);\n const cols = this.num('columns', 0) || Math.max(1, Math.floor((w + gap) / (this.num('min', 220) + gap)));\n const cw = (w - gap * (cols - 1)) / cols;\n items.forEach((el) => (el.style.width = `${cw}px`));\n const pos = masonryLayout(items.map((el) => el.offsetHeight), cols, cw, gap);\n items.forEach((el, i) => (el.style.transform = `translate(${pos[i].x}px, ${pos[i].y}px)`));\n this.style.height = `${pos.height}px`;\n this.style.setProperty('--usa-masonry-cols', String(cols));\n }\n mount(): void {\n this.setAttribute('data-js', '');\n this.onCleanup(() => this.removeAttribute('data-js'));\n let id = 0;\n const queue = () => {\n if (id) return;\n id = requestAnimationFrame(() => {\n id = 0;\n this.layout();\n });\n };\n if (typeof ResizeObserver === 'function') {\n const ro = new ResizeObserver(queue);\n ro.observe(this);\n Array.from(this.children).forEach((c) => ro.observe(c));\n const mo = new MutationObserver((recs) => {\n recs.forEach((r) => r.addedNodes.forEach((n) => n instanceof Element && ro.observe(n)));\n queue();\n });\n mo.observe(this, { childList: true });\n this.onCleanup(() => (ro.disconnect(), mo.disconnect()));\n }\n this.listen(this, 'load', queue, { capture: true });\n this.layout();\n }\n unmount(): void {\n this.style.height = '';\n Array.from(this.children).forEach((c) => ((c as HTMLElement).style.transform = '', (c as HTMLElement).style.width = ''));\n }\n },\n { id: 'layout', text: css }\n );\n}\n","/**\n * use-scroll-animate/components/layout — layout animation (v3.6).\n * `autoAnimate()` / `<usa-auto-animate>` (list & grid reflow),\n * `<usa-masonry>`, and `sharedTransition()` for shared-element transitions\n * (View Transitions API with a FLIP fallback).\n */\nimport { defineAutoAnimate, defineMasonry, type UsaAutoAnimateElement, type UsaMasonryElement } from './elements';\n\nexport { defineAutoAnimate, defineMasonry };\nexport { autoAnimate, masonryLayout, sharedTransition, flipFrames } from './core';\nexport type { AutoAnimateOptions, SharedOptions } from './core';\nexport type { UsaAutoAnimateElement, UsaMasonryElement };\nexport { configureComponents, prefersReducedMotion } from '../base';\nexport type { ComponentsConfig, UsaElement } from '../base';\n\n/** Register every component of this category under its default tag. */\nexport function defineLayoutComponents(): void {\n defineAutoAnimate();\n defineMasonry();\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'usa-auto-animate': UsaAutoAnimateElement;\n 'usa-masonry': UsaMasonryElement;\n }\n}\n"],"names":["motionScale","EASE_OUT","prefersReducedMotion","defineElement"],"mappings":";;;;AAIA;AACM,SAAU,UAAU,CAAC,IAAS,EAAE,EAAO,EAAE,KAAK,GAAG,IAAI,EAAA;IACzD,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI;IAC9B,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG;IAC5B,MAAM,EAAE,GAAG,KAAK,IAAI,EAAE,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,KAAK,GAAG,CAAC;IACxD,MAAM,EAAE,GAAG,KAAK,IAAI,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,MAAM,GAAG,CAAC;IAC3D,OAAO;AACL,QAAA,EAAE,eAAe,EAAE,KAAK,EAAE,SAAS,EAAE,CAAA,UAAA,EAAa,EAAE,CAAA,IAAA,EAAO,EAAE,CAAA,UAAA,EAAa,EAAE,CAAA,EAAA,EAAK,EAAE,GAAG,EAAE;AACxF,QAAA,EAAE,eAAe,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE;KAC9C;AACH;AASA;;;;;;;;;AASG;SACa,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,EAA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AAC,CAAC,CAAC,KAAK,CAAC,YAAY,OAAO,IAAI,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AACvF,oBAAA,KAAK,EAAE;AACT,gBAAA,CAAC,CAAC;gBACF,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AACrC,gBAAA,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;AAUH;SACgB,sBAAsB,GAAA;AACpC,IAAA,iBAAiB,EAAE;AACnB,IAAA,aAAa,EAAE;AACjB;;;;;;;;;;;;"}
@@ -0,0 +1,3 @@
1
+ /* use-scroll-animate/components/layout */
2
+ .usa-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}
3
+ usa-auto-animate{display:block}usa-masonry{display:block;column-width:220px;column-gap:16px}usa-masonry>*{break-inside:avoid;margin-bottom:16px}usa-masonry[data-js]{position:relative;columns:auto}usa-masonry[data-js]>*{position:absolute;left:0;top:0;margin:0;box-sizing:border-box;transition:transform 0.45s cubic-bezier(0.22,1,0.36,1)}@media (prefers-reduced-motion:reduce){usa-masonry[data-js]>*{transition:none}}
@@ -0,0 +1,134 @@
1
+ /**
2
+ * use-scroll-animate/components — shared base for the `<usa-*>` custom elements.
3
+ *
4
+ * Everything here is lazy: nothing touches `window`, `document`,
5
+ * `HTMLElement` or `matchMedia` at import time, so the components can be
6
+ * imported during SSR (Next, Nuxt, Astro…) and in Electron/Tauri preload
7
+ * scripts. Classes are created the first time a `define*()` function runs.
8
+ */
9
+ interface ComponentsConfig {
10
+ /**
11
+ * Inject each component's CSS when it is defined (default `true`). Uses a
12
+ * constructable stylesheet (`document.adoptedStyleSheets`, which a strict
13
+ * `style-src` CSP does not block) and falls back to a `<style>` tag. Set
14
+ * to `false` when you load `use-scroll-animate/components.css` yourself.
15
+ */
16
+ injectStyles?: boolean;
17
+ /**
18
+ * `'user'` (default) follows `prefers-reduced-motion`; `'reduce'` always
19
+ * uses the reduced variants (e.g. a kiosk / battery-saver mode);
20
+ * `'no-preference'` ignores the OS setting (only for demos — respect your users).
21
+ */
22
+ reducedMotion?: 'user' | 'reduce' | 'no-preference';
23
+ /**
24
+ * Global motion intensity (v2.7): `'off'` (same as reduced motion),
25
+ * `'low'` (shorter, calmer), `'normal'` (default) or `'high'`. Scales every
26
+ * component animation's duration and sets `--usa-motion` (0 / 0.6 / 1 /
27
+ * 1.25) on `<html>` for your own CSS. See `setMotionIntensity()`.
28
+ */
29
+ motionIntensity?: MotionIntensity;
30
+ }
31
+ type MotionIntensity = 'off' | 'low' | 'normal' | 'high';
32
+ /** Change global component settings (call before `define*()` for `injectStyles`). */
33
+ declare function configureComponents(options: ComponentsConfig): void;
34
+ /** `true` when animations should be reduced (OS setting or `configureComponents`). */
35
+ declare function prefersReducedMotion(): boolean;
36
+ /**
37
+ * Members shared by every `<usa-*>` element. Attribute helpers, a cleanup
38
+ * bag that is emptied on disconnect, and motion helpers that degrade to the
39
+ * final state without WAAPI or under reduced motion.
40
+ */
41
+ interface UsaElement extends HTMLElement {
42
+ /** `true` while reduced motion applies to this element. */
43
+ readonly reduced: boolean;
44
+ }
45
+
46
+ /**
47
+ * `<usa-auto-animate>` — wraps `autoAnimate()`: any change to its children
48
+ * (add, remove, re-order, filter, size) animates. Attributes `duration`
49
+ * (300), `no-scale`. Works for lists and CSS grids alike.
50
+ */
51
+ interface UsaAutoAnimateElement extends UsaElement {
52
+ enable(): void;
53
+ disable(): void;
54
+ }
55
+ declare function defineAutoAnimate(tag?: string): CustomElementConstructor | undefined;
56
+ /**
57
+ * `<usa-masonry>` — a masonry (Pinterest-style) grid: children are placed in
58
+ * the shortest column and glide to new spots when the width, the items or
59
+ * their sizes change. Attributes `columns` (fixed count) or `min` (min
60
+ * column width px, 220), `gap` (16). Without JS layout support it is a
61
+ * plain CSS multi-column flow. Reduced motion: no glide.
62
+ */
63
+ interface UsaMasonryElement extends UsaElement {
64
+ layout(): void;
65
+ }
66
+ declare function defineMasonry(tag?: string): CustomElementConstructor | undefined;
67
+
68
+ type Box = {
69
+ left: number;
70
+ top: number;
71
+ width: number;
72
+ height: number;
73
+ };
74
+ /** FLIP keyframes from a previous box to the current one (pure). */
75
+ declare function flipFrames(from: Box, to: Box, scale?: boolean): Keyframe[];
76
+ interface AutoAnimateOptions {
77
+ duration?: number;
78
+ easing?: string;
79
+ /** Also animate size changes (default true). */
80
+ scale?: boolean;
81
+ }
82
+ /**
83
+ * Auto-animate a container: children that are added fade / scale in, removed
84
+ * ones fade out in place, and moved ones (re-sort, filter, reflow, resize)
85
+ * glide to their new spot — no extra code at the call site. Returns
86
+ * `{ disable, enable, stop }`. Reduced motion: changes apply instantly.
87
+ *
88
+ * @example
89
+ * const ctl = autoAnimate(document.querySelector('ul'));
90
+ * list.append(item); // animates
91
+ */
92
+ declare function autoAnimate(parent: HTMLElement, o?: AutoAnimateOptions): {
93
+ enable(): void;
94
+ disable(): void;
95
+ stop(): void;
96
+ };
97
+ /** Masonry placement: shortest-column-first positions for item heights (pure). */
98
+ declare function masonryLayout(heights: number[], columns: number, columnWidth: number, gap: number): {
99
+ x: number;
100
+ y: number;
101
+ }[] & {
102
+ height?: number;
103
+ };
104
+ interface SharedOptions {
105
+ duration?: number;
106
+ easing?: string;
107
+ }
108
+ /**
109
+ * Shared-element transition between two states of the page: every element
110
+ * with `data-shared="id"` before `update()` flies to the element with the
111
+ * same id afterwards (size and position), the rest cross-fades. Uses the
112
+ * View Transitions API when present (with `view-transition-name` per id),
113
+ * otherwise a FLIP fallback. Reduced motion: just runs `update()`.
114
+ */
115
+ declare function sharedTransition(update: () => void | Promise<void>, root?: ParentNode, o?: SharedOptions): Promise<void>;
116
+
117
+ /**
118
+ * use-scroll-animate/components/layout — layout animation (v3.6).
119
+ * `autoAnimate()` / `<usa-auto-animate>` (list & grid reflow),
120
+ * `<usa-masonry>`, and `sharedTransition()` for shared-element transitions
121
+ * (View Transitions API with a FLIP fallback).
122
+ */
123
+
124
+ /** Register every component of this category under its default tag. */
125
+ declare function defineLayoutComponents(): void;
126
+ declare global {
127
+ interface HTMLElementTagNameMap {
128
+ 'usa-auto-animate': UsaAutoAnimateElement;
129
+ 'usa-masonry': UsaMasonryElement;
130
+ }
131
+ }
132
+
133
+ export { autoAnimate, configureComponents, defineAutoAnimate, defineLayoutComponents, defineMasonry, flipFrames, masonryLayout, prefersReducedMotion, sharedTransition };
134
+ export type { AutoAnimateOptions, ComponentsConfig, SharedOptions, UsaAutoAnimateElement, UsaElement, UsaMasonryElement };