@hollis-labs/surface-page 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 (57) hide show
  1. package/README.md +24 -2
  2. package/dist/chunks/chunk-ZT6LTRMY.js +220 -0
  3. package/dist/gallery.js +1730 -0
  4. package/dist/index.js +2706 -0
  5. package/dist/registry-items.json +37 -0
  6. package/dist/sdk.js +24 -0
  7. package/dist/types/ade/Overlay.d.ts +4 -0
  8. package/dist/types/ade/hub.d.ts +5 -0
  9. package/dist/types/agent/AgentPanel.d.ts +24 -0
  10. package/dist/types/agent/api.d.ts +61 -0
  11. package/dist/types/agent/index.d.ts +2 -0
  12. package/dist/types/agent/items.d.ts +25 -0
  13. package/dist/types/agent/session.d.ts +34 -0
  14. package/dist/types/boot.d.ts +12 -0
  15. package/dist/types/cards/renderers.d.ts +22 -0
  16. package/dist/types/cards/store.d.ts +41 -0
  17. package/dist/types/cards/views.d.ts +9 -0
  18. package/dist/types/desk/AttentionBadge.d.ts +4 -0
  19. package/dist/types/desk/Confirm.d.ts +2 -0
  20. package/dist/types/desk/ContextInspector.d.ts +2 -0
  21. package/dist/types/desk/Desktop.d.ts +6 -0
  22. package/dist/types/desk/GhostCursor.d.ts +1 -0
  23. package/dist/types/desk/Palette.d.ts +9 -0
  24. package/dist/types/desk/ThemePicker.d.ts +3 -0
  25. package/dist/types/desk/attention.d.ts +17 -0
  26. package/dist/types/desk/commands.d.ts +13 -0
  27. package/dist/types/desk/composing.d.ts +10 -0
  28. package/dist/types/desk/coreViews.d.ts +2 -0
  29. package/dist/types/desk/keys.d.ts +12 -0
  30. package/dist/types/desk/moduleApi.d.ts +3 -0
  31. package/dist/types/desk/store.d.ts +123 -0
  32. package/dist/types/gallery/Gallery.d.ts +64 -0
  33. package/dist/types/gallery/Specimen.d.ts +22 -0
  34. package/dist/types/gallery/ade.d.ts +1 -0
  35. package/dist/types/gallery/approval.d.ts +1 -0
  36. package/dist/types/gallery/cards.d.ts +1 -0
  37. package/dist/types/gallery/chat.d.ts +1 -0
  38. package/dist/types/gallery/composer.d.ts +1 -0
  39. package/dist/types/gallery/controls.d.ts +1 -0
  40. package/dist/types/gallery/display.d.ts +1 -0
  41. package/dist/types/gallery/genui.d.ts +1 -0
  42. package/dist/types/gallery/index.d.ts +9 -0
  43. package/dist/types/gallery/overlays.d.ts +1 -0
  44. package/dist/types/gallery/theme.d.ts +19 -0
  45. package/dist/types/gallery/windows.d.ts +1 -0
  46. package/dist/types/genui/card.d.ts +2 -0
  47. package/dist/types/index.d.ts +15 -0
  48. package/dist/types/sdk/anchors.d.ts +8 -0
  49. package/dist/types/sdk/hooks.d.ts +11 -0
  50. package/dist/types/sdk/icon.d.ts +5 -0
  51. package/dist/types/sdk/index.d.ts +9 -0
  52. package/dist/types/sdk/marks.d.ts +10 -0
  53. package/dist/types/sdk/runtime.d.ts +40 -0
  54. package/dist/types/sdk/types.d.ts +99 -0
  55. package/package.json +71 -4
  56. package/vite.d.ts +3 -0
  57. package/vite.js +42 -0
@@ -0,0 +1,1730 @@
1
+ // ../../web/src/gallery/Gallery.tsx
2
+ import { PALETTES as PALETTES2, paletteById } from "@hollis-labs/surface-theme";
3
+ import { useLayoutEffect as useLayoutEffect2, useMemo, useRef as useRef4, useState as useState5 } from "react";
4
+ import { Empty as Empty2, EmptyDescription as EmptyDescription2, EmptyHeader as EmptyHeader2, EmptyTitle as EmptyTitle2 } from "@/components/ui/empty";
5
+ import { Select as Select2, SelectContent as SelectContent2, SelectItem as SelectItem2, SelectTrigger as SelectTrigger2, SelectValue as SelectValue2 } from "@/components/ui/select";
6
+ import { Tabs as Tabs2, TabsContent as TabsContent2, TabsList as TabsList2, TabsTrigger as TabsTrigger2 } from "@/components/ui/tabs";
7
+ import { ToggleGroup as ToggleGroup2, ToggleGroupItem as ToggleGroupItem2 } from "@/components/ui/toggle-group";
8
+
9
+ // ../../web/src/gallery/ade.tsx
10
+ import { useEffect, useRef, useState } from "react";
11
+ import { AttentionLayer } from "@/components/ui/attention-layer";
12
+ import { GuideBar } from "@/components/ui/guide-bar";
13
+ import { Label } from "@/components/ui/label";
14
+ import { Switch } from "@/components/ui/switch";
15
+
16
+ // ../../web/src/gallery/Specimen.tsx
17
+ import { createContext, useContext } from "react";
18
+ import { jsx, jsxs } from "react/jsx-runtime";
19
+ var DraftFilter = createContext({ only: false });
20
+ function Section({
21
+ title,
22
+ about,
23
+ draft,
24
+ children
25
+ }) {
26
+ const filter = useContext(DraftFilter);
27
+ if (filter.only && (!draft || filter.job && draft !== filter.job)) return null;
28
+ return /* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-3", "data-gallery-draft": draft, children: [
29
+ /* @__PURE__ */ jsxs("header", { children: [
30
+ /* @__PURE__ */ jsx("h2", { className: "text-sm font-semibold", children: title }),
31
+ about && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: about })
32
+ ] }),
33
+ /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 gap-3 @2xl:grid-cols-2", children })
34
+ ] });
35
+ }
36
+ function Specimen({ label, wide, children }) {
37
+ return /* @__PURE__ */ jsxs(
38
+ "div",
39
+ {
40
+ className: `flex min-w-0 flex-col gap-2 rounded-lg border border-border bg-background p-3 ${wide ? "@2xl:col-span-2" : ""}`,
41
+ children: [
42
+ /* @__PURE__ */ jsx("span", { className: "font-mono text-xs text-muted-foreground", children: label }),
43
+ /* @__PURE__ */ jsx("div", { className: "flex min-w-0 flex-wrap items-center gap-2", children })
44
+ ]
45
+ }
46
+ );
47
+ }
48
+
49
+ // ../../web/src/gallery/ade.tsx
50
+ import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
51
+ var rectOf = (el) => {
52
+ if (!el) return null;
53
+ const r = el.getBoundingClientRect();
54
+ return r.width && r.height ? { x: r.x, y: r.y, w: r.width, h: r.height } : null;
55
+ };
56
+ function AttentionDemo({ style }) {
57
+ const a = useRef(null);
58
+ const b = useRef(null);
59
+ const box = useRef(null);
60
+ const [, tick] = useState(0);
61
+ const [on, setOn] = useState(true);
62
+ useEffect(() => {
63
+ const t = window.setInterval(() => tick((n) => n + 1), 200);
64
+ return () => window.clearInterval(t);
65
+ }, []);
66
+ const target = rectOf(b.current);
67
+ const from = rectOf(a.current);
68
+ const marks = on && target ? [{ id: style, actor: "agent", style, rects: [target], from, note: `A ${style}, with a note.`, by: "Agent" }] : [];
69
+ return /* @__PURE__ */ jsxs2("div", { className: "flex w-full flex-col gap-2", children: [
70
+ /* @__PURE__ */ jsxs2(Label, { className: "gap-2 text-xs", children: [
71
+ /* @__PURE__ */ jsx2(Switch, { checked: on, onCheckedChange: setOn, size: "sm" }),
72
+ " Show"
73
+ ] }),
74
+ /* @__PURE__ */ jsxs2(
75
+ "div",
76
+ {
77
+ ref: box,
78
+ className: "relative grid h-36 w-full grid-cols-2 gap-4 rounded-md border border-dashed border-border p-4",
79
+ children: [
80
+ /* @__PURE__ */ jsx2("div", { ref: a, className: "grid place-items-center rounded-md bg-muted text-xs", children: "from" }),
81
+ /* @__PURE__ */ jsx2("div", { ref: b, className: "grid place-items-center rounded-md bg-muted text-xs", children: "target" })
82
+ ]
83
+ }
84
+ ),
85
+ /* @__PURE__ */ jsx2(
86
+ AttentionLayer,
87
+ {
88
+ marks,
89
+ area: style === "spotlight" ? rectOf(box.current) : null,
90
+ onDismiss: () => setOn(false)
91
+ }
92
+ )
93
+ ] });
94
+ }
95
+ function Ade() {
96
+ return /* @__PURE__ */ jsxs2(Fragment, { children: [
97
+ /* @__PURE__ */ jsx2(Section, { title: "attention-layer", about: "Drawn over the whole window at rectangles the caller finds.", children: ["highlight", "spotlight", "arrow", "select"].map((s) => /* @__PURE__ */ jsx2(Specimen, { label: `style="${s}"`, children: /* @__PURE__ */ jsx2(AttentionDemo, { style: s }) }, s)) }),
98
+ /* @__PURE__ */ jsxs2(Section, { title: "guide-bar", children: [
99
+ /* @__PURE__ */ jsx2(Specimen, { label: "running, waits for Next", children: /* @__PURE__ */ jsx2(
100
+ GuideBar,
101
+ {
102
+ title: "A tour of Drafts",
103
+ say: "These are the modes: Review, Edit and Compare.",
104
+ step: 1,
105
+ steps: 3,
106
+ status: "running",
107
+ onNext: () => {
108
+ },
109
+ onPause: () => {
110
+ },
111
+ onStop: () => {
112
+ }
113
+ }
114
+ ) }),
115
+ /* @__PURE__ */ jsx2(Specimen, { label: "running, waits for something to be done", children: /* @__PURE__ */ jsx2(
116
+ GuideBar,
117
+ {
118
+ title: "A tour of Drafts",
119
+ say: "Now open Scratch, where quick notes go.",
120
+ step: 3,
121
+ steps: 3,
122
+ status: "running",
123
+ waiting: "Open Scratch.",
124
+ hint: "Use the apps menu at the top left.",
125
+ onBack: () => {
126
+ },
127
+ onNext: () => {
128
+ },
129
+ onPause: () => {
130
+ },
131
+ onStop: () => {
132
+ }
133
+ }
134
+ ) }),
135
+ /* @__PURE__ */ jsx2(Specimen, { label: "paused", children: /* @__PURE__ */ jsx2(
136
+ GuideBar,
137
+ {
138
+ title: "A tour of Drafts",
139
+ say: "This is the draft's text.",
140
+ step: 2,
141
+ steps: 3,
142
+ status: "paused",
143
+ onBack: () => {
144
+ },
145
+ onResume: () => {
146
+ },
147
+ onStop: () => {
148
+ }
149
+ }
150
+ ) }),
151
+ /* @__PURE__ */ jsx2(Specimen, { label: "done", children: /* @__PURE__ */ jsx2(GuideBar, { title: "A tour of Drafts", say: "", step: 3, steps: 3, status: "done", onStop: () => {
152
+ } }) })
153
+ ] })
154
+ ] });
155
+ }
156
+
157
+ // ../../web/src/gallery/cards.tsx
158
+ import { CardApproval as CardApproval2 } from "@/components/ui/card-approval";
159
+ import { CardChoice } from "@/components/ui/card-choice";
160
+ import { CardConfirm as CardConfirm2 } from "@/components/ui/card-confirm";
161
+ import { CardForm } from "@/components/ui/card-form";
162
+ import { CardMiss } from "@/components/ui/card-miss";
163
+ import { CardNotice as CardNotice2 } from "@/components/ui/card-notice";
164
+ import { CardPlan as CardPlan2 } from "@/components/ui/card-plan";
165
+ import { CardProgress as CardProgress2 } from "@/components/ui/card-progress";
166
+ import { CardPrompt } from "@/components/ui/card-prompt";
167
+
168
+ // ../../web/src/gallery/approval.tsx
169
+ import { CardApproval } from "@/components/ui/card-approval";
170
+ import { CardConfirm } from "@/components/ui/card-confirm";
171
+ import { CardNotice } from "@/components/ui/card-notice";
172
+ import { CardPlan } from "@/components/ui/card-plan";
173
+ import { CardProgress } from "@/components/ui/card-progress";
174
+ import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
175
+ var open = { state: "open", expires: "in 28 min", onRespond: () => {
176
+ } };
177
+ var SHORT = [
178
+ { label: "Status", before: "ready for review", after: "approved" },
179
+ { label: "Commit", after: "9f517de" },
180
+ { label: "Branch", after: "design/d065599e-approval-card-mockup" }
181
+ ];
182
+ var LONG = [
183
+ { label: "Title", before: "Launch", after: "Launch notes" },
184
+ {
185
+ label: "Text",
186
+ before: "We launch on Monday.\nThe team meets at nine.",
187
+ after: "We launch on Monday, 24 November.\nThe team meets at nine in the main room; the agenda is in the draft.\nAfter the launch: a short review on Wednesday, notes in the shared folder.\nQuestions go to the launch thread, not to email."
188
+ }
189
+ ];
190
+ var SEVERAL = [
191
+ { label: "Rename the draft", before: "Untitled", after: "Launch notes" },
192
+ { label: "Move it", before: "Drafts", after: "Projects / Launch" },
193
+ { label: "Share it", after: "with the design team" }
194
+ ];
195
+ function Wide({ label, children }) {
196
+ return /* @__PURE__ */ jsx3(Specimen, { label, children: /* @__PURE__ */ jsx3("div", { className: "w-full", children }) });
197
+ }
198
+ function Approval() {
199
+ return /* @__PURE__ */ jsxs3(Fragment2, { children: [
200
+ /* @__PURE__ */ jsxs3(
201
+ Section,
202
+ {
203
+ draft: "d_d065599e",
204
+ title: "Approval card: risk at a glance",
205
+ about: "Proposal for job d_d065599e. Risk shows in the left edge, the icon and the badge. High risk is the only red, and its Approve leads to a second confirm.",
206
+ children: [
207
+ ["low", "medium", "high"].map((risk) => /* @__PURE__ */ jsx3(Wide, { label: `risk="${risk}"`, children: /* @__PURE__ */ jsx3(
208
+ CardApproval,
209
+ {
210
+ ...open,
211
+ title: { low: "Rename a note", medium: "Approve the design", high: "Delete 14 notes" }[risk],
212
+ summary: {
213
+ low: "The agent wants to rename one note.",
214
+ medium: "Approve PR 18 at commit 9f517de. The Design team is told to merge exactly that commit.",
215
+ high: "The agent wants to delete 14 notes from **Archive**. They cannot be restored from Surface."
216
+ }[risk],
217
+ risk,
218
+ requestedBy: risk === "medium" ? "design" : "agent",
219
+ changes: risk === "low" ? [{ label: "Title", before: "untitled", after: "Weekly review" }] : risk === "medium" ? SHORT : [{ label: "Notes", before: "14", after: "0" }]
220
+ }
221
+ ) }, risk)),
222
+ /* @__PURE__ */ jsx3(Wide, { label: "high, after Approve\u2026: the second confirm (with a typed phrase)", children: /* @__PURE__ */ jsx3(ConfirmStep, {}) })
223
+ ]
224
+ }
225
+ ),
226
+ /* @__PURE__ */ jsxs3(
227
+ Section,
228
+ {
229
+ draft: "d_d065599e",
230
+ title: "Approval card: before and after",
231
+ about: "Short values sit on one line. Long ones stack as before and after blocks, clipped until opened.",
232
+ children: [
233
+ /* @__PURE__ */ jsx3(Wide, { label: "short values", children: /* @__PURE__ */ jsx3(
234
+ CardApproval,
235
+ {
236
+ ...open,
237
+ title: "Write the draft",
238
+ summary: "Two fields change.",
239
+ risk: "low",
240
+ changes: [
241
+ { label: "Title", before: "Launch", after: "Launch notes" },
242
+ { label: "Lines", before: "4", after: "7" }
243
+ ]
244
+ }
245
+ ) }),
246
+ /* @__PURE__ */ jsx3(Wide, { label: "a longer text", children: /* @__PURE__ */ jsx3(
247
+ CardApproval,
248
+ {
249
+ ...open,
250
+ title: "Rewrite the draft",
251
+ summary: "The agent wants to replace the draft's text.",
252
+ risk: "medium",
253
+ changes: LONG,
254
+ requestedBy: "agent"
255
+ }
256
+ ) })
257
+ ]
258
+ }
259
+ ),
260
+ /* @__PURE__ */ jsxs3(
261
+ Section,
262
+ {
263
+ draft: "d_d065599e",
264
+ title: "Approval card: several changes",
265
+ about: "With perChange, each change is approved or declined on its own. The button says how many are approved, and each change is answered as its own decision.",
266
+ children: [
267
+ /* @__PURE__ */ jsx3(Wide, { label: "perChange, all approved", children: /* @__PURE__ */ jsx3(
268
+ CardApproval,
269
+ {
270
+ ...open,
271
+ title: "Tidy the launch draft",
272
+ summary: "Three changes; take any of them.",
273
+ risk: "medium",
274
+ perChange: true,
275
+ changes: SEVERAL
276
+ }
277
+ ) }),
278
+ /* @__PURE__ */ jsx3(Wide, { label: "perChange, answered: 2 of 3", children: /* @__PURE__ */ jsx3(
279
+ CardApproval,
280
+ {
281
+ state: "submitted",
282
+ onRespond: () => {
283
+ },
284
+ title: "Tidy the launch draft",
285
+ risk: "medium",
286
+ perChange: true,
287
+ changes: SEVERAL,
288
+ decision: { approved: 2, of: 3 }
289
+ }
290
+ ) })
291
+ ]
292
+ }
293
+ ),
294
+ /* @__PURE__ */ jsxs3(
295
+ Section,
296
+ {
297
+ draft: "d_d065599e",
298
+ title: "Approval card: states",
299
+ about: "Waiting shows when it expires. Once closed, the edge and colour go quiet and the foot says what happened.",
300
+ children: [
301
+ /* @__PURE__ */ jsx3(Wide, { label: "waiting for an answer", children: /* @__PURE__ */ jsx3(
302
+ CardApproval,
303
+ {
304
+ ...open,
305
+ title: "Approve the design",
306
+ summary: "PR 18 at 9f517de.",
307
+ risk: "medium",
308
+ changes: SHORT.slice(0, 2)
309
+ }
310
+ ) }),
311
+ /* @__PURE__ */ jsx3(Wide, { label: "working (answer being sent)", children: /* @__PURE__ */ jsx3(
312
+ CardApproval,
313
+ {
314
+ state: "pending",
315
+ busy: true,
316
+ onRespond: () => {
317
+ },
318
+ title: "Approve the design",
319
+ summary: "PR 18 at 9f517de.",
320
+ risk: "medium",
321
+ changes: SHORT.slice(0, 2)
322
+ }
323
+ ) }),
324
+ /* @__PURE__ */ jsx3(Wide, { label: "approved", children: /* @__PURE__ */ jsx3(
325
+ CardApproval,
326
+ {
327
+ state: "submitted",
328
+ decision: "approved",
329
+ onRespond: () => {
330
+ },
331
+ title: "Approve the design",
332
+ summary: "PR 18 at 9f517de.",
333
+ risk: "medium",
334
+ changes: SHORT.slice(0, 2)
335
+ }
336
+ ) }),
337
+ /* @__PURE__ */ jsx3(Wide, { label: "declined", children: /* @__PURE__ */ jsx3(
338
+ CardApproval,
339
+ {
340
+ state: "submitted",
341
+ decision: "declined",
342
+ onRespond: () => {
343
+ },
344
+ title: "Delete 14 notes",
345
+ summary: "From Archive.",
346
+ risk: "high"
347
+ }
348
+ ) }),
349
+ /* @__PURE__ */ jsx3(Wide, { label: "expired", children: /* @__PURE__ */ jsx3(
350
+ CardApproval,
351
+ {
352
+ state: "expired",
353
+ onRespond: () => {
354
+ },
355
+ title: "Approve the design",
356
+ summary: "PR 18 at 7f7d61f.",
357
+ risk: "medium"
358
+ }
359
+ ) }),
360
+ /* @__PURE__ */ jsx3(Wide, { label: "replaced by a newer card", children: /* @__PURE__ */ jsx3(
361
+ CardApproval,
362
+ {
363
+ state: "superseded",
364
+ onRespond: () => {
365
+ },
366
+ title: "Approve the design at 7f7d61f",
367
+ summary: "A newer commit came in; you are asked again on it.",
368
+ risk: "medium"
369
+ }
370
+ ) })
371
+ ]
372
+ }
373
+ ),
374
+ /* @__PURE__ */ jsx3(
375
+ Section,
376
+ {
377
+ draft: "d_d065599e",
378
+ title: "Approval card: next to the other cards",
379
+ about: "In a column of cards, the approval is the one with an edge and a decision. Notices, progress and plans stay flat.",
380
+ children: /* @__PURE__ */ jsx3(Specimen, { label: "a column of cards", wide: true, children: /* @__PURE__ */ jsxs3("div", { className: "mx-auto flex w-full max-w-md flex-col gap-2", children: [
381
+ /* @__PURE__ */ jsx3(
382
+ CardNotice,
383
+ {
384
+ title: "Ready to review",
385
+ body: "\u201CApproval card mockup\u201D has a preview to review: its window is open.",
386
+ tone: "info",
387
+ onDismiss: () => {
388
+ }
389
+ }
390
+ ),
391
+ /* @__PURE__ */ jsx3(CardProgress, { title: "Reading the branch", label: "files", value: 3, max: 5, status: "running" }),
392
+ /* @__PURE__ */ jsx3(
393
+ CardPlan,
394
+ {
395
+ title: "Design round 1",
396
+ steps: [
397
+ { id: "1", title: "Brief sent", status: "done" },
398
+ { id: "2", title: "Mock-up pushed", status: "done" },
399
+ { id: "3", title: "Your review", status: "active" }
400
+ ]
401
+ }
402
+ ),
403
+ /* @__PURE__ */ jsx3(
404
+ CardApproval,
405
+ {
406
+ ...open,
407
+ title: "Approve the design at 9f517de",
408
+ summary: "PR 18 at commit 9f517de.",
409
+ risk: "medium",
410
+ changes: SHORT.slice(0, 2),
411
+ requestedBy: "design"
412
+ }
413
+ ),
414
+ /* @__PURE__ */ jsx3(CardConfirm, { ...open, title: "Close three windows?", body: "Your unsaved draft stays open.", danger: false })
415
+ ] }) })
416
+ }
417
+ )
418
+ ] });
419
+ }
420
+ function ConfirmStep() {
421
+ return /* @__PURE__ */ jsx3(
422
+ "div",
423
+ {
424
+ ref: (el) => {
425
+ if (!el) return;
426
+ const b = Array.from(el.querySelectorAll("button")).find((x) => x.textContent?.endsWith("\u2026"));
427
+ if (b && !el.dataset.clicked) {
428
+ el.dataset.clicked = "1";
429
+ setTimeout(() => b.click(), 0);
430
+ }
431
+ },
432
+ children: /* @__PURE__ */ jsx3(
433
+ CardApproval,
434
+ {
435
+ ...open,
436
+ title: "Delete 14 notes",
437
+ summary: "The agent wants to delete 14 notes from **Archive**.",
438
+ risk: "high",
439
+ phrase: "delete 14 notes",
440
+ requestedBy: "agent",
441
+ changes: [{ label: "Notes", before: "14", after: "0" }]
442
+ }
443
+ )
444
+ }
445
+ );
446
+ }
447
+
448
+ // ../../web/src/gallery/cards.tsx
449
+ import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
450
+ var STATES = [
451
+ { label: "open", state: "open" },
452
+ { label: "pending", state: "pending" },
453
+ { label: "submitted", state: "submitted" },
454
+ { label: "canceled", state: "canceled" },
455
+ { label: "expired", state: "expired" },
456
+ { label: "superseded", state: "superseded" },
457
+ { label: "failed", state: "failed" },
458
+ { label: "stale", state: "open", stale: true }
459
+ ];
460
+ var base = (s) => ({
461
+ state: s.state,
462
+ stale: s.stale,
463
+ onReload: s.stale ? () => {
464
+ } : void 0,
465
+ busy: s.state === "pending",
466
+ receipt: s.state === "submitted" ? "Approved" : void 0,
467
+ expires: s.state === "open" ? "at 14:05" : void 0,
468
+ onRespond: () => {
469
+ }
470
+ });
471
+ var FIELDS = [
472
+ { key: "title", kind: "text", title: "Title", required: true },
473
+ { key: "about", kind: "textarea", title: "About", description: "A line or two." },
474
+ { key: "count", kind: "integer", title: "How many" },
475
+ { key: "public", kind: "boolean", title: "Public" },
476
+ { key: "kind", kind: "enum", title: "Kind", options: ["note", "draft", "plan"] }
477
+ ];
478
+ function AllStates({ name, draw }) {
479
+ return /* @__PURE__ */ jsx4(Section, { title: name, children: STATES.map((s) => /* @__PURE__ */ jsx4(Specimen, { label: s.label, children: /* @__PURE__ */ jsx4("div", { className: "w-full", children: draw(base(s)) }) }, s.label)) });
480
+ }
481
+ function Cards() {
482
+ return /* @__PURE__ */ jsxs4(Fragment3, { children: [
483
+ /* @__PURE__ */ jsx4(Approval, {}),
484
+ /* @__PURE__ */ jsx4(
485
+ AllStates,
486
+ {
487
+ name: "card-confirm",
488
+ draw: (p) => /* @__PURE__ */ jsx4(CardConfirm2, { ...p, title: "Close three windows?", body: "Your unsaved draft stays open.", danger: false })
489
+ }
490
+ ),
491
+ /* @__PURE__ */ jsx4(
492
+ AllStates,
493
+ {
494
+ name: "card-prompt",
495
+ draw: (p) => /* @__PURE__ */ jsx4(CardPrompt, { ...p, title: "A name", question: "What should the flow be called?", placeholder: "Research" })
496
+ }
497
+ ),
498
+ /* @__PURE__ */ jsx4(
499
+ AllStates,
500
+ {
501
+ name: "card-choice",
502
+ draw: (p) => /* @__PURE__ */ jsx4(
503
+ CardChoice,
504
+ {
505
+ ...p,
506
+ title: "Which layout?",
507
+ question: "Pick where the browser goes.",
508
+ options: [
509
+ { id: "left", label: "Left", description: "Beside the draft" },
510
+ { id: "below", label: "Below" },
511
+ { id: "float", label: "Floating" }
512
+ ],
513
+ allowOther: true
514
+ }
515
+ )
516
+ }
517
+ ),
518
+ /* @__PURE__ */ jsx4(
519
+ AllStates,
520
+ {
521
+ name: "card-form",
522
+ draw: (p) => /* @__PURE__ */ jsx4(
523
+ CardForm,
524
+ {
525
+ ...p,
526
+ title: "New flow",
527
+ body: "Fill in what you know.",
528
+ fields: FIELDS,
529
+ values: { title: "Research" }
530
+ }
531
+ )
532
+ }
533
+ ),
534
+ /* @__PURE__ */ jsx4(
535
+ AllStates,
536
+ {
537
+ name: "card-approval",
538
+ draw: (p) => /* @__PURE__ */ jsx4(
539
+ CardApproval2,
540
+ {
541
+ ...p,
542
+ title: "Write the draft",
543
+ summary: "The agent wants to replace the draft's text.",
544
+ risk: "high",
545
+ requestedBy: "agent",
546
+ changes: [
547
+ { label: "Title", before: "Launch", after: "Launch notes" },
548
+ { label: "Lines", before: "4", after: "7" }
549
+ ]
550
+ }
551
+ )
552
+ }
553
+ ),
554
+ /* @__PURE__ */ jsxs4(Section, { title: "card-notice", children: [
555
+ ["info", "success", "warning", "error"].map((t) => /* @__PURE__ */ jsx4(Specimen, { label: `tone="${t}"`, children: /* @__PURE__ */ jsx4("div", { className: "w-full", children: /* @__PURE__ */ jsx4(
556
+ CardNotice2,
557
+ {
558
+ title: { info: "For your information", success: "Done", warning: "Heads up", error: "It failed" }[t],
559
+ body: "Something happened that you should know about.",
560
+ tone: t,
561
+ detail: t === "error" ? "exit status 1" : void 0,
562
+ onDismiss: () => {
563
+ }
564
+ }
565
+ ) }) }, t)),
566
+ /* @__PURE__ */ jsx4(Specimen, { label: "dismissed", children: /* @__PURE__ */ jsx4("div", { className: "w-full", children: /* @__PURE__ */ jsx4(CardNotice2, { title: "A notice", body: "Already dismissed.", state: "canceled" }) }) })
567
+ ] }),
568
+ /* @__PURE__ */ jsxs4(Section, { title: "card-progress and card-plan", children: [
569
+ ["running", "done", "failed"].map((s) => /* @__PURE__ */ jsx4(Specimen, { label: `progress ${s}`, children: /* @__PURE__ */ jsx4("div", { className: "w-full", children: /* @__PURE__ */ jsx4(
570
+ CardProgress2,
571
+ {
572
+ title: "Reading the site",
573
+ label: "pages",
574
+ value: s === "running" ? 4 : 10,
575
+ max: 10,
576
+ status: s,
577
+ detail: s === "failed" ? "The site stopped answering." : void 0
578
+ }
579
+ ) }) }, s)),
580
+ /* @__PURE__ */ jsx4(Specimen, { label: "progress, no value", children: /* @__PURE__ */ jsx4("div", { className: "w-full", children: /* @__PURE__ */ jsx4(CardProgress2, { title: "Thinking", status: "running" }) }) }),
581
+ /* @__PURE__ */ jsx4(Specimen, { label: "plan", wide: true, children: /* @__PURE__ */ jsx4("div", { className: "w-full", children: /* @__PURE__ */ jsx4(
582
+ CardPlan2,
583
+ {
584
+ title: "Write the article",
585
+ steps: [
586
+ { id: "1", title: "Read the sources", status: "done" },
587
+ { id: "2", title: "Outline", status: "done" },
588
+ { id: "3", title: "Draft each section", status: "active", detail: "Section 2 of 4" },
589
+ { id: "4", title: "Images", status: "skipped" },
590
+ { id: "5", title: "Proofread", status: "pending" }
591
+ ]
592
+ }
593
+ ) }) })
594
+ ] }),
595
+ /* @__PURE__ */ jsx4(Section, { title: "card-miss", about: "What draws when no renderer can.", children: ["unknown-kind", "version-skew", "failed"].map((r) => /* @__PURE__ */ jsx4(Specimen, { label: r, children: /* @__PURE__ */ jsx4("div", { className: "w-full", children: /* @__PURE__ */ jsx4(
596
+ CardMiss,
597
+ {
598
+ kind: "survey",
599
+ version: "2",
600
+ reason: r,
601
+ title: "A survey",
602
+ payload: { questions: 3 },
603
+ detail: r === "failed" ? "TypeError: x is undefined" : void 0
604
+ }
605
+ ) }) }, r)) })
606
+ ] });
607
+ }
608
+
609
+ // ../../web/src/gallery/chat.tsx
610
+ import { Bot } from "lucide-react";
611
+ import {
612
+ Conversation,
613
+ ConversationContent,
614
+ ConversationEmptyState,
615
+ ConversationScrollButton,
616
+ ConversationViewport
617
+ } from "@/components/ui/conversation";
618
+ import { Markdown } from "@/components/ui/markdown";
619
+ import { Message, MessageContent, MessageNotice } from "@/components/ui/message";
620
+ import { Tool, ToolContent, ToolHeader, ToolInput, ToolOutput } from "@/components/ui/tool";
621
+
622
+ // ../../web/src/gallery/composer.tsx
623
+ import { Paperclip, Slash, X } from "lucide-react";
624
+ import { useId, useRef as useRef2, useState as useState2 } from "react";
625
+ import { Button } from "@/components/ui/button";
626
+ import { InputGroupAddon, InputGroupButton } from "@/components/ui/input-group";
627
+ import { PromptInput, PromptInputFooter, PromptInputSubmit, PromptInputTextarea } from "@/components/ui/prompt-input";
628
+ import { Fragment as Fragment4, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
629
+ function ComposerFixture({ initial }) {
630
+ const id = useId();
631
+ const field = useRef2(null);
632
+ const [state, setState] = useState2(initial);
633
+ const [draft, setDraft] = useState2(
634
+ initial === "typing" || initial === "sending" ? "Review the composer in light and dark.\nKeep the attachment and shortcut actions within reach." : ""
635
+ );
636
+ const [attached, setAttached] = useState2(initial === "typing");
637
+ const [notice, setNotice] = useState2("");
638
+ const locked = state === "disabled" || state === "sending" || state === "streaming";
639
+ const hint = state === "disabled" ? "Connect to an agent to send a message." : state === "sending" ? "Sending message\u2026 Your draft is kept until it is delivered." : state === "streaming" ? "The agent is answering. Stop to write another message." : "Enter sends \xB7 Shift+Enter adds a line";
640
+ return /* @__PURE__ */ jsxs5("div", { className: "flex w-full min-w-0 flex-col gap-2", "data-composer-state": initial, children: [
641
+ /* @__PURE__ */ jsxs5(
642
+ PromptInput,
643
+ {
644
+ "aria-label": `${initial} composer`,
645
+ onSubmit: (event) => {
646
+ event.preventDefault();
647
+ if (locked || !draft.trim() && !attached) return;
648
+ setState("sending");
649
+ setNotice("");
650
+ },
651
+ children: [
652
+ attached && /* @__PURE__ */ jsx5(InputGroupAddon, { align: "block-start", "aria-label": "Attachments", children: /* @__PURE__ */ jsxs5(
653
+ InputGroupButton,
654
+ {
655
+ disabled: locked,
656
+ "aria-label": "Remove example attachment notes.md",
657
+ onClick: () => setAttached(false),
658
+ children: [
659
+ /* @__PURE__ */ jsx5(Paperclip, {}),
660
+ " notes.md ",
661
+ /* @__PURE__ */ jsx5(X, {})
662
+ ]
663
+ }
664
+ ) }),
665
+ /* @__PURE__ */ jsx5(
666
+ PromptInputTextarea,
667
+ {
668
+ ref: field,
669
+ value: draft,
670
+ onChange: (event) => setDraft(event.target.value),
671
+ disabled: state === "disabled",
672
+ readOnly: state === "sending" || state === "streaming",
673
+ placeholder: "Message the agent\u2026",
674
+ "aria-label": `${initial} message`,
675
+ "aria-describedby": `${id}-hint`
676
+ }
677
+ ),
678
+ /* @__PURE__ */ jsxs5(PromptInputFooter, { children: [
679
+ /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-1", children: [
680
+ /* @__PURE__ */ jsx5(
681
+ InputGroupButton,
682
+ {
683
+ size: "icon-xs",
684
+ disabled: locked,
685
+ "aria-label": "Add example attachment",
686
+ title: "Add example attachment",
687
+ onClick: () => {
688
+ setAttached(true);
689
+ setNotice("Example attachment added. No file was uploaded.");
690
+ },
691
+ children: /* @__PURE__ */ jsx5(Paperclip, {})
692
+ }
693
+ ),
694
+ /* @__PURE__ */ jsx5(
695
+ InputGroupButton,
696
+ {
697
+ size: "icon-xs",
698
+ disabled: locked,
699
+ "aria-label": "Insert example shortcut",
700
+ title: "Insert /summarize",
701
+ onClick: () => {
702
+ setDraft((text) => `${text}${text ? "\n" : ""}/summarize `);
703
+ field.current?.focus();
704
+ },
705
+ children: /* @__PURE__ */ jsx5(Slash, {})
706
+ }
707
+ )
708
+ ] }),
709
+ /* @__PURE__ */ jsx5(
710
+ PromptInputSubmit,
711
+ {
712
+ status: state === "sending" ? "sending" : state === "streaming" ? "streaming" : "ready",
713
+ disabled: state === "disabled" || state !== "streaming" && !draft.trim() && !attached,
714
+ onStop: () => {
715
+ setState("typing");
716
+ setNotice("Stopped. You can continue writing.");
717
+ field.current?.focus();
718
+ }
719
+ }
720
+ )
721
+ ] })
722
+ ]
723
+ }
724
+ ),
725
+ /* @__PURE__ */ jsx5("p", { id: `${id}-hint`, className: "text-xs text-muted-foreground", children: hint }),
726
+ /* @__PURE__ */ jsx5("p", { role: "status", className: "text-xs text-muted-foreground", children: notice || (state === "sending" ? "Demo: waiting for delivery." : "") }),
727
+ state === "sending" && /* @__PURE__ */ jsx5(
728
+ Button,
729
+ {
730
+ variant: "outline",
731
+ size: "sm",
732
+ onClick: () => {
733
+ setState("empty");
734
+ setDraft("");
735
+ setAttached(false);
736
+ setNotice("Demo message delivered.");
737
+ field.current?.focus();
738
+ },
739
+ children: "Simulate delivery"
740
+ }
741
+ )
742
+ ] });
743
+ }
744
+ function ComposerSpecimens() {
745
+ return /* @__PURE__ */ jsxs5(Fragment4, { children: [
746
+ /* @__PURE__ */ jsx5(Specimen, { label: "Composer \xB7 empty", children: /* @__PURE__ */ jsx5(ComposerFixture, { initial: "empty" }) }),
747
+ /* @__PURE__ */ jsx5(Specimen, { label: "Composer \xB7 typing with attachment", children: /* @__PURE__ */ jsx5(ComposerFixture, { initial: "typing" }) }),
748
+ /* @__PURE__ */ jsx5(Specimen, { label: "Composer \xB7 sending", children: /* @__PURE__ */ jsx5(ComposerFixture, { initial: "sending" }) }),
749
+ /* @__PURE__ */ jsx5(Specimen, { label: "Composer \xB7 disabled", children: /* @__PURE__ */ jsx5(ComposerFixture, { initial: "disabled" }) }),
750
+ /* @__PURE__ */ jsx5(Specimen, { label: "Composer \xB7 streaming / stop", children: /* @__PURE__ */ jsx5(ComposerFixture, { initial: "streaming" }) })
751
+ ] });
752
+ }
753
+
754
+ // ../../web/src/gallery/chat.tsx
755
+ import { Fragment as Fragment5, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
756
+ var ANSWER = `Here is the layout I set up:
757
+
758
+ - **Browser** on the left, at the page you named
759
+ - **Drafts** on the right, in front
760
+ - *Scratch* below it, for loose ends
761
+
762
+ \`\`\`json
763
+ { "mode": "research", "ratio": 0.6 }
764
+ \`\`\`
765
+
766
+ | Window | Where |
767
+ |---|---|
768
+ | Browser | left |
769
+ | Drafts | right |`;
770
+ var STREAMING = "Opening the **Drafts window and `drafts_get";
771
+ function Chat() {
772
+ return /* @__PURE__ */ jsxs6(Fragment5, { children: [
773
+ /* @__PURE__ */ jsxs6(Section, { title: "Conversation", about: "A canned thread: the person, the agent with Markdown, tool rows, a notice.", children: [
774
+ /* @__PURE__ */ jsx6(Specimen, { label: "Conversation, Message, Markdown, Tool, MessageNotice", wide: true, children: /* @__PURE__ */ jsx6("div", { className: "h-[52rem] w-full overflow-hidden rounded-md border border-border", children: /* @__PURE__ */ jsxs6(Conversation, { className: "h-full", children: [
775
+ /* @__PURE__ */ jsx6(ConversationViewport, { children: /* @__PURE__ */ jsxs6(ConversationContent, { children: [
776
+ /* @__PURE__ */ jsx6(Message, { from: "user", children: /* @__PURE__ */ jsx6(MessageContent, { children: "Set up a research layout for the article." }) }),
777
+ /* @__PURE__ */ jsxs6(Tool, { children: [
778
+ /* @__PURE__ */ jsx6(ToolHeader, { title: "desk_arrange", status: "done" }),
779
+ /* @__PURE__ */ jsxs6(ToolContent, { children: [
780
+ /* @__PURE__ */ jsx6(ToolInput, { input: { windows: [{ view: "browser" }, { view: "drafts", focus: true }] } }),
781
+ /* @__PURE__ */ jsx6(ToolOutput, { output: '{"arranged": true}' })
782
+ ] })
783
+ ] }),
784
+ /* @__PURE__ */ jsxs6(Tool, { defaultOpen: true, children: [
785
+ /* @__PURE__ */ jsx6(ToolHeader, { title: "browser_read", status: "error" }),
786
+ /* @__PURE__ */ jsxs6(ToolContent, { children: [
787
+ /* @__PURE__ */ jsx6(ToolInput, { input: { url: "https://example.invalid/" } }),
788
+ /* @__PURE__ */ jsx6(ToolOutput, { output: "The site could not be reached.", error: true })
789
+ ] })
790
+ ] }),
791
+ /* @__PURE__ */ jsx6(Tool, { children: /* @__PURE__ */ jsx6(ToolHeader, { title: "drafts_get", status: "running" }) }),
792
+ /* @__PURE__ */ jsx6(Message, { from: "assistant", children: /* @__PURE__ */ jsx6(MessageContent, { children: /* @__PURE__ */ jsx6(Markdown, { children: ANSWER }) }) }),
793
+ /* @__PURE__ */ jsx6(Message, { from: "assistant", children: /* @__PURE__ */ jsx6(MessageContent, { children: /* @__PURE__ */ jsx6(Markdown, { streaming: true, children: STREAMING }) }) }),
794
+ /* @__PURE__ */ jsx6(MessageNotice, { children: "Stopped." }),
795
+ /* @__PURE__ */ jsx6(MessageNotice, { tone: "error", children: "The agent could not finish." })
796
+ ] }) }),
797
+ /* @__PURE__ */ jsx6(ConversationScrollButton, {})
798
+ ] }) }) }),
799
+ /* @__PURE__ */ jsx6(Specimen, { label: "ConversationEmptyState", children: /* @__PURE__ */ jsx6(
800
+ ConversationEmptyState,
801
+ {
802
+ icon: /* @__PURE__ */ jsx6(Bot, {}),
803
+ title: "Ask the agent",
804
+ description: "It sees the window in front and can work the desk for you."
805
+ }
806
+ ) })
807
+ ] }),
808
+ /* @__PURE__ */ jsx6(
809
+ Section,
810
+ {
811
+ title: "Chat composer",
812
+ about: "The input where the owner types to the agent: grows with its text, send, attachments and shortcuts, in each state (design job d_03adcb6b).",
813
+ draft: "d_03adcb6b",
814
+ children: /* @__PURE__ */ jsx6(ComposerSpecimens, {})
815
+ }
816
+ )
817
+ ] });
818
+ }
819
+
820
+ // ../../web/src/gallery/controls.tsx
821
+ import { Bold, Italic, Mail, Plus, Search, Underline } from "lucide-react";
822
+ import { Badge } from "@/components/ui/badge";
823
+ import { Button as Button2 } from "@/components/ui/button";
824
+ import { Checkbox } from "@/components/ui/checkbox";
825
+ import { Field, FieldDescription, FieldError, FieldLabel } from "@/components/ui/field";
826
+ import { Input } from "@/components/ui/input";
827
+ import { InputGroup, InputGroupAddon as InputGroupAddon2, InputGroupButton as InputGroupButton2, InputGroupInput } from "@/components/ui/input-group";
828
+ import { Kbd, KbdGroup } from "@/components/ui/kbd";
829
+ import { Label as Label2 } from "@/components/ui/label";
830
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
831
+ import { Switch as Switch2 } from "@/components/ui/switch";
832
+ import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
833
+ import { TextEditor } from "@/components/ui/text-editor";
834
+ import { Textarea } from "@/components/ui/textarea";
835
+ import { Toggle } from "@/components/ui/toggle";
836
+ import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
837
+ import { Fragment as Fragment6, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
838
+ var VARIANTS = ["default", "outline", "secondary", "ghost", "destructive", "link"];
839
+ var SIZES = ["xs", "sm", "default", "lg"];
840
+ var ICON_SIZES = ["icon-xs", "icon-sm", "icon", "icon-lg"];
841
+ var FRUIT = [
842
+ { value: "apple", label: "Apple" },
843
+ { value: "pear", label: "Pear" },
844
+ { value: "plum", label: "Plum" }
845
+ ];
846
+ function Controls() {
847
+ return /* @__PURE__ */ jsxs7(Fragment6, { children: [
848
+ /* @__PURE__ */ jsxs7(Section, { title: "Button", about: "variant \xD7 size; icon sizes; disabled.", children: [
849
+ VARIANTS.map((v) => /* @__PURE__ */ jsxs7(Specimen, { label: `variant="${v}"`, children: [
850
+ SIZES.map((s) => /* @__PURE__ */ jsx7(Button2, { variant: v, size: s, children: s }, s)),
851
+ /* @__PURE__ */ jsx7(Button2, { variant: v, disabled: true, children: "disabled" })
852
+ ] }, v)),
853
+ /* @__PURE__ */ jsxs7(Specimen, { label: "icon sizes, with an icon and text", children: [
854
+ ICON_SIZES.map((s) => /* @__PURE__ */ jsx7(Button2, { variant: "outline", size: s, "aria-label": s, children: /* @__PURE__ */ jsx7(Plus, {}) }, s)),
855
+ /* @__PURE__ */ jsxs7(Button2, { children: [
856
+ /* @__PURE__ */ jsx7(Mail, {}),
857
+ " With icon"
858
+ ] })
859
+ ] })
860
+ ] }),
861
+ /* @__PURE__ */ jsxs7(Section, { title: "Badge and Kbd", children: [
862
+ /* @__PURE__ */ jsx7(Specimen, { label: "Badge variants", children: ["default", "secondary", "outline", "destructive", "ghost", "link"].map((v) => /* @__PURE__ */ jsx7(Badge, { variant: v, children: v }, v)) }),
863
+ /* @__PURE__ */ jsxs7(Specimen, { label: "Kbd", children: [
864
+ /* @__PURE__ */ jsx7(Kbd, { children: "\u2318K" }),
865
+ /* @__PURE__ */ jsxs7(KbdGroup, { children: [
866
+ /* @__PURE__ */ jsx7(Kbd, { children: "Shift" }),
867
+ /* @__PURE__ */ jsx7(Kbd, { children: "Enter" })
868
+ ] })
869
+ ] })
870
+ ] }),
871
+ /* @__PURE__ */ jsxs7(Section, { title: "Text entry", children: [
872
+ /* @__PURE__ */ jsxs7(Specimen, { label: "Input: default, disabled, invalid", children: [
873
+ /* @__PURE__ */ jsx7(Input, { placeholder: "Placeholder", "aria-label": "default" }),
874
+ /* @__PURE__ */ jsx7(Input, { placeholder: "Disabled", disabled: true, "aria-label": "disabled" }),
875
+ /* @__PURE__ */ jsx7(Input, { defaultValue: "Not an email", "aria-invalid": true, "aria-label": "invalid" })
876
+ ] }),
877
+ /* @__PURE__ */ jsx7(Specimen, { label: "InputGroup", children: /* @__PURE__ */ jsxs7(InputGroup, { children: [
878
+ /* @__PURE__ */ jsx7(InputGroupAddon2, { children: /* @__PURE__ */ jsx7(Search, {}) }),
879
+ /* @__PURE__ */ jsx7(InputGroupInput, { placeholder: "Search", "aria-label": "Search" }),
880
+ /* @__PURE__ */ jsx7(InputGroupAddon2, { align: "inline-end", children: /* @__PURE__ */ jsx7(InputGroupButton2, { children: "Go" }) })
881
+ ] }) }),
882
+ /* @__PURE__ */ jsx7(Specimen, { label: "Textarea", children: /* @__PURE__ */ jsx7(Textarea, { placeholder: "Write something", "aria-label": "Textarea" }) }),
883
+ /* @__PURE__ */ jsx7(Specimen, { label: "TextEditor (a document's source)", children: /* @__PURE__ */ jsx7("div", { className: "h-24 w-full rounded-md border border-border", children: /* @__PURE__ */ jsx7(TextEditor, { "aria-label": "Source", defaultValue: "# A heading\n\nSome **Markdown**, in the monospace face." }) }) }),
884
+ /* @__PURE__ */ jsxs7(Specimen, { label: "Field: label, description, error", wide: true, children: [
885
+ /* @__PURE__ */ jsxs7(Field, { children: [
886
+ /* @__PURE__ */ jsx7(FieldLabel, { htmlFor: "g-name", children: "Name" }),
887
+ /* @__PURE__ */ jsx7(Input, { id: "g-name", placeholder: "Ada" }),
888
+ /* @__PURE__ */ jsx7(FieldDescription, { children: "What the agent calls you." })
889
+ ] }),
890
+ /* @__PURE__ */ jsxs7(Field, { "data-invalid": "true", children: [
891
+ /* @__PURE__ */ jsx7(FieldLabel, { htmlFor: "g-mail", children: "Email" }),
892
+ /* @__PURE__ */ jsx7(Input, { id: "g-mail", defaultValue: "ada@", "aria-invalid": true }),
893
+ /* @__PURE__ */ jsx7(FieldError, { children: "That is not a whole address." })
894
+ ] })
895
+ ] })
896
+ ] }),
897
+ /* @__PURE__ */ jsxs7(Section, { title: "Choices", children: [
898
+ /* @__PURE__ */ jsxs7(Specimen, { label: "Select: default, sm, disabled", children: [
899
+ /* @__PURE__ */ jsxs7(Select, { defaultValue: "pear", items: FRUIT, children: [
900
+ /* @__PURE__ */ jsx7(SelectTrigger, { "aria-label": "Fruit", children: /* @__PURE__ */ jsx7(SelectValue, {}) }),
901
+ /* @__PURE__ */ jsx7(SelectContent, { children: FRUIT.map((f) => /* @__PURE__ */ jsx7(SelectItem, { value: f.value, children: f.label }, f.value)) })
902
+ ] }),
903
+ /* @__PURE__ */ jsxs7(Select, { defaultValue: "plum", items: FRUIT, children: [
904
+ /* @__PURE__ */ jsx7(SelectTrigger, { size: "sm", "aria-label": "Fruit, small", children: /* @__PURE__ */ jsx7(SelectValue, {}) }),
905
+ /* @__PURE__ */ jsx7(SelectContent, { children: FRUIT.map((f) => /* @__PURE__ */ jsx7(SelectItem, { value: f.value, children: f.label }, f.value)) })
906
+ ] }),
907
+ /* @__PURE__ */ jsxs7(Select, { disabled: true, items: FRUIT, children: [
908
+ /* @__PURE__ */ jsx7(SelectTrigger, { "aria-label": "Fruit, disabled", children: /* @__PURE__ */ jsx7(SelectValue, { placeholder: "Disabled" }) }),
909
+ /* @__PURE__ */ jsx7(SelectContent, {})
910
+ ] })
911
+ ] }),
912
+ /* @__PURE__ */ jsxs7(Specimen, { label: "Checkbox and Switch: off, on, disabled", children: [
913
+ /* @__PURE__ */ jsxs7(Label2, { className: "gap-2", children: [
914
+ /* @__PURE__ */ jsx7(Checkbox, {}),
915
+ " off"
916
+ ] }),
917
+ /* @__PURE__ */ jsxs7(Label2, { className: "gap-2", children: [
918
+ /* @__PURE__ */ jsx7(Checkbox, { defaultChecked: true }),
919
+ " on"
920
+ ] }),
921
+ /* @__PURE__ */ jsxs7(Label2, { className: "gap-2", children: [
922
+ /* @__PURE__ */ jsx7(Checkbox, { disabled: true }),
923
+ " disabled"
924
+ ] }),
925
+ /* @__PURE__ */ jsx7(Switch2, { "aria-label": "off" }),
926
+ /* @__PURE__ */ jsx7(Switch2, { defaultChecked: true, "aria-label": "on" }),
927
+ /* @__PURE__ */ jsx7(Switch2, { disabled: true, "aria-label": "disabled" })
928
+ ] }),
929
+ /* @__PURE__ */ jsxs7(Specimen, { label: "Toggle and ToggleGroup (default, outline, sm)", children: [
930
+ /* @__PURE__ */ jsx7(Toggle, { "aria-label": "Bold", defaultPressed: true, children: /* @__PURE__ */ jsx7(Bold, {}) }),
931
+ /* @__PURE__ */ jsxs7(ToggleGroup, { defaultValue: ["bold"], "aria-label": "Style", children: [
932
+ /* @__PURE__ */ jsx7(ToggleGroupItem, { value: "bold", "aria-label": "Bold", children: /* @__PURE__ */ jsx7(Bold, {}) }),
933
+ /* @__PURE__ */ jsx7(ToggleGroupItem, { value: "italic", "aria-label": "Italic", children: /* @__PURE__ */ jsx7(Italic, {}) }),
934
+ /* @__PURE__ */ jsx7(ToggleGroupItem, { value: "underline", "aria-label": "Underline", children: /* @__PURE__ */ jsx7(Underline, {}) })
935
+ ] }),
936
+ /* @__PURE__ */ jsxs7(ToggleGroup, { variant: "outline", size: "sm", spacing: 0, defaultValue: ["review"], "aria-label": "Mode", children: [
937
+ /* @__PURE__ */ jsx7(ToggleGroupItem, { value: "review", children: "Review" }),
938
+ /* @__PURE__ */ jsx7(ToggleGroupItem, { value: "edit", children: "Edit" }),
939
+ /* @__PURE__ */ jsx7(ToggleGroupItem, { value: "compare", children: "Compare" })
940
+ ] })
941
+ ] }),
942
+ /* @__PURE__ */ jsxs7(Specimen, { label: "Tabs: default and line", children: [
943
+ /* @__PURE__ */ jsxs7(Tabs, { defaultValue: "one", children: [
944
+ /* @__PURE__ */ jsxs7(TabsList, { children: [
945
+ /* @__PURE__ */ jsx7(TabsTrigger, { value: "one", children: "One" }),
946
+ /* @__PURE__ */ jsx7(TabsTrigger, { value: "two", children: "Two" }),
947
+ /* @__PURE__ */ jsx7(TabsTrigger, { value: "three", disabled: true, children: "Three" })
948
+ ] }),
949
+ /* @__PURE__ */ jsx7(TabsContent, { value: "one", className: "pt-2 text-sm text-muted-foreground", children: "The first tab's content." })
950
+ ] }),
951
+ /* @__PURE__ */ jsx7(Tabs, { defaultValue: "two", children: /* @__PURE__ */ jsxs7(TabsList, { variant: "line", children: [
952
+ /* @__PURE__ */ jsx7(TabsTrigger, { value: "one", children: "One" }),
953
+ /* @__PURE__ */ jsx7(TabsTrigger, { value: "two", children: "Two" })
954
+ ] }) })
955
+ ] })
956
+ ] })
957
+ ] });
958
+ }
959
+
960
+ // ../../web/src/gallery/display.tsx
961
+ import { ChevronRight, FileText, Folder, Inbox } from "lucide-react";
962
+ import { Avatar, AvatarFallback, AvatarGroup, AvatarGroupCount } from "@/components/ui/avatar";
963
+ import {
964
+ Breadcrumb,
965
+ BreadcrumbItem,
966
+ BreadcrumbLink,
967
+ BreadcrumbList,
968
+ BreadcrumbPage,
969
+ BreadcrumbSeparator
970
+ } from "@/components/ui/breadcrumb";
971
+ import { Button as Button3 } from "@/components/ui/button";
972
+ import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card";
973
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";
974
+ import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "@/components/ui/empty";
975
+ import { Item, ItemActions, ItemContent, ItemDescription, ItemMedia, ItemTitle } from "@/components/ui/item";
976
+ import { Progress } from "@/components/ui/progress";
977
+ import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from "@/components/ui/resizable";
978
+ import { ScrollArea } from "@/components/ui/scroll-area";
979
+ import { Separator } from "@/components/ui/separator";
980
+ import { Skeleton } from "@/components/ui/skeleton";
981
+ import { Spinner } from "@/components/ui/spinner";
982
+ import { Table, TableBody, TableCaption, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
983
+ import { Fragment as Fragment7, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
984
+ var ROWS = [
985
+ { name: "notes", kind: "module", state: "running" },
986
+ { name: "drafts", kind: "module", state: "running" },
987
+ { name: "builder", kind: "module", state: "stopped" }
988
+ ];
989
+ function Display() {
990
+ return /* @__PURE__ */ jsxs8(Fragment7, { children: [
991
+ /* @__PURE__ */ jsxs8(Section, { title: "Rows", about: "Item in each variant and size; a Table.", children: [
992
+ ["default", "outline", "muted"].map((v) => /* @__PURE__ */ jsx8(Specimen, { label: `Item variant="${v}"`, children: /* @__PURE__ */ jsxs8(Item, { variant: v, children: [
993
+ /* @__PURE__ */ jsx8(ItemMedia, { variant: "icon", children: /* @__PURE__ */ jsx8(FileText, {}) }),
994
+ /* @__PURE__ */ jsxs8(ItemContent, { children: [
995
+ /* @__PURE__ */ jsx8(ItemTitle, { children: "Launch notes" }),
996
+ /* @__PURE__ */ jsx8(ItemDescription, { children: "markdown \xB7 r2 \xB7 7 lines" })
997
+ ] }),
998
+ /* @__PURE__ */ jsx8(ItemActions, { children: /* @__PURE__ */ jsx8(Button3, { variant: "ghost", size: "icon-sm", "aria-label": "Open", children: /* @__PURE__ */ jsx8(ChevronRight, {}) }) })
999
+ ] }) }, v)),
1000
+ /* @__PURE__ */ jsx8(Specimen, { label: 'Item size="sm" and "xs"', children: /* @__PURE__ */ jsxs8("div", { className: "flex w-full flex-col gap-1", children: [
1001
+ /* @__PURE__ */ jsx8(Item, { size: "sm", variant: "outline", children: /* @__PURE__ */ jsx8(ItemContent, { children: /* @__PURE__ */ jsx8(ItemTitle, { children: "Small" }) }) }),
1002
+ /* @__PURE__ */ jsx8(Item, { size: "xs", variant: "outline", children: /* @__PURE__ */ jsx8(ItemContent, { children: /* @__PURE__ */ jsx8(ItemTitle, { children: "Extra small" }) }) })
1003
+ ] }) }),
1004
+ /* @__PURE__ */ jsx8(Specimen, { label: "Table", wide: true, children: /* @__PURE__ */ jsxs8(Table, { children: [
1005
+ /* @__PURE__ */ jsx8(TableCaption, { children: "The modules of this app." }),
1006
+ /* @__PURE__ */ jsx8(TableHeader, { children: /* @__PURE__ */ jsxs8(TableRow, { children: [
1007
+ /* @__PURE__ */ jsx8(TableHead, { children: "Name" }),
1008
+ /* @__PURE__ */ jsx8(TableHead, { children: "Kind" }),
1009
+ /* @__PURE__ */ jsx8(TableHead, { className: "text-right", children: "State" })
1010
+ ] }) }),
1011
+ /* @__PURE__ */ jsx8(TableBody, { children: ROWS.map((r) => /* @__PURE__ */ jsxs8(TableRow, { children: [
1012
+ /* @__PURE__ */ jsx8(TableCell, { className: "font-medium", children: r.name }),
1013
+ /* @__PURE__ */ jsx8(TableCell, { children: r.kind }),
1014
+ /* @__PURE__ */ jsx8(TableCell, { className: "text-right", children: r.state })
1015
+ ] }, r.name)) })
1016
+ ] }) })
1017
+ ] }),
1018
+ /* @__PURE__ */ jsxs8(Section, { title: "Regions", children: [
1019
+ /* @__PURE__ */ jsxs8(Specimen, { label: "Card: default and sm", children: [
1020
+ /* @__PURE__ */ jsxs8(Card, { className: "w-full", children: [
1021
+ /* @__PURE__ */ jsxs8(CardHeader, { children: [
1022
+ /* @__PURE__ */ jsx8(CardTitle, { children: "A card" }),
1023
+ /* @__PURE__ */ jsx8(CardDescription, { children: "With a header, content and a footer." }),
1024
+ /* @__PURE__ */ jsx8(CardAction, { children: /* @__PURE__ */ jsx8(Button3, { variant: "outline", size: "xs", children: "Action" }) })
1025
+ ] }),
1026
+ /* @__PURE__ */ jsx8(CardContent, { className: "text-sm", children: "The body of the card." }),
1027
+ /* @__PURE__ */ jsx8(CardFooter, { children: /* @__PURE__ */ jsx8(Button3, { size: "sm", children: "Save" }) })
1028
+ ] }),
1029
+ /* @__PURE__ */ jsx8(Card, { size: "sm", className: "w-full", children: /* @__PURE__ */ jsxs8(CardHeader, { children: [
1030
+ /* @__PURE__ */ jsx8(CardTitle, { children: "Small" }),
1031
+ /* @__PURE__ */ jsx8(CardDescription, { children: 'size="sm"' })
1032
+ ] }) })
1033
+ ] }),
1034
+ /* @__PURE__ */ jsx8(Specimen, { label: "Empty", children: /* @__PURE__ */ jsxs8(Empty, { className: "border border-dashed border-border", children: [
1035
+ /* @__PURE__ */ jsxs8(EmptyHeader, { children: [
1036
+ /* @__PURE__ */ jsx8(EmptyMedia, { variant: "icon", children: /* @__PURE__ */ jsx8(Inbox, {}) }),
1037
+ /* @__PURE__ */ jsx8(EmptyTitle, { children: "Nothing here yet" }),
1038
+ /* @__PURE__ */ jsx8(EmptyDescription, { children: "Things you add show up here." })
1039
+ ] }),
1040
+ /* @__PURE__ */ jsx8(EmptyContent, { children: /* @__PURE__ */ jsx8(Button3, { size: "sm", children: "Add one" }) })
1041
+ ] }) }),
1042
+ /* @__PURE__ */ jsx8(Specimen, { label: "ScrollArea", children: /* @__PURE__ */ jsx8(ScrollArea, { className: "h-28 w-full rounded-md border border-border", children: /* @__PURE__ */ jsx8("div", { className: "flex flex-col gap-1 p-2 text-sm", children: Array.from({ length: 12 }, (_, i) => `Line ${i + 1}`).map((l) => /* @__PURE__ */ jsx8("span", { children: l }, l)) }) }) }),
1043
+ /* @__PURE__ */ jsx8(Specimen, { label: "ResizablePanelGroup", children: /* @__PURE__ */ jsx8("div", { className: "h-28 w-full rounded-md border border-border", children: /* @__PURE__ */ jsxs8(ResizablePanelGroup, { orientation: "horizontal", children: [
1044
+ /* @__PURE__ */ jsx8(ResizablePanel, { defaultSize: "40", className: "grid place-items-center text-sm", children: "One" }),
1045
+ /* @__PURE__ */ jsx8(ResizableHandle, { withHandle: true }),
1046
+ /* @__PURE__ */ jsx8(ResizablePanel, { className: "grid place-items-center text-sm", children: "Two" })
1047
+ ] }) }) }),
1048
+ /* @__PURE__ */ jsx8(Specimen, { label: "Collapsible (open)", children: /* @__PURE__ */ jsxs8(Collapsible, { defaultOpen: true, className: "w-full", children: [
1049
+ /* @__PURE__ */ jsxs8(CollapsibleTrigger, { render: /* @__PURE__ */ jsx8(Button3, { variant: "ghost", size: "sm" }), children: [
1050
+ /* @__PURE__ */ jsx8(Folder, {}),
1051
+ " Details"
1052
+ ] }),
1053
+ /* @__PURE__ */ jsx8(CollapsibleContent, { className: "px-2 pt-1 text-sm text-muted-foreground", children: "What was folded away." })
1054
+ ] }) }),
1055
+ /* @__PURE__ */ jsxs8(Specimen, { label: "Breadcrumb and Separator", children: [
1056
+ /* @__PURE__ */ jsx8(Breadcrumb, { children: /* @__PURE__ */ jsxs8(BreadcrumbList, { children: [
1057
+ /* @__PURE__ */ jsx8(BreadcrumbItem, { children: /* @__PURE__ */ jsx8(BreadcrumbLink, { href: "#gallery", children: "Home" }) }),
1058
+ /* @__PURE__ */ jsx8(BreadcrumbSeparator, {}),
1059
+ /* @__PURE__ */ jsx8(BreadcrumbItem, { children: /* @__PURE__ */ jsx8(BreadcrumbLink, { href: "#gallery", children: "Notes" }) }),
1060
+ /* @__PURE__ */ jsx8(BreadcrumbSeparator, {}),
1061
+ /* @__PURE__ */ jsx8(BreadcrumbItem, { children: /* @__PURE__ */ jsx8(BreadcrumbPage, { children: "Launch" }) })
1062
+ ] }) }),
1063
+ /* @__PURE__ */ jsx8(Separator, {})
1064
+ ] })
1065
+ ] }),
1066
+ /* @__PURE__ */ jsxs8(Section, { title: "Status", children: [
1067
+ /* @__PURE__ */ jsxs8(Specimen, { label: "Spinner, Skeleton, Progress", children: [
1068
+ /* @__PURE__ */ jsx8(Spinner, {}),
1069
+ /* @__PURE__ */ jsxs8("div", { className: "flex w-40 flex-col gap-1.5", children: [
1070
+ /* @__PURE__ */ jsx8(Skeleton, { className: "h-3 w-full" }),
1071
+ /* @__PURE__ */ jsx8(Skeleton, { className: "h-3 w-2/3" })
1072
+ ] }),
1073
+ /* @__PURE__ */ jsx8(Progress, { value: 62, className: "w-40", "aria-label": "62 percent" })
1074
+ ] }),
1075
+ /* @__PURE__ */ jsxs8(Specimen, { label: "Avatar: sizes and a group", children: [
1076
+ /* @__PURE__ */ jsx8(Avatar, { size: "sm", children: /* @__PURE__ */ jsx8(AvatarFallback, { children: "AL" }) }),
1077
+ /* @__PURE__ */ jsx8(Avatar, { children: /* @__PURE__ */ jsx8(AvatarFallback, { children: "AL" }) }),
1078
+ /* @__PURE__ */ jsx8(Avatar, { size: "lg", children: /* @__PURE__ */ jsx8(AvatarFallback, { children: "AL" }) }),
1079
+ /* @__PURE__ */ jsxs8(AvatarGroup, { children: [
1080
+ /* @__PURE__ */ jsx8(Avatar, { children: /* @__PURE__ */ jsx8(AvatarFallback, { children: "A" }) }),
1081
+ /* @__PURE__ */ jsx8(Avatar, { children: /* @__PURE__ */ jsx8(AvatarFallback, { children: "B" }) }),
1082
+ /* @__PURE__ */ jsx8(AvatarGroupCount, { children: "+3" })
1083
+ ] })
1084
+ ] })
1085
+ ] })
1086
+ ] });
1087
+ }
1088
+
1089
+ // ../../web/src/gallery/genui.tsx
1090
+ import { GenuiSurface } from "@/components/ui/genui-surface";
1091
+ import { Fragment as Fragment8, jsx as jsx9 } from "react/jsx-runtime";
1092
+ var PATTERNS = [
1093
+ {
1094
+ name: "approval",
1095
+ pattern: {
1096
+ kind: "approval",
1097
+ title: "Publish the post",
1098
+ summary: "The agent wants to publish the draft to the blog.",
1099
+ changes: [{ label: "Status", before: "draft", after: "published" }],
1100
+ choices: [{ label: "Publish", risk: "high" }, { label: "Keep as draft" }]
1101
+ }
1102
+ },
1103
+ {
1104
+ name: "form",
1105
+ pattern: {
1106
+ kind: "form",
1107
+ title: "New flow",
1108
+ fields: [
1109
+ { key: "name", label: "Name", type: "text", required: true, help: "What to call it." },
1110
+ { key: "about", label: "About", type: "textarea", required: false, maxLength: 200 },
1111
+ { key: "steps", label: "Steps", type: "integer", required: false, min: 1, max: 9 },
1112
+ { key: "public", label: "Public", type: "checkbox", required: false }
1113
+ ],
1114
+ draft: { name: "Research" },
1115
+ submitLabel: "Create"
1116
+ }
1117
+ },
1118
+ {
1119
+ name: "list_detail",
1120
+ pattern: {
1121
+ kind: "list_detail",
1122
+ title: "Open questions",
1123
+ items: [
1124
+ { id: "a", title: "Which theme is the baseline?", summary: "Design" },
1125
+ { id: "b", title: "Where does the registry live?", summary: "Settled" }
1126
+ ],
1127
+ selectedId: "a",
1128
+ detail: { title: "Which theme is the baseline?", body: "Decided after the plumbing, not before." }
1129
+ }
1130
+ }
1131
+ ];
1132
+ var PHASES = [
1133
+ { phase: "ready" },
1134
+ { phase: "busy" },
1135
+ { phase: "pending", message: "Waiting for the host." },
1136
+ { phase: "confirmation", confirmation: "This publishes the post. Go on?" },
1137
+ { phase: "unknown", message: "It may or may not have happened. Check before trying again." },
1138
+ { phase: "terminal", status: "accepted" },
1139
+ { phase: "terminal", status: "refused", message: "Not allowed here." },
1140
+ { phase: "stale" }
1141
+ ];
1142
+ function Genui() {
1143
+ return /* @__PURE__ */ jsx9(Fragment8, { children: PATTERNS.map(({ name, pattern }) => /* @__PURE__ */ jsx9(Section, { title: `genui-surface: ${name}`, children: PHASES.map((p) => /* @__PURE__ */ jsx9(Specimen, { label: p.status ? `${p.phase} \xB7 ${p.status}` : p.phase, children: /* @__PURE__ */ jsx9("div", { className: "w-full", children: /* @__PURE__ */ jsx9(
1144
+ GenuiSurface,
1145
+ {
1146
+ pattern,
1147
+ phase: p.phase,
1148
+ status: p.status,
1149
+ message: p.message,
1150
+ confirmation: p.confirmation,
1151
+ canConfirm: p.phase === "confirmation",
1152
+ onChoose: () => {
1153
+ },
1154
+ onConfirm: () => {
1155
+ },
1156
+ onCheck: () => {
1157
+ },
1158
+ onSelect: () => {
1159
+ }
1160
+ }
1161
+ ) }) }, `${p.phase}:${p.status ?? ""}`)) }, name)) });
1162
+ }
1163
+
1164
+ // ../../web/src/gallery/overlays.tsx
1165
+ import { Copy, Settings, Trash2 } from "lucide-react";
1166
+ import {
1167
+ AlertDialog,
1168
+ AlertDialogAction,
1169
+ AlertDialogCancel,
1170
+ AlertDialogContent,
1171
+ AlertDialogDescription,
1172
+ AlertDialogFooter,
1173
+ AlertDialogHeader,
1174
+ AlertDialogTitle,
1175
+ AlertDialogTrigger
1176
+ } from "@/components/ui/alert-dialog";
1177
+ import { Button as Button4 } from "@/components/ui/button";
1178
+ import {
1179
+ Command,
1180
+ CommandEmpty,
1181
+ CommandGroup,
1182
+ CommandInput,
1183
+ CommandItem,
1184
+ CommandList,
1185
+ CommandShortcut
1186
+ } from "@/components/ui/command";
1187
+ import {
1188
+ ContextMenu,
1189
+ ContextMenuContent,
1190
+ ContextMenuItem,
1191
+ ContextMenuShortcut,
1192
+ ContextMenuTrigger
1193
+ } from "@/components/ui/context-menu";
1194
+ import {
1195
+ Dialog,
1196
+ DialogClose,
1197
+ DialogContent,
1198
+ DialogDescription,
1199
+ DialogFooter,
1200
+ DialogHeader,
1201
+ DialogTitle,
1202
+ DialogTrigger
1203
+ } from "@/components/ui/dialog";
1204
+ import {
1205
+ DropdownMenu,
1206
+ DropdownMenuContent,
1207
+ DropdownMenuItem,
1208
+ DropdownMenuLabel,
1209
+ DropdownMenuSeparator,
1210
+ DropdownMenuShortcut,
1211
+ DropdownMenuTrigger
1212
+ } from "@/components/ui/dropdown-menu";
1213
+ import {
1214
+ Popover,
1215
+ PopoverContent,
1216
+ PopoverDescription,
1217
+ PopoverHeader,
1218
+ PopoverTitle,
1219
+ PopoverTrigger
1220
+ } from "@/components/ui/popover";
1221
+ import {
1222
+ Sheet,
1223
+ SheetContent,
1224
+ SheetDescription,
1225
+ SheetFooter,
1226
+ SheetHeader,
1227
+ SheetTitle,
1228
+ SheetTrigger
1229
+ } from "@/components/ui/sheet";
1230
+ import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
1231
+ import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
1232
+ function Overlays() {
1233
+ return /* @__PURE__ */ jsxs9(Section, { title: "Over the page", about: "Open each from its trigger. Command is shown inline as well.", children: [
1234
+ /* @__PURE__ */ jsxs9(Specimen, { label: "Dialog and AlertDialog", children: [
1235
+ /* @__PURE__ */ jsxs9(Dialog, { children: [
1236
+ /* @__PURE__ */ jsx10(DialogTrigger, { render: /* @__PURE__ */ jsx10(Button4, { variant: "outline", children: "Open dialog" }) }),
1237
+ /* @__PURE__ */ jsxs9(DialogContent, { children: [
1238
+ /* @__PURE__ */ jsxs9(DialogHeader, { children: [
1239
+ /* @__PURE__ */ jsx10(DialogTitle, { children: "A dialog" }),
1240
+ /* @__PURE__ */ jsx10(DialogDescription, { children: "Something to read or fill in before going on." })
1241
+ ] }),
1242
+ /* @__PURE__ */ jsxs9(DialogFooter, { children: [
1243
+ /* @__PURE__ */ jsx10(DialogClose, { render: /* @__PURE__ */ jsx10(Button4, { variant: "outline", children: "Cancel" }) }),
1244
+ /* @__PURE__ */ jsx10(Button4, { children: "Save" })
1245
+ ] })
1246
+ ] })
1247
+ ] }),
1248
+ /* @__PURE__ */ jsxs9(AlertDialog, { children: [
1249
+ /* @__PURE__ */ jsx10(AlertDialogTrigger, { render: /* @__PURE__ */ jsx10(Button4, { variant: "destructive", children: "Delete\u2026" }) }),
1250
+ /* @__PURE__ */ jsxs9(AlertDialogContent, { children: [
1251
+ /* @__PURE__ */ jsxs9(AlertDialogHeader, { children: [
1252
+ /* @__PURE__ */ jsx10(AlertDialogTitle, { children: "Delete the draft?" }),
1253
+ /* @__PURE__ */ jsx10(AlertDialogDescription, { children: "Its revisions go too. This cannot be undone." })
1254
+ ] }),
1255
+ /* @__PURE__ */ jsxs9(AlertDialogFooter, { children: [
1256
+ /* @__PURE__ */ jsx10(AlertDialogCancel, { children: "Cancel" }),
1257
+ /* @__PURE__ */ jsx10(AlertDialogAction, { children: "Delete" })
1258
+ ] })
1259
+ ] })
1260
+ ] })
1261
+ ] }),
1262
+ /* @__PURE__ */ jsxs9(Specimen, { label: "Sheet, Popover, Tooltip", children: [
1263
+ /* @__PURE__ */ jsxs9(Sheet, { children: [
1264
+ /* @__PURE__ */ jsx10(SheetTrigger, { render: /* @__PURE__ */ jsx10(Button4, { variant: "outline", children: "Open sheet" }) }),
1265
+ /* @__PURE__ */ jsxs9(SheetContent, { children: [
1266
+ /* @__PURE__ */ jsxs9(SheetHeader, { children: [
1267
+ /* @__PURE__ */ jsx10(SheetTitle, { children: "A sheet" }),
1268
+ /* @__PURE__ */ jsx10(SheetDescription, { children: "A panel from the edge of the screen." })
1269
+ ] }),
1270
+ /* @__PURE__ */ jsx10(SheetFooter, { children: /* @__PURE__ */ jsx10(Button4, { children: "Done" }) })
1271
+ ] })
1272
+ ] }),
1273
+ /* @__PURE__ */ jsxs9(Popover, { children: [
1274
+ /* @__PURE__ */ jsx10(PopoverTrigger, { render: /* @__PURE__ */ jsx10(Button4, { variant: "outline", children: "Open popover" }) }),
1275
+ /* @__PURE__ */ jsx10(PopoverContent, { children: /* @__PURE__ */ jsxs9(PopoverHeader, { children: [
1276
+ /* @__PURE__ */ jsx10(PopoverTitle, { children: "A popover" }),
1277
+ /* @__PURE__ */ jsx10(PopoverDescription, { children: "A little more, next to what it is about." })
1278
+ ] }) })
1279
+ ] }),
1280
+ /* @__PURE__ */ jsxs9(Tooltip, { children: [
1281
+ /* @__PURE__ */ jsx10(TooltipTrigger, { render: /* @__PURE__ */ jsx10(Button4, { variant: "ghost", size: "icon", "aria-label": "Settings" }), children: /* @__PURE__ */ jsx10(Settings, {}) }),
1282
+ /* @__PURE__ */ jsx10(TooltipContent, { children: "Settings" })
1283
+ ] })
1284
+ ] }),
1285
+ /* @__PURE__ */ jsxs9(Specimen, { label: "DropdownMenu and ContextMenu", children: [
1286
+ /* @__PURE__ */ jsxs9(DropdownMenu, { children: [
1287
+ /* @__PURE__ */ jsx10(DropdownMenuTrigger, { render: /* @__PURE__ */ jsx10(Button4, { variant: "outline", children: "Open menu" }) }),
1288
+ /* @__PURE__ */ jsxs9(DropdownMenuContent, { children: [
1289
+ /* @__PURE__ */ jsx10(DropdownMenuLabel, { children: "Draft" }),
1290
+ /* @__PURE__ */ jsxs9(DropdownMenuItem, { children: [
1291
+ /* @__PURE__ */ jsx10(Copy, {}),
1292
+ " Duplicate ",
1293
+ /* @__PURE__ */ jsx10(DropdownMenuShortcut, { children: "\u2318D" })
1294
+ ] }),
1295
+ /* @__PURE__ */ jsx10(DropdownMenuSeparator, {}),
1296
+ /* @__PURE__ */ jsxs9(DropdownMenuItem, { variant: "destructive", children: [
1297
+ /* @__PURE__ */ jsx10(Trash2, {}),
1298
+ " Delete"
1299
+ ] })
1300
+ ] })
1301
+ ] }),
1302
+ /* @__PURE__ */ jsxs9(ContextMenu, { children: [
1303
+ /* @__PURE__ */ jsx10(ContextMenuTrigger, { className: "grid h-16 w-48 place-items-center rounded-md border border-dashed border-border text-xs text-muted-foreground", children: "Right-click here" }),
1304
+ /* @__PURE__ */ jsxs9(ContextMenuContent, { children: [
1305
+ /* @__PURE__ */ jsxs9(ContextMenuItem, { children: [
1306
+ "Copy ",
1307
+ /* @__PURE__ */ jsx10(ContextMenuShortcut, { children: "\u2318C" })
1308
+ ] }),
1309
+ /* @__PURE__ */ jsx10(ContextMenuItem, { children: "Rename" })
1310
+ ] })
1311
+ ] })
1312
+ ] }),
1313
+ /* @__PURE__ */ jsx10(Specimen, { label: "Command (inline)", children: /* @__PURE__ */ jsxs9(Command, { className: "w-full rounded-lg border border-border", children: [
1314
+ /* @__PURE__ */ jsx10(CommandInput, { placeholder: "Run a command\u2026" }),
1315
+ /* @__PURE__ */ jsxs9(CommandList, { children: [
1316
+ /* @__PURE__ */ jsx10(CommandEmpty, { children: "Nothing matches." }),
1317
+ /* @__PURE__ */ jsxs9(CommandGroup, { heading: "Desk", children: [
1318
+ /* @__PURE__ */ jsxs9(CommandItem, { children: [
1319
+ "Open Notes ",
1320
+ /* @__PURE__ */ jsx10(CommandShortcut, { children: "\u2318N" })
1321
+ ] }),
1322
+ /* @__PURE__ */ jsx10(CommandItem, { children: "Tile every window" }),
1323
+ /* @__PURE__ */ jsx10(CommandItem, { children: "Show the agent" })
1324
+ ] })
1325
+ ] })
1326
+ ] }) })
1327
+ ] });
1328
+ }
1329
+
1330
+ // ../../web/src/gallery/theme.tsx
1331
+ import {
1332
+ applyPalette,
1333
+ checkPalette,
1334
+ PALETTES,
1335
+ paletteCSS,
1336
+ parseTheme
1337
+ } from "@hollis-labs/surface-theme";
1338
+ import { createContext as createContext2, useContext as useContext2, useLayoutEffect, useRef as useRef3, useState as useState3 } from "react";
1339
+ import { Badge as Badge2 } from "@/components/ui/badge";
1340
+ import { Button as Button5 } from "@/components/ui/button";
1341
+ import { Card as Card2, CardContent as CardContent2, CardDescription as CardDescription2, CardFooter as CardFooter2, CardHeader as CardHeader2, CardTitle as CardTitle2 } from "@/components/ui/card";
1342
+ import { Input as Input2 } from "@/components/ui/input";
1343
+ import { Textarea as Textarea2 } from "@/components/ui/textarea";
1344
+ import { Fragment as Fragment9, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
1345
+ var JOB = "d_97410e09";
1346
+ var ThemeChoice = createContext2({ palette: PALETTES[0], type: "mixed", setPalette: () => {
1347
+ }, setType: () => {
1348
+ } });
1349
+ function InPalette({
1350
+ palette,
1351
+ type,
1352
+ children,
1353
+ className
1354
+ }) {
1355
+ const ref = useRef3(null);
1356
+ useLayoutEffect(() => {
1357
+ if (!ref.current) return;
1358
+ const undo = applyPalette(palette, ref.current, type ?? "mixed");
1359
+ return undo;
1360
+ }, [palette, type]);
1361
+ return /* @__PURE__ */ jsx11("div", { ref, className: `bg-background text-foreground ${className ?? ""}`, children });
1362
+ }
1363
+ var TOKENS = [
1364
+ "desk",
1365
+ "background",
1366
+ "card",
1367
+ "popover",
1368
+ "muted",
1369
+ "secondary",
1370
+ "accent",
1371
+ "border",
1372
+ "input",
1373
+ "primary",
1374
+ "ring",
1375
+ "destructive",
1376
+ "success",
1377
+ "warning",
1378
+ "info",
1379
+ "selection"
1380
+ ];
1381
+ function Swatch({ color, label, detail }) {
1382
+ return /* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 items-center gap-2", children: [
1383
+ /* @__PURE__ */ jsx11("span", { className: "size-7 shrink-0 rounded-md border", style: { background: color } }),
1384
+ /* @__PURE__ */ jsxs10("span", { className: "flex min-w-0 flex-col", children: [
1385
+ /* @__PURE__ */ jsx11("span", { className: "truncate text-xs", children: label }),
1386
+ detail && /* @__PURE__ */ jsx11("span", { className: "truncate font-mono text-[10px] text-muted-foreground", children: detail })
1387
+ ] })
1388
+ ] });
1389
+ }
1390
+ function Sample({ palette }) {
1391
+ return /* @__PURE__ */ jsxs10(Card2, { size: "sm", className: "w-full", children: [
1392
+ /* @__PURE__ */ jsxs10(CardHeader2, { children: [
1393
+ /* @__PURE__ */ jsx11(CardTitle2, { children: palette.name }),
1394
+ /* @__PURE__ */ jsx11(CardDescription2, { children: palette.source ?? "palette" })
1395
+ ] }),
1396
+ /* @__PURE__ */ jsxs10(CardContent2, { className: "flex flex-col gap-2 text-sm", children: [
1397
+ /* @__PURE__ */ jsx11("p", { children: "The agent read three files and wrote a draft." }),
1398
+ /* @__PURE__ */ jsx11("p", { className: "text-muted-foreground", children: "Muted: updated 2 min ago \xB7 14 notes" }),
1399
+ /* @__PURE__ */ jsxs10("div", { className: "flex flex-wrap gap-1.5", children: [
1400
+ /* @__PURE__ */ jsx11(Badge2, { variant: "outline", className: "text-success", children: "done" }),
1401
+ /* @__PURE__ */ jsx11(Badge2, { variant: "outline", className: "text-warning", children: "waiting" }),
1402
+ /* @__PURE__ */ jsx11(Badge2, { variant: "outline", className: "text-destructive", children: "failed" }),
1403
+ /* @__PURE__ */ jsx11(Badge2, { variant: "outline", className: "text-info", children: "info" })
1404
+ ] }),
1405
+ /* @__PURE__ */ jsx11("div", { className: "flex gap-1", children: ["red", "green", "yellow", "blue", "magenta", "cyan"].map((k) => /* @__PURE__ */ jsx11("span", { className: "h-1.5 flex-1 rounded-full", style: { background: palette[k] } }, k)) })
1406
+ ] }),
1407
+ /* @__PURE__ */ jsxs10(CardFooter2, { className: "justify-end gap-2", children: [
1408
+ /* @__PURE__ */ jsx11(Button5, { size: "sm", variant: "outline", children: "Cancel" }),
1409
+ /* @__PURE__ */ jsx11(Button5, { size: "sm", children: "Run" })
1410
+ ] })
1411
+ ] });
1412
+ }
1413
+ function Checks({ palette }) {
1414
+ return /* @__PURE__ */ jsx11("ul", { className: "flex w-full flex-col gap-1 text-xs", children: checkPalette(palette).map((r) => /* @__PURE__ */ jsxs10("li", { className: "flex items-center justify-between gap-2", children: [
1415
+ /* @__PURE__ */ jsx11("span", { children: r.pair }),
1416
+ /* @__PURE__ */ jsxs10("span", { className: r.ok ? "text-success" : "text-destructive", children: [
1417
+ r.ratio.toFixed(2),
1418
+ " ",
1419
+ r.ok ? "\u2265" : "<",
1420
+ " ",
1421
+ r.min
1422
+ ] })
1423
+ ] }, r.pair)) });
1424
+ }
1425
+ function Theme() {
1426
+ const { palette, setPalette } = useContext2(ThemeChoice);
1427
+ return /* @__PURE__ */ jsxs10(Fragment9, { children: [
1428
+ /* @__PURE__ */ jsxs10(
1429
+ Section,
1430
+ {
1431
+ title: "Theme: the palette in use",
1432
+ about: "Thirteen colours a Linux theme names. Everything else is derived from them by the theme. Pick another in the header.",
1433
+ draft: JOB,
1434
+ children: [
1435
+ /* @__PURE__ */ jsx11(Specimen, { label: `palette: ${palette.name}`, wide: true, children: /* @__PURE__ */ jsx11("div", { className: "grid w-full grid-cols-2 gap-3 @lg:grid-cols-4 @3xl:grid-cols-7", children: Object.entries(paletteCSS(palette)).map(([name, v]) => /* @__PURE__ */ jsx11(Swatch, { color: v, label: name.replace("--p-", ""), detail: v }, name)) }) }),
1436
+ /* @__PURE__ */ jsx11(Specimen, { label: "derived tokens", wide: true, children: /* @__PURE__ */ jsx11("div", { className: "grid w-full grid-cols-2 gap-3 @lg:grid-cols-4 @3xl:grid-cols-8", children: TOKENS.map((t) => /* @__PURE__ */ jsx11(Swatch, { color: `var(--${t})`, label: t }, t)) }) }),
1437
+ /* @__PURE__ */ jsx11(Specimen, { label: "how it reads (WCAG contrast)", children: /* @__PURE__ */ jsx11(Checks, { palette }) }),
1438
+ /* @__PURE__ */ jsx11(Specimen, { label: "a piece of interface", children: /* @__PURE__ */ jsx11(Sample, { palette }) })
1439
+ ]
1440
+ }
1441
+ ),
1442
+ /* @__PURE__ */ jsx11(
1443
+ Section,
1444
+ {
1445
+ title: "Theme: every palette",
1446
+ about: "Each drawn in its own palette. Choose one to use it across the gallery.",
1447
+ draft: JOB,
1448
+ children: PALETTES.map((p) => {
1449
+ const fails = checkPalette(p).filter((r) => !r.ok).length;
1450
+ return /* @__PURE__ */ jsx11(Specimen, { label: `${p.id}${fails ? ` \xB7 ${fails} contrast warning(s)` : ""}`, children: /* @__PURE__ */ jsxs10(InPalette, { palette: p, className: "flex w-full flex-col gap-2 rounded-lg p-2", children: [
1451
+ /* @__PURE__ */ jsx11(Sample, { palette: p }),
1452
+ /* @__PURE__ */ jsx11(Button5, { size: "xs", variant: p.id === palette.id ? "secondary" : "ghost", onClick: () => setPalette(p), children: p.id === palette.id ? "In use" : "Use this palette" })
1453
+ ] }) }, p.id);
1454
+ })
1455
+ }
1456
+ ),
1457
+ /* @__PURE__ */ jsx11(
1458
+ Section,
1459
+ {
1460
+ title: "Theme: type",
1461
+ about: "Mono chrome (bars, buttons, tabs, badges, titles) over a sans body, or mono everywhere. Switch it for the whole gallery in the header.",
1462
+ draft: JOB,
1463
+ children: ["mixed", "mono"].map((t) => /* @__PURE__ */ jsx11(
1464
+ Specimen,
1465
+ {
1466
+ label: t === "mixed" ? "mixed: mono chrome, sans body" : "mono: everything in the mono font",
1467
+ children: /* @__PURE__ */ jsx11(InPalette, { palette, type: t, className: "w-full rounded-lg p-2", children: /* @__PURE__ */ jsx11(Sample, { palette }) })
1468
+ },
1469
+ t
1470
+ ))
1471
+ }
1472
+ ),
1473
+ /* @__PURE__ */ jsx11(
1474
+ Section,
1475
+ {
1476
+ title: "Theme: read a theme file",
1477
+ about: "Paste an Omarchy colors.toml, a base16 / tinted-theming scheme or a pywal colors.json.",
1478
+ draft: JOB,
1479
+ children: /* @__PURE__ */ jsx11(ImportSpecimen, { onUse: setPalette })
1480
+ }
1481
+ )
1482
+ ] });
1483
+ }
1484
+ function ImportSpecimen({ onUse }) {
1485
+ const [text, setText] = useState3("");
1486
+ const [name, setName] = useState3("");
1487
+ const [read, setRead] = useState3(null);
1488
+ const [error, setError] = useState3("");
1489
+ const preview = () => {
1490
+ try {
1491
+ setRead(parseTheme(text, name.trim() || void 0));
1492
+ setError("");
1493
+ } catch (e) {
1494
+ setRead(null);
1495
+ setError(e.message);
1496
+ }
1497
+ };
1498
+ return /* @__PURE__ */ jsxs10(Fragment9, { children: [
1499
+ /* @__PURE__ */ jsx11(Specimen, { label: "the file", children: /* @__PURE__ */ jsxs10("div", { className: "flex w-full flex-col gap-2", children: [
1500
+ /* @__PURE__ */ jsx11(Input2, { placeholder: "Name (optional)", value: name, onChange: (e) => setName(e.target.value) }),
1501
+ /* @__PURE__ */ jsx11(
1502
+ Textarea2,
1503
+ {
1504
+ className: "min-h-40 font-mono text-xs",
1505
+ placeholder: 'background = "#1a1b26"\nforeground = "#a9b1d6"\naccent = "#7aa2f7"\n\u2026',
1506
+ value: text,
1507
+ onChange: (e) => setText(e.target.value)
1508
+ }
1509
+ ),
1510
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-end gap-2", children: [
1511
+ error && /* @__PURE__ */ jsx11("span", { className: "mr-auto text-xs text-destructive", children: error }),
1512
+ /* @__PURE__ */ jsx11(Button5, { size: "sm", variant: "outline", disabled: !text.trim(), onClick: preview, children: "Read it" }),
1513
+ /* @__PURE__ */ jsx11(Button5, { size: "sm", disabled: !read, onClick: () => read && onUse(read), children: "Use it" })
1514
+ ] })
1515
+ ] }) }),
1516
+ /* @__PURE__ */ jsx11(Specimen, { label: read ? `read as ${read.source}: ${read.name}` : "nothing read yet", children: read ? /* @__PURE__ */ jsxs10(InPalette, { palette: read, className: "flex w-full flex-col gap-2 rounded-lg p-2", children: [
1517
+ /* @__PURE__ */ jsx11(Sample, { palette: read }),
1518
+ /* @__PURE__ */ jsx11(Checks, { palette: read })
1519
+ ] }) : /* @__PURE__ */ jsx11("p", { className: "text-xs text-muted-foreground", children: "Paste a theme and read it to see it here." }) })
1520
+ ] });
1521
+ }
1522
+
1523
+ // ../../web/src/gallery/windows.tsx
1524
+ import { FileText as FileText2, Globe, StickyNote } from "lucide-react";
1525
+ import { useState as useState4 } from "react";
1526
+ import { WindowManager } from "@/components/ui/window-manager";
1527
+ import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
1528
+ var START = {
1529
+ root: {
1530
+ type: "row",
1531
+ children: [
1532
+ { type: "stack", id: "left", weight: 60, wins: ["draft", "notes"], selected: 0 },
1533
+ { type: "stack", id: "right", weight: 40, wins: ["browser"] }
1534
+ ]
1535
+ },
1536
+ floats: [
1537
+ {
1538
+ id: "f",
1539
+ rect: { x: 40, y: 150, w: 220, h: 110 },
1540
+ root: { type: "row", children: [{ type: "stack", wins: ["scratch"] }] }
1541
+ }
1542
+ ]
1543
+ };
1544
+ var WINDOWS = [
1545
+ { id: "draft", title: "Launch notes", icon: /* @__PURE__ */ jsx12(FileText2, { className: "size-3.5" }), dirty: true },
1546
+ { id: "notes", title: "Notes", icon: /* @__PURE__ */ jsx12(StickyNote, { className: "size-3.5" }) },
1547
+ { id: "browser", title: "Example Domain", icon: /* @__PURE__ */ jsx12(Globe, { className: "size-3.5" }) },
1548
+ { id: "scratch", title: "Scratch", icon: /* @__PURE__ */ jsx12(StickyNote, { className: "size-3.5" }) }
1549
+ ];
1550
+ function Windows() {
1551
+ const [tree, setTree] = useState4(START);
1552
+ const [focus, setFocus] = useState4("draft");
1553
+ return /* @__PURE__ */ jsx12(
1554
+ Section,
1555
+ {
1556
+ draft: "d_3f9690aa",
1557
+ title: "window-manager",
1558
+ about: "Drag a tab to move, split, tab or float a window. The tree is local to this window.",
1559
+ children: /* @__PURE__ */ jsx12(Specimen, { label: "two stacks and a float", wide: true, children: /* @__PURE__ */ jsx12(
1560
+ "div",
1561
+ {
1562
+ className: "relative h-80 w-full overflow-hidden rounded-md border border-border bg-desk",
1563
+ style: { "--window-gap": "6px" },
1564
+ children: /* @__PURE__ */ jsx12(
1565
+ WindowManager,
1566
+ {
1567
+ tree,
1568
+ windows: WINDOWS,
1569
+ focus,
1570
+ onArrange: (t, f) => {
1571
+ setTree(t);
1572
+ setFocus(f);
1573
+ },
1574
+ onClose: () => {
1575
+ },
1576
+ children: (id) => /* @__PURE__ */ jsxs11("div", { className: "p-3 text-xs text-muted-foreground", children: [
1577
+ "The body of \u201C",
1578
+ WINDOWS.find((w) => w.id === id)?.title,
1579
+ "\u201D."
1580
+ ] })
1581
+ }
1582
+ )
1583
+ }
1584
+ ) })
1585
+ }
1586
+ );
1587
+ }
1588
+
1589
+ // ../../web/src/gallery/Gallery.tsx
1590
+ import { Fragment as Fragment10, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
1591
+ var SECTIONS = [
1592
+ { id: "theme", title: "Theme", draw: Theme },
1593
+ { id: "controls", title: "Controls", draw: Controls },
1594
+ { id: "display", title: "Display", draw: Display },
1595
+ { id: "overlays", title: "Overlays", draw: Overlays },
1596
+ { id: "chat", title: "Chat", draw: Chat },
1597
+ { id: "cards", title: "Cards", draw: Cards },
1598
+ { id: "genui", title: "GenUI", draw: Genui },
1599
+ { id: "ade", title: "ADE", draw: Ade },
1600
+ { id: "windows", title: "Windows", draw: Windows }
1601
+ ];
1602
+ function Draft({ job }) {
1603
+ const box = useRef4(null);
1604
+ const [empty, setEmpty] = useState5(false);
1605
+ useLayoutEffect2(() => {
1606
+ const el = box.current;
1607
+ if (!el) return;
1608
+ const check = () => setEmpty(el.childElementCount === 0);
1609
+ check();
1610
+ const watch = new MutationObserver(check);
1611
+ watch.observe(el, { childList: true });
1612
+ return () => watch.disconnect();
1613
+ }, []);
1614
+ return /* @__PURE__ */ jsxs12(Fragment10, { children: [
1615
+ /* @__PURE__ */ jsx13("div", { ref: box, className: "contents", children: /* @__PURE__ */ jsx13(DraftFilter.Provider, { value: { only: true, job }, children: SECTIONS.map((s) => /* @__PURE__ */ jsx13(s.draw, {}, s.id)) }) }),
1616
+ empty && /* @__PURE__ */ jsx13(Empty2, { children: /* @__PURE__ */ jsxs12(EmptyHeader2, { children: [
1617
+ /* @__PURE__ */ jsx13(EmptyTitle2, { children: "No draft marked" }),
1618
+ /* @__PURE__ */ jsxs12(EmptyDescription2, { children: [
1619
+ job ? `No section is marked as the draft of ${job}` : "No section is marked as a draft",
1620
+ " (",
1621
+ /* @__PURE__ */ jsx13("code", { children: '<Section draft="<job id>">' }),
1622
+ "). The whole gallery is in the other tabs."
1623
+ ] })
1624
+ ] }) })
1625
+ ] });
1626
+ }
1627
+ function Gallery({ win }) {
1628
+ return /* @__PURE__ */ jsx13(GalleryTabs, { first: typeof win.args.section === "string" ? win.args.section : void 0 });
1629
+ }
1630
+ function GalleryTabs({
1631
+ first,
1632
+ onSection,
1633
+ draft
1634
+ }) {
1635
+ const tabs = draft ? [{ id: "draft", title: "Draft" }, ...SECTIONS] : SECTIONS;
1636
+ const [section, setSection] = useState5(
1637
+ first && tabs.some((s) => s.id === first) ? first : draft ? "draft" : "controls"
1638
+ );
1639
+ const [palette, setPalette] = useState5(
1640
+ () => paletteById(remembered("palette") ?? "") ?? PALETTES2[0]
1641
+ );
1642
+ const [type, setType] = useState5(() => remembered("type") === "mono" ? "mono" : "mixed");
1643
+ const choice = useMemo(
1644
+ () => ({
1645
+ palette,
1646
+ type,
1647
+ setPalette: (p) => {
1648
+ setPalette(p);
1649
+ remember("palette", p.id);
1650
+ },
1651
+ setType: (t) => {
1652
+ setType(t);
1653
+ remember("type", t);
1654
+ }
1655
+ }),
1656
+ [palette, type]
1657
+ );
1658
+ return /* @__PURE__ */ jsx13(ThemeChoice.Provider, { value: choice, children: /* @__PURE__ */ jsx13(InPalette, { palette, type, className: "h-full min-h-0", children: /* @__PURE__ */ jsxs12(
1659
+ Tabs2,
1660
+ {
1661
+ value: section,
1662
+ onValueChange: (v) => {
1663
+ setSection(String(v));
1664
+ onSection?.(String(v));
1665
+ },
1666
+ className: "@container flex h-full min-h-0 flex-col",
1667
+ children: [
1668
+ /* @__PURE__ */ jsxs12("div", { className: "flex shrink-0 flex-wrap items-center gap-2 border-b border-border px-3 py-2", children: [
1669
+ /* @__PURE__ */ jsx13(TabsList2, { variant: "line", className: "min-w-0 flex-wrap group-data-horizontal/tabs:h-auto", children: tabs.map((s) => /* @__PURE__ */ jsx13(TabsTrigger2, { value: s.id, "data-gallery-tab": s.id, children: s.title }, s.id)) }),
1670
+ /* @__PURE__ */ jsxs12("div", { className: "ml-auto flex items-center gap-2", children: [
1671
+ /* @__PURE__ */ jsxs12(
1672
+ Select2,
1673
+ {
1674
+ value: palette.id,
1675
+ onValueChange: (v) => {
1676
+ const p = paletteById(String(v));
1677
+ if (p) choice.setPalette(p);
1678
+ },
1679
+ items: PALETTES2.map((p) => ({ value: p.id, label: p.name })),
1680
+ children: [
1681
+ /* @__PURE__ */ jsx13(SelectTrigger2, { size: "sm", "aria-label": "Palette", children: /* @__PURE__ */ jsx13(SelectValue2, {}) }),
1682
+ /* @__PURE__ */ jsx13(SelectContent2, { children: PALETTES2.map((p) => /* @__PURE__ */ jsx13(SelectItem2, { value: p.id, children: p.name }, p.id)) })
1683
+ ]
1684
+ }
1685
+ ),
1686
+ /* @__PURE__ */ jsxs12(
1687
+ ToggleGroup2,
1688
+ {
1689
+ size: "sm",
1690
+ spacing: 0,
1691
+ value: [type],
1692
+ onValueChange: (v) => v[0] && choice.setType(v[0]),
1693
+ children: [
1694
+ /* @__PURE__ */ jsx13(ToggleGroupItem2, { value: "mixed", "aria-label": "Mono chrome, sans body", children: "Mixed" }),
1695
+ /* @__PURE__ */ jsx13(ToggleGroupItem2, { value: "mono", "aria-label": "Mono everywhere", children: "Mono" })
1696
+ ]
1697
+ }
1698
+ )
1699
+ ] })
1700
+ ] }),
1701
+ /* @__PURE__ */ jsxs12("div", { className: "min-h-0 flex-1 overflow-auto bg-muted/30", children: [
1702
+ draft && /* @__PURE__ */ jsx13(TabsContent2, { value: "draft", "data-gallery-section": "draft", className: "flex flex-col gap-6 p-4", children: /* @__PURE__ */ jsx13(Draft, { job: draft === true ? void 0 : draft }) }),
1703
+ SECTIONS.map((s) => /* @__PURE__ */ jsx13(TabsContent2, { value: s.id, "data-gallery-section": s.id, className: "flex flex-col gap-6 p-4", children: /* @__PURE__ */ jsx13(s.draw, {}) }, s.id))
1704
+ ] })
1705
+ ]
1706
+ }
1707
+ ) }) });
1708
+ }
1709
+ function remembered(key) {
1710
+ const fromURL = new URLSearchParams(window.location.search).get(key);
1711
+ if (fromURL) return fromURL;
1712
+ try {
1713
+ return localStorage.getItem(`surface.gallery.${key}`) ?? void 0;
1714
+ } catch {
1715
+ return void 0;
1716
+ }
1717
+ }
1718
+ function remember(key, value) {
1719
+ try {
1720
+ localStorage.setItem(`surface.gallery.${key}`, value);
1721
+ } catch {
1722
+ }
1723
+ }
1724
+
1725
+ // ../../web/src/gallery/index.ts
1726
+ var galleryViews = { "surface/gallery": Gallery };
1727
+ export {
1728
+ Gallery,
1729
+ galleryViews
1730
+ };