@capgo/capacitor-sheets 8.0.2

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 (63) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +437 -0
  3. package/dist/angular/index.d.mts +114 -0
  4. package/dist/angular/index.d.ts +114 -0
  5. package/dist/angular/index.js +1890 -0
  6. package/dist/angular/index.js.map +1 -0
  7. package/dist/angular/index.mjs +1863 -0
  8. package/dist/angular/index.mjs.map +1 -0
  9. package/dist/chunk-LAUTMWR7.mjs +261 -0
  10. package/dist/chunk-LAUTMWR7.mjs.map +1 -0
  11. package/dist/chunk-YBLI7KN6.mjs +1629 -0
  12. package/dist/chunk-YBLI7KN6.mjs.map +1 -0
  13. package/dist/components-4JACDCD4.mjs +48 -0
  14. package/dist/components-4JACDCD4.mjs.map +1 -0
  15. package/dist/index.d.mts +513 -0
  16. package/dist/index.d.ts +513 -0
  17. package/dist/index.js +2069 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/index.mjs +70 -0
  20. package/dist/index.mjs.map +1 -0
  21. package/dist/react/index.d.mts +240 -0
  22. package/dist/react/index.d.ts +240 -0
  23. package/dist/react/index.js +1900 -0
  24. package/dist/react/index.js.map +1 -0
  25. package/dist/react/index.mjs +1871 -0
  26. package/dist/react/index.mjs.map +1 -0
  27. package/dist/solid/index.d.mts +114 -0
  28. package/dist/solid/index.d.ts +114 -0
  29. package/dist/solid/index.js +1890 -0
  30. package/dist/solid/index.js.map +1 -0
  31. package/dist/solid/index.mjs +1863 -0
  32. package/dist/solid/index.mjs.map +1 -0
  33. package/dist/styles-ZKNWSPZR.mjs +9 -0
  34. package/dist/styles-ZKNWSPZR.mjs.map +1 -0
  35. package/dist/svelte/index.d.mts +121 -0
  36. package/dist/svelte/index.d.ts +121 -0
  37. package/dist/svelte/index.js +1904 -0
  38. package/dist/svelte/index.js.map +1 -0
  39. package/dist/svelte/index.mjs +1876 -0
  40. package/dist/svelte/index.mjs.map +1 -0
  41. package/dist/vue/index.d.mts +114 -0
  42. package/dist/vue/index.d.ts +114 -0
  43. package/dist/vue/index.js +1890 -0
  44. package/dist/vue/index.js.map +1 -0
  45. package/dist/vue/index.mjs +1863 -0
  46. package/dist/vue/index.mjs.map +1 -0
  47. package/docs/demos/bottom-sheet.webp +0 -0
  48. package/docs/demos/card.webp +0 -0
  49. package/docs/demos/detached-sheet.webp +0 -0
  50. package/docs/demos/lightbox.webp +0 -0
  51. package/docs/demos/long-sheet.webp +0 -0
  52. package/docs/demos/page-from-bottom.webp +0 -0
  53. package/docs/demos/page.webp +0 -0
  54. package/docs/demos/parallax-page.webp +0 -0
  55. package/docs/demos/persistent-sheet-with-detent.webp +0 -0
  56. package/docs/demos/sheet-with-depth.webp +0 -0
  57. package/docs/demos/sheet-with-detent.webp +0 -0
  58. package/docs/demos/sheet-with-keyboard.webp +0 -0
  59. package/docs/demos/sheet-with-stacking.webp +0 -0
  60. package/docs/demos/sidebar.webp +0 -0
  61. package/docs/demos/toast.webp +0 -0
  62. package/docs/demos/top-sheet.webp +0 -0
  63. package/package.json +162 -0
package/dist/index.js ADDED
@@ -0,0 +1,2069 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __esm = (fn, res) => function __init() {
7
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
8
+ };
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
+
23
+ // src/core/utils.ts
24
+ function clamp(value, min, max) {
25
+ return Math.min(Math.max(value, min), max);
26
+ }
27
+ function parseBoolean(value, defaultValue) {
28
+ if (value === null) return defaultValue;
29
+ if (value === "" || value === "true") return true;
30
+ if (value === "false") return false;
31
+ return defaultValue;
32
+ }
33
+ function parseList(value) {
34
+ return value ? value.split(/[,\s]+/).map((item) => item.trim()).filter(Boolean) : [];
35
+ }
36
+ function parseTracks(value, fallback) {
37
+ const tracks = parseList(value).filter(
38
+ (item) => ["top", "bottom", "left", "right"].includes(item)
39
+ );
40
+ return tracks.length > 0 ? tracks : [fallback];
41
+ }
42
+ function parsePlacement(value) {
43
+ return ["top", "bottom", "left", "right", "center"].includes(value || "") ? value : "bottom";
44
+ }
45
+ function trackForPlacement(placement, tracks) {
46
+ if (placement !== "center" && tracks.includes(placement)) return placement;
47
+ return tracks[0] || (placement === "center" ? "bottom" : placement);
48
+ }
49
+ function isVerticalTrack(track) {
50
+ return track === "top" || track === "bottom";
51
+ }
52
+ function trackSign(track) {
53
+ return track === "bottom" || track === "right" ? 1 : -1;
54
+ }
55
+ function getEmPx(element) {
56
+ if (!element?.ownerDocument.defaultView) return 16;
57
+ const fontSize = element.ownerDocument.defaultView.getComputedStyle(element).fontSize;
58
+ const parsed = Number.parseFloat(fontSize);
59
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : 16;
60
+ }
61
+ function toEm(element, value) {
62
+ return value / getEmPx(element);
63
+ }
64
+ function measureCssLength(length, context, axis) {
65
+ const doc = context.ownerDocument;
66
+ const probe = doc.createElement("div");
67
+ probe.style.position = "absolute";
68
+ probe.style.visibility = "hidden";
69
+ probe.style.pointerEvents = "none";
70
+ probe.style.inset = "0";
71
+ if (axis === "x") {
72
+ probe.style.width = length;
73
+ probe.style.height = "0";
74
+ } else {
75
+ probe.style.height = length;
76
+ probe.style.width = "0";
77
+ }
78
+ context.appendChild(probe);
79
+ const rect = probe.getBoundingClientRect();
80
+ probe.remove();
81
+ return axis === "x" ? rect.width : rect.height;
82
+ }
83
+ function getFocusable(container) {
84
+ return Array.from(container.querySelectorAll(focusableSelector)).filter((element) => {
85
+ if (element.hasAttribute("disabled")) return false;
86
+ if (element.getAttribute("aria-hidden") === "true") return false;
87
+ const rects = element.getClientRects();
88
+ return rects.length > 0;
89
+ });
90
+ }
91
+ function dispatch(target, type, detail) {
92
+ target.dispatchEvent(new CustomEvent(type, { bubbles: true, composed: true, detail }));
93
+ }
94
+ function defineElement(name, constructor) {
95
+ if (typeof customElements === "undefined") return;
96
+ if (!customElements.get(name)) {
97
+ customElements.define(name, constructor);
98
+ }
99
+ }
100
+ function shouldSkipMotion(settingsSkip) {
101
+ if (settingsSkip === true) return true;
102
+ if (settingsSkip === "auto" && typeof matchMedia !== "undefined") {
103
+ return matchMedia("(prefers-reduced-motion: reduce)").matches;
104
+ }
105
+ return false;
106
+ }
107
+ function createId(prefix) {
108
+ return `${prefix}-${Math.random().toString(36).slice(2, 10)}`;
109
+ }
110
+ var focusableSelector;
111
+ var init_utils = __esm({
112
+ "src/core/utils.ts"() {
113
+ "use strict";
114
+ focusableSelector = [
115
+ "a[href]",
116
+ "area[href]",
117
+ "button:not([disabled])",
118
+ 'input:not([disabled]):not([type="hidden"])',
119
+ "select:not([disabled])",
120
+ "textarea:not([disabled])",
121
+ "iframe",
122
+ "object",
123
+ "embed",
124
+ "[contenteditable]",
125
+ '[tabindex]:not([tabindex="-1"])',
126
+ "cap-sheet-handle",
127
+ "cap-sheet-trigger"
128
+ ].join(",");
129
+ }
130
+ });
131
+
132
+ // src/core/styles.ts
133
+ var styles_exports = {};
134
+ __export(styles_exports, {
135
+ CAP_SHEETS_CSS: () => CSS,
136
+ injectCapSheetStyles: () => injectCapSheetStyles
137
+ });
138
+ function injectCapSheetStyles(root = document) {
139
+ if (root.getElementById(STYLE_ID)) return;
140
+ const style = root.createElement("style");
141
+ style.id = STYLE_ID;
142
+ style.textContent = CSS;
143
+ root.head.appendChild(style);
144
+ }
145
+ var STYLE_ID, CSS;
146
+ var init_styles = __esm({
147
+ "src/core/styles.ts"() {
148
+ "use strict";
149
+ STYLE_ID = "capgo-capacitor-sheets-styles";
150
+ CSS = `
151
+ :root {
152
+ --cap-sheet-100-lvh-dvh-pct: max(100%, 100vh);
153
+ --cap-sheet-backdrop-color: rgb(0 0 0);
154
+ --cap-sheet-backdrop-opacity: 0.44;
155
+ --cap-sheet-radius: 1.5em;
156
+ --cap-sheet-handle-color: rgb(115 115 115);
157
+ --cap-sheet-surface: Canvas;
158
+ --cap-sheet-shadow: 0 0.5em 2.5em rgb(0 0 0 / 0.18);
159
+ --cap-sheet-z-index: 1000;
160
+ --cap-sheet-safe-area-top: max(env(safe-area-inset-top, 0em), var(--safe-area-inset-top, 0em));
161
+ --cap-sheet-safe-area-bottom: max(env(safe-area-inset-bottom, 0em), var(--safe-area-inset-bottom, 0em));
162
+ --cap-sheet-safe-area-left: max(env(safe-area-inset-left, 0em), var(--safe-area-inset-left, 0em));
163
+ --cap-sheet-safe-area-right: max(env(safe-area-inset-right, 0em), var(--safe-area-inset-right, 0em));
164
+ --cap-sheet-applied-safe-area-top: var(--cap-sheet-safe-area-top);
165
+ --cap-sheet-applied-safe-area-bottom: var(--cap-sheet-safe-area-bottom);
166
+ --cap-sheet-applied-safe-area-left: var(--cap-sheet-safe-area-left);
167
+ --cap-sheet-applied-safe-area-right: var(--cap-sheet-safe-area-right);
168
+ }
169
+
170
+ @supports (height: 1dvh) {
171
+ :root {
172
+ --cap-sheet-100-lvh-dvh-pct: max(100dvh, 100lvh);
173
+ }
174
+ }
175
+
176
+ cap-sheet,
177
+ cap-sheet-portal,
178
+ cap-sheet-special-wrapper,
179
+ cap-sheet-special-wrapper-content,
180
+ cap-sheet-stack {
181
+ display: contents;
182
+ }
183
+
184
+ cap-sheet-view {
185
+ position: fixed;
186
+ inset: 0;
187
+ display: grid;
188
+ width: 100%;
189
+ height: var(--cap-sheet-100-lvh-dvh-pct);
190
+ z-index: var(--cap-sheet-z-index);
191
+ pointer-events: none;
192
+ touch-action: none;
193
+ overscroll-behavior: none;
194
+ contain: layout style;
195
+ box-sizing: border-box;
196
+ padding-block-start: var(--cap-sheet-applied-safe-area-top, 0em);
197
+ padding-block-end: calc(var(--cap-sheet-applied-safe-area-bottom, 0em) + var(--cap-sheet-keyboard-offset, 0em));
198
+ padding-inline-start: var(--cap-sheet-applied-safe-area-left, 0em);
199
+ padding-inline-end: var(--cap-sheet-applied-safe-area-right, 0em);
200
+ }
201
+
202
+ cap-sheet-view[hidden] {
203
+ display: none !important;
204
+ }
205
+
206
+ cap-sheet-view[content-placement="top"] {
207
+ align-items: start;
208
+ justify-items: center;
209
+ }
210
+
211
+ cap-sheet-view[content-placement="bottom"],
212
+ cap-sheet-view:not([content-placement]) {
213
+ align-items: end;
214
+ justify-items: center;
215
+ }
216
+
217
+ cap-sheet-view[content-placement="left"] {
218
+ align-items: center;
219
+ justify-items: start;
220
+ }
221
+
222
+ cap-sheet-view[content-placement="right"] {
223
+ align-items: center;
224
+ justify-items: end;
225
+ }
226
+
227
+ cap-sheet-view[content-placement="center"] {
228
+ align-items: center;
229
+ justify-items: center;
230
+ }
231
+
232
+ cap-sheet-backdrop {
233
+ position: absolute;
234
+ inset: 0;
235
+ display: block;
236
+ background: var(--cap-sheet-backdrop-color);
237
+ opacity: 0;
238
+ pointer-events: none;
239
+ touch-action: none;
240
+ will-change: opacity;
241
+ }
242
+
243
+ cap-sheet-content {
244
+ box-sizing: border-box;
245
+ position: relative;
246
+ display: block;
247
+ width: min(100%, 34em);
248
+ max-height: 100%;
249
+ color: CanvasText;
250
+ background: var(--cap-sheet-surface);
251
+ border-radius: var(--cap-sheet-radius) var(--cap-sheet-radius) 0 0;
252
+ box-shadow: var(--cap-sheet-shadow);
253
+ overflow: auto;
254
+ overscroll-behavior: contain;
255
+ pointer-events: auto;
256
+ touch-action: pan-x pan-y;
257
+ will-change: transform, opacity;
258
+ -webkit-overflow-scrolling: touch;
259
+ }
260
+
261
+ cap-sheet-view[content-placement="top"] cap-sheet-content {
262
+ border-radius: 0 0 var(--cap-sheet-radius) var(--cap-sheet-radius);
263
+ }
264
+
265
+ cap-sheet-view[content-placement="left"] cap-sheet-content {
266
+ width: min(88%, 28em);
267
+ height: 100%;
268
+ max-height: 100%;
269
+ border-radius: 0 var(--cap-sheet-radius) var(--cap-sheet-radius) 0;
270
+ }
271
+
272
+ cap-sheet-view[content-placement="right"] cap-sheet-content {
273
+ width: min(88%, 28em);
274
+ height: 100%;
275
+ max-height: 100%;
276
+ border-radius: var(--cap-sheet-radius) 0 0 var(--cap-sheet-radius);
277
+ }
278
+
279
+ cap-sheet-view[content-placement="center"] cap-sheet-content {
280
+ width: min(90%, 30em);
281
+ max-height: min(90%, 42em);
282
+ border-radius: var(--cap-sheet-radius);
283
+ }
284
+
285
+ cap-sheet-bleeding-background {
286
+ position: absolute;
287
+ inset: 0;
288
+ z-index: -1;
289
+ display: block;
290
+ background: var(--cap-sheet-surface);
291
+ border-radius: inherit;
292
+ pointer-events: none;
293
+ }
294
+
295
+ cap-sheet-view[content-placement="bottom"] cap-sheet-bleeding-background,
296
+ cap-sheet-view:not([content-placement]) cap-sheet-bleeding-background {
297
+ inset-block-end: -8em;
298
+ }
299
+
300
+ cap-sheet-view[content-placement="top"] cap-sheet-bleeding-background {
301
+ inset-block-start: -8em;
302
+ }
303
+
304
+ cap-sheet-view[content-placement="left"] cap-sheet-bleeding-background {
305
+ inset-inline-start: -8em;
306
+ }
307
+
308
+ cap-sheet-view[content-placement="right"] cap-sheet-bleeding-background {
309
+ inset-inline-end: -8em;
310
+ }
311
+
312
+ cap-sheet-handle {
313
+ box-sizing: border-box;
314
+ display: grid;
315
+ place-items: center;
316
+ width: 100%;
317
+ height: 2.25em;
318
+ cursor: grab;
319
+ touch-action: none;
320
+ }
321
+
322
+ cap-sheet-handle::before {
323
+ content: "";
324
+ display: block;
325
+ width: 2.75em;
326
+ height: 0.3125em;
327
+ border-radius: 999em;
328
+ background: var(--cap-sheet-handle-color);
329
+ opacity: 0.65;
330
+ }
331
+
332
+ cap-sheet-handle:active {
333
+ cursor: grabbing;
334
+ }
335
+
336
+ cap-sheet-title,
337
+ cap-sheet-description {
338
+ display: block;
339
+ }
340
+
341
+ cap-sheet-outlet {
342
+ display: block;
343
+ transform-origin: center;
344
+ will-change: transform, opacity, filter;
345
+ }
346
+
347
+ cap-scroll {
348
+ display: block;
349
+ overflow: auto;
350
+ overscroll-behavior: contain;
351
+ -webkit-overflow-scrolling: touch;
352
+ scroll-behavior: smooth;
353
+ }
354
+
355
+ cap-scroll[axis="x"] {
356
+ overflow-x: auto;
357
+ overflow-y: hidden;
358
+ }
359
+
360
+ cap-scroll[axis="y"],
361
+ cap-scroll:not([axis]) {
362
+ overflow-x: hidden;
363
+ overflow-y: auto;
364
+ }
365
+
366
+ cap-scroll-content {
367
+ display: block;
368
+ min-width: 100%;
369
+ min-height: 100%;
370
+ }
371
+
372
+ cap-fixed {
373
+ position: fixed;
374
+ inset-inline: 0;
375
+ z-index: calc(var(--cap-sheet-z-index) + 1);
376
+ }
377
+
378
+ cap-island,
379
+ cap-external-overlay {
380
+ display: contents;
381
+ }
382
+
383
+ cap-visually-hidden,
384
+ cap-auto-focus-target[hidden-target] {
385
+ position: absolute;
386
+ width: 0.0625em;
387
+ height: 0.0625em;
388
+ margin: -0.0625em;
389
+ overflow: hidden;
390
+ clip: rect(0 0 0 0);
391
+ white-space: nowrap;
392
+ border: 0;
393
+ padding: 0;
394
+ }
395
+ `;
396
+ }
397
+ });
398
+
399
+ // src/components/cap-scroll.ts
400
+ var CapScroll, CapScrollContent;
401
+ var init_cap_scroll = __esm({
402
+ "src/components/cap-scroll.ts"() {
403
+ "use strict";
404
+ init_styles();
405
+ init_utils();
406
+ CapScroll = class extends HTMLElement {
407
+ scrollTarget = this;
408
+ connectedCallback() {
409
+ injectCapSheetStyles(this.ownerDocument);
410
+ this.scrollTarget = this;
411
+ this.addEventListener("scroll", this.handleScroll, { passive: true });
412
+ }
413
+ disconnectedCallback() {
414
+ this.removeEventListener("scroll", this.handleScroll);
415
+ }
416
+ /** Return scroll progress from `0` to `1`. */
417
+ getProgress() {
418
+ return this.getAvailableDistance() === 0 ? 0 : clamp(this.getDistance() / this.getAvailableDistance(), 0, 1);
419
+ }
420
+ /** Return traveled distance in CSS pixels. */
421
+ getDistance() {
422
+ return this.axis === "x" ? this.scrollTarget.scrollLeft : this.scrollTarget.scrollTop;
423
+ }
424
+ /** Return available travel distance in CSS pixels. */
425
+ getAvailableDistance() {
426
+ return this.axis === "x" ? Math.max(0, this.scrollTarget.scrollWidth - this.scrollTarget.clientWidth) : Math.max(0, this.scrollTarget.scrollHeight - this.scrollTarget.clientHeight);
427
+ }
428
+ scrollTo(optionsOrX, y) {
429
+ if (typeof optionsOrX === "number") {
430
+ super.scrollTo(optionsOrX, y ?? 0);
431
+ return;
432
+ }
433
+ if (!optionsOrX || "top" in optionsOrX || "left" in optionsOrX) {
434
+ super.scrollTo(optionsOrX);
435
+ return;
436
+ }
437
+ const travelOptions = optionsOrX;
438
+ const distance = this.resolveDistance(travelOptions.progress, travelOptions.distance);
439
+ this.scrollTarget.scrollTo({
440
+ left: this.axis === "x" ? distance : void 0,
441
+ top: this.axis === "y" ? distance : void 0,
442
+ behavior: travelOptions.behavior
443
+ });
444
+ }
445
+ scrollBy(optionsOrX, y) {
446
+ if (typeof optionsOrX === "number") {
447
+ super.scrollBy(optionsOrX, y ?? 0);
448
+ return;
449
+ }
450
+ if (!optionsOrX || "top" in optionsOrX || "left" in optionsOrX) {
451
+ super.scrollBy(optionsOrX);
452
+ return;
453
+ }
454
+ const travelOptions = optionsOrX;
455
+ const distance = this.resolveDistance(travelOptions.progress, travelOptions.distance);
456
+ this.scrollTarget.scrollBy({
457
+ left: this.axis === "x" ? distance : void 0,
458
+ top: this.axis === "y" ? distance : void 0,
459
+ behavior: travelOptions.behavior
460
+ });
461
+ }
462
+ get axis() {
463
+ return this.getAttribute("axis") === "x" ? "x" : "y";
464
+ }
465
+ resolveDistance(progress, distance) {
466
+ if (distance !== void 0) return distance;
467
+ return clamp(progress ?? 0, 0, 1) * this.getAvailableDistance();
468
+ }
469
+ handleScroll = () => {
470
+ dispatch(this, "cap-scroll", {
471
+ progress: this.getProgress(),
472
+ distance: this.getDistance(),
473
+ availableDistance: this.getAvailableDistance()
474
+ });
475
+ };
476
+ };
477
+ CapScrollContent = class extends HTMLElement {
478
+ connectedCallback() {
479
+ injectCapSheetStyles(this.ownerDocument);
480
+ }
481
+ };
482
+ }
483
+ });
484
+
485
+ // src/core/theme-color.ts
486
+ function getThemeMeta(documentRef) {
487
+ return documentRef.querySelector('meta[name="theme-color"]');
488
+ }
489
+ function parseHexColor(color) {
490
+ const normalized = color.trim().replace("#", "");
491
+ if (![3, 6].includes(normalized.length)) return null;
492
+ const expanded = normalized.length === 3 ? normalized.split("").map((char) => `${char}${char}`).join("") : normalized;
493
+ const value = Number.parseInt(expanded, 16);
494
+ if (!Number.isFinite(value)) return null;
495
+ return [value >> 16 & 255, value >> 8 & 255, value & 255];
496
+ }
497
+ function parseRgbColor(color) {
498
+ const match = color.match(/rgba?\(([^)]+)\)/i);
499
+ if (!match) return null;
500
+ const values = match[1].split(/[\s,/]+/).map((item) => Number.parseFloat(item)).filter((item) => Number.isFinite(item));
501
+ if (values.length < 3) return null;
502
+ return [values[0], values[1], values[2]];
503
+ }
504
+ function toHex(channel) {
505
+ return Math.round(channel).toString(16).padStart(2, "0");
506
+ }
507
+ function blend(base, overlay, alpha) {
508
+ const baseRgb = parseHexColor(base) || parseRgbColor(base);
509
+ const overlayRgb = parseHexColor(overlay) || parseRgbColor(overlay);
510
+ if (!baseRgb || !overlayRgb) return null;
511
+ const [r, g, b] = baseRgb.map((channel, index) => channel * (1 - alpha) + overlayRgb[index] * alpha);
512
+ return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
513
+ }
514
+ function updateThemeColor(color, documentRef = document) {
515
+ const meta = getThemeMeta(documentRef);
516
+ if (!meta) return;
517
+ if (activeDimmerCount > 0) {
518
+ baseThemeColor = color;
519
+ return;
520
+ }
521
+ meta.content = color;
522
+ }
523
+ function setThemeColorDimming(documentRef, alpha, overlayColor = "rgb(0 0 0)") {
524
+ const meta = getThemeMeta(documentRef);
525
+ if (!meta) return;
526
+ if (baseThemeColor === null) {
527
+ baseThemeColor = meta.content;
528
+ }
529
+ const next = blend(baseThemeColor, overlayColor, alpha);
530
+ if (next) {
531
+ meta.content = next;
532
+ }
533
+ }
534
+ function retainThemeColorDimmer() {
535
+ activeDimmerCount += 1;
536
+ }
537
+ function releaseThemeColorDimmer(documentRef) {
538
+ activeDimmerCount = Math.max(0, activeDimmerCount - 1);
539
+ if (activeDimmerCount === 0 && baseThemeColor !== null) {
540
+ const meta = getThemeMeta(documentRef);
541
+ if (meta) {
542
+ meta.content = baseThemeColor;
543
+ }
544
+ baseThemeColor = null;
545
+ }
546
+ }
547
+ var baseThemeColor, activeDimmerCount;
548
+ var init_theme_color = __esm({
549
+ "src/core/theme-color.ts"() {
550
+ "use strict";
551
+ baseThemeColor = null;
552
+ activeDimmerCount = 0;
553
+ }
554
+ });
555
+
556
+ // src/core/sheet-controller.ts
557
+ function parseNumber(value) {
558
+ if (value === null) return void 0;
559
+ const parsed = Number.parseInt(value, 10);
560
+ return Number.isFinite(parsed) ? parsed : void 0;
561
+ }
562
+ function normalizeDetents(value) {
563
+ if (Array.isArray(value)) return value.filter(Boolean);
564
+ return parseList(value || null);
565
+ }
566
+ function parseSafeArea(value) {
567
+ if (value === null) return void 0;
568
+ const normalized = value.trim().toLowerCase();
569
+ if (!normalized || normalized === "true" || normalized === "auto" || normalized === "all") return "auto";
570
+ if (normalized === "false" || normalized === "none" || normalized === "off") return "none";
571
+ const edges = parseList(normalized).filter(
572
+ (edge) => safeAreaEdges.includes(edge)
573
+ );
574
+ return edges.length > 0 ? edges : "auto";
575
+ }
576
+ function resolveSafeAreaEdges(value) {
577
+ if (value === false || value === "none") return [];
578
+ if (Array.isArray(value)) return value.filter((edge) => safeAreaEdges.includes(edge));
579
+ return safeAreaEdges;
580
+ }
581
+ function readOptionsFromElement(root) {
582
+ const placement = parsePlacement(root.getAttribute("content-placement"));
583
+ const defaultActiveDetent = parseNumber(root.getAttribute("default-active-detent"));
584
+ const activeDetent = parseNumber(root.getAttribute("active-detent"));
585
+ return {
586
+ componentId: root.getAttribute("component-id") || root.id || void 0,
587
+ stack: root.getAttribute("stack") || void 0,
588
+ defaultPresented: parseBoolean(root.getAttribute("default-presented"), false),
589
+ presented: root.hasAttribute("presented") ? parseBoolean(root.getAttribute("presented"), true) : void 0,
590
+ defaultActiveDetent,
591
+ activeDetent,
592
+ detents: normalizeDetents(root.getAttribute("detents") || void 0),
593
+ sheetRole: root.getAttribute("sheet-role") || defaultOptions.sheetRole,
594
+ contentPlacement: placement,
595
+ safeArea: parseSafeArea(root.getAttribute("safe-area")),
596
+ tracks: parseTracks(root.getAttribute("tracks"), placement === "center" ? "bottom" : placement),
597
+ swipe: parseBoolean(root.getAttribute("swipe"), defaultOptions.swipe),
598
+ swipeDismissal: parseBoolean(root.getAttribute("swipe-dismissal"), defaultOptions.swipeDismissal),
599
+ swipeOvershoot: parseBoolean(root.getAttribute("swipe-overshoot"), defaultOptions.swipeOvershoot),
600
+ swipeTrap: parseBoolean(root.getAttribute("swipe-trap"), defaultOptions.swipeTrap),
601
+ inertOutside: parseBoolean(root.getAttribute("inert-outside"), defaultOptions.inertOutside),
602
+ nativeEdgeSwipePrevention: parseBoolean(
603
+ root.getAttribute("native-edge-swipe-prevention"),
604
+ defaultOptions.nativeEdgeSwipePrevention
605
+ ),
606
+ nativeFocusScrollPrevention: parseBoolean(
607
+ root.getAttribute("native-focus-scroll-prevention"),
608
+ defaultOptions.nativeFocusScrollPrevention
609
+ ),
610
+ closeOnOutsideClick: parseBoolean(root.getAttribute("close-on-outside-click"), defaultOptions.closeOnOutsideClick),
611
+ closeOnEscape: parseBoolean(root.getAttribute("close-on-escape"), defaultOptions.closeOnEscape),
612
+ focusTrap: parseBoolean(root.getAttribute("focus-trap"), defaultOptions.focusTrap),
613
+ restoreFocus: parseBoolean(root.getAttribute("restore-focus"), defaultOptions.restoreFocus),
614
+ themeColorDimming: root.getAttribute("theme-color-dimming") === "false" ? false : root.getAttribute("theme-color-dimming") === "auto" ? "auto" : defaultOptions.themeColorDimming
615
+ };
616
+ }
617
+ function resolveAnimation(settings) {
618
+ const preset = settings?.preset || "smooth";
619
+ const presetDefaults = {
620
+ gentle: { duration: 520, easing: "cubic-bezier(0.16, 1, 0.3, 1)" },
621
+ smooth: { duration: defaultAnimation.duration, easing: defaultAnimation.easing },
622
+ snappy: { duration: 260, easing: "cubic-bezier(0.2, 0, 0, 1)" }
623
+ };
624
+ return {
625
+ ...defaultAnimation,
626
+ ...presetDefaults[preset],
627
+ duration: settings?.duration ?? presetDefaults[preset]?.duration ?? defaultAnimation.duration,
628
+ easing: settings?.easing ?? presetDefaults[preset]?.easing ?? defaultAnimation.easing,
629
+ skip: settings?.skip ?? defaultAnimation.skip,
630
+ contentMove: settings?.contentMove ?? defaultAnimation.contentMove
631
+ };
632
+ }
633
+ function attributeBoolean(value) {
634
+ return value ? "true" : "false";
635
+ }
636
+ function tween(start, end, progress) {
637
+ const startString = String(start);
638
+ const endString = String(end);
639
+ const startValue = Number.parseFloat(startString);
640
+ const endValue = Number.parseFloat(endString);
641
+ if (!Number.isFinite(startValue) || !Number.isFinite(endValue)) return progress < 1 ? startString : endString;
642
+ const unit = endString.replace(String(endValue), "") || startString.replace(String(startValue), "");
643
+ const next = startValue + (endValue - startValue) * progress;
644
+ return `${next}${unit}`;
645
+ }
646
+ var defaultOptions, defaultAnimation, stackRegistry, safeAreaEdges, SheetController;
647
+ var init_sheet_controller = __esm({
648
+ "src/core/sheet-controller.ts"() {
649
+ "use strict";
650
+ init_theme_color();
651
+ init_utils();
652
+ defaultOptions = {
653
+ contentPlacement: "bottom",
654
+ sheetRole: "dialog",
655
+ safeArea: "auto",
656
+ swipe: true,
657
+ swipeDismissal: true,
658
+ swipeOvershoot: true,
659
+ swipeTrap: true,
660
+ inertOutside: true,
661
+ nativeEdgeSwipePrevention: true,
662
+ nativeFocusScrollPrevention: true,
663
+ closeOnOutsideClick: true,
664
+ closeOnEscape: true,
665
+ focusTrap: true,
666
+ restoreFocus: true,
667
+ themeColorDimming: "auto"
668
+ };
669
+ defaultAnimation = {
670
+ duration: 420,
671
+ easing: "cubic-bezier(0.22, 1, 0.36, 1)",
672
+ skip: "auto",
673
+ contentMove: true
674
+ };
675
+ stackRegistry = /* @__PURE__ */ new Map();
676
+ safeAreaEdges = ["top", "bottom", "left", "right"];
677
+ SheetController = class {
678
+ root;
679
+ id;
680
+ parts = {
681
+ outlets: /* @__PURE__ */ new Set(),
682
+ islands: /* @__PURE__ */ new Set(),
683
+ externalOverlays: /* @__PURE__ */ new Set()
684
+ };
685
+ options;
686
+ presented = false;
687
+ activeDetent = 0;
688
+ status = "idle";
689
+ detentOffsetsPx = [0, 0];
690
+ hiddenOffsetPx = 0;
691
+ currentOffsetPx = 0;
692
+ activeTrack = "bottom";
693
+ pointerTravel = null;
694
+ connected = false;
695
+ lockedScroll = false;
696
+ previousBodyOverflow = "";
697
+ previousBodyTouchAction = "";
698
+ inertedElements = /* @__PURE__ */ new Map();
699
+ previousFocus = null;
700
+ hasThemeDimmer = false;
701
+ stackId = null;
702
+ documentListenersAttached = false;
703
+ viewListenersElement = null;
704
+ visualViewportListenersAttached = false;
705
+ handleVisualViewportResize = () => {
706
+ const view = this.parts.view;
707
+ const visualViewport = this.root.ownerDocument.defaultView?.visualViewport;
708
+ if (!view) return;
709
+ if (!visualViewport || this.options.nativeFocusScrollPrevention === false) {
710
+ view.style.setProperty("--cap-sheet-keyboard-offset", "0em");
711
+ return;
712
+ }
713
+ const layoutHeight = this.root.ownerDocument.documentElement.clientHeight;
714
+ const keyboardOffset = Math.max(0, layoutHeight - visualViewport.height - visualViewport.offsetTop);
715
+ view.style.setProperty("--cap-sheet-keyboard-offset", `${toEm(view, keyboardOffset)}em`);
716
+ };
717
+ handleDocumentKeyDown = (event) => {
718
+ if (!this.presented) return;
719
+ if (event.key === "Escape" && this.options.closeOnEscape !== false) {
720
+ event.preventDefault();
721
+ void this.dismiss({ source: "escape" });
722
+ return;
723
+ }
724
+ if (event.key === "Tab" && this.options.focusTrap !== false) {
725
+ this.trapFocus(event);
726
+ }
727
+ };
728
+ handleViewClick = (event) => {
729
+ if (!this.presented || this.options.closeOnOutsideClick === false) return;
730
+ if (event.target === this.parts.view || event.target === this.parts.backdrop) {
731
+ void this.dismiss({ source: "outside" });
732
+ }
733
+ };
734
+ handlePointerDown = (event) => {
735
+ if (!this.presented || this.options.swipe === false || this.options.contentPlacement === "center") return;
736
+ if (!(event.target instanceof Element)) return;
737
+ if (!this.parts.content?.contains(event.target) && event.target !== this.parts.backdrop) return;
738
+ if (this.options.nativeEdgeSwipePrevention !== false && this.isNativeEdgePointer(event)) {
739
+ event.preventDefault();
740
+ }
741
+ this.remeasure();
742
+ this.pointerTravel = {
743
+ id: event.pointerId,
744
+ startOffsetPx: this.currentOffsetPx,
745
+ startX: event.clientX,
746
+ startY: event.clientY,
747
+ lastX: event.clientX,
748
+ lastY: event.clientY,
749
+ lastTime: performance.now(),
750
+ velocity: 0,
751
+ dragging: false
752
+ };
753
+ };
754
+ handlePointerMove = (event) => {
755
+ const travel = this.pointerTravel;
756
+ if (travel?.id !== event.pointerId) return;
757
+ const axis = isVerticalTrack(this.activeTrack) ? "y" : "x";
758
+ const current = axis === "y" ? event.clientY : event.clientX;
759
+ const start = axis === "y" ? travel.startY : travel.startX;
760
+ const delta = current - start;
761
+ const crossDelta = axis === "y" ? event.clientX - travel.startX : event.clientY - travel.startY;
762
+ if (!travel.dragging) {
763
+ if (Math.abs(delta) < 6 || Math.abs(crossDelta) > Math.abs(delta) * 1.25) return;
764
+ travel.dragging = true;
765
+ event.currentTarget?.setPointerCapture?.(event.pointerId);
766
+ this.setStatus("dragging");
767
+ dispatch(this.root, "cap-sheet-drag-start", this.getTravelEvent());
768
+ }
769
+ if (this.options.swipeTrap !== false) {
770
+ event.preventDefault();
771
+ }
772
+ const now = performance.now();
773
+ const previous = axis === "y" ? travel.lastY : travel.lastX;
774
+ const elapsed = Math.max(now - travel.lastTime, 1);
775
+ travel.velocity = (current - previous) / elapsed * 1e3;
776
+ travel.lastX = event.clientX;
777
+ travel.lastY = event.clientY;
778
+ travel.lastTime = now;
779
+ const nextOffset = this.limitOffset(travel.startOffsetPx + delta);
780
+ this.applyOffset(nextOffset, "dragging");
781
+ };
782
+ handlePointerUp = (event) => {
783
+ const travel = this.pointerTravel;
784
+ if (travel?.id !== event.pointerId) return;
785
+ const currentTarget = event.currentTarget;
786
+ if (currentTarget?.hasPointerCapture?.(event.pointerId)) {
787
+ currentTarget.releasePointerCapture(event.pointerId);
788
+ }
789
+ this.pointerTravel = null;
790
+ if (!travel.dragging) return;
791
+ const nearest = this.nearestDetentForOffset(this.currentOffsetPx, travel.velocity);
792
+ dispatch(this.root, "cap-sheet-drag-end", this.getTravelEvent());
793
+ if (nearest === 0 && this.options.swipeDismissal !== false) {
794
+ void this.dismiss({ source: "gesture" });
795
+ return;
796
+ }
797
+ void this.stepTo(nearest, { source: "gesture" });
798
+ };
799
+ handleWheel = (event) => {
800
+ if (!this.presented || this.options.swipe === false || this.options.contentPlacement === "center") return;
801
+ if (!(event.target instanceof Element)) return;
802
+ if (!this.parts.content?.contains(event.target) && event.target !== this.parts.backdrop) return;
803
+ const delta = isVerticalTrack(this.activeTrack) ? event.deltaY : event.deltaX;
804
+ if (Math.abs(delta) < 1) return;
805
+ const nextOffset = this.limitOffset(this.currentOffsetPx + delta);
806
+ if (Math.abs(nextOffset - this.currentOffsetPx) < 0.5) return;
807
+ event.preventDefault();
808
+ this.applyOffset(nextOffset, "dragging");
809
+ window.clearTimeout(this.root.__capWheelSettle);
810
+ this.root.__capWheelSettle = window.setTimeout(() => {
811
+ const nearest = this.nearestDetentForOffset(this.currentOffsetPx, delta * 10);
812
+ if (nearest === 0 && this.options.swipeDismissal !== false) {
813
+ void this.dismiss({ source: "gesture" });
814
+ } else {
815
+ void this.stepTo(nearest, { source: "gesture" });
816
+ }
817
+ }, 120);
818
+ };
819
+ constructor(root) {
820
+ this.root = root;
821
+ this.options = readOptionsFromElement(root);
822
+ this.id = this.options.componentId || root.id || createId("cap-sheet");
823
+ if (!root.id) root.id = this.id;
824
+ }
825
+ /** Connect the controller to the DOM and initialize current state. */
826
+ connect() {
827
+ if (this.connected) return;
828
+ this.connected = true;
829
+ this.configure(readOptionsFromElement(this.root));
830
+ const nextPresented = this.options.presented ?? this.options.defaultPresented ?? false;
831
+ this.activeDetent = this.resolveInitialDetent();
832
+ this.presented = nextPresented;
833
+ this.setStatus("idle");
834
+ this.remeasure();
835
+ this.applyOffset(
836
+ nextPresented ? this.detentOffsetsPx[this.activeDetent] || 0 : this.detentOffsetsPx[0] || 0,
837
+ "idle"
838
+ );
839
+ this.updateDomState(false);
840
+ this.addGlobalListeners();
841
+ this.registerStack();
842
+ }
843
+ /** Disconnect listeners and restore outside DOM state. */
844
+ disconnect() {
845
+ this.connected = false;
846
+ this.removeGlobalListeners();
847
+ this.unlockPage();
848
+ this.clearInert();
849
+ this.releaseThemeDimmer();
850
+ this.unregisterStack();
851
+ }
852
+ /** Update options from attributes or setup helpers. */
853
+ configure(options) {
854
+ this.options = {
855
+ ...defaultOptions,
856
+ ...this.options,
857
+ ...options,
858
+ detents: normalizeDetents(options.detents ?? this.options.detents)
859
+ };
860
+ const placement = this.options.contentPlacement || defaultOptions.contentPlacement;
861
+ const tracks = Array.isArray(this.options.tracks) ? this.options.tracks : this.options.tracks ? [this.options.tracks] : [placement === "center" ? "bottom" : placement];
862
+ this.activeTrack = trackForPlacement(placement, tracks);
863
+ this.parts.view?.setAttribute("content-placement", placement);
864
+ this.parts.view?.setAttribute("role", this.options.sheetRole || "dialog");
865
+ this.applySafeArea();
866
+ this.handleVisualViewportResize();
867
+ if (this.parts.content) {
868
+ this.parts.content.setAttribute("aria-modal", attributeBoolean(this.options.inertOutside !== false));
869
+ }
870
+ this.linkAccessibleNames();
871
+ this.registerStack();
872
+ }
873
+ /** Register a view, backdrop, content, or semantic part. */
874
+ registerPart(part, element) {
875
+ this.parts[part] = element;
876
+ this.configure(this.options);
877
+ if (this.connected && part === "view") {
878
+ this.addViewListeners();
879
+ this.addVisualViewportListeners();
880
+ this.handleVisualViewportResize();
881
+ }
882
+ this.remeasure();
883
+ this.applyOffset(
884
+ this.presented ? this.detentOffsetsPx[this.activeDetent] || 0 : this.detentOffsetsPx[0] || this.hiddenOffsetPx,
885
+ this.status
886
+ );
887
+ this.updateDomState(this.presented);
888
+ }
889
+ /** Unregister a view, backdrop, content, or semantic part. */
890
+ unregisterPart(part, element) {
891
+ if (this.parts[part] === element) {
892
+ if (part === "view") this.removeViewListeners();
893
+ this.parts[part] = void 0;
894
+ }
895
+ }
896
+ /** Register an outlet animated by sheet progress. */
897
+ registerOutlet(element) {
898
+ this.parts.outlets.add(element);
899
+ this.updateOutletProgress();
900
+ }
901
+ /** Unregister an outlet. */
902
+ unregisterOutlet(element) {
903
+ this.parts.outlets.delete(element);
904
+ }
905
+ /** Register an outside island that remains interactive with inert outside enabled. */
906
+ registerIsland(element) {
907
+ this.parts.islands.add(element);
908
+ if (this.presented) this.applyInert();
909
+ }
910
+ /** Unregister an outside island. */
911
+ unregisterIsland(element) {
912
+ this.parts.islands.delete(element);
913
+ if (this.presented) this.applyInert();
914
+ }
915
+ /** Present the sheet. */
916
+ async present(options = {}) {
917
+ this.remeasure();
918
+ if (this.presented) {
919
+ await this.stepTo(options.detent ?? this.activeDetent, options);
920
+ return;
921
+ }
922
+ this.previousFocus = this.root.ownerDocument.activeElement;
923
+ this.presented = true;
924
+ this.activeDetent = clamp(options.detent ?? this.resolveInitialDetent(), 1, this.detentOffsetsPx.length - 1);
925
+ this.updateDomState(true);
926
+ this.lockPage();
927
+ this.applyInert();
928
+ this.retainThemeDimmer();
929
+ this.setStatus("entering");
930
+ dispatch(this.root, "cap-sheet-present", this.getTravelEvent());
931
+ await this.animateTo(this.detentOffsetsPx[this.activeDetent] || 0, {
932
+ ...this.options.enteringAnimationSettings || {},
933
+ ...options.animation || {}
934
+ });
935
+ this.setStatus("idle");
936
+ this.focusInitialElement();
937
+ this.emitPresentedChange(true, options.source || "programmatic");
938
+ this.emitActiveDetentChange(this.activeDetent, 0);
939
+ this.updateStack();
940
+ }
941
+ /** Dismiss the sheet. */
942
+ async dismiss(options = {}) {
943
+ if (!this.presented) return;
944
+ this.remeasure();
945
+ const previous = this.activeDetent;
946
+ this.presented = false;
947
+ this.activeDetent = 0;
948
+ this.setStatus("exiting");
949
+ dispatch(this.root, "cap-sheet-dismiss", this.getTravelEvent());
950
+ await this.animateTo(this.detentOffsetsPx[0] || this.hiddenOffsetPx, {
951
+ ...this.options.exitingAnimationSettings || {},
952
+ ...options.animation || {}
953
+ });
954
+ this.setStatus("idle");
955
+ this.updateDomState(false);
956
+ this.unlockPage();
957
+ this.clearInert();
958
+ this.releaseThemeDimmer();
959
+ this.restoreFocus();
960
+ this.emitPresentedChange(false, options.source || "programmatic");
961
+ this.emitActiveDetentChange(0, previous);
962
+ this.updateStack();
963
+ }
964
+ /** Toggle presentation state. */
965
+ async toggle(options = {}) {
966
+ if (this.presented) {
967
+ await this.dismiss(options);
968
+ } else {
969
+ await this.present(options);
970
+ }
971
+ }
972
+ /** Step to a specific detent index. */
973
+ async stepTo(detent, options = {}) {
974
+ this.remeasure();
975
+ const target = clamp(detent, this.options.swipeDismissal === false ? 1 : 0, this.detentOffsetsPx.length - 1);
976
+ if (target === 0) {
977
+ await this.dismiss(options);
978
+ return;
979
+ }
980
+ if (!this.presented) {
981
+ await this.present({ ...options, detent: target });
982
+ return;
983
+ }
984
+ const previous = this.activeDetent;
985
+ this.activeDetent = target;
986
+ this.setStatus("settling");
987
+ await this.animateTo(this.detentOffsetsPx[target] || 0, {
988
+ ...this.options.steppingAnimationSettings || {},
989
+ ...options.animation || {}
990
+ });
991
+ this.setStatus("idle");
992
+ if (previous !== target) {
993
+ this.emitActiveDetentChange(target, previous);
994
+ }
995
+ }
996
+ /** Step up or down one detent. */
997
+ async step(direction = "up", options = {}) {
998
+ const delta = direction === "up" ? 1 : -1;
999
+ await this.stepTo(this.activeDetent + delta, options);
1000
+ }
1001
+ /** Recalculate content size and detent offsets. */
1002
+ remeasure() {
1003
+ const content = this.parts.content;
1004
+ if (!content) return;
1005
+ const placement = this.options.contentPlacement || "bottom";
1006
+ if (placement === "center") {
1007
+ this.hiddenOffsetPx = 0;
1008
+ this.detentOffsetsPx = [0, 0];
1009
+ return;
1010
+ }
1011
+ const view = this.parts.view;
1012
+ const shouldMeasureHiddenView = Boolean(view?.hidden);
1013
+ const previousVisibility = view?.style.visibility || "";
1014
+ const previousPointerEvents = view?.style.pointerEvents || "";
1015
+ if (view && shouldMeasureHiddenView) {
1016
+ view.hidden = false;
1017
+ view.style.visibility = "hidden";
1018
+ view.style.pointerEvents = "none";
1019
+ }
1020
+ try {
1021
+ const track = this.activeTrack;
1022
+ const sign = trackSign(track);
1023
+ const axis = isVerticalTrack(track) ? "y" : "x";
1024
+ const rect = content.getBoundingClientRect();
1025
+ const size = axis === "y" ? rect.height : rect.width;
1026
+ this.hiddenOffsetPx = Math.max(size, 1) * sign;
1027
+ const detents = normalizeDetents(this.options.detents);
1028
+ const offsets = [this.hiddenOffsetPx];
1029
+ for (const detent of detents) {
1030
+ const visible = measureCssLength(detent, content, axis);
1031
+ const offset = Math.max(Math.abs(this.hiddenOffsetPx) - visible, 0) * sign;
1032
+ offsets.push(offset);
1033
+ }
1034
+ offsets.push(0);
1035
+ this.detentOffsetsPx = offsets;
1036
+ this.activeDetent = clamp(this.activeDetent, this.options.swipeDismissal === false ? 1 : 0, offsets.length - 1);
1037
+ dispatch(this.root, "cap-sheet-travel-range-change", {
1038
+ offsets: offsets.map((offset) => toEm(content, offset)),
1039
+ count: offsets.length
1040
+ });
1041
+ } finally {
1042
+ if (view && shouldMeasureHiddenView) {
1043
+ view.hidden = true;
1044
+ view.style.visibility = previousVisibility;
1045
+ view.style.pointerEvents = previousPointerEvents;
1046
+ }
1047
+ }
1048
+ }
1049
+ /** Read current normalized travel details. */
1050
+ getTravelEvent() {
1051
+ const progress = this.getProgressForOffset(this.currentOffsetPx);
1052
+ return {
1053
+ progress,
1054
+ activeDetent: this.activeDetent,
1055
+ offset: toEm(this.parts.content || this.root, this.currentOffsetPx),
1056
+ status: this.status
1057
+ };
1058
+ }
1059
+ resolveInitialDetent() {
1060
+ const detents = normalizeDetents(this.options.detents);
1061
+ const last = detents.length + 1;
1062
+ const configured = this.options.activeDetent ?? this.options.defaultActiveDetent;
1063
+ if (configured !== void 0) return clamp(configured, 1, last);
1064
+ return detents.length > 0 ? 1 : last;
1065
+ }
1066
+ applyOffset(offsetPx, status) {
1067
+ this.currentOffsetPx = offsetPx;
1068
+ this.setStatus(status);
1069
+ const content = this.parts.content;
1070
+ const backdrop = this.parts.backdrop;
1071
+ const view = this.parts.view;
1072
+ const placement = this.options.contentPlacement || "bottom";
1073
+ const progress = this.getProgressForOffset(offsetPx);
1074
+ if (content) {
1075
+ if (placement === "center") {
1076
+ const scale = 0.96 + progress * 0.04;
1077
+ content.style.transform = `translate3d(0, 0, 0) scale(${scale})`;
1078
+ content.style.opacity = String(progress);
1079
+ } else {
1080
+ const offsetEm = toEm(content, offsetPx);
1081
+ const x = isVerticalTrack(this.activeTrack) ? "0" : `${offsetEm}em`;
1082
+ const y = isVerticalTrack(this.activeTrack) ? `${offsetEm}em` : "0";
1083
+ content.style.transform = `translate3d(${x}, ${y}, 0)`;
1084
+ content.style.opacity = "1";
1085
+ }
1086
+ }
1087
+ if (backdrop) {
1088
+ backdrop.style.opacity = String(
1089
+ progress * Number.parseFloat(getComputedStyle(backdrop).getPropertyValue("--cap-sheet-backdrop-opacity") || "0.44")
1090
+ );
1091
+ backdrop.style.pointerEvents = progress > 0.01 && !this.hasInteractiveOutside() ? "auto" : "none";
1092
+ }
1093
+ if (view) {
1094
+ view.style.pointerEvents = progress > 0.01 && !this.hasInteractiveOutside() ? "auto" : "none";
1095
+ view.dataset.presented = this.presented ? "true" : "false";
1096
+ view.dataset.status = status;
1097
+ view.dataset.outsideInteractive = this.hasInteractiveOutside() ? "true" : "false";
1098
+ }
1099
+ this.applyOutletAnimations(progress);
1100
+ this.updateThemeDimming(progress);
1101
+ dispatch(this.root, "cap-sheet-travel", this.getTravelEvent());
1102
+ }
1103
+ async animateTo(targetOffsetPx, settings) {
1104
+ const content = this.parts.content;
1105
+ const backdrop = this.parts.backdrop;
1106
+ const resolved = resolveAnimation(settings);
1107
+ if (!content || shouldSkipMotion(resolved.skip)) {
1108
+ this.applyOffset(targetOffsetPx, "idle");
1109
+ return;
1110
+ }
1111
+ const startOffset = this.currentOffsetPx;
1112
+ const fromProgress = this.getProgressForOffset(startOffset);
1113
+ const toProgress = this.getProgressForOffset(targetOffsetPx);
1114
+ const duration = Math.max(0, resolved.duration);
1115
+ const axis = isVerticalTrack(this.activeTrack) ? "y" : "x";
1116
+ const fromEm = toEm(content, startOffset);
1117
+ const targetEm = toEm(content, targetOffsetPx);
1118
+ const fromTransform = this.options.contentPlacement === "center" ? `translate3d(0, 0, 0) scale(${0.96 + fromProgress * 0.04})` : axis === "y" ? `translate3d(0, ${fromEm}em, 0)` : `translate3d(${fromEm}em, 0, 0)`;
1119
+ const toTransform = this.options.contentPlacement === "center" ? `translate3d(0, 0, 0) scale(${0.96 + toProgress * 0.04})` : axis === "y" ? `translate3d(0, ${targetEm}em, 0)` : `translate3d(${targetEm}em, 0, 0)`;
1120
+ const contentAnimation = resolved.contentMove ? content.animate(
1121
+ [
1122
+ { transform: fromTransform, opacity: this.options.contentPlacement === "center" ? fromProgress : 1 },
1123
+ { transform: toTransform, opacity: this.options.contentPlacement === "center" ? toProgress : 1 }
1124
+ ],
1125
+ { duration, easing: resolved.easing, fill: "both" }
1126
+ ) : null;
1127
+ const backdropOpacity = backdrop ? Number.parseFloat(getComputedStyle(backdrop).getPropertyValue("--cap-sheet-backdrop-opacity") || "0.44") : 0;
1128
+ const backdropAnimation = backdrop?.animate(
1129
+ [{ opacity: fromProgress * backdropOpacity }, { opacity: toProgress * backdropOpacity }],
1130
+ { duration, easing: resolved.easing, fill: "both" }
1131
+ );
1132
+ const started = performance.now();
1133
+ let frame;
1134
+ const tick = () => {
1135
+ const progress = duration === 0 ? 1 : clamp((performance.now() - started) / duration, 0, 1);
1136
+ const offset = startOffset + (targetOffsetPx - startOffset) * progress;
1137
+ this.currentOffsetPx = offset;
1138
+ this.applyOutletAnimations(this.getProgressForOffset(offset));
1139
+ this.updateThemeDimming(this.getProgressForOffset(offset));
1140
+ dispatch(this.root, "cap-sheet-travel", this.getTravelEvent());
1141
+ if (progress < 1) frame = requestAnimationFrame(tick);
1142
+ };
1143
+ frame = requestAnimationFrame(tick);
1144
+ await Promise.allSettled([
1145
+ contentAnimation?.finished,
1146
+ backdropAnimation ? backdropAnimation.finished : Promise.resolve()
1147
+ ]);
1148
+ cancelAnimationFrame(frame);
1149
+ contentAnimation?.cancel();
1150
+ backdropAnimation?.cancel();
1151
+ this.applyOffset(targetOffsetPx, "idle");
1152
+ }
1153
+ getProgressForOffset(offsetPx) {
1154
+ if (this.options.contentPlacement === "center") {
1155
+ return this.presented ? 1 : 0;
1156
+ }
1157
+ const hidden = Math.abs(this.hiddenOffsetPx) || 1;
1158
+ return clamp(1 - Math.abs(offsetPx) / hidden, 0, 1);
1159
+ }
1160
+ limitOffset(offsetPx) {
1161
+ const sign = trackSign(this.activeTrack);
1162
+ const maxAbs = Math.abs(this.hiddenOffsetPx);
1163
+ const min = sign < 0 ? -maxAbs : 0;
1164
+ const max = sign < 0 ? 0 : maxAbs;
1165
+ if (this.options.swipeOvershoot === false) return clamp(offsetPx, min, max);
1166
+ if (offsetPx < min) return min + (offsetPx - min) * 0.18;
1167
+ if (offsetPx > max) return max + (offsetPx - max) * 0.18;
1168
+ return offsetPx;
1169
+ }
1170
+ nearestDetentForOffset(offsetPx, velocity) {
1171
+ const sign = trackSign(this.activeTrack);
1172
+ const fling = Math.abs(velocity) > 700 ? Math.sign(velocity) * sign : 0;
1173
+ if (fling > 0) return Math.max(0, this.activeDetent - 1);
1174
+ if (fling < 0) return Math.min(this.detentOffsetsPx.length - 1, this.activeDetent + 1);
1175
+ let nearest = 0;
1176
+ let nearestDistance = Number.POSITIVE_INFINITY;
1177
+ this.detentOffsetsPx.forEach((offset, index) => {
1178
+ if (index === 0 && this.options.swipeDismissal === false) return;
1179
+ const distance = Math.abs(offset - offsetPx);
1180
+ if (distance < nearestDistance) {
1181
+ nearest = index;
1182
+ nearestDistance = distance;
1183
+ }
1184
+ });
1185
+ return nearest;
1186
+ }
1187
+ hasInteractiveOutside() {
1188
+ return this.options.inertOutside === false && this.options.closeOnOutsideClick === false;
1189
+ }
1190
+ isNativeEdgePointer(event) {
1191
+ const view = this.parts.view;
1192
+ if (!view) return false;
1193
+ const rect = view.getBoundingClientRect();
1194
+ const edgeSize = Math.max(20, rect.width * 0.04);
1195
+ return event.clientX - rect.left <= edgeSize || rect.right - event.clientX <= edgeSize || event.clientY - rect.top <= edgeSize || rect.bottom - event.clientY <= edgeSize;
1196
+ }
1197
+ applySafeArea() {
1198
+ const view = this.parts.view;
1199
+ if (!view) return;
1200
+ const edges = new Set(resolveSafeAreaEdges(this.options.safeArea));
1201
+ view.dataset.safeArea = edges.size > 0 ? Array.from(edges).join(" ") : "none";
1202
+ for (const edge of safeAreaEdges) {
1203
+ view.style.setProperty(
1204
+ `--cap-sheet-applied-safe-area-${edge}`,
1205
+ edges.has(edge) ? `var(--cap-sheet-safe-area-${edge})` : "0em"
1206
+ );
1207
+ }
1208
+ }
1209
+ addGlobalListeners() {
1210
+ const doc = this.root.ownerDocument;
1211
+ if (!this.documentListenersAttached) {
1212
+ doc.addEventListener("keydown", this.handleDocumentKeyDown);
1213
+ this.documentListenersAttached = true;
1214
+ }
1215
+ this.addViewListeners();
1216
+ this.addVisualViewportListeners();
1217
+ }
1218
+ removeGlobalListeners() {
1219
+ const doc = this.root.ownerDocument;
1220
+ if (this.documentListenersAttached) {
1221
+ doc.removeEventListener("keydown", this.handleDocumentKeyDown);
1222
+ this.documentListenersAttached = false;
1223
+ }
1224
+ this.removeViewListeners();
1225
+ this.removeVisualViewportListeners();
1226
+ }
1227
+ addViewListeners() {
1228
+ const view = this.parts.view;
1229
+ if (!view || this.viewListenersElement === view) return;
1230
+ this.removeViewListeners();
1231
+ view.addEventListener("click", this.handleViewClick);
1232
+ view.addEventListener("pointerdown", this.handlePointerDown);
1233
+ view.addEventListener("pointermove", this.handlePointerMove, { passive: false });
1234
+ view.addEventListener("pointerup", this.handlePointerUp);
1235
+ view.addEventListener("pointercancel", this.handlePointerUp);
1236
+ view.addEventListener("wheel", this.handleWheel, { passive: false });
1237
+ this.viewListenersElement = view;
1238
+ }
1239
+ removeViewListeners() {
1240
+ const view = this.viewListenersElement;
1241
+ if (!view) return;
1242
+ view.removeEventListener("click", this.handleViewClick);
1243
+ view.removeEventListener("pointerdown", this.handlePointerDown);
1244
+ view.removeEventListener("pointermove", this.handlePointerMove);
1245
+ view.removeEventListener("pointerup", this.handlePointerUp);
1246
+ view.removeEventListener("pointercancel", this.handlePointerUp);
1247
+ view.removeEventListener("wheel", this.handleWheel);
1248
+ this.viewListenersElement = null;
1249
+ }
1250
+ addVisualViewportListeners() {
1251
+ const visualViewport = this.root.ownerDocument.defaultView?.visualViewport;
1252
+ if (!visualViewport || this.visualViewportListenersAttached) return;
1253
+ visualViewport.addEventListener("resize", this.handleVisualViewportResize);
1254
+ visualViewport.addEventListener("scroll", this.handleVisualViewportResize);
1255
+ this.visualViewportListenersAttached = true;
1256
+ this.handleVisualViewportResize();
1257
+ }
1258
+ removeVisualViewportListeners() {
1259
+ const visualViewport = this.root.ownerDocument.defaultView?.visualViewport;
1260
+ if (!visualViewport || !this.visualViewportListenersAttached) return;
1261
+ visualViewport.removeEventListener("resize", this.handleVisualViewportResize);
1262
+ visualViewport.removeEventListener("scroll", this.handleVisualViewportResize);
1263
+ this.visualViewportListenersAttached = false;
1264
+ }
1265
+ updateDomState(presented) {
1266
+ const view = this.parts.view;
1267
+ const content = this.parts.content;
1268
+ if (view) {
1269
+ view.hidden = !presented && Math.abs(this.currentOffsetPx) === Math.abs(this.detentOffsetsPx[0] || 0);
1270
+ view.dataset.presented = presented ? "true" : "false";
1271
+ view.dataset.status = this.status;
1272
+ view.style.setProperty("--cap-sheet-z-index", String(this.getStackZIndex()));
1273
+ }
1274
+ if (content) {
1275
+ content.setAttribute("aria-hidden", attributeBoolean(!presented));
1276
+ content.setAttribute("tabindex", content.getAttribute("tabindex") || "-1");
1277
+ }
1278
+ this.root.toggleAttribute("presented", presented);
1279
+ }
1280
+ linkAccessibleNames() {
1281
+ if (!this.parts.content) return;
1282
+ if (this.parts.title) {
1283
+ if (!this.parts.title.id) this.parts.title.id = createId("cap-sheet-title");
1284
+ this.parts.content.setAttribute("aria-labelledby", this.parts.title.id);
1285
+ }
1286
+ if (this.parts.description) {
1287
+ if (!this.parts.description.id) this.parts.description.id = createId("cap-sheet-description");
1288
+ this.parts.content.setAttribute("aria-describedby", this.parts.description.id);
1289
+ }
1290
+ }
1291
+ focusInitialElement() {
1292
+ const content = this.parts.content;
1293
+ if (!content) return;
1294
+ const target = this.parts.autoFocusTarget || content.querySelector("cap-auto-focus-target, [autofocus]");
1295
+ const focusable = target || getFocusable(content)[0] || content;
1296
+ requestAnimationFrame(() => focusable.focus({ preventScroll: this.options.nativeFocusScrollPrevention !== false }));
1297
+ }
1298
+ restoreFocus() {
1299
+ if (this.options.restoreFocus === false) return;
1300
+ if (this.previousFocus instanceof HTMLElement && this.previousFocus.isConnected) {
1301
+ this.previousFocus.focus({ preventScroll: true });
1302
+ }
1303
+ this.previousFocus = null;
1304
+ }
1305
+ trapFocus(event) {
1306
+ const content = this.parts.content;
1307
+ if (!content) return;
1308
+ const focusable = getFocusable(content);
1309
+ if (focusable.length === 0) {
1310
+ event.preventDefault();
1311
+ content.focus({ preventScroll: true });
1312
+ return;
1313
+ }
1314
+ const first = focusable[0];
1315
+ const last = focusable[focusable.length - 1];
1316
+ const active = this.root.ownerDocument.activeElement;
1317
+ if (event.shiftKey && active === first) {
1318
+ event.preventDefault();
1319
+ last.focus({ preventScroll: true });
1320
+ } else if (!event.shiftKey && active === last) {
1321
+ event.preventDefault();
1322
+ first.focus({ preventScroll: true });
1323
+ }
1324
+ }
1325
+ lockPage() {
1326
+ if (this.lockedScroll) return;
1327
+ const body = this.root.ownerDocument.body;
1328
+ this.previousBodyOverflow = body.style.overflow;
1329
+ this.previousBodyTouchAction = body.style.touchAction;
1330
+ body.dataset.capSheetScrollLocked = "true";
1331
+ body.style.overflow = "hidden";
1332
+ body.style.touchAction = "none";
1333
+ this.lockedScroll = true;
1334
+ }
1335
+ unlockPage() {
1336
+ if (!this.lockedScroll) return;
1337
+ const body = this.root.ownerDocument.body;
1338
+ delete body.dataset.capSheetScrollLocked;
1339
+ body.style.overflow = this.previousBodyOverflow;
1340
+ body.style.touchAction = this.previousBodyTouchAction;
1341
+ this.previousBodyOverflow = "";
1342
+ this.previousBodyTouchAction = "";
1343
+ this.lockedScroll = false;
1344
+ }
1345
+ applyInert() {
1346
+ if (this.options.inertOutside === false || !this.parts.view) return;
1347
+ const body = this.root.ownerDocument.body;
1348
+ const allowed = /* @__PURE__ */ new Set([this.parts.view, ...this.parts.islands, ...this.parts.externalOverlays]);
1349
+ this.clearInert();
1350
+ for (const child of Array.from(body.children)) {
1351
+ if (!(child instanceof HTMLElement)) continue;
1352
+ const isAllowed = Array.from(allowed).some((element) => child === element || child.contains(element));
1353
+ if (isAllowed) continue;
1354
+ this.inertedElements.set(child, child.getAttribute("aria-hidden"));
1355
+ child.inert = true;
1356
+ child.setAttribute("aria-hidden", "true");
1357
+ }
1358
+ }
1359
+ clearInert() {
1360
+ for (const [element, ariaHidden] of this.inertedElements) {
1361
+ element.inert = false;
1362
+ if (ariaHidden === null) {
1363
+ element.removeAttribute("aria-hidden");
1364
+ } else {
1365
+ element.setAttribute("aria-hidden", ariaHidden);
1366
+ }
1367
+ }
1368
+ this.inertedElements.clear();
1369
+ }
1370
+ retainThemeDimmer() {
1371
+ if (this.hasThemeDimmer || this.options.themeColorDimming !== "auto") return;
1372
+ this.hasThemeDimmer = true;
1373
+ retainThemeColorDimmer();
1374
+ }
1375
+ releaseThemeDimmer() {
1376
+ if (!this.hasThemeDimmer) return;
1377
+ this.hasThemeDimmer = false;
1378
+ releaseThemeColorDimmer(this.root.ownerDocument);
1379
+ }
1380
+ updateThemeDimming(progress) {
1381
+ if (!this.hasThemeDimmer || this.options.themeColorDimming !== "auto") return;
1382
+ const color = this.parts.backdrop ? getComputedStyle(this.parts.backdrop).getPropertyValue("--cap-sheet-backdrop-color") || "rgb(0 0 0)" : "rgb(0 0 0)";
1383
+ setThemeColorDimming(this.root.ownerDocument, clamp(progress * 0.44, 0, 0.7), color);
1384
+ }
1385
+ applyOutletAnimations(progress) {
1386
+ this.updateOutletProgress();
1387
+ for (const outlet of this.parts.outlets) {
1388
+ const animation = outlet.travelAnimation;
1389
+ if (!animation) continue;
1390
+ for (const [property, value] of Object.entries(animation)) {
1391
+ if (value === null || value === void 0) continue;
1392
+ if (Array.isArray(value)) {
1393
+ outlet.style.setProperty(property, tween(value[0], value[1], progress));
1394
+ } else if (typeof value === "function") {
1395
+ const next = value({ progress, tween: (start, end) => tween(start, end, progress) });
1396
+ if (next !== null && next !== void 0) outlet.style.setProperty(property, String(next));
1397
+ } else {
1398
+ outlet.style.setProperty(property, String(value));
1399
+ }
1400
+ }
1401
+ }
1402
+ }
1403
+ updateOutletProgress() {
1404
+ const travel = this.getTravelEvent();
1405
+ for (const outlet of this.parts.outlets) {
1406
+ outlet.style.setProperty("--cap-sheet-progress", String(travel.progress));
1407
+ outlet.style.setProperty("--cap-sheet-offset", `${travel.offset}em`);
1408
+ outlet.dataset.sheetStatus = travel.status;
1409
+ }
1410
+ }
1411
+ emitPresentedChange(presented, source) {
1412
+ const detail = { presented, source };
1413
+ dispatch(this.root, "cap-sheet-presented-change", detail);
1414
+ }
1415
+ emitActiveDetentChange(activeDetent, previousActiveDetent) {
1416
+ const detail = { activeDetent, previousActiveDetent };
1417
+ dispatch(this.root, "cap-sheet-active-detent-change", detail);
1418
+ }
1419
+ registerStack() {
1420
+ const nextStack = this.options.stack || this.root.closest("cap-sheet-stack")?.id || null;
1421
+ if (this.stackId === nextStack) return;
1422
+ this.unregisterStack();
1423
+ this.stackId = nextStack;
1424
+ if (!nextStack) return;
1425
+ const stack = stackRegistry.get(nextStack) || /* @__PURE__ */ new Set();
1426
+ stack.add(this);
1427
+ stackRegistry.set(nextStack, stack);
1428
+ this.updateStack();
1429
+ }
1430
+ unregisterStack() {
1431
+ if (!this.stackId) return;
1432
+ const stack = stackRegistry.get(this.stackId);
1433
+ stack?.delete(this);
1434
+ if (stack?.size === 0) stackRegistry.delete(this.stackId);
1435
+ this.stackId = null;
1436
+ }
1437
+ getStackZIndex() {
1438
+ if (!this.stackId) return 1e3;
1439
+ const stack = Array.from(stackRegistry.get(this.stackId) || []);
1440
+ const index = stack.indexOf(this);
1441
+ return 1e3 + Math.max(index, 0) * 2;
1442
+ }
1443
+ updateStack() {
1444
+ if (!this.stackId) return;
1445
+ const stack = Array.from(stackRegistry.get(this.stackId) || []);
1446
+ const presented = stack.filter((controller) => controller.presented);
1447
+ stack.forEach((controller, index) => {
1448
+ controller.parts.view?.style.setProperty("--cap-sheet-z-index", String(1e3 + index * 2));
1449
+ const depth = presented.length - presented.indexOf(controller) - 1;
1450
+ const stackDepth = Math.max(depth, 0);
1451
+ controller.parts.content?.style.setProperty("--cap-sheet-stack-depth", String(stackDepth));
1452
+ controller.applyStackingAnimations(stackDepth);
1453
+ });
1454
+ }
1455
+ applyStackingAnimations(depth) {
1456
+ const progress = clamp(depth, 0, 4) / 4;
1457
+ for (const outlet of this.parts.outlets) {
1458
+ const animation = outlet.stackingAnimation;
1459
+ if (!animation) continue;
1460
+ for (const [property, value] of Object.entries(animation)) {
1461
+ if (value === null || value === void 0) continue;
1462
+ if (Array.isArray(value)) {
1463
+ outlet.style.setProperty(property, tween(value[0], value[1], progress));
1464
+ } else if (typeof value === "function") {
1465
+ const next = value({ progress, tween: (start, end) => tween(start, end, progress) });
1466
+ if (next !== null && next !== void 0) outlet.style.setProperty(property, String(next));
1467
+ } else {
1468
+ outlet.style.setProperty(property, String(value));
1469
+ }
1470
+ }
1471
+ }
1472
+ }
1473
+ setStatus(status) {
1474
+ if (this.status === status) return;
1475
+ const previousStatus = this.status;
1476
+ this.status = status;
1477
+ dispatch(this.root, "cap-sheet-travel-status-change", { previousStatus, status });
1478
+ }
1479
+ };
1480
+ }
1481
+ });
1482
+
1483
+ // src/components/cap-sheet.ts
1484
+ function getSheetFromElement(element) {
1485
+ const explicitTarget = element.getAttribute("for");
1486
+ if (explicitTarget) {
1487
+ const found = element.ownerDocument.getElementById(explicitTarget);
1488
+ return isCapSheetElement(found) ? found : null;
1489
+ }
1490
+ const nearest = element.closest("cap-sheet");
1491
+ return isCapSheetElement(nearest) ? nearest : null;
1492
+ }
1493
+ function isCapSheetElement(element) {
1494
+ if (element?.localName !== "cap-sheet") return false;
1495
+ const candidate = element;
1496
+ return typeof candidate.present === "function" && typeof candidate.dismiss === "function";
1497
+ }
1498
+ function applySheetOptions(element, options) {
1499
+ if (options.contentPlacement) element.setAttribute("content-placement", options.contentPlacement);
1500
+ if (options.detents !== void 0) {
1501
+ element.setAttribute("detents", Array.isArray(options.detents) ? options.detents.join(" ") : options.detents);
1502
+ }
1503
+ if (options.activeDetent !== void 0) element.setAttribute("active-detent", String(options.activeDetent));
1504
+ if (options.defaultActiveDetent !== void 0) {
1505
+ element.setAttribute("default-active-detent", String(options.defaultActiveDetent));
1506
+ }
1507
+ if (options.defaultPresented !== void 0)
1508
+ element.setAttribute("default-presented", String(options.defaultPresented));
1509
+ if (options.presented !== void 0) element.toggleAttribute("presented", options.presented);
1510
+ if (options.sheetRole) element.setAttribute("sheet-role", options.sheetRole);
1511
+ if (options.safeArea !== void 0) {
1512
+ element.setAttribute(
1513
+ "safe-area",
1514
+ Array.isArray(options.safeArea) ? options.safeArea.join(" ") : String(options.safeArea)
1515
+ );
1516
+ }
1517
+ if (options.stack) element.setAttribute("stack", options.stack);
1518
+ if (options.tracks)
1519
+ element.setAttribute("tracks", Array.isArray(options.tracks) ? options.tracks.join(" ") : options.tracks);
1520
+ for (const [key, attr] of [
1521
+ ["swipe", "swipe"],
1522
+ ["swipeDismissal", "swipe-dismissal"],
1523
+ ["swipeOvershoot", "swipe-overshoot"],
1524
+ ["swipeTrap", "swipe-trap"],
1525
+ ["inertOutside", "inert-outside"],
1526
+ ["nativeEdgeSwipePrevention", "native-edge-swipe-prevention"],
1527
+ ["nativeFocusScrollPrevention", "native-focus-scroll-prevention"],
1528
+ ["closeOnOutsideClick", "close-on-outside-click"],
1529
+ ["closeOnEscape", "close-on-escape"],
1530
+ ["focusTrap", "focus-trap"],
1531
+ ["restoreFocus", "restore-focus"]
1532
+ ]) {
1533
+ const value = options[key];
1534
+ if (typeof value === "boolean") element.setAttribute(attr, String(value));
1535
+ }
1536
+ if (options.themeColorDimming !== void 0) {
1537
+ element.setAttribute("theme-color-dimming", options.themeColorDimming === false ? "false" : "auto");
1538
+ }
1539
+ }
1540
+ var observed, CapSheet;
1541
+ var init_cap_sheet = __esm({
1542
+ "src/components/cap-sheet.ts"() {
1543
+ "use strict";
1544
+ init_sheet_controller();
1545
+ init_styles();
1546
+ init_utils();
1547
+ observed = [
1548
+ "active-detent",
1549
+ "close-on-escape",
1550
+ "close-on-outside-click",
1551
+ "content-placement",
1552
+ "default-active-detent",
1553
+ "default-presented",
1554
+ "detents",
1555
+ "focus-trap",
1556
+ "inert-outside",
1557
+ "native-edge-swipe-prevention",
1558
+ "native-focus-scroll-prevention",
1559
+ "presented",
1560
+ "restore-focus",
1561
+ "safe-area",
1562
+ "sheet-role",
1563
+ "stack",
1564
+ "swipe",
1565
+ "swipe-dismissal",
1566
+ "swipe-overshoot",
1567
+ "swipe-trap",
1568
+ "theme-color-dimming",
1569
+ "tracks"
1570
+ ];
1571
+ CapSheet = class extends HTMLElement {
1572
+ controller = new SheetController(this);
1573
+ syncingAttribute = false;
1574
+ static get observedAttributes() {
1575
+ return observed;
1576
+ }
1577
+ connectedCallback() {
1578
+ injectCapSheetStyles(this.ownerDocument);
1579
+ this.style.display ||= "contents";
1580
+ this.controller.connect();
1581
+ }
1582
+ disconnectedCallback() {
1583
+ this.controller.disconnect();
1584
+ }
1585
+ attributeChangedCallback() {
1586
+ if (this.syncingAttribute) return;
1587
+ this.controller.configure({});
1588
+ if (this.isConnected) {
1589
+ if (this.hasAttribute("presented") && !this.controller.presented) {
1590
+ void this.present({ source: "programmatic" });
1591
+ } else if (!this.hasAttribute("presented") && this.controller.presented) {
1592
+ void this.dismiss({ source: "programmatic" });
1593
+ }
1594
+ }
1595
+ }
1596
+ /** True when the sheet is currently presented. */
1597
+ get presented() {
1598
+ return this.controller.presented;
1599
+ }
1600
+ set presented(value) {
1601
+ if (value) {
1602
+ void this.present();
1603
+ } else {
1604
+ void this.dismiss();
1605
+ }
1606
+ }
1607
+ /** Current active detent index. */
1608
+ get activeDetent() {
1609
+ return this.controller.activeDetent;
1610
+ }
1611
+ set activeDetent(value) {
1612
+ void this.stepTo(value);
1613
+ }
1614
+ /** Configure the sheet imperatively without depending on a framework adapter. */
1615
+ configure(options) {
1616
+ this.controller.configure(options);
1617
+ }
1618
+ /** Present the sheet. */
1619
+ async present(options = {}) {
1620
+ await this.controller.present(options);
1621
+ this.syncAttribute("presented", true);
1622
+ }
1623
+ /** Dismiss the sheet. */
1624
+ async dismiss(options = {}) {
1625
+ await this.controller.dismiss(options);
1626
+ this.syncAttribute("presented", false);
1627
+ }
1628
+ /** Toggle presentation state. */
1629
+ async toggle(options = {}) {
1630
+ if (this.presented) {
1631
+ await this.dismiss(options);
1632
+ } else {
1633
+ await this.present(options);
1634
+ }
1635
+ }
1636
+ /** Step to a specific detent index. */
1637
+ async stepTo(detent, options = {}) {
1638
+ await this.controller.stepTo(detent, options);
1639
+ if (this.controller.presented) this.syncAttribute("presented", true);
1640
+ }
1641
+ /** Step one detent up or down. */
1642
+ async step(direction = "up", options = {}) {
1643
+ await this.controller.step(direction, options);
1644
+ }
1645
+ syncAttribute(name, enabled) {
1646
+ this.syncingAttribute = true;
1647
+ this.toggleAttribute(name, enabled);
1648
+ this.syncingAttribute = false;
1649
+ }
1650
+ };
1651
+ }
1652
+ });
1653
+
1654
+ // src/components/sheet-actions.ts
1655
+ function normalizeAction(value, fallback) {
1656
+ return ["present", "dismiss", "toggle", "step"].includes(value || "") ? value : fallback;
1657
+ }
1658
+ async function runAction(element, fallback) {
1659
+ const sheet = getSheetFromElement(element);
1660
+ if (!sheet) return;
1661
+ const action = normalizeAction(element.getAttribute("action"), fallback);
1662
+ if (action === "present") {
1663
+ await sheet.present({ source: "trigger" });
1664
+ } else if (action === "dismiss") {
1665
+ await sheet.dismiss({ source: "trigger" });
1666
+ } else if (action === "step") {
1667
+ const detent = Number.parseInt(element.getAttribute("detent") || "", 10);
1668
+ if (Number.isFinite(detent)) {
1669
+ await sheet.stepTo(detent, { source: "trigger" });
1670
+ } else {
1671
+ await sheet.step(element.getAttribute("direction") || "up", { source: "trigger" });
1672
+ }
1673
+ } else {
1674
+ await sheet.toggle({ source: "trigger" });
1675
+ }
1676
+ }
1677
+ var CapSheetTrigger, CapSheetHandle;
1678
+ var init_sheet_actions = __esm({
1679
+ "src/components/sheet-actions.ts"() {
1680
+ "use strict";
1681
+ init_styles();
1682
+ init_cap_sheet();
1683
+ CapSheetTrigger = class extends HTMLElement {
1684
+ connectedCallback() {
1685
+ injectCapSheetStyles(this.ownerDocument);
1686
+ this.role ||= "button";
1687
+ if (!this.hasAttribute("tabindex")) this.tabIndex = 0;
1688
+ this.addEventListener("click", this.handleClick);
1689
+ this.addEventListener("keydown", this.handleKeyDown);
1690
+ }
1691
+ disconnectedCallback() {
1692
+ this.removeEventListener("click", this.handleClick);
1693
+ this.removeEventListener("keydown", this.handleKeyDown);
1694
+ }
1695
+ handleClick = () => {
1696
+ void runAction(this, "toggle");
1697
+ };
1698
+ handleKeyDown = (event) => {
1699
+ if (event.key !== "Enter" && event.key !== " ") return;
1700
+ event.preventDefault();
1701
+ void runAction(this, "toggle");
1702
+ };
1703
+ };
1704
+ CapSheetHandle = class extends HTMLElement {
1705
+ connectedCallback() {
1706
+ injectCapSheetStyles(this.ownerDocument);
1707
+ this.role ||= "button";
1708
+ if (!this.hasAttribute("tabindex")) this.tabIndex = 0;
1709
+ this.setAttribute("aria-label", this.getAttribute("aria-label") || "Move sheet");
1710
+ this.addEventListener("click", this.handleClick);
1711
+ this.addEventListener("keydown", this.handleKeyDown);
1712
+ }
1713
+ disconnectedCallback() {
1714
+ this.removeEventListener("click", this.handleClick);
1715
+ this.removeEventListener("keydown", this.handleKeyDown);
1716
+ }
1717
+ handleClick = () => {
1718
+ void runAction(this, "step");
1719
+ };
1720
+ handleKeyDown = (event) => {
1721
+ if (event.key === "ArrowUp") {
1722
+ event.preventDefault();
1723
+ this.setAttribute("direction", "up");
1724
+ void runAction(this, "step");
1725
+ }
1726
+ if (event.key === "ArrowDown") {
1727
+ event.preventDefault();
1728
+ this.setAttribute("direction", "down");
1729
+ void runAction(this, "step");
1730
+ }
1731
+ };
1732
+ };
1733
+ }
1734
+ });
1735
+
1736
+ // src/components/sheet-context.ts
1737
+ var CapSheetStack, CapSheetOutlet, CapSheetSpecialWrapper, CapSheetSpecialWrapperContent, CapIsland, CapExternalOverlay, CapFixed, CapVisuallyHidden;
1738
+ var init_sheet_context = __esm({
1739
+ "src/components/sheet-context.ts"() {
1740
+ "use strict";
1741
+ init_styles();
1742
+ init_cap_sheet();
1743
+ CapSheetStack = class extends HTMLElement {
1744
+ connectedCallback() {
1745
+ injectCapSheetStyles(this.ownerDocument);
1746
+ this.style.display ||= "contents";
1747
+ if (!this.id) this.id = `cap-sheet-stack-${Math.random().toString(36).slice(2, 10)}`;
1748
+ }
1749
+ };
1750
+ CapSheetOutlet = class extends HTMLElement {
1751
+ travelAnimation;
1752
+ stackingAnimation;
1753
+ connectedCallback() {
1754
+ injectCapSheetStyles(this.ownerDocument);
1755
+ getSheetFromElement(this)?.controller.registerOutlet(this);
1756
+ }
1757
+ disconnectedCallback() {
1758
+ getSheetFromElement(this)?.controller.unregisterOutlet(this);
1759
+ }
1760
+ };
1761
+ CapSheetSpecialWrapper = class extends HTMLElement {
1762
+ connectedCallback() {
1763
+ injectCapSheetStyles(this.ownerDocument);
1764
+ this.style.display ||= "contents";
1765
+ }
1766
+ };
1767
+ CapSheetSpecialWrapperContent = class extends HTMLElement {
1768
+ connectedCallback() {
1769
+ injectCapSheetStyles(this.ownerDocument);
1770
+ this.style.display ||= "contents";
1771
+ }
1772
+ };
1773
+ CapIsland = class extends HTMLElement {
1774
+ connectedCallback() {
1775
+ injectCapSheetStyles(this.ownerDocument);
1776
+ getSheetFromElement(this)?.controller.registerIsland(this);
1777
+ }
1778
+ disconnectedCallback() {
1779
+ getSheetFromElement(this)?.controller.unregisterIsland(this);
1780
+ }
1781
+ };
1782
+ CapExternalOverlay = class extends HTMLElement {
1783
+ registered = null;
1784
+ connectedCallback() {
1785
+ injectCapSheetStyles(this.ownerDocument);
1786
+ this.register();
1787
+ }
1788
+ disconnectedCallback() {
1789
+ this.unregister();
1790
+ }
1791
+ register() {
1792
+ const sheet = getSheetFromElement(this);
1793
+ if (!sheet) return;
1794
+ const selector = this.getAttribute("content-getter");
1795
+ const content = selector ? this.ownerDocument.querySelector(selector) : this;
1796
+ if (!content) return;
1797
+ this.registered = content;
1798
+ sheet.controller.registerIsland(content);
1799
+ }
1800
+ unregister() {
1801
+ const sheet = getSheetFromElement(this);
1802
+ if (sheet && this.registered) {
1803
+ sheet.controller.unregisterIsland(this.registered);
1804
+ }
1805
+ this.registered = null;
1806
+ }
1807
+ };
1808
+ CapFixed = class extends HTMLElement {
1809
+ connectedCallback() {
1810
+ injectCapSheetStyles(this.ownerDocument);
1811
+ }
1812
+ };
1813
+ CapVisuallyHidden = class extends HTMLElement {
1814
+ connectedCallback() {
1815
+ injectCapSheetStyles(this.ownerDocument);
1816
+ }
1817
+ };
1818
+ }
1819
+ });
1820
+
1821
+ // src/components/sheet-parts.ts
1822
+ var SheetPartElement, CapSheetView, CapSheetBackdrop, CapSheetContent, CapSheetBleedingBackground, CapSheetTitle, CapSheetDescription, CapAutoFocusTarget;
1823
+ var init_sheet_parts = __esm({
1824
+ "src/components/sheet-parts.ts"() {
1825
+ "use strict";
1826
+ init_styles();
1827
+ init_utils();
1828
+ init_cap_sheet();
1829
+ SheetPartElement = class extends HTMLElement {
1830
+ connectedCallback() {
1831
+ injectCapSheetStyles(this.ownerDocument);
1832
+ const sheet = getSheetFromElement(this);
1833
+ sheet?.controller.registerPart(this.partName, this);
1834
+ }
1835
+ disconnectedCallback() {
1836
+ const sheet = getSheetFromElement(this);
1837
+ sheet?.controller.unregisterPart(this.partName, this);
1838
+ }
1839
+ };
1840
+ CapSheetView = class extends SheetPartElement {
1841
+ partName = "view";
1842
+ connectedCallback() {
1843
+ super.connectedCallback();
1844
+ const sheet = getSheetFromElement(this);
1845
+ const placement = this.getAttribute("content-placement") || sheet?.controller.options.contentPlacement || "bottom";
1846
+ this.setAttribute("content-placement", placement);
1847
+ }
1848
+ };
1849
+ CapSheetBackdrop = class extends SheetPartElement {
1850
+ partName = "backdrop";
1851
+ };
1852
+ CapSheetContent = class extends SheetPartElement {
1853
+ partName = "content";
1854
+ connectedCallback() {
1855
+ super.connectedCallback();
1856
+ if (!this.hasAttribute("tabindex")) this.tabIndex = -1;
1857
+ }
1858
+ };
1859
+ CapSheetBleedingBackground = class extends HTMLElement {
1860
+ connectedCallback() {
1861
+ injectCapSheetStyles(this.ownerDocument);
1862
+ }
1863
+ };
1864
+ CapSheetTitle = class extends SheetPartElement {
1865
+ partName = "title";
1866
+ connectedCallback() {
1867
+ if (!this.id) this.id = createId("cap-sheet-title");
1868
+ super.connectedCallback();
1869
+ }
1870
+ };
1871
+ CapSheetDescription = class extends SheetPartElement {
1872
+ partName = "description";
1873
+ connectedCallback() {
1874
+ if (!this.id) this.id = createId("cap-sheet-description");
1875
+ super.connectedCallback();
1876
+ }
1877
+ };
1878
+ CapAutoFocusTarget = class extends SheetPartElement {
1879
+ partName = "autoFocusTarget";
1880
+ connectedCallback() {
1881
+ if (!this.hasAttribute("tabindex")) this.tabIndex = -1;
1882
+ super.connectedCallback();
1883
+ }
1884
+ };
1885
+ }
1886
+ });
1887
+
1888
+ // src/components/sheet-portal.ts
1889
+ var CapSheetPortal;
1890
+ var init_sheet_portal = __esm({
1891
+ "src/components/sheet-portal.ts"() {
1892
+ "use strict";
1893
+ init_styles();
1894
+ init_utils();
1895
+ CapSheetPortal = class extends HTMLElement {
1896
+ host = null;
1897
+ connectedCallback() {
1898
+ injectCapSheetStyles(this.ownerDocument);
1899
+ this.style.display ||= "contents";
1900
+ if (this.hasAttribute("disabled")) return;
1901
+ const sheet = this.closest("cap-sheet");
1902
+ if (!sheet) return;
1903
+ if (!sheet.id) sheet.id = createId("cap-sheet");
1904
+ this.host = this.ownerDocument.createElement("div");
1905
+ this.host.dataset.capSheetPortal = sheet.id;
1906
+ this.host.style.display = "contents";
1907
+ for (const child of Array.from(this.children)) {
1908
+ if (child instanceof HTMLElement && !child.hasAttribute("for")) {
1909
+ child.setAttribute("for", sheet.id);
1910
+ for (const descendant of Array.from(
1911
+ child.querySelectorAll(
1912
+ "cap-sheet-view, cap-sheet-backdrop, cap-sheet-content, cap-sheet-title, cap-sheet-description, cap-sheet-trigger, cap-sheet-handle, cap-auto-focus-target"
1913
+ )
1914
+ )) {
1915
+ if (!descendant.hasAttribute("for")) descendant.setAttribute("for", sheet.id);
1916
+ }
1917
+ }
1918
+ this.host.appendChild(child);
1919
+ }
1920
+ this.ownerDocument.body.appendChild(this.host);
1921
+ }
1922
+ disconnectedCallback() {
1923
+ if (!this.host) return;
1924
+ for (const child of Array.from(this.host.children)) {
1925
+ this.appendChild(child);
1926
+ }
1927
+ this.host.remove();
1928
+ this.host = null;
1929
+ }
1930
+ };
1931
+ }
1932
+ });
1933
+
1934
+ // src/components/index.ts
1935
+ var components_exports = {};
1936
+ __export(components_exports, {
1937
+ CapAutoFocusTarget: () => CapAutoFocusTarget,
1938
+ CapExternalOverlay: () => CapExternalOverlay,
1939
+ CapFixed: () => CapFixed,
1940
+ CapIsland: () => CapIsland,
1941
+ CapScroll: () => CapScroll,
1942
+ CapScrollContent: () => CapScrollContent,
1943
+ CapSheet: () => CapSheet,
1944
+ CapSheetBackdrop: () => CapSheetBackdrop,
1945
+ CapSheetBleedingBackground: () => CapSheetBleedingBackground,
1946
+ CapSheetContent: () => CapSheetContent,
1947
+ CapSheetDescription: () => CapSheetDescription,
1948
+ CapSheetHandle: () => CapSheetHandle,
1949
+ CapSheetOutlet: () => CapSheetOutlet,
1950
+ CapSheetPortal: () => CapSheetPortal,
1951
+ CapSheetSpecialWrapper: () => CapSheetSpecialWrapper,
1952
+ CapSheetSpecialWrapperContent: () => CapSheetSpecialWrapperContent,
1953
+ CapSheetStack: () => CapSheetStack,
1954
+ CapSheetTitle: () => CapSheetTitle,
1955
+ CapSheetTrigger: () => CapSheetTrigger,
1956
+ CapSheetView: () => CapSheetView,
1957
+ CapVisuallyHidden: () => CapVisuallyHidden
1958
+ });
1959
+ var init_components = __esm({
1960
+ "src/components/index.ts"() {
1961
+ "use strict";
1962
+ init_utils();
1963
+ init_cap_scroll();
1964
+ init_cap_sheet();
1965
+ init_sheet_actions();
1966
+ init_sheet_context();
1967
+ init_sheet_parts();
1968
+ init_sheet_portal();
1969
+ defineElement("cap-sheet", CapSheet);
1970
+ defineElement("cap-sheet-trigger", CapSheetTrigger);
1971
+ defineElement("cap-sheet-portal", CapSheetPortal);
1972
+ defineElement("cap-sheet-view", CapSheetView);
1973
+ defineElement("cap-sheet-backdrop", CapSheetBackdrop);
1974
+ defineElement("cap-sheet-content", CapSheetContent);
1975
+ defineElement("cap-sheet-bleeding-background", CapSheetBleedingBackground);
1976
+ defineElement("cap-sheet-handle", CapSheetHandle);
1977
+ defineElement("cap-sheet-title", CapSheetTitle);
1978
+ defineElement("cap-sheet-description", CapSheetDescription);
1979
+ defineElement("cap-sheet-special-wrapper", CapSheetSpecialWrapper);
1980
+ defineElement("cap-sheet-special-wrapper-content", CapSheetSpecialWrapperContent);
1981
+ defineElement("cap-sheet-stack", CapSheetStack);
1982
+ defineElement("cap-sheet-outlet", CapSheetOutlet);
1983
+ defineElement("cap-scroll", CapScroll);
1984
+ defineElement("cap-scroll-content", CapScrollContent);
1985
+ defineElement("cap-fixed", CapFixed);
1986
+ defineElement("cap-island", CapIsland);
1987
+ defineElement("cap-external-overlay", CapExternalOverlay);
1988
+ defineElement("cap-visually-hidden", CapVisuallyHidden);
1989
+ defineElement("cap-auto-focus-target", CapAutoFocusTarget);
1990
+ }
1991
+ });
1992
+
1993
+ // src/index.ts
1994
+ var index_exports = {};
1995
+ __export(index_exports, {
1996
+ CAP_SHEETS_CSS: () => CSS,
1997
+ CapAutoFocusTarget: () => CapAutoFocusTarget,
1998
+ CapExternalOverlay: () => CapExternalOverlay,
1999
+ CapFixed: () => CapFixed,
2000
+ CapIsland: () => CapIsland,
2001
+ CapScroll: () => CapScroll,
2002
+ CapScrollContent: () => CapScrollContent,
2003
+ CapSheet: () => CapSheet,
2004
+ CapSheetBackdrop: () => CapSheetBackdrop,
2005
+ CapSheetBleedingBackground: () => CapSheetBleedingBackground,
2006
+ CapSheetContent: () => CapSheetContent,
2007
+ CapSheetDescription: () => CapSheetDescription,
2008
+ CapSheetHandle: () => CapSheetHandle,
2009
+ CapSheetOutlet: () => CapSheetOutlet,
2010
+ CapSheetPortal: () => CapSheetPortal,
2011
+ CapSheetSpecialWrapper: () => CapSheetSpecialWrapper,
2012
+ CapSheetSpecialWrapperContent: () => CapSheetSpecialWrapperContent,
2013
+ CapSheetStack: () => CapSheetStack,
2014
+ CapSheetTitle: () => CapSheetTitle,
2015
+ CapSheetTrigger: () => CapSheetTrigger,
2016
+ CapSheetView: () => CapSheetView,
2017
+ CapVisuallyHidden: () => CapVisuallyHidden,
2018
+ SheetController: () => SheetController,
2019
+ applySheetOptions: () => applySheetOptions,
2020
+ getSheetFromElement: () => getSheetFromElement,
2021
+ initCapSheets: () => initCapSheets,
2022
+ injectCapSheetStyles: () => injectCapSheetStyles,
2023
+ updateThemeColor: () => updateThemeColor
2024
+ });
2025
+ module.exports = __toCommonJS(index_exports);
2026
+ init_components();
2027
+ init_styles();
2028
+ init_theme_color();
2029
+ init_sheet_controller();
2030
+ init_cap_sheet();
2031
+ init_components();
2032
+ function initCapSheets() {
2033
+ Promise.resolve().then(() => init_components());
2034
+ if (typeof document !== "undefined") {
2035
+ Promise.resolve().then(() => (init_styles(), styles_exports)).then(({ injectCapSheetStyles: injectCapSheetStyles2 }) => injectCapSheetStyles2(document));
2036
+ }
2037
+ }
2038
+ // Annotate the CommonJS export names for ESM import in node:
2039
+ 0 && (module.exports = {
2040
+ CAP_SHEETS_CSS,
2041
+ CapAutoFocusTarget,
2042
+ CapExternalOverlay,
2043
+ CapFixed,
2044
+ CapIsland,
2045
+ CapScroll,
2046
+ CapScrollContent,
2047
+ CapSheet,
2048
+ CapSheetBackdrop,
2049
+ CapSheetBleedingBackground,
2050
+ CapSheetContent,
2051
+ CapSheetDescription,
2052
+ CapSheetHandle,
2053
+ CapSheetOutlet,
2054
+ CapSheetPortal,
2055
+ CapSheetSpecialWrapper,
2056
+ CapSheetSpecialWrapperContent,
2057
+ CapSheetStack,
2058
+ CapSheetTitle,
2059
+ CapSheetTrigger,
2060
+ CapSheetView,
2061
+ CapVisuallyHidden,
2062
+ SheetController,
2063
+ applySheetOptions,
2064
+ getSheetFromElement,
2065
+ initCapSheets,
2066
+ injectCapSheetStyles,
2067
+ updateThemeColor
2068
+ });
2069
+ //# sourceMappingURL=index.js.map