@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/selection.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as _usingCtx } from "../usingCtx-CsEf0xO3.mjs";
|
|
2
|
-
import { t as require_jsx_runtime } from "../jsx-runtime-dMs_8fNu.mjs";
|
|
3
2
|
import { useCallback, useState } from "react";
|
|
4
3
|
import { Box, Text } from "silvery";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { run, useInput as useInput$1 } from "silvery/runtime";
|
|
6
6
|
//#region apps/selection.tsx
|
|
7
7
|
/**
|
|
@@ -16,7 +16,6 @@ import { run, useInput as useInput$1 } from "silvery/runtime";
|
|
|
16
16
|
*
|
|
17
17
|
* Run: bun examples/apps/selection.tsx
|
|
18
18
|
*/
|
|
19
|
-
var import_jsx_runtime = require_jsx_runtime();
|
|
20
19
|
const S = {
|
|
21
20
|
cursor: (sel) => sel.nodes[0],
|
|
22
21
|
anchor: (sel) => sel.nodes.at(-1),
|
|
@@ -115,34 +114,34 @@ function ItemRow({ item, sel, onSelect }) {
|
|
|
115
114
|
const isEditing = isCursor && sel ? S.isEditing(sel) : false;
|
|
116
115
|
const marker = isCursor ? "►" : isSelected ? "●" : " ";
|
|
117
116
|
const anchorMark = isAnchor && !isCursor ? " ⚓" : "";
|
|
118
|
-
return /* @__PURE__ */
|
|
117
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
119
118
|
onClick: (e) => onSelect(item.id, e.metaKey, e.shiftKey),
|
|
120
119
|
onDoubleClick: () => onSelect(item.id, false, false),
|
|
121
120
|
children: [
|
|
122
|
-
/* @__PURE__ */
|
|
121
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
123
122
|
color: isSelected ? "$primary" : "$muted",
|
|
124
123
|
children: [marker, " "]
|
|
125
124
|
}),
|
|
126
|
-
isEditing ? /* @__PURE__ */
|
|
125
|
+
isEditing ? /* @__PURE__ */ jsxs(Text, {
|
|
127
126
|
backgroundColor: "$surface",
|
|
128
127
|
color: "$text",
|
|
129
128
|
bold: true,
|
|
130
129
|
children: [
|
|
131
130
|
" ",
|
|
132
131
|
item.label,
|
|
133
|
-
/* @__PURE__ */
|
|
132
|
+
/* @__PURE__ */ jsx(Text, {
|
|
134
133
|
color: "$primary",
|
|
135
134
|
children: "│"
|
|
136
135
|
}),
|
|
137
136
|
" "
|
|
138
137
|
]
|
|
139
|
-
}) : /* @__PURE__ */
|
|
138
|
+
}) : /* @__PURE__ */ jsx(Text, {
|
|
140
139
|
bold: isCursor,
|
|
141
140
|
color: isCursor ? "$primary" : isSelected ? "$primary" : "$text",
|
|
142
141
|
dim: !isSelected && !isCursor,
|
|
143
142
|
children: item.label
|
|
144
143
|
}),
|
|
145
|
-
/* @__PURE__ */
|
|
144
|
+
/* @__PURE__ */ jsx(Text, {
|
|
146
145
|
color: "$muted",
|
|
147
146
|
dim: true,
|
|
148
147
|
children: anchorMark
|
|
@@ -152,48 +151,48 @@ function ItemRow({ item, sel, onSelect }) {
|
|
|
152
151
|
}
|
|
153
152
|
function StatusBar({ sel }) {
|
|
154
153
|
const mode = S.inputMode(sel);
|
|
155
|
-
return /* @__PURE__ */
|
|
154
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
156
155
|
flexDirection: "column",
|
|
157
156
|
borderStyle: "single",
|
|
158
157
|
borderColor: "$border",
|
|
159
158
|
paddingX: 1,
|
|
160
|
-
children: [/* @__PURE__ */
|
|
159
|
+
children: [/* @__PURE__ */ jsxs(Box, {
|
|
161
160
|
gap: 2,
|
|
162
|
-
children: [/* @__PURE__ */
|
|
161
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
163
162
|
color: mode === "text" ? "$success" : mode === "node" ? "$primary" : "$muted",
|
|
164
163
|
bold: true,
|
|
165
164
|
children: mode.toUpperCase()
|
|
166
|
-
}), sel && /* @__PURE__ */
|
|
167
|
-
/* @__PURE__ */
|
|
165
|
+
}), sel && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
166
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
168
167
|
color: "$muted",
|
|
169
|
-
children: ["cursor=", /* @__PURE__ */
|
|
168
|
+
children: ["cursor=", /* @__PURE__ */ jsx(Text, {
|
|
170
169
|
color: "$primary",
|
|
171
170
|
children: S.cursor(sel)
|
|
172
171
|
})]
|
|
173
172
|
}),
|
|
174
|
-
/* @__PURE__ */
|
|
173
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
175
174
|
color: "$muted",
|
|
176
|
-
children: ["anchor=", /* @__PURE__ */
|
|
175
|
+
children: ["anchor=", /* @__PURE__ */ jsx(Text, {
|
|
177
176
|
color: "$text",
|
|
178
177
|
children: S.anchor(sel)
|
|
179
178
|
})]
|
|
180
179
|
}),
|
|
181
|
-
/* @__PURE__ */
|
|
180
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
182
181
|
color: "$muted",
|
|
183
|
-
children: ["selected=", /* @__PURE__ */
|
|
182
|
+
children: ["selected=", /* @__PURE__ */ jsx(Text, {
|
|
184
183
|
color: "$text",
|
|
185
184
|
children: sel.nodes.length
|
|
186
185
|
})]
|
|
187
186
|
}),
|
|
188
|
-
sel.text && /* @__PURE__ */
|
|
187
|
+
sel.text && /* @__PURE__ */ jsxs(Text, {
|
|
189
188
|
color: "$muted",
|
|
190
|
-
children: ["text=", /* @__PURE__ */
|
|
189
|
+
children: ["text=", /* @__PURE__ */ jsxs(Text, {
|
|
191
190
|
color: "$success",
|
|
192
191
|
children: ["offset ", sel.text[0].offset]
|
|
193
192
|
})]
|
|
194
193
|
})
|
|
195
194
|
] })]
|
|
196
|
-
}), /* @__PURE__ */
|
|
195
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
197
196
|
color: "$muted",
|
|
198
197
|
dim: true,
|
|
199
198
|
children: "j/k nav · Enter edit · Esc back · Shift+j/k extend · Cmd+click toggle · q quit"
|
|
@@ -284,39 +283,39 @@ function SelectionDemo() {
|
|
|
284
283
|
...item,
|
|
285
284
|
label: editTexts[item.id] ?? item.label
|
|
286
285
|
}));
|
|
287
|
-
return /* @__PURE__ */
|
|
286
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
288
287
|
flexDirection: "column",
|
|
289
288
|
padding: 1,
|
|
290
289
|
height: "100%",
|
|
291
290
|
children: [
|
|
292
|
-
/* @__PURE__ */
|
|
291
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
293
292
|
marginBottom: 1,
|
|
294
|
-
children: [/* @__PURE__ */
|
|
293
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
295
294
|
bold: true,
|
|
296
295
|
color: "$primary",
|
|
297
296
|
children: "Selection Model Demo"
|
|
298
|
-
}), /* @__PURE__ */
|
|
297
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
299
298
|
color: "$muted",
|
|
300
299
|
children: " — silvery reactive selection"
|
|
301
300
|
})]
|
|
302
301
|
}),
|
|
303
|
-
/* @__PURE__ */
|
|
302
|
+
/* @__PURE__ */ jsx(Box, {
|
|
304
303
|
flexDirection: "column",
|
|
305
304
|
flexGrow: 1,
|
|
306
305
|
borderStyle: "round",
|
|
307
306
|
borderColor: "$border",
|
|
308
307
|
overflow: "hidden",
|
|
309
|
-
children: displayItems.map((item) => /* @__PURE__ */
|
|
308
|
+
children: displayItems.map((item) => /* @__PURE__ */ jsx(ItemRow, {
|
|
310
309
|
item,
|
|
311
310
|
sel,
|
|
312
311
|
onSelect: handleSelect
|
|
313
312
|
}, item.id))
|
|
314
313
|
}),
|
|
315
|
-
/* @__PURE__ */
|
|
316
|
-
/* @__PURE__ */
|
|
314
|
+
/* @__PURE__ */ jsx(StatusBar, { sel }),
|
|
315
|
+
/* @__PURE__ */ jsx(Box, {
|
|
317
316
|
marginTop: 1,
|
|
318
317
|
flexDirection: "column",
|
|
319
|
-
children: /* @__PURE__ */
|
|
318
|
+
children: /* @__PURE__ */ jsxs(Text, {
|
|
320
319
|
color: "$muted",
|
|
321
320
|
dim: true,
|
|
322
321
|
children: [
|
|
@@ -343,7 +342,7 @@ const meta = {
|
|
|
343
342
|
async function main() {
|
|
344
343
|
try {
|
|
345
344
|
var _usingCtx$1 = _usingCtx();
|
|
346
|
-
await _usingCtx$1.u(await run(/* @__PURE__ */
|
|
345
|
+
await _usingCtx$1.u(await run(/* @__PURE__ */ jsx(SelectionDemo, {}), { mode: "fullscreen" })).waitUntilExit();
|
|
347
346
|
} catch (_) {
|
|
348
347
|
_usingCtx$1.e = _;
|
|
349
348
|
} finally {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as _usingCtx } from "../usingCtx-CsEf0xO3.mjs";
|
|
2
|
-
import { t as require_jsx_runtime } from "../jsx-runtime-dMs_8fNu.mjs";
|
|
3
2
|
import { useMemo, useState } from "react";
|
|
4
3
|
import { Box, Text } from "silvery";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { run, useInput as useInput$1 } from "silvery/runtime";
|
|
6
6
|
//#region apps/spatial-focus-demo.tsx
|
|
7
7
|
/**
|
|
@@ -15,7 +15,6 @@ import { run, useInput as useInput$1 } from "silvery/runtime";
|
|
|
15
15
|
*
|
|
16
16
|
* Run: bun vendor/silvery/examples/apps/spatial-focus-demo.tsx
|
|
17
17
|
*/
|
|
18
|
-
var import_jsx_runtime = require_jsx_runtime();
|
|
19
18
|
const columns = [
|
|
20
19
|
{
|
|
21
20
|
id: "backlog",
|
|
@@ -200,7 +199,7 @@ const prioritySymbols = {
|
|
|
200
199
|
}
|
|
201
200
|
};
|
|
202
201
|
function Tag({ name }) {
|
|
203
|
-
return /* @__PURE__ */
|
|
202
|
+
return /* @__PURE__ */ jsxs(Text, {
|
|
204
203
|
color: tagColors[name] ?? "$muted",
|
|
205
204
|
dim: true,
|
|
206
205
|
children: ["#", name]
|
|
@@ -208,58 +207,58 @@ function Tag({ name }) {
|
|
|
208
207
|
}
|
|
209
208
|
function CardView({ card, focused }) {
|
|
210
209
|
const priority = card.priority ? prioritySymbols[card.priority] : null;
|
|
211
|
-
return /* @__PURE__ */
|
|
210
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
212
211
|
testID: card.id,
|
|
213
212
|
flexDirection: "column",
|
|
214
213
|
borderStyle: "round",
|
|
215
214
|
borderColor: focused ? "$warning" : "$border",
|
|
216
215
|
children: [
|
|
217
|
-
/* @__PURE__ */
|
|
216
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
218
217
|
paddingX: 1,
|
|
219
218
|
gap: 1,
|
|
220
|
-
children: [priority && /* @__PURE__ */
|
|
219
|
+
children: [priority && /* @__PURE__ */ jsx(Text, {
|
|
221
220
|
color: priority.color,
|
|
222
221
|
children: priority.symbol
|
|
223
|
-
}), /* @__PURE__ */
|
|
222
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
224
223
|
bold: focused,
|
|
225
224
|
color: focused ? "$warning" : void 0,
|
|
226
225
|
wrap: "truncate",
|
|
227
226
|
children: card.title
|
|
228
227
|
})]
|
|
229
228
|
}),
|
|
230
|
-
card.description && /* @__PURE__ */
|
|
229
|
+
card.description && /* @__PURE__ */ jsx(Box, {
|
|
231
230
|
paddingX: 1,
|
|
232
|
-
children: /* @__PURE__ */
|
|
231
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
233
232
|
color: "$muted",
|
|
234
233
|
dim: true,
|
|
235
234
|
wrap: "truncate",
|
|
236
235
|
children: card.description
|
|
237
236
|
})
|
|
238
237
|
}),
|
|
239
|
-
/* @__PURE__ */
|
|
238
|
+
/* @__PURE__ */ jsx(Box, {
|
|
240
239
|
gap: 1,
|
|
241
240
|
paddingX: 1,
|
|
242
|
-
children: card.tags.map((tag) => /* @__PURE__ */
|
|
241
|
+
children: card.tags.map((tag) => /* @__PURE__ */ jsx(Tag, { name: tag }, tag))
|
|
243
242
|
})
|
|
244
243
|
]
|
|
245
244
|
});
|
|
246
245
|
}
|
|
247
246
|
function ColumnView({ column, focusedCardId }) {
|
|
248
247
|
const hasFocus = column.cards.some((c) => c.id === focusedCardId);
|
|
249
|
-
return /* @__PURE__ */
|
|
248
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
250
249
|
flexDirection: "column",
|
|
251
250
|
flexGrow: 1,
|
|
252
251
|
flexBasis: 0,
|
|
253
252
|
borderStyle: "single",
|
|
254
253
|
borderColor: hasFocus ? "$warning" : "$border",
|
|
255
|
-
children: [/* @__PURE__ */
|
|
254
|
+
children: [/* @__PURE__ */ jsxs(Box, {
|
|
256
255
|
backgroundColor: hasFocus ? "$warning" : void 0,
|
|
257
256
|
paddingX: 1,
|
|
258
|
-
children: [/* @__PURE__ */
|
|
257
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
259
258
|
bold: true,
|
|
260
259
|
color: hasFocus ? "$warning-fg" : void 0,
|
|
261
260
|
children: column.title
|
|
262
|
-
}), /* @__PURE__ */
|
|
261
|
+
}), /* @__PURE__ */ jsxs(Text, {
|
|
263
262
|
color: hasFocus ? "$warning-fg" : "$muted",
|
|
264
263
|
children: [
|
|
265
264
|
" (",
|
|
@@ -267,11 +266,11 @@ function ColumnView({ column, focusedCardId }) {
|
|
|
267
266
|
")"
|
|
268
267
|
]
|
|
269
268
|
})]
|
|
270
|
-
}), /* @__PURE__ */
|
|
269
|
+
}), /* @__PURE__ */ jsx(Box, {
|
|
271
270
|
flexDirection: "column",
|
|
272
271
|
paddingX: 1,
|
|
273
272
|
flexGrow: 1,
|
|
274
|
-
children: column.cards.map((card) => /* @__PURE__ */
|
|
273
|
+
children: column.cards.map((card) => /* @__PURE__ */ jsx(CardView, {
|
|
275
274
|
card,
|
|
276
275
|
focused: card.id === focusedCardId
|
|
277
276
|
}, card.id))
|
|
@@ -289,34 +288,34 @@ function StatusBar({ focusedId }) {
|
|
|
289
288
|
break;
|
|
290
289
|
}
|
|
291
290
|
}
|
|
292
|
-
return /* @__PURE__ */
|
|
291
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
293
292
|
paddingX: 1,
|
|
294
293
|
gap: 2,
|
|
295
294
|
children: [
|
|
296
|
-
/* @__PURE__ */
|
|
295
|
+
/* @__PURE__ */ jsx(Text, {
|
|
297
296
|
color: "$muted",
|
|
298
297
|
dim: true,
|
|
299
298
|
children: "←↑↓→/hjkl navigate"
|
|
300
299
|
}),
|
|
301
|
-
/* @__PURE__ */
|
|
300
|
+
/* @__PURE__ */ jsx(Text, {
|
|
302
301
|
color: "$muted",
|
|
303
302
|
dim: true,
|
|
304
303
|
children: "q quit"
|
|
305
304
|
}),
|
|
306
|
-
focusedCard && /* @__PURE__ */
|
|
307
|
-
/* @__PURE__ */
|
|
305
|
+
focusedCard && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
306
|
+
/* @__PURE__ */ jsx(Text, {
|
|
308
307
|
color: "$border",
|
|
309
308
|
children: "│"
|
|
310
309
|
}),
|
|
311
|
-
/* @__PURE__ */
|
|
310
|
+
/* @__PURE__ */ jsx(Text, {
|
|
312
311
|
color: "$warning",
|
|
313
312
|
children: focusedColumn
|
|
314
313
|
}),
|
|
315
|
-
/* @__PURE__ */
|
|
314
|
+
/* @__PURE__ */ jsx(Text, {
|
|
316
315
|
color: "$muted",
|
|
317
316
|
children: "→"
|
|
318
317
|
}),
|
|
319
|
-
/* @__PURE__ */
|
|
318
|
+
/* @__PURE__ */ jsx(Text, { children: focusedCard.title })
|
|
320
319
|
] })
|
|
321
320
|
]
|
|
322
321
|
});
|
|
@@ -330,35 +329,35 @@ function SpatialFocusBoard() {
|
|
|
330
329
|
const dir = key.upArrow ? "up" : key.downArrow ? "down" : key.leftArrow ? "left" : key.rightArrow ? "right" : !hasArrow && input === "k" ? "up" : !hasArrow && input === "j" ? "down" : !hasArrow && input === "h" ? "left" : !hasArrow && input === "l" ? "right" : null;
|
|
331
330
|
if (dir) setFocusedId((id) => navigate(id, dir, index));
|
|
332
331
|
});
|
|
333
|
-
return /* @__PURE__ */
|
|
332
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
334
333
|
flexDirection: "column",
|
|
335
334
|
padding: 1,
|
|
336
335
|
height: "100%",
|
|
337
336
|
children: [
|
|
338
|
-
/* @__PURE__ */
|
|
337
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
339
338
|
marginBottom: 1,
|
|
340
339
|
paddingX: 1,
|
|
341
340
|
gap: 1,
|
|
342
|
-
children: [/* @__PURE__ */
|
|
341
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
343
342
|
bold: true,
|
|
344
343
|
color: "$warning",
|
|
345
344
|
children: "Spatial Focus"
|
|
346
|
-
}), /* @__PURE__ */
|
|
345
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
347
346
|
color: "$muted",
|
|
348
347
|
children: "— arrow keys / hjkl navigate between cards across columns"
|
|
349
348
|
})]
|
|
350
349
|
}),
|
|
351
|
-
/* @__PURE__ */
|
|
350
|
+
/* @__PURE__ */ jsx(Box, {
|
|
352
351
|
flexGrow: 1,
|
|
353
352
|
flexDirection: "row",
|
|
354
353
|
gap: 1,
|
|
355
354
|
overflow: "hidden",
|
|
356
|
-
children: columns.map((column) => /* @__PURE__ */
|
|
355
|
+
children: columns.map((column) => /* @__PURE__ */ jsx(ColumnView, {
|
|
357
356
|
column,
|
|
358
357
|
focusedCardId: focusedId
|
|
359
358
|
}, column.id))
|
|
360
359
|
}),
|
|
361
|
-
/* @__PURE__ */
|
|
360
|
+
/* @__PURE__ */ jsx(StatusBar, { focusedId })
|
|
362
361
|
]
|
|
363
362
|
});
|
|
364
363
|
}
|
|
@@ -376,7 +375,7 @@ const meta = {
|
|
|
376
375
|
async function main() {
|
|
377
376
|
try {
|
|
378
377
|
var _usingCtx$1 = _usingCtx();
|
|
379
|
-
await _usingCtx$1.u(await run(/* @__PURE__ */
|
|
378
|
+
await _usingCtx$1.u(await run(/* @__PURE__ */ jsx(SpatialFocusBoard, {}), { mode: "fullscreen" })).waitUntilExit();
|
|
380
379
|
} catch (_) {
|
|
381
380
|
_usingCtx$1.e = _;
|
|
382
381
|
} finally {
|
package/dist/apps/task-list.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 { useMemo, useState } from "react";
|
|
5
4
|
import { Box, Kbd, Muted, Text, createTerm, render, useApp, useInput } from "silvery";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region apps/task-list.tsx
|
|
7
7
|
/**
|
|
8
8
|
* Task List Example
|
|
@@ -13,7 +13,6 @@ import { Box, Kbd, Muted, Text, createTerm, render, useApp, useInput } from "sil
|
|
|
13
13
|
* - Toggle task completion with space
|
|
14
14
|
* - Variable height items (some with subtasks)
|
|
15
15
|
*/
|
|
16
|
-
var import_jsx_runtime = require_jsx_runtime();
|
|
17
16
|
const meta = {
|
|
18
17
|
name: "Task List",
|
|
19
18
|
description: "Scrollable list with priority badges, toggles, and expandable subtasks",
|
|
@@ -69,7 +68,7 @@ function generateTasks(count) {
|
|
|
69
68
|
}));
|
|
70
69
|
}
|
|
71
70
|
function PriorityBadge({ priority }) {
|
|
72
|
-
return /* @__PURE__ */
|
|
71
|
+
return /* @__PURE__ */ jsxs(Text, {
|
|
73
72
|
color: {
|
|
74
73
|
high: "$error",
|
|
75
74
|
medium: "$warning",
|
|
@@ -90,10 +89,10 @@ function PriorityBadge({ priority }) {
|
|
|
90
89
|
function TaskItem({ task, isSelected, isExpanded }) {
|
|
91
90
|
const checkbox = task.completed ? "[x]" : "[ ]";
|
|
92
91
|
const hasSubtasks = task.subtasks && task.subtasks.length > 0;
|
|
93
|
-
return /* @__PURE__ */
|
|
92
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
94
93
|
flexDirection: "column",
|
|
95
|
-
children: [/* @__PURE__ */
|
|
96
|
-
isSelected ? /* @__PURE__ */
|
|
94
|
+
children: [/* @__PURE__ */ jsxs(Box, { children: [
|
|
95
|
+
isSelected ? /* @__PURE__ */ jsxs(Text, {
|
|
97
96
|
backgroundColor: "$primary",
|
|
98
97
|
color: "$primary-fg",
|
|
99
98
|
children: [
|
|
@@ -103,7 +102,7 @@ function TaskItem({ task, isSelected, isExpanded }) {
|
|
|
103
102
|
task.title,
|
|
104
103
|
" "
|
|
105
104
|
]
|
|
106
|
-
}) : /* @__PURE__ */
|
|
105
|
+
}) : /* @__PURE__ */ jsxs(Text, {
|
|
107
106
|
strikethrough: task.completed,
|
|
108
107
|
dim: task.completed,
|
|
109
108
|
children: [
|
|
@@ -113,8 +112,8 @@ function TaskItem({ task, isSelected, isExpanded }) {
|
|
|
113
112
|
]
|
|
114
113
|
}),
|
|
115
114
|
" ",
|
|
116
|
-
/* @__PURE__ */
|
|
117
|
-
hasSubtasks && /* @__PURE__ */
|
|
115
|
+
/* @__PURE__ */ jsx(PriorityBadge, { priority: task.priority }),
|
|
116
|
+
hasSubtasks && /* @__PURE__ */ jsxs(Text, {
|
|
118
117
|
dim: true,
|
|
119
118
|
children: [
|
|
120
119
|
" (",
|
|
@@ -122,10 +121,10 @@ function TaskItem({ task, isSelected, isExpanded }) {
|
|
|
122
121
|
" subtasks)"
|
|
123
122
|
]
|
|
124
123
|
})
|
|
125
|
-
] }), hasSubtasks && isExpanded && /* @__PURE__ */
|
|
124
|
+
] }), hasSubtasks && isExpanded && /* @__PURE__ */ jsx(Box, {
|
|
126
125
|
flexDirection: "column",
|
|
127
126
|
marginLeft: 4,
|
|
128
|
-
children: task.subtasks.map((subtask, idx) => /* @__PURE__ */
|
|
127
|
+
children: task.subtasks.map((subtask, idx) => /* @__PURE__ */ jsxs(Text, {
|
|
129
128
|
dim: true,
|
|
130
129
|
children: ["- ", subtask]
|
|
131
130
|
}, idx))
|
|
@@ -136,21 +135,21 @@ function StatusBar({ tasks, cursor, scrollOffset, visibleCount }) {
|
|
|
136
135
|
const completed = tasks.filter((t) => t.completed).length;
|
|
137
136
|
const total = tasks.length;
|
|
138
137
|
const percent = Math.round(completed / total * 100);
|
|
139
|
-
return /* @__PURE__ */
|
|
138
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
140
139
|
justifyContent: "space-between",
|
|
141
|
-
children: [/* @__PURE__ */
|
|
140
|
+
children: [/* @__PURE__ */ jsxs(Muted, { children: [
|
|
142
141
|
" ",
|
|
143
|
-
/* @__PURE__ */
|
|
142
|
+
/* @__PURE__ */ jsx(Kbd, { children: "j/k" }),
|
|
144
143
|
" navigate ",
|
|
145
|
-
/* @__PURE__ */
|
|
144
|
+
/* @__PURE__ */ jsx(Kbd, { children: "space" }),
|
|
146
145
|
" toggle ",
|
|
147
|
-
/* @__PURE__ */
|
|
146
|
+
/* @__PURE__ */ jsx(Kbd, { children: "enter" }),
|
|
148
147
|
" expand ",
|
|
149
|
-
/* @__PURE__ */
|
|
148
|
+
/* @__PURE__ */ jsx(Kbd, { children: "Esc/q" }),
|
|
150
149
|
" quit"
|
|
151
|
-
] }), /* @__PURE__ */
|
|
150
|
+
] }), /* @__PURE__ */ jsxs(Muted, { children: [
|
|
152
151
|
" ",
|
|
153
|
-
/* @__PURE__ */
|
|
152
|
+
/* @__PURE__ */ jsx(Text, {
|
|
154
153
|
bold: true,
|
|
155
154
|
children: completed
|
|
156
155
|
}),
|
|
@@ -212,10 +211,10 @@ function TaskList() {
|
|
|
212
211
|
});
|
|
213
212
|
}
|
|
214
213
|
});
|
|
215
|
-
return /* @__PURE__ */
|
|
214
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
216
215
|
flexDirection: "column",
|
|
217
216
|
padding: 1,
|
|
218
|
-
children: [/* @__PURE__ */
|
|
217
|
+
children: [/* @__PURE__ */ jsx(Box, {
|
|
219
218
|
flexGrow: 1,
|
|
220
219
|
flexDirection: "column",
|
|
221
220
|
borderStyle: "round",
|
|
@@ -223,13 +222,13 @@ function TaskList() {
|
|
|
223
222
|
overflow: "hidden",
|
|
224
223
|
height: visibleCount + 2,
|
|
225
224
|
children: visibleTasks.map((task, visibleIndex) => {
|
|
226
|
-
return /* @__PURE__ */
|
|
225
|
+
return /* @__PURE__ */ jsx(TaskItem, {
|
|
227
226
|
task,
|
|
228
227
|
isSelected: scrollOffset + visibleIndex === cursor,
|
|
229
228
|
isExpanded: expandedTasks.has(task.id)
|
|
230
229
|
}, task.id);
|
|
231
230
|
})
|
|
232
|
-
}), /* @__PURE__ */
|
|
231
|
+
}), /* @__PURE__ */ jsx(StatusBar, {
|
|
233
232
|
tasks,
|
|
234
233
|
cursor,
|
|
235
234
|
scrollOffset,
|
|
@@ -241,10 +240,10 @@ async function main() {
|
|
|
241
240
|
try {
|
|
242
241
|
var _usingCtx$1 = _usingCtx();
|
|
243
242
|
const term = _usingCtx$1.u(createTerm());
|
|
244
|
-
const { waitUntilExit } = await render(/* @__PURE__ */
|
|
243
|
+
const { waitUntilExit } = await render(/* @__PURE__ */ jsx(ExampleBanner, {
|
|
245
244
|
meta,
|
|
246
245
|
controls: "j/k navigate space toggle enter expand Esc/q quit",
|
|
247
|
-
children: /* @__PURE__ */
|
|
246
|
+
children: /* @__PURE__ */ jsx(TaskList, {})
|
|
248
247
|
}), term);
|
|
249
248
|
await waitUntilExit();
|
|
250
249
|
} catch (_) {
|