@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/outline.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, Kbd, Muted, Text, createTerm, render, useApp, useBoxRect, useInput } from "silvery";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region apps/outline.tsx
|
|
7
7
|
/**
|
|
8
8
|
* Outline vs Border Comparison
|
|
@@ -19,7 +19,6 @@ import { Box, Kbd, Muted, Text, createTerm, render, useApp, useBoxRect, useInput
|
|
|
19
19
|
*
|
|
20
20
|
* Run: bun vendor/silvery/examples/apps/outline.tsx
|
|
21
21
|
*/
|
|
22
|
-
var import_jsx_runtime = require_jsx_runtime();
|
|
23
22
|
const meta = {
|
|
24
23
|
name: "Outline vs Border",
|
|
25
24
|
description: "Side-by-side comparison showing outline (no layout impact) vs border",
|
|
@@ -38,37 +37,37 @@ const STYLES = [
|
|
|
38
37
|
];
|
|
39
38
|
function ContentWithSize({ label }) {
|
|
40
39
|
const { width, height } = useBoxRect();
|
|
41
|
-
return /* @__PURE__ */
|
|
40
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
42
41
|
flexDirection: "column",
|
|
43
42
|
children: [
|
|
44
|
-
/* @__PURE__ */
|
|
43
|
+
/* @__PURE__ */ jsx(Text, {
|
|
45
44
|
bold: true,
|
|
46
45
|
children: label
|
|
47
46
|
}),
|
|
48
|
-
/* @__PURE__ */
|
|
47
|
+
/* @__PURE__ */ jsxs(Text, { children: [
|
|
49
48
|
"Content area:",
|
|
50
49
|
" ",
|
|
51
|
-
/* @__PURE__ */
|
|
50
|
+
/* @__PURE__ */ jsx(Text, {
|
|
52
51
|
color: "$success",
|
|
53
52
|
bold: true,
|
|
54
53
|
children: width
|
|
55
54
|
}),
|
|
56
55
|
"x",
|
|
57
|
-
/* @__PURE__ */
|
|
56
|
+
/* @__PURE__ */ jsx(Text, {
|
|
58
57
|
color: "$success",
|
|
59
58
|
bold: true,
|
|
60
59
|
children: height
|
|
61
60
|
})
|
|
62
61
|
] }),
|
|
63
|
-
/* @__PURE__ */
|
|
62
|
+
/* @__PURE__ */ jsx(Text, {
|
|
64
63
|
dim: true,
|
|
65
64
|
children: "The quick brown fox"
|
|
66
65
|
}),
|
|
67
|
-
/* @__PURE__ */
|
|
66
|
+
/* @__PURE__ */ jsx(Text, {
|
|
68
67
|
dim: true,
|
|
69
68
|
children: "jumps over the lazy"
|
|
70
69
|
}),
|
|
71
|
-
/* @__PURE__ */
|
|
70
|
+
/* @__PURE__ */ jsx(Text, {
|
|
72
71
|
dim: true,
|
|
73
72
|
children: "dog on a sunny day."
|
|
74
73
|
})
|
|
@@ -76,12 +75,12 @@ function ContentWithSize({ label }) {
|
|
|
76
75
|
});
|
|
77
76
|
}
|
|
78
77
|
function BorderPanel({ style, highlight }) {
|
|
79
|
-
return /* @__PURE__ */
|
|
78
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
80
79
|
flexDirection: "column",
|
|
81
80
|
flexGrow: 1,
|
|
82
81
|
gap: 1,
|
|
83
82
|
children: [
|
|
84
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
85
84
|
bold: true,
|
|
86
85
|
color: highlight ? "$primary" : void 0,
|
|
87
86
|
children: [
|
|
@@ -90,25 +89,25 @@ function BorderPanel({ style, highlight }) {
|
|
|
90
89
|
"\""
|
|
91
90
|
]
|
|
92
91
|
}),
|
|
93
|
-
/* @__PURE__ */
|
|
92
|
+
/* @__PURE__ */ jsx(Box, {
|
|
94
93
|
borderStyle: style,
|
|
95
94
|
borderColor: highlight ? "$primary" : "$border",
|
|
96
95
|
width: 30,
|
|
97
96
|
height: 9,
|
|
98
|
-
children: /* @__PURE__ */
|
|
97
|
+
children: /* @__PURE__ */ jsx(ContentWithSize, { label: "Border Box" })
|
|
99
98
|
}),
|
|
100
|
-
/* @__PURE__ */
|
|
101
|
-
/* @__PURE__ */
|
|
99
|
+
/* @__PURE__ */ jsx(Muted, { children: "Border adds to layout." }),
|
|
100
|
+
/* @__PURE__ */ jsx(Muted, { children: "Content is pushed inward." })
|
|
102
101
|
]
|
|
103
102
|
});
|
|
104
103
|
}
|
|
105
104
|
function OutlinePanel({ style, highlight }) {
|
|
106
|
-
return /* @__PURE__ */
|
|
105
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
107
106
|
flexDirection: "column",
|
|
108
107
|
flexGrow: 1,
|
|
109
108
|
gap: 1,
|
|
110
109
|
children: [
|
|
111
|
-
/* @__PURE__ */
|
|
110
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
112
111
|
bold: true,
|
|
113
112
|
color: highlight ? "$warning" : void 0,
|
|
114
113
|
children: [
|
|
@@ -117,15 +116,15 @@ function OutlinePanel({ style, highlight }) {
|
|
|
117
116
|
"\""
|
|
118
117
|
]
|
|
119
118
|
}),
|
|
120
|
-
/* @__PURE__ */
|
|
119
|
+
/* @__PURE__ */ jsx(Box, {
|
|
121
120
|
outlineStyle: style,
|
|
122
121
|
outlineColor: highlight ? "$warning" : "$border",
|
|
123
122
|
width: 30,
|
|
124
123
|
height: 9,
|
|
125
|
-
children: /* @__PURE__ */
|
|
124
|
+
children: /* @__PURE__ */ jsx(ContentWithSize, { label: "Outline Box" })
|
|
126
125
|
}),
|
|
127
|
-
/* @__PURE__ */
|
|
128
|
-
/* @__PURE__ */
|
|
126
|
+
/* @__PURE__ */ jsx(Muted, { children: "Outline overlaps content." }),
|
|
127
|
+
/* @__PURE__ */ jsx(Muted, { children: "No layout impact at all." })
|
|
129
128
|
]
|
|
130
129
|
});
|
|
131
130
|
}
|
|
@@ -143,40 +142,40 @@ function OutlineDemo() {
|
|
|
143
142
|
if (key.rightArrow || input === "l") setStyleIndex((prev) => (prev + 1) % STYLES.length);
|
|
144
143
|
if (key.leftArrow || input === "h") setStyleIndex((prev) => (prev - 1 + STYLES.length) % STYLES.length);
|
|
145
144
|
});
|
|
146
|
-
return /* @__PURE__ */
|
|
145
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
147
146
|
flexDirection: "column",
|
|
148
147
|
padding: 1,
|
|
149
148
|
gap: 1,
|
|
150
149
|
children: [
|
|
151
|
-
/* @__PURE__ */
|
|
150
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
152
151
|
gap: 1,
|
|
153
|
-
children: [/* @__PURE__ */
|
|
152
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
154
153
|
bold: true,
|
|
155
154
|
children: "Style:"
|
|
156
|
-
}), STYLES.map((s, i) => /* @__PURE__ */
|
|
155
|
+
}), STYLES.map((s, i) => /* @__PURE__ */ jsx(Text, {
|
|
157
156
|
color: i === styleIndex ? "$primary" : "$muted",
|
|
158
157
|
bold: i === styleIndex,
|
|
159
158
|
children: i === styleIndex ? `[${s}]` : s
|
|
160
159
|
}, s))]
|
|
161
160
|
}),
|
|
162
|
-
/* @__PURE__ */
|
|
161
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
163
162
|
flexDirection: "row",
|
|
164
163
|
gap: 2,
|
|
165
|
-
children: [/* @__PURE__ */
|
|
164
|
+
children: [/* @__PURE__ */ jsx(BorderPanel, {
|
|
166
165
|
style: currentStyle,
|
|
167
166
|
highlight: focusedSide === "border"
|
|
168
|
-
}), /* @__PURE__ */
|
|
167
|
+
}), /* @__PURE__ */ jsx(OutlinePanel, {
|
|
169
168
|
style: currentStyle,
|
|
170
169
|
highlight: focusedSide === "outline"
|
|
171
170
|
})]
|
|
172
171
|
}),
|
|
173
|
-
/* @__PURE__ */
|
|
172
|
+
/* @__PURE__ */ jsxs(Muted, { children: [
|
|
174
173
|
" ",
|
|
175
|
-
/* @__PURE__ */
|
|
174
|
+
/* @__PURE__ */ jsx(Kbd, { children: "Tab" }),
|
|
176
175
|
" toggle focus ",
|
|
177
|
-
/* @__PURE__ */
|
|
176
|
+
/* @__PURE__ */ jsx(Kbd, { children: "h/l" }),
|
|
178
177
|
" change style ",
|
|
179
|
-
/* @__PURE__ */
|
|
178
|
+
/* @__PURE__ */ jsx(Kbd, { children: "Esc/q" }),
|
|
180
179
|
" quit"
|
|
181
180
|
] })
|
|
182
181
|
]
|
|
@@ -186,10 +185,10 @@ async function main() {
|
|
|
186
185
|
try {
|
|
187
186
|
var _usingCtx$1 = _usingCtx();
|
|
188
187
|
const term = _usingCtx$1.u(createTerm());
|
|
189
|
-
const { waitUntilExit } = await render(/* @__PURE__ */
|
|
188
|
+
const { waitUntilExit } = await render(/* @__PURE__ */ jsx(ExampleBanner, {
|
|
190
189
|
meta,
|
|
191
190
|
controls: "Tab toggle h/l style Esc/q quit",
|
|
192
|
-
children: /* @__PURE__ */
|
|
191
|
+
children: /* @__PURE__ */ jsx(OutlineDemo, {})
|
|
193
192
|
}), term);
|
|
194
193
|
await waitUntilExit();
|
|
195
194
|
} catch (_) {
|
package/dist/apps/paste-demo.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as _usingCtx } from "../usingCtx-CsEf0xO3.mjs";
|
|
2
|
-
import { t as
|
|
3
|
-
import { t as ExampleBanner } from "../_banner-DLPxCqVy.mjs";
|
|
2
|
+
import { t as ExampleBanner } from "../_banner-A70_y2Vi.mjs";
|
|
4
3
|
import { useState } from "react";
|
|
5
4
|
import { Box, H1, Kbd, Lead, Muted, Small, Text, createTerm, render, useApp, useInput } from "silvery";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region apps/paste-demo.tsx
|
|
7
7
|
/**
|
|
8
8
|
* Bracketed Paste Demo
|
|
@@ -19,7 +19,6 @@ import { Box, H1, Kbd, Lead, Muted, Small, Text, createTerm, render, useApp, use
|
|
|
19
19
|
*
|
|
20
20
|
* Run: bun vendor/silvery/examples/apps/paste-demo.tsx
|
|
21
21
|
*/
|
|
22
|
-
var import_jsx_runtime = require_jsx_runtime();
|
|
23
22
|
const meta = {
|
|
24
23
|
name: "Bracketed Paste",
|
|
25
24
|
description: "Receive pasted text as a single event via bracketed paste mode",
|
|
@@ -30,56 +29,56 @@ const meta = {
|
|
|
30
29
|
]
|
|
31
30
|
};
|
|
32
31
|
function PasteIndicator() {
|
|
33
|
-
return /* @__PURE__ */
|
|
32
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
34
33
|
gap: 1,
|
|
35
34
|
paddingX: 1,
|
|
36
35
|
children: [
|
|
37
|
-
/* @__PURE__ */
|
|
36
|
+
/* @__PURE__ */ jsx(Text, {
|
|
38
37
|
color: "$success",
|
|
39
38
|
bold: true,
|
|
40
39
|
children: "●"
|
|
41
40
|
}),
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
-
/* @__PURE__ */
|
|
41
|
+
/* @__PURE__ */ jsx(Text, { children: "Paste mode:" }),
|
|
42
|
+
/* @__PURE__ */ jsx(Text, {
|
|
44
43
|
color: "$success",
|
|
45
44
|
bold: true,
|
|
46
45
|
children: "ENABLED"
|
|
47
46
|
}),
|
|
48
|
-
/* @__PURE__ */
|
|
47
|
+
/* @__PURE__ */ jsx(Muted, { children: "(bracketed paste is automatic with render())" })
|
|
49
48
|
]
|
|
50
49
|
});
|
|
51
50
|
}
|
|
52
51
|
function PasteEventCard({ event, isLatest }) {
|
|
53
52
|
const displayText = (event.text.length > 60 ? event.text.slice(0, 57) + "..." : event.text).replace(/\n/g, "\\n").replace(/\t/g, "\\t");
|
|
54
|
-
return /* @__PURE__ */
|
|
53
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
55
54
|
flexDirection: "column",
|
|
56
55
|
borderStyle: "round",
|
|
57
56
|
borderColor: isLatest ? "$primary" : "$border",
|
|
58
57
|
paddingX: 1,
|
|
59
58
|
marginBottom: 0,
|
|
60
59
|
children: [
|
|
61
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
62
61
|
justifyContent: "space-between",
|
|
63
|
-
children: [/* @__PURE__ */
|
|
62
|
+
children: [/* @__PURE__ */ jsxs(H1, {
|
|
64
63
|
color: isLatest ? "$primary" : void 0,
|
|
65
64
|
children: ["Paste #", event.id]
|
|
66
|
-
}), /* @__PURE__ */
|
|
65
|
+
}), /* @__PURE__ */ jsx(Small, { children: event.timestamp })]
|
|
67
66
|
}),
|
|
68
|
-
/* @__PURE__ */
|
|
67
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
69
68
|
gap: 2,
|
|
70
|
-
children: [/* @__PURE__ */
|
|
69
|
+
children: [/* @__PURE__ */ jsxs(Small, { children: [
|
|
71
70
|
event.charCount,
|
|
72
71
|
" char",
|
|
73
72
|
event.charCount !== 1 ? "s" : ""
|
|
74
|
-
] }), /* @__PURE__ */
|
|
73
|
+
] }), /* @__PURE__ */ jsxs(Small, { children: [
|
|
75
74
|
event.lineCount,
|
|
76
75
|
" line",
|
|
77
76
|
event.lineCount !== 1 ? "s" : ""
|
|
78
77
|
] })]
|
|
79
78
|
}),
|
|
80
|
-
/* @__PURE__ */
|
|
79
|
+
/* @__PURE__ */ jsx(Box, {
|
|
81
80
|
marginTop: 1,
|
|
82
|
-
children: /* @__PURE__ */
|
|
81
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
83
82
|
color: "$warning",
|
|
84
83
|
children: displayText
|
|
85
84
|
})
|
|
@@ -88,14 +87,14 @@ function PasteEventCard({ event, isLatest }) {
|
|
|
88
87
|
});
|
|
89
88
|
}
|
|
90
89
|
function EmptyState() {
|
|
91
|
-
return /* @__PURE__ */
|
|
90
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
92
91
|
flexDirection: "column",
|
|
93
92
|
padding: 2,
|
|
94
93
|
alignItems: "center",
|
|
95
94
|
children: [
|
|
96
|
-
/* @__PURE__ */
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
-
/* @__PURE__ */
|
|
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)" })
|
|
99
98
|
]
|
|
100
99
|
});
|
|
101
100
|
}
|
|
@@ -125,44 +124,44 @@ function PasteDemo() {
|
|
|
125
124
|
setPasteHistory((prev) => [event, ...prev].slice(0, 10));
|
|
126
125
|
setNextId((prev) => prev + 1);
|
|
127
126
|
} });
|
|
128
|
-
return /* @__PURE__ */
|
|
127
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
129
128
|
flexDirection: "column",
|
|
130
129
|
padding: 1,
|
|
131
130
|
gap: 1,
|
|
132
131
|
children: [
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
/* @__PURE__ */
|
|
132
|
+
/* @__PURE__ */ jsx(PasteIndicator, {}),
|
|
133
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
135
134
|
flexDirection: "column",
|
|
136
135
|
borderStyle: "round",
|
|
137
136
|
borderColor: "$primary",
|
|
138
137
|
paddingX: 1,
|
|
139
|
-
children: [/* @__PURE__ */
|
|
138
|
+
children: [/* @__PURE__ */ jsxs(Box, {
|
|
140
139
|
marginBottom: 1,
|
|
141
|
-
children: [/* @__PURE__ */
|
|
140
|
+
children: [/* @__PURE__ */ jsx(H1, { children: "Paste History" }), /* @__PURE__ */ jsxs(Small, { children: [
|
|
142
141
|
" ",
|
|
143
142
|
"— ",
|
|
144
143
|
pasteHistory.length,
|
|
145
144
|
" event",
|
|
146
145
|
pasteHistory.length !== 1 ? "s" : ""
|
|
147
146
|
] })]
|
|
148
|
-
}), pasteHistory.length === 0 ? /* @__PURE__ */
|
|
147
|
+
}), pasteHistory.length === 0 ? /* @__PURE__ */ jsx(EmptyState, {}) : /* @__PURE__ */ jsx(Box, {
|
|
149
148
|
flexDirection: "column",
|
|
150
149
|
overflow: "scroll",
|
|
151
150
|
height: 12,
|
|
152
151
|
gap: 1,
|
|
153
|
-
children: pasteHistory.map((event, index) => /* @__PURE__ */
|
|
152
|
+
children: pasteHistory.map((event, index) => /* @__PURE__ */ jsx(PasteEventCard, {
|
|
154
153
|
event,
|
|
155
154
|
isLatest: index === 0
|
|
156
155
|
}, event.id))
|
|
157
156
|
})]
|
|
158
157
|
}),
|
|
159
|
-
/* @__PURE__ */
|
|
158
|
+
/* @__PURE__ */ jsxs(Muted, { children: [
|
|
160
159
|
" ",
|
|
161
|
-
/* @__PURE__ */
|
|
160
|
+
/* @__PURE__ */ jsx(Kbd, { children: "Paste text" }),
|
|
162
161
|
" to see events ",
|
|
163
|
-
/* @__PURE__ */
|
|
162
|
+
/* @__PURE__ */ jsx(Kbd, { children: "x" }),
|
|
164
163
|
" clear ",
|
|
165
|
-
/* @__PURE__ */
|
|
164
|
+
/* @__PURE__ */ jsx(Kbd, { children: "Esc/q" }),
|
|
166
165
|
" quit"
|
|
167
166
|
] })
|
|
168
167
|
]
|
|
@@ -172,10 +171,10 @@ async function main() {
|
|
|
172
171
|
try {
|
|
173
172
|
var _usingCtx$1 = _usingCtx();
|
|
174
173
|
const term = _usingCtx$1.u(createTerm());
|
|
175
|
-
const { waitUntilExit } = await render(/* @__PURE__ */
|
|
174
|
+
const { waitUntilExit } = await render(/* @__PURE__ */ jsx(ExampleBanner, {
|
|
176
175
|
meta,
|
|
177
176
|
controls: "Paste text to see events x clear Esc/q quit",
|
|
178
|
-
children: /* @__PURE__ */
|
|
177
|
+
children: /* @__PURE__ */ jsx(PasteDemo, {})
|
|
179
178
|
}), term);
|
|
180
179
|
await waitUntilExit();
|
|
181
180
|
} catch (_) {
|
package/dist/apps/scroll.mjs
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
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, Kbd, Muted, Text, createTerm, render, useApp, useInput } from "silvery";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region apps/scroll.tsx
|
|
7
7
|
/**
|
|
8
8
|
* Scroll Example
|
|
9
9
|
*
|
|
10
10
|
* Demonstrates overflow="scroll" with keyboard navigation.
|
|
11
11
|
*/
|
|
12
|
-
var import_jsx_runtime = require_jsx_runtime();
|
|
13
12
|
const meta = {
|
|
14
13
|
name: "Scroll",
|
|
15
14
|
description: "Native overflow=\"scroll\" with automatic scroll-to-selected",
|
|
@@ -32,12 +31,12 @@ function ScrollExample() {
|
|
|
32
31
|
if (key.upArrow || input === "k") setSelectedIndex((prev) => Math.max(0, prev - 1));
|
|
33
32
|
if (key.downArrow || input === "j") setSelectedIndex((prev) => Math.min(items.length - 1, prev + 1));
|
|
34
33
|
});
|
|
35
|
-
return /* @__PURE__ */
|
|
34
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
36
35
|
flexDirection: "column",
|
|
37
36
|
padding: 1,
|
|
38
37
|
width: 60,
|
|
39
38
|
height: 20,
|
|
40
|
-
children: [/* @__PURE__ */
|
|
39
|
+
children: [/* @__PURE__ */ jsx(Box, {
|
|
41
40
|
flexGrow: 1,
|
|
42
41
|
flexDirection: "column",
|
|
43
42
|
borderStyle: "round",
|
|
@@ -45,20 +44,20 @@ function ScrollExample() {
|
|
|
45
44
|
overflow: "scroll",
|
|
46
45
|
scrollTo: selectedIndex,
|
|
47
46
|
height: 10,
|
|
48
|
-
children: items.map((item, index) => /* @__PURE__ */
|
|
47
|
+
children: items.map((item, index) => /* @__PURE__ */ jsx(Box, {
|
|
49
48
|
paddingX: 1,
|
|
50
49
|
backgroundColor: index === selectedIndex ? "$primary" : void 0,
|
|
51
|
-
children: /* @__PURE__ */
|
|
50
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
52
51
|
color: index === selectedIndex ? "$primary-fg" : void 0,
|
|
53
52
|
bold: index === selectedIndex,
|
|
54
53
|
children: item.title
|
|
55
54
|
})
|
|
56
55
|
}, item.id))
|
|
57
|
-
}), /* @__PURE__ */
|
|
56
|
+
}), /* @__PURE__ */ jsxs(Muted, { children: [
|
|
58
57
|
" ",
|
|
59
|
-
/* @__PURE__ */
|
|
58
|
+
/* @__PURE__ */ jsx(Kbd, { children: "j/k" }),
|
|
60
59
|
" navigate ",
|
|
61
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ jsx(Kbd, { children: "Esc/q" }),
|
|
62
61
|
" quit | Selected: ",
|
|
63
62
|
selectedIndex + 1,
|
|
64
63
|
"/",
|
|
@@ -70,10 +69,10 @@ async function main() {
|
|
|
70
69
|
try {
|
|
71
70
|
var _usingCtx$1 = _usingCtx();
|
|
72
71
|
const term = _usingCtx$1.u(createTerm());
|
|
73
|
-
await render(/* @__PURE__ */
|
|
72
|
+
await render(/* @__PURE__ */ jsx(ExampleBanner, {
|
|
74
73
|
meta,
|
|
75
74
|
controls: "j/k navigate Esc/q quit",
|
|
76
|
-
children: /* @__PURE__ */
|
|
75
|
+
children: /* @__PURE__ */ jsx(ScrollExample, {})
|
|
77
76
|
}), term);
|
|
78
77
|
} catch (_) {
|
|
79
78
|
_usingCtx$1.e = _;
|
|
@@ -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 { useDeferredValue, useState, useTransition } from "react";
|
|
5
4
|
import { Box, Kbd, Lead, Muted, Strong, Text, createTerm, render, useApp, useInput } from "silvery";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region apps/search-filter.tsx
|
|
7
7
|
/**
|
|
8
8
|
* Search Filter Example
|
|
@@ -12,7 +12,6 @@ import { Box, Kbd, Lead, Muted, Strong, Text, createTerm, render, useApp, useInp
|
|
|
12
12
|
* - useDeferredValue for deferred filtering
|
|
13
13
|
* - Typing remains responsive even with heavy filtering
|
|
14
14
|
*/
|
|
15
|
-
var import_jsx_runtime = require_jsx_runtime();
|
|
16
15
|
const meta = {
|
|
17
16
|
name: "Search Filter",
|
|
18
17
|
description: "useTransition + useDeferredValue for responsive concurrent search",
|
|
@@ -167,13 +166,13 @@ const items = [
|
|
|
167
166
|
}
|
|
168
167
|
];
|
|
169
168
|
function SearchInput({ value, onChange }) {
|
|
170
|
-
return /* @__PURE__ */
|
|
171
|
-
/* @__PURE__ */
|
|
169
|
+
return /* @__PURE__ */ jsxs(Box, { children: [
|
|
170
|
+
/* @__PURE__ */ jsx(Strong, {
|
|
172
171
|
color: "$primary",
|
|
173
172
|
children: "Search: "
|
|
174
173
|
}),
|
|
175
|
-
/* @__PURE__ */
|
|
176
|
-
/* @__PURE__ */
|
|
174
|
+
/* @__PURE__ */ jsx(Text, { children: value }),
|
|
175
|
+
/* @__PURE__ */ jsx(Text, {
|
|
177
176
|
dim: true,
|
|
178
177
|
children: "|"
|
|
179
178
|
})
|
|
@@ -184,26 +183,26 @@ function FilteredList({ query, isPending }) {
|
|
|
184
183
|
const searchLower = query.toLowerCase();
|
|
185
184
|
return item.name.toLowerCase().includes(searchLower) || item.category.toLowerCase().includes(searchLower) || item.tags.some((tag) => tag.toLowerCase().includes(searchLower));
|
|
186
185
|
});
|
|
187
|
-
return /* @__PURE__ */
|
|
186
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
188
187
|
flexDirection: "column",
|
|
189
188
|
marginTop: 1,
|
|
190
189
|
children: [
|
|
191
|
-
/* @__PURE__ */
|
|
190
|
+
/* @__PURE__ */ jsx(Box, {
|
|
192
191
|
marginBottom: 1,
|
|
193
|
-
children: /* @__PURE__ */
|
|
192
|
+
children: /* @__PURE__ */ jsxs(Muted, { children: [
|
|
194
193
|
filtered.length,
|
|
195
194
|
" results",
|
|
196
195
|
isPending && " (filtering...)"
|
|
197
196
|
] })
|
|
198
197
|
}),
|
|
199
|
-
filtered.map((item) => /* @__PURE__ */
|
|
198
|
+
filtered.map((item) => /* @__PURE__ */ jsxs(Box, {
|
|
200
199
|
marginBottom: 1,
|
|
201
200
|
children: [
|
|
202
|
-
/* @__PURE__ */
|
|
201
|
+
/* @__PURE__ */ jsx(Text, {
|
|
203
202
|
bold: true,
|
|
204
203
|
children: item.name
|
|
205
204
|
}),
|
|
206
|
-
/* @__PURE__ */
|
|
205
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
207
206
|
dim: true,
|
|
208
207
|
children: [
|
|
209
208
|
" [",
|
|
@@ -211,13 +210,13 @@ function FilteredList({ query, isPending }) {
|
|
|
211
210
|
"]"
|
|
212
211
|
]
|
|
213
212
|
}),
|
|
214
|
-
/* @__PURE__ */
|
|
213
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
215
214
|
color: "$muted",
|
|
216
215
|
children: [" ", item.tags.join(", ")]
|
|
217
216
|
})
|
|
218
217
|
]
|
|
219
218
|
}, item.id)),
|
|
220
|
-
filtered.length === 0 && /* @__PURE__ */
|
|
219
|
+
filtered.length === 0 && /* @__PURE__ */ jsx(Lead, { children: "No matches found" })
|
|
221
220
|
]
|
|
222
221
|
});
|
|
223
222
|
}
|
|
@@ -241,26 +240,26 @@ function SearchApp() {
|
|
|
241
240
|
setQuery((prev) => prev + input);
|
|
242
241
|
});
|
|
243
242
|
});
|
|
244
|
-
return /* @__PURE__ */
|
|
243
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
245
244
|
flexDirection: "column",
|
|
246
245
|
padding: 1,
|
|
247
246
|
children: [
|
|
248
|
-
/* @__PURE__ */
|
|
247
|
+
/* @__PURE__ */ jsx(SearchInput, {
|
|
249
248
|
value: query,
|
|
250
249
|
onChange: setQuery
|
|
251
250
|
}),
|
|
252
|
-
/* @__PURE__ */
|
|
251
|
+
/* @__PURE__ */ jsx(Box, {
|
|
253
252
|
flexGrow: 1,
|
|
254
|
-
children: /* @__PURE__ */
|
|
253
|
+
children: /* @__PURE__ */ jsx(FilteredList, {
|
|
255
254
|
query: deferredQuery,
|
|
256
255
|
isPending
|
|
257
256
|
})
|
|
258
257
|
}),
|
|
259
|
-
/* @__PURE__ */
|
|
258
|
+
/* @__PURE__ */ jsxs(Muted, { children: [
|
|
260
259
|
" ",
|
|
261
|
-
/* @__PURE__ */
|
|
260
|
+
/* @__PURE__ */ jsx(Kbd, { children: "type" }),
|
|
262
261
|
" to search ",
|
|
263
|
-
/* @__PURE__ */
|
|
262
|
+
/* @__PURE__ */ jsx(Kbd, { children: "Esc/q" }),
|
|
264
263
|
" quit"
|
|
265
264
|
] })
|
|
266
265
|
]
|
|
@@ -270,10 +269,10 @@ async function main() {
|
|
|
270
269
|
try {
|
|
271
270
|
var _usingCtx$1 = _usingCtx();
|
|
272
271
|
const term = _usingCtx$1.u(createTerm());
|
|
273
|
-
const { waitUntilExit } = await render(/* @__PURE__ */
|
|
272
|
+
const { waitUntilExit } = await render(/* @__PURE__ */ jsx(ExampleBanner, {
|
|
274
273
|
meta,
|
|
275
274
|
controls: "type to search Esc quit",
|
|
276
|
-
children: /* @__PURE__ */
|
|
275
|
+
children: /* @__PURE__ */ jsx(SearchApp, {})
|
|
277
276
|
}), term);
|
|
278
277
|
await waitUntilExit();
|
|
279
278
|
} catch (_) {
|