@silvery/examples 0.17.3 → 0.17.5

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 (111) hide show
  1. package/dist/UPNG-ShUlaTDh.mjs +5074 -0
  2. package/dist/__vite-browser-external-2447137e-Bopa5BFR.mjs +4 -0
  3. package/dist/_banner-A70_y2Vi.mjs +43 -0
  4. package/dist/ansi-0VXlUmNn.mjs +16397 -0
  5. package/dist/apng-B0gRaDVT.mjs +3 -0
  6. package/dist/apng-BTRDTfDW.mjs +68 -0
  7. package/dist/apps/aichat/index.mjs +1298 -0
  8. package/dist/apps/app-todo.mjs +138 -0
  9. package/dist/apps/async-data.mjs +203 -0
  10. package/dist/apps/cli-wizard.mjs +338 -0
  11. package/dist/apps/clipboard.mjs +197 -0
  12. package/dist/apps/components.mjs +863 -0
  13. package/dist/apps/data-explorer.mjs +482 -0
  14. package/dist/apps/dev-tools.mjs +396 -0
  15. package/dist/apps/explorer.mjs +697 -0
  16. package/dist/apps/gallery.mjs +765 -0
  17. package/dist/apps/inline-bench.mjs +115 -0
  18. package/dist/apps/kanban.mjs +279 -0
  19. package/dist/apps/layout-ref.mjs +186 -0
  20. package/dist/apps/outline.mjs +202 -0
  21. package/dist/apps/paste-demo.mjs +188 -0
  22. package/dist/apps/scroll.mjs +85 -0
  23. package/dist/apps/search-filter.mjs +286 -0
  24. package/dist/apps/selection.mjs +354 -0
  25. package/dist/apps/spatial-focus-demo.mjs +387 -0
  26. package/dist/apps/task-list.mjs +257 -0
  27. package/dist/apps/terminal-caps-demo.mjs +314 -0
  28. package/dist/apps/terminal.mjs +871 -0
  29. package/dist/apps/text-selection-demo.mjs +253 -0
  30. package/dist/apps/textarea.mjs +177 -0
  31. package/dist/apps/theme.mjs +660 -0
  32. package/dist/apps/transform.mjs +214 -0
  33. package/dist/apps/virtual-10k.mjs +421 -0
  34. package/dist/assets/resvgjs.darwin-arm64-BtufyGW1.node +0 -0
  35. package/dist/backends-Dj-11kZF.mjs +1179 -0
  36. package/dist/backends-U3QwStfO.mjs +3 -0
  37. package/dist/{cli.mjs → bin/cli.mjs} +15 -19
  38. package/dist/chunk-BSw8zbkd.mjs +37 -0
  39. package/dist/components/counter.mjs +47 -0
  40. package/dist/components/hello.mjs +30 -0
  41. package/dist/components/progress-bar.mjs +58 -0
  42. package/dist/components/select-list.mjs +84 -0
  43. package/dist/components/spinner.mjs +56 -0
  44. package/dist/components/text-input.mjs +61 -0
  45. package/dist/components/virtual-list.mjs +50 -0
  46. package/dist/flexily-zero-adapter-ByVzLTFP.mjs +3374 -0
  47. package/dist/gif-B6NGH5gs.mjs +3 -0
  48. package/dist/gif-CfkOF-iG.mjs +71 -0
  49. package/dist/gifenc-BI4ihP_T.mjs +728 -0
  50. package/dist/key-mapping-5oYQdAQE.mjs +3 -0
  51. package/dist/key-mapping-D4LR1go6.mjs +130 -0
  52. package/dist/layout/dashboard.mjs +1203 -0
  53. package/dist/layout/live-resize.mjs +302 -0
  54. package/dist/layout/overflow.mjs +69 -0
  55. package/dist/layout/text-layout.mjs +334 -0
  56. package/dist/node-nsrAOjH4.mjs +1083 -0
  57. package/dist/plugins-CT0DdV_E.mjs +3056 -0
  58. package/dist/resvg-js-Cnk2o49d.mjs +201 -0
  59. package/dist/src-9ZhfQyzD.mjs +814 -0
  60. package/dist/src-CUUOuRH6.mjs +5322 -0
  61. package/dist/src-jO3Zuzjj.mjs +23538 -0
  62. package/dist/usingCtx-CsEf0xO3.mjs +57 -0
  63. package/dist/yoga-adapter-BSQHuMV9.mjs +237 -0
  64. package/package.json +21 -14
  65. package/_banner.tsx +0 -60
  66. package/apps/aichat/components.tsx +0 -469
  67. package/apps/aichat/index.tsx +0 -220
  68. package/apps/aichat/script.ts +0 -460
  69. package/apps/aichat/state.ts +0 -325
  70. package/apps/aichat/types.ts +0 -19
  71. package/apps/app-todo.tsx +0 -201
  72. package/apps/async-data.tsx +0 -196
  73. package/apps/cli-wizard.tsx +0 -332
  74. package/apps/clipboard.tsx +0 -183
  75. package/apps/components.tsx +0 -658
  76. package/apps/data-explorer.tsx +0 -490
  77. package/apps/dev-tools.tsx +0 -395
  78. package/apps/explorer.tsx +0 -731
  79. package/apps/gallery.tsx +0 -653
  80. package/apps/inline-bench.tsx +0 -138
  81. package/apps/kanban.tsx +0 -265
  82. package/apps/layout-ref.tsx +0 -173
  83. package/apps/outline.tsx +0 -160
  84. package/apps/panes/index.tsx +0 -203
  85. package/apps/paste-demo.tsx +0 -185
  86. package/apps/scroll.tsx +0 -80
  87. package/apps/search-filter.tsx +0 -240
  88. package/apps/selection.tsx +0 -346
  89. package/apps/spatial-focus-demo.tsx +0 -372
  90. package/apps/task-list.tsx +0 -271
  91. package/apps/terminal-caps-demo.tsx +0 -317
  92. package/apps/terminal.tsx +0 -784
  93. package/apps/text-selection-demo.tsx +0 -193
  94. package/apps/textarea.tsx +0 -155
  95. package/apps/theme.tsx +0 -515
  96. package/apps/transform.tsx +0 -229
  97. package/apps/virtual-10k.tsx +0 -405
  98. package/apps/vterm-demo/index.tsx +0 -216
  99. package/components/counter.tsx +0 -49
  100. package/components/hello.tsx +0 -38
  101. package/components/progress-bar.tsx +0 -52
  102. package/components/select-list.tsx +0 -54
  103. package/components/spinner.tsx +0 -44
  104. package/components/text-input.tsx +0 -61
  105. package/components/virtual-list.tsx +0 -56
  106. package/dist/cli.d.mts +0 -1
  107. package/dist/cli.mjs.map +0 -1
  108. package/layout/dashboard.tsx +0 -953
  109. package/layout/live-resize.tsx +0 -282
  110. package/layout/overflow.tsx +0 -51
  111. package/layout/text-layout.tsx +0 -283
@@ -0,0 +1,660 @@
1
+ import { d as ansi16LightTheme, f as builtinPalettes, h as deriveTheme, t as init_src, u as ansi16DarkTheme } from "../src-CUUOuRH6.mjs";
2
+ import { t as _usingCtx } from "../usingCtx-CsEf0xO3.mjs";
3
+ import { t as ExampleBanner } from "../_banner-A70_y2Vi.mjs";
4
+ import { useState } from "react";
5
+ import { Badge, Blockquote, Box, Code, Divider, H1, H2, H3, Kbd, Lead, Link, Muted, P, ProgressBar, Small, Spinner, Strong, Text, ThemeProvider, Toggle, createTerm, detectTheme, render, useApp, useInput } from "silvery";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ //#region apps/theme.tsx
8
+ /**
9
+ * Theme Explorer Example
10
+ *
11
+ * Browse all built-in palettes with live color preview.
12
+ * First entry is always the detected terminal theme.
13
+ * Left panel: scrollable list with mini color swatches.
14
+ * Right panel: live preview wrapped in ThemeProvider showing
15
+ * semantic tokens, ANSI 16-color table, surfaces, components, and typography.
16
+ */
17
+ init_src();
18
+ const meta = {
19
+ name: "Theme Explorer",
20
+ description: "Browse built-in palettes with live color preview",
21
+ demo: true,
22
+ features: [
23
+ "ThemeProvider",
24
+ "builtinThemes",
25
+ "detectTheme",
26
+ "semantic tokens",
27
+ "components"
28
+ ]
29
+ };
30
+ let allEntries = [];
31
+ /** Small color swatch: 2 colored block chars */
32
+ function Swatch({ color }) {
33
+ return /* @__PURE__ */ jsx(Text, {
34
+ color,
35
+ children: "██"
36
+ });
37
+ }
38
+ /** Mini swatch: 4 colored blocks showing palette character */
39
+ function MiniSwatch({ palette }) {
40
+ return /* @__PURE__ */ jsxs(Text, { children: [
41
+ /* @__PURE__ */ jsx(Text, {
42
+ color: palette.red,
43
+ children: "█"
44
+ }),
45
+ /* @__PURE__ */ jsx(Text, {
46
+ color: palette.green,
47
+ children: "█"
48
+ }),
49
+ /* @__PURE__ */ jsx(Text, {
50
+ color: palette.blue,
51
+ children: "█"
52
+ }),
53
+ /* @__PURE__ */ jsx(Text, {
54
+ color: palette.yellow,
55
+ children: "█"
56
+ })
57
+ ] });
58
+ }
59
+ /** Mini swatch from theme tokens (for detected theme without a palette) */
60
+ function ThemeMiniSwatch({ theme }) {
61
+ return /* @__PURE__ */ jsxs(Text, { children: [
62
+ /* @__PURE__ */ jsx(Text, {
63
+ color: theme.error,
64
+ children: "█"
65
+ }),
66
+ /* @__PURE__ */ jsx(Text, {
67
+ color: theme.success,
68
+ children: "█"
69
+ }),
70
+ /* @__PURE__ */ jsx(Text, {
71
+ color: theme.info,
72
+ children: "█"
73
+ }),
74
+ /* @__PURE__ */ jsx(Text, {
75
+ color: theme.primary,
76
+ children: "█"
77
+ })
78
+ ] });
79
+ }
80
+ /** Left panel: theme list with color swatches */
81
+ function ThemeList({ entries, selectedIndex }) {
82
+ return /* @__PURE__ */ jsxs(Box, {
83
+ flexDirection: "column",
84
+ width: 30,
85
+ borderStyle: "single",
86
+ overflow: "scroll",
87
+ scrollTo: selectedIndex,
88
+ children: [
89
+ /* @__PURE__ */ jsxs(Box, {
90
+ paddingX: 1,
91
+ children: [/* @__PURE__ */ jsx(Text, {
92
+ bold: true,
93
+ color: "$primary",
94
+ children: "Palettes"
95
+ }), /* @__PURE__ */ jsxs(Muted, { children: [
96
+ " (",
97
+ entries.length,
98
+ ")"
99
+ ] })]
100
+ }),
101
+ /* @__PURE__ */ jsx(Divider, {}),
102
+ /* @__PURE__ */ jsx(Box, {
103
+ flexDirection: "column",
104
+ paddingX: 1,
105
+ children: entries.map((entry, i) => {
106
+ const isSelected = i === selectedIndex;
107
+ return /* @__PURE__ */ jsxs(Box, { children: [
108
+ /* @__PURE__ */ jsxs(Text, {
109
+ inverse: isSelected,
110
+ children: [
111
+ isSelected ? "▸" : " ",
112
+ " ",
113
+ entry.name.padEnd(18)
114
+ ]
115
+ }),
116
+ /* @__PURE__ */ jsx(Text, { children: " " }),
117
+ entry.palette ? /* @__PURE__ */ jsx(MiniSwatch, { palette: entry.palette }) : /* @__PURE__ */ jsx(ThemeMiniSwatch, { theme: entry.theme })
118
+ ] }, entry.name);
119
+ })
120
+ })
121
+ ]
122
+ });
123
+ }
124
+ /** Semantic token showcase row */
125
+ function SemanticTokens() {
126
+ return /* @__PURE__ */ jsxs(Box, {
127
+ flexDirection: "column",
128
+ children: [/* @__PURE__ */ jsx(H2, { children: "Semantic Tokens" }), /* @__PURE__ */ jsx(Box, {
129
+ flexDirection: "row",
130
+ flexWrap: "wrap",
131
+ gap: 1,
132
+ paddingX: 1,
133
+ children: [
134
+ {
135
+ name: "primary",
136
+ token: "$primary",
137
+ icon: "●"
138
+ },
139
+ {
140
+ name: "success",
141
+ token: "$success",
142
+ icon: "✓"
143
+ },
144
+ {
145
+ name: "warning",
146
+ token: "$warning",
147
+ icon: "⚠"
148
+ },
149
+ {
150
+ name: "error",
151
+ token: "$error",
152
+ icon: "✗"
153
+ },
154
+ {
155
+ name: "info",
156
+ token: "$info",
157
+ icon: "ℹ"
158
+ },
159
+ {
160
+ name: "accent",
161
+ token: "$accent",
162
+ icon: "◆"
163
+ },
164
+ {
165
+ name: "muted",
166
+ token: "$muted",
167
+ icon: "○"
168
+ },
169
+ {
170
+ name: "link",
171
+ token: "$link",
172
+ icon: "🔗"
173
+ }
174
+ ].map((t) => /* @__PURE__ */ jsxs(Text, {
175
+ color: t.token,
176
+ children: [
177
+ t.icon,
178
+ " ",
179
+ t.name
180
+ ]
181
+ }, t.name))
182
+ })]
183
+ });
184
+ }
185
+ /** ANSI 16-color table */
186
+ function AnsiColorTable({ palette }) {
187
+ const normal = [
188
+ palette.black,
189
+ palette.red,
190
+ palette.green,
191
+ palette.yellow,
192
+ palette.blue,
193
+ palette.magenta,
194
+ palette.cyan,
195
+ palette.white
196
+ ];
197
+ const bright = [
198
+ palette.brightBlack,
199
+ palette.brightRed,
200
+ palette.brightGreen,
201
+ palette.brightYellow,
202
+ palette.brightBlue,
203
+ palette.brightMagenta,
204
+ palette.brightCyan,
205
+ palette.brightWhite
206
+ ];
207
+ return /* @__PURE__ */ jsxs(Box, {
208
+ flexDirection: "column",
209
+ children: [
210
+ /* @__PURE__ */ jsx(H2, { children: "ANSI 16 Colors" }),
211
+ /* @__PURE__ */ jsx(Box, {
212
+ paddingX: 1,
213
+ gap: 1,
214
+ children: /* @__PURE__ */ jsxs(Box, { children: [/* @__PURE__ */ jsx(Muted, { children: "0-7 " }), normal.map((c, i) => /* @__PURE__ */ jsx(Swatch, { color: c }, i))] })
215
+ }),
216
+ /* @__PURE__ */ jsx(Box, {
217
+ paddingX: 1,
218
+ gap: 1,
219
+ children: /* @__PURE__ */ jsxs(Box, { children: [/* @__PURE__ */ jsx(Muted, { children: "8-15 " }), bright.map((c, i) => /* @__PURE__ */ jsx(Swatch, { color: c }, i))] })
220
+ })
221
+ ]
222
+ });
223
+ }
224
+ /** ANSI 16-color table from theme palette array (for detected theme) */
225
+ function ThemeAnsiColorTable({ palette }) {
226
+ const normal = palette.slice(0, 8);
227
+ const bright = palette.slice(8, 16);
228
+ return /* @__PURE__ */ jsxs(Box, {
229
+ flexDirection: "column",
230
+ children: [
231
+ /* @__PURE__ */ jsx(H2, { children: "ANSI 16 Colors" }),
232
+ /* @__PURE__ */ jsx(Box, {
233
+ paddingX: 1,
234
+ gap: 1,
235
+ children: /* @__PURE__ */ jsxs(Box, { children: [/* @__PURE__ */ jsx(Muted, { children: "0-7 " }), normal.map((c, i) => /* @__PURE__ */ jsx(Swatch, { color: c }, i))] })
236
+ }),
237
+ /* @__PURE__ */ jsx(Box, {
238
+ paddingX: 1,
239
+ gap: 1,
240
+ children: /* @__PURE__ */ jsxs(Box, { children: [/* @__PURE__ */ jsx(Muted, { children: "8-15 " }), bright.map((c, i) => /* @__PURE__ */ jsx(Swatch, { color: c }, i))] })
241
+ })
242
+ ]
243
+ });
244
+ }
245
+ /** Component showcase — real silvery components using theme tokens */
246
+ function ComponentShowcase() {
247
+ return /* @__PURE__ */ jsxs(Box, {
248
+ flexDirection: "column",
249
+ children: [/* @__PURE__ */ jsx(H2, { children: "Components" }), /* @__PURE__ */ jsxs(Box, {
250
+ flexDirection: "column",
251
+ paddingX: 1,
252
+ gap: 1,
253
+ children: [
254
+ /* @__PURE__ */ jsxs(Box, {
255
+ gap: 2,
256
+ children: [
257
+ /* @__PURE__ */ jsx(Link, {
258
+ href: "https://silvery.dev",
259
+ children: "silvery.dev"
260
+ }),
261
+ /* @__PURE__ */ jsx(Link, {
262
+ href: "https://example.com",
263
+ color: "$primary",
264
+ children: "primary link"
265
+ }),
266
+ /* @__PURE__ */ jsx(Link, {
267
+ href: "https://example.com",
268
+ dim: true,
269
+ children: "dim link"
270
+ })
271
+ ]
272
+ }),
273
+ /* @__PURE__ */ jsxs(Box, {
274
+ gap: 1,
275
+ flexWrap: "wrap",
276
+ children: [
277
+ /* @__PURE__ */ jsx(Badge, {
278
+ label: "default",
279
+ variant: "default"
280
+ }),
281
+ /* @__PURE__ */ jsx(Badge, {
282
+ label: "success",
283
+ variant: "success"
284
+ }),
285
+ /* @__PURE__ */ jsx(Badge, {
286
+ label: "error",
287
+ variant: "error"
288
+ }),
289
+ /* @__PURE__ */ jsx(Badge, {
290
+ label: "warning",
291
+ variant: "warning"
292
+ }),
293
+ /* @__PURE__ */ jsx(Badge, {
294
+ label: "primary",
295
+ variant: "primary"
296
+ })
297
+ ]
298
+ }),
299
+ /* @__PURE__ */ jsxs(Box, {
300
+ gap: 2,
301
+ children: [/* @__PURE__ */ jsxs(Box, {
302
+ gap: 1,
303
+ children: [/* @__PURE__ */ jsx(Muted, { children: "Progress:" }), /* @__PURE__ */ jsx(Box, {
304
+ width: 16,
305
+ children: /* @__PURE__ */ jsx(ProgressBar, { value: .65 })
306
+ })]
307
+ }), /* @__PURE__ */ jsxs(Box, {
308
+ gap: 1,
309
+ children: [/* @__PURE__ */ jsx(Spinner, {}), /* @__PURE__ */ jsx(Muted, { children: "Loading..." })]
310
+ })]
311
+ }),
312
+ /* @__PURE__ */ jsxs(Box, {
313
+ gap: 2,
314
+ children: [/* @__PURE__ */ jsx(Box, {
315
+ gap: 1,
316
+ children: /* @__PURE__ */ jsx(Toggle, {
317
+ value: true,
318
+ onChange: () => {},
319
+ label: "Enabled"
320
+ })
321
+ }), /* @__PURE__ */ jsx(Box, {
322
+ gap: 1,
323
+ children: /* @__PURE__ */ jsx(Toggle, {
324
+ value: false,
325
+ onChange: () => {},
326
+ label: "Disabled"
327
+ })
328
+ })]
329
+ }),
330
+ /* @__PURE__ */ jsxs(Box, {
331
+ borderStyle: "round",
332
+ paddingX: 1,
333
+ flexDirection: "column",
334
+ children: [
335
+ /* @__PURE__ */ jsx(Text, {
336
+ bold: true,
337
+ color: "$primary",
338
+ children: "Dialog Title"
339
+ }),
340
+ /* @__PURE__ */ jsx(Text, { children: "Body text with default colors." }),
341
+ /* @__PURE__ */ jsx(Muted, { children: "Muted secondary info" })
342
+ ]
343
+ }),
344
+ /* @__PURE__ */ jsx(Box, {
345
+ borderStyle: "single",
346
+ borderColor: "$inputborder",
347
+ paddingX: 1,
348
+ width: 30,
349
+ children: /* @__PURE__ */ jsx(Text, {
350
+ color: "$disabledfg",
351
+ children: "Search..."
352
+ })
353
+ }),
354
+ /* @__PURE__ */ jsx(Box, {
355
+ borderStyle: "single",
356
+ borderColor: "$focusborder",
357
+ paddingX: 1,
358
+ width: 30,
359
+ children: /* @__PURE__ */ jsx(Text, { children: "Focused input" })
360
+ })
361
+ ]
362
+ })]
363
+ });
364
+ }
365
+ /** Typography samples */
366
+ function TypographySamples() {
367
+ return /* @__PURE__ */ jsxs(Box, {
368
+ flexDirection: "column",
369
+ children: [/* @__PURE__ */ jsx(H2, { children: "Typography" }), /* @__PURE__ */ jsxs(Box, {
370
+ flexDirection: "column",
371
+ paddingX: 1,
372
+ children: [
373
+ /* @__PURE__ */ jsx(H1, { children: "Heading 1" }),
374
+ /* @__PURE__ */ jsx(H2, { children: "Heading 2" }),
375
+ /* @__PURE__ */ jsx(H3, { children: "Heading 3" }),
376
+ /* @__PURE__ */ jsx(Strong, { children: "Strong text" }),
377
+ /* @__PURE__ */ jsx(Lead, { children: "Lead text (italic)" }),
378
+ /* @__PURE__ */ jsx(P, { children: "Normal paragraph text" }),
379
+ /* @__PURE__ */ jsx(Muted, { children: "Muted text" }),
380
+ /* @__PURE__ */ jsx(Small, { children: "Small text" }),
381
+ /* @__PURE__ */ jsxs(Box, {
382
+ gap: 1,
383
+ children: [
384
+ /* @__PURE__ */ jsx(Kbd, { children: "Kbd" }),
385
+ /* @__PURE__ */ jsx(Kbd, { children: "⌘K" }),
386
+ /* @__PURE__ */ jsx(Kbd, { children: "Enter" })
387
+ ]
388
+ }),
389
+ /* @__PURE__ */ jsx(Code, { children: "inline code" }),
390
+ /* @__PURE__ */ jsx(Blockquote, { children: "Blockquote text" })
391
+ ]
392
+ })]
393
+ });
394
+ }
395
+ /** Surface pairs showcase */
396
+ function SurfacePairs() {
397
+ return /* @__PURE__ */ jsxs(Box, {
398
+ flexDirection: "column",
399
+ children: [/* @__PURE__ */ jsx(H2, { children: "Surfaces" }), /* @__PURE__ */ jsxs(Box, {
400
+ flexDirection: "column",
401
+ paddingX: 1,
402
+ gap: 0,
403
+ children: [
404
+ /* @__PURE__ */ jsxs(Box, {
405
+ gap: 1,
406
+ children: [
407
+ /* @__PURE__ */ jsx(Box, {
408
+ backgroundColor: "$surfacebg",
409
+ paddingX: 1,
410
+ children: /* @__PURE__ */ jsx(Text, {
411
+ color: "$surface",
412
+ children: "surface"
413
+ })
414
+ }),
415
+ /* @__PURE__ */ jsx(Box, {
416
+ backgroundColor: "$inversebg",
417
+ paddingX: 1,
418
+ children: /* @__PURE__ */ jsx(Text, {
419
+ color: "$inverse",
420
+ children: "inverse"
421
+ })
422
+ }),
423
+ /* @__PURE__ */ jsx(Box, {
424
+ backgroundColor: "$mutedbg",
425
+ paddingX: 1,
426
+ children: /* @__PURE__ */ jsx(Text, { children: "muted bg" })
427
+ })
428
+ ]
429
+ }),
430
+ /* @__PURE__ */ jsxs(Box, {
431
+ gap: 1,
432
+ children: [
433
+ /* @__PURE__ */ jsx(Box, {
434
+ backgroundColor: "$primary",
435
+ paddingX: 1,
436
+ children: /* @__PURE__ */ jsx(Text, {
437
+ color: "$primaryfg",
438
+ children: "primary"
439
+ })
440
+ }),
441
+ /* @__PURE__ */ jsx(Box, {
442
+ backgroundColor: "$error",
443
+ paddingX: 1,
444
+ children: /* @__PURE__ */ jsx(Text, {
445
+ color: "$errorfg",
446
+ children: "error"
447
+ })
448
+ }),
449
+ /* @__PURE__ */ jsx(Box, {
450
+ backgroundColor: "$success",
451
+ paddingX: 1,
452
+ children: /* @__PURE__ */ jsx(Text, {
453
+ color: "$successfg",
454
+ children: "success"
455
+ })
456
+ })
457
+ ]
458
+ }),
459
+ /* @__PURE__ */ jsxs(Box, {
460
+ gap: 1,
461
+ children: [
462
+ /* @__PURE__ */ jsx(Box, {
463
+ backgroundColor: "$selectionbg",
464
+ paddingX: 1,
465
+ children: /* @__PURE__ */ jsx(Text, {
466
+ color: "$selection",
467
+ children: "selection"
468
+ })
469
+ }),
470
+ /* @__PURE__ */ jsx(Box, {
471
+ backgroundColor: "$popoverbg",
472
+ paddingX: 1,
473
+ children: /* @__PURE__ */ jsx(Text, {
474
+ color: "$popover",
475
+ children: "popover"
476
+ })
477
+ }),
478
+ /* @__PURE__ */ jsx(Box, {
479
+ backgroundColor: "$accent",
480
+ paddingX: 1,
481
+ children: /* @__PURE__ */ jsx(Text, {
482
+ color: "$accentfg",
483
+ children: "accent"
484
+ })
485
+ })
486
+ ]
487
+ })
488
+ ]
489
+ })]
490
+ });
491
+ }
492
+ /** Contrast adjustments made during derivation */
493
+ function AdjustmentLog({ adjustments = [] }) {
494
+ if (adjustments.length === 0) return /* @__PURE__ */ jsxs(Box, {
495
+ flexDirection: "column",
496
+ children: [/* @__PURE__ */ jsx(H2, { children: "Contrast Adjustments" }), /* @__PURE__ */ jsx(Box, {
497
+ paddingX: 1,
498
+ children: /* @__PURE__ */ jsx(Text, {
499
+ color: "$success",
500
+ children: "✓ No adjustments needed — all tokens meet contrast targets"
501
+ })
502
+ })]
503
+ });
504
+ return /* @__PURE__ */ jsxs(Box, {
505
+ flexDirection: "column",
506
+ children: [/* @__PURE__ */ jsxs(H2, { children: [
507
+ "Contrast Adjustments (",
508
+ adjustments.length,
509
+ ")"
510
+ ] }), /* @__PURE__ */ jsx(Box, {
511
+ flexDirection: "column",
512
+ paddingX: 1,
513
+ children: adjustments.map((adj, i) => /* @__PURE__ */ jsxs(Box, {
514
+ gap: 1,
515
+ children: [
516
+ /* @__PURE__ */ jsx(Text, {
517
+ bold: true,
518
+ children: adj.token.padEnd(12)
519
+ }),
520
+ /* @__PURE__ */ jsx(Text, {
521
+ color: adj.from,
522
+ children: "██"
523
+ }),
524
+ /* @__PURE__ */ jsx(Muted, { children: "→" }),
525
+ /* @__PURE__ */ jsx(Text, {
526
+ color: adj.to,
527
+ children: "██"
528
+ }),
529
+ /* @__PURE__ */ jsxs(Muted, { children: [
530
+ adj.ratioBefore.toFixed(1),
531
+ "→",
532
+ adj.ratioAfter.toFixed(1),
533
+ ":1 (target ",
534
+ adj.target,
535
+ ":1)"
536
+ ] })
537
+ ]
538
+ }, i))
539
+ })]
540
+ });
541
+ }
542
+ /** Right panel: live preview wrapped in selected ThemeProvider */
543
+ function ThemePreview({ entry }) {
544
+ const label = entry.detected ? "(detected)" : entry.palette?.dark === false ? "(light)" : "(dark)";
545
+ return /* @__PURE__ */ jsx(ThemeProvider, {
546
+ theme: entry.theme,
547
+ children: /* @__PURE__ */ jsxs(Box, {
548
+ theme: entry.theme,
549
+ flexDirection: "column",
550
+ flexGrow: 1,
551
+ borderStyle: "single",
552
+ overflow: "scroll",
553
+ children: [
554
+ /* @__PURE__ */ jsxs(Box, {
555
+ paddingX: 1,
556
+ gap: 1,
557
+ children: [/* @__PURE__ */ jsx(H1, { children: entry.name }), /* @__PURE__ */ jsx(Muted, { children: label })]
558
+ }),
559
+ /* @__PURE__ */ jsx(Divider, {}),
560
+ /* @__PURE__ */ jsxs(Box, {
561
+ flexDirection: "column",
562
+ gap: 1,
563
+ children: [
564
+ /* @__PURE__ */ jsx(SemanticTokens, {}),
565
+ entry.palette ? /* @__PURE__ */ jsx(AnsiColorTable, { palette: entry.palette }) : /* @__PURE__ */ jsx(ThemeAnsiColorTable, { palette: entry.theme.palette }),
566
+ /* @__PURE__ */ jsx(SurfacePairs, {}),
567
+ /* @__PURE__ */ jsx(ComponentShowcase, {}),
568
+ /* @__PURE__ */ jsx(TypographySamples, {}),
569
+ /* @__PURE__ */ jsx(AdjustmentLog, { adjustments: entry.adjustments })
570
+ ]
571
+ })
572
+ ]
573
+ })
574
+ });
575
+ }
576
+ function HelpBar() {
577
+ return /* @__PURE__ */ jsxs(Muted, { children: [
578
+ " ",
579
+ /* @__PURE__ */ jsx(Kbd, { children: "j/k" }),
580
+ " navigate ",
581
+ /* @__PURE__ */ jsx(Kbd, { children: "Esc/q" }),
582
+ " quit"
583
+ ] });
584
+ }
585
+ function ThemeExplorer({ entries }) {
586
+ const { exit } = useApp();
587
+ const [selectedIndex, setSelectedIndex] = useState(0);
588
+ useInput((input, key) => {
589
+ if (input === "q" || key.escape) exit();
590
+ if (key.downArrow || input === "j") setSelectedIndex((i) => Math.min(i + 1, entries.length - 1));
591
+ if (key.upArrow || input === "k") setSelectedIndex((i) => Math.max(i - 1, 0));
592
+ });
593
+ const entry = entries[selectedIndex];
594
+ return /* @__PURE__ */ jsxs(Box, {
595
+ flexDirection: "column",
596
+ height: "100%",
597
+ padding: 1,
598
+ children: [/* @__PURE__ */ jsxs(Box, {
599
+ flexGrow: 1,
600
+ flexDirection: "row",
601
+ gap: 1,
602
+ overflow: "hidden",
603
+ children: [/* @__PURE__ */ jsx(ThemeList, {
604
+ entries,
605
+ selectedIndex
606
+ }), /* @__PURE__ */ jsx(ThemePreview, { entry })]
607
+ }), /* @__PURE__ */ jsx(HelpBar, {})]
608
+ });
609
+ }
610
+ async function main() {
611
+ try {
612
+ var _usingCtx$1 = _usingCtx();
613
+ const detectedTheme = await detectTheme();
614
+ const builtinEntries = Object.entries(builtinPalettes).map(([name, palette]) => {
615
+ const adjustments = [];
616
+ return {
617
+ name,
618
+ palette,
619
+ theme: deriveTheme(palette, "truecolor", adjustments),
620
+ adjustments
621
+ };
622
+ });
623
+ allEntries = [
624
+ {
625
+ name: "Detected",
626
+ palette: null,
627
+ theme: detectedTheme,
628
+ adjustments: [],
629
+ detected: true
630
+ },
631
+ {
632
+ name: "ANSI 16 Dark",
633
+ palette: null,
634
+ theme: ansi16DarkTheme,
635
+ adjustments: []
636
+ },
637
+ {
638
+ name: "ANSI 16 Light",
639
+ palette: null,
640
+ theme: ansi16LightTheme,
641
+ adjustments: []
642
+ },
643
+ ...builtinEntries
644
+ ];
645
+ const term = _usingCtx$1.u(createTerm());
646
+ const { waitUntilExit } = await render(/* @__PURE__ */ jsx(ExampleBanner, {
647
+ meta,
648
+ controls: "j/k navigate Esc/q quit",
649
+ children: /* @__PURE__ */ jsx(ThemeExplorer, { entries: allEntries })
650
+ }), term);
651
+ await waitUntilExit();
652
+ } catch (_) {
653
+ _usingCtx$1.e = _;
654
+ } finally {
655
+ _usingCtx$1.d();
656
+ }
657
+ }
658
+ if (import.meta.main) await main();
659
+ //#endregion
660
+ export { ThemeExplorer, main, meta };