@brignano/design 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/DECISIONS.md CHANGED
@@ -513,3 +513,76 @@ across the projects could tell them apart.
513
513
  added words are gone.
514
514
  - Driftwood, Guidebook and Sites each add a `BRIEF.md`, pick their identity
515
515
  and cut to the budgets in their own repos.
516
+
517
+ ---
518
+
519
+ ## ADR-0012 — Shared components ship as plain CSS in a cascade layer
520
+
521
+ **Status:** accepted · 2026-11-07 · proposal `proposals/component-layer.md` (#45, #85)
522
+
523
+ ### Context
524
+
525
+ The package shipped tokens and the product-page template. Buttons, fields,
526
+ messages and pills existed only on the preview pages, so every consumer rebuilt
527
+ them, and they drifted (brignano.io: about five button styles, an `opacity-40`
528
+ disabled state that §4 forbids).
529
+
530
+ ### Decision
531
+
532
+ - Components ship as **plain CSS classes**: `components.css` for controls and
533
+ patterns, `templates/<name>.css` per page template. No React wrappers, no JS.
534
+ - Short unprefixed names (`.btn`, `.field`) inside `@layer brignano.components`,
535
+ so a consumer's own CSS and utilities win without `!important`. States come
536
+ from real attributes (`disabled`, `aria-invalid`, `[open]`), never classes.
537
+ - **Native first:** `<dialog>`, `popover`, `<details>`, anchor positioning.
538
+ Where behaviour needs JS, design documents the ARIA contract and the consumer
539
+ owns the script.
540
+ - `.pp-button` / `.pp-field` become aliases of the shared classes until 1.0.
541
+ - The full catalog is decided now in three waves; wave 3 is built only when a
542
+ product needs it.
543
+
544
+ ### Consequences
545
+
546
+ - One import gives any surface, React or not, the same controls.
547
+ - Every class must appear on a docs page, and contrast is checked in both
548
+ themes (`npm run check`).
549
+ - Behaviour bugs live in consumers' JS, not here; the docs pages carry the
550
+ contract so they are written the same way.
551
+
552
+ ---
553
+
554
+ ## ADR-0013 — Overlays may move as they open and close
555
+
556
+ **Status:** accepted · 2026-11-09 · #116, from #55
557
+
558
+ ### Context
559
+
560
+ The tool tier has no motion (§2), and §7 rules out entrance animation.
561
+ ADR-0009 allowed one exception: motion the reader starts that shows an order.
562
+ The component catalog (#55 dialog, #56 popover and menu, #58 toast) asked for
563
+ open and close motion on overlays, which meets none of ADR-0009's conditions.
564
+ Dialogs and sheets first shipped still (#115). A sheet that appears from
565
+ nowhere doesn't say which edge it belongs to, and a dialog that blinks in
566
+ reads as a page jump. Anthony chose to allow the motion with its own entry.
567
+
568
+ ### Decision
569
+
570
+ An overlay (dialog, sheet, popover or menu, toast) may animate as it opens
571
+ and closes, in both tiers, when:
572
+
573
+ - the person opened it, or it answers something they just did;
574
+ - only `opacity` and `transform` move, for `--dur-fast` on `--ease`: a fade
575
+ plus a slide of a few pixels, or a sheet sliding from its own edge;
576
+ - the open state is fully shown without the animation (it comes from
577
+ `@starting-style`), so a browser that lacks it shows the overlay at once;
578
+ - `prefers-reduced-motion` makes it instant, `::backdrop` included.
579
+
580
+ ### Consequences
581
+
582
+ - §2's motion row and §7 name this as the one exception beside ADR-0009.
583
+ Content on the page itself still never animates in.
584
+ - `.dialog` and `.sheet` get the motion now. Popover, menu and toast use the
585
+ same timing when they are built. The site header's phone menu (#54) can
586
+ adopt it in a later change.
587
+ - Anything else that wants to move still has to meet ADR-0009 or it is
588
+ decorative.
package/DESIGN.md CHANGED
@@ -31,7 +31,7 @@ family, motion and shape are identical; what changes is how much room things get
31
31
  | Section rhythm | `--s9` (96px) | `--s6` (32px) |
32
32
  | Measure | 68ch | 780px |
33
33
  | Display face | Silkscreen — monogram, hero eyebrows | none (aliases to `--sans`) |
34
- | Motion | the trail, scroll reveal | none |
34
+ | Motion | the trail, scroll reveal, overlays opening and closing (ADR-0013) | none, except overlays opening and closing (ADR-0013) |
35
35
  | Density | whitespace carries the layout | scanning beats reading |
36
36
 
37
37
  ## 3. Colour — one hue, one meaning
@@ -90,6 +90,15 @@ Every state ships with an **icon and a word**. Colour is the accelerant, not the
90
90
  signal — this covers colour-vision deficiency, greyscale printing, and forced-colours
91
91
  mode in one rule.
92
92
 
93
+ ### Code is the one non-interactive cobalt
94
+
95
+ Syntax keywords (`--code-keyword`) and a highlighted line (`--code-highlight`)
96
+ borrow the cobalt ink and wash, though nothing there can be acted on. It's
97
+ deliberate and contained: inside a code block, a reader scanning for structure
98
+ needs one accent, and cobalt is the only hue that can't be misread as a state.
99
+ Everything else in code is neutral (§9). Nowhere outside a code block does
100
+ cobalt mean anything but *you can act on this*.
101
+
93
102
  ### What does NOT get colour
94
103
 
95
104
  Event type. Six types in six colours is exactly the complication this avoids —
@@ -111,8 +120,12 @@ The part that makes an interface feel built rather than styled.
111
120
  `--surface-active`, not from opacity tricks.
112
121
  - A control's own edge — an input, a secondary button — is `--line-control`
113
122
  (≥ 3:1). `--line-strong` is a divider, too faint to tell you a control is there.
114
- - Native checkboxes, radios and ranges inherit `accent-color: var(--i)` from
115
- `tokens.css`; don't restyle them just to recolour them.
123
+ - Checkboxes and radios in a `.choice` row are drawn from tokens
124
+ (`components.css`), so they look the same on every OS. Bare ones, ranges and
125
+ progress bars stay native and inherit `accent-color: var(--i)` from
126
+ `tokens.css`; don't restyle those just to recolour them. `.progress` and
127
+ `.meter` on a native `<progress>` or `<meter>` draw it from tokens, for
128
+ when a bar must look the same everywhere.
116
129
 
117
130
  ## 5. Type
118
131
 
@@ -157,13 +170,23 @@ or is disabled is disqualified.
157
170
  and that block ships inside `tokens.css` so no surface can forget it. One easing
158
171
  curve (`--ease`), three durations, compositor-only properties.
159
172
 
160
- **The tool tier has one exception: motion a person asks for.** A control that
173
+ **The tool tier has two exceptions. The first is motion a person asks for.** A control that
161
174
  walks through a sequence step by step, such as driftwood's *Trace a request*,
162
175
  may animate, because the reader started it to follow an order of events, and
163
176
  the order is the content. It runs only when clicked, never on load; it can be
164
177
  stopped at any step; every state it passes through is also listed as text; and
165
178
  under `prefers-reduced-motion` it shows the final state (the whole sequence lit)
166
- at once. Nothing decorative qualifies: no entrance, hover or scroll animation.
179
+ at once. Nothing decorative qualifies: no entrance, hover or scroll animation,
180
+ except the overlay case below.
181
+
182
+ **The second: overlays may move as they open and close, in both tiers**
183
+ (ADR-0013). A dialog, sheet, popover, menu or toast that someone opened, or that answers what they
184
+ just did, fades and slides a few pixels (a sheet from its own edge) over
185
+ `--dur-fast`. Only opacity and transform move; the open state is always fully
186
+ shown, so a browser without `@starting-style` shows it at once; and under
187
+ `prefers-reduced-motion` it is instant, backdrop included. An overlay that is
188
+ already open when the page loads doesn't animate. That is the whole
189
+ exception: content on the page itself still never animates in.
167
190
 
168
191
  ## 8. Charts
169
192
 
@@ -205,6 +228,10 @@ is thirty coloured things, and the one that is down disappears among them.
205
228
  The diff tokens alias the state hues on purpose (added is *settled*, a change is
206
229
  *informational*, a removal is the change that can lose data), so a diff adds no
207
230
  hue to the system. Health wins the fill (`-surface`); a diff only takes the edge.
231
+ - **Code is neutral too.** `--code-keyword` is the cobalt ink; strings are
232
+ `--code-string` (`--ink-soft`), comments `--code-comment` (`--slate`, italic),
233
+ everything else `--code-ink`. A highlighted line is `--code-highlight`. No
234
+ syntax rainbow: a reader scanning code needs the keywords, not a palette.
208
235
  - **Selection** is the focus treatment: a 2px `--i-ink` outline, offset. Asking
209
236
  "what depends on this?" dims everything unrelated to ~30% opacity and inks the
210
237
  connecting edges in `--ink`; it never introduces a colour.
@@ -571,3 +598,40 @@ page runs this before asking for review, and puts the answers in the PR.
571
598
  `autoplay` attribute.
572
599
  - [ ] Copyright footer with the year filled in at build time.
573
600
  - [ ] No hex outside `tokens.css` (`npm run check`).
601
+
602
+ ## 14. Components
603
+
604
+ Shared controls and patterns ship as plain CSS in
605
+ [`components.css`](./components.css), and whole-page layouts as
606
+ `templates/<name>.css`. Why plain CSS and not React: ADR-0012. What gets built
607
+ and in what order: [`proposals/component-layer.md`](./proposals/component-layer.md).
608
+
609
+ ```css
610
+ @import '@brignano/design/tokens.css';
611
+ @import '@brignano/design/components.css';
612
+ ```
613
+
614
+ - **One layer.** Everything is inside `@layer brignano.components`. A consumer's
615
+ unlayered CSS and Tailwind utilities beat it without `!important`, so a site
616
+ can adjust a component without fighting it.
617
+ - **Names.** `.name` for the component, `.name-variant` for a variant
618
+ (`.btn`, `.btn-primary`). State is never a class: it comes from the attribute
619
+ that makes it true (`disabled`, `aria-invalid="true"`, `aria-current`,
620
+ `aria-expanded`, `[open]`), so the look can't disagree with what assistive
621
+ tech is told.
622
+ - **Native first.** `<dialog>`, the `popover` attribute, `<details>` and CSS
623
+ anchor positioning before any script. Where a component needs JS (a toast
624
+ queue, tab arrow keys), its preview page documents the ARIA contract and the
625
+ consumer writes the script. Design ships no JS.
626
+ - **Tokens only.** No hex. Every rule here that sets a background is
627
+ contrast-checked in both themes (`npm run check`): its text colour at 4.5:1,
628
+ its border or outline at 3:1. A control's edge is `--line-control`; the
629
+ divider tokens (`--line`, `--line-soft`, `--line-strong`) are exempt from the
630
+ edge check because they are never a control's edge.
631
+ - **Every class is shown.** A class in `components.css` or a template that no
632
+ preview page uses fails the check: if it isn't shown, it isn't reviewed.
633
+ - **Switch or checkbox.** A switch (`.switch`, `role="switch"`) is only for a
634
+ setting that takes effect the moment it flips. Anything sent with a form's
635
+ submit button is a checkbox, because a switch promises an effect the form
636
+ hasn't made yet.
637
+
package/README.md CHANGED
@@ -9,7 +9,9 @@ The shared design system for every brignano surface — `brignano.io`, `life`,
9
9
  | [`DECISIONS.md`](./DECISIONS.md) | Why the values are what they are. ADRs. |
10
10
  | [`tokens.css`](./tokens.css) | Single source of truth for colour, type, space, shape, motion. |
11
11
  | [`tokens.chart.css`](./tokens.chart.css) | Validated categorical palette for data viz. |
12
+ | [`components.css`](./components.css) | Shared controls and patterns as plain CSS in `@layer brignano.components`: one import, any framework. DESIGN.md §14; catalog in `proposals/component-layer.md`; preview in `previews/components.html`. |
12
13
  | [`product-page.css`](./product-page.css) | The structure of a product's marketing page, built from a five-line brief: thesis and proof on the first phone screen, one signature band, how it works, closing ask; a product mark, hero layout and proof frame so each product looks like itself. DESIGN.md §13; skeleton in `previews/product-page.html`, worked example in `previews/product-page-example.html`, first-screen check in `scripts/fold.mjs`. |
14
+ | [`templates/`](./templates) | Page templates built on `components.css`: `article.css` (posts and docs), `changelog.css`, `legal.css`, and a transactional email (`email.html` + `email.txt`, filled from the tokens by `scripts/email-tokens.mjs`). Import as `@brignano/design/templates/<name>.css`. |
13
15
  | [`previews/`](./previews) | Live swatches. Open one in a browser to see the tokens render. |
14
16
 
15
17
  ## The shape of it
@@ -30,6 +32,7 @@ npm install @brignano/design
30
32
 
31
33
  ```css
32
34
  @import '@brignano/design/tokens.css';
35
+ @import '@brignano/design/components.css'; /* buttons, fields, messages… */
33
36
  @import '@brignano/design/tokens.chart.css'; /* only if the surface has charts */
34
37
  ```
35
38