@silvery/examples 0.17.3 → 0.17.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/dist/UPNG-ShUlaTDh.mjs +5074 -0
  2. package/dist/__vite-browser-external-2447137e-Bopa5BFR.mjs +4 -0
  3. package/dist/_banner-A70_y2Vi.mjs +43 -0
  4. package/dist/ansi-0VXlUmNn.mjs +16397 -0
  5. package/dist/apng-B0gRaDVT.mjs +3 -0
  6. package/dist/apng-BTRDTfDW.mjs +68 -0
  7. package/dist/apps/aichat/index.mjs +1298 -0
  8. package/dist/apps/app-todo.mjs +138 -0
  9. package/dist/apps/async-data.mjs +203 -0
  10. package/dist/apps/cli-wizard.mjs +338 -0
  11. package/dist/apps/clipboard.mjs +197 -0
  12. package/dist/apps/components.mjs +863 -0
  13. package/dist/apps/data-explorer.mjs +482 -0
  14. package/dist/apps/dev-tools.mjs +396 -0
  15. package/dist/apps/explorer.mjs +697 -0
  16. package/dist/apps/gallery.mjs +765 -0
  17. package/dist/apps/inline-bench.mjs +115 -0
  18. package/dist/apps/kanban.mjs +279 -0
  19. package/dist/apps/layout-ref.mjs +186 -0
  20. package/dist/apps/outline.mjs +202 -0
  21. package/dist/apps/paste-demo.mjs +188 -0
  22. package/dist/apps/scroll.mjs +85 -0
  23. package/dist/apps/search-filter.mjs +286 -0
  24. package/dist/apps/selection.mjs +354 -0
  25. package/dist/apps/spatial-focus-demo.mjs +387 -0
  26. package/dist/apps/task-list.mjs +257 -0
  27. package/dist/apps/terminal-caps-demo.mjs +314 -0
  28. package/dist/apps/terminal.mjs +871 -0
  29. package/dist/apps/text-selection-demo.mjs +253 -0
  30. package/dist/apps/textarea.mjs +177 -0
  31. package/dist/apps/theme.mjs +660 -0
  32. package/dist/apps/transform.mjs +214 -0
  33. package/dist/apps/virtual-10k.mjs +421 -0
  34. package/dist/assets/resvgjs.darwin-arm64-BtufyGW1.node +0 -0
  35. package/dist/backends-Dj-11kZF.mjs +1179 -0
  36. package/dist/backends-U3QwStfO.mjs +3 -0
  37. package/dist/{cli.mjs → bin/cli.mjs} +15 -19
  38. package/dist/chunk-BSw8zbkd.mjs +37 -0
  39. package/dist/components/counter.mjs +47 -0
  40. package/dist/components/hello.mjs +30 -0
  41. package/dist/components/progress-bar.mjs +58 -0
  42. package/dist/components/select-list.mjs +84 -0
  43. package/dist/components/spinner.mjs +56 -0
  44. package/dist/components/text-input.mjs +61 -0
  45. package/dist/components/virtual-list.mjs +50 -0
  46. package/dist/flexily-zero-adapter-ByVzLTFP.mjs +3374 -0
  47. package/dist/gif-B6NGH5gs.mjs +3 -0
  48. package/dist/gif-CfkOF-iG.mjs +71 -0
  49. package/dist/gifenc-BI4ihP_T.mjs +728 -0
  50. package/dist/key-mapping-5oYQdAQE.mjs +3 -0
  51. package/dist/key-mapping-D4LR1go6.mjs +130 -0
  52. package/dist/layout/dashboard.mjs +1203 -0
  53. package/dist/layout/live-resize.mjs +302 -0
  54. package/dist/layout/overflow.mjs +69 -0
  55. package/dist/layout/text-layout.mjs +334 -0
  56. package/dist/node-nsrAOjH4.mjs +1083 -0
  57. package/dist/plugins-CT0DdV_E.mjs +3056 -0
  58. package/dist/resvg-js-Cnk2o49d.mjs +201 -0
  59. package/dist/src-9ZhfQyzD.mjs +814 -0
  60. package/dist/src-CUUOuRH6.mjs +5322 -0
  61. package/dist/src-jO3Zuzjj.mjs +23538 -0
  62. package/dist/usingCtx-CsEf0xO3.mjs +57 -0
  63. package/dist/yoga-adapter-BSQHuMV9.mjs +237 -0
  64. package/package.json +21 -14
  65. package/_banner.tsx +0 -60
  66. package/apps/aichat/components.tsx +0 -469
  67. package/apps/aichat/index.tsx +0 -220
  68. package/apps/aichat/script.ts +0 -460
  69. package/apps/aichat/state.ts +0 -325
  70. package/apps/aichat/types.ts +0 -19
  71. package/apps/app-todo.tsx +0 -201
  72. package/apps/async-data.tsx +0 -196
  73. package/apps/cli-wizard.tsx +0 -332
  74. package/apps/clipboard.tsx +0 -183
  75. package/apps/components.tsx +0 -658
  76. package/apps/data-explorer.tsx +0 -490
  77. package/apps/dev-tools.tsx +0 -395
  78. package/apps/explorer.tsx +0 -731
  79. package/apps/gallery.tsx +0 -653
  80. package/apps/inline-bench.tsx +0 -138
  81. package/apps/kanban.tsx +0 -265
  82. package/apps/layout-ref.tsx +0 -173
  83. package/apps/outline.tsx +0 -160
  84. package/apps/panes/index.tsx +0 -203
  85. package/apps/paste-demo.tsx +0 -185
  86. package/apps/scroll.tsx +0 -80
  87. package/apps/search-filter.tsx +0 -240
  88. package/apps/selection.tsx +0 -346
  89. package/apps/spatial-focus-demo.tsx +0 -372
  90. package/apps/task-list.tsx +0 -271
  91. package/apps/terminal-caps-demo.tsx +0 -317
  92. package/apps/terminal.tsx +0 -784
  93. package/apps/text-selection-demo.tsx +0 -193
  94. package/apps/textarea.tsx +0 -155
  95. package/apps/theme.tsx +0 -515
  96. package/apps/transform.tsx +0 -229
  97. package/apps/virtual-10k.tsx +0 -405
  98. package/apps/vterm-demo/index.tsx +0 -216
  99. package/components/counter.tsx +0 -49
  100. package/components/hello.tsx +0 -38
  101. package/components/progress-bar.tsx +0 -52
  102. package/components/select-list.tsx +0 -54
  103. package/components/spinner.tsx +0 -44
  104. package/components/text-input.tsx +0 -61
  105. package/components/virtual-list.tsx +0 -56
  106. package/dist/cli.d.mts +0 -1
  107. package/dist/cli.mjs.map +0 -1
  108. package/layout/dashboard.tsx +0 -953
  109. package/layout/live-resize.tsx +0 -282
  110. package/layout/overflow.tsx +0 -51
  111. package/layout/text-layout.tsx +0 -283
@@ -0,0 +1,202 @@
1
+ import { t as _usingCtx } from "../usingCtx-CsEf0xO3.mjs";
2
+ import { t as ExampleBanner } from "../_banner-A70_y2Vi.mjs";
3
+ import { useState } from "react";
4
+ import { Box, Kbd, Muted, Text, createTerm, render, useApp, useBoxRect, useInput } from "silvery";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ //#region apps/outline.tsx
7
+ /**
8
+ * Outline vs Border Comparison
9
+ *
10
+ * Side-by-side demonstration of outlineStyle vs borderStyle.
11
+ * Borders push content inward (adding to layout dimensions), while
12
+ * outlines overlap the content edge without affecting layout.
13
+ *
14
+ * Features:
15
+ * - Left panel: Box with borderStyle — content area is smaller
16
+ * - Right panel: Box with outlineStyle — content starts at edge
17
+ * - Toggle between styles with Tab
18
+ * - Live content dimensions via useBoxRect()
19
+ *
20
+ * Run: bun vendor/silvery/examples/apps/outline.tsx
21
+ */
22
+ const meta = {
23
+ name: "Outline vs Border",
24
+ description: "Side-by-side comparison showing outline (no layout impact) vs border",
25
+ features: [
26
+ "outlineStyle",
27
+ "borderStyle",
28
+ "useBoxRect()",
29
+ "layout dimensions"
30
+ ]
31
+ };
32
+ const STYLES = [
33
+ "single",
34
+ "double",
35
+ "round",
36
+ "bold"
37
+ ];
38
+ function ContentWithSize({ label }) {
39
+ const { width, height } = useBoxRect();
40
+ return /* @__PURE__ */ jsxs(Box, {
41
+ flexDirection: "column",
42
+ children: [
43
+ /* @__PURE__ */ jsx(Text, {
44
+ bold: true,
45
+ children: label
46
+ }),
47
+ /* @__PURE__ */ jsxs(Text, { children: [
48
+ "Content area:",
49
+ " ",
50
+ /* @__PURE__ */ jsx(Text, {
51
+ color: "$success",
52
+ bold: true,
53
+ children: width
54
+ }),
55
+ "x",
56
+ /* @__PURE__ */ jsx(Text, {
57
+ color: "$success",
58
+ bold: true,
59
+ children: height
60
+ })
61
+ ] }),
62
+ /* @__PURE__ */ jsx(Text, {
63
+ dim: true,
64
+ children: "The quick brown fox"
65
+ }),
66
+ /* @__PURE__ */ jsx(Text, {
67
+ dim: true,
68
+ children: "jumps over the lazy"
69
+ }),
70
+ /* @__PURE__ */ jsx(Text, {
71
+ dim: true,
72
+ children: "dog on a sunny day."
73
+ })
74
+ ]
75
+ });
76
+ }
77
+ function BorderPanel({ style, highlight }) {
78
+ return /* @__PURE__ */ jsxs(Box, {
79
+ flexDirection: "column",
80
+ flexGrow: 1,
81
+ gap: 1,
82
+ children: [
83
+ /* @__PURE__ */ jsxs(Text, {
84
+ bold: true,
85
+ color: highlight ? "$primary" : void 0,
86
+ children: [
87
+ "borderStyle=\"",
88
+ style,
89
+ "\""
90
+ ]
91
+ }),
92
+ /* @__PURE__ */ jsx(Box, {
93
+ borderStyle: style,
94
+ borderColor: highlight ? "$primary" : "$border",
95
+ width: 30,
96
+ height: 9,
97
+ children: /* @__PURE__ */ jsx(ContentWithSize, { label: "Border Box" })
98
+ }),
99
+ /* @__PURE__ */ jsx(Muted, { children: "Border adds to layout." }),
100
+ /* @__PURE__ */ jsx(Muted, { children: "Content is pushed inward." })
101
+ ]
102
+ });
103
+ }
104
+ function OutlinePanel({ style, highlight }) {
105
+ return /* @__PURE__ */ jsxs(Box, {
106
+ flexDirection: "column",
107
+ flexGrow: 1,
108
+ gap: 1,
109
+ children: [
110
+ /* @__PURE__ */ jsxs(Text, {
111
+ bold: true,
112
+ color: highlight ? "$warning" : void 0,
113
+ children: [
114
+ "outlineStyle=\"",
115
+ style,
116
+ "\""
117
+ ]
118
+ }),
119
+ /* @__PURE__ */ jsx(Box, {
120
+ outlineStyle: style,
121
+ outlineColor: highlight ? "$warning" : "$border",
122
+ width: 30,
123
+ height: 9,
124
+ children: /* @__PURE__ */ jsx(ContentWithSize, { label: "Outline Box" })
125
+ }),
126
+ /* @__PURE__ */ jsx(Muted, { children: "Outline overlaps content." }),
127
+ /* @__PURE__ */ jsx(Muted, { children: "No layout impact at all." })
128
+ ]
129
+ });
130
+ }
131
+ function OutlineDemo() {
132
+ const { exit } = useApp();
133
+ const [styleIndex, setStyleIndex] = useState(0);
134
+ const [focusedSide, setFocusedSide] = useState("border");
135
+ const currentStyle = STYLES[styleIndex];
136
+ useInput((input, key) => {
137
+ if (input === "q" || key.escape) {
138
+ exit();
139
+ return;
140
+ }
141
+ if (key.tab || input === " ") setFocusedSide((prev) => prev === "border" ? "outline" : "border");
142
+ if (key.rightArrow || input === "l") setStyleIndex((prev) => (prev + 1) % STYLES.length);
143
+ if (key.leftArrow || input === "h") setStyleIndex((prev) => (prev - 1 + STYLES.length) % STYLES.length);
144
+ });
145
+ return /* @__PURE__ */ jsxs(Box, {
146
+ flexDirection: "column",
147
+ padding: 1,
148
+ gap: 1,
149
+ children: [
150
+ /* @__PURE__ */ jsxs(Box, {
151
+ gap: 1,
152
+ children: [/* @__PURE__ */ jsx(Text, {
153
+ bold: true,
154
+ children: "Style:"
155
+ }), STYLES.map((s, i) => /* @__PURE__ */ jsx(Text, {
156
+ color: i === styleIndex ? "$primary" : "$muted",
157
+ bold: i === styleIndex,
158
+ children: i === styleIndex ? `[${s}]` : s
159
+ }, s))]
160
+ }),
161
+ /* @__PURE__ */ jsxs(Box, {
162
+ flexDirection: "row",
163
+ gap: 2,
164
+ children: [/* @__PURE__ */ jsx(BorderPanel, {
165
+ style: currentStyle,
166
+ highlight: focusedSide === "border"
167
+ }), /* @__PURE__ */ jsx(OutlinePanel, {
168
+ style: currentStyle,
169
+ highlight: focusedSide === "outline"
170
+ })]
171
+ }),
172
+ /* @__PURE__ */ jsxs(Muted, { children: [
173
+ " ",
174
+ /* @__PURE__ */ jsx(Kbd, { children: "Tab" }),
175
+ " toggle focus ",
176
+ /* @__PURE__ */ jsx(Kbd, { children: "h/l" }),
177
+ " change style ",
178
+ /* @__PURE__ */ jsx(Kbd, { children: "Esc/q" }),
179
+ " quit"
180
+ ] })
181
+ ]
182
+ });
183
+ }
184
+ async function main() {
185
+ try {
186
+ var _usingCtx$1 = _usingCtx();
187
+ const term = _usingCtx$1.u(createTerm());
188
+ const { waitUntilExit } = await render(/* @__PURE__ */ jsx(ExampleBanner, {
189
+ meta,
190
+ controls: "Tab toggle h/l style Esc/q quit",
191
+ children: /* @__PURE__ */ jsx(OutlineDemo, {})
192
+ }), term);
193
+ await waitUntilExit();
194
+ } catch (_) {
195
+ _usingCtx$1.e = _;
196
+ } finally {
197
+ _usingCtx$1.d();
198
+ }
199
+ }
200
+ if (import.meta.main) await main();
201
+ //#endregion
202
+ export { OutlineDemo, main, meta };
@@ -0,0 +1,188 @@
1
+ import { t as _usingCtx } from "../usingCtx-CsEf0xO3.mjs";
2
+ import { t as ExampleBanner } from "../_banner-A70_y2Vi.mjs";
3
+ import { useState } from "react";
4
+ import { Box, H1, Kbd, Lead, Muted, Small, Text, createTerm, render, useApp, useInput } from "silvery";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ //#region apps/paste-demo.tsx
7
+ /**
8
+ * Bracketed Paste Demo
9
+ *
10
+ * Demonstrates bracketed paste mode — when text is pasted into the terminal,
11
+ * it arrives as a single event rather than individual keystrokes. This prevents
12
+ * pasted text from being interpreted as commands.
13
+ *
14
+ * Features:
15
+ * - Shows paste mode status (always enabled with render())
16
+ * - Displays pasted text as a single block event
17
+ * - Shows character count and line count of pasted text
18
+ * - Maintains a history of paste events
19
+ *
20
+ * Run: bun vendor/silvery/examples/apps/paste-demo.tsx
21
+ */
22
+ const meta = {
23
+ name: "Bracketed Paste",
24
+ description: "Receive pasted text as a single event via bracketed paste mode",
25
+ features: [
26
+ "onPaste",
27
+ "useInput",
28
+ "bracketed paste mode"
29
+ ]
30
+ };
31
+ function PasteIndicator() {
32
+ return /* @__PURE__ */ jsxs(Box, {
33
+ gap: 1,
34
+ paddingX: 1,
35
+ children: [
36
+ /* @__PURE__ */ jsx(Text, {
37
+ color: "$success",
38
+ bold: true,
39
+ children: "●"
40
+ }),
41
+ /* @__PURE__ */ jsx(Text, { children: "Paste mode:" }),
42
+ /* @__PURE__ */ jsx(Text, {
43
+ color: "$success",
44
+ bold: true,
45
+ children: "ENABLED"
46
+ }),
47
+ /* @__PURE__ */ jsx(Muted, { children: "(bracketed paste is automatic with render())" })
48
+ ]
49
+ });
50
+ }
51
+ function PasteEventCard({ event, isLatest }) {
52
+ const displayText = (event.text.length > 60 ? event.text.slice(0, 57) + "..." : event.text).replace(/\n/g, "\\n").replace(/\t/g, "\\t");
53
+ return /* @__PURE__ */ jsxs(Box, {
54
+ flexDirection: "column",
55
+ borderStyle: "round",
56
+ borderColor: isLatest ? "$primary" : "$border",
57
+ paddingX: 1,
58
+ marginBottom: 0,
59
+ children: [
60
+ /* @__PURE__ */ jsxs(Box, {
61
+ justifyContent: "space-between",
62
+ children: [/* @__PURE__ */ jsxs(H1, {
63
+ color: isLatest ? "$primary" : void 0,
64
+ children: ["Paste #", event.id]
65
+ }), /* @__PURE__ */ jsx(Small, { children: event.timestamp })]
66
+ }),
67
+ /* @__PURE__ */ jsxs(Box, {
68
+ gap: 2,
69
+ children: [/* @__PURE__ */ jsxs(Small, { children: [
70
+ event.charCount,
71
+ " char",
72
+ event.charCount !== 1 ? "s" : ""
73
+ ] }), /* @__PURE__ */ jsxs(Small, { children: [
74
+ event.lineCount,
75
+ " line",
76
+ event.lineCount !== 1 ? "s" : ""
77
+ ] })]
78
+ }),
79
+ /* @__PURE__ */ jsx(Box, {
80
+ marginTop: 1,
81
+ children: /* @__PURE__ */ jsx(Text, {
82
+ color: "$warning",
83
+ children: displayText
84
+ })
85
+ })
86
+ ]
87
+ });
88
+ }
89
+ function EmptyState() {
90
+ return /* @__PURE__ */ jsxs(Box, {
91
+ flexDirection: "column",
92
+ padding: 2,
93
+ alignItems: "center",
94
+ children: [
95
+ /* @__PURE__ */ jsx(Muted, { children: "No paste events yet." }),
96
+ /* @__PURE__ */ jsx(Lead, { children: "Try pasting some text from your clipboard!" }),
97
+ /* @__PURE__ */ jsx(Lead, { children: "(Cmd+V on macOS, Ctrl+Shift+V on Linux)" })
98
+ ]
99
+ });
100
+ }
101
+ function PasteDemo() {
102
+ const { exit } = useApp();
103
+ const [pasteHistory, setPasteHistory] = useState([]);
104
+ const [nextId, setNextId] = useState(1);
105
+ useInput((input, key) => {
106
+ if (input === "q" || key.escape) {
107
+ exit();
108
+ return;
109
+ }
110
+ if (input === "x") {
111
+ setPasteHistory([]);
112
+ setNextId(1);
113
+ }
114
+ }, { onPaste: (text) => {
115
+ const now = /* @__PURE__ */ new Date();
116
+ const timestamp = `${now.getHours().toString().padStart(2, "0")}:${now.getMinutes().toString().padStart(2, "0")}:${now.getSeconds().toString().padStart(2, "0")}`;
117
+ const event = {
118
+ id: nextId,
119
+ text,
120
+ charCount: text.length,
121
+ lineCount: text.split("\n").length,
122
+ timestamp
123
+ };
124
+ setPasteHistory((prev) => [event, ...prev].slice(0, 10));
125
+ setNextId((prev) => prev + 1);
126
+ } });
127
+ return /* @__PURE__ */ jsxs(Box, {
128
+ flexDirection: "column",
129
+ padding: 1,
130
+ gap: 1,
131
+ children: [
132
+ /* @__PURE__ */ jsx(PasteIndicator, {}),
133
+ /* @__PURE__ */ jsxs(Box, {
134
+ flexDirection: "column",
135
+ borderStyle: "round",
136
+ borderColor: "$primary",
137
+ paddingX: 1,
138
+ children: [/* @__PURE__ */ jsxs(Box, {
139
+ marginBottom: 1,
140
+ children: [/* @__PURE__ */ jsx(H1, { children: "Paste History" }), /* @__PURE__ */ jsxs(Small, { children: [
141
+ " ",
142
+ "— ",
143
+ pasteHistory.length,
144
+ " event",
145
+ pasteHistory.length !== 1 ? "s" : ""
146
+ ] })]
147
+ }), pasteHistory.length === 0 ? /* @__PURE__ */ jsx(EmptyState, {}) : /* @__PURE__ */ jsx(Box, {
148
+ flexDirection: "column",
149
+ overflow: "scroll",
150
+ height: 12,
151
+ gap: 1,
152
+ children: pasteHistory.map((event, index) => /* @__PURE__ */ jsx(PasteEventCard, {
153
+ event,
154
+ isLatest: index === 0
155
+ }, event.id))
156
+ })]
157
+ }),
158
+ /* @__PURE__ */ jsxs(Muted, { children: [
159
+ " ",
160
+ /* @__PURE__ */ jsx(Kbd, { children: "Paste text" }),
161
+ " to see events ",
162
+ /* @__PURE__ */ jsx(Kbd, { children: "x" }),
163
+ " clear ",
164
+ /* @__PURE__ */ jsx(Kbd, { children: "Esc/q" }),
165
+ " quit"
166
+ ] })
167
+ ]
168
+ });
169
+ }
170
+ async function main() {
171
+ try {
172
+ var _usingCtx$1 = _usingCtx();
173
+ const term = _usingCtx$1.u(createTerm());
174
+ const { waitUntilExit } = await render(/* @__PURE__ */ jsx(ExampleBanner, {
175
+ meta,
176
+ controls: "Paste text to see events x clear Esc/q quit",
177
+ children: /* @__PURE__ */ jsx(PasteDemo, {})
178
+ }), term);
179
+ await waitUntilExit();
180
+ } catch (_) {
181
+ _usingCtx$1.e = _;
182
+ } finally {
183
+ _usingCtx$1.d();
184
+ }
185
+ }
186
+ if (import.meta.main) await main();
187
+ //#endregion
188
+ export { PasteDemo, main, meta };
@@ -0,0 +1,85 @@
1
+ import { t as _usingCtx } from "../usingCtx-CsEf0xO3.mjs";
2
+ import { t as ExampleBanner } from "../_banner-A70_y2Vi.mjs";
3
+ import { useState } from "react";
4
+ import { Box, Kbd, Muted, Text, createTerm, render, useApp, useInput } from "silvery";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ //#region apps/scroll.tsx
7
+ /**
8
+ * Scroll Example
9
+ *
10
+ * Demonstrates overflow="scroll" with keyboard navigation.
11
+ */
12
+ const meta = {
13
+ name: "Scroll",
14
+ description: "Native overflow=\"scroll\" with automatic scroll-to-selected",
15
+ features: [
16
+ "overflow=\"scroll\"",
17
+ "scrollTo",
18
+ "useInput"
19
+ ]
20
+ };
21
+ const items = Array.from({ length: 50 }, (_, i) => ({
22
+ id: i,
23
+ title: `Item ${i + 1}`,
24
+ description: `This is the description for item number ${i + 1}`
25
+ }));
26
+ function ScrollExample() {
27
+ const { exit } = useApp();
28
+ const [selectedIndex, setSelectedIndex] = useState(0);
29
+ useInput((input, key) => {
30
+ if (input === "q" || key.escape) exit();
31
+ if (key.upArrow || input === "k") setSelectedIndex((prev) => Math.max(0, prev - 1));
32
+ if (key.downArrow || input === "j") setSelectedIndex((prev) => Math.min(items.length - 1, prev + 1));
33
+ });
34
+ return /* @__PURE__ */ jsxs(Box, {
35
+ flexDirection: "column",
36
+ padding: 1,
37
+ width: 60,
38
+ height: 20,
39
+ children: [/* @__PURE__ */ jsx(Box, {
40
+ flexGrow: 1,
41
+ flexDirection: "column",
42
+ borderStyle: "round",
43
+ borderColor: "$primary",
44
+ overflow: "scroll",
45
+ scrollTo: selectedIndex,
46
+ height: 10,
47
+ children: items.map((item, index) => /* @__PURE__ */ jsx(Box, {
48
+ paddingX: 1,
49
+ backgroundColor: index === selectedIndex ? "$primary" : void 0,
50
+ children: /* @__PURE__ */ jsx(Text, {
51
+ color: index === selectedIndex ? "$primary-fg" : void 0,
52
+ bold: index === selectedIndex,
53
+ children: item.title
54
+ })
55
+ }, item.id))
56
+ }), /* @__PURE__ */ jsxs(Muted, { children: [
57
+ " ",
58
+ /* @__PURE__ */ jsx(Kbd, { children: "j/k" }),
59
+ " navigate ",
60
+ /* @__PURE__ */ jsx(Kbd, { children: "Esc/q" }),
61
+ " quit | Selected: ",
62
+ selectedIndex + 1,
63
+ "/",
64
+ items.length
65
+ ] })]
66
+ });
67
+ }
68
+ async function main() {
69
+ try {
70
+ var _usingCtx$1 = _usingCtx();
71
+ const term = _usingCtx$1.u(createTerm());
72
+ await render(/* @__PURE__ */ jsx(ExampleBanner, {
73
+ meta,
74
+ controls: "j/k navigate Esc/q quit",
75
+ children: /* @__PURE__ */ jsx(ScrollExample, {})
76
+ }), term);
77
+ } catch (_) {
78
+ _usingCtx$1.e = _;
79
+ } finally {
80
+ _usingCtx$1.d();
81
+ }
82
+ }
83
+ if (import.meta.main) await main();
84
+ //#endregion
85
+ export { ScrollExample, main, meta };