glasslikeui 1.9.1 → 1.10.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 (128) hide show
  1. package/README.md +887 -26
  2. package/dist/actions/adaptiveTone.d.ts +50 -0
  3. package/dist/actions/adaptiveTone.js +569 -0
  4. package/dist/actions/alertLogic.d.ts +67 -0
  5. package/dist/actions/alertLogic.js +123 -0
  6. package/dist/actions/anchorPlacement.d.ts +92 -0
  7. package/dist/actions/anchorPlacement.js +137 -0
  8. package/dist/actions/dragSnap.d.ts +1 -1
  9. package/dist/actions/dragSnapMath.d.ts +70 -0
  10. package/dist/actions/dragSnapMath.js +115 -0
  11. package/dist/actions/glassToneLogic.d.ts +182 -0
  12. package/dist/actions/glassToneLogic.js +513 -0
  13. package/dist/actions/heightTransition.d.ts +32 -0
  14. package/dist/actions/heightTransition.js +64 -0
  15. package/dist/actions/index.d.ts +1 -0
  16. package/dist/actions/index.js +1 -0
  17. package/dist/actions/inertSiblings.js +20 -4
  18. package/dist/actions/menuLogic.d.ts +40 -0
  19. package/dist/actions/menuLogic.js +68 -0
  20. package/dist/actions/modalDialog.d.ts +19 -0
  21. package/dist/actions/modalDialog.js +48 -0
  22. package/dist/actions/popoverLogic.d.ts +25 -0
  23. package/dist/actions/popoverLogic.js +48 -0
  24. package/dist/actions/rovingIndex.d.ts +30 -0
  25. package/dist/actions/rovingIndex.js +49 -0
  26. package/dist/actions/scrollRunTracker.d.ts +36 -0
  27. package/dist/actions/scrollRunTracker.js +77 -0
  28. package/dist/actions/scrollUnder.d.ts +21 -0
  29. package/dist/actions/scrollUnder.js +29 -0
  30. package/dist/actions/segmentedLogic.d.ts +38 -0
  31. package/dist/actions/segmentedLogic.js +59 -0
  32. package/dist/actions/sheetLogic.d.ts +25 -7
  33. package/dist/actions/sheetLogic.js +43 -10
  34. package/dist/actions/sliderLogic.d.ts +29 -0
  35. package/dist/actions/sliderLogic.js +53 -0
  36. package/dist/actions/swipeActions.d.ts +46 -2
  37. package/dist/actions/swipeActions.js +267 -46
  38. package/dist/actions/tabBarMinimize.d.ts +31 -0
  39. package/dist/actions/tabBarMinimize.js +38 -0
  40. package/dist/actions/tabViewLogic.d.ts +47 -0
  41. package/dist/actions/tabViewLogic.js +71 -0
  42. package/dist/actions/toggleKnobLogic.d.ts +57 -0
  43. package/dist/actions/toggleKnobLogic.js +66 -0
  44. package/dist/actions/toolbarFocus.d.ts +44 -0
  45. package/dist/actions/toolbarFocus.js +228 -0
  46. package/dist/actions/topLayer.d.ts +12 -0
  47. package/dist/actions/topLayer.js +18 -0
  48. package/dist/components/dialog/ActionSheet.svelte +457 -0
  49. package/dist/components/dialog/ActionSheet.svelte.d.ts +25 -0
  50. package/dist/components/dialog/Alert.svelte +337 -0
  51. package/dist/components/dialog/Alert.svelte.d.ts +28 -0
  52. package/dist/components/dialog/index.d.ts +6 -0
  53. package/dist/components/dialog/index.js +6 -0
  54. package/dist/components/glass/Glass.svelte +49 -17
  55. package/dist/components/glass/Glass.svelte.d.ts +8 -0
  56. package/dist/components/glass/GlassSection.svelte +9 -1
  57. package/dist/components/glass/LensFilters.svelte +4 -2
  58. package/dist/components/glass/Popover.svelte +379 -0
  59. package/dist/components/glass/Popover.svelte.d.ts +30 -0
  60. package/dist/components/glass/Sheet.svelte +450 -105
  61. package/dist/components/glass/Sheet.svelte.d.ts +55 -7
  62. package/dist/components/glass/index.d.ts +3 -0
  63. package/dist/components/glass/index.js +1 -0
  64. package/dist/components/index.d.ts +2 -0
  65. package/dist/components/index.js +4 -0
  66. package/dist/components/interactive/Badge.svelte +97 -6
  67. package/dist/components/interactive/Badge.svelte.d.ts +13 -2
  68. package/dist/components/interactive/Button.svelte +159 -20
  69. package/dist/components/interactive/Button.svelte.d.ts +14 -1
  70. package/dist/components/interactive/IconButton.svelte +214 -4
  71. package/dist/components/interactive/IconButton.svelte.d.ts +2 -1
  72. package/dist/components/interactive/ProgressView.svelte +306 -0
  73. package/dist/components/interactive/ProgressView.svelte.d.ts +25 -0
  74. package/dist/components/interactive/Segment.d.ts +14 -0
  75. package/dist/components/interactive/Segment.js +1 -0
  76. package/dist/components/interactive/SegmentedControl.svelte +399 -0
  77. package/dist/components/interactive/SegmentedControl.svelte.d.ts +17 -0
  78. package/dist/components/interactive/Slider.svelte +299 -0
  79. package/dist/components/interactive/Slider.svelte.d.ts +23 -0
  80. package/dist/components/interactive/TabView.svelte +573 -41
  81. package/dist/components/interactive/TabView.svelte.d.ts +25 -0
  82. package/dist/components/interactive/Toggle.svelte +287 -16
  83. package/dist/components/interactive/Toggle.svelte.d.ts +12 -0
  84. package/dist/components/interactive/index.d.ts +4 -0
  85. package/dist/components/interactive/index.js +3 -0
  86. package/dist/components/list/List.svelte +41 -17
  87. package/dist/components/list/List.svelte.d.ts +1 -0
  88. package/dist/components/list/ListRow.svelte +208 -47
  89. package/dist/components/list/ListRow.svelte.d.ts +16 -1
  90. package/dist/components/menu/Menu.svelte +51 -27
  91. package/dist/components/menu/Menu.svelte.d.ts +5 -0
  92. package/dist/components/menu/MenuItem.svelte +82 -25
  93. package/dist/components/menu/MenuItem.svelte.d.ts +8 -0
  94. package/dist/components/menu/MenuSection.svelte +95 -0
  95. package/dist/components/menu/MenuSection.svelte.d.ts +18 -0
  96. package/dist/components/menu/MenuSubmenu.svelte +196 -0
  97. package/dist/components/menu/MenuSubmenu.svelte.d.ts +11 -0
  98. package/dist/components/menu/index.d.ts +4 -1
  99. package/dist/components/menu/index.js +3 -1
  100. package/dist/components/navigation/NavigationBar.svelte +97 -15
  101. package/dist/components/navigation/NavigationBar.svelte.d.ts +6 -0
  102. package/dist/components/toolbar/Toolbar.svelte +43 -0
  103. package/dist/components/toolbar/Toolbar.svelte.d.ts +13 -0
  104. package/dist/components/toolbar/ToolbarItemGroup.svelte +45 -0
  105. package/dist/components/toolbar/ToolbarItemGroup.svelte.d.ts +14 -0
  106. package/dist/components/toolbar/ToolbarSpacer.svelte +36 -0
  107. package/dist/components/toolbar/ToolbarSpacer.svelte.d.ts +12 -0
  108. package/dist/components/toolbar/index.d.ts +7 -0
  109. package/dist/components/toolbar/index.js +7 -0
  110. package/dist/components/typography/Text.svelte +9 -1
  111. package/dist/constants/alertAction.d.ts +19 -0
  112. package/dist/constants/alertAction.js +1 -0
  113. package/dist/constants/badge.d.ts +32 -0
  114. package/dist/constants/badge.js +47 -0
  115. package/dist/constants/buttons.d.ts +45 -0
  116. package/dist/constants/buttons.js +52 -0
  117. package/dist/constants/colors.d.ts +9 -4
  118. package/dist/constants/colors.js +9 -4
  119. package/dist/constants/index.d.ts +3 -0
  120. package/dist/constants/index.js +3 -0
  121. package/dist/constants/progress.d.ts +56 -0
  122. package/dist/constants/progress.js +75 -0
  123. package/dist/constants/variants.d.ts +6 -2
  124. package/dist/constants/variants.js +2 -2
  125. package/dist/styles/glasslikeui.css +128 -1
  126. package/dist/styles/lens.css +21 -19
  127. package/dist/styles/squircle.css +17 -7
  128. package/package.json +1 -1
@@ -0,0 +1,457 @@
1
+ <script lang="ts">
2
+ import { untrack } from 'svelte';
3
+ import type { AlertAction } from '../../constants/alertAction';
4
+ import {
5
+ actionSheetDismissal,
6
+ actionSheetGroups,
7
+ initialFocusIndex,
8
+ warnAlertActions
9
+ } from '../../actions/alertLogic';
10
+ import { openModalDialog } from '../../actions/modalDialog';
11
+ import {
12
+ isCompactWidth,
13
+ placeAnchored,
14
+ playGrow,
15
+ revealOffset,
16
+ revealSide,
17
+ type AnchorSide
18
+ } from '../../actions/anchorPlacement';
19
+ import { prefersReducedMotion } from '../../actions/reducedMotion';
20
+
21
+ interface Props {
22
+ /** Whether the action sheet is on screen. Choosing an action, Escape or a tap outside sets it back to false. */
23
+ isOpen?: boolean;
24
+ /** Optional heading. It names the dialog when given. */
25
+ title?: string | undefined;
26
+ /** Optional text under the title, which also describes the dialog. */
27
+ message?: string | undefined;
28
+ /** The choices. A `cancel` action is drawn apart, and runs on Escape or a tap outside. */
29
+ actions: readonly AlertAction[];
30
+ /**
31
+ * The control that opened the sheet. On a regular width the sheet grows out
32
+ * of it, as iOS 26 does. Without one, or on a compact width, the sheet is
33
+ * centred on the page, with Cancel as its last button.
34
+ */
35
+ anchor?: HTMLElement | null | undefined;
36
+ /** The dialog's accessible name when there is no title. */
37
+ label?: string | undefined;
38
+ /** Runs after the sheet closes, whatever closed it. */
39
+ onClose?: (() => void) | undefined;
40
+ class?: string | undefined;
41
+ }
42
+
43
+ let {
44
+ isOpen = $bindable(false),
45
+ title,
46
+ message,
47
+ actions,
48
+ anchor = null,
49
+ label = 'Actions',
50
+ onClose,
51
+ class: className = ''
52
+ }: Props = $props();
53
+
54
+ const uid = $props.id();
55
+ const titleId = `${uid}-title`;
56
+ const messageId = `${uid}-message`;
57
+
58
+ const groups = $derived(actionSheetGroups(actions));
59
+
60
+ let viewportWidth = $state(typeof window === 'undefined' ? 0 : window.innerWidth);
61
+ const anchored = $derived(anchor !== null && !isCompactWidth(viewportWidth));
62
+
63
+ let dialogEl = $state<HTMLElement | undefined>();
64
+ const buttonEls: (HTMLButtonElement | undefined)[] = $state([]);
65
+
66
+ $effect(() => warnAlertActions('ActionSheet', actions));
67
+
68
+ function close() {
69
+ if (!isOpen) return;
70
+ isOpen = false;
71
+ onClose?.();
72
+ }
73
+
74
+ function choose(index: number) {
75
+ const action = actions[index];
76
+ if (!action || action.disabled || !isOpen) return;
77
+ isOpen = false;
78
+ action.onclick?.();
79
+ onClose?.();
80
+ }
81
+
82
+ /** Escape and a tap outside: see actionSheetDismissal. */
83
+ function cancel() {
84
+ const outcome = actionSheetDismissal(actions);
85
+ if (outcome === 'close') close();
86
+ else if (outcome !== null) choose(outcome);
87
+ }
88
+
89
+ function handleBackdropClick(event: MouseEvent) {
90
+ if (event.target === event.currentTarget) cancel();
91
+ }
92
+
93
+ /** The side of the anchor the open sheet took. It is kept until the sheet closes. */
94
+ let lockedSide: AnchorSide | undefined;
95
+
96
+ /**
97
+ * Room kept for the revealed Cancel's group borders, which the concealed
98
+ * group does not draw: 1.5px each at most, under increased contrast.
99
+ */
100
+ const REVEAL_BORDER_ALLOWANCE = 4;
101
+
102
+ /**
103
+ * Places an anchored sheet next to its anchor. The style is written straight
104
+ * to the element, not through state, so the grow that follows reads the
105
+ * final box. The side is chosen once, when the sheet opens. Where the hidden
106
+ * Cancel shows on focus is worked out here too, so focus never moves the
107
+ * sheet or its rows.
108
+ */
109
+ function measure() {
110
+ if (!dialogEl) return;
111
+ if (!anchor || !anchored) {
112
+ lockedSide = undefined;
113
+ dialogEl.style.removeProperty('top');
114
+ dialogEl.style.removeProperty('left');
115
+ dialogEl.style.removeProperty('--_reveal-top');
116
+ return;
117
+ }
118
+ const rtl = getComputedStyle(anchor).direction === 'rtl';
119
+ const viewport = { width: window.innerWidth, height: window.innerHeight };
120
+ const anchorRect = anchor.getBoundingClientRect();
121
+ const panel = { width: dialogEl.offsetWidth, height: dialogEl.offsetHeight };
122
+ const cancelButton = groups.cancel === null ? undefined : buttonEls[groups.cancel];
123
+ const revealHeight = cancelButton ? cancelButton.offsetHeight + REVEAL_BORDER_ALLOWANCE : 0;
124
+ // The side is chosen with room for Cancel on the far side, so the
125
+ // revealed Cancel does not cover the anchor when the viewport allows.
126
+ lockedSide ??= cancelButton ? revealSide(anchorRect, panel, revealHeight, viewport) : undefined;
127
+ const p = placeAnchored(anchorRect, panel, viewport, 'center', rtl, lockedSide);
128
+ lockedSide = p.side;
129
+ dialogEl.style.top = `${p.top}px`;
130
+ dialogEl.style.left = `${p.left}px`;
131
+ if (cancelButton) {
132
+ const offset = revealOffset(p.side, p.top, panel.height, revealHeight, viewport.height);
133
+ dialogEl.style.setProperty('--_reveal-top', `${offset}px`);
134
+ }
135
+ }
136
+
137
+ $effect(() => {
138
+ const dialog = dialogEl;
139
+ if (!dialog) return;
140
+ return untrack(() => {
141
+ lockedSide = undefined;
142
+ measure();
143
+ if (anchored && anchor) playGrow(dialog, anchor, prefersReducedMotion());
144
+ return openModalDialog(dialog, {
145
+ layer: dialog.parentElement,
146
+ initialFocus: () => {
147
+ const index = initialFocusIndex(actions, anchored);
148
+ return index === null ? null : (buttonEls[index] ?? null);
149
+ },
150
+ onEscape: cancel
151
+ });
152
+ });
153
+ });
154
+ </script>
155
+
156
+ <svelte:window onresize={() => ((viewportWidth = window.innerWidth), measure())} />
157
+
158
+ {#snippet actionButton(index: number)}
159
+ {@const action = actions[index]!}
160
+ <button
161
+ bind:this={buttonEls[index]}
162
+ type="button"
163
+ class="glass-action-sheet-button"
164
+ class:destructive={action.role === 'destructive'}
165
+ class:cancel={action.role === 'cancel'}
166
+ class:preferred={action.preferred}
167
+ disabled={action.disabled}
168
+ onclick={() => choose(index)}
169
+ >
170
+ {action.label}
171
+ </button>
172
+ {/snippet}
173
+
174
+ {#if isOpen}
175
+ <div
176
+ class="glass-action-sheet-backdrop"
177
+ class:anchored
178
+ role="presentation"
179
+ onclick={handleBackdropClick}
180
+ >
181
+ <div
182
+ bind:this={dialogEl}
183
+ class="glass-action-sheet {className}"
184
+ class:anchored
185
+ data-placement={anchored ? 'anchored' : 'centered'}
186
+ role="alertdialog"
187
+ aria-modal="true"
188
+ aria-labelledby={title ? titleId : undefined}
189
+ aria-label={title ? undefined : label}
190
+ aria-describedby={message ? messageId : undefined}
191
+ tabindex="-1"
192
+ >
193
+ <div class="glass-action-sheet-group">
194
+ {#if title || message}
195
+ <div class="glass-action-sheet-header">
196
+ {#if title}
197
+ <h2 class="glass-action-sheet-title" id={titleId}>{title}</h2>
198
+ {/if}
199
+ {#if message}
200
+ <p class="glass-action-sheet-message" id={messageId}>{message}</p>
201
+ {/if}
202
+ </div>
203
+ {/if}
204
+ {#each groups.main as index (index)}
205
+ {@render actionButton(index)}
206
+ {/each}
207
+ </div>
208
+ <!-- Centred, the group is laid out as part of the sheet's own panel, so
209
+ Cancel is its last capsule, as on iOS 26.
210
+ Anchored, iOS draws no Cancel button: a tap outside or Escape
211
+ cancels. The button is kept, hidden from sight, so screen reader
212
+ users (touch VoiceOver has no Escape) can still cancel, and it
213
+ shows while it has keyboard focus. It shows over the page beside
214
+ the sheet, out of the sheet's flow, so the sheet and its rows never
215
+ move under the pointer. -->
216
+ {#if groups.cancel !== null}
217
+ <div class="glass-action-sheet-group cancel-group" class:concealed={anchored}>
218
+ {@render actionButton(groups.cancel)}
219
+ </div>
220
+ {/if}
221
+ </div>
222
+ </div>
223
+ {/if}
224
+
225
+ <style>
226
+ .glass-action-sheet-backdrop {
227
+ position: fixed;
228
+ inset: 0;
229
+ z-index: 1100;
230
+ /* Reset the browser's popover box, for when the backdrop is shown in the
231
+ top layer (see topLayer.ts). z-index is the fallback elsewhere. */
232
+ margin: 0;
233
+ border: none;
234
+ width: auto;
235
+ height: auto;
236
+ max-width: none;
237
+ max-height: none;
238
+ overflow: visible;
239
+ color: inherit;
240
+ display: flex;
241
+ /* With no source, iOS 26 centres the action sheet (WWDC25 284). */
242
+ align-items: center;
243
+ justify-content: center;
244
+ padding: 16px;
245
+ box-sizing: border-box;
246
+ background: rgba(0, 0, 0, 0.4);
247
+ animation: glass-action-sheet-fade var(--glass-action-sheet-duration, 0.3s) ease-out;
248
+ }
249
+
250
+ /* Anchored, the page stays visible: iOS does not dim behind a popover. */
251
+ .glass-action-sheet-backdrop.anchored {
252
+ background: transparent;
253
+ }
254
+
255
+ .glass-action-sheet {
256
+ box-sizing: border-box;
257
+ width: min(320px, 100%);
258
+ max-height: calc(100vh - 32px);
259
+ overflow-y: auto;
260
+ display: flex;
261
+ flex-direction: column;
262
+ gap: 8px;
263
+ /* --glass-fg follows the tone of the backdrop behind the glass. */
264
+ color: var(--glass-fg, var(--color-text, var(--glass-text-color-default, #f5f5f7)));
265
+ font-family: var(--font-system);
266
+ outline: none;
267
+ animation: glass-action-sheet-pop var(--glass-action-sheet-duration, 0.3s) cubic-bezier(0.32, 0.72, 0, 1);
268
+ }
269
+
270
+ /* Centred, the sheet is one glass panel holding the header and every
271
+ capsule, Cancel last. A 48px capsule inset 16px makes the corners
272
+ concentric. */
273
+ .glass-action-sheet:not(.anchored) {
274
+ padding: 16px;
275
+ background: var(--glass-sheet-bg);
276
+ backdrop-filter: blur(var(--glass-blur-nav)) saturate(var(--glass-saturation));
277
+ -webkit-backdrop-filter: blur(var(--glass-blur-nav)) saturate(var(--glass-saturation));
278
+ border: var(--glass-border-width) solid var(--glass-border);
279
+ border-radius: var(--glass-action-sheet-radius, 40px);
280
+ box-shadow:
281
+ 0 24px 60px -12px var(--glass-shadow),
282
+ inset 0 1px 0 0 var(--glass-highlight);
283
+ }
284
+
285
+ .glass-action-sheet:not(.anchored) > .glass-action-sheet-group {
286
+ display: contents;
287
+ }
288
+
289
+ .glass-action-sheet.anchored {
290
+ position: fixed;
291
+ width: 280px;
292
+ /* The revealed Cancel is drawn outside the sheet's box, so the sheet
293
+ must not clip. Its action group scrolls instead. */
294
+ max-height: none;
295
+ overflow: visible;
296
+ /* playGrow animates the grow from the anchor. */
297
+ animation: none;
298
+ }
299
+
300
+ .glass-action-sheet-group {
301
+ display: flex;
302
+ flex-direction: column;
303
+ gap: 8px;
304
+ padding: 16px;
305
+ overflow: hidden;
306
+ background: var(--glass-sheet-bg);
307
+ backdrop-filter: blur(var(--glass-blur-nav)) saturate(var(--glass-saturation));
308
+ -webkit-backdrop-filter: blur(var(--glass-blur-nav)) saturate(var(--glass-saturation));
309
+ border: var(--glass-border-width) solid var(--glass-border);
310
+ border-radius: var(--glass-action-sheet-radius, 40px);
311
+ box-shadow:
312
+ 0 16px 48px -12px var(--glass-shadow),
313
+ inset 0 1px 0 0 var(--glass-highlight);
314
+ }
315
+
316
+ .glass-action-sheet.anchored > .glass-action-sheet-group:first-child {
317
+ max-height: calc(100vh - 16px);
318
+ overflow-y: auto;
319
+ }
320
+
321
+ /* With focus, drawn beside the sheet at the offset measure() worked out,
322
+ over the page and out of the sheet's flow. */
323
+ .cancel-group.concealed:focus-within {
324
+ position: absolute;
325
+ top: var(--_reveal-top, calc(100% + 8px));
326
+ left: 0;
327
+ right: 0;
328
+ /* Revealed, Cancel is a glass capsule of its own. */
329
+ padding: 0;
330
+ border-radius: var(--glass-radius-full);
331
+ }
332
+
333
+ /* Hidden from sight until it has focus, but still in the accessibility tree
334
+ and the Tab order. */
335
+ .cancel-group.concealed:not(:focus-within) {
336
+ position: absolute;
337
+ width: 1px;
338
+ height: 1px;
339
+ margin: -1px;
340
+ padding: 0;
341
+ overflow: hidden;
342
+ clip-path: inset(50%);
343
+ white-space: nowrap;
344
+ border: 0;
345
+ }
346
+
347
+ .glass-action-sheet-header {
348
+ display: flex;
349
+ flex-direction: column;
350
+ gap: 4px;
351
+ /* With the panel's 16px, the text sits 30px in, as on iOS 26. */
352
+ padding: 8px 14px;
353
+ text-align: start;
354
+ }
355
+
356
+ .glass-action-sheet-title {
357
+ margin: 0;
358
+ font-size: 17px;
359
+ font-weight: 600;
360
+ line-height: 1.3;
361
+ }
362
+
363
+ .glass-action-sheet-message {
364
+ margin: 0;
365
+ font-size: 15px;
366
+ line-height: 1.35;
367
+ /* Secondary, grey as on iOS, where the page or the glass tone sets it. */
368
+ color: var(--glass-fg-secondary, var(--color-text-secondary, var(--color-text, var(--glass-text-color-default, #f5f5f7))));
369
+ }
370
+
371
+ /* Each action is a full width capsule on the glass highlight, as in Alert.
372
+ iOS 26 tints the capsule darker in light, but that drops the destructive
373
+ label under 4.5:1, so the lighter highlight stays. */
374
+ .glass-action-sheet-button {
375
+ min-height: 48px;
376
+ padding: 12px 20px;
377
+ font: inherit;
378
+ font-size: 17px;
379
+ color: inherit;
380
+ background-color: var(--glass-highlight);
381
+ border: none;
382
+ border-radius: var(--glass-radius-full);
383
+ cursor: pointer;
384
+ transition: background var(--transition-fast);
385
+ --_danger-text: var(--color-danger-text, color-mix(in srgb, var(--color-danger) var(--glass-danger-text-strength, 30%), var(--glass-text-toward, white)));
386
+ }
387
+
388
+ .glass-action-sheet-button:hover:not(:disabled) {
389
+ background-image: linear-gradient(var(--glass-hover-bg), var(--glass-hover-bg));
390
+ }
391
+
392
+ .glass-action-sheet-button:active:not(:disabled) {
393
+ background-image: linear-gradient(var(--glass-active-bg), var(--glass-active-bg));
394
+ }
395
+
396
+ .glass-action-sheet-button.destructive {
397
+ color: var(--_danger-text);
398
+ }
399
+
400
+ /* iOS 26 sets Cancel in the regular weight. */
401
+ .glass-action-sheet-button.preferred {
402
+ font-weight: 600;
403
+ }
404
+
405
+ .glass-action-sheet-button:disabled {
406
+ cursor: default;
407
+ opacity: 0.45;
408
+ }
409
+
410
+ /* Shared focus ring, drawn inside, where it follows the capsule and the
411
+ revealed Cancel's group does not clip it. :where keeps it at
412
+ zero specificity, so a page's own focus rules win. */
413
+ :where(.glass-action-sheet-button:focus-visible) {
414
+ outline: var(--glass-focus-ring-width, 2px) solid var(--glass-focus-ring-color, var(--glass-focus-ring-color-default, #9ecbff));
415
+ outline-offset: calc(-1 * var(--glass-focus-ring-width, 2px));
416
+ box-shadow: inset 0 0 0 calc(2 * var(--glass-focus-ring-width, 2px)) var(--glass-focus-ring-halo-color, var(--glass-focus-ring-halo-color-default, #000000));
417
+ }
418
+
419
+ /* Forced colours drop the capsule fill, so a border keeps each action's
420
+ edge. */
421
+ @media (forced-colors: active) {
422
+ .glass-action-sheet-button {
423
+ border: 1px solid ButtonText;
424
+ }
425
+ }
426
+
427
+ @keyframes glass-action-sheet-pop {
428
+ from {
429
+ opacity: 0;
430
+ transform: scale(1.12);
431
+ }
432
+ to {
433
+ opacity: 1;
434
+ transform: scale(1);
435
+ }
436
+ }
437
+
438
+ @keyframes glass-action-sheet-fade {
439
+ from {
440
+ opacity: 0;
441
+ }
442
+ to {
443
+ opacity: 1;
444
+ }
445
+ }
446
+
447
+ /* Reduced motion: the sheet fades in where it ends up, with no scale. */
448
+ @media (prefers-reduced-motion: reduce) {
449
+ .glass-action-sheet:not(.anchored) {
450
+ animation-name: glass-action-sheet-fade;
451
+ }
452
+ }
453
+
454
+ :global([data-reduced-motion='true']) .glass-action-sheet:not(.anchored) {
455
+ animation-name: glass-action-sheet-fade;
456
+ }
457
+ </style>
@@ -0,0 +1,25 @@
1
+ import type { AlertAction } from '../../constants/alertAction';
2
+ interface Props {
3
+ /** Whether the action sheet is on screen. Choosing an action, Escape or a tap outside sets it back to false. */
4
+ isOpen?: boolean;
5
+ /** Optional heading. It names the dialog when given. */
6
+ title?: string | undefined;
7
+ /** Optional text under the title, which also describes the dialog. */
8
+ message?: string | undefined;
9
+ /** The choices. A `cancel` action is drawn apart, and runs on Escape or a tap outside. */
10
+ actions: readonly AlertAction[];
11
+ /**
12
+ * The control that opened the sheet. On a regular width the sheet grows out
13
+ * of it, as iOS 26 does. Without one, or on a compact width, the sheet is
14
+ * centred on the page, with Cancel as its last button.
15
+ */
16
+ anchor?: HTMLElement | null | undefined;
17
+ /** The dialog's accessible name when there is no title. */
18
+ label?: string | undefined;
19
+ /** Runs after the sheet closes, whatever closed it. */
20
+ onClose?: (() => void) | undefined;
21
+ class?: string | undefined;
22
+ }
23
+ declare const ActionSheet: import("svelte").Component<Props, {}, string>;
24
+ type ActionSheet = ReturnType<typeof ActionSheet>;
25
+ export default ActionSheet;