@jungherz-de/glasskit 1.20.0 → 1.21.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/CHANGELOG.md +40 -1
- package/README.md +56 -6
- package/SKILL.md +46 -2
- package/glasskit-styles.js +4 -4
- package/glasskit.css +106 -40
- package/glasskit.min.css +2 -2
- package/glasskit.min.css.map +1 -1
- package/package.json +1 -1
- package/theme-override.css +20 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,44 @@ GlassKit uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## [1.21.0] – 2026-10-05
|
|
11
|
+
|
|
12
|
+
Contributed as pull request [#5](https://github.com/JUNGHERZ/GlassKit/pull/5) by the product that is adopting GlassKit at full depth; GlassKit Elements 1.21.0 follows the attribute.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- **Density tokens for the control sizes, and a compact preset: `data-density="compact"`.** The heights of fields, buttons, toggles, checkboxes, radios, list rows and modal actions were px literals in the component rules, so a denser layout — an admin screen, a desktop form, a narrow column — had to override a dozen selectors and keep the toggle's thumb, its travel and the first-line alignment of the labels in step by hand. They are tokens now, declared next to the spacing tokens with the values GlassKit has always drawn and read with that value as fallback, as `--gl-modal-max-width` is; `data-density="compact"` on `<html>`, next to `data-theme`, swaps in a denser set, at load or at runtime:
|
|
17
|
+
|
|
18
|
+
| Token | Default | Compact |
|
|
19
|
+
|---|---|---|
|
|
20
|
+
| `--gl-control-height` (input, select, search) | `52px` | `40px` |
|
|
21
|
+
| `--gl-control-padding-x` (input, select, textarea) | unset → `var(--gl-space-md)` | `var(--gl-space-sm)` |
|
|
22
|
+
| `--gl-btn-height` / `-sm` / `-lg` | `56px` / `44px` / `64px` | `40px` / `32px` / `48px` |
|
|
23
|
+
| `--gl-textarea-min-height` | `120px` | `88px` |
|
|
24
|
+
| `--gl-list-item-min-height` | `56px` | `48px` |
|
|
25
|
+
| `--gl-list-item-padding-y` | unset → `var(--gl-space-md)` | `10px` |
|
|
26
|
+
| `--gl-toggle-width` × `--gl-toggle-height` | `52px` × `30px` | `44px` × `26px` |
|
|
27
|
+
| `--gl-toggle-thumb-size` | `22px` | `18px` |
|
|
28
|
+
| `--gl-check-size` (checkbox, radio) | `24px` | `20px` |
|
|
29
|
+
| `--gl-modal-action-height` | `52px` | `44px` |
|
|
30
|
+
|
|
31
|
+
Only these tokens change; colours, type and spacing stay, so nothing outside the controls moves. The toggle's thumb sits `(height − thumb) / 2 − 1px` inside the track — 3 px at 52 × 30, where it has always sat — and travels `width − height`, from the right and to the left under `dir="rtl"`; the invisible inputs that lie on top of the controls since 1.20.0 take the same sizes, and the first-line offsets of toggle, checkbox and radio are computed from them. Any value a project sets therefore stays aligned. Two paddings join the heights because the heights alone would not have shown: a list row's 16 px top and bottom padding already makes a plain row 50 px tall, so a 48 px minimum needs `--gl-list-item-padding-y`; and a 40 px field reads better with 12 px inside (`--gl-control-padding-x`, which the textarea follows too, so stacked fields keep one text edge). Both are left unset by default, like `--gl-toast-top`: the rules fall back to `--gl-space-md` as before, so a spacing override still reaches them wherever it is declared. The select keeps its padding pair under `:dir(rtl)`: the token takes the text side, left to right on the left and right to left on the right, and the chevron's room stays with the chevron. The chevron, the search icon and the check and radio glyphs keep their sizes.
|
|
32
|
+
|
|
33
|
+
The preset is a bare attribute selector, like `[data-theme="light"]`, placed after the theme blocks, and the build puts it into `tokensCss` / `tokensSheet` with them. GlassKit Elements adopts only `componentsSheet` in its shadow roots and places the tokens on the document, so the compact values reach every element by inheritance — and so does a project's own `[data-density="compact"] { --gl-btn-height: 36px; }`, which a preset inside `componentsSheet` would have overridden in every shadow root. A `glassSheet` consumer whose shadow root holds an element with `data-theme` has to mirror `data-density` onto it as well, as GlassKit Elements does with its theme wrapper.
|
|
34
|
+
|
|
35
|
+
Measured in Chromium and WebKit (Playwright 1.63) against 1.20.0: without the attribute every one of these controls has the same size, padding, thumb position, input box, label offset and first-line centre as before, left to right and right to left, and full-page screenshots — a test page in both themes, this repository's index, showcase and docs in English and German — are pixel-identical, apart from regions that also differ between two renders of 1.20.0. With `data-density="compact"` on `<html>`, at load and switched at runtime: input, select and search 40 px with 12 px inner padding, buttons 40 / 32 / 48 px, the textarea 88 px, list rows 48 px with or without a 28 px icon (about 56 px with title and subtitle), the toggle 44 × 26 px with an 18 px thumb and the same gap at either end in both directions, checkbox and radio 20 px with their inputs on top, modal actions 44 px, every label still centred on its first line; under `dir="rtl"` the select's 12 px move to the right with the chevron on the left. Removing the attribute restores every value.
|
|
36
|
+
|
|
37
|
+
### Changed
|
|
38
|
+
|
|
39
|
+
- `build-styles-js.mjs` splits three token blocks off instead of two — `:root, [data-theme="dark"]`, `[data-theme="light"]` and `[data-density="compact"]` — and fails if `tokensCss` lacks the preset or `componentsCss` declares a density token.
|
|
40
|
+
|
|
41
|
+
### Compatibility
|
|
42
|
+
|
|
43
|
+
- Without `data-density` nothing changes, and a stylesheet that lacks the new tokens — an older `tokensCss` next to this `componentsSheet` — gets the old sizes from the fallbacks.
|
|
44
|
+
- Like every token of the dark block, the size defaults are declared again by an element below `<html>` that carries `data-theme="dark"`; keep `data-density` on `<html>`, next to `data-theme`.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
10
48
|
## [1.20.0] – 2026-10-05
|
|
11
49
|
|
|
12
50
|
The first batch of findings filed as GitHub issues, from a product that is adopting GlassKit at full depth; GlassKit Elements 1.20.0 ships the matching element changes.
|
|
@@ -974,6 +1012,7 @@ during development. Version 1.3 is the first public open-source release.
|
|
|
974
1012
|
|
|
975
1013
|
---
|
|
976
1014
|
|
|
1015
|
+
[1.21.0]: https://github.com/JUNGHERZ/GlassKit/releases/tag/v1.21.0
|
|
977
1016
|
[1.20.0]: https://github.com/JUNGHERZ/GlassKit/releases/tag/v1.20.0
|
|
978
1017
|
[1.19.1]: https://github.com/JUNGHERZ/GlassKit/releases/tag/v1.19.1
|
|
979
1018
|
[1.19.0]: https://github.com/JUNGHERZ/GlassKit/releases/tag/v1.19.0
|
|
@@ -1002,4 +1041,4 @@ during development. Version 1.3 is the first public open-source release.
|
|
|
1002
1041
|
[1.3.2]: https://github.com/JUNGHERZ/GlassKit/releases/tag/v1.3.2
|
|
1003
1042
|
[1.3.1]: https://github.com/JUNGHERZ/GlassKit/releases/tag/v1.3.1
|
|
1004
1043
|
[1.3.0]: https://github.com/JUNGHERZ/GlassKit/releases/tag/v1.3.0
|
|
1005
|
-
[Unreleased]: https://github.com/JUNGHERZ/GlassKit/compare/v1.
|
|
1044
|
+
[Unreleased]: https://github.com/JUNGHERZ/GlassKit/compare/v1.21.0...HEAD
|
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="https://img.shields.io/badge/version-1.
|
|
2
|
+
<img src="https://img.shields.io/badge/version-1.21.0-orange?style=flat-square" alt="Version">
|
|
3
3
|
<img src="https://img.shields.io/badge/CSS-only-blue?style=flat-square" alt="CSS only">
|
|
4
4
|
<img src="https://img.shields.io/badge/components-34-green?style=flat-square" alt="Components">
|
|
5
5
|
<img src="https://img.shields.io/badge/license-MIT-lightgrey?style=flat-square" alt="License">
|
|
6
|
-
<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/changelog-v1.
|
|
6
|
+
<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/changelog-v1.21.0-f5a623?style=flat-square" alt="Changelog"></a>
|
|
7
7
|
<a href="https://www.npmjs.com/package/@jungherz-de/glasskit"><img src="https://img.shields.io/npm/v/@jungherz-de/glasskit?style=flat-square&color=cb3837&label=npm" alt="npm"></a>
|
|
8
8
|
<a href="https://cdn.jsdelivr.net/npm/@jungherz-de/glasskit/"><img src="https://img.shields.io/badge/CDN-jsDelivr-blue?style=flat-square" alt="jsDelivr"></a>
|
|
9
9
|
</p>
|
|
@@ -72,16 +72,16 @@ No download, no build tool – just include and go:
|
|
|
72
72
|
|
|
73
73
|
```html
|
|
74
74
|
<!-- jsDelivr – Minified -->
|
|
75
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/glasskit@1.
|
|
75
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/glasskit@1.21/glasskit.min.css">
|
|
76
76
|
|
|
77
77
|
<!-- jsDelivr – Unminified (for reading/debugging) -->
|
|
78
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/glasskit@1.
|
|
78
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/glasskit@1.21/glasskit.css">
|
|
79
79
|
|
|
80
80
|
<!-- unpkg – Alternative -->
|
|
81
|
-
<link rel="stylesheet" href="https://unpkg.com/@jungherz-de/glasskit@1.
|
|
81
|
+
<link rel="stylesheet" href="https://unpkg.com/@jungherz-de/glasskit@1.21/glasskit.min.css">
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
-
> **Tip:** Replace `@1.
|
|
84
|
+
> **Tip:** Replace `@1.21` with `@latest` for the newest version – or pin to a specific version for maximum stability.
|
|
85
85
|
|
|
86
86
|
### npm / yarn / pnpm
|
|
87
87
|
|
|
@@ -280,6 +280,44 @@ The `theme-override.css` template comes with **4 example themes**:
|
|
|
280
280
|
- 🌹 Rose
|
|
281
281
|
- 🎨 Custom (empty, ready to fill)
|
|
282
282
|
|
|
283
|
+
### Density
|
|
284
|
+
|
|
285
|
+
Admin screens, desktop layouts and narrow forms want denser controls. Set `data-density="compact"` on `<html>`, next to `data-theme`:
|
|
286
|
+
|
|
287
|
+
```html
|
|
288
|
+
<html data-theme="dark" data-density="compact">
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
```js
|
|
292
|
+
// Switch at runtime
|
|
293
|
+
document.documentElement.setAttribute('data-density', 'compact');
|
|
294
|
+
document.documentElement.removeAttribute('data-density'); // back to the default
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
Since **1.21.0** the control sizes are tokens, and the attribute swaps in a denser set. Without it every control keeps the size it has always had. Colours, type and spacing stay as they are, so nothing outside the controls moves:
|
|
298
|
+
|
|
299
|
+
| Token | Default | Compact |
|
|
300
|
+
|---|---|---|
|
|
301
|
+
| `--gl-control-height` (input, select, search) | `52px` | `40px` |
|
|
302
|
+
| `--gl-control-padding-x` (input, select, textarea) | unset → `var(--gl-space-md)` | `var(--gl-space-sm)` |
|
|
303
|
+
| `--gl-btn-height` / `-sm` / `-lg` | `56px` / `44px` / `64px` | `40px` / `32px` / `48px` |
|
|
304
|
+
| `--gl-textarea-min-height` | `120px` | `88px` |
|
|
305
|
+
| `--gl-list-item-min-height` | `56px` | `48px` |
|
|
306
|
+
| `--gl-list-item-padding-y` | unset → `var(--gl-space-md)` | `10px` |
|
|
307
|
+
| `--gl-toggle-width` × `--gl-toggle-height` | `52px` × `30px` | `44px` × `26px` |
|
|
308
|
+
| `--gl-toggle-thumb-size` | `22px` | `18px` |
|
|
309
|
+
| `--gl-check-size` (checkbox, radio) | `24px` | `20px` |
|
|
310
|
+
| `--gl-modal-action-height` | `52px` | `44px` |
|
|
311
|
+
|
|
312
|
+
Every token can also be set on its own, for one density or both — the toggle's thumb and the first-line alignment of toggle, checkbox and radio follow whatever size you give:
|
|
313
|
+
|
|
314
|
+
```css
|
|
315
|
+
:root { --gl-btn-height: 48px; } /* default density */
|
|
316
|
+
[data-density='compact'] { --gl-btn-height: 36px; } /* compact only */
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
Like `data-theme`, keep `data-density` on `<html>`: an element further down that carries `data-theme="dark"` re-declares the dark block, the default sizes included.
|
|
320
|
+
|
|
283
321
|
---
|
|
284
322
|
|
|
285
323
|
## 🎛️ Design Tokens
|
|
@@ -308,6 +346,12 @@ All visual values are controlled via CSS Custom Properties:
|
|
|
308
346
|
/* Spacing */
|
|
309
347
|
--gl-space-xs … --gl-space-4xl
|
|
310
348
|
|
|
349
|
+
/* Density – control sizes, denser with data-density="compact" */
|
|
350
|
+
--gl-control-height /* 52px – input, select */
|
|
351
|
+
--gl-btn-height /* 56px; -sm 44px, -lg 64px */
|
|
352
|
+
--gl-check-size /* 24px – checkbox, radio */
|
|
353
|
+
--gl-toggle-width … --gl-modal-action-height
|
|
354
|
+
|
|
311
355
|
/* Shadows & Insets */
|
|
312
356
|
--gl-shadow-card
|
|
313
357
|
--gl-inset-strong
|
|
@@ -437,6 +481,8 @@ Since CSS Custom Properties penetrate the shadow boundary, **theme switching wor
|
|
|
437
481
|
document.documentElement.setAttribute('data-theme', 'light');
|
|
438
482
|
```
|
|
439
483
|
|
|
484
|
+
`data-density="compact"` reaches the shadow roots the same way: the preset only sets tokens, and tokens cross the shadow boundary by inheritance.
|
|
485
|
+
|
|
440
486
|
> **Tip:** For maximum performance with many component instances, import `glassSheet` once and share it across all components. The browser keeps the stylesheet in memory only once.
|
|
441
487
|
|
|
442
488
|
---
|
|
@@ -547,6 +593,10 @@ A few refinements arrive later and fall back quietly where they are missing:
|
|
|
547
593
|
## 📋 States & Modifiers – Cheat Sheet
|
|
548
594
|
|
|
549
595
|
```
|
|
596
|
+
Page Attributes (on <html>):
|
|
597
|
+
data-theme="dark" / "light"
|
|
598
|
+
data-density="compact" (denser controls)
|
|
599
|
+
|
|
550
600
|
Interactive States:
|
|
551
601
|
.is-active → Tab Bar item, Modal Overlay
|
|
552
602
|
.is-open → Accordion item, Popover
|
package/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: glasskit-css
|
|
3
|
-
description: GlassKit is a pure CSS glassmorphism component library (v1.
|
|
3
|
+
description: GlassKit is a pure CSS glassmorphism component library (v1.21.0) with 34 components, Dark & Light mode, design tokens, and BEM-like naming. Use this reference whenever generating HTML that uses GlassKit classes to ensure correct structure, nesting, modifiers, and token usage.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# GlassKit CSS – AI Component Reference
|
|
@@ -89,6 +89,16 @@ and prose mirror. Pairs that must move together — the select's chevron and its
|
|
|
89
89
|
toggle's thumb and its travel, the progress fill's gradient — are under `:dir(rtl)`
|
|
90
90
|
(Chrome 120+); an older browser keeps them left to right rather than splitting them.
|
|
91
91
|
|
|
92
|
+
### Density
|
|
93
|
+
|
|
94
|
+
Denser controls for admin screens, desktop layouts and narrow forms: `data-density="compact"` on `<html>`, next to `data-theme` (since 1.21.0).
|
|
95
|
+
|
|
96
|
+
```html
|
|
97
|
+
<html data-theme="dark" data-density="compact">
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Fields and buttons are 40px high instead of 52 and 56px; toggles, checkboxes, radios, list rows and modal actions shrink with them. Colours, type and spacing stay. Without the attribute nothing changes; `removeAttribute('data-density')` switches back at runtime. The values are the density tokens in section 2 — never shrink controls by overriding their `height`. It combines with `dir="rtl"`: the toggle's thumb and the select's padding mirror at either density.
|
|
101
|
+
|
|
92
102
|
---
|
|
93
103
|
|
|
94
104
|
## 2. Design Tokens
|
|
@@ -215,6 +225,28 @@ fully-translucent pre-1.7.0 chip.
|
|
|
215
225
|
| `--gl-space-3xl` | `40px` |
|
|
216
226
|
| `--gl-space-4xl` | `56px` |
|
|
217
227
|
|
|
228
|
+
### Density (since 1.21.0)
|
|
229
|
+
|
|
230
|
+
The control sizes. `data-density="compact"` on `<html>` switches to the second value column.
|
|
231
|
+
|
|
232
|
+
| Token | Default | Compact | Used by |
|
|
233
|
+
|---|---|---|---|
|
|
234
|
+
| `--gl-control-height` | `52px` | `40px` | `.glass-input`, `.glass-select` (and the search field) |
|
|
235
|
+
| `--gl-control-padding-x` | unset → `var(--gl-space-md)` | `var(--gl-space-sm)` | Inner left/right padding of input, select, textarea |
|
|
236
|
+
| `--gl-btn-height` | `56px` | `40px` | `.glass-btn` |
|
|
237
|
+
| `--gl-btn-height-sm` | `44px` | `32px` | `.glass-btn--sm` |
|
|
238
|
+
| `--gl-btn-height-lg` | `64px` | `48px` | `.glass-btn--lg` |
|
|
239
|
+
| `--gl-textarea-min-height` | `120px` | `88px` | `.glass-textarea` |
|
|
240
|
+
| `--gl-list-item-min-height` | `56px` | `48px` | `.glass-list__item` |
|
|
241
|
+
| `--gl-list-item-padding-y` | unset → `var(--gl-space-md)` | `10px` | `.glass-list__item`, top and bottom |
|
|
242
|
+
| `--gl-toggle-width` | `52px` | `44px` | `.glass-toggle__track` |
|
|
243
|
+
| `--gl-toggle-height` | `30px` | `26px` | `.glass-toggle__track` |
|
|
244
|
+
| `--gl-toggle-thumb-size` | `22px` | `18px` | `.glass-toggle__thumb` |
|
|
245
|
+
| `--gl-check-size` | `24px` | `20px` | `.glass-checkbox__box`, `.glass-radio__circle` |
|
|
246
|
+
| `--gl-modal-action-height` | `52px` | `44px` | `.glass-modal__action` |
|
|
247
|
+
|
|
248
|
+
The rules read each size with its default as fallback, like `--gl-modal-max-width`. The toggle's thumb inset and travel (in both directions) and the first-line alignment of toggle, checkbox and radio are derived from these, so any value stays aligned. The two paddings are unset by default and fall back to `--gl-space-md`, so a spacing override still reaches them. Set any token on `:root` for both densities, or on `[data-density="compact"]` for compact only.
|
|
249
|
+
|
|
218
250
|
### Shadows
|
|
219
251
|
|
|
220
252
|
| Token | Usage |
|
|
@@ -478,6 +510,8 @@ Full-width buttons (56px height) with three variants and size modifiers.
|
|
|
478
510
|
|
|
479
511
|
**Important:** Buttons default to `width: 100%`. Use `--auto` for inline/auto-width buttons.
|
|
480
512
|
|
|
513
|
+
**Heights** are density tokens: `--gl-btn-height`, `-sm`, `-lg` — 56 / 44 / 64px, or 40 / 32 / 48px with `data-density="compact"` on `<html>` (since 1.21.0).
|
|
514
|
+
|
|
481
515
|
**Icons:** Button SVGs need **no inline `fill`/`stroke` attributes** – GlassKit styles them automatically: outline style (`fill: none; stroke: currentColor; stroke-width: 2`, round caps/joins) as the default, `--secondary`/`--tertiary` use their icon tokens, `--primary` renders icons filled. For deliberately filled icons (e.g. brand logos like the GitHub mark) add `glass-icon--fill` to the `<svg>`.
|
|
482
516
|
|
|
483
517
|
**Links as buttons:** `.glass-btn` also works on `<a>` elements – anchors render as `inline-flex` with `text-decoration: none`, so `--auto` shrink-wraps exactly like on a real `<button>`.
|
|
@@ -1884,6 +1918,7 @@ Key points in this composition:
|
|
|
1884
1918
|
7. **`data-theme`** – Always set on `<html>`, never on `<body>` or deeper elements.
|
|
1885
1919
|
8. **List dividers are automatic** – Never add a `<hr>` or divider element between `.glass-list__item`s. The divider is rendered via `::after` and respects `:has(.glass-list__leading)` for the inset.
|
|
1886
1920
|
9. **Popover toggle naming** – Never name your popover toggle JS function `togglePopover`. It collides with the native `HTMLElement.togglePopover()` method. Use a prefix like `gkTogglePopover`.
|
|
1921
|
+
10. **`data-density`** – Like `data-theme`, on `<html>`: `compact` or absent. For a denser UI set the attribute or a density token, never `height` on the components.
|
|
1887
1922
|
|
|
1888
1923
|
### ❌ Common Mistakes
|
|
1889
1924
|
|
|
@@ -1900,6 +1935,7 @@ Key points in this composition:
|
|
|
1900
1935
|
| Putting `glass-list` inside `glass-popover` without `--bare` | Add `.glass-list--bare` to strip the double glass surface |
|
|
1901
1936
|
| JS function named `togglePopover()` | Rename to `gkTogglePopover()` or similar to avoid native API clash |
|
|
1902
1937
|
| Putting `.is-open` on the trigger button instead of `.glass-popover` | The state class belongs on the popover element |
|
|
1938
|
+
| Overriding `height` of `.glass-btn`, `.glass-input` etc. for a denser UI | `data-density="compact"` on `<html>`, or set a density token — toggle thumb and label alignment follow the tokens, not a hand-set `height` |
|
|
1903
1939
|
|
|
1904
1940
|
---
|
|
1905
1941
|
|
|
@@ -1977,7 +2013,7 @@ customElements.define('my-card', MyCard);
|
|
|
1977
2013
|
| `css` | `string` | The same, as a string |
|
|
1978
2014
|
| `componentsSheet` | `CSSStyleSheet` | Component rules only, no token declarations (since 1.9.0) |
|
|
1979
2015
|
| `componentsCss` | `string` | The same, as a string |
|
|
1980
|
-
| `tokensSheet` | `CSSStyleSheet` | Only the two `[data-theme]` blocks
|
|
2016
|
+
| `tokensSheet` | `CSSStyleSheet` | Only the blocks that declare `--gl-*`: the two `[data-theme]` blocks (since 1.9.0) and the `[data-density="compact"]` preset (since 1.21.0) |
|
|
1981
2017
|
| `tokensCss` | `string` | The same, as a string |
|
|
1982
2018
|
|
|
1983
2019
|
CSS Custom Properties (`--gl-*`) cross the shadow boundary by inheritance, so the example
|
|
@@ -1988,6 +2024,7 @@ above picks up whatever the document defines and theme switching works globally.
|
|
|
1988
2024
|
> element carrying `data-theme`, that selector matches it and re-declares every token
|
|
1989
2025
|
> locally — and a matching rule always beats an inherited value. A project's
|
|
1990
2026
|
> `:root { --gl-color-primary: … }` then silently stops arriving inside your component.
|
|
2027
|
+
> The dark block declares the default control sizes too, so `<html data-density="compact">` stops arriving as well — unless that element carries `data-density` mirrored from `<html>`, which lets the compact preset (also in the full sheet) match it.
|
|
1991
2028
|
>
|
|
1992
2029
|
> If you need a themed element inside the shadow root, adopt `componentsSheet` instead
|
|
1993
2030
|
> and make sure the tokens are present on the document:
|
|
@@ -2060,6 +2097,13 @@ Overriding `--gl-color-success` / `--gl-color-error` is enough on its own: fill,
|
|
|
2060
2097
|
text and glow of every state component are derived from those tokens. Only if you want
|
|
2061
2098
|
a different ink than the derived one do you need to touch `--gl-color-{state}-on-surface`.
|
|
2062
2099
|
|
|
2100
|
+
The density tokens (section 2) are overridden the same way, for both densities or for compact only:
|
|
2101
|
+
|
|
2102
|
+
```css
|
|
2103
|
+
:root { --gl-btn-height: 48px; }
|
|
2104
|
+
[data-density='compact'] { --gl-btn-height: 36px; }
|
|
2105
|
+
```
|
|
2106
|
+
|
|
2063
2107
|
Included theme templates in `theme-override.css`:
|
|
2064
2108
|
- 🔵 Ocean Blue
|
|
2065
2109
|
- 🟢 Emerald Green
|