termui 0.1.0 → 0.1.2
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/chunk-B2VO7M2O.js +3493 -0
- package/dist/chunk-B2VO7M2O.js.map +1 -0
- package/dist/chunk-ZZKFZA2U.js +694 -0
- package/dist/chunk-ZZKFZA2U.js.map +1 -0
- package/dist/components.d.ts +668 -0
- package/dist/components.js +130 -0
- package/dist/components.js.map +1 -0
- package/dist/core.d.ts +144 -0
- package/dist/core.js +99 -0
- package/dist/core.js.map +1 -0
- package/dist/hooks-YADffFjU.d.ts +237 -0
- package/dist/hooks.d.ts +3 -0
- package/dist/hooks.js +29 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +225 -0
- package/dist/index.js.map +1 -0
- package/package.json +41 -10
- package/packages/cli/package.json +0 -36
- package/packages/components/dist/data/List.d.ts +0 -15
- package/packages/components/dist/data/List.d.ts.map +0 -1
- package/packages/components/dist/data/List.js +0 -40
- package/packages/components/dist/data/List.js.map +0 -1
- package/packages/components/dist/data/Table.d.ts +0 -17
- package/packages/components/dist/data/Table.d.ts.map +0 -1
- package/packages/components/dist/data/Table.js +0 -74
- package/packages/components/dist/data/Table.js.map +0 -1
- package/packages/components/dist/data/index.d.ts +0 -5
- package/packages/components/dist/data/index.d.ts.map +0 -1
- package/packages/components/dist/data/index.js +0 -3
- package/packages/components/dist/data/index.js.map +0 -1
- package/packages/components/dist/feedback/Alert.d.ts +0 -10
- package/packages/components/dist/feedback/Alert.d.ts.map +0 -1
- package/packages/components/dist/feedback/Alert.js +0 -23
- package/packages/components/dist/feedback/Alert.js.map +0 -1
- package/packages/components/dist/feedback/ProgressBar.d.ts +0 -13
- package/packages/components/dist/feedback/ProgressBar.d.ts.map +0 -1
- package/packages/components/dist/feedback/ProgressBar.js +0 -13
- package/packages/components/dist/feedback/ProgressBar.js.map +0 -1
- package/packages/components/dist/feedback/Spinner.d.ts +0 -9
- package/packages/components/dist/feedback/Spinner.d.ts.map +0 -1
- package/packages/components/dist/feedback/Spinner.js +0 -26
- package/packages/components/dist/feedback/Spinner.js.map +0 -1
- package/packages/components/dist/feedback/index.d.ts +0 -7
- package/packages/components/dist/feedback/index.d.ts.map +0 -1
- package/packages/components/dist/feedback/index.js +0 -4
- package/packages/components/dist/feedback/index.js.map +0 -1
- package/packages/components/dist/forms/Form.d.ts +0 -22
- package/packages/components/dist/forms/Form.d.ts.map +0 -1
- package/packages/components/dist/forms/Form.js +0 -45
- package/packages/components/dist/forms/Form.js.map +0 -1
- package/packages/components/dist/forms/index.d.ts +0 -3
- package/packages/components/dist/forms/index.d.ts.map +0 -1
- package/packages/components/dist/forms/index.js +0 -2
- package/packages/components/dist/forms/index.js.map +0 -1
- package/packages/components/dist/index.d.ts +0 -11
- package/packages/components/dist/index.d.ts.map +0 -1
- package/packages/components/dist/index.js +0 -21
- package/packages/components/dist/index.js.map +0 -1
- package/packages/components/dist/input/TextInput.d.ts +0 -14
- package/packages/components/dist/input/TextInput.d.ts.map +0 -1
- package/packages/components/dist/input/TextInput.js +0 -44
- package/packages/components/dist/input/TextInput.js.map +0 -1
- package/packages/components/dist/input/index.d.ts +0 -3
- package/packages/components/dist/input/index.d.ts.map +0 -1
- package/packages/components/dist/input/index.js +0 -2
- package/packages/components/dist/input/index.js.map +0 -1
- package/packages/components/dist/layout/Box.d.ts +0 -11
- package/packages/components/dist/layout/Box.d.ts.map +0 -1
- package/packages/components/dist/layout/Box.js +0 -18
- package/packages/components/dist/layout/Box.js.map +0 -1
- package/packages/components/dist/layout/Grid.d.ts +0 -8
- package/packages/components/dist/layout/Grid.d.ts.map +0 -1
- package/packages/components/dist/layout/Grid.js +0 -12
- package/packages/components/dist/layout/Grid.js.map +0 -1
- package/packages/components/dist/layout/ScrollView.d.ts +0 -9
- package/packages/components/dist/layout/ScrollView.d.ts.map +0 -1
- package/packages/components/dist/layout/ScrollView.js +0 -26
- package/packages/components/dist/layout/ScrollView.js.map +0 -1
- package/packages/components/dist/layout/Stack.d.ts +0 -12
- package/packages/components/dist/layout/Stack.d.ts.map +0 -1
- package/packages/components/dist/layout/Stack.js +0 -6
- package/packages/components/dist/layout/Stack.js.map +0 -1
- package/packages/components/dist/layout/index.d.ts +0 -9
- package/packages/components/dist/layout/index.d.ts.map +0 -1
- package/packages/components/dist/layout/index.js +0 -5
- package/packages/components/dist/layout/index.js.map +0 -1
- package/packages/components/dist/navigation/Tabs.d.ts +0 -15
- package/packages/components/dist/navigation/Tabs.d.ts.map +0 -1
- package/packages/components/dist/navigation/Tabs.js +0 -34
- package/packages/components/dist/navigation/Tabs.js.map +0 -1
- package/packages/components/dist/navigation/index.d.ts +0 -3
- package/packages/components/dist/navigation/index.d.ts.map +0 -1
- package/packages/components/dist/navigation/index.js +0 -2
- package/packages/components/dist/navigation/index.js.map +0 -1
- package/packages/components/dist/overlays/Modal.d.ts +0 -10
- package/packages/components/dist/overlays/Modal.d.ts.map +0 -1
- package/packages/components/dist/overlays/Modal.js +0 -16
- package/packages/components/dist/overlays/Modal.js.map +0 -1
- package/packages/components/dist/overlays/index.d.ts +0 -3
- package/packages/components/dist/overlays/index.d.ts.map +0 -1
- package/packages/components/dist/overlays/index.js +0 -2
- package/packages/components/dist/overlays/index.js.map +0 -1
- package/packages/components/dist/selection/Checkbox.d.ts +0 -10
- package/packages/components/dist/selection/Checkbox.d.ts.map +0 -1
- package/packages/components/dist/selection/Checkbox.js +0 -26
- package/packages/components/dist/selection/Checkbox.js.map +0 -1
- package/packages/components/dist/selection/Select.d.ts +0 -17
- package/packages/components/dist/selection/Select.d.ts.map +0 -1
- package/packages/components/dist/selection/Select.js +0 -44
- package/packages/components/dist/selection/Select.js.map +0 -1
- package/packages/components/dist/selection/index.d.ts +0 -5
- package/packages/components/dist/selection/index.d.ts.map +0 -1
- package/packages/components/dist/selection/index.js +0 -3
- package/packages/components/dist/selection/index.js.map +0 -1
- package/packages/components/dist/typography/Badge.d.ts +0 -9
- package/packages/components/dist/typography/Badge.d.ts.map +0 -1
- package/packages/components/dist/typography/Badge.js +0 -18
- package/packages/components/dist/typography/Badge.js.map +0 -1
- package/packages/components/dist/typography/Text.d.ts +0 -15
- package/packages/components/dist/typography/Text.d.ts.map +0 -1
- package/packages/components/dist/typography/Text.js +0 -6
- package/packages/components/dist/typography/Text.js.map +0 -1
- package/packages/components/dist/typography/index.d.ts +0 -5
- package/packages/components/dist/typography/index.d.ts.map +0 -1
- package/packages/components/dist/typography/index.js +0 -3
- package/packages/components/dist/typography/index.js.map +0 -1
- package/packages/components/dist/utility/Panel.d.ts +0 -14
- package/packages/components/dist/utility/Panel.d.ts.map +0 -1
- package/packages/components/dist/utility/Panel.js +0 -8
- package/packages/components/dist/utility/Panel.js.map +0 -1
- package/packages/components/dist/utility/Toggle.d.ts +0 -11
- package/packages/components/dist/utility/Toggle.d.ts.map +0 -1
- package/packages/components/dist/utility/Toggle.js +0 -23
- package/packages/components/dist/utility/Toggle.js.map +0 -1
- package/packages/components/dist/utility/index.d.ts +0 -5
- package/packages/components/dist/utility/index.d.ts.map +0 -1
- package/packages/components/dist/utility/index.js +0 -3
- package/packages/components/dist/utility/index.js.map +0 -1
- package/packages/components/package.json +0 -36
- package/packages/core/dist/hooks/index.d.ts +0 -18
- package/packages/core/dist/hooks/index.d.ts.map +0 -1
- package/packages/core/dist/hooks/index.js +0 -13
- package/packages/core/dist/hooks/index.js.map +0 -1
- package/packages/core/dist/hooks/useAnimation.d.ts +0 -7
- package/packages/core/dist/hooks/useAnimation.d.ts.map +0 -1
- package/packages/core/dist/hooks/useAnimation.js +0 -40
- package/packages/core/dist/hooks/useAnimation.js.map +0 -1
- package/packages/core/dist/hooks/useAsync.d.ts +0 -25
- package/packages/core/dist/hooks/useAsync.d.ts.map +0 -1
- package/packages/core/dist/hooks/useAsync.js +0 -37
- package/packages/core/dist/hooks/useAsync.js.map +0 -1
- package/packages/core/dist/hooks/useClipboard.d.ts +0 -9
- package/packages/core/dist/hooks/useClipboard.d.ts.map +0 -1
- package/packages/core/dist/hooks/useClipboard.js +0 -14
- package/packages/core/dist/hooks/useClipboard.js.map +0 -1
- package/packages/core/dist/hooks/useFocus.d.ts +0 -10
- package/packages/core/dist/hooks/useFocus.d.ts.map +0 -1
- package/packages/core/dist/hooks/useFocus.js +0 -6
- package/packages/core/dist/hooks/useFocus.js.map +0 -1
- package/packages/core/dist/hooks/useFocusManager.d.ts +0 -9
- package/packages/core/dist/hooks/useFocusManager.d.ts.map +0 -1
- package/packages/core/dist/hooks/useFocusManager.js +0 -6
- package/packages/core/dist/hooks/useFocusManager.js.map +0 -1
- package/packages/core/dist/hooks/useInput.d.ts +0 -22
- package/packages/core/dist/hooks/useInput.d.ts.map +0 -1
- package/packages/core/dist/hooks/useInput.js +0 -6
- package/packages/core/dist/hooks/useInput.js.map +0 -1
- package/packages/core/dist/hooks/useInterval.d.ts +0 -6
- package/packages/core/dist/hooks/useInterval.d.ts.map +0 -1
- package/packages/core/dist/hooks/useInterval.js +0 -18
- package/packages/core/dist/hooks/useInterval.js.map +0 -1
- package/packages/core/dist/hooks/useKeymap.d.ts +0 -13
- package/packages/core/dist/hooks/useKeymap.d.ts.map +0 -1
- package/packages/core/dist/hooks/useKeymap.js +0 -36
- package/packages/core/dist/hooks/useKeymap.js.map +0 -1
- package/packages/core/dist/hooks/useMouse.d.ts +0 -19
- package/packages/core/dist/hooks/useMouse.d.ts.map +0 -1
- package/packages/core/dist/hooks/useMouse.js +0 -60
- package/packages/core/dist/hooks/useMouse.js.map +0 -1
- package/packages/core/dist/hooks/useResize.d.ts +0 -7
- package/packages/core/dist/hooks/useResize.d.ts.map +0 -1
- package/packages/core/dist/hooks/useResize.js +0 -27
- package/packages/core/dist/hooks/useResize.js.map +0 -1
- package/packages/core/dist/hooks/useTerminal.d.ts +0 -4
- package/packages/core/dist/hooks/useTerminal.d.ts.map +0 -1
- package/packages/core/dist/hooks/useTerminal.js +0 -17
- package/packages/core/dist/hooks/useTerminal.js.map +0 -1
- package/packages/core/dist/hooks/useTheme.d.ts +0 -2
- package/packages/core/dist/hooks/useTheme.d.ts.map +0 -1
- package/packages/core/dist/hooks/useTheme.js +0 -3
- package/packages/core/dist/hooks/useTheme.js.map +0 -1
- package/packages/core/dist/index.d.ts +0 -4
- package/packages/core/dist/index.d.ts.map +0 -1
- package/packages/core/dist/index.js +0 -7
- package/packages/core/dist/index.js.map +0 -1
- package/packages/core/dist/styling/ThemeProvider.d.ts +0 -15
- package/packages/core/dist/styling/ThemeProvider.d.ts.map +0 -1
- package/packages/core/dist/styling/ThemeProvider.js +0 -44
- package/packages/core/dist/styling/ThemeProvider.js.map +0 -1
- package/packages/core/dist/styling/index.d.ts +0 -7
- package/packages/core/dist/styling/index.d.ts.map +0 -1
- package/packages/core/dist/styling/index.js +0 -7
- package/packages/core/dist/styling/index.js.map +0 -1
- package/packages/core/dist/styling/style.d.ts +0 -25
- package/packages/core/dist/styling/style.d.ts.map +0 -1
- package/packages/core/dist/styling/style.js +0 -57
- package/packages/core/dist/styling/style.js.map +0 -1
- package/packages/core/dist/styling/themes/default.d.ts +0 -3
- package/packages/core/dist/styling/themes/default.d.ts.map +0 -1
- package/packages/core/dist/styling/themes/default.js +0 -49
- package/packages/core/dist/styling/themes/default.js.map +0 -1
- package/packages/core/dist/styling/themes/dracula.d.ts +0 -3
- package/packages/core/dist/styling/themes/dracula.d.ts.map +0 -1
- package/packages/core/dist/styling/themes/dracula.js +0 -49
- package/packages/core/dist/styling/themes/dracula.js.map +0 -1
- package/packages/core/dist/styling/themes/nord.d.ts +0 -3
- package/packages/core/dist/styling/themes/nord.d.ts.map +0 -1
- package/packages/core/dist/styling/themes/nord.js +0 -49
- package/packages/core/dist/styling/themes/nord.js.map +0 -1
- package/packages/core/dist/styling/tokens.d.ts +0 -57
- package/packages/core/dist/styling/tokens.d.ts.map +0 -1
- package/packages/core/dist/styling/tokens.js +0 -6
- package/packages/core/dist/styling/tokens.js.map +0 -1
- package/packages/core/dist/terminal/ansi.d.ts +0 -107
- package/packages/core/dist/terminal/ansi.d.ts.map +0 -1
- package/packages/core/dist/terminal/ansi.js +0 -153
- package/packages/core/dist/terminal/ansi.js.map +0 -1
- package/packages/core/dist/terminal/capabilities.d.ts +0 -21
- package/packages/core/dist/terminal/capabilities.d.ts.map +0 -1
- package/packages/core/dist/terminal/capabilities.js +0 -74
- package/packages/core/dist/terminal/capabilities.js.map +0 -1
- package/packages/core/dist/terminal/index.d.ts +0 -3
- package/packages/core/dist/terminal/index.d.ts.map +0 -1
- package/packages/core/dist/terminal/index.js +0 -3
- package/packages/core/dist/terminal/index.js.map +0 -1
- package/packages/core/package.json +0 -49
- package/registry/components/alert/meta.json +0 -9
- package/registry/components/badge/meta.json +0 -9
- package/registry/components/box/meta.json +0 -9
- package/registry/components/checkbox/meta.json +0 -9
- package/registry/components/form/meta.json +0 -9
- package/registry/components/grid/meta.json +0 -9
- package/registry/components/list/meta.json +0 -9
- package/registry/components/modal/meta.json +0 -9
- package/registry/components/panel/meta.json +0 -9
- package/registry/components/progress-bar/meta.json +0 -9
- package/registry/components/scroll-view/meta.json +0 -9
- package/registry/components/select/meta.json +0 -9
- package/registry/components/spinner/meta.json +0 -9
- package/registry/components/stack/meta.json +0 -9
- package/registry/components/table/meta.json +0 -9
- package/registry/components/tabs/meta.json +0 -9
- package/registry/components/text/meta.json +0 -9
- package/registry/components/text-input/meta.json +0 -9
- package/registry/components/toggle/meta.json +0 -9
- package/registry/schema.json +0 -178
|
@@ -0,0 +1,694 @@
|
|
|
1
|
+
// packages/core/src/terminal/ansi.js
|
|
2
|
+
var ESC = "\x1B";
|
|
3
|
+
var reset = `${ESC}[0m`;
|
|
4
|
+
var bold = `${ESC}[1m`;
|
|
5
|
+
var dim = `${ESC}[2m`;
|
|
6
|
+
var italic = `${ESC}[3m`;
|
|
7
|
+
var underline = `${ESC}[4m`;
|
|
8
|
+
var blink = `${ESC}[5m`;
|
|
9
|
+
var inverse = `${ESC}[7m`;
|
|
10
|
+
var hidden = `${ESC}[8m`;
|
|
11
|
+
var strikethrough = `${ESC}[9m`;
|
|
12
|
+
var fg = {
|
|
13
|
+
black: `${ESC}[30m`,
|
|
14
|
+
red: `${ESC}[31m`,
|
|
15
|
+
green: `${ESC}[32m`,
|
|
16
|
+
yellow: `${ESC}[33m`,
|
|
17
|
+
blue: `${ESC}[34m`,
|
|
18
|
+
magenta: `${ESC}[35m`,
|
|
19
|
+
cyan: `${ESC}[36m`,
|
|
20
|
+
white: `${ESC}[37m`,
|
|
21
|
+
default: `${ESC}[39m`,
|
|
22
|
+
// Bright variants (90–97)
|
|
23
|
+
brightBlack: `${ESC}[90m`,
|
|
24
|
+
brightRed: `${ESC}[91m`,
|
|
25
|
+
brightGreen: `${ESC}[92m`,
|
|
26
|
+
brightYellow: `${ESC}[93m`,
|
|
27
|
+
brightBlue: `${ESC}[94m`,
|
|
28
|
+
brightMagenta: `${ESC}[95m`,
|
|
29
|
+
brightCyan: `${ESC}[96m`,
|
|
30
|
+
brightWhite: `${ESC}[97m`
|
|
31
|
+
};
|
|
32
|
+
var bg = {
|
|
33
|
+
black: `${ESC}[40m`,
|
|
34
|
+
red: `${ESC}[41m`,
|
|
35
|
+
green: `${ESC}[42m`,
|
|
36
|
+
yellow: `${ESC}[43m`,
|
|
37
|
+
blue: `${ESC}[44m`,
|
|
38
|
+
magenta: `${ESC}[45m`,
|
|
39
|
+
cyan: `${ESC}[46m`,
|
|
40
|
+
white: `${ESC}[47m`,
|
|
41
|
+
default: `${ESC}[49m`,
|
|
42
|
+
// Bright backgrounds
|
|
43
|
+
brightBlack: `${ESC}[100m`,
|
|
44
|
+
brightRed: `${ESC}[101m`,
|
|
45
|
+
brightGreen: `${ESC}[102m`,
|
|
46
|
+
brightYellow: `${ESC}[103m`,
|
|
47
|
+
brightBlue: `${ESC}[104m`,
|
|
48
|
+
brightMagenta: `${ESC}[105m`,
|
|
49
|
+
brightCyan: `${ESC}[106m`,
|
|
50
|
+
brightWhite: `${ESC}[107m`
|
|
51
|
+
};
|
|
52
|
+
function fg256(n) {
|
|
53
|
+
return `${ESC}[38;5;${n}m`;
|
|
54
|
+
}
|
|
55
|
+
function bg256(n) {
|
|
56
|
+
return `${ESC}[48;5;${n}m`;
|
|
57
|
+
}
|
|
58
|
+
function fgRgb(r, g, b) {
|
|
59
|
+
return `${ESC}[38;2;${r};${g};${b}m`;
|
|
60
|
+
}
|
|
61
|
+
function bgRgb(r, g, b) {
|
|
62
|
+
return `${ESC}[48;2;${r};${g};${b}m`;
|
|
63
|
+
}
|
|
64
|
+
function parseHex(hex) {
|
|
65
|
+
const clean = hex.replace("#", "");
|
|
66
|
+
if (clean.length === 3) {
|
|
67
|
+
const r2 = parseInt(clean[0] + clean[0], 16);
|
|
68
|
+
const g2 = parseInt(clean[1] + clean[1], 16);
|
|
69
|
+
const b2 = parseInt(clean[2] + clean[2], 16);
|
|
70
|
+
return { r: r2, g: g2, b: b2 };
|
|
71
|
+
}
|
|
72
|
+
const r = parseInt(clean.slice(0, 2), 16);
|
|
73
|
+
const g = parseInt(clean.slice(2, 4), 16);
|
|
74
|
+
const b = parseInt(clean.slice(4, 6), 16);
|
|
75
|
+
return { r, g, b };
|
|
76
|
+
}
|
|
77
|
+
function fgHex(hex) {
|
|
78
|
+
const { r, g, b } = parseHex(hex);
|
|
79
|
+
return fgRgb(r, g, b);
|
|
80
|
+
}
|
|
81
|
+
function bgHex(hex) {
|
|
82
|
+
const { r, g, b } = parseHex(hex);
|
|
83
|
+
return bgRgb(r, g, b);
|
|
84
|
+
}
|
|
85
|
+
var cursor = {
|
|
86
|
+
up: (n = 1) => `${ESC}[${n}A`,
|
|
87
|
+
down: (n = 1) => `${ESC}[${n}B`,
|
|
88
|
+
forward: (n = 1) => `${ESC}[${n}C`,
|
|
89
|
+
back: (n = 1) => `${ESC}[${n}D`,
|
|
90
|
+
nextLine: (n = 1) => `${ESC}[${n}E`,
|
|
91
|
+
prevLine: (n = 1) => `${ESC}[${n}F`,
|
|
92
|
+
column: (n = 1) => `${ESC}[${n}G`,
|
|
93
|
+
position: (row, col) => `${ESC}[${row};${col}H`,
|
|
94
|
+
hide: `${ESC}[?25l`,
|
|
95
|
+
show: `${ESC}[?25h`,
|
|
96
|
+
save: `${ESC}[s`,
|
|
97
|
+
restore: `${ESC}[u`
|
|
98
|
+
};
|
|
99
|
+
var screen = {
|
|
100
|
+
clear: `${ESC}[2J`,
|
|
101
|
+
clearToEnd: `${ESC}[0J`,
|
|
102
|
+
clearToStart: `${ESC}[1J`,
|
|
103
|
+
clearLine: `${ESC}[2K`,
|
|
104
|
+
clearLineToEnd: `${ESC}[0K`,
|
|
105
|
+
clearLineToStart: `${ESC}[1K`,
|
|
106
|
+
alternateBuffer: `${ESC}[?1049h`,
|
|
107
|
+
mainBuffer: `${ESC}[?1049l`
|
|
108
|
+
};
|
|
109
|
+
var osc = {
|
|
110
|
+
/** OSC 8 — hyperlink: \x1b]8;;url\x1b\\ text \x1b]8;;\x1b\\ */
|
|
111
|
+
hyperlink: (url, text) => `${ESC}]8;;${url}${ESC}\\${text}${ESC}]8;;${ESC}\\`,
|
|
112
|
+
/** OSC 52 — clipboard write (base64-encoded) */
|
|
113
|
+
clipboardWrite: (data) => {
|
|
114
|
+
const encoded = Buffer.from(data).toString("base64");
|
|
115
|
+
return `${ESC}]52;c;${encoded}\x07`;
|
|
116
|
+
},
|
|
117
|
+
/** OSC 0 — set window title */
|
|
118
|
+
setTitle: (title) => `${ESC}]0;${title}\x07`
|
|
119
|
+
};
|
|
120
|
+
function style(code, text) {
|
|
121
|
+
return `${code}${text}${reset}`;
|
|
122
|
+
}
|
|
123
|
+
var ANSI_REGEX = /\x1b\[[0-9;]*[mGKHFABCDJn]|\x1b\][^\\]*\x1b\\|\x1b[()][AB012]/g;
|
|
124
|
+
function stripAnsi(str) {
|
|
125
|
+
return str.replace(ANSI_REGEX, "");
|
|
126
|
+
}
|
|
127
|
+
function visibleWidth(str) {
|
|
128
|
+
return stripAnsi(str).length;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// packages/core/src/terminal/capabilities.js
|
|
132
|
+
function detectCapabilities() {
|
|
133
|
+
const isTTY = Boolean(process.stdout.isTTY);
|
|
134
|
+
const columns = process.stdout.columns ?? 80;
|
|
135
|
+
const rows = process.stdout.rows ?? 24;
|
|
136
|
+
const noColor = "NO_COLOR" in process.env;
|
|
137
|
+
const forceColor = process.env["FORCE_COLOR"];
|
|
138
|
+
let colorDepth = 1;
|
|
139
|
+
if (!noColor) {
|
|
140
|
+
if (forceColor === "3" || forceColor === "true" || forceColor === "1") {
|
|
141
|
+
colorDepth = 24;
|
|
142
|
+
} else if (forceColor === "2") {
|
|
143
|
+
colorDepth = 8;
|
|
144
|
+
} else if (isTTY) {
|
|
145
|
+
const colorterm = (process.env["COLORTERM"] ?? "").toLowerCase();
|
|
146
|
+
if (colorterm === "truecolor" || colorterm === "24bit") {
|
|
147
|
+
colorDepth = 24;
|
|
148
|
+
} else if ((process.env["TERM_PROGRAM"] ?? "").toLowerCase().includes("iterm") || (process.env["TERM_PROGRAM"] ?? "").toLowerCase() === "hyper") {
|
|
149
|
+
colorDepth = 24;
|
|
150
|
+
} else if ((process.env["TERM"] ?? "").includes("256color")) {
|
|
151
|
+
colorDepth = 8;
|
|
152
|
+
} else if (process.env["TERM"] === "xterm" || isTTY) {
|
|
153
|
+
colorDepth = 4;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
const supportsTrueColor = colorDepth === 24;
|
|
158
|
+
const supports256Color = colorDepth >= 8;
|
|
159
|
+
const lang = process.env["LANG"] ?? process.env["LC_ALL"] ?? "";
|
|
160
|
+
const supportsUnicode = lang.toLowerCase().includes("utf-8") || lang.toLowerCase().includes("utf8") || process.platform === "darwin" || (process.env["TERM_PROGRAM"] ?? "") !== "";
|
|
161
|
+
const supportsMouse = isTTY;
|
|
162
|
+
return {
|
|
163
|
+
colorDepth,
|
|
164
|
+
supportsUnicode,
|
|
165
|
+
supportsTrueColor,
|
|
166
|
+
supports256Color,
|
|
167
|
+
supportsMouse,
|
|
168
|
+
columns,
|
|
169
|
+
rows,
|
|
170
|
+
isTTY
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
var _capabilities = null;
|
|
174
|
+
function getCapabilities() {
|
|
175
|
+
if (!_capabilities) {
|
|
176
|
+
_capabilities = detectCapabilities();
|
|
177
|
+
}
|
|
178
|
+
return _capabilities;
|
|
179
|
+
}
|
|
180
|
+
function refreshCapabilities() {
|
|
181
|
+
_capabilities = detectCapabilities();
|
|
182
|
+
return _capabilities;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// packages/core/src/styling/themes/default.js
|
|
186
|
+
var defaultTheme = {
|
|
187
|
+
name: "default",
|
|
188
|
+
colors: {
|
|
189
|
+
primary: "#7C3AED",
|
|
190
|
+
primaryForeground: "#FFFFFF",
|
|
191
|
+
secondary: "#6B7280",
|
|
192
|
+
secondaryForeground: "#FFFFFF",
|
|
193
|
+
accent: "#8B5CF6",
|
|
194
|
+
accentForeground: "#FFFFFF",
|
|
195
|
+
success: "#10B981",
|
|
196
|
+
successForeground: "#FFFFFF",
|
|
197
|
+
warning: "#F59E0B",
|
|
198
|
+
warningForeground: "#000000",
|
|
199
|
+
error: "#EF4444",
|
|
200
|
+
errorForeground: "#FFFFFF",
|
|
201
|
+
info: "#3B82F6",
|
|
202
|
+
infoForeground: "#FFFFFF",
|
|
203
|
+
background: "#000000",
|
|
204
|
+
foreground: "#FFFFFF",
|
|
205
|
+
muted: "#374151",
|
|
206
|
+
mutedForeground: "#9CA3AF",
|
|
207
|
+
border: "#4B5563",
|
|
208
|
+
focusRing: "#8B5CF6",
|
|
209
|
+
selection: "#7C3AED",
|
|
210
|
+
selectionForeground: "#FFFFFF"
|
|
211
|
+
},
|
|
212
|
+
spacing: {
|
|
213
|
+
0: 0,
|
|
214
|
+
1: 1,
|
|
215
|
+
2: 2,
|
|
216
|
+
3: 3,
|
|
217
|
+
4: 4,
|
|
218
|
+
6: 6,
|
|
219
|
+
8: 8
|
|
220
|
+
},
|
|
221
|
+
typography: {
|
|
222
|
+
bold: true,
|
|
223
|
+
sm: "dim",
|
|
224
|
+
base: "",
|
|
225
|
+
lg: "bold",
|
|
226
|
+
xl: "bold"
|
|
227
|
+
},
|
|
228
|
+
border: {
|
|
229
|
+
style: "round",
|
|
230
|
+
color: "#4B5563",
|
|
231
|
+
focusColor: "#8B5CF6"
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
// packages/core/src/styling/ThemeProvider.js
|
|
236
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
237
|
+
import React, { createContext, useContext } from "react";
|
|
238
|
+
var ThemeContext = createContext({
|
|
239
|
+
theme: defaultTheme,
|
|
240
|
+
setTheme: () => {
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
function ThemeProvider({ theme = defaultTheme, children }) {
|
|
244
|
+
const [currentTheme, setCurrentTheme] = React.useState(theme);
|
|
245
|
+
React.useEffect(() => {
|
|
246
|
+
setCurrentTheme(theme);
|
|
247
|
+
}, [theme]);
|
|
248
|
+
return _jsx(ThemeContext.Provider, { value: { theme: currentTheme, setTheme: setCurrentTheme }, children });
|
|
249
|
+
}
|
|
250
|
+
function useTheme() {
|
|
251
|
+
return useContext(ThemeContext).theme;
|
|
252
|
+
}
|
|
253
|
+
function useThemeUpdater() {
|
|
254
|
+
return useContext(ThemeContext).setTheme;
|
|
255
|
+
}
|
|
256
|
+
function createTheme(overrides) {
|
|
257
|
+
return {
|
|
258
|
+
...defaultTheme,
|
|
259
|
+
...overrides,
|
|
260
|
+
colors: {
|
|
261
|
+
...defaultTheme.colors,
|
|
262
|
+
...overrides.colors ?? {}
|
|
263
|
+
},
|
|
264
|
+
spacing: {
|
|
265
|
+
...defaultTheme.spacing,
|
|
266
|
+
...overrides.spacing ?? {}
|
|
267
|
+
},
|
|
268
|
+
typography: {
|
|
269
|
+
...defaultTheme.typography,
|
|
270
|
+
...overrides.typography ?? {}
|
|
271
|
+
},
|
|
272
|
+
border: {
|
|
273
|
+
...defaultTheme.border,
|
|
274
|
+
...overrides.border ?? {}
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// packages/core/src/styling/style.js
|
|
280
|
+
var StyleBuilder = class {
|
|
281
|
+
_text;
|
|
282
|
+
_codes = [];
|
|
283
|
+
constructor(text) {
|
|
284
|
+
this._text = text;
|
|
285
|
+
}
|
|
286
|
+
bold() {
|
|
287
|
+
this._codes.push(bold);
|
|
288
|
+
return this;
|
|
289
|
+
}
|
|
290
|
+
dim() {
|
|
291
|
+
this._codes.push(dim);
|
|
292
|
+
return this;
|
|
293
|
+
}
|
|
294
|
+
italic() {
|
|
295
|
+
this._codes.push(italic);
|
|
296
|
+
return this;
|
|
297
|
+
}
|
|
298
|
+
underline() {
|
|
299
|
+
this._codes.push(underline);
|
|
300
|
+
return this;
|
|
301
|
+
}
|
|
302
|
+
strikethrough() {
|
|
303
|
+
this._codes.push(strikethrough);
|
|
304
|
+
return this;
|
|
305
|
+
}
|
|
306
|
+
fg(color) {
|
|
307
|
+
this._codes.push(fgHex(color));
|
|
308
|
+
return this;
|
|
309
|
+
}
|
|
310
|
+
bg(color) {
|
|
311
|
+
this._codes.push(bgHex(color));
|
|
312
|
+
return this;
|
|
313
|
+
}
|
|
314
|
+
/** Build the final ANSI-styled string */
|
|
315
|
+
build() {
|
|
316
|
+
if (this._codes.length === 0)
|
|
317
|
+
return this._text;
|
|
318
|
+
return `${this._codes.join("")}${this._text}${reset}`;
|
|
319
|
+
}
|
|
320
|
+
toString() {
|
|
321
|
+
return this.build();
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
function style2(text) {
|
|
325
|
+
return new StyleBuilder(text);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// packages/core/src/styling/themes/dracula.js
|
|
329
|
+
var draculaTheme = {
|
|
330
|
+
name: "dracula",
|
|
331
|
+
colors: {
|
|
332
|
+
primary: "#BD93F9",
|
|
333
|
+
primaryForeground: "#282A36",
|
|
334
|
+
secondary: "#6272A4",
|
|
335
|
+
secondaryForeground: "#F8F8F2",
|
|
336
|
+
accent: "#FF79C6",
|
|
337
|
+
accentForeground: "#282A36",
|
|
338
|
+
success: "#50FA7B",
|
|
339
|
+
successForeground: "#282A36",
|
|
340
|
+
warning: "#F1FA8C",
|
|
341
|
+
warningForeground: "#282A36",
|
|
342
|
+
error: "#FF5555",
|
|
343
|
+
errorForeground: "#F8F8F2",
|
|
344
|
+
info: "#8BE9FD",
|
|
345
|
+
infoForeground: "#282A36",
|
|
346
|
+
background: "#282A36",
|
|
347
|
+
foreground: "#F8F8F2",
|
|
348
|
+
muted: "#44475A",
|
|
349
|
+
mutedForeground: "#6272A4",
|
|
350
|
+
border: "#6272A4",
|
|
351
|
+
focusRing: "#BD93F9",
|
|
352
|
+
selection: "#44475A",
|
|
353
|
+
selectionForeground: "#F8F8F2"
|
|
354
|
+
},
|
|
355
|
+
spacing: {
|
|
356
|
+
0: 0,
|
|
357
|
+
1: 1,
|
|
358
|
+
2: 2,
|
|
359
|
+
3: 3,
|
|
360
|
+
4: 4,
|
|
361
|
+
6: 6,
|
|
362
|
+
8: 8
|
|
363
|
+
},
|
|
364
|
+
typography: {
|
|
365
|
+
bold: true,
|
|
366
|
+
sm: "dim",
|
|
367
|
+
base: "",
|
|
368
|
+
lg: "bold",
|
|
369
|
+
xl: "bold"
|
|
370
|
+
},
|
|
371
|
+
border: {
|
|
372
|
+
style: "round",
|
|
373
|
+
color: "#6272A4",
|
|
374
|
+
focusColor: "#BD93F9"
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
// packages/core/src/styling/themes/nord.js
|
|
379
|
+
var nordTheme = {
|
|
380
|
+
name: "nord",
|
|
381
|
+
colors: {
|
|
382
|
+
primary: "#88C0D0",
|
|
383
|
+
primaryForeground: "#2E3440",
|
|
384
|
+
secondary: "#4C566A",
|
|
385
|
+
secondaryForeground: "#ECEFF4",
|
|
386
|
+
accent: "#81A1C1",
|
|
387
|
+
accentForeground: "#2E3440",
|
|
388
|
+
success: "#A3BE8C",
|
|
389
|
+
successForeground: "#2E3440",
|
|
390
|
+
warning: "#EBCB8B",
|
|
391
|
+
warningForeground: "#2E3440",
|
|
392
|
+
error: "#BF616A",
|
|
393
|
+
errorForeground: "#ECEFF4",
|
|
394
|
+
info: "#5E81AC",
|
|
395
|
+
infoForeground: "#ECEFF4",
|
|
396
|
+
background: "#2E3440",
|
|
397
|
+
foreground: "#ECEFF4",
|
|
398
|
+
muted: "#3B4252",
|
|
399
|
+
mutedForeground: "#4C566A",
|
|
400
|
+
border: "#4C566A",
|
|
401
|
+
focusRing: "#88C0D0",
|
|
402
|
+
selection: "#3B4252",
|
|
403
|
+
selectionForeground: "#ECEFF4"
|
|
404
|
+
},
|
|
405
|
+
spacing: {
|
|
406
|
+
0: 0,
|
|
407
|
+
1: 1,
|
|
408
|
+
2: 2,
|
|
409
|
+
3: 3,
|
|
410
|
+
4: 4,
|
|
411
|
+
6: 6,
|
|
412
|
+
8: 8
|
|
413
|
+
},
|
|
414
|
+
typography: {
|
|
415
|
+
bold: true,
|
|
416
|
+
sm: "dim",
|
|
417
|
+
base: "",
|
|
418
|
+
lg: "bold",
|
|
419
|
+
xl: "bold"
|
|
420
|
+
},
|
|
421
|
+
border: {
|
|
422
|
+
style: "round",
|
|
423
|
+
color: "#4C566A",
|
|
424
|
+
focusColor: "#88C0D0"
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
// packages/core/src/hooks/useInput.js
|
|
429
|
+
import { useInput as inkUseInput } from "ink";
|
|
430
|
+
function useInput(handler, options) {
|
|
431
|
+
inkUseInput(handler, options);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
// packages/core/src/hooks/useFocus.js
|
|
435
|
+
import { useFocus as inkUseFocus } from "ink";
|
|
436
|
+
function useFocus(options) {
|
|
437
|
+
return inkUseFocus(options);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
// packages/core/src/hooks/useFocusManager.js
|
|
441
|
+
import { useFocusManager as inkUseFocusManager } from "ink";
|
|
442
|
+
function useFocusManager() {
|
|
443
|
+
return inkUseFocusManager();
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// packages/core/src/hooks/useTerminal.js
|
|
447
|
+
import { useState, useEffect } from "react";
|
|
448
|
+
function useTerminal() {
|
|
449
|
+
const [caps, setCaps] = useState(getCapabilities);
|
|
450
|
+
useEffect(() => {
|
|
451
|
+
const handler = () => {
|
|
452
|
+
setCaps(refreshCapabilities());
|
|
453
|
+
};
|
|
454
|
+
process.stdout.on("resize", handler);
|
|
455
|
+
return () => {
|
|
456
|
+
process.stdout.off("resize", handler);
|
|
457
|
+
};
|
|
458
|
+
}, []);
|
|
459
|
+
return caps;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
// packages/core/src/hooks/useAnimation.js
|
|
463
|
+
import { useState as useState2, useEffect as useEffect2, useRef } from "react";
|
|
464
|
+
function useAnimation(fps = 12) {
|
|
465
|
+
const [frame, setFrame] = useState2(0);
|
|
466
|
+
const intervalRef = useRef(null);
|
|
467
|
+
useEffect2(() => {
|
|
468
|
+
const ms = Math.round(1e3 / fps);
|
|
469
|
+
intervalRef.current = setInterval(() => {
|
|
470
|
+
setFrame((f) => f + 1);
|
|
471
|
+
}, ms);
|
|
472
|
+
return () => {
|
|
473
|
+
if (intervalRef.current)
|
|
474
|
+
clearInterval(intervalRef.current);
|
|
475
|
+
};
|
|
476
|
+
}, [fps]);
|
|
477
|
+
return frame;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
// packages/core/src/hooks/useInterval.js
|
|
481
|
+
import { useEffect as useEffect3, useRef as useRef2 } from "react";
|
|
482
|
+
function useInterval(callback, delay) {
|
|
483
|
+
const savedCallback = useRef2(callback);
|
|
484
|
+
useEffect3(() => {
|
|
485
|
+
savedCallback.current = callback;
|
|
486
|
+
}, [callback]);
|
|
487
|
+
useEffect3(() => {
|
|
488
|
+
if (delay === null)
|
|
489
|
+
return;
|
|
490
|
+
const id = setInterval(() => savedCallback.current(), delay);
|
|
491
|
+
return () => clearInterval(id);
|
|
492
|
+
}, [delay]);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
// packages/core/src/hooks/useClipboard.js
|
|
496
|
+
import { useCallback } from "react";
|
|
497
|
+
function useClipboard() {
|
|
498
|
+
const write = useCallback((text) => {
|
|
499
|
+
process.stdout.write(osc.clipboardWrite(text));
|
|
500
|
+
}, []);
|
|
501
|
+
return { write };
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
// packages/core/src/hooks/useKeymap.js
|
|
505
|
+
import { useEffect as useEffect4, useRef as useRef3 } from "react";
|
|
506
|
+
function useKeymap(bindings, isActive = true) {
|
|
507
|
+
const bindingsRef = useRef3(bindings);
|
|
508
|
+
useEffect4(() => {
|
|
509
|
+
bindingsRef.current = bindings;
|
|
510
|
+
}, [bindings]);
|
|
511
|
+
useEffect4(() => {
|
|
512
|
+
const seen = /* @__PURE__ */ new Set();
|
|
513
|
+
for (const b of bindings) {
|
|
514
|
+
const id = `${b.key ?? ""}:${b.ctrl ? "ctrl" : ""}:${b.shift ? "shift" : ""}:${b.meta ? "meta" : ""}`;
|
|
515
|
+
if (seen.has(id)) {
|
|
516
|
+
console.warn(`[useKeymap] Conflicting keybinding: ${id}`);
|
|
517
|
+
}
|
|
518
|
+
seen.add(id);
|
|
519
|
+
}
|
|
520
|
+
}, []);
|
|
521
|
+
useInput((input, key) => {
|
|
522
|
+
for (const binding of bindingsRef.current) {
|
|
523
|
+
const keyMatch = !binding.key || input === binding.key;
|
|
524
|
+
const ctrlMatch = binding.ctrl === void 0 || binding.ctrl === key.ctrl;
|
|
525
|
+
const shiftMatch = binding.shift === void 0 || binding.shift === key.shift;
|
|
526
|
+
const metaMatch = binding.meta === void 0 || binding.meta === key.meta;
|
|
527
|
+
if (keyMatch && ctrlMatch && shiftMatch && metaMatch) {
|
|
528
|
+
binding.action();
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
}, { isActive });
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
// packages/core/src/hooks/useMouse.js
|
|
535
|
+
import { useEffect as useEffect5 } from "react";
|
|
536
|
+
function useMouse(handler) {
|
|
537
|
+
const handlerRef = { current: handler };
|
|
538
|
+
useEffect5(() => {
|
|
539
|
+
handlerRef.current = handler;
|
|
540
|
+
});
|
|
541
|
+
useEffect5(() => {
|
|
542
|
+
if (!process.stdout.isTTY)
|
|
543
|
+
return;
|
|
544
|
+
process.stdout.write("\x1B[?1000h");
|
|
545
|
+
process.stdout.write("\x1B[?1002h");
|
|
546
|
+
process.stdout.write("\x1B[?1006h");
|
|
547
|
+
const rawHandler = (data) => {
|
|
548
|
+
const str = data.toString();
|
|
549
|
+
const match = str.match(/\x1b\[<(\d+);(\d+);(\d+)([Mm])/);
|
|
550
|
+
if (!match)
|
|
551
|
+
return;
|
|
552
|
+
const cb = parseInt(match[1], 10);
|
|
553
|
+
const x = parseInt(match[2], 10);
|
|
554
|
+
const y = parseInt(match[3], 10);
|
|
555
|
+
const released = match[4] === "m";
|
|
556
|
+
const ctrl = Boolean(cb & 16);
|
|
557
|
+
const meta = Boolean(cb & 8);
|
|
558
|
+
const shift = Boolean(cb & 4);
|
|
559
|
+
const buttonCode = cb & 3;
|
|
560
|
+
let button;
|
|
561
|
+
if (cb & 64) {
|
|
562
|
+
button = buttonCode === 0 ? "scrollUp" : "scrollDown";
|
|
563
|
+
} else {
|
|
564
|
+
button = ["left", "middle", "right"][buttonCode] ?? "left";
|
|
565
|
+
}
|
|
566
|
+
handlerRef.current({
|
|
567
|
+
type: released ? "release" : "press",
|
|
568
|
+
button,
|
|
569
|
+
x,
|
|
570
|
+
y,
|
|
571
|
+
ctrl,
|
|
572
|
+
shift,
|
|
573
|
+
meta
|
|
574
|
+
});
|
|
575
|
+
};
|
|
576
|
+
process.stdin.on("data", rawHandler);
|
|
577
|
+
return () => {
|
|
578
|
+
process.stdout.write("\x1B[?1000l");
|
|
579
|
+
process.stdout.write("\x1B[?1002l");
|
|
580
|
+
process.stdout.write("\x1B[?1006l");
|
|
581
|
+
process.stdin.off("data", rawHandler);
|
|
582
|
+
};
|
|
583
|
+
}, []);
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
// packages/core/src/hooks/useResize.js
|
|
587
|
+
import { useState as useState3, useEffect as useEffect6 } from "react";
|
|
588
|
+
function useResize(debounceMs = 50) {
|
|
589
|
+
const [size, setSize] = useState3({
|
|
590
|
+
columns: process.stdout.columns ?? 80,
|
|
591
|
+
rows: process.stdout.rows ?? 24
|
|
592
|
+
});
|
|
593
|
+
useEffect6(() => {
|
|
594
|
+
let timer;
|
|
595
|
+
const handler = () => {
|
|
596
|
+
clearTimeout(timer);
|
|
597
|
+
timer = setTimeout(() => {
|
|
598
|
+
setSize({
|
|
599
|
+
columns: process.stdout.columns ?? 80,
|
|
600
|
+
rows: process.stdout.rows ?? 24
|
|
601
|
+
});
|
|
602
|
+
}, debounceMs);
|
|
603
|
+
};
|
|
604
|
+
process.stdout.on("resize", handler);
|
|
605
|
+
return () => {
|
|
606
|
+
clearTimeout(timer);
|
|
607
|
+
process.stdout.off("resize", handler);
|
|
608
|
+
};
|
|
609
|
+
}, [debounceMs]);
|
|
610
|
+
return size;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
// packages/core/src/hooks/useAsync.js
|
|
614
|
+
import { useState as useState4, useEffect as useEffect7, useCallback as useCallback2, useRef as useRef4 } from "react";
|
|
615
|
+
function useAsync(asyncFn, deps = []) {
|
|
616
|
+
const [state, setState] = useState4({
|
|
617
|
+
status: "idle",
|
|
618
|
+
data: null,
|
|
619
|
+
error: null
|
|
620
|
+
});
|
|
621
|
+
const mountedRef = useRef4(true);
|
|
622
|
+
const execute = useCallback2(async () => {
|
|
623
|
+
setState({ status: "loading", data: null, error: null });
|
|
624
|
+
try {
|
|
625
|
+
const data = await asyncFn();
|
|
626
|
+
if (mountedRef.current) {
|
|
627
|
+
setState({ status: "success", data, error: null });
|
|
628
|
+
}
|
|
629
|
+
} catch (e) {
|
|
630
|
+
if (mountedRef.current) {
|
|
631
|
+
setState({ status: "error", data: null, error: e instanceof Error ? e : new Error(String(e)) });
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}, deps);
|
|
635
|
+
useEffect7(() => {
|
|
636
|
+
mountedRef.current = true;
|
|
637
|
+
execute();
|
|
638
|
+
return () => {
|
|
639
|
+
mountedRef.current = false;
|
|
640
|
+
};
|
|
641
|
+
}, [execute]);
|
|
642
|
+
return { ...state, refetch: execute };
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
export {
|
|
646
|
+
reset,
|
|
647
|
+
bold,
|
|
648
|
+
dim,
|
|
649
|
+
italic,
|
|
650
|
+
underline,
|
|
651
|
+
blink,
|
|
652
|
+
inverse,
|
|
653
|
+
hidden,
|
|
654
|
+
strikethrough,
|
|
655
|
+
fg,
|
|
656
|
+
bg,
|
|
657
|
+
fg256,
|
|
658
|
+
bg256,
|
|
659
|
+
fgRgb,
|
|
660
|
+
bgRgb,
|
|
661
|
+
parseHex,
|
|
662
|
+
fgHex,
|
|
663
|
+
bgHex,
|
|
664
|
+
cursor,
|
|
665
|
+
screen,
|
|
666
|
+
osc,
|
|
667
|
+
style,
|
|
668
|
+
stripAnsi,
|
|
669
|
+
visibleWidth,
|
|
670
|
+
detectCapabilities,
|
|
671
|
+
getCapabilities,
|
|
672
|
+
refreshCapabilities,
|
|
673
|
+
defaultTheme,
|
|
674
|
+
ThemeProvider,
|
|
675
|
+
useTheme,
|
|
676
|
+
useThemeUpdater,
|
|
677
|
+
createTheme,
|
|
678
|
+
StyleBuilder,
|
|
679
|
+
style2,
|
|
680
|
+
draculaTheme,
|
|
681
|
+
nordTheme,
|
|
682
|
+
useInput,
|
|
683
|
+
useFocus,
|
|
684
|
+
useFocusManager,
|
|
685
|
+
useTerminal,
|
|
686
|
+
useAnimation,
|
|
687
|
+
useInterval,
|
|
688
|
+
useClipboard,
|
|
689
|
+
useKeymap,
|
|
690
|
+
useMouse,
|
|
691
|
+
useResize,
|
|
692
|
+
useAsync
|
|
693
|
+
};
|
|
694
|
+
//# sourceMappingURL=chunk-ZZKFZA2U.js.map
|