@codenhub/styles 0.4.0 → 0.6.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.
Files changed (61) hide show
  1. package/README.md +7 -7
  2. package/dist/aesthetics/chunky-tile.css +1 -1
  3. package/dist/aesthetics/cyber.css +1 -1
  4. package/dist/aesthetics/glass.css +1 -1
  5. package/dist/aesthetics/index.css +1 -1
  6. package/dist/aesthetics/neobrutalism.css +1 -1
  7. package/dist/aesthetics/pixel.css +1 -1
  8. package/dist/aesthetics/sketch.css +1 -0
  9. package/dist/components.css +1 -1
  10. package/dist/index.css +1 -1
  11. package/dist/native.css +1 -1
  12. package/dist/palette.css +1 -1
  13. package/dist/theme.css +1 -1
  14. package/dist/tw/aesthetics/chunky-tile.css +144 -128
  15. package/dist/tw/aesthetics/cyber.css +138 -96
  16. package/dist/tw/aesthetics/glass.css +332 -66
  17. package/dist/tw/aesthetics/index.css +3 -1
  18. package/dist/tw/aesthetics/neobrutalism.css +113 -54
  19. package/dist/tw/aesthetics/pixel.css +137 -87
  20. package/dist/tw/aesthetics/sketch.css +333 -0
  21. package/dist/tw/box.css +139 -52
  22. package/dist/tw/components/button.css +67 -28
  23. package/dist/tw/components/feedback.css +85 -67
  24. package/dist/tw/components/form.css +300 -230
  25. package/dist/tw/components/index.css +17 -9
  26. package/dist/tw/components/loader.css +38 -30
  27. package/dist/tw/components/surface.css +89 -129
  28. package/dist/tw/components/tooltip.css +91 -47
  29. package/dist/tw/corner.css +26 -0
  30. package/dist/tw/elevation.css +19 -28
  31. package/dist/tw/index.css +15 -19
  32. package/dist/tw/intent.css +47 -32
  33. package/dist/tw/native.css +58 -42
  34. package/dist/tw/palette.css +455 -446
  35. package/dist/tw/presentation.css +20 -29
  36. package/dist/tw/reset.css +21 -28
  37. package/dist/tw/surface.css +61 -0
  38. package/dist/tw/theme.css +156 -153
  39. package/dist/tw/utilities/content.css +283 -205
  40. package/dist/tw/utilities/layout.css +17 -27
  41. package/docs/accessibility.md +63 -46
  42. package/docs/changelog/0.5.0.md +38 -0
  43. package/docs/changelog/0.6.0.md +52 -0
  44. package/docs/changelog/index.md +2 -0
  45. package/docs/concepts.md +6 -6
  46. package/docs/index.md +12 -3
  47. package/docs/integrating/nextjs.md +1 -1
  48. package/docs/integrating/tailwind.md +14 -6
  49. package/docs/setup.md +28 -8
  50. package/docs/usage/aesthetics.md +88 -18
  51. package/docs/usage/buttons.md +14 -14
  52. package/docs/usage/composing.md +12 -12
  53. package/docs/usage/content-and-layout.md +25 -24
  54. package/docs/usage/customizing.md +92 -55
  55. package/docs/usage/feedback.md +5 -3
  56. package/docs/usage/forms.md +61 -45
  57. package/docs/usage/theming.md +41 -42
  58. package/docs/usage/tooltips.md +37 -17
  59. package/llms-full.txt +590 -304
  60. package/llms.txt +6 -0
  61. package/package.json +15 -5
@@ -1,24 +1,27 @@
1
1
  @reference "tailwindcss";
2
2
  @import "../theme.css";
3
3
  @reference "../box.css";
4
- @reference "./surface.css";
4
+ @reference "../surface.css";
5
5
 
6
6
  /* The host is a positioning wrapper and nothing else -- it paints no fill, no
7
- edge, no material of its own. The bubble is a real element beside the
8
- trigger rather than a pseudo-element attached to it, so intent,
9
- presentation, aesthetic, and elevation classes go on `.tooltip-bubble`, the
10
- thing actually shown, not on the wrapper -- the same rule every other
11
- component in this package follows (theming.md: "Intent does not cascade").
12
-
13
- Composing the bubble as a real element fixes a real gap, not just a styling
14
- one: `content: attr(data-tooltip)` text is not reliably exposed to
15
- assistive tech and cannot be the target of an `aria-describedby`, since that
16
- needs a real element with a real `id`. A real bubble can carry
17
- `role="tooltip"` and be referenced by the trigger's own `aria-describedby`;
18
- wiring that association is the consumer's, this package only styles the
19
- bubble. See docs/usage/tooltips.md. */
7
+ edge, no material of its own. The bubble is a real element beside the trigger
8
+ rather than a pseudo-element, so intent, presentation, aesthetic, and
9
+ elevation classes go on `.tooltip-bubble`, the thing actually shown, not on
10
+ the wrapper -- the same rule every other component follows (theming.md:
11
+ "Intent does not cascade").
12
+
13
+ A real element is also what makes the tooltip accessible: `content:
14
+ attr(data-tooltip)` text is not reliably exposed to assistive tech and cannot
15
+ be the target of an `aria-describedby`, which needs a real element with a
16
+ real `id`. A real bubble can carry `role="tooltip"` and be referenced by the
17
+ trigger's own `aria-describedby`; wiring that association is the consumer's,
18
+ this package only styles the bubble. See docs/usage/tooltips.md. */
20
19
  @utility tooltip {
21
20
  --tooltip-gap: 0.5rem;
21
+ /* How long the bubble stays after the pointer leaves the trigger: long
22
+ enough to cross `--tooltip-gap` onto the bubble, which keeps it open
23
+ (WCAG 1.4.13). */
24
+ --tooltip-linger: 300ms;
22
25
  --tooltip-top: calc(var(--tooltip-gap) * -1);
23
26
  --tooltip-right: auto;
24
27
  --tooltip-bottom: auto;
@@ -52,24 +55,31 @@
52
55
  }
53
56
 
54
57
  /* The bubble. It is a surface, so an aesthetic that blurs surfaces blurs it
55
- too, and it rests on a ground of its own, edged, and flat -- depth is
56
- opt-in through its own `.raised`/`.floating`, like any other component, now
57
- that it is one. No proxy inheritance is needed to carry elevation across a
58
- host-to-pseudo-element gap: there is no gap, `.tooltip-bubble.raised` reads
59
- `--ui-elevation` the ordinary way every other component does. See
58
+ too, and it rests on a ground of its own, edged, and flat -- depth is opt-in
59
+ through its own `.raised`/`.floating`, like any other component. See
60
60
  model.md#elevation. */
61
61
  @utility tooltip-bubble {
62
- @apply surface pointer-events-none absolute z-(--z-popover) w-max max-w-72 px-2.5 py-2 text-sm font-normal whitespace-normal opacity-0 transition-[opacity,transform] duration-(--motion-duration-normal) ease-(--motion-ease);
62
+ @apply surface absolute z-(--z-popover) w-max max-w-72 px-2.5 py-2 text-sm font-normal whitespace-normal opacity-0;
63
+
64
+ /* Hidden rather than merely transparent, so a closed bubble is nothing
65
+ under the pointer, and it lingers before it goes: the host stays hovered
66
+ once the pointer is over the bubble, so crossing the gap in
67
+ `--tooltip-linger` keeps it open. Visibility switches at the end of the
68
+ fade, so the bubble is there to land on for the whole of it. */
69
+ visibility: hidden;
70
+ transition-property: opacity, transform, visibility;
71
+ transition-duration: var(--motion-duration-normal);
72
+ transition-timing-function: var(--motion-ease);
73
+ transition-delay: var(--tooltip-linger, 0s);
63
74
 
64
75
  /* Filled, over a ground of its own. An intent floods the fill
65
76
  (`.tooltip-bubble.primary` is the primary colour); with no intent
66
77
  `intent.css` resolves the bubble onto `--color-tooltip` and lifts the
67
- neutral cap, a plate stated per theme because the derived version was a
68
- mid-grey slab in light and lifted in dark. The ground stays the surface
69
- tone, not the plate -- pointed at both, the fill axis went inert and
70
- `axes.spec.ts` caught it. An opaque ground is also what keeps a cascaded
71
- `.ghost` from leaving the bubble boundaryless. `--ui-surface-ground` is
72
- read first so a glass tooltip stays glass. */
78
+ neutral cap. The ground stays the surface tone, not the plate: pointed at
79
+ both, the fill axis goes inert (`axes.spec.ts` catches it). An opaque
80
+ ground is also what keeps a cascaded `.ghost` from leaving the bubble
81
+ boundaryless. `--ui-surface-ground` is read first so a glass tooltip stays
82
+ glass. */
73
83
  --_d-fill: 100%;
74
84
  --_d-fg-on-fill: 100%;
75
85
  --_d-border: 100%;
@@ -88,8 +98,13 @@
88
98
  --_edge-floor: 100%;
89
99
 
90
100
  /* A bubble is a small transient popover, not a modal, so it takes the
91
- control radius rather than the surface one `surface` hands it. */
92
- border-radius: var(--ui-radius, var(--radius-control));
101
+ control corner `box` computes rather than the surface one `surface` hands
102
+ it, with the same pattern. */
103
+ border-radius: var(
104
+ --ui-radius,
105
+ calc(var(--_corner) * var(--ui-corner-tl, 1)) calc(var(--_corner) * var(--ui-corner-tr, 1))
106
+ calc(var(--_corner) * var(--ui-corner-br, 1)) calc(var(--_corner) * var(--ui-corner-bl, 1))
107
+ );
93
108
  left: var(--tooltip-left);
94
109
  right: var(--tooltip-right);
95
110
  top: var(--tooltip-top);
@@ -100,35 +115,58 @@
100
115
  &.edgeless {
101
116
  --_edge-floor: 0%;
102
117
  }
118
+
119
+ /* The bubble appears without growing under reduced motion, for the entries
120
+ without the reset; see `box.css`. */
121
+ @media (prefers-reduced-motion: reduce) {
122
+ transition-duration: 0.01ms;
123
+ }
103
124
  }
104
125
 
105
126
  /* Shown on hover or focus anywhere in the host, or pinned open with
106
127
  `data-state="open"`. `:focus-within` rather than the trigger's own
107
- `:focus-visible`, the same substitution `.input-group` makes for the
108
- identical reason: the bubble is a sibling, not a pseudo-element, of the
109
- trigger, so nothing but the shared ancestor can see both at once. The cost
110
- is the one `.input-group` already accepts -- the bubble also shows on a
111
- mouse click, which the old `:focus-visible`-only version did not. */
112
- .tooltip:hover .tooltip-bubble,
113
- .tooltip:focus-within .tooltip-bubble,
114
- .tooltip[data-state="open"] .tooltip-bubble {
115
- opacity: 1;
116
- transform: var(--tooltip-transform) scale(1);
128
+ `:focus-visible`, the same substitution `.input-group` makes: the bubble is a
129
+ sibling of the trigger, so only the shared ancestor can see both at once. The
130
+ cost is the one `.input-group` accepts -- the bubble also shows on a mouse
131
+ click.
132
+
133
+ In `utilities`, where the bubble's own `@utility` is, winning on specificity
134
+ -- see the seams note in `form.css`. */
135
+ @layer utilities {
136
+ .tooltip:hover .tooltip-bubble,
137
+ .tooltip:focus-within .tooltip-bubble,
138
+ .tooltip[data-state="open"] .tooltip-bubble {
139
+ opacity: 1;
140
+ transform: var(--tooltip-transform) scale(1);
141
+ visibility: visible;
142
+ transition-delay: 0s;
143
+ }
144
+
145
+ /* Dismissed: a hover message has to close without the pointer moving
146
+ (WCAG 1.4.13), and CSS cannot hear Escape, so the consumer's handler
147
+ writes `data-state="closed"` and clears it when the pointer and focus
148
+ leave. Later and as specific as the rule above, so it wins over hover and
149
+ focus alike. */
150
+ .tooltip[data-state="closed"] .tooltip-bubble {
151
+ opacity: 0;
152
+ transform: var(--tooltip-transform) scale(0);
153
+ visibility: hidden;
154
+ transition-delay: 0s;
155
+ }
117
156
  }
118
157
 
119
158
  /* The trigger badge, for a message with no other element to hang it on. Quiet
120
159
  -- ghost, edged, on `--intent-subtle`, a key cap's resting shape -- because
121
160
  it marks that there is a message, it is not one. The line earns its keep:
122
- `--intent-subtle` is a near-page tint that reads the same across families,
123
- so a plate alone left three of eight intents indistinguishable;
161
+ `--intent-subtle` is a near-page tint that reads the same across families, so
162
+ a plate alone leaves three of eight intents indistinguishable;
124
163
  `--intent-border` is the slot that differs.
125
164
 
126
- `clip-path: none` used to exist to protect the bubble, a pseudo-element of
127
- this same host, from being clipped away along with it under an aesthetic
128
- like `.pixel`. The bubble is independent now, so that reason is gone, but
129
- the declaration stays: the docs call this a circular fixed identity, not a
130
- shape a container's aesthetic reaches, the same way `.radio` keeps its own
131
- circle instead of taking `.pixel`'s stepped silhouette. */
165
+ Its corner is the aesthetic's, through the pill corner and then the control
166
+ corner: round by default, a diamond under `.cyber`, square under
167
+ `.neobrutalism` and `.pixel`, whose corner is zero. Only the silhouette
168
+ clip is refused -- `clip-path: none`, as `.radio` has it -- because
169
+ `.pixel`'s stepped polygon would bite a 20px chip rather than shape it. */
132
170
  @utility tooltip-icon {
133
171
  @apply box inline-flex size-5 cursor-default items-center justify-center text-sm font-bold;
134
172
 
@@ -138,6 +176,12 @@
138
176
  --_d-elevation: 0;
139
177
  --_d-ground: var(--intent-subtle);
140
178
 
141
- border-radius: var(--ui-radius-pill, var(--ui-radius, calc(infinity * 1px)));
179
+ /* The trigger is best a real `<button>`, which is a `.btn` under `/native`
180
+ and carries the user agent's padding under `/components`; either would
181
+ stretch the chip past its own size. */
182
+ min-width: 0;
183
+ min-height: 0;
184
+ padding: 0;
185
+ border-radius: var(--ui-radius-pill, var(--ui-radius, var(--ui-corner, calc(infinity * 1px))));
142
186
  clip-path: none;
143
187
  }
@@ -0,0 +1,26 @@
1
+ /* Imported into the `components` layer by `theme.css`, below every utility, so
2
+ a consumer's own utility or unlayered CSS beats these classes. See
3
+ docs/internal/model.md#cascade-layers.
4
+
5
+ The corner pattern: which corners take the corner the aesthetic draws. `box`
6
+ and `surface` multiply their computed corner by `--ui-corner-tl`, `-tr`,
7
+ `-br`, and `-bl`, each 0 or 1, so a class that sets the four draws two
8
+ corners and leaves two square under every aesthetic -- a two-corner leaf
9
+ under the default look, two cuts under `.cyber`. An explicit `--ui-radius`
10
+ is taken as written and ignores the pattern. See docs/internal/model.md#material-tokens. */
11
+
12
+ /* Top-left and bottom-right. */
13
+ .cut-diagonal {
14
+ --ui-corner-tl: 1;
15
+ --ui-corner-tr: 0;
16
+ --ui-corner-br: 1;
17
+ --ui-corner-bl: 0;
18
+ }
19
+
20
+ /* Top-right and bottom-left. */
21
+ .cut-diagonal-reverse {
22
+ --ui-corner-tl: 0;
23
+ --ui-corner-tr: 1;
24
+ --ui-corner-br: 0;
25
+ --ui-corner-bl: 1;
26
+ }
@@ -1,29 +1,25 @@
1
+ /* Imported into the `components` layer by `theme.css`, below every utility, so
2
+ a consumer's own utility or unlayered CSS beats these classes. See
3
+ docs/internal/model.md#cascade-layers. */
4
+
1
5
  /* Elevation is a modifier, not an axis: depth is a per-element decision (raised
2
- tiles beside a flat panel in one aesthetic), so one unitless number multiplies
3
- the aesthetic's shadow geometry where the component composes it. `.flat`
4
- removes a part-based slab or blur without a conditional (complete surface
5
- shadows like glass remain). See model.md#elevation.
6
+ tiles beside a flat panel in one aesthetic), so one unitless number
7
+ multiplies the aesthetic's shadow geometry where the component composes it.
8
+ `.flat` removes a part-based slab or blur without a conditional (complete
9
+ surface shadows like glass remain). See model.md#elevation.
6
10
 
7
11
  `--ui-elevation`, and the plain-page fallback geometry (`--elevation-y`,
8
12
  `--elevation-blur`) below, are registered non-inheriting: a class sets them
9
- on the element it is written on and nothing else picks them up. They used to
10
- be ordinary inherited custom properties, on the reasoning that a container
11
- could flatten or lift a whole region in one class and any element inside
12
- could opt back out -- but the same mechanism let a `.floating` dialog's
13
- ambient ×2 reach its own unclassed "Cancel"/"Remove" buttons, doubling their
14
- shadow with nothing in the markup asking for that. Depth is not the same
15
- kind of thing as color or material: a button inside a raised card is not
16
- itself more raised, it is just resting normally inside an already-raised
17
- surface. `--ui-shadow-*` -- what an aesthetic supplies -- is unaffected and
18
- still cascades normally; that is a different mechanism (the material tokens
19
- in `src/aesthetics/*.css`), and an aesthetic still has to reach every nested
20
- component uniformly the way it always did. Registering these three is what
21
- scopes the change to the elevation modifier alone.
13
+ on the element it is written on and nothing else picks them up. Inherited, a
14
+ `.floating` dialog's ambient x2 would reach its own unclassed buttons and
15
+ double their shadow with nothing in the markup asking for it. Depth is not
16
+ the same kind of thing as color or material: a button inside a raised card is
17
+ not itself more raised. `--ui-shadow-*` -- what an aesthetic supplies -- is a
18
+ different mechanism and still cascades normally, so an aesthetic reaches
19
+ every nested component uniformly.
22
20
 
23
- `.flat`/`.raised`/`.floating` and `.elevation-none`/`-sm`/`-md` are
24
- interchangeable aliases, the second borrowing the raw `--elevation-*` scale's
25
- naming. Bare `sm`/`md`/`lg` would collide with the size modifier;
26
- `.elevation-lg` is reserved, not shipped. */
21
+ `.flat`/`.raised`/`.floating` name what they do rather than a scale step:
22
+ bare `sm`/`md`/`lg` would collide with the size modifier. */
27
23
 
28
24
  /* `syntax: "*"` with no `initial-value` is deliberate: a numeric syntax would
29
25
  require one (CSS Properties and Values API), and any initial-value at all
@@ -32,8 +28,8 @@
32
28
  1))` in `box.css` needs to fall through to a component's own default. With
33
29
  no initial-value and `inherits: false`, an element that does not set the
34
30
  property directly computes it as guaranteed-invalid, the same as if it had
35
- never been registered at all -- `var()` takes its fallback precisely where
36
- inheritance used to hand it an ambient value instead. */
31
+ never been registered at all -- `var()` takes its fallback where an
32
+ inherited value would otherwise be handed in. */
37
33
  @property --ui-elevation {
38
34
  syntax: "*";
39
35
  inherits: false;
@@ -51,7 +47,6 @@
51
47
 
52
48
  /* No part-based depth. Complete surface shadow values, such as glass, are not
53
49
  reached by the elevation multiplier. */
54
- .elevation-none,
55
50
  .flat {
56
51
  --ui-elevation: 0;
57
52
  }
@@ -61,22 +56,18 @@
61
56
  that declares its own shadow parts overrides it, and the elevation multiplier
62
57
  scales whichever one lands. `.floating` takes its extra depth from the
63
58
  multiplier below, not a second copy of these parts. */
64
- .elevation-sm,
65
59
  .raised,
66
- .elevation-md,
67
60
  .floating {
68
61
  --elevation-y: 1px;
69
62
  --elevation-blur: 3px;
70
63
  }
71
64
 
72
65
  /* The aesthetic's depth as authored, said explicitly. */
73
- .elevation-sm,
74
66
  .raised {
75
67
  --ui-elevation: 1;
76
68
  }
77
69
 
78
70
  /* Twice it, for menus and popovers. */
79
- .elevation-md,
80
71
  .floating {
81
72
  --ui-elevation: 2;
82
73
  }
package/dist/tw/index.css CHANGED
@@ -1,27 +1,23 @@
1
1
  @import "tailwindcss";
2
2
 
3
3
  /* The build has no markup to scan, so Tailwind's automatic content detection
4
- sees only this package's own files. The `src/` scan is load-bearing -- it is
4
+ sees only this package's own files. The `src/` scan is load-bearing: it is
5
5
  how the composition utilities (`box`, `surface`, `text-control`,
6
- `input-group`, `loader-mask`) get emitted as standalone rules, since nothing
7
- `@source inline`s them -- so `source(none)` is not an option. A handful of
8
- Tailwind utility names also collide with a CSS property or a word this
9
- file's own comments use (`backdrop-filter`, `filter`, `transition`,
10
- `transform`, `container`), which reads like a risk of the same scan --
11
- verified against Tailwind 4.3.2, none of them emit.
12
- `tests/integration/exports.test.ts` guards it, so a scanner change that
13
- starts emitting one is caught rather than shipping silently.
6
+ `input-group`, `loader-mask`) are emitted as standalone rules, so
7
+ `source(none)` is not an option. Tailwind utility names that collide with a
8
+ CSS property or a word these comments use (`backdrop-filter`, `filter`,
9
+ `transition`, `transform`, `container`) do not emit, verified against
10
+ Tailwind 4.3.2; `tests/integration/exports.test.ts` guards it.
14
11
 
15
- The `@source not` lines below keep everything that is not `src/` out of that
16
- scan: the sibling app and fixture directories, the `docs/` tree, the build
17
- scripts, and the root prose and data files (`README.md`, `llms*.txt`,
18
- `registry*.json`, `package.json`). Without them a class name or `--color-*`
19
- reference that appears only in a documentation example ships as real CSS --
20
- the violet ramp in `docs/usage/theming.md`'s custom-intent example was
21
- compiling into `dist/index.css` and `dist/native.css`, and any utility in a
22
- docs code fence did the same. `tests/integration/exports.test.ts` guards it.
23
- `scripts/build-tw.mjs` strips these lines from the `dist/tw/` copy, where they
24
- resolve to nothing and the `/tw` consumer scans their own tree anyway. */
12
+ The `@source not` lines keep everything that is not `src/` out of the scan:
13
+ the sibling app and fixture directories, the `docs/` tree, the build scripts,
14
+ and the root prose, data, config, and license files. Without them a class
15
+ name or `--color-*` reference that appears only in a documentation example
16
+ ships as real CSS -- the license's "contents" once shipped as
17
+ `.contents{display:contents}`.
18
+ `exports.test.ts` guards it. `scripts/build-tw.mjs` strips these lines from
19
+ the `dist/tw/` copy, where they resolve to nothing and the `/tw` consumer
20
+ scans their own tree. */
25
21
 
26
22
  @import "./theme.css";
27
23
  @import "./typography.css";
@@ -1,3 +1,7 @@
1
+ /* Imported into the `components` layer by `theme.css`, below every utility, so
2
+ a consumer's own utility or unlayered CSS beats these classes. See
3
+ docs/internal/model.md#cascade-layers. */
4
+
1
5
  /* An intent maps one colour family onto seven shared slots and nothing else.
2
6
  It does not cascade: the reset at the bottom redeclares the neutral defaults
3
7
  at every component's own root, so a `.success` container cannot recolour a
@@ -29,12 +33,11 @@
29
33
  }
30
34
 
31
35
  /* Neutral stops its fill short: its colour is the page's ink, so a full fill is
32
- a slab and `.neutral.solid` was pixel-for-pixel `.primary.solid`. 20% is
36
+ a slab and `.neutral.solid` would be pixel-for-pixel `.primary.solid`. 20% is
33
37
  chosen against `.soft`'s 12% -- a step past the tint, not a repeat.
34
38
  `--intent-contrast` stays the page colour; a `.neutral.solid` badge's ink is
35
39
  `box`'s question, answered by the same `--ui-fg-on-fill` cap. Pointing this
36
- slot at `--color-text` instead rendered a checked neutral checkbox
37
- black-on-black. */
40
+ slot at `--color-text` renders a checked neutral checkbox black-on-black. */
38
41
  .neutral {
39
42
  --intent-color: var(--color-text);
40
43
  --intent-contrast: var(--color-text-contrast);
@@ -85,9 +88,7 @@
85
88
  --intent-fill-max: 100%;
86
89
  }
87
90
 
88
- .destructive,
89
- .danger,
90
- .error {
91
+ .destructive {
91
92
  --intent-color: var(--color-destructive);
92
93
  --intent-contrast: var(--color-destructive-contrast);
93
94
  --intent-hover: var(--color-destructive-hover);
@@ -159,38 +160,52 @@
159
160
  border for 3:1. `--color-border` gives it 1.42:1.
160
161
 
161
162
  Declared here at zero specificity for the same reason the indicators below
162
- are: written inside `@utility text-control` it would land in the utilities
163
- layer, the reset above lands in no layer at all, and unlayered beats layered
164
- at any specificity. Written as a plain class list it would carry 0-1-0 and,
165
- being later in the stylesheet, beat `.primary` -- which would make every
166
- colored control draw a grey line. `:where()` keeps it under both. */
167
- :where(.text-control, .ipt, .textarea, .select, .input-group, .checkbox, .radio, .switch) {
168
- --intent-border: var(--ui-ink, var(--color-control-border));
163
+ are: written inside `@utility text-control` it would land in `utilities`,
164
+ above every intent class in `components`, and overrule `.primary` on the
165
+ element. Written as a plain class list it would carry 0-1-0 and, being later
166
+ in the stylesheet, beat `.primary` the same way. Either would make every
167
+ colored control draw a grey line; `:where()` keeps it under both.
168
+
169
+ An aesthetic reaches this line through `--ui-control-ink` first, then its
170
+ `--ui-ink`: the theme keeps a control border apart from a surface border, and
171
+ an aesthetic whose neutral line suits a pane but not a control's boundary --
172
+ `.glass`'s white hairline, `.chunky-tile`'s tile grey -- names a control line
173
+ of its own. See docs/internal/model.md#presentation.
174
+
175
+ The second selector is the tooltip bubble's below, for the same reason:
176
+ `.neutral` carries 0-1-0 and beat `:where()`, so a `.neutral` field under
177
+ `.glass` drew the pane's hairline while an unclassed one drew the control
178
+ line, and writing the intent out changed the box. */
179
+ :where(.text-control, .ipt, .textarea, .select, .input-group, .checkbox, .radio, .switch),
180
+ :is(.text-control, .ipt, .textarea, .select, .input-group, .checkbox, .radio, .switch).neutral {
181
+ --intent-border: var(--ui-control-ink, var(--ui-ink, var(--color-control-border)));
182
+ }
183
+
184
+ /* A table's lines -- its frame, head rule, and row rules -- are drawn on a
185
+ plate, not at a pane's edge against the backdrop, so an aesthetic whose
186
+ neutral line is a highlight names a rule line of its own: glass's white
187
+ hairline vanishes on the table's light plate. Neutral only, and `.neutral`
188
+ included, the way the control line above is. */
189
+ :where(.data-table),
190
+ .data-table.neutral {
191
+ --intent-border: var(--ui-rule-ink, var(--ui-ink, var(--color-border)));
169
192
  }
170
193
 
171
194
  /* The bubble a tooltip draws is the one plate in the package that is chosen
172
195
  rather than composed, so it resolves the no-intent case onto its own pair
173
- instead of onto the shared neutral. Composed, it was 20% of the page's
174
- ink over `--color-surface`, which lifts off a dark page and sinks into a light
175
- one -- see `--color-tooltip` in `theme.css` for the measurements.
196
+ instead of the shared neutral -- see `--color-tooltip` in `theme.css`.
176
197
 
177
198
  The cap goes with it. Neutral stops its fill at 20% because its colour is the
178
- page's ink and a full fill of that is a slab; `--color-tooltip` is a plate
179
- rather than an ink, so a full fill of it is the plate and there is nothing to
180
- stop short of.
181
-
182
- `--intent-subtle` stays the surface token, the same tone every other
183
- unclassed component sits on. `.tooltip-icon`, the trigger badge, is a
184
- separate element now and does not read this block at all -- it never fills
185
- past `0%`, so the generic neutral reset above it is enough, and it keeps its
186
- own resting ground and line independent of whatever intent the bubble shows.
187
-
188
- Two selectors, because `none` and `neutral` have to agree here. `:where()`
189
- loses to any intent class, so `.tooltip-bubble.primary` still floods with
190
- primary; `.tooltip-bubble.neutral` carries 0-2-0 and beats `.neutral`, so
191
- writing the intent out gives the same bubble as writing nothing. Without the
192
- second selector the two would differ on a component where they mean the
193
- same thing. */
199
+ page's ink; `--color-tooltip` is a plate rather than an ink, so a full fill
200
+ of it is the plate and there is nothing to stop short of. `--intent-subtle`
201
+ stays the surface token, the tone every other unclassed component sits on.
202
+ `.tooltip-icon` is a separate element that never fills past `0%`, so the
203
+ generic neutral reset above is enough for it.
204
+
205
+ Two selectors, so `none` and `neutral` agree. `:where()` loses to any intent
206
+ class, so `.tooltip-bubble.primary` still floods with primary;
207
+ `.tooltip-bubble.neutral` carries 0-2-0 and beats `.neutral`, so writing the
208
+ intent out gives the same bubble as writing nothing. */
194
209
  :where(.tooltip-bubble),
195
210
  .tooltip-bubble.neutral {
196
211
  --intent-color: var(--color-tooltip);
@@ -1,3 +1,6 @@
1
+ /* The layer map, stated before any import uses a layer -- see `theme.css`. */
2
+ @layer theme, base, components, utilities;
3
+
1
4
  @import "./theme.css";
2
5
  @reference "tailwindcss";
3
6
  /* Everything that is not `src/` -- see the note in `index.css`. Without the
@@ -8,45 +11,56 @@
8
11
  @import "./components/index.css";
9
12
  @import "./reset.css";
10
13
 
11
- /* `intent.css`'s reset keys on class names; these bare elements need the same,
12
- or a `color-mix()` reading an undefined `--intent-*` drops silently. Zero
13
- specificity like the class reset, values matching it slot for slot -- a bare
14
- `<code>` and a `.code` chip are one component reached two ways. */
15
- :where(table, kbd, code, pre, blockquote, hr, input, textarea, select, button) {
16
- --intent-color: var(--color-text);
17
- --intent-contrast: var(--color-text-contrast);
18
- --intent-hover: var(--color-text-hover);
19
- --intent-strong: var(--color-text-strong);
20
- --intent-subtle: var(--color-surface);
21
- --intent-border: var(--ui-ink, var(--color-border));
22
- --intent-fill-max: 20%;
23
- }
24
-
25
- /* Native text controls need the same stronger neutral boundary as their classed
26
- counterparts, without changing buttons, checkboxes, radios, or other inputs. */
27
- :where(
28
- input:not([type]),
29
- input[type="text"],
30
- input[type="number"],
31
- input[type="email"],
32
- input[type="password"],
33
- input[type="url"],
34
- input[type="tel"],
35
- input[type="search"],
36
- input[type="month"],
37
- input[type="week"],
38
- input[type="time"],
39
- input[type="date"],
40
- input[type="datetime-local"],
41
- textarea,
42
- select
43
- ) {
44
- --intent-border: var(--ui-ink, var(--color-control-border));
45
- }
46
-
47
- :where(hr) {
48
- --intent-color: currentColor;
49
- --intent-border: currentColor;
14
+ @layer components {
15
+ /* `intent.css`'s reset keys on class names; these bare elements need the same,
16
+ or a `color-mix()` reading an undefined `--intent-*` drops silently. Zero
17
+ specificity like the class reset, values matching it slot for slot -- a bare
18
+ `<code>` and a `.code` chip are one component reached two ways. */
19
+ :where(table, kbd, code, pre, blockquote, hr, input, textarea, select, button) {
20
+ --intent-color: var(--color-text);
21
+ --intent-contrast: var(--color-text-contrast);
22
+ --intent-hover: var(--color-text-hover);
23
+ --intent-strong: var(--color-text-strong);
24
+ --intent-subtle: var(--color-surface);
25
+ --intent-border: var(--ui-ink, var(--color-border));
26
+ --intent-fill-max: 20%;
27
+ }
28
+
29
+ /* Native text controls and toggles take the same stronger neutral boundary as
30
+ their classed counterparts, without changing buttons or other inputs --
31
+ control ink included, as `intent.css`'s class reset reads it. */
32
+ :where(
33
+ input:not([type]),
34
+ input[type="checkbox"],
35
+ input[type="radio"],
36
+ input[type="text"],
37
+ input[type="number"],
38
+ input[type="email"],
39
+ input[type="password"],
40
+ input[type="url"],
41
+ input[type="tel"],
42
+ input[type="search"],
43
+ input[type="month"],
44
+ input[type="week"],
45
+ input[type="time"],
46
+ input[type="date"],
47
+ input[type="datetime-local"],
48
+ textarea,
49
+ select
50
+ ) {
51
+ --intent-border: var(--ui-control-ink, var(--ui-ink, var(--color-control-border)));
52
+ }
53
+
54
+ /* A bare table's lines take the rule line, as `.data-table`'s do in
55
+ `intent.css`. */
56
+ :where(table) {
57
+ --intent-border: var(--ui-rule-ink, var(--ui-ink, var(--color-border)));
58
+ }
59
+
60
+ :where(hr) {
61
+ --intent-color: currentColor;
62
+ --intent-border: currentColor;
63
+ }
50
64
  }
51
65
 
52
66
  @layer base {
@@ -74,9 +88,10 @@
74
88
  @apply text-label;
75
89
  }
76
90
 
91
+ /* Links are left out: a link takes the text it sits in, so one inside a
92
+ heading stays heading-sized. */
77
93
  p,
78
- li,
79
- a {
94
+ li {
80
95
  @apply text-body;
81
96
  }
82
97
 
@@ -167,7 +182,8 @@
167
182
  transition: none;
168
183
  }
169
184
 
170
- input[type="checkbox"]:checked {
185
+ input[type="checkbox"]:checked,
186
+ input[type="checkbox"]:indeterminate {
171
187
  background-color: Highlight;
172
188
  border-color: Highlight;
173
189