@aster-ui/prefixed 0.12.83 → 0.12.85
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/components/Terminal.d.ts +2 -2
- package/dist/components/Terminal.js +33 -31
- package/dist/components/Terminal.js.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +99 -101
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -27,8 +27,8 @@ export interface TerminalProps {
|
|
|
27
27
|
readline?: boolean;
|
|
28
28
|
/** Prompt string for readline mode (supports ANSI colors) */
|
|
29
29
|
prompt?: string;
|
|
30
|
-
/** Callback when user submits a line in readline mode */
|
|
31
|
-
onLine?: (line: string) => void
|
|
30
|
+
/** Callback when user submits a line in readline mode. Return a Promise to defer the next prompt. */
|
|
31
|
+
onLine?: (line: string) => void | Promise<void>;
|
|
32
32
|
/** Convert LF to CRLF for proper newline handling (default: true) */
|
|
33
33
|
convertEol?: boolean;
|
|
34
34
|
/** xterm.js options (theme is auto-applied unless you override it) */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as M } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as H, useRef as
|
|
2
|
+
import { forwardRef as H, useRef as a, useImperativeHandle as O, useEffect as B } from "react";
|
|
3
3
|
import * as p from "@xterm/xterm";
|
|
4
4
|
import * as g from "@xterm/addon-fit";
|
|
5
5
|
import { useTheme as $ } from "../hooks/useTheme.js";
|
|
@@ -8,11 +8,11 @@ let k = !1;
|
|
|
8
8
|
function E() {
|
|
9
9
|
if (k || typeof document > "u") return;
|
|
10
10
|
k = !0;
|
|
11
|
-
const
|
|
12
|
-
|
|
11
|
+
const u = document.createElement("style");
|
|
12
|
+
u.setAttribute("data-xterm", ""), u.textContent = ".xterm{cursor:text;position:relative;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#fff;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;right:0;left:0;top:0;bottom:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm .xterm-scroll-area{visibility:hidden}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;left:0;top:0;bottom:0;right:0;z-index:10;color:transparent;pointer-events:none}.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}.xterm .xterm-accessibility-tree{user-select:text;white-space:pre}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:.5}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{text-decoration:double underline}.xterm-underline-3{text-decoration:wavy underline}.xterm-underline-4{text-decoration:dotted underline}.xterm-underline-5{text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{text-decoration:overline double underline}.xterm-overline.xterm-underline-3{text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}", document.head.appendChild(u);
|
|
13
13
|
}
|
|
14
14
|
const L = H(({
|
|
15
|
-
onData:
|
|
15
|
+
onData: u,
|
|
16
16
|
onReady: z,
|
|
17
17
|
readline: y = !1,
|
|
18
18
|
prompt: c = "$ ",
|
|
@@ -23,7 +23,7 @@ const L = H(({
|
|
|
23
23
|
style: R,
|
|
24
24
|
"data-testid": T
|
|
25
25
|
}, D) => {
|
|
26
|
-
const
|
|
26
|
+
const m = a(null), o = a(null), h = a(null), { isDark: f, colors: n } = $(), d = a({
|
|
27
27
|
buffer: "",
|
|
28
28
|
cursor: 0,
|
|
29
29
|
history: [],
|
|
@@ -36,14 +36,14 @@ const L = H(({
|
|
|
36
36
|
cursorAccent: n.background,
|
|
37
37
|
selectionBackground: n.primary + "40",
|
|
38
38
|
selectionForeground: n.foreground,
|
|
39
|
-
black:
|
|
39
|
+
black: f ? "#000000" : "#2e3436",
|
|
40
40
|
red: n.error,
|
|
41
41
|
green: n.success,
|
|
42
42
|
yellow: n.warning,
|
|
43
43
|
blue: n.info,
|
|
44
44
|
magenta: n.secondary,
|
|
45
45
|
cyan: n.accent,
|
|
46
|
-
white:
|
|
46
|
+
white: f ? "#d3d7cf" : "#eeeeec",
|
|
47
47
|
brightBlack: "#555753",
|
|
48
48
|
brightRed: n.error,
|
|
49
49
|
brightGreen: n.success,
|
|
@@ -51,7 +51,7 @@ const L = H(({
|
|
|
51
51
|
brightBlue: n.info,
|
|
52
52
|
brightMagenta: n.secondary,
|
|
53
53
|
brightCyan: n.accent,
|
|
54
|
-
brightWhite:
|
|
54
|
+
brightWhite: f ? "#eeeeec" : "#ffffff"
|
|
55
55
|
});
|
|
56
56
|
O(D, () => ({
|
|
57
57
|
terminal: o.current,
|
|
@@ -59,29 +59,29 @@ const L = H(({
|
|
|
59
59
|
writeln: (r) => o.current?.writeln(r),
|
|
60
60
|
clear: () => o.current?.clear(),
|
|
61
61
|
focus: () => o.current?.focus(),
|
|
62
|
-
fit: () =>
|
|
63
|
-
history:
|
|
62
|
+
fit: () => h.current?.fit(),
|
|
63
|
+
history: d.current.history,
|
|
64
64
|
clearHistory: () => {
|
|
65
|
-
|
|
65
|
+
d.current.history = [];
|
|
66
66
|
}
|
|
67
67
|
}), []);
|
|
68
|
-
const
|
|
68
|
+
const l = () => {
|
|
69
69
|
const r = o.current;
|
|
70
70
|
if (!r) return;
|
|
71
|
-
const t =
|
|
71
|
+
const t = d.current;
|
|
72
72
|
r.write("\r\x1B[K" + c + t.buffer);
|
|
73
73
|
const e = t.buffer.length - t.cursor;
|
|
74
74
|
e > 0 && r.write(`\x1B[${e}D`);
|
|
75
75
|
}, S = (r) => {
|
|
76
76
|
const t = o.current;
|
|
77
77
|
if (!t) return;
|
|
78
|
-
const e =
|
|
78
|
+
const e = d.current;
|
|
79
79
|
if (r === "\x1B[A") {
|
|
80
|
-
e.history.length > 0 && e.historyIndex < e.history.length - 1 && (e.historyIndex === -1 && (e.savedBuffer = e.buffer), e.historyIndex++, e.buffer = e.history[e.history.length - 1 - e.historyIndex], e.cursor = e.buffer.length,
|
|
80
|
+
e.history.length > 0 && e.historyIndex < e.history.length - 1 && (e.historyIndex === -1 && (e.savedBuffer = e.buffer), e.historyIndex++, e.buffer = e.history[e.history.length - 1 - e.historyIndex], e.cursor = e.buffer.length, l());
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
83
|
if (r === "\x1B[B") {
|
|
84
|
-
e.historyIndex > -1 && (e.historyIndex--, e.buffer = e.historyIndex === -1 ? e.savedBuffer : e.history[e.history.length - 1 - e.historyIndex], e.cursor = e.buffer.length,
|
|
84
|
+
e.historyIndex > -1 && (e.historyIndex--, e.buffer = e.historyIndex === -1 ? e.savedBuffer : e.history[e.history.length - 1 - e.historyIndex], e.cursor = e.buffer.length, l());
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
87
|
if (r === "\x1B[C") {
|
|
@@ -101,44 +101,46 @@ const L = H(({
|
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
103
|
if (r === "\x1B[3~") {
|
|
104
|
-
e.cursor < e.buffer.length && (e.buffer = e.buffer.slice(0, e.cursor) + e.buffer.slice(e.cursor + 1),
|
|
104
|
+
e.cursor < e.buffer.length && (e.buffer = e.buffer.slice(0, e.cursor) + e.buffer.slice(e.cursor + 1), l());
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
107
|
if (!r.startsWith("\x1B"))
|
|
108
108
|
if (r === "\r") {
|
|
109
109
|
t.writeln("");
|
|
110
110
|
const i = e.buffer;
|
|
111
|
-
i.trim() && e.history.push(i), e.buffer = "", e.cursor = 0, e.historyIndex = -1, e.savedBuffer = ""
|
|
112
|
-
|
|
111
|
+
i.trim() && e.history.push(i), e.buffer = "", e.cursor = 0, e.historyIndex = -1, e.savedBuffer = "";
|
|
112
|
+
const s = I?.(i);
|
|
113
|
+
s && typeof s.then == "function" ? s.then(() => t.write(c)) : t.write(c);
|
|
114
|
+
} else r === "" || r === "\b" ? e.cursor > 0 && (e.buffer = e.buffer.slice(0, e.cursor - 1) + e.buffer.slice(e.cursor), e.cursor--, l()) : r === "" ? (t.writeln("^C"), e.buffer = "", e.cursor = 0, e.historyIndex = -1, t.write(c)) : (r >= " " || r === " ") && (e.buffer = e.buffer.slice(0, e.cursor) + r + e.buffer.slice(e.cursor), e.cursor += r.length, l());
|
|
113
115
|
};
|
|
114
116
|
return B(() => {
|
|
115
|
-
if (!
|
|
117
|
+
if (!m.current) return;
|
|
116
118
|
E();
|
|
117
|
-
const r =
|
|
118
|
-
let t = null, e = null, i = null,
|
|
119
|
+
const r = m.current;
|
|
120
|
+
let t = null, e = null, i = null, s = !1, b = !1;
|
|
119
121
|
const v = () => {
|
|
120
|
-
if (
|
|
121
|
-
const
|
|
122
|
-
|
|
122
|
+
if (s || b || !r) return;
|
|
123
|
+
const x = r.getBoundingClientRect();
|
|
124
|
+
x.width === 0 || x.height === 0 || (s = !0, t = new j({
|
|
123
125
|
theme: w(),
|
|
124
126
|
cursorBlink: !0,
|
|
125
127
|
convertEol: A,
|
|
126
128
|
fontFamily: 'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace',
|
|
127
129
|
fontSize: 14,
|
|
128
130
|
...F
|
|
129
|
-
}), e = new X(), t.loadAddon(e), t.open(r), e.fit(), o.current = t,
|
|
131
|
+
}), e = new X(), t.loadAddon(e), t.open(r), e.fit(), o.current = t, h.current = e, y ? t.onData(S) : u && t.onData(u), z?.(t), y && t.write(c));
|
|
130
132
|
};
|
|
131
|
-
return i = new ResizeObserver((
|
|
132
|
-
!
|
|
133
|
+
return i = new ResizeObserver((x) => {
|
|
134
|
+
!x[0] || b || (s ? e && e.fit() : v());
|
|
133
135
|
}), i.observe(r), requestAnimationFrame(v), () => {
|
|
134
|
-
b = !0, i?.disconnect(), t?.dispose(), o.current = null,
|
|
136
|
+
b = !0, i?.disconnect(), t?.dispose(), o.current = null, h.current = null;
|
|
135
137
|
};
|
|
136
138
|
}, []), B(() => {
|
|
137
139
|
o.current && (o.current.options.theme = w());
|
|
138
|
-
}, [
|
|
140
|
+
}, [f, n]), /* @__PURE__ */ M(
|
|
139
141
|
"div",
|
|
140
142
|
{
|
|
141
|
-
ref:
|
|
143
|
+
ref: m,
|
|
142
144
|
className: C,
|
|
143
145
|
style: { width: "100%", height: "100%", ...R },
|
|
144
146
|
"data-testid": T
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Terminal.js","sources":["../../src/components/Terminal.tsx"],"sourcesContent":["import React, { useEffect, useRef, useImperativeHandle, forwardRef } from 'react'\nimport * as XTermPkg from '@xterm/xterm'\nimport * as FitAddonPkg from '@xterm/addon-fit'\nimport type { Terminal as XTermType, ITerminalOptions, ITerminalInitOnlyOptions } from '@xterm/xterm'\nimport type { FitAddon as FitAddonType } from '@xterm/addon-fit'\nimport { useTheme } from '../hooks/useTheme'\n\n// Handle both ESM and CJS module formats\nconst XTerm = (XTermPkg as { Terminal?: typeof XTermType }).Terminal\n ?? (XTermPkg as { default?: { Terminal: typeof XTermType } }).default?.Terminal\n ?? (XTermPkg as unknown as typeof XTermType)\nconst FitAddon = (FitAddonPkg as { FitAddon?: typeof FitAddonType }).FitAddon\n ?? (FitAddonPkg as { default?: { FitAddon: typeof FitAddonType } }).default?.FitAddon\n ?? (FitAddonPkg as unknown as typeof FitAddonType)\n\n// Inject xterm.css once (inlined for reliability across bundlers)\nlet cssInjected = false\nfunction injectXtermCSS() {\n if (cssInjected || typeof document === 'undefined') return\n cssInjected = true\n\n const style = document.createElement('style')\n style.setAttribute('data-xterm', '')\n style.textContent = `.xterm{cursor:text;position:relative;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#fff;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;right:0;left:0;top:0;bottom:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm .xterm-scroll-area{visibility:hidden}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;left:0;top:0;bottom:0;right:0;z-index:10;color:transparent;pointer-events:none}.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}.xterm .xterm-accessibility-tree{user-select:text;white-space:pre}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:.5}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{text-decoration:double underline}.xterm-underline-3{text-decoration:wavy underline}.xterm-underline-4{text-decoration:dotted underline}.xterm-underline-5{text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{text-decoration:overline double underline}.xterm-overline.xterm-underline-3{text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}`\n document.head.appendChild(style)\n}\n\nexport interface TerminalRef {\n /** The underlying xterm.js Terminal instance */\n terminal: XTermType | null\n /** Write data to the terminal */\n write: (data: string) => void\n /** Write a line to the terminal (with newline) */\n writeln: (data: string) => void\n /** Clear the terminal */\n clear: () => void\n /** Focus the terminal */\n focus: () => void\n /** Fit the terminal to its container */\n fit: () => void\n /** Command history (only available with readline mode) */\n history: string[]\n /** Clear command history (only available with readline mode) */\n clearHistory: () => void\n}\n\nexport interface TerminalProps {\n /** Callback when user types in the terminal (raw input) */\n onData?: (data: string) => void\n /** Callback when terminal is ready */\n onReady?: (terminal: XTermType) => void\n /** Enable readline mode with line editing and history */\n readline?: boolean\n /** Prompt string for readline mode (supports ANSI colors) */\n prompt?: string\n /** Callback when user submits a line in readline mode */\n onLine?: (line: string) => void\n /** Convert LF to CRLF for proper newline handling (default: true) */\n convertEol?: boolean\n /** xterm.js options (theme is auto-applied unless you override it) */\n options?: ITerminalOptions & ITerminalInitOnlyOptions\n /** Additional CSS classes for the container */\n className?: string\n /** Container style */\n style?: React.CSSProperties\n 'data-testid'?: string\n}\n\nexport const Terminal = forwardRef<TerminalRef, TerminalProps>(({\n onData,\n onReady,\n readline = false,\n prompt = '$ ',\n onLine,\n convertEol = true,\n options = {},\n className = '',\n style,\n 'data-testid': testId,\n}, ref) => {\n const containerRef = useRef<HTMLDivElement>(null)\n const terminalRef = useRef<XTermType | null>(null)\n const fitAddonRef = useRef<FitAddonType | null>(null)\n const { isDark, colors } = useTheme()\n\n // Readline state\n const readlineState = useRef({\n buffer: '',\n cursor: 0,\n history: [] as string[],\n historyIndex: -1,\n savedBuffer: '',\n })\n\n // Build theme from DaisyUI colors\n const getTheme = () => ({\n background: colors.background,\n foreground: colors.foreground,\n cursor: colors.primary,\n cursorAccent: colors.background,\n selectionBackground: colors.primary + '40',\n selectionForeground: colors.foreground,\n black: isDark ? '#000000' : '#2e3436',\n red: colors.error,\n green: colors.success,\n yellow: colors.warning,\n blue: colors.info,\n magenta: colors.secondary,\n cyan: colors.accent,\n white: isDark ? '#d3d7cf' : '#eeeeec',\n brightBlack: '#555753',\n brightRed: colors.error,\n brightGreen: colors.success,\n brightYellow: colors.warning,\n brightBlue: colors.info,\n brightMagenta: colors.secondary,\n brightCyan: colors.accent,\n brightWhite: isDark ? '#eeeeec' : '#ffffff',\n })\n\n useImperativeHandle(ref, () => ({\n terminal: terminalRef.current,\n write: (data: string) => terminalRef.current?.write(data),\n writeln: (data: string) => terminalRef.current?.writeln(data),\n clear: () => terminalRef.current?.clear(),\n focus: () => terminalRef.current?.focus(),\n fit: () => fitAddonRef.current?.fit(),\n history: readlineState.current.history,\n clearHistory: () => { readlineState.current.history = [] },\n }), [])\n\n // Redraw the current line in readline mode\n const redrawLine = () => {\n const term = terminalRef.current\n if (!term) return\n const s = readlineState.current\n // Move to start of line, clear line, write prompt + buffer, position cursor\n term.write('\\r\\x1b[K' + prompt + s.buffer)\n // Move cursor to correct position\n const moveBack = s.buffer.length - s.cursor\n if (moveBack > 0) {\n term.write(`\\x1b[${moveBack}D`)\n }\n }\n\n // Handle readline input\n const handleReadlineData = (data: string) => {\n const term = terminalRef.current\n if (!term) return\n const s = readlineState.current\n\n // Handle escape sequences (arrow keys)\n if (data === '\\x1b[A') {\n // Up arrow - history previous\n if (s.history.length > 0 && s.historyIndex < s.history.length - 1) {\n if (s.historyIndex === -1) s.savedBuffer = s.buffer\n s.historyIndex++\n s.buffer = s.history[s.history.length - 1 - s.historyIndex]\n s.cursor = s.buffer.length\n redrawLine()\n }\n return\n }\n if (data === '\\x1b[B') {\n // Down arrow - history next\n if (s.historyIndex > -1) {\n s.historyIndex--\n s.buffer = s.historyIndex === -1 ? s.savedBuffer : s.history[s.history.length - 1 - s.historyIndex]\n s.cursor = s.buffer.length\n redrawLine()\n }\n return\n }\n if (data === '\\x1b[C') {\n // Right arrow\n if (s.cursor < s.buffer.length) {\n s.cursor++\n term.write('\\x1b[C')\n }\n return\n }\n if (data === '\\x1b[D') {\n // Left arrow\n if (s.cursor > 0) {\n s.cursor--\n term.write('\\x1b[D')\n }\n return\n }\n if (data === '\\x1b[H' || data === '\\x1bOH' || data === '\\x1b[1~') {\n // Home - move to start of line\n if (s.cursor > 0) {\n term.write(`\\x1b[${s.cursor}D`)\n s.cursor = 0\n }\n return\n }\n if (data === '\\x1b[F' || data === '\\x1bOF' || data === '\\x1b[4~') {\n // End - move to end of line\n if (s.cursor < s.buffer.length) {\n term.write(`\\x1b[${s.buffer.length - s.cursor}C`)\n s.cursor = s.buffer.length\n }\n return\n }\n if (data === '\\x1b[3~') {\n // Delete key - delete character at cursor\n if (s.cursor < s.buffer.length) {\n s.buffer = s.buffer.slice(0, s.cursor) + s.buffer.slice(s.cursor + 1)\n redrawLine()\n }\n return\n }\n\n // Ignore other escape sequences\n if (data.startsWith('\\x1b')) return\n\n if (data === '\\r') {\n // Enter\n term.writeln('')\n const line = s.buffer\n if (line.trim()) {\n s.history.push(line)\n }\n s.buffer = ''\n s.cursor = 0\n s.historyIndex = -1\n s.savedBuffer = ''\n onLine?.(line)\n term.write(prompt)\n } else if (data === '\\x7f' || data === '\\b') {\n // Backspace\n if (s.cursor > 0) {\n s.buffer = s.buffer.slice(0, s.cursor - 1) + s.buffer.slice(s.cursor)\n s.cursor--\n redrawLine()\n }\n } else if (data === '\\x03') {\n // Ctrl+C\n term.writeln('^C')\n s.buffer = ''\n s.cursor = 0\n s.historyIndex = -1\n term.write(prompt)\n } else if (data >= ' ' || data === '\\t') {\n // Printable characters\n s.buffer = s.buffer.slice(0, s.cursor) + data + s.buffer.slice(s.cursor)\n s.cursor += data.length\n redrawLine()\n }\n }\n\n // Initialize terminal\n useEffect(() => {\n if (!containerRef.current) return\n\n injectXtermCSS()\n\n const container = containerRef.current\n let terminal: XTermType | null = null\n let fitAddon: FitAddonType | null = null\n let resizeObserver: ResizeObserver | null = null\n let initialized = false\n let disposed = false\n\n const initTerminal = () => {\n if (initialized || disposed || !container) return\n\n // Check container has dimensions before opening\n const rect = container.getBoundingClientRect()\n if (rect.width === 0 || rect.height === 0) return\n\n initialized = true\n\n terminal = new XTerm({\n theme: getTheme(),\n cursorBlink: true,\n convertEol,\n fontFamily: 'ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, \"Liberation Mono\", monospace',\n fontSize: 14,\n ...options,\n })\n fitAddon = new FitAddon()\n\n terminal.loadAddon(fitAddon)\n terminal.open(container)\n fitAddon.fit()\n\n terminalRef.current = terminal\n fitAddonRef.current = fitAddon\n\n if (readline) {\n terminal.onData(handleReadlineData)\n } else if (onData) {\n terminal.onData(onData)\n }\n\n onReady?.(terminal)\n\n // Write initial prompt after onReady so welcome messages appear first\n if (readline) {\n terminal.write(prompt)\n }\n }\n\n // Use ResizeObserver to wait for container to have dimensions\n resizeObserver = new ResizeObserver((entries) => {\n const entry = entries[0]\n if (!entry || disposed) return\n\n if (!initialized) {\n initTerminal()\n } else if (fitAddon) {\n fitAddon.fit()\n }\n })\n resizeObserver.observe(container)\n\n // Also try immediately in case container already has dimensions\n requestAnimationFrame(initTerminal)\n\n return () => {\n disposed = true\n resizeObserver?.disconnect()\n terminal?.dispose()\n terminalRef.current = null\n fitAddonRef.current = null\n }\n }, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n // Update theme when colors change\n useEffect(() => {\n if (!terminalRef.current) return\n terminalRef.current.options.theme = getTheme()\n }, [isDark, colors]) // eslint-disable-line react-hooks/exhaustive-deps\n\n return (\n <div\n ref={containerRef}\n className={className}\n style={{ width: '100%', height: '100%', ...style }}\n data-testid={testId}\n />\n )\n})\n\nTerminal.displayName = 'Terminal'\n"],"names":["XTerm","XTermPkg","FitAddon","FitAddonPkg","cssInjected","injectXtermCSS","style","Terminal","forwardRef","onData","onReady","readline","prompt","onLine","convertEol","options","className","testId","ref","containerRef","useRef","terminalRef","fitAddonRef","isDark","colors","useTheme","readlineState","getTheme","useImperativeHandle","data","redrawLine","term","s","moveBack","handleReadlineData","line","useEffect","container","terminal","fitAddon","resizeObserver","initialized","disposed","initTerminal","rect","entries","jsx"],"mappings":";;;;;AAQA,MAAMA,IAASC,EAA6C,YACtDA,EAA0D,SAAS,YACnEA,GACAC,IAAYC,EAAmD,YAC/DA,EAAgE,SAAS,YACzEA;AAGN,IAAIC,IAAc;AAClB,SAASC,IAAiB;AACxB,MAAID,KAAe,OAAO,WAAa,IAAa;AACpD,EAAAA,IAAc;AAEd,QAAME,IAAQ,SAAS,cAAc,OAAO;AAC5C,EAAAA,EAAM,aAAa,cAAc,EAAE,GACnCA,EAAM,cAAc,4+EACpB,SAAS,KAAK,YAAYA,CAAK;AACjC;AA2CO,MAAMC,IAAWC,EAAuC,CAAC;AAAA,EAC9D,QAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,QAAAC,IAAS;AAAA,EACT,QAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,SAAAC,IAAU,CAAA;AAAA,EACV,WAAAC,IAAY;AAAA,EACZ,OAAAV;AAAA,EACA,eAAeW;AACjB,GAAGC,MAAQ;AACT,QAAMC,IAAeC,EAAuB,IAAI,GAC1CC,IAAcD,EAAyB,IAAI,GA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AQ,QAAQM,EAAA;AAAA,EACtC,GAAG,CAACJ,GAAQC,CAAM,CAAC,GAGjB,gBAAAsB;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK3B;AAAA,MACL,WAAAH;AAAA,MACA,OAAO,EAAE,OAAO,QAAQ,QAAQ,QAAQ,GAAGV,EAAA;AAAA,MAC3C,eAAaW;AAAA,IAAA;AAAA,EAAA;AAGnB,CAAC;AAEDV,EAAS,cAAc;"}
|
|
1
|
+
{"version":3,"file":"Terminal.js","sources":["../../src/components/Terminal.tsx"],"sourcesContent":["import React, { useEffect, useRef, useImperativeHandle, forwardRef } from 'react'\nimport * as XTermPkg from '@xterm/xterm'\nimport * as FitAddonPkg from '@xterm/addon-fit'\nimport type { Terminal as XTermType, ITerminalOptions, ITerminalInitOnlyOptions } from '@xterm/xterm'\nimport type { FitAddon as FitAddonType } from '@xterm/addon-fit'\nimport { useTheme } from '../hooks/useTheme'\n\n// Handle both ESM and CJS module formats\nconst XTerm = (XTermPkg as { Terminal?: typeof XTermType }).Terminal\n ?? (XTermPkg as { default?: { Terminal: typeof XTermType } }).default?.Terminal\n ?? (XTermPkg as unknown as typeof XTermType)\nconst FitAddon = (FitAddonPkg as { FitAddon?: typeof FitAddonType }).FitAddon\n ?? (FitAddonPkg as { default?: { FitAddon: typeof FitAddonType } }).default?.FitAddon\n ?? (FitAddonPkg as unknown as typeof FitAddonType)\n\n// Inject xterm.css once (inlined for reliability across bundlers)\nlet cssInjected = false\nfunction injectXtermCSS() {\n if (cssInjected || typeof document === 'undefined') return\n cssInjected = true\n\n const style = document.createElement('style')\n style.setAttribute('data-xterm', '')\n style.textContent = `.xterm{cursor:text;position:relative;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#fff;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;right:0;left:0;top:0;bottom:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm .xterm-scroll-area{visibility:hidden}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;left:0;top:0;bottom:0;right:0;z-index:10;color:transparent;pointer-events:none}.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}.xterm .xterm-accessibility-tree{user-select:text;white-space:pre}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:.5}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{text-decoration:double underline}.xterm-underline-3{text-decoration:wavy underline}.xterm-underline-4{text-decoration:dotted underline}.xterm-underline-5{text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{text-decoration:overline double underline}.xterm-overline.xterm-underline-3{text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}`\n document.head.appendChild(style)\n}\n\nexport interface TerminalRef {\n /** The underlying xterm.js Terminal instance */\n terminal: XTermType | null\n /** Write data to the terminal */\n write: (data: string) => void\n /** Write a line to the terminal (with newline) */\n writeln: (data: string) => void\n /** Clear the terminal */\n clear: () => void\n /** Focus the terminal */\n focus: () => void\n /** Fit the terminal to its container */\n fit: () => void\n /** Command history (only available with readline mode) */\n history: string[]\n /** Clear command history (only available with readline mode) */\n clearHistory: () => void\n}\n\nexport interface TerminalProps {\n /** Callback when user types in the terminal (raw input) */\n onData?: (data: string) => void\n /** Callback when terminal is ready */\n onReady?: (terminal: XTermType) => void\n /** Enable readline mode with line editing and history */\n readline?: boolean\n /** Prompt string for readline mode (supports ANSI colors) */\n prompt?: string\n /** Callback when user submits a line in readline mode. Return a Promise to defer the next prompt. */\n onLine?: (line: string) => void | Promise<void>\n /** Convert LF to CRLF for proper newline handling (default: true) */\n convertEol?: boolean\n /** xterm.js options (theme is auto-applied unless you override it) */\n options?: ITerminalOptions & ITerminalInitOnlyOptions\n /** Additional CSS classes for the container */\n className?: string\n /** Container style */\n style?: React.CSSProperties\n 'data-testid'?: string\n}\n\nexport const Terminal = forwardRef<TerminalRef, TerminalProps>(({\n onData,\n onReady,\n readline = false,\n prompt = '$ ',\n onLine,\n convertEol = true,\n options = {},\n className = '',\n style,\n 'data-testid': testId,\n}, ref) => {\n const containerRef = useRef<HTMLDivElement>(null)\n const terminalRef = useRef<XTermType | null>(null)\n const fitAddonRef = useRef<FitAddonType | null>(null)\n const { isDark, colors } = useTheme()\n\n // Readline state\n const readlineState = useRef({\n buffer: '',\n cursor: 0,\n history: [] as string[],\n historyIndex: -1,\n savedBuffer: '',\n })\n\n // Build theme from DaisyUI colors\n const getTheme = () => ({\n background: colors.background,\n foreground: colors.foreground,\n cursor: colors.primary,\n cursorAccent: colors.background,\n selectionBackground: colors.primary + '40',\n selectionForeground: colors.foreground,\n black: isDark ? '#000000' : '#2e3436',\n red: colors.error,\n green: colors.success,\n yellow: colors.warning,\n blue: colors.info,\n magenta: colors.secondary,\n cyan: colors.accent,\n white: isDark ? '#d3d7cf' : '#eeeeec',\n brightBlack: '#555753',\n brightRed: colors.error,\n brightGreen: colors.success,\n brightYellow: colors.warning,\n brightBlue: colors.info,\n brightMagenta: colors.secondary,\n brightCyan: colors.accent,\n brightWhite: isDark ? '#eeeeec' : '#ffffff',\n })\n\n useImperativeHandle(ref, () => ({\n terminal: terminalRef.current,\n write: (data: string) => terminalRef.current?.write(data),\n writeln: (data: string) => terminalRef.current?.writeln(data),\n clear: () => terminalRef.current?.clear(),\n focus: () => terminalRef.current?.focus(),\n fit: () => fitAddonRef.current?.fit(),\n history: readlineState.current.history,\n clearHistory: () => { readlineState.current.history = [] },\n }), [])\n\n // Redraw the current line in readline mode\n const redrawLine = () => {\n const term = terminalRef.current\n if (!term) return\n const s = readlineState.current\n // Move to start of line, clear line, write prompt + buffer, position cursor\n term.write('\\r\\x1b[K' + prompt + s.buffer)\n // Move cursor to correct position\n const moveBack = s.buffer.length - s.cursor\n if (moveBack > 0) {\n term.write(`\\x1b[${moveBack}D`)\n }\n }\n\n // Handle readline input\n const handleReadlineData = (data: string) => {\n const term = terminalRef.current\n if (!term) return\n const s = readlineState.current\n\n // Handle escape sequences (arrow keys)\n if (data === '\\x1b[A') {\n // Up arrow - history previous\n if (s.history.length > 0 && s.historyIndex < s.history.length - 1) {\n if (s.historyIndex === -1) s.savedBuffer = s.buffer\n s.historyIndex++\n s.buffer = s.history[s.history.length - 1 - s.historyIndex]\n s.cursor = s.buffer.length\n redrawLine()\n }\n return\n }\n if (data === '\\x1b[B') {\n // Down arrow - history next\n if (s.historyIndex > -1) {\n s.historyIndex--\n s.buffer = s.historyIndex === -1 ? s.savedBuffer : s.history[s.history.length - 1 - s.historyIndex]\n s.cursor = s.buffer.length\n redrawLine()\n }\n return\n }\n if (data === '\\x1b[C') {\n // Right arrow\n if (s.cursor < s.buffer.length) {\n s.cursor++\n term.write('\\x1b[C')\n }\n return\n }\n if (data === '\\x1b[D') {\n // Left arrow\n if (s.cursor > 0) {\n s.cursor--\n term.write('\\x1b[D')\n }\n return\n }\n if (data === '\\x1b[H' || data === '\\x1bOH' || data === '\\x1b[1~') {\n // Home - move to start of line\n if (s.cursor > 0) {\n term.write(`\\x1b[${s.cursor}D`)\n s.cursor = 0\n }\n return\n }\n if (data === '\\x1b[F' || data === '\\x1bOF' || data === '\\x1b[4~') {\n // End - move to end of line\n if (s.cursor < s.buffer.length) {\n term.write(`\\x1b[${s.buffer.length - s.cursor}C`)\n s.cursor = s.buffer.length\n }\n return\n }\n if (data === '\\x1b[3~') {\n // Delete key - delete character at cursor\n if (s.cursor < s.buffer.length) {\n s.buffer = s.buffer.slice(0, s.cursor) + s.buffer.slice(s.cursor + 1)\n redrawLine()\n }\n return\n }\n\n // Ignore other escape sequences\n if (data.startsWith('\\x1b')) return\n\n if (data === '\\r') {\n // Enter\n term.writeln('')\n const line = s.buffer\n if (line.trim()) {\n s.history.push(line)\n }\n s.buffer = ''\n s.cursor = 0\n s.historyIndex = -1\n s.savedBuffer = ''\n const result = onLine?.(line)\n if (result && typeof (result as any).then === 'function') {\n (result as any).then(() => term.write(prompt))\n } else {\n term.write(prompt)\n }\n } else if (data === '\\x7f' || data === '\\b') {\n // Backspace\n if (s.cursor > 0) {\n s.buffer = s.buffer.slice(0, s.cursor - 1) + s.buffer.slice(s.cursor)\n s.cursor--\n redrawLine()\n }\n } else if (data === '\\x03') {\n // Ctrl+C\n term.writeln('^C')\n s.buffer = ''\n s.cursor = 0\n s.historyIndex = -1\n term.write(prompt)\n } else if (data >= ' ' || data === '\\t') {\n // Printable characters\n s.buffer = s.buffer.slice(0, s.cursor) + data + s.buffer.slice(s.cursor)\n s.cursor += data.length\n redrawLine()\n }\n }\n\n // Initialize terminal\n useEffect(() => {\n if (!containerRef.current) return\n\n injectXtermCSS()\n\n const container = containerRef.current\n let terminal: XTermType | null = null\n let fitAddon: FitAddonType | null = null\n let resizeObserver: ResizeObserver | null = null\n let initialized = false\n let disposed = false\n\n const initTerminal = () => {\n if (initialized || disposed || !container) return\n\n // Check container has dimensions before opening\n const rect = container.getBoundingClientRect()\n if (rect.width === 0 || rect.height === 0) return\n\n initialized = true\n\n terminal = new XTerm({\n theme: getTheme(),\n cursorBlink: true,\n convertEol,\n fontFamily: 'ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, \"Liberation Mono\", monospace',\n fontSize: 14,\n ...options,\n })\n fitAddon = new FitAddon()\n\n terminal.loadAddon(fitAddon)\n terminal.open(container)\n fitAddon.fit()\n\n terminalRef.current = terminal\n fitAddonRef.current = fitAddon\n\n if (readline) {\n terminal.onData(handleReadlineData)\n } else if (onData) {\n terminal.onData(onData)\n }\n\n onReady?.(terminal)\n\n // Write initial prompt after onReady so welcome messages appear first\n if (readline) {\n terminal.write(prompt)\n }\n }\n\n // Use ResizeObserver to wait for container to have dimensions\n resizeObserver = new ResizeObserver((entries) => {\n const entry = entries[0]\n if (!entry || disposed) return\n\n if (!initialized) {\n initTerminal()\n } else if (fitAddon) {\n fitAddon.fit()\n }\n })\n resizeObserver.observe(container)\n\n // Also try immediately in case container already has dimensions\n requestAnimationFrame(initTerminal)\n\n return () => {\n disposed = true\n resizeObserver?.disconnect()\n terminal?.dispose()\n terminalRef.current = null\n fitAddonRef.current = null\n }\n }, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n // Update theme when colors change\n useEffect(() => {\n if (!terminalRef.current) return\n terminalRef.current.options.theme = getTheme()\n }, [isDark, colors]) // eslint-disable-line react-hooks/exhaustive-deps\n\n return (\n <div\n ref={containerRef}\n className={className}\n style={{ width: '100%', height: '100%', ...style }}\n data-testid={testId}\n />\n )\n})\n\nTerminal.displayName = 'Terminal'\n"],"names":["XTerm","XTermPkg","FitAddon","FitAddonPkg","cssInjected","injectXtermCSS","style","Terminal","forwardRef","onData","onReady","readline","prompt","onLine","convertEol","options","className","testId","ref","containerRef","useRef","terminalRef","fitAddonRef","isDark","colors","useTheme","readlineState","getTheme","useImperativeHandle","data","redrawLine","term","s","moveBack","handleReadlineData","line","result","useEffect","container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Item, TabsVariant, TabsSize, TabsPosition } from './components/Tabs';
|
|
173
173
|
export { Textarea } from './components/Textarea';
|
|
174
174
|
export type { TextareaProps } from './components/Textarea';
|
|
175
|
-
export { Terminal } from './components/Terminal';
|
|
176
|
-
export type { TerminalProps, TerminalRef } from './components/Terminal';
|
|
177
175
|
export { TextRotate } from './components/TextRotate';
|
|
178
176
|
export type { TextRotateProps, TextRotateDuration } from './components/TextRotate';
|
|
179
177
|
export { Tag, CheckableTag, TagLiveRegion } from './components/Tag';
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Affix as e } from "./components/Affix.js";
|
|
2
2
|
import { AspectRatio as p } from "./components/AspectRatio.js";
|
|
3
|
-
import { Anchor as
|
|
3
|
+
import { Anchor as m } from "./components/Anchor.js";
|
|
4
4
|
import { Alert as a } from "./components/Alert.js";
|
|
5
5
|
import { Autocomplete as n } from "./components/Autocomplete.js";
|
|
6
6
|
import { Avatar as u, AvatarGroup as l } from "./components/Avatar.js";
|
|
7
7
|
import { Badge as C } from "./components/Badge.js";
|
|
8
|
-
import { Breadcrumb as
|
|
8
|
+
import { Breadcrumb as g } from "./components/Breadcrumb.js";
|
|
9
9
|
import { Button as S } from "./components/Button.js";
|
|
10
10
|
import { SizeContext as h, SizeProvider as k, useSize as v } from "./contexts/SizeContext.js";
|
|
11
11
|
import { CopyButton as D } from "./components/CopyButton.js";
|
|
@@ -23,12 +23,12 @@ import { ContextMenu as Z } from "./components/ContextMenu.js";
|
|
|
23
23
|
import { Countdown as $ } from "./components/Countdown.js";
|
|
24
24
|
import { DatePicker as ro } from "./components/DatePicker.js";
|
|
25
25
|
import { DateOfBirth as to, dateOfBirthRequired as po } from "./components/DateOfBirth.js";
|
|
26
|
-
import { MonthCalendar as
|
|
26
|
+
import { MonthCalendar as mo } from "./components/MonthCalendar.js";
|
|
27
27
|
import { WeekCalendar as ao } from "./components/WeekCalendar.js";
|
|
28
28
|
import { Descriptions as no } from "./components/Descriptions.js";
|
|
29
29
|
import { Diff as uo } from "./components/Diff.js";
|
|
30
30
|
import { Dock as Co } from "./components/Dock.js";
|
|
31
|
-
import { Divider as
|
|
31
|
+
import { Divider as go } from "./components/Divider.js";
|
|
32
32
|
import { Drawer as So } from "./components/Drawer.js";
|
|
33
33
|
import { ResponsiveDrawer as ho } from "./components/ResponsiveDrawer.js";
|
|
34
34
|
import { Fieldset as vo } from "./components/Fieldset.js";
|
|
@@ -47,13 +47,13 @@ import { Empty as Zo } from "./components/Empty.js";
|
|
|
47
47
|
import { Input as $o } from "./components/Input.js";
|
|
48
48
|
import { InputNumber as rr } from "./components/InputNumber.js";
|
|
49
49
|
import { Join as tr } from "./components/Join.js";
|
|
50
|
-
import { Kbd as
|
|
50
|
+
import { Kbd as fr } from "./components/Kbd.js";
|
|
51
51
|
import { Layout as xr, useSiderContext as ar } from "./components/Layout.js";
|
|
52
52
|
import { List as nr } from "./components/List.js";
|
|
53
53
|
import { Loading as ur } from "./components/Loading.js";
|
|
54
54
|
import { Mask as dr } from "./components/Mask.js";
|
|
55
55
|
import { Masonry as cr } from "./components/Masonry.js";
|
|
56
|
-
import { Mention as
|
|
56
|
+
import { Mention as Tr } from "./components/Mention.js";
|
|
57
57
|
import { Menu as Pr } from "./components/Menu.js";
|
|
58
58
|
import { Browser as kr } from "./components/Browser.js";
|
|
59
59
|
import { Code as Rr } from "./components/Code.js";
|
|
@@ -73,73 +73,72 @@ import { RadialProgress as Zr } from "./components/RadialProgress.js";
|
|
|
73
73
|
import { Range as $r } from "./components/Range.js";
|
|
74
74
|
import { Rating as re } from "./components/Rating.js";
|
|
75
75
|
import { Result as te } from "./components/Result.js";
|
|
76
|
-
import { Select as
|
|
76
|
+
import { Select as fe } from "./components/Select.js";
|
|
77
77
|
import { Segmented as xe } from "./components/Segmented.js";
|
|
78
78
|
import { Skeleton as se } from "./components/Skeleton.js";
|
|
79
79
|
import { Space as ie } from "./components/Space.js";
|
|
80
80
|
import { Splitter as le } from "./components/Splitter.js";
|
|
81
81
|
import { Stats as Ce } from "./components/Stat.js";
|
|
82
|
-
import { Status as
|
|
82
|
+
import { Status as ge } from "./components/Status.js";
|
|
83
83
|
import { Steps as Se } from "./components/Steps.js";
|
|
84
84
|
import { Table as he } from "./components/Table.js";
|
|
85
85
|
import { Tabs as ve } from "./components/Tabs.js";
|
|
86
86
|
import { Textarea as De } from "./components/Textarea.js";
|
|
87
|
-
import {
|
|
88
|
-
import {
|
|
89
|
-
import {
|
|
90
|
-
import {
|
|
91
|
-
import {
|
|
92
|
-
import {
|
|
93
|
-
import {
|
|
94
|
-
import {
|
|
95
|
-
import {
|
|
96
|
-
import {
|
|
97
|
-
import {
|
|
98
|
-
import {
|
|
99
|
-
import {
|
|
100
|
-
import {
|
|
101
|
-
import {
|
|
102
|
-
import {
|
|
103
|
-
import {
|
|
104
|
-
import {
|
|
105
|
-
import {
|
|
106
|
-
import {
|
|
107
|
-
import {
|
|
108
|
-
import {
|
|
109
|
-
import {
|
|
110
|
-
import {
|
|
111
|
-
import {
|
|
112
|
-
import {
|
|
113
|
-
import {
|
|
114
|
-
import {
|
|
115
|
-
import { default as Ht } from "./locale/en-
|
|
116
|
-
import { default as Gt } from "./locale/en-
|
|
117
|
-
import { default as Ot } from "./locale/
|
|
118
|
-
import { default as Nt } from "./locale/
|
|
119
|
-
import { default as Ut } from "./locale/
|
|
120
|
-
import { default as qt } from "./locale/
|
|
121
|
-
import { default as Vt } from "./locale/
|
|
122
|
-
import { default as Yt } from "./locale/
|
|
123
|
-
import { default as _t } from "./locale/
|
|
124
|
-
import {
|
|
125
|
-
import { useWatch as ep } from "react-hook-form";
|
|
87
|
+
import { TextRotate as Be } from "./components/TextRotate.js";
|
|
88
|
+
import { CheckableTag as we, Tag as ye, TagLiveRegion as Me } from "./components/Tag.js";
|
|
89
|
+
import { ThemeController as Le } from "./components/ThemeController.js";
|
|
90
|
+
import { ThemeProvider as ze, useHasThemeProvider as He, useThemeContext as We } from "./providers/ThemeProvider.js";
|
|
91
|
+
import { TimePicker as Ke } from "./components/TimePicker.js";
|
|
92
|
+
import { Timeline as Ee } from "./components/Timeline.js";
|
|
93
|
+
import { Toggle as Je } from "./components/Toggle.js";
|
|
94
|
+
import { Tour as je } from "./components/Tour.js";
|
|
95
|
+
import { Tooltip as Qe } from "./components/Tooltip.js";
|
|
96
|
+
import { Transfer as Xe } from "./components/Transfer.js";
|
|
97
|
+
import { Tree as Ze } from "./components/Tree.js";
|
|
98
|
+
import { TreeSelect as $e, TreeSelectComponent as ot } from "./components/TreeSelect.js";
|
|
99
|
+
import { Typography as et } from "./components/Typography.js";
|
|
100
|
+
import { Upload as pt } from "./components/Upload.js";
|
|
101
|
+
import { Watermark as mt } from "./components/Watermark.js";
|
|
102
|
+
import { Hide as at, Show as st } from "./components/Responsive.js";
|
|
103
|
+
import { useBreakpoint as it } from "./hooks/useBreakpoint.js";
|
|
104
|
+
import { useDisclosure as lt } from "./hooks/useDisclosure.js";
|
|
105
|
+
import { useClipboard as Ct } from "./hooks/useClipboard.js";
|
|
106
|
+
import { useLocalStorage as gt } from "./hooks/useLocalStorage.js";
|
|
107
|
+
import { useDebounce as St } from "./hooks/useDebounce.js";
|
|
108
|
+
import { useClickOutside as ht } from "./hooks/useClickOutside.js";
|
|
109
|
+
import { usePrevious as vt } from "./hooks/usePrevious.js";
|
|
110
|
+
import { useHover as Dt } from "./hooks/useHover.js";
|
|
111
|
+
import { useKeyPress as Bt, useKeyPressCallback as Ft } from "./hooks/useKeyPress.js";
|
|
112
|
+
import { useWindowSize as yt } from "./hooks/useWindowSize.js";
|
|
113
|
+
import { useTheme as At } from "./hooks/useTheme.js";
|
|
114
|
+
import { default as It } from "./locale/en-US.js";
|
|
115
|
+
import { default as Ht } from "./locale/en-GB.js";
|
|
116
|
+
import { default as Gt } from "./locale/en-CA.js";
|
|
117
|
+
import { default as Ot } from "./locale/zh-CN.js";
|
|
118
|
+
import { default as Nt } from "./locale/es-ES.js";
|
|
119
|
+
import { default as Ut } from "./locale/ja-JP.js";
|
|
120
|
+
import { default as qt } from "./locale/pt-BR.js";
|
|
121
|
+
import { default as Vt } from "./locale/de-DE.js";
|
|
122
|
+
import { default as Yt } from "./locale/fr-FR.js";
|
|
123
|
+
import { default as _t } from "./locale/ko-KR.js";
|
|
124
|
+
import { useWatch as op } from "react-hook-form";
|
|
126
125
|
export {
|
|
127
126
|
e as Affix,
|
|
128
127
|
a as Alert,
|
|
129
|
-
|
|
128
|
+
m as Anchor,
|
|
130
129
|
p as AspectRatio,
|
|
131
130
|
n as Autocomplete,
|
|
132
131
|
u as Avatar,
|
|
133
132
|
l as AvatarGroup,
|
|
134
133
|
C as Badge,
|
|
135
|
-
|
|
134
|
+
g as Breadcrumb,
|
|
136
135
|
kr as Browser,
|
|
137
136
|
S as Button,
|
|
138
137
|
L as Card,
|
|
139
138
|
z as Carousel,
|
|
140
139
|
W as Cascader,
|
|
141
140
|
w as Chat,
|
|
142
|
-
|
|
141
|
+
we as CheckableTag,
|
|
143
142
|
B as Checkbox,
|
|
144
143
|
Rr as Code,
|
|
145
144
|
Ko as Col,
|
|
@@ -156,7 +155,7 @@ export {
|
|
|
156
155
|
ro as DatePicker,
|
|
157
156
|
no as Descriptions,
|
|
158
157
|
uo as Diff,
|
|
159
|
-
|
|
158
|
+
go as Divider,
|
|
160
159
|
Co as Dock,
|
|
161
160
|
So as Drawer,
|
|
162
161
|
Xo as Dropdown,
|
|
@@ -170,23 +169,23 @@ export {
|
|
|
170
169
|
zo as Form,
|
|
171
170
|
Oo as Grid,
|
|
172
171
|
Jo as Hero,
|
|
173
|
-
|
|
172
|
+
at as Hide,
|
|
174
173
|
jo as HoverGallery,
|
|
175
174
|
Qo as Image,
|
|
176
175
|
$o as Input,
|
|
177
176
|
rr as InputNumber,
|
|
178
177
|
tr as Join,
|
|
179
|
-
|
|
178
|
+
fr as Kbd,
|
|
180
179
|
xr as Layout,
|
|
181
180
|
nr as List,
|
|
182
181
|
ur as Loading,
|
|
183
182
|
dr as Mask,
|
|
184
183
|
cr as Masonry,
|
|
185
|
-
|
|
184
|
+
Tr as Mention,
|
|
186
185
|
Pr as Menu,
|
|
187
186
|
Hr as MessageManager,
|
|
188
187
|
yr as Modal,
|
|
189
|
-
|
|
188
|
+
mo as MonthCalendar,
|
|
190
189
|
Ar as Navbar,
|
|
191
190
|
Kr as OTPInput,
|
|
192
191
|
Er as Pagination,
|
|
@@ -202,73 +201,72 @@ export {
|
|
|
202
201
|
te as Result,
|
|
203
202
|
Eo as Row,
|
|
204
203
|
xe as Segmented,
|
|
205
|
-
|
|
206
|
-
|
|
204
|
+
fe as Select,
|
|
205
|
+
st as Show,
|
|
207
206
|
h as SizeContext,
|
|
208
207
|
k as SizeProvider,
|
|
209
208
|
se as Skeleton,
|
|
210
209
|
ie as Space,
|
|
211
210
|
le as Splitter,
|
|
212
211
|
Ce as Stats,
|
|
213
|
-
|
|
212
|
+
ge as Status,
|
|
214
213
|
Se as Steps,
|
|
215
214
|
he as Table,
|
|
216
215
|
ve as Tabs,
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
Be as
|
|
220
|
-
we as TextRotate,
|
|
216
|
+
ye as Tag,
|
|
217
|
+
Me as TagLiveRegion,
|
|
218
|
+
Be as TextRotate,
|
|
221
219
|
De as Textarea,
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
220
|
+
Le as ThemeController,
|
|
221
|
+
ze as ThemeProvider,
|
|
222
|
+
Ke as TimePicker,
|
|
223
|
+
Ee as Timeline,
|
|
224
|
+
Je as Toggle,
|
|
225
|
+
Qe as Tooltip,
|
|
226
|
+
je as Tour,
|
|
227
|
+
Xe as Transfer,
|
|
228
|
+
Ze as Tree,
|
|
229
|
+
$e as TreeSelect,
|
|
230
|
+
ot as TreeSelectComponent,
|
|
231
|
+
et as Typography,
|
|
232
|
+
pt as Upload,
|
|
233
|
+
mt as Watermark,
|
|
236
234
|
ao as WeekCalendar,
|
|
237
235
|
Fr as Window,
|
|
238
236
|
po as dateOfBirthRequired,
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
237
|
+
Vt as deDE,
|
|
238
|
+
Gt as enCA,
|
|
239
|
+
Ht as enGB,
|
|
240
|
+
It as enUS,
|
|
241
|
+
Nt as esES,
|
|
242
|
+
Yt as frFR,
|
|
243
|
+
Ut as jaJP,
|
|
244
|
+
_t as koKR,
|
|
247
245
|
Wr as message,
|
|
248
246
|
Ir as notification,
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
247
|
+
qt as ptBR,
|
|
248
|
+
it as useBreakpoint,
|
|
249
|
+
ht as useClickOutside,
|
|
250
|
+
Ct as useClipboard,
|
|
253
251
|
E as useComponentLocale,
|
|
254
252
|
N as useConfig,
|
|
255
|
-
|
|
256
|
-
|
|
253
|
+
St as useDebounce,
|
|
254
|
+
lt as useDisclosure,
|
|
257
255
|
Ho as useForm,
|
|
258
256
|
Wo as useFormInstance,
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
257
|
+
He as useHasThemeProvider,
|
|
258
|
+
Dt as useHover,
|
|
259
|
+
Bt as useKeyPress,
|
|
260
|
+
Ft as useKeyPressCallback,
|
|
261
|
+
gt as useLocalStorage,
|
|
264
262
|
J as useLocale,
|
|
265
|
-
|
|
263
|
+
vt as usePrevious,
|
|
266
264
|
ar as useSiderContext,
|
|
267
265
|
v as useSize,
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
266
|
+
At as useTheme,
|
|
267
|
+
We as useThemeContext,
|
|
268
|
+
op as useWatch,
|
|
269
|
+
yt as useWindowSize,
|
|
270
|
+
Ot as zhCN
|
|
273
271
|
};
|
|
274
272
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|