@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/gallery.mjs
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
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, H2, Image, Kbd, Muted, Tab, TabList, TabPanel, Tabs, Text, createTerm, render, useApp, useBoxRect, useInput } from "silvery";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { deflateSync } from "node:zlib";
|
|
7
7
|
//#region apps/gallery.tsx
|
|
8
|
-
var import_jsx_runtime = require_jsx_runtime();
|
|
9
8
|
const meta = {
|
|
10
9
|
name: "Gallery",
|
|
11
10
|
description: "Kitty images, pixel art, and truecolor rendering",
|
|
@@ -244,22 +243,22 @@ function ImagesTab() {
|
|
|
244
243
|
if (input === "j" || key.downArrow || input === "n") setIndex((i) => (i + 1) % images.length);
|
|
245
244
|
if (input === "k" || key.upArrow || input === "p") setIndex((i) => (i - 1 + images.length) % images.length);
|
|
246
245
|
});
|
|
247
|
-
return /* @__PURE__ */
|
|
246
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
248
247
|
flexDirection: "column",
|
|
249
248
|
flexGrow: 1,
|
|
250
249
|
gap: 1,
|
|
251
250
|
children: [
|
|
252
|
-
/* @__PURE__ */
|
|
251
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
253
252
|
paddingX: 1,
|
|
254
253
|
gap: 2,
|
|
255
254
|
children: [
|
|
256
|
-
/* @__PURE__ */
|
|
255
|
+
/* @__PURE__ */ jsx(Text, {
|
|
257
256
|
bold: true,
|
|
258
257
|
color: "$primary",
|
|
259
258
|
children: img.name
|
|
260
259
|
}),
|
|
261
|
-
/* @__PURE__ */
|
|
262
|
-
/* @__PURE__ */
|
|
260
|
+
/* @__PURE__ */ jsx(Muted, { children: img.description }),
|
|
261
|
+
/* @__PURE__ */ jsxs(Muted, { children: [
|
|
263
262
|
"(",
|
|
264
263
|
index + 1,
|
|
265
264
|
"/",
|
|
@@ -268,20 +267,20 @@ function ImagesTab() {
|
|
|
268
267
|
] })
|
|
269
268
|
]
|
|
270
269
|
}),
|
|
271
|
-
/* @__PURE__ */
|
|
270
|
+
/* @__PURE__ */ jsx(Box, {
|
|
272
271
|
flexGrow: 1,
|
|
273
272
|
justifyContent: "center",
|
|
274
273
|
paddingX: 1,
|
|
275
|
-
children: /* @__PURE__ */
|
|
274
|
+
children: /* @__PURE__ */ jsx(Image, {
|
|
276
275
|
src: img.png,
|
|
277
276
|
width: w,
|
|
278
277
|
height: imgH,
|
|
279
278
|
fallback: `[${img.name} — graphics protocol not available. Run in Kitty/WezTerm/Ghostty for images.]`
|
|
280
279
|
})
|
|
281
280
|
}),
|
|
282
|
-
/* @__PURE__ */
|
|
281
|
+
/* @__PURE__ */ jsxs(Muted, { children: [
|
|
283
282
|
" ",
|
|
284
|
-
/* @__PURE__ */
|
|
283
|
+
/* @__PURE__ */ jsx(Kbd, { children: "j/k" }),
|
|
285
284
|
" navigate images"
|
|
286
285
|
] })
|
|
287
286
|
]
|
|
@@ -416,30 +415,30 @@ function PaintTab() {
|
|
|
416
415
|
for (let col = 0; col < canvasW; col++) {
|
|
417
416
|
const top = row * 2 < pixels.length ? pixels[row * 2]?.[col] ?? null : null;
|
|
418
417
|
const bot = row * 2 + 1 < pixels.length ? pixels[row * 2 + 1]?.[col] ?? null : null;
|
|
419
|
-
if (top === null && bot === null) cells.push(/* @__PURE__ */
|
|
420
|
-
else if (top !== null && bot === null) cells.push(/* @__PURE__ */
|
|
418
|
+
if (top === null && bot === null) cells.push(/* @__PURE__ */ jsx(Text, { children: " " }, col));
|
|
419
|
+
else if (top !== null && bot === null) cells.push(/* @__PURE__ */ jsx(Text, {
|
|
421
420
|
color: `rgb(${top[0]},${top[1]},${top[2]})`,
|
|
422
421
|
children: UPPER_HALF
|
|
423
422
|
}, col));
|
|
424
|
-
else if (top === null && bot !== null) cells.push(/* @__PURE__ */
|
|
423
|
+
else if (top === null && bot !== null) cells.push(/* @__PURE__ */ jsx(Text, {
|
|
425
424
|
color: `rgb(${bot[0]},${bot[1]},${bot[2]})`,
|
|
426
425
|
children: LOWER_HALF
|
|
427
426
|
}, col));
|
|
428
|
-
else if (top !== null && top[0] === bot?.[0] && top[1] === bot[1] && top[2] === bot[2]) cells.push(/* @__PURE__ */
|
|
427
|
+
else if (top !== null && top[0] === bot?.[0] && top[1] === bot[1] && top[2] === bot[2]) cells.push(/* @__PURE__ */ jsx(Text, {
|
|
429
428
|
color: `rgb(${top[0]},${top[1]},${top[2]})`,
|
|
430
429
|
children: FULL_BLOCK
|
|
431
430
|
}, col));
|
|
432
|
-
else cells.push(/* @__PURE__ */
|
|
431
|
+
else cells.push(/* @__PURE__ */ jsx(Text, {
|
|
433
432
|
color: `rgb(${top[0]},${top[1]},${top[2]})`,
|
|
434
433
|
backgroundColor: `rgb(${bot[0]},${bot[1]},${bot[2]})`,
|
|
435
434
|
children: UPPER_HALF
|
|
436
435
|
}, col));
|
|
437
436
|
}
|
|
438
|
-
canvasLines.push(/* @__PURE__ */
|
|
437
|
+
canvasLines.push(/* @__PURE__ */ jsx(Box, { children: cells }, row));
|
|
439
438
|
}
|
|
440
439
|
const paletteItems = PAINT_PRESETS.map((p, i) => {
|
|
441
440
|
const selected = i === colorIndex;
|
|
442
|
-
return /* @__PURE__ */
|
|
441
|
+
return /* @__PURE__ */ jsx(Text, {
|
|
443
442
|
backgroundColor: `rgb(${p.color[0]},${p.color[1]},${p.color[2]})`,
|
|
444
443
|
color: p.color[0] + p.color[1] + p.color[2] > 384 ? "black" : "white",
|
|
445
444
|
bold: selected,
|
|
@@ -448,24 +447,24 @@ function PaintTab() {
|
|
|
448
447
|
});
|
|
449
448
|
const toolLabel = tool === "pen" ? "Pen" : "Eraser";
|
|
450
449
|
const [cr, cg, cb] = currentColor;
|
|
451
|
-
return /* @__PURE__ */
|
|
450
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
452
451
|
flexDirection: "column",
|
|
453
452
|
flexGrow: 1,
|
|
454
453
|
children: [
|
|
455
|
-
/* @__PURE__ */
|
|
454
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
456
455
|
paddingX: 1,
|
|
457
456
|
gap: 2,
|
|
458
457
|
children: [
|
|
459
|
-
/* @__PURE__ */
|
|
458
|
+
/* @__PURE__ */ jsx(Text, {
|
|
460
459
|
bold: true,
|
|
461
460
|
color: `rgb(${cr},${cg},${cb})`,
|
|
462
461
|
children: toolLabel
|
|
463
462
|
}),
|
|
464
|
-
/* @__PURE__ */
|
|
463
|
+
/* @__PURE__ */ jsx(Text, {
|
|
465
464
|
backgroundColor: `rgb(${cr},${cg},${cb})`,
|
|
466
465
|
children: " "
|
|
467
466
|
}),
|
|
468
|
-
/* @__PURE__ */
|
|
467
|
+
/* @__PURE__ */ jsxs(Muted, { children: [
|
|
469
468
|
"rgb(",
|
|
470
469
|
cr,
|
|
471
470
|
",",
|
|
@@ -476,28 +475,28 @@ function PaintTab() {
|
|
|
476
475
|
] })
|
|
477
476
|
]
|
|
478
477
|
}),
|
|
479
|
-
/* @__PURE__ */
|
|
478
|
+
/* @__PURE__ */ jsx(Box, {
|
|
480
479
|
flexDirection: "column",
|
|
481
480
|
flexGrow: 1,
|
|
482
481
|
borderStyle: "round",
|
|
483
482
|
marginX: 1,
|
|
484
|
-
children: /* @__PURE__ */
|
|
483
|
+
children: /* @__PURE__ */ jsx(Box, {
|
|
485
484
|
flexDirection: "column",
|
|
486
485
|
children: canvasLines
|
|
487
486
|
})
|
|
488
487
|
}),
|
|
489
|
-
/* @__PURE__ */
|
|
488
|
+
/* @__PURE__ */ jsx(Box, {
|
|
490
489
|
paddingX: 1,
|
|
491
490
|
gap: 0,
|
|
492
491
|
children: paletteItems
|
|
493
492
|
}),
|
|
494
|
-
/* @__PURE__ */
|
|
493
|
+
/* @__PURE__ */ jsxs(Muted, { children: [
|
|
495
494
|
" ",
|
|
496
|
-
/* @__PURE__ */
|
|
495
|
+
/* @__PURE__ */ jsx(Kbd, { children: "1-0" }),
|
|
497
496
|
" color ",
|
|
498
|
-
/* @__PURE__ */
|
|
497
|
+
/* @__PURE__ */ jsx(Kbd, { children: "e" }),
|
|
499
498
|
" eraser ",
|
|
500
|
-
/* @__PURE__ */
|
|
499
|
+
/* @__PURE__ */ jsx(Kbd, { children: "c" }),
|
|
501
500
|
" clear (click canvas in Kitty/Ghostty for mouse paint)"
|
|
502
501
|
] })
|
|
503
502
|
]
|
|
@@ -515,12 +514,12 @@ function TruecolorTab() {
|
|
|
515
514
|
const cells = [];
|
|
516
515
|
for (let col = 0; col < w; col++) {
|
|
517
516
|
const [r, g, b] = hslToRgb(col / w * 360, 1, .35 + row / Math.max(1, hueBarH - 1) * .3);
|
|
518
|
-
cells.push(/* @__PURE__ */
|
|
517
|
+
cells.push(/* @__PURE__ */ jsx(Text, {
|
|
519
518
|
backgroundColor: `rgb(${r},${g},${b})`,
|
|
520
519
|
children: " "
|
|
521
520
|
}, col));
|
|
522
521
|
}
|
|
523
|
-
hueBar.push(/* @__PURE__ */
|
|
522
|
+
hueBar.push(/* @__PURE__ */ jsx(Box, { children: cells }, row));
|
|
524
523
|
}
|
|
525
524
|
const gradient = [];
|
|
526
525
|
for (let row = 0; row < gradientH; row++) {
|
|
@@ -528,12 +527,12 @@ function TruecolorTab() {
|
|
|
528
527
|
const sat = 1 - row / Math.max(1, gradientH - 1) * .8;
|
|
529
528
|
for (let col = 0; col < w; col++) {
|
|
530
529
|
const [r, g, b] = hsvToRgb(col / w * 360, sat, .95);
|
|
531
|
-
cells.push(/* @__PURE__ */
|
|
530
|
+
cells.push(/* @__PURE__ */ jsx(Text, {
|
|
532
531
|
backgroundColor: `rgb(${r},${g},${b})`,
|
|
533
532
|
children: " "
|
|
534
533
|
}, col));
|
|
535
534
|
}
|
|
536
|
-
gradient.push(/* @__PURE__ */
|
|
535
|
+
gradient.push(/* @__PURE__ */ jsx(Box, { children: cells }, row));
|
|
537
536
|
}
|
|
538
537
|
const paletteCols = 16;
|
|
539
538
|
const paletteRows = Math.min(paletteH, Math.ceil(256 / paletteCols));
|
|
@@ -547,55 +546,55 @@ function TruecolorTab() {
|
|
|
547
546
|
const [r, g, b] = ansi256toRgb(idx);
|
|
548
547
|
const label = idx.toString().padStart(3);
|
|
549
548
|
const textColor = r + g + b > 384 ? "black" : "white";
|
|
550
|
-
cells.push(/* @__PURE__ */
|
|
549
|
+
cells.push(/* @__PURE__ */ jsx(Box, {
|
|
551
550
|
width: cellW,
|
|
552
|
-
children: /* @__PURE__ */
|
|
551
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
553
552
|
backgroundColor: `rgb(${r},${g},${b})`,
|
|
554
553
|
color: textColor,
|
|
555
554
|
children: label.slice(0, cellW)
|
|
556
555
|
})
|
|
557
556
|
}, col));
|
|
558
557
|
}
|
|
559
|
-
palette.push(/* @__PURE__ */
|
|
558
|
+
palette.push(/* @__PURE__ */ jsx(Box, { children: cells }, row));
|
|
560
559
|
}
|
|
561
560
|
const grayCells = [];
|
|
562
561
|
for (let col = 0; col < w; col++) {
|
|
563
562
|
const v = Math.round(col / Math.max(1, w - 1) * 255);
|
|
564
|
-
grayCells.push(/* @__PURE__ */
|
|
563
|
+
grayCells.push(/* @__PURE__ */ jsx(Text, {
|
|
565
564
|
backgroundColor: `rgb(${v},${v},${v})`,
|
|
566
565
|
children: " "
|
|
567
566
|
}, col));
|
|
568
567
|
}
|
|
569
|
-
return /* @__PURE__ */
|
|
568
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
570
569
|
flexDirection: "column",
|
|
571
570
|
flexGrow: 1,
|
|
572
571
|
gap: 1,
|
|
573
572
|
paddingX: 1,
|
|
574
573
|
children: [
|
|
575
|
-
/* @__PURE__ */
|
|
574
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
576
575
|
flexDirection: "column",
|
|
577
|
-
children: [/* @__PURE__ */
|
|
576
|
+
children: [/* @__PURE__ */ jsx(H2, { children: "HSL Rainbow" }), /* @__PURE__ */ jsx(Box, {
|
|
578
577
|
flexDirection: "column",
|
|
579
578
|
children: hueBar
|
|
580
579
|
})]
|
|
581
580
|
}),
|
|
582
|
-
/* @__PURE__ */
|
|
581
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
583
582
|
flexDirection: "column",
|
|
584
|
-
children: [/* @__PURE__ */
|
|
583
|
+
children: [/* @__PURE__ */ jsx(H2, { children: "Saturation Gradient" }), /* @__PURE__ */ jsx(Box, {
|
|
585
584
|
flexDirection: "column",
|
|
586
585
|
children: gradient
|
|
587
586
|
})]
|
|
588
587
|
}),
|
|
589
|
-
/* @__PURE__ */
|
|
588
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
590
589
|
flexDirection: "column",
|
|
591
|
-
children: [/* @__PURE__ */
|
|
590
|
+
children: [/* @__PURE__ */ jsx(H2, { children: "256-Color Palette" }), /* @__PURE__ */ jsx(Box, {
|
|
592
591
|
flexDirection: "column",
|
|
593
592
|
children: palette
|
|
594
593
|
})]
|
|
595
594
|
}),
|
|
596
|
-
/* @__PURE__ */
|
|
595
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
597
596
|
flexDirection: "column",
|
|
598
|
-
children: [/* @__PURE__ */
|
|
597
|
+
children: [/* @__PURE__ */ jsx(H2, { children: "Grayscale Ramp" }), /* @__PURE__ */ jsx(Box, { children: grayCells })]
|
|
599
598
|
})
|
|
600
599
|
]
|
|
601
600
|
});
|
|
@@ -708,38 +707,38 @@ function Gallery() {
|
|
|
708
707
|
useInput((input, key) => {
|
|
709
708
|
if (input === "q" || key.escape) exit();
|
|
710
709
|
});
|
|
711
|
-
return /* @__PURE__ */
|
|
710
|
+
return /* @__PURE__ */ jsx(Box, {
|
|
712
711
|
flexDirection: "column",
|
|
713
712
|
flexGrow: 1,
|
|
714
|
-
children: /* @__PURE__ */
|
|
713
|
+
children: /* @__PURE__ */ jsxs(Tabs, {
|
|
715
714
|
value: activeTab,
|
|
716
715
|
onChange: setActiveTab,
|
|
717
716
|
children: [
|
|
718
|
-
/* @__PURE__ */
|
|
719
|
-
/* @__PURE__ */
|
|
717
|
+
/* @__PURE__ */ jsxs(TabList, { children: [
|
|
718
|
+
/* @__PURE__ */ jsx(Tab, {
|
|
720
719
|
value: "images",
|
|
721
720
|
children: "Images"
|
|
722
721
|
}),
|
|
723
|
-
/* @__PURE__ */
|
|
722
|
+
/* @__PURE__ */ jsx(Tab, {
|
|
724
723
|
value: "paint",
|
|
725
724
|
children: "Paint"
|
|
726
725
|
}),
|
|
727
|
-
/* @__PURE__ */
|
|
726
|
+
/* @__PURE__ */ jsx(Tab, {
|
|
728
727
|
value: "truecolor",
|
|
729
728
|
children: "Truecolor"
|
|
730
729
|
})
|
|
731
730
|
] }),
|
|
732
|
-
/* @__PURE__ */
|
|
731
|
+
/* @__PURE__ */ jsx(TabPanel, {
|
|
733
732
|
value: "images",
|
|
734
|
-
children: /* @__PURE__ */
|
|
733
|
+
children: /* @__PURE__ */ jsx(ImagesTab, {})
|
|
735
734
|
}),
|
|
736
|
-
/* @__PURE__ */
|
|
735
|
+
/* @__PURE__ */ jsx(TabPanel, {
|
|
737
736
|
value: "paint",
|
|
738
|
-
children: /* @__PURE__ */
|
|
737
|
+
children: /* @__PURE__ */ jsx(PaintTab, {})
|
|
739
738
|
}),
|
|
740
|
-
/* @__PURE__ */
|
|
739
|
+
/* @__PURE__ */ jsx(TabPanel, {
|
|
741
740
|
value: "truecolor",
|
|
742
|
-
children: /* @__PURE__ */
|
|
741
|
+
children: /* @__PURE__ */ jsx(TruecolorTab, {})
|
|
743
742
|
})
|
|
744
743
|
]
|
|
745
744
|
})
|
|
@@ -749,10 +748,10 @@ async function main() {
|
|
|
749
748
|
try {
|
|
750
749
|
var _usingCtx$1 = _usingCtx();
|
|
751
750
|
const term = _usingCtx$1.u(createTerm());
|
|
752
|
-
const { waitUntilExit } = await render(/* @__PURE__ */
|
|
751
|
+
const { waitUntilExit } = await render(/* @__PURE__ */ jsx(ExampleBanner, {
|
|
753
752
|
meta,
|
|
754
753
|
controls: "h/l tab j/k navigate Esc/q quit",
|
|
755
|
-
children: /* @__PURE__ */
|
|
754
|
+
children: /* @__PURE__ */ jsx(Gallery, {})
|
|
756
755
|
}), term);
|
|
757
756
|
await waitUntilExit();
|
|
758
757
|
} catch (_) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as TerminalBuffer, N as init_buffer, i as outputPhase, r as createOutputPhase } from "../ansi-
|
|
1
|
+
import { D as TerminalBuffer, N as init_buffer, i as outputPhase, r as createOutputPhase } from "../ansi-0VXlUmNn.mjs";
|
|
2
2
|
//#region apps/inline-bench.tsx
|
|
3
3
|
init_buffer();
|
|
4
4
|
const RUNS = 500;
|
package/dist/apps/kanban.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, Text, createTerm, render, useApp, useInput } from "silvery";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region apps/kanban.tsx
|
|
7
7
|
/**
|
|
8
8
|
* Kanban Board Example
|
|
@@ -13,7 +13,6 @@ import { Box, Text, createTerm, render, useApp, useInput } from "silvery";
|
|
|
13
13
|
* - Each column uses native overflow="scroll" for scrolling
|
|
14
14
|
* - Flexbox layout for proportional sizing
|
|
15
15
|
*/
|
|
16
|
-
var import_jsx_runtime = require_jsx_runtime();
|
|
17
16
|
const meta = {
|
|
18
17
|
name: "Kanban Board",
|
|
19
18
|
description: "3-column kanban with card movement and independent scroll",
|
|
@@ -130,54 +129,54 @@ const tagColors = {
|
|
|
130
129
|
security: "$error"
|
|
131
130
|
};
|
|
132
131
|
function Tag({ name }) {
|
|
133
|
-
return /* @__PURE__ */
|
|
132
|
+
return /* @__PURE__ */ jsxs(Text, {
|
|
134
133
|
color: tagColors[name] ?? "$muted",
|
|
135
134
|
dim: true,
|
|
136
135
|
children: ["#", name]
|
|
137
136
|
});
|
|
138
137
|
}
|
|
139
138
|
function CardComponent({ card, isSelected }) {
|
|
140
|
-
return /* @__PURE__ */
|
|
139
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
141
140
|
flexDirection: "column",
|
|
142
141
|
borderStyle: "round",
|
|
143
142
|
borderColor: isSelected ? "$primary" : "$border",
|
|
144
|
-
children: [isSelected ? /* @__PURE__ */
|
|
143
|
+
children: [isSelected ? /* @__PURE__ */ jsx(Box, {
|
|
145
144
|
backgroundColor: "$primary",
|
|
146
145
|
paddingX: 1,
|
|
147
|
-
children: /* @__PURE__ */
|
|
146
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
148
147
|
color: "$primary-fg",
|
|
149
148
|
bold: true,
|
|
150
149
|
wrap: "truncate",
|
|
151
150
|
children: card.title
|
|
152
151
|
})
|
|
153
|
-
}) : /* @__PURE__ */
|
|
152
|
+
}) : /* @__PURE__ */ jsx(Box, {
|
|
154
153
|
paddingX: 1,
|
|
155
|
-
children: /* @__PURE__ */
|
|
154
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
156
155
|
wrap: "truncate",
|
|
157
156
|
children: card.title
|
|
158
157
|
})
|
|
159
|
-
}), /* @__PURE__ */
|
|
158
|
+
}), /* @__PURE__ */ jsx(Box, {
|
|
160
159
|
gap: 1,
|
|
161
160
|
paddingX: 1,
|
|
162
|
-
children: card.tags.map((tag) => /* @__PURE__ */
|
|
161
|
+
children: card.tags.map((tag) => /* @__PURE__ */ jsx(Tag, { name: tag }, tag))
|
|
163
162
|
})]
|
|
164
163
|
});
|
|
165
164
|
}
|
|
166
165
|
function ColumnComponent({ column, isSelected, selectedCardIndex }) {
|
|
167
|
-
return /* @__PURE__ */
|
|
166
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
168
167
|
flexDirection: "column",
|
|
169
168
|
flexGrow: 1,
|
|
170
169
|
flexBasis: 0,
|
|
171
170
|
borderStyle: "single",
|
|
172
171
|
borderColor: isSelected ? "$primary" : "$border",
|
|
173
|
-
children: [/* @__PURE__ */
|
|
172
|
+
children: [/* @__PURE__ */ jsxs(Box, {
|
|
174
173
|
backgroundColor: isSelected ? "$primary" : void 0,
|
|
175
174
|
paddingX: 1,
|
|
176
|
-
children: [/* @__PURE__ */
|
|
175
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
177
176
|
bold: true,
|
|
178
177
|
color: isSelected ? "$primary-fg" : "$text",
|
|
179
178
|
children: column.title
|
|
180
|
-
}), /* @__PURE__ */
|
|
179
|
+
}), /* @__PURE__ */ jsxs(Text, {
|
|
181
180
|
color: isSelected ? "$primary-fg" : "$muted",
|
|
182
181
|
children: [
|
|
183
182
|
" (",
|
|
@@ -185,16 +184,16 @@ function ColumnComponent({ column, isSelected, selectedCardIndex }) {
|
|
|
185
184
|
")"
|
|
186
185
|
]
|
|
187
186
|
})]
|
|
188
|
-
}), /* @__PURE__ */
|
|
187
|
+
}), /* @__PURE__ */ jsxs(Box, {
|
|
189
188
|
flexDirection: "column",
|
|
190
189
|
paddingX: 1,
|
|
191
190
|
overflow: "scroll",
|
|
192
191
|
scrollTo: isSelected ? selectedCardIndex : void 0,
|
|
193
192
|
flexGrow: 1,
|
|
194
|
-
children: [column.cards.map((card, cardIndex) => /* @__PURE__ */
|
|
193
|
+
children: [column.cards.map((card, cardIndex) => /* @__PURE__ */ jsx(CardComponent, {
|
|
195
194
|
card,
|
|
196
195
|
isSelected: isSelected && cardIndex === selectedCardIndex
|
|
197
|
-
}, card.id)), column.cards.length === 0 && /* @__PURE__ */
|
|
196
|
+
}, card.id)), column.cards.length === 0 && /* @__PURE__ */ jsx(Text, {
|
|
198
197
|
dim: true,
|
|
199
198
|
italic: true,
|
|
200
199
|
children: "No cards"
|
|
@@ -242,16 +241,16 @@ function KanbanBoard() {
|
|
|
242
241
|
setSelectedColumn(targetColumnIndex);
|
|
243
242
|
setSelectedCard(columns[targetColumnIndex].cards.length);
|
|
244
243
|
}
|
|
245
|
-
return /* @__PURE__ */
|
|
244
|
+
return /* @__PURE__ */ jsx(Box, {
|
|
246
245
|
flexDirection: "column",
|
|
247
246
|
padding: 1,
|
|
248
247
|
height: "100%",
|
|
249
|
-
children: /* @__PURE__ */
|
|
248
|
+
children: /* @__PURE__ */ jsx(Box, {
|
|
250
249
|
flexGrow: 1,
|
|
251
250
|
flexDirection: "row",
|
|
252
251
|
gap: 1,
|
|
253
252
|
overflow: "hidden",
|
|
254
|
-
children: columns.map((column, colIndex) => /* @__PURE__ */
|
|
253
|
+
children: columns.map((column, colIndex) => /* @__PURE__ */ jsx(ColumnComponent, {
|
|
255
254
|
column,
|
|
256
255
|
isSelected: colIndex === selectedColumn,
|
|
257
256
|
selectedCardIndex: colIndex === selectedColumn ? boundedSelectedCard : -1
|
|
@@ -263,10 +262,10 @@ async function main() {
|
|
|
263
262
|
try {
|
|
264
263
|
var _usingCtx$1 = _usingCtx();
|
|
265
264
|
const term = _usingCtx$1.u(createTerm());
|
|
266
|
-
const { waitUntilExit } = await render(/* @__PURE__ */
|
|
265
|
+
const { waitUntilExit } = await render(/* @__PURE__ */ jsx(ExampleBanner, {
|
|
267
266
|
meta,
|
|
268
267
|
controls: "h/l column j/k card </> move Esc/q quit",
|
|
269
|
-
children: /* @__PURE__ */
|
|
268
|
+
children: /* @__PURE__ */ jsx(KanbanBoard, {})
|
|
270
269
|
}), term);
|
|
271
270
|
await waitUntilExit();
|
|
272
271
|
} catch (_) {
|
package/dist/apps/layout-ref.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 { useRef, useState } from "react";
|
|
5
4
|
import { Box, H1, Kbd, Muted, Text, createTerm, render, useApp, useInput } from "silvery";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region apps/layout-ref.tsx
|
|
7
7
|
/**
|
|
8
8
|
* Layout Ref Example
|
|
@@ -12,7 +12,6 @@ import { Box, H1, Kbd, Muted, Text, createTerm, render, useApp, useInput } from
|
|
|
12
12
|
* - BoxHandle for accessing layout info imperatively
|
|
13
13
|
* - onLayout callback for responding to size changes
|
|
14
14
|
*/
|
|
15
|
-
var import_jsx_runtime = require_jsx_runtime();
|
|
16
15
|
const meta = {
|
|
17
16
|
name: "Layout Ref",
|
|
18
17
|
description: "useBoxRect + useScrollRect for imperative layout measurement",
|
|
@@ -24,14 +23,14 @@ const meta = {
|
|
|
24
23
|
]
|
|
25
24
|
};
|
|
26
25
|
function ResizablePane({ title, color, onLayoutChange }) {
|
|
27
|
-
return /* @__PURE__ */
|
|
26
|
+
return /* @__PURE__ */ jsx(Box, {
|
|
28
27
|
ref: useRef(null),
|
|
29
28
|
flexGrow: 1,
|
|
30
29
|
borderStyle: "round",
|
|
31
30
|
borderColor: color,
|
|
32
31
|
padding: 1,
|
|
33
32
|
onLayout: (layout) => onLayoutChange(layout),
|
|
34
|
-
children: /* @__PURE__ */
|
|
33
|
+
children: /* @__PURE__ */ jsx(H1, {
|
|
35
34
|
color,
|
|
36
35
|
children: title
|
|
37
36
|
})
|
|
@@ -50,23 +49,23 @@ function ImperativeAccessDemo() {
|
|
|
50
49
|
const node = boxRef.current.getNode();
|
|
51
50
|
setInfo(`Content: ${content?.width}x${content?.height} at (${content?.x},${content?.y})\nScreen: ${screen?.width}x${screen?.height} at (${screen?.x},${screen?.y})\nNode: ${node ? "available" : "null"}`);
|
|
52
51
|
};
|
|
53
|
-
return /* @__PURE__ */
|
|
52
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
54
53
|
ref: boxRef,
|
|
55
54
|
flexDirection: "column",
|
|
56
55
|
borderStyle: "double",
|
|
57
56
|
borderColor: "$accent",
|
|
58
57
|
padding: 1,
|
|
59
58
|
children: [
|
|
60
|
-
/* @__PURE__ */
|
|
59
|
+
/* @__PURE__ */ jsx(H1, {
|
|
61
60
|
color: "$accent",
|
|
62
61
|
children: "Imperative Access (BoxHandle)"
|
|
63
62
|
}),
|
|
64
|
-
/* @__PURE__ */
|
|
65
|
-
/* @__PURE__ */
|
|
63
|
+
/* @__PURE__ */ jsx(Muted, { children: "Press 'i' to inspect this box" }),
|
|
64
|
+
/* @__PURE__ */ jsx(Box, {
|
|
66
65
|
marginTop: 1,
|
|
67
|
-
children: /* @__PURE__ */
|
|
66
|
+
children: /* @__PURE__ */ jsx(Text, { children: info })
|
|
68
67
|
}),
|
|
69
|
-
/* @__PURE__ */
|
|
68
|
+
/* @__PURE__ */ jsx(InspectTrigger, { onInspect: inspect })
|
|
70
69
|
]
|
|
71
70
|
});
|
|
72
71
|
}
|
|
@@ -88,46 +87,46 @@ function LayoutRefApp() {
|
|
|
88
87
|
[pane]: info
|
|
89
88
|
}));
|
|
90
89
|
};
|
|
91
|
-
return /* @__PURE__ */
|
|
90
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
92
91
|
flexDirection: "column",
|
|
93
92
|
padding: 1,
|
|
94
93
|
children: [
|
|
95
|
-
/* @__PURE__ */
|
|
94
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
96
95
|
flexDirection: "row",
|
|
97
96
|
gap: 1,
|
|
98
97
|
height: 8,
|
|
99
98
|
children: [
|
|
100
|
-
/* @__PURE__ */
|
|
99
|
+
/* @__PURE__ */ jsx(ResizablePane, {
|
|
101
100
|
title: "Pane A",
|
|
102
101
|
color: "$success",
|
|
103
102
|
onLayoutChange: handleLayoutChange("a")
|
|
104
103
|
}),
|
|
105
|
-
/* @__PURE__ */
|
|
104
|
+
/* @__PURE__ */ jsx(ResizablePane, {
|
|
106
105
|
title: "Pane B",
|
|
107
106
|
color: "$info",
|
|
108
107
|
onLayoutChange: handleLayoutChange("b")
|
|
109
108
|
}),
|
|
110
|
-
/* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ jsx(ResizablePane, {
|
|
111
110
|
title: "Pane C",
|
|
112
111
|
color: "$primary",
|
|
113
112
|
onLayoutChange: handleLayoutChange("c")
|
|
114
113
|
})
|
|
115
114
|
]
|
|
116
115
|
}),
|
|
117
|
-
/* @__PURE__ */
|
|
116
|
+
/* @__PURE__ */ jsx(Box, {
|
|
118
117
|
marginTop: 1,
|
|
119
118
|
borderStyle: "single",
|
|
120
119
|
borderColor: "$border",
|
|
121
120
|
padding: 1,
|
|
122
|
-
children: /* @__PURE__ */
|
|
121
|
+
children: /* @__PURE__ */ jsxs(Box, {
|
|
123
122
|
flexDirection: "column",
|
|
124
123
|
children: [
|
|
125
|
-
/* @__PURE__ */
|
|
124
|
+
/* @__PURE__ */ jsx(Text, {
|
|
126
125
|
bold: true,
|
|
127
126
|
dim: true,
|
|
128
127
|
children: "onLayout Results:"
|
|
129
128
|
}),
|
|
130
|
-
Object.entries(layouts).map(([pane, info]) => /* @__PURE__ */
|
|
129
|
+
Object.entries(layouts).map(([pane, info]) => /* @__PURE__ */ jsxs(Text, {
|
|
131
130
|
dim: true,
|
|
132
131
|
children: [
|
|
133
132
|
"Pane ",
|
|
@@ -143,7 +142,7 @@ function LayoutRefApp() {
|
|
|
143
142
|
")"
|
|
144
143
|
]
|
|
145
144
|
}, pane)),
|
|
146
|
-
Object.keys(layouts).length === 0 && /* @__PURE__ */
|
|
145
|
+
Object.keys(layouts).length === 0 && /* @__PURE__ */ jsx(Text, {
|
|
147
146
|
dim: true,
|
|
148
147
|
italic: true,
|
|
149
148
|
children: "Waiting for layout..."
|
|
@@ -151,16 +150,16 @@ function LayoutRefApp() {
|
|
|
151
150
|
]
|
|
152
151
|
})
|
|
153
152
|
}),
|
|
154
|
-
/* @__PURE__ */
|
|
153
|
+
/* @__PURE__ */ jsx(Box, {
|
|
155
154
|
flexGrow: 1,
|
|
156
155
|
marginTop: 1,
|
|
157
|
-
children: /* @__PURE__ */
|
|
156
|
+
children: /* @__PURE__ */ jsx(ImperativeAccessDemo, {})
|
|
158
157
|
}),
|
|
159
|
-
/* @__PURE__ */
|
|
158
|
+
/* @__PURE__ */ jsxs(Muted, { children: [
|
|
160
159
|
" ",
|
|
161
|
-
/* @__PURE__ */
|
|
160
|
+
/* @__PURE__ */ jsx(Kbd, { children: "i" }),
|
|
162
161
|
" inspect ",
|
|
163
|
-
/* @__PURE__ */
|
|
162
|
+
/* @__PURE__ */ jsx(Kbd, { children: "Esc/q" }),
|
|
164
163
|
" quit"
|
|
165
164
|
] })
|
|
166
165
|
]
|
|
@@ -170,10 +169,10 @@ async function main() {
|
|
|
170
169
|
try {
|
|
171
170
|
var _usingCtx$1 = _usingCtx();
|
|
172
171
|
const term = _usingCtx$1.u(createTerm());
|
|
173
|
-
const { waitUntilExit } = await render(/* @__PURE__ */
|
|
172
|
+
const { waitUntilExit } = await render(/* @__PURE__ */ jsx(ExampleBanner, {
|
|
174
173
|
meta,
|
|
175
174
|
controls: "i inspect Esc/q quit",
|
|
176
|
-
children: /* @__PURE__ */
|
|
175
|
+
children: /* @__PURE__ */ jsx(LayoutRefApp, {})
|
|
177
176
|
}), term);
|
|
178
177
|
await waitUntilExit();
|
|
179
178
|
} catch (_) {
|