@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,87 @@
1
+ /* molecules/content-index — a collection's listing (MILL's index route emits it): a quiet
2
+ ruled list of entries, each meta → linked title → summary → tags. CSS-only: composed by
3
+ MILL, nothing data-binds it. Human-authored content lists → clean ink. */
4
+ .content-index { list-style: none; margin: 0; padding: 0; }
5
+ .content-index__item { padding: var(--space-5) 0; border-bottom: 1px solid var(--color-line); }
6
+ .content-index__item:last-child { border-bottom: 0; }
7
+
8
+ .content-index__meta {
9
+ font-size: var(--text-xs);
10
+ color: var(--color-muted);
11
+ text-transform: uppercase;
12
+ letter-spacing: 0.08em;
13
+ margin: 0 0 var(--space-1);
14
+ }
15
+ /* date + readingTime ship as separate spans (mill/serve.ts) so the "log" variant below can put
16
+ the date alone in a fixed gutter; the default listing joins them back inline with a rule. */
17
+ .content-index__readtime::before { content: " \00b7 "; }
18
+ .content-index__title { font-size: var(--text-xl); margin: 0 0 var(--space-2); }
19
+ .content-index__title a { color: var(--color-fg); text-decoration: none; }
20
+ .content-index__title a:hover { text-decoration: underline; }
21
+ .content-index__summary {
22
+ color: var(--color-muted);
23
+ line-height: var(--leading-relaxed);
24
+ max-width: 60ch;
25
+ margin: 0 0 var(--space-2);
26
+ }
27
+ .content-index .note__tags { margin: 0; }
28
+
29
+ /* AI / in-transit: dashed terminal edge (non-text grain idiom) — never from MILL itself */
30
+ .content-index__item[data-commit="pending"],
31
+ [data-grade="grain"] .content-index__item { border-bottom-style: dashed; }
32
+
33
+ /* variant: log — a collection read as `git log --graph`: a node + connecting rail down the
34
+ left edge, a mono date gutter, the title as the commit message, tags as branch chips. Opt-in
35
+ per collection (indexVariant, mill/serve.ts); default listing above is untouched for
36
+ collections that don't ask for it.
37
+
38
+ THREE grid columns: [graph] [date] [message]. The graph column holds no grid child — the
39
+ node + rail are pseudo-elements on the LI itself (position:absolute is excluded from grid
40
+ auto-placement, so they can't collide with the real columns), same technique as the
41
+ side-rail's own icon-gutter line. `.content-index__meta`'s two children (date, readingTime —
42
+ separate spans since mill/serve.ts) go `display:contents` so each can be grid-placed on its
43
+ own: date into the fixed gutter, readingTime down with the message instead of crowding the
44
+ gutter — that crowding (both joined in one nowrap string) was the overlap bug. */
45
+ .content-index[data-variant="log"] .content-index__item {
46
+ position: relative;
47
+ display: grid;
48
+ grid-template-columns: 1.25rem 11ch 1fr;
49
+ column-gap: var(--space-3);
50
+ }
51
+ /* the rail: one hairline down the graph column, full item height — trimmed at the first/last
52
+ entry so it starts/stops at the tip and root commit instead of dangling past the list. */
53
+ .content-index[data-variant="log"] .content-index__item::before {
54
+ content: ""; position: absolute; left: 0.625rem; top: 0; bottom: 0;
55
+ width: 1px; background: var(--color-line);
56
+ }
57
+ .content-index[data-variant="log"] .content-index__item:first-child::before { top: 0.95rem; }
58
+ .content-index[data-variant="log"] .content-index__item:last-child::before { bottom: calc(100% - 0.95rem); }
59
+ /* the node: an accent dot on the rail, haloed in the page background so the rail reads as
60
+ passing BEHIND it (the same halo trick a git-graph renderer uses). */
61
+ .content-index[data-variant="log"] .content-index__item::after {
62
+ content: ""; position: absolute; left: 0.625rem; top: 0.95rem;
63
+ width: 7px; height: 7px; margin-left: -3px; border-radius: 50%;
64
+ background: var(--color-accent); border: 2px solid var(--color-bg);
65
+ }
66
+ .content-index[data-variant="log"] .content-index__meta { display: contents; }
67
+ .content-index[data-variant="log"] .content-index__date {
68
+ grid-column: 2; grid-row: 1;
69
+ font-family: var(--font-mono); text-transform: none; letter-spacing: normal; white-space: nowrap;
70
+ color: var(--color-muted);
71
+ }
72
+ .content-index[data-variant="log"] .content-index__title {
73
+ grid-column: 3; grid-row: 1;
74
+ font-size: var(--text-base); font-weight: 600;
75
+ }
76
+ .content-index[data-variant="log"] .content-index__readtime {
77
+ grid-column: 3; grid-row: 2;
78
+ font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-muted);
79
+ }
80
+ .content-index[data-variant="log"] .content-index__readtime::before { content: ""; } /* cancel the default " · " prefix — no longer beside the date */
81
+ .content-index[data-variant="log"] .content-index__summary { grid-column: 3; grid-row: 3; }
82
+ .content-index[data-variant="log"] .note__tags { grid-column: 3; grid-row: 4; display: flex; gap: var(--space-2); flex-wrap: wrap; }
83
+ .content-index[data-variant="log"] .note__tags .badge {
84
+ font-family: var(--font-mono);
85
+ font-size: var(--text-xs);
86
+ }
87
+ .content-index[data-variant="log"] .note__tags .badge::before { content: "⎇ "; }
@@ -0,0 +1,27 @@
1
+ # Content index
2
+
3
+ A collection's listing — what MILL's live content route emits at a collection's index
4
+ (`/notes`, `/grain/docs`): a ruled list of entries, each with a meta line, a linked title,
5
+ a summary, and tag badges. CSS-only: MILL composes it; nothing data-binds it.
6
+
7
+ ## Listing
8
+ ```html
9
+ <ul class="content-index">
10
+ <li class="content-index__item">
11
+ <p class="content-index__meta">2026-07-04 · ~8 min</p>
12
+ <h2 class="content-index__title"><a href="/notes/the-browser-grew-up">The Browser Grew Up</a></h2>
13
+ <p class="content-index__summary">The honest ledger of what betting on the native platform bought me.</p>
14
+ <div class="note__tags"><span class="badge" data-status="active">native-first</span></div>
15
+ </li>
16
+ </ul>
17
+ ```
18
+
19
+ ## Variant: log
20
+
21
+ `data-variant="log"` on the `<ul>` reads the listing as commit history — mono date gutter,
22
+ title as the message, tags as branch chips. Opt in per collection (MILL's `indexVariant`);
23
+ default listing is unchanged for collections that don't ask for it.
24
+
25
+ ```html
26
+ <ul class="content-index" data-variant="log">…</ul>
27
+ ```
@@ -0,0 +1,6 @@
1
+ /* molecules/content-source — the Rendered/Source toggle on a MILL entry page: two `.tab`
2
+ atoms (reuse, not a new control), Rendered active by default. Container only; the tab
3
+ itself carries all the visual states (active/hover). */
4
+ .content-source {
5
+ display: flex; border-bottom: 1px solid var(--color-line); margin: 0 0 var(--space-5);
6
+ }
@@ -0,0 +1,13 @@
1
+ # Content source
2
+
3
+ The Rendered/Source toggle on a MILL entry page: "the site is its own source tree" made
4
+ clickable. Composed from the `tab` atom (reuse, not a new control) — Rendered carries
5
+ `aria-current="page"`, Source links straight to the entry's raw `.md` route (MILL's
6
+ honest-source route, `${prefix}/${slug}.md`).
7
+
8
+ ```html
9
+ <nav class="content-source" aria-label="View">
10
+ <a class="tab" aria-current="page" href="/notes/the-browser-grew-up">Rendered</a>
11
+ <a class="tab" href="/notes/the-browser-grew-up.md">Source</a>
12
+ </nav>
13
+ ```
@@ -0,0 +1,19 @@
1
+ /* molecules/figure — an image with an optional caption for content prose. The `clipped`
2
+ variant gives the editorial clipped-photo edge. CSS-only (CONVENTIONS §4): MILL maps a
3
+ standalone Markdown image to <figure class="figure">; nothing data-binds it, no template. */
4
+ .figure { margin: 0 0 var(--space-6); }
5
+ .figure img { display: block; max-width: 100%; height: auto; border: 1px solid var(--color-line); }
6
+ .figure__caption {
7
+ margin-top: var(--space-2);
8
+ font-size: var(--text-sm);
9
+ color: var(--color-muted);
10
+ line-height: var(--leading-normal);
11
+ }
12
+
13
+ /* clipped-photo variant: a hard editorial clip instead of a straight rectangle */
14
+ .figure[data-variant="clipped"] img { border: 0; clip-path: polygon(0 0, 100% 0, 100% 94%, 96% 100%, 0 100%); }
15
+
16
+ /* ---- AI / in-transit: dashed terminal edge (non-text grain), same idiom as the atoms.
17
+ MILL output is human-authored → never triggers; the catalog grain-flip demonstrates it. */
18
+ .figure[data-commit="pending"] img,
19
+ [data-grade="grain"] .figure img { border-style: dashed; border-color: var(--ink); }
@@ -0,0 +1,20 @@
1
+ # Figure
2
+
3
+ An image with an optional caption. The `clipped` variant gives the editorial clipped-photo
4
+ edge (a hard corner clip, no border). MILL maps a standalone Markdown image to this;
5
+ composed by hand, so nothing data-binds it. Images never overflow the column.
6
+
7
+ ## Caption
8
+ ```html
9
+ <figure class="figure">
10
+ <img src="/assets/figure-sample.svg" alt="An abstract field of grain strokes">
11
+ <figcaption class="figure__caption">A caption sits under the image, set small.</figcaption>
12
+ </figure>
13
+ ```
14
+
15
+ ## Clipped photo
16
+ ```html
17
+ <figure class="figure" data-variant="clipped">
18
+ <img src="/assets/figure-sample.svg" alt="The same image, clipped">
19
+ </figure>
20
+ ```
@@ -0,0 +1,17 @@
1
+ /* molecules/lede — the opening paragraph of a page or section: larger, muted, measured.
2
+ CSS-only (CONVENTIONS §4): nothing data-binds it — compose by hand under a masthead.
3
+ Emphasis inside a lede reads as underline, not italic (monochrome, DESIGN-SYSTEM §2). */
4
+ .lede {
5
+ color: var(--color-muted);
6
+ font-size: var(--text-lg);
7
+ max-width: 56ch;
8
+ line-height: var(--leading-relaxed);
9
+ }
10
+ .lede em { font-style: normal; text-decoration: underline; }
11
+
12
+ /* size is an attribute, not a second class: the small lede is a quiet aside — body-small,
13
+ a touch wider measure */
14
+ .lede[data-size="sm"] { font-size: var(--text-sm); max-width: 60ch; }
15
+
16
+ /* ---- AI / in-transit: a lede is text — the global grade mechanism (data-grade →
17
+ --type-font, styles/grain.css) already carries the grain; nothing bespoke needed. */
@@ -0,0 +1,17 @@
1
+ # Lede
2
+
3
+ The opening paragraph of a page or section — larger, muted, held to a readable measure
4
+ (56ch). One class, composed by hand under a masthead; emphasis inside it reads as an
5
+ underline, not italic (state is ink, not hue).
6
+
7
+ ## Lede
8
+ ```html
9
+ <p class="lede">A <em>no-build, server-rendered</em> hypermedia substrate. The browser gets
10
+ near-zero framework JavaScript; the runtime reads the source directly.</p>
11
+ ```
12
+
13
+ ## Small (a quiet aside)
14
+ ```html
15
+ <p class="lede" data-size="sm">An in-browser demo is on the way — a tiny model running
16
+ client-side, no backend, no key.</p>
17
+ ```
@@ -0,0 +1,25 @@
1
+ /* molecules/made-with — the system byline: "made with GRAIN by tjakoen". The one footer
2
+ line every GRAIN app mounts at the bottom of its shell, so provenance reads the same
3
+ everywhere. CSS-only (CONVENTIONS §4): consumers emit the markup themselves or import
4
+ the string helper (scripts/made-with.js) — one source of truth for the content. */
5
+ .made-with {
6
+ display: block;
7
+ padding: var(--space-6) var(--space-4) var(--space-4);
8
+ text-align: center;
9
+ font-family: var(--font-mono);
10
+ font-size: var(--text-xs);
11
+ color: var(--color-muted);
12
+ }
13
+ .made-with a { color: inherit; text-decoration: none; }
14
+ .made-with a:hover,
15
+ .made-with a:focus-visible { color: var(--color-fg); text-decoration: underline; }
16
+
17
+ /* inside a status-bar (or any inline meta row) it flows as quiet meta-text, not a block —
18
+ the row's own type treatment wins */
19
+ .made-with[data-inline] {
20
+ display: inline;
21
+ padding: 0;
22
+ text-align: inherit;
23
+ font-family: inherit;
24
+ font-size: inherit;
25
+ }
@@ -0,0 +1,35 @@
1
+ # made-with
2
+
3
+ The system **byline**: `made with GRAIN by tjakoen`. One quiet mono line, mounted at the
4
+ bottom of every GRAIN app's shell, so provenance reads identically across the fleet. Links:
5
+ *GRAIN* → the design-system docs home, *tjakoen* → the portfolio.
6
+
7
+ CSS-only (no `.html`) — but the *content* is centralized too: server-side template-literal
8
+ shells import the string helper so the line can never drift per app:
9
+
10
+ ```ts
11
+ import { madeWith } from "@tjakoen/grain/scripts/made-with.js";
12
+ // block form — a standalone page footer
13
+ body += madeWith();
14
+ // inline form — inside a status-bar row
15
+ `<footer class="app-shell__status status-bar">…<span class="status-bar__spacer"></span>${madeWith({ inline: true })}</footer>`
16
+ ```
17
+
18
+ Canonical markup (what the helper emits):
19
+
20
+ ```html
21
+ <footer class="made-with">
22
+ made with <a href="https://tjakoen.github.io/grain">GRAIN</a>
23
+ by <a href="https://tjakoen.github.io">tjakoen</a>
24
+ </footer>
25
+ ```
26
+
27
+ - **Block form** (default): a centered `--text-xs` mono line in `--color-muted`; links keep
28
+ ink and underline only on hover/focus. Place it last inside `<body>` (after `<main>`).
29
+ - **Inline form** (`data-inline`, emitted as a `<span>`): inherits the row's type treatment —
30
+ made for the right side of a `status-bar`, after the `__spacer`.
31
+ - No grade texture on the wordmark: grade only reads at ≥ `--text-2xl` (CLAUDE.md lesson 4),
32
+ and this line is deliberately small.
33
+
34
+ **Parent contract:** none — self-sufficient anywhere. Consumers must ship
35
+ `components/molecules/made-with/made-with.css` in their stylesheet set.
@@ -0,0 +1,19 @@
1
+ /* molecules/nav-item — a rail navigation entry: an icon in the rail's shared ICON GUTTER, then
2
+ the label — the two-column, editor-workspace look (icons align in their own vertical column;
3
+ the rail draws the gutter line). A styled anchor composed with b-icon (not a custom tag, so it
4
+ drops into a static page). Active = aria-current="page" (accessible) or data-active="true".
5
+ Grid: icon column (fixed, --rail-icon-col) | label | trailing (chevron). Iconless items (e.g.
6
+ a group's sub-entries) indent past the gutter instead — see side-rail. */
7
+ .nav-item {
8
+ display: grid; grid-template-columns: var(--rail-icon-col, 2.5rem) 1fr auto;
9
+ align-items: center; column-gap: var(--space-2);
10
+ min-height: 2.25rem; padding-right: var(--space-2);
11
+ border: 1px solid transparent; border-radius: var(--radius-sm);
12
+ color: var(--color-muted); text-decoration: none; white-space: nowrap;
13
+ }
14
+ .nav-item > b-icon, .nav-item > .icon { justify-self: center; } /* the icon sits centered in the gutter */
15
+ .nav-item:hover { background: var(--color-bg); color: var(--color-fg); }
16
+ .nav-item[aria-current="page"], .nav-item[data-active="true"] {
17
+ color: var(--color-fg); background: var(--color-bg); border-color: var(--color-line);
18
+ }
19
+ .nav-item__label { font-size: var(--text-base); }
@@ -0,0 +1,21 @@
1
+ # Nav item
2
+
3
+ A rail navigation entry — the icon sits in the rail's shared icon **gutter** (a fixed
4
+ column, `--rail-icon-col`), the label beside it; all glyphs align in one vertical column
5
+ and the side-rail draws the gutter hairline. A styled anchor composed with `b-icon`. Mark
6
+ the current one with `aria-current="page"` (accessible) or `data-active="true"`. In a
7
+ collapsed rail the label is hidden and the glyph centers. Iconless entries (a group's
8
+ sub-items) indent past the gutter — the side-rail handles that.
9
+
10
+ ## States
11
+
12
+ ### Active
13
+ ```html
14
+ <a class="nav-item" aria-current="page"><b-icon sym="/assets/sprite.svg#loop"></b-icon><span class="nav-item__label">Overview</span></a>
15
+ ```
16
+
17
+ ### Default
18
+ ```html
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#rules"></b-icon><span class="nav-item__label">Rules</span></a>
21
+ ```
@@ -0,0 +1,34 @@
1
+ /* molecules/stat-tile — a KPI tile: one big number, a small label, an optional sub-line.
2
+ The standard dashboard primitive; grain had nothing between b-badge and card. One class per
3
+ element (BEM); tone is an attribute. Monochrome: tone is carried by ink-level + border weight,
4
+ never by hue (DESIGN-SYSTEM §2) — same doctrine as b-badge's "active". Tiles compose in a plain
5
+ flex/grid row; no wrapper component (see the .md). */
6
+ .stat {
7
+ display: flex; flex-direction: column; gap: var(--space-1);
8
+ padding: var(--space-3) var(--space-4);
9
+ border: var(--border); border-radius: var(--radius-md);
10
+ min-inline-size: 0;
11
+ }
12
+ /* the number sits at display scale so grain texture reads if it's AI-written (grade doctrine) */
13
+ .stat__value {
14
+ font-size: var(--text-2xl); font-weight: var(--font-weight-medium);
15
+ line-height: var(--leading-tight); color: var(--ink);
16
+ }
17
+ .stat__label { font-size: var(--text-sm); color: var(--color-muted); }
18
+ .stat__sub { font-size: var(--text-xs); color: var(--ink-faint); }
19
+
20
+ /* ---- tone (attribute) — ink-level + border weight, NOT hue ----
21
+ default : the calm baseline (a healthy/positive count needs no shouting).
22
+ ok : same calm baseline — an explicit "good" that reads identical, by design.
23
+ bad : draws the eye monochromatically — a solid-ink border + full-ink value.
24
+ muted : a context/secondary count (skipped, pending, a total) recedes to faint. */
25
+ .stat[data-tone="bad"] { border-color: var(--ink); }
26
+ .stat[data-tone="muted"] .stat__value { color: var(--ink-faint); }
27
+ .stat[data-tone="muted"] .stat__label { color: var(--ink-faint); }
28
+
29
+ /* ---- AI / in-transit: the non-text grain, same vocabulary as the button/field/badge
30
+ (AI-INTERFACE §5). A tile whose number is mid-update wears the dashed "terminal" edge; a
31
+ value the AI is writing carries data-grade="grain" so its digits render in the grain family
32
+ via the inherited --type-font. */
33
+ .stat[data-commit="pending"],
34
+ [data-grade="grain"] .stat { border-style: dashed; border-color: var(--ink); }
@@ -0,0 +1,50 @@
1
+ # Stat tile
2
+
3
+ A KPI tile — one big number, a small label, an optional sub-line. The standard dashboard
4
+ primitive (a stats strip, a run summary, a cockpit home). Monochrome: tone is ink-level +
5
+ border weight, never hue.
6
+
7
+ Composition note: tiles are laid out by their parent, not by a wrapper component — drop them
8
+ in a plain flex or grid row (`display: flex; gap: var(--space-3)`, or a
9
+ `grid-template-columns: repeat(auto-fit, minmax(…, 1fr))`). Keep the `.stat` itself layout-free
10
+ so it fits any strip.
11
+
12
+ The value sits at display scale so, when an AI writes it, the grain texture reads — put
13
+ `data-grade="grain"` on the `.stat__value` while the AI is composing it; a tile whose number is
14
+ mid-update wears `data-commit="pending"` (the shared in-transit idiom), not a bespoke "loading"
15
+ state.
16
+
17
+ ## Default
18
+ ```html
19
+ <div class="stat">
20
+ <span class="stat__value">128</span>
21
+ <span class="stat__label">total</span>
22
+ </div>
23
+ ```
24
+
25
+ ## With a sub-line
26
+ ```html
27
+ <div class="stat">
28
+ <span class="stat__value">128</span>
29
+ <span class="stat__label">total</span>
30
+ <span class="stat__sub">across 4 environments</span>
31
+ </div>
32
+ ```
33
+
34
+ ## Tones
35
+ `data-tone` shifts ink-level, not hue. `bad` draws the eye with a solid-ink border; `muted` is a
36
+ secondary/context count that recedes to faint; `ok` and the default read identically on purpose
37
+ (a healthy count needs no shouting).
38
+ ```html
39
+ <div class="stat" data-tone="ok"><span class="stat__value">14</span><span class="stat__label">passed</span></div>
40
+ <div class="stat" data-tone="bad"><span class="stat__value">2</span><span class="stat__label">failed</span></div>
41
+ <div class="stat" data-tone="muted"><span class="stat__value">3</span><span class="stat__label">skipped</span></div>
42
+ ```
43
+
44
+ ## In transit (AI writing the number)
45
+ ```html
46
+ <div class="stat" data-commit="pending">
47
+ <span class="stat__value" data-grade="grain">…</span>
48
+ <span class="stat__label">passed</span>
49
+ </div>
50
+ ```
@@ -0,0 +1,47 @@
1
+ /* molecules/status-list — a list where each row carries a leading status mark, a title, and
2
+ trailing meta (duration, target). A live pass/fail checklist, a job queue, a deploy pipeline, a
3
+ task run-down — b-list is prose-marker only, this is a three-slot structural row. One class per
4
+ element (BEM). Monochrome: the mark you place carries the signal (a glyph / b-badge / b-icon in
5
+ currentColor), never a hue baked in here (DESIGN-SYSTEM §2).
6
+
7
+ The load-bearing idea: an in-flight row wears data-commit="pending" (dashed leading edge +
8
+ blinking caret) and settles on result — the grain control lifecycle (lesson 2) mapped onto a
9
+ list item, no new "running" state invented. A not-yet-reached row reads faint via
10
+ data-state="waiting". Rows take data-surface so an AI can address one row at a time. */
11
+ .status-list { list-style: none; margin: 0; padding: 0; }
12
+ .status-list__item {
13
+ display: flex; align-items: baseline; gap: var(--space-3);
14
+ padding: var(--space-2) var(--space-2) var(--space-2) var(--space-3);
15
+ border-top: 1px solid var(--line-soft);
16
+ }
17
+ .status-list__item:first-child { border-top: 0; }
18
+ /* the leading mark slot: fixed width so titles align; author fills it with a glyph/badge/icon,
19
+ rendered in the row's ink (monochrome) */
20
+ .status-list__mark { flex: 0 0 1.5em; text-align: center; color: var(--ink); }
21
+ .status-list__title { flex: 1 1 auto; min-inline-size: 0; color: var(--ink); }
22
+ .status-list__meta { flex: 0 0 auto; font-size: var(--text-sm); color: var(--color-muted); }
23
+
24
+ /* ---- waiting: a row the runner hasn't reached yet recedes to faint (generic queue/pending
25
+ state — not a domain status) ---- */
26
+ .status-list__item[data-state="waiting"] .status-list__mark,
27
+ .status-list__item[data-state="waiting"] .status-list__title { color: var(--ink-faint); }
28
+
29
+ /* ---- AI / in-transit + "this row is being acted on": the grain control lifecycle (lesson 2),
30
+ same vocabulary as the button/field. An in-flight row (a runner is acting on it, or the AI is)
31
+ wears the dashed "terminal" leading edge; a blinking block caret trails the title. Keyed off
32
+ the row's own pending state OR any grain ancestor. ---- */
33
+ .status-list__item[data-commit="pending"],
34
+ [data-grade="grain"] .status-list__item {
35
+ border-left: 2px dashed var(--ink); padding-left: calc(var(--space-3) - 2px);
36
+ }
37
+ .status-list__item[data-commit="pending"] .status-list__title::after,
38
+ [data-grade="grain"] .status-list__item .status-list__title::after {
39
+ content: ""; display: inline-block;
40
+ width: 0.5ch; height: 1em; margin-left: 0.4ch; vertical-align: text-bottom;
41
+ background: currentColor;
42
+ animation: caret-blink 1s steps(1) infinite; /* keyframes in grain/styles/grain.css */
43
+ }
44
+ @media (prefers-reduced-motion: reduce) {
45
+ .status-list__item[data-commit="pending"] .status-list__title::after,
46
+ [data-grade="grain"] .status-list__item .status-list__title::after { animation: none; }
47
+ }
@@ -0,0 +1,62 @@
1
+ # Status list
2
+
3
+ A list where each row carries a leading status **mark**, a **title**, and trailing **meta** — a
4
+ live pass/fail checklist, a job queue, a deploy pipeline, a task run-down. `b-list` is a
5
+ prose-marker list; this is a three-slot structural row.
6
+
7
+ Composition note: an item is a `<li class="status-list__item">` inside a
8
+ `<ul class="status-list">`, with three children — `.status-list__mark` (a glyph, a `b-badge`, or
9
+ a `b-icon`), `.status-list__title`, and `.status-list__meta`. The **mark carries the signal**
10
+ (monochrome, currentColor) — the component bakes in no domain status colours.
11
+
12
+ The load-bearing idea: an **in-flight** row wears `data-commit="pending"` — a dashed leading edge
13
+ + a blinking caret trailing the title — and settles on result. That's the grain control lifecycle
14
+ (the row a runner/AI is acting on), not a bespoke "running" state. A **not-yet-reached** row reads
15
+ faint via `data-state="waiting"`. Rows take `data-surface="…"` so an AI can address one row at a
16
+ time (a plain attribute hook — it adds no surface kind to `ai/contract.ts`).
17
+
18
+ ## Settled rows
19
+ ```html
20
+ <ul class="status-list">
21
+ <li class="status-list__item" data-surface="row:login">
22
+ <span class="status-list__mark">✓</span>
23
+ <span class="status-list__title">login works</span>
24
+ <span class="status-list__meta">2.1s · staging</span>
25
+ </li>
26
+ <li class="status-list__item" data-surface="row:checkout">
27
+ <span class="status-list__mark">✕</span>
28
+ <span class="status-list__title">checkout completes</span>
29
+ <span class="status-list__meta">4.8s · staging</span>
30
+ </li>
31
+ </ul>
32
+ ```
33
+
34
+ ## Waiting + in-flight
35
+ The first row hasn't been reached (faint); the second is being run right now
36
+ (`data-commit="pending"` → dashed edge + caret).
37
+ ```html
38
+ <ul class="status-list">
39
+ <li class="status-list__item" data-state="waiting">
40
+ <span class="status-list__mark">○</span>
41
+ <span class="status-list__title">search returns results</span>
42
+ <span class="status-list__meta"></span>
43
+ </li>
44
+ <li class="status-list__item" data-commit="pending">
45
+ <span class="status-list__mark">◐</span>
46
+ <span class="status-list__title">profile loads</span>
47
+ <span class="status-list__meta">staging</span>
48
+ </li>
49
+ </ul>
50
+ ```
51
+
52
+ ## With a badge mark
53
+ The mark slot takes any small primitive — here a `b-badge` instead of a bare glyph.
54
+ ```html
55
+ <ul class="status-list">
56
+ <li class="status-list__item">
57
+ <span class="status-list__mark"><span class="badge" data-status="active">ok</span></span>
58
+ <span class="status-list__title">deploy · api</span>
59
+ <span class="status-list__meta">1m 12s</span>
60
+ </li>
61
+ </ul>
62
+ ```
@@ -0,0 +1,32 @@
1
+ /* molecules/tab — one open view in the tab-bar, editor-style (the workspace metaphor): a boxed
2
+ tab with an icon, a mono label, and a close affordance — the active tab carries a top accent
3
+ line and merges into its pane. Composed: icon (.tab__icon, optional) + label text + close
4
+ (.tab__close, optional). The close is PRESENTATIONAL by default (pointer-events off — a click
5
+ lands on the tab link); a consumer with genuinely closable views wires it as a real button. */
6
+ .tab {
7
+ display: flex; align-items: center; gap: var(--space-2);
8
+ height: 2.5rem; padding: 0 var(--space-2) 0 var(--space-3);
9
+ font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: 0.01em;
10
+ color: var(--color-muted); text-decoration: none; white-space: nowrap;
11
+ border-right: 1px solid var(--color-line);
12
+ }
13
+ .tab:hover { color: var(--color-fg); background: color-mix(in srgb, var(--color-bg) 55%, transparent); }
14
+ .tab__icon { display: inline-flex; color: var(--ink-faint); }
15
+ .tab[aria-current="page"], .tab[data-active="true"] {
16
+ color: var(--color-fg); background: var(--color-bg);
17
+ box-shadow: inset 0 2px 0 var(--color-accent, var(--ink)); /* the editor tab's top accent line */
18
+ }
19
+ .tab[aria-current="page"] .tab__icon, .tab[data-active="true"] .tab__icon { color: var(--color-accent, var(--ink)); }
20
+ .tab__close {
21
+ display: inline-flex; align-items: center; justify-content: center;
22
+ width: 1.15rem; height: 1.15rem; border-radius: var(--radius-sm);
23
+ color: transparent; pointer-events: none; /* hidden until the tab is hovered/active */
24
+ }
25
+ .tab:hover .tab__close, .tab[aria-current="page"] .tab__close, .tab[data-active="true"] .tab__close { color: var(--ink-faint); }
26
+ /* the PINNED marker: same box as .tab__close but ALWAYS visible and never interactive — it
27
+ reads "this tab doesn't close" (a pinned tab ships a .tab__pin instead of a .tab__close). */
28
+ .tab__pin {
29
+ display: inline-flex; align-items: center; justify-content: center;
30
+ width: 1.15rem; height: 1.15rem; border-radius: var(--radius-sm);
31
+ color: var(--ink-faint); pointer-events: none;
32
+ }
@@ -0,0 +1,27 @@
1
+ # Tab
2
+
3
+ One open view in the tab-bar, editor-style: a boxed tab with an optional icon
4
+ (`.tab__icon`), a mono label, and an optional close affordance (`.tab__close`). The active
5
+ tab carries a top accent line and merges into its pane. The close is presentational by
6
+ default (pointer-events off; a click lands on the tab's link) — wire it as a real button
7
+ only when views are genuinely closable.
8
+
9
+ ## States
10
+
11
+ ### Active
12
+ ```html
13
+ <a class="tab" aria-current="page"><span class="tab__icon"><b-icon sym="/assets/sprite.svg#tasks" size="sm"></b-icon></span>Overview<span class="tab__close" aria-hidden="true"><b-icon sym="/assets/sprite.svg#close" size="sm"></b-icon></span></a>
14
+ ```
15
+
16
+ ### Default + closable
17
+ ```html
18
+ <a class="tab"><span class="tab__icon"><b-icon sym="/assets/sprite.svg#loop" size="sm"></b-icon></span>Tasks<span class="tab__close" aria-hidden="true"><b-icon sym="/assets/sprite.svg#close" size="sm"></b-icon></span></a>
19
+ <a class="tab">Library · notes</a>
20
+ ```
21
+
22
+ ### Pinned (never closes)
23
+ A pinned tab ships a `.tab__pin` in place of the `.tab__close`: same box, always visible,
24
+ `pointer-events: none` — the icon reads "this view stays open" (e.g. a home/Welcome tab).
25
+ ```html
26
+ <a class="tab" data-pinned aria-current="page"><span class="tab__icon"><b-icon sym="/assets/sprite.svg#spark" size="sm"></b-icon></span>Welcome<span class="tab__pin" aria-hidden="true"><b-icon sym="/assets/sprite.svg#pin" size="sm"></b-icon></span></a>
27
+ ```
@@ -0,0 +1,23 @@
1
+ /* molecules/table — a content data table (MILL maps Markdown pipe tables to it), wrapped
2
+ in .table-scroll so wide tables scroll inside their own box instead of breaking the page.
3
+ Monochrome and ruled, not zebra-striped (DESIGN-SYSTEM §2). CSS-only: composed by MILL
4
+ or written by hand; nothing data-binds it. */
5
+ .table-scroll { overflow-x: auto; margin: 0 0 var(--space-4); }
6
+ .table { border-collapse: collapse; width: 100%; font-size: var(--text-sm); }
7
+ .table th {
8
+ text-align: left;
9
+ font-weight: var(--font-weight-semibold);
10
+ border-bottom: 2px solid var(--ink);
11
+ padding: var(--space-2) var(--space-3);
12
+ }
13
+ .table td {
14
+ border-bottom: 1px solid var(--color-line);
15
+ padding: var(--space-2) var(--space-3);
16
+ vertical-align: top;
17
+ line-height: var(--leading-normal);
18
+ }
19
+ .table th:first-child, .table td:first-child { padding-left: 0; }
20
+
21
+ /* AI / in-transit: dashed terminal edge (non-text grain idiom, same as the atoms) */
22
+ .table[data-commit="pending"],
23
+ [data-grade="grain"] .table { border: 1px dashed var(--ink); }
@@ -0,0 +1,18 @@
1
+ # Table
2
+
3
+ A content data table — MILL maps Markdown pipe tables (`| a | b |` + `|---|---|`) to it.
4
+ Ruled and monochrome, not zebra-striped; the `.table-scroll` wrapper keeps wide tables
5
+ scrolling inside their own box. CSS-only: composed by MILL or written by hand.
6
+
7
+ ## Table
8
+ ```html
9
+ <div class="table-scroll">
10
+ <table class="table">
11
+ <thead><tr><th>You change…</th><th>…also update</th></tr></thead>
12
+ <tbody>
13
+ <tr><td>An action verb</td><td>contract.ts → reasoner → tests → docs</td></tr>
14
+ <tr><td>A design token</td><td>grain/styles/variables.css only</td></tr>
15
+ </tbody>
16
+ </table>
17
+ </div>
18
+ ```