@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
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import { Box, Muted, Strong, Text, ThemeProvider, getThemeByName } from "silvery";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region _banner.tsx
|
|
5
|
+
/**
|
|
6
|
+
* Compact header shown when examples run standalone.
|
|
7
|
+
* Wraps children in ThemeProvider for consistent theming.
|
|
8
|
+
*/
|
|
9
|
+
function ExampleBanner({ meta, controls, theme, children }) {
|
|
10
|
+
return /* @__PURE__ */ jsx(ThemeProvider, {
|
|
11
|
+
theme: theme ?? getThemeByName(process.env.SILVERY_THEME),
|
|
12
|
+
children: /* @__PURE__ */ jsxs(Box, {
|
|
13
|
+
flexDirection: "column",
|
|
14
|
+
flexGrow: 1,
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
17
|
+
paddingX: 1,
|
|
18
|
+
gap: 1,
|
|
19
|
+
children: [
|
|
20
|
+
/* @__PURE__ */ jsx(Text, {
|
|
21
|
+
dim: true,
|
|
22
|
+
color: "$warning",
|
|
23
|
+
children: "▸ silvery"
|
|
24
|
+
}),
|
|
25
|
+
/* @__PURE__ */ jsx(Strong, { children: meta.name }),
|
|
26
|
+
/* @__PURE__ */ jsxs(Muted, { children: ["— ", meta.description] })
|
|
27
|
+
]
|
|
28
|
+
}),
|
|
29
|
+
meta.features && meta.features.length > 0 && /* @__PURE__ */ jsx(Box, {
|
|
30
|
+
paddingX: 1,
|
|
31
|
+
children: /* @__PURE__ */ jsxs(Muted, { children: [" ", meta.features.join(" · ")] })
|
|
32
|
+
}),
|
|
33
|
+
controls && /* @__PURE__ */ jsx(Box, {
|
|
34
|
+
paddingX: 1,
|
|
35
|
+
children: /* @__PURE__ */ jsxs(Muted, { children: [" ", controls] })
|
|
36
|
+
}),
|
|
37
|
+
children
|
|
38
|
+
]
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { ExampleBanner as t };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { a as __toCommonJS, i as __require, n as __esmMin, r as __exportAll, t as __commonJSMin } from "./chunk-BSw8zbkd.mjs";
|
|
2
2
|
import { A as detectUnicode, C as bgColorCode, D as detectCursor, E as detectColor, O as detectInput, T as defaultCaps, _ as createStyle, g as createMixedStyle, k as detectTerminalCaps, n as src_exports$3, p as init_src$3, t as init_src$4, w as fgColorCode } from "./src-CUUOuRH6.mjs";
|
|
3
3
|
import { n as keyToAnsi$1, r as parseKey$1, t as init_key_mapping } from "./key-mapping-D4LR1go6.mjs";
|
|
4
|
-
import { _ as screenshotPng, a as ensureCachedVersion, c as isReady, d as init_terminal, f as createCellView, g as init_png, h as init_views, i as createTerminalByName, l as manifest, m as createRowView, n as backends, o as entry, p as createRegionView, r as buildBackend, s as init_backends, t as backend, u as createTerminal, v as init_svg, y as screenshotSvg } from "./backends-
|
|
5
|
-
import { n as init_gif, t as createGif } from "./gif-
|
|
6
|
-
import { n as init_apng, t as createApng } from "./apng-
|
|
4
|
+
import { _ as screenshotPng, a as ensureCachedVersion, c as isReady, d as init_terminal, f as createCellView, g as init_png, h as init_views, i as createTerminalByName, l as manifest, m as createRowView, n as backends, o as entry, p as createRegionView, r as buildBackend, s as init_backends, t as backend, u as createTerminal, v as init_svg, y as screenshotSvg } from "./backends-Dj-11kZF.mjs";
|
|
5
|
+
import { n as init_gif, t as createGif } from "./gif-CfkOF-iG.mjs";
|
|
6
|
+
import { n as init_apng, t as createApng } from "./apng-BTRDTfDW.mjs";
|
|
7
7
|
import { createLogger } from "loggily";
|
|
8
8
|
import { closeSync, openSync, writeSync } from "node:fs";
|
|
9
9
|
//#region ../packages/ag/src/keys.ts
|
|
@@ -7228,7 +7228,7 @@ async function executeTape(tape, options) {
|
|
|
7228
7228
|
let backendInstance;
|
|
7229
7229
|
const backendOpt = options?.backend ?? "vterm";
|
|
7230
7230
|
if (typeof backendOpt === "string") {
|
|
7231
|
-
const { backend } = await import("./backends-
|
|
7231
|
+
const { backend } = await import("./backends-U3QwStfO.mjs");
|
|
7232
7232
|
backendInstance = await backend(backendOpt);
|
|
7233
7233
|
} else backendInstance = backendOpt;
|
|
7234
7234
|
const terminal = createTerminal({
|
|
@@ -7741,11 +7741,11 @@ async function renderAnimation(frames, format, options) {
|
|
|
7741
7741
|
switch (format) {
|
|
7742
7742
|
case "svg": return createAnimatedSvg(frames, options);
|
|
7743
7743
|
case "gif": {
|
|
7744
|
-
const { createGif } = await import("./gif-
|
|
7744
|
+
const { createGif } = await import("./gif-B6NGH5gs.mjs");
|
|
7745
7745
|
return createGif(frames, options);
|
|
7746
7746
|
}
|
|
7747
7747
|
case "apng": {
|
|
7748
|
-
const { createApng } = await import("./apng-
|
|
7748
|
+
const { createApng } = await import("./apng-B0gRaDVT.mjs");
|
|
7749
7749
|
return createApng(frames, options);
|
|
7750
7750
|
}
|
|
7751
7751
|
default: throw new Error(`Unsupported animation format: ${format}`);
|
|
@@ -12604,7 +12604,7 @@ var init_ghostty_web = __esmMin((() => {
|
|
|
12604
12604
|
await C.exists() && (B = await C.arrayBuffer());
|
|
12605
12605
|
} catch {}
|
|
12606
12606
|
if (!B) try {
|
|
12607
|
-
const I = await (await import("./__vite-browser-external-2447137e-
|
|
12607
|
+
const I = await (await import("./__vite-browser-external-2447137e-Bopa5BFR.mjs")).readFile(A);
|
|
12608
12608
|
B = I.buffer.slice(I.byteOffset, I.byteOffset + I.byteLength);
|
|
12609
12609
|
} catch {}
|
|
12610
12610
|
if (!B) {
|
|
@@ -3,7 +3,7 @@ import { n as __esmMin, o as __toESM } from "./chunk-BSw8zbkd.mjs";
|
|
|
3
3
|
async function loadUpng() {
|
|
4
4
|
if (upngModule) return upngModule;
|
|
5
5
|
try {
|
|
6
|
-
upngModule = await import("./UPNG-
|
|
6
|
+
upngModule = await import("./UPNG-ShUlaTDh.mjs").then((m) => /* @__PURE__ */ __toESM(m.default, 1));
|
|
7
7
|
return upngModule;
|
|
8
8
|
} catch {
|
|
9
9
|
throw new Error("createApng() requires upng-js. Install it:\n bun add upng-js");
|
|
@@ -12,7 +12,7 @@ async function loadUpng() {
|
|
|
12
12
|
async function loadResvg() {
|
|
13
13
|
if (resvgModule) return resvgModule;
|
|
14
14
|
try {
|
|
15
|
-
resvgModule = await import("./resvg-js-
|
|
15
|
+
resvgModule = await import("./resvg-js-Cnk2o49d.mjs").then((m) => /* @__PURE__ */ __toESM(m.default, 1));
|
|
16
16
|
return resvgModule;
|
|
17
17
|
} catch {
|
|
18
18
|
throw new Error("createApng() requires @resvg/resvg-js. Install it:\n bun add @resvg/resvg-js");
|
|
@@ -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, useEffect, useMemo, useRef, useState } from "react";
|
|
4
3
|
import { Box, Link, ListView, Spinner, Text, TextInput, fx, useTea, useTerminalFocused, useWindowSize } from "silvery";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { run, useExit, useInput as useInput$1 } from "silvery/runtime";
|
|
6
6
|
//#region apps/aichat/script.ts
|
|
7
7
|
const CONTEXT_WINDOW = 2e5;
|
|
@@ -760,7 +760,6 @@ function createDemoUpdate(script, fastMode, autoMode) {
|
|
|
760
760
|
}
|
|
761
761
|
//#endregion
|
|
762
762
|
//#region apps/aichat/components.tsx
|
|
763
|
-
var import_jsx_runtime = require_jsx_runtime();
|
|
764
763
|
/** Split content into a short title (first sentence) and the remaining body.
|
|
765
764
|
* Title must be ≤40 chars to fit on the header line with metadata. */
|
|
766
765
|
function splitTitleBody(content) {
|
|
@@ -785,39 +784,39 @@ function LinkifiedLine({ text, dim, color }) {
|
|
|
785
784
|
let match;
|
|
786
785
|
URL_RE.lastIndex = 0;
|
|
787
786
|
while ((match = URL_RE.exec(text)) !== null) {
|
|
788
|
-
if (match.index > lastIndex) parts.push(/* @__PURE__ */
|
|
787
|
+
if (match.index > lastIndex) parts.push(/* @__PURE__ */ jsx(Text, {
|
|
789
788
|
dim,
|
|
790
789
|
color,
|
|
791
790
|
children: text.slice(lastIndex, match.index)
|
|
792
791
|
}, `t${lastIndex}`));
|
|
793
792
|
const url = match[0];
|
|
794
|
-
parts.push(/* @__PURE__ */
|
|
793
|
+
parts.push(/* @__PURE__ */ jsx(Link, {
|
|
795
794
|
href: url,
|
|
796
795
|
dim,
|
|
797
796
|
children: url
|
|
798
797
|
}, `l${match.index}`));
|
|
799
798
|
lastIndex = match.index + url.length;
|
|
800
799
|
}
|
|
801
|
-
if (lastIndex < text.length) parts.push(/* @__PURE__ */
|
|
800
|
+
if (lastIndex < text.length) parts.push(/* @__PURE__ */ jsx(Text, {
|
|
802
801
|
dim,
|
|
803
802
|
color,
|
|
804
803
|
children: text.slice(lastIndex)
|
|
805
804
|
}, `t${lastIndex}`));
|
|
806
|
-
if (parts.length === 0) return /* @__PURE__ */
|
|
805
|
+
if (parts.length === 0) return /* @__PURE__ */ jsx(Text, {
|
|
807
806
|
dim,
|
|
808
807
|
color,
|
|
809
808
|
children: text
|
|
810
809
|
});
|
|
811
|
-
return /* @__PURE__ */
|
|
810
|
+
return /* @__PURE__ */ jsx(Text, { children: parts });
|
|
812
811
|
}
|
|
813
812
|
/** Thinking block — shows thinking text preview in the body. */
|
|
814
813
|
function ThinkingBlock({ text, done }) {
|
|
815
|
-
if (done) return /* @__PURE__ */
|
|
814
|
+
if (done) return /* @__PURE__ */ jsx(Text, {
|
|
816
815
|
color: "$muted",
|
|
817
816
|
italic: true,
|
|
818
817
|
children: "▸ thought"
|
|
819
818
|
});
|
|
820
|
-
return /* @__PURE__ */
|
|
819
|
+
return /* @__PURE__ */ jsx(Text, {
|
|
821
820
|
color: "$muted",
|
|
822
821
|
wrap: "truncate",
|
|
823
822
|
italic: true,
|
|
@@ -827,50 +826,50 @@ function ThinkingBlock({ text, done }) {
|
|
|
827
826
|
/** Tool call with lifecycle: spinner -> output -> checkmark. */
|
|
828
827
|
function ToolCallBlock({ call, phase }) {
|
|
829
828
|
const color = TOOL_COLORS[call.tool] ?? "$muted";
|
|
830
|
-
return /* @__PURE__ */
|
|
829
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
831
830
|
flexDirection: "column",
|
|
832
831
|
marginTop: 0,
|
|
833
|
-
children: [/* @__PURE__ */
|
|
834
|
-
phase === "running" ? /* @__PURE__ */
|
|
832
|
+
children: [/* @__PURE__ */ jsxs(Text, { children: [
|
|
833
|
+
phase === "running" ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Spinner, { type: "dots" }), " "] }) : phase === "done" ? /* @__PURE__ */ jsx(Text, {
|
|
835
834
|
color: "$success",
|
|
836
835
|
children: "✓ "
|
|
837
|
-
}) : /* @__PURE__ */
|
|
836
|
+
}) : /* @__PURE__ */ jsx(Text, {
|
|
838
837
|
color: "$muted",
|
|
839
838
|
children: "○ "
|
|
840
839
|
}),
|
|
841
|
-
/* @__PURE__ */
|
|
840
|
+
/* @__PURE__ */ jsx(Text, {
|
|
842
841
|
color,
|
|
843
842
|
bold: true,
|
|
844
843
|
children: call.tool
|
|
845
844
|
}),
|
|
846
845
|
" ",
|
|
847
|
-
call.tool === "Bash" || call.tool === "Grep" || call.tool === "Glob" ? /* @__PURE__ */
|
|
846
|
+
call.tool === "Bash" || call.tool === "Grep" || call.tool === "Glob" ? /* @__PURE__ */ jsx(Text, {
|
|
848
847
|
color: "$muted",
|
|
849
848
|
children: call.args
|
|
850
|
-
}) : /* @__PURE__ */
|
|
849
|
+
}) : /* @__PURE__ */ jsx(Link, {
|
|
851
850
|
href: `file://${call.args}`,
|
|
852
851
|
children: call.args
|
|
853
852
|
})
|
|
854
|
-
] }), phase === "done" && /* @__PURE__ */
|
|
853
|
+
] }), phase === "done" && /* @__PURE__ */ jsx(Box, {
|
|
855
854
|
flexDirection: "column",
|
|
856
855
|
paddingLeft: 2,
|
|
857
856
|
children: call.output.map((line, i) => {
|
|
858
|
-
if (line.startsWith("+")) return /* @__PURE__ */
|
|
857
|
+
if (line.startsWith("+")) return /* @__PURE__ */ jsx(LinkifiedLine, {
|
|
859
858
|
text: line,
|
|
860
859
|
color: "$success"
|
|
861
860
|
}, i);
|
|
862
|
-
if (line.startsWith("-")) return /* @__PURE__ */
|
|
861
|
+
if (line.startsWith("-")) return /* @__PURE__ */ jsx(LinkifiedLine, {
|
|
863
862
|
text: line,
|
|
864
863
|
color: "$error"
|
|
865
864
|
}, i);
|
|
866
|
-
return /* @__PURE__ */
|
|
865
|
+
return /* @__PURE__ */ jsx(LinkifiedLine, { text: line }, i);
|
|
867
866
|
})
|
|
868
867
|
})]
|
|
869
868
|
});
|
|
870
869
|
}
|
|
871
870
|
/** Streaming text — reveals content word by word. */
|
|
872
871
|
function StreamingText({ fullText, revealFraction, showCursor }) {
|
|
873
|
-
if (revealFraction >= 1) return /* @__PURE__ */
|
|
872
|
+
if (revealFraction >= 1) return /* @__PURE__ */ jsx(Text, { children: fullText });
|
|
874
873
|
const words = fullText.split(/(\s+)/);
|
|
875
874
|
const totalWords = words.filter((w) => w.trim()).length;
|
|
876
875
|
const revealWords = Math.ceil(totalWords * revealFraction);
|
|
@@ -883,39 +882,39 @@ function StreamingText({ fullText, revealFraction, showCursor }) {
|
|
|
883
882
|
}
|
|
884
883
|
revealedText += word;
|
|
885
884
|
}
|
|
886
|
-
return /* @__PURE__ */
|
|
885
|
+
return /* @__PURE__ */ jsxs(Text, { children: [revealedText, showCursor && /* @__PURE__ */ jsx(Text, {
|
|
887
886
|
color: "$primary",
|
|
888
887
|
children: "▌"
|
|
889
888
|
})] });
|
|
890
889
|
}
|
|
891
890
|
function ExchangeItem({ exchange, streamPhase, revealFraction, pulse, isLatest, isFirstInGroup, isLastInGroup }) {
|
|
892
|
-
if (exchange.role === "system") return /* @__PURE__ */
|
|
891
|
+
if (exchange.role === "system") return /* @__PURE__ */ jsxs(Box, {
|
|
893
892
|
flexDirection: "column",
|
|
894
893
|
children: [
|
|
895
|
-
/* @__PURE__ */
|
|
896
|
-
/* @__PURE__ */
|
|
894
|
+
/* @__PURE__ */ jsx(Text, { children: " " }),
|
|
895
|
+
/* @__PURE__ */ jsx(Text, {
|
|
897
896
|
bold: true,
|
|
898
897
|
children: "AI Chat"
|
|
899
898
|
}),
|
|
900
|
-
/* @__PURE__ */
|
|
901
|
-
/* @__PURE__ */
|
|
899
|
+
/* @__PURE__ */ jsx(Text, { children: " " }),
|
|
900
|
+
/* @__PURE__ */ jsx(Text, {
|
|
902
901
|
color: "$muted",
|
|
903
902
|
children: exchange.content
|
|
904
903
|
}),
|
|
905
|
-
/* @__PURE__ */
|
|
904
|
+
/* @__PURE__ */ jsx(Text, { children: " " })
|
|
906
905
|
]
|
|
907
906
|
});
|
|
908
|
-
if (exchange.role === "user") return /* @__PURE__ */
|
|
907
|
+
if (exchange.role === "user") return /* @__PURE__ */ jsxs(Box, {
|
|
909
908
|
paddingX: 1,
|
|
910
909
|
flexDirection: "row",
|
|
911
910
|
backgroundColor: "$surface-bg",
|
|
912
|
-
children: [/* @__PURE__ */
|
|
911
|
+
children: [/* @__PURE__ */ jsxs(Text, {
|
|
913
912
|
bold: true,
|
|
914
913
|
color: "$focusring",
|
|
915
914
|
children: ["❯", " "]
|
|
916
|
-
}), /* @__PURE__ */
|
|
915
|
+
}), /* @__PURE__ */ jsx(Box, {
|
|
917
916
|
flexShrink: 1,
|
|
918
|
-
children: /* @__PURE__ */
|
|
917
|
+
children: /* @__PURE__ */ jsx(Text, { children: exchange.content })
|
|
919
918
|
})]
|
|
920
919
|
});
|
|
921
920
|
const phase = isLatest ? streamPhase : "done";
|
|
@@ -930,25 +929,25 @@ function ExchangeItem({ exchange, streamPhase, revealFraction, pulse, isLatest,
|
|
|
930
929
|
const { title, body } = splitTitleBody(exchange.content);
|
|
931
930
|
const bulletColor = hasOperations ? "$success" : "$muted";
|
|
932
931
|
const contentText = title ? body : exchange.content;
|
|
933
|
-
return /* @__PURE__ */
|
|
932
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
934
933
|
flexDirection: "column",
|
|
935
|
-
children: [/* @__PURE__ */
|
|
934
|
+
children: [/* @__PURE__ */ jsxs(Text, { children: [/* @__PURE__ */ jsx(Text, {
|
|
936
935
|
bold: true,
|
|
937
936
|
color: bulletColor,
|
|
938
937
|
dimColor: hasOperations && !pulse && phase !== "done",
|
|
939
938
|
children: "●"
|
|
940
|
-
}), phase === "thinking" ? /* @__PURE__ */
|
|
939
|
+
}), phase === "thinking" ? /* @__PURE__ */ jsxs(Text, {
|
|
941
940
|
color: "$muted",
|
|
942
941
|
italic: true,
|
|
943
942
|
children: [
|
|
944
943
|
" ",
|
|
945
|
-
/* @__PURE__ */
|
|
944
|
+
/* @__PURE__ */ jsx(Spinner, { type: "dots" }),
|
|
946
945
|
" thinking"
|
|
947
946
|
]
|
|
948
|
-
}) : /* @__PURE__ */
|
|
947
|
+
}) : /* @__PURE__ */ jsxs(Fragment, { children: [title && /* @__PURE__ */ jsxs(Text, { children: [" ", title] }), /* @__PURE__ */ jsx(Text, {
|
|
949
948
|
color: "$muted",
|
|
950
949
|
children: metaStr
|
|
951
|
-
})] })] }), /* @__PURE__ */
|
|
950
|
+
})] })] }), /* @__PURE__ */ jsxs(Box, {
|
|
952
951
|
flexDirection: "column",
|
|
953
952
|
borderStyle: "bold",
|
|
954
953
|
borderColor: "$border",
|
|
@@ -958,18 +957,18 @@ function ExchangeItem({ exchange, streamPhase, revealFraction, pulse, isLatest,
|
|
|
958
957
|
borderBottom: false,
|
|
959
958
|
paddingLeft: 1,
|
|
960
959
|
children: [
|
|
961
|
-
exchange.thinking && (phase === "thinking" || phase === "streaming") && /* @__PURE__ */
|
|
960
|
+
exchange.thinking && (phase === "thinking" || phase === "streaming") && /* @__PURE__ */ jsx(ThinkingBlock, {
|
|
962
961
|
text: exchange.thinking,
|
|
963
962
|
done: phase !== "thinking"
|
|
964
963
|
}),
|
|
965
|
-
(phase === "streaming" || phase === "tools" || phase === "done") && contentText && /* @__PURE__ */
|
|
964
|
+
(phase === "streaming" || phase === "tools" || phase === "done") && contentText && /* @__PURE__ */ jsx(StreamingText, {
|
|
966
965
|
fullText: contentText,
|
|
967
966
|
revealFraction: phase === "streaming" ? fraction : 1,
|
|
968
967
|
showCursor: phase === "streaming" && fraction < 1
|
|
969
968
|
}),
|
|
970
|
-
toolRevealCount > 0 && /* @__PURE__ */
|
|
969
|
+
toolRevealCount > 0 && /* @__PURE__ */ jsx(Box, {
|
|
971
970
|
flexDirection: "column",
|
|
972
|
-
children: toolCalls.map((call, i) => /* @__PURE__ */
|
|
971
|
+
children: toolCalls.map((call, i) => /* @__PURE__ */ jsx(ToolCallBlock, {
|
|
973
972
|
call,
|
|
974
973
|
phase: phase === "done" ? "done" : i < toolRevealCount - 1 ? "done" : "running"
|
|
975
974
|
}, i))
|
|
@@ -988,11 +987,11 @@ function StatusBar({ exchanges, compacting, done, elapsed, contextBaseline = 0,
|
|
|
988
987
|
const ctxPct = Math.round(ctxFrac * 100);
|
|
989
988
|
const ctxColor = ctxPct > 100 ? "$error" : ctxPct > 80 ? "$warning" : "$primary";
|
|
990
989
|
const ctxBar = "█".repeat(ctxFilled) + "░".repeat(CTX_W - ctxFilled);
|
|
991
|
-
return /* @__PURE__ */
|
|
990
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
992
991
|
flexDirection: "row",
|
|
993
992
|
justifyContent: "space-between",
|
|
994
993
|
width: "100%",
|
|
995
|
-
children: [/* @__PURE__ */
|
|
994
|
+
children: [/* @__PURE__ */ jsxs(Text, {
|
|
996
995
|
color: "$muted",
|
|
997
996
|
wrap: "truncate",
|
|
998
997
|
children: [
|
|
@@ -1000,7 +999,7 @@ function StatusBar({ exchanges, compacting, done, elapsed, contextBaseline = 0,
|
|
|
1000
999
|
" ",
|
|
1001
1000
|
ctrlDPending ? "Ctrl-D again to exit" : compacting ? "compacting..." : "esc quit"
|
|
1002
1001
|
]
|
|
1003
|
-
}), /* @__PURE__ */
|
|
1002
|
+
}), /* @__PURE__ */ jsxs(Text, {
|
|
1004
1003
|
color: ctxPct > 80 ? ctxColor : "$muted",
|
|
1005
1004
|
wrap: "truncate",
|
|
1006
1005
|
children: [
|
|
@@ -1055,24 +1054,24 @@ function DemoFooter({ controlRef, onSubmit, streamPhase, done, compacting, excha
|
|
|
1055
1054
|
autoTypingText,
|
|
1056
1055
|
onSubmit
|
|
1057
1056
|
]);
|
|
1058
|
-
return /* @__PURE__ */
|
|
1057
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
1059
1058
|
flexDirection: "column",
|
|
1060
1059
|
width: "100%",
|
|
1061
1060
|
children: [
|
|
1062
|
-
/* @__PURE__ */
|
|
1063
|
-
/* @__PURE__ */
|
|
1061
|
+
/* @__PURE__ */ jsx(Text, { children: " " }),
|
|
1062
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
1064
1063
|
flexDirection: "row",
|
|
1065
1064
|
borderStyle: "round",
|
|
1066
1065
|
borderColor: !done && terminalFocused ? "$focusborder" : "$inputborder",
|
|
1067
1066
|
paddingX: 1,
|
|
1068
|
-
children: [/* @__PURE__ */
|
|
1067
|
+
children: [/* @__PURE__ */ jsxs(Text, {
|
|
1069
1068
|
bold: true,
|
|
1070
1069
|
color: "$focusring",
|
|
1071
1070
|
children: ["❯", " "]
|
|
1072
|
-
}), /* @__PURE__ */
|
|
1071
|
+
}), /* @__PURE__ */ jsx(Box, {
|
|
1073
1072
|
flexShrink: 1,
|
|
1074
1073
|
flexGrow: 1,
|
|
1075
|
-
children: /* @__PURE__ */
|
|
1074
|
+
children: /* @__PURE__ */ jsx(TextInput, {
|
|
1076
1075
|
value: autoTypingText ?? inputText,
|
|
1077
1076
|
onChange: autoTypingText ? () => {} : setInputText,
|
|
1078
1077
|
onSubmit: handleSubmit,
|
|
@@ -1081,10 +1080,10 @@ function DemoFooter({ controlRef, onSubmit, streamPhase, done, compacting, excha
|
|
|
1081
1080
|
})
|
|
1082
1081
|
})]
|
|
1083
1082
|
}),
|
|
1084
|
-
/* @__PURE__ */
|
|
1083
|
+
/* @__PURE__ */ jsx(Box, {
|
|
1085
1084
|
paddingX: 2,
|
|
1086
1085
|
width: "100%",
|
|
1087
|
-
children: /* @__PURE__ */
|
|
1086
|
+
children: /* @__PURE__ */ jsx(StatusBar, {
|
|
1088
1087
|
exchanges,
|
|
1089
1088
|
compacting,
|
|
1090
1089
|
done,
|
|
@@ -1134,13 +1133,13 @@ function AIChat({ script, autoStart, fastMode }) {
|
|
|
1134
1133
|
useKeyBindings(state, send, footerControlRef);
|
|
1135
1134
|
const renderExchange = useCallback((exchange, index, _meta) => {
|
|
1136
1135
|
const isLatest = index === state.exchanges.length - 1;
|
|
1137
|
-
return /* @__PURE__ */
|
|
1136
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
1138
1137
|
flexDirection: "column",
|
|
1139
1138
|
children: [
|
|
1140
|
-
index > 0 && /* @__PURE__ */
|
|
1141
|
-
state.compacting && isLatest && /* @__PURE__ */
|
|
1142
|
-
state.done && autoStart && isLatest && /* @__PURE__ */
|
|
1143
|
-
/* @__PURE__ */
|
|
1139
|
+
index > 0 && /* @__PURE__ */ jsx(Text, { children: " " }),
|
|
1140
|
+
state.compacting && isLatest && /* @__PURE__ */ jsx(CompactingOverlay, {}),
|
|
1141
|
+
state.done && autoStart && isLatest && /* @__PURE__ */ jsx(SessionComplete, {}),
|
|
1142
|
+
/* @__PURE__ */ jsx(ExchangeItem, {
|
|
1144
1143
|
exchange,
|
|
1145
1144
|
streamPhase: state.streamPhase,
|
|
1146
1145
|
revealFraction: state.revealFraction,
|
|
@@ -1152,10 +1151,10 @@ function AIChat({ script, autoStart, fastMode }) {
|
|
|
1152
1151
|
]
|
|
1153
1152
|
});
|
|
1154
1153
|
}, [state, autoStart]);
|
|
1155
|
-
return /* @__PURE__ */
|
|
1154
|
+
return /* @__PURE__ */ jsx(Box, {
|
|
1156
1155
|
flexDirection: "column",
|
|
1157
1156
|
paddingX: 1,
|
|
1158
|
-
children: /* @__PURE__ */
|
|
1157
|
+
children: /* @__PURE__ */ jsx(ListView, {
|
|
1159
1158
|
items: state.exchanges,
|
|
1160
1159
|
getKey: (ex) => ex.id,
|
|
1161
1160
|
height: termRows,
|
|
@@ -1166,7 +1165,7 @@ function AIChat({ script, autoStart, fastMode }) {
|
|
|
1166
1165
|
mode: "virtual",
|
|
1167
1166
|
isCacheable: (_ex, index) => index < state.exchanges.length - 1
|
|
1168
1167
|
},
|
|
1169
|
-
listFooter: /* @__PURE__ */
|
|
1168
|
+
listFooter: /* @__PURE__ */ jsx(DemoFooter, {
|
|
1170
1169
|
controlRef: footerControlRef,
|
|
1171
1170
|
onSubmit: (text) => send({
|
|
1172
1171
|
type: "submit",
|
|
@@ -1190,7 +1189,7 @@ async function main() {
|
|
|
1190
1189
|
const args = process.argv.slice(2);
|
|
1191
1190
|
const script = args.includes("--stress") ? generateStressScript() : SCRIPT;
|
|
1192
1191
|
const mode = args.includes("--inline") ? "inline" : "fullscreen";
|
|
1193
|
-
await _usingCtx$1.u(await run(/* @__PURE__ */
|
|
1192
|
+
await _usingCtx$1.u(await run(/* @__PURE__ */ jsx(AIChat, {
|
|
1194
1193
|
script,
|
|
1195
1194
|
autoStart: args.includes("--auto"),
|
|
1196
1195
|
fastMode: args.includes("--fast")
|
|
@@ -1259,20 +1258,20 @@ function useKeyBindings(state, send, footerControlRef) {
|
|
|
1259
1258
|
});
|
|
1260
1259
|
}
|
|
1261
1260
|
function CompactingOverlay() {
|
|
1262
|
-
return /* @__PURE__ */
|
|
1261
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
1263
1262
|
flexDirection: "column",
|
|
1264
1263
|
borderStyle: "round",
|
|
1265
1264
|
borderColor: "$warning",
|
|
1266
1265
|
paddingX: 1,
|
|
1267
1266
|
overflow: "hidden",
|
|
1268
1267
|
children: [
|
|
1269
|
-
/* @__PURE__ */
|
|
1268
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
1270
1269
|
color: "$warning",
|
|
1271
1270
|
bold: true,
|
|
1272
|
-
children: [/* @__PURE__ */
|
|
1271
|
+
children: [/* @__PURE__ */ jsx(Spinner, { type: "arc" }), " Compacting context"]
|
|
1273
1272
|
}),
|
|
1274
|
-
/* @__PURE__ */
|
|
1275
|
-
/* @__PURE__ */
|
|
1273
|
+
/* @__PURE__ */ jsx(Text, { children: " " }),
|
|
1274
|
+
/* @__PURE__ */ jsx(Text, {
|
|
1276
1275
|
color: "$muted",
|
|
1277
1276
|
children: "Freezing exchanges into terminal scrollback. Scroll up to review."
|
|
1278
1277
|
})
|
|
@@ -1280,16 +1279,16 @@ function CompactingOverlay() {
|
|
|
1280
1279
|
});
|
|
1281
1280
|
}
|
|
1282
1281
|
function SessionComplete() {
|
|
1283
|
-
return /* @__PURE__ */
|
|
1282
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
1284
1283
|
flexDirection: "column",
|
|
1285
1284
|
borderStyle: "round",
|
|
1286
1285
|
borderColor: "$success",
|
|
1287
1286
|
paddingX: 1,
|
|
1288
|
-
children: [/* @__PURE__ */
|
|
1287
|
+
children: [/* @__PURE__ */ jsxs(Text, {
|
|
1289
1288
|
color: "$success",
|
|
1290
1289
|
bold: true,
|
|
1291
1290
|
children: ["✓", " Session complete"]
|
|
1292
|
-
}), /* @__PURE__ */
|
|
1291
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
1293
1292
|
color: "$muted",
|
|
1294
1293
|
children: "Scroll up to review — colors, borders, and hyperlinks preserved in scrollback."
|
|
1295
1294
|
})]
|
package/dist/apps/app-todo.mjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { a as createApp, i as pipe, n as withTerminal, o as useApp$1, r as withReact } from "../plugins-
|
|
2
|
-
import { t as
|
|
3
|
-
import { t as ExampleBanner } from "../_banner-DLPxCqVy.mjs";
|
|
1
|
+
import { a as createApp, i as pipe, n as withTerminal, o as useApp$1, r as withReact } from "../plugins-CT0DdV_E.mjs";
|
|
2
|
+
import { t as ExampleBanner } from "../_banner-A70_y2Vi.mjs";
|
|
4
3
|
import "react";
|
|
5
4
|
import { Box, Kbd, Muted, Text } from "silvery";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region apps/app-todo.tsx
|
|
7
|
-
var import_jsx_runtime = require_jsx_runtime();
|
|
8
7
|
const meta = {
|
|
9
8
|
name: "Todo App",
|
|
10
9
|
description: "Layer 3: pipe() + createApp() + withReact() + withTerminal()",
|
|
@@ -16,10 +15,10 @@ const meta = {
|
|
|
16
15
|
]
|
|
17
16
|
};
|
|
18
17
|
function TodoItem({ todo, isCursor }) {
|
|
19
|
-
return /* @__PURE__ */
|
|
18
|
+
return /* @__PURE__ */ jsxs(Box, { children: [/* @__PURE__ */ jsx(Text, {
|
|
20
19
|
color: isCursor ? "$primary" : void 0,
|
|
21
20
|
children: isCursor ? "› " : " "
|
|
22
|
-
}), /* @__PURE__ */
|
|
21
|
+
}), /* @__PURE__ */ jsxs(Text, {
|
|
23
22
|
color: todo.completed ? "$success" : void 0,
|
|
24
23
|
strikethrough: todo.completed,
|
|
25
24
|
children: [
|
|
@@ -32,31 +31,31 @@ function TodoItem({ todo, isCursor }) {
|
|
|
32
31
|
function TodoList() {
|
|
33
32
|
const todos = useApp$1((s) => s.todos);
|
|
34
33
|
const cursor = useApp$1((s) => s.cursor);
|
|
35
|
-
return /* @__PURE__ */
|
|
34
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
36
35
|
flexDirection: "column",
|
|
37
|
-
children: [todos.map((todo, i) => /* @__PURE__ */
|
|
36
|
+
children: [todos.map((todo, i) => /* @__PURE__ */ jsx(TodoItem, {
|
|
38
37
|
todo,
|
|
39
38
|
isCursor: i === cursor
|
|
40
|
-
}, todo.id)), todos.length === 0 && /* @__PURE__ */
|
|
39
|
+
}, todo.id)), todos.length === 0 && /* @__PURE__ */ jsx(Muted, { children: "No todos. Press 'a' to add one." })]
|
|
41
40
|
});
|
|
42
41
|
}
|
|
43
42
|
function TodoApp() {
|
|
44
|
-
return /* @__PURE__ */
|
|
43
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
45
44
|
flexDirection: "column",
|
|
46
45
|
padding: 1,
|
|
47
46
|
children: [
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
-
/* @__PURE__ */
|
|
47
|
+
/* @__PURE__ */ jsx(TodoList, {}),
|
|
48
|
+
/* @__PURE__ */ jsx(Text, { children: " " }),
|
|
49
|
+
/* @__PURE__ */ jsxs(Muted, { children: [
|
|
50
|
+
/* @__PURE__ */ jsx(Kbd, { children: "j/k" }),
|
|
52
51
|
" move ",
|
|
53
|
-
/* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ jsx(Kbd, { children: "x" }),
|
|
54
53
|
" toggle ",
|
|
55
|
-
/* @__PURE__ */
|
|
54
|
+
/* @__PURE__ */ jsx(Kbd, { children: "a" }),
|
|
56
55
|
" add ",
|
|
57
|
-
/* @__PURE__ */
|
|
56
|
+
/* @__PURE__ */ jsx(Kbd, { children: "d" }),
|
|
58
57
|
" delete ",
|
|
59
|
-
/* @__PURE__ */
|
|
58
|
+
/* @__PURE__ */ jsx(Kbd, { children: "Esc/q" }),
|
|
60
59
|
" quit"
|
|
61
60
|
] })
|
|
62
61
|
]
|
|
@@ -124,10 +123,10 @@ const app = pipe(createApp(() => (set, get) => ({
|
|
|
124
123
|
break;
|
|
125
124
|
case "q": return "exit";
|
|
126
125
|
}
|
|
127
|
-
} }), withReact(/* @__PURE__ */
|
|
126
|
+
} }), withReact(/* @__PURE__ */ jsx(ExampleBanner, {
|
|
128
127
|
meta,
|
|
129
128
|
controls: "j/k move x toggle a add d delete Esc/q quit",
|
|
130
|
-
children: /* @__PURE__ */
|
|
129
|
+
children: /* @__PURE__ */ jsx(TodoApp, {})
|
|
131
130
|
})), withTerminal(process));
|
|
132
131
|
async function main() {
|
|
133
132
|
const handle = await app.run();
|