@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,315 @@
1
+ import "../ansi-CCE2pVS0.mjs";
2
+ import { k as detectTerminalCaps, m as createColorSchemeDetector } from "../src-CUUOuRH6.mjs";
3
+ import { _ as detectKittyFromStdio$1, g as createWidthDetector } from "../src-BTEVGpd9.mjs";
4
+ import { t as require_jsx_runtime } from "../jsx-runtime-dMs_8fNu.mjs";
5
+ import { t as ExampleBanner } from "../_banner-DLPxCqVy.mjs";
6
+ import { useState } from "react";
7
+ import { Box, H3, Kbd, Muted, Text, render, useApp, useInput } from "silvery";
8
+ //#region apps/terminal-caps-demo.tsx
9
+ /**
10
+ * Terminal Capabilities Demo
11
+ *
12
+ * A "terminal health check" dashboard that probes all supported terminal
13
+ * protocols and displays their status in real time.
14
+ *
15
+ * Probed protocols:
16
+ * - Synchronized Output (Mode 2026)
17
+ * - SGR Mouse (Mode 1006)
18
+ * - Bracketed Paste (Mode 2004)
19
+ * - Focus Reporting (Mode 1004)
20
+ * - Kitty Keyboard (CSI u)
21
+ * - Mode 2031 Color Scheme Detection
22
+ * - DEC 1020-1023 Width Detection (UTF-8, CJK, Emoji, Private-Use)
23
+ * - OSC 66 Text Sizing
24
+ * - OSC 52 Clipboard
25
+ * - OSC 5522 Advanced Clipboard
26
+ * - OSC 8 Hyperlinks
27
+ * - Image Support (Kitty Graphics / Sixel)
28
+ * - DA1/DA2/DA3 Device Attributes
29
+ *
30
+ * Run: bun vendor/silvery/examples/apps/terminal-caps-demo.tsx
31
+ */
32
+ var import_jsx_runtime = require_jsx_runtime();
33
+ const meta = {
34
+ name: "Terminal Capabilities",
35
+ description: "Probe and display all supported terminal protocols",
36
+ demo: true,
37
+ features: [
38
+ "detectTerminalCaps()",
39
+ "Mode 2031",
40
+ "DEC 1020-1023",
41
+ "OSC 66",
42
+ "OSC 52",
43
+ "OSC 5522",
44
+ "DA1/DA2/DA3"
45
+ ]
46
+ };
47
+ function StatusIcon({ status }) {
48
+ switch (status) {
49
+ case "supported": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
50
+ color: "$success",
51
+ children: "✓"
52
+ });
53
+ case "not-supported": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
54
+ color: "$error",
55
+ children: "✗"
56
+ });
57
+ case "probing": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
58
+ color: "$warning",
59
+ children: "?"
60
+ });
61
+ case "detected": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
62
+ color: "$warning",
63
+ children: "?"
64
+ });
65
+ }
66
+ }
67
+ function CapRow({ entry, width }) {
68
+ const label = entry.detail ? `${entry.name}: ${entry.detail}` : entry.name;
69
+ const padded = label.length < width ? label + " ".repeat(width - label.length) : label;
70
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, { children: [
71
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusIcon, { status: entry.status }),
72
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: " " }),
73
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
74
+ color: entry.status === "not-supported" ? "$muted" : void 0,
75
+ children: padded
76
+ })
77
+ ] });
78
+ }
79
+ function buildStaticEntries(caps) {
80
+ const bool = (supported) => supported ? "supported" : "not-supported";
81
+ return [
82
+ {
83
+ name: "Synchronized Output (Mode 2026)",
84
+ status: bool(caps.syncOutput)
85
+ },
86
+ {
87
+ name: "SGR Mouse (Mode 1006)",
88
+ status: bool(caps.mouse)
89
+ },
90
+ {
91
+ name: "Bracketed Paste (Mode 2004)",
92
+ status: bool(caps.bracketedPaste)
93
+ },
94
+ {
95
+ name: "Focus Reporting (Mode 1004)",
96
+ status: bool(caps.bracketedPaste)
97
+ },
98
+ {
99
+ name: "Kitty Keyboard (CSI u)",
100
+ status: bool(caps.kittyKeyboard)
101
+ },
102
+ {
103
+ name: "OSC 52 Clipboard",
104
+ status: bool(caps.osc52)
105
+ },
106
+ {
107
+ name: "OSC 8 Hyperlinks",
108
+ status: bool(caps.hyperlinks)
109
+ },
110
+ {
111
+ name: "Image Support",
112
+ status: caps.kittyGraphics || caps.sixel ? "supported" : "not-supported",
113
+ detail: caps.kittyGraphics ? "Kitty" : caps.sixel ? "Sixel" : "none"
114
+ },
115
+ {
116
+ name: "Notifications (OSC 9/99)",
117
+ status: bool(caps.notifications)
118
+ },
119
+ {
120
+ name: "Underline Styles (SGR 4:x)",
121
+ status: bool(caps.underlineStyles)
122
+ },
123
+ {
124
+ name: "Underline Color (SGR 58)",
125
+ status: bool(caps.underlineColor)
126
+ },
127
+ {
128
+ name: "Unicode",
129
+ status: bool(caps.unicode)
130
+ },
131
+ {
132
+ name: "Nerd Font",
133
+ status: bool(caps.nerdfont)
134
+ }
135
+ ];
136
+ }
137
+ function TerminalCapsApp({ initialProbes }) {
138
+ const { exit } = useApp();
139
+ const [caps] = useState(() => detectTerminalCaps());
140
+ const [colorScheme] = useState(initialProbes?.colorScheme ?? "unknown");
141
+ const [widthConfig] = useState(initialProbes?.widthConfig ?? null);
142
+ const [kittyDetected] = useState(initialProbes?.kittyDetected ?? null);
143
+ useInput((input, key) => {
144
+ if (input === "q" || key.escape) exit();
145
+ });
146
+ const staticEntries = buildStaticEntries(caps);
147
+ if (kittyDetected !== null) {
148
+ const kittyEntry = staticEntries.find((e) => e.name.startsWith("Kitty Keyboard"));
149
+ if (kittyEntry) kittyEntry.status = kittyDetected ? "supported" : "not-supported";
150
+ }
151
+ const probeEntries = [
152
+ {
153
+ name: "Mode 2031 Color Scheme",
154
+ status: colorScheme === "unknown" ? "probing" : "detected",
155
+ detail: colorScheme === "unknown" ? "probing..." : colorScheme
156
+ },
157
+ {
158
+ name: "DEC 1020 UTF-8",
159
+ status: widthConfig === null ? "probing" : "detected",
160
+ detail: widthConfig === null ? "probing..." : widthConfig.utf8 ? "enabled" : "disabled"
161
+ },
162
+ {
163
+ name: "DEC 1021 CJK Width",
164
+ status: widthConfig === null ? "probing" : "detected",
165
+ detail: widthConfig === null ? "probing..." : String(widthConfig.cjkWidth)
166
+ },
167
+ {
168
+ name: "DEC 1022 Emoji Width",
169
+ status: widthConfig === null ? "probing" : "detected",
170
+ detail: widthConfig === null ? "probing..." : String(widthConfig.emojiWidth)
171
+ },
172
+ {
173
+ name: "DEC 1023 Private Width",
174
+ status: widthConfig === null ? "probing" : "detected",
175
+ detail: widthConfig === null ? "probing..." : String(widthConfig.privateUseWidth)
176
+ },
177
+ {
178
+ name: "OSC 66 Text Sizing",
179
+ status: caps.textSizingSupported ? "supported" : "not-supported",
180
+ detail: caps.textSizingSupported ? "supported" : "not supported"
181
+ },
182
+ {
183
+ name: "OSC 5522 Advanced Clipboard",
184
+ status: caps.term === "xterm-kitty" ? "supported" : "not-supported",
185
+ detail: caps.term === "xterm-kitty" ? "Kitty" : "not supported"
186
+ },
187
+ {
188
+ name: "DA1/DA2/DA3",
189
+ status: caps.program !== "" ? "supported" : "not-supported"
190
+ }
191
+ ];
192
+ const termProgram = caps.program || "(unknown)";
193
+ const termType = caps.term || "(unknown)";
194
+ const colorLevel = caps.colorLevel;
195
+ const colWidth = 38;
196
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
197
+ flexDirection: "column",
198
+ paddingX: 1,
199
+ paddingY: 1,
200
+ children: [
201
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(H3, { children: "Terminal Capabilities Probe" }),
202
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
203
+ paddingBottom: 1,
204
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Muted, { children: [
205
+ "Terminal: ",
206
+ termProgram,
207
+ " (",
208
+ termType,
209
+ ") | Colors: ",
210
+ colorLevel,
211
+ " | Background:",
212
+ " ",
213
+ caps.darkBackground ? "dark" : "light"
214
+ ] })
215
+ }),
216
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
217
+ flexDirection: "column",
218
+ width: colWidth + 4,
219
+ children: [
220
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
221
+ bold: true,
222
+ color: "$primary",
223
+ children: "Static Detection"
224
+ }),
225
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, { height: 1 }),
226
+ staticEntries.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CapRow, {
227
+ entry,
228
+ width: colWidth
229
+ }, entry.name))
230
+ ]
231
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
232
+ flexDirection: "column",
233
+ width: colWidth + 4,
234
+ children: [
235
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
236
+ bold: true,
237
+ color: "$primary",
238
+ children: "Runtime Probes"
239
+ }),
240
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, { height: 1 }),
241
+ probeEntries.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CapRow, {
242
+ entry,
243
+ width: colWidth
244
+ }, entry.name))
245
+ ]
246
+ })] }),
247
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
248
+ paddingTop: 1,
249
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Muted, { children: [
250
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Kbd, { children: "q" }),
251
+ " or ",
252
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Kbd, { children: "Esc" }),
253
+ " to quit"
254
+ ] })
255
+ })
256
+ ]
257
+ });
258
+ }
259
+ async function main() {
260
+ let probeResults = {
261
+ colorScheme: "unknown",
262
+ widthConfig: null,
263
+ kittyDetected: null
264
+ };
265
+ if (process.stdin.isTTY) {
266
+ process.stdin.setRawMode(true);
267
+ process.stdin.resume();
268
+ const write = (data) => process.stdout.write(data);
269
+ const onData = (handler) => {
270
+ const h = (chunk) => handler(typeof chunk === "string" ? chunk : chunk.toString());
271
+ process.stdin.on("data", h);
272
+ return () => process.stdin.removeListener("data", h);
273
+ };
274
+ const [colorResult, widthResult, kittyResult] = await Promise.allSettled([
275
+ new Promise((resolve) => {
276
+ const det = createColorSchemeDetector({
277
+ write,
278
+ onData,
279
+ timeoutMs: 500
280
+ });
281
+ det.subscribe((s) => {
282
+ resolve(s);
283
+ det.stop();
284
+ });
285
+ det.start();
286
+ setTimeout(() => {
287
+ resolve(det.scheme);
288
+ det.stop();
289
+ }, 600);
290
+ }),
291
+ createWidthDetector({
292
+ write,
293
+ onData,
294
+ timeoutMs: 500
295
+ }).detect().catch(() => null),
296
+ detectKittyFromStdio$1(process.stdout, process.stdin, 500).then((r) => r.supported).catch(() => false)
297
+ ]);
298
+ probeResults = {
299
+ colorScheme: colorResult.status === "fulfilled" ? colorResult.value : "unknown",
300
+ widthConfig: widthResult.status === "fulfilled" ? widthResult.value : null,
301
+ kittyDetected: kittyResult.status === "fulfilled" ? kittyResult.value : false
302
+ };
303
+ process.stdin.setRawMode(false);
304
+ process.stdin.pause();
305
+ }
306
+ const { waitUntilExit } = await render(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExampleBanner, {
307
+ meta,
308
+ controls: "q/Esc quit",
309
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TerminalCapsApp, { initialProbes: probeResults })
310
+ }));
311
+ await waitUntilExit();
312
+ }
313
+ if (import.meta.main) await main();
314
+ //#endregion
315
+ export { main, meta };