@rickycourtes/designrail 0.2.1 → 0.3.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 +103 -0
- package/README.md +146 -34
- package/kit/changes.json +157 -7
- package/kit/parts/base.css +6 -2
- package/kit/parts/button.css +65 -13
- package/kit/parts/card.css +16 -1
- package/kit/parts/dropdown.css +16 -5
- package/kit/parts/field.css +48 -9
- package/kit/parts/pill.css +35 -11
- package/kit/parts/sheet.css +36 -9
- package/kit/parts/toast.css +22 -6
- package/kit/tokens.css +3 -0
- package/package.json +2 -1
- package/rules/DESIGN.md +7 -2
- package/schema.json +21 -2
- package/src/audit.js +76 -31
- package/src/check.js +45 -4
- package/src/cli.js +7 -0
- package/src/contract.js +2 -0
- package/src/css.js +8 -1
- package/src/fix.js +6 -2
- package/src/init.js +26 -5
- package/src/model.js +5 -5
- package/src/project.js +38 -4
- package/src/report.js +2 -2
- package/src/sources.js +7 -1
- package/src/specimens.js +5 -0
- package/src/tokens.js +15 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,109 @@
|
|
|
3
3
|
Every foundation release also has an entry in `kit/changes.json`, which
|
|
4
4
|
`designrail upgrade` reads to move a project forward.
|
|
5
5
|
|
|
6
|
+
## 0.3.0
|
|
7
|
+
|
|
8
|
+
A minor release: a config that turns a rule down now stops `check` and
|
|
9
|
+
`audit`, which a patch must not do.
|
|
10
|
+
|
|
11
|
+
**Rules extend, never override**
|
|
12
|
+
- The base design rules ship in the package and are exported as
|
|
13
|
+
`@rickycourtes/designrail/rules/DESIGN.md`. `init` writes a project
|
|
14
|
+
`DESIGN.md` that starts `Extends @rickycourtes/designrail/rules/DESIGN.md`
|
|
15
|
+
with an empty "Project rules" section, and the `--agents` note says to read
|
|
16
|
+
both.
|
|
17
|
+
- New `check` rule `rules-override` (error): a bullet in the project's
|
|
18
|
+
`DESIGN.md` tagged with a base `{id}`. A project written by an earlier
|
|
19
|
+
`init` holds a copy of the base: run `designrail init --force` or delete
|
|
20
|
+
the copied bullets.
|
|
21
|
+
- `check` and `audit` exit 2 on a config that loosens a foundation rule: a
|
|
22
|
+
`rules` level below its default, `semanticOnly: false`, an
|
|
23
|
+
`allowPrimitives` entry outside the default, or
|
|
24
|
+
`duplicates.minDeclarations` above 3. Raising a level stays allowed.
|
|
25
|
+
|
|
26
|
+
**False hits found on a real app**
|
|
27
|
+
- A quoted name read by script (`getPropertyValue('--x')`, `tok('--x')`)
|
|
28
|
+
counts as a read, so the token is not `unused`.
|
|
29
|
+
- With a token file named for primitives, only its literals (and the
|
|
30
|
+
foundation's) are primitives: a literal in the semantic file that other
|
|
31
|
+
tokens compose is API, not `primitive-direct`.
|
|
32
|
+
- `part-restyle` lets interaction properties through: `cursor`,
|
|
33
|
+
`user-select`, `touch-action`, `-webkit-tap-highlight-color`,
|
|
34
|
+
`-webkit-touch-callout`, `will-change`, `overflow`,
|
|
35
|
+
`overscroll-behavior` and `scroll-*`.
|
|
36
|
+
- `part-restyle` reads only the selector's subject: a part class inside
|
|
37
|
+
`:has()` or `:not()` is a condition, so `.segment:has(> .btn.glass)` no
|
|
38
|
+
longer counts as restyling `.btn`.
|
|
39
|
+
|
|
40
|
+
**Foundation: new knobs, same look**
|
|
41
|
+
- Tokens `--focus-ring` (`2px solid var(--focus)`) and `--focus-glow`
|
|
42
|
+
(`none`) draw `:focus-visible`. Every part honours `.is-hover`,
|
|
43
|
+
`.is-active` and `.is-focus`, so a specimen can pin a state.
|
|
44
|
+
- button: `--btn-pad-x`, `--btn-pad-y`, `--btn-font`, `--btn-lift`,
|
|
45
|
+
`--btn-press`, `--btn-blur`, `--btn-text-wrap`, `--btn-align`
|
|
46
|
+
(justify-content), `--btn-text-align`, `--btn-disabled`, an `aria-busy`
|
|
47
|
+
ring (`--btn-busy-size`, `--btn-busy-w`, `--btn-busy-ring: none` turns it
|
|
48
|
+
off), `--btn-shadow`; `.btn.small`'s hit area: `--btn-hit`, `--btn-hit-area: none` turns it
|
|
49
|
+
off.
|
|
50
|
+
`.btn` sets `appearance: none`, so a `<button>` keeps no browser style.
|
|
51
|
+
The height is a `min-height`, and a disabled button keeps
|
|
52
|
+
`pointer-events`, so `aria-disabled` still takes a click.
|
|
53
|
+
- field: `--input-pad-y`, `--input-pad-x`, `--input-pad-end`,
|
|
54
|
+
`--input-bg-hover`, `--input-bg-focus` (on `:focus-within`),
|
|
55
|
+
`--input-shadow`, `--input-font`, `--input-rim-style`, `--input-align`,
|
|
56
|
+
`--input-gap`; `.field` resets a fieldset and its
|
|
57
|
+
column can shrink; `.check`: `--check-gap`, `--check-pad-y`,
|
|
58
|
+
`--check-fg`, `--check-font`, `--check-line`.
|
|
59
|
+
- card: `--card-blur`, `--card-fg`, `--card-align`, `--card-align-content`,
|
|
60
|
+
`--card-type` (the whole font shorthand). pill: `--pill-pad-y`, `--pill-pad-x`,
|
|
61
|
+
`--pill-radius`, `--pill-font`, `--pill-blur`, `--pill-text-shadow`,
|
|
62
|
+
centred content, no browser border on a
|
|
63
|
+
`button.pill`; `.count`: `--count-bg`,
|
|
64
|
+
`--count-fg`, `--count-font`, `--count-pad-x`, `--count-h`,
|
|
65
|
+
`--count-radius`.
|
|
66
|
+
- dropdown: `--menu-gap`, `--menu-rim`, `--menu-fg`, `--menu-origin`; a
|
|
67
|
+
`[popover]` menu draws no browser rim. toast: `--toast-pad-y`,
|
|
68
|
+
`--toast-pad-start`, `--toast-pad-end`, `--toast-rim`, `--toast-shadow`,
|
|
69
|
+
`--toast-gap`, `--toast-font`, `--toast-type` (the whole font shorthand).
|
|
70
|
+
sheet: `--sheet-rim`, `--sheet-rim-w`,
|
|
71
|
+
`--sheet-shadow`, `--sheet-blur`, `--sheet-fg`, `--sheet-border-w` and
|
|
72
|
+
`--sheet-border-style` (a real border that can be top-only),
|
|
73
|
+
`--sheet-align-content`; the sheet's gap no longer waits for `[open]`; modal sizing applies to
|
|
74
|
+
`dialog.sheet` only, so a docked `.sheet` is placed by its page.
|
|
75
|
+
|
|
76
|
+
## 0.2.2
|
|
77
|
+
|
|
78
|
+
No foundation changes. Five gaps found by auditing a real project:
|
|
79
|
+
|
|
80
|
+
- Exemption comments work. `/* designrail-ignore */` or `/* measured */`
|
|
81
|
+
inside a value now leaves that declaration out of the hardcoded, scale and
|
|
82
|
+
duplicate counts, and out of `fix`. Before, comments were blanked before
|
|
83
|
+
values were read, so the marker was never seen.
|
|
84
|
+
- `audit` groups part families by file. Inside the `parts` folder each file
|
|
85
|
+
is one part, its role taken from the file's name, and a class it defines
|
|
86
|
+
stays that part's wherever else it is styled. So `.field`, `.input`,
|
|
87
|
+
`input` and `textarea` in one `field.css` are one family, and
|
|
88
|
+
`.pf-banner` in `profile.css` is not a toast. Class-name heuristics still
|
|
89
|
+
apply outside `parts`.
|
|
90
|
+
- New config key `specimens` (globs): specimen pages are left out of the
|
|
91
|
+
repeated-markup and part-family checks. `init` sets it when it finds the
|
|
92
|
+
page `designrail specimens` writes, which now carries a
|
|
93
|
+
`<meta name="generator" content="designrail specimens">` tag.
|
|
94
|
+
- Rule blocks whose selectors differ only by vendor pseudo-elements
|
|
95
|
+
(`::-webkit-slider-thumb` and `::-moz-range-thumb`) are no longer
|
|
96
|
+
duplicates or near-duplicates: they can't share one selector list.
|
|
97
|
+
- `fix` keeps its own rules. With `semanticOnly` on it never writes a
|
|
98
|
+
primitive outside token files (`#0e1218` no longer becomes
|
|
99
|
+
`var(--gray-950)`), and a length maps only to a token of the property's
|
|
100
|
+
scale, read from the token's name first (`padding: 44px` no longer becomes
|
|
101
|
+
`var(--control)`). The foundation's palette now counts as primitives, so
|
|
102
|
+
`check` reports reading `--gray-950` directly as `primitive-direct`.
|
|
103
|
+
- Duplicate rule blocks have a floor, as copy-paste detectors have a minimum
|
|
104
|
+
size: identical blocks count from 3 declarations (was 2 outside state
|
|
105
|
+
rules), near pairs when they share 3. Two token reads in common
|
|
106
|
+
(`font-weight: 600; color: var(--text)`) are a type role, not a copy.
|
|
107
|
+
Configurable as `duplicates: { minDeclarations: 3 }`.
|
|
108
|
+
|
|
6
109
|
## 0.2.1
|
|
7
110
|
|
|
8
111
|
No foundation changes.
|
package/README.md
CHANGED
|
@@ -163,11 +163,14 @@ An unknown flag exits with code 2 and an error, rather than being guessed at.
|
|
|
163
163
|
|
|
164
164
|
### `init [dir] [--agents] [--force]`
|
|
165
165
|
|
|
166
|
-
Writes `designrail.config.json` and `DESIGN.md`, the project's design rules
|
|
167
|
-
|
|
166
|
+
Writes `designrail.config.json` and `DESIGN.md`, the project's design rules.
|
|
167
|
+
That `DESIGN.md` starts `Extends @rickycourtes/designrail/rules/DESIGN.md`
|
|
168
|
+
and holds an empty "Project rules" section: the base rules ship in the
|
|
169
|
+
package and the project only appends (see [Design rules](#design-rules)). If the project already has token files
|
|
168
170
|
(stylesheets that are mostly custom properties on `:root`), `init` finds them
|
|
169
171
|
and points `tokens` at them. `parts` is set to `src/ui` when there is a `src/`
|
|
170
|
-
folder, else `ui`.
|
|
172
|
+
folder, else `ui`. A page `designrail specimens` wrote (wherever `--out` put
|
|
173
|
+
it) is listed under `specimens`. When the foundation is installed (or `package.json`
|
|
171
174
|
depends on `designrail`), `init` records its version as `foundation` and
|
|
172
175
|
prints the import lines.
|
|
173
176
|
|
|
@@ -197,16 +200,35 @@ Then the details:
|
|
|
197
200
|
- **Families, weights, shadows, durations, z-index**: every distinct value.
|
|
198
201
|
- **Duplicate rule blocks**: selectors whose declarations are identical (`.card
|
|
199
202
|
≡ .panel`), and pairs that share most of them (60%+), with what differs.
|
|
203
|
+
Like a copy-paste detector's minimum size, a block counts only at
|
|
204
|
+
`duplicates.minDeclarations` (3) declarations, and a near pair only when it
|
|
205
|
+
shares that many: two rules that both read `font-weight: 600; color:
|
|
206
|
+
var(--text)` are a type role, and merging them would couple unrelated parts.
|
|
200
207
|
Near-identical colours count as equal here. Show/hide state rules
|
|
201
|
-
(`display`, `opacity`, `pointer-events`…) are left out
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
208
|
+
(`display`, `opacity`, `pointer-events`…) are left out, and so are rules
|
|
209
|
+
whose selectors differ only by vendor pseudo-elements
|
|
210
|
+
(`::-webkit-slider-thumb` and `::-moz-range-thumb`): they can't share one
|
|
211
|
+
selector list, since a browser drops the whole list over a pseudo-element
|
|
212
|
+
it doesn't know.
|
|
213
|
+
- **Parts drawn more than one way**: parts grouped by role (button, field,
|
|
214
|
+
card, pill, dialog, toast, dropdown) and by family.
|
|
215
|
+
- Inside the `parts` folder, each file is one part, so one family, whatever
|
|
216
|
+
its classes are called: `.field`, `.input`, `input` and `textarea` in
|
|
217
|
+
`ui/field.css` are the field part. The role comes from the file's name
|
|
218
|
+
(`field.css`, `value-field.css`). A file whose name is no role
|
|
219
|
+
(`profile.css`) is a part of its own, so its `.pf-banner` is not a toast.
|
|
220
|
+
- A class a part file defines stays that part's wherever else it is styled:
|
|
221
|
+
`.checkout .btn` restyles the button part, it is not another family.
|
|
222
|
+
- Elsewhere, class names say the role and family. For example,
|
|
223
|
+
`.btn`/`.btn-secondary` are one family while `.submit-button` and `.cta`
|
|
224
|
+
are others, so the report suggests one part with variants.
|
|
206
225
|
- **Repeated markup**: the same element structure (tags and classes) copied
|
|
207
226
|
in more than one place, and the same structure repeated with different
|
|
208
227
|
classes. Sibling repeats in a list are left out (render those from data).
|
|
209
228
|
|
|
229
|
+
Pages listed under `specimens` in the config show parts side by side on
|
|
230
|
+
purpose, so they're left out of the part-family and repeated-markup checks.
|
|
231
|
+
|
|
210
232
|
`--html file` writes a self-contained report page to share. `--limit n` sets
|
|
211
233
|
how many items each section shows (default 6).
|
|
212
234
|
|
|
@@ -278,10 +300,18 @@ Rewrites hardcoded values as the tokens that hold them. It shows a diff
|
|
|
278
300
|
A semantic token whose job is a different property is never used, so
|
|
279
301
|
`#1a1a1a` as a background never becomes `--text`.
|
|
280
302
|
- **Spacing, radius, font size**: an exact pixel match within the same scale
|
|
281
|
-
(rem converts at 16px; em is skipped).
|
|
303
|
+
(rem converts at 16px; em is skipped). A token's scale comes from its name
|
|
304
|
+
when the name says it (`--space-*`, `--gap`, `--radius-*`; `--control`,
|
|
305
|
+
`--icon-*` and `--*-h` are sizes, which `fix` never writes), else from the
|
|
306
|
+
properties that read it. So `padding: 44px` never becomes `--control`. With `--snap`, anything within
|
|
282
307
|
`snap` px of a step also matches, and the diff marks it `snapped`. A
|
|
283
308
|
negative margin becomes `calc(var(--space-8) * -1)`.
|
|
284
309
|
- **Families, shadows, durations**: an exact match.
|
|
310
|
+
- **Primitives**: every value lands outside token files, so with
|
|
311
|
+
`semanticOnly` on, `fix` never writes a primitive (the foundation's palette,
|
|
312
|
+
such as `--gray-950`, included), only semantic tokens and the
|
|
313
|
+
`allowPrimitives` steps. A colour only a primitive holds is listed as
|
|
314
|
+
having no token.
|
|
285
315
|
- **Where it writes**: CSS/SCSS/Less, `<style>` blocks, `style=""`
|
|
286
316
|
attributes, styled-components and `css`` ` templates, JSX style objects (a
|
|
287
317
|
number like `padding: 12` becomes `padding: 'var(--space-12)'`), and
|
|
@@ -298,12 +328,18 @@ The drift gate. It exits 1 if any rule set to `error` has a hit.
|
|
|
298
328
|
| --- | --- | --- |
|
|
299
329
|
| `hardcoded` | A colour, spacing, radius, font size, family or shadow typed by hand outside token files. Shows the token that holds it, if one does. | error |
|
|
300
330
|
| `unresolved` | A `var(--x)` with `--x` defined nowhere and not set from JS. | error |
|
|
301
|
-
| `primitive-direct` | A primitive read outside token files when a semantic layer exists (except `allowPrimitives` and contract names). | warn |
|
|
302
|
-
| `duplicate-block` | A rule block identical to another one. | error |
|
|
331
|
+
| `primitive-direct` | A primitive read outside token files when a semantic layer exists (except `allowPrimitives` and contract names). The foundation's palette (`--gray-950`, `--blue-500`…) counts as primitives. When a token file's name says `primitive`, only that file's literals (and the foundation's) are primitives: a literal in the semantic file that other tokens compose is API. | warn |
|
|
332
|
+
| `duplicate-block` | A rule block identical to another one, at `duplicates.minDeclarations` (3) declarations or more. | error |
|
|
303
333
|
| `unused` | A token nobody reads (contract names are exempt: they are the parts' API). | warn |
|
|
304
334
|
| `tracked-caps` | `text-transform: uppercase` with letter-spacing. | warn |
|
|
305
335
|
| `contract` | With the foundation installed: a core token (`--surface`, `--text`, `--accent`, `--text-on-accent`, `--font-ui`) the project never sets, so it shows the foundation's default. | warn |
|
|
306
|
-
| `part-restyle` | With the foundation installed: a rule that restyles a foundation part where it is used (`.card { background: … }`) instead of setting its knobs on a variant. Layout properties (margin, grid placement, width, position, display…) are allowed. Ejected parts are exempt. | warn |
|
|
336
|
+
| `part-restyle` | With the foundation installed: a rule that restyles a foundation part where it is used (`.card { background: … }`) instead of setting its knobs on a variant. Layout properties (margin, grid placement, width, position, display…) and interaction properties (`cursor`, `user-select`, `touch-action`, `-webkit-tap-highlight-color`, `-webkit-touch-callout`, `will-change`, `overflow`, `overscroll-behavior`, `scroll-*`) are allowed. Ejected parts are exempt. | warn |
|
|
337
|
+
| `rules-override` | A bullet in the project's `DESIGN.md` tagged with an `{id}` from the base rules (`@rickycourtes/designrail/rules/DESIGN.md`). A project rule adds to the base under its own id; it never restates or overrides one. | error |
|
|
338
|
+
|
|
339
|
+
`check` and `audit` refuse a config that loosens a foundation rule: they
|
|
340
|
+
exit 2 with one line such as
|
|
341
|
+
`designrail.config.json: rules.unused "off" loosens a foundation rule`. See
|
|
342
|
+
[Configuration](#configuration).
|
|
307
343
|
|
|
308
344
|
With the foundation installed, its tokens count as defined (a project's
|
|
309
345
|
`var(--fill)` resolves), its parts' reads count as reads, and nothing inside
|
|
@@ -348,6 +384,10 @@ Writes one static page (default `.designrail/specimens.html`) showing:
|
|
|
348
384
|
*foundation*, *ejected* (the project's own copy) or, with no foundation
|
|
349
385
|
installed, *kit*.
|
|
350
386
|
|
|
387
|
+
If you write it into the project (`--out ui.html`), list it under `specimens`
|
|
388
|
+
in the config (`init` does this for a page it finds) so `audit` doesn't count
|
|
389
|
+
its parts as copies.
|
|
390
|
+
|
|
351
391
|
A light/dark toggle appears when the token files define a dark theme. With
|
|
352
392
|
no token files of its own, the project is shown in the foundation's default
|
|
353
393
|
theme.
|
|
@@ -425,6 +465,8 @@ the project has no value of its own.
|
|
|
425
465
|
| `--success` | colour | Something worked. | `#16a34a` |
|
|
426
466
|
| `--warning` | colour | Careful. | `#d97706` |
|
|
427
467
|
| `--focus` | colour | The keyboard focus ring. | `var(--accent)` |
|
|
468
|
+
| `--focus-ring` | colour | The focus outline (`none` for a glow only). | `2px solid var(--focus)` |
|
|
469
|
+
| `--focus-glow` | colour | A focus glow, as a box-shadow. | `none` |
|
|
428
470
|
| `--font-ui` | type | Every label and paragraph. | `system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif` |
|
|
429
471
|
| `--font-display` | type | Headings. | `var(--font-ui)` |
|
|
430
472
|
| `--font-mono` | type | Code. | `ui-monospace, 'SF Mono', Menlo, Consolas, monospace` |
|
|
@@ -477,7 +519,10 @@ The page (`body` background, text, font), heading resets, and layout helpers:
|
|
|
477
519
|
- `.stack`: a column with one gap (`--gap`, default `--space-12`)
|
|
478
520
|
- `.row`: a wrapping line (default `--space-8`)
|
|
479
521
|
- `.tight` / `.loose` change the gap; `.muted` and `.small` adjust text
|
|
480
|
-
- a keyboard-only focus
|
|
522
|
+
- a keyboard-only focus mark (`:focus-visible`): `--focus-ring` as the
|
|
523
|
+
outline and `--focus-glow` as a box-shadow, both theme tokens
|
|
524
|
+
- state classes `.is-hover`, `.is-active` and `.is-focus`, honoured by every
|
|
525
|
+
part beside the pseudo-classes, so a specimen page can pin a state
|
|
481
526
|
- motion stops under `prefers-reduced-motion`
|
|
482
527
|
|
|
483
528
|
Knob: `--gap` on `.stack` and `.row`.
|
|
@@ -505,12 +550,26 @@ Knob: `--gap` on `.stack` and `.row`.
|
|
|
505
550
|
|
|
506
551
|
| `.btn.outline` | A rim instead of a fill. |
|
|
507
552
|
|
|
508
|
-
The height is `--control-h
|
|
509
|
-
|
|
553
|
+
The height is `--control-h`, as a min-height, so a two-line option grows.
|
|
554
|
+
The side padding is derived from the height so it is twice the top padding
|
|
555
|
+
(measured from the outer edge, rim included). `aria-busy="true"` spins a ring
|
|
556
|
+
over the label. Disabled and `aria-disabled="true"` dim to `--btn-disabled`
|
|
557
|
+
with a default cursor, but still take a click, so an aria-disabled button
|
|
558
|
+
can say why it is off.
|
|
510
559
|
|
|
511
560
|
Knobs: `--btn-h`, `--btn-line`, `--btn-radius`, `--btn-bg`, `--btn-bg-hover`,
|
|
512
561
|
`--btn-bg-press`, `--btn-fg`, `--btn-fg-hover`, `--btn-rim`, `--btn-rim-w`,
|
|
513
|
-
`--btn-font-size`, `--btn-gap
|
|
562
|
+
`--btn-font-size`, `--btn-gap`, `--btn-pad-x` (default the derived side pad),
|
|
563
|
+
`--btn-pad-y` (`0`), `--btn-font` (default the composed shorthand),
|
|
564
|
+
`--btn-lift` (a hover filter, `none`), `--btn-press` (`scale(0.98)`),
|
|
565
|
+
`--btn-blur` (a backdrop-filter, `none`), `--btn-text-wrap` (`nowrap`),
|
|
566
|
+
`--btn-align` (`center`: justify-content), `--btn-text-align` (`center`:
|
|
567
|
+
text-align, for a label that wraps), `--btn-disabled` (`0.45`),
|
|
568
|
+
`--btn-busy-size` (`18px`), `--btn-busy-w` (`2px`), `--btn-busy-ring`
|
|
569
|
+
(`''`; `none` draws no ring, for a page with its own); on `.btn.small`:
|
|
570
|
+
`--btn-hit` (the hit area's height, `--control-h`), `--btn-hit-area` (`''`;
|
|
571
|
+
`none` draws none), `--btn-shadow` (a box-shadow, `none`; keyboard focus
|
|
572
|
+
shows `--focus-glow` instead); on `.icon-btn`: `--icon-btn-size`,
|
|
514
573
|
`--icon-btn-fg`, `--icon-btn-bg-hover`, `--icon-btn-bg-press`; `--icon-size` for
|
|
515
574
|
an svg inside either.
|
|
516
575
|
|
|
@@ -538,7 +597,15 @@ an svg inside either.
|
|
|
538
597
|
|
|
539
598
|
Knobs: `--input-h`, `--input-line`, `--input-rim-w`, `--input-radius`,
|
|
540
599
|
`--input-bg`, `--input-fg`, `--input-rim`, `--input-rim-hover`,
|
|
541
|
-
`--input-rim-focus
|
|
600
|
+
`--input-rim-focus`, `--input-pad-y` (derived from the height),
|
|
601
|
+
`--input-pad-x` (`--space-12`), `--input-pad-end` (`--input-pad-x`),
|
|
602
|
+
`--input-bg-hover`, `--input-bg-focus` (on `:focus-within`, so a wrapper
|
|
603
|
+
`.input` lights with its `<input>`), `--input-shadow` (`none`),
|
|
604
|
+
`--input-font`, `--input-rim-style` (`solid`; `none` for a wrapper with no
|
|
605
|
+
rim, so a 0-width rim computes as no border), `--input-align` (align-items,
|
|
606
|
+
`normal`) and `--input-gap` (gap, `normal`) for a wrapper laid out as a row; `--field-gap` on `.field` (a `<fieldset>` works: its margin,
|
|
607
|
+
padding and border reset); `--check-gap`, `--check-pad-y`, `--check-fg`,
|
|
608
|
+
`--check-font`, `--check-line` on `.check`; `--tick` on a `.check` input.
|
|
542
609
|
|
|
543
610
|
### card
|
|
544
611
|
|
|
@@ -558,7 +625,10 @@ Knobs: `--input-h`, `--input-line`, `--input-rim-w`, `--input-radius`,
|
|
|
558
625
|
column.
|
|
559
626
|
|
|
560
627
|
Knobs: `--card-pad`, `--card-gap`, `--card-radius`, `--card-bg`,
|
|
561
|
-
`--card-shadow`, `--card-rim
|
|
628
|
+
`--card-shadow`, `--card-rim`, `--card-blur` (a backdrop-filter, `none`),
|
|
629
|
+
`--card-fg` (`inherit`), `--card-align` and `--card-align-content`
|
|
630
|
+
(`normal`), `--card-type` (the whole font shorthand; `initial`, so the font
|
|
631
|
+
inherits).
|
|
562
632
|
|
|
563
633
|
### pill
|
|
564
634
|
|
|
@@ -574,7 +644,11 @@ Comments <span class="count">12</span>
|
|
|
574
644
|
- `.count` is a number beside its label, with tabular figures.
|
|
575
645
|
|
|
576
646
|
Knobs: `--pill-tone` (the colour it says; the tinted variants mix their
|
|
577
|
-
background from it), `--pill-bg`, `--pill-fg
|
|
647
|
+
background from it), `--pill-bg`, `--pill-fg`, `--pill-pad-y`, `--pill-pad-x`,
|
|
648
|
+
`--pill-radius`, `--pill-font`, `--pill-blur` (a backdrop-filter, `none`),
|
|
649
|
+
`--pill-text-shadow` (`none`); on `.count`: `--count-bg`, `--count-fg`,
|
|
650
|
+
`--count-font`, `--count-pad-x`, `--count-h`, `--count-radius`. A
|
|
651
|
+
`button.pill` draws no browser border.
|
|
578
652
|
|
|
579
653
|
### dropdown
|
|
580
654
|
|
|
@@ -601,7 +675,11 @@ dropdowns(); // once; it delegates, so dropdowns added later work too
|
|
|
601
675
|
- `[aria-checked='true']` marks the current item.
|
|
602
676
|
|
|
603
677
|
Knobs: `--menu-pad`, `--menu-radius`, `--menu-bg`, `--menu-shadow`,
|
|
604
|
-
`--menu-min-w`, `--menu-item-h
|
|
678
|
+
`--menu-min-w`, `--menu-item-h`, `--menu-gap` (between rows, `0`),
|
|
679
|
+
`--menu-rim` (an inside rim that takes no room, `transparent`), `--menu-fg`
|
|
680
|
+
(the text colour, `inherit`), `--menu-origin` (where it grows from,
|
|
681
|
+
`top left`; `.end` sets `top right`). A `.menu` that is a `[popover]` draws
|
|
682
|
+
no browser rim: its rim is `--menu-rim`.
|
|
605
683
|
|
|
606
684
|
### toast
|
|
607
685
|
|
|
@@ -615,7 +693,11 @@ const dismiss = toast('Link copied', { action: { label: 'Undo', onClick: undo },
|
|
|
615
693
|
open).
|
|
616
694
|
- The text is set with `textContent`, so a message is never parsed as HTML.
|
|
617
695
|
|
|
618
|
-
Knobs: `--toast-bg`, `--toast-fg`, `--toast-radius`, `--toast-max-w
|
|
696
|
+
Knobs: `--toast-bg`, `--toast-fg`, `--toast-radius`, `--toast-max-w`,
|
|
697
|
+
`--toast-pad-y`, `--toast-pad-start`, `--toast-pad-end` (a toast ending in a
|
|
698
|
+
button sets it to `--space-8`), `--toast-rim`, `--toast-shadow`,
|
|
699
|
+
`--toast-gap`, `--toast-font` (the size), `--toast-type` (the whole font
|
|
700
|
+
shorthand, `initial` so the font inherits; set `--toast-font` to its size).
|
|
619
701
|
|
|
620
702
|
### sheet
|
|
621
703
|
|
|
@@ -631,15 +713,28 @@ Knobs: `--toast-bg`, `--toast-fg`, `--toast-radius`, `--toast-max-w`.
|
|
|
631
713
|
- Built on the native `<dialog>`: `el.showModal()` gives a focus trap,
|
|
632
714
|
Escape and an inert background.
|
|
633
715
|
- At most 420px wide; on screens under 520px it becomes a bottom sheet that
|
|
634
|
-
respects the safe area.
|
|
716
|
+
respects the safe area. That modal sizing applies to `dialog.sheet` only:
|
|
717
|
+
a `.sheet` on another element is placed by its page (a bottom dock, a
|
|
718
|
+
side panel).
|
|
635
719
|
|
|
636
720
|
Knobs: `--sheet-pad`, `--sheet-gap`, `--sheet-width`, `--sheet-radius`,
|
|
637
|
-
`--sheet-bg
|
|
721
|
+
`--sheet-bg`, `--sheet-rim`, `--sheet-rim-w`, `--sheet-shadow`,
|
|
722
|
+
`--sheet-blur`, `--sheet-fg`, `--sheet-border-w` (`0`) and
|
|
723
|
+
`--sheet-border-style` (`none`): a real border in `--sheet-rim` that can
|
|
724
|
+
leave sides out (`1px 0 0` is a top-only rim, for a sheet on the page's
|
|
725
|
+
foot; set `--sheet-rim-w: 0` beside it), `--sheet-align-content`
|
|
726
|
+
(`normal`). The gap applies to any sheet laid out as flex or grid, open or
|
|
727
|
+
not.
|
|
638
728
|
|
|
639
729
|
## Design rules
|
|
640
730
|
|
|
641
|
-
|
|
642
|
-
|
|
731
|
+
These are the base rules. They ship in the package as
|
|
732
|
+
`@rickycourtes/designrail/rules/DESIGN.md`, and every project on designrail
|
|
733
|
+
follows them as written. The `DESIGN.md` that `init` writes extends them:
|
|
734
|
+
it starts `Extends @rickycourtes/designrail/rules/DESIGN.md` and appends the
|
|
735
|
+
project's own rules under "Project rules". A project rule adds something
|
|
736
|
+
the base doesn't say; one that reuses a base `{id}` fails `check`
|
|
737
|
+
(`rules-override`). Each bullet is tagged `{id · how it is checked}`:
|
|
643
738
|
|
|
644
739
|
- `check`: `designrail check` fails a change that breaks it.
|
|
645
740
|
- `audit`: `designrail audit` reports it.
|
|
@@ -680,7 +775,8 @@ The rules came out of Popup's design system.
|
|
|
680
775
|
- Focus glow for the keyboard only. `{motion.focus · eye}`
|
|
681
776
|
- Motion uses the duration and easing tokens and stops under reduced motion. `{motion.tokens · eye}`
|
|
682
777
|
|
|
683
|
-
|
|
778
|
+
A project can turn a rule up, never down: `rules` can raise a `warn` to
|
|
779
|
+
`error`, and `check` and `audit` refuse a config that lowers one.
|
|
684
780
|
|
|
685
781
|
## Configuration
|
|
686
782
|
|
|
@@ -695,6 +791,7 @@ optional, and `schema.json` validates it.
|
|
|
695
791
|
"exclude": ["dist", "build", "out", "coverage", "vendor", "**/*.min.*", "**/*.map"],
|
|
696
792
|
"tokens": ["tokens/primitives.css", "tokens/semantic.css"],
|
|
697
793
|
"parts": "ui",
|
|
794
|
+
"specimens": [],
|
|
698
795
|
"grid": 4,
|
|
699
796
|
"colorTolerance": 0.01,
|
|
700
797
|
"snap": 1,
|
|
@@ -709,8 +806,10 @@ optional, and `schema.json` validates it.
|
|
|
709
806
|
"unused": "warn",
|
|
710
807
|
"tracked-caps": "warn",
|
|
711
808
|
"contract": "warn",
|
|
712
|
-
"part-restyle": "warn"
|
|
809
|
+
"part-restyle": "warn",
|
|
810
|
+
"rules-override": "error"
|
|
713
811
|
},
|
|
812
|
+
"duplicates": { "minDeclarations": 3 },
|
|
714
813
|
"maxFileBytes": 1500000
|
|
715
814
|
}
|
|
716
815
|
```
|
|
@@ -722,19 +821,30 @@ optional, and `schema.json` validates it.
|
|
|
722
821
|
| `include` | Folders to scan. |
|
|
723
822
|
| `exclude` | Globs left out. `.gitignore` entries, `.git`, `node_modules` and `.designrail` are always left out too. |
|
|
724
823
|
| `tokens` | The token files. Stylesheets that are mostly custom properties on `:root` (or `html`, `:host`, `[data-theme]`) count as token files even if unlisted. |
|
|
725
|
-
| `parts` | Where the project's own parts live, and where `eject` copies one. |
|
|
824
|
+
| `parts` | Where the project's own parts live, and where `eject` copies one. Each file in it is one part to `audit`. |
|
|
825
|
+
| `specimens` | Globs for specimen pages, which show parts side by side on purpose. They're left out of `audit`'s part-family and repeated-markup checks. `init` sets it when it finds the page `specimens` writes. |
|
|
726
826
|
| `grid` | The spacing grid in px. |
|
|
727
827
|
| `colorTolerance` | ΔE (OKLab) below which two colours are the same colour. 0.01 merges `#3b82f6` and `#3b83f6` but keeps `#ffffff` and `#fafafa` apart. |
|
|
728
828
|
| `snap` | px within which `extract` merges lengths and `fix --snap` maps one to a step. |
|
|
729
|
-
| `semanticOnly` | Report primitives read outside token files. |
|
|
829
|
+
| `semanticOnly` | Report primitives read outside token files, and keep `fix` from writing them there. |
|
|
730
830
|
| `allowPrimitives` | Primitive prefixes allowed anywhere. |
|
|
731
831
|
| `runtimeTokens` | Custom properties set from JS, as names or prefixes, so they count as defined. Calls like `setProperty('--x', …)` are found on their own. |
|
|
732
|
-
| `rules` | `error`, `warn` or `off` per check rule. |
|
|
832
|
+
| `rules` | `error`, `warn` or `off` per check rule. A level may only rise above its default (`warn` → `error`). |
|
|
833
|
+
| `duplicates.minDeclarations` | How many declarations rule blocks must share to count as identical or near duplicates (default 3, at least 2). At 2, state rules (`:hover`, `:focus`…) still need 3. |
|
|
733
834
|
| `maxFileBytes` | Larger files are skipped. |
|
|
734
835
|
|
|
836
|
+
The foundation's rules are the floor. `check` and `audit` exit 2, naming
|
|
837
|
+
each key, when the config loosens one:
|
|
838
|
+
|
|
839
|
+
- a `rules` level below its default (`"unused": "off"`, `"hardcoded": "warn"`),
|
|
840
|
+
- `semanticOnly: false`,
|
|
841
|
+
- an `allowPrimitives` entry outside the default three,
|
|
842
|
+
- `duplicates.minDeclarations` above 3.
|
|
843
|
+
|
|
735
844
|
To exempt a single declaration, put `/* designrail-ignore */` (or
|
|
736
|
-
`/* measured */`) inside its value, for example
|
|
737
|
-
`margin-top: -3px /* measured */;`.
|
|
845
|
+
`/* measured */`) inside its value, before the `;`, for example
|
|
846
|
+
`margin-top: -3px /* measured */;`. It is then left out of the hardcoded,
|
|
847
|
+
scale and duplicate counts, and `fix` leaves it alone.
|
|
738
848
|
|
|
739
849
|
## What it reads
|
|
740
850
|
|
|
@@ -742,7 +852,7 @@ To exempt a single declaration, put `/* designrail-ignore */` (or
|
|
|
742
852
|
| --- | --- |
|
|
743
853
|
| `.css`, `.scss`, `.less`, `.pcss` | Rules, native/SCSS/Less nesting with `&`, `@media`/`@container`/`@supports`/`@layer`. `@keyframes` and `@font-face` contents are not counted as usage. |
|
|
744
854
|
| `.html`, `.vue`, `.svelte`, `.astro` | `<style>` blocks (`lang="scss"` too), `style=""` attributes, `<script>` contents, and the markup. |
|
|
745
|
-
| `.js`, `.jsx`, `.ts`, `.tsx`, `.mjs`, `.cjs` | `css`` `, `styled.x`` `, `styled(X)`` `, `createGlobalStyle`, `keyframes`; `style={{…}}`, `sx={{…}}`, `Object.assign(el.style, {…})` and `el.style.prop = '…'` (known CSS properties only, so config objects stay out); JSX markup; `var(--x)` reads and `setProperty('--x')` writes. |
|
|
855
|
+
| `.js`, `.jsx`, `.ts`, `.tsx`, `.mjs`, `.cjs` | `css`` `, `styled.x`` `, `styled(X)`` `, `createGlobalStyle`, `keyframes`; `style={{…}}`, `sx={{…}}`, `Object.assign(el.style, {…})` and `el.style.prop = '…'` (known CSS properties only, so config objects stay out); JSX markup; `var(--x)` reads, quoted names read by script (`getPropertyValue('--x')`, `tok('--x')`, which count as reads for `unused` and are never `unresolved`), and `setProperty('--x')` writes. |
|
|
746
856
|
| Class strings anywhere | Tailwind arbitrary values: `p-[13px]`, `bg-[#fafafa]`, `rounded-[10px]`, `text-[15px]`/`text-[#333]`, `shadow-[…]`, `z-[…]` and the rest. |
|
|
747
857
|
|
|
748
858
|
Values are recognised in every notation:
|
|
@@ -779,7 +889,9 @@ baseline in git; there is no baseline file to maintain.
|
|
|
779
889
|
|
|
780
890
|
`designrail init --agents` adds this to `CLAUDE.md` or `AGENTS.md`:
|
|
781
891
|
|
|
782
|
-
> Before touching UI, read
|
|
892
|
+
> Before touching UI, read both rule files: designrail's base rules
|
|
893
|
+
> (`node_modules/@rickycourtes/designrail/rules/DESIGN.md`) and this
|
|
894
|
+
> project's `DESIGN.md`, which extends them. Build from the parts in `ui/` and the
|
|
783
895
|
> tokens in the token files, on top of the designrail foundation
|
|
784
896
|
> (`@rickycourtes/designrail/foundation.css`). Restyle a foundation part with its knobs on a
|
|
785
897
|
> variant, never by editing it; never type a colour, spacing, radius or font
|
package/kit/changes.json
CHANGED
|
@@ -3,21 +3,171 @@
|
|
|
3
3
|
"version": "0.1.0",
|
|
4
4
|
"notes": "First kit: tokens, base, button, field, card, pill, dropdown, toast, sheet.",
|
|
5
5
|
"renamed": {},
|
|
6
|
-
"added": {
|
|
7
|
-
|
|
6
|
+
"added": {
|
|
7
|
+
"tokens": [],
|
|
8
|
+
"parts": [
|
|
9
|
+
"base",
|
|
10
|
+
"button",
|
|
11
|
+
"field",
|
|
12
|
+
"card",
|
|
13
|
+
"pill",
|
|
14
|
+
"dropdown",
|
|
15
|
+
"toast",
|
|
16
|
+
"sheet"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"removed": {
|
|
20
|
+
"tokens": [],
|
|
21
|
+
"parts": []
|
|
22
|
+
}
|
|
8
23
|
},
|
|
9
24
|
{
|
|
10
25
|
"version": "0.2.0",
|
|
11
|
-
"notes": "The kit becomes the foundation: one import (@rickycourtes/designrail/foundation.css), cascade layers so a project's own CSS always wins, and knobs on every part (--btn-bg, --card-pad, --input-rim
|
|
26
|
+
"notes": "The kit becomes the foundation: one import (@rickycourtes/designrail/foundation.css), cascade layers so a project's own CSS always wins, and knobs on every part (--btn-bg, --card-pad, --input-rim\u2026) to restyle it without editing it. .btn.outline is new. `add` is now `eject`.",
|
|
12
27
|
"renamed": {},
|
|
13
|
-
"added": {
|
|
14
|
-
|
|
28
|
+
"added": {
|
|
29
|
+
"tokens": [],
|
|
30
|
+
"parts": [],
|
|
31
|
+
"classes": [
|
|
32
|
+
".btn.outline"
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
"removed": {
|
|
36
|
+
"tokens": [],
|
|
37
|
+
"parts": []
|
|
38
|
+
}
|
|
15
39
|
},
|
|
16
40
|
{
|
|
17
41
|
"version": "0.2.1",
|
|
18
42
|
"notes": "No foundation changes. Releases now publish through npm trusted publishing with provenance.",
|
|
19
43
|
"renamed": {},
|
|
20
|
-
"added": {
|
|
21
|
-
|
|
44
|
+
"added": {
|
|
45
|
+
"tokens": [],
|
|
46
|
+
"parts": [],
|
|
47
|
+
"classes": []
|
|
48
|
+
},
|
|
49
|
+
"removed": {
|
|
50
|
+
"tokens": [],
|
|
51
|
+
"parts": []
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"version": "0.2.2",
|
|
56
|
+
"notes": "No foundation changes. Audit and fix: exemption comments work, part families by file, a specimens config key, vendor-prefixed rules and blocks under duplicates.minDeclarations (3) are not duplicates, and fix never writes a primitive or a token from another scale.",
|
|
57
|
+
"renamed": {},
|
|
58
|
+
"added": {
|
|
59
|
+
"tokens": [],
|
|
60
|
+
"parts": [],
|
|
61
|
+
"classes": []
|
|
62
|
+
},
|
|
63
|
+
"removed": {
|
|
64
|
+
"tokens": [],
|
|
65
|
+
"parts": []
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"version": "0.3.0",
|
|
70
|
+
"notes": "Rules extend, never loosen: the base design rules ship as @rickycourtes/designrail/rules/DESIGN.md and a project's DESIGN.md extends them (check: rules-override); check and audit refuse a config that turns a rule down. New knobs so a project can reproduce its look on the kit: focus tokens, button pads, font, lift, press, blur, wrap, align, busy, its ring, shadow, the small hit area and disabled; field pads, fills, shadow, rim style, alignment and gap; card blur, colour, alignment and font; pill and count shape, pill blur and text shadow (a button.pill drops its browser border); menu gap, rim, colour and origin; toast pads, rim, shadow, gap, font size and font; sheet rim (a ring or a top-only border), shadow, blur, colour and row packing (its gap applies closed too). .is-hover, .is-active and .is-focus pin a state. The button sets appearance: none and its height is a min-height, disabled buttons still take a click, and only dialog.sheet is sized as a modal.",
|
|
71
|
+
"renamed": {},
|
|
72
|
+
"added": {
|
|
73
|
+
"tokens": [
|
|
74
|
+
"--focus-ring",
|
|
75
|
+
"--focus-glow"
|
|
76
|
+
],
|
|
77
|
+
"parts": [],
|
|
78
|
+
"classes": [
|
|
79
|
+
".is-hover",
|
|
80
|
+
".is-active",
|
|
81
|
+
".is-focus"
|
|
82
|
+
],
|
|
83
|
+
"knobs": {
|
|
84
|
+
"button": [
|
|
85
|
+
"--btn-pad-x",
|
|
86
|
+
"--btn-pad-y",
|
|
87
|
+
"--btn-font",
|
|
88
|
+
"--btn-lift",
|
|
89
|
+
"--btn-press",
|
|
90
|
+
"--btn-blur",
|
|
91
|
+
"--btn-text-wrap",
|
|
92
|
+
"--btn-align",
|
|
93
|
+
"--btn-disabled",
|
|
94
|
+
"--btn-busy-size",
|
|
95
|
+
"--btn-busy-w",
|
|
96
|
+
"--btn-text-align",
|
|
97
|
+
"--btn-busy-ring",
|
|
98
|
+
"--btn-hit",
|
|
99
|
+
"--btn-hit-area",
|
|
100
|
+
"--btn-shadow"
|
|
101
|
+
],
|
|
102
|
+
"field": [
|
|
103
|
+
"--input-pad-y",
|
|
104
|
+
"--input-pad-x",
|
|
105
|
+
"--input-pad-end",
|
|
106
|
+
"--input-bg-hover",
|
|
107
|
+
"--input-bg-focus",
|
|
108
|
+
"--input-shadow",
|
|
109
|
+
"--input-font",
|
|
110
|
+
"--check-gap",
|
|
111
|
+
"--check-pad-y",
|
|
112
|
+
"--check-fg",
|
|
113
|
+
"--check-font",
|
|
114
|
+
"--check-line",
|
|
115
|
+
"--input-rim-style",
|
|
116
|
+
"--input-align",
|
|
117
|
+
"--input-gap"
|
|
118
|
+
],
|
|
119
|
+
"card": [
|
|
120
|
+
"--card-blur",
|
|
121
|
+
"--card-fg",
|
|
122
|
+
"--card-align",
|
|
123
|
+
"--card-align-content",
|
|
124
|
+
"--card-type"
|
|
125
|
+
],
|
|
126
|
+
"pill": [
|
|
127
|
+
"--pill-pad-y",
|
|
128
|
+
"--pill-pad-x",
|
|
129
|
+
"--pill-radius",
|
|
130
|
+
"--pill-font",
|
|
131
|
+
"--count-bg",
|
|
132
|
+
"--count-fg",
|
|
133
|
+
"--count-font",
|
|
134
|
+
"--count-pad-x",
|
|
135
|
+
"--count-h",
|
|
136
|
+
"--count-radius",
|
|
137
|
+
"--pill-blur",
|
|
138
|
+
"--pill-text-shadow"
|
|
139
|
+
],
|
|
140
|
+
"dropdown": [
|
|
141
|
+
"--menu-gap",
|
|
142
|
+
"--menu-rim",
|
|
143
|
+
"--menu-fg",
|
|
144
|
+
"--menu-origin"
|
|
145
|
+
],
|
|
146
|
+
"toast": [
|
|
147
|
+
"--toast-pad-y",
|
|
148
|
+
"--toast-pad-start",
|
|
149
|
+
"--toast-pad-end",
|
|
150
|
+
"--toast-rim",
|
|
151
|
+
"--toast-shadow",
|
|
152
|
+
"--toast-gap",
|
|
153
|
+
"--toast-font",
|
|
154
|
+
"--toast-type"
|
|
155
|
+
],
|
|
156
|
+
"sheet": [
|
|
157
|
+
"--sheet-rim",
|
|
158
|
+
"--sheet-rim-w",
|
|
159
|
+
"--sheet-shadow",
|
|
160
|
+
"--sheet-blur",
|
|
161
|
+
"--sheet-fg",
|
|
162
|
+
"--sheet-border-w",
|
|
163
|
+
"--sheet-border-style",
|
|
164
|
+
"--sheet-align-content"
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
"removed": {
|
|
169
|
+
"tokens": [],
|
|
170
|
+
"parts": []
|
|
171
|
+
}
|
|
22
172
|
}
|
|
23
173
|
]
|
package/kit/parts/base.css
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
/* base: the page and layout helpers every part assumes.
|
|
2
2
|
Siblings get their gap from the container, never a margin of their own.
|
|
3
3
|
.stack (a column) and .row (a wrapping line) take --gap; .tight and .loose
|
|
4
|
-
step it. .muted and .small adjust text.
|
|
4
|
+
step it. .muted and .small adjust text.
|
|
5
|
+
Focus reads --focus-ring (an outline, default 2px solid var(--focus)) and
|
|
6
|
+
--focus-glow (a box-shadow, default none), both set in the theme.
|
|
7
|
+
State classes: every part honours .is-hover, .is-active and .is-focus
|
|
8
|
+
beside :hover, :active and :focus-visible, so a specimen can pin a state. */
|
|
5
9
|
|
|
6
10
|
@layer designrail.base {
|
|
7
11
|
*, *::before, *::after { box-sizing: border-box; }
|
|
@@ -26,7 +30,7 @@
|
|
|
26
30
|
|
|
27
31
|
/* Keyboard focus only: a pointer press never lights a ring. */
|
|
28
32
|
:focus:not(:focus-visible) { outline: none; }
|
|
29
|
-
:focus-visible { outline:
|
|
33
|
+
:focus-visible, .is-focus { outline: var(--focus-ring); outline-offset: 2px; box-shadow: var(--focus-glow); }
|
|
30
34
|
|
|
31
35
|
@media (prefers-reduced-motion: reduce) {
|
|
32
36
|
*, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
|