@alis-build/design-system 0.13.2 → 0.15.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.
@@ -0,0 +1,120 @@
1
+ # AppFilePane
2
+
3
+ A file Alis made, opened beside the conversation: a page, a document, an image, a table, code. You look at it and talk about it; you never edit it here.
4
+
5
+ ## Use / don't use
6
+
7
+ See [page.md](../rules/page.md) § A file beside the conversation.
8
+
9
+ - **It is the shell's detail pane, made wide** ([AppShell](AppShell.md)): `app-shell--file` on the shell, the pane in `.app-shell__detail` with `data-detail-pane`. It has a URL, back closes it, Esc closes it, and the shortcut sheet covers it as it covers any detail pane.
10
+ - **From 1200px wide (`breakpoint-large`) it sits beside the conversation**, which takes two parts to its three: at 1440 that is a 707px file, the width of a page of prose. Below 1200 the conversation would wrap every few words, so the file takes the content's place and closing it brings the conversation back. The edge doesn't drag.
11
+ - **Opened from a tile** ([AppAttachment](AppAttachment.md)) where Alis put the file in her reply. **It opens by itself only live**: when the turn that made it ends, you are on the conversation, no other detail pane is open and the window is 1200 or wider. Never when a conversation is reopened, never on a phone, and never where it would cover her reply.
12
+ - **Never the word "artifact"**: the pane is named by the file, its description or else its file name.
13
+ - **No versions.** The file is overwritten in place, so every tile for it opens what is there now, and the meta line says *Latest*.
14
+
15
+ | Part | What it holds |
16
+ |---|---|
17
+ | **Bar** | Close leading, as on every detail pane; the title in `text-section-title`, the meta under it ("HTML page · Latest"); then the tools |
18
+ | **Tools** | Preview / Code as an [AppSegmented](AppSegmented.md), only where a file reads two ways (HTML and SVG: Preview / Code; Markdown: Preview / Source). Then icon buttons, each with its tooltip: Copy (the source, so "Copy code" where there's a Preview; none for an image or a PDF), Download (always), Expand (beside the conversation only) |
19
+ | **Body** | One per kind, below |
20
+ | **Line** | Optional, meta, at the foot: a table cut short says how many rows show |
21
+
22
+ | Kind | Body |
23
+ |---|---|
24
+ | HTML page | A sandboxed frame (`.app-file-pane__frame`) on `paper`, white in every theme: the page sets its own colours, and on a dark ground half of them would vanish. Nothing of AlisX reaches inside |
25
+ | SVG | Preview: as an image (never inline, so its scripts don't run) on `paper` (`--image` with `--paper`) |
26
+ | Markdown | Preview: `.prose` at the prose measure, centred (`--prose`) |
27
+ | Image | Fitted: contained, never cropped, never past its own size (`--image`) |
28
+ | PDF | The browser's own viewer, in a frame. Its controls are the browser's |
29
+ | CSV | [AppTable](AppTable.md), sticky header, its first row as the headings as written, cells unwrapped and scrolling sideways (`--table`). Past the product's row limit, the line: "The first 1,000 of 24,310 rows. Download it for the rest." |
30
+ | Code, plain text, any Code or Source view | Mono 13/20, numbered, on `surface-container-low`, the statement ground: you read it, you don't act on it (`--source`). No wrapping, no colouring by syntax |
31
+
32
+ - **States.** The bar is there from the first frame, since the tile knows the title and the kind; only the body waits. *Loading*: [AppSkeleton](AppSkeleton.md)'s text shape, after 300ms ([loading.md](../rules/loading.md)). *Can't load*: "Couldn't load this file", one supporting line, an outlined Try again, in ink (nothing you did failed). *Too large to show*: "Too large to show here", the name and size, an outlined Download. The product sets the limits per kind.
33
+ - **Expand** (`open_in_full`, "Expand") lets the file take the conversation's place; the navigation pane stays. The same button, now `close_fullscreen` and "Show the chat", brings it back, and so does Esc. Below 1200 there is no Expand: the file already has the content's place.
34
+ - **On a phone** the pane is the whole screen, a step deeper: back (`arrow_back`) leads, and the phone's back gesture closes it. The switch shows its glyphs alone (`visibility`, `code`), each still named, and Copy and Download go into ⋯ ([AppMenu](AppMenu.md)). No Expand.
35
+ - **While it is open, the composer's context chip carries the file** ([AppComposer](AppComposer.md) § Row: Context): its glyph and file name. Closing the chip keeps the pane (you're still looking; you just don't tell Alis), and closing the pane takes the chip.
36
+
37
+ ## Markup
38
+
39
+ ```html
40
+ <div class="app-shell app-shell--detail app-shell--file"> <!-- + app-shell--file-expanded -->
41
+ <nav class="app-shell__nav" aria-label="Main">…</nav>
42
+ <main class="app-shell__main"><!-- the conversation --></main>
43
+
44
+ <aside class="app-shell__detail app-file-pane" id="file-pane" data-detail-pane aria-label="Pricing page">
45
+ <header class="app-file-pane__bar">
46
+ <button type="button" class="app-icon-btn app-state app-target app-wide-only" aria-label="Close" title="Close" aria-keyshortcuts="Escape"><span class="app-icon" aria-hidden="true">close</span></button>
47
+ <button type="button" class="app-icon-btn app-state app-target app-compact-only" aria-label="Back to the chat"><span class="app-icon" aria-hidden="true">arrow_back</span></button>
48
+ <div class="app-file-pane__name">
49
+ <h2 class="text-section-title" title="Pricing page">Pricing page</h2>
50
+ <span class="text-meta">HTML page · Latest</span>
51
+ </div>
52
+ <div class="app-file-pane__tools">
53
+ <div role="radiogroup" aria-label="Show" class="app-seg">
54
+ <button type="button" role="radio" aria-checked="true" tabindex="0" class="app-seg__item app-state is-selected"><span class="app-icon app-icon--filled" aria-hidden="true">visibility</span><span class="app-file-pane__word">Preview</span></button>
55
+ <button type="button" role="radio" aria-checked="false" tabindex="-1" class="app-seg__item app-state"><span class="app-icon" aria-hidden="true">code</span><span class="app-file-pane__word">Code</span></button>
56
+ </div>
57
+ <span class="app-wide-only">
58
+ <button type="button" class="app-icon-btn app-state app-target" aria-label="Copy code" title="Copy code"><span class="app-icon" aria-hidden="true">content_copy</span></button>
59
+ <button type="button" class="app-icon-btn app-state app-target" aria-label="Download" title="Download"><span class="app-icon" aria-hidden="true">download</span></button>
60
+ <button type="button" class="app-icon-btn app-state app-target app-file-pane__expand" aria-label="Expand" title="Expand"><span class="app-icon" aria-hidden="true">open_in_full</span></button>
61
+ </span>
62
+ <button type="button" class="app-icon-btn app-state app-target app-compact-only" aria-label="More" aria-haspopup="menu" aria-expanded="false"><span class="app-icon" aria-hidden="true">more_vert</span></button>
63
+ </div>
64
+ </header>
65
+
66
+ <!-- An HTML page: no allow-same-origin, so it runs in an opaque origin -->
67
+ <div class="app-file-pane__body">
68
+ <iframe class="app-file-pane__frame" sandbox="allow-scripts" srcdoc="…" title="Pricing page"></iframe>
69
+ </div>
70
+
71
+ <!-- Code or Source -->
72
+ <div class="app-file-pane__body app-file-pane__body--source">
73
+ <pre class="app-file-pane__source" tabindex="0" aria-label="Code"><span>&lt;!doctype html&gt;</span><span>&lt;html lang="en"&gt;</span><!-- one span per line --></pre>
74
+ </div>
75
+
76
+ <!-- Markdown -->
77
+ <div class="app-file-pane__body app-file-pane__body--prose"><div class="prose">…</div></div>
78
+
79
+ <!-- An image; an SVG adds app-file-pane__body--paper -->
80
+ <div class="app-file-pane__body app-file-pane__body--image"><img src="…" alt="Churn by month"></div>
81
+
82
+ <!-- A PDF -->
83
+ <div class="app-file-pane__body"><iframe class="app-file-pane__frame" src="…" title="Q3 board summary"></iframe></div>
84
+
85
+ <!-- A CSV -->
86
+ <div class="app-file-pane__body app-file-pane__body--table">
87
+ <div class="app-table-wrap"><table class="app-table app-table--sticky" aria-label="renewals-q3.csv">…</table></div>
88
+ </div>
89
+ <p class="app-file-pane__line text-meta">The first 1,000 of 24,310 rows. Download it for the rest.</p>
90
+
91
+ <!-- Loading -->
92
+ <div class="app-file-pane__body"><div class="app-skel" aria-busy="true" aria-label="Loading"><span class="app-skel__bar app-skel__bar--title"></span><span class="app-skel__bar"></span><span class="app-skel__bar app-skel__bar--short"></span></div></div>
93
+
94
+ <!-- Can't load; too large is the same with Download -->
95
+ <div class="app-file-pane__body"><div class="app-file-pane__state">
96
+ <div class="app-empty">
97
+ <h2 class="app-empty__headline text-section-title">Couldn't load this file</h2>
98
+ <p class="app-empty__line text-supporting">Check your connection, then try again.</p>
99
+ <button type="button" class="app-btn app-state app-target app-btn--outlined"><span class="app-icon" aria-hidden="true">refresh</span>Try again</button>
100
+ </div>
101
+ </div></div>
102
+ </aside>
103
+ </div>
104
+ ```
105
+
106
+ ## Behaviour you must supply
107
+
108
+ - **Opening**: add `app-shell--detail app-shell--file` and the pane; push a history entry with the pane's parameter (another file while it's open replaces the entry); move focus to the pane's title. Mark the tile that opened it `is-selected` and `aria-expanded="true"` (every tile for the same file).
109
+ - **Opening by itself**: only on the conditions above, and without taking focus: the thread keeps it, and the conversation's status region says "Pricing page is open beside the chat".
110
+ - **Closing** (close, back, Esc, the tile again): go back in history, remove the classes and the chip, and return focus to the tile that opened it, or the composer if it was opened by itself.
111
+ - **Esc steps back**: expanded to beside, then closed. When focus is inside the page's frame, its keys are the page's and Esc doesn't reach you; the bar's buttons still work, and Tab leaves the frame.
112
+ - **Expand** toggles `app-shell--file-expanded`, and swaps the glyph and the name ("Expand" / "Show the chat") together.
113
+ - **Preview / Code** re-renders the body; the choice belongs to the pane, not the file, and resets to Preview when another file opens.
114
+ - **The frame**: fetch the text and give it to `srcdoc`, with `sandbox="allow-scripts"` and never `allow-same-origin`. Serve it from a separate origin when there is one.
115
+ - **Copy** writes the source to the clipboard and says "Copied" in a snackbar; **Download** saves the file under its own name.
116
+ - **Missing** (deleted since): the pane shows "This file was deleted" in the can't-load layout with no action, and its tiles turn `is-gone`.
117
+
118
+ ## Classes
119
+
120
+ `.app-shell--file`, `.app-shell--file-expanded`, `.app-file-pane`, `.app-file-pane__bar`, `.app-file-pane__name`, `.app-file-pane__tools`, `.app-file-pane__word`, `.app-file-pane__expand`, `.app-file-pane__body`, `.app-file-pane__body--prose`, `.app-file-pane__body--image`, `.app-file-pane__body--paper`, `.app-file-pane__body--source`, `.app-file-pane__body--table`, `.app-file-pane__frame`, `.app-file-pane__source`, `.app-file-pane__line`, `.app-file-pane__state`.
@@ -6,7 +6,7 @@ A list of acts or places that opens from a control or from what you type, and cl
6
6
 
7
7
  | Behaviour | Opens from | Where | Focus |
8
8
  |---|---|---|---|
9
- | **Action menu** (`role="menu"`) | A `more_vert` icon button, a button with a trailing chevron, the composer's Add, the account card, a long press on a phone | Floats: white at `elevation-2`, 4 from its trigger | Moves to the first item; Escape returns it to the trigger |
9
+ | **Action menu** (`role="menu"`) | A `more_vert` icon button, a button with a trailing chevron, the composer's Add, the account card, a long press on a phone | Floats: `surface-container-high` (white in light) at `elevation-2`, 4 from its trigger | Moves to the first item; Escape returns it to the trigger |
10
10
  | **Suggestion menu** (`role="listbox"`) | Typing `/` or `@` in an editor | In a composer, a band on its surface above the editor (`.app-menu--suggest`), like an [AppAsk](AppAsk.md). In a document, at the caret | Stays in the editor; the active row follows the arrows |
11
11
 
12
12
  - **Not a form.** A field, a checkbox or a type-to-confirm inside a menu is an [AppDialog](AppDialog.md); the item that opens it ends in an ellipsis ("Deploy to production…").
@@ -18,7 +18,7 @@ A list of acts or places that opens from a control or from what you type, and cl
18
18
 
19
19
  | Part | What it is |
20
20
  |---|---|
21
- | **Surface** | White, `elevation-2`, `radius-lg` (16) with 8 inside, so a row's `radius-sm` (8) is concentric. 200 to 320 wide. The one list in the product that is white ([surfaces.md](../rules/surfaces.md)). A suggestion band has no surface of its own: it is the composer's, with a hairline under it, and its rows take the ask's `radius-md` |
21
+ | **Surface** | `surface-container-high`: white in light, a step lighter than a card in dark ([themes.md](../rules/themes.md)). `elevation-2`, `radius-lg` (16) with 8 inside, so a row's `radius-sm` (8) is concentric. 200 to 320 wide. The one list in the product that is white ([surfaces.md](../rules/surfaces.md)). A suggestion band has no surface of its own: it is the composer's, with a hairline under it, and its rows take the ask's `radius-md` |
22
22
  | **Row** | 40 tall (48 under a coarse pointer), the whole row the target. A 20px icon in `on-surface-variant` if any row in the menu has one; the label at 14/20 500, set by the menu, no role |
23
23
  | **Second line** | Meta, only when the label can't stand alone: who has access, what a command does, a person's role |
24
24
  | **Hint** | Trailing: a shortcut as an [AppKeys](AppKeys.md), or a /name in meta. Or `open_in_new` when the item leaves the app. Never a chevron |
@@ -17,6 +17,7 @@ See [surfaces.md](../rules/surfaces.md) and [page.md](../rules/page.md).
17
17
  - The pane is permanent chrome, so selection there is `selection-chrome`. Which destinations each product lists is product content, not part of this system.
18
18
  - **Content**: an [AppTitleBar](AppTitleBar.md), then `.app-shell__content`, which pads 24 on every side (32 below) and fills the pane, holding the filter row and the list, table or document.
19
19
  - **Detail pane** (`detail-width`, 360px): what is selected in the content, led by a detail title bar. It sits on the ground behind a divider, never on a card, and scrolls on its own. **It has a URL** (a query parameter, as search keeps `?q=`), so a refresh, a shared link and back all find it. The [AppShortcutSheet](AppShortcutSheet.md) opens in its place: the content narrows for it, or it covers an open detail pane until it closes. Below 840px it slides over the content at `elevation-3`, over a scrim.
20
+ - **A file beside the conversation** ([AppFilePane](AppFilePane.md)) is the detail pane made wide: `app-shell--file`. From 1200 the content takes two parts and the file three; below it the file takes the content's place; `app-shell--file-expanded` does the same at any width. It never slides over at `elevation-3`.
20
21
  - **On a phone** (below 600px) the shell is one column: the content, under a one-row title bar ([AppTitleBar](AppTitleBar.md) § On a phone).
21
22
  - **The navigation pane fills the screen**: the same pane, brand, groups, agent chats and foot unchanged, hidden until the title bar's menu button opens it (`app-shell--nav-open`). It lies on the ground, edge to edge inside the safe area: nothing shows behind it, so no scrim and no elevation. Its close (`.app-shell__nav-close`, "Close navigation") sits in its head beside the brand. Never a column of icons: it hid the agent chats, the place you go back to most, and left the content too little room.
22
23
  - **The detail pane covers the full width**, and its bar leads with back (`arrow_back`) instead of close: on a phone it reads as a step deeper, and the phone's own back gesture closes it.
@@ -14,7 +14,7 @@ Names a control that shows no words, and carries its keys ([shortcuts.md](../rul
14
14
 
15
15
  | Part | What it is |
16
16
  |---|---|
17
- | **Surface** | `inverse-surface`, `radius-sm`, no shadow; 28 tall for one line, at most 240 wide, wrapping after that |
17
+ | **Surface** | `inverse-surface`, Material 3's plain tooltip: the reverse of the UI around it, so it is petrol in light and light in dark. `radius-sm`, no shadow; 28 tall for one line, at most 240 wide, wrapping after that |
18
18
  | **Label** | `on-inverse-surface` at 12/16 500, sentence case, no full stop: the action ("Resolve conversation") |
19
19
  | **Keys** | An [AppKeys](AppKeys.md) after the label, 8 from it, the tooltip's end padding drawn in to 4 |
20
20
  | **Place** | 4 below the control, centred on it; flipped above when there isn't room below, and kept 8 inside the window |
@@ -44,6 +44,7 @@ One turn in a conversation, in an `.app-thread`. **You write in a bubble; Alis w
44
44
 
45
45
  ## What you send
46
46
 
47
+ - **What it was about**: when the composer's context chip went with your message, a meta line above your bubble names it, in `on-surface-variant` (`.app-turn__about`): "About Pricing rethink", "About pricing.html". The chip as it was when you sent, so the thread says what Alis was looking at.
47
48
  - **Files and things** keep their [AppAttachment](AppAttachment.md) tile from the tray, without remove, stacked right above your bubble; the tile opens what it names. A thing shared into the conversation (a meeting, its notes, an interview, diagnostics, a skill, an issue, an agent session) is the same tile, never a card with a button in it. An image shows itself, 240 wide. A file or a thing sent alone is a turn with no bubble.
48
49
  - **A voice note** is its own bubble (`.app-voice-note`): play, the waveform (played in `primary`, the rest in `outline`) and the time, then the transcript in body, three lines and Show all. The transcript is what Alis acted on, so a misheard word is in plain sight.
49
50
 
@@ -103,6 +104,7 @@ One line in meta where it happened (`.app-turn__line`, as the composer's):
103
104
 
104
105
  <!-- You: files, then the bubble; hover actions beside it -->
105
106
  <div class="app-turn app-turn--you">
107
+ <span class="app-turn__about text-meta">About pricing.html</span>
106
108
  <div class="app-turn__files">
107
109
  <a class="app-attachment" href="…"><!-- AppAttachment, no remove --></a>
108
110
  <a class="app-turn__image" href="…"><img src="…" alt="Churn by month"></a>
@@ -207,4 +209,4 @@ Northwind 120 —</pre></li>
207
209
 
208
210
  ## Classes
209
211
 
210
- `.app-thread`, `.app-thread__event`, `.app-thread__typing`, `.app-thread__status`; `.app-turn`, `.app-turn--you`, `.app-turn--alis`, `.app-turn--them`, `.is-latest`; `.app-turn__who`, `.app-turn__avatar`, `.app-turn__avatar--alis`; `.app-turn__head`, `.app-turn__mark`, `.app-turn__status`, `.app-turn__worked`, `.app-turn__steps`, `.app-turn__step`, `.app-turn__output`, `.app-turn__caret`; `.app-turn__row`, `.app-turn__bubble`, `.app-turn__bubble--voice`, `.app-turn__tools`, `.app-turn__files`, `.app-turn__image`; `.app-turn__foot`; `.app-turn__line`, `.is-error`, `.app-turn__line-action`; `.app-turn__record`; `.app-turn__request`; `.app-voice-note`, `.is-open`, `.app-voice-note__player`, `.app-voice-note__wave`, `.is-played`, `.app-voice-note__time`, `.app-voice-note__transcript`, `.app-voice-note__more`; with `.prose` on her reply, `.app-icon-btn` and `.app-state` on the buttons, and `.app-loader.app-loader--line` on the mark while she thinks.
212
+ `.app-thread`, `.app-thread__event`, `.app-thread__typing`, `.app-thread__status`; `.app-turn`, `.app-turn--you`, `.app-turn--alis`, `.app-turn--them`, `.is-latest`; `.app-turn__about`, `.app-turn__who`, `.app-turn__avatar`, `.app-turn__avatar--alis`; `.app-turn__head`, `.app-turn__mark`, `.app-turn__status`, `.app-turn__worked`, `.app-turn__steps`, `.app-turn__step`, `.app-turn__output`, `.app-turn__caret`; `.app-turn__row`, `.app-turn__bubble`, `.app-turn__bubble--voice`, `.app-turn__tools`, `.app-turn__files`, `.app-turn__image`; `.app-turn__foot`; `.app-turn__line`, `.is-error`, `.app-turn__line-action`; `.app-turn__record`; `.app-turn__request`; `.app-voice-note`, `.is-open`, `.app-voice-note__player`, `.app-voice-note__wave`, `.is-played`, `.app-voice-note__time`, `.app-voice-note__transcript`, `.app-voice-note__more`; with `.prose` on her reply, `.app-icon-btn` and `.app-state` on the buttons, and `.app-loader.app-loader--line` on the mark while she thinks.
@@ -25,6 +25,7 @@ Shared conventions: `app-state` gives anything pressable its hover, focus and pr
25
25
  | AppSwitch | An on/off setting | [AppSwitch.md](AppSwitch.md) |
26
26
  | AppTooltip | Names a control that shows no words, and carries its keys | [AppTooltip.md](AppTooltip.md) |
27
27
  | AppKeys | A keyboard shortcut, one cap per key, written for the platform | [AppKeys.md](AppKeys.md) |
28
+ | AppFilePane | A file Alis made, opened beside the conversation: Preview / Code, each kind's body, its states | [AppFilePane.md](AppFilePane.md) |
28
29
  | AppShortcutSheet | Every key the screen answers to, opened by `?`, in the detail pane's place | [AppShortcutSheet.md](AppShortcutSheet.md) |
29
30
  | AppChip | A small fact: status, label, category, filter, input | [AppChip.md](AppChip.md) |
30
31
  | AppAlert | A statement carrying one status; the snackbar | [AppAlert.md](AppAlert.md) |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alis-build/design-system",
3
- "version": "0.13.2",
3
+ "version": "0.15.0",
4
4
  "description": "The AlisX design system for coding agents: tokens, product CSS, component markup, capability marks and rules.",
5
5
  "keywords": ["alisx", "design-system", "design-tokens", "css"],
6
6
  "homepage": "https://alisx.com",
@@ -9,8 +9,10 @@
9
9
  "sideEffects": ["*.css"],
10
10
  "exports": {
11
11
  "./alisx.css": "./alisx.css",
12
+ "./tokens.css": "./tokens.css",
12
13
  "./fonts.css": "./fonts.css",
13
14
  "./tokens.json": "./tokens.json",
15
+ "./themes.json": "./themes.json",
14
16
  "./marks.json": "./marks.json",
15
17
  "./rules/*": "./rules/*",
16
18
  "./components/*": "./components/*",
@@ -19,8 +21,10 @@
19
21
  },
20
22
  "files": [
21
23
  "alisx.css",
24
+ "tokens.css",
22
25
  "fonts.css",
23
26
  "tokens.json",
27
+ "themes.json",
24
28
  "marks.json",
25
29
  "rules",
26
30
  "components",
package/rules/README.md CHANGED
@@ -16,6 +16,7 @@ Read only what the job needs.
16
16
  | --- | --- |
17
17
  | [register.md](register.md) | Which register a surface is in, and the voice |
18
18
  | [colour.md](colour.md) | Roles, the one action colour, status, categories |
19
+ | [themes.md](themes.md) | Light and dark: asking for a theme, what changes, what doesn't |
19
20
  | [type.md](type.md) | Type roles, weights, the shapes text takes |
20
21
  | [surfaces.md](surfaces.md) | Ground, statement, instrument, lattice; depth |
21
22
  | [spacing.md](spacing.md) | The scale, targets, density |
@@ -62,7 +63,7 @@ The product has **no product tones**: the navigation pane and the page say which
62
63
 
63
64
  ## Tokens
64
65
 
65
- `alisx.css` carries every token as a custom property and every type style as a class; it is generated from `tokens.json`, the source for every other platform too. Three layers: **palette** tokens (`petrol-800`, `paper-50`, `alis-red` …) hold literal values; **product roles** (`primary`, `on-surface`, `surface-container-low` …) are named by job and alias the palette, so build with these; **narrative roles** belong to alisx.com and never appear in the product. In `tokens.json` a role's value is a reference such as `{cyan-600}`, resolved against the palette. Set a component library's theme (button weight, state-layer opacities, shape scale) from the tokens once rather than overriding components.
66
+ `alisx.css` carries every token as a custom property and every type style as a class; it is generated from `tokens.json`, the source for every other platform too. Three layers, each colour token tagged with its `register`: **palette** tokens (`petrol-800`, `paper-50`, `alis-red` …) hold literal values; **product roles** (`primary`, `on-surface`, `surface-container-low` …) are named by job, with a value for each theme, light and dark, so build with these and both themes come free ([themes.md](themes.md)); **narrative roles** belong to alisx.com and never appear in the product. `tokens.css` carries the tokens alone, and `themes.json` every product role resolved per theme; read those rather than resolving `tokens.json` yourself. Set a component library's theme (button weight, state-layer opacities, shape scale) from the tokens once rather than overriding components.
66
67
 
67
68
  ## Components
68
69
 
@@ -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
@@ -77,6 +77,18 @@ back, at every width; on a phone, where the pane covers the window, its close
77
77
  becomes back (`arrow_back`) and the phone's back gesture closes it
78
78
  ([AppShell](../components/AppShell.md)).
79
79
 
80
+ ## A file beside the conversation
81
+
82
+ **A file Alis made opens beside the conversation**, in the detail pane made wide
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
86
+ itself only live, only where it fits beside her reply, never on a phone. While it is
87
+ open the composer's context chip carries it, and your bubble's about line names it.
88
+ The tile in her reply opens it; a file a browser can't show keeps its download tile.
89
+ The pane is named by the file, never "artifact", and has no versions: it says
90
+ *Latest*.
91
+
80
92
  **On a phone** the title bar is one row: menu or back, the name, the lead as its
81
93
  glyph, ⋯ for every other verb ([AppTitleBar](../components/AppTitleBar.md) § On a
82
94
  phone). Nothing else earns a place in it.
@@ -67,7 +67,7 @@ nothing here is left out, not dimmed.
67
67
  | Keys | Does |
68
68
  | --- | --- |
69
69
  | ? | Opens or closes the sheet |
70
- | Esc | Closes what is open (a menu, a dialog, the sheet). In a field it does the field's own job first (clears a search's query, closes a `/` or `@` band, cancels a rename), and otherwise leaves the field |
70
+ | Esc | Closes what is open (a menu, a dialog, the sheet). In a field it does the field's own job first (clears a search's query, closes a `/` or `@` band, cancels a rename), and otherwise leaves the field. One step at a time: an expanded file goes back beside the conversation before it closes. Inside a page's frame (AppFilePane) keys are the page's, so Esc doesn't reach the app; the pane's bar still works |
71
71
  | / | Puts you in the screen's search field |
72
72
  | ⌘ K | Reserved for finding anything across the product ([known-gaps.md](known-gaps.md)); bind nothing to it |
73
73
 
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
@@ -88,5 +88,11 @@ Why is this above the page?
88
88
  Transparency and blur appear in exactly four places: a floating nav pill, glass
89
89
  on a dark panel, a dialog backdrop, and the statement over a gradient.
90
90
 
91
- No card relies on a shadow to be legible, so every rule here survives a dark
92
- theme.
91
+ **What floats takes `surface-container-high`**: a menu, the composer, a dialog,
92
+ the detail pane when it slides over, a dragged card. In light it is white, the
93
+ same as an instrument. In dark it is one step lighter, because there lightness
94
+ does the lifting a shadow can't.
95
+
96
+ No card relies on a shadow to be legible, so every rule here holds in dark
97
+ ([themes.md](themes.md)). A statement lifts off the dark ground instead of
98
+ 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.