@jungherz-de/glasskit 1.20.0 → 1.21.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.
- package/CHANGELOG.md +53 -1
- package/README.md +74 -6
- package/SKILL.md +64 -2
- package/glasskit-styles.js +4 -4
- package/glasskit.css +139 -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,56 @@ GlassKit uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## [1.21.1] – 2026-10-05
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- **Printed pages keep the state of checkboxes, radios, toggles, progress bars and steps.** Print dialogs leave out background graphics by default, and these states were drawn with a background only: the checked box with its white tick, the chosen radio and its dot, the toggle's on track, the progress fill, the current step's circle. On paper a checked box printed like an empty one, told apart only by a faint orange ring, and the progress bar printed empty. The parts that carry the state now print as on screen (`print-color-adjust: exact`, in both spellings, inside `@media print`); everything else keeps the economical print mode. Beyond the issue, the same holds for the slider thumb, for the chosen day of date strip and calendar — which printed paler than the other days — and for the tone dots of calendar, date strip and segmented control, which did not print at all. Whole day buttons and step numbers are not included, only the chosen and the current ones: the setting also stops the browser from darkening light text for paper, which keeps the other days readable on a dark page. Measured in Chromium with `page.pdf()` without background graphics, counting the inked pixels inside each indicator, on / off: toggle 231 / 222 → 1025 / 226, checkbox 87 / 79 → 511 / 79, radio 75 / 67 → 383 / 67; the chosen calendar day 28 → 1632 against 63 for another day; progress fill, marks and dots from nothing to printed. On screen nothing changes — docs and showcase render pixel-identical in Chromium and WebKit. WebKit cannot print to PDF under Playwright; Safari reads the same properties. ([#6](https://github.com/JUNGHERZ/GlassKit/issues/6))
|
|
15
|
+
|
|
16
|
+
### Documentation
|
|
17
|
+
|
|
18
|
+
- README, SKILL.md and the docs (English and German) describe printing, with a `beforeprint` / `afterprint` snippet that prints a dark page in the light theme — it keeps its light text and surfaces otherwise, on white paper.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## [1.21.0] – 2026-10-05
|
|
23
|
+
|
|
24
|
+
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.
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
|
|
28
|
+
- **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:
|
|
29
|
+
|
|
30
|
+
| Token | Default | Compact |
|
|
31
|
+
|---|---|---|
|
|
32
|
+
| `--gl-control-height` (input, select, search) | `52px` | `40px` |
|
|
33
|
+
| `--gl-control-padding-x` (input, select, textarea) | unset → `var(--gl-space-md)` | `var(--gl-space-sm)` |
|
|
34
|
+
| `--gl-btn-height` / `-sm` / `-lg` | `56px` / `44px` / `64px` | `40px` / `32px` / `48px` |
|
|
35
|
+
| `--gl-textarea-min-height` | `120px` | `88px` |
|
|
36
|
+
| `--gl-list-item-min-height` | `56px` | `48px` |
|
|
37
|
+
| `--gl-list-item-padding-y` | unset → `var(--gl-space-md)` | `10px` |
|
|
38
|
+
| `--gl-toggle-width` × `--gl-toggle-height` | `52px` × `30px` | `44px` × `26px` |
|
|
39
|
+
| `--gl-toggle-thumb-size` | `22px` | `18px` |
|
|
40
|
+
| `--gl-check-size` (checkbox, radio) | `24px` | `20px` |
|
|
41
|
+
| `--gl-modal-action-height` | `52px` | `44px` |
|
|
42
|
+
|
|
43
|
+
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.
|
|
44
|
+
|
|
45
|
+
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.
|
|
46
|
+
|
|
47
|
+
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.
|
|
48
|
+
|
|
49
|
+
### Changed
|
|
50
|
+
|
|
51
|
+
- `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.
|
|
52
|
+
|
|
53
|
+
### Compatibility
|
|
54
|
+
|
|
55
|
+
- 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.
|
|
56
|
+
- 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`.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
10
60
|
## [1.20.0] – 2026-10-05
|
|
11
61
|
|
|
12
62
|
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 +1024,8 @@ during development. Version 1.3 is the first public open-source release.
|
|
|
974
1024
|
|
|
975
1025
|
---
|
|
976
1026
|
|
|
1027
|
+
[1.21.1]: https://github.com/JUNGHERZ/GlassKit/releases/tag/v1.21.1
|
|
1028
|
+
[1.21.0]: https://github.com/JUNGHERZ/GlassKit/releases/tag/v1.21.0
|
|
977
1029
|
[1.20.0]: https://github.com/JUNGHERZ/GlassKit/releases/tag/v1.20.0
|
|
978
1030
|
[1.19.1]: https://github.com/JUNGHERZ/GlassKit/releases/tag/v1.19.1
|
|
979
1031
|
[1.19.0]: https://github.com/JUNGHERZ/GlassKit/releases/tag/v1.19.0
|
|
@@ -1002,4 +1054,4 @@ during development. Version 1.3 is the first public open-source release.
|
|
|
1002
1054
|
[1.3.2]: https://github.com/JUNGHERZ/GlassKit/releases/tag/v1.3.2
|
|
1003
1055
|
[1.3.1]: https://github.com/JUNGHERZ/GlassKit/releases/tag/v1.3.1
|
|
1004
1056
|
[1.3.0]: https://github.com/JUNGHERZ/GlassKit/releases/tag/v1.3.0
|
|
1005
|
-
[Unreleased]: https://github.com/JUNGHERZ/GlassKit/compare/v1.
|
|
1057
|
+
[Unreleased]: https://github.com/JUNGHERZ/GlassKit/compare/v1.21.1...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.1-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.1-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,62 @@ 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
|
+
|
|
321
|
+
### Printing
|
|
322
|
+
|
|
323
|
+
Print dialogs leave out background graphics by default, and some states are drawn with a background only. Since **1.21.1** those parts keep their colours on paper — the checked box and its tick, the chosen radio, the toggle's track, the progress fill, the current step, the chosen day of date strip and calendar, the slider thumb and the tone dots — while the rest of the page prints economically. Nothing to set.
|
|
324
|
+
|
|
325
|
+
A dark page prints its light text and surfaces on white paper. A page meant for printing switches to the light theme for it:
|
|
326
|
+
|
|
327
|
+
```js
|
|
328
|
+
let printTheme = null;
|
|
329
|
+
addEventListener('beforeprint', () => {
|
|
330
|
+
printTheme = document.documentElement.getAttribute('data-theme');
|
|
331
|
+
document.documentElement.setAttribute('data-theme', 'light');
|
|
332
|
+
});
|
|
333
|
+
addEventListener('afterprint', () => {
|
|
334
|
+
if (printTheme) document.documentElement.setAttribute('data-theme', printTheme);
|
|
335
|
+
else document.documentElement.removeAttribute('data-theme');
|
|
336
|
+
});
|
|
337
|
+
```
|
|
338
|
+
|
|
283
339
|
---
|
|
284
340
|
|
|
285
341
|
## 🎛️ Design Tokens
|
|
@@ -308,6 +364,12 @@ All visual values are controlled via CSS Custom Properties:
|
|
|
308
364
|
/* Spacing */
|
|
309
365
|
--gl-space-xs … --gl-space-4xl
|
|
310
366
|
|
|
367
|
+
/* Density – control sizes, denser with data-density="compact" */
|
|
368
|
+
--gl-control-height /* 52px – input, select */
|
|
369
|
+
--gl-btn-height /* 56px; -sm 44px, -lg 64px */
|
|
370
|
+
--gl-check-size /* 24px – checkbox, radio */
|
|
371
|
+
--gl-toggle-width … --gl-modal-action-height
|
|
372
|
+
|
|
311
373
|
/* Shadows & Insets */
|
|
312
374
|
--gl-shadow-card
|
|
313
375
|
--gl-inset-strong
|
|
@@ -437,6 +499,8 @@ Since CSS Custom Properties penetrate the shadow boundary, **theme switching wor
|
|
|
437
499
|
document.documentElement.setAttribute('data-theme', 'light');
|
|
438
500
|
```
|
|
439
501
|
|
|
502
|
+
`data-density="compact"` reaches the shadow roots the same way: the preset only sets tokens, and tokens cross the shadow boundary by inheritance.
|
|
503
|
+
|
|
440
504
|
> **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
505
|
|
|
442
506
|
---
|
|
@@ -547,6 +611,10 @@ A few refinements arrive later and fall back quietly where they are missing:
|
|
|
547
611
|
## 📋 States & Modifiers – Cheat Sheet
|
|
548
612
|
|
|
549
613
|
```
|
|
614
|
+
Page Attributes (on <html>):
|
|
615
|
+
data-theme="dark" / "light"
|
|
616
|
+
data-density="compact" (denser controls)
|
|
617
|
+
|
|
550
618
|
Interactive States:
|
|
551
619
|
.is-active → Tab Bar item, Modal Overlay
|
|
552
620
|
.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.1) 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,34 @@ 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
|
+
|
|
102
|
+
### Printing (since 1.21.1)
|
|
103
|
+
|
|
104
|
+
Print dialogs leave out backgrounds by default. The parts that carry a state keep their colours on paper (`print-color-adjust: exact` inside `@media print`): checkbox box and tick, radio circle and dot, toggle track and thumb, progress fill, the current step, the chosen day of date strip and calendar, the slider thumb, the tone dots. Everything else prints economically. Nothing to set — do not add your own `print-color-adjust` to whole components: it also stops the browser from darkening light text for paper.
|
|
105
|
+
|
|
106
|
+
A dark page prints light text and surfaces on white paper. For pages meant to be printed, switch to the light theme around printing:
|
|
107
|
+
|
|
108
|
+
```js
|
|
109
|
+
let printTheme = null;
|
|
110
|
+
addEventListener('beforeprint', () => {
|
|
111
|
+
printTheme = document.documentElement.getAttribute('data-theme');
|
|
112
|
+
document.documentElement.setAttribute('data-theme', 'light');
|
|
113
|
+
});
|
|
114
|
+
addEventListener('afterprint', () => {
|
|
115
|
+
if (printTheme) document.documentElement.setAttribute('data-theme', printTheme);
|
|
116
|
+
else document.documentElement.removeAttribute('data-theme');
|
|
117
|
+
});
|
|
118
|
+
```
|
|
119
|
+
|
|
92
120
|
---
|
|
93
121
|
|
|
94
122
|
## 2. Design Tokens
|
|
@@ -215,6 +243,28 @@ fully-translucent pre-1.7.0 chip.
|
|
|
215
243
|
| `--gl-space-3xl` | `40px` |
|
|
216
244
|
| `--gl-space-4xl` | `56px` |
|
|
217
245
|
|
|
246
|
+
### Density (since 1.21.0)
|
|
247
|
+
|
|
248
|
+
The control sizes. `data-density="compact"` on `<html>` switches to the second value column.
|
|
249
|
+
|
|
250
|
+
| Token | Default | Compact | Used by |
|
|
251
|
+
|---|---|---|---|
|
|
252
|
+
| `--gl-control-height` | `52px` | `40px` | `.glass-input`, `.glass-select` (and the search field) |
|
|
253
|
+
| `--gl-control-padding-x` | unset → `var(--gl-space-md)` | `var(--gl-space-sm)` | Inner left/right padding of input, select, textarea |
|
|
254
|
+
| `--gl-btn-height` | `56px` | `40px` | `.glass-btn` |
|
|
255
|
+
| `--gl-btn-height-sm` | `44px` | `32px` | `.glass-btn--sm` |
|
|
256
|
+
| `--gl-btn-height-lg` | `64px` | `48px` | `.glass-btn--lg` |
|
|
257
|
+
| `--gl-textarea-min-height` | `120px` | `88px` | `.glass-textarea` |
|
|
258
|
+
| `--gl-list-item-min-height` | `56px` | `48px` | `.glass-list__item` |
|
|
259
|
+
| `--gl-list-item-padding-y` | unset → `var(--gl-space-md)` | `10px` | `.glass-list__item`, top and bottom |
|
|
260
|
+
| `--gl-toggle-width` | `52px` | `44px` | `.glass-toggle__track` |
|
|
261
|
+
| `--gl-toggle-height` | `30px` | `26px` | `.glass-toggle__track` |
|
|
262
|
+
| `--gl-toggle-thumb-size` | `22px` | `18px` | `.glass-toggle__thumb` |
|
|
263
|
+
| `--gl-check-size` | `24px` | `20px` | `.glass-checkbox__box`, `.glass-radio__circle` |
|
|
264
|
+
| `--gl-modal-action-height` | `52px` | `44px` | `.glass-modal__action` |
|
|
265
|
+
|
|
266
|
+
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.
|
|
267
|
+
|
|
218
268
|
### Shadows
|
|
219
269
|
|
|
220
270
|
| Token | Usage |
|
|
@@ -478,6 +528,8 @@ Full-width buttons (56px height) with three variants and size modifiers.
|
|
|
478
528
|
|
|
479
529
|
**Important:** Buttons default to `width: 100%`. Use `--auto` for inline/auto-width buttons.
|
|
480
530
|
|
|
531
|
+
**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).
|
|
532
|
+
|
|
481
533
|
**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
534
|
|
|
483
535
|
**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 +1936,7 @@ Key points in this composition:
|
|
|
1884
1936
|
7. **`data-theme`** – Always set on `<html>`, never on `<body>` or deeper elements.
|
|
1885
1937
|
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
1938
|
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`.
|
|
1939
|
+
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
1940
|
|
|
1888
1941
|
### ❌ Common Mistakes
|
|
1889
1942
|
|
|
@@ -1900,6 +1953,7 @@ Key points in this composition:
|
|
|
1900
1953
|
| Putting `glass-list` inside `glass-popover` without `--bare` | Add `.glass-list--bare` to strip the double glass surface |
|
|
1901
1954
|
| JS function named `togglePopover()` | Rename to `gkTogglePopover()` or similar to avoid native API clash |
|
|
1902
1955
|
| Putting `.is-open` on the trigger button instead of `.glass-popover` | The state class belongs on the popover element |
|
|
1956
|
+
| 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
1957
|
|
|
1904
1958
|
---
|
|
1905
1959
|
|
|
@@ -1977,7 +2031,7 @@ customElements.define('my-card', MyCard);
|
|
|
1977
2031
|
| `css` | `string` | The same, as a string |
|
|
1978
2032
|
| `componentsSheet` | `CSSStyleSheet` | Component rules only, no token declarations (since 1.9.0) |
|
|
1979
2033
|
| `componentsCss` | `string` | The same, as a string |
|
|
1980
|
-
| `tokensSheet` | `CSSStyleSheet` | Only the two `[data-theme]` blocks
|
|
2034
|
+
| `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
2035
|
| `tokensCss` | `string` | The same, as a string |
|
|
1982
2036
|
|
|
1983
2037
|
CSS Custom Properties (`--gl-*`) cross the shadow boundary by inheritance, so the example
|
|
@@ -1988,6 +2042,7 @@ above picks up whatever the document defines and theme switching works globally.
|
|
|
1988
2042
|
> element carrying `data-theme`, that selector matches it and re-declares every token
|
|
1989
2043
|
> locally — and a matching rule always beats an inherited value. A project's
|
|
1990
2044
|
> `:root { --gl-color-primary: … }` then silently stops arriving inside your component.
|
|
2045
|
+
> 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
2046
|
>
|
|
1992
2047
|
> If you need a themed element inside the shadow root, adopt `componentsSheet` instead
|
|
1993
2048
|
> and make sure the tokens are present on the document:
|
|
@@ -2060,6 +2115,13 @@ Overriding `--gl-color-success` / `--gl-color-error` is enough on its own: fill,
|
|
|
2060
2115
|
text and glow of every state component are derived from those tokens. Only if you want
|
|
2061
2116
|
a different ink than the derived one do you need to touch `--gl-color-{state}-on-surface`.
|
|
2062
2117
|
|
|
2118
|
+
The density tokens (section 2) are overridden the same way, for both densities or for compact only:
|
|
2119
|
+
|
|
2120
|
+
```css
|
|
2121
|
+
:root { --gl-btn-height: 48px; }
|
|
2122
|
+
[data-density='compact'] { --gl-btn-height: 36px; }
|
|
2123
|
+
```
|
|
2124
|
+
|
|
2063
2125
|
Included theme templates in `theme-override.css`:
|
|
2064
2126
|
- 🔵 Ocean Blue
|
|
2065
2127
|
- 🟢 Emerald Green
|