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