@glass-sdk/liquid-glass 0.0.2 → 0.0.3-beta.1

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 (146) hide show
  1. package/CHANGELOG.md +124 -0
  2. package/README.md +66 -149
  3. package/dist/core/concentric.js +20 -3
  4. package/dist/core/corner-options.js +12 -0
  5. package/dist/core/corner-path.js +118 -0
  6. package/dist/core/materials.js +264 -32
  7. package/dist/core/optics.js +1 -2
  8. package/dist/core/progressive.js +1 -2
  9. package/dist/core/shape.js +18 -28
  10. package/dist/core/spring.js +5 -10
  11. package/dist/core.js +5 -6
  12. package/dist/dom/backdrop-glass.js +46 -0
  13. package/dist/dom/compose-layers.js +42 -31
  14. package/dist/dom/composited.js +136 -0
  15. package/dist/dom/control-motion.js +58 -47
  16. package/dist/dom/engine.js +1 -2
  17. package/dist/dom/escaped-layers.js +179 -0
  18. package/dist/dom/filter-bounds.js +42 -13
  19. package/dist/dom/filter-budget.js +1 -2
  20. package/dist/dom/filter-chain.js +40 -0
  21. package/dist/dom/filter-groups.js +33 -14
  22. package/dist/dom/filter-paint-root.js +8 -6
  23. package/dist/dom/filter-patch.js +94 -55
  24. package/dist/dom/filter-reach.js +32 -19
  25. package/dist/dom/filter-stages.js +1 -2
  26. package/dist/dom/fixed-shape.js +23 -16
  27. package/dist/dom/foreground.js +16 -17
  28. package/dist/dom/interaction.js +65 -92
  29. package/dist/dom/layout-rect.js +42 -0
  30. package/dist/dom/layout-size.js +28 -0
  31. package/dist/dom/lens-layers.js +250 -136
  32. package/dist/dom/map-encoder.js +16 -13
  33. package/dist/dom/map-encoder.worker.js +2 -3
  34. package/dist/dom/map-encoding.js +49 -12
  35. package/dist/dom/map-image.js +29 -7
  36. package/dist/dom/map-store.js +1 -2
  37. package/dist/dom/maps.js +133 -83
  38. package/dist/dom/material-graph.js +108 -29
  39. package/dist/dom/media-mirror.js +244 -0
  40. package/dist/dom/page-zoom.js +19 -18
  41. package/dist/dom/png.js +1 -2
  42. package/dist/dom/progressive.js +152 -147
  43. package/dist/dom/renderer.js +1 -2
  44. package/dist/dom/sampling-bounds.js +1 -2
  45. package/dist/dom/selection.js +133 -79
  46. package/dist/dom/shape-attributes.js +9 -0
  47. package/dist/dom/shape-effects.js +14 -0
  48. package/dist/dom/shape-geometry.js +3 -0
  49. package/dist/dom/shape-layout.js +115 -116
  50. package/dist/dom/shared-backdrop.js +33 -25
  51. package/dist/dom/specular.js +116 -0
  52. package/dist/dom/ticker.js +28 -19
  53. package/dist/dom/tint-color.js +24 -0
  54. package/dist/dom/warm.js +63 -59
  55. package/dist/dom.js +591 -505
  56. package/dist/gpu/geometry.js +2 -3
  57. package/dist/gpu/maps.js +1109 -7
  58. package/dist/gpu/planes.js +2 -3
  59. package/dist/gpu.js +66 -64
  60. package/dist/index.js +12 -10
  61. package/dist/react/button.js +12 -11
  62. package/dist/react/color-picker.js +199 -0
  63. package/dist/react/control-thumb.js +4 -5
  64. package/dist/react/menu.js +82 -111
  65. package/dist/react/merged-ref.js +1 -2
  66. package/dist/react/progressive.js +1 -2
  67. package/dist/react/scene.js +71 -55
  68. package/dist/react/shape.js +67 -47
  69. package/dist/react/slider.js +81 -0
  70. package/dist/react/surface.js +90 -56
  71. package/dist/react/switch.js +101 -0
  72. package/dist/react/tabs.js +85 -63
  73. package/dist/react/toolbar.js +38 -123
  74. package/dist/react/value-control-motion.js +1 -2
  75. package/dist/styles.css +517 -111
  76. package/dist/types/core/concentric.d.ts +8 -0
  77. package/dist/types/core/corner-options.d.ts +4 -0
  78. package/dist/types/core/corner-path.d.ts +8 -0
  79. package/dist/types/core/index.d.ts +3 -5
  80. package/dist/types/core/materials.d.ts +100 -28
  81. package/dist/types/core/shape.d.ts +4 -6
  82. package/dist/types/core/spring.d.ts +8 -12
  83. package/dist/types/dom/backdrop-glass.d.ts +38 -0
  84. package/dist/types/dom/compose-layers.d.ts +4 -0
  85. package/dist/types/dom/composited.d.ts +61 -0
  86. package/dist/types/dom/escaped-layers.d.ts +32 -0
  87. package/dist/types/dom/filter-bounds.d.ts +4 -0
  88. package/dist/types/dom/filter-chain.d.ts +6 -0
  89. package/dist/types/dom/filter-groups.d.ts +1 -1
  90. package/dist/types/dom/filter-paint-root.d.ts +3 -0
  91. package/dist/types/dom/filter-patch.d.ts +5 -0
  92. package/dist/types/dom/filter-reach.d.ts +9 -9
  93. package/dist/types/dom/foreground.d.ts +2 -1
  94. package/dist/types/dom/index.d.ts +8 -19
  95. package/dist/types/dom/interaction.d.ts +8 -8
  96. package/dist/types/dom/layout-rect.d.ts +17 -0
  97. package/dist/types/dom/layout-size.d.ts +11 -0
  98. package/dist/types/dom/lens-layers.d.ts +18 -10
  99. package/dist/types/dom/map-encoder.d.ts +5 -2
  100. package/dist/types/dom/map-encoding.d.ts +12 -3
  101. package/dist/types/dom/map-image.d.ts +7 -1
  102. package/dist/types/dom/maps.d.ts +25 -7
  103. package/dist/types/dom/material-graph.d.ts +73 -10
  104. package/dist/types/dom/media-mirror.d.ts +49 -0
  105. package/dist/types/dom/progressive.d.ts +2 -5
  106. package/dist/types/dom/sampling-bounds.d.ts +1 -3
  107. package/dist/types/dom/selection.d.ts +29 -4
  108. package/dist/types/dom/shape-attributes.d.ts +6 -0
  109. package/dist/types/dom/shape-effects.d.ts +10 -0
  110. package/dist/types/dom/shape-geometry.d.ts +6 -0
  111. package/dist/types/dom/shape-layout.d.ts +2 -4
  112. package/dist/types/dom/shared-backdrop.d.ts +7 -3
  113. package/dist/types/dom/specular.d.ts +50 -0
  114. package/dist/types/dom/ticker.d.ts +4 -1
  115. package/dist/types/dom/tint-color.d.ts +11 -0
  116. package/dist/types/dom/warm.d.ts +8 -2
  117. package/dist/types/gpu/geometry.d.ts +2 -0
  118. package/dist/types/gpu/planes.d.ts +3 -2
  119. package/dist/types/index.d.ts +1 -1
  120. package/dist/types/react/button.d.ts +1 -1
  121. package/dist/types/react/color-picker.d.ts +26 -0
  122. package/dist/types/react/index.d.ts +14 -10
  123. package/dist/types/react/menu.d.ts +4 -5
  124. package/dist/types/react/progressive.d.ts +1 -1
  125. package/dist/types/react/scene.d.ts +4 -2
  126. package/dist/types/react/shape.d.ts +11 -1
  127. package/dist/types/react/slider.d.ts +14 -0
  128. package/dist/types/react/surface.d.ts +11 -22
  129. package/dist/types/react/switch.d.ts +9 -0
  130. package/dist/types/react/tabs.d.ts +3 -3
  131. package/dist/types/react/toolbar.d.ts +1 -1
  132. package/package.json +46 -40
  133. package/dist/core/morph-path.js +0 -206
  134. package/dist/core/union.js +0 -117
  135. package/dist/dom/compound-field.js +0 -23
  136. package/dist/dom/exit-handoff.js +0 -14
  137. package/dist/dom/map-blend.js +0 -8
  138. package/dist/dom/morph.js +0 -296
  139. package/dist/react/value-controls.js +0 -176
  140. package/dist/types/core/morph-path.d.ts +0 -110
  141. package/dist/types/core/union.d.ts +0 -20
  142. package/dist/types/dom/compound-field.d.ts +0 -35
  143. package/dist/types/dom/exit-handoff.d.ts +0 -7
  144. package/dist/types/dom/map-blend.d.ts +0 -22
  145. package/dist/types/dom/morph.d.ts +0 -78
  146. package/dist/types/react/value-controls.d.ts +0 -20
package/dist/styles.css CHANGED
@@ -1,3 +1,11 @@
1
+ /* What glass treats as behind it wherever the scene's content is
2
+ transparent: its frost, tone and refraction show this color there. Set it
3
+ on a scene or any ancestor. Transparent, the default, adds nothing. */
4
+ @property --lg-backdrop {
5
+ syntax: "<color>";
6
+ inherits: true;
7
+ initial-value: transparent;
8
+ }
1
9
  :where(.lg-scene) {
2
10
  position: relative;
3
11
  isolation: isolate;
@@ -9,17 +17,37 @@
9
17
  width: 100%;
10
18
  height: 100%;
11
19
  }
12
- :where(.lg-content[data-layout="scroll"]) { overflow: auto; }
13
- :where([data-glass-blur-host]) { display: contents; }
20
+ :where(.lg-content[data-layout="scroll"]) {
21
+ overflow: auto;
22
+ }
23
+ :where([data-glass-blur-host]) {
24
+ display: contents;
25
+ }
14
26
  /* Gecko blurs this wrapper on the GPU, so glass copies the content unblurred. */
15
- :where([data-glass-blur-host][data-glass-blur-active]) { display: block; position: absolute; inset: 0; width: 100%; height: 100%; }
16
- :where([data-glass-blur-host][data-glass-blur-active][data-layout="flow"]) { position: relative; inset: auto; height: auto; }
17
- :where(.lg-scroll-paint-root) { position: absolute; inset: 0; overflow: visible; }
18
- :where(.lg-scroll-paint-root > foreignObject) { overflow: visible; }
27
+ :where([data-glass-blur-host][data-glass-blur-active]) {
28
+ display: block;
29
+ position: absolute;
30
+ inset: 0;
31
+ width: 100%;
32
+ height: 100%;
33
+ }
34
+ :where([data-glass-blur-host][data-glass-blur-active][data-layout="flow"]) {
35
+ position: relative;
36
+ inset: auto;
37
+ height: auto;
38
+ }
39
+ :where(.lg-scroll-paint-root) {
40
+ position: absolute;
41
+ inset: 0;
42
+ overflow: visible;
43
+ }
44
+ :where(.lg-scroll-paint-root > foreignObject) {
45
+ overflow: visible;
46
+ }
19
47
  /* Gecko draws each surface's glass in a layer beneath its children. */
20
48
  .lg-glass-layer {
21
49
  position: absolute;
22
- z-index: -1;
50
+ z-index: -2;
23
51
  pointer-events: none;
24
52
  background-repeat: no-repeat;
25
53
  }
@@ -31,6 +59,23 @@
31
59
  --lg-material-foreground: var(--lg-foreground, #111113);
32
60
  color: var(--lg-material-foreground);
33
61
  }
62
+ /* In Chromium each surface draws its glass as its own backdrop filter. One
63
+ holding other glass draws it on this layer beneath its children instead,
64
+ so the glass inside it sees it. */
65
+ .lg-surface[data-glass-host] {
66
+ isolation: isolate;
67
+ }
68
+ .lg-surface[data-glass-host]::before {
69
+ content: "";
70
+ position: absolute;
71
+ inset: 0;
72
+ z-index: -1;
73
+ pointer-events: none;
74
+ border-radius: inherit;
75
+ backdrop-filter: var(--lg-glass-filter);
76
+ /* Held in view while the surface scrolls its children. */
77
+ translate: var(--lg-scroll, 0px 0px);
78
+ }
34
79
  :where(.lg-surface)[data-glass-appearance="dark"] {
35
80
  --lg-material-foreground: var(--lg-foreground, #fff);
36
81
  color: var(--lg-material-foreground);
@@ -75,7 +120,9 @@
75
120
  padding: var(--lg-toolbar-inset, 3px);
76
121
  flex: 1 0 auto;
77
122
  }
78
- :where(.lg-toolbar)[data-segmented] > :where(.lg-toolbar-cluster) { flex: 0 0 auto; }
123
+ :where(.lg-toolbar)[data-segmented] > :where(.lg-toolbar-cluster) {
124
+ flex: 0 0 auto;
125
+ }
79
126
  :where(.lg-toolbar) :where(.lg-button) {
80
127
  min-height: 22px;
81
128
  padding: 0 8px;
@@ -132,8 +179,7 @@
132
179
  outline: none;
133
180
  overscroll-behavior: contain;
134
181
  }
135
- :where(.lg-menu)
136
- :is([role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]) {
182
+ :where(.lg-menu) :is([role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]) {
137
183
  box-sizing: border-box;
138
184
  min-height: 28px;
139
185
  padding: 4px 8px;
@@ -147,23 +193,10 @@
147
193
  outline: none;
148
194
  }
149
195
  :where(.lg-menu)
150
- :is(
151
- [role="menuitem"],
152
- [role="menuitemcheckbox"],
153
- [role="menuitemradio"]
154
- )[data-highlighted],
155
- :where(.lg-menu)
156
- :is(
157
- [role="menuitem"],
158
- [role="menuitemcheckbox"],
159
- [role="menuitemradio"]
160
- ):focus-visible,
196
+ :is([role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"])[data-highlighted],
161
197
  :where(.lg-menu)
162
- :is(
163
- [role="menuitem"],
164
- [role="menuitemcheckbox"],
165
- [role="menuitemradio"]
166
- ):active {
198
+ :is([role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]):focus-visible,
199
+ :where(.lg-menu) :is([role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]):active {
167
200
  background: var(--lg-menu-highlight);
168
201
  }
169
202
  @media (prefers-reduced-motion: reduce) {
@@ -175,35 +208,42 @@
175
208
  /* Interactive glass illuminates from within, starting beneath the pointer.
176
209
  The scene writes --lg-glow (0–1) and its position on the surface. */
177
210
  :where(.lg-surface[data-glass-interactive]) {
211
+ /* A soft light under the finger, and the whole face brightening a little. */
178
212
  --lg-glow-color: rgb(255 255 255 / 0.3);
179
- background-image: radial-gradient(
180
- var(--lg-glow-size, 64px) circle at var(--lg-glow-x, 50%) var(--lg-glow-y, 50%),
181
- color-mix(in srgb, var(--lg-glow-color) calc(var(--lg-glow, 0) * 100%), transparent),
182
- transparent
183
- );
213
+ --lg-glow-fill: rgb(255 255 255 / 0.12);
214
+ background-image:
215
+ radial-gradient(
216
+ var(--lg-glow-size, 36px) circle at var(--lg-glow-x, 50%) var(--lg-glow-y, 50%),
217
+ color-mix(in srgb, var(--lg-glow-color) calc(var(--lg-glow, 0) * 100%), transparent),
218
+ transparent
219
+ ),
220
+ linear-gradient(
221
+ color-mix(in srgb, var(--lg-glow-fill) calc(var(--lg-glow, 0) * 100%), transparent),
222
+ color-mix(in srgb, var(--lg-glow-fill) calc(var(--lg-glow, 0) * 100%), transparent)
223
+ );
184
224
  }
185
225
  :where(.lg-surface[data-glass-interactive][data-glass-appearance="dark"]) {
186
- --lg-glow-color: rgb(255 255 255 / 0.16);
226
+ --lg-glow-color: rgb(255 255 255 / 0.2);
227
+ --lg-glow-fill: rgb(255 255 255 / 0.07);
228
+ }
229
+ :where(.lg-surface[data-glass-interactive]) {
230
+ touch-action: manipulation;
231
+ -webkit-tap-highlight-color: transparent;
187
232
  }
188
- :where(.lg-surface[data-glass-interactive]) { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
189
233
 
190
- /* While glass grows out of, or back into, another shape, its content waits
191
- for room: it condenses out of a blur as the outline opens, and dissolves
192
- back into one as it closes. */
193
- :where(.lg-surface[data-glass-morph]) > * {
194
- opacity: calc(var(--lg-morph, 1) * var(--lg-glass-ready, 1));
195
- filter: blur(calc((1 - var(--lg-morph, 1)) * 6px));
196
- /* Keep animated text blur on its own layer: WebKit can otherwise flash
197
- unpainted pixels while the containing outline changes. This hint does
198
- not replace an author's transform and expires with the morph. */
199
- will-change: transform;
200
- backface-visibility: hidden;
201
- }
202
- /* Glass that has become another surface: its material is drawn by that
203
- surface, and its own content withdraws as the glass leaves it. */
204
- :where([data-glass-morph-source]) {
205
- opacity: calc(1 - var(--lg-morph-source, 1));
206
- filter: blur(calc(var(--lg-morph-source, 1) * 3px));
234
+ /* The rim highlight of specular glass, above the material and beneath the
235
+ surface's children. The scene sizes it to the glass and aims its light. */
236
+ .lg-specular {
237
+ position: absolute;
238
+ z-index: -1;
239
+ display: block;
240
+ pointer-events: none;
241
+ background-repeat: no-repeat;
242
+ }
243
+ @media (prefers-reduced-transparency: reduce), (forced-colors: active) {
244
+ .lg-specular {
245
+ display: none;
246
+ }
207
247
  }
208
248
 
209
249
  :where(.lg-tab-indicator) {
@@ -213,26 +253,71 @@
213
253
  width: var(--active-tab-width);
214
254
  height: var(--active-tab-height);
215
255
  pointer-events: none;
256
+ /* The chosen tab's plate of glass is lit a little brighter than the bar. */
257
+ background: var(--lg-tab-selection, color-mix(in oklab, currentColor 9%, transparent));
258
+ }
259
+ /* The lens a press lifts out of the plate: drawn over the labels, so it
260
+ magnifies them, and outside the bar, so the bar's shape never clips it. */
261
+ :where(.lg-tab-lens) {
262
+ position: absolute;
263
+ z-index: 3;
264
+ pointer-events: none;
265
+ box-sizing: border-box;
216
266
  }
217
267
 
218
268
  :where(.lg-button)[data-size="xs"],
219
- :where(.lg-button)[data-size="icon-xs"] { min-height: 20px; }
269
+ :where(.lg-button)[data-size="icon-xs"] {
270
+ min-height: 20px;
271
+ }
220
272
  :where(.lg-button)[data-size="sm"],
221
- :where(.lg-button)[data-size="icon-sm"] { min-height: 24px; }
273
+ :where(.lg-button)[data-size="icon-sm"] {
274
+ min-height: 24px;
275
+ }
222
276
  :where(.lg-button)[data-size="lg"],
223
- :where(.lg-button)[data-size="icon-lg"] { min-height: 32px; padding-inline: 10px; }
224
- :where(.lg-button)[data-size="xs"] { font-size: 10px; }
225
- :where(.lg-button)[data-size^="icon"] { width: 28px; height: 28px; padding: 0; }
226
- :where(.lg-button)[data-size="icon-xs"] { width: 20px; height: 20px; }
227
- :where(.lg-button)[data-size="icon-sm"] { width: 24px; height: 24px; }
228
- :where(.lg-button)[data-size="icon-lg"] { width: 32px; height: 32px; }
229
- :where(.lg-button) > svg, :where(.lg-toolbar-button) > svg { width: 14px; height: 14px; }
277
+ :where(.lg-button)[data-size="icon-lg"] {
278
+ min-height: 32px;
279
+ padding-inline: 10px;
280
+ }
281
+ :where(.lg-button)[data-size="xs"] {
282
+ font-size: 10px;
283
+ }
284
+ :where(.lg-button)[data-size^="icon"] {
285
+ width: 28px;
286
+ height: 28px;
287
+ padding: 0;
288
+ }
289
+ :where(.lg-button)[data-size="icon-xs"] {
290
+ width: 20px;
291
+ height: 20px;
292
+ }
293
+ :where(.lg-button)[data-size="icon-sm"] {
294
+ width: 24px;
295
+ height: 24px;
296
+ }
297
+ :where(.lg-button)[data-size="icon-lg"] {
298
+ width: 32px;
299
+ height: 32px;
300
+ }
301
+ :where(.lg-button) > svg,
302
+ :where(.lg-toolbar-button) > svg {
303
+ width: 14px;
304
+ height: 14px;
305
+ }
230
306
  :where(.lg-button)[data-size="xs"] > svg,
231
- :where(.lg-button)[data-size="icon-xs"] > svg { width: 10px; height: 10px; }
307
+ :where(.lg-button)[data-size="icon-xs"] > svg {
308
+ width: 10px;
309
+ height: 10px;
310
+ }
232
311
  :where(.lg-button)[data-size="sm"] > svg,
233
- :where(.lg-button)[data-size="icon-sm"] > svg { width: 12px; height: 12px; }
312
+ :where(.lg-button)[data-size="icon-sm"] > svg {
313
+ width: 12px;
314
+ height: 12px;
315
+ }
234
316
  :where(.lg-button)[data-size="lg"] > svg,
235
- :where(.lg-button)[data-size="icon-lg"] > svg { width: 16px; height: 16px; }
317
+ :where(.lg-button)[data-size="icon-lg"] > svg {
318
+ width: 16px;
319
+ height: 16px;
320
+ }
236
321
 
237
322
  :where(.lg-toolbar-button) {
238
323
  display: inline-flex;
@@ -255,14 +340,24 @@
255
340
  font-size: 12px;
256
341
  font-weight: 500;
257
342
  }
258
- :where(.lg-toolbar, .lg-toolbar-cluster)[data-orientation="vertical"] { flex-direction: column; }
343
+ :where(.lg-toolbar, .lg-toolbar-cluster)[data-orientation="vertical"] {
344
+ flex-direction: column;
345
+ }
259
346
  :where(.lg-toolbar-spacer) {
260
347
  flex: 1 0 var(--lg-toolbar-space, 8px);
261
348
  align-self: stretch;
262
349
  pointer-events: none;
263
350
  }
264
- :where(.lg-toolbar-spacer)[data-sizing="fixed"] { flex-grow: 0; }
265
- :where(.lg-toolbar-button):is(:hover, :focus-visible, :active, [aria-pressed="true"], [data-popup-open]):not([data-disabled]):not(:disabled) {
351
+ :where(.lg-toolbar-spacer)[data-sizing="fixed"] {
352
+ flex-grow: 0;
353
+ }
354
+ :where(.lg-toolbar-button):is(
355
+ :hover,
356
+ :focus-visible,
357
+ :active,
358
+ [aria-pressed="true"],
359
+ [data-popup-open]
360
+ ):not([data-disabled]):not(:disabled) {
266
361
  background: var(--lg-control-highlight);
267
362
  }
268
363
  :where(.lg-toolbar-button):focus-visible {
@@ -272,7 +367,9 @@
272
367
  opacity: 0.45;
273
368
  cursor: default;
274
369
  }
275
- :where(.lg-tabs-list)[data-size="sm"] :where(.lg-tab) { height: 22px; }
370
+ :where(.lg-tabs-list)[data-size="sm"] :where(.lg-tab) {
371
+ height: 22px;
372
+ }
276
373
  :where(.lg-tabs-list)[data-size="lg"] :where(.lg-tab) {
277
374
  height: 30px;
278
375
  padding-inline: 12px;
@@ -284,7 +381,6 @@
284
381
  :where(.lg-tabs-list)[data-orientation="vertical"] :where(.lg-tab-indicator) {
285
382
  left: var(--active-tab-left);
286
383
  top: var(--active-tab-top);
287
-
288
384
  }
289
385
  :where(.lg-tab)[data-disabled],
290
386
  :where(.lg-menu) [data-disabled] {
@@ -298,63 +394,373 @@
298
394
  opacity: 0.15;
299
395
  }
300
396
 
301
- :where(.lg-menu) :is([role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]) > svg { width: 14px; height: 14px; }
397
+ :where(.lg-menu) :is([role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]) > svg {
398
+ width: 14px;
399
+ height: 14px;
400
+ }
302
401
 
303
402
  /* Open popups and their optical layer share a stacking context above nearby content. */
304
403
  /* Set by the scene while a popup surface is registered in it. A `:has()` rule
305
404
  here would re-style the whole scene on every inline style change inside it. */
306
- :where(.lg-scene[data-glass-popup]) { z-index: 20; }
307
-
308
- :where(.lg-content[data-layout="flow"]) { position: relative; inset: auto; height: auto; }
309
- :where(.lg-progressive-blur) { position: absolute; pointer-events: none; }
310
- :where(.lg-progressive-blur[data-edge="top"]) { inset: 0 0 auto; height: var(--lg-blur-size); }
311
- :where(.lg-progressive-blur[data-edge="bottom"]) { inset: auto 0 0; height: var(--lg-blur-size); }
312
- :where(.lg-progressive-blur[data-edge="inline-start"]) { inset-block: 0; inset-inline-start: 0; width: var(--lg-blur-size); }
313
- :where(.lg-progressive-blur[data-edge="inline-end"]) { inset-block: 0; inset-inline-end: 0; width: var(--lg-blur-size); }
405
+ :where(.lg-scene[data-glass-popup]) {
406
+ z-index: 20;
407
+ }
408
+ /* A popup's contents wait for its glass, for at most a few frames. The popup
409
+ itself stays visible so it can take focus. */
410
+ .lg-surface[data-glass-pending] > * {
411
+ visibility: hidden !important;
412
+ }
314
413
 
315
- :where(.lg-slider) { position: relative; width: 280px; max-width: 100%; touch-action: none; }
316
- :where(.lg-slider-control) { position: relative; display: flex; align-items: center; height: 28px; user-select: none; }
317
- :where(.lg-slider-track) { position: relative; width: 100%; height: 6px; background: rgb(128 128 128 / 0.3); }
318
- :where(.lg-slider-fill) { height: 100%; background: var(--lg-accent); }
319
- :where(.lg-slider-thumb) { width: 20px; height: 16px; translate: -50% -50%; cursor: grab; z-index: 1; outline: none; }
320
- :where(.lg-slider-thumb):dir(rtl) { translate: 50% -50%; }
321
- :where(.lg-slider)[data-orientation="vertical"] :where(.lg-slider-thumb) { translate: -50% 50%; }
322
- :where(.lg-slider-thumb)[data-press-phase="pressed"] { cursor: grabbing; }
323
- :where(.lg-control-thumb) { --lg-control-progress: 0; --lg-control-grow-x: 2.5px; --lg-control-grow-y: 2px; }
324
- :where(.lg-switch-thumb) { --lg-control-grow-x: 9px; --lg-control-grow-y: 5.5px; }
325
- :where(.lg-control-lens, .lg-control-face) { position: absolute; inset: calc(-1 * var(--lg-control-grow-y) * var(--lg-control-progress)) calc(-1 * var(--lg-control-grow-x) * var(--lg-control-progress)); pointer-events: none; }
326
- :where(.lg-control-face) { background: #fff; opacity: calc(1 - var(--lg-control-progress)); box-shadow: 0 1px 2px rgb(0 0 0 / 0.1), 0 3px 12px rgb(0 0 0 / 0.1); }
327
- :where(.lg-control-lens) { opacity: var(--lg-control-progress); }
414
+ :where(.lg-content[data-layout="flow"]) {
415
+ position: relative;
416
+ inset: auto;
417
+ height: auto;
418
+ }
419
+ :where(.lg-progressive-blur) {
420
+ position: absolute;
421
+ pointer-events: none;
422
+ }
423
+ :where(.lg-progressive-blur[data-edge="top"]) {
424
+ inset: 0 0 auto;
425
+ height: var(--lg-blur-size);
426
+ }
427
+ :where(.lg-progressive-blur[data-edge="bottom"]) {
428
+ inset: auto 0 0;
429
+ height: var(--lg-blur-size);
430
+ }
431
+ :where(.lg-progressive-blur[data-edge="inline-start"]) {
432
+ inset-block: 0;
433
+ inset-inline-start: 0;
434
+ width: var(--lg-blur-size);
435
+ }
436
+ :where(.lg-progressive-blur[data-edge="inline-end"]) {
437
+ inset-block: 0;
438
+ inset-inline-end: 0;
439
+ width: var(--lg-blur-size);
440
+ }
328
441
 
329
- :where(.lg-slider-thumb):focus-within { outline: none; }
330
- :where(.lg-slider-ticks) { display: flex; justify-content: space-between; position: absolute; inset-inline: 0; top: 23px; pointer-events: none; }
331
- :where(.lg-slider-ticks) > span { width: 2px; height: 2px; border-radius: 50%; background: rgb(128 128 128 / 0.65); }
332
- :where(.lg-slider)[data-orientation="vertical"] { width: 28px; height: 200px; }
333
- :where(.lg-slider)[data-orientation="vertical"] :where(.lg-slider-control) { width: 28px; height: 100%; justify-content: center; }
334
- :where(.lg-slider)[data-orientation="vertical"] :where(.lg-slider-track) { width: 6px; height: 100%; }
335
- :where(.lg-slider)[data-orientation="vertical"] :where(.lg-slider-fill) { width: 100%; }
336
- :where(.lg-slider)[data-orientation="vertical"] :where(.lg-slider-ticks) { inset: 0 auto 0 23px; flex-direction: column-reverse; }
337
- :where(.lg-switch) { --lg-switch-travel: 18px; position: relative; display: inline-flex; align-items: center; flex-shrink: 0; box-sizing: border-box; width: 54px; height: 24px; padding: 2px; border: 0; cursor: pointer; touch-action: none; user-select: none; outline: none; transition: background-color 200ms ease-in-out; }
338
- :where(.lg-switch-track) { position: absolute; inset: 0; pointer-events: none; background: rgb(128 128 128 / 0.4); transition: background-color 200ms ease-in-out; }
339
- :where(.lg-switch)[data-checked] > .lg-switch-track, :where(.lg-switch)[data-presentation-checked="true"] > .lg-switch-track { background: var(--lg-accent); }
340
- :where(.lg-switch)[data-presentation-checked="false"] > .lg-switch-track { background: rgb(128 128 128 / 0.4); }
341
- :where(.lg-switch):dir(rtl) { --lg-switch-travel: -18px; }
342
- :where(.lg-switch-thumb) { position: relative; display: block; width: 32px; height: 20px; flex-shrink: 0; left: calc(var(--lg-switch-position, 0) * var(--lg-switch-travel)); }
442
+ /* The fill of a slider and the track of a switch that's on. `tint` sets it on
443
+ the element; a stylesheet can set it too. */
444
+ :where(.lg-slider, .lg-switch) {
445
+ --lg-accent: #8e8e93;
446
+ }
447
+ :where(.lg-slider) {
448
+ position: relative;
449
+ width: 280px;
450
+ max-width: 100%;
451
+ touch-action: none;
452
+ }
453
+ :where(.lg-slider-control) {
454
+ position: relative;
455
+ display: flex;
456
+ align-items: center;
457
+ height: 28px;
458
+ user-select: none;
459
+ }
460
+ :where(.lg-slider-track) {
461
+ position: relative;
462
+ width: 100%;
463
+ height: 6px;
464
+ background: rgb(128 128 128 / 0.3);
465
+ }
466
+ :where(.lg-slider-fill) {
467
+ height: 100%;
468
+ background: var(--lg-accent);
469
+ }
470
+ :where(.lg-slider-thumb) {
471
+ width: 20px;
472
+ height: 16px;
473
+ translate: -50% -50%;
474
+ cursor: grab;
475
+ z-index: 1;
476
+ outline: none;
477
+ }
478
+ :where(.lg-slider-thumb):dir(rtl) {
479
+ translate: 50% -50%;
480
+ }
481
+ :where(.lg-slider)[data-orientation="vertical"] :where(.lg-slider-thumb) {
482
+ translate: -50% 50%;
483
+ }
484
+ :where(.lg-slider-thumb)[data-press-phase="pressed"] {
485
+ cursor: grabbing;
486
+ }
487
+ :where(.lg-control-thumb) {
488
+ --lg-control-progress: 0;
489
+ --lg-control-grow-x: 2.5px;
490
+ --lg-control-grow-y: 2px;
491
+ }
492
+ :where(.lg-switch-thumb) {
493
+ /* While pressed the thumb lifts into a lens about 1.55 times its size, as on
494
+ macOS: 9px and 5.5px each side at the default 32x20 thumb, so 50x31. */
495
+ --lg-control-grow-x: calc(100cqh * 0.45);
496
+ --lg-control-grow-y: calc(100cqh * 0.275);
497
+ }
498
+ :where(.lg-control-lens, .lg-control-face) {
499
+ position: absolute;
500
+ inset: calc(-1 * var(--lg-control-grow-y) * var(--lg-control-progress))
501
+ calc(-1 * var(--lg-control-grow-x) * var(--lg-control-progress));
502
+ pointer-events: none;
503
+ }
504
+ :where(.lg-control-face) {
505
+ background: #fff;
506
+ opacity: calc(1 - var(--lg-control-progress));
507
+ box-shadow:
508
+ 0 1px 2px rgb(0 0 0 / 0.1),
509
+ 0 3px 12px rgb(0 0 0 / 0.1);
510
+ }
511
+ :where(.lg-control-lens) {
512
+ opacity: var(--lg-control-progress);
513
+ }
343
514
 
515
+ :where(.lg-slider-thumb):focus-within {
516
+ outline: none;
517
+ }
518
+ :where(.lg-slider-ticks) {
519
+ display: flex;
520
+ justify-content: space-between;
521
+ position: absolute;
522
+ inset-inline: 0;
523
+ top: 23px;
524
+ pointer-events: none;
525
+ }
526
+ :where(.lg-slider-ticks) > span {
527
+ width: 2px;
528
+ height: 2px;
529
+ border-radius: 50%;
530
+ background: rgb(128 128 128 / 0.65);
531
+ }
532
+ :where(.lg-slider)[data-orientation="vertical"] {
533
+ width: 28px;
534
+ height: 200px;
535
+ }
536
+ :where(.lg-slider)[data-orientation="vertical"] :where(.lg-slider-control) {
537
+ width: 28px;
538
+ height: 100%;
539
+ justify-content: center;
540
+ }
541
+ :where(.lg-slider)[data-orientation="vertical"] :where(.lg-slider-track) {
542
+ width: 6px;
543
+ height: 100%;
544
+ }
545
+ :where(.lg-slider)[data-orientation="vertical"] :where(.lg-slider-fill) {
546
+ width: 100%;
547
+ }
548
+ :where(.lg-slider)[data-orientation="vertical"] :where(.lg-slider-ticks) {
549
+ inset: 0 auto 0 23px;
550
+ flex-direction: column-reverse;
551
+ }
552
+ :where(.lg-switch) {
553
+ /* The thumb sizes itself and its travel from the switch's content box. */
554
+ container-type: size;
555
+ position: relative;
556
+ display: inline-flex;
557
+ align-items: center;
558
+ flex-shrink: 0;
559
+ box-sizing: border-box;
560
+ width: 54px;
561
+ height: 24px;
562
+ padding: 2px;
563
+ border: 0;
564
+ cursor: pointer;
565
+ touch-action: none;
566
+ user-select: none;
567
+ outline: none;
568
+ transition: background-color 200ms ease-in-out;
569
+ }
570
+ :where(.lg-switch-track) {
571
+ position: absolute;
572
+ inset: 0;
573
+ pointer-events: none;
574
+ background: rgb(128 128 128 / 0.4);
575
+ transition: background-color 200ms ease-in-out;
576
+ }
577
+ :where(.lg-switch)[data-checked] > .lg-switch-track,
578
+ :where(.lg-switch)[data-presentation-checked="true"] > .lg-switch-track {
579
+ background: var(--lg-accent);
580
+ }
581
+ :where(.lg-switch)[data-presentation-checked="false"] > .lg-switch-track {
582
+ background: rgb(128 128 128 / 0.4);
583
+ }
584
+ /* The track brightens a little while its thumb is held. */
585
+ :where(.lg-switch):has(.lg-control-thumb[data-press-phase="pressed"]) > .lg-switch-track {
586
+ background-image: linear-gradient(rgb(255 255 255 / 0.1), rgb(255 255 255 / 0.1));
587
+ }
588
+ /* The thumb is as tall as the switch inside its padding and 32:20 wide, and
589
+ travels the width that leaves it, following --lg-switch-position (0 off, 1
590
+ on, and every point between while dragged) in either writing direction. At
591
+ the default 54x24 size that is a 32x20 thumb travelling 18px. */
592
+ :where(.lg-switch-thumb) {
593
+ position: relative;
594
+ display: block;
595
+ width: calc(100cqh * 1.6);
596
+ height: 100cqh;
597
+ flex-shrink: 0;
598
+ inset-inline-start: calc(var(--lg-switch-position, 0) * (100cqw - 100cqh * 1.6));
599
+ }
344
600
 
345
- :where(.lg-switch):focus-visible { outline: none; }
346
- :where(.lg-switch)[data-readonly] { cursor: default; }
601
+ :where(.lg-switch):focus-visible {
602
+ outline: none;
603
+ }
604
+ :where(.lg-switch)[data-readonly] {
605
+ cursor: default;
606
+ }
607
+ :where(.lg-switch, .lg-slider)[data-disabled] {
608
+ opacity: 0.45;
609
+ cursor: default;
610
+ }
611
+ :where(.lg-slider)[data-disabled] :where(.lg-slider-thumb) {
612
+ cursor: default;
613
+ }
347
614
  @media (prefers-reduced-motion: reduce) {
348
615
  :where(.lg-slider-thumb, .lg-switch, .lg-switch-track, .lg-switch-thumb, .lg-control-face),
349
- :where(.lg-switch)[data-dragging] :where(.lg-switch-thumb) { transition: none; }
616
+ :where(.lg-switch)[data-dragging] :where(.lg-switch-thumb) {
617
+ transition: none;
618
+ }
350
619
  }
351
620
  @media (forced-colors: active) {
352
- :where(.lg-slider-track, .lg-switch-track) { background: Canvas; border: 1px solid ButtonText; }
353
- :where(.lg-slider-fill), :where(.lg-switch)[data-checked] > .lg-switch-track { background: Highlight; }
354
- :where(.lg-slider-thumb, .lg-switch-thumb) { background: ButtonText; }
621
+ :where(.lg-slider-track, .lg-switch-track) {
622
+ background: Canvas;
623
+ border: 1px solid ButtonText;
624
+ }
625
+ :where(.lg-slider-fill),
626
+ :where(.lg-switch)[data-checked] > .lg-switch-track {
627
+ background: Highlight;
628
+ }
629
+ :where(.lg-slider-thumb, .lg-switch-thumb) {
630
+ background: ButtonText;
631
+ }
355
632
  }
356
633
 
357
- :where(.lg-switch:has([data-glass-motion="none"]), .lg-switch:has([data-glass-motion="none"]) > .lg-switch-track) { transition: none; }
634
+ :where(
635
+ .lg-switch:has([data-glass-motion="none"]),
636
+ .lg-switch:has([data-glass-motion="none"]) > .lg-switch-track
637
+ ) {
638
+ transition: none;
639
+ }
358
640
 
359
641
  /* No rounded-rectangle first paint while Lisse measures the shape. */
360
- [data-lg-shape]:not([style*="clip-path"]), .lg-surface:not([style*="clip-path"]) { visibility: hidden; }
642
+ [data-lg-shape]:not([style*="clip-path"]),
643
+ .lg-surface:not([style*="clip-path"]) {
644
+ /* Keep newly mounted popups focusable while their outline is measured. */
645
+ clip-path: inset(50%);
646
+ }
647
+
648
+ /* Color picker: the wheel is the scene's content. At rest a small dot of the
649
+ chosen color marks it; pressing grows a Clear lens out of the dot. The lens
650
+ keeps its open size in layout and is only scaled, so its maps never change
651
+ while it grows. */
652
+ :where(.lg-color-picker) {
653
+ --lg-color-lens-size: 60px;
654
+ --lg-color-lens-rest: 0.24;
655
+ --lg-color-picker-padding: calc(var(--lg-color-lens-size) / 2 + 6px);
656
+ display: inline-flex;
657
+ box-sizing: border-box;
658
+ padding: var(--lg-color-picker-padding);
659
+ }
660
+ :where(.lg-color-picker[data-disabled]) {
661
+ opacity: 0.45;
662
+ pointer-events: none;
663
+ }
664
+ :where(.lg-color-picker-canvas) {
665
+ box-sizing: border-box;
666
+ padding: var(--lg-color-picker-padding);
667
+ }
668
+ :where(.lg-color-wheel-colors, .lg-color-wheel) {
669
+ position: relative;
670
+ width: var(--lg-color-wheel-size);
671
+ height: var(--lg-color-wheel-size);
672
+ border-radius: 50%;
673
+ }
674
+ :where(.lg-color-wheel-colors) {
675
+ /* Shown until the drawn wheel is ready. */
676
+ background:
677
+ radial-gradient(closest-side, #fff, rgb(255 255 255 / 0)),
678
+ conic-gradient(from 90deg, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
679
+ background-size: 100% 100%;
680
+ box-shadow: 0 10px 34px rgb(0 0 0 / 0.1);
681
+ }
682
+ :where(.lg-color-wheel) {
683
+ flex-shrink: 0;
684
+ cursor: crosshair;
685
+ touch-action: none;
686
+ user-select: none;
687
+ outline: none;
688
+ -webkit-tap-highlight-color: transparent;
689
+ }
690
+ .lg-color-lens,
691
+ .lg-color-lens-shadow,
692
+ .lg-color-knob {
693
+ position: absolute;
694
+ translate: -50% -50%;
695
+ pointer-events: none;
696
+ }
697
+ .lg-color-lens,
698
+ .lg-color-lens-shadow {
699
+ width: var(--lg-color-lens-size);
700
+ height: var(--lg-color-lens-size);
701
+ scale: var(--lg-color-lens-rest);
702
+ opacity: 0;
703
+ transition:
704
+ scale 320ms cubic-bezier(0.3, 1.35, 0.45, 1),
705
+ opacity 90ms ease-out;
706
+ }
707
+ .lg-color-lens-shadow {
708
+ border-radius: 50%;
709
+ box-shadow: 0 3px 14px rgb(0 0 0 / 0.22);
710
+ }
711
+ .lg-color-lens[data-open],
712
+ .lg-color-lens-shadow[data-open] {
713
+ scale: 1;
714
+ opacity: 1;
715
+ }
716
+ .lg-color-lens[data-open][data-touch],
717
+ .lg-color-lens-shadow[data-open][data-touch] {
718
+ scale: 1.1;
719
+ }
720
+ :where(.lg-color-lens:not([data-open]), .lg-color-lens-shadow:not([data-open])) {
721
+ transition:
722
+ scale 220ms cubic-bezier(0.4, 0, 0.6, 1),
723
+ opacity 120ms 100ms ease-in;
724
+ }
725
+ /* The exact color under the pointer: the center of the lens bends nothing. */
726
+ :where(.lg-color-lens-point) {
727
+ position: absolute;
728
+ left: 50%;
729
+ top: 50%;
730
+ width: 6px;
731
+ height: 6px;
732
+ translate: -50% -50%;
733
+ border-radius: 50%;
734
+ box-shadow:
735
+ 0 0 0 1.5px rgb(255 255 255 / 0.95),
736
+ 0 0 0 2.5px rgb(0 0 0 / 0.16);
737
+ }
738
+ /* The resting marker: the chosen color, ringed thinly in white. */
739
+ .lg-color-knob {
740
+ width: 14px;
741
+ height: 14px;
742
+ border-radius: 50%;
743
+ background: var(--lg-color);
744
+ box-shadow:
745
+ 0 0 0 2px #fff,
746
+ 0 1px 5px rgb(0 0 0 / 0.3);
747
+ transition:
748
+ scale 160ms ease-out,
749
+ opacity 120ms ease-out;
750
+ }
751
+ .lg-color-knob[data-open] {
752
+ scale: 0.4;
753
+ opacity: 0;
754
+ }
755
+ :where(.lg-color-knob:not([data-open])) {
756
+ transition:
757
+ scale 200ms 120ms cubic-bezier(0.3, 1.35, 0.45, 1),
758
+ opacity 120ms 120ms ease-out;
759
+ }
760
+ @media (prefers-reduced-motion: reduce) {
761
+ .lg-color-lens,
762
+ .lg-color-lens-shadow,
763
+ .lg-color-knob {
764
+ transition: opacity 120ms;
765
+ }
766
+ }