glasslikeui 1.9.0 → 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 +892 -24
  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 +43 -0
  33. package/dist/actions/sheetLogic.js +71 -0
  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 +470 -103
  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 +162 -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 +135 -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,56 @@
1
+ /**
2
+ * ProgressView, mirroring SwiftUI's `ProgressView`.
3
+ *
4
+ * A value makes it determinate; no value makes it indeterminate. The
5
+ * `automatic` style follows iOS: a determinate view is a linear bar, an
6
+ * indeterminate one a spinner. `linear` and `circular` force the shape either
7
+ * way, so all four combinations exist.
8
+ */
9
+ export declare const PROGRESS_VIEW_STYLES: readonly ["automatic", "linear", "circular"];
10
+ export type ProgressViewStyle = (typeof PROGRESS_VIEW_STYLES)[number];
11
+ /** The shape actually drawn, once `automatic` is resolved. */
12
+ export type ResolvedProgressStyle = Exclude<ProgressViewStyle, 'automatic'>;
13
+ export declare const DEFAULT_PROGRESS_VIEW_STYLE: ProgressViewStyle;
14
+ /** Accessible name used when a ProgressView is given no label of any kind. */
15
+ export declare const DEFAULT_PROGRESS_LABEL = "Loading";
16
+ /** Control sizes, as SwiftUI's `controlSize`. */
17
+ export declare const PROGRESS_SIZES: readonly ["sm", "md", "lg"];
18
+ export type ProgressSize = (typeof PROGRESS_SIZES)[number];
19
+ /**
20
+ * Pixel sizes per control size: the spinner or ring diameter and the linear
21
+ * track thickness. md matches the iOS medium activity indicator (20pt), lg
22
+ * the large one (37pt).
23
+ */
24
+ export declare const PROGRESS_SIZE_PX: Record<ProgressSize, {
25
+ diameter: number;
26
+ track: number;
27
+ }>;
28
+ /** Spokes in the indeterminate spinner, as in the iOS activity indicator. */
29
+ export declare const SPINNER_SPOKES = 8;
30
+ /** Whether a value makes the view determinate: any finite number does. */
31
+ export declare function isDeterminate(value: number | null | undefined): value is number;
32
+ /** A usable total: a positive finite number, otherwise 1 (SwiftUI's default). */
33
+ export declare function progressTotal(total: number | null | undefined): number;
34
+ /** The completed share, 0 to 1, or null while indeterminate. */
35
+ export declare function progressFraction(value: number | null | undefined, total: number | null | undefined): number | null;
36
+ export declare function resolveProgressStyle(style: ProgressViewStyle, determinate: boolean): ResolvedProgressStyle;
37
+ export interface ProgressAria {
38
+ 'aria-valuemin'?: number;
39
+ 'aria-valuemax'?: number;
40
+ 'aria-valuenow'?: number;
41
+ 'aria-valuetext'?: string;
42
+ 'aria-busy'?: 'true';
43
+ }
44
+ /**
45
+ * The progressbar attributes. Determinate: the range and the current value,
46
+ * clamped into it. Indeterminate: no value at all (as the ARIA spec asks) and
47
+ * aria-busy.
48
+ */
49
+ export declare function progressAria(value: number | null | undefined, total: number | null | undefined, valueText?: string | null): ProgressAria;
50
+ /** Stroke dash values for a determinate ring of radius `radius`. */
51
+ export declare function ringDash(fraction: number, radius: number): {
52
+ length: number;
53
+ offset: number;
54
+ };
55
+ /** Opacity of each spinner spoke, brightest first, fading round the ring. */
56
+ export declare function spinnerSpokeOpacities(count?: number): number[];
@@ -0,0 +1,75 @@
1
+ /**
2
+ * ProgressView, mirroring SwiftUI's `ProgressView`.
3
+ *
4
+ * A value makes it determinate; no value makes it indeterminate. The
5
+ * `automatic` style follows iOS: a determinate view is a linear bar, an
6
+ * indeterminate one a spinner. `linear` and `circular` force the shape either
7
+ * way, so all four combinations exist.
8
+ */
9
+ export var PROGRESS_VIEW_STYLES = ['automatic', 'linear', 'circular'];
10
+ export var DEFAULT_PROGRESS_VIEW_STYLE = 'automatic';
11
+ /** Accessible name used when a ProgressView is given no label of any kind. */
12
+ export var DEFAULT_PROGRESS_LABEL = 'Loading';
13
+ /** Control sizes, as SwiftUI's `controlSize`. */
14
+ export var PROGRESS_SIZES = ['sm', 'md', 'lg'];
15
+ /**
16
+ * Pixel sizes per control size: the spinner or ring diameter and the linear
17
+ * track thickness. md matches the iOS medium activity indicator (20pt), lg
18
+ * the large one (37pt).
19
+ */
20
+ export var PROGRESS_SIZE_PX = {
21
+ sm: { diameter: 16, track: 3 },
22
+ md: { diameter: 20, track: 4 },
23
+ lg: { diameter: 37, track: 6 }
24
+ };
25
+ /** Spokes in the indeterminate spinner, as in the iOS activity indicator. */
26
+ export var SPINNER_SPOKES = 8;
27
+ /** Whether a value makes the view determinate: any finite number does. */
28
+ export function isDeterminate(value) {
29
+ // Number.isFinite, not the global isFinite: it rejects strings outright.
30
+ return Number.isFinite(value);
31
+ }
32
+ /** A usable total: a positive finite number, otherwise 1 (SwiftUI's default). */
33
+ export function progressTotal(total) {
34
+ return Number.isFinite(total) && total > 0 ? total : 1;
35
+ }
36
+ /** The completed share, 0 to 1, or null while indeterminate. */
37
+ export function progressFraction(value, total) {
38
+ if (!isDeterminate(value))
39
+ return null;
40
+ var fraction = value / progressTotal(total);
41
+ return Math.min(1, Math.max(0, fraction));
42
+ }
43
+ export function resolveProgressStyle(style, determinate) {
44
+ if (style === 'linear' || style === 'circular')
45
+ return style;
46
+ return determinate ? 'linear' : 'circular';
47
+ }
48
+ /**
49
+ * The progressbar attributes. Determinate: the range and the current value,
50
+ * clamped into it. Indeterminate: no value at all (as the ARIA spec asks) and
51
+ * aria-busy.
52
+ */
53
+ export function progressAria(value, total, valueText) {
54
+ if (!isDeterminate(value))
55
+ return { 'aria-busy': 'true' };
56
+ var max = progressTotal(total);
57
+ var aria = {
58
+ 'aria-valuemin': 0,
59
+ 'aria-valuemax': max,
60
+ 'aria-valuenow': Math.min(max, Math.max(0, value))
61
+ };
62
+ if (valueText)
63
+ aria['aria-valuetext'] = valueText;
64
+ return aria;
65
+ }
66
+ /** Stroke dash values for a determinate ring of radius `radius`. */
67
+ export function ringDash(fraction, radius) {
68
+ var length = 2 * Math.PI * radius;
69
+ return { length: length, offset: length * (1 - fraction) };
70
+ }
71
+ /** Opacity of each spinner spoke, brightest first, fading round the ring. */
72
+ export function spinnerSpokeOpacities(count) {
73
+ if (count === void 0) { count = SPINNER_SPOKES; }
74
+ return Array.from({ length: count }, function (_, i) { return 1 - (i * 0.75) / count; });
75
+ }
@@ -2,13 +2,17 @@
2
2
  * Glass variant + intensity design tokens.
3
3
  *
4
4
  * Two-axis model:
5
- * variant — regular or clear
6
- * intensity — subtle, standard, or prominent (modulates blur/displacement/saturation)
5
+ * variant: regular or clear
6
+ * intensity: subtle, standard, or prominent (modulates blur and saturation)
7
7
  */
8
8
  export type GlassVariant = 'regular' | 'clear';
9
9
  export type GlassIntensity = 'subtle' | 'standard' | 'prominent';
10
10
  export interface IntensityConfig {
11
11
  blur: number;
12
+ /**
13
+ * @deprecated Glass no longer displaces its edge, so nothing reads this.
14
+ * It will be removed in the next major version.
15
+ */
12
16
  displacementScale: number;
13
17
  saturation: number;
14
18
  }
@@ -2,8 +2,8 @@
2
2
  * Glass variant + intensity design tokens.
3
3
  *
4
4
  * Two-axis model:
5
- * variant — regular or clear
6
- * intensity — subtle, standard, or prominent (modulates blur/displacement/saturation)
5
+ * variant: regular or clear
6
+ * intensity: subtle, standard, or prominent (modulates blur and saturation)
7
7
  */
8
8
  export var INTENSITY_CONFIG = {
9
9
  subtle: { blur: 10, displacementScale: 4, saturation: 1.4 },
@@ -1,6 +1,6 @@
1
1
  /* GlassLikeUI v1 design tokens.
2
2
  * Import in your global styles. Mount <LensFilters /> once at app root
3
- * for SVG filter defs.
3
+ * for the .glass-squircle clip path.
4
4
  */
5
5
 
6
6
  :root {
@@ -15,6 +15,7 @@
15
15
 
16
16
  /* Core effect parameters (intensity-driven) */
17
17
  --glass-blur: 20px;
18
+ /* Deprecated: nothing reads it. */
18
19
  --glass-displacement-scale: 8;
19
20
  --glass-saturation: 1.8;
20
21
 
@@ -23,6 +24,7 @@
23
24
  --glass-border-width: 0.5px;
24
25
  --glass-highlight: rgba(255, 255, 255, 0.08);
25
26
  --glass-shadow: rgba(0, 0, 0, 0.5);
27
+ /* Deprecated: the library no longer uses it. */
26
28
  --glass-shadow-inner: rgba(0, 0, 0, 0.2);
27
29
  --glass-divider: rgba(255, 255, 255, 0.08);
28
30
  --glass-handle: rgba(255, 255, 255, 0.3);
@@ -65,6 +67,15 @@
65
67
  --sheet-focus-ring-inner: #ffffff;
66
68
  --sheet-focus-ring-outer: #3b8eea;
67
69
 
70
+ /* Text where the page sets no --color-text, such as the Sheet title. The
71
+ library leaves --color-text to the page; this is the colour used until
72
+ then. */
73
+ --glass-text-color-default: #f5f5f7;
74
+
75
+ /* Fill for the GlassSection title and Text with gradient. Every stop holds
76
+ 4.5:1 on the theme's page colours. */
77
+ --glass-text-gradient: linear-gradient(180deg, #ffffff 0%, #c7c7cc 100%);
78
+
68
79
  /* ========================================
69
80
  Accent system
70
81
  ======================================== */
@@ -160,6 +171,125 @@
160
171
  --color-danger-active: color-mix(in srgb, var(--color-danger) 85%, black);
161
172
  }
162
173
 
174
+ /* ========================================
175
+ Adaptive tone: text on glass that follows the backdrop
176
+ The adaptiveTone action, which every Glass runs, marks a surface
177
+ data-glass-tone="light" over a light backdrop and "dark" over a dark one.
178
+ These rules turn that into --glass-fg, --glass-fg-secondary and
179
+ --glass-fg-accent, which text on glass reads with the theme colour as the
180
+ fallback:
181
+ color: var(--glass-fg, var(--color-text));
182
+ Black and white are the widest contrast there is: one of them holds 4.5:1
183
+ over any plain backdrop. Secondary text is the primary colour at 60%, as on
184
+ iOS, and the action raises that to 80% or 100% when the backdrop nears the
185
+ middle (data-glass-tone-secondary), so it holds 4.5:1 too. Accent text keeps
186
+ as much of the accent as still holds 4.5:1 (data-glass-tone-accent).
187
+ ======================================== */
188
+
189
+ /* A surface with its own fill and no tone of its own starts afresh, so it does
190
+ not take the tone of the glass it sits in: an untoned Glass, glass and filled
191
+ buttons, whose fill holds the theme label over any backdrop, and the menus,
192
+ lists, popovers, tooltips and dialogs that float above the page. */
193
+ :where(
194
+ .glass-surface,
195
+ .button.is-glass,
196
+ .button.variant-filled,
197
+ .button.variant-destructive,
198
+ .icon-button.is-glass,
199
+ .icon-button.variant-filled,
200
+ [popover],
201
+ [role='dialog'],
202
+ [role='alertdialog'],
203
+ [role='menu'],
204
+ [role='listbox'],
205
+ [role='tooltip']
206
+ ) {
207
+ --glass-fg: initial;
208
+ --glass-fg-secondary: initial;
209
+ --glass-fg-accent: initial;
210
+ --glass-tone-active-bg: initial;
211
+ }
212
+
213
+ /* The tone. :where keeps it at zero specificity, so a page's own --glass-fg
214
+ wins. It comes after the reset, so a toned menu or dialog keeps its tone.
215
+ The accent defaults are for a tone set by hand, which nothing measures. */
216
+ :where([data-glass-tone='light']) {
217
+ --glass-fg: #000000;
218
+ --glass-fg-secondary: color-mix(in srgb, #000000 60%, transparent);
219
+ --glass-fg-accent: color-mix(in srgb, var(--color-accent) 75%, #000000);
220
+ }
221
+ :where([data-glass-tone='dark']) {
222
+ --glass-fg: #ffffff;
223
+ --glass-fg-secondary: color-mix(in srgb, #ffffff 60%, transparent);
224
+ --glass-fg-accent: color-mix(in srgb, var(--color-accent) 25%, #ffffff);
225
+ }
226
+ :where([data-glass-tone='light'][data-glass-tone-secondary='80']) {
227
+ --glass-fg-secondary: color-mix(in srgb, #000000 80%, transparent);
228
+ }
229
+ :where([data-glass-tone='dark'][data-glass-tone-secondary='80']) {
230
+ --glass-fg-secondary: color-mix(in srgb, #ffffff 80%, transparent);
231
+ }
232
+ :where([data-glass-tone][data-glass-tone-secondary='100']) {
233
+ --glass-fg-secondary: var(--glass-fg);
234
+ }
235
+ :where([data-glass-tone='light'][data-glass-tone-accent='100']) {
236
+ --glass-fg-accent: var(--color-accent);
237
+ }
238
+ :where([data-glass-tone='light'][data-glass-tone-accent='75']) {
239
+ --glass-fg-accent: color-mix(in srgb, var(--color-accent) 75%, #000000);
240
+ }
241
+ :where([data-glass-tone='light'][data-glass-tone-accent='50']) {
242
+ --glass-fg-accent: color-mix(in srgb, var(--color-accent) 50%, #000000);
243
+ }
244
+ :where([data-glass-tone='light'][data-glass-tone-accent='25']) {
245
+ --glass-fg-accent: color-mix(in srgb, var(--color-accent) 25%, #000000);
246
+ }
247
+ :where([data-glass-tone='light'][data-glass-tone-accent='0']) {
248
+ --glass-fg-accent: var(--glass-fg);
249
+ }
250
+ :where([data-glass-tone='dark'][data-glass-tone-accent='100']) {
251
+ --glass-fg-accent: var(--color-accent);
252
+ }
253
+ :where([data-glass-tone='dark'][data-glass-tone-accent='75']) {
254
+ --glass-fg-accent: color-mix(in srgb, var(--color-accent) 75%, #ffffff);
255
+ }
256
+ :where([data-glass-tone='dark'][data-glass-tone-accent='50']) {
257
+ --glass-fg-accent: color-mix(in srgb, var(--color-accent) 50%, #ffffff);
258
+ }
259
+ :where([data-glass-tone='dark'][data-glass-tone-accent='25']) {
260
+ --glass-fg-accent: color-mix(in srgb, var(--color-accent) 25%, #ffffff);
261
+ }
262
+ :where([data-glass-tone='dark'][data-glass-tone-accent='0']) {
263
+ --glass-fg-accent: var(--glass-fg);
264
+ }
265
+
266
+ /* Where no accent holds 4.5:1, the selected label is black or white, and the
267
+ selection pill under it leans the other way, so the label stands out from
268
+ the pill too. Read by the TabView indicator. */
269
+ :where([data-glass-tone='light'][data-glass-tone-accent='0']) {
270
+ --glass-tone-active-bg: rgba(255, 255, 255, 0.4);
271
+ }
272
+ :where([data-glass-tone='dark'][data-glass-tone-accent='0']) {
273
+ --glass-tone-active-bg: rgba(0, 0, 0, 0.3);
274
+ }
275
+
276
+ /* The first tone is written before the first paint, after the theme colours
277
+ were already worked out. Until the next frame nothing on the surface
278
+ transitions, so the text does not fade in from the theme colour. */
279
+ :where([data-glass-tone]:not([data-glass-tone-ready])),
280
+ :where([data-glass-tone]:not([data-glass-tone-ready])) * {
281
+ transition: none !important;
282
+ }
283
+
284
+ /* Forced colours: the system's text colour, whatever the tone. */
285
+ @media (forced-colors: active) {
286
+ :where([data-glass-tone]) {
287
+ --glass-fg: CanvasText;
288
+ --glass-fg-secondary: CanvasText;
289
+ --glass-fg-accent: LinkText;
290
+ }
291
+ }
292
+
163
293
  /* ========================================
164
294
  Light mode overrides
165
295
  ======================================== */
@@ -196,6 +326,10 @@
196
326
 
197
327
  --sheet-focus-ring-inner: #000000;
198
328
  --sheet-focus-ring-outer: #0071e3;
329
+
330
+ --glass-text-color-default: #1d1d1f;
331
+
332
+ --glass-text-gradient: linear-gradient(180deg, #1d1d1f 0%, #48484a 100%);
199
333
  }
200
334
 
201
335
  /* ========================================
@@ -1,11 +1,16 @@
1
1
  /* Glass lens layer.
2
- * Pseudo-element strategy: ::before captures backdrop via backdrop-filter,
3
- * then an SVG filter displaces those pixels to produce edge refraction.
4
- * Requires <LensFilters /> mounted once for the SVG defs.
2
+ * Pseudo-element strategy: ::before blurs the backdrop with backdrop-filter,
3
+ * and ::after draws the lens rim and sheen. Nothing displaces the shape.
4
+ * Keep opacity, filter, clip-path, mask and non-normal blends off the
5
+ * surface: any of them stops the blur reaching the page.
5
6
  */
6
7
 
7
- .glass-surface {
8
+ /* Zero specificity, so a class on the surface can place it. */
9
+ :where(.glass-surface) {
8
10
  position: relative;
11
+ }
12
+
13
+ .glass-surface {
9
14
  isolation: isolate;
10
15
  background: var(--glass-surface-bg);
11
16
  border-radius: var(--glass-radius, var(--glass-radius-lg));
@@ -24,10 +29,6 @@
24
29
  pointer-events: none;
25
30
  }
26
31
 
27
- .glass-surface.has-lensing::before {
28
- filter: url(#glass-lens-refract);
29
- }
30
-
31
32
  .glass-surface::after {
32
33
  content: '';
33
34
  position: absolute;
@@ -36,17 +37,22 @@
36
37
  border-radius: inherit;
37
38
  pointer-events: none;
38
39
  border: var(--glass-border-width) solid var(--glass-border);
40
+ /* The lens rim: a thin specular line and a soft glow inside every edge,
41
+ the same on all four sides. No filter displaces the shape, so the
42
+ silhouette stays crisp, as iOS 26 glass does. */
39
43
  box-shadow:
40
- inset 0 1px 0 0 var(--glass-highlight),
41
- inset 0 -1px 0 0 var(--glass-shadow-inner);
44
+ inset 0 0 0 0.5px var(--glass-highlight),
45
+ inset 0 0 10px 0 rgba(255, 255, 255, 0.06);
42
46
  background: linear-gradient(
43
47
  var(--glass-highlight-angle),
44
- rgba(255, 255, 255, calc(0.08 * var(--glass-motion-enabled))) 0%,
48
+ rgba(255, 255, 255, calc(0.05 * var(--glass-motion-enabled))) 0%,
45
49
  transparent 40%,
46
50
  transparent 60%,
47
- rgba(0, 0, 0, calc(0.04 * var(--glass-motion-enabled))) 100%
51
+ rgba(0, 0, 0, calc(0.03 * var(--glass-motion-enabled))) 100%
48
52
  );
49
- mix-blend-mode: overlay;
53
+ /* Normal blending. An overlay blend here made Chromium treat the surface as
54
+ its own backdrop root, so the backdrop layer blurred only the surface's
55
+ fill: no blur of the page, and the fill painted twice. */
50
56
  }
51
57
 
52
58
  .glass-content {
@@ -134,12 +140,10 @@
134
140
  backdrop-filter: none;
135
141
  -webkit-backdrop-filter: none;
136
142
  }
137
- .glass-surface.has-lensing::before {
138
- filter: none;
139
- }
140
143
  .glass-surface::after {
141
144
  background: none;
142
145
  mix-blend-mode: normal;
146
+ box-shadow: inset 0 0 0 0.5px var(--glass-highlight);
143
147
  }
144
148
  }
145
149
  :where([data-reduced-transparency='true']) .glass-surface::before {
@@ -149,12 +153,10 @@
149
153
  backdrop-filter: none;
150
154
  -webkit-backdrop-filter: none;
151
155
  }
152
- :where([data-reduced-transparency='true']) .glass-surface.has-lensing::before {
153
- filter: none;
154
- }
155
156
  :where([data-reduced-transparency='true']) .glass-surface::after {
156
157
  background: none;
157
158
  mix-blend-mode: normal;
159
+ box-shadow: inset 0 0 0 0.5px var(--glass-highlight);
158
160
  }
159
161
 
160
162
  .glass-dim-layer {
@@ -1,17 +1,27 @@
1
1
  /* Squircle corner utility.
2
- * Uses clip-path with a normalized (objectBoundingBox) path so the shape
3
- * scales correctly with element dimensions. Apply .glass-squircle to any
4
- * element that should have continuous-curve corners instead of circular.
5
- * Falls back to CSS border-radius where the clip-path is unsupported.
2
+ * Apply .glass-squircle to any element that should have continuous-curve
3
+ * corners instead of circular ones. Where corner-shape is supported it sets
4
+ * a superellipse, and carries it to ::before and ::after, so a glass rim and
5
+ * backdrop follow the same curve as the surface.
6
+ * Elsewhere (Firefox) it clips the element with the normalized
7
+ * (objectBoundingBox) path from LensFilters, except a glass surface. A
8
+ * clip-path on a glass surface makes it the backdrop root of its own blur
9
+ * layer, so the blur would see only the surface's fill and never the page.
10
+ * A glass surface keeps its border-radius there instead.
6
11
  */
7
12
 
8
- .glass-squircle {
9
- clip-path: url(#glass-squircle-path);
13
+ @supports not (corner-shape: superellipse(2)) {
14
+ .glass-squircle:where(:not(.glass-surface)) {
15
+ clip-path: url(#glass-squircle-path);
16
+ }
10
17
  }
11
18
 
12
19
  @supports (corner-shape: superellipse(2)) {
13
20
  .glass-squircle {
14
- clip-path: none;
15
21
  corner-shape: superellipse(2.5);
16
22
  }
23
+ .glass-squircle::before,
24
+ .glass-squircle::after {
25
+ corner-shape: inherit;
26
+ }
17
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glasslikeui",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "description": "Svelte component library with frosted glass materials",
5
5
  "license": "MPL-2.0",
6
6
  "type": "module",