@silvery/examples 0.5.6 → 0.17.4
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/UPNG-Cy7ViL8f.mjs +5074 -0
- package/dist/__vite-browser-external-2447137e-BML7CYau.mjs +4 -0
- package/dist/_banner-DLPxCqVy.mjs +44 -0
- package/dist/ansi-CCE2pVS0.mjs +16397 -0
- package/dist/apng-HhhBjRGt.mjs +68 -0
- package/dist/apng-mwUQbTTF.mjs +3 -0
- package/dist/apps/aichat/index.mjs +1299 -0
- package/dist/apps/app-todo.mjs +139 -0
- package/dist/apps/async-data.mjs +204 -0
- package/dist/apps/cli-wizard.mjs +339 -0
- package/dist/apps/clipboard.mjs +198 -0
- package/dist/apps/components.mjs +864 -0
- package/dist/apps/data-explorer.mjs +483 -0
- package/dist/apps/dev-tools.mjs +397 -0
- package/dist/apps/explorer.mjs +698 -0
- package/dist/apps/gallery.mjs +766 -0
- package/dist/apps/inline-bench.mjs +115 -0
- package/dist/apps/kanban.mjs +280 -0
- package/dist/apps/layout-ref.mjs +187 -0
- package/dist/apps/outline.mjs +203 -0
- package/dist/apps/paste-demo.mjs +189 -0
- package/dist/apps/scroll.mjs +86 -0
- package/dist/apps/search-filter.mjs +287 -0
- package/dist/apps/selection.mjs +355 -0
- package/dist/apps/spatial-focus-demo.mjs +388 -0
- package/dist/apps/task-list.mjs +258 -0
- package/dist/apps/terminal-caps-demo.mjs +315 -0
- package/dist/apps/terminal.mjs +872 -0
- package/dist/apps/text-selection-demo.mjs +254 -0
- package/dist/apps/textarea.mjs +178 -0
- package/dist/apps/theme.mjs +661 -0
- package/dist/apps/transform.mjs +215 -0
- package/dist/apps/virtual-10k.mjs +422 -0
- package/dist/assets/resvgjs.darwin-arm64-BtufyGW1.node +0 -0
- package/dist/backends-Bahh9mKN.mjs +1179 -0
- package/dist/backends-CCtCDQ94.mjs +3 -0
- package/dist/{cli.mjs → bin/cli.mjs} +21 -25
- package/dist/chunk-BSw8zbkd.mjs +37 -0
- package/dist/components/counter.mjs +48 -0
- package/dist/components/hello.mjs +31 -0
- package/dist/components/progress-bar.mjs +59 -0
- package/dist/components/select-list.mjs +85 -0
- package/dist/components/spinner.mjs +57 -0
- package/dist/components/text-input.mjs +62 -0
- package/dist/components/virtual-list.mjs +51 -0
- package/dist/flexily-zero-adapter-UB-ra8fR.mjs +3374 -0
- package/dist/gif-BZaqPPVX.mjs +3 -0
- package/dist/gif-BtnXuxLF.mjs +71 -0
- package/dist/gifenc-CLRW41dk.mjs +728 -0
- package/dist/jsx-runtime-dMs_8fNu.mjs +241 -0
- package/dist/key-mapping-5oYQdAQE.mjs +3 -0
- package/dist/key-mapping-D4LR1go6.mjs +130 -0
- package/dist/layout/dashboard.mjs +1204 -0
- package/dist/layout/live-resize.mjs +303 -0
- package/dist/layout/overflow.mjs +70 -0
- package/dist/layout/text-layout.mjs +335 -0
- package/dist/node-NuJ94BWl.mjs +1083 -0
- package/dist/plugins-D1KtkT4a.mjs +3057 -0
- package/dist/resvg-js-C_8Wps1F.mjs +201 -0
- package/dist/src-BTEVGpd9.mjs +23538 -0
- package/dist/src-CUUOuRH6.mjs +5322 -0
- package/dist/src-CzfRafCQ.mjs +814 -0
- package/dist/usingCtx-CsEf0xO3.mjs +57 -0
- package/dist/yoga-adapter-BVtQ5OJR.mjs +237 -0
- package/package.json +19 -14
- package/_banner.tsx +0 -60
- package/apps/aichat/components.tsx +0 -469
- package/apps/aichat/index.tsx +0 -220
- package/apps/aichat/script.ts +0 -460
- package/apps/aichat/state.ts +0 -325
- package/apps/aichat/types.ts +0 -19
- package/apps/app-todo.tsx +0 -201
- package/apps/async-data.tsx +0 -196
- package/apps/cli-wizard.tsx +0 -332
- package/apps/clipboard.tsx +0 -183
- package/apps/components.tsx +0 -658
- package/apps/data-explorer.tsx +0 -490
- package/apps/dev-tools.tsx +0 -395
- package/apps/explorer.tsx +0 -731
- package/apps/gallery.tsx +0 -653
- package/apps/inline-bench.tsx +0 -138
- package/apps/kanban.tsx +0 -265
- package/apps/layout-ref.tsx +0 -173
- package/apps/outline.tsx +0 -160
- package/apps/panes/index.tsx +0 -203
- package/apps/paste-demo.tsx +0 -185
- package/apps/scroll.tsx +0 -77
- package/apps/search-filter.tsx +0 -240
- package/apps/selection.tsx +0 -342
- package/apps/spatial-focus-demo.tsx +0 -368
- package/apps/task-list.tsx +0 -271
- package/apps/terminal-caps-demo.tsx +0 -334
- package/apps/terminal.tsx +0 -800
- package/apps/text-selection-demo.tsx +0 -189
- package/apps/textarea.tsx +0 -155
- package/apps/theme.tsx +0 -515
- package/apps/transform.tsx +0 -229
- package/apps/virtual-10k.tsx +0 -405
- package/apps/vterm-demo/index.tsx +0 -216
- package/components/counter.tsx +0 -45
- package/components/hello.tsx +0 -34
- package/components/progress-bar.tsx +0 -48
- package/components/select-list.tsx +0 -50
- package/components/spinner.tsx +0 -40
- package/components/text-input.tsx +0 -57
- package/components/virtual-list.tsx +0 -52
- package/dist/cli.d.mts +0 -1
- package/dist/cli.mjs.map +0 -1
- package/layout/dashboard.tsx +0 -953
- package/layout/live-resize.tsx +0 -282
- package/layout/overflow.tsx +0 -51
- package/layout/text-layout.tsx +0 -283
|
@@ -0,0 +1,864 @@
|
|
|
1
|
+
import { t as _usingCtx } from "../usingCtx-CsEf0xO3.mjs";
|
|
2
|
+
import { t as require_jsx_runtime } from "../jsx-runtime-dMs_8fNu.mjs";
|
|
3
|
+
import { t as ExampleBanner } from "../_banner-DLPxCqVy.mjs";
|
|
4
|
+
import { useCallback, useState } from "react";
|
|
5
|
+
import { Blockquote, Box, Button, Code, CodeBlock, Em, H1, H2, H3, HR, Kbd, LI, Lead, ModalDialog, Muted, OL, P, ProgressBar, SelectList, Small, Spinner, Strong, Text, TextArea, TextInput, Toggle, UL, createTerm, render, useApp, useInput } from "silvery";
|
|
6
|
+
//#region apps/components.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Components Showcase
|
|
9
|
+
*
|
|
10
|
+
* A UI component gallery demonstrating silvery's built-in components:
|
|
11
|
+
* - Typography: H1-H3, Strong, Muted, Small, Lead, Code, Blockquote, lists
|
|
12
|
+
* - Inputs: TextInput, TextArea, SelectList, Toggle with focus cycling
|
|
13
|
+
* - Display: ProgressBar, Spinner, Badge, border styles, ModalDialog
|
|
14
|
+
*/
|
|
15
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
16
|
+
const meta = {
|
|
17
|
+
name: "Components",
|
|
18
|
+
description: "UI component gallery with typography, inputs, and dialogs",
|
|
19
|
+
demo: true,
|
|
20
|
+
features: [
|
|
21
|
+
"Typography",
|
|
22
|
+
"TextInput",
|
|
23
|
+
"SelectList",
|
|
24
|
+
"ModalDialog",
|
|
25
|
+
"ProgressBar",
|
|
26
|
+
"focus ring"
|
|
27
|
+
]
|
|
28
|
+
};
|
|
29
|
+
function TypographyTab({ scrollOffset }) {
|
|
30
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
31
|
+
flexDirection: "column",
|
|
32
|
+
gap: 1,
|
|
33
|
+
paddingX: 1,
|
|
34
|
+
overflow: "scroll",
|
|
35
|
+
scrollOffset,
|
|
36
|
+
flexGrow: 1,
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
39
|
+
flexDirection: "column",
|
|
40
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(H1, { children: "Getting Started with Silvery" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Lead, { children: "Build modern terminal UIs with React — layout feedback, semantic theming, and 30+ components." })]
|
|
41
|
+
}),
|
|
42
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(HR, {}),
|
|
43
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
44
|
+
flexDirection: "row",
|
|
45
|
+
gap: 2,
|
|
46
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
47
|
+
flexDirection: "column",
|
|
48
|
+
flexGrow: 1,
|
|
49
|
+
flexBasis: 0,
|
|
50
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(H2, { children: "Typography" }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
51
|
+
flexDirection: "column",
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
54
|
+
bold: true,
|
|
55
|
+
color: "$primary",
|
|
56
|
+
children: "H1 — Page Title (bold, $primary)"
|
|
57
|
+
}),
|
|
58
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
59
|
+
bold: true,
|
|
60
|
+
color: "$accent",
|
|
61
|
+
children: "H2 — Section Heading (bold, $accent)"
|
|
62
|
+
}),
|
|
63
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
64
|
+
color: "$primary",
|
|
65
|
+
children: "H3 — Group Heading ($primary)"
|
|
66
|
+
}),
|
|
67
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(P, { children: "P — Body paragraph text" }),
|
|
68
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Lead, { children: "Lead — Introductory italic text" }),
|
|
69
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Muted, { children: "Muted — Secondary information" }),
|
|
70
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Small, { children: "Small — Fine print and captions" })
|
|
71
|
+
]
|
|
72
|
+
})]
|
|
73
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
74
|
+
flexDirection: "column",
|
|
75
|
+
flexGrow: 1,
|
|
76
|
+
flexBasis: 0,
|
|
77
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(H2, { children: "Inline Styles" }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
78
|
+
flexDirection: "column",
|
|
79
|
+
children: [
|
|
80
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Strong, { children: "Strong" }), " — bold emphasis"] }),
|
|
81
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Em, { children: "Em" }), " — italic emphasis"] }),
|
|
82
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [
|
|
83
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Strong, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Em, { children: "Strong + Em" }) }),
|
|
84
|
+
" ",
|
|
85
|
+
"— bold italic"
|
|
86
|
+
] }),
|
|
87
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
88
|
+
underline: true,
|
|
89
|
+
children: "Underline"
|
|
90
|
+
}), " — underlined text"] }),
|
|
91
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
92
|
+
strikethrough: true,
|
|
93
|
+
children: "Strikethrough"
|
|
94
|
+
}), " — deleted text"] }),
|
|
95
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Code, { children: "Code" }), " — inline code span"] }),
|
|
96
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Kbd, { children: "Kbd" }), " — keyboard shortcut"] })
|
|
97
|
+
]
|
|
98
|
+
})]
|
|
99
|
+
})]
|
|
100
|
+
}),
|
|
101
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(HR, {}),
|
|
102
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(H2, { children: "Semantic Colors" }),
|
|
103
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
104
|
+
flexDirection: "column",
|
|
105
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
106
|
+
gap: 1,
|
|
107
|
+
children: [
|
|
108
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
109
|
+
backgroundColor: "$primary",
|
|
110
|
+
color: "$primary-fg",
|
|
111
|
+
bold: true,
|
|
112
|
+
children: " $primary "
|
|
113
|
+
}),
|
|
114
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
115
|
+
backgroundColor: "$accent",
|
|
116
|
+
color: "$accent-fg",
|
|
117
|
+
bold: true,
|
|
118
|
+
children: " $accent "
|
|
119
|
+
}),
|
|
120
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
121
|
+
backgroundColor: "$success",
|
|
122
|
+
color: "$success-fg",
|
|
123
|
+
bold: true,
|
|
124
|
+
children: " $success "
|
|
125
|
+
}),
|
|
126
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
127
|
+
backgroundColor: "$warning",
|
|
128
|
+
color: "$warning-fg",
|
|
129
|
+
bold: true,
|
|
130
|
+
children: " $warning "
|
|
131
|
+
}),
|
|
132
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
133
|
+
backgroundColor: "$error",
|
|
134
|
+
color: "$error-fg",
|
|
135
|
+
bold: true,
|
|
136
|
+
children: " $error "
|
|
137
|
+
})
|
|
138
|
+
]
|
|
139
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
140
|
+
gap: 1,
|
|
141
|
+
marginTop: 1,
|
|
142
|
+
children: [
|
|
143
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
144
|
+
color: "$primary",
|
|
145
|
+
children: ["████", " primary"]
|
|
146
|
+
}),
|
|
147
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
148
|
+
color: "$accent",
|
|
149
|
+
children: ["████", " accent"]
|
|
150
|
+
}),
|
|
151
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
152
|
+
color: "$success",
|
|
153
|
+
children: ["████", " success"]
|
|
154
|
+
}),
|
|
155
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
156
|
+
color: "$warning",
|
|
157
|
+
children: ["████", " warning"]
|
|
158
|
+
}),
|
|
159
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
160
|
+
color: "$error",
|
|
161
|
+
children: ["████", " error"]
|
|
162
|
+
}),
|
|
163
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
164
|
+
color: "$muted",
|
|
165
|
+
children: ["████", " muted"]
|
|
166
|
+
})
|
|
167
|
+
]
|
|
168
|
+
})]
|
|
169
|
+
}),
|
|
170
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(HR, {}),
|
|
171
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(H2, { children: "Block Elements" }),
|
|
172
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blockquote, { children: "The best color code is no color code — most components already use the right semantic tokens." }),
|
|
173
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CodeBlock, { children: "bun add silvery # install\nbun run dev # start dev server" }),
|
|
174
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(H2, { children: "Lists" }),
|
|
175
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
176
|
+
flexDirection: "row",
|
|
177
|
+
gap: 4,
|
|
178
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
179
|
+
flexDirection: "column",
|
|
180
|
+
flexGrow: 1,
|
|
181
|
+
flexBasis: 0,
|
|
182
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(H3, { children: "Unordered" }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(UL, { children: [
|
|
183
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(LI, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Strong, { children: "SelectList" }), " — j/k navigation, scroll"] }),
|
|
184
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(LI, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Strong, { children: "TextInput" }), " — full readline support"] }),
|
|
185
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(LI, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Strong, { children: "ModalDialog" }), " — overlay with input blocking"] }),
|
|
186
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(LI, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Strong, { children: "ProgressBar" }), " — determinate + indeterminate"] })
|
|
187
|
+
] })]
|
|
188
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
189
|
+
flexDirection: "column",
|
|
190
|
+
flexGrow: 1,
|
|
191
|
+
flexBasis: 0,
|
|
192
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(H3, { children: "Ordered" }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(OL, { children: [
|
|
193
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(LI, { children: ["Install with ", /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Code, { children: "bun add silvery" })] }),
|
|
194
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(LI, { children: [
|
|
195
|
+
"Use ",
|
|
196
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Code, { children: "$tokens" }),
|
|
197
|
+
" for semantic colors"
|
|
198
|
+
] }),
|
|
199
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(LI, { children: [
|
|
200
|
+
"Layout with ",
|
|
201
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Code, { children: "flexbox" }),
|
|
202
|
+
" via Flexily"
|
|
203
|
+
] }),
|
|
204
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(LI, { children: ["Test with ", /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Code, { children: "createTermless()" })] })
|
|
205
|
+
] })]
|
|
206
|
+
})]
|
|
207
|
+
}),
|
|
208
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Small, { children: "silvery v0.0.1 — 38 palettes, 30+ components — silvery.dev" })
|
|
209
|
+
]
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
const frameworkItems = [
|
|
213
|
+
{
|
|
214
|
+
label: "Silvery",
|
|
215
|
+
value: "silvery"
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
label: "Ink",
|
|
219
|
+
value: "ink"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
label: "Blessed",
|
|
223
|
+
value: "blessed",
|
|
224
|
+
disabled: true
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
label: "Terminal Kit",
|
|
228
|
+
value: "terminal-kit"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
label: "React Curse",
|
|
232
|
+
value: "react-curse"
|
|
233
|
+
}
|
|
234
|
+
];
|
|
235
|
+
function InputsTab() {
|
|
236
|
+
const [textValue, setTextValue] = useState("");
|
|
237
|
+
const [areaValue, setAreaValue] = useState("");
|
|
238
|
+
const [selectedFramework, setSelectedFramework] = useState(0);
|
|
239
|
+
const [darkMode, setDarkMode] = useState(true);
|
|
240
|
+
const [notifications, setNotifications] = useState(false);
|
|
241
|
+
const [autoSave, setAutoSave] = useState(true);
|
|
242
|
+
const [focusIndex, setFocusIndex] = useState(0);
|
|
243
|
+
const focusableCount = 5;
|
|
244
|
+
useInput((_input, key) => {
|
|
245
|
+
if (key.tab && !key.shift) setFocusIndex((prev) => (prev + 1) % focusableCount);
|
|
246
|
+
if (key.tab && key.shift) setFocusIndex((prev) => (prev - 1 + focusableCount) % focusableCount);
|
|
247
|
+
});
|
|
248
|
+
const resetAll = useCallback(() => {
|
|
249
|
+
setTextValue("");
|
|
250
|
+
setAreaValue("");
|
|
251
|
+
setSelectedFramework(0);
|
|
252
|
+
setDarkMode(true);
|
|
253
|
+
setNotifications(false);
|
|
254
|
+
setAutoSave(true);
|
|
255
|
+
}, []);
|
|
256
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
257
|
+
flexDirection: "column",
|
|
258
|
+
gap: 1,
|
|
259
|
+
paddingX: 1,
|
|
260
|
+
overflow: "scroll",
|
|
261
|
+
flexGrow: 1,
|
|
262
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
263
|
+
flexDirection: "row",
|
|
264
|
+
gap: 2,
|
|
265
|
+
flexGrow: 1,
|
|
266
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
267
|
+
flexDirection: "column",
|
|
268
|
+
gap: 1,
|
|
269
|
+
flexGrow: 1,
|
|
270
|
+
flexBasis: 0,
|
|
271
|
+
children: [
|
|
272
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(H2, { children: "Text Input" }),
|
|
273
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TextInput, {
|
|
274
|
+
value: textValue,
|
|
275
|
+
onChange: setTextValue,
|
|
276
|
+
onSubmit: () => setTextValue(""),
|
|
277
|
+
placeholder: "Type something...",
|
|
278
|
+
prompt: "search: ",
|
|
279
|
+
borderStyle: "round",
|
|
280
|
+
isActive: focusIndex === 0
|
|
281
|
+
}),
|
|
282
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(H2, { children: "Text Area" }),
|
|
283
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TextArea, {
|
|
284
|
+
value: areaValue,
|
|
285
|
+
onChange: setAreaValue,
|
|
286
|
+
placeholder: "Write your thoughts...",
|
|
287
|
+
height: 4,
|
|
288
|
+
borderStyle: "round",
|
|
289
|
+
isActive: focusIndex === 1
|
|
290
|
+
}),
|
|
291
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(H2, { children: "Select List" }),
|
|
292
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
293
|
+
borderStyle: "round",
|
|
294
|
+
borderColor: focusIndex === 2 ? "$focusborder" : "$border",
|
|
295
|
+
paddingX: 1,
|
|
296
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectList, {
|
|
297
|
+
items: frameworkItems,
|
|
298
|
+
highlightedIndex: selectedFramework,
|
|
299
|
+
onHighlight: setSelectedFramework,
|
|
300
|
+
isActive: focusIndex === 2
|
|
301
|
+
})
|
|
302
|
+
})
|
|
303
|
+
]
|
|
304
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
305
|
+
flexDirection: "column",
|
|
306
|
+
gap: 1,
|
|
307
|
+
flexGrow: 1,
|
|
308
|
+
flexBasis: 0,
|
|
309
|
+
children: [
|
|
310
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(H2, { children: "Toggles" }),
|
|
311
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
312
|
+
flexDirection: "column",
|
|
313
|
+
borderStyle: "round",
|
|
314
|
+
borderColor: focusIndex === 3 ? "$focusborder" : "$border",
|
|
315
|
+
paddingX: 1,
|
|
316
|
+
paddingY: 1,
|
|
317
|
+
gap: 1,
|
|
318
|
+
children: [
|
|
319
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Toggle, {
|
|
320
|
+
value: darkMode,
|
|
321
|
+
onChange: setDarkMode,
|
|
322
|
+
label: "Dark mode",
|
|
323
|
+
isActive: focusIndex === 3
|
|
324
|
+
}),
|
|
325
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Toggle, {
|
|
326
|
+
value: notifications,
|
|
327
|
+
onChange: setNotifications,
|
|
328
|
+
label: "Notifications",
|
|
329
|
+
isActive: false
|
|
330
|
+
}),
|
|
331
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Toggle, {
|
|
332
|
+
value: autoSave,
|
|
333
|
+
onChange: setAutoSave,
|
|
334
|
+
label: "Auto-save",
|
|
335
|
+
isActive: false
|
|
336
|
+
})
|
|
337
|
+
]
|
|
338
|
+
}),
|
|
339
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(H2, { children: "Button" }),
|
|
340
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
|
|
341
|
+
label: "Reset All",
|
|
342
|
+
onPress: resetAll,
|
|
343
|
+
isActive: focusIndex === 4
|
|
344
|
+
}),
|
|
345
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(HR, {}),
|
|
346
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(H2, { children: "Current Values" }),
|
|
347
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
348
|
+
flexDirection: "column",
|
|
349
|
+
backgroundColor: "$surfacebg",
|
|
350
|
+
paddingX: 1,
|
|
351
|
+
paddingY: 1,
|
|
352
|
+
borderStyle: "round",
|
|
353
|
+
children: [
|
|
354
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
355
|
+
color: "$surface",
|
|
356
|
+
children: [
|
|
357
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Strong, { children: "Text:" }),
|
|
358
|
+
" ",
|
|
359
|
+
textValue || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Muted, { children: "(empty)" })
|
|
360
|
+
]
|
|
361
|
+
}),
|
|
362
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
363
|
+
color: "$surface",
|
|
364
|
+
children: [
|
|
365
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Strong, { children: "Area:" }),
|
|
366
|
+
" ",
|
|
367
|
+
areaValue ? areaValue.split("\n")[0] + (areaValue.includes("\n") ? "..." : "") : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Muted, { children: "(empty)" })
|
|
368
|
+
]
|
|
369
|
+
}),
|
|
370
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
371
|
+
color: "$surface",
|
|
372
|
+
children: [
|
|
373
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Strong, { children: "Framework:" }),
|
|
374
|
+
" ",
|
|
375
|
+
frameworkItems[selectedFramework]?.label
|
|
376
|
+
]
|
|
377
|
+
}),
|
|
378
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
379
|
+
color: "$surface",
|
|
380
|
+
children: [
|
|
381
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Strong, { children: "Dark mode:" }),
|
|
382
|
+
" ",
|
|
383
|
+
darkMode ? "on" : "off"
|
|
384
|
+
]
|
|
385
|
+
}),
|
|
386
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
387
|
+
color: "$surface",
|
|
388
|
+
children: [
|
|
389
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Strong, { children: "Notifications:" }),
|
|
390
|
+
" ",
|
|
391
|
+
notifications ? "on" : "off"
|
|
392
|
+
]
|
|
393
|
+
}),
|
|
394
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
395
|
+
color: "$surface",
|
|
396
|
+
children: [
|
|
397
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Strong, { children: "Auto-save:" }),
|
|
398
|
+
" ",
|
|
399
|
+
autoSave ? "on" : "off"
|
|
400
|
+
]
|
|
401
|
+
})
|
|
402
|
+
]
|
|
403
|
+
})
|
|
404
|
+
]
|
|
405
|
+
})]
|
|
406
|
+
})
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
function DisplayTab({ scrollOffset }) {
|
|
410
|
+
const [showModal, setShowModal] = useState(false);
|
|
411
|
+
const [selectedBorder, setSelectedBorder] = useState(0);
|
|
412
|
+
const borderStyles = [
|
|
413
|
+
"round",
|
|
414
|
+
"bold",
|
|
415
|
+
"single",
|
|
416
|
+
"double",
|
|
417
|
+
"classic"
|
|
418
|
+
];
|
|
419
|
+
useInput((input, key) => {
|
|
420
|
+
if (key.return && !showModal) setShowModal(true);
|
|
421
|
+
if ((key.escape || input === "q") && showModal) setShowModal(false);
|
|
422
|
+
if (input === "j" && !showModal) setSelectedBorder((prev) => Math.min(prev + 1, borderStyles.length - 1));
|
|
423
|
+
if (input === "k" && !showModal) setSelectedBorder((prev) => Math.max(prev - 1, 0));
|
|
424
|
+
});
|
|
425
|
+
const cell = {
|
|
426
|
+
flexGrow: 1,
|
|
427
|
+
flexBasis: 0,
|
|
428
|
+
borderStyle: "round",
|
|
429
|
+
borderColor: "$border",
|
|
430
|
+
paddingX: 1,
|
|
431
|
+
paddingY: 1,
|
|
432
|
+
flexDirection: "column",
|
|
433
|
+
gap: 1
|
|
434
|
+
};
|
|
435
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
436
|
+
flexDirection: "column",
|
|
437
|
+
gap: 1,
|
|
438
|
+
paddingX: 1,
|
|
439
|
+
children: [
|
|
440
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
441
|
+
flexDirection: "row",
|
|
442
|
+
gap: 1,
|
|
443
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
444
|
+
...cell,
|
|
445
|
+
children: [
|
|
446
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
447
|
+
color: "$primary",
|
|
448
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Strong, { children: "Progress Bars" })
|
|
449
|
+
}),
|
|
450
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
451
|
+
flexDirection: "column",
|
|
452
|
+
children: [
|
|
453
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
454
|
+
color: "$muted",
|
|
455
|
+
children: "Build "
|
|
456
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
457
|
+
flexGrow: 1,
|
|
458
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressBar, {
|
|
459
|
+
value: 1,
|
|
460
|
+
label: "✓"
|
|
461
|
+
})
|
|
462
|
+
})] }),
|
|
463
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
464
|
+
color: "$muted",
|
|
465
|
+
children: "Test "
|
|
466
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
467
|
+
flexGrow: 1,
|
|
468
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressBar, { value: .73 })
|
|
469
|
+
})] }),
|
|
470
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
471
|
+
color: "$muted",
|
|
472
|
+
children: "Deploy "
|
|
473
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
474
|
+
flexGrow: 1,
|
|
475
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressBar, { value: .35 })
|
|
476
|
+
})] }),
|
|
477
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
478
|
+
color: "$muted",
|
|
479
|
+
children: "Install "
|
|
480
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
481
|
+
flexGrow: 1,
|
|
482
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressBar, {})
|
|
483
|
+
})] })
|
|
484
|
+
]
|
|
485
|
+
}),
|
|
486
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
487
|
+
flexDirection: "column",
|
|
488
|
+
children: [
|
|
489
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, {
|
|
490
|
+
type: "dots",
|
|
491
|
+
label: "Loading packages..."
|
|
492
|
+
}),
|
|
493
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, {
|
|
494
|
+
type: "line",
|
|
495
|
+
label: "Compiling..."
|
|
496
|
+
}),
|
|
497
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, {
|
|
498
|
+
type: "arc",
|
|
499
|
+
label: "Optimizing bundle..."
|
|
500
|
+
})
|
|
501
|
+
]
|
|
502
|
+
})
|
|
503
|
+
]
|
|
504
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
505
|
+
...cell,
|
|
506
|
+
children: [
|
|
507
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
508
|
+
color: "$primary",
|
|
509
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Strong, { children: "Input Controls" })
|
|
510
|
+
}),
|
|
511
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
512
|
+
flexDirection: "column",
|
|
513
|
+
gap: 1,
|
|
514
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
515
|
+
gap: 1,
|
|
516
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Muted, { children: "Search:" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
517
|
+
flexGrow: 1,
|
|
518
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TextInput, {
|
|
519
|
+
value: "flutter widgets",
|
|
520
|
+
onChange: () => {},
|
|
521
|
+
showUnderline: true,
|
|
522
|
+
underlineWidth: 25
|
|
523
|
+
})
|
|
524
|
+
})]
|
|
525
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
526
|
+
gap: 2,
|
|
527
|
+
wrap: "truncate",
|
|
528
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Toggle, {
|
|
529
|
+
label: "Dark mode",
|
|
530
|
+
value: true,
|
|
531
|
+
onChange: () => {}
|
|
532
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Toggle, {
|
|
533
|
+
label: "Notifications",
|
|
534
|
+
value: false,
|
|
535
|
+
onChange: () => {}
|
|
536
|
+
})]
|
|
537
|
+
})]
|
|
538
|
+
}),
|
|
539
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectList, {
|
|
540
|
+
items: [
|
|
541
|
+
{
|
|
542
|
+
label: "React",
|
|
543
|
+
value: "react"
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
label: "Vue",
|
|
547
|
+
value: "vue"
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
label: "Svelte",
|
|
551
|
+
value: "svelte"
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
label: "Angular",
|
|
555
|
+
value: "angular"
|
|
556
|
+
}
|
|
557
|
+
],
|
|
558
|
+
highlightedIndex: 0,
|
|
559
|
+
onHighlight: () => {},
|
|
560
|
+
isActive: false
|
|
561
|
+
})
|
|
562
|
+
]
|
|
563
|
+
})]
|
|
564
|
+
}),
|
|
565
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
566
|
+
flexDirection: "row",
|
|
567
|
+
gap: 1,
|
|
568
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
569
|
+
flexDirection: "column",
|
|
570
|
+
gap: 1,
|
|
571
|
+
flexGrow: 1,
|
|
572
|
+
flexBasis: 0,
|
|
573
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
574
|
+
...cell,
|
|
575
|
+
flexGrow: 1,
|
|
576
|
+
flexBasis: 0,
|
|
577
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
578
|
+
color: "$primary",
|
|
579
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Strong, { children: "Border Styles" })
|
|
580
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
581
|
+
flexDirection: "column",
|
|
582
|
+
gap: 0,
|
|
583
|
+
children: borderStyles.map((style, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
584
|
+
borderStyle: style,
|
|
585
|
+
borderColor: i === selectedBorder ? "$primary" : "$border",
|
|
586
|
+
borderLeft: true,
|
|
587
|
+
borderRight: true,
|
|
588
|
+
borderTop: i === 0,
|
|
589
|
+
borderBottom: true,
|
|
590
|
+
paddingX: 1,
|
|
591
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
592
|
+
bold: i === selectedBorder,
|
|
593
|
+
children: [i === selectedBorder ? "▸ " : " ", style]
|
|
594
|
+
})
|
|
595
|
+
}, style))
|
|
596
|
+
})]
|
|
597
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
598
|
+
...cell,
|
|
599
|
+
flexGrow: 1,
|
|
600
|
+
flexBasis: 0,
|
|
601
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
602
|
+
color: "$primary",
|
|
603
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Strong, { children: "Design Tokens" })
|
|
604
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
605
|
+
flexDirection: "row",
|
|
606
|
+
gap: 2,
|
|
607
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
608
|
+
flexDirection: "column",
|
|
609
|
+
width: 14,
|
|
610
|
+
children: [
|
|
611
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
612
|
+
color: "$success",
|
|
613
|
+
children: [
|
|
614
|
+
"●",
|
|
615
|
+
" ",
|
|
616
|
+
"$success".padEnd(10)
|
|
617
|
+
]
|
|
618
|
+
}),
|
|
619
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
620
|
+
color: "$warning",
|
|
621
|
+
children: [
|
|
622
|
+
"●",
|
|
623
|
+
" ",
|
|
624
|
+
"$warning".padEnd(10)
|
|
625
|
+
]
|
|
626
|
+
}),
|
|
627
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
628
|
+
color: "$error",
|
|
629
|
+
children: [
|
|
630
|
+
"●",
|
|
631
|
+
" ",
|
|
632
|
+
"$error".padEnd(10)
|
|
633
|
+
]
|
|
634
|
+
}),
|
|
635
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
636
|
+
color: "$info",
|
|
637
|
+
children: [
|
|
638
|
+
"●",
|
|
639
|
+
" ",
|
|
640
|
+
"$info".padEnd(10)
|
|
641
|
+
]
|
|
642
|
+
}),
|
|
643
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
644
|
+
color: "$primary",
|
|
645
|
+
children: [
|
|
646
|
+
"●",
|
|
647
|
+
" ",
|
|
648
|
+
"$primary".padEnd(10)
|
|
649
|
+
]
|
|
650
|
+
}),
|
|
651
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Muted, { children: [
|
|
652
|
+
"●",
|
|
653
|
+
" ",
|
|
654
|
+
"$muted".padEnd(10)
|
|
655
|
+
] })
|
|
656
|
+
]
|
|
657
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
658
|
+
flexDirection: "column",
|
|
659
|
+
children: [
|
|
660
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
661
|
+
backgroundColor: "$primary",
|
|
662
|
+
color: "$primary-fg",
|
|
663
|
+
children: " $primary "
|
|
664
|
+
}),
|
|
665
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
666
|
+
backgroundColor: "$fg",
|
|
667
|
+
color: "$bg",
|
|
668
|
+
children: " $inverse "
|
|
669
|
+
}),
|
|
670
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
671
|
+
backgroundColor: "$muted-bg",
|
|
672
|
+
color: "$fg",
|
|
673
|
+
children: " $surface "
|
|
674
|
+
}),
|
|
675
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
676
|
+
backgroundColor: "$surfacebg",
|
|
677
|
+
color: "$surface",
|
|
678
|
+
children: " $surfacebg "
|
|
679
|
+
})
|
|
680
|
+
]
|
|
681
|
+
})]
|
|
682
|
+
})]
|
|
683
|
+
})]
|
|
684
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
685
|
+
...cell,
|
|
686
|
+
backgroundColor: "$surfacebg",
|
|
687
|
+
paddingRight: 2,
|
|
688
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
689
|
+
justifyContent: "space-between",
|
|
690
|
+
paddingBottom: 1,
|
|
691
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
692
|
+
color: "$primary",
|
|
693
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Strong, { children: "Modal Dialog" })
|
|
694
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Small, {
|
|
695
|
+
color: "$muted",
|
|
696
|
+
children: "Esc to close"
|
|
697
|
+
})]
|
|
698
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
699
|
+
flexDirection: "column",
|
|
700
|
+
gap: 1,
|
|
701
|
+
children: [
|
|
702
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
703
|
+
gap: 1,
|
|
704
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Muted, { children: "Branch:" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TextInput, {
|
|
705
|
+
value: "main",
|
|
706
|
+
onChange: () => {},
|
|
707
|
+
showUnderline: true,
|
|
708
|
+
underlineWidth: 25,
|
|
709
|
+
isActive: true
|
|
710
|
+
})]
|
|
711
|
+
}),
|
|
712
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
713
|
+
flexDirection: "column",
|
|
714
|
+
children: [
|
|
715
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
716
|
+
color: "$success",
|
|
717
|
+
children: "✓"
|
|
718
|
+
}), " All checks passed"] }),
|
|
719
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
720
|
+
color: "$success",
|
|
721
|
+
children: "✓"
|
|
722
|
+
}), " Tests: 247 passed"] }),
|
|
723
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
724
|
+
color: "$warning",
|
|
725
|
+
children: "⚠"
|
|
726
|
+
}), " 2 deprecation warnings"] }),
|
|
727
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
728
|
+
color: "$muted",
|
|
729
|
+
children: "ℹ"
|
|
730
|
+
}), " Deploy target: us-east-1"] })
|
|
731
|
+
]
|
|
732
|
+
}),
|
|
733
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
734
|
+
gap: 2,
|
|
735
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
736
|
+
backgroundColor: "$primary",
|
|
737
|
+
color: "$primary-fg",
|
|
738
|
+
children: " Deploy "
|
|
739
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
740
|
+
backgroundColor: "$muted-bg",
|
|
741
|
+
color: "$fg",
|
|
742
|
+
children: " Cancel "
|
|
743
|
+
})]
|
|
744
|
+
})
|
|
745
|
+
]
|
|
746
|
+
})]
|
|
747
|
+
})]
|
|
748
|
+
}),
|
|
749
|
+
showModal && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
750
|
+
position: "absolute",
|
|
751
|
+
display: "flex",
|
|
752
|
+
justifyContent: "center",
|
|
753
|
+
alignItems: "center",
|
|
754
|
+
width: "100%",
|
|
755
|
+
height: "100%",
|
|
756
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ModalDialog, {
|
|
757
|
+
title: "Component Gallery",
|
|
758
|
+
width: 50,
|
|
759
|
+
footer: "ESC or q to close",
|
|
760
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
761
|
+
flexDirection: "column",
|
|
762
|
+
gap: 1,
|
|
763
|
+
children: [
|
|
764
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(P, { children: [
|
|
765
|
+
"This gallery demonstrates ",
|
|
766
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Strong, { children: "silvery" }),
|
|
767
|
+
"'s built-in UI components. Every component uses semantic theme tokens — they adapt to any of the 38 built-in palettes automatically."
|
|
768
|
+
] }),
|
|
769
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(HR, {}),
|
|
770
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
771
|
+
flexDirection: "column",
|
|
772
|
+
children: [
|
|
773
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
774
|
+
color: "$success",
|
|
775
|
+
children: "✓ Typography presets (H1-H3, Lead, Muted, Code)"
|
|
776
|
+
}),
|
|
777
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
778
|
+
color: "$success",
|
|
779
|
+
children: "✓ Input components (TextInput, TextArea, SelectList)"
|
|
780
|
+
}),
|
|
781
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
782
|
+
color: "$success",
|
|
783
|
+
children: "✓ Display widgets (ProgressBar, Spinner, Badge)"
|
|
784
|
+
}),
|
|
785
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
786
|
+
color: "$success",
|
|
787
|
+
children: "✓ Layout primitives (Box, Divider, border styles)"
|
|
788
|
+
}),
|
|
789
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
790
|
+
color: "$success",
|
|
791
|
+
children: "✓ Dialog system (ModalDialog with input blocking)"
|
|
792
|
+
})
|
|
793
|
+
]
|
|
794
|
+
})
|
|
795
|
+
]
|
|
796
|
+
})
|
|
797
|
+
})
|
|
798
|
+
})
|
|
799
|
+
]
|
|
800
|
+
});
|
|
801
|
+
}
|
|
802
|
+
function ComponentsApp() {
|
|
803
|
+
const { exit } = useApp();
|
|
804
|
+
const [activeTab, setActiveTab] = useState("display");
|
|
805
|
+
const [scrollOffset, setScrollOffset] = useState(0);
|
|
806
|
+
const handleTabChange = useCallback((tab) => {
|
|
807
|
+
setActiveTab(tab);
|
|
808
|
+
setScrollOffset(0);
|
|
809
|
+
}, []);
|
|
810
|
+
const tabs = [
|
|
811
|
+
"display",
|
|
812
|
+
"inputs",
|
|
813
|
+
"typography"
|
|
814
|
+
];
|
|
815
|
+
useInput((input, key) => {
|
|
816
|
+
if (input === "q" && activeTab !== "inputs") exit();
|
|
817
|
+
if (key.escape && activeTab !== "display") exit();
|
|
818
|
+
if (input === "l" && activeTab !== "inputs") {
|
|
819
|
+
handleTabChange(tabs[(tabs.indexOf(activeTab) + 1) % tabs.length]);
|
|
820
|
+
return;
|
|
821
|
+
}
|
|
822
|
+
if (input === "h" && activeTab !== "inputs") {
|
|
823
|
+
handleTabChange(tabs[(tabs.indexOf(activeTab) - 1 + tabs.length) % tabs.length]);
|
|
824
|
+
return;
|
|
825
|
+
}
|
|
826
|
+
if (activeTab !== "inputs") {
|
|
827
|
+
if (key.downArrow || activeTab === "typography" && input === "j") setScrollOffset((prev) => prev + 1);
|
|
828
|
+
if (key.upArrow || activeTab === "typography" && input === "k") setScrollOffset((prev) => Math.max(0, prev - 1));
|
|
829
|
+
if (key.pageDown) setScrollOffset((prev) => prev + 10);
|
|
830
|
+
if (key.pageUp) setScrollOffset((prev) => Math.max(0, prev - 10));
|
|
831
|
+
if (key.home || activeTab === "typography" && input === "g") setScrollOffset(0);
|
|
832
|
+
if (key.end || activeTab === "typography" && input === "G") setScrollOffset(999);
|
|
833
|
+
}
|
|
834
|
+
});
|
|
835
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
836
|
+
flexDirection: "column",
|
|
837
|
+
flexGrow: 1,
|
|
838
|
+
padding: 1,
|
|
839
|
+
children: [
|
|
840
|
+
activeTab === "display" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DisplayTab, { scrollOffset }),
|
|
841
|
+
activeTab === "inputs" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputsTab, {}),
|
|
842
|
+
activeTab === "typography" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TypographyTab, { scrollOffset })
|
|
843
|
+
]
|
|
844
|
+
});
|
|
845
|
+
}
|
|
846
|
+
async function main() {
|
|
847
|
+
try {
|
|
848
|
+
var _usingCtx$1 = _usingCtx();
|
|
849
|
+
const term = _usingCtx$1.u(createTerm());
|
|
850
|
+
const { waitUntilExit } = await render(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExampleBanner, {
|
|
851
|
+
meta,
|
|
852
|
+
controls: "h/l tab Tab cycle inputs j/k navigate Enter modal Esc/q quit",
|
|
853
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ComponentsApp, {})
|
|
854
|
+
}), term);
|
|
855
|
+
await waitUntilExit();
|
|
856
|
+
} catch (_) {
|
|
857
|
+
_usingCtx$1.e = _;
|
|
858
|
+
} finally {
|
|
859
|
+
_usingCtx$1.d();
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
if (import.meta.main) await main();
|
|
863
|
+
//#endregion
|
|
864
|
+
export { ComponentsApp, main, meta };
|