@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.
Files changed (181) hide show
  1. package/LICENSE +202 -0
  2. package/PLAN.md +27 -0
  3. package/README.md +243 -0
  4. package/ai/accepts.test.ts +69 -0
  5. package/ai/accepts.ts +57 -0
  6. package/ai/ai.css +127 -0
  7. package/ai/client-door.test.ts +70 -0
  8. package/ai/client-door.ts +56 -0
  9. package/ai/contract.test.ts +158 -0
  10. package/ai/contract.ts +285 -0
  11. package/ai/interaction-layer.test.ts +270 -0
  12. package/ai/interaction-layer.ts +138 -0
  13. package/ai/manifest-dom.test.ts +176 -0
  14. package/ai/manifest-dom.ts +187 -0
  15. package/ai/manifest.test.ts +71 -0
  16. package/ai/manifest.ts +57 -0
  17. package/ai/markdown.test.ts +68 -0
  18. package/ai/markdown.ts +74 -0
  19. package/ai/model-chat.test.ts +131 -0
  20. package/ai/model-chat.ts +151 -0
  21. package/ai/model-reasoner.test.ts +152 -0
  22. package/ai/model-reasoner.ts +146 -0
  23. package/ai/model.test.ts +148 -0
  24. package/ai/model.ts +200 -0
  25. package/ai/reasoner-kit.test.ts +142 -0
  26. package/ai/reasoner-kit.ts +159 -0
  27. package/ai/reasoner.test.ts +227 -0
  28. package/ai/reasoner.ts +446 -0
  29. package/ai/timeline-log.test.ts +55 -0
  30. package/ai/timeline-log.ts +50 -0
  31. package/ai/vocab-reference.test.ts +43 -0
  32. package/ai/vocab-reference.ts +107 -0
  33. package/ai/webllm.test.ts +79 -0
  34. package/ai/webllm.ts +125 -0
  35. package/assets/figure-sample.svg +14 -0
  36. package/assets/sprite.svg +22 -0
  37. package/catalog/catalog.test.ts +37 -0
  38. package/catalog/catalog.ts +424 -0
  39. package/components/atoms/action-badge/action-badge.css +17 -0
  40. package/components/atoms/action-badge/action-badge.html +6 -0
  41. package/components/atoms/action-badge/action-badge.md +23 -0
  42. package/components/atoms/b-badge/b-badge.css +15 -0
  43. package/components/atoms/b-badge/b-badge.html +2 -0
  44. package/components/atoms/b-badge/b-badge.md +16 -0
  45. package/components/atoms/b-button/b-button.ai.md +22 -0
  46. package/components/atoms/b-button/b-button.css +87 -0
  47. package/components/atoms/b-button/b-button.html +5 -0
  48. package/components/atoms/b-button/b-button.md +77 -0
  49. package/components/atoms/b-icon/b-icon.css +10 -0
  50. package/components/atoms/b-icon/b-icon.html +5 -0
  51. package/components/atoms/b-icon/b-icon.md +36 -0
  52. package/components/atoms/b-icon-button/b-icon-button.ai.md +11 -0
  53. package/components/atoms/b-icon-button/b-icon-button.css +43 -0
  54. package/components/atoms/b-icon-button/b-icon-button.html +8 -0
  55. package/components/atoms/b-icon-button/b-icon-button.md +33 -0
  56. package/components/atoms/b-input/b-input.css +36 -0
  57. package/components/atoms/b-input/b-input.html +8 -0
  58. package/components/atoms/b-input/b-input.md +59 -0
  59. package/components/atoms/b-kbd/b-kbd.css +11 -0
  60. package/components/atoms/b-kbd/b-kbd.html +3 -0
  61. package/components/atoms/b-kbd/b-kbd.md +13 -0
  62. package/components/atoms/b-list/b-list.css +21 -0
  63. package/components/atoms/b-list/b-list.html +6 -0
  64. package/components/atoms/b-list/b-list.md +24 -0
  65. package/components/atoms/b-meter/b-meter.css +39 -0
  66. package/components/atoms/b-meter/b-meter.md +44 -0
  67. package/components/atoms/b-select/b-select.css +35 -0
  68. package/components/atoms/b-select/b-select.md +75 -0
  69. package/components/atoms/b-switch/b-switch.css +61 -0
  70. package/components/atoms/b-switch/b-switch.html +6 -0
  71. package/components/atoms/b-switch/b-switch.md +40 -0
  72. package/components/atoms/b-text/b-text.ai.md +29 -0
  73. package/components/atoms/b-text/b-text.css +2 -0
  74. package/components/atoms/b-text/b-text.html +3 -0
  75. package/components/atoms/b-text/b-text.md +23 -0
  76. package/components/atoms/code-block/code-block.css +42 -0
  77. package/components/atoms/code-block/code-block.md +23 -0
  78. package/components/examples.test.ts +23 -0
  79. package/components/molecules/callout/callout.css +19 -0
  80. package/components/molecules/callout/callout.md +15 -0
  81. package/components/molecules/card/card.css +28 -0
  82. package/components/molecules/card/card.md +30 -0
  83. package/components/molecules/chat-message/chat-message.css +83 -0
  84. package/components/molecules/chat-message/chat-message.md +52 -0
  85. package/components/molecules/chip-group/chip-group.css +35 -0
  86. package/components/molecules/chip-group/chip-group.md +42 -0
  87. package/components/molecules/content-index/content-index.css +87 -0
  88. package/components/molecules/content-index/content-index.md +27 -0
  89. package/components/molecules/content-source/content-source.css +6 -0
  90. package/components/molecules/content-source/content-source.md +13 -0
  91. package/components/molecules/figure/figure.css +19 -0
  92. package/components/molecules/figure/figure.md +20 -0
  93. package/components/molecules/lede/lede.css +17 -0
  94. package/components/molecules/lede/lede.md +17 -0
  95. package/components/molecules/made-with/made-with.css +25 -0
  96. package/components/molecules/made-with/made-with.md +35 -0
  97. package/components/molecules/nav-item/nav-item.css +19 -0
  98. package/components/molecules/nav-item/nav-item.md +21 -0
  99. package/components/molecules/stat-tile/stat-tile.css +34 -0
  100. package/components/molecules/stat-tile/stat-tile.md +50 -0
  101. package/components/molecules/status-list/status-list.css +47 -0
  102. package/components/molecules/status-list/status-list.md +62 -0
  103. package/components/molecules/tab/tab.css +32 -0
  104. package/components/molecules/tab/tab.md +27 -0
  105. package/components/molecules/table/table.css +23 -0
  106. package/components/molecules/table/table.md +18 -0
  107. package/components/organisms/activity-bar/activity-bar.css +36 -0
  108. package/components/organisms/activity-bar/activity-bar.md +43 -0
  109. package/components/organisms/app-shell/app-shell.css +193 -0
  110. package/components/organisms/app-shell/app-shell.md +58 -0
  111. package/components/organisms/app-shell/app-shell.test.ts +74 -0
  112. package/components/organisms/app-window/app-window.css +111 -0
  113. package/components/organisms/app-window/app-window.md +53 -0
  114. package/components/organisms/chat-log/chat-log.css +5 -0
  115. package/components/organisms/chat-log/chat-log.md +14 -0
  116. package/components/organisms/code-editor/code-editor.ai.md +31 -0
  117. package/components/organisms/code-editor/code-editor.css +111 -0
  118. package/components/organisms/code-editor/code-editor.md +122 -0
  119. package/components/organisms/console/console.css +112 -0
  120. package/components/organisms/console/console.md +66 -0
  121. package/components/organisms/file-tree/file-tree.css +85 -0
  122. package/components/organisms/file-tree/file-tree.md +49 -0
  123. package/components/organisms/note/note.css +19 -0
  124. package/components/organisms/note/note.md +20 -0
  125. package/components/organisms/notepad/notepad.css +60 -0
  126. package/components/organisms/notepad/notepad.md +40 -0
  127. package/components/organisms/side-rail/side-rail.css +55 -0
  128. package/components/organisms/side-rail/side-rail.md +24 -0
  129. package/components/organisms/sidebar-panel/sidebar-panel.css +69 -0
  130. package/components/organisms/sidebar-panel/sidebar-panel.md +47 -0
  131. package/components/organisms/status-bar/status-bar.css +33 -0
  132. package/components/organisms/status-bar/status-bar.md +28 -0
  133. package/components/organisms/tab-bar/tab-bar.css +48 -0
  134. package/components/organisms/tab-bar/tab-bar.md +26 -0
  135. package/components/organisms/timeline/timeline.css +51 -0
  136. package/components/organisms/timeline/timeline.md +42 -0
  137. package/components/organisms/topbar/topbar.css +8 -0
  138. package/components/organisms/topbar/topbar.md +26 -0
  139. package/components/responsive-polish.test.ts +43 -0
  140. package/components/tokens.test.ts +39 -0
  141. package/fonts/redaction-35-400.woff2 +0 -0
  142. package/fonts/redaction-400.woff2 +0 -0
  143. package/fonts/redaction-50-400.woff2 +0 -0
  144. package/fonts/redaction-70-400.woff2 +0 -0
  145. package/package.json +46 -0
  146. package/scripts/ai-dispatch.js +583 -0
  147. package/scripts/ai-dispatch.test.ts +85 -0
  148. package/scripts/ai-spotlight.d.ts +23 -0
  149. package/scripts/ai-spotlight.js +139 -0
  150. package/scripts/ai-spotlight.test.ts +31 -0
  151. package/scripts/catalog-peek.js +156 -0
  152. package/scripts/catalog-peek.test.ts +31 -0
  153. package/scripts/cmdk.js +159 -0
  154. package/scripts/demo-box.js +53 -0
  155. package/scripts/handoff.js +64 -0
  156. package/scripts/handoff.test.ts +36 -0
  157. package/scripts/lightbox.js +144 -0
  158. package/scripts/lightbox.test.ts +23 -0
  159. package/scripts/made-with.d.ts +2 -0
  160. package/scripts/made-with.js +22 -0
  161. package/scripts/made-with.test.ts +25 -0
  162. package/scripts/notepad.js +100 -0
  163. package/scripts/shell.js +204 -0
  164. package/scripts/shell.test.ts +50 -0
  165. package/scripts/tabs.js +127 -0
  166. package/scripts/tabs.test.ts +40 -0
  167. package/scripts/terminal.js +271 -0
  168. package/scripts/terminal.test.ts +36 -0
  169. package/scripts/theme-boot.js +15 -0
  170. package/scripts/theme.js +87 -0
  171. package/scripts/type-effect.js +25 -0
  172. package/scripts/xray.js +79 -0
  173. package/scripts/xray.test.ts +43 -0
  174. package/styles/cmdk.css +65 -0
  175. package/styles/global.css +80 -0
  176. package/styles/grain.css +47 -0
  177. package/styles/lightbox.css +78 -0
  178. package/styles/themes/_template.css +48 -0
  179. package/styles/themes/baguette.css +30 -0
  180. package/styles/themes/brioche.css +30 -0
  181. package/styles/variables.css +217 -0
@@ -0,0 +1,77 @@
1
+ # Button
2
+
3
+ One class — `.btn`. Variant, size, and status are attributes, not extra classes.
4
+ Pseudo-states are forced for display with `data-force`.
5
+
6
+ ## States
7
+
8
+ ### Default
9
+ ```html
10
+ <button class="btn">Button</button>
11
+ ```
12
+
13
+ ### Hover
14
+ ```html
15
+ <button class="btn" data-force="hover">Button</button>
16
+ ```
17
+
18
+ ### Focus
19
+ ```html
20
+ <button class="btn" data-force="focus">Button</button>
21
+ ```
22
+
23
+ ### Active
24
+ ```html
25
+ <button class="btn" data-force="active">Button</button>
26
+ ```
27
+
28
+ ### Disabled
29
+ ```html
30
+ <button class="btn" disabled>Button</button>
31
+ ```
32
+
33
+ ## Sizes
34
+
35
+ ### Small
36
+ ```html
37
+ <button class="btn" data-size="sm">Small</button>
38
+ ```
39
+
40
+ ### Medium
41
+ ```html
42
+ <button class="btn">Medium</button>
43
+ ```
44
+
45
+ ### Large
46
+ ```html
47
+ <button class="btn" data-size="lg">Large</button>
48
+ ```
49
+
50
+ ## Variants
51
+
52
+ ### Solid
53
+ ```html
54
+ <button class="btn">Solid</button>
55
+ ```
56
+
57
+ ### Soft
58
+ ```html
59
+ <button class="btn" data-variant="soft">Soft</button>
60
+ ```
61
+
62
+ ### Outline
63
+ ```html
64
+ <button class="btn" data-variant="outline">Outline</button>
65
+ ```
66
+
67
+ ## Status
68
+
69
+ ### Success
70
+ ```html
71
+ <button class="btn" data-status="success">Save</button>
72
+ ```
73
+
74
+ ### Danger
75
+ ```html
76
+ <button class="btn" data-status="danger">Delete</button>
77
+ ```
@@ -0,0 +1,10 @@
1
+ /* atoms/b-icon — a monochrome line glyph. Inherits color (currentColor) so it flips
2
+ ink↔grain with whatever it sits in; sized in rem so it scales with the layout, not
3
+ a fixed pixel. One class (.icon); size is an attribute (DESIGN-SYSTEM §4). */
4
+ .icon {
5
+ display: inline-block; flex: 0 0 auto; vertical-align: middle;
6
+ width: 1.25rem; height: 1.25rem; /* default */
7
+ color: currentColor; /* the sprite's stroke reads this */
8
+ }
9
+ .icon[data-size="sm"] { width: 1rem; height: 1rem; }
10
+ .icon[data-size="lg"] { width: 1.5rem; height: 1.5rem; }
@@ -0,0 +1,5 @@
1
+ <!-- atoms/b-icon — one inline SVG glyph from the shared sprite (grain/assets/sprite.svg).
2
+ `sym` is the whole sprite reference (e.g. /assets/sprite.svg#loop) — the render binding
3
+ vocabulary can't concatenate, so the ref is passed whole. `size` scales it (sm/lg).
4
+ Decorative by default (aria-hidden); label the CONTROL that wraps it, not the glyph. -->
5
+ <svg class="icon" prop-attr-data-size="size" aria-hidden="true" focusable="false"><use prop-attr-href="sym"></use></svg>
@@ -0,0 +1,36 @@
1
+ # Icon
2
+
3
+ Inline SVG glyphs from the shared sprite (`/assets/sprite.svg`). One class — `.icon`;
4
+ `size` is an attribute. Monochrome and `currentColor`, so an icon flips ink ↔ grain with
5
+ its surroundings. Icons are **decorative** (`aria-hidden`) — label the control that wraps
6
+ them (see `b-icon-button`), not the glyph.
7
+
8
+ Pass the whole sprite reference in `sym` (the binding vocabulary can't concatenate a name).
9
+
10
+ ## Glyphs
11
+
12
+ ```html
13
+ <b-icon sym="/assets/sprite.svg#loop"></b-icon>
14
+ <b-icon sym="/assets/sprite.svg#tasks"></b-icon>
15
+ <b-icon sym="/assets/sprite.svg#knowledge"></b-icon>
16
+ <b-icon sym="/assets/sprite.svg#rules"></b-icon>
17
+ <b-icon sym="/assets/sprite.svg#traces"></b-icon>
18
+ <b-icon sym="/assets/sprite.svg#settings"></b-icon>
19
+ <b-icon sym="/assets/sprite.svg#menu"></b-icon>
20
+ <b-icon sym="/assets/sprite.svg#close"></b-icon>
21
+ <b-icon sym="/assets/sprite.svg#chevron-left"></b-icon>
22
+ <b-icon sym="/assets/sprite.svg#chevron-right"></b-icon>
23
+ <b-icon sym="/assets/sprite.svg#send"></b-icon>
24
+ <b-icon sym="/assets/sprite.svg#search"></b-icon>
25
+ <b-icon sym="/assets/sprite.svg#spark"></b-icon>
26
+ <b-icon sym="/assets/sprite.svg#check"></b-icon>
27
+ <b-icon sym="/assets/sprite.svg#plus"></b-icon>
28
+ ```
29
+
30
+ ## Sizes
31
+
32
+ ```html
33
+ <b-icon sym="/assets/sprite.svg#loop" size="sm"></b-icon>
34
+ <b-icon sym="/assets/sprite.svg#loop"></b-icon>
35
+ <b-icon sym="/assets/sprite.svg#loop" size="lg"></b-icon>
36
+ ```
@@ -0,0 +1,11 @@
1
+ # Icon button
2
+
3
+ When the AI is acting through an icon button it wears the **non-text grain** — a dashed
4
+ "terminal" edge — the same inherited grade state `b-button` uses. It settles back to a
5
+ solid ink hairline on commit.
6
+
7
+ ## In-transit
8
+
9
+ ```html
10
+ <b-icon-button sym="/assets/sprite.svg#send" label="Sending…" data-commit="pending"></b-icon-button>
11
+ ```
@@ -0,0 +1,43 @@
1
+ /* atoms/b-icon-button — the icon square. One class (.icon-btn); variant/size are
2
+ attributes. Mirrors b-button: ink hairline, transparent fill, quiet wash on hover, no
3
+ shadow. Default is a ≥44px touch target (DESIGN-SYSTEM §7). */
4
+ .icon-btn {
5
+ display: inline-flex; align-items: center; justify-content: center;
6
+ width: 2.75rem; height: 2.75rem; /* ≥44px touch target */
7
+ flex-shrink: 0; /* the ≥44px promise is dead if a flex parent can shrink
8
+ it — e.g. the mobile topbar squeezing the rail-toggle
9
+ hamburger down to an untappable sliver (2026-07-14
10
+ responsive-polish audit). A square icon affordance has
11
+ no "shrink gracefully" reading; it's this size or gone. */
12
+ padding: 0;
13
+ border: var(--border); border-radius: var(--radius-sm);
14
+ background: transparent; color: var(--ink);
15
+ cursor: pointer;
16
+ transition: background-color 0.15s, color 0.15s;
17
+ }
18
+
19
+ /* ---- sizes / variants (attributes) ---- */
20
+ .icon-btn[data-size="sm"] { width: 2rem; height: 2rem; }
21
+ .icon-btn[data-size="lg"] { width: 3.25rem; height: 3.25rem; }
22
+ .icon-btn[data-variant="ghost"] { border-color: transparent; } /* rail / toolbar use */
23
+ /* the native `hidden` attribute and this rule's own `display` tie in specificity (both 0-1-0);
24
+ author order wins, so `.icon-btn`'s display silently beats the UA's `[hidden]{display:none}`
25
+ and a "hidden" button stays visible. Same trap, same fix as sidebar-panel's `.assistant__pane`. */
26
+ .icon-btn[hidden] { display: none; }
27
+
28
+ /* ---- pseudo-states. Hover = a quiet ink WASH (DESIGN-SYSTEM §5), never an invert —
29
+ the ink-fill invert read as a loud block and made ghost buttons (invisible at rest)
30
+ pop in as a rounded box out of nowhere (regression, 2026-07-04). ---- */
31
+ .icon-btn:hover, .icon-btn[data-force~="hover"] { background: color-mix(in srgb, var(--ink) 8%, transparent); }
32
+ .icon-btn:focus-visible, .icon-btn[data-force~="focus"] { outline: 2px solid var(--ink); outline-offset: 2px; }
33
+ .icon-btn:active, .icon-btn[data-force~="active"] { transform: translateY(1px); }
34
+ .icon-btn:disabled, .icon-btn[disabled] { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
35
+
36
+ /* ---- AI / in-transit: the same non-text grain as b-button — a dashed "terminal"
37
+ edge while the writer uses the control (AI-INTERFACE §5). ---- */
38
+ .icon-btn[data-commit="pending"],
39
+ .icon-btn[data-grade="grain"],
40
+ [data-grade="grain"] .icon-btn {
41
+ border-style: dashed; border-color: var(--ink);
42
+ pointer-events: none;
43
+ }
@@ -0,0 +1,8 @@
1
+ <!-- atoms/b-icon-button — a square, bordered control holding ONE glyph (DESIGN-SYSTEM §5
2
+ "Icon square"). Icon-only, so it REQUIRES `label` (→ aria-label). Same ink-hairline,
3
+ no-fill treatment as b-button; variant (ghost) + size are attributes. The glyph is
4
+ inlined (the binding vocabulary can't forward a prop into a nested <b-icon>). -->
5
+ <button class="icon-btn" prop-attr-type="type" prop-attr-aria-label="label"
6
+ prop-attr-data-variant="variant" prop-attr-data-size="size">
7
+ <svg class="icon" aria-hidden="true" focusable="false"><use prop-attr-href="sym"></use></svg>
8
+ </button>
@@ -0,0 +1,33 @@
1
+ # Icon button
2
+
3
+ The "icon square" (DESIGN-SYSTEM §5): a bordered control holding one glyph. One class —
4
+ `.icon-btn`; variant and size are attributes. Icon-only, so **`label` is required** (it
5
+ becomes the `aria-label`). Same ink-hairline / invert-on-hover treatment as `b-button`.
6
+
7
+ ## Default
8
+
9
+ ```html
10
+ <b-icon-button sym="/assets/sprite.svg#send" label="Send"></b-icon-button>
11
+ ```
12
+
13
+ ## Ghost (rail / toolbar)
14
+
15
+ ```html
16
+ <b-icon-button sym="/assets/sprite.svg#menu" label="Menu" variant="ghost"></b-icon-button>
17
+ ```
18
+
19
+ ## Sizes
20
+
21
+ ```html
22
+ <b-icon-button sym="/assets/sprite.svg#search" label="Search" size="sm"></b-icon-button>
23
+ <b-icon-button sym="/assets/sprite.svg#search" label="Search"></b-icon-button>
24
+ <b-icon-button sym="/assets/sprite.svg#search" label="Search" size="lg"></b-icon-button>
25
+ ```
26
+
27
+ ## States
28
+
29
+ ```html
30
+ <b-icon-button sym="/assets/sprite.svg#send" label="Send" data-force="hover"></b-icon-button>
31
+ <b-icon-button sym="/assets/sprite.svg#send" label="Send" data-force="focus"></b-icon-button>
32
+ <b-icon-button sym="/assets/sprite.svg#send" label="Send" disabled></b-icon-button>
33
+ ```
@@ -0,0 +1,36 @@
1
+ /* atoms/b-input — one class per element (BEM, component-scoped).
2
+ Variants are attributes, same pattern as the button. */
3
+ .field { display: flex; flex-direction: column; gap: var(--space-1); flex: 1; }
4
+ .field__label { font-size: var(--text-sm); color: var(--color-muted); }
5
+ .field__input {
6
+ padding: var(--space-2) var(--space-3);
7
+ font-family: var(--type-font); font-size: var(--text-base);
8
+ color: var(--ink); background: transparent;
9
+ border: var(--border); border-radius: var(--radius-sm); /* hard edge — you tap it */
10
+ }
11
+ .field__input::placeholder { color: var(--ink-faint); }
12
+ /* focus ring; data-force parallel lets the catalog show the state statically (same pattern as
13
+ the button) — never `autofocus`, which would steal focus + scroll the catalog on load. */
14
+ .field__input:focus-visible, .field__input[data-force~="focus"] { outline: 2px solid var(--color-accent); outline-offset: 1px; }
15
+
16
+ /* invalid state — native, no JS. Monochrome: a heavier rule, not a red one. */
17
+ .field__input:user-invalid { border-width: 2px; }
18
+
19
+ /* ---- variants (attribute) ---- */
20
+ .field[data-variant="inline"] { flex-direction: row; align-items: center; gap: var(--space-3); }
21
+ .field[data-variant="inline"] .field__label { flex: 0 0 auto; }
22
+
23
+ /* ---- sizes (attribute) ---- */
24
+ .field[data-size="sm"] .field__input { padding: var(--space-1) var(--space-2); font-size: var(--text-sm); }
25
+ .field[data-size="lg"] .field__input { padding: var(--space-3) var(--space-4); font-size: var(--text-lg); }
26
+
27
+ /* ---- AI / in-transit: the non-text grain, same language as the button (AI-INTERFACE §5).
28
+ A field the AI is touching (live pending, or any grain ancestor) wears the dashed
29
+ "terminal" edge; the label + value already swap to the grain family via --type-font.
30
+ EXCEPTION: while the AI is actively COMPOSING, the dispatcher sets data-grade="smooth"
31
+ on the input itself (clean ink, real caret, like a human typing) — so that stays solid.
32
+ The `:not([data-grade="smooth"])` guard makes the exception explicit: a self-smooth input
33
+ never matches the dashed rule, so the outcome doesn't depend on stylesheet source order. */
34
+ .field[data-commit="pending"] .field__input:not([data-grade="smooth"]),
35
+ [data-grade="grain"] .field__input:not([data-grade="smooth"]) { border-style: dashed; }
36
+ .field__input[data-grade="smooth"] { border-style: solid; }
@@ -0,0 +1,8 @@
1
+ <!-- atoms/b-input — labelled text field. Config props: name, type, placeholder,
2
+ required (bare boolean), variant, size. Usable self-closed. -->
3
+ <label class="field" prop-attr-data-variant="variant" prop-attr-data-size="size">
4
+ <span class="field__label" prop-text="label">Label</span>
5
+ <input class="field__input"
6
+ prop-attr-name="name" prop-attr-type="type"
7
+ prop-attr-placeholder="placeholder" prop-attr-required="required">
8
+ </label>
@@ -0,0 +1,59 @@
1
+ # Input
2
+
3
+ A labelled text field. Compose several inside a `<form>` to build any form.
4
+ As a component: `<b-input name="email" label="Email" required />` — `required` is a
5
+ bare boolean, and the tag may self-close.
6
+
7
+ ## States
8
+
9
+ ### Default
10
+ ```html
11
+ <label class="field">
12
+ <span class="field__label">Name</span>
13
+ <input class="field__input" name="name" placeholder="Jane">
14
+ </label>
15
+ ```
16
+
17
+ ### Focus
18
+ ```html
19
+ <label class="field">
20
+ <span class="field__label">Name</span>
21
+ <input class="field__input" name="name" value="Jane" data-force="focus">
22
+ </label>
23
+ ```
24
+
25
+ ## Variants
26
+
27
+ ### Default (stacked)
28
+ ```html
29
+ <label class="field">
30
+ <span class="field__label">Name</span>
31
+ <input class="field__input" name="name">
32
+ </label>
33
+ ```
34
+
35
+ ### Inline
36
+ ```html
37
+ <label class="field" data-variant="inline">
38
+ <span class="field__label">Name</span>
39
+ <input class="field__input" name="name">
40
+ </label>
41
+ ```
42
+
43
+ ## Sizes
44
+
45
+ ### Small
46
+ ```html
47
+ <label class="field" data-size="sm">
48
+ <span class="field__label">Name</span>
49
+ <input class="field__input" name="name">
50
+ </label>
51
+ ```
52
+
53
+ ### Large
54
+ ```html
55
+ <label class="field" data-size="lg">
56
+ <span class="field__label">Name</span>
57
+ <input class="field__input" name="name">
58
+ </label>
59
+ ```
@@ -0,0 +1,11 @@
1
+ /* atoms/b-kbd — a keyboard-shortcut hint. A quiet hairline chip in muted ink; reads the
2
+ inherited --type-font like every type primitive (no bespoke font). */
3
+ .kbd {
4
+ display: inline-flex; align-items: center; justify-content: center;
5
+ min-width: 1.5rem; min-height: 1.5rem;
6
+ padding: 0 var(--space-2);
7
+ font-family: var(--type-font); font-size: var(--text-xs);
8
+ color: var(--ink-muted);
9
+ border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
10
+ white-space: nowrap;
11
+ }
@@ -0,0 +1,3 @@
1
+ <!-- atoms/b-kbd — a keyboard-shortcut hint (e.g. ⌘K). Presentational only; the real
2
+ handler lives elsewhere (the ⌘K palette island, a shell toggle). `keys` sets the label. -->
3
+ <kbd class="kbd" prop-text="keys">⌘K</kbd>
@@ -0,0 +1,13 @@
1
+ # Keyboard hint
2
+
3
+ A quiet hairline chip that names a keyboard shortcut. One class — `.kbd`. Presentational
4
+ only: the real handler lives elsewhere (the ⌘K palette, a shell toggle). `keys` sets the
5
+ label.
6
+
7
+ ## Examples
8
+
9
+ ```html
10
+ <b-kbd keys="⌘K"></b-kbd>
11
+ <b-kbd keys="⌘B"></b-kbd>
12
+ <b-kbd keys="Esc"></b-kbd>
13
+ ```
@@ -0,0 +1,21 @@
1
+ /* atoms/b-list — a quiet list. Markers are an editorial em-dash (bullet) or a counter
2
+ (ordered) in muted ink — no heavy disc, fits the e-ink paper look (DESIGN-SYSTEM §4). */
3
+ .list { margin: 0 0 var(--space-4); padding: 0; list-style: none; }
4
+ .list__item { position: relative; padding-left: var(--space-5); margin: var(--space-2) 0; }
5
+ .list__item::before { content: "—"; position: absolute; left: 0; color: var(--ink-muted); }
6
+
7
+ /* ---- ordered variant (attribute): a counter, not a disc ---- */
8
+ .list[data-variant="ordered"] { counter-reset: li; }
9
+ .list[data-variant="ordered"] .list__item { counter-increment: li; }
10
+ .list[data-variant="ordered"] .list__item::before { content: counter(li) "."; }
11
+
12
+ /* ---- AI / in-transit: an item the AI is writing reads grain (the label swaps via the
13
+ inherited --type-font); its marker recedes to faint while pending, settling on commit.
14
+ Same vocabulary as the other atoms (AI-INTERFACE §5). */
15
+ .list__item[data-commit="pending"]::before,
16
+ [data-grade="grain"] .list__item::before { color: var(--ink-faint); }
17
+
18
+ /* While the AI writes an item it's momentarily EMPTY (appended, not yet typed). Reserve
19
+ a line so the list doesn't collapse then grow back — that jumpy shrink before writing. */
20
+ .list__item:empty { min-height: 1.55em; } /* ≈ one --leading-relaxed line */
21
+
@@ -0,0 +1,6 @@
1
+ <!-- atoms/b-list — a quiet list (bullet or ordered). Items come from an `items` array
2
+ via `each`, or author <li class="list__item"> directly. Each item is addressable
3
+ (give it a data-surface) so the AI can write or revise ONE item. Self-closable. -->
4
+ <ul class="list" prop-attr-data-variant="variant">
5
+ <li class="list__item" each="items" data-field="."></li>
6
+ </ul>
@@ -0,0 +1,24 @@
1
+ # List
2
+
3
+ One class — `.list` with `.list__item` children. Bullet by default (an editorial
4
+ em-dash); `data-variant="ordered"` switches to a counter. Markers are muted ink, not a
5
+ heavy disc (DESIGN-SYSTEM §4). Give each item a `data-surface` so the AI can write — or
6
+ revise — one item at a time.
7
+
8
+ ## Bullet (default)
9
+ ```html
10
+ <ul class="list">
11
+ <li class="list__item">Deep-work block — 09:00–11:00</li>
12
+ <li class="list__item">Clear the inbox</li>
13
+ <li class="list__item">Review architecture doc</li>
14
+ </ul>
15
+ ```
16
+
17
+ ## Ordered
18
+ ```html
19
+ <ul class="list" data-variant="ordered">
20
+ <li class="list__item">First</li>
21
+ <li class="list__item">Second</li>
22
+ <li class="list__item">Third</li>
23
+ </ul>
24
+ ```
@@ -0,0 +1,39 @@
1
+ /* atoms/b-meter — a proportional horizontal bar split into segments: a health bar (passed/
2
+ failed/pending share), a storage bar, a progress bar, a poll result. Grain had no meter/
3
+ progress primitive at all. One class per element (BEM); tone is an attribute. Each segment's
4
+ width is one custom property (--seg) so it's data-bindable server-side with zero JS.
5
+ Monochrome: segments differ by TEXTURE + ink-level, never by hue (DESIGN-SYSTEM §2) — solid
6
+ ink (ok), hatched (bad), faint (the rest) — the e-ink language. */
7
+ .meter {
8
+ display: flex; align-items: stretch;
9
+ height: var(--space-2); overflow: hidden;
10
+ border-radius: var(--radius-pill); background: var(--line-soft);
11
+ }
12
+ /* a segment fills its share of the track; default/"pending" reads faint solid */
13
+ .meter__seg { flex: 0 0 auto; width: var(--seg, 0); background: var(--ink-faint); }
14
+ /* ok — solid ink (the load-bearing "good" share) */
15
+ .meter__seg[data-tone="ok"] { background: var(--ink); }
16
+ /* bad — a dense diagonal hatch of ink (stands out by texture, not colour) */
17
+ .meter__seg[data-tone="bad"] {
18
+ background-color: transparent;
19
+ background-image: repeating-linear-gradient(45deg, var(--ink) 0 2px, transparent 2px 5px);
20
+ }
21
+ /* pending — a sparse dotted hatch, echoing the in-transit e-ink grain (lighter than "bad") */
22
+ .meter__seg[data-tone="pending"] {
23
+ background-color: transparent;
24
+ background-image: repeating-linear-gradient(45deg, var(--ink-faint) 0 1px, transparent 1px 4px);
25
+ }
26
+
27
+ /* ---- indeterminate: running, totals unknown yet. A single faint stripe sweeps the track.
28
+ Honours reduced-motion (falls back to a static faint fill). ---- */
29
+ .meter[data-state="busy"] .meter__seg { width: 35%; background: var(--ink-faint); animation: meter-sweep 1.1s ease-in-out infinite; }
30
+ @keyframes meter-sweep { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
31
+ @media (prefers-reduced-motion: reduce) {
32
+ .meter[data-state="busy"] .meter__seg { animation: none; width: 100%; }
33
+ }
34
+
35
+ /* ---- AI / in-transit: the non-text grain, same vocabulary as the rest of the family
36
+ (AI-INTERFACE §5). A meter the AI is updating (live pending, or any grain ancestor) wears the
37
+ dashed "terminal" edge on the track. ---- */
38
+ .meter[data-commit="pending"],
39
+ [data-grade="grain"] .meter { border: 1px dashed var(--ink); }
@@ -0,0 +1,44 @@
1
+ # Meter
2
+
3
+ A proportional horizontal bar split into segments — a health bar (passed / failed / pending
4
+ share of a run), a storage bar, a progress bar, a poll result. Each segment's width is a single
5
+ custom property (`--seg`) so it's bindable server-side with **zero JS**. Monochrome: segments
6
+ differ by texture and ink-level — solid ink, hatched, faint — never by hue.
7
+
8
+ Segments read left-to-right and should sum to 100% (any remainder shows the faint track). Give
9
+ the meter an `aria-label`; for a single-value progress meter add `aria-valuenow`/`min`/`max`.
10
+
11
+ ## Health bar (three tones)
12
+ `ok` is solid ink, `bad` is a dense hatch, an untoned/`pending` segment is faint. Order and
13
+ widths are author-set.
14
+ ```html
15
+ <div class="meter" role="meter" aria-label="Run health">
16
+ <span class="meter__seg" data-tone="ok" style="--seg: 70%"></span>
17
+ <span class="meter__seg" data-tone="bad" style="--seg: 20%"></span>
18
+ <span class="meter__seg" data-tone="pending" style="--seg: 10%"></span>
19
+ </div>
20
+ ```
21
+
22
+ ## Progress (one segment)
23
+ ```html
24
+ <div class="meter" role="meter" aria-label="Upload" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100">
25
+ <span class="meter__seg" data-tone="ok" style="--seg: 60%"></span>
26
+ </div>
27
+ ```
28
+
29
+ ## Indeterminate (running, totals unknown)
30
+ `data-state="busy"` sweeps a faint stripe across the track (static faint fill under
31
+ `prefers-reduced-motion`).
32
+ ```html
33
+ <div class="meter" data-state="busy" role="meter" aria-label="Running…">
34
+ <span class="meter__seg"></span>
35
+ </div>
36
+ ```
37
+
38
+ ## In transit (AI updating the meter)
39
+ ```html
40
+ <div class="meter" data-commit="pending" role="meter" aria-label="Run health">
41
+ <span class="meter__seg" data-tone="ok" style="--seg: 55%"></span>
42
+ <span class="meter__seg" data-tone="pending" style="--seg: 45%"></span>
43
+ </div>
44
+ ```
@@ -0,0 +1,35 @@
1
+ /* atoms/b-select — the field family's dropdown; reuses .field/.field__label from b-input,
2
+ adds .field__select. One class per element (BEM, component-scoped); variants are attributes,
3
+ same pattern as the input/button. Native dropdown arrow kept (no appearance: none) — accessible,
4
+ and a hardcoded caret color would break the tokens-only rule. */
5
+ .field__select {
6
+ width: 100%; box-sizing: border-box;
7
+ padding: var(--space-2) var(--space-3);
8
+ font-family: var(--type-font); font-size: var(--text-base);
9
+ color: var(--ink); background: transparent;
10
+ border: var(--border); border-radius: var(--radius-sm);
11
+ }
12
+ /* focus ring; data-force parallel lets the catalog show the state statically (same pattern as
13
+ b-input) — never `autofocus`, which would steal focus + scroll the catalog on load. */
14
+ .field__select:focus-visible, .field__select[data-force~="focus"] { outline: 2px solid var(--color-accent); outline-offset: 1px; }
15
+
16
+ /* invalid state — native, no JS. Monochrome: a heavier rule, not a red one. */
17
+ .field__select:user-invalid { border-width: 2px; }
18
+
19
+ /* ---- sizes (attribute, on .field, same as b-input) ---- */
20
+ .field[data-size="sm"] .field__select { padding: var(--space-1) var(--space-2); font-size: var(--text-sm); }
21
+ .field[data-size="lg"] .field__select { padding: var(--space-3) var(--space-4); font-size: var(--text-lg); }
22
+
23
+ /* Inline variant (.field[data-variant="inline"]) already works — it's declared on .field itself
24
+ in b-input.css, so b-select gets it for free by reusing the same frame. Not re-declared here. */
25
+
26
+ /* ---- AI / in-transit: the non-text grain, same language as the button/field (AI-INTERFACE §5).
27
+ A select the AI is touching (live pending, or any grain ancestor) wears the dashed "terminal"
28
+ edge; the label + value already swap to the grain family via --type-font.
29
+ EXCEPTION: while the AI is actively COMPOSING, the dispatcher sets data-grade="smooth" on the
30
+ select itself (clean ink, like a human choosing) — so that stays solid. The
31
+ `:not([data-grade="smooth"])` guard makes the exception explicit: a self-smooth select never
32
+ matches the dashed rule, so the outcome doesn't depend on stylesheet source order. */
33
+ .field[data-commit="pending"] .field__select:not([data-grade="smooth"]),
34
+ [data-grade="grain"] .field__select:not([data-grade="smooth"]) { border-style: dashed; }
35
+ .field__select[data-grade="smooth"] { border-style: solid; }
@@ -0,0 +1,75 @@
1
+ # Select
2
+
3
+ A labelled `<select>` in the `.field` idiom — the dropdown sibling of the text input.
4
+ It reuses the shared `.field`/`.field__label` frame from b-input (parent-context note:
5
+ b-select contributes only `.field__select`, and must be composed inside a `.field` label
6
+ exactly like b-input, or it has no frame/spacing/AI treatment). The native dropdown arrow
7
+ is kept — no custom caret, so nothing here needs a hardcoded color.
8
+
9
+ ## States
10
+
11
+ ### Default
12
+ ```html
13
+ <label class="field">
14
+ <span class="field__label">Environment</span>
15
+ <select class="field__select" name="env">
16
+ <option>staging</option><option>prod</option>
17
+ </select>
18
+ </label>
19
+ ```
20
+
21
+ ### Focus
22
+ ```html
23
+ <label class="field">
24
+ <span class="field__label">Environment</span>
25
+ <select class="field__select" name="env" data-force="focus">
26
+ <option>staging</option><option>prod</option>
27
+ </select>
28
+ </label>
29
+ ```
30
+
31
+ ## Variants
32
+
33
+ ### Default (stacked)
34
+ ```html
35
+ <label class="field">
36
+ <span class="field__label">Priority</span>
37
+ <select class="field__select" name="priority">
38
+ <option>Low</option><option>Medium</option><option>High</option>
39
+ </select>
40
+ </label>
41
+ ```
42
+
43
+ ### Inline
44
+ Inline works for free — it's declared on `.field[data-variant="inline"]` by b-input.css,
45
+ and b-select reuses the same `.field` frame, so no separate CSS is needed here.
46
+ ```html
47
+ <label class="field" data-variant="inline">
48
+ <span class="field__label">Priority</span>
49
+ <select class="field__select" name="priority">
50
+ <option>Low</option><option>Medium</option><option>High</option>
51
+ </select>
52
+ </label>
53
+ ```
54
+
55
+ ## Sizes
56
+
57
+ ### Small
58
+ ```html
59
+ <label class="field" data-size="sm">
60
+ <span class="field__label">Priority</span>
61
+ <select class="field__select" name="priority">
62
+ <option>Low</option><option>Medium</option><option>High</option>
63
+ </select>
64
+ </label>
65
+ ```
66
+
67
+ ### Large
68
+ ```html
69
+ <label class="field" data-size="lg">
70
+ <span class="field__label">Priority</span>
71
+ <select class="field__select" name="priority">
72
+ <option>Low</option><option>Medium</option><option>High</option>
73
+ </select>
74
+ </label>
75
+ ```