@alis-build/design-system 0.14.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -55,7 +55,7 @@ Cite by ID in review. Each is a defect that has shipped in an Alis product.
55
55
 
56
56
  ## Smell test
57
57
 
58
- Five questions, about a minute. **Run this before handing work back.**
58
+ Six questions, about a minute. **Run this before handing work back.**
59
59
 
60
60
  1. **Is anything in the page casting a shadow?** Only a menu, the composer,
61
61
  a snackbar, a dialog, a dragged item or a card on the drafting field may. A
@@ -68,6 +68,9 @@ Five questions, about a minute. **Run this before handing work back.**
68
68
  5. **Look at the component's own styles. Is there any appearance in them?** A
69
69
  colour, font, radius, shadow, a forced override (`!important`) or a reach into
70
70
  a library's internal classes → C3.
71
+ 6. **Have you looked at it in dark?** Set `data-theme="dark"` on the page. Text
72
+ that vanishes, a white box, a shadow doing an edge's job → a colour that isn't
73
+ a role ([themes.md](themes.md)).
71
74
 
72
75
  ## The agent failure mode
73
76
 
@@ -63,8 +63,8 @@ in.
63
63
 
64
64
  ## Snackbars
65
65
 
66
- Level 3 on `surface-variant`, light: the inverse surface belongs to machine
67
- speech. One text action at most. When to use one, and for how long, is in
66
+ Level 3 on `surface-variant`, light: the inverse surface belongs to the
67
+ tooltip, and machine speech has its own. One text action at most. When to use one, and for how long, is in
68
68
  [AppAlert](../components/AppAlert.md) § AppSnackbar.
69
69
 
70
70
  ## States of a thing
package/rules/colour.md CHANGED
@@ -108,6 +108,14 @@ in this order:
108
108
  meaning without a label beside it.
109
109
  - Chrome stays ink and cyan; colour lives in the data. That is Material 3
110
110
  Expressive's split, and why the marks can be vivid.
111
+ - **The marks hold across themes**, so a series is the same colour wherever its
112
+ chart is; violet and rose are one small step lighter in dark to clear 3:1 on a
113
+ dark card. In dark the container is deep (tone ~30) and its ink light
114
+ ([themes.md](themes.md)).
115
+ - **Code takes the syntax roles**, the category hues at a text tone:
116
+ `syntax-keyword` violet, `-string` mint, `-number` apricot, `-function` rose,
117
+ `-comment` the second ink, `-plain` the ink. Sky is left out: it sits too close
118
+ to `primary`, and code is not something you press.
111
119
 
112
120
  ## The AI identity
113
121
 
@@ -121,27 +129,37 @@ do, and spends a data colour on decoration.
121
129
  the two stay a cool and a warm. This is the one place `signal` lights a shape,
122
130
  and **only ever as a tint**: a solid red light reads as an alarm, not as Alis. It sits behind the composer in a call and is the voice view's orb
123
131
  ([AppComposer](../components/AppComposer.md), [AppVoiceView](../components/AppVoiceView.md));
124
- a recording's level wears `ai-you`.
132
+ a recording's level wears `ai-you`. In dark it is the same light: `ai-you` and
133
+ `ai-alis` don't change, and the containers become a sky and a coral, so the
134
+ light stays lighter than the ground. Deep tints were tried and read as an alarm.
125
135
  - **The AI gradient** runs `signal` to `primary` to `ai-tail`: `.app-ai-text` on
126
136
  a headline, and the onboarding ring. It lands on a mark tone, so text stays 3:1
127
137
  at its faintest.
128
- - **The AI code ground**, `.app-ai-ground`, runs `primary` to `ai-ground-end`, dark
129
- throughout, so its `on-inverse-surface` ink holds.
138
+ - **The AI code ground**, `.app-ai-ground`, runs `ai-ground-start` to
139
+ `ai-ground-end`, dark throughout and the same in both themes, so its
140
+ `on-machine-surface` ink holds. It doesn't start at `primary`, which turns pale
141
+ in dark.
130
142
 
131
143
  ## Marked text, the dark ground, the scrim
132
144
 
133
145
  - **`highlight`** (with `on-highlight` ink) marks text: a comment's anchor, a
134
146
  search hit, a transcript match. Never a status, a category or a selection. The
135
147
  active mark is the same fill plus an underline.
136
- - **`inverse-surface`** with `on-inverse-surface` is the ground for machine speech
137
- only: a dark code block, a terminal, a canvas that draws light on dark. A dialog
138
- hero or a band is never dark in the product, and a media stage is black
139
- ([styling.md](styling.md)).
148
+ - **`machine-surface`** with `on-machine-surface` is the ground for machine
149
+ speech only: a code block on the machine ground, a terminal, a canvas that draws
150
+ light on dark. Use it through `.app-machine`, which keeps it dark in both themes
151
+ ([themes.md](themes.md)). A dialog hero or a band is never dark in the product,
152
+ and a media stage is black ([styling.md](styling.md)).
153
+ - **`inverse-surface`** with `on-inverse-surface` is Material 3's inverse, the
154
+ reverse of the UI around it: the plain tooltip
155
+ ([AppTooltip](../components/AppTooltip.md)). It turns light in dark.
140
156
  - **`scrim`** is the black behind text laid over an image, and with a drawing the
141
157
  one place a role takes an alpha ([styling.md](styling.md)).
142
158
 
143
159
  ## Every colour decision
144
160
 
161
+ - **Both themes, always.** A role has a value for each theme; a colour that isn't
162
+ a role doesn't follow the theme ([themes.md](themes.md)).
145
163
  - **No new hexes**, and **name only roles the system defines**: an undefined role
146
164
  often doesn't fail, it falls through to the framework's default colour (D5). If
147
165
  the colour you want is not a role, you are solving the wrong problem.
@@ -24,7 +24,6 @@ What the system doesn't decide yet, in one place. When you hit one, take the qui
24
24
  - `term-ok` (`#4CAF50`) and `term-reply` (`#FFC107`) are Material defaults on alisx.com's terminal: a stock palette (D5). They need measured brand replacements on `petrol-950`.
25
25
  - `surface-variant` and `surface-container-highest` hold one value (`#E6E8EB`) for two jobs.
26
26
  - Long-form document surfaces have no ruled measure beyond 710px prose.
27
- - No dark theme.
28
27
 
29
28
  ## Assets
30
29
 
package/rules/page.md CHANGED
@@ -81,8 +81,9 @@ becomes back (`arrow_back`) and the phone's back gesture closes it
81
81
 
82
82
  **A file Alis made opens beside the conversation**, in the detail pane made wide
83
83
  ([AppFilePane](../components/AppFilePane.md)): you look at it and talk about it,
84
- never edit it there. From 1200 the conversation takes two parts and the file three;
85
- narrower, the file takes the conversation's place until it closes. It opens by
84
+ never edit it there. From 1200 the conversation takes two parts and the file three,
85
+ the file as a card with an edge; narrower, it takes the conversation's place,
86
+ flat, until it closes. It opens by
86
87
  itself only live, only where it fits beside her reply, never on a phone. While it is
87
88
  open the composer's context chip carries it, and your bubble's about line names it.
88
89
  The tile in her reply opens it; a file a browser can't show keeps its download tile.
package/rules/spacing.md CHANGED
@@ -56,8 +56,9 @@ container (`overflow: hidden`), which clips a focus ring.
56
56
  ## Depth
57
57
 
58
58
  **A shadow means above the page** ([surfaces.md](surfaces.md) § Depth). One brand
59
- recipe: a 1px contact shadow plus a wide diffuse one, in cool petrol rather than
60
- black.
59
+ recipe: a 1px contact shadow plus a wide diffuse one (`shadow-key`,
60
+ `shadow-ambient`), in cool petrol rather than black in light; in dark they are
61
+ black, the only ink a shadow shows in on a dark ground.
61
62
 
62
63
  - **`elevation-2`** floats over the page: menus, the composer, a sticky bar
63
64
  with content under it; and a card on the drafting field
package/rules/styling.md CHANGED
@@ -58,10 +58,12 @@ An empty rule is deleted, and so is a class whose only declaration was deleted.
58
58
  tokens and never a category ([colour.md](colour.md) § The AI identity).
59
59
  - Third parties themed from the tokens at runtime (diagram and syntax renderers)
60
60
  and a terminal's ANSI palette: machine speech, not ours to redesign. Their
61
- ground is a surface role, or `inverse-surface` when it is dark.
62
- - **A full-bleed media stage is black**, because `inverse-surface` is a blue-grey
63
- that would cast on someone's photograph. Every other dark ground is
64
- `inverse-surface`.
61
+ ground is a surface role, or `machine-surface` (`.app-machine`) when it is
62
+ dark. They re-render when the theme changes; an exported diagram is always
63
+ light ([themes.md](themes.md)).
64
+ - **A full-bleed media stage is black**, because `machine-surface` is a
65
+ blue-grey that would cast on someone's photograph. Every other dark ground is
66
+ `machine-surface`.
65
67
 
66
68
  ## A gap is a finding
67
69
 
package/rules/surfaces.md CHANGED
@@ -18,7 +18,8 @@ heading or a divider.
18
18
  - **No pane of the layout is a white card, and nor is the thread column.** They
19
19
  sit on the ground, and the shell's panes default to it
20
20
  ([AppShell](../components/AppShell.md)), so a white card always reads as an
21
- object.
21
+ object. That is why a file Alis made, beside the conversation, *is* one: an
22
+ instrument card with its edge ([AppFilePane](../components/AppFilePane.md)).
22
23
  - **If a white card would sit on a white parent, the parent is wrong** (A1).
23
24
  - **Fill says read or act; a shadow says above the page.** A statement is grey
24
25
  and flat with no border. An instrument is white with a 1px `outline-variant`
@@ -88,5 +89,11 @@ Why is this above the page?
88
89
  Transparency and blur appear in exactly four places: a floating nav pill, glass
89
90
  on a dark panel, a dialog backdrop, and the statement over a gradient.
90
91
 
91
- No card relies on a shadow to be legible, so every rule here survives a dark
92
- theme.
92
+ **What floats takes `surface-container-high`**: a menu, the composer, a dialog,
93
+ the detail pane when it slides over, a dragged card. In light it is white, the
94
+ same as an instrument. In dark it is one step lighter, because there lightness
95
+ does the lifting a shadow can't.
96
+
97
+ No card relies on a shadow to be legible, so every rule here holds in dark
98
+ ([themes.md](themes.md)). A statement lifts off the dark ground instead of
99
+ sinking into it: it is still `on-surface` at 4% over the ground.
@@ -0,0 +1,115 @@
1
+ # Themes
2
+
3
+ Two themes, light and dark, from one set of roles. **A page is light unless it
4
+ asks.** Build with roles and both themes come free; a colour that isn't a role
5
+ breaks the moment the theme changes.
6
+
7
+ ## Asking for a theme
8
+
9
+ `data-theme` on any element, the page root or one section of it:
10
+
11
+ | `data-theme` | Shows |
12
+ | --- | --- |
13
+ | *(none)* | Light |
14
+ | `light` | Light |
15
+ | `dark` | Dark |
16
+ | `system` | Whatever the operating system prefers |
17
+
18
+ - **An app owns the choice.** It resolves the person's preference (System,
19
+ Light, Dark) and sets `data-theme` on `<html>` before first paint, so the
20
+ page never flashes the wrong theme. The package ships no script for it.
21
+ - **A section can take its own theme.** Every role is written as
22
+ `light-dark(light, dark)` and resolved where it is used, so a dark section in a
23
+ light page (or the reverse) is right all the way down. `alisx.css` paints a
24
+ section's ground and ink (`background`, `on-surface`); with `tokens.css` alone,
25
+ the section sets them itself, since ink inherited from the page was resolved
26
+ in the page's theme. A component library's own theming (Vuetify's
27
+ `v-theme-provider`) has to be told as well, and a menu or dialog it teleports
28
+ out of the section takes the page's theme.
29
+ - **Print is always light**, whatever the screen shows.
30
+ - A browser without `light-dark()` (before Chrome 123, Firefox 120, Safari 17.5)
31
+ gets the light theme.
32
+
33
+ ## Where the values come from
34
+
35
+ | File | Holds | For |
36
+ | --- | --- | --- |
37
+ | `alisx.css` | Every token, both themes, plus the type classes, base and components | A page that takes the whole system |
38
+ | `tokens.css` | Every token, both themes, nothing else | An app with its own component library |
39
+ | `themes.json` | Every product role resolved to a literal, per theme | Code that needs values, not custom properties: a component library's theme, a diagram renderer, a canvas |
40
+ | `tokens.json` | The source: a value per theme on each product role, references left in | Tooling. Read the three above instead |
41
+
42
+ Never resolve `{references}` from `tokens.json` yourself: `themes.json` has them
43
+ resolved, and the generator is the only resolver. The package's `tokens.json`
44
+ still gives each product role a `value` (its light one), and each shadow its
45
+ light literal as `value` beside `values` per theme, for code written before
46
+ themes; new code reads `tokens.css` or `themes.json`.
47
+
48
+ ## What a role means in dark
49
+
50
+ The roles keep their jobs; only their values move. The relationships in the
51
+ other rules hold in both themes:
52
+
53
+ - **The ground is petrol** (`#192127`), tinted from the brand the way the light
54
+ ground is warm paper.
55
+ - **A statement lifts** a little off the ground: it is still `on-surface` at 4%
56
+ over it ([surfaces.md](surfaces.md)). An instrument lifts further and keeps its
57
+ edge. **Things that float** (a menu, the composer, a dialog, the sliding detail
58
+ pane, a dragged card) take `surface-container-high`, lighter again,
59
+ because a shadow barely shows on a dark ground: as light as it can be while
60
+ the caret in the composer keeps 3:1. In light it is white, as before.
61
+ - **Primary is the light cyan** (`cyan-200`) with dark ink on a filled button.
62
+ - **The statuses** are re-matched at about L\* 76–80, as the light set is at 40.
63
+ `warning` stays an icon, never text, in both themes.
64
+ - **The tooltip turns light.** It is Material 3's plain tooltip, on
65
+ `inverse-surface`, which is the reverse of the UI around it.
66
+
67
+ ## What doesn't change, and why
68
+
69
+ | Role | Same in both themes because |
70
+ | --- | --- |
71
+ | `signal` | It is the Alis mark. Alis looks the same in either theme. |
72
+ | `cat1`–`cat6` | A series is the same colour wherever its chart is. Violet and rose are a small step lighter in dark, so they clear 3:1 on a dark card; the rest are identical. |
73
+ | `ai-you`, `ai-alis` | The voice light is a light: the same colour in both themes, lighter than the ground in both. Only its containers change. |
74
+ | `ai-ground-start`, `ai-ground-end` | The AI code ground looks the same in either theme. |
75
+ | `paper` | White in every theme: the frame of a page that sets its own colours. |
76
+ | `machine-surface` | Machine speech is dark in both themes (below). |
77
+
78
+ ## Machine speech is a dark section
79
+
80
+ Code on the machine ground, a terminal, the AI code ground: **`.app-machine`**
81
+ (and `.app-ai-ground`) sets the ground and makes everything inside it take its
82
+ dark values, in either theme. Syntax colours, links and buttons inside follow
83
+ on their own. Put it on the block itself (Shiki's `<pre>` is fine: its inline
84
+ background and foreground read the class) or on a wrapper. Printed, it drops to
85
+ ink on paper.
86
+
87
+ Anything inside `.app-ai-ground` takes dark values too, a button or a link on
88
+ the gradient included, in either theme.
89
+
90
+ Code on a light ground (prose, the editor) takes the syntax roles in the
91
+ page's theme. The syntax roles (`syntax-keyword`, `-string`, `-number`,
92
+ `-function`, `-comment`, `-plain`) are the category hues at a text tone; never
93
+ `primary`, because code is not something you press. `alisx.css` maps them to
94
+ Shiki's css-variables theme (`--shiki-token-*`), so code is highlighted once and
95
+ a theme change needs no re-highlight.
96
+
97
+ ## Third parties and exports
98
+
99
+ - **A renderer that paints its own colours** (Mermaid) reads `themes.json`, or
100
+ the component library's theme built from it, and re-renders when the theme
101
+ changes.
102
+ - **An exported diagram is always light**: a copy or a download renders with the
103
+ light values, whatever the viewer sees, so it pastes cleanly into a document.
104
+ - Images and photographs stay as they are.
105
+
106
+ ## What make check enforces
107
+
108
+ 1. Every product role names a value for every theme.
109
+ 2. Contrast in both themes: `on-X` over `X`, both inks over every surface, and
110
+ the pairs declared in `tokens.json` § contrast. Text 4.5:1, graphics 3:1.
111
+ 3. `product.css` names roles only: no literal colour, no palette or narrative
112
+ token. A deliberate exception says why on its line: `/* any-theme: … */`.
113
+
114
+ What it can't see: a `color-mix` fill, a library's internals, your own CSS.
115
+ **Look at every new component in both themes** before it ships.
package/themes.json ADDED
@@ -0,0 +1,144 @@
1
+ {
2
+ "light": {
3
+ "primary": "#006383",
4
+ "on-primary": "#ffffff",
5
+ "signal": "#f02222",
6
+ "on-surface": "#27323a",
7
+ "on-surface-variant": "#5d666d",
8
+ "background": "#fbfbfa",
9
+ "surface": "#ffffff",
10
+ "surface-container-low": "#f3f3f2",
11
+ "surface-container-high": "#ffffff",
12
+ "surface-container-highest": "#e6e8eb",
13
+ "surface-variant": "#e6e8eb",
14
+ "shimmer": "#ffffff",
15
+ "secondary-container": "#cfd2d4",
16
+ "on-secondary-container": "#27323a",
17
+ "selection-chrome": "#e2e3e3",
18
+ "outline": "#74777c",
19
+ "outline-variant": "#e6e8eb",
20
+ "error": "#ba1a1a",
21
+ "on-error": "#ffffff",
22
+ "warning": "#b58200",
23
+ "success": "#1e6b3a",
24
+ "info": "#2a5cbe",
25
+ "inverse-surface": "#27323a",
26
+ "on-inverse-surface": "#f4f4f2",
27
+ "machine-surface": "#27323a",
28
+ "on-machine-surface": "#f4f4f2",
29
+ "paper": "#ffffff",
30
+ "scrim": "#000000",
31
+ "shadow-key": "rgba(16, 24, 40, 0.16)",
32
+ "shadow-ambient": "rgba(16, 24, 40, 0.2)",
33
+ "highlight": "#fdecc8",
34
+ "on-highlight": "#27323a",
35
+ "cat1": "#7860c4",
36
+ "cat2": "#19a289",
37
+ "cat3": "#c97409",
38
+ "cat4": "#0398cd",
39
+ "cat5": "#b3487e",
40
+ "cat6": "#728d02",
41
+ "on-cat": "#ffffff",
42
+ "cat1-container": "#ede9ff",
43
+ "cat2-container": "#d2f6ec",
44
+ "cat3-container": "#ffe8d2",
45
+ "cat4-container": "#d3f2ff",
46
+ "cat5-container": "#ffe2f0",
47
+ "cat6-container": "#e8f2d4",
48
+ "on-cat1-container": "#443672",
49
+ "on-cat2-container": "#004f41",
50
+ "on-cat3-container": "#653400",
51
+ "on-cat4-container": "#00496a",
52
+ "on-cat5-container": "#682848",
53
+ "on-cat6-container": "#3a4a00",
54
+ "chart-neutral": "#8c8e8e",
55
+ "syntax-plain": "#27323a",
56
+ "syntax-comment": "#5d666d",
57
+ "syntax-keyword": "#5f45a6",
58
+ "syntax-string": "#006f58",
59
+ "syntax-number": "#914100",
60
+ "syntax-function": "#952c64",
61
+ "ai-you": "#0398cd",
62
+ "ai-you-container": "#d3f2ff",
63
+ "ai-alis": "#f02222",
64
+ "ai-alis-container": "#ffece9",
65
+ "ai-tail": "#19a289",
66
+ "ai-ground-start": "#006383",
67
+ "ai-ground-end": "#004f41",
68
+ "field-grid-line": "rgba(39, 50, 58, 0.06)",
69
+ "field-glow-1": "rgba(0, 99, 131, 0.12)",
70
+ "field-glow-2": "rgba(88, 66, 135, 0.1)",
71
+ "field-noise": "#27323a"
72
+ },
73
+ "dark": {
74
+ "primary": "#7fd4e8",
75
+ "on-primary": "#00303f",
76
+ "signal": "#f02222",
77
+ "on-surface": "#dfe7ec",
78
+ "on-surface-variant": "#9aa6ae",
79
+ "background": "#192127",
80
+ "surface": "#26313a",
81
+ "surface-container-low": "#21292f",
82
+ "surface-container-high": "#29343c",
83
+ "surface-container-highest": "#2f3b45",
84
+ "surface-variant": "#2f3b45",
85
+ "shimmer": "#3d4a55",
86
+ "secondary-container": "#34434e",
87
+ "on-secondary-container": "#dfe7ec",
88
+ "selection-chrome": "#2a363f",
89
+ "outline": "#77838c",
90
+ "outline-variant": "#34414a",
91
+ "error": "#ffb4ab",
92
+ "on-error": "#690005",
93
+ "warning": "#e9b443",
94
+ "success": "#7ccf95",
95
+ "info": "#a9c1ff",
96
+ "inverse-surface": "#dfe7ec",
97
+ "on-inverse-surface": "#27323a",
98
+ "machine-surface": "#0f1418",
99
+ "on-machine-surface": "#dfe7ec",
100
+ "paper": "#ffffff",
101
+ "scrim": "#000000",
102
+ "shadow-key": "rgba(0, 0, 0, 0.4)",
103
+ "shadow-ambient": "rgba(0, 0, 0, 0.45)",
104
+ "highlight": "#5b4614",
105
+ "on-highlight": "#fdecc8",
106
+ "cat1": "#846cd1",
107
+ "cat2": "#19a289",
108
+ "cat3": "#c97409",
109
+ "cat4": "#0398cd",
110
+ "cat5": "#c1548a",
111
+ "cat6": "#728d02",
112
+ "on-cat": "#ffffff",
113
+ "cat1-container": "#2f2752",
114
+ "cat2-container": "#0f3a31",
115
+ "cat3-container": "#43280a",
116
+ "cat4-container": "#0b3446",
117
+ "cat5-container": "#45192f",
118
+ "cat6-container": "#2a3405",
119
+ "on-cat1-container": "#ddd5ff",
120
+ "on-cat2-container": "#b5efdc",
121
+ "on-cat3-container": "#ffd9b3",
122
+ "on-cat4-container": "#c2ecff",
123
+ "on-cat5-container": "#ffd1e6",
124
+ "on-cat6-container": "#d6ea9f",
125
+ "chart-neutral": "#8c8e8e",
126
+ "syntax-plain": "#dfe7ec",
127
+ "syntax-comment": "#9aa6ae",
128
+ "syntax-keyword": "#cdb7ff",
129
+ "syntax-string": "#6de3c8",
130
+ "syntax-number": "#ffb35e",
131
+ "syntax-function": "#ff9fd5",
132
+ "ai-you": "#0398cd",
133
+ "ai-you-container": "#9fdcf0",
134
+ "ai-alis": "#f02222",
135
+ "ai-alis-container": "#f0a39b",
136
+ "ai-tail": "#19a289",
137
+ "ai-ground-start": "#006383",
138
+ "ai-ground-end": "#004f41",
139
+ "field-grid-line": "rgba(127, 212, 232, 0.055)",
140
+ "field-glow-1": "rgba(127, 212, 232, 0.1)",
141
+ "field-glow-2": "rgba(195, 178, 247, 0.08)",
142
+ "field-noise": "#ffffff"
143
+ }
144
+ }