@silvery/examples 0.17.4 → 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.
- package/dist/_banner-A70_y2Vi.mjs +43 -0
- package/dist/{ansi-CCE2pVS0.mjs → ansi-0VXlUmNn.mjs} +7 -7
- package/dist/apng-B0gRaDVT.mjs +3 -0
- package/dist/{apng-HhhBjRGt.mjs → apng-BTRDTfDW.mjs} +2 -2
- package/dist/apps/aichat/index.mjs +69 -70
- package/dist/apps/app-todo.mjs +19 -20
- package/dist/apps/async-data.mjs +40 -41
- package/dist/apps/cli-wizard.mjs +51 -52
- package/dist/apps/clipboard.mjs +26 -27
- package/dist/apps/components.mjs +189 -190
- package/dist/apps/data-explorer.mjs +52 -53
- package/dist/apps/dev-tools.mjs +39 -40
- package/dist/apps/explorer.mjs +73 -74
- package/dist/apps/gallery.mjs +61 -62
- package/dist/apps/inline-bench.mjs +1 -1
- package/dist/apps/kanban.mjs +22 -23
- package/dist/apps/layout-ref.mjs +27 -28
- package/dist/apps/outline.mjs +35 -36
- package/dist/apps/paste-demo.mjs +33 -34
- package/dist/apps/scroll.mjs +11 -12
- package/dist/apps/search-filter.mjs +23 -24
- package/dist/apps/selection.mjs +30 -31
- package/dist/apps/spatial-focus-demo.mjs +32 -33
- package/dist/apps/task-list.mjs +25 -26
- package/dist/apps/terminal-caps-demo.mjs +30 -31
- package/dist/apps/terminal.mjs +157 -158
- package/dist/apps/text-selection-demo.mjs +62 -63
- package/dist/apps/textarea.mjs +21 -22
- package/dist/apps/theme.mjs +142 -143
- package/dist/apps/transform.mjs +25 -26
- package/dist/apps/virtual-10k.mjs +52 -53
- package/dist/{backends-Bahh9mKN.mjs → backends-Dj-11kZF.mjs} +1 -1
- package/dist/backends-U3QwStfO.mjs +3 -0
- package/dist/components/counter.mjs +6 -7
- package/dist/components/hello.mjs +5 -6
- package/dist/components/progress-bar.mjs +10 -11
- package/dist/components/select-list.mjs +8 -9
- package/dist/components/spinner.mjs +10 -11
- package/dist/components/text-input.mjs +8 -9
- package/dist/components/virtual-list.mjs +7 -8
- package/dist/{flexily-zero-adapter-UB-ra8fR.mjs → flexily-zero-adapter-ByVzLTFP.mjs} +1 -1
- package/dist/gif-B6NGH5gs.mjs +3 -0
- package/dist/{gif-BtnXuxLF.mjs → gif-CfkOF-iG.mjs} +2 -2
- package/dist/layout/dashboard.mjs +197 -198
- package/dist/layout/live-resize.mjs +44 -45
- package/dist/layout/overflow.mjs +16 -17
- package/dist/layout/text-layout.mjs +67 -68
- package/dist/{plugins-D1KtkT4a.mjs → plugins-CT0DdV_E.mjs} +12 -13
- package/dist/{src-BTEVGpd9.mjs → src-jO3Zuzjj.mjs} +3 -3
- package/dist/{yoga-adapter-BVtQ5OJR.mjs → yoga-adapter-BSQHuMV9.mjs} +1 -1
- package/package.json +4 -2
- package/dist/_banner-DLPxCqVy.mjs +0 -44
- package/dist/apng-mwUQbTTF.mjs +0 -3
- package/dist/backends-CCtCDQ94.mjs +0 -3
- package/dist/gif-BZaqPPVX.mjs +0 -3
- package/dist/jsx-runtime-dMs_8fNu.mjs +0 -241
- /package/dist/{UPNG-Cy7ViL8f.mjs → UPNG-ShUlaTDh.mjs} +0 -0
- /package/dist/{__vite-browser-external-2447137e-BML7CYau.mjs → __vite-browser-external-2447137e-Bopa5BFR.mjs} +0 -0
- /package/dist/{gifenc-CLRW41dk.mjs → gifenc-BI4ihP_T.mjs} +0 -0
- /package/dist/{node-NuJ94BWl.mjs → node-nsrAOjH4.mjs} +0 -0
- /package/dist/{resvg-js-C_8Wps1F.mjs → resvg-js-Cnk2o49d.mjs} +0 -0
- /package/dist/{src-CzfRafCQ.mjs → src-9ZhfQyzD.mjs} +0 -0
package/dist/apps/transform.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as _usingCtx } from "../usingCtx-CsEf0xO3.mjs";
|
|
2
|
-
import { t as
|
|
3
|
-
import { t as ExampleBanner } from "../_banner-DLPxCqVy.mjs";
|
|
2
|
+
import { t as ExampleBanner } from "../_banner-A70_y2Vi.mjs";
|
|
4
3
|
import { useState } from "react";
|
|
5
4
|
import { Box, H1, Kbd, Muted, Small, Text, Transform, createTerm, render, useApp, useInput } from "silvery";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region apps/transform.tsx
|
|
7
7
|
/**
|
|
8
8
|
* Transform Component Demo
|
|
@@ -18,7 +18,6 @@ import { Box, H1, Kbd, Muted, Small, Text, Transform, createTerm, render, useApp
|
|
|
18
18
|
*
|
|
19
19
|
* Run: bun vendor/silvery/examples/apps/transform.tsx
|
|
20
20
|
*/
|
|
21
|
-
var import_jsx_runtime = require_jsx_runtime();
|
|
22
21
|
const meta = {
|
|
23
22
|
name: "Transform",
|
|
24
23
|
description: "Text post-processing with the Transform component",
|
|
@@ -94,16 +93,16 @@ const sampleLines = [
|
|
|
94
93
|
"liquor jugs and enjoy them."
|
|
95
94
|
];
|
|
96
95
|
function TransformSelector({ current, transforms: items }) {
|
|
97
|
-
return /* @__PURE__ */
|
|
96
|
+
return /* @__PURE__ */ jsx(Box, {
|
|
98
97
|
flexDirection: "column",
|
|
99
98
|
overflow: "scroll",
|
|
100
99
|
scrollTo: current,
|
|
101
100
|
height: 7,
|
|
102
101
|
children: items.map((t, index) => {
|
|
103
102
|
const isSelected = index === current;
|
|
104
|
-
return /* @__PURE__ */
|
|
103
|
+
return /* @__PURE__ */ jsx(Box, {
|
|
105
104
|
paddingX: 1,
|
|
106
|
-
children: /* @__PURE__ */
|
|
105
|
+
children: /* @__PURE__ */ jsxs(Text, {
|
|
107
106
|
color: isSelected ? "$bg" : void 0,
|
|
108
107
|
backgroundColor: isSelected ? "$primary" : void 0,
|
|
109
108
|
bold: isSelected,
|
|
@@ -114,15 +113,15 @@ function TransformSelector({ current, transforms: items }) {
|
|
|
114
113
|
});
|
|
115
114
|
}
|
|
116
115
|
function TextPanel({ title, titleColor, children }) {
|
|
117
|
-
return /* @__PURE__ */
|
|
116
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
118
117
|
flexDirection: "column",
|
|
119
118
|
flexGrow: 1,
|
|
120
119
|
borderStyle: "round",
|
|
121
120
|
borderColor: "$border",
|
|
122
121
|
paddingX: 1,
|
|
123
|
-
children: [/* @__PURE__ */
|
|
122
|
+
children: [/* @__PURE__ */ jsx(Box, {
|
|
124
123
|
marginBottom: 1,
|
|
125
|
-
children: /* @__PURE__ */
|
|
124
|
+
children: /* @__PURE__ */ jsx(H1, {
|
|
126
125
|
color: titleColor,
|
|
127
126
|
children: title
|
|
128
127
|
})
|
|
@@ -141,54 +140,54 @@ function TransformDemo() {
|
|
|
141
140
|
if (key.upArrow || input === "k") setCurrentIndex((prev) => Math.max(0, prev - 1));
|
|
142
141
|
if (key.downArrow || input === "j") setCurrentIndex((prev) => Math.min(transforms.length - 1, prev + 1));
|
|
143
142
|
});
|
|
144
|
-
return /* @__PURE__ */
|
|
143
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
145
144
|
flexDirection: "column",
|
|
146
145
|
padding: 1,
|
|
147
146
|
gap: 1,
|
|
148
147
|
children: [
|
|
149
|
-
/* @__PURE__ */
|
|
148
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
150
149
|
flexDirection: "column",
|
|
151
150
|
borderStyle: "round",
|
|
152
151
|
borderColor: "$primary",
|
|
153
152
|
paddingX: 1,
|
|
154
|
-
children: [/* @__PURE__ */
|
|
153
|
+
children: [/* @__PURE__ */ jsxs(Box, {
|
|
155
154
|
marginBottom: 1,
|
|
156
155
|
gap: 1,
|
|
157
|
-
children: [/* @__PURE__ */
|
|
156
|
+
children: [/* @__PURE__ */ jsx(H1, { children: "Transform" }), /* @__PURE__ */ jsxs(Small, { children: [
|
|
158
157
|
"— ",
|
|
159
158
|
current.name,
|
|
160
159
|
": ",
|
|
161
160
|
current.description
|
|
162
161
|
] })]
|
|
163
|
-
}), /* @__PURE__ */
|
|
162
|
+
}), /* @__PURE__ */ jsx(TransformSelector, {
|
|
164
163
|
current: currentIndex,
|
|
165
164
|
transforms
|
|
166
165
|
})]
|
|
167
166
|
}),
|
|
168
|
-
/* @__PURE__ */
|
|
167
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
169
168
|
flexDirection: "row",
|
|
170
169
|
gap: 1,
|
|
171
|
-
children: [/* @__PURE__ */
|
|
170
|
+
children: [/* @__PURE__ */ jsx(TextPanel, {
|
|
172
171
|
title: "Original",
|
|
173
172
|
titleColor: "$muted",
|
|
174
|
-
children: /* @__PURE__ */
|
|
173
|
+
children: /* @__PURE__ */ jsx(Box, {
|
|
175
174
|
flexDirection: "column",
|
|
176
|
-
children: sampleLines.map((line, i) => /* @__PURE__ */
|
|
175
|
+
children: sampleLines.map((line, i) => /* @__PURE__ */ jsx(Text, { children: line || " " }, i))
|
|
177
176
|
})
|
|
178
|
-
}), /* @__PURE__ */
|
|
177
|
+
}), /* @__PURE__ */ jsx(TextPanel, {
|
|
179
178
|
title: `${current.name}`,
|
|
180
179
|
titleColor: "$warning",
|
|
181
|
-
children: /* @__PURE__ */
|
|
180
|
+
children: /* @__PURE__ */ jsx(Transform, {
|
|
182
181
|
transform: current.fn,
|
|
183
|
-
children: /* @__PURE__ */
|
|
182
|
+
children: /* @__PURE__ */ jsx(Text, { children: sampleLines.join("\n") })
|
|
184
183
|
})
|
|
185
184
|
})]
|
|
186
185
|
}),
|
|
187
|
-
/* @__PURE__ */
|
|
186
|
+
/* @__PURE__ */ jsxs(Muted, { children: [
|
|
188
187
|
" ",
|
|
189
|
-
/* @__PURE__ */
|
|
188
|
+
/* @__PURE__ */ jsx(Kbd, { children: "j/k" }),
|
|
190
189
|
" select transform ",
|
|
191
|
-
/* @__PURE__ */
|
|
190
|
+
/* @__PURE__ */ jsx(Kbd, { children: "Esc/q" }),
|
|
192
191
|
" quit"
|
|
193
192
|
] })
|
|
194
193
|
]
|
|
@@ -198,10 +197,10 @@ async function main() {
|
|
|
198
197
|
try {
|
|
199
198
|
var _usingCtx$1 = _usingCtx();
|
|
200
199
|
const term = _usingCtx$1.u(createTerm());
|
|
201
|
-
const { waitUntilExit } = await render(/* @__PURE__ */
|
|
200
|
+
const { waitUntilExit } = await render(/* @__PURE__ */ jsx(ExampleBanner, {
|
|
202
201
|
meta,
|
|
203
202
|
controls: "j/k select transform Esc/q quit",
|
|
204
|
-
children: /* @__PURE__ */
|
|
203
|
+
children: /* @__PURE__ */ jsx(TransformDemo, {})
|
|
205
204
|
}), term);
|
|
206
205
|
await waitUntilExit();
|
|
207
206
|
} catch (_) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { t as ExampleBanner } from "../_banner-DLPxCqVy.mjs";
|
|
1
|
+
import { t as ExampleBanner } from "../_banner-A70_y2Vi.mjs";
|
|
3
2
|
import { useCallback, useMemo, useState } from "react";
|
|
4
3
|
import { Box, Divider, Kbd, ListView, Muted, Strong, Text, useBoxRect } from "silvery";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { run, useInput as useInput$1 } from "silvery/runtime";
|
|
6
6
|
//#region apps/virtual-10k.tsx
|
|
7
7
|
/**
|
|
@@ -26,7 +26,6 @@ import { run, useInput as useInput$1 } from "silvery/runtime";
|
|
|
26
26
|
* / - Search by number
|
|
27
27
|
* Esc/q or Ctrl+C - Quit
|
|
28
28
|
*/
|
|
29
|
-
var import_jsx_runtime = require_jsx_runtime();
|
|
30
29
|
const meta = {
|
|
31
30
|
name: "Virtual 10K",
|
|
32
31
|
description: "ListView scrolling through 10,000 items with instant navigation",
|
|
@@ -153,26 +152,26 @@ function ProgressBar$1({ percent, width: barWidth }) {
|
|
|
153
152
|
const effectiveWidth = Math.max(5, barWidth);
|
|
154
153
|
const filled = Math.round(percent / 100 * effectiveWidth);
|
|
155
154
|
const empty = effectiveWidth - filled;
|
|
156
|
-
return /* @__PURE__ */
|
|
155
|
+
return /* @__PURE__ */ jsxs(Text, { children: [/* @__PURE__ */ jsx(Text, {
|
|
157
156
|
color: "$success",
|
|
158
157
|
children: "█".repeat(filled)
|
|
159
|
-
}), /* @__PURE__ */
|
|
158
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
160
159
|
dim: true,
|
|
161
160
|
children: "░".repeat(empty)
|
|
162
161
|
})] });
|
|
163
162
|
}
|
|
164
163
|
function ItemRow({ item, isSelected, showDetail }) {
|
|
165
164
|
const idStr = String(item.id).padStart(5, " ");
|
|
166
|
-
return /* @__PURE__ */
|
|
165
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
167
166
|
flexDirection: "column",
|
|
168
167
|
paddingX: 1,
|
|
169
168
|
backgroundColor: isSelected ? "$primary" : void 0,
|
|
170
|
-
children: [/* @__PURE__ */
|
|
171
|
-
/* @__PURE__ */
|
|
169
|
+
children: [/* @__PURE__ */ jsxs(Box, { children: [
|
|
170
|
+
/* @__PURE__ */ jsx(Text, {
|
|
172
171
|
color: STATUS_COLORS[item.status],
|
|
173
172
|
children: STATUS_ICONS[item.status]
|
|
174
173
|
}),
|
|
175
|
-
/* @__PURE__ */
|
|
174
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
176
175
|
dim: true,
|
|
177
176
|
children: [
|
|
178
177
|
" ",
|
|
@@ -180,18 +179,18 @@ function ItemRow({ item, isSelected, showDetail }) {
|
|
|
180
179
|
" "
|
|
181
180
|
]
|
|
182
181
|
}),
|
|
183
|
-
/* @__PURE__ */
|
|
182
|
+
/* @__PURE__ */ jsx(Text, {
|
|
184
183
|
bold: true,
|
|
185
184
|
color: PRIORITY_COLORS[item.priority],
|
|
186
185
|
children: item.priority
|
|
187
186
|
}),
|
|
188
|
-
/* @__PURE__ */
|
|
189
|
-
/* @__PURE__ */
|
|
187
|
+
/* @__PURE__ */ jsx(Text, { children: " " }),
|
|
188
|
+
/* @__PURE__ */ jsx(Text, {
|
|
190
189
|
bold: isSelected,
|
|
191
190
|
children: item.title
|
|
192
191
|
}),
|
|
193
|
-
/* @__PURE__ */
|
|
194
|
-
item.tags.map((tag) => /* @__PURE__ */
|
|
192
|
+
/* @__PURE__ */ jsx(Text, { children: " " }),
|
|
193
|
+
item.tags.map((tag) => /* @__PURE__ */ jsxs(Text, {
|
|
195
194
|
dim: true,
|
|
196
195
|
color: "$info",
|
|
197
196
|
children: [
|
|
@@ -200,19 +199,19 @@ function ItemRow({ item, isSelected, showDetail }) {
|
|
|
200
199
|
tag
|
|
201
200
|
]
|
|
202
201
|
}, tag))
|
|
203
|
-
] }), showDetail && /* @__PURE__ */
|
|
202
|
+
] }), showDetail && /* @__PURE__ */ jsxs(Box, {
|
|
204
203
|
paddingLeft: 8,
|
|
205
204
|
children: [
|
|
206
|
-
/* @__PURE__ */
|
|
205
|
+
/* @__PURE__ */ jsx(Text, {
|
|
207
206
|
dim: true,
|
|
208
207
|
children: item.description
|
|
209
208
|
}),
|
|
210
|
-
/* @__PURE__ */
|
|
211
|
-
/* @__PURE__ */
|
|
209
|
+
/* @__PURE__ */ jsx(Text, { children: " " }),
|
|
210
|
+
/* @__PURE__ */ jsx(ProgressBar$1, {
|
|
212
211
|
percent: item.progress,
|
|
213
212
|
width: 10
|
|
214
213
|
}),
|
|
215
|
-
/* @__PURE__ */
|
|
214
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
216
215
|
dim: true,
|
|
217
216
|
children: [
|
|
218
217
|
" ",
|
|
@@ -229,27 +228,27 @@ function ScrollIndicator({ current, total, width }) {
|
|
|
229
228
|
const barWidth = Math.max(10, Math.min(30, width - 40));
|
|
230
229
|
const filled = Math.round(percent / 100 * barWidth);
|
|
231
230
|
const empty = barWidth - filled;
|
|
232
|
-
return /* @__PURE__ */
|
|
231
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
233
232
|
gap: 2,
|
|
234
233
|
paddingX: 1,
|
|
235
234
|
children: [
|
|
236
|
-
/* @__PURE__ */
|
|
235
|
+
/* @__PURE__ */ jsx(Strong, {
|
|
237
236
|
color: "$primary",
|
|
238
237
|
children: (current + 1).toLocaleString()
|
|
239
238
|
}),
|
|
240
|
-
/* @__PURE__ */
|
|
239
|
+
/* @__PURE__ */ jsx(Text, {
|
|
241
240
|
dim: true,
|
|
242
241
|
children: "of"
|
|
243
242
|
}),
|
|
244
|
-
/* @__PURE__ */
|
|
245
|
-
/* @__PURE__ */
|
|
243
|
+
/* @__PURE__ */ jsx(Strong, { children: total.toLocaleString() }),
|
|
244
|
+
/* @__PURE__ */ jsxs(Text, { children: [/* @__PURE__ */ jsx(Text, {
|
|
246
245
|
color: "$primary",
|
|
247
246
|
children: "█".repeat(filled)
|
|
248
|
-
}), /* @__PURE__ */
|
|
247
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
249
248
|
dim: true,
|
|
250
249
|
children: "░".repeat(empty)
|
|
251
250
|
})] }),
|
|
252
|
-
/* @__PURE__ */
|
|
251
|
+
/* @__PURE__ */ jsxs(Strong, {
|
|
253
252
|
color: "$primary",
|
|
254
253
|
children: [percent, "%"]
|
|
255
254
|
})
|
|
@@ -281,31 +280,31 @@ function StatsBar({ items }) {
|
|
|
281
280
|
blocked
|
|
282
281
|
};
|
|
283
282
|
}, [items]);
|
|
284
|
-
return /* @__PURE__ */
|
|
283
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
285
284
|
gap: 2,
|
|
286
285
|
paddingX: 1,
|
|
287
286
|
children: [
|
|
288
|
-
/* @__PURE__ */
|
|
287
|
+
/* @__PURE__ */ jsxs(Strong, {
|
|
289
288
|
color: "$error",
|
|
290
289
|
children: ["P0:", stats.p0]
|
|
291
290
|
}),
|
|
292
|
-
/* @__PURE__ */
|
|
291
|
+
/* @__PURE__ */ jsxs(Strong, {
|
|
293
292
|
color: "$warning",
|
|
294
293
|
children: ["P1:", stats.p1]
|
|
295
294
|
}),
|
|
296
|
-
/* @__PURE__ */
|
|
295
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
297
296
|
color: "$info",
|
|
298
297
|
children: ["P2:", stats.p2]
|
|
299
298
|
}),
|
|
300
|
-
/* @__PURE__ */
|
|
299
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
301
300
|
dim: true,
|
|
302
301
|
children: ["P3:", stats.p3]
|
|
303
302
|
}),
|
|
304
|
-
/* @__PURE__ */
|
|
303
|
+
/* @__PURE__ */ jsx(Text, {
|
|
305
304
|
dim: true,
|
|
306
305
|
children: "|"
|
|
307
306
|
}),
|
|
308
|
-
/* @__PURE__ */
|
|
307
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
309
308
|
color: "$muted",
|
|
310
309
|
children: [
|
|
311
310
|
STATUS_ICONS.todo,
|
|
@@ -313,7 +312,7 @@ function StatsBar({ items }) {
|
|
|
313
312
|
stats.todo
|
|
314
313
|
]
|
|
315
314
|
}),
|
|
316
|
-
/* @__PURE__ */
|
|
315
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
317
316
|
color: "$warning",
|
|
318
317
|
children: [
|
|
319
318
|
STATUS_ICONS["in-progress"],
|
|
@@ -321,7 +320,7 @@ function StatsBar({ items }) {
|
|
|
321
320
|
stats.inProg
|
|
322
321
|
]
|
|
323
322
|
}),
|
|
324
|
-
/* @__PURE__ */
|
|
323
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
325
324
|
color: "$success",
|
|
326
325
|
children: [
|
|
327
326
|
STATUS_ICONS.done,
|
|
@@ -329,7 +328,7 @@ function StatsBar({ items }) {
|
|
|
329
328
|
stats.done
|
|
330
329
|
]
|
|
331
330
|
}),
|
|
332
|
-
/* @__PURE__ */
|
|
331
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
333
332
|
color: "$error",
|
|
334
333
|
children: [
|
|
335
334
|
STATUS_ICONS.blocked,
|
|
@@ -360,50 +359,50 @@ function VirtualBenchmark() {
|
|
|
360
359
|
if (input === "G" || key.end) setCursor(TOTAL_ITEMS - 1);
|
|
361
360
|
if (key.return || input === " ") setShowDetail((d) => !d);
|
|
362
361
|
}, [halfPage]));
|
|
363
|
-
return /* @__PURE__ */
|
|
362
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
364
363
|
flexDirection: "column",
|
|
365
364
|
width: "100%",
|
|
366
365
|
height: "100%",
|
|
367
366
|
children: [
|
|
368
|
-
/* @__PURE__ */
|
|
369
|
-
/* @__PURE__ */
|
|
367
|
+
/* @__PURE__ */ jsx(StatsBar, { items: ALL_ITEMS }),
|
|
368
|
+
/* @__PURE__ */ jsx(Box, {
|
|
370
369
|
paddingX: 1,
|
|
371
|
-
children: /* @__PURE__ */
|
|
370
|
+
children: /* @__PURE__ */ jsx(Divider, {})
|
|
372
371
|
}),
|
|
373
|
-
/* @__PURE__ */
|
|
372
|
+
/* @__PURE__ */ jsx(Box, {
|
|
374
373
|
flexGrow: 1,
|
|
375
|
-
children: /* @__PURE__ */
|
|
374
|
+
children: /* @__PURE__ */ jsx(ListView, {
|
|
376
375
|
items: ALL_ITEMS,
|
|
377
376
|
height: listHeight,
|
|
378
377
|
estimateHeight,
|
|
379
378
|
scrollTo: cursor,
|
|
380
379
|
overscan: 5,
|
|
381
|
-
renderItem: (item, index) => /* @__PURE__ */
|
|
380
|
+
renderItem: (item, index) => /* @__PURE__ */ jsx(ItemRow, {
|
|
382
381
|
item,
|
|
383
382
|
isSelected: index === cursor,
|
|
384
383
|
showDetail: showDetail && index === cursor
|
|
385
384
|
}, item.id)
|
|
386
385
|
})
|
|
387
386
|
}),
|
|
388
|
-
/* @__PURE__ */
|
|
387
|
+
/* @__PURE__ */ jsx(ScrollIndicator, {
|
|
389
388
|
current: cursor,
|
|
390
389
|
total: TOTAL_ITEMS,
|
|
391
390
|
width
|
|
392
391
|
}),
|
|
393
|
-
/* @__PURE__ */
|
|
392
|
+
/* @__PURE__ */ jsx(Box, {
|
|
394
393
|
paddingX: 1,
|
|
395
394
|
justifyContent: "center",
|
|
396
|
-
children: /* @__PURE__ */
|
|
397
|
-
/* @__PURE__ */
|
|
395
|
+
children: /* @__PURE__ */ jsxs(Muted, { children: [
|
|
396
|
+
/* @__PURE__ */ jsx(Kbd, { children: "j/k" }),
|
|
398
397
|
" navigate ",
|
|
399
|
-
/* @__PURE__ */
|
|
398
|
+
/* @__PURE__ */ jsx(Kbd, { children: "d/u" }),
|
|
400
399
|
" half-page ",
|
|
401
|
-
/* @__PURE__ */
|
|
400
|
+
/* @__PURE__ */ jsx(Kbd, { children: "g/G" }),
|
|
402
401
|
" start/end ",
|
|
403
|
-
/* @__PURE__ */
|
|
402
|
+
/* @__PURE__ */ jsx(Kbd, { children: "Enter" }),
|
|
404
403
|
" detail",
|
|
405
404
|
" ",
|
|
406
|
-
/* @__PURE__ */
|
|
405
|
+
/* @__PURE__ */ jsx(Kbd, { children: "Esc/q" }),
|
|
407
406
|
" quit"
|
|
408
407
|
] })
|
|
409
408
|
})
|
|
@@ -411,10 +410,10 @@ function VirtualBenchmark() {
|
|
|
411
410
|
});
|
|
412
411
|
}
|
|
413
412
|
async function main() {
|
|
414
|
-
await (await run(/* @__PURE__ */
|
|
413
|
+
await (await run(/* @__PURE__ */ jsx(ExampleBanner, {
|
|
415
414
|
meta,
|
|
416
415
|
controls: "j/k navigate d/u half-page g/G start/end Enter detail Esc/q quit",
|
|
417
|
-
children: /* @__PURE__ */
|
|
416
|
+
children: /* @__PURE__ */ jsx(VirtualBenchmark, {})
|
|
418
417
|
}))).waitUntilExit();
|
|
419
418
|
}
|
|
420
419
|
if (import.meta.main) await main();
|
|
@@ -443,7 +443,7 @@ var init_svg = __esmMin((() => {
|
|
|
443
443
|
async function loadResvg() {
|
|
444
444
|
if (resvgModule) return resvgModule;
|
|
445
445
|
try {
|
|
446
|
-
resvgModule = await import("./resvg-js-
|
|
446
|
+
resvgModule = await import("./resvg-js-Cnk2o49d.mjs").then((m) => /* @__PURE__ */ __toESM(m.default, 1));
|
|
447
447
|
return resvgModule;
|
|
448
448
|
} catch {
|
|
449
449
|
throw new Error("screenshotPng() requires @resvg/resvg-js. Install it:\n bun add -d @resvg/resvg-js");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as require_jsx_runtime } from "../jsx-runtime-dMs_8fNu.mjs";
|
|
2
1
|
import { useState } from "react";
|
|
3
2
|
import { Box, Text } from "silvery";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { run, useInput as useInput$1 } from "silvery/runtime";
|
|
5
5
|
//#region components/counter.tsx
|
|
6
6
|
/**
|
|
@@ -11,7 +11,6 @@ import { run, useInput as useInput$1 } from "silvery/runtime";
|
|
|
11
11
|
*
|
|
12
12
|
* Usage: bun examples/components/counter.tsx
|
|
13
13
|
*/
|
|
14
|
-
var import_jsx_runtime = require_jsx_runtime();
|
|
15
14
|
function Counter() {
|
|
16
15
|
const [count, setCount] = useState(0);
|
|
17
16
|
useInput$1((input, key) => {
|
|
@@ -20,17 +19,17 @@ function Counter() {
|
|
|
20
19
|
if (input === "r") setCount(0);
|
|
21
20
|
if (input === "q" || key.escape) return "exit";
|
|
22
21
|
});
|
|
23
|
-
return /* @__PURE__ */
|
|
22
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
24
23
|
flexDirection: "column",
|
|
25
24
|
padding: 1,
|
|
26
|
-
children: [/* @__PURE__ */
|
|
25
|
+
children: [/* @__PURE__ */ jsxs(Box, {
|
|
27
26
|
gap: 1,
|
|
28
|
-
children: [/* @__PURE__ */
|
|
27
|
+
children: [/* @__PURE__ */ jsx(Text, { children: "Count:" }), /* @__PURE__ */ jsx(Text, {
|
|
29
28
|
bold: true,
|
|
30
29
|
color: count >= 0 ? "$success" : "$error",
|
|
31
30
|
children: count
|
|
32
31
|
})]
|
|
33
|
-
}), /* @__PURE__ */
|
|
32
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
34
33
|
color: "$muted",
|
|
35
34
|
children: "j/k: +/- r: reset q: quit"
|
|
36
35
|
})]
|
|
@@ -41,7 +40,7 @@ const meta = {
|
|
|
41
40
|
description: "Interactive counter with useState + useInput"
|
|
42
41
|
};
|
|
43
42
|
async function main() {
|
|
44
|
-
await (await run(/* @__PURE__ */
|
|
43
|
+
await (await run(/* @__PURE__ */ jsx(Counter, {}))).waitUntilExit();
|
|
45
44
|
}
|
|
46
45
|
if (import.meta.main) await main();
|
|
47
46
|
//#endregion
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { t as require_jsx_runtime } from "../jsx-runtime-dMs_8fNu.mjs";
|
|
2
1
|
import "react";
|
|
3
2
|
import { Box, Text } from "silvery";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { run, useInput as useInput$1 } from "silvery/runtime";
|
|
5
5
|
//#region components/hello.tsx
|
|
6
|
-
var import_jsx_runtime = require_jsx_runtime();
|
|
7
6
|
function Hello() {
|
|
8
7
|
useInput$1(() => "exit");
|
|
9
|
-
return /* @__PURE__ */
|
|
8
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
10
9
|
flexDirection: "column",
|
|
11
10
|
padding: 1,
|
|
12
|
-
children: [/* @__PURE__ */
|
|
11
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
13
12
|
bold: true,
|
|
14
13
|
color: "$primary",
|
|
15
14
|
children: "Hello, Silvery!"
|
|
16
|
-
}), /* @__PURE__ */
|
|
15
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
17
16
|
color: "$muted",
|
|
18
17
|
children: "Press any key to exit."
|
|
19
18
|
})]
|
|
@@ -24,7 +23,7 @@ const meta = {
|
|
|
24
23
|
description: "The simplest silvery app — styled text, exit on keypress"
|
|
25
24
|
};
|
|
26
25
|
async function main() {
|
|
27
|
-
await (await run(/* @__PURE__ */
|
|
26
|
+
await (await run(/* @__PURE__ */ jsx(Hello, {}))).waitUntilExit();
|
|
28
27
|
}
|
|
29
28
|
if (import.meta.main) await main();
|
|
30
29
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as require_jsx_runtime } from "../jsx-runtime-dMs_8fNu.mjs";
|
|
2
1
|
import { useState } from "react";
|
|
3
2
|
import { Box, ProgressBar, Text } from "silvery";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { run, useInput as useInput$1 } from "silvery/runtime";
|
|
5
5
|
//#region components/progress-bar.tsx
|
|
6
6
|
/**
|
|
@@ -11,7 +11,6 @@ import { run, useInput as useInput$1 } from "silvery/runtime";
|
|
|
11
11
|
*
|
|
12
12
|
* Usage: bun examples/components/progress-bar.tsx
|
|
13
13
|
*/
|
|
14
|
-
var import_jsx_runtime = require_jsx_runtime();
|
|
15
14
|
function ProgressBarDemo() {
|
|
16
15
|
const [progress, setProgress] = useState(.4);
|
|
17
16
|
useInput$1((input, key) => {
|
|
@@ -19,28 +18,28 @@ function ProgressBarDemo() {
|
|
|
19
18
|
if (input === "k" || key.leftArrow) setProgress((p) => Math.max(0, p - .05));
|
|
20
19
|
if (input === "q" || key.escape) return "exit";
|
|
21
20
|
});
|
|
22
|
-
return /* @__PURE__ */
|
|
21
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
23
22
|
flexDirection: "column",
|
|
24
23
|
padding: 1,
|
|
25
24
|
gap: 1,
|
|
26
25
|
children: [
|
|
27
|
-
/* @__PURE__ */
|
|
26
|
+
/* @__PURE__ */ jsx(Text, {
|
|
28
27
|
bold: true,
|
|
29
28
|
children: "Determinate"
|
|
30
29
|
}),
|
|
31
|
-
/* @__PURE__ */
|
|
30
|
+
/* @__PURE__ */ jsx(Box, {
|
|
32
31
|
width: 40,
|
|
33
|
-
children: /* @__PURE__ */
|
|
32
|
+
children: /* @__PURE__ */ jsx(ProgressBar, { value: progress })
|
|
34
33
|
}),
|
|
35
|
-
/* @__PURE__ */
|
|
34
|
+
/* @__PURE__ */ jsx(Text, {
|
|
36
35
|
bold: true,
|
|
37
36
|
children: "Indeterminate"
|
|
38
37
|
}),
|
|
39
|
-
/* @__PURE__ */
|
|
38
|
+
/* @__PURE__ */ jsx(Box, {
|
|
40
39
|
width: 40,
|
|
41
|
-
children: /* @__PURE__ */
|
|
40
|
+
children: /* @__PURE__ */ jsx(ProgressBar, {})
|
|
42
41
|
}),
|
|
43
|
-
/* @__PURE__ */
|
|
42
|
+
/* @__PURE__ */ jsx(Text, {
|
|
44
43
|
color: "$muted",
|
|
45
44
|
children: "j/k: adjust q: quit"
|
|
46
45
|
})
|
|
@@ -52,7 +51,7 @@ const meta = {
|
|
|
52
51
|
description: "Determinate and indeterminate progress bars"
|
|
53
52
|
};
|
|
54
53
|
async function main() {
|
|
55
|
-
await (await run(/* @__PURE__ */
|
|
54
|
+
await (await run(/* @__PURE__ */ jsx(ProgressBarDemo, {}))).waitUntilExit();
|
|
56
55
|
}
|
|
57
56
|
if (import.meta.main) await main();
|
|
58
57
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as require_jsx_runtime } from "../jsx-runtime-dMs_8fNu.mjs";
|
|
2
1
|
import { useState } from "react";
|
|
3
2
|
import { Box, SelectList, Text } from "silvery";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { run, useInput as useInput$1 } from "silvery/runtime";
|
|
5
5
|
//#region components/select-list.tsx
|
|
6
6
|
/**
|
|
@@ -11,7 +11,6 @@ import { run, useInput as useInput$1 } from "silvery/runtime";
|
|
|
11
11
|
*
|
|
12
12
|
* Usage: bun examples/components/select-list.tsx
|
|
13
13
|
*/
|
|
14
|
-
var import_jsx_runtime = require_jsx_runtime();
|
|
15
14
|
const languages = [
|
|
16
15
|
{
|
|
17
16
|
label: "TypeScript",
|
|
@@ -44,29 +43,29 @@ function SelectListDemo() {
|
|
|
44
43
|
useInput$1((_, key) => {
|
|
45
44
|
if (key.escape) return "exit";
|
|
46
45
|
});
|
|
47
|
-
return /* @__PURE__ */
|
|
46
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
48
47
|
flexDirection: "column",
|
|
49
48
|
padding: 1,
|
|
50
49
|
gap: 1,
|
|
51
50
|
children: [
|
|
52
|
-
/* @__PURE__ */
|
|
51
|
+
/* @__PURE__ */ jsx(Text, {
|
|
53
52
|
bold: true,
|
|
54
53
|
children: "Pick a language:"
|
|
55
54
|
}),
|
|
56
|
-
/* @__PURE__ */
|
|
55
|
+
/* @__PURE__ */ jsx(Box, {
|
|
57
56
|
borderStyle: "round",
|
|
58
57
|
borderColor: "$border",
|
|
59
58
|
paddingX: 1,
|
|
60
|
-
children: /* @__PURE__ */
|
|
59
|
+
children: /* @__PURE__ */ jsx(SelectList, {
|
|
61
60
|
items: languages,
|
|
62
61
|
onSelect: (opt) => setSelected(opt.value)
|
|
63
62
|
})
|
|
64
63
|
}),
|
|
65
|
-
selected && /* @__PURE__ */
|
|
64
|
+
selected && /* @__PURE__ */ jsxs(Text, {
|
|
66
65
|
color: "$success",
|
|
67
66
|
children: ["Selected: ", selected]
|
|
68
67
|
}),
|
|
69
|
-
/* @__PURE__ */
|
|
68
|
+
/* @__PURE__ */ jsx(Text, {
|
|
70
69
|
color: "$muted",
|
|
71
70
|
children: "j/k: navigate Enter: select Esc: quit"
|
|
72
71
|
})
|
|
@@ -78,7 +77,7 @@ const meta = {
|
|
|
78
77
|
description: "Keyboard-navigable single-select list"
|
|
79
78
|
};
|
|
80
79
|
async function main() {
|
|
81
|
-
await (await run(/* @__PURE__ */
|
|
80
|
+
await (await run(/* @__PURE__ */ jsx(SelectListDemo, {}))).waitUntilExit();
|
|
82
81
|
}
|
|
83
82
|
if (import.meta.main) await main();
|
|
84
83
|
//#endregion
|