@bigmistqke/whiteboard 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +628 -2
  3. package/bin/whiteboard.ts +488 -0
  4. package/dist/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/taggedTemplateLiteral.js +5 -0
  5. package/dist/bin/whiteboard.js +542 -0
  6. package/dist/client/runtime.js +544 -0
  7. package/dist/define.js +7 -0
  8. package/dist/plugins/callout/README.md +13 -0
  9. package/dist/plugins/callout/index.js +27 -0
  10. package/dist/plugins/callout/style.css +12 -0
  11. package/dist/plugins/chat/README.md +46 -0
  12. package/dist/plugins/chat/client.js +3 -0
  13. package/dist/plugins/chat/index.js +47 -0
  14. package/dist/plugins/chat/style.css +24 -0
  15. package/dist/plugins/claude-code/index.js +120 -0
  16. package/dist/plugins/code/README.md +42 -0
  17. package/dist/plugins/code/diff.js +65 -0
  18. package/dist/plugins/code/index.js +77 -0
  19. package/dist/plugins/code/style.css +29 -0
  20. package/dist/plugins/comments/client.js +10 -0
  21. package/dist/plugins/comments/index.js +54 -0
  22. package/dist/plugins/comments/style.css +40 -0
  23. package/dist/plugins/details/README.md +17 -0
  24. package/dist/plugins/details/index.js +17 -0
  25. package/dist/plugins/details/style.css +3 -0
  26. package/dist/plugins/forge/README.md +12 -0
  27. package/dist/plugins/forge/index.js +83 -0
  28. package/dist/plugins/form/README.md +111 -0
  29. package/dist/plugins/form/index.js +102 -0
  30. package/dist/plugins/form/style.css +41 -0
  31. package/dist/plugins/gallery/README.md +30 -0
  32. package/dist/plugins/gallery/client.js +1 -0
  33. package/dist/plugins/gallery/index.js +74 -0
  34. package/dist/plugins/gallery/style.css +27 -0
  35. package/dist/plugins/grid/README.md +33 -0
  36. package/dist/plugins/grid/index.js +33 -0
  37. package/dist/plugins/grid/style.css +25 -0
  38. package/dist/plugins/iframe/README.md +18 -0
  39. package/dist/plugins/iframe/client.js +1 -0
  40. package/dist/plugins/iframe/index.js +40 -0
  41. package/dist/plugins/iframe/style.css +29 -0
  42. package/dist/plugins/index.js +30 -0
  43. package/dist/plugins/mermaid/README.md +21 -0
  44. package/dist/plugins/mermaid/index.js +35 -0
  45. package/dist/plugins/mermaid/style.css +16 -0
  46. package/dist/plugins/quiet/README.md +26 -0
  47. package/dist/plugins/quiet/index.js +17 -0
  48. package/dist/plugins/terminal/client.js +41 -0
  49. package/dist/plugins/terminal/host.js +332 -0
  50. package/dist/plugins/terminal/index.js +171 -0
  51. package/dist/plugins/terminal/modes.js +32 -0
  52. package/dist/plugins/terminal/server.js +256 -0
  53. package/dist/plugins/terminal/sizes.js +57 -0
  54. package/dist/plugins/terminal/style.css +357 -0
  55. package/dist/solid/index.js +36 -0
  56. package/dist/src/auth.js +54 -0
  57. package/dist/src/client/page/base.css +295 -0
  58. package/dist/src/client/page/main.js +1228 -0
  59. package/dist/src/config.js +76 -0
  60. package/dist/src/events.js +183 -0
  61. package/dist/src/html.js +34 -0
  62. package/dist/src/icons.js +6 -0
  63. package/dist/src/load.js +77 -0
  64. package/dist/src/loader.js +126 -0
  65. package/dist/src/package.js +33 -0
  66. package/dist/src/pages/blocks.js +50 -0
  67. package/dist/src/pages/index.js +15 -0
  68. package/dist/src/pages/markdown.js +410 -0
  69. package/dist/src/pages/render.js +311 -0
  70. package/dist/src/plugins.js +238 -0
  71. package/dist/src/running.js +24 -0
  72. package/dist/src/serve.js +71 -0
  73. package/dist/src/server.js +725 -0
  74. package/dist/src/status.js +71 -0
  75. package/package.json +131 -4
  76. package/plugins/callout/README.md +13 -0
  77. package/plugins/callout/index.ts +25 -0
  78. package/plugins/callout/style.css +12 -0
  79. package/plugins/chat/README.md +46 -0
  80. package/plugins/chat/autosize.ts +101 -0
  81. package/plugins/chat/client.tsx +93 -0
  82. package/plugins/chat/index.ts +61 -0
  83. package/plugins/chat/style.css +24 -0
  84. package/plugins/claude-code/index.ts +136 -0
  85. package/plugins/code/README.md +42 -0
  86. package/plugins/code/diff.ts +64 -0
  87. package/plugins/code/index.ts +94 -0
  88. package/plugins/code/style.css +29 -0
  89. package/plugins/comments/client.ts +492 -0
  90. package/plugins/comments/index.ts +54 -0
  91. package/plugins/comments/style.css +40 -0
  92. package/plugins/details/README.md +17 -0
  93. package/plugins/details/index.ts +21 -0
  94. package/plugins/details/style.css +3 -0
  95. package/plugins/forge/README.md +12 -0
  96. package/plugins/forge/index.ts +71 -0
  97. package/plugins/form/README.md +111 -0
  98. package/plugins/form/index.ts +104 -0
  99. package/plugins/form/style.css +41 -0
  100. package/plugins/gallery/README.md +30 -0
  101. package/plugins/gallery/client.tsx +64 -0
  102. package/plugins/gallery/index.ts +67 -0
  103. package/plugins/gallery/style.css +27 -0
  104. package/plugins/grid/README.md +33 -0
  105. package/plugins/grid/index.ts +36 -0
  106. package/plugins/grid/style.css +25 -0
  107. package/plugins/iframe/README.md +18 -0
  108. package/plugins/iframe/client.ts +46 -0
  109. package/plugins/iframe/index.ts +54 -0
  110. package/plugins/iframe/style.css +29 -0
  111. package/plugins/index.ts +21 -0
  112. package/plugins/mermaid/README.md +21 -0
  113. package/plugins/mermaid/index.ts +40 -0
  114. package/plugins/mermaid/style.css +16 -0
  115. package/plugins/quiet/README.md +26 -0
  116. package/plugins/quiet/index.ts +27 -0
  117. package/plugins/terminal/client.ts +317 -0
  118. package/plugins/terminal/host.ts +326 -0
  119. package/plugins/terminal/index.ts +138 -0
  120. package/plugins/terminal/modes.ts +30 -0
  121. package/plugins/terminal/server.ts +215 -0
  122. package/plugins/terminal/sizes.ts +60 -0
  123. package/plugins/terminal/style.css +71 -0
  124. package/skills/whiteboard/SKILL.md +302 -0
  125. package/solid/index.tsx +59 -0
  126. package/src/auth.ts +66 -0
  127. package/src/client/forms.ts +185 -0
  128. package/src/client/markdown.ts +36 -0
  129. package/src/client/page/base.css +295 -0
  130. package/src/client/page/elsewhere.ts +70 -0
  131. package/src/client/page/fresh.ts +205 -0
  132. package/src/client/page/live.ts +30 -0
  133. package/src/client/page/main.ts +272 -0
  134. package/src/client/page/orphans.ts +46 -0
  135. package/src/client/page/sort.ts +38 -0
  136. package/src/client/page/theme.ts +32 -0
  137. package/src/client/page/view.ts +9 -0
  138. package/src/client/page/waiting.ts +182 -0
  139. package/src/client/read.ts +73 -0
  140. package/src/client/runtime.ts +183 -0
  141. package/src/client/toast.ts +25 -0
  142. package/src/config.ts +96 -0
  143. package/src/define.ts +612 -0
  144. package/src/events.ts +218 -0
  145. package/src/html.ts +40 -0
  146. package/src/icons.ts +8 -0
  147. package/src/load.ts +89 -0
  148. package/src/loader.ts +112 -0
  149. package/src/package.ts +39 -0
  150. package/src/pages/blocks.ts +70 -0
  151. package/src/pages/index.ts +42 -0
  152. package/src/pages/markdown.ts +364 -0
  153. package/src/pages/render.ts +233 -0
  154. package/src/plugins.ts +197 -0
  155. package/src/running.ts +22 -0
  156. package/src/serve.ts +52 -0
  157. package/src/server.ts +667 -0
  158. package/src/status.ts +113 -0
@@ -0,0 +1,54 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import crypto from "node:crypto";
4
+ // src/auth.ts
5
+ const COOKIE = "wb-token";
6
+ /** The project's token, made on first use. */
7
+ function projectToken(wb) {
8
+ const file = path.join(wb, "token");
9
+ try {
10
+ return fs.readFileSync(file, "utf8").trim();
11
+ } catch {}
12
+ const token = crypto.randomBytes(24).toString("base64url");
13
+ fs.writeFileSync(file, token + "\n", { mode: 384 });
14
+ return token;
15
+ }
16
+ function createAuth(wb) {
17
+ const token = projectToken(wb);
18
+ const same = (a, b) => typeof a === "string" && a.length === b.length && crypto.timingSafeEqual(Buffer.from(a), Buffer.from(b));
19
+ const cookies = (req) => Object.fromEntries((req.headers.cookie ?? "").split(";").map((c) => c.trim().split("=")).filter(([k]) => k));
20
+ /** Has this request the token, from this origin? */
21
+ function authorized(req) {
22
+ const jar = cookies(req);
23
+ if (!(same(jar[COOKIE], token) || same(req.headers["x-whiteboard-token"], token))) return false;
24
+ const origin = req.headers.origin;
25
+ if (origin && !/^http:\/\/(localhost|127\.0\.0\.1)(:\d+)?$/.test(origin)) return false;
26
+ const site = req.headers["sec-fetch-site"];
27
+ if (site && site !== "same-origin" && site !== "none" && !opensPage(req)) return false;
28
+ return true;
29
+ }
30
+ /** Opening a page as the tab's document: no frame, no fetch, and not an API route. */
31
+ const opensPage = (req) => req.method === "GET" && req.headers["sec-fetch-mode"] === "navigate" && req.headers["sec-fetch-dest"] === "document" && !(req.url ?? "").startsWith("/api/");
32
+ /** The /_/auth route; false for any other path. */
33
+ function handle(req, res, p, q) {
34
+ if (p !== "/_/auth") return false;
35
+ if (!same(q.token, token)) {
36
+ res.writeHead(403, { "content-type": "text/plain" });
37
+ res.end("wrong token");
38
+ return true;
39
+ }
40
+ const to = typeof q.to === "string" && q.to.startsWith("/") && !q.to.startsWith("//") ? q.to : "/";
41
+ res.writeHead(302, {
42
+ "set-cookie": `${COOKIE}=${token}; Path=/; HttpOnly; SameSite=Lax; Max-Age=31536000`,
43
+ location: to
44
+ });
45
+ res.end();
46
+ return true;
47
+ }
48
+ return {
49
+ authorized,
50
+ handle,
51
+ token
52
+ };
53
+ }
54
+ export { createAuth, projectToken };
@@ -0,0 +1,295 @@
1
+ /* Base page style: an article, set for reading. Blocks bring their own style.css;
2
+ <root>/style.css is loaded after this file to override anything here.
3
+
4
+ Theme: follows the system unless <html data-theme="light|dark"> is set (the nav toggle). */
5
+ :root {
6
+ --bg: #fdfdfc; --surface: #ffffff; --text: #1b1c1e; --muted: #696e76; --border: #e3e5e9;
7
+ --accent: #1d5bbf; --accent-text: #ffffff; --code-bg: #f2f3f5; --tint: #f6f7f9;
8
+ --ok: #1a7a49; --warn: #6b4fc0; --bad: #c4352b; --info: #1d5bbf;
9
+ --radius: 8px; --shadow: none;
10
+ --serif: "Iowan Old Style", "Charter", "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
11
+ --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
12
+ --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
13
+ --measure: 680px;
14
+ --wide: 1040px;
15
+ --figure: 920px;
16
+ color-scheme: light;
17
+ }
18
+ @media (prefers-color-scheme: dark) {
19
+ :root:not([data-theme="light"]) {
20
+ --bg: #131417; --surface: #191a1e; --text: #e4e5e7; --muted: #979ca5; --border: #2b2e34;
21
+ --accent: #82aaff; --accent-text: #0d1220; --code-bg: #1e2026; --tint: #1a1c21;
22
+ --ok: #57c48c; --warn: #b4a0ff; --bad: #ff6f66; --info: #82aaff;
23
+ color-scheme: dark;
24
+ }
25
+ }
26
+ :root[data-theme="dark"] {
27
+ --bg: #131417; --surface: #191a1e; --text: #e4e5e7; --muted: #979ca5; --border: #2b2e34;
28
+ --accent: #82aaff; --accent-text: #0d1220; --code-bg: #1e2026; --tint: #1a1c21;
29
+ --ok: #57c48c; --warn: #b4a0ff; --bad: #ff6f66; --info: #82aaff;
30
+ color-scheme: dark;
31
+ }
32
+
33
+ * { box-sizing: border-box; }
34
+ html { -webkit-text-size-adjust: 100%; }
35
+ body {
36
+ margin: 0; background: var(--bg); color: var(--text);
37
+ font: 19px/1.72 var(--serif);
38
+ font-kerning: normal; font-variant-numeric: oldstyle-nums proportional-nums;
39
+ text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
40
+ }
41
+ /* The column: headings sit on its left edge, everything else is indented by --indent, and section
42
+ numbers hang in the margin left of the headings. */
43
+ main { --indent: 34px; max-width: calc(var(--measure) + var(--indent) + 32px); margin: 0 auto; padding: 120px 16px 220px; }
44
+ main > :first-child { margin-top: 0; }
45
+ #wb-main > :not(h1, h2, h3, h4, h5, h6, hr, .wb-wide, .wb-island:has(.wb-wide), figure, .wb-figure, p:has(> img:only-child), p:has(> a:only-child > img:only-child)) { margin-left: var(--indent); }
46
+ #wb-main > :is(h1, h2, h3, h4) + * { margin-top: 0; }
47
+
48
+ /* text */
49
+ a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
50
+ a:hover { text-decoration-color: currentColor; }
51
+ h1, h2, h3, h4 { font-family: var(--serif); font-weight: 500; line-height: 1.2; letter-spacing: -0.01em; text-wrap: balance; }
52
+ h1 { font-size: 2.9rem; line-height: 1.08; margin: 0 0 1.1em; letter-spacing: -0.022em; }
53
+ h2 { font-size: 1.62rem; margin: 4.6em 0 1.5em; }
54
+ h3 { font-size: 1.2rem; margin: 3.4em 0 1.2em; }
55
+ #wb-main > h3 { font-style: italic; } /* section headings only; card titles stay upright */
56
+ h4 { font: 600 .74rem/1.4 var(--sans); text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin: 3em 0 1.1em; }
57
+ p, ul, ol, blockquote, pre, table { margin: 0 0 2.2em; }
58
+ p { margin-bottom: 2.4em; }
59
+ p { text-wrap: pretty; hyphens: auto; }
60
+ ul, ol { padding-left: 1.4em; }
61
+ li::marker { color: var(--muted); }
62
+ li + li { margin-top: .8em; }
63
+ li > p { margin-bottom: .8em; }
64
+ strong { font-weight: 650; }
65
+ img, video { max-width: 100%; height: auto; border-radius: 4px; }
66
+ figure { margin: 3.6em 0; }
67
+ figcaption { font: italic .9rem/1.5 var(--serif); color: var(--muted); margin-top: .7em; }
68
+ code { font: .82em/1.5 var(--mono); background: var(--code-bg); padding: .12em .35em; border-radius: 4px; }
69
+ pre { margin: 3em 0; background: var(--code-bg); padding: 14px 16px; border-radius: var(--radius); overflow-x: auto; font-size: .92rem; line-height: 1.55; }
70
+ pre code { background: none; padding: 0; font-size: .82rem; }
71
+ table { margin: 3em 0; border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; font: .88rem/1.5 var(--sans); }
72
+ th, td { border-bottom: 1px solid var(--border); padding: 7px 12px 7px 0; text-align: left; vertical-align: top; }
73
+ th { font-weight: 600; color: var(--muted); }
74
+ li:has(> input[type=checkbox]) { list-style: none; margin-left: -1.4em; }
75
+ li > input[type=checkbox] { margin-right: 8px; }
76
+
77
+ /* standfirst: the paragraph right under the title introduces the piece */
78
+ #wb-main > h1 + p {
79
+ font-size: 1.24em; line-height: 1.5; color: color-mix(in srgb, var(--text) 72%, var(--bg));
80
+ margin-bottom: 3.6em; padding-bottom: 2.6em; border-bottom: 1px solid var(--border);
81
+ }
82
+ /* pull quote */
83
+ blockquote {
84
+ margin: 3.4em 0; padding: 0 0 0 1em; border-left: 2px solid var(--text);
85
+ font-size: 1.24em; line-height: 1.45; font-style: italic; color: var(--text);
86
+ }
87
+ blockquote > :last-child { margin-bottom: 0; }
88
+ /* a section break: an asterism instead of a rule */
89
+ hr { border: 0; margin: 4.6em 0; text-align: center; height: auto; }
90
+ hr::after { content: "⁂"; font-size: 1.1em; color: var(--muted); letter-spacing: .3em; }
91
+
92
+ /* section numbers hanging in the margin: 1, 1.1, 1.1.1, in italic oldstyle figures. Only the
93
+ page's own headings (direct children of main), so headings inside cards stay unnumbered. The
94
+ number is an inline-block pulled into the margin, so it shares the heading's baseline. */
95
+ #wb-main { counter-reset: h2; }
96
+ #wb-main > h2 { counter-increment: h2; counter-reset: h3; }
97
+ #wb-main > h3 { counter-increment: h3; counter-reset: h4; }
98
+ #wb-main > h4 { counter-increment: h4; }
99
+ #wb-main > :is(h2, h3, h4)::before {
100
+ display: inline-block; box-sizing: content-box; width: 64px; margin-left: -86px; margin-right: 22px; text-align: right;
101
+ font-family: var(--serif); font-style: italic; font-weight: 400; font-variant-numeric: oldstyle-nums tabular-nums;
102
+ color: var(--muted); letter-spacing: 0; text-transform: none; white-space: nowrap;
103
+ }
104
+ #wb-main > h2::before { content: counter(h2); font-size: .82em; }
105
+ #wb-main > h3::before { content: counter(h2) "." counter(h3); font-size: .88em; }
106
+ #wb-main > h4::before { content: counter(h2) "." counter(h3) "." counter(h4); font-size: 1.3em; }
107
+ /* no margin to hang them in: set the number in front of the heading, and indent less */
108
+ @media (max-width: 860px) {
109
+ main { --indent: 0px; }
110
+ #wb-main > :is(h2, h3, h4)::before { width: auto; margin-left: 0; margin-right: .6em; text-align: left; }
111
+ }
112
+
113
+ /* a <details>: a quiet, collapsible section rather than a box */
114
+ details { margin: 3.2em 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
115
+ details + details { margin-top: -3.2em; border-top: 0; }
116
+ details > summary {
117
+ cursor: pointer; list-style: none; padding: .95em 0; font: 500 .95rem/1.4 var(--sans); color: var(--text);
118
+ display: flex; gap: .6em; align-items: baseline;
119
+ }
120
+ details > summary::-webkit-details-marker { display: none; }
121
+ details > summary::before { content: "+"; font: 400 1.1em/1 var(--mono); color: var(--muted); width: .8em; flex: none; }
122
+ details[open] > summary::before { content: "−"; }
123
+ details > summary:hover { color: var(--accent); }
124
+ details > :not(summary) { margin-left: 1.4em; }
125
+ details[open] > :last-child { margin-bottom: 2em; }
126
+
127
+ /* figures: an image alone in its paragraph, an HTML <figure>, or anything with .wb-figure (blocks
128
+ opt in) may run wider than the text, up to --figure, centred on the column. Images keep their
129
+ natural size within that. */
130
+ #wb-main > :is(figure, .wb-figure, p:has(> img:only-child), p:has(> a:only-child > img:only-child)) {
131
+ width: min(var(--figure), 100vw - 32px); position: relative; left: 50%; transform: translateX(-50%);
132
+ margin-left: 0; margin-right: 0; text-align: center;
133
+ }
134
+ #wb-main > p:has(> img:only-child), #wb-main > p:has(> a:only-child > img:only-child) { margin-top: 3.6em; margin-bottom: 3.6em; }
135
+ #wb-main > :is(figure, .wb-figure) figcaption { text-align: center; }
136
+
137
+ /* blocks that may run wider than the text column (blocks opt in with .wb-wide) */
138
+ /* positioned with left + transform, not margins, so a block's own margin rules can't undo it */
139
+ .wb-wide { width: min(var(--wide), 100vw - 32px); position: relative; left: 50%; transform: translateX(-50%); }
140
+
141
+ /* frame */
142
+ .wb-nav {
143
+ position: sticky; top: 0; z-index: 5; display: flex; gap: 14px; align-items: center; justify-content: space-between;
144
+ padding: 10px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
145
+ font: .8rem/1.4 var(--sans); color: var(--muted);
146
+ }
147
+ .wb-nav > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
148
+ .wb-nav a { color: var(--muted); text-decoration: none; }
149
+ .wb-nav a:hover { color: var(--text); }
150
+ /* live.ts: a ring while not connected, grey while live with no agent listening, green with one */
151
+ .wb-live { width: 8px; height: 8px; box-sizing: border-box; border-radius: 50%; border: 1.5px solid var(--muted); background: none; flex: none; }
152
+ [data-wb-live] .wb-live { border-color: var(--muted); background: var(--muted); }
153
+ [data-wb-live] .wb-live[data-agent] { border-color: var(--ok); background: var(--ok); }
154
+ .wb-theme {
155
+ font: inherit; color: var(--muted); background: none; border: 1px solid var(--border); border-radius: 99px;
156
+ height: 24px; box-sizing: border-box; padding: 0 7px; cursor: pointer; display: inline-flex; align-items: center; flex: none;
157
+ }
158
+ .wb-theme:hover { color: var(--text); border-color: var(--muted); }
159
+ /* what waits for the reader on other pages (elsewhere.ts): a menu of them */
160
+ .wb-elsewhere { position: relative; flex: none; }
161
+ .wb-elsewhere[hidden], .wb-elsewhere-list[hidden] { display: none; }
162
+ .wb-awaiting {
163
+ font: inherit; font-weight: 600; color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent);
164
+ border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 99px; height: 24px; box-sizing: border-box; padding: 0 9px; cursor: pointer;
165
+ display: inline-flex; align-items: center; gap: 5px;
166
+ }
167
+ .wb-awaiting svg { flex: none; }
168
+ .wb-index .wb-awaiting { vertical-align: 1px; margin-left: 4px; font: 600 .8rem/1.4 var(--sans); text-decoration: none; }
169
+ .wb-awaiting:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
170
+ .wb-elsewhere-list {
171
+ position: absolute; right: 0; top: calc(100% + 6px); margin: 0; padding: 4px; list-style: none; min-width: 200px; max-width: min(360px, 100vw - 32px);
172
+ background: var(--bg); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 28px rgb(0 0 0 / .16);
173
+ }
174
+ .wb-nav .wb-elsewhere-list a { display: block; padding: 6px 10px; border-radius: 5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
175
+ .wb-nav .wb-elsewhere-list a:hover, .wb-nav .wb-elsewhere-list a:focus-visible { background: color-mix(in srgb, var(--accent) 12%, transparent); }
176
+ .wb-meta { color: var(--muted); font: .8rem/1.5 var(--sans); }
177
+ .wb-index { padding: 0; }
178
+ .wb-index li { list-style: none; padding: 12px 0; border-bottom: 1px solid var(--border); }
179
+ .wb-index .wb-meta { display: block; }
180
+ .wb-error { color: var(--bad); background: color-mix(in srgb, var(--bad) 7%, var(--bg)); white-space: pre-wrap; font: .8rem/1.5 var(--mono); }
181
+ .wb-unknown > .wb-label { color: var(--muted); }
182
+ .wb-island { display: block; }
183
+ span.wb-island { display: inline; }
184
+
185
+ /* plain named forms: the only engine-level interaction */
186
+ input:not([type=checkbox], [type=radio], [type=range]), textarea, select {
187
+ font: .95rem/1.45 var(--sans); color: inherit; background: var(--surface); border: 1px solid var(--border);
188
+ border-radius: 6px; padding: 8px 10px; max-width: 100%;
189
+ }
190
+ input:focus, textarea:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 0; border-color: var(--accent); }
191
+ input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
192
+ button {
193
+ font: 500 .85rem/1.3 var(--sans); padding: 7px 14px; border-radius: 6px; cursor: pointer;
194
+ border: 1px solid var(--border); background: var(--surface); color: var(--text);
195
+ }
196
+ button:hover { border-color: var(--muted); }
197
+
198
+ /* new content since the reader last saw the page */
199
+ #wb-main > * { scroll-margin-top: 72px; }
200
+ .wb-new { position: relative; }
201
+ .wb-new::after {
202
+ content: ""; position: absolute; left: -14px; top: 3px; bottom: 3px; width: 3px; border-radius: 2px;
203
+ background: var(--bad); transition: opacity 1.2s ease;
204
+ }
205
+ .wb-wide.wb-new::after { left: -10px; }
206
+ .wb-new.wb-new-seen::after { opacity: 0; transition-delay: 1s; }
207
+ .wb-fresh button { display: inline-flex; align-items: center; gap: 8px; }
208
+ .wb-fresh-close { display: inline-block; margin-right: -4px; padding: 0 4px; border-left: 1px solid rgb(255 255 255 / .35); opacity: .75; }
209
+ .wb-fresh-close:hover { opacity: 1; }
210
+ .wb-fresh { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
211
+
212
+ form.wb-form[data-wb-folded] { padding: 1em 0; gap: 0; }
213
+ /* named forms: the core marks where each stands (data-wb-open, -pending, -decided); this is how that looks */
214
+ form[data-wb-state=sending] { opacity: .7; }
215
+ /* sending: the form's buttons can't send twice */
216
+ form[data-wb-state=sending] button { pointer-events: none; cursor: progress; }
217
+ /* just sent: a short green flash, and a line saying what happened, for a few seconds */
218
+ @keyframes wb-sent { from { background-color: color-mix(in srgb, var(--ok) 22%, transparent); } to { background-color: transparent; } }
219
+ form[data-wb-just-sent] { animation: wb-sent 1.4s ease-out; }
220
+ form.wb-form[data-wb-state=failed]::before { content: "couldn't send it: try again"; display: block; margin-bottom: 8px; color: var(--bad); font: 600 .75rem/1.4 var(--sans); }
221
+ form[data-wb-sent]:not(.wb-form)::after { content: "✓ sent " attr(data-wb-sent); display: block; margin-top: 6px; color: var(--ok); font: .8rem var(--sans); }
222
+ form[data-wb-state=failed]:not(.wb-form)::after { content: "failed to send"; color: var(--bad); }
223
+
224
+ /* the button in the page's corner that goes to the next thing waiting for the reader */
225
+ .wb-waiting-next { background: var(--accent); color: var(--accent-text); border-color: var(--accent); border-radius: 99px; font-size: .8rem; }
226
+ .wb-waiting-next[hidden] { display: none; }
227
+
228
+ /* a question the reader hasn't answered, or one the agent asks again */
229
+ form[data-wb-open] { outline: 2px solid var(--accent); outline-offset: 10px; border-radius: 2px; }
230
+ form[data-wb-open]::before { content: "waiting for you"; display: block; margin-bottom: 8px; color: var(--accent); font: 600 .75rem/1.4 var(--sans); letter-spacing: .04em; text-transform: uppercase; }
231
+ form[data-wb-pending]::before { content: "sent · waiting for the agent to pick it up"; display: block; margin-bottom: 8px; color: var(--muted); font: .75rem/1.4 var(--sans); }
232
+ form[data-wb-pending][data-wb-just-sent]::before { content: "✓ sent · waiting for the agent to pick it up"; color: var(--ok); font-weight: 600; }
233
+
234
+ /* decided: the agent picked up the latest answer; the form folds into one line quoting it */
235
+ form[data-wb-folded] { cursor: pointer; }
236
+ form[data-wb-folded] > :not([data-block=chat-thread]) { display: none !important; }
237
+ /* the question's chat stays with it, under the answer and the line that reopens it */
238
+ form[data-wb-folded] > [data-block=chat-thread] { order: 1; margin-top: 14px; cursor: auto; }
239
+ form[data-wb-folded]::before { content: "✓ " attr(data-wb-outcome); display: block; white-space: pre-line; color: var(--text); font: .95rem/1.5 var(--sans); }
240
+ form[data-wb-folded]::after { content: "decided · click to change the answer"; display: block; margin-top: 4px; color: var(--muted); font: .75rem/1.4 var(--sans); }
241
+ form[data-wb-folded][data-wb-just-sent]::after { content: "✓ sent · the agent has it"; color: var(--ok); font-weight: 600; }
242
+ form[data-wb-folded]:hover::after { color: var(--accent); }
243
+
244
+ /* the line above the page: what waits for the reader, what nobody listens for, what is answered */
245
+ .wb-summary[hidden] { display: none; }
246
+ .wb-summary button { all: unset; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); }
247
+ .wb-summary button:hover { color: var(--text); }
248
+ .wb-summary button:is([data-state=open], [data-state=messages]) { color: var(--accent); font-weight: 600; }
249
+ .wb-summary { max-width: calc(var(--measure) + var(--indent, 34px) + 32px); margin: 0 auto; padding: 96px 16px 0; box-sizing: border-box; color: var(--muted); font: .8rem/1.5 var(--sans); }
250
+ /* the summary takes the space above the title that the page would otherwise start with */
251
+ .wb-summary:not([hidden]) + main { padding-top: 20px; }
252
+ .wb-fresh[hidden], .wb-fresh button[hidden] { display: none; }
253
+ .wb-fresh button { background: var(--bad); color: #fff; border-color: var(--bad); border-radius: 99px; font-size: .8rem; }
254
+
255
+ @media (max-width: 600px) {
256
+ body { font-size: 18px; }
257
+ main { padding-top: 32px; }
258
+ h1 { font-size: 2.2rem; }
259
+ .wb-new::after { left: -9px; }
260
+ }
261
+
262
+ /* repository views: folder listings and code */
263
+ .wb-files { padding: 0; font: .92rem/1.5 var(--mono); }
264
+ .wb-files li { list-style: none; margin: 0; padding: 5px 0; border-bottom: 1px solid var(--border); }
265
+ .wb-files li + li { margin-top: 0; }
266
+ .wb-files a { text-decoration: none; }
267
+ .wb-code-title { font: 500 1.1rem/1.4 var(--mono); letter-spacing: 0; }
268
+ .wb-code.wb-wide { margin-top: 0; }
269
+
270
+ .wb-code > pre { margin-top: 0; }
271
+
272
+ /* the overview's list of the project's documents */
273
+ .wb-documents { margin-top: 2.5em; }
274
+ .wb-documents h2 { font-size: 1.1rem; margin: 0; }
275
+ /* a list's heading with its sort control at the right (sort.ts) */
276
+ .wb-list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: .4em; }
277
+ .wb-sort { font: .8rem/1.4 var(--sans); color: var(--muted); display: inline-flex; align-items: baseline; gap: 6px; }
278
+ .wb-sort select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; }
279
+
280
+ /* threads whose form is no longer on the page (orphans.ts): read-only, after the content */
281
+ .wb-orphans { --indent: 34px; max-width: calc(var(--measure) + var(--indent) + 32px); margin: 0 auto; padding: 0 16px 220px; box-sizing: border-box; font: .92rem/1.45 var(--sans); }
282
+ .wb-orphans > * { margin-left: var(--indent); }
283
+ .wb-orphans > h2 { margin-left: 0; padding-top: 2em; }
284
+ /* the page's own bottom space moves below the list */
285
+ main:has(+ .wb-orphans:not([hidden])) { padding-bottom: 0; }
286
+ @media (max-width: 860px) { .wb-orphans { --indent: 0px; } }
287
+ .wb-orphans[hidden] { display: none; }
288
+ .wb-orphans h2 { font-size: 1rem; margin: 0 0 .8em; color: var(--muted); }
289
+ .wb-orphans h3 { font: 600 .8rem/1.4 var(--mono, monospace); margin: 1.2em 0 .5em; }
290
+ .wb-orphan { display: flex; flex-direction: column; gap: 8px; }
291
+ .wb-orphan-message { display: flex; flex-direction: column; gap: 2px; max-width: 85%; align-self: flex-start; }
292
+ .wb-orphan-message[data-from=you] { align-self: flex-end; align-items: flex-end; }
293
+ .wb-orphan-who { font: 600 .68rem/1.3 var(--sans); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
294
+ .wb-orphan-message[data-from=agent] .wb-orphan-who { color: var(--accent); }
295
+ .wb-orphan-text { white-space: pre-wrap; padding: 6px 10px; border-radius: 12px; background: var(--tint, var(--surface)); border: 1px solid var(--border); }