@tjakoen/grain 0.1.12
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/LICENSE +202 -0
- package/PLAN.md +27 -0
- package/README.md +243 -0
- package/ai/accepts.test.ts +69 -0
- package/ai/accepts.ts +57 -0
- package/ai/ai.css +127 -0
- package/ai/client-door.test.ts +70 -0
- package/ai/client-door.ts +56 -0
- package/ai/contract.test.ts +158 -0
- package/ai/contract.ts +285 -0
- package/ai/interaction-layer.test.ts +270 -0
- package/ai/interaction-layer.ts +138 -0
- package/ai/manifest-dom.test.ts +176 -0
- package/ai/manifest-dom.ts +187 -0
- package/ai/manifest.test.ts +71 -0
- package/ai/manifest.ts +57 -0
- package/ai/markdown.test.ts +68 -0
- package/ai/markdown.ts +74 -0
- package/ai/model-chat.test.ts +131 -0
- package/ai/model-chat.ts +151 -0
- package/ai/model-reasoner.test.ts +152 -0
- package/ai/model-reasoner.ts +146 -0
- package/ai/model.test.ts +148 -0
- package/ai/model.ts +200 -0
- package/ai/reasoner-kit.test.ts +142 -0
- package/ai/reasoner-kit.ts +159 -0
- package/ai/reasoner.test.ts +227 -0
- package/ai/reasoner.ts +446 -0
- package/ai/timeline-log.test.ts +55 -0
- package/ai/timeline-log.ts +50 -0
- package/ai/vocab-reference.test.ts +43 -0
- package/ai/vocab-reference.ts +107 -0
- package/ai/webllm.test.ts +79 -0
- package/ai/webllm.ts +125 -0
- package/assets/figure-sample.svg +14 -0
- package/assets/sprite.svg +22 -0
- package/catalog/catalog.test.ts +37 -0
- package/catalog/catalog.ts +424 -0
- package/components/atoms/action-badge/action-badge.css +17 -0
- package/components/atoms/action-badge/action-badge.html +6 -0
- package/components/atoms/action-badge/action-badge.md +23 -0
- package/components/atoms/b-badge/b-badge.css +15 -0
- package/components/atoms/b-badge/b-badge.html +2 -0
- package/components/atoms/b-badge/b-badge.md +16 -0
- package/components/atoms/b-button/b-button.ai.md +22 -0
- package/components/atoms/b-button/b-button.css +87 -0
- package/components/atoms/b-button/b-button.html +5 -0
- package/components/atoms/b-button/b-button.md +77 -0
- package/components/atoms/b-icon/b-icon.css +10 -0
- package/components/atoms/b-icon/b-icon.html +5 -0
- package/components/atoms/b-icon/b-icon.md +36 -0
- package/components/atoms/b-icon-button/b-icon-button.ai.md +11 -0
- package/components/atoms/b-icon-button/b-icon-button.css +43 -0
- package/components/atoms/b-icon-button/b-icon-button.html +8 -0
- package/components/atoms/b-icon-button/b-icon-button.md +33 -0
- package/components/atoms/b-input/b-input.css +36 -0
- package/components/atoms/b-input/b-input.html +8 -0
- package/components/atoms/b-input/b-input.md +59 -0
- package/components/atoms/b-kbd/b-kbd.css +11 -0
- package/components/atoms/b-kbd/b-kbd.html +3 -0
- package/components/atoms/b-kbd/b-kbd.md +13 -0
- package/components/atoms/b-list/b-list.css +21 -0
- package/components/atoms/b-list/b-list.html +6 -0
- package/components/atoms/b-list/b-list.md +24 -0
- package/components/atoms/b-meter/b-meter.css +39 -0
- package/components/atoms/b-meter/b-meter.md +44 -0
- package/components/atoms/b-select/b-select.css +35 -0
- package/components/atoms/b-select/b-select.md +75 -0
- package/components/atoms/b-switch/b-switch.css +61 -0
- package/components/atoms/b-switch/b-switch.html +6 -0
- package/components/atoms/b-switch/b-switch.md +40 -0
- package/components/atoms/b-text/b-text.ai.md +29 -0
- package/components/atoms/b-text/b-text.css +2 -0
- package/components/atoms/b-text/b-text.html +3 -0
- package/components/atoms/b-text/b-text.md +23 -0
- package/components/atoms/code-block/code-block.css +42 -0
- package/components/atoms/code-block/code-block.md +23 -0
- package/components/examples.test.ts +23 -0
- package/components/molecules/callout/callout.css +19 -0
- package/components/molecules/callout/callout.md +15 -0
- package/components/molecules/card/card.css +28 -0
- package/components/molecules/card/card.md +30 -0
- package/components/molecules/chat-message/chat-message.css +83 -0
- package/components/molecules/chat-message/chat-message.md +52 -0
- package/components/molecules/chip-group/chip-group.css +35 -0
- package/components/molecules/chip-group/chip-group.md +42 -0
- package/components/molecules/content-index/content-index.css +87 -0
- package/components/molecules/content-index/content-index.md +27 -0
- package/components/molecules/content-source/content-source.css +6 -0
- package/components/molecules/content-source/content-source.md +13 -0
- package/components/molecules/figure/figure.css +19 -0
- package/components/molecules/figure/figure.md +20 -0
- package/components/molecules/lede/lede.css +17 -0
- package/components/molecules/lede/lede.md +17 -0
- package/components/molecules/made-with/made-with.css +25 -0
- package/components/molecules/made-with/made-with.md +35 -0
- package/components/molecules/nav-item/nav-item.css +19 -0
- package/components/molecules/nav-item/nav-item.md +21 -0
- package/components/molecules/stat-tile/stat-tile.css +34 -0
- package/components/molecules/stat-tile/stat-tile.md +50 -0
- package/components/molecules/status-list/status-list.css +47 -0
- package/components/molecules/status-list/status-list.md +62 -0
- package/components/molecules/tab/tab.css +32 -0
- package/components/molecules/tab/tab.md +27 -0
- package/components/molecules/table/table.css +23 -0
- package/components/molecules/table/table.md +18 -0
- package/components/organisms/activity-bar/activity-bar.css +36 -0
- package/components/organisms/activity-bar/activity-bar.md +43 -0
- package/components/organisms/app-shell/app-shell.css +193 -0
- package/components/organisms/app-shell/app-shell.md +58 -0
- package/components/organisms/app-shell/app-shell.test.ts +74 -0
- package/components/organisms/app-window/app-window.css +111 -0
- package/components/organisms/app-window/app-window.md +53 -0
- package/components/organisms/chat-log/chat-log.css +5 -0
- package/components/organisms/chat-log/chat-log.md +14 -0
- package/components/organisms/code-editor/code-editor.ai.md +31 -0
- package/components/organisms/code-editor/code-editor.css +111 -0
- package/components/organisms/code-editor/code-editor.md +122 -0
- package/components/organisms/console/console.css +112 -0
- package/components/organisms/console/console.md +66 -0
- package/components/organisms/file-tree/file-tree.css +85 -0
- package/components/organisms/file-tree/file-tree.md +49 -0
- package/components/organisms/note/note.css +19 -0
- package/components/organisms/note/note.md +20 -0
- package/components/organisms/notepad/notepad.css +60 -0
- package/components/organisms/notepad/notepad.md +40 -0
- package/components/organisms/side-rail/side-rail.css +55 -0
- package/components/organisms/side-rail/side-rail.md +24 -0
- package/components/organisms/sidebar-panel/sidebar-panel.css +69 -0
- package/components/organisms/sidebar-panel/sidebar-panel.md +47 -0
- package/components/organisms/status-bar/status-bar.css +33 -0
- package/components/organisms/status-bar/status-bar.md +28 -0
- package/components/organisms/tab-bar/tab-bar.css +48 -0
- package/components/organisms/tab-bar/tab-bar.md +26 -0
- package/components/organisms/timeline/timeline.css +51 -0
- package/components/organisms/timeline/timeline.md +42 -0
- package/components/organisms/topbar/topbar.css +8 -0
- package/components/organisms/topbar/topbar.md +26 -0
- package/components/responsive-polish.test.ts +43 -0
- package/components/tokens.test.ts +39 -0
- package/fonts/redaction-35-400.woff2 +0 -0
- package/fonts/redaction-400.woff2 +0 -0
- package/fonts/redaction-50-400.woff2 +0 -0
- package/fonts/redaction-70-400.woff2 +0 -0
- package/package.json +46 -0
- package/scripts/ai-dispatch.js +583 -0
- package/scripts/ai-dispatch.test.ts +85 -0
- package/scripts/ai-spotlight.d.ts +23 -0
- package/scripts/ai-spotlight.js +139 -0
- package/scripts/ai-spotlight.test.ts +31 -0
- package/scripts/catalog-peek.js +156 -0
- package/scripts/catalog-peek.test.ts +31 -0
- package/scripts/cmdk.js +159 -0
- package/scripts/demo-box.js +53 -0
- package/scripts/handoff.js +64 -0
- package/scripts/handoff.test.ts +36 -0
- package/scripts/lightbox.js +144 -0
- package/scripts/lightbox.test.ts +23 -0
- package/scripts/made-with.d.ts +2 -0
- package/scripts/made-with.js +22 -0
- package/scripts/made-with.test.ts +25 -0
- package/scripts/notepad.js +100 -0
- package/scripts/shell.js +204 -0
- package/scripts/shell.test.ts +50 -0
- package/scripts/tabs.js +127 -0
- package/scripts/tabs.test.ts +40 -0
- package/scripts/terminal.js +271 -0
- package/scripts/terminal.test.ts +36 -0
- package/scripts/theme-boot.js +15 -0
- package/scripts/theme.js +87 -0
- package/scripts/type-effect.js +25 -0
- package/scripts/xray.js +79 -0
- package/scripts/xray.test.ts +43 -0
- package/styles/cmdk.css +65 -0
- package/styles/global.css +80 -0
- package/styles/grain.css +47 -0
- package/styles/lightbox.css +78 -0
- package/styles/themes/_template.css +48 -0
- package/styles/themes/baguette.css +30 -0
- package/styles/themes/brioche.css +30 -0
- package/styles/variables.css +217 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/* organisms/notepad — the AI's MEMORY as a visible, editable surface (DEMO-PLAN piece 2). A rail
|
|
2
|
+
pane with two modes: RENDERED (the notes, read-only, where note.append/note.replace ops land) and
|
|
3
|
+
SOURCE (a textarea the human edits, then commits through the one door). One toggle flips between
|
|
4
|
+
them; the canonical state is the markdown SOURCE (a client island mirrors it to localStorage from
|
|
5
|
+
each entry's data-md — see grain/scripts/notepad.js). Persona-neutral: "the AI", never "the desk".
|
|
6
|
+
CSS-only structure — compose the markup from notepad.md. AI-authored entries carry data-grade
|
|
7
|
+
="grain" (provenance persists, DESIGN-SYSTEM §3); a human commit settles clean. Tokens only.
|
|
8
|
+
(Loads after side-rail.css in the sorted bundle; mounts inside the rail like any pane.) */
|
|
9
|
+
|
|
10
|
+
.notepad { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto;
|
|
11
|
+
font-family: var(--font-smooth); font-size: var(--text-sm); color: var(--color-fg); }
|
|
12
|
+
|
|
13
|
+
/* header row: the pane title + the source⇄rendered toggle + (in source mode) the Commit control */
|
|
14
|
+
.notepad__head { display: flex; align-items: center; gap: var(--space-2); flex: 0 0 auto;
|
|
15
|
+
padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--color-line); }
|
|
16
|
+
.notepad__title { font-family: var(--font-grain); font-size: var(--text-xs); text-transform: uppercase;
|
|
17
|
+
letter-spacing: 0.06em; color: var(--ink-faint); margin-right: auto; }
|
|
18
|
+
.notepad__toggle, .notepad__commit { cursor: pointer; font: inherit; font-size: var(--text-xs);
|
|
19
|
+
color: var(--color-fg); background: transparent; border: 1px solid var(--color-line);
|
|
20
|
+
border-radius: var(--radius-sm); padding: 2px var(--space-2); }
|
|
21
|
+
.notepad__toggle:hover, .notepad__commit:hover { background: var(--paper-2); }
|
|
22
|
+
.notepad__toggle:focus-visible, .notepad__commit:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
|
|
23
|
+
/* the toggle's label reflects the pane's mode (::before, so it stays right if state is reset externally) */
|
|
24
|
+
.notepad__toggle::before { content: "◑ source"; }
|
|
25
|
+
.notepad[data-mode="source"] .notepad__toggle::before { content: "◐ rendered"; }
|
|
26
|
+
/* Commit only makes sense while editing the source; hidden in rendered mode */
|
|
27
|
+
.notepad__commit { display: none; }
|
|
28
|
+
.notepad[data-mode="source"] .notepad__commit { display: inline-flex; align-items: center; }
|
|
29
|
+
|
|
30
|
+
/* the two panes share the scroll area; only one shows at a time (driven by data-mode) */
|
|
31
|
+
.notepad__body, .notepad__source { flex: 1 1 0; min-height: 0; overflow: auto; scroll-behavior: smooth;
|
|
32
|
+
padding: var(--space-3); }
|
|
33
|
+
.notepad[data-mode="source"] .notepad__body { display: none; }
|
|
34
|
+
.notepad:not([data-mode="source"]) .notepad__source { display: none; }
|
|
35
|
+
|
|
36
|
+
/* RENDERED: the notes. Each entry is one markdown block; AI entries grade grain, human clean. */
|
|
37
|
+
.notepad__body { display: flex; flex-direction: column; gap: var(--space-3); }
|
|
38
|
+
.notepad__body:empty::after,
|
|
39
|
+
.notepad__body:not(:has(.notepad__entry))::after {
|
|
40
|
+
content: "Nothing noted yet."; color: var(--ink-faint); font-style: italic; }
|
|
41
|
+
/* min-width:0 lets the entry shrink below its content's intrinsic width (a flex child won't by
|
|
42
|
+
default), and overflow-wrap breaks a long unbroken token instead of forcing the whole pane wide —
|
|
43
|
+
together they stop a long AI line or pasted URL from giving the panel a horizontal scrollbar. */
|
|
44
|
+
.notepad__entry { min-width: 0; overflow-wrap: anywhere; }
|
|
45
|
+
/* a code block is the one thing that shouldn't hard-wrap — let it scroll on its own, capped to width */
|
|
46
|
+
.notepad__entry pre { max-width: 100%; overflow-x: auto; }
|
|
47
|
+
.notepad__entry[data-grade="grain"] { color: var(--color-grain, var(--color-muted)); }
|
|
48
|
+
.notepad__entry > :first-child { margin-top: 0; }
|
|
49
|
+
.notepad__entry > :last-child { margin-bottom: 0; }
|
|
50
|
+
.notepad__entry a { color: var(--color-accent); text-decoration: none; }
|
|
51
|
+
.notepad__entry a:hover { text-decoration: underline; }
|
|
52
|
+
.notepad__entry code { font-family: var(--font-grain); font-size: 0.9em; }
|
|
53
|
+
|
|
54
|
+
/* SOURCE: the human's editable markdown. Clean ink (human authorship); mono for source legibility. */
|
|
55
|
+
.notepad__source { display: block; width: 100%; resize: none; box-sizing: border-box;
|
|
56
|
+
background: var(--color-bg); border: 0; outline: none;
|
|
57
|
+
color: var(--color-fg); font-family: var(--font-grain); font-size: var(--text-sm); line-height: 1.6; }
|
|
58
|
+
.notepad__source::placeholder { color: var(--ink-faint); }
|
|
59
|
+
|
|
60
|
+
@media (prefers-reduced-motion: reduce) { .notepad__body, .notepad__source { scroll-behavior: auto; } }
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Notepad
|
|
2
|
+
|
|
3
|
+
The AI's memory as a **visible, editable surface** — a rail pane both operators write through the one
|
|
4
|
+
door. Two modes flip on `data-mode`: **rendered** (the notes, where `note.append` / `note.replace` ops
|
|
5
|
+
land on the inner `notepad-body` surface) and **source** (a textarea the human edits, then commits).
|
|
6
|
+
|
|
7
|
+
The canonical state is the markdown **source**, not this rendered HTML: each `.notepad__entry` carries
|
|
8
|
+
its own source in `data-md`, so a client island can rebuild the whole pad's markdown (join the entries)
|
|
9
|
+
and mirror it to `localStorage` — the DOM is a projection, the source is the truth. Build entries with
|
|
10
|
+
`notepadEntry` / an `note.append` op (`ai/reasoner-kit.ts`) so the grade and the `data-md` round-trip are
|
|
11
|
+
never hand-rolled. An AI entry grades `grain` (provenance persists, DESIGN-SYSTEM §3); a human commit
|
|
12
|
+
settles clean.
|
|
13
|
+
|
|
14
|
+
The `note.*` verbs accept the `notepad` **kind** (the wrapper — also the surface the AI-acting spotlight
|
|
15
|
+
lights); the ops write to the inner `notepad-body` push surface. Behaviour (the source⇄rendered toggle,
|
|
16
|
+
localStorage mirror, and the human's Commit → `note.replace` through the door) is the consumer's island;
|
|
17
|
+
`grain/scripts/notepad.js` ships a persona-neutral one.
|
|
18
|
+
|
|
19
|
+
## Pane
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<section class="notepad" data-mode="rendered" data-surface="notepad">
|
|
23
|
+
<header class="notepad__head">
|
|
24
|
+
<span class="notepad__title">Notepad</span>
|
|
25
|
+
<button type="button" class="notepad__toggle" aria-label="Toggle source / rendered"></button>
|
|
26
|
+
<button type="button" class="notepad__commit"
|
|
27
|
+
data-action="note.replace" data-target="notepad" data-from="notepad-src">Commit</button>
|
|
28
|
+
</header>
|
|
29
|
+
<div class="notepad__body" data-surface="notepad-body">
|
|
30
|
+
<div class="notepad__entry" data-grade="grain" data-md="**New this week:** an app-like feel."><p><strong>New this week:</strong> an app-like feel.</p></div>
|
|
31
|
+
</div>
|
|
32
|
+
<textarea class="notepad__source" data-surface="notepad-src" aria-label="Notepad source (markdown)"
|
|
33
|
+
placeholder="Write markdown…"></textarea>
|
|
34
|
+
</section>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The Commit button is a normal `[data-action]` trigger: it reads the textarea by its surface address
|
|
38
|
+
(`data-from="notepad-src"`, resolved the same way the chat composer's Send reads `chat-input`) and
|
|
39
|
+
raises `note.replace` on the `notepad` surface — the same door a page control or the AI uses, no
|
|
40
|
+
parallel path. The `note.append` verb (used by an AI "add to my notes" action) writes without clearing.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/* organisms/side-rail — the vertical navigation rail inside the app-shell: a brand at the
|
|
2
|
+
top, nav-items, a spacer, then footer items (settings). The rail draws a shared ICON
|
|
3
|
+
GUTTER (a fixed column + a hairline) so every item's glyph sits in its own vertical
|
|
4
|
+
column beside the labels — the editor-workspace look. Collapses to icons-only when the
|
|
5
|
+
shell carries data-rail-collapsed (labels are dropped, the gutter line goes). Composed
|
|
6
|
+
with b-icon + nav-item; a layout class, not a data-bound tag. */
|
|
7
|
+
.side-rail {
|
|
8
|
+
position: relative;
|
|
9
|
+
display: flex; flex-direction: column; gap: 2px;
|
|
10
|
+
height: 100%; padding: var(--space-3) var(--space-2);
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
}
|
|
13
|
+
/* the gutter line — one hairline the full height of the rail, at the icon column's edge */
|
|
14
|
+
.side-rail::before {
|
|
15
|
+
content: ""; position: absolute; top: 0; bottom: 0;
|
|
16
|
+
left: calc(var(--space-2) + var(--rail-icon-col, 2.5rem));
|
|
17
|
+
width: 1px; background: var(--color-line);
|
|
18
|
+
}
|
|
19
|
+
.side-rail__brand {
|
|
20
|
+
display: grid; grid-template-columns: var(--rail-icon-col, 2.5rem) 1fr;
|
|
21
|
+
align-items: center; column-gap: var(--space-2);
|
|
22
|
+
padding: var(--space-2) 0 var(--space-4);
|
|
23
|
+
font-family: var(--font-accent); letter-spacing: 0.02em;
|
|
24
|
+
white-space: nowrap;
|
|
25
|
+
}
|
|
26
|
+
.side-rail__brand > b-icon, .side-rail__brand > .icon { justify-self: center; }
|
|
27
|
+
/* the brand mark carries the theme's accent — hueless under Sourdough, a hue under Baguette/
|
|
28
|
+
Brioche (the accent reaches the brand + the presence star; DESIGN-SYSTEM §2). */
|
|
29
|
+
.side-rail__brand > b-icon { color: var(--color-accent); }
|
|
30
|
+
.side-rail__spacer { flex: 1 1 auto; }
|
|
31
|
+
|
|
32
|
+
/* ---- grouped nav — a collapsible section for nested navigation (e.g. a BREAD group over
|
|
33
|
+
BATCH / GRAIN / MILL). Native <details>/<summary>, no JS: the summary IS a nav-item, the
|
|
34
|
+
sub-items indent under it. Open/closed is the browser's; a rotating chevron shows state. ---- */
|
|
35
|
+
.side-rail__group { display: contents; } /* the <details> itself adds no box */
|
|
36
|
+
.side-rail__group > summary { list-style: none; cursor: pointer; }
|
|
37
|
+
.side-rail__group > summary::-webkit-details-marker { display: none; }
|
|
38
|
+
.side-rail__group > summary .nav-item__chev { margin-left: auto; color: var(--ink-faint);
|
|
39
|
+
transition: transform 0.2s ease; }
|
|
40
|
+
.side-rail__group[open] > summary .nav-item__chev { transform: rotate(90deg); }
|
|
41
|
+
.side-rail__sub { display: flex; flex-direction: column; gap: 2px; }
|
|
42
|
+
/* iconless children: skip the gutter, align labels with the parent's label column */
|
|
43
|
+
.side-rail__sub .nav-item {
|
|
44
|
+
grid-template-columns: 1fr auto;
|
|
45
|
+
padding-left: calc(var(--rail-icon-col, 2.5rem) + var(--space-2));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* ---- collapsed: drop the labels + the gutter line, center the glyphs ---- */
|
|
49
|
+
[data-rail-collapsed="true"] .side-rail::before { display: none; }
|
|
50
|
+
[data-rail-collapsed="true"] .side-rail__brand span,
|
|
51
|
+
[data-rail-collapsed="true"] .nav-item__label { display: none; }
|
|
52
|
+
[data-rail-collapsed="true"] .nav-item { grid-template-columns: var(--rail-icon-col, 2.5rem); }
|
|
53
|
+
[data-rail-collapsed="true"] .side-rail__brand { grid-template-columns: var(--rail-icon-col, 2.5rem); }
|
|
54
|
+
[data-rail-collapsed="true"] .side-rail__group > summary .nav-item__chev { display: none; }
|
|
55
|
+
[data-rail-collapsed="true"] .side-rail__sub .nav-item { padding-left: 0; }
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Side rail
|
|
2
|
+
|
|
3
|
+
The vertical navigation rail inside the app-shell: brand → nav-items → spacer → footer
|
|
4
|
+
items. A layout class composed with `b-icon` and `nav-item`. When the shell carries
|
|
5
|
+
`data-rail-collapsed="true"` the labels drop and glyphs center (icons-only). On mobile the
|
|
6
|
+
shell turns the whole rail into a drawer.
|
|
7
|
+
|
|
8
|
+
The brand mark (`.side-rail__brand > b-icon`) carries `var(--color-accent)` — hueless under the
|
|
9
|
+
default theme, a hue under an accent theme (the accent reaches the brand + the presence star;
|
|
10
|
+
DESIGN-SYSTEM §2). Pairs with the `activity-bar` organism when the shell wants a VS Code-style
|
|
11
|
+
icon column (see `activity-bar.md`).
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<aside class="side-rail" style="height:240px;border:1px solid var(--color-line)">
|
|
17
|
+
<div class="side-rail__brand"><b-icon sym="/assets/sprite.svg#spark"></b-icon><span>Grain</span></div>
|
|
18
|
+
<a class="nav-item" aria-current="page"><b-icon sym="/assets/sprite.svg#loop"></b-icon><span class="nav-item__label">Overview</span></a>
|
|
19
|
+
<a class="nav-item"><b-icon sym="/assets/sprite.svg#tasks"></b-icon><span class="nav-item__label">Tasks</span></a>
|
|
20
|
+
<a class="nav-item"><b-icon sym="/assets/sprite.svg#knowledge"></b-icon><span class="nav-item__label">Library</span></a>
|
|
21
|
+
<div class="side-rail__spacer"></div>
|
|
22
|
+
<a class="nav-item"><b-icon sym="/assets/sprite.svg#settings"></b-icon><span class="nav-item__label">Settings</span></a>
|
|
23
|
+
</aside>
|
|
24
|
+
```
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/* organisms/sidebar-panel — the workspace's right-hand panel that fills `.app-shell__aside`: a
|
|
2
|
+
header / scrolling body / composer column. Its default use is the ASSISTANT (chat). During an AI
|
|
3
|
+
takeover (the shell raises `data-acting`) it slides away so the console can narrate; on mobile it
|
|
4
|
+
becomes a bottom sheet. Persona-neutral — the consumer supplies any label/name. CSS-only pattern:
|
|
5
|
+
compose `.assistant` inside `.app-shell__aside`; see sidebar-panel.md. Re-skins via tokens.
|
|
6
|
+
(Loads after app-shell.css in the sorted bundle, so its aside overrides win.) */
|
|
7
|
+
|
|
8
|
+
/* the panel (assistant form): header · scrolling log · composer */
|
|
9
|
+
.assistant { display: flex; flex-direction: column; height: 100%; }
|
|
10
|
+
.assistant__head { display: flex; align-items: center; justify-content: space-between; padding: 0 var(--space-4);
|
|
11
|
+
min-height: var(--editor-header-h, 2.9rem); box-sizing: border-box; /* aligns with the topbar/tab row (one line) */
|
|
12
|
+
border-bottom: 1px solid var(--color-line); font-size: var(--text-sm); text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-muted); }
|
|
13
|
+
/* OPTIONAL MODES: a panel may carry several PANES (chat / a catalog / …) switched by small tabs
|
|
14
|
+
in the head. Markup: `.assistant[data-mode="…"]` whose head holds `.assistant__modes` (buttons
|
|
15
|
+
`[data-shell-mode="…"]`), with sibling `.assistant__pane[data-pane="…"]` columns — the inactive
|
|
16
|
+
ones `[hidden]` (SSR sets the initial state; shell.js flips data-mode / hidden / aria-selected).
|
|
17
|
+
Value-agnostic: the consumer names the modes. A panel with no panes is untouched. */
|
|
18
|
+
.assistant__modes { display: flex; gap: var(--space-1); }
|
|
19
|
+
.assistant__modes [data-shell-mode] { background: transparent; border: 1px solid transparent;
|
|
20
|
+
border-radius: var(--radius-sm); padding: 0 var(--space-2); font: inherit; color: var(--color-muted);
|
|
21
|
+
cursor: pointer; }
|
|
22
|
+
.assistant__modes [data-shell-mode][aria-selected="true"] { color: var(--color-fg);
|
|
23
|
+
border-color: var(--color-line); background: var(--color-surface); }
|
|
24
|
+
.assistant__pane { display: flex; flex-direction: column; flex: 1; min-height: 0; }
|
|
25
|
+
.assistant__pane[hidden] { display: none; }
|
|
26
|
+
|
|
27
|
+
.assistant__log { flex: 1; overflow: auto; padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3);
|
|
28
|
+
scroll-behavior: smooth; }
|
|
29
|
+
.assistant__log > :first-child { margin-top: auto; } /* bottom-pin the conversation — no mid-panel dead space */
|
|
30
|
+
.assistant__composer { border-top: 1px solid var(--color-line); padding: var(--space-3); display: flex; gap: var(--space-2); }
|
|
31
|
+
.assistant__composer .field__input { flex: 1; font: inherit; font-size: var(--text-sm); color: var(--color-fg);
|
|
32
|
+
background: var(--color-bg); border: 1px solid var(--color-line); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); }
|
|
33
|
+
.assistant__composer .field__input::placeholder { color: var(--ink-faint); }
|
|
34
|
+
|
|
35
|
+
/* TAKEOVER: the shell raises `data-acting` (grain/scripts/ai-dispatch.js). The terminal (console)
|
|
36
|
+
narrates the AI's THINKING; the chat is for COMMUNICATION — the two are separate concerns and
|
|
37
|
+
both stay visible during a run (owner, 2026-07-05: the chat no longer collapses when the AI
|
|
38
|
+
works). The panel just lifts above the spotlight veil so it stays usable mid-run — a click in
|
|
39
|
+
here is not an interrupt (ai-dispatch ignores aside/console clicks). */
|
|
40
|
+
.app-shell[data-acting="true"] .app-shell__aside { position: relative; z-index: var(--z-ai-surface, 9002); }
|
|
41
|
+
|
|
42
|
+
/* mobile (<768px): the panel becomes a bottom SHEET. The shell drops the aside column, so re-show it
|
|
43
|
+
fixed to the bottom, collapsed to its header as a grab bar; tap the header to raise the full panel.
|
|
44
|
+
`@container shell-frame`, not `@media` (app-shell.css establishes the container on `<body>` and
|
|
45
|
+
converts its own layout breakpoints the same way — this one has to move in lockstep, or the
|
|
46
|
+
viewport-toggle would hide the aside per app-shell.css's mobile block without this bottom-sheet
|
|
47
|
+
override ever kicking in to replace it, since its old `@media` never fired off the toggle's
|
|
48
|
+
clamp). Every selector here targets a descendant of body (`.app-shell__aside`, `.assistant__head`),
|
|
49
|
+
never body itself, so the container-query self-query rule doesn't block this file. */
|
|
50
|
+
@container shell-frame (max-width: 768px) {
|
|
51
|
+
.app-shell__aside {
|
|
52
|
+
display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-ai-surface, 9002);
|
|
53
|
+
height: 85dvh; opacity: 1;
|
|
54
|
+
transform: translateY(calc(100% - 2.75rem)); /* collapsed: the head peeks as a bar */
|
|
55
|
+
border: 0; border-top: 1px solid var(--ink); border-radius: var(--radius-md) var(--radius-md) 0 0;
|
|
56
|
+
}
|
|
57
|
+
.assistant__head { cursor: pointer; } /* the grab bar toggles the sheet */
|
|
58
|
+
.assistant__head::after { content: "▴"; color: var(--ink-faint); }
|
|
59
|
+
.app-shell[data-aside-open] .assistant__head::after { content: "▾"; }
|
|
60
|
+
.app-shell[data-aside-open] .app-shell__aside { transform: translateY(0); }
|
|
61
|
+
/* while acting, the floating console is the AI surface — hide the idle sheet unless the chat is
|
|
62
|
+
explicitly opened, then raise it full. */
|
|
63
|
+
.app-shell[data-acting="true"] .app-shell__aside { transform: translateY(100%); }
|
|
64
|
+
.app-shell[data-acting="true"][data-chat-open] .app-shell__aside { transform: translateY(0); }
|
|
65
|
+
}
|
|
66
|
+
@media (prefers-reduced-motion: reduce) {
|
|
67
|
+
.app-shell__aside { transition: none; }
|
|
68
|
+
.assistant__log { scroll-behavior: auto; }
|
|
69
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# sidebar-panel
|
|
2
|
+
|
|
3
|
+
The workspace's right-hand panel — a header / scrolling body / footer column that fills the shell's
|
|
4
|
+
`.app-shell__aside` region. Its default use is the **assistant** (chat). CSS-only (no `.html`):
|
|
5
|
+
compose the markup in your frame.
|
|
6
|
+
|
|
7
|
+
**Parent context (required):** lives inside `.app-shell__aside` (grain `app-shell`). The takeover
|
|
8
|
+
behavior keys off the shell's `data-acting` / `data-chat-open` / `data-aside-open` attributes, and on
|
|
9
|
+
mobile it becomes a bottom sheet — all driven by the shell + `grain/scripts/ai-dispatch.js`, not this
|
|
10
|
+
CSS. Persona-neutral: any label ("Assistant", a product name) is the consumer's.
|
|
11
|
+
|
|
12
|
+
```html
|
|
13
|
+
<aside class="app-shell__aside">
|
|
14
|
+
<div class="assistant">
|
|
15
|
+
<div class="assistant__head"><span>Assistant</span></div>
|
|
16
|
+
<div class="assistant__log" data-surface="chat-log">…messages…</div>
|
|
17
|
+
<div class="assistant__composer">
|
|
18
|
+
<input data-action="chat.send" data-target="chat-log" data-surface="chat-input">
|
|
19
|
+
<button class="icon-btn" data-action="chat.send" data-target="chat-log" data-from="chat-input">…</button>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</aside>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
On an AI takeover the panel slides away so the `console` can narrate; the chat⇄terminal toggle brings
|
|
26
|
+
it back. See `console` (its counterpart) and `app-shell` (the grid + takeover state).
|
|
27
|
+
|
|
28
|
+
**Optional modes.** A panel can carry several panes switched by small tabs in the head — the
|
|
29
|
+
consumer names the modes (a catalog, settings, anything). Add `.assistant__modes` (buttons
|
|
30
|
+
`[data-shell-mode="…"]`) to the head and wrap each body in `.assistant__pane[data-pane="…"]`,
|
|
31
|
+
marking the inactive ones `hidden` (SSR ships the initial state, so no-JS shows the default pane).
|
|
32
|
+
`grain/scripts/shell.js` flips `data-mode` on `.assistant`, `hidden` on the panes, and
|
|
33
|
+
`aria-selected` on the tabs — value-agnostic. A panel with no panes (the plain assistant) is
|
|
34
|
+
untouched.
|
|
35
|
+
|
|
36
|
+
```html
|
|
37
|
+
<div class="assistant" data-mode="chat">
|
|
38
|
+
<div class="assistant__head"><span>Assistant</span>
|
|
39
|
+
<nav class="assistant__modes" aria-label="Panel mode">
|
|
40
|
+
<button type="button" data-shell-mode="chat" aria-selected="true">Chat</button>
|
|
41
|
+
<button type="button" data-shell-mode="catalog" aria-selected="false">Catalog</button>
|
|
42
|
+
</nav>
|
|
43
|
+
</div>
|
|
44
|
+
<div class="assistant__pane" data-pane="chat">…log + composer…</div>
|
|
45
|
+
<div class="assistant__pane" data-pane="catalog" hidden>…anything…</div>
|
|
46
|
+
</div>
|
|
47
|
+
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* organisms/status-bar — the editor-style STATUS ROW at the bottom of the app window:
|
|
2
|
+
quiet mono meta-text (presence, build info) left, small controls (theme cycle, scheme
|
|
3
|
+
toggle, ⌘K hint) right. CSS-only pattern — place a `.status-bar` in the app-shell's
|
|
4
|
+
`.app-shell__status` grid row (app-shell.css owns the row; see status-bar.md).
|
|
5
|
+
Controls are STATUS, not content: buttons here unstyle to plain text and only sharpen
|
|
6
|
+
on hover/focus. Tokens only. */
|
|
7
|
+
.status-bar {
|
|
8
|
+
display: flex; align-items: center; gap: var(--space-5);
|
|
9
|
+
padding: 0.3rem 0.9rem;
|
|
10
|
+
background: var(--color-surface);
|
|
11
|
+
border-top: 1px solid var(--color-line);
|
|
12
|
+
font-family: var(--font-mono);
|
|
13
|
+
font-size: var(--text-xs);
|
|
14
|
+
color: var(--color-muted);
|
|
15
|
+
white-space: nowrap;
|
|
16
|
+
}
|
|
17
|
+
.status-bar__spacer { flex: 1; }
|
|
18
|
+
.status-bar button {
|
|
19
|
+
all: unset; /* a status control reads as text, not a button */
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
font: inherit; color: inherit;
|
|
22
|
+
}
|
|
23
|
+
.status-bar button:hover { color: var(--color-fg); }
|
|
24
|
+
.status-bar button:focus-visible { outline: 1px solid var(--color-accent); outline-offset: 2px; }
|
|
25
|
+
|
|
26
|
+
/* narrow screens: keep presence + controls, let the middle meta-text go. `@container shell-frame`
|
|
27
|
+
(app-shell.css establishes the container on `<body>`) so this fires off BOTH a real narrow
|
|
28
|
+
window and the shell's viewport-toggle clamp, not just the real one — `.status-bar` is a
|
|
29
|
+
descendant of body, never body itself, so it's legal to query here (see app-shell.css). */
|
|
30
|
+
@container shell-frame (max-width: 768px) {
|
|
31
|
+
.status-bar { gap: var(--space-4); }
|
|
32
|
+
.status-bar [data-status-optional] { display: none; }
|
|
33
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# status-bar
|
|
2
|
+
|
|
3
|
+
The editor-style **status row** at the bottom of the app window: quiet mono meta-text
|
|
4
|
+
(presence, build info) on the left, small controls (theme cycle, scheme toggle, ⌘K hint) on
|
|
5
|
+
the right of a `__spacer`. CSS-only (no `.html`) — the consumer supplies the content; controls
|
|
6
|
+
here are *status, not content*, so buttons unstyle to plain text and sharpen on hover/focus.
|
|
7
|
+
|
|
8
|
+
**Parent contract (required):** place a `.status-bar` in the app-shell's `.app-shell__status`
|
|
9
|
+
grid row (app-shell.css owns the row). Pairs with `app-window` for the full editor-window frame.
|
|
10
|
+
|
|
11
|
+
```html
|
|
12
|
+
<footer class="app-shell__status status-bar">
|
|
13
|
+
<span class="presence">✶ online</span>
|
|
14
|
+
<span data-status-optional>0 ⊘ · 0 ⚠</span>
|
|
15
|
+
<span data-status-optional>main</span>
|
|
16
|
+
<span class="status-bar__spacer"></span>
|
|
17
|
+
<button type="button" data-cycle-theme>◆ <span data-theme-name>sourdough</span></button>
|
|
18
|
+
<button type="button" data-toggle-scheme>◐ scheme</button>
|
|
19
|
+
<b-kbd keys="⌘K"></b-kbd>
|
|
20
|
+
</footer>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
- The theming controls are the standard declarative ones (`scripts/theme.js`); a
|
|
24
|
+
`[data-theme-name]` span inside anything gets kept in sync with the current flavor name.
|
|
25
|
+
- Mark middle meta-text `data-status-optional` — it hides on narrow screens so presence and
|
|
26
|
+
the controls keep the row.
|
|
27
|
+
- Honest-status doctrine: what this row *claims* (build ref, check counts, presence) should be
|
|
28
|
+
real — bake real values at export/compose time or show none.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/* organisms/tab-bar — the top strip of open views inside the app-shell topbar. A
|
|
2
|
+
horizontal, scrollable row of tabs; the page places controls (⌘K, presence) after it in
|
|
3
|
+
the topbar. A layout class composed with tab. flex:1 so it fills the topbar's remaining
|
|
4
|
+
width — that's what pins .tab-bar__close-all to the topbar's true far edge instead of
|
|
5
|
+
floating right after the last tab with empty space beyond it. */
|
|
6
|
+
.tab-bar {
|
|
7
|
+
display: flex; align-items: stretch; min-width: 0; flex: 1 1 auto;
|
|
8
|
+
overflow-x: auto; scrollbar-width: none;
|
|
9
|
+
/* scroll affordance: fade the far edge so hidden tabs read as "more to scroll"
|
|
10
|
+
rather than a hard clip. Tabs are flex:none and left-packed, so when the
|
|
11
|
+
strip is NOT overflowing the faded edge sits over empty space (invisible);
|
|
12
|
+
it only bites a real tab once the row overflows. */
|
|
13
|
+
mask-image: linear-gradient(to right, currentColor calc(100% - 1.5rem), transparent);
|
|
14
|
+
}
|
|
15
|
+
.tab-bar::-webkit-scrollbar { display: none; }
|
|
16
|
+
/* Where scroll-driven animation is supported, upgrade to both edges tracking the
|
|
17
|
+
actual scroll position: right-only at the start, both in the middle, left-only
|
|
18
|
+
at the end. Unsupported browsers keep the static right fade above. */
|
|
19
|
+
@supports (animation-timeline: scroll()) {
|
|
20
|
+
.tab-bar { animation: tab-bar-edges linear both; animation-timeline: scroll(self inline); }
|
|
21
|
+
@keyframes tab-bar-edges {
|
|
22
|
+
from { mask-image: linear-gradient(to right, currentColor, currentColor calc(100% - 1.5rem), transparent); }
|
|
23
|
+
50% { mask-image: linear-gradient(to right, transparent, currentColor 1.5rem, currentColor calc(100% - 1.5rem), transparent); }
|
|
24
|
+
to { mask-image: linear-gradient(to right, transparent, currentColor 1.5rem, currentColor); }
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
@media (prefers-reduced-motion: reduce) { .tab-bar { animation: none; } }
|
|
28
|
+
|
|
29
|
+
/* the close-all affordance — a small TAB-SHAPED cell pinned past the scrollable strip (a sibling
|
|
30
|
+
in the topbar, never a child of .tab-bar), so it never scrolls out of reach no matter how many
|
|
31
|
+
tabs are open. Same height as .tab for one continuous band; a left hairline (mirrors .tab's own
|
|
32
|
+
border-right) reads it as its own cell, distinct from each tab's individual .tab__close.
|
|
33
|
+
tabs.js toggles [hidden] when nothing closable is open (pinned tabs don't count) — `all: unset`
|
|
34
|
+
resets `display` to its initial value (inline) UNCONDITIONALLY, and author CSS always beats
|
|
35
|
+
the UA `[hidden]{display:none}` rule regardless of specificity, so the base rule alone already
|
|
36
|
+
overrode `hidden` (the button showed, just un-flexed) — `[hidden]{display:none}` below is the
|
|
37
|
+
fix: a class+attribute selector out-specifies the plain class rule, restoring `hidden`. */
|
|
38
|
+
.tab-bar__close-all {
|
|
39
|
+
all: unset; box-sizing: border-box; cursor: pointer;
|
|
40
|
+
display: flex; flex: none; align-items: center; justify-content: center;
|
|
41
|
+
height: 2.5rem; width: 2.25rem;
|
|
42
|
+
border-left: 1px solid var(--color-line);
|
|
43
|
+
color: var(--color-muted);
|
|
44
|
+
}
|
|
45
|
+
.tab-bar__close-all[hidden] { display: none; }
|
|
46
|
+
.tab-bar__close-all:hover { color: var(--color-fg); background: color-mix(in srgb, var(--color-bg) 55%, transparent); }
|
|
47
|
+
.tab-bar__close-all:focus-visible { outline: 1px solid var(--color-accent); outline-offset: -2px; }
|
|
48
|
+
.tab-bar__close-all .icon { width: 0.85rem; height: 0.85rem; }
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Tab bar
|
|
2
|
+
|
|
3
|
+
The top strip of open views, inside the app-shell topbar. A scrollable row of `tab`s;
|
|
4
|
+
place controls (a `b-kbd` for ⌘K, an AI presence marker) after it in the topbar. Tabs are
|
|
5
|
+
navigation (links) — active is per-page, not client state.
|
|
6
|
+
|
|
7
|
+
**Close all (opt-in):** a control marked `data-shell="tabs-close-all"` placed as a SIBLING of the
|
|
8
|
+
strip (not inside it, so it survives the strip's own horizontal scroll) is wired live by
|
|
9
|
+
`scripts/tabs.js`: it clears every non-pinned tab and, if the current page was one of them,
|
|
10
|
+
navigates to the first pinned tab. `tabs.js` toggles its `hidden` attribute — shown only once
|
|
11
|
+
there's something closable open.
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<div style="display:flex;align-items:stretch;border:1px solid var(--color-line)">
|
|
17
|
+
<nav class="tab-bar">
|
|
18
|
+
<a class="tab" aria-current="page">Overview</a>
|
|
19
|
+
<a class="tab">Tasks</a>
|
|
20
|
+
<a class="tab">Library · notes</a>
|
|
21
|
+
</nav>
|
|
22
|
+
<span style="margin-left:auto;display:flex;align-items:center;gap:.5rem;padding:0 .75rem">
|
|
23
|
+
<b-kbd keys="⌘K"></b-kbd>
|
|
24
|
+
</span>
|
|
25
|
+
</div>
|
|
26
|
+
```
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/* organisms/timeline — the INTERACTION TIMELINE: a read-only, push-only feed of every crossing of
|
|
2
|
+
the one door, human AND AI, recorded identically at the single writer (AI-INTERFACE §5g). The AI
|
|
3
|
+
only ever WRITES to it (`log` render ops at the `timeline` surface); nothing acts on it, so it's a
|
|
4
|
+
push surface, never a SurfaceKind. Provenance is shown the GRAIN way — by GRADE, not a hue: an AI
|
|
5
|
+
crossing renders in the grain font behind a dashed "terminal" edge (grain = AI); a human crossing
|
|
6
|
+
in the smooth font behind a solid edge; a system rejection stays faint. Tokens only. CSS-only
|
|
7
|
+
pattern (no .html): compose the markup below inside your page; see timeline.md. */
|
|
8
|
+
|
|
9
|
+
.timeline { display: flex; flex-direction: column; min-height: 0;
|
|
10
|
+
border: 1px solid var(--color-line); border-radius: var(--radius-md); background: var(--color-bg); }
|
|
11
|
+
|
|
12
|
+
.timeline__head { display: flex; align-items: baseline; gap: var(--space-3); flex: 0 0 auto;
|
|
13
|
+
padding: var(--space-2) var(--space-4); border-bottom: 1px solid var(--color-line);
|
|
14
|
+
font-family: var(--font-grain); font-size: var(--text-sm); color: var(--color-fg); }
|
|
15
|
+
.timeline__hint { color: var(--color-muted); font-size: var(--text-xs); }
|
|
16
|
+
|
|
17
|
+
/* the scrolling feed — the `data-surface="timeline"` element `log` ops land in. It sizes to its
|
|
18
|
+
content and CAPS at 18rem, scrolling inside there (pinned to newest by the dispatcher, since
|
|
19
|
+
overflowY = auto). `flex: 0 1 auto` (not `1 1 0`): this component sits in normal document flow,
|
|
20
|
+
so the feed must grow with its rows — a `1 1 0` basis would collapse it to a sliver here (that
|
|
21
|
+
fill-the-row behaviour is for a fixed-height parent like the docked console). */
|
|
22
|
+
.timeline__feed { list-style: none; margin: 0; padding: var(--space-2) var(--space-3);
|
|
23
|
+
display: flex; flex-direction: column; gap: var(--space-1);
|
|
24
|
+
flex: 0 1 auto; min-height: 0; max-height: 18rem; overflow: auto; scroll-behavior: smooth; }
|
|
25
|
+
.timeline__feed:empty::after { content: "No crossings yet — ask the AI, or watch it act.";
|
|
26
|
+
color: var(--ink-faint); font-family: var(--font-grain); font-size: var(--text-sm); padding: var(--space-2); }
|
|
27
|
+
|
|
28
|
+
/* one crossing. The left edge carries the provenance; the row reads verb + detail. */
|
|
29
|
+
.timeline__entry { display: flex; align-items: baseline; gap: var(--space-2);
|
|
30
|
+
padding: var(--space-1) var(--space-2); padding-left: var(--space-3);
|
|
31
|
+
border-left: 3px solid var(--color-accent); font-size: var(--text-sm); color: var(--color-fg); }
|
|
32
|
+
|
|
33
|
+
/* grade = provenance (DESIGN-SYSTEM §3): AI in the grain font behind a DASHED terminal edge (non-text
|
|
34
|
+
grain = dashed edge); the human in the smooth font behind a solid edge; a system rejection faint. */
|
|
35
|
+
.timeline__entry[data-provenance="user"] { font-family: var(--font-smooth); }
|
|
36
|
+
.timeline__entry[data-provenance="ai"] { font-family: var(--font-grain); border-left-style: dashed; }
|
|
37
|
+
.timeline__entry[data-provenance="system"] { font-family: var(--font-grain); border-left-color: var(--ink-faint); color: var(--ink-muted); }
|
|
38
|
+
|
|
39
|
+
/* a failed crossing (rejected request / rolled-back write) reads as struck through, still legible. */
|
|
40
|
+
.timeline__entry[data-ok="false"] { color: var(--ink-muted); }
|
|
41
|
+
.timeline__entry[data-ok="false"] .timeline__verb { text-decoration: line-through; }
|
|
42
|
+
|
|
43
|
+
.timeline__who { flex: 0 0 auto; min-width: 2.6rem; text-transform: uppercase;
|
|
44
|
+
letter-spacing: 0.06em; font-size: var(--text-xs); color: var(--color-muted); }
|
|
45
|
+
.timeline__mark { flex: 0 0 auto; color: var(--color-accent); }
|
|
46
|
+
.timeline__entry[data-ok="false"] .timeline__mark { color: var(--ink-muted); }
|
|
47
|
+
.timeline__verb { flex: 0 0 auto; color: var(--color-fg); }
|
|
48
|
+
.timeline__detail { flex: 1 1 auto; min-width: 0; color: var(--color-muted);
|
|
49
|
+
overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
50
|
+
|
|
51
|
+
@media (prefers-reduced-motion: reduce) { .timeline__feed { scroll-behavior: auto; } }
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# timeline
|
|
2
|
+
|
|
3
|
+
The **interaction timeline** — a read-only feed of every crossing of the one door, human **and** AI,
|
|
4
|
+
recorded identically at the single writer (AI-INTERFACE §5g). It is the unified log the whole stack
|
|
5
|
+
implies: because both a human click and an AI decision enter through the same `handleIntent`, the
|
|
6
|
+
door records them in one place, one format, source-tagged — so the history reads the same for either
|
|
7
|
+
operator (uniform auditability a pixel-click imitation can't give).
|
|
8
|
+
|
|
9
|
+
**Push-only, never a `SurfaceKind`.** The AI only ever *writes* to it — `log` render ops at the
|
|
10
|
+
`timeline` surface. Nothing acts on it, so like `console` it is addressed by its bare slug and is not
|
|
11
|
+
a verb target. Entries are produced by a `LogSink` (`grain/ai/timeline-log.ts` `createStreamLogSink`)
|
|
12
|
+
wired at the composition root; the door calls `logSink.record(...)` for each crossing.
|
|
13
|
+
|
|
14
|
+
**Provenance is shown by GRADE, not a hue** (the palette is hueless by design): an **AI** crossing
|
|
15
|
+
renders in the grain font behind a **dashed** terminal edge (grain = AI); a **human** crossing in the
|
|
16
|
+
smooth font behind a solid edge; a **system** rejection stays faint. A failed crossing (rejected
|
|
17
|
+
request, rolled-back write) reads struck-through. So the timeline itself demonstrates grade-as-signal.
|
|
18
|
+
|
|
19
|
+
**Parent context:** none required — it's self-contained. Give the feed a bounded height (the
|
|
20
|
+
component caps it at `18rem`) so a long run scrolls inside it; the dispatcher pins it to newest and
|
|
21
|
+
caps the DOM at 80 rows. CSS-only (no `.html`).
|
|
22
|
+
|
|
23
|
+
```html
|
|
24
|
+
<section class="timeline" aria-label="Interaction timeline">
|
|
25
|
+
<div class="timeline__head">
|
|
26
|
+
<span>Interaction timeline</span>
|
|
27
|
+
<span class="timeline__hint">every crossing of the one door — human and AI, recorded identically</span>
|
|
28
|
+
</div>
|
|
29
|
+
<ol class="timeline__feed" data-surface="timeline"></ol>
|
|
30
|
+
</section>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Each `log` op appends one row (built by `timelineEntryHtml`):
|
|
34
|
+
|
|
35
|
+
```html
|
|
36
|
+
<li class="timeline__entry" data-provenance="ai" data-kind="response" data-seq="4">
|
|
37
|
+
<span class="timeline__who">ai</span>
|
|
38
|
+
<span class="timeline__mark">✓</span>
|
|
39
|
+
<span class="timeline__verb">chat.send</span>
|
|
40
|
+
<span class="timeline__detail">2 ops</span>
|
|
41
|
+
</li>
|
|
42
|
+
```
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* organisms/topbar — the app-shell top bar's CONTENT: a right-aligned control cluster (the theme +
|
|
2
|
+
light/dark toggles, ⌘K, a presence indicator). CSS-only pattern — place a `.topbar-ctl` inside the
|
|
3
|
+
shell's `.app-shell__topbar` region (the shell owns the bar's grid slot + border, app-shell.css).
|
|
4
|
+
Persona-neutral: the toggles are grain `.icon-btn`s carrying the theming controls
|
|
5
|
+
(`data-toggle-scheme`, `data-cycle-theme` — see grain/scripts/theme.js). Consumers supply the
|
|
6
|
+
brand/presence text. See topbar.md. */
|
|
7
|
+
.topbar-ctl { display: flex; align-items: center; gap: var(--space-3); margin-left: auto; padding: 0 var(--space-4); }
|
|
8
|
+
.presence { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--color-muted); font-size: var(--text-sm); }
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# topbar
|
|
2
|
+
|
|
3
|
+
The app-shell top bar's **content** — a right-aligned control cluster. The shell (`app-shell`) owns
|
|
4
|
+
the bar's grid slot + border; this primitive is the cluster you place inside `.app-shell__topbar`.
|
|
5
|
+
CSS-only (no `.html`): compose the markup in your frame.
|
|
6
|
+
|
|
7
|
+
**Parent context:** lives inside `.app-shell__topbar`. `.topbar-ctl` pushes itself to the right
|
|
8
|
+
(`margin-left:auto`).
|
|
9
|
+
|
|
10
|
+
**The theming toggles** are grain `.icon-btn`s carrying the declarative theming controls from
|
|
11
|
+
`grain/scripts/theme.js` — they need no per-page JS:
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<header class="app-shell__topbar">
|
|
15
|
+
<!-- …brand / nav… -->
|
|
16
|
+
<div class="topbar-ctl">
|
|
17
|
+
<button class="icon-btn" data-variant="ghost" data-toggle-scheme aria-label="Toggle light / dark">…</button>
|
|
18
|
+
<button class="icon-btn" data-variant="ghost" data-cycle-theme aria-label="Cycle theme">…</button>
|
|
19
|
+
<b-kbd keys="⌘K"></b-kbd>
|
|
20
|
+
<span class="presence"><b-icon sym="…#spark" size="sm"></b-icon> online</span>
|
|
21
|
+
</div>
|
|
22
|
+
</header>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Persona-neutral: the presence label ("online", a product name, "Acme's assistant") is the consumer's — the
|
|
26
|
+
primitive ships no persona. The flavor list the cycle rotates is declared on `<html data-themes="…">`.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// grain/components/responsive-polish.test.ts — conformance guards for the 2026-07-14
|
|
2
|
+
// responsive/mobile pass (grain lesson 5: don't just patch the instance, add a test that catches
|
|
3
|
+
// the class of misuse). Two unrelated regressions this covers:
|
|
4
|
+
//
|
|
5
|
+
// 1. The ≥44px touch-target promise (DESIGN-SYSTEM §7, b-icon-button.css's own comment) was a
|
|
6
|
+
// documented number nothing enforced against a squeezing flex parent — the mobile rail-toggle
|
|
7
|
+
// hamburger audited as "resolves but is untappable" because its declared width could still
|
|
8
|
+
// shrink to nothing. flex-shrink: 0 is what actually holds the floor; guard that it stays wired.
|
|
9
|
+
// 2. The grain-grade font (Redaction 50) reads as texture only at >= --text-2xl (lesson 4); a chat
|
|
10
|
+
// bubble is --text-sm, so it must use the fine fallback face, not the sitewide rough one.
|
|
11
|
+
import { test, expect } from "bun:test";
|
|
12
|
+
import { readFileSync } from "node:fs";
|
|
13
|
+
import { join } from "node:path";
|
|
14
|
+
|
|
15
|
+
const root = join(import.meta.dir, "..");
|
|
16
|
+
const read = (rel: string) => readFileSync(join(root, rel), "utf8");
|
|
17
|
+
|
|
18
|
+
test("icon-btn's touch target can't be shrunk by a flex parent", () => {
|
|
19
|
+
const css = read("components/atoms/b-icon-button/b-icon-button.css");
|
|
20
|
+
expect(css).toMatch(/\.icon-btn\s*\{[^}]*flex-shrink:\s*0/);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test("activity-bar items meet the ≥44px touch-target floor", () => {
|
|
24
|
+
const css = read("components/organisms/activity-bar/activity-bar.css");
|
|
25
|
+
const m = css.match(/\.activity-bar__item\s*\{([^}]*)\}/);
|
|
26
|
+
expect(m).not.toBeNull();
|
|
27
|
+
const width = m![1].match(/width:\s*([\d.]+)rem/);
|
|
28
|
+
expect(width).not.toBeNull();
|
|
29
|
+
expect(Number(width![1]) * 16).toBeGreaterThanOrEqual(44); // 1rem == 16px, grain's base
|
|
30
|
+
expect(m![1]).toMatch(/flex-shrink:\s*0/);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test("--font-grain-fine exists and chat-message uses it instead of the rough face at bubble size", () => {
|
|
34
|
+
const vars = read("styles/variables.css");
|
|
35
|
+
expect(vars).toMatch(/--font-grain-fine:\s*"Redaction 35"/);
|
|
36
|
+
|
|
37
|
+
const css = read("components/molecules/chat-message/chat-message.css");
|
|
38
|
+
// must key --type-font (the mechanism grain.css already ships), not invent a parallel font switch
|
|
39
|
+
expect(css).toMatch(/--type-font:\s*var\(--font-grain-fine\)/);
|
|
40
|
+
// covers both the settled grain state and the still-streaming pending state
|
|
41
|
+
expect(css).toMatch(/\[data-grade="grain"\]/);
|
|
42
|
+
expect(css).toMatch(/\[data-commit="pending"\]/);
|
|
43
|
+
});
|