@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,271 @@
1
+ // grain/scripts/terminal.js — the docked console becomes an INTERACTIVE TERMINAL.
2
+ //
3
+ // The console (organisms/console) is the AI's narration feed. This island adds a command line to
4
+ // it, making the terminal a THIRD client of the one door — a human types a command, and anything
5
+ // AI-shaped (`ask`, `tour`, `stop`) is raised as a real Intent through window.grain.door.submit,
6
+ // the SAME door a click or the AI uses. Reads (help, go, ls, context, …) run locally. No parallel
7
+ // wire, no privileged path — the terminal earns the same lifecycle + ready-gate as everything else.
8
+ //
9
+ // OPT-IN: a consumer stamps `data-terminal="interactive"` on its `.console__box`; this island
10
+ // finds those boxes and INJECTS the input row itself (like cmdk injects its dialog), so adoption is
11
+ // one attribute + one <script type="module"> tag — no markup to compose. A console without the
12
+ // attribute (e.g. the product's /loop narration feed) stays display-only, untouched.
13
+ //
14
+ // EXTENSIBLE: window.grain.terminal.register({ name, args, help, run(ctx) }) adds a command. GRAIN
15
+ // ships the generic builtins below; a consumer registers its own (persona commands, page tours) in
16
+ // its own script — grain stays persona-neutral. Verb literals here are the drift-guarded exception
17
+ // (CONVENTIONS §3); terminal.test.ts checks each against the real ACTIONS registry.
18
+ (() => {
19
+ "use strict";
20
+ if (window.grain && window.grain.terminal) return; // idempotent
21
+
22
+ const PROMPT = "❯"; // ❯
23
+ const HISTORY_KEY = "grain.terminal.history";
24
+ const HISTORY_CAP = 50;
25
+ const esc = (s) => String(s).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
26
+
27
+ // ── command registry ──────────────────────────────────────────────────────────────────────────
28
+ const registry = new Map();
29
+ function register(cmd) {
30
+ if (!cmd || !cmd.name || typeof cmd.run !== "function") return;
31
+ registry.set(cmd.name, { args: "", help: "", ...cmd });
32
+ }
33
+
34
+ // ── the ⌘K corpus (pages + components), fetched once — shared shape with cmdk.js ────────────────
35
+ let corpusData = null;
36
+ async function loadCorpus() {
37
+ if (corpusData) return corpusData;
38
+ try { corpusData = await (await fetch("/search.json")).json(); }
39
+ catch { corpusData = { pages: [], components: [] }; }
40
+ return corpusData;
41
+ }
42
+ const corpusPages = () => (corpusData && corpusData.pages) || [];
43
+
44
+ // ── output: append lines to a console feed ──────────────────────────────────────────────────────
45
+ function scrollFeed(feed) {
46
+ const oy = getComputedStyle(feed).overflowY;
47
+ if (oy === "auto" || oy === "scroll") feed.scrollTo({ top: feed.scrollHeight });
48
+ }
49
+ function appendLine(feed, html, { grade, variant, state } = {}) {
50
+ if (!feed) return;
51
+ const div = document.createElement("div");
52
+ div.className = "console__line";
53
+ if (variant) div.dataset.variant = variant;
54
+ if (grade) div.dataset.grade = grade; // "smooth" = human/clean; default feed = grain
55
+ if (state) div.dataset.state = state; // "error" → the door's rejection idiom
56
+ div.innerHTML = html;
57
+ feed.appendChild(div);
58
+ scrollFeed(feed);
59
+ return div;
60
+ }
61
+ // a controller's output surface (bound per feed)
62
+ function makeIO(feed) {
63
+ return {
64
+ print: (text) => appendLine(feed, `<span class="console__desc">${esc(text)}</span>`),
65
+ printHtml: (html) => appendLine(feed, `<span class="console__desc">${html}</span>`),
66
+ printPre: (text) => appendLine(feed, `<pre class="console__pre">${esc(text)}</pre>`),
67
+ printErr: (text) => appendLine(feed, `<span class="console__desc">${esc(text)}</span>`, { state: "error" }),
68
+ echo: (raw) => appendLine(feed,
69
+ `<span class="console__prompt" aria-hidden="true">${PROMPT}</span><span class="console__desc">${esc(raw)}</span>`,
70
+ { variant: "cmd", grade: "smooth" }), // the human's typed line settles CLEAN
71
+ clear: () => { if (feed) feed.innerHTML = ""; },
72
+ feed,
73
+ };
74
+ }
75
+
76
+ // ── run a command line ──────────────────────────────────────────────────────────────────────────
77
+ async function run(raw, io) {
78
+ const line = String(raw).trim();
79
+ io.echo(line || "");
80
+ if (!line) return;
81
+ const argv = line.split(/\s+/);
82
+ const name = argv.shift();
83
+ const cmd = registry.get(name);
84
+ if (!cmd) {
85
+ io.printErr(`command not found: ${name}. Type ‘help’ to see what the AI understands.`);
86
+ return;
87
+ }
88
+ const ctx = {
89
+ argv, raw: line, arg: argv.join(" "),
90
+ print: io.print, printHtml: io.printHtml, printPre: io.printPre, printErr: io.printErr, clear: io.clear,
91
+ door: window.grain && window.grain.door,
92
+ corpus: loadCorpus, corpusPages,
93
+ commands: () => [...registry.values()],
94
+ };
95
+ try { await cmd.run(ctx); }
96
+ catch (err) { io.printErr(`‘${name}’ failed: ${(err && err.message) || err}`); }
97
+ }
98
+
99
+ // ── the input row (injected) + its controller ────────────────────────────────────────────────────
100
+ function shellOf(box) { return box.closest(".app-shell"); }
101
+ function feedOf(box) {
102
+ const region = box.closest(".app-shell__console") || box;
103
+ return region.querySelector('[data-surface="console"]');
104
+ }
105
+ function loadHistory() { try { return JSON.parse(localStorage.getItem(HISTORY_KEY) || "[]"); } catch { return []; } }
106
+ function saveHistory(h) { try { localStorage.setItem(HISTORY_KEY, JSON.stringify(h.slice(-HISTORY_CAP))); } catch { /* private mode */ } }
107
+
108
+ function mount(box) {
109
+ if (box.__grainTerminal) return;
110
+ box.__grainTerminal = true;
111
+ const feed = feedOf(box);
112
+ const io = makeIO(feed);
113
+
114
+ const row = document.createElement("div");
115
+ row.className = "console__input";
116
+ row.innerHTML =
117
+ `<span class="console__prompt" aria-hidden="true">${PROMPT}</span>` +
118
+ `<input class="console__cmd" type="text" autocomplete="off" autocapitalize="off" autocorrect="off" ` +
119
+ `spellcheck="false" aria-label="Terminal command" placeholder="type a command — try ‘help’">`;
120
+ box.appendChild(row);
121
+ const input = row.querySelector(".console__cmd");
122
+
123
+ let history = loadHistory();
124
+ let hIdx = history.length; // points one past the end (the live line)
125
+ let draft = "";
126
+
127
+ input.addEventListener("keydown", async (ev) => {
128
+ if (ev.key === "Enter") {
129
+ ev.preventDefault();
130
+ const raw = input.value;
131
+ input.value = "";
132
+ if (raw.trim()) { history = [...history.filter((h) => h !== raw.trim()), raw.trim()]; saveHistory(history); }
133
+ hIdx = history.length; draft = "";
134
+ await run(raw, io);
135
+ } else if (ev.key === "ArrowUp") {
136
+ ev.preventDefault();
137
+ if (hIdx === history.length) draft = input.value;
138
+ if (hIdx > 0) { hIdx--; input.value = history[hIdx] || ""; moveCaretEnd(input); }
139
+ } else if (ev.key === "ArrowDown") {
140
+ ev.preventDefault();
141
+ if (hIdx < history.length) { hIdx++; input.value = hIdx === history.length ? draft : (history[hIdx] || ""); moveCaretEnd(input); }
142
+ } else if (ev.key === "Tab") {
143
+ ev.preventDefault();
144
+ await complete(input);
145
+ }
146
+ // Escape is NOT swallowed — it must reach the dispatcher's interrupt while the AI acts.
147
+ });
148
+ }
149
+
150
+ function moveCaretEnd(input) { const n = input.value.length; requestAnimationFrame(() => input.setSelectionRange(n, n)); }
151
+
152
+ // tab-complete: first token → command names; `go`/`ls`/`grep` arg → page slugs from the corpus
153
+ async function complete(input) {
154
+ const value = input.value;
155
+ const parts = value.split(/\s+/);
156
+ if (parts.length <= 1) {
157
+ const hit = uniquePrefix([...registry.keys()], parts[0] || "");
158
+ if (hit) input.value = hit + " ";
159
+ return;
160
+ }
161
+ const cmd = parts[0];
162
+ if (cmd === "go" || cmd === "grep" || cmd === "ls") {
163
+ await loadCorpus();
164
+ const slugs = corpusPages().map((p) => (p.url === "/" ? "/" : p.url.replace(/^\//, "")));
165
+ const hit = uniquePrefix(slugs, parts.slice(1).join(" "));
166
+ if (hit) input.value = cmd + " " + hit;
167
+ }
168
+ moveCaretEnd(input);
169
+ }
170
+ // the longest common completion of the candidates that start with `prefix` (bash-style)
171
+ function uniquePrefix(candidates, prefix) {
172
+ const matches = candidates.filter((c) => c.startsWith(prefix));
173
+ if (!matches.length) return null;
174
+ if (matches.length === 1) return matches[0];
175
+ let common = matches[0];
176
+ for (const m of matches) { while (!m.startsWith(common)) common = common.slice(0, -1); }
177
+ return common.length > prefix.length ? common : matches[0];
178
+ }
179
+
180
+ // ── GRAIN builtin commands (generic — any product on GRAIN would want these) ─────────────────────
181
+ function pageMatch(slugOrTitle) {
182
+ const q = slugOrTitle.toLowerCase();
183
+ const pages = corpusPages();
184
+ return pages.find((p) => p.url === "/" + q || p.url === q || (p.title || "").toLowerCase() === q)
185
+ || pages.find((p) => p.url.toLowerCase().includes(q) || (p.title || "").toLowerCase().includes(q));
186
+ }
187
+ register({ name: "help", args: "", help: "list what the AI understands", run(ctx) {
188
+ for (const c of ctx.commands()) ctx.printHtml(`<b>${esc(c.name)}</b>${c.args ? " " + esc(c.args) : ""} — ${esc(c.help)}`);
189
+ }});
190
+ register({ name: "clear", args: "", help: "clear the terminal", run(ctx) { ctx.clear(); }});
191
+ register({ name: "ls", args: "", help: "list the pages on this site", async run(ctx) {
192
+ await ctx.corpus();
193
+ for (const p of ctx.corpusPages()) ctx.printHtml(`<a href="${esc(p.url)}">${esc(p.url)}</a> — ${esc(p.title || "")}`);
194
+ }});
195
+ register({ name: "go", args: "<page>", help: "navigate to a page", async run(ctx) {
196
+ if (!ctx.arg) return ctx.printErr("go where? try ‘ls’ to list pages.");
197
+ await ctx.corpus();
198
+ const p = pageMatch(ctx.arg);
199
+ if (!p) return ctx.printErr(`no page matches ‘${ctx.arg}’.`);
200
+ ctx.print(`→ ${p.url}`); location.assign(p.url);
201
+ }});
202
+ register({ name: "grep", args: "<term>", help: "search pages and components", async run(ctx) {
203
+ if (!ctx.arg) return ctx.printErr("grep for what?");
204
+ await ctx.corpus();
205
+ const q = ctx.arg.toLowerCase();
206
+ const hits = [...ctx.corpusPages(), ...((corpusData && corpusData.components) || [])]
207
+ .filter((e) => `${e.title || ""} ${e.url || ""} ${e.subtitle || ""}`.toLowerCase().includes(q));
208
+ if (!hits.length) return ctx.print(`no matches for ‘${ctx.arg}’.`);
209
+ for (const h of hits.slice(0, 20)) ctx.printHtml(`<a href="${esc(h.url)}">${esc(h.title || h.url)}</a>`);
210
+ }});
211
+ register({ name: "theme", args: "<flavor>", help: "switch the theme flavor", run(ctx) {
212
+ const t = window.grain && window.grain.theme;
213
+ if (!t) return ctx.printErr("theming isn't loaded on this page.");
214
+ if (!ctx.arg) return ctx.print(`themes: ${(t.themes && t.themes().join(", ")) || "?"} — current: ${t.theme && t.theme()}`);
215
+ try { t.setTheme(ctx.arg); ctx.print(`theme → ${ctx.arg}`); }
216
+ catch { ctx.printErr(`unknown flavor ‘${ctx.arg}’.`); }
217
+ }});
218
+ register({ name: "ask", args: "<question>", help: "ask the AI (it answers in the chat)", run(ctx) {
219
+ if (!ctx.arg) return ctx.printErr("ask what?");
220
+ if (!ctx.door) return ctx.printErr("the door isn't loaded on this page.");
221
+ if (!document.querySelector('[data-surface="chat-log"]')) return ctx.printErr("no chat on this page to answer in.");
222
+ if (!ctx.door.online()) return ctx.printErr("the AI is offline — can't ask right now.");
223
+ ctx.door.submit("chat.send", "chat-log", { text: ctx.arg });
224
+ ctx.print("→ answering in the chat.");
225
+ }});
226
+ register({ name: "stop", args: "", help: "ask the AI to stop (mediated)", run(ctx) {
227
+ if (!ctx.door) return ctx.printErr("the door isn't loaded on this page.");
228
+ if (document.querySelector(".app-shell[data-acting=\"true\"]")) { ctx.door.submit("desk.stop", "screen", {}); ctx.print("asked the AI to stop."); }
229
+ else ctx.print("nothing is running.");
230
+ }});
231
+ register({ name: "context", args: "", help: "print this page as the AI sees it (the manifest)", async run(ctx) {
232
+ const base = new URL("..", import.meta.url).pathname.replace(/\/$/, "");
233
+ const { domManifest } = await import(base + "/modules/grain/ai/manifest-dom.js");
234
+ ctx.printPre(JSON.stringify(domManifest(document), null, 2));
235
+ }});
236
+ register({ name: "xray", args: "", help: "outline every operable surface (dev mode)", async run(ctx) {
237
+ if (window.grain && window.grain.xray) return void window.grain.xray.toggle();
238
+ // xray.js not loaded — load it, then toggle
239
+ try { const base = new URL("..", import.meta.url).pathname.replace(/\/$/, ""); await import(base + "/scripts/xray.js"); window.grain.xray.toggle(); }
240
+ catch { ctx.printErr("x-ray isn't available on this page (load /scripts/xray.js)."); }
241
+ }});
242
+ register({ name: "exit", args: "", help: "close the terminal", run() {
243
+ const shell = document.querySelector(".app-shell");
244
+ if (shell) shell.removeAttribute("data-console-open");
245
+ }});
246
+
247
+ // ── keybinding: Ctrl+` opens the terminal and focuses the command line ───────────────────────────
248
+ document.addEventListener("keydown", (ev) => {
249
+ if (ev.ctrlKey && (ev.key === "`" || ev.code === "Backquote")) {
250
+ const box = document.querySelector('.console__box[data-terminal="interactive"]');
251
+ if (!box) return;
252
+ ev.preventDefault();
253
+ const shell = shellOf(box);
254
+ if (shell) { shell.removeAttribute("data-console-hidden"); shell.setAttribute("data-console-open", ""); }
255
+ box.querySelector(".console__cmd")?.focus();
256
+ }
257
+ });
258
+
259
+ // ── boot: mount every interactive console box; expose the seam ───────────────────────────────────
260
+ function mountAll() { for (const box of document.querySelectorAll('.console__box[data-terminal="interactive"]')) mount(box); }
261
+ if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", mountAll);
262
+ else mountAll();
263
+
264
+ window.grain = window.grain || {};
265
+ window.grain.terminal = {
266
+ register,
267
+ /** Programmatic run (for tests / a consumer): runs `raw` against the first interactive feed. */
268
+ run: (raw) => { const box = document.querySelector('.console__box[data-terminal="interactive"]'); return run(raw, makeIO(box ? feedOf(box) : null)); },
269
+ commands: () => [...registry.keys()],
270
+ };
271
+ })();
@@ -0,0 +1,36 @@
1
+ // grain/scripts/terminal.test.ts — DRIFT GUARD for the interactive terminal island. The island is
2
+ // a browser module (behavior lives in the e2e); here we guard the CONTRACT it depends on: every
3
+ // verb it submits through the door must be a REAL action in the registry (CONVENTIONS §3 — the one
4
+ // exception for browser literals, validated here), and it must expose the documented seam.
5
+ import { test, expect } from "bun:test";
6
+ import { readFileSync } from "node:fs";
7
+ import { join } from "node:path";
8
+ import { ACTIONS } from "../ai/contract.ts";
9
+
10
+ const js = readFileSync(join(import.meta.dir, "terminal.js"), "utf8");
11
+
12
+ test("every door.submit(...) verb literal is a real action in the registry", () => {
13
+ const verbs = [...js.matchAll(/door\.submit\(\s*"([^"]+)"/g)].map((m) => m[1]);
14
+ expect(verbs.length).toBeGreaterThan(0);
15
+ const strays = verbs.filter((v) => !Object.hasOwn(ACTIONS, v));
16
+ expect(strays).toEqual([]);
17
+ });
18
+
19
+ test("registers the generic builtins", () => {
20
+ const names = [...js.matchAll(/register\(\{\s*name:\s*"([^"]+)"/g)].map((m) => m[1]);
21
+ for (const expected of ["help", "clear", "ls", "go", "grep", "theme", "ask", "stop", "context", "xray", "exit"])
22
+ expect(names).toContain(expected);
23
+ });
24
+
25
+ test("exposes window.grain.terminal.register (the extensibility seam)", () => {
26
+ expect(js).toMatch(/window\.grain\.terminal\s*=\s*\{[\s\S]*\bregister\b/);
27
+ });
28
+
29
+ test("only mounts opt-in consoles (data-terminal=\"interactive\")", () => {
30
+ expect(js).toMatch(/\.console__box\[data-terminal="interactive"\]/);
31
+ });
32
+
33
+ test("the human echo settles clean (grade=smooth), machine output stays grain (feed default)", () => {
34
+ // the echo helper must carry grade:"smooth"; no builtin output line forces a grade
35
+ expect(js).toMatch(/echo:[\s\S]*grade:\s*"smooth"/);
36
+ });
@@ -0,0 +1,15 @@
1
+ // grain/scripts/theme-boot.js — the theming FOUC guard (GRAIN). Loaded render-BLOCKING in
2
+ // <head> (no defer, before the stylesheets apply) so the saved color-scheme/flavor attributes
3
+ // are on <html> before first paint — without it, every navigation flashes the default theme
4
+ // until the deferred theme.js runs. READ-ONLY: it mirrors the storage keys + attribute names
5
+ // whose single source is theme.js (the writer); keep the two files in sync.
6
+ (() => {
7
+ "use strict";
8
+ try {
9
+ var html = document.documentElement;
10
+ var s = localStorage.getItem("grain-color-scheme");
11
+ if (s) html.setAttribute("data-color-scheme", s);
12
+ var t = localStorage.getItem("grain-theme");
13
+ if (t) html.setAttribute("data-theme", t);
14
+ } catch (e) { /* no storage (privacy mode) → defaults render, theme.js stays the fallback */ }
15
+ })();
@@ -0,0 +1,87 @@
1
+ // grain/scripts/theme.js — the theming controls (GRAIN). Sets the two ORTHOGONAL token axes on
2
+ // <html>: data-color-scheme (light | dark, or unset = follow the OS) and data-theme (the flavor;
3
+ // unset = the default). Both are pure TOKEN re-skins (grain/styles/variables.css) — a client-side
4
+ // VIEW PREFERENCE: static-safe, no deps, NOT the AI door. Persists to localStorage.
5
+ //
6
+ // The theming VOCABULARY (attribute + value + control names + storage keys) is defined ONCE in the
7
+ // constant block below — no raw strings scattered through the logic (CONVENTIONS §3: browser-JS
8
+ // literals kept to a single source). Those attribute names are mirrored in CSS selectors
9
+ // (variables.css) and in the control markup; keep the three in sync.
10
+ // NOTE (FOUC): saved prefs apply when this deferred module runs; theme-boot.js (loaded
11
+ // render-BLOCKING in <head> by the composition root) pre-sets the attributes before first
12
+ // paint so navigation never flashes the default. It mirrors the KEY/ATTR strings below —
13
+ // change them here, change them there.
14
+ (() => {
15
+ "use strict";
16
+ if (window.grain && window.grain.theme) return; // idempotent: safe if loaded per-page AND globally
17
+
18
+ // ---- theming vocabulary (single source of these strings) ---------------------------------
19
+ const ATTR = { scheme: "data-color-scheme", theme: "data-theme", list: "data-themes" };
20
+ const SCHEME = { light: "light", dark: "dark", auto: "auto" };
21
+ const CTRL = { toggleScheme: "data-toggle-scheme", cycleTheme: "data-cycle-theme",
22
+ setScheme: "data-set-scheme", setTheme: "data-set-theme" };
23
+ const LABEL = "data-theme-name"; // any element carrying it shows the current flavor name
24
+ const KEY = { scheme: "grain-color-scheme", theme: "grain-theme" };
25
+ const MQ_DARK = "(prefers-color-scheme: dark)";
26
+
27
+ const html = document.documentElement;
28
+ const store = (() => { try { return window.localStorage; } catch { return null; } })();
29
+ const get = (k) => { try { return store && store.getItem(k); } catch { return null; } };
30
+ const put = (k, v) => { try { if (store) v == null ? store.removeItem(k) : store.setItem(k, v); } catch {} };
31
+
32
+ // ---- color scheme (light | dark | auto; auto drops the attr → follow the OS) --------------
33
+ function setScheme(s) {
34
+ if (!s || s === SCHEME.auto) { html.removeAttribute(ATTR.scheme); put(KEY.scheme, null); }
35
+ else { html.setAttribute(ATTR.scheme, s); put(KEY.scheme, s); }
36
+ }
37
+ const scheme = () => html.getAttribute(ATTR.scheme) || SCHEME.auto;
38
+ function toggleScheme() {
39
+ const eff = scheme() === SCHEME.auto
40
+ ? (matchMedia(MQ_DARK).matches ? SCHEME.dark : SCHEME.light)
41
+ : scheme();
42
+ setScheme(eff === SCHEME.dark ? SCHEME.light : SCHEME.dark);
43
+ }
44
+
45
+ // ---- flavor (data-theme). The ordered list is CONSUMER-DECLARED on <html data-themes="…"> —
46
+ // GRAIN hardcodes no theme names. list[0] is the DEFAULT (rendered by the bare :root, so
47
+ // selecting it just drops the attribute). Add/rename/reorder purely in the markup + CSS. -------
48
+ const themes = () => (html.getAttribute(ATTR.list) || "").split(/\s+/).filter(Boolean);
49
+ const defaultTheme = () => themes()[0] || "";
50
+ function setTheme(t) {
51
+ if (!t || t === defaultTheme()) { html.removeAttribute(ATTR.theme); put(KEY.theme, null); }
52
+ else { html.setAttribute(ATTR.theme, t); put(KEY.theme, t); }
53
+ syncLabels();
54
+ }
55
+ const theme = () => html.getAttribute(ATTR.theme) || defaultTheme();
56
+ function cycleTheme() {
57
+ const list = themes(); if (list.length < 2) return;
58
+ setTheme(list[(list.indexOf(theme()) + 1) % list.length]);
59
+ }
60
+
61
+ // flavor-name labels (e.g. the status bar's "◆ sourdough"): kept in sync on every change
62
+ const syncLabels = () => {
63
+ for (const el of document.querySelectorAll(`[${LABEL}]`)) el.textContent = theme();
64
+ };
65
+
66
+ // ---- apply saved prefs (no saved scheme → stay auto, so the OS wins, no forced-override flash) --
67
+ const savedScheme = get(KEY.scheme); if (savedScheme) html.setAttribute(ATTR.scheme, savedScheme);
68
+ const savedTheme = get(KEY.theme); if (savedTheme) html.setAttribute(ATTR.theme, savedTheme);
69
+ syncLabels(); // deferred script: the DOM is parsed by now
70
+
71
+ // ---- declarative controls (any element drives theming; no per-page handlers) ---------------
72
+ const HANDLERS = {
73
+ [CTRL.toggleScheme]: () => toggleScheme(),
74
+ [CTRL.cycleTheme]: () => cycleTheme(),
75
+ [CTRL.setScheme]: (el) => setScheme(el.getAttribute(CTRL.setScheme)),
76
+ [CTRL.setTheme]: (el) => setTheme(el.getAttribute(CTRL.setTheme)),
77
+ };
78
+ const SELECTOR = Object.keys(HANDLERS).map((a) => `[${a}]`).join(",");
79
+ document.addEventListener("click", (e) => {
80
+ const el = e.target.closest(SELECTOR);
81
+ if (!el) return;
82
+ for (const attr of Object.keys(HANDLERS)) if (el.hasAttribute(attr)) { HANDLERS[attr](el); break; }
83
+ });
84
+
85
+ window.grain = window.grain || {};
86
+ window.grain.theme = { setScheme, setTheme, toggleScheme, cycleTheme, scheme, theme, themes };
87
+ })();
@@ -0,0 +1,25 @@
1
+ // grain/scripts/type-effect.js — the shared typing/streaming effect for GRAIN's demo islands.
2
+ // One home for the char-by-char animation + the reduced-motion rule, so every demo types the same
3
+ // way (and there's a single place to tune the speed). Native ES module, no build.
4
+ export const reducedMotion = () => matchMedia("(prefers-reduced-motion: reduce)").matches;
5
+
6
+ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
7
+
8
+ // Type `text` into an element's textContent, char by char; instant under reduced motion.
9
+ // Optional `caret` element is shown while typing, hidden when done.
10
+ export async function typeText(el, text, { speed = 32, caret = null } = {}) {
11
+ if (!el) return;
12
+ el.textContent = "";
13
+ if (caret) caret.hidden = false;
14
+ if (reducedMotion()) { el.textContent = text; if (caret) caret.hidden = true; return; }
15
+ for (const ch of text) { el.textContent += ch; await sleep(speed); }
16
+ if (caret) caret.hidden = true;
17
+ }
18
+
19
+ // Type into an input's value (a form field the AI is filling); instant under reduced motion.
20
+ export async function typeInput(el, text, { speed = 45 } = {}) {
21
+ if (!el) return;
22
+ el.value = "";
23
+ if (reducedMotion()) { el.value = text; return; }
24
+ for (const ch of text) { el.value += ch; await sleep(speed); }
25
+ }
@@ -0,0 +1,79 @@
1
+ // grain/scripts/xray.js — X-RAY: see the page the way the AI sees it (a GRAIN dev-mode island).
2
+ //
3
+ // Outlines every operable surface ([data-surface]) and labels it with its kind + the verbs the
4
+ // registry allows on it — the manifest, drawn onto the page. It's the visual twin of the
5
+ // terminal's `context` command; both read grain/ai/manifest-dom.ts (the live-DOM projection).
6
+ //
7
+ // STANDALONE — no terminal required. Four ways in, all independent:
8
+ // 1. window.grain.xray.{on,off,toggle}() — from devtools on any GRAIN page
9
+ // 2. ?xray in the URL — a shareable "see it as the AI does" link
10
+ // 3. click any [data-xray-toggle] control — e.g. a status-bar affordance
11
+ // 4. Ctrl+Shift+X — keyboard chord
12
+ // The terminal's `xray` command is just a fifth caller of window.grain.xray (no dependency either
13
+ // way). One <script type="module"> tag drops it onto any page; a <link> to ai.css carries the CSS.
14
+ //
15
+ // CLIENT-SAFE: the only import is the pure manifest-dom projection, lazy-loaded via /modules
16
+ // (transpiled on request) using the same base resolution the dispatcher uses, so it works under a
17
+ // subpath (GitHub Pages) and on a static export.
18
+ //
19
+ // PERSISTENCE: x-ray survives MPA navigation (localStorage key `grain.xray.on`). While enabled the
20
+ // lazy manifest-dom.js import loads on EVERY page — acceptable: this is a dev island, only on when
21
+ // you asked for it. A shared `?xray` link wins on boot AND persists, so the toggle sticks after you
22
+ // land. (House per-island pattern — dotted key + try/catch for private mode; matches tabs.js.)
23
+ (() => {
24
+ "use strict";
25
+ if (window.grain && window.grain.xray) return; // idempotent: safe if loaded per-page AND globally
26
+
27
+ const HTML = document.documentElement;
28
+ const assetBase = new URL("..", import.meta.url).pathname.replace(/\/$/, "");
29
+ const KEY = "grain.xray.on";
30
+ const persist = (v) => { try { localStorage.setItem(KEY, v ? "1" : "0"); } catch { /* private mode */ } };
31
+ let mod = null;
32
+
33
+ async function projection() {
34
+ if (!mod) mod = await import(assetBase + "/modules/grain/ai/manifest-dom.js");
35
+ return mod;
36
+ }
37
+
38
+ // Stamp each [data-surface] with its label; the CSS (ai.css) draws the outline + label from it.
39
+ async function stampLabels() {
40
+ const { harvestTargets, targetLabel } = await projection();
41
+ // harvestTargets reads the DOM structurally (getAttribute / querySelectorAll) — the browser's
42
+ // real Element satisfies that interface, so document is a valid DomRoot with no adapter.
43
+ const byId = new Map(harvestTargets(document).map((t) => [t.id, t]));
44
+ for (const el of document.querySelectorAll("[data-surface]")) {
45
+ const t = byId.get(el.getAttribute("data-surface"));
46
+ if (t) el.setAttribute("data-xray-label", targetLabel(t));
47
+ }
48
+ }
49
+ function clearLabels() {
50
+ for (const el of document.querySelectorAll("[data-xray-label]")) el.removeAttribute("data-xray-label");
51
+ }
52
+
53
+ const isOn = () => HTML.hasAttribute("data-xray");
54
+ async function on() { if (isOn()) return; HTML.setAttribute("data-xray", ""); persist(true); await stampLabels(); }
55
+ function off() { if (!isOn()) return; HTML.removeAttribute("data-xray"); persist(false); clearLabels(); }
56
+ function toggle() { return isOn() ? off() : on(); }
57
+
58
+ // ── entry points ────────────────────────────────────────────────────────────────────────────
59
+ // devtools API
60
+ window.grain = window.grain || {};
61
+ window.grain.xray = { on, off, toggle, isOn };
62
+
63
+ // a [data-xray-toggle] control anywhere (status bar, footer…)
64
+ document.addEventListener("click", (e) => {
65
+ if (e.target.closest && e.target.closest("[data-xray-toggle]")) { e.preventDefault(); toggle(); }
66
+ });
67
+
68
+ // Ctrl+Shift+X — a chord that doesn't collide with the browser's ⌘/Ctrl+X (cut)
69
+ document.addEventListener("keydown", (e) => {
70
+ if (e.ctrlKey && e.shiftKey && (e.key === "X" || e.key === "x")) { e.preventDefault(); toggle(); }
71
+ });
72
+
73
+ // boot: ?xray in the URL wins (a self-demoing, shareable link — and on() persists it so it
74
+ // sticks after you navigate); otherwise restore the stored preference (survives MPA nav).
75
+ try {
76
+ if (new URLSearchParams(location.search).has("xray")) on();
77
+ else if (localStorage.getItem(KEY) === "1") on();
78
+ } catch { /* no-op */ }
79
+ })();
@@ -0,0 +1,43 @@
1
+ // grain/scripts/xray.test.ts — DRIFT GUARD for the x-ray island. The island is a browser module
2
+ // (no DOM in bun), so its behavior lives in the e2e; here we guard the CONTRACT it depends on:
3
+ // the module path it lazy-imports must resolve to a real file, and it must expose the documented
4
+ // window.grain.xray API + entry points so the docs and the terminal caller can't drift from it.
5
+ import { test, expect } from "bun:test";
6
+ import { existsSync } from "node:fs";
7
+ import { readFileSync } from "node:fs";
8
+ import { join } from "node:path";
9
+
10
+ const js = readFileSync(join(import.meta.dir, "xray.js"), "utf8");
11
+
12
+ test("lazy-imports a module path that maps to a real /modules file", () => {
13
+ const m = js.match(/"\/modules\/([^"]+)"/);
14
+ expect(m).not.toBeNull();
15
+ // "/modules/grain/ai/manifest-dom.js" → grain/ai/manifest-dom.ts on disk
16
+ const rel = m![1].replace(/^grain\//, "").replace(/\.js$/, ".ts");
17
+ expect(existsSync(join(import.meta.dir, "..", rel))).toBe(true);
18
+ });
19
+
20
+ test("exposes the documented window.grain.xray API", () => {
21
+ expect(js).toMatch(/window\.grain\.xray\s*=\s*\{[^}]*\bon\b[^}]*\boff\b[^}]*\btoggle\b/s);
22
+ });
23
+
24
+ test("wires all four entry points (API, ?xray, data-xray-toggle, Ctrl+Shift+X)", () => {
25
+ expect(js).toMatch(/data-xray-toggle/);
26
+ expect(js).toMatch(/URLSearchParams/);
27
+ expect(js).toMatch(/\.has\("xray"\)/);
28
+ expect(js).toMatch(/ctrlKey.*shiftKey/);
29
+ });
30
+
31
+ test("toggles the data-xray attribute on the document root", () => {
32
+ expect(js).toMatch(/setAttribute\("data-xray"/);
33
+ expect(js).toMatch(/removeAttribute\("data-xray"\)/);
34
+ });
35
+
36
+ test("persists across navigation under grain.xray.on, guarded by try/catch (private mode)", () => {
37
+ expect(js).toMatch(/"grain\.xray\.on"/); // the dotted house key
38
+ expect(js).toMatch(/localStorage\.setItem\(KEY/); // writes it
39
+ expect(js).toMatch(/localStorage\.getItem\(KEY\)\s*===\s*"1"/); // restores it on boot
40
+ // both storage touches sit inside try/catch (private mode never throws)
41
+ expect(js).toMatch(/try\s*\{[^}]*localStorage\.setItem\(KEY/s);
42
+ expect(js).toMatch(/try\s*\{[\s\S]*localStorage\.getItem\(KEY\)/);
43
+ });
@@ -0,0 +1,65 @@
1
+ /* grain/styles/cmdk.css — styles for the global command palette (cmdk.js).
2
+ Uses only design tokens — no hardcoded colors or sizes.
3
+
4
+ Restyle (owner, 2026-07-06 — visual only, matching logic untouched): was drifted from the
5
+ rest of THE EDITOR's chrome on THREE counts — (1) raw --ink/--paper/--line-soft instead of the
6
+ semantic --color-* tokens everything else here uses, so it couldn't pick up the accent hue
7
+ under Baguette/Brioche (--color-accent overrides --ink for the flavor, never the reverse);
8
+ (2) --font-smooth while the file-tree/tab-bar/console it sits beside are --font-mono — the
9
+ actual "doesn't match the VS Code vibe" gap; (3) the selected row was a solid ink-invert
10
+ block, the exact pattern DESIGN-SYSTEM §5 already rejected elsewhere (see icon-btn.css's own
11
+ hover comment) — a loud block instead of a quiet accent wash. */
12
+ .cmdk {
13
+ max-width: 34rem; width: calc(100% - 2rem); margin: 3rem auto auto; padding: 0;
14
+ border: 1px solid var(--color-line); border-radius: var(--radius-md); overflow: hidden;
15
+ background: var(--color-bg); color: var(--color-fg);
16
+ font-family: var(--font-mono);
17
+ box-shadow: 0 8px 24px color-mix(in srgb, var(--ink) 22%, transparent);
18
+ opacity: 0; transform: translateY(-0.5rem); transition: opacity .16s ease, transform .16s ease;
19
+ }
20
+ .cmdk[open] { opacity: 1; transform: translateY(0); }
21
+ @starting-style { .cmdk[open] { opacity: 0; transform: translateY(-0.5rem); } }
22
+ .cmdk::backdrop { background: color-mix(in srgb, var(--ink) 18%, transparent); }
23
+ @media (prefers-reduced-motion: reduce) { .cmdk { transition: none; transform: none; } }
24
+
25
+ /* anchored: dropped directly beneath the title bar's search field (cmdk.js measures it on open,
26
+ not guessed — grain/CLAUDE.md lesson 9). Reads as that field growing a results list, not a
27
+ separate floating box: same left edge + width, flush top corners, top border dropped so the
28
+ field's own bottom edge is the only seam. */
29
+ .cmdk--anchored {
30
+ top: var(--cmdk-top); left: var(--cmdk-left); width: var(--cmdk-width);
31
+ max-width: none; margin: 0;
32
+ border-top-left-radius: 0; border-top-right-radius: 0; border-top-color: transparent;
33
+ }
34
+
35
+ .cmdk__row {
36
+ display: flex; align-items: center; gap: var(--space-2);
37
+ border-bottom: 1px solid var(--color-line); padding: 0 1rem;
38
+ }
39
+ .cmdk__icon { width: 1rem; height: 1rem; color: var(--color-muted); flex: none; }
40
+ .cmdk__input {
41
+ width: 100%; box-sizing: border-box; border: 0;
42
+ background: transparent; padding: .85rem 0;
43
+ font-family: inherit; font-size: 1.1rem; color: inherit;
44
+ /* no outline:none — the input is the palette's focused control; it takes the global
45
+ :focus-visible accent ring (global.css) so keyboard focus is visible on open. */
46
+ }
47
+ .cmdk__input::placeholder { color: var(--ink-faint); }
48
+
49
+ .cmdk__list { list-style: none; margin: 0; padding: .25rem; max-height: 52vh; overflow: auto; }
50
+ .cmdk__item { display: flex; align-items: baseline; gap: .6rem; padding: .5rem .75rem; border-radius: 2px; cursor: pointer; }
51
+ /* selected = a quiet ACCENT wash (never an invert) — the same treatment as every other
52
+ current/selected state in the shell (nav-item[aria-current], tabs, file-tree), so the
53
+ highlight reaches the accent hue on Baguette/Brioche instead of staying flat monochrome. */
54
+ .cmdk__item.is-sel { background: color-mix(in srgb, var(--color-accent) 14%, transparent); }
55
+
56
+ .cmdk__sub { color: var(--color-muted); font-size: .85em; }
57
+
58
+ .cmdk__kind { margin-left: auto; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); }
59
+
60
+ .cmdk__empty { padding: .75rem 1rem; color: var(--color-muted); }
61
+
62
+ .cmdk__hint {
63
+ padding: .5rem 1rem; border-top: 1px solid var(--color-line);
64
+ font-size: .7rem; color: var(--color-muted); text-transform: uppercase; letter-spacing: .06em;
65
+ }