@sigx/terminal-ui 0.5.0
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/LICENSE +21 -0
- package/dist/Spinner-JpmBtbPo.js +25 -0
- package/dist/Spinner-JpmBtbPo.js.map +1 -0
- package/dist/buttons/Button.d.ts +8 -0
- package/dist/buttons/index.d.ts +1 -0
- package/dist/buttons/index.js +2 -0
- package/dist/buttons-D5iaiJ6G.js +38 -0
- package/dist/buttons-D5iaiJ6G.js.map +1 -0
- package/dist/data/QRCode.d.ts +17 -0
- package/dist/data/Table.d.ts +11 -0
- package/dist/data/index.d.ts +2 -0
- package/dist/data/index.js +2 -0
- package/dist/data-DKKLsE5K.js +43 -0
- package/dist/data-DKKLsE5K.js.map +1 -0
- package/dist/feedback/Badge.d.ts +14 -0
- package/dist/feedback/ProgressBar.d.ts +31 -0
- package/dist/feedback/Spinner.d.ts +21 -0
- package/dist/feedback/index.d.ts +3 -0
- package/dist/feedback/index.js +3 -0
- package/dist/feedback-1WqdARfx.js +62 -0
- package/dist/feedback-1WqdARfx.js.map +1 -0
- package/dist/forms/Checkbox.d.ts +15 -0
- package/dist/forms/Confirm.d.ts +21 -0
- package/dist/forms/Input.d.ts +15 -0
- package/dist/forms/MultiSelect.d.ts +36 -0
- package/dist/forms/Radio.d.ts +23 -0
- package/dist/forms/Select.d.ts +22 -0
- package/dist/forms/TextArea.d.ts +37 -0
- package/dist/forms/index.d.ts +7 -0
- package/dist/forms/index.js +2 -0
- package/dist/forms-MgpyoQI5.js +399 -0
- package/dist/forms-MgpyoQI5.js.map +1 -0
- package/dist/fx/Banner.d.ts +19 -0
- package/dist/fx/Gradient.d.ts +18 -0
- package/dist/fx/PixelArt.d.ts +16 -0
- package/dist/fx/Shimmer.d.ts +18 -0
- package/dist/fx/blockFont.d.ts +13 -0
- package/dist/fx/index.d.ts +6 -0
- package/dist/fx/index.js +3 -0
- package/dist/fx/paint.d.ts +15 -0
- package/dist/fx/presets.d.ts +14 -0
- package/dist/fx-igWaVCkB.js +452 -0
- package/dist/fx-igWaVCkB.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +13 -0
- package/dist/layout/Card.d.ts +11 -0
- package/dist/layout/index.d.ts +2 -0
- package/dist/layout/index.js +2 -0
- package/dist/layout-CJzMVMDf.js +18 -0
- package/dist/layout-CJzMVMDf.js.map +1 -0
- package/dist/navigation/KeyHints.d.ts +15 -0
- package/dist/navigation/StatusBar.d.ts +9 -0
- package/dist/navigation/SuggestionList.d.ts +22 -0
- package/dist/navigation/Tabs.d.ts +18 -0
- package/dist/navigation/index.d.ts +4 -0
- package/dist/navigation/index.js +2 -0
- package/dist/navigation-B-nI3g0k.js +133 -0
- package/dist/navigation-B-nI3g0k.js.map +1 -0
- package/dist/presets-uqseGRqO.js +31 -0
- package/dist/presets-uqseGRqO.js.map +1 -0
- package/dist/prompts/PromptShell.d.ts +11 -0
- package/dist/prompts/confirm.d.ts +14 -0
- package/dist/prompts/index.d.ts +35 -0
- package/dist/prompts/index.js +2 -0
- package/dist/prompts/multiselect.d.ts +14 -0
- package/dist/prompts/select.d.ts +20 -0
- package/dist/prompts/spinner.d.ts +22 -0
- package/dist/prompts/statics.d.ts +8 -0
- package/dist/prompts/text.d.ts +19 -0
- package/dist/prompts-BLtLCen_.js +381 -0
- package/dist/prompts-BLtLCen_.js.map +1 -0
- package/dist/tasks/LogPanel.d.ts +28 -0
- package/dist/tasks/LogView.d.ts +24 -0
- package/dist/tasks/TaskList.d.ts +26 -0
- package/dist/tasks/index.d.ts +4 -0
- package/dist/tasks/index.js +2 -0
- package/dist/tasks/logStore.d.ts +40 -0
- package/dist/tasks-CdVFFOFs.js +254 -0
- package/dist/tasks-CdVFFOFs.js.map +1 -0
- package/dist/theme/builtins.d.ts +7 -0
- package/dist/theme/index.d.ts +3 -0
- package/dist/theme/index.js +2 -0
- package/dist/theme-DASuxf6k.js +150 -0
- package/dist/theme-DASuxf6k.js.map +1 -0
- package/package.json +95 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { GLYPHS as e, focus as t, focusState as n, onKey as r, registerFocusable as i, resolveColor as a, unregisterFocusable as o } from "@sigx/terminal-zero";
|
|
2
|
+
import { component as s, onMounted as c, onUnmounted as l, signal as u } from "@sigx/runtime-core";
|
|
3
|
+
import { jsx as d, jsxs as f } from "@sigx/runtime-core/jsx-runtime";
|
|
4
|
+
//#region src/navigation/Tabs.tsx
|
|
5
|
+
var p = s(({ props: e, emit: s }) => {
|
|
6
|
+
let u = Math.random().toString(36).slice(2), p = () => n.activeId === u, m = () => {
|
|
7
|
+
let t = (e.options || []).findIndex((t) => t.value === e.model?.value);
|
|
8
|
+
return t >= 0 ? t : 0;
|
|
9
|
+
}, h = (t) => {
|
|
10
|
+
let n = e.options || [];
|
|
11
|
+
if (n.length === 0) return;
|
|
12
|
+
let r = n.length, i = n[(m() + t + r) % r].value;
|
|
13
|
+
e.model && (e.model.value = i), s("change", i);
|
|
14
|
+
}, g = (e) => {
|
|
15
|
+
p() && (e === "\x1B[D" || e === "h" ? h(-1) : (e === "\x1B[C" || e === "l") && h(1));
|
|
16
|
+
}, _ = null;
|
|
17
|
+
return c(() => {
|
|
18
|
+
i(u), e.autofocus && t(u), _ = r(g);
|
|
19
|
+
}), l(() => {
|
|
20
|
+
_ && _(), o(u);
|
|
21
|
+
}), () => {
|
|
22
|
+
let t = e.options || [], n = e.model?.value || t[0]?.value || "", r = p(), i = [];
|
|
23
|
+
return t.forEach((e, r) => {
|
|
24
|
+
let o = e.value === n, s = a(o ? "accent" : "accentSoft"), c = a(o ? "accentText" : "dim");
|
|
25
|
+
i.push(/* @__PURE__ */ f("text", {
|
|
26
|
+
backgroundColor: s,
|
|
27
|
+
color: c,
|
|
28
|
+
children: [
|
|
29
|
+
" ",
|
|
30
|
+
e.label,
|
|
31
|
+
" "
|
|
32
|
+
]
|
|
33
|
+
})), r < t.length - 1 && i.push(/* @__PURE__ */ d("text", { children: " " }));
|
|
34
|
+
}), /* @__PURE__ */ d("box", {
|
|
35
|
+
border: "rounded",
|
|
36
|
+
borderColor: a(r ? "accent" : "line"),
|
|
37
|
+
children: i
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
}, { name: "Tabs" }), m = s(({ props: e }) => () => {
|
|
41
|
+
let t = e.items || [], n = [];
|
|
42
|
+
return t.forEach((e) => {
|
|
43
|
+
n.push(/* @__PURE__ */ f("text", {
|
|
44
|
+
backgroundColor: a("accent"),
|
|
45
|
+
color: a("accentText"),
|
|
46
|
+
children: [
|
|
47
|
+
" ",
|
|
48
|
+
e.key,
|
|
49
|
+
" "
|
|
50
|
+
]
|
|
51
|
+
})), n.push(/* @__PURE__ */ f("text", {
|
|
52
|
+
color: a("dim"),
|
|
53
|
+
children: [
|
|
54
|
+
" ",
|
|
55
|
+
e.label,
|
|
56
|
+
" "
|
|
57
|
+
]
|
|
58
|
+
}));
|
|
59
|
+
}), /* @__PURE__ */ d("box", {
|
|
60
|
+
backgroundColor: a("chrome"),
|
|
61
|
+
children: n
|
|
62
|
+
});
|
|
63
|
+
}, { name: "StatusBar" }), h = s(({ props: e }) => () => {
|
|
64
|
+
let t = e.hints || [], n = e.separator || "·";
|
|
65
|
+
return /* @__PURE__ */ d("box", { children: t.map((e, t) => /* @__PURE__ */ f("text", { children: [
|
|
66
|
+
t > 0 && /* @__PURE__ */ f("text", {
|
|
67
|
+
color: a("faint"),
|
|
68
|
+
children: [
|
|
69
|
+
" ",
|
|
70
|
+
n,
|
|
71
|
+
" "
|
|
72
|
+
]
|
|
73
|
+
}),
|
|
74
|
+
/* @__PURE__ */ d("text", {
|
|
75
|
+
color: a("accent"),
|
|
76
|
+
children: e.key
|
|
77
|
+
}),
|
|
78
|
+
/* @__PURE__ */ f("text", {
|
|
79
|
+
color: a("dim"),
|
|
80
|
+
children: [" ", e.label]
|
|
81
|
+
})
|
|
82
|
+
] })) });
|
|
83
|
+
}, { name: "KeyHints" }), g = s(({ props: t, emit: n }) => {
|
|
84
|
+
let i = u({
|
|
85
|
+
cursor: 0,
|
|
86
|
+
itemsKey: ""
|
|
87
|
+
}), o = () => t.items ?? [], s = () => {
|
|
88
|
+
let e = o().map((e) => e.value).join("\0");
|
|
89
|
+
return e !== i.itemsKey && (i.itemsKey = e, i.cursor = 0), Math.min(i.cursor, Math.max(0, o().length - 1));
|
|
90
|
+
}, p = (e) => {
|
|
91
|
+
let t = o();
|
|
92
|
+
if (e === "\x1B[A") return t.length === 0 || (i.cursor = s() > 0 ? s() - 1 : t.length - 1), !0;
|
|
93
|
+
if (e === "\x1B[B") return t.length === 0 || (i.cursor = s() < t.length - 1 ? s() + 1 : 0), !0;
|
|
94
|
+
if (e === " " || e === "\r") return t.length === 0 ? void 0 : (n("accept", t[s()].value), !0);
|
|
95
|
+
if (e === "\x1B") return n("dismiss"), !0;
|
|
96
|
+
}, m = null;
|
|
97
|
+
return c(() => {
|
|
98
|
+
m = r(p, { layer: "overlay" });
|
|
99
|
+
}), l(() => {
|
|
100
|
+
m && m();
|
|
101
|
+
}), () => {
|
|
102
|
+
let n = o(), r = s(), i = Math.max(1, t.maxVisible || 6), c = 0;
|
|
103
|
+
return n.length > i && (c = Math.min(Math.max(0, r - i + 1), n.length - i)), /* @__PURE__ */ f("box", { children: [n.slice(c, c + i).map((t, n) => {
|
|
104
|
+
let i = c + n === r;
|
|
105
|
+
return /* @__PURE__ */ f("box", { children: [
|
|
106
|
+
/* @__PURE__ */ f("text", {
|
|
107
|
+
color: a(i ? "accent" : "faint"),
|
|
108
|
+
children: [i ? e.cursor : " ", " "]
|
|
109
|
+
}),
|
|
110
|
+
/* @__PURE__ */ d("text", {
|
|
111
|
+
color: a(i ? "accent" : "fg"),
|
|
112
|
+
children: t.label ?? t.value
|
|
113
|
+
}),
|
|
114
|
+
t.description && /* @__PURE__ */ f("text", {
|
|
115
|
+
color: a("dim"),
|
|
116
|
+
children: [" ", t.description]
|
|
117
|
+
})
|
|
118
|
+
] });
|
|
119
|
+
}), n.length > i && /* @__PURE__ */ d("box", { children: /* @__PURE__ */ f("text", {
|
|
120
|
+
color: a("faint"),
|
|
121
|
+
children: [
|
|
122
|
+
" ",
|
|
123
|
+
r + 1,
|
|
124
|
+
"/",
|
|
125
|
+
n.length
|
|
126
|
+
]
|
|
127
|
+
}) })] });
|
|
128
|
+
};
|
|
129
|
+
}, { name: "SuggestionList" });
|
|
130
|
+
//#endregion
|
|
131
|
+
export { p as i, h as n, m as r, g as t };
|
|
132
|
+
|
|
133
|
+
//# sourceMappingURL=navigation-B-nI3g0k.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation-B-nI3g0k.js","names":[],"sources":["../src/navigation/Tabs.tsx","../src/navigation/StatusBar.tsx","../src/navigation/KeyHints.tsx","../src/navigation/SuggestionList.tsx"],"sourcesContent":["/** @jsxImportSource @sigx/runtime-core */\r\nimport { component, onMounted, onUnmounted, type Define } from '@sigx/runtime-core';\r\nimport {\r\n onKey, registerFocusable, unregisterFocusable, focusState, focus, resolveColor,\r\n} from '@sigx/terminal-zero';\r\n\r\nexport interface TabOption<T = string> {\r\n label: string;\r\n value: T;\r\n}\r\n\r\n/** Horizontal tab switcher. Active tab fills accent; ←/→ (or h/l) switch. */\r\nexport const Tabs = component<\r\n Define.Model<string> &\r\n Define.Prop<\"options\", TabOption[], true> &\r\n Define.Prop<\"autofocus\", boolean, false> &\r\n Define.Event<\"change\", string>\r\n>(({ props, emit }) => {\r\n const id = Math.random().toString(36).slice(2);\r\n const isFocused = () => focusState.activeId === id;\r\n\r\n const getCurrentIndex = () => {\r\n const options = props.options || [];\r\n const idx = options.findIndex(o => o.value === props.model?.value);\r\n return idx >= 0 ? idx : 0;\r\n };\r\n\r\n const move = (delta: number) => {\r\n const options = props.options || [];\r\n if (options.length === 0) return;\r\n const len = options.length;\r\n const newIndex = (getCurrentIndex() + delta + len) % len;\r\n const newValue = options[newIndex].value;\r\n if (props.model) props.model.value = newValue;\r\n emit('change', newValue);\r\n };\r\n\r\n const handleKey = (key: string) => {\r\n if (!isFocused()) return;\r\n if (key === '\\x1B[D' || key === 'h') move(-1);\r\n else if (key === '\\x1B[C' || key === 'l') move(1);\r\n };\r\n\r\n let keyCleanup: (() => void) | null = null;\r\n\r\n onMounted(() => {\r\n registerFocusable(id);\r\n if (props.autofocus) focus(id);\r\n keyCleanup = onKey(handleKey);\r\n });\r\n\r\n onUnmounted(() => {\r\n if (keyCleanup) keyCleanup();\r\n unregisterFocusable(id);\r\n });\r\n\r\n return () => {\r\n const options = props.options || [];\r\n const current = props.model?.value || options[0]?.value || '';\r\n const focused = isFocused();\r\n\r\n const tabs: any[] = [];\r\n options.forEach((option, i) => {\r\n const active = option.value === current;\r\n const bg = resolveColor(active ? 'accent' : 'accentSoft');\r\n const fg = resolveColor(active ? 'accentText' : 'dim');\r\n tabs.push(<text backgroundColor={bg} color={fg}> {option.label} </text>);\r\n if (i < options.length - 1) tabs.push(<text> </text>);\r\n });\r\n\r\n return (\r\n <box border=\"rounded\" borderColor={resolveColor(focused ? 'accent' : 'line')}>\r\n {tabs}\r\n </box>\r\n );\r\n };\r\n}, { name: 'Tabs' });\r\n\r\nexport default Tabs;\r\n","/** @jsxImportSource @sigx/runtime-core */\r\nimport { component, type Define } from '@sigx/runtime-core';\r\nimport { resolveColor } from '@sigx/terminal-zero';\r\n\r\nexport interface StatusItem {\r\n key: string;\r\n label: string;\r\n}\r\n\r\n/** Key-hint footer: each item is ` key ` (accent fill) + ` label ` (dim). */\r\nexport const StatusBar = component<\r\n Define.Prop<\"items\", StatusItem[], true>\r\n>(({ props }) => {\r\n return () => {\r\n const items = props.items || [];\r\n const nodes: any[] = [];\r\n items.forEach((item) => {\r\n nodes.push(\r\n <text backgroundColor={resolveColor('accent')} color={resolveColor('accentText')}> {item.key} </text>\r\n );\r\n nodes.push(<text color={resolveColor('dim')}> {item.label} </text>);\r\n });\r\n return <box backgroundColor={resolveColor('chrome')}>{nodes}</box>;\r\n };\r\n}, { name: 'StatusBar' });\r\n\r\nexport default StatusBar;\r\n","/** @jsxImportSource @sigx/runtime-core */\r\nimport { component, type Define } from '@sigx/runtime-core';\r\nimport { resolveColor } from '@sigx/terminal-zero';\r\n\r\nexport interface KeyHint {\r\n key: string;\r\n label: string;\r\n}\r\n\r\n/**\r\n * The dev-server shortcuts footer: `r reload · d devices · q quit`.\r\n * Deliberately lighter than StatusBar (no chips, no background fill) —\r\n * accent keys, dim labels, faint separators, one line.\r\n */\r\nexport const KeyHints = component<\r\n Define.Prop<\"hints\", KeyHint[], true> &\r\n Define.Prop<\"separator\", string, false>\r\n>(({ props }) => {\r\n return () => {\r\n const hints = props.hints || [];\r\n const separator = props.separator || '·';\r\n\r\n return (\r\n <box>\r\n {hints.map((hint, i) => (\r\n <text>\r\n {i > 0 && <text color={resolveColor('faint')}> {separator} </text>}\r\n <text color={resolveColor('accent')}>{hint.key}</text>\r\n <text color={resolveColor('dim')}> {hint.label}</text>\r\n </text>\r\n ))}\r\n </box>\r\n );\r\n };\r\n}, { name: 'KeyHints' });\r\n\r\nexport default KeyHints;\r\n","/** @jsxImportSource @sigx/runtime-core */\r\nimport { component, onMounted, onUnmounted, signal, type Define } from '@sigx/runtime-core';\r\nimport { onKey, resolveColor, GLYPHS } from '@sigx/terminal-zero';\r\n\r\nexport interface SuggestionItem {\r\n value: string;\r\n /** Defaults to value. */\r\n label?: string;\r\n description?: string;\r\n}\r\n\r\n/**\r\n * Intellisense popup for an input: mount it to open it (typically rendered\r\n * conditionally under a TextArea while the value matches a trigger like `/`).\r\n * It registers an OVERLAY-layer key handler that consumes only navigation\r\n * keys — ↑/↓ move, Tab/Enter accept the highlighted item, Esc dismisses —\r\n * while printable characters, backspace, etc. fall through to the input\r\n * below, so filtering keeps working as the user types.\r\n */\r\nexport const SuggestionList = component<\r\n Define.Prop<'items', SuggestionItem[], true> &\r\n Define.Prop<'maxVisible', number, false> &\r\n Define.Event<'accept', string> &\r\n Define.Event<'dismiss'>\r\n>(({ props, emit }) => {\r\n const ESC = String.fromCharCode(27);\r\n const state = signal({ cursor: 0, itemsKey: '' });\r\n\r\n const items = () => props.items ?? [];\r\n const syncCursor = () => {\r\n const key = items().map((i) => i.value).join('\\x00');\r\n if (key !== state.itemsKey) {\r\n state.itemsKey = key;\r\n state.cursor = 0;\r\n }\r\n return Math.min(state.cursor, Math.max(0, items().length - 1));\r\n };\r\n\r\n const handleKey = (key: string): boolean | void => {\r\n const list = items();\r\n if (key === ESC + '[A') {\r\n if (list.length === 0) return true;\r\n state.cursor = syncCursor() > 0 ? syncCursor() - 1 : list.length - 1;\r\n return true;\r\n }\r\n if (key === ESC + '[B') {\r\n if (list.length === 0) return true;\r\n state.cursor = syncCursor() < list.length - 1 ? syncCursor() + 1 : 0;\r\n return true;\r\n }\r\n if (key === '\\t' || key === '\\r') {\r\n if (list.length === 0) return; // nothing to accept — let it fall through\r\n emit('accept', list[syncCursor()].value);\r\n return true;\r\n }\r\n if (key === ESC) {\r\n emit('dismiss');\r\n return true;\r\n }\r\n // Everything else (printables, backspace, \\n) falls through to the\r\n // input below so filtering keeps working.\r\n };\r\n\r\n let keyCleanup: (() => void) | null = null;\r\n\r\n onMounted(() => {\r\n // No READY_DELAY: this mounts in reaction to a key that was already\r\n // dispatched — the very next key is legitimately for the list.\r\n keyCleanup = onKey(handleKey, { layer: 'overlay' });\r\n });\r\n\r\n onUnmounted(() => {\r\n if (keyCleanup) keyCleanup();\r\n });\r\n\r\n return () => {\r\n const list = items();\r\n const cursor = syncCursor();\r\n const maxVisible = Math.max(1, props.maxVisible || 6);\r\n\r\n let top = 0;\r\n if (list.length > maxVisible) {\r\n top = Math.min(Math.max(0, cursor - maxVisible + 1), list.length - maxVisible);\r\n }\r\n const windowed = list.slice(top, top + maxVisible);\r\n\r\n return (\r\n <box>\r\n {windowed.map((item, i) => {\r\n const onCursor = top + i === cursor;\r\n return (\r\n <box>\r\n <text color={resolveColor(onCursor ? 'accent' : 'faint')}>{onCursor ? GLYPHS.cursor : ' '} </text>\r\n <text color={resolveColor(onCursor ? 'accent' : 'fg')}>{item.label ?? item.value}</text>\r\n {item.description && <text color={resolveColor('dim')}> {item.description}</text>}\r\n </box>\r\n );\r\n })}\r\n {list.length > maxVisible && (\r\n <box><text color={resolveColor('faint')}> {cursor + 1}/{list.length}</text></box>\r\n )}\r\n </box>\r\n );\r\n };\r\n}, { name: 'SuggestionList' });\r\n\r\nexport default SuggestionList;\r\n"],"mappings":";;;;AAYA,IAAa,IAAO,GAKjB,EAAE,UAAO,cAAW;CACnB,IAAM,IAAK,KAAK,QAAQ,CAAC,SAAS,GAAG,CAAC,MAAM,EAAE,EACxC,UAAkB,EAAW,aAAa,GAE1C,UAAwB;EAE1B,IAAM,KADU,EAAM,WAAW,EAAE,EACf,WAAU,MAAK,EAAE,UAAU,EAAM,OAAO,MAAM;EAClE,OAAO,KAAO,IAAI,IAAM;IAGtB,KAAQ,MAAkB;EAC5B,IAAM,IAAU,EAAM,WAAW,EAAE;EACnC,IAAI,EAAQ,WAAW,GAAG;EAC1B,IAAM,IAAM,EAAQ,QAEd,IAAW,GADC,GAAiB,GAAG,IAAQ,KAAO,GAClB;EAEnC,AADI,EAAM,UAAO,EAAM,MAAM,QAAQ,IACrC,EAAK,UAAU,EAAS;IAGtB,KAAa,MAAgB;EAC1B,GAAW,KACZ,MAAQ,YAAY,MAAQ,MAAK,EAAK,GAAG,IACpC,MAAQ,YAAY,MAAQ,QAAK,EAAK,EAAE;IAGjD,IAAkC;CAatC,OAXA,QAAgB;EAGZ,AAFA,EAAkB,EAAG,EACjB,EAAM,aAAW,EAAM,EAAG,EAC9B,IAAa,EAAM,EAAU;GAC/B,EAEF,QAAkB;EAEd,AADI,KAAY,GAAY,EAC5B,EAAoB,EAAG;GACzB,QAEW;EACT,IAAM,IAAU,EAAM,WAAW,EAAE,EAC7B,IAAU,EAAM,OAAO,SAAS,EAAQ,IAAI,SAAS,IACrD,IAAU,GAAW,EAErB,IAAc,EAAE;EAStB,OARA,EAAQ,SAAS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"
|
|
25
|
+
],
|
|
26
|
+
fire: ["#f12711", "#f5af19"]
|
|
27
|
+
};
|
|
28
|
+
//#endregion
|
|
29
|
+
export { e as t };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=presets-uqseGRqO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presets-uqseGRqO.js","names":[],"sources":["../src/fx/presets.ts"],"sourcesContent":["/**\r\n * Gradient stop presets. Stops are theme tokens OR raw hex: tokens resolve\r\n * through `resolveColor` at render time, so token-based presets (like `sigx`)\r\n * re-color live when the theme changes; fixed-hex presets look the same on\r\n * every theme.\r\n */\r\nexport const GRADIENT_PRESETS = {\r\n sigx: ['accent', 'info', 'success'],\r\n rainbow: ['#ff5f5f', '#f5c518', '#3fd07f', '#34d4d4', '#4a9eff', '#c678dd'],\r\n sunset: ['#ff7e5f', '#feb47b', '#ffcd94'],\r\n ocean: ['#2193b0', '#6dd5ed', '#b8e8f4'],\r\n fire: ['#f12711', '#f5af19'],\r\n} as const;\r\n\r\nexport type GradientPreset = keyof typeof GRADIENT_PRESETS;\r\n"],"mappings":";AAMA,IAAa,IAAmB;CAC5B,MAAM;EAAC;EAAU;EAAQ;EAAU;CACnC,SAAS;EAAC;EAAW;EAAW;EAAW;EAAW;EAAW;EAAU;CAC3E,QAAQ;EAAC;EAAW;EAAW;EAAU;CACzC,OAAO;EAAC;EAAW;EAAW;EAAU;CACxC,MAAM,CAAC,WAAW,UAAU;CAC/B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface FrameOptions {
|
|
2
|
+
message: string;
|
|
3
|
+
rows: unknown[];
|
|
4
|
+
/** Dim guidance under the bar; replaced by `error` when set. */
|
|
5
|
+
footer?: string;
|
|
6
|
+
/** Validation error — switches the glyph to ▲ danger. */
|
|
7
|
+
error?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function promptFrame(opts: FrameOptions): any;
|
|
10
|
+
/** One body row behind the `│` gutter. */
|
|
11
|
+
export declare function promptRow(children: unknown): any;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CANCEL } from '@sigx/terminal-zero';
|
|
2
|
+
export interface ConfirmOptions {
|
|
3
|
+
message: string;
|
|
4
|
+
initialValue?: boolean;
|
|
5
|
+
/** Label for true. Default 'Yes'. */
|
|
6
|
+
active?: string;
|
|
7
|
+
/** Label for false. Default 'No'. */
|
|
8
|
+
inactive?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Yes/No prompt: y/n answer immediately, ←/→ (or h/l) flip the selection,
|
|
12
|
+
* Enter resolves the current value.
|
|
13
|
+
*/
|
|
14
|
+
export declare function confirm(opts: ConfirmOptions): Promise<boolean | typeof CANCEL>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Imperative prompts: linear CLI wizards without a JSX step
|
|
3
|
+
* machine. Each prompt mounts a one-shot inline UI, resolves on Enter, and
|
|
4
|
+
* collapses into a permanent `◇ message · answer` line — a finished wizard
|
|
5
|
+
* reads as a tidy transcript in scrollback.
|
|
6
|
+
*/
|
|
7
|
+
export { CANCEL, isCancel, __setInteractiveOverride } from '@sigx/terminal-zero';
|
|
8
|
+
export { text, password, type TextOptions } from './text';
|
|
9
|
+
export { select, type SelectOptions, type PromptOption } from './select';
|
|
10
|
+
export { multiselect, type MultiSelectPromptOptions } from './multiselect';
|
|
11
|
+
export { confirm, type ConfirmOptions } from './confirm';
|
|
12
|
+
export { intro, outro, note, cancel } from './statics';
|
|
13
|
+
export { spinner, type SpinnerHandle } from './spinner';
|
|
14
|
+
import { CANCEL, isCancel } from '@sigx/terminal-zero';
|
|
15
|
+
import { text, password } from './text';
|
|
16
|
+
import { select } from './select';
|
|
17
|
+
import { multiselect } from './multiselect';
|
|
18
|
+
import { confirm } from './confirm';
|
|
19
|
+
import { intro, outro, note, cancel } from './statics';
|
|
20
|
+
import { spinner } from './spinner';
|
|
21
|
+
/** Namespace bundle for collision-free imports: `prompt.select(...)`. */
|
|
22
|
+
export declare const prompt: {
|
|
23
|
+
readonly text: typeof text;
|
|
24
|
+
readonly password: typeof password;
|
|
25
|
+
readonly select: typeof select;
|
|
26
|
+
readonly multiselect: typeof multiselect;
|
|
27
|
+
readonly confirm: typeof confirm;
|
|
28
|
+
readonly intro: typeof intro;
|
|
29
|
+
readonly outro: typeof outro;
|
|
30
|
+
readonly note: typeof note;
|
|
31
|
+
readonly cancel: typeof cancel;
|
|
32
|
+
readonly spinner: typeof spinner;
|
|
33
|
+
readonly isCancel: typeof isCancel;
|
|
34
|
+
readonly CANCEL: typeof CANCEL;
|
|
35
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as e, c as t, d as n, f as r, i, l as a, m as o, n as s, o as c, p as l, r as u, s as d, t as f, u as p } from "../prompts-BLtLCen_.js";
|
|
2
|
+
export { f as CANCEL, s as __setInteractiveOverride, c as cancel, p as confirm, d as intro, u as isCancel, n as multiselect, t as note, a as outro, l as password, i as prompt, r as select, e as spinner, o as text };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CANCEL } from '@sigx/terminal-zero';
|
|
2
|
+
import { type PromptOption } from './select';
|
|
3
|
+
export interface MultiSelectPromptOptions<T> {
|
|
4
|
+
message: string;
|
|
5
|
+
options: PromptOption<T>[];
|
|
6
|
+
initialValues?: T[];
|
|
7
|
+
/** Block an empty Enter and show a hint instead. Default false. */
|
|
8
|
+
required?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Multi-choice prompt: ↑/k ↓/j move, Space toggles, `a` toggles all,
|
|
12
|
+
* Enter resolves the checked values (in option order).
|
|
13
|
+
*/
|
|
14
|
+
export declare function multiselect<T = string>(opts: MultiSelectPromptOptions<T>): Promise<T[] | typeof CANCEL>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CANCEL } from '@sigx/terminal-zero';
|
|
2
|
+
export interface PromptOption<T> {
|
|
3
|
+
value: T;
|
|
4
|
+
/** Defaults to String(value). */
|
|
5
|
+
label?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Section header rendered above this option when it differs from the
|
|
9
|
+
* previous option's group (multiselect only; pre-sort options by group).
|
|
10
|
+
*/
|
|
11
|
+
group?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function optionLabel<T>(option: PromptOption<T>): string;
|
|
14
|
+
export interface SelectOptions<T> {
|
|
15
|
+
message: string;
|
|
16
|
+
options: PromptOption<T>[];
|
|
17
|
+
initialValue?: T;
|
|
18
|
+
}
|
|
19
|
+
/** Single-choice prompt: ↑/k ↓/j move (wrapping), Enter resolves the value. */
|
|
20
|
+
export declare function select<T = string>(opts: SelectOptions<T>): Promise<T | typeof CANCEL>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface SpinnerHandle {
|
|
2
|
+
start(label?: string): void;
|
|
3
|
+
/** Update the label while spinning. */
|
|
4
|
+
message(label: string): void;
|
|
5
|
+
/** Stop and leave a permanent `✔ label` / `✖ label` line. */
|
|
6
|
+
stop(label?: string, code?: 'success' | 'error'): void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Imperative spinner for prompt flows:
|
|
10
|
+
*
|
|
11
|
+
* const s = spinner();
|
|
12
|
+
* s.start('Installing dependencies');
|
|
13
|
+
* await install();
|
|
14
|
+
* s.stop('Dependencies installed');
|
|
15
|
+
*
|
|
16
|
+
* Queues behind any in-flight prompts and occupies the live region until
|
|
17
|
+
* stopped — don't await another prompt between start() and stop() (it would
|
|
18
|
+
* wait for the spinner's slot and deadlock). Ctrl+C stays the renderer
|
|
19
|
+
* default here (exit): a long task should be interruptible.
|
|
20
|
+
* Non-TTY: start() renders nothing; stop() prints the summary line.
|
|
21
|
+
*/
|
|
22
|
+
export declare function spinner(): SpinnerHandle;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Open a prompt flow with a title bar. */
|
|
2
|
+
export declare function intro(title: string): void;
|
|
3
|
+
/** Close a prompt flow. */
|
|
4
|
+
export declare function outro(message: string): void;
|
|
5
|
+
/** An informational block inside a flow. */
|
|
6
|
+
export declare function note(message: string, title?: string): void;
|
|
7
|
+
/** Announce a cancelled flow (pair with isCancel + process.exit). */
|
|
8
|
+
export declare function cancel(message: string): void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CANCEL } from '@sigx/terminal-zero';
|
|
2
|
+
export interface TextOptions {
|
|
3
|
+
message: string;
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
initialValue?: string;
|
|
6
|
+
/** Return an error string to reject the submit and keep editing. */
|
|
7
|
+
validate?: (value: string) => string | undefined;
|
|
8
|
+
/** Render every typed character as this string (password fields). */
|
|
9
|
+
mask?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Single-line text prompt. Enter validates and resolves; Esc/Ctrl+C resolve
|
|
13
|
+
* the CANCEL symbol (check with isCancel). Editing is end-of-line only.
|
|
14
|
+
*/
|
|
15
|
+
export declare function text(opts: TextOptions): Promise<string | typeof CANCEL>;
|
|
16
|
+
/** `text` with masked rendering — the summary shows the mask, never the value. */
|
|
17
|
+
export declare function password(opts: Omit<TextOptions, 'mask' | 'placeholder'> & {
|
|
18
|
+
mask?: string;
|
|
19
|
+
}): Promise<string | typeof CANCEL>;
|