@yeshwanthyk/open-tui 0.1.4 → 0.1.6
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/app.js +17 -15
- package/dist/app.jsx.map +1 -0
- package/dist/components/badge.js +60 -24
- package/dist/components/{badge.js.map → badge.jsx.map} +1 -1
- package/dist/components/code-block.js +110 -17
- package/dist/components/code-block.jsx.map +1 -0
- package/dist/components/dialog.js +86 -10
- package/dist/components/dialog.jsx.map +1 -0
- package/dist/components/diff.js +79 -13
- package/dist/components/diff.jsx.map +1 -0
- package/dist/components/divider.js +44 -11
- package/dist/components/divider.jsx.map +1 -0
- package/dist/components/editor.js +174 -127
- package/dist/components/{editor.js.map → editor.jsx.map} +1 -1
- package/dist/components/image.js +292 -228
- package/dist/components/{image.js.map → image.jsx.map} +1 -1
- package/dist/components/loader.js +50 -6
- package/dist/components/loader.jsx.map +1 -0
- package/dist/components/markdown.js +35 -18
- package/dist/components/markdown.jsx.map +1 -0
- package/dist/components/panel.js +86 -42
- package/dist/components/{panel.js.map → panel.jsx.map} +1 -1
- package/dist/components/select-list.js +193 -103
- package/dist/components/select-list.jsx.map +1 -0
- package/dist/components/spacer.js +17 -12
- package/dist/components/spacer.jsx.map +1 -0
- package/dist/components/toast.js +115 -34
- package/dist/components/toast.jsx.map +1 -0
- package/dist/context/terminal.js +1 -2
- package/dist/context/terminal.jsx.map +1 -0
- package/dist/context/theme.js +779 -555
- package/dist/context/theme.jsx.map +1 -0
- package/package.json +4 -4
- package/dist/app.js.map +0 -1
- package/dist/components/code-block.js.map +0 -1
- package/dist/components/dialog.js.map +0 -1
- package/dist/components/diff.js.map +0 -1
- package/dist/components/divider.js.map +0 -1
- package/dist/components/loader.js.map +0 -1
- package/dist/components/markdown.js.map +0 -1
- package/dist/components/select-list.js.map +0 -1
- package/dist/components/spacer.js.map +0 -1
- package/dist/components/toast.js.map +0 -1
- package/dist/context/terminal.js.map +0 -1
- package/dist/context/theme.js.map +0 -1
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { spread as _$spread } from "@opentui/solid";
|
|
2
|
+
import { createElement as _$createElement } from "@opentui/solid";
|
|
3
|
+
/**
|
|
4
|
+
* Spacer component - flexible space that grows to fill available space
|
|
5
|
+
*/
|
|
2
6
|
/**
|
|
3
7
|
* Flexible spacer that expands to fill available space
|
|
4
8
|
*
|
|
@@ -12,14 +16,15 @@ import { jsx as _jsx } from "solid-js/h/jsx-runtime";
|
|
|
12
16
|
* ```
|
|
13
17
|
*/
|
|
14
18
|
export function Spacer(props) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
// Build props object without undefined values to satisfy exactOptionalPropertyTypes
|
|
20
|
+
const boxProps = {
|
|
21
|
+
flexGrow: props.grow ?? 1
|
|
22
|
+
};
|
|
23
|
+
if (props.minHeight !== undefined) boxProps.minHeight = props.minHeight;
|
|
24
|
+
if (props.minWidth !== undefined) boxProps.minWidth = props.minWidth;
|
|
25
|
+
return (() => {
|
|
26
|
+
var _el$ = _$createElement("box");
|
|
27
|
+
_$spread(_el$, boxProps, false);
|
|
28
|
+
return _el$;
|
|
29
|
+
})();
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spacer.jsx","sourceRoot":"","sources":["../../src/components/spacer.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAWH;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,MAAM,CAAC,KAAkB;IACxC,oFAAoF;IACpF,MAAM,QAAQ,GAAgE;QAC7E,QAAQ,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC;KACzB,CAAA;IACD,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS;QAAE,QAAQ,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAA;IACvE,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS;QAAE,QAAQ,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAA;IAEpE,OAAO,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,EAAG,CAAA;AAC7B,CAAC"}
|
package/dist/components/toast.js
CHANGED
|
@@ -1,42 +1,123 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { effect as _$effect } from "@opentui/solid";
|
|
2
|
+
import { insertNode as _$insertNode } from "@opentui/solid";
|
|
3
|
+
import { memo as _$memo } from "@opentui/solid";
|
|
4
|
+
import { insert as _$insert } from "@opentui/solid";
|
|
5
|
+
import { createComponent as _$createComponent } from "@opentui/solid";
|
|
6
|
+
import { setProp as _$setProp } from "@opentui/solid";
|
|
7
|
+
import { spread as _$spread } from "@opentui/solid";
|
|
8
|
+
import { mergeProps as _$mergeProps } from "@opentui/solid";
|
|
9
|
+
import { createElement as _$createElement } from "@opentui/solid";
|
|
2
10
|
import { For, Show, splitProps } from "solid-js";
|
|
3
11
|
import { useTheme } from "../context/theme.js";
|
|
4
12
|
import { Badge } from "./badge.js";
|
|
5
13
|
import { Panel } from "./panel.js";
|
|
6
14
|
export function ToastViewport(props) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
const [local, rest] = splitProps(props, ["toasts", "position", "maxToasts"]);
|
|
16
|
+
const position = () => local.position ?? "top-right";
|
|
17
|
+
const maxToasts = () => local.maxToasts ?? 3;
|
|
18
|
+
const anchorProps = () => {
|
|
19
|
+
switch (position()) {
|
|
20
|
+
case "top-left":
|
|
21
|
+
return {
|
|
22
|
+
top: 1,
|
|
23
|
+
left: 2
|
|
24
|
+
};
|
|
25
|
+
case "bottom-left":
|
|
26
|
+
return {
|
|
27
|
+
bottom: 1,
|
|
28
|
+
left: 2
|
|
29
|
+
};
|
|
30
|
+
case "bottom-right":
|
|
31
|
+
return {
|
|
32
|
+
bottom: 1,
|
|
33
|
+
right: 2
|
|
34
|
+
};
|
|
35
|
+
case "top-right":
|
|
36
|
+
default:
|
|
37
|
+
return {
|
|
38
|
+
top: 1,
|
|
39
|
+
right: 2
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
return (() => {
|
|
44
|
+
var _el$ = _$createElement("box");
|
|
45
|
+
_$setProp(_el$, "position", "absolute");
|
|
46
|
+
_$setProp(_el$, "zIndex", 1000);
|
|
47
|
+
_$setProp(_el$, "flexDirection", "column");
|
|
48
|
+
_$setProp(_el$, "gap", 1);
|
|
49
|
+
_$spread(_el$, _$mergeProps(anchorProps, rest), true);
|
|
50
|
+
_$insert(_el$, _$createComponent(For, {
|
|
51
|
+
get each() {
|
|
52
|
+
return local.toasts.slice(0, maxToasts());
|
|
53
|
+
},
|
|
54
|
+
children: toast => _$createComponent(Toast, {
|
|
55
|
+
toast: toast
|
|
56
|
+
})
|
|
57
|
+
}));
|
|
58
|
+
return _el$;
|
|
59
|
+
})();
|
|
24
60
|
}
|
|
25
61
|
export function Toast(props) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
62
|
+
const {
|
|
63
|
+
theme
|
|
64
|
+
} = useTheme();
|
|
65
|
+
const borderColor = () => {
|
|
66
|
+
switch (props.toast.variant ?? "info") {
|
|
67
|
+
case "success":
|
|
68
|
+
return theme.success;
|
|
69
|
+
case "warning":
|
|
70
|
+
return theme.warning;
|
|
71
|
+
case "error":
|
|
72
|
+
return theme.error;
|
|
73
|
+
case "info":
|
|
74
|
+
default:
|
|
75
|
+
return theme.info;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
return _$createComponent(Panel, {
|
|
79
|
+
variant: "menu",
|
|
80
|
+
get borderColor() {
|
|
81
|
+
return borderColor();
|
|
82
|
+
},
|
|
83
|
+
paddingX: 1,
|
|
84
|
+
paddingY: 0,
|
|
85
|
+
get children() {
|
|
86
|
+
return [(() => {
|
|
87
|
+
var _el$2 = _$createElement("box"),
|
|
88
|
+
_el$3 = _$createElement("text");
|
|
89
|
+
_$insertNode(_el$2, _el$3);
|
|
90
|
+
_$setProp(_el$2, "flexDirection", "row");
|
|
91
|
+
_$setProp(_el$2, "gap", 1);
|
|
92
|
+
_$setProp(_el$2, "alignItems", "center");
|
|
93
|
+
_$insert(_el$2, _$createComponent(Badge, {
|
|
94
|
+
get label() {
|
|
95
|
+
return (props.toast.variant ?? "info").toUpperCase();
|
|
96
|
+
},
|
|
97
|
+
get variant() {
|
|
98
|
+
return props.toast.variant ?? "info";
|
|
99
|
+
}
|
|
100
|
+
}), _el$3);
|
|
101
|
+
_$insert(_el$3, () => props.toast.title);
|
|
102
|
+
_$effect(_$p => _$setProp(_el$3, "fg", theme.text, _$p));
|
|
103
|
+
return _el$2;
|
|
104
|
+
})(), _$createComponent(Show, {
|
|
105
|
+
get when() {
|
|
106
|
+
return props.toast.message;
|
|
107
|
+
},
|
|
108
|
+
get children() {
|
|
109
|
+
return [(() => {
|
|
110
|
+
var _el$4 = _$createElement("box");
|
|
111
|
+
_$setProp(_el$4, "height", 1);
|
|
112
|
+
return _el$4;
|
|
113
|
+
})(), (() => {
|
|
114
|
+
var _el$5 = _$createElement("text");
|
|
115
|
+
_$insert(_el$5, () => props.toast.message);
|
|
116
|
+
_$effect(_$p => _$setProp(_el$5, "fg", theme.textMuted, _$p));
|
|
117
|
+
return _el$5;
|
|
118
|
+
})()];
|
|
38
119
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
120
|
+
})];
|
|
121
|
+
}
|
|
122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AI,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,IAAI,MAAM,CAAC,EACpG;IAAA,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,CAChD;GAAA,EAAE,GAAG,CACL;GAAA,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAC/B;IAAA,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EACf;IAAA,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,CACvD;GAAA,EAAE,IAAI,CACP;EAAA,EAAE,KAAK,CAAC,CACR,CAAA;AACF,CAAC"}
|
package/dist/context/terminal.js
CHANGED
|
@@ -2,5 +2,4 @@
|
|
|
2
2
|
* Terminal context - provides access to renderer and dimensions
|
|
3
3
|
* Re-exports OpenTUI's hooks for convenience
|
|
4
4
|
*/
|
|
5
|
-
export { onResize, RendererContext, useRenderer, useSelectionHandler, useTerminalDimensions
|
|
6
|
-
//# sourceMappingURL=terminal.js.map
|
|
5
|
+
export { onResize, RendererContext, useRenderer, useSelectionHandler, useTerminalDimensions } from "@opentui/solid";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal.jsx","sourceRoot":"","sources":["../../src/context/terminal.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,QAAQ,EACR,eAAe,EACf,WAAW,EACX,mBAAmB,EACnB,qBAAqB,GACrB,MAAM,gBAAgB,CAAA"}
|