glasslikeui 1.6.1 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +373 -674
- package/README.md +299 -4
- package/dist/actions/dragSnap.d.ts +16 -39
- package/dist/actions/dragSnap.js +6 -224
- package/dist/actions/dragSnapMath.d.ts +68 -0
- package/dist/actions/dragSnapMath.js +166 -0
- package/dist/actions/dragSurface.d.ts +26 -0
- package/dist/actions/dragSurface.js +187 -0
- package/dist/actions/focusRingFit.d.ts +22 -0
- package/dist/actions/focusRingFit.js +115 -0
- package/dist/actions/focusTrap.d.ts +22 -0
- package/dist/actions/focusTrap.js +103 -0
- package/dist/actions/index.d.ts +3 -0
- package/dist/actions/index.js +3 -0
- package/dist/actions/inertSiblings.d.ts +10 -0
- package/dist/actions/inertSiblings.js +35 -0
- package/dist/actions/reducedMotion.d.ts +25 -0
- package/dist/actions/reducedMotion.js +26 -0
- package/dist/actions/sheetBodyDrag.d.ts +14 -0
- package/dist/actions/sheetBodyDrag.js +26 -0
- package/dist/actions/sheetExit.d.ts +36 -0
- package/dist/actions/sheetExit.js +65 -0
- package/dist/actions/swipeActions.d.ts +14 -5
- package/dist/actions/swipeActions.js +89 -16
- package/dist/actions/viewTransition.d.ts +2 -1
- package/dist/actions/viewTransition.js +4 -2
- package/dist/components/glass/Glass.svelte +97 -6
- package/dist/components/glass/GlassMorph.svelte +21 -0
- package/dist/components/glass/Sheet.svelte +243 -61
- package/dist/components/glass/Sheet.svelte.d.ts +7 -1
- package/dist/components/interactive/Badge.svelte +2 -1
- package/dist/components/interactive/Button.svelte +164 -18
- package/dist/components/interactive/IconButton.svelte +23 -1
- package/dist/components/interactive/TabView.svelte +24 -1
- package/dist/components/interactive/Toggle.svelte +22 -4
- package/dist/components/layout/ScrollView.svelte +6 -0
- package/dist/components/list/ListRow.svelte +43 -9
- package/dist/components/menu/Menu.svelte +23 -0
- package/dist/components/menu/MenuItem.svelte +15 -2
- package/dist/components/navigation/NavigationLink.svelte +38 -2
- package/dist/components/typography/Text.svelte +2 -2
- package/dist/constants/shapes.d.ts +7 -0
- package/dist/constants/shapes.js +16 -0
- package/dist/styles/glasslikeui.css +143 -15
- package/dist/styles/lens.css +77 -0
- package/package.json +2 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
+
import { fitFocusRing } from '../../actions/focusRingFit';
|
|
3
4
|
|
|
4
5
|
interface Props {
|
|
5
6
|
children: Snippet;
|
|
@@ -16,7 +17,9 @@
|
|
|
16
17
|
}: Props = $props();
|
|
17
18
|
</script>
|
|
18
19
|
|
|
19
|
-
<a {href} class="navigation-link {className}" class:active aria-current={active ? 'page' : undefined}
|
|
20
|
+
<a {href} class="navigation-link {className}" class:active aria-current={active ? 'page' : undefined}
|
|
21
|
+
{@attach fitFocusRing}
|
|
22
|
+
>
|
|
20
23
|
{@render children()}
|
|
21
24
|
</a>
|
|
22
25
|
|
|
@@ -35,11 +38,44 @@
|
|
|
35
38
|
z-index: 1;
|
|
36
39
|
}
|
|
37
40
|
|
|
41
|
+
/* Shared focus ring. :where keeps it at zero specificity, so a page's own
|
|
42
|
+
focus rules win. */
|
|
43
|
+
:where(.navigation-link:focus-visible) {
|
|
44
|
+
outline: var(--glass-focus-ring-width, 2px) solid var(--glass-focus-ring-color, var(--glass-focus-ring-color-default, #9ecbff));
|
|
45
|
+
outline-offset: var(--glass-focus-ring-offset, 2px);
|
|
46
|
+
box-shadow: 0 0 0 var(--glass-focus-ring-offset, 2px) var(--glass-focus-ring-halo-color, var(--glass-focus-ring-halo-color-default, #000000));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* The same ring moved inside, for a part flush in a container that would clip
|
|
50
|
+
it (see focusRingFit). The label colour stands out on the part's own fill. */
|
|
51
|
+
:where(.navigation-link:global([data-focus-ring='inset']):focus-visible) {
|
|
52
|
+
outline-color: var(--glass-focus-ring-color, currentColor);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* A page's own :focus-visible rule must not push the ring back out, where
|
|
56
|
+
the container cuts it off. Only the offset outranks it. */
|
|
57
|
+
.navigation-link:global([data-focus-ring='inset']):where(:focus-visible) {
|
|
58
|
+
outline-offset: calc(-2 * var(--glass-focus-ring-width, 2px));
|
|
59
|
+
}
|
|
60
|
+
|
|
38
61
|
.navigation-link:hover {
|
|
39
62
|
color: var(--color-text);
|
|
40
63
|
}
|
|
41
64
|
|
|
65
|
+
/* The active link has a fill of its own, as a filled Button does, so its label
|
|
66
|
+
holds 4.5:1 over any page or bar behind it. */
|
|
42
67
|
.navigation-link.active {
|
|
43
|
-
|
|
68
|
+
background: var(--color-accent);
|
|
69
|
+
color: var(--color-on-accent, white);
|
|
70
|
+
transition: color var(--transition-spring), background-color var(--transition-spring);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.navigation-link.active:hover {
|
|
74
|
+
background: var(--color-accent-hover);
|
|
75
|
+
color: var(--color-on-accent, white);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.navigation-link.active:active {
|
|
79
|
+
background: var(--color-accent-active);
|
|
44
80
|
}
|
|
45
81
|
</style>
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
primary: 'var(--color-text)',
|
|
49
49
|
secondary: 'var(--color-text-secondary)',
|
|
50
50
|
tertiary: 'var(--color-text-tertiary)',
|
|
51
|
-
accent: 'var(--color-accent)',
|
|
51
|
+
accent: 'var(--color-accent-text, color-mix(in srgb, var(--color-accent) var(--glass-accent-text-strength, 33%), var(--glass-text-toward, white)))',
|
|
52
52
|
white: '#ffffff',
|
|
53
|
-
danger: 'var(--color-danger, #
|
|
53
|
+
danger: 'var(--color-danger-text, color-mix(in srgb, var(--color-danger, #d23c3c) var(--glass-danger-text-strength, 30%), var(--glass-text-toward, white)))'
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
const alignmentMap = {
|
|
@@ -9,6 +9,13 @@ import { type CornerRadius } from './sizes';
|
|
|
9
9
|
export declare const GLASS_SHAPES: readonly ["rect", "capsule", "circle"];
|
|
10
10
|
export type GlassShape = (typeof GLASS_SHAPES)[number];
|
|
11
11
|
export declare const DEFAULT_GLASS_SHAPE: GlassShape;
|
|
12
|
+
/**
|
|
13
|
+
* Elements that count as a lone text-level label. A `rect` Glass whose only
|
|
14
|
+
* child is one of these is centred like a capsule or circle, while a panel
|
|
15
|
+
* holding a div, a stack or several children keeps its normal flow. The CSS in
|
|
16
|
+
* Glass.svelte and lens.css spells this list out, and a test keeps them equal.
|
|
17
|
+
*/
|
|
18
|
+
export declare const GLASS_LONE_LABEL_ELEMENTS: readonly ["span", "label", "strong", "b", "em", "small", "svg", "img"];
|
|
12
19
|
export interface GlassShapeStyle {
|
|
13
20
|
/** CSS border-radius value. */
|
|
14
21
|
radius: string;
|
package/dist/constants/shapes.js
CHANGED
|
@@ -8,6 +8,22 @@
|
|
|
8
8
|
import { CORNER_RADIUS } from './sizes';
|
|
9
9
|
export var GLASS_SHAPES = ['rect', 'capsule', 'circle'];
|
|
10
10
|
export var DEFAULT_GLASS_SHAPE = 'rect';
|
|
11
|
+
/**
|
|
12
|
+
* Elements that count as a lone text-level label. A `rect` Glass whose only
|
|
13
|
+
* child is one of these is centred like a capsule or circle, while a panel
|
|
14
|
+
* holding a div, a stack or several children keeps its normal flow. The CSS in
|
|
15
|
+
* Glass.svelte and lens.css spells this list out, and a test keeps them equal.
|
|
16
|
+
*/
|
|
17
|
+
export var GLASS_LONE_LABEL_ELEMENTS = [
|
|
18
|
+
'span',
|
|
19
|
+
'label',
|
|
20
|
+
'strong',
|
|
21
|
+
'b',
|
|
22
|
+
'em',
|
|
23
|
+
'small',
|
|
24
|
+
'svg',
|
|
25
|
+
'img'
|
|
26
|
+
];
|
|
11
27
|
/** Radius used when a caller passes a corner-radius key that is not a token. */
|
|
12
28
|
var FALLBACK_RADIUS = CORNER_RADIUS.lg;
|
|
13
29
|
function rectRadius(cornerRadius) {
|
|
@@ -46,23 +46,53 @@
|
|
|
46
46
|
|
|
47
47
|
/* Sheet chrome */
|
|
48
48
|
--glass-sheet-bg: rgba(28, 28, 30, 0.80);
|
|
49
|
+
--glass-backdrop-blur: 4px;
|
|
50
|
+
|
|
51
|
+
/* Keyboard focus ring, shared by every interactive part. Set
|
|
52
|
+
--glass-focus-ring-color, --glass-focus-ring-width and
|
|
53
|
+
--glass-focus-ring-offset on any element to restyle the rings inside it.
|
|
54
|
+
They are left unset here so a value set anywhere wins in both themes;
|
|
55
|
+
these are the colours used until then.
|
|
56
|
+
The ring has two tones so that it holds 3:1 against any backdrop: the
|
|
57
|
+
outline, and a halo against it on the inside, set with
|
|
58
|
+
--glass-focus-ring-halo-color. Keep the two at least 9:1 apart. */
|
|
59
|
+
--glass-focus-ring-color-default: #9ecbff;
|
|
60
|
+
--glass-focus-ring-halo-color-default: #000000;
|
|
61
|
+
|
|
62
|
+
/* Sheet close button focus ring. The inner ring hugs the button and the
|
|
63
|
+
outer ring sits against the sheet. Override to rebrand.
|
|
64
|
+
--glass-focus-ring-color, when set, replaces the outer tone. */
|
|
65
|
+
--sheet-focus-ring-inner: #ffffff;
|
|
66
|
+
--sheet-focus-ring-outer: #3b8eea;
|
|
49
67
|
|
|
50
68
|
/* ========================================
|
|
51
69
|
Accent system
|
|
52
70
|
======================================== */
|
|
53
71
|
--color-accent: #0071e3;
|
|
54
|
-
--color-accent-hover: color-mix(in srgb, var(--color-accent)
|
|
72
|
+
--color-accent-hover: color-mix(in srgb, var(--color-accent) 92%, black);
|
|
55
73
|
--color-accent-active: color-mix(in srgb, var(--color-accent) 85%, black);
|
|
56
74
|
--color-accent-10: color-mix(in srgb, var(--color-accent) 10%, transparent);
|
|
57
75
|
--color-accent-15: color-mix(in srgb, var(--color-accent) 15%, transparent);
|
|
58
76
|
--color-accent-25: color-mix(in srgb, var(--color-accent) 25%, transparent);
|
|
59
77
|
--color-accent-50: color-mix(in srgb, var(--color-accent) 50%, transparent);
|
|
60
78
|
|
|
61
|
-
/* Semantic danger — adapts to light/dark via color-mix
|
|
62
|
-
|
|
63
|
-
--color-danger
|
|
79
|
+
/* Semantic danger — adapts to light/dark via color-mix. The default is the
|
|
80
|
+
lightest red a white label holds 4.5:1 on. */
|
|
81
|
+
--color-danger: #d23c3c;
|
|
82
|
+
--color-danger-hover: color-mix(in srgb, var(--color-danger) 92%, black);
|
|
64
83
|
--color-danger-active: color-mix(in srgb, var(--color-danger) 85%, black);
|
|
65
84
|
|
|
85
|
+
/* Text in the accent or danger colour, as in an outlined Button or a
|
|
86
|
+
destructive MenuItem, is the colour mixed toward white in the dark theme and
|
|
87
|
+
toward black in the light one, so that it holds 4.5:1 on the theme's own
|
|
88
|
+
surfaces. Each part works it out from its own --color-accent or
|
|
89
|
+
--color-danger. Set --color-accent-text, --color-accent-text-hover or
|
|
90
|
+
--color-danger-text to use a colour of your own instead. */
|
|
91
|
+
--glass-accent-text-strength: 33%;
|
|
92
|
+
--glass-accent-text-strength-hover: 26%;
|
|
93
|
+
--glass-danger-text-strength: 30%;
|
|
94
|
+
--glass-text-toward: white;
|
|
95
|
+
|
|
66
96
|
/* ========================================
|
|
67
97
|
Radius system
|
|
68
98
|
======================================== */
|
|
@@ -99,6 +129,37 @@
|
|
|
99
129
|
/* Typography tokens are defined in styles/typography.css. */
|
|
100
130
|
}
|
|
101
131
|
|
|
132
|
+
/* ========================================
|
|
133
|
+
Shades for a scope with its own colours
|
|
134
|
+
The shades above are worked out on :root, so a wrapper that sets
|
|
135
|
+
--color-accent or --color-danger would inherit the root's. They are worked
|
|
136
|
+
out again for a wrapper that sets either inline, and for one marked
|
|
137
|
+
.glass-accent-scope, which a colour set from a stylesheet needs: CSS cannot
|
|
138
|
+
find it unmarked. :where adds no specificity, so a shade you set wins.
|
|
139
|
+
======================================== */
|
|
140
|
+
:where(.glass-accent-scope) {
|
|
141
|
+
--color-accent-hover: color-mix(in srgb, var(--color-accent) 92%, black);
|
|
142
|
+
--color-accent-active: color-mix(in srgb, var(--color-accent) 85%, black);
|
|
143
|
+
--color-accent-10: color-mix(in srgb, var(--color-accent) 10%, transparent);
|
|
144
|
+
--color-accent-15: color-mix(in srgb, var(--color-accent) 15%, transparent);
|
|
145
|
+
--color-accent-25: color-mix(in srgb, var(--color-accent) 25%, transparent);
|
|
146
|
+
--color-accent-50: color-mix(in srgb, var(--color-accent) 50%, transparent);
|
|
147
|
+
--color-danger-hover: color-mix(in srgb, var(--color-danger) 92%, black);
|
|
148
|
+
--color-danger-active: color-mix(in srgb, var(--color-danger) 85%, black);
|
|
149
|
+
}
|
|
150
|
+
:where([style*='--color-accent:']) {
|
|
151
|
+
--color-accent-hover: color-mix(in srgb, var(--color-accent) 92%, black);
|
|
152
|
+
--color-accent-active: color-mix(in srgb, var(--color-accent) 85%, black);
|
|
153
|
+
--color-accent-10: color-mix(in srgb, var(--color-accent) 10%, transparent);
|
|
154
|
+
--color-accent-15: color-mix(in srgb, var(--color-accent) 15%, transparent);
|
|
155
|
+
--color-accent-25: color-mix(in srgb, var(--color-accent) 25%, transparent);
|
|
156
|
+
--color-accent-50: color-mix(in srgb, var(--color-accent) 50%, transparent);
|
|
157
|
+
}
|
|
158
|
+
:where([style*='--color-danger:']) {
|
|
159
|
+
--color-danger-hover: color-mix(in srgb, var(--color-danger) 92%, black);
|
|
160
|
+
--color-danger-active: color-mix(in srgb, var(--color-danger) 85%, black);
|
|
161
|
+
}
|
|
162
|
+
|
|
102
163
|
/* ========================================
|
|
103
164
|
Light mode overrides
|
|
104
165
|
======================================== */
|
|
@@ -124,6 +185,17 @@
|
|
|
124
185
|
|
|
125
186
|
--glass-nav-bg: rgba(255, 255, 255, 0.85);
|
|
126
187
|
--glass-sheet-bg: rgba(255, 255, 255, 0.88);
|
|
188
|
+
|
|
189
|
+
--glass-accent-text-strength: 72%;
|
|
190
|
+
--glass-accent-text-strength-hover: 62%;
|
|
191
|
+
--glass-danger-text-strength: 78%;
|
|
192
|
+
--glass-text-toward: black;
|
|
193
|
+
|
|
194
|
+
--glass-focus-ring-color-default: #00408a;
|
|
195
|
+
--glass-focus-ring-halo-color-default: #ffffff;
|
|
196
|
+
|
|
197
|
+
--sheet-focus-ring-inner: #000000;
|
|
198
|
+
--sheet-focus-ring-outer: #0071e3;
|
|
127
199
|
}
|
|
128
200
|
|
|
129
201
|
/* ========================================
|
|
@@ -132,30 +204,78 @@
|
|
|
132
204
|
Consumers on Chrome/Firefox can wire matchMedia into data-attrs manually.
|
|
133
205
|
======================================== */
|
|
134
206
|
|
|
135
|
-
|
|
207
|
+
/* More contrast comes before reduced transparency, so that asking for both
|
|
208
|
+
leaves surfaces solid. */
|
|
209
|
+
@media (prefers-contrast: more) {
|
|
136
210
|
:root {
|
|
137
|
-
--glass-
|
|
211
|
+
--glass-border-width: 1.5px;
|
|
212
|
+
--glass-opacity: 0.98;
|
|
213
|
+
}
|
|
214
|
+
/* The light theme block outranks a bare :root, so repeat the opacity. */
|
|
215
|
+
:root[data-theme='light'] {
|
|
216
|
+
--glass-opacity: 0.98;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
:root[data-contrast='more'] {
|
|
220
|
+
--glass-border-width: 1.5px;
|
|
221
|
+
--glass-opacity: 0.98;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
@media (prefers-reduced-transparency: reduce) {
|
|
225
|
+
/* :root:root outranks a page's plain :root values, so see-through sheets and
|
|
226
|
+
bars set that way after this file do not outlive the preference before a
|
|
227
|
+
script has set the attribute. It does not outrank everything: a selector of
|
|
228
|
+
the same weight that comes later, such as :root[data-theme='dark'], or a
|
|
229
|
+
heavier one, still wins. */
|
|
230
|
+
:root:root {
|
|
231
|
+
--glass-opacity: 1;
|
|
138
232
|
--glass-blur: 0px;
|
|
139
233
|
--glass-displacement-scale: 0;
|
|
140
234
|
--glass-saturation: 1;
|
|
235
|
+
--glass-blur-nav: 0px;
|
|
236
|
+
--glass-backdrop-blur: 0px;
|
|
237
|
+
--glass-sheet-bg: rgba(28, 28, 30, 0.98);
|
|
238
|
+
--glass-nav-bg: rgba(0, 0, 0, 0.98);
|
|
239
|
+
}
|
|
240
|
+
/* One :root more than the dark values above, so the light ones win. */
|
|
241
|
+
:root:root[data-theme='light'] {
|
|
242
|
+
--glass-opacity: 1;
|
|
243
|
+
--glass-sheet-bg: rgba(255, 255, 255, 0.98);
|
|
244
|
+
--glass-nav-bg: rgba(255, 255, 255, 0.98);
|
|
141
245
|
}
|
|
142
246
|
}
|
|
143
247
|
:root[data-reduced-transparency='true'] {
|
|
144
|
-
--glass-opacity:
|
|
248
|
+
--glass-opacity: 1;
|
|
145
249
|
--glass-blur: 0px;
|
|
146
250
|
--glass-displacement-scale: 0;
|
|
147
251
|
--glass-saturation: 1;
|
|
252
|
+
--glass-blur-nav: 0px;
|
|
253
|
+
--glass-backdrop-blur: 0px;
|
|
254
|
+
--glass-sheet-bg: rgba(28, 28, 30, 0.98);
|
|
255
|
+
--glass-nav-bg: rgba(0, 0, 0, 0.98);
|
|
256
|
+
}
|
|
257
|
+
/* One more attribute than the light theme block, so it beats it whatever the order. */
|
|
258
|
+
:root[data-reduced-transparency='true'][data-theme='light'] {
|
|
259
|
+
--glass-sheet-bg: rgba(255, 255, 255, 0.98);
|
|
260
|
+
--glass-nav-bg: rgba(255, 255, 255, 0.98);
|
|
148
261
|
}
|
|
149
262
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
263
|
+
/* The attribute on an element inside the page, such as a preview. The surface
|
|
264
|
+
background is repeated because it is otherwise resolved on :root. */
|
|
265
|
+
[data-reduced-transparency='true']:where(:not(:root)) {
|
|
266
|
+
--glass-opacity: 1;
|
|
267
|
+
--glass-surface-bg: rgb(var(--glass-surface-color));
|
|
268
|
+
--glass-blur: 0px;
|
|
269
|
+
--glass-displacement-scale: 0;
|
|
270
|
+
--glass-saturation: 1;
|
|
271
|
+
--glass-blur-nav: 0px;
|
|
272
|
+
--glass-backdrop-blur: 0px;
|
|
273
|
+
--glass-sheet-bg: rgba(28, 28, 30, 0.98);
|
|
274
|
+
--glass-nav-bg: rgba(0, 0, 0, 0.98);
|
|
155
275
|
}
|
|
156
|
-
:root[data-
|
|
157
|
-
--glass-
|
|
158
|
-
--glass-
|
|
276
|
+
:root[data-theme='light'] [data-reduced-transparency='true']:where(:not(:root)) {
|
|
277
|
+
--glass-sheet-bg: rgba(255, 255, 255, 0.98);
|
|
278
|
+
--glass-nav-bg: rgba(255, 255, 255, 0.98);
|
|
159
279
|
}
|
|
160
280
|
|
|
161
281
|
@media (prefers-reduced-motion: reduce) {
|
|
@@ -190,3 +310,11 @@
|
|
|
190
310
|
--glass-blur-nav: 16px;
|
|
191
311
|
}
|
|
192
312
|
}
|
|
313
|
+
|
|
314
|
+
/* The small viewport block above comes later and has the same specificity as the
|
|
315
|
+
reduced transparency media block, so repeat the nav blur reset after it. */
|
|
316
|
+
@media (max-width: 768px) and (prefers-reduced-transparency: reduce) {
|
|
317
|
+
:root:root {
|
|
318
|
+
--glass-blur-nav: 0px;
|
|
319
|
+
}
|
|
320
|
+
}
|
package/dist/styles/lens.css
CHANGED
|
@@ -55,6 +55,47 @@
|
|
|
55
55
|
height: 100%;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
/* Control shapes centre their content on both axes. The surface does the
|
|
59
|
+
* centring rather than a percentage height on .glass-content: WebKit
|
|
60
|
+
* resolves that percentage against the aspect-ratio box without removing the
|
|
61
|
+
* padding, so a circle label sat one padding-width below centre. Kept in step
|
|
62
|
+
* with the scoped rules in Glass.svelte. */
|
|
63
|
+
:where(.glass-surface[data-glass-shape='capsule']),
|
|
64
|
+
:where(.glass-surface[data-glass-shape='circle']) {
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
:where(.glass-surface[data-glass-shape='capsule']) > .glass-content,
|
|
71
|
+
:where(.glass-surface[data-glass-shape='circle']) > .glass-content {
|
|
72
|
+
height: auto;
|
|
73
|
+
min-width: 0;
|
|
74
|
+
max-width: 100%;
|
|
75
|
+
text-align: center;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
:where(.glass-surface[data-glass-shape='circle']) > .glass-content {
|
|
79
|
+
display: flex;
|
|
80
|
+
align-items: center;
|
|
81
|
+
justify-content: center;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* A surface holding one text-level child (GLASS_LONE_LABEL_ELEMENTS) centres
|
|
85
|
+
* it too. Panels, cards and stacks are untouched. */
|
|
86
|
+
:where(.glass-surface:has(> .glass-content > :where(span, label, strong, b, em, small, svg, img):only-child)) {
|
|
87
|
+
display: flex;
|
|
88
|
+
align-items: center;
|
|
89
|
+
justify-content: center;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
:where(.glass-surface:has(> .glass-content > :where(span, label, strong, b, em, small, svg, img):only-child)) > .glass-content {
|
|
93
|
+
height: auto;
|
|
94
|
+
min-width: 0;
|
|
95
|
+
max-width: 100%;
|
|
96
|
+
text-align: center;
|
|
97
|
+
}
|
|
98
|
+
|
|
58
99
|
.glass-content > :where(h1, h2, h3, h4, h5, h6, p, span, label, a, button) {
|
|
59
100
|
font-family: var(--font-system);
|
|
60
101
|
}
|
|
@@ -80,6 +121,42 @@
|
|
|
80
121
|
transform: scale(calc(1 - 0.005 * var(--glass-motion-enabled)));
|
|
81
122
|
}
|
|
82
123
|
|
|
124
|
+
/* Reduced transparency: no blur, no lens and no blended highlight. Glass writes
|
|
125
|
+
its effect values inline, where no token can reach them, so the properties
|
|
126
|
+
that read them are replaced. The tokens make the background solid, and the
|
|
127
|
+
empty ::before layer goes, so contrast checkers can read it.
|
|
128
|
+
:where keeps each rule as specific as the one it replaces. */
|
|
129
|
+
@media (prefers-reduced-transparency: reduce) {
|
|
130
|
+
.glass-surface::before {
|
|
131
|
+
content: none;
|
|
132
|
+
}
|
|
133
|
+
.glass-surface::before {
|
|
134
|
+
backdrop-filter: none;
|
|
135
|
+
-webkit-backdrop-filter: none;
|
|
136
|
+
}
|
|
137
|
+
.glass-surface.has-lensing::before {
|
|
138
|
+
filter: none;
|
|
139
|
+
}
|
|
140
|
+
.glass-surface::after {
|
|
141
|
+
background: none;
|
|
142
|
+
mix-blend-mode: normal;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
:where([data-reduced-transparency='true']) .glass-surface::before {
|
|
146
|
+
content: none;
|
|
147
|
+
}
|
|
148
|
+
:where([data-reduced-transparency='true']) .glass-surface::before {
|
|
149
|
+
backdrop-filter: none;
|
|
150
|
+
-webkit-backdrop-filter: none;
|
|
151
|
+
}
|
|
152
|
+
:where([data-reduced-transparency='true']) .glass-surface.has-lensing::before {
|
|
153
|
+
filter: none;
|
|
154
|
+
}
|
|
155
|
+
:where([data-reduced-transparency='true']) .glass-surface::after {
|
|
156
|
+
background: none;
|
|
157
|
+
mix-blend-mode: normal;
|
|
158
|
+
}
|
|
159
|
+
|
|
83
160
|
.glass-dim-layer {
|
|
84
161
|
position: absolute;
|
|
85
162
|
inset: 0;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "glasslikeui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "Svelte component library with frosted glass materials",
|
|
5
|
-
"license": "
|
|
5
|
+
"license": "MPL-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"svelte": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|