@crewlethq/artifact-kit 0.48.2 → 0.49.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/README.md CHANGED
@@ -43,6 +43,60 @@ It is opt in and it is scoped, so it never fights anything else on the page:
43
43
 
44
44
  Link it after `kit.css`: each of its rules wins over the baseline's rule for the same element by coming later at the same weight.
45
45
 
46
+ ## A company's brand
47
+
48
+ A company's brand restyles every page written with the kit's tokens: the accent and everything mixed from it, the grounds, the body text, the faces and the logo. The brand is given as **input slots**, `--brand-*` custom properties, and the kit's own tokens read them, so a page that already writes `var(--color-brand-accent)` or `var(--font-family-display)` follows the brand without changing a line. With no input set, every token is exactly the theme's own value, in both modes and under every named theme, so a page that links the kit and no brand paints as it always has. A page pinned to an earlier kit reads no slot at all.
49
+
50
+ The engine generates the company's adopted brand into a stylesheet of its own and links it beside the kit. That stylesheet defines **only `--brand-*` custom properties (on `:root`) and `@font-face` rules**, nothing else: no selector other than `:root`, no other property, so it cannot restyle anything the kit does not choose to read from it, and it can load before or after `kit.css`. A page may also set the slots itself.
51
+
52
+ | Slot | Value | What reads it |
53
+ | ---- | ----- | ------------- |
54
+ | `--brand-primary` | `#rrggbb` | The accent in light mode, and in dark mode where `--brand-primary-on-dark` is not set; `--color-brand-mark`. |
55
+ | `--brand-primary-on-dark` | `#rrggbb` | The accent in dark mode. |
56
+ | `--brand-secondary` | `#rrggbb` | `--color-brand-highlight`, and the second stop of `--color-brand-gradient`. |
57
+ | `--brand-text` | `#rrggbb` | `--color-text-primary` in light mode. Dark mode keeps the theme's text. |
58
+ | `--brand-light-ground` | `#rrggbb` | `--color-surface-frame` and `--color-surface-background` in light mode. |
59
+ | `--brand-dark-ground` | `#rrggbb` | The same two in dark mode. |
60
+ | `--brand-font-heading` | a `font-family` list | `--font-family-display`. Left out, headings take the body face. |
61
+ | `--brand-font-body` | a `font-family` list | `--font-family-sans`. |
62
+ | `--brand-logo-primary`, `--brand-logo-on-dark`, `--brand-logo-mark` | `url(...)`, root-relative or absolute | The `crewlet-logo` class. |
63
+ | `--brand-logo-primary-ratio`, `--brand-logo-on-dark-ratio`, `--brand-logo-mark-ratio` | a number, the logo's width over its height | The `crewlet-logo` class. |
64
+
65
+ **One input restyles the whole family, in both modes.** From the accent of each mode the kit mixes, with `color-mix()`:
66
+
67
+ | Token | Mixed from the mode's accent |
68
+ | ----- | ---------------------------- |
69
+ | `--color-brand-accent-hover`, `-active` | 90% and 80% toward black in OKLab, a step and two steps darker |
70
+ | `--color-brand-accent-ink` | the accent as text: 55% toward white in dark mode, 70% toward black in light mode |
71
+ | `--color-brand-accent-soft` | the accent at 16% in dark mode and 12.5% in light mode, over whatever it lands on |
72
+ | `--color-brand-accent-soft-strong`, `--color-border-selected` | the accent at 32% and 60% |
73
+ | `--color-brand-accent-deep` | 70% toward black, the gradient's deep stop |
74
+ | `--color-text-link-quiet` | the ink, 65% toward the secondary text |
75
+ | `--shadow-glow` | the accent at 30%, as the glow's light |
76
+ | `--color-text-on-accent` | black or white, whichever clears more contrast on the accent, worked out from the accent's WCAG luminance |
77
+
78
+ Two tokens stay the theme's on purpose. **The focus ring** (`--color-focus`) is measured at 3:1 for every theme, and a mix of an arbitrary colour cannot be, so a keyboard reader keeps a ring they can see. **`--color-brand-accent-rgb`** is a channel triple, which CSS cannot derive from a colour; tint with `color-mix(in srgb, var(--color-brand-accent) 20%, transparent)` instead of `rgba(var(--color-brand-accent-rgb), 0.2)`, and the tint follows the brand. Each derived value is a `--crewlet-brand-*` step that names its input with no fallback, so with the input unset the step is invalid and the token falls back to the theme's value; the theme's values are kept under `--crewlet-theme-<token>`, which the build moves them to so the brand layer is the one place a public token is declared. The colour mixes need `color-mix()` and, for the label on the accent, relative colour syntax (current Chrome, Edge, Firefox and Safari).
79
+
80
+ The kit checks no contrast of its own: whether the brand's text reads on its light ground, and its accent on its grounds, is the engine's to check when an administrator adopts the brand.
81
+
82
+ The mapping is not the kit's alone. Its one source is `@crewlethq/tokens`' `stylesheets/brand.css`, published as `@crewlethq/tokens/css/brand`, which the kit's build bundles into kit.css after moving the theme's values aside; the same source, with its selectors moved onto a scope, is `@crewlethq/tokens/css/brand-scope`, which `@crewlethq/ui`'s BrandScope uses to brand a doc or a board inside the dashboard. A page in the kit and a branded region of the dashboard are drawn by the same rules, and the kit's suite holds the two to declaring the same steps in each mode. The kit's own part of the layer is the logo class (`src/brand.css`).
83
+
84
+ ### The logo
85
+
86
+ The `crewlet-logo` class draws the brand's logo from the slots, so a page never writes a URL and its logo follows the next adopted brand:
87
+
88
+ ```html
89
+ <span class="crewlet-logo" role="img" aria-label="Acme"></span>
90
+ <span class="crewlet-logo" data-variant="mark" data-size="sm" role="img" aria-label="Acme"></span>
91
+ ```
92
+
93
+ | Attribute | Meaning |
94
+ | --------- | ------- |
95
+ | `data-variant` | `primary` (the default): the logo for a light ground in light mode, and the on-dark logo in dark mode where the brand has one. `on-dark`: the on-dark logo whatever the mode, for a dark band on a light page. `mark`: the mark alone. |
96
+ | `data-size` | `sm` (1.5rem), the default 2rem, `lg` (3rem) or `xl` (4rem) tall. A page's own class may set `--crewlet-logo-size` to any length instead. |
97
+
98
+ The width follows the logo's ratio. Where the brand has no logo for the variant it draws nothing and takes no room. Give it `role="img"` and the company's name as `aria-label`, as above. It carries a `crewlet-` class, so `content.css` leaves it to the kit.
99
+
46
100
  ## The sheet
47
101
 
48
102
  A page draws an editable sheet over one of its datastore collections with `<crewlet-sheet>`, its columns declared with `<crewlet-column>`:
@@ -119,7 +173,7 @@ A write resolves with the engine's verdict (`applied`, `pending`, `conflict`, `i
119
173
 
120
174
  | File | Content |
121
175
  | ---- | ------- |
122
- | `kit.css` | The canonical variables, the dark and light palettes of the default theme, every named theme under `data-palette`, the density steps under `data-density`, the self-hosted Geist and Geist Mono faces and the document baseline, then the stylesheet of the sheet, its cells and the presence marks, in one file. |
176
+ | `kit.css` | The canonical variables, the dark and light palettes of the default theme, every named theme under `data-palette`, the density steps under `data-density`, the self-hosted Geist and Geist Mono faces and the document baseline, the brand layer that reads the `--brand-*` slots ([above](#a-companys-brand)) and the `crewlet-logo` class, then the stylesheet of the sheet, its cells and the presence marks, in one file. |
123
177
  | `content.css` | The opt-in content stylesheet: the design system's look for the plain HTML a page writes itself, linked after `kit.css`. See [Plain HTML content](#plain-html-content). |
124
178
  | `fonts/` | The four Geist faces `kit.css` references, with `OFL.txt`. |
125
179
  | `theme.js` | The theme bootstrap, under 2 KB gzipped. |