@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,863 @@
1
+ import { t as _usingCtx } from "../usingCtx-CsEf0xO3.mjs";
2
+ import { t as ExampleBanner } from "../_banner-A70_y2Vi.mjs";
3
+ import { useCallback, useState } from "react";
4
+ import { Blockquote, Box, Button, Code, CodeBlock, Em, H1, H2, H3, HR, Kbd, LI, Lead, ModalDialog, Muted, OL, P, ProgressBar, SelectList, Small, Spinner, Strong, Text, TextArea, TextInput, Toggle, UL, createTerm, render, useApp, useInput } from "silvery";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ //#region apps/components.tsx
7
+ /**
8
+ * Components Showcase
9
+ *
10
+ * A UI component gallery demonstrating silvery's built-in components:
11
+ * - Typography: H1-H3, Strong, Muted, Small, Lead, Code, Blockquote, lists
12
+ * - Inputs: TextInput, TextArea, SelectList, Toggle with focus cycling
13
+ * - Display: ProgressBar, Spinner, Badge, border styles, ModalDialog
14
+ */
15
+ const meta = {
16
+ name: "Components",
17
+ description: "UI component gallery with typography, inputs, and dialogs",
18
+ demo: true,
19
+ features: [
20
+ "Typography",
21
+ "TextInput",
22
+ "SelectList",
23
+ "ModalDialog",
24
+ "ProgressBar",
25
+ "focus ring"
26
+ ]
27
+ };
28
+ function TypographyTab({ scrollOffset }) {
29
+ return /* @__PURE__ */ jsxs(Box, {
30
+ flexDirection: "column",
31
+ gap: 1,
32
+ paddingX: 1,
33
+ overflow: "scroll",
34
+ scrollOffset,
35
+ flexGrow: 1,
36
+ children: [
37
+ /* @__PURE__ */ jsxs(Box, {
38
+ flexDirection: "column",
39
+ children: [/* @__PURE__ */ jsx(H1, { children: "Getting Started with Silvery" }), /* @__PURE__ */ jsx(Lead, { children: "Build modern terminal UIs with React — layout feedback, semantic theming, and 30+ components." })]
40
+ }),
41
+ /* @__PURE__ */ jsx(HR, {}),
42
+ /* @__PURE__ */ jsxs(Box, {
43
+ flexDirection: "row",
44
+ gap: 2,
45
+ children: [/* @__PURE__ */ jsxs(Box, {
46
+ flexDirection: "column",
47
+ flexGrow: 1,
48
+ flexBasis: 0,
49
+ children: [/* @__PURE__ */ jsx(H2, { children: "Typography" }), /* @__PURE__ */ jsxs(Box, {
50
+ flexDirection: "column",
51
+ children: [
52
+ /* @__PURE__ */ jsx(Text, {
53
+ bold: true,
54
+ color: "$primary",
55
+ children: "H1 — Page Title (bold, $primary)"
56
+ }),
57
+ /* @__PURE__ */ jsx(Text, {
58
+ bold: true,
59
+ color: "$accent",
60
+ children: "H2 — Section Heading (bold, $accent)"
61
+ }),
62
+ /* @__PURE__ */ jsx(Text, {
63
+ color: "$primary",
64
+ children: "H3 — Group Heading ($primary)"
65
+ }),
66
+ /* @__PURE__ */ jsx(P, { children: "P — Body paragraph text" }),
67
+ /* @__PURE__ */ jsx(Lead, { children: "Lead — Introductory italic text" }),
68
+ /* @__PURE__ */ jsx(Muted, { children: "Muted — Secondary information" }),
69
+ /* @__PURE__ */ jsx(Small, { children: "Small — Fine print and captions" })
70
+ ]
71
+ })]
72
+ }), /* @__PURE__ */ jsxs(Box, {
73
+ flexDirection: "column",
74
+ flexGrow: 1,
75
+ flexBasis: 0,
76
+ children: [/* @__PURE__ */ jsx(H2, { children: "Inline Styles" }), /* @__PURE__ */ jsxs(Box, {
77
+ flexDirection: "column",
78
+ children: [
79
+ /* @__PURE__ */ jsxs(Text, { children: [/* @__PURE__ */ jsx(Strong, { children: "Strong" }), " — bold emphasis"] }),
80
+ /* @__PURE__ */ jsxs(Text, { children: [/* @__PURE__ */ jsx(Em, { children: "Em" }), " — italic emphasis"] }),
81
+ /* @__PURE__ */ jsxs(Text, { children: [
82
+ /* @__PURE__ */ jsx(Strong, { children: /* @__PURE__ */ jsx(Em, { children: "Strong + Em" }) }),
83
+ " ",
84
+ "— bold italic"
85
+ ] }),
86
+ /* @__PURE__ */ jsxs(Text, { children: [/* @__PURE__ */ jsx(Text, {
87
+ underline: true,
88
+ children: "Underline"
89
+ }), " — underlined text"] }),
90
+ /* @__PURE__ */ jsxs(Text, { children: [/* @__PURE__ */ jsx(Text, {
91
+ strikethrough: true,
92
+ children: "Strikethrough"
93
+ }), " — deleted text"] }),
94
+ /* @__PURE__ */ jsxs(Text, { children: [/* @__PURE__ */ jsx(Code, { children: "Code" }), " — inline code span"] }),
95
+ /* @__PURE__ */ jsxs(Text, { children: [/* @__PURE__ */ jsx(Kbd, { children: "Kbd" }), " — keyboard shortcut"] })
96
+ ]
97
+ })]
98
+ })]
99
+ }),
100
+ /* @__PURE__ */ jsx(HR, {}),
101
+ /* @__PURE__ */ jsx(H2, { children: "Semantic Colors" }),
102
+ /* @__PURE__ */ jsxs(Box, {
103
+ flexDirection: "column",
104
+ children: [/* @__PURE__ */ jsxs(Box, {
105
+ gap: 1,
106
+ children: [
107
+ /* @__PURE__ */ jsx(Text, {
108
+ backgroundColor: "$primary",
109
+ color: "$primary-fg",
110
+ bold: true,
111
+ children: " $primary "
112
+ }),
113
+ /* @__PURE__ */ jsx(Text, {
114
+ backgroundColor: "$accent",
115
+ color: "$accent-fg",
116
+ bold: true,
117
+ children: " $accent "
118
+ }),
119
+ /* @__PURE__ */ jsx(Text, {
120
+ backgroundColor: "$success",
121
+ color: "$success-fg",
122
+ bold: true,
123
+ children: " $success "
124
+ }),
125
+ /* @__PURE__ */ jsx(Text, {
126
+ backgroundColor: "$warning",
127
+ color: "$warning-fg",
128
+ bold: true,
129
+ children: " $warning "
130
+ }),
131
+ /* @__PURE__ */ jsx(Text, {
132
+ backgroundColor: "$error",
133
+ color: "$error-fg",
134
+ bold: true,
135
+ children: " $error "
136
+ })
137
+ ]
138
+ }), /* @__PURE__ */ jsxs(Box, {
139
+ gap: 1,
140
+ marginTop: 1,
141
+ children: [
142
+ /* @__PURE__ */ jsxs(Text, {
143
+ color: "$primary",
144
+ children: ["████", " primary"]
145
+ }),
146
+ /* @__PURE__ */ jsxs(Text, {
147
+ color: "$accent",
148
+ children: ["████", " accent"]
149
+ }),
150
+ /* @__PURE__ */ jsxs(Text, {
151
+ color: "$success",
152
+ children: ["████", " success"]
153
+ }),
154
+ /* @__PURE__ */ jsxs(Text, {
155
+ color: "$warning",
156
+ children: ["████", " warning"]
157
+ }),
158
+ /* @__PURE__ */ jsxs(Text, {
159
+ color: "$error",
160
+ children: ["████", " error"]
161
+ }),
162
+ /* @__PURE__ */ jsxs(Text, {
163
+ color: "$muted",
164
+ children: ["████", " muted"]
165
+ })
166
+ ]
167
+ })]
168
+ }),
169
+ /* @__PURE__ */ jsx(HR, {}),
170
+ /* @__PURE__ */ jsx(H2, { children: "Block Elements" }),
171
+ /* @__PURE__ */ jsx(Blockquote, { children: "The best color code is no color code — most components already use the right semantic tokens." }),
172
+ /* @__PURE__ */ jsx(CodeBlock, { children: "bun add silvery # install\nbun run dev # start dev server" }),
173
+ /* @__PURE__ */ jsx(H2, { children: "Lists" }),
174
+ /* @__PURE__ */ jsxs(Box, {
175
+ flexDirection: "row",
176
+ gap: 4,
177
+ children: [/* @__PURE__ */ jsxs(Box, {
178
+ flexDirection: "column",
179
+ flexGrow: 1,
180
+ flexBasis: 0,
181
+ children: [/* @__PURE__ */ jsx(H3, { children: "Unordered" }), /* @__PURE__ */ jsxs(UL, { children: [
182
+ /* @__PURE__ */ jsxs(LI, { children: [/* @__PURE__ */ jsx(Strong, { children: "SelectList" }), " — j/k navigation, scroll"] }),
183
+ /* @__PURE__ */ jsxs(LI, { children: [/* @__PURE__ */ jsx(Strong, { children: "TextInput" }), " — full readline support"] }),
184
+ /* @__PURE__ */ jsxs(LI, { children: [/* @__PURE__ */ jsx(Strong, { children: "ModalDialog" }), " — overlay with input blocking"] }),
185
+ /* @__PURE__ */ jsxs(LI, { children: [/* @__PURE__ */ jsx(Strong, { children: "ProgressBar" }), " — determinate + indeterminate"] })
186
+ ] })]
187
+ }), /* @__PURE__ */ jsxs(Box, {
188
+ flexDirection: "column",
189
+ flexGrow: 1,
190
+ flexBasis: 0,
191
+ children: [/* @__PURE__ */ jsx(H3, { children: "Ordered" }), /* @__PURE__ */ jsxs(OL, { children: [
192
+ /* @__PURE__ */ jsxs(LI, { children: ["Install with ", /* @__PURE__ */ jsx(Code, { children: "bun add silvery" })] }),
193
+ /* @__PURE__ */ jsxs(LI, { children: [
194
+ "Use ",
195
+ /* @__PURE__ */ jsx(Code, { children: "$tokens" }),
196
+ " for semantic colors"
197
+ ] }),
198
+ /* @__PURE__ */ jsxs(LI, { children: [
199
+ "Layout with ",
200
+ /* @__PURE__ */ jsx(Code, { children: "flexbox" }),
201
+ " via Flexily"
202
+ ] }),
203
+ /* @__PURE__ */ jsxs(LI, { children: ["Test with ", /* @__PURE__ */ jsx(Code, { children: "createTermless()" })] })
204
+ ] })]
205
+ })]
206
+ }),
207
+ /* @__PURE__ */ jsx(Small, { children: "silvery v0.0.1 — 38 palettes, 30+ components — silvery.dev" })
208
+ ]
209
+ });
210
+ }
211
+ const frameworkItems = [
212
+ {
213
+ label: "Silvery",
214
+ value: "silvery"
215
+ },
216
+ {
217
+ label: "Ink",
218
+ value: "ink"
219
+ },
220
+ {
221
+ label: "Blessed",
222
+ value: "blessed",
223
+ disabled: true
224
+ },
225
+ {
226
+ label: "Terminal Kit",
227
+ value: "terminal-kit"
228
+ },
229
+ {
230
+ label: "React Curse",
231
+ value: "react-curse"
232
+ }
233
+ ];
234
+ function InputsTab() {
235
+ const [textValue, setTextValue] = useState("");
236
+ const [areaValue, setAreaValue] = useState("");
237
+ const [selectedFramework, setSelectedFramework] = useState(0);
238
+ const [darkMode, setDarkMode] = useState(true);
239
+ const [notifications, setNotifications] = useState(false);
240
+ const [autoSave, setAutoSave] = useState(true);
241
+ const [focusIndex, setFocusIndex] = useState(0);
242
+ const focusableCount = 5;
243
+ useInput((_input, key) => {
244
+ if (key.tab && !key.shift) setFocusIndex((prev) => (prev + 1) % focusableCount);
245
+ if (key.tab && key.shift) setFocusIndex((prev) => (prev - 1 + focusableCount) % focusableCount);
246
+ });
247
+ const resetAll = useCallback(() => {
248
+ setTextValue("");
249
+ setAreaValue("");
250
+ setSelectedFramework(0);
251
+ setDarkMode(true);
252
+ setNotifications(false);
253
+ setAutoSave(true);
254
+ }, []);
255
+ return /* @__PURE__ */ jsx(Box, {
256
+ flexDirection: "column",
257
+ gap: 1,
258
+ paddingX: 1,
259
+ overflow: "scroll",
260
+ flexGrow: 1,
261
+ children: /* @__PURE__ */ jsxs(Box, {
262
+ flexDirection: "row",
263
+ gap: 2,
264
+ flexGrow: 1,
265
+ children: [/* @__PURE__ */ jsxs(Box, {
266
+ flexDirection: "column",
267
+ gap: 1,
268
+ flexGrow: 1,
269
+ flexBasis: 0,
270
+ children: [
271
+ /* @__PURE__ */ jsx(H2, { children: "Text Input" }),
272
+ /* @__PURE__ */ jsx(TextInput, {
273
+ value: textValue,
274
+ onChange: setTextValue,
275
+ onSubmit: () => setTextValue(""),
276
+ placeholder: "Type something...",
277
+ prompt: "search: ",
278
+ borderStyle: "round",
279
+ isActive: focusIndex === 0
280
+ }),
281
+ /* @__PURE__ */ jsx(H2, { children: "Text Area" }),
282
+ /* @__PURE__ */ jsx(TextArea, {
283
+ value: areaValue,
284
+ onChange: setAreaValue,
285
+ placeholder: "Write your thoughts...",
286
+ height: 4,
287
+ borderStyle: "round",
288
+ isActive: focusIndex === 1
289
+ }),
290
+ /* @__PURE__ */ jsx(H2, { children: "Select List" }),
291
+ /* @__PURE__ */ jsx(Box, {
292
+ borderStyle: "round",
293
+ borderColor: focusIndex === 2 ? "$focusborder" : "$border",
294
+ paddingX: 1,
295
+ children: /* @__PURE__ */ jsx(SelectList, {
296
+ items: frameworkItems,
297
+ highlightedIndex: selectedFramework,
298
+ onHighlight: setSelectedFramework,
299
+ isActive: focusIndex === 2
300
+ })
301
+ })
302
+ ]
303
+ }), /* @__PURE__ */ jsxs(Box, {
304
+ flexDirection: "column",
305
+ gap: 1,
306
+ flexGrow: 1,
307
+ flexBasis: 0,
308
+ children: [
309
+ /* @__PURE__ */ jsx(H2, { children: "Toggles" }),
310
+ /* @__PURE__ */ jsxs(Box, {
311
+ flexDirection: "column",
312
+ borderStyle: "round",
313
+ borderColor: focusIndex === 3 ? "$focusborder" : "$border",
314
+ paddingX: 1,
315
+ paddingY: 1,
316
+ gap: 1,
317
+ children: [
318
+ /* @__PURE__ */ jsx(Toggle, {
319
+ value: darkMode,
320
+ onChange: setDarkMode,
321
+ label: "Dark mode",
322
+ isActive: focusIndex === 3
323
+ }),
324
+ /* @__PURE__ */ jsx(Toggle, {
325
+ value: notifications,
326
+ onChange: setNotifications,
327
+ label: "Notifications",
328
+ isActive: false
329
+ }),
330
+ /* @__PURE__ */ jsx(Toggle, {
331
+ value: autoSave,
332
+ onChange: setAutoSave,
333
+ label: "Auto-save",
334
+ isActive: false
335
+ })
336
+ ]
337
+ }),
338
+ /* @__PURE__ */ jsx(H2, { children: "Button" }),
339
+ /* @__PURE__ */ jsx(Button, {
340
+ label: "Reset All",
341
+ onPress: resetAll,
342
+ isActive: focusIndex === 4
343
+ }),
344
+ /* @__PURE__ */ jsx(HR, {}),
345
+ /* @__PURE__ */ jsx(H2, { children: "Current Values" }),
346
+ /* @__PURE__ */ jsxs(Box, {
347
+ flexDirection: "column",
348
+ backgroundColor: "$surfacebg",
349
+ paddingX: 1,
350
+ paddingY: 1,
351
+ borderStyle: "round",
352
+ children: [
353
+ /* @__PURE__ */ jsxs(Text, {
354
+ color: "$surface",
355
+ children: [
356
+ /* @__PURE__ */ jsx(Strong, { children: "Text:" }),
357
+ " ",
358
+ textValue || /* @__PURE__ */ jsx(Muted, { children: "(empty)" })
359
+ ]
360
+ }),
361
+ /* @__PURE__ */ jsxs(Text, {
362
+ color: "$surface",
363
+ children: [
364
+ /* @__PURE__ */ jsx(Strong, { children: "Area:" }),
365
+ " ",
366
+ areaValue ? areaValue.split("\n")[0] + (areaValue.includes("\n") ? "..." : "") : /* @__PURE__ */ jsx(Muted, { children: "(empty)" })
367
+ ]
368
+ }),
369
+ /* @__PURE__ */ jsxs(Text, {
370
+ color: "$surface",
371
+ children: [
372
+ /* @__PURE__ */ jsx(Strong, { children: "Framework:" }),
373
+ " ",
374
+ frameworkItems[selectedFramework]?.label
375
+ ]
376
+ }),
377
+ /* @__PURE__ */ jsxs(Text, {
378
+ color: "$surface",
379
+ children: [
380
+ /* @__PURE__ */ jsx(Strong, { children: "Dark mode:" }),
381
+ " ",
382
+ darkMode ? "on" : "off"
383
+ ]
384
+ }),
385
+ /* @__PURE__ */ jsxs(Text, {
386
+ color: "$surface",
387
+ children: [
388
+ /* @__PURE__ */ jsx(Strong, { children: "Notifications:" }),
389
+ " ",
390
+ notifications ? "on" : "off"
391
+ ]
392
+ }),
393
+ /* @__PURE__ */ jsxs(Text, {
394
+ color: "$surface",
395
+ children: [
396
+ /* @__PURE__ */ jsx(Strong, { children: "Auto-save:" }),
397
+ " ",
398
+ autoSave ? "on" : "off"
399
+ ]
400
+ })
401
+ ]
402
+ })
403
+ ]
404
+ })]
405
+ })
406
+ });
407
+ }
408
+ function DisplayTab({ scrollOffset }) {
409
+ const [showModal, setShowModal] = useState(false);
410
+ const [selectedBorder, setSelectedBorder] = useState(0);
411
+ const borderStyles = [
412
+ "round",
413
+ "bold",
414
+ "single",
415
+ "double",
416
+ "classic"
417
+ ];
418
+ useInput((input, key) => {
419
+ if (key.return && !showModal) setShowModal(true);
420
+ if ((key.escape || input === "q") && showModal) setShowModal(false);
421
+ if (input === "j" && !showModal) setSelectedBorder((prev) => Math.min(prev + 1, borderStyles.length - 1));
422
+ if (input === "k" && !showModal) setSelectedBorder((prev) => Math.max(prev - 1, 0));
423
+ });
424
+ const cell = {
425
+ flexGrow: 1,
426
+ flexBasis: 0,
427
+ borderStyle: "round",
428
+ borderColor: "$border",
429
+ paddingX: 1,
430
+ paddingY: 1,
431
+ flexDirection: "column",
432
+ gap: 1
433
+ };
434
+ return /* @__PURE__ */ jsxs(Box, {
435
+ flexDirection: "column",
436
+ gap: 1,
437
+ paddingX: 1,
438
+ children: [
439
+ /* @__PURE__ */ jsxs(Box, {
440
+ flexDirection: "row",
441
+ gap: 1,
442
+ children: [/* @__PURE__ */ jsxs(Box, {
443
+ ...cell,
444
+ children: [
445
+ /* @__PURE__ */ jsx(Text, {
446
+ color: "$primary",
447
+ children: /* @__PURE__ */ jsx(Strong, { children: "Progress Bars" })
448
+ }),
449
+ /* @__PURE__ */ jsxs(Box, {
450
+ flexDirection: "column",
451
+ children: [
452
+ /* @__PURE__ */ jsxs(Box, { children: [/* @__PURE__ */ jsx(Text, {
453
+ color: "$muted",
454
+ children: "Build "
455
+ }), /* @__PURE__ */ jsx(Box, {
456
+ flexGrow: 1,
457
+ children: /* @__PURE__ */ jsx(ProgressBar, {
458
+ value: 1,
459
+ label: "✓"
460
+ })
461
+ })] }),
462
+ /* @__PURE__ */ jsxs(Box, { children: [/* @__PURE__ */ jsx(Text, {
463
+ color: "$muted",
464
+ children: "Test "
465
+ }), /* @__PURE__ */ jsx(Box, {
466
+ flexGrow: 1,
467
+ children: /* @__PURE__ */ jsx(ProgressBar, { value: .73 })
468
+ })] }),
469
+ /* @__PURE__ */ jsxs(Box, { children: [/* @__PURE__ */ jsx(Text, {
470
+ color: "$muted",
471
+ children: "Deploy "
472
+ }), /* @__PURE__ */ jsx(Box, {
473
+ flexGrow: 1,
474
+ children: /* @__PURE__ */ jsx(ProgressBar, { value: .35 })
475
+ })] }),
476
+ /* @__PURE__ */ jsxs(Box, { children: [/* @__PURE__ */ jsx(Text, {
477
+ color: "$muted",
478
+ children: "Install "
479
+ }), /* @__PURE__ */ jsx(Box, {
480
+ flexGrow: 1,
481
+ children: /* @__PURE__ */ jsx(ProgressBar, {})
482
+ })] })
483
+ ]
484
+ }),
485
+ /* @__PURE__ */ jsxs(Box, {
486
+ flexDirection: "column",
487
+ children: [
488
+ /* @__PURE__ */ jsx(Spinner, {
489
+ type: "dots",
490
+ label: "Loading packages..."
491
+ }),
492
+ /* @__PURE__ */ jsx(Spinner, {
493
+ type: "line",
494
+ label: "Compiling..."
495
+ }),
496
+ /* @__PURE__ */ jsx(Spinner, {
497
+ type: "arc",
498
+ label: "Optimizing bundle..."
499
+ })
500
+ ]
501
+ })
502
+ ]
503
+ }), /* @__PURE__ */ jsxs(Box, {
504
+ ...cell,
505
+ children: [
506
+ /* @__PURE__ */ jsx(Text, {
507
+ color: "$primary",
508
+ children: /* @__PURE__ */ jsx(Strong, { children: "Input Controls" })
509
+ }),
510
+ /* @__PURE__ */ jsxs(Box, {
511
+ flexDirection: "column",
512
+ gap: 1,
513
+ children: [/* @__PURE__ */ jsxs(Box, {
514
+ gap: 1,
515
+ children: [/* @__PURE__ */ jsx(Muted, { children: "Search:" }), /* @__PURE__ */ jsx(Box, {
516
+ flexGrow: 1,
517
+ children: /* @__PURE__ */ jsx(TextInput, {
518
+ value: "flutter widgets",
519
+ onChange: () => {},
520
+ showUnderline: true,
521
+ underlineWidth: 25
522
+ })
523
+ })]
524
+ }), /* @__PURE__ */ jsxs(Box, {
525
+ gap: 2,
526
+ wrap: "truncate",
527
+ children: [/* @__PURE__ */ jsx(Toggle, {
528
+ label: "Dark mode",
529
+ value: true,
530
+ onChange: () => {}
531
+ }), /* @__PURE__ */ jsx(Toggle, {
532
+ label: "Notifications",
533
+ value: false,
534
+ onChange: () => {}
535
+ })]
536
+ })]
537
+ }),
538
+ /* @__PURE__ */ jsx(SelectList, {
539
+ items: [
540
+ {
541
+ label: "React",
542
+ value: "react"
543
+ },
544
+ {
545
+ label: "Vue",
546
+ value: "vue"
547
+ },
548
+ {
549
+ label: "Svelte",
550
+ value: "svelte"
551
+ },
552
+ {
553
+ label: "Angular",
554
+ value: "angular"
555
+ }
556
+ ],
557
+ highlightedIndex: 0,
558
+ onHighlight: () => {},
559
+ isActive: false
560
+ })
561
+ ]
562
+ })]
563
+ }),
564
+ /* @__PURE__ */ jsxs(Box, {
565
+ flexDirection: "row",
566
+ gap: 1,
567
+ children: [/* @__PURE__ */ jsxs(Box, {
568
+ flexDirection: "column",
569
+ gap: 1,
570
+ flexGrow: 1,
571
+ flexBasis: 0,
572
+ children: [/* @__PURE__ */ jsxs(Box, {
573
+ ...cell,
574
+ flexGrow: 1,
575
+ flexBasis: 0,
576
+ children: [/* @__PURE__ */ jsx(Text, {
577
+ color: "$primary",
578
+ children: /* @__PURE__ */ jsx(Strong, { children: "Border Styles" })
579
+ }), /* @__PURE__ */ jsx(Box, {
580
+ flexDirection: "column",
581
+ gap: 0,
582
+ children: borderStyles.map((style, i) => /* @__PURE__ */ jsx(Box, {
583
+ borderStyle: style,
584
+ borderColor: i === selectedBorder ? "$primary" : "$border",
585
+ borderLeft: true,
586
+ borderRight: true,
587
+ borderTop: i === 0,
588
+ borderBottom: true,
589
+ paddingX: 1,
590
+ children: /* @__PURE__ */ jsxs(Text, {
591
+ bold: i === selectedBorder,
592
+ children: [i === selectedBorder ? "▸ " : " ", style]
593
+ })
594
+ }, style))
595
+ })]
596
+ }), /* @__PURE__ */ jsxs(Box, {
597
+ ...cell,
598
+ flexGrow: 1,
599
+ flexBasis: 0,
600
+ children: [/* @__PURE__ */ jsx(Text, {
601
+ color: "$primary",
602
+ children: /* @__PURE__ */ jsx(Strong, { children: "Design Tokens" })
603
+ }), /* @__PURE__ */ jsxs(Box, {
604
+ flexDirection: "row",
605
+ gap: 2,
606
+ children: [/* @__PURE__ */ jsxs(Box, {
607
+ flexDirection: "column",
608
+ width: 14,
609
+ children: [
610
+ /* @__PURE__ */ jsxs(Text, {
611
+ color: "$success",
612
+ children: [
613
+ "●",
614
+ " ",
615
+ "$success".padEnd(10)
616
+ ]
617
+ }),
618
+ /* @__PURE__ */ jsxs(Text, {
619
+ color: "$warning",
620
+ children: [
621
+ "●",
622
+ " ",
623
+ "$warning".padEnd(10)
624
+ ]
625
+ }),
626
+ /* @__PURE__ */ jsxs(Text, {
627
+ color: "$error",
628
+ children: [
629
+ "●",
630
+ " ",
631
+ "$error".padEnd(10)
632
+ ]
633
+ }),
634
+ /* @__PURE__ */ jsxs(Text, {
635
+ color: "$info",
636
+ children: [
637
+ "●",
638
+ " ",
639
+ "$info".padEnd(10)
640
+ ]
641
+ }),
642
+ /* @__PURE__ */ jsxs(Text, {
643
+ color: "$primary",
644
+ children: [
645
+ "●",
646
+ " ",
647
+ "$primary".padEnd(10)
648
+ ]
649
+ }),
650
+ /* @__PURE__ */ jsxs(Muted, { children: [
651
+ "●",
652
+ " ",
653
+ "$muted".padEnd(10)
654
+ ] })
655
+ ]
656
+ }), /* @__PURE__ */ jsxs(Box, {
657
+ flexDirection: "column",
658
+ children: [
659
+ /* @__PURE__ */ jsx(Text, {
660
+ backgroundColor: "$primary",
661
+ color: "$primary-fg",
662
+ children: " $primary "
663
+ }),
664
+ /* @__PURE__ */ jsx(Text, {
665
+ backgroundColor: "$fg",
666
+ color: "$bg",
667
+ children: " $inverse "
668
+ }),
669
+ /* @__PURE__ */ jsx(Text, {
670
+ backgroundColor: "$muted-bg",
671
+ color: "$fg",
672
+ children: " $surface "
673
+ }),
674
+ /* @__PURE__ */ jsx(Text, {
675
+ backgroundColor: "$surfacebg",
676
+ color: "$surface",
677
+ children: " $surfacebg "
678
+ })
679
+ ]
680
+ })]
681
+ })]
682
+ })]
683
+ }), /* @__PURE__ */ jsxs(Box, {
684
+ ...cell,
685
+ backgroundColor: "$surfacebg",
686
+ paddingRight: 2,
687
+ children: [/* @__PURE__ */ jsxs(Box, {
688
+ justifyContent: "space-between",
689
+ paddingBottom: 1,
690
+ children: [/* @__PURE__ */ jsx(Text, {
691
+ color: "$primary",
692
+ children: /* @__PURE__ */ jsx(Strong, { children: "Modal Dialog" })
693
+ }), /* @__PURE__ */ jsx(Small, {
694
+ color: "$muted",
695
+ children: "Esc to close"
696
+ })]
697
+ }), /* @__PURE__ */ jsxs(Box, {
698
+ flexDirection: "column",
699
+ gap: 1,
700
+ children: [
701
+ /* @__PURE__ */ jsxs(Box, {
702
+ gap: 1,
703
+ children: [/* @__PURE__ */ jsx(Muted, { children: "Branch:" }), /* @__PURE__ */ jsx(TextInput, {
704
+ value: "main",
705
+ onChange: () => {},
706
+ showUnderline: true,
707
+ underlineWidth: 25,
708
+ isActive: true
709
+ })]
710
+ }),
711
+ /* @__PURE__ */ jsxs(Box, {
712
+ flexDirection: "column",
713
+ children: [
714
+ /* @__PURE__ */ jsxs(Text, { children: [/* @__PURE__ */ jsx(Text, {
715
+ color: "$success",
716
+ children: "✓"
717
+ }), " All checks passed"] }),
718
+ /* @__PURE__ */ jsxs(Text, { children: [/* @__PURE__ */ jsx(Text, {
719
+ color: "$success",
720
+ children: "✓"
721
+ }), " Tests: 247 passed"] }),
722
+ /* @__PURE__ */ jsxs(Text, { children: [/* @__PURE__ */ jsx(Text, {
723
+ color: "$warning",
724
+ children: "⚠"
725
+ }), " 2 deprecation warnings"] }),
726
+ /* @__PURE__ */ jsxs(Text, { children: [/* @__PURE__ */ jsx(Text, {
727
+ color: "$muted",
728
+ children: "ℹ"
729
+ }), " Deploy target: us-east-1"] })
730
+ ]
731
+ }),
732
+ /* @__PURE__ */ jsxs(Box, {
733
+ gap: 2,
734
+ children: [/* @__PURE__ */ jsx(Text, {
735
+ backgroundColor: "$primary",
736
+ color: "$primary-fg",
737
+ children: " Deploy "
738
+ }), /* @__PURE__ */ jsx(Text, {
739
+ backgroundColor: "$muted-bg",
740
+ color: "$fg",
741
+ children: " Cancel "
742
+ })]
743
+ })
744
+ ]
745
+ })]
746
+ })]
747
+ }),
748
+ showModal && /* @__PURE__ */ jsx(Box, {
749
+ position: "absolute",
750
+ display: "flex",
751
+ justifyContent: "center",
752
+ alignItems: "center",
753
+ width: "100%",
754
+ height: "100%",
755
+ children: /* @__PURE__ */ jsx(ModalDialog, {
756
+ title: "Component Gallery",
757
+ width: 50,
758
+ footer: "ESC or q to close",
759
+ children: /* @__PURE__ */ jsxs(Box, {
760
+ flexDirection: "column",
761
+ gap: 1,
762
+ children: [
763
+ /* @__PURE__ */ jsxs(P, { children: [
764
+ "This gallery demonstrates ",
765
+ /* @__PURE__ */ jsx(Strong, { children: "silvery" }),
766
+ "'s built-in UI components. Every component uses semantic theme tokens — they adapt to any of the 38 built-in palettes automatically."
767
+ ] }),
768
+ /* @__PURE__ */ jsx(HR, {}),
769
+ /* @__PURE__ */ jsxs(Box, {
770
+ flexDirection: "column",
771
+ children: [
772
+ /* @__PURE__ */ jsx(Text, {
773
+ color: "$success",
774
+ children: "✓ Typography presets (H1-H3, Lead, Muted, Code)"
775
+ }),
776
+ /* @__PURE__ */ jsx(Text, {
777
+ color: "$success",
778
+ children: "✓ Input components (TextInput, TextArea, SelectList)"
779
+ }),
780
+ /* @__PURE__ */ jsx(Text, {
781
+ color: "$success",
782
+ children: "✓ Display widgets (ProgressBar, Spinner, Badge)"
783
+ }),
784
+ /* @__PURE__ */ jsx(Text, {
785
+ color: "$success",
786
+ children: "✓ Layout primitives (Box, Divider, border styles)"
787
+ }),
788
+ /* @__PURE__ */ jsx(Text, {
789
+ color: "$success",
790
+ children: "✓ Dialog system (ModalDialog with input blocking)"
791
+ })
792
+ ]
793
+ })
794
+ ]
795
+ })
796
+ })
797
+ })
798
+ ]
799
+ });
800
+ }
801
+ function ComponentsApp() {
802
+ const { exit } = useApp();
803
+ const [activeTab, setActiveTab] = useState("display");
804
+ const [scrollOffset, setScrollOffset] = useState(0);
805
+ const handleTabChange = useCallback((tab) => {
806
+ setActiveTab(tab);
807
+ setScrollOffset(0);
808
+ }, []);
809
+ const tabs = [
810
+ "display",
811
+ "inputs",
812
+ "typography"
813
+ ];
814
+ useInput((input, key) => {
815
+ if (input === "q" && activeTab !== "inputs") exit();
816
+ if (key.escape && activeTab !== "display") exit();
817
+ if (input === "l" && activeTab !== "inputs") {
818
+ handleTabChange(tabs[(tabs.indexOf(activeTab) + 1) % tabs.length]);
819
+ return;
820
+ }
821
+ if (input === "h" && activeTab !== "inputs") {
822
+ handleTabChange(tabs[(tabs.indexOf(activeTab) - 1 + tabs.length) % tabs.length]);
823
+ return;
824
+ }
825
+ if (activeTab !== "inputs") {
826
+ if (key.downArrow || activeTab === "typography" && input === "j") setScrollOffset((prev) => prev + 1);
827
+ if (key.upArrow || activeTab === "typography" && input === "k") setScrollOffset((prev) => Math.max(0, prev - 1));
828
+ if (key.pageDown) setScrollOffset((prev) => prev + 10);
829
+ if (key.pageUp) setScrollOffset((prev) => Math.max(0, prev - 10));
830
+ if (key.home || activeTab === "typography" && input === "g") setScrollOffset(0);
831
+ if (key.end || activeTab === "typography" && input === "G") setScrollOffset(999);
832
+ }
833
+ });
834
+ return /* @__PURE__ */ jsxs(Box, {
835
+ flexDirection: "column",
836
+ flexGrow: 1,
837
+ padding: 1,
838
+ children: [
839
+ activeTab === "display" && /* @__PURE__ */ jsx(DisplayTab, { scrollOffset }),
840
+ activeTab === "inputs" && /* @__PURE__ */ jsx(InputsTab, {}),
841
+ activeTab === "typography" && /* @__PURE__ */ jsx(TypographyTab, { scrollOffset })
842
+ ]
843
+ });
844
+ }
845
+ async function main() {
846
+ try {
847
+ var _usingCtx$1 = _usingCtx();
848
+ const term = _usingCtx$1.u(createTerm());
849
+ const { waitUntilExit } = await render(/* @__PURE__ */ jsx(ExampleBanner, {
850
+ meta,
851
+ controls: "h/l tab Tab cycle inputs j/k navigate Enter modal Esc/q quit",
852
+ children: /* @__PURE__ */ jsx(ComponentsApp, {})
853
+ }), term);
854
+ await waitUntilExit();
855
+ } catch (_) {
856
+ _usingCtx$1.e = _;
857
+ } finally {
858
+ _usingCtx$1.d();
859
+ }
860
+ }
861
+ if (import.meta.main) await main();
862
+ //#endregion
863
+ export { ComponentsApp, main, meta };