motionary 10.7.0 → 10.8.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 (129) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +42 -3
  3. package/dist/chunks/{anim-image-CFGpUX7t.cjs → anim-image-BzTQa2k3.cjs} +2 -2
  4. package/dist/chunks/{anim-image-CFGpUX7t.cjs.map → anim-image-BzTQa2k3.cjs.map} +1 -1
  5. package/dist/chunks/{anim-image-CXDD19FH.js → anim-image-iD646Q7i.js} +2 -2
  6. package/dist/chunks/{anim-image-CXDD19FH.js.map → anim-image-iD646Q7i.js.map} +1 -1
  7. package/dist/chunks/{keyframes-DwR6GPej.js → keyframes-B4zefz0k.js} +2 -2
  8. package/dist/chunks/{keyframes-DwR6GPej.js.map → keyframes-B4zefz0k.js.map} +1 -1
  9. package/dist/chunks/{keyframes-DdwGY1gr.cjs → keyframes-BlOyB1PP.cjs} +2 -2
  10. package/dist/chunks/{keyframes-DdwGY1gr.cjs.map → keyframes-BlOyB1PP.cjs.map} +1 -1
  11. package/dist/chunks/{registry-DhKZCitb.cjs → registry-BZxDVL3h.cjs} +2 -2
  12. package/dist/chunks/{registry-DhKZCitb.cjs.map → registry-BZxDVL3h.cjs.map} +1 -1
  13. package/dist/chunks/{registry-D87dP_aR.js → registry-Bkt3-3ET.js} +3 -3
  14. package/dist/chunks/{registry-D87dP_aR.js.map → registry-Bkt3-3ET.js.map} +1 -1
  15. package/dist/chunks/runtime-link-CUiZ8lbE.cjs +38 -0
  16. package/dist/chunks/runtime-link-CUiZ8lbE.cjs.map +1 -0
  17. package/dist/chunks/runtime-link-c13gskBZ.js +36 -0
  18. package/dist/chunks/runtime-link-c13gskBZ.js.map +1 -0
  19. package/dist/chunks/{ticker-jD9_A9Rh.cjs → ticker-BfxAECfO.cjs} +2 -2
  20. package/dist/chunks/{ticker-jD9_A9Rh.cjs.map → ticker-BfxAECfO.cjs.map} +1 -1
  21. package/dist/chunks/{ticker-CJYI5Pxc.js → ticker-ZtweD3U4.js} +2 -2
  22. package/dist/chunks/{ticker-CJYI5Pxc.js.map → ticker-ZtweD3U4.js.map} +1 -1
  23. package/dist/chunks/{tween-Dk0QmNe9.cjs → tween--MD-39y0.cjs} +2 -2
  24. package/dist/chunks/{tween-Dk0QmNe9.cjs.map → tween--MD-39y0.cjs.map} +1 -1
  25. package/dist/chunks/{tween-_Lld1MsF.js → tween-DACdkLyO.js} +2 -2
  26. package/dist/chunks/{tween-_Lld1MsF.js.map → tween-DACdkLyO.js.map} +1 -1
  27. package/dist/components/snap-carousel.cjs +216 -0
  28. package/dist/components/snap-carousel.cjs.map +1 -0
  29. package/dist/components/snap-carousel.d.cts +80 -0
  30. package/dist/components/snap-carousel.d.ts +80 -0
  31. package/dist/components/snap-carousel.js +214 -0
  32. package/dist/components/snap-carousel.js.map +1 -0
  33. package/dist/components/widgets.cjs +32 -46
  34. package/dist/components/widgets.cjs.map +1 -1
  35. package/dist/components/widgets.d.cts +77 -4
  36. package/dist/components/widgets.d.ts +77 -4
  37. package/dist/components/widgets.js +22 -36
  38. package/dist/components/widgets.js.map +1 -1
  39. package/dist/llms-full.txt +94 -6
  40. package/dist/llms.txt +6 -3
  41. package/dist/manifest.json +260 -19
  42. package/dist/runtime/drag-snap.cjs +269 -0
  43. package/dist/runtime/drag-snap.cjs.map +1 -0
  44. package/dist/runtime/drag-snap.d.cts +109 -0
  45. package/dist/runtime/drag-snap.d.ts +109 -0
  46. package/dist/runtime/drag-snap.iife.js +2 -0
  47. package/dist/runtime/drag-snap.iife.js.map +1 -0
  48. package/dist/runtime/drag-snap.js +261 -0
  49. package/dist/runtime/drag-snap.js.map +1 -0
  50. package/dist/runtime/format-apng.cjs +4 -4
  51. package/dist/runtime/format-apng.js +4 -4
  52. package/dist/runtime/format-css.cjs +4 -4
  53. package/dist/runtime/format-css.js +4 -4
  54. package/dist/runtime/format-gif.cjs +4 -4
  55. package/dist/runtime/format-gif.js +4 -4
  56. package/dist/runtime/format-gltf.cjs +37 -18
  57. package/dist/runtime/format-gltf.cjs.map +1 -1
  58. package/dist/runtime/format-gltf.d.cts +18 -2
  59. package/dist/runtime/format-gltf.d.ts +18 -2
  60. package/dist/runtime/format-gltf.iife.js +1 -1
  61. package/dist/runtime/format-gltf.iife.js.map +1 -1
  62. package/dist/runtime/format-gltf.js +37 -18
  63. package/dist/runtime/format-gltf.js.map +1 -1
  64. package/dist/runtime/format-motion.cjs +4 -4
  65. package/dist/runtime/format-motion.js +4 -4
  66. package/dist/runtime/format-obj.cjs +1 -1
  67. package/dist/runtime/format-obj.d.cts +2 -0
  68. package/dist/runtime/format-obj.d.ts +2 -0
  69. package/dist/runtime/format-obj.iife.js.map +1 -1
  70. package/dist/runtime/format-obj.js +1 -1
  71. package/dist/runtime/format-scene.cjs +1 -1
  72. package/dist/runtime/format-scene.js +1 -1
  73. package/dist/runtime/format-sprite.cjs +3 -3
  74. package/dist/runtime/format-sprite.js +3 -3
  75. package/dist/runtime/format-svg.cjs +3 -3
  76. package/dist/runtime/format-svg.js +3 -3
  77. package/dist/runtime/format-webp.cjs +4 -4
  78. package/dist/runtime/format-webp.js +4 -4
  79. package/dist/runtime/gl.cjs +17 -4
  80. package/dist/runtime/gl.cjs.map +1 -1
  81. package/dist/runtime/gl.d.cts +2 -0
  82. package/dist/runtime/gl.d.ts +2 -0
  83. package/dist/runtime/gl.iife.js +1 -1
  84. package/dist/runtime/gl.iife.js.map +1 -1
  85. package/dist/runtime/gl.js +17 -4
  86. package/dist/runtime/gl.js.map +1 -1
  87. package/dist/runtime/gltf-anim.cjs +251 -0
  88. package/dist/runtime/gltf-anim.cjs.map +1 -0
  89. package/dist/runtime/gltf-anim.d.cts +216 -0
  90. package/dist/runtime/gltf-anim.d.ts +216 -0
  91. package/dist/runtime/gltf-anim.iife.js +2 -0
  92. package/dist/runtime/gltf-anim.iife.js.map +1 -0
  93. package/dist/runtime/gltf-anim.js +243 -0
  94. package/dist/runtime/gltf-anim.js.map +1 -0
  95. package/dist/runtime/physics.cjs +1 -1
  96. package/dist/runtime/physics.js +1 -1
  97. package/dist/runtime/scroll.cjs +2 -2
  98. package/dist/runtime/scroll.js +2 -2
  99. package/dist/runtime/smooth.cjs +1 -1
  100. package/dist/runtime/smooth.js +1 -1
  101. package/dist/runtime/text.cjs +1 -1
  102. package/dist/runtime/text.js +1 -1
  103. package/dist/runtime/vector.cjs +421 -11
  104. package/dist/runtime/vector.cjs.map +1 -1
  105. package/dist/runtime/vector.d.cts +20 -4
  106. package/dist/runtime/vector.d.ts +20 -4
  107. package/dist/runtime/vector.iife.js +1 -1
  108. package/dist/runtime/vector.iife.js.map +1 -1
  109. package/dist/runtime/vector.js +421 -12
  110. package/dist/runtime/vector.js.map +1 -1
  111. package/dist/runtime.cjs +3 -3
  112. package/dist/runtime.d.cts +1 -1
  113. package/dist/runtime.d.ts +1 -1
  114. package/dist/runtime.iife.js +1 -1
  115. package/dist/runtime.iife.js.map +1 -1
  116. package/dist/runtime.js +5 -5
  117. package/dist/widgets.umd.js +1 -1
  118. package/dist/widgets.umd.js.map +1 -1
  119. package/docs/ROADMAP.md +1 -1
  120. package/docs/components/README.md +3 -2
  121. package/docs/components/usa-gl-scene.md +27 -6
  122. package/docs/components/usa-lottie-player.md +18 -0
  123. package/docs/components/usa-snap-carousel.md +68 -0
  124. package/docs/components.md +51 -3
  125. package/docs/runtime/drag-snap.md +60 -0
  126. package/docs/runtime/format-gltf.md +3 -2
  127. package/docs/runtime/gltf-anim.md +62 -0
  128. package/docs/runtime/vector.md +3 -2
  129. package/package.json +31 -1
@@ -0,0 +1,216 @@
1
+ 'use strict';
2
+
3
+ var base = require('../chunks/base-DBheNxJu.cjs');
4
+ var runtimeLink = require('../chunks/runtime-link-CUiZ8lbE.cjs');
5
+ require('../chunks/registry-BZxDVL3h.cjs');
6
+
7
+ var css = "usa-snap-carousel{display:block;position:relative;--usa-sc-size:80%;--usa-sc-gap:16px;--usa-sc-accent:#7c5cff}.usa-sc-viewport{overflow:hidden;border-radius:var(--usa-radius,14px);outline:none;cursor:grab}.usa-sc-viewport:focus-visible{box-shadow:0 0 0 2px var(--usa-sc-accent)}usa-snap-carousel[data-dragging] .usa-sc-viewport{cursor:grabbing}.usa-sc-track{display:flex;gap:var(--usa-sc-gap);will-change:transform;user-select:none;-webkit-user-select:none}.usa-sc-track>*{flex:0 0 var(--usa-sc-size);min-width:0;box-sizing:border-box;transition:opacity .3s,transform .3s}.usa-sc-track img{pointer-events:none;-webkit-user-drag:none}usa-snap-carousel:not([data-ready]) .usa-sc-viewport{overflow-x:auto;scroll-snap-type:x mandatory;scrollbar-width:thin}usa-snap-carousel:not([data-ready]) .usa-sc-track>*{scroll-snap-align:center}usa-snap-carousel[data-ready] .usa-sc-track>:not([data-active]){opacity:.55;transform:scale(.94)}.usa-sc-nav{position:absolute;top:calc(50% - 18px);z-index:2;width:36px;height:36px;border-radius:50%;border:0;background:rgba(255,255,255,.9);color:#111;font:600 20px/1 system-ui;cursor:pointer;display:grid;place-items:center;box-shadow:0 4px 14px rgba(0,0,0,.18)}.usa-sc-nav:disabled{opacity:.35;cursor:default}.usa-sc-nav:focus-visible,.usa-sc-dot:focus-visible{outline:2px solid var(--usa-sc-accent);outline-offset:2px}.usa-sc-prev{left:8px}.usa-sc-next{right:8px}.usa-sc-dots{display:flex;justify-content:center;gap:6px;padding-top:10px}.usa-sc-dot{width:8px;height:8px;padding:0;border:0;border-radius:99px;background:color-mix(in srgb,currentColor 30%,transparent);cursor:pointer;transition:width .3s,background .3s}.usa-sc-dot[aria-current=\"true\"]{width:22px;background:var(--usa-sc-accent)}.usa-sc-live{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;margin:0}@media (prefers-reduced-motion:reduce){.usa-sc-track>*,.usa-sc-dot{transition:none}}";
8
+
9
+ function defineSnapCarousel(tag = 'usa-snap-carousel') {
10
+ return base.defineElement(tag, (Base) => {
11
+ class UsaSnapCarousel extends Base {
12
+ constructor() {
13
+ super(...arguments);
14
+ this.slides = [];
15
+ this.ds = null;
16
+ this.cur = 0;
17
+ this.sync = null;
18
+ }
19
+ static get observedAttributes() {
20
+ return ['align', 'gap', 'autoplay', 'no-controls', 'no-dots', 'label'];
21
+ }
22
+ get length() {
23
+ return this.slides.length;
24
+ }
25
+ get index() {
26
+ return this.cur;
27
+ }
28
+ set index(v) {
29
+ this.goTo(v);
30
+ }
31
+ get controller() {
32
+ return this.ds;
33
+ }
34
+ next() {
35
+ this.goTo(this.cur + 1 >= this.length ? 0 : this.cur + 1);
36
+ }
37
+ prev() {
38
+ this.goTo(this.cur - 1 < 0 ? this.length - 1 : this.cur - 1);
39
+ }
40
+ goTo(i, animate = true) {
41
+ const n = Math.max(0, Math.min(this.length - 1, Math.round(i)));
42
+ if (this.ds)
43
+ this.ds.snapTo(n, animate && !this.reduced);
44
+ else {
45
+ this.slides[n]?.scrollIntoView?.({ block: 'nearest', inline: 'center' });
46
+ this.set(n);
47
+ }
48
+ }
49
+ set(n) {
50
+ if (n === this.cur && this.dataset.ready !== undefined)
51
+ return this.sync?.();
52
+ const from = this.cur;
53
+ this.cur = n;
54
+ this.sync?.();
55
+ if (from !== n)
56
+ this.emit('change', { index: n, from });
57
+ }
58
+ mount() {
59
+ // structure first (works without the runtime as a CSS scroll-snap strip)
60
+ let vp = this.querySelector(':scope > .usa-sc-viewport');
61
+ let track = vp?.querySelector(':scope > .usa-sc-track') || null;
62
+ if (!vp || !track) {
63
+ vp = document.createElement('div');
64
+ vp.className = 'usa-sc-viewport';
65
+ track = document.createElement('div');
66
+ track.className = 'usa-sc-track';
67
+ for (const c of Array.from(this.children))
68
+ if (c instanceof HTMLElement && !c.matches('.usa-rt-missing, .usa-sc-ui'))
69
+ track.append(c);
70
+ vp.append(track);
71
+ this.append(vp);
72
+ }
73
+ this.querySelectorAll(':scope > .usa-sc-ui').forEach((x) => x.remove());
74
+ this.slides = Array.from(track.children);
75
+ const N = this.slides.length;
76
+ this.setAttribute('role', 'region');
77
+ this.setAttribute('aria-roledescription', 'carousel');
78
+ this.setAttribute('aria-label', this.str('label', 'Carousel'));
79
+ vp.tabIndex = 0;
80
+ vp.setAttribute('aria-label', `${this.str('label', 'Carousel')} — use the arrow keys`);
81
+ this.style.setProperty('--usa-sc-gap', `${this.num('gap', 16)}px`);
82
+ this.slides.forEach((s, i) => {
83
+ s.setAttribute('role', 'group');
84
+ s.setAttribute('aria-roledescription', 'slide');
85
+ s.setAttribute('aria-label', `${i + 1} of ${N}`);
86
+ });
87
+ const live = document.createElement('p');
88
+ live.className = 'usa-sc-ui usa-sc-live';
89
+ live.setAttribute('aria-live', 'polite');
90
+ this.append(live);
91
+ let prevB = null, nextB = null;
92
+ if (!this.flag('no-controls') && N > 1) {
93
+ const mk = (cls, label, glyph, fn) => {
94
+ const b = document.createElement('button');
95
+ b.type = 'button';
96
+ b.className = `usa-sc-ui usa-sc-nav ${cls}`;
97
+ b.setAttribute('aria-label', label);
98
+ b.textContent = glyph;
99
+ this.listen(b, 'click', fn);
100
+ this.append(b);
101
+ return b;
102
+ };
103
+ prevB = mk('usa-sc-prev', 'Previous slide', '‹', () => this.goTo(this.cur - 1));
104
+ nextB = mk('usa-sc-next', 'Next slide', '›', () => this.goTo(this.cur + 1));
105
+ }
106
+ const dots = [];
107
+ if (!this.flag('no-dots') && N > 1) {
108
+ const nav = document.createElement('div');
109
+ nav.className = 'usa-sc-ui usa-sc-dots';
110
+ nav.setAttribute('role', 'group');
111
+ nav.setAttribute('aria-label', 'Choose a slide');
112
+ this.slides.forEach((_, i) => {
113
+ const d = document.createElement('button');
114
+ d.type = 'button';
115
+ d.className = 'usa-sc-dot';
116
+ d.setAttribute('aria-label', `Go to slide ${i + 1}`);
117
+ this.listen(d, 'click', () => this.goTo(i));
118
+ nav.append(d);
119
+ dots.push(d);
120
+ });
121
+ this.append(nav);
122
+ }
123
+ let announce = false;
124
+ this.sync = () => {
125
+ dots.forEach((d, i) => d.setAttribute('aria-current', String(i === this.cur)));
126
+ if (prevB)
127
+ prevB.disabled = this.cur <= 0;
128
+ if (nextB)
129
+ nextB.disabled = this.cur >= N - 1;
130
+ this.slides.forEach((s, i) => s.toggleAttribute('data-active', i === this.cur));
131
+ if (announce)
132
+ live.textContent = `Slide ${this.cur + 1} of ${N}`;
133
+ };
134
+ this.listen(vp, 'keydown', (e) => {
135
+ const k = e.key;
136
+ const to = k === 'ArrowRight' ? this.cur + 1 : k === 'ArrowLeft' ? this.cur - 1 : k === 'Home' ? 0 : k === 'End' ? N - 1 : null;
137
+ if (to === null)
138
+ return;
139
+ e.preventDefault();
140
+ announce = true;
141
+ this.goTo(to);
142
+ });
143
+ this.listen(this, 'click', (e) => {
144
+ if (e.target?.closest?.('.usa-sc-nav, .usa-sc-dot'))
145
+ announce = true;
146
+ }, { capture: true });
147
+ const DS = runtimeLink.runtimeModule(this, 'drag-snap');
148
+ const start = Math.max(0, Math.min(N - 1, this.num('index', 0)));
149
+ this.cur = start;
150
+ if (!DS) {
151
+ this.sync();
152
+ return;
153
+ }
154
+ this.dataset.ready = '';
155
+ const center = this.str('align', 'center') !== 'start';
156
+ const measure = () => {
157
+ const vw = vp.clientWidth;
158
+ const max = Math.max(0, track.scrollWidth - vw);
159
+ return this.slides.map((s) => {
160
+ const p = -(s.offsetLeft - (center ? (vw - s.offsetWidth) / 2 : 0));
161
+ return center ? p : Math.max(-max, Math.min(0, p));
162
+ });
163
+ };
164
+ const apply = (p) => (track.style.transform = `translate3d(${p.toFixed(2)}px,0,0)`);
165
+ const ds = DS.createDragSnap(track, {
166
+ axis: 'x',
167
+ snap: measure(),
168
+ reducedMotion: this.reduced,
169
+ onUpdate: apply,
170
+ onSnap: (i) => this.set(i),
171
+ onDragStart: () => this.toggleAttribute('data-dragging', true),
172
+ onDragEnd: () => this.toggleAttribute('data-dragging', false),
173
+ });
174
+ this.ds = ds;
175
+ ds.snapTo(start, false);
176
+ this.set(start);
177
+ this.onCleanup(() => {
178
+ ds.dispose();
179
+ this.ds = null;
180
+ track.style.transform = '';
181
+ });
182
+ const remeasure = () => ds.setSnapPoints(measure());
183
+ this.listen(window, 'resize', remeasure, { passive: true });
184
+ if (typeof ResizeObserver === 'function') {
185
+ const ro = new ResizeObserver(remeasure);
186
+ ro.observe(vp);
187
+ this.onCleanup(() => ro.disconnect());
188
+ }
189
+ // autoplay: paused on hover / focus / press / off screen; never under reduced motion
190
+ const every = this.num('autoplay', 0);
191
+ if (every > 0 && N > 1 && !this.reduced) {
192
+ let hold = 0, seen = true;
193
+ const h = (d) => () => (hold = Math.max(0, hold + d));
194
+ this.listen(this, 'pointerenter', h(1));
195
+ this.listen(this, 'pointerleave', h(-1));
196
+ this.listen(this, 'focusin', h(1));
197
+ this.listen(this, 'focusout', h(-1));
198
+ this.inView((v) => (seen = v));
199
+ const t = setInterval(() => {
200
+ if (!hold && seen && !ds.dragging)
201
+ this.goTo(this.cur + 1 >= N ? 0 : this.cur + 1);
202
+ }, Math.max(1200, every));
203
+ this.onCleanup(() => clearInterval(t));
204
+ }
205
+ }
206
+ unmount() {
207
+ this.removeAttribute('data-ready');
208
+ this.removeAttribute('data-dragging');
209
+ }
210
+ }
211
+ return UsaSnapCarousel;
212
+ }, { id: 'snap-carousel', text: css });
213
+ }
214
+
215
+ exports.defineSnapCarousel = defineSnapCarousel;
216
+ //# sourceMappingURL=snap-carousel.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snap-carousel.cjs","sources":["../../src/components/widgets/snap-carousel.ts"],"sourcesContent":["import { defineElement, type UsaElement } from '../base';\nimport { runtimeModule } from './runtime-link';\nimport type { DragSnapApi, DragSnap } from '../../runtime/drag-snap';\nimport css from './snap-carousel.css?raw';\n\n/**\n * `<usa-snap-carousel>` (10.8) — a drag / swipe carousel with inertia and\n * snap points on **`motionary/runtime/drag-snap`** (requires `use(dragSnap)`\n * before it mounts). Each child is a slide; slides keep their own width\n * (CSS `--usa-sc-size`, default 80 %), so several can be visible (\"peek\").\n *\n * Its own entry point — `motionary/components/snap-carousel` — and **not**\n * part of `motionary/components/widgets` or `motionary/components/lite`\n * (10.8+ components ship as individual entry points so the bundles stay put).\n *\n * Attributes: `align` (start · center, default center), `gap` (px, default\n * 16), `index` (start slide), `autoplay` (ms; pauses on hover, focus, press,\n * off screen and under reduced motion; wraps), `no-controls`, `no-dots`,\n * `label` (accessible name, default \"Carousel\"). Keyboard: ←/→, Home / End\n * on the focused viewport. Without the runtime module the slides stay a\n * native CSS scroll-snap strip (plus the clear notice).\n *\n * API: `index`, `length`, `controller` (the DragSnap), `next()`, `prev()`,\n * `goTo(i, animate = true)`; `usa:change` { index, from }.\n */\nexport interface UsaSnapCarouselElement extends UsaElement {\n index: number;\n readonly length: number;\n readonly controller: DragSnap | null;\n next(): void;\n prev(): void;\n goTo(i: number, animate?: boolean): void;\n}\n\nexport function defineSnapCarousel(tag = 'usa-snap-carousel'): CustomElementConstructor | undefined {\n return defineElement(\n tag,\n (Base) => {\n class UsaSnapCarousel extends Base {\n static get observedAttributes(): string[] {\n return ['align', 'gap', 'autoplay', 'no-controls', 'no-dots', 'label'];\n }\n private slides: HTMLElement[] = [];\n private ds: DragSnap | null = null;\n private cur = 0;\n private sync: (() => void) | null = null;\n get length(): number {\n return this.slides.length;\n }\n get index(): number {\n return this.cur;\n }\n set index(v: number) {\n this.goTo(v);\n }\n get controller(): DragSnap | null {\n return this.ds;\n }\n next(): void {\n this.goTo(this.cur + 1 >= this.length ? 0 : this.cur + 1);\n }\n prev(): void {\n this.goTo(this.cur - 1 < 0 ? this.length - 1 : this.cur - 1);\n }\n goTo(i: number, animate = true): void {\n const n = Math.max(0, Math.min(this.length - 1, Math.round(i)));\n if (this.ds) this.ds.snapTo(n, animate && !this.reduced);\n else {\n this.slides[n]?.scrollIntoView?.({ block: 'nearest', inline: 'center' });\n this.set(n);\n }\n }\n private set(n: number): void {\n if (n === this.cur && this.dataset.ready !== undefined) return this.sync?.();\n const from = this.cur;\n this.cur = n;\n this.sync?.();\n if (from !== n) this.emit('change', { index: n, from });\n }\n mount(): void {\n // structure first (works without the runtime as a CSS scroll-snap strip)\n let vp = this.querySelector<HTMLElement>(':scope > .usa-sc-viewport');\n let track = vp?.querySelector<HTMLElement>(':scope > .usa-sc-track') || null;\n if (!vp || !track) {\n vp = document.createElement('div');\n vp.className = 'usa-sc-viewport';\n track = document.createElement('div');\n track.className = 'usa-sc-track';\n for (const c of Array.from(this.children)) if (c instanceof HTMLElement && !c.matches('.usa-rt-missing, .usa-sc-ui')) track.append(c);\n vp.append(track);\n this.append(vp);\n }\n this.querySelectorAll(':scope > .usa-sc-ui').forEach((x) => x.remove());\n this.slides = Array.from(track.children) as HTMLElement[];\n const N = this.slides.length;\n this.setAttribute('role', 'region');\n this.setAttribute('aria-roledescription', 'carousel');\n this.setAttribute('aria-label', this.str('label', 'Carousel'));\n vp.tabIndex = 0;\n vp.setAttribute('aria-label', `${this.str('label', 'Carousel')} — use the arrow keys`);\n this.style.setProperty('--usa-sc-gap', `${this.num('gap', 16)}px`);\n this.slides.forEach((s, i) => {\n s.setAttribute('role', 'group');\n s.setAttribute('aria-roledescription', 'slide');\n s.setAttribute('aria-label', `${i + 1} of ${N}`);\n });\n const live = document.createElement('p');\n live.className = 'usa-sc-ui usa-sc-live';\n live.setAttribute('aria-live', 'polite');\n this.append(live);\n let prevB: HTMLButtonElement | null = null, nextB: HTMLButtonElement | null = null;\n if (!this.flag('no-controls') && N > 1) {\n const mk = (cls: string, label: string, glyph: string, fn: () => void) => {\n const b = document.createElement('button');\n b.type = 'button';\n b.className = `usa-sc-ui usa-sc-nav ${cls}`;\n b.setAttribute('aria-label', label);\n b.textContent = glyph;\n this.listen(b, 'click', fn);\n this.append(b);\n return b;\n };\n prevB = mk('usa-sc-prev', 'Previous slide', '‹', () => this.goTo(this.cur - 1));\n nextB = mk('usa-sc-next', 'Next slide', '›', () => this.goTo(this.cur + 1));\n }\n const dots: HTMLButtonElement[] = [];\n if (!this.flag('no-dots') && N > 1) {\n const nav = document.createElement('div');\n nav.className = 'usa-sc-ui usa-sc-dots';\n nav.setAttribute('role', 'group');\n nav.setAttribute('aria-label', 'Choose a slide');\n this.slides.forEach((_, i) => {\n const d = document.createElement('button');\n d.type = 'button';\n d.className = 'usa-sc-dot';\n d.setAttribute('aria-label', `Go to slide ${i + 1}`);\n this.listen(d, 'click', () => this.goTo(i));\n nav.append(d);\n dots.push(d);\n });\n this.append(nav);\n }\n let announce = false;\n this.sync = () => {\n dots.forEach((d, i) => d.setAttribute('aria-current', String(i === this.cur)));\n if (prevB) prevB.disabled = this.cur <= 0;\n if (nextB) nextB.disabled = this.cur >= N - 1;\n this.slides.forEach((s, i) => s.toggleAttribute('data-active', i === this.cur));\n if (announce) live.textContent = `Slide ${this.cur + 1} of ${N}`;\n };\n this.listen(vp, 'keydown', (e: KeyboardEvent) => {\n const k = e.key;\n const to = k === 'ArrowRight' ? this.cur + 1 : k === 'ArrowLeft' ? this.cur - 1 : k === 'Home' ? 0 : k === 'End' ? N - 1 : null;\n if (to === null) return;\n e.preventDefault();\n announce = true;\n this.goTo(to);\n });\n this.listen(this, 'click', (e: Event) => {\n if ((e.target as Element)?.closest?.('.usa-sc-nav, .usa-sc-dot')) announce = true;\n }, { capture: true });\n const DS = runtimeModule<DragSnapApi>(this, 'drag-snap');\n const start = Math.max(0, Math.min(N - 1, this.num('index', 0)));\n this.cur = start;\n if (!DS) {\n this.sync();\n return;\n }\n this.dataset.ready = '';\n const center = this.str('align', 'center') !== 'start';\n const measure = (): number[] => {\n const vw = vp!.clientWidth;\n const max = Math.max(0, track!.scrollWidth - vw);\n return this.slides.map((s) => {\n const p = -(s.offsetLeft - (center ? (vw - s.offsetWidth) / 2 : 0));\n return center ? p : Math.max(-max, Math.min(0, p));\n });\n };\n const apply = (p: number) => (track!.style.transform = `translate3d(${p.toFixed(2)}px,0,0)`);\n const ds = DS.createDragSnap(track, {\n axis: 'x',\n snap: measure(),\n reducedMotion: this.reduced,\n onUpdate: apply,\n onSnap: (i) => this.set(i),\n onDragStart: () => this.toggleAttribute('data-dragging', true),\n onDragEnd: () => this.toggleAttribute('data-dragging', false),\n });\n this.ds = ds;\n ds.snapTo(start, false);\n this.set(start);\n this.onCleanup(() => {\n ds.dispose();\n this.ds = null;\n track!.style.transform = '';\n });\n const remeasure = () => ds.setSnapPoints(measure());\n this.listen(window, 'resize', remeasure, { passive: true });\n if (typeof ResizeObserver === 'function') {\n const ro = new ResizeObserver(remeasure);\n ro.observe(vp);\n this.onCleanup(() => ro.disconnect());\n }\n // autoplay: paused on hover / focus / press / off screen; never under reduced motion\n const every = this.num('autoplay', 0);\n if (every > 0 && N > 1 && !this.reduced) {\n let hold = 0, seen = true;\n const h = (d: number) => () => (hold = Math.max(0, hold + d));\n this.listen(this, 'pointerenter', h(1));\n this.listen(this, 'pointerleave', h(-1));\n this.listen(this, 'focusin', h(1));\n this.listen(this, 'focusout', h(-1));\n this.inView((v) => (seen = v));\n const t = setInterval(() => {\n if (!hold && seen && !ds.dragging) this.goTo(this.cur + 1 >= N ? 0 : this.cur + 1);\n }, Math.max(1200, every));\n this.onCleanup(() => clearInterval(t));\n }\n }\n unmount(): void {\n this.removeAttribute('data-ready');\n this.removeAttribute('data-dragging');\n }\n }\n return UsaSnapCarousel as unknown as CustomElementConstructor;\n },\n { id: 'snap-carousel', text: css }\n );\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'usa-snap-carousel': UsaSnapCarouselElement;\n }\n}\n"],"names":["defineElement","runtimeModule"],"mappings":";;;;;;;;AAkCM,SAAU,kBAAkB,CAAC,GAAG,GAAG,mBAAmB,EAAA;AAC1D,IAAA,OAAOA,kBAAa,CAClB,GAAG,EACH,CAAC,IAAI,KAAI;QACP,MAAM,eAAgB,SAAQ,IAAI,CAAA;AAAlC,YAAA,WAAA,GAAA;;gBAIU,IAAA,CAAA,MAAM,GAAkB,EAAE;gBAC1B,IAAA,CAAA,EAAE,GAAoB,IAAI;gBAC1B,IAAA,CAAA,GAAG,GAAG,CAAC;gBACP,I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Ae,CAAC,YAAY,CAAC;AAClC,gBAAA,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC;YACvC;AACD;AACD,QAAA,OAAO,eAAsD;IAC/D,CAAC,EACD,EAAE,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,GAAG,EAAE,CACnC;AACH;;"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Members shared by every `<usa-*>` element. Attribute helpers, a cleanup
3
+ * bag that is emptied on disconnect, and motion helpers that degrade to the
4
+ * final state without WAAPI or under reduced motion.
5
+ */
6
+ interface UsaElement extends HTMLElement {
7
+ /** `true` while reduced motion applies to this element. */
8
+ readonly reduced: boolean;
9
+ }
10
+
11
+ /**
12
+ * `motionary/runtime/drag-snap` (10.8) — pointer drag with inertia and snap
13
+ * points, for carousels, sheets, sliders and pickers (own implementation).
14
+ *
15
+ * - one axis (`x` / `y`) per controller; pointer, touch and pen through
16
+ * Pointer Events, a movement threshold before a drag starts (so clicks
17
+ * inside still work), `touch-action` set for the other axis;
18
+ * - velocity from the last 100 ms of samples; release projects the throw
19
+ * with constant deceleration and snaps to the nearest point (or to the
20
+ * next / previous point for a fast flick, `flick`), with a critically
21
+ * damped spring on the shared ticker;
22
+ * - bounds with rubber-band resistance past the ends;
23
+ * - `createDragSnap(el, options)`; `snapTo(index)`, `setPosition(px)`, `setSnapPoints([...])`; reduced
24
+ * motion: no inertia, snaps without the spring.
25
+ *
26
+ * The maths (`projectThrow`, `nearestSnap`, `rubberband`, `springStep`,
27
+ * `velocityTracker`) is pure and exported for tests / workers.
28
+ */
29
+
30
+ type Num = number;
31
+ interface DragSnap {
32
+ readonly position: Num;
33
+ readonly index: Num;
34
+ readonly dragging: boolean;
35
+ readonly moving: boolean;
36
+ snapTo(index: Num, animate?: boolean): void;
37
+ setPosition(px: Num, animate?: boolean): void;
38
+ setSnapPoints(points: Num[], bounds?: [Num, Num]): void;
39
+ /** Where a release at `velocity` would come to rest (index). */
40
+ targetFor(position: Num, velocity: Num): Num;
41
+ dispose(): void;
42
+ }
43
+
44
+ /**
45
+ * `<usa-snap-carousel>` (10.8) — a drag / swipe carousel with inertia and
46
+ * snap points on **`motionary/runtime/drag-snap`** (requires `use(dragSnap)`
47
+ * before it mounts). Each child is a slide; slides keep their own width
48
+ * (CSS `--usa-sc-size`, default 80 %), so several can be visible ("peek").
49
+ *
50
+ * Its own entry point — `motionary/components/snap-carousel` — and **not**
51
+ * part of `motionary/components/widgets` or `motionary/components/lite`
52
+ * (10.8+ components ship as individual entry points so the bundles stay put).
53
+ *
54
+ * Attributes: `align` (start · center, default center), `gap` (px, default
55
+ * 16), `index` (start slide), `autoplay` (ms; pauses on hover, focus, press,
56
+ * off screen and under reduced motion; wraps), `no-controls`, `no-dots`,
57
+ * `label` (accessible name, default "Carousel"). Keyboard: ←/→, Home / End
58
+ * on the focused viewport. Without the runtime module the slides stay a
59
+ * native CSS scroll-snap strip (plus the clear notice).
60
+ *
61
+ * API: `index`, `length`, `controller` (the DragSnap), `next()`, `prev()`,
62
+ * `goTo(i, animate = true)`; `usa:change` { index, from }.
63
+ */
64
+ interface UsaSnapCarouselElement extends UsaElement {
65
+ index: number;
66
+ readonly length: number;
67
+ readonly controller: DragSnap | null;
68
+ next(): void;
69
+ prev(): void;
70
+ goTo(i: number, animate?: boolean): void;
71
+ }
72
+ declare function defineSnapCarousel(tag?: string): CustomElementConstructor | undefined;
73
+ declare global {
74
+ interface HTMLElementTagNameMap {
75
+ 'usa-snap-carousel': UsaSnapCarouselElement;
76
+ }
77
+ }
78
+
79
+ export { defineSnapCarousel };
80
+ export type { UsaSnapCarouselElement };
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Members shared by every `<usa-*>` element. Attribute helpers, a cleanup
3
+ * bag that is emptied on disconnect, and motion helpers that degrade to the
4
+ * final state without WAAPI or under reduced motion.
5
+ */
6
+ interface UsaElement extends HTMLElement {
7
+ /** `true` while reduced motion applies to this element. */
8
+ readonly reduced: boolean;
9
+ }
10
+
11
+ /**
12
+ * `motionary/runtime/drag-snap` (10.8) — pointer drag with inertia and snap
13
+ * points, for carousels, sheets, sliders and pickers (own implementation).
14
+ *
15
+ * - one axis (`x` / `y`) per controller; pointer, touch and pen through
16
+ * Pointer Events, a movement threshold before a drag starts (so clicks
17
+ * inside still work), `touch-action` set for the other axis;
18
+ * - velocity from the last 100 ms of samples; release projects the throw
19
+ * with constant deceleration and snaps to the nearest point (or to the
20
+ * next / previous point for a fast flick, `flick`), with a critically
21
+ * damped spring on the shared ticker;
22
+ * - bounds with rubber-band resistance past the ends;
23
+ * - `createDragSnap(el, options)`; `snapTo(index)`, `setPosition(px)`, `setSnapPoints([...])`; reduced
24
+ * motion: no inertia, snaps without the spring.
25
+ *
26
+ * The maths (`projectThrow`, `nearestSnap`, `rubberband`, `springStep`,
27
+ * `velocityTracker`) is pure and exported for tests / workers.
28
+ */
29
+
30
+ type Num = number;
31
+ interface DragSnap {
32
+ readonly position: Num;
33
+ readonly index: Num;
34
+ readonly dragging: boolean;
35
+ readonly moving: boolean;
36
+ snapTo(index: Num, animate?: boolean): void;
37
+ setPosition(px: Num, animate?: boolean): void;
38
+ setSnapPoints(points: Num[], bounds?: [Num, Num]): void;
39
+ /** Where a release at `velocity` would come to rest (index). */
40
+ targetFor(position: Num, velocity: Num): Num;
41
+ dispose(): void;
42
+ }
43
+
44
+ /**
45
+ * `<usa-snap-carousel>` (10.8) — a drag / swipe carousel with inertia and
46
+ * snap points on **`motionary/runtime/drag-snap`** (requires `use(dragSnap)`
47
+ * before it mounts). Each child is a slide; slides keep their own width
48
+ * (CSS `--usa-sc-size`, default 80 %), so several can be visible ("peek").
49
+ *
50
+ * Its own entry point — `motionary/components/snap-carousel` — and **not**
51
+ * part of `motionary/components/widgets` or `motionary/components/lite`
52
+ * (10.8+ components ship as individual entry points so the bundles stay put).
53
+ *
54
+ * Attributes: `align` (start · center, default center), `gap` (px, default
55
+ * 16), `index` (start slide), `autoplay` (ms; pauses on hover, focus, press,
56
+ * off screen and under reduced motion; wraps), `no-controls`, `no-dots`,
57
+ * `label` (accessible name, default "Carousel"). Keyboard: ←/→, Home / End
58
+ * on the focused viewport. Without the runtime module the slides stay a
59
+ * native CSS scroll-snap strip (plus the clear notice).
60
+ *
61
+ * API: `index`, `length`, `controller` (the DragSnap), `next()`, `prev()`,
62
+ * `goTo(i, animate = true)`; `usa:change` { index, from }.
63
+ */
64
+ interface UsaSnapCarouselElement extends UsaElement {
65
+ index: number;
66
+ readonly length: number;
67
+ readonly controller: DragSnap | null;
68
+ next(): void;
69
+ prev(): void;
70
+ goTo(i: number, animate?: boolean): void;
71
+ }
72
+ declare function defineSnapCarousel(tag?: string): CustomElementConstructor | undefined;
73
+ declare global {
74
+ interface HTMLElementTagNameMap {
75
+ 'usa-snap-carousel': UsaSnapCarouselElement;
76
+ }
77
+ }
78
+
79
+ export { defineSnapCarousel };
80
+ export type { UsaSnapCarouselElement };
@@ -0,0 +1,214 @@
1
+ import { f as defineElement } from '../chunks/base-BTev8qxg.js';
2
+ import { r as runtimeModule } from '../chunks/runtime-link-c13gskBZ.js';
3
+ import '../chunks/registry-Bkt3-3ET.js';
4
+
5
+ var css = "usa-snap-carousel{display:block;position:relative;--usa-sc-size:80%;--usa-sc-gap:16px;--usa-sc-accent:#7c5cff}.usa-sc-viewport{overflow:hidden;border-radius:var(--usa-radius,14px);outline:none;cursor:grab}.usa-sc-viewport:focus-visible{box-shadow:0 0 0 2px var(--usa-sc-accent)}usa-snap-carousel[data-dragging] .usa-sc-viewport{cursor:grabbing}.usa-sc-track{display:flex;gap:var(--usa-sc-gap);will-change:transform;user-select:none;-webkit-user-select:none}.usa-sc-track>*{flex:0 0 var(--usa-sc-size);min-width:0;box-sizing:border-box;transition:opacity .3s,transform .3s}.usa-sc-track img{pointer-events:none;-webkit-user-drag:none}usa-snap-carousel:not([data-ready]) .usa-sc-viewport{overflow-x:auto;scroll-snap-type:x mandatory;scrollbar-width:thin}usa-snap-carousel:not([data-ready]) .usa-sc-track>*{scroll-snap-align:center}usa-snap-carousel[data-ready] .usa-sc-track>:not([data-active]){opacity:.55;transform:scale(.94)}.usa-sc-nav{position:absolute;top:calc(50% - 18px);z-index:2;width:36px;height:36px;border-radius:50%;border:0;background:rgba(255,255,255,.9);color:#111;font:600 20px/1 system-ui;cursor:pointer;display:grid;place-items:center;box-shadow:0 4px 14px rgba(0,0,0,.18)}.usa-sc-nav:disabled{opacity:.35;cursor:default}.usa-sc-nav:focus-visible,.usa-sc-dot:focus-visible{outline:2px solid var(--usa-sc-accent);outline-offset:2px}.usa-sc-prev{left:8px}.usa-sc-next{right:8px}.usa-sc-dots{display:flex;justify-content:center;gap:6px;padding-top:10px}.usa-sc-dot{width:8px;height:8px;padding:0;border:0;border-radius:99px;background:color-mix(in srgb,currentColor 30%,transparent);cursor:pointer;transition:width .3s,background .3s}.usa-sc-dot[aria-current=\"true\"]{width:22px;background:var(--usa-sc-accent)}.usa-sc-live{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;margin:0}@media (prefers-reduced-motion:reduce){.usa-sc-track>*,.usa-sc-dot{transition:none}}";
6
+
7
+ function defineSnapCarousel(tag = 'usa-snap-carousel') {
8
+ return defineElement(tag, (Base) => {
9
+ class UsaSnapCarousel extends Base {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.slides = [];
13
+ this.ds = null;
14
+ this.cur = 0;
15
+ this.sync = null;
16
+ }
17
+ static get observedAttributes() {
18
+ return ['align', 'gap', 'autoplay', 'no-controls', 'no-dots', 'label'];
19
+ }
20
+ get length() {
21
+ return this.slides.length;
22
+ }
23
+ get index() {
24
+ return this.cur;
25
+ }
26
+ set index(v) {
27
+ this.goTo(v);
28
+ }
29
+ get controller() {
30
+ return this.ds;
31
+ }
32
+ next() {
33
+ this.goTo(this.cur + 1 >= this.length ? 0 : this.cur + 1);
34
+ }
35
+ prev() {
36
+ this.goTo(this.cur - 1 < 0 ? this.length - 1 : this.cur - 1);
37
+ }
38
+ goTo(i, animate = true) {
39
+ const n = Math.max(0, Math.min(this.length - 1, Math.round(i)));
40
+ if (this.ds)
41
+ this.ds.snapTo(n, animate && !this.reduced);
42
+ else {
43
+ this.slides[n]?.scrollIntoView?.({ block: 'nearest', inline: 'center' });
44
+ this.set(n);
45
+ }
46
+ }
47
+ set(n) {
48
+ if (n === this.cur && this.dataset.ready !== undefined)
49
+ return this.sync?.();
50
+ const from = this.cur;
51
+ this.cur = n;
52
+ this.sync?.();
53
+ if (from !== n)
54
+ this.emit('change', { index: n, from });
55
+ }
56
+ mount() {
57
+ // structure first (works without the runtime as a CSS scroll-snap strip)
58
+ let vp = this.querySelector(':scope > .usa-sc-viewport');
59
+ let track = vp?.querySelector(':scope > .usa-sc-track') || null;
60
+ if (!vp || !track) {
61
+ vp = document.createElement('div');
62
+ vp.className = 'usa-sc-viewport';
63
+ track = document.createElement('div');
64
+ track.className = 'usa-sc-track';
65
+ for (const c of Array.from(this.children))
66
+ if (c instanceof HTMLElement && !c.matches('.usa-rt-missing, .usa-sc-ui'))
67
+ track.append(c);
68
+ vp.append(track);
69
+ this.append(vp);
70
+ }
71
+ this.querySelectorAll(':scope > .usa-sc-ui').forEach((x) => x.remove());
72
+ this.slides = Array.from(track.children);
73
+ const N = this.slides.length;
74
+ this.setAttribute('role', 'region');
75
+ this.setAttribute('aria-roledescription', 'carousel');
76
+ this.setAttribute('aria-label', this.str('label', 'Carousel'));
77
+ vp.tabIndex = 0;
78
+ vp.setAttribute('aria-label', `${this.str('label', 'Carousel')} — use the arrow keys`);
79
+ this.style.setProperty('--usa-sc-gap', `${this.num('gap', 16)}px`);
80
+ this.slides.forEach((s, i) => {
81
+ s.setAttribute('role', 'group');
82
+ s.setAttribute('aria-roledescription', 'slide');
83
+ s.setAttribute('aria-label', `${i + 1} of ${N}`);
84
+ });
85
+ const live = document.createElement('p');
86
+ live.className = 'usa-sc-ui usa-sc-live';
87
+ live.setAttribute('aria-live', 'polite');
88
+ this.append(live);
89
+ let prevB = null, nextB = null;
90
+ if (!this.flag('no-controls') && N > 1) {
91
+ const mk = (cls, label, glyph, fn) => {
92
+ const b = document.createElement('button');
93
+ b.type = 'button';
94
+ b.className = `usa-sc-ui usa-sc-nav ${cls}`;
95
+ b.setAttribute('aria-label', label);
96
+ b.textContent = glyph;
97
+ this.listen(b, 'click', fn);
98
+ this.append(b);
99
+ return b;
100
+ };
101
+ prevB = mk('usa-sc-prev', 'Previous slide', '‹', () => this.goTo(this.cur - 1));
102
+ nextB = mk('usa-sc-next', 'Next slide', '›', () => this.goTo(this.cur + 1));
103
+ }
104
+ const dots = [];
105
+ if (!this.flag('no-dots') && N > 1) {
106
+ const nav = document.createElement('div');
107
+ nav.className = 'usa-sc-ui usa-sc-dots';
108
+ nav.setAttribute('role', 'group');
109
+ nav.setAttribute('aria-label', 'Choose a slide');
110
+ this.slides.forEach((_, i) => {
111
+ const d = document.createElement('button');
112
+ d.type = 'button';
113
+ d.className = 'usa-sc-dot';
114
+ d.setAttribute('aria-label', `Go to slide ${i + 1}`);
115
+ this.listen(d, 'click', () => this.goTo(i));
116
+ nav.append(d);
117
+ dots.push(d);
118
+ });
119
+ this.append(nav);
120
+ }
121
+ let announce = false;
122
+ this.sync = () => {
123
+ dots.forEach((d, i) => d.setAttribute('aria-current', String(i === this.cur)));
124
+ if (prevB)
125
+ prevB.disabled = this.cur <= 0;
126
+ if (nextB)
127
+ nextB.disabled = this.cur >= N - 1;
128
+ this.slides.forEach((s, i) => s.toggleAttribute('data-active', i === this.cur));
129
+ if (announce)
130
+ live.textContent = `Slide ${this.cur + 1} of ${N}`;
131
+ };
132
+ this.listen(vp, 'keydown', (e) => {
133
+ const k = e.key;
134
+ const to = k === 'ArrowRight' ? this.cur + 1 : k === 'ArrowLeft' ? this.cur - 1 : k === 'Home' ? 0 : k === 'End' ? N - 1 : null;
135
+ if (to === null)
136
+ return;
137
+ e.preventDefault();
138
+ announce = true;
139
+ this.goTo(to);
140
+ });
141
+ this.listen(this, 'click', (e) => {
142
+ if (e.target?.closest?.('.usa-sc-nav, .usa-sc-dot'))
143
+ announce = true;
144
+ }, { capture: true });
145
+ const DS = runtimeModule(this, 'drag-snap');
146
+ const start = Math.max(0, Math.min(N - 1, this.num('index', 0)));
147
+ this.cur = start;
148
+ if (!DS) {
149
+ this.sync();
150
+ return;
151
+ }
152
+ this.dataset.ready = '';
153
+ const center = this.str('align', 'center') !== 'start';
154
+ const measure = () => {
155
+ const vw = vp.clientWidth;
156
+ const max = Math.max(0, track.scrollWidth - vw);
157
+ return this.slides.map((s) => {
158
+ const p = -(s.offsetLeft - (center ? (vw - s.offsetWidth) / 2 : 0));
159
+ return center ? p : Math.max(-max, Math.min(0, p));
160
+ });
161
+ };
162
+ const apply = (p) => (track.style.transform = `translate3d(${p.toFixed(2)}px,0,0)`);
163
+ const ds = DS.createDragSnap(track, {
164
+ axis: 'x',
165
+ snap: measure(),
166
+ reducedMotion: this.reduced,
167
+ onUpdate: apply,
168
+ onSnap: (i) => this.set(i),
169
+ onDragStart: () => this.toggleAttribute('data-dragging', true),
170
+ onDragEnd: () => this.toggleAttribute('data-dragging', false),
171
+ });
172
+ this.ds = ds;
173
+ ds.snapTo(start, false);
174
+ this.set(start);
175
+ this.onCleanup(() => {
176
+ ds.dispose();
177
+ this.ds = null;
178
+ track.style.transform = '';
179
+ });
180
+ const remeasure = () => ds.setSnapPoints(measure());
181
+ this.listen(window, 'resize', remeasure, { passive: true });
182
+ if (typeof ResizeObserver === 'function') {
183
+ const ro = new ResizeObserver(remeasure);
184
+ ro.observe(vp);
185
+ this.onCleanup(() => ro.disconnect());
186
+ }
187
+ // autoplay: paused on hover / focus / press / off screen; never under reduced motion
188
+ const every = this.num('autoplay', 0);
189
+ if (every > 0 && N > 1 && !this.reduced) {
190
+ let hold = 0, seen = true;
191
+ const h = (d) => () => (hold = Math.max(0, hold + d));
192
+ this.listen(this, 'pointerenter', h(1));
193
+ this.listen(this, 'pointerleave', h(-1));
194
+ this.listen(this, 'focusin', h(1));
195
+ this.listen(this, 'focusout', h(-1));
196
+ this.inView((v) => (seen = v));
197
+ const t = setInterval(() => {
198
+ if (!hold && seen && !ds.dragging)
199
+ this.goTo(this.cur + 1 >= N ? 0 : this.cur + 1);
200
+ }, Math.max(1200, every));
201
+ this.onCleanup(() => clearInterval(t));
202
+ }
203
+ }
204
+ unmount() {
205
+ this.removeAttribute('data-ready');
206
+ this.removeAttribute('data-dragging');
207
+ }
208
+ }
209
+ return UsaSnapCarousel;
210
+ }, { id: 'snap-carousel', text: css });
211
+ }
212
+
213
+ export { defineSnapCarousel };
214
+ //# sourceMappingURL=snap-carousel.js.map