@silvery/examples 0.17.3 → 0.17.4

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