@industry-theme/xterm-terminal-panel 0.1.5 → 0.1.7
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/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { FitAddon } from "@xterm/addon-fit";
|
|
3
3
|
import { SearchAddon } from "@xterm/addon-search";
|
|
4
4
|
import { WebLinksAddon } from "@xterm/addon-web-links";
|
|
5
|
+
import { WebglAddon } from "@xterm/addon-webgl";
|
|
5
6
|
import { Terminal } from "@xterm/xterm";
|
|
6
7
|
import {
|
|
7
8
|
ChevronDown,
|
|
@@ -60,6 +61,7 @@ function getTerminalCSSVariables(theme) {
|
|
|
60
61
|
|
|
61
62
|
// src/components/ThemedTerminal.tsx
|
|
62
63
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
64
|
+
var SCROLL_DEBOUNCE_MS = 1000;
|
|
63
65
|
var ThemedTerminal = forwardRef(({
|
|
64
66
|
theme,
|
|
65
67
|
onData,
|
|
@@ -91,7 +93,9 @@ var ThemedTerminal = forwardRef(({
|
|
|
91
93
|
const [terminal, setTerminal] = useState(null);
|
|
92
94
|
const fitAddonRef = useRef(null);
|
|
93
95
|
const searchAddonRef = useRef(null);
|
|
96
|
+
const webglAddonRef = useRef(null);
|
|
94
97
|
const resizeTimeoutRef = useRef(null);
|
|
98
|
+
const scrollDebounceRef = useRef(null);
|
|
95
99
|
const isVisibleRef = useRef(isVisible);
|
|
96
100
|
const isScrollLockedRef = useRef(true);
|
|
97
101
|
useEffect(() => {
|
|
@@ -115,14 +119,23 @@ var ThemedTerminal = forwardRef(({
|
|
|
115
119
|
isScrollLocked: isScrollLockedRef.current
|
|
116
120
|
};
|
|
117
121
|
};
|
|
122
|
+
const scheduleScrollToBottom = () => {
|
|
123
|
+
if (!terminal || !isScrollLockedRef.current)
|
|
124
|
+
return;
|
|
125
|
+
if (scrollDebounceRef.current) {
|
|
126
|
+
clearTimeout(scrollDebounceRef.current);
|
|
127
|
+
}
|
|
128
|
+
scrollDebounceRef.current = setTimeout(() => {
|
|
129
|
+
if (terminal && isScrollLockedRef.current) {
|
|
130
|
+
terminal.scrollToBottom();
|
|
131
|
+
}
|
|
132
|
+
}, SCROLL_DEBOUNCE_MS);
|
|
133
|
+
};
|
|
118
134
|
useImperativeHandle(ref, () => ({
|
|
119
135
|
write: (data) => {
|
|
120
136
|
if (terminal) {
|
|
121
|
-
terminal.write(data
|
|
122
|
-
|
|
123
|
-
terminal.scrollToBottom();
|
|
124
|
-
}
|
|
125
|
-
});
|
|
137
|
+
terminal.write(data);
|
|
138
|
+
scheduleScrollToBottom();
|
|
126
139
|
} else {
|
|
127
140
|
console.warn("[ThemedTerminal] write called but terminal is null!");
|
|
128
141
|
}
|
|
@@ -130,9 +143,7 @@ var ThemedTerminal = forwardRef(({
|
|
|
130
143
|
writeln: (data) => {
|
|
131
144
|
if (terminal) {
|
|
132
145
|
terminal.writeln(data);
|
|
133
|
-
|
|
134
|
-
terminal.scrollToBottom();
|
|
135
|
-
}
|
|
146
|
+
scheduleScrollToBottom();
|
|
136
147
|
}
|
|
137
148
|
},
|
|
138
149
|
scrollToBottom: () => {
|
|
@@ -257,6 +268,19 @@ var ThemedTerminal = forwardRef(({
|
|
|
257
268
|
term.loadAddon(webLinksAddon);
|
|
258
269
|
}
|
|
259
270
|
term.open(terminalRef.current);
|
|
271
|
+
try {
|
|
272
|
+
const webglAddon = new WebglAddon;
|
|
273
|
+
webglAddonRef.current = webglAddon;
|
|
274
|
+
webglAddon.onContextLoss(() => {
|
|
275
|
+
console.warn("[ThemedTerminal] WebGL context lost, falling back to canvas renderer");
|
|
276
|
+
webglAddon.dispose();
|
|
277
|
+
webglAddonRef.current = null;
|
|
278
|
+
});
|
|
279
|
+
term.loadAddon(webglAddon);
|
|
280
|
+
console.info("[ThemedTerminal] WebGL renderer enabled");
|
|
281
|
+
} catch (e) {
|
|
282
|
+
console.warn("[ThemedTerminal] WebGL not available, using canvas renderer:", e);
|
|
283
|
+
}
|
|
260
284
|
const scrollDisposable = term.onScroll(() => {
|
|
261
285
|
const scrollY = term.buffer.active.viewportY;
|
|
262
286
|
const scrollback2 = term.buffer.active.baseY;
|
|
@@ -303,6 +327,13 @@ var ThemedTerminal = forwardRef(({
|
|
|
303
327
|
if (resizeTimeoutRef.current) {
|
|
304
328
|
clearTimeout(resizeTimeoutRef.current);
|
|
305
329
|
}
|
|
330
|
+
if (scrollDebounceRef.current) {
|
|
331
|
+
clearTimeout(scrollDebounceRef.current);
|
|
332
|
+
}
|
|
333
|
+
if (webglAddonRef.current) {
|
|
334
|
+
webglAddonRef.current.dispose();
|
|
335
|
+
webglAddonRef.current = null;
|
|
336
|
+
}
|
|
306
337
|
term.dispose();
|
|
307
338
|
};
|
|
308
339
|
}, [onLinkClick]);
|
|
@@ -397,7 +428,7 @@ var ThemedTerminal = forwardRef(({
|
|
|
397
428
|
display: "flex",
|
|
398
429
|
alignItems: "center",
|
|
399
430
|
justifyContent: "space-between",
|
|
400
|
-
padding: "
|
|
431
|
+
padding: "7px 16px 8px",
|
|
401
432
|
borderBottom: `1px solid ${theme.colors.border}`,
|
|
402
433
|
backgroundColor: theme.colors.backgroundSecondary || theme.colors.background
|
|
403
434
|
},
|
|
@@ -1578,7 +1609,7 @@ var TabbedTerminalPanelInner = ({
|
|
|
1578
1609
|
style: {
|
|
1579
1610
|
display: "flex",
|
|
1580
1611
|
alignItems: "stretch",
|
|
1581
|
-
height: "
|
|
1612
|
+
height: "40px",
|
|
1582
1613
|
flexShrink: 0,
|
|
1583
1614
|
boxSizing: "border-box"
|
|
1584
1615
|
},
|
|
@@ -1648,7 +1679,7 @@ var TabbedTerminalPanelInner = ({
|
|
|
1648
1679
|
gap: "6px",
|
|
1649
1680
|
padding: "6px 8px",
|
|
1650
1681
|
backgroundColor: tab.isActive ? theme.colors.background : theme.colors.backgroundSecondary,
|
|
1651
|
-
borderBottom: `1px solid ${theme.colors.border}`,
|
|
1682
|
+
borderBottom: tab.isActive ? `1px solid ${theme.colors.background}` : `1px solid ${theme.colors.border}`,
|
|
1652
1683
|
cursor: "pointer",
|
|
1653
1684
|
fontSize: theme.fontSizes[1],
|
|
1654
1685
|
fontWeight: tab.isActive ? theme.fontWeights.semibold : theme.fontWeights.body,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemedTerminal.d.ts","sourceRoot":"","sources":["../../../src/components/ThemedTerminal.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"ThemedTerminal.d.ts","sourceRoot":"","sources":["../../../src/components/ThemedTerminal.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAyB3D,OAAO,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAEV,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,8BAA8B,CAAC;AAEtC,MAAM,WAAW,4BAA6B,SAAQ,mBAAmB;IACvE,KAAK,EAAE,KAAK,CAAC;CACd;AAsBD,eAAO,MAAM,cAAc,4HAyuB1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabbedTerminalPanel.d.ts","sourceRoot":"","sources":["../../../src/panels/TabbedTerminalPanel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAKN,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EACV,wBAAwB,EAGzB,MAAM,gBAAgB,CAAC;AAuBxB,MAAM,WAAW,qBAAqB;IACpC,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAC9B;
|
|
1
|
+
{"version":3,"file":"TabbedTerminalPanel.d.ts","sourceRoot":"","sources":["../../../src/panels/TabbedTerminalPanel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAKN,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EACV,wBAAwB,EAGzB,MAAM,gBAAgB,CAAC;AAuBxB,MAAM,WAAW,qBAAqB;IACpC,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAC9B;AAwiCD,eAAO,MAAM,mBAAmB,sDAmB9B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@industry-theme/xterm-terminal-panel",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Industry-themed xterm.js terminal components with panel framework integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
26
|
"build": "bun run clean && bun run build:esm && bun run build:tools && bun run build:types && bun run build:styles",
|
|
27
|
-
"build:esm": "NODE_ENV=production bun build ./index.ts --outdir ./dist --entry-naming [dir]/[name].[ext] --format esm --target browser --external react --external react-dom --external @xterm/xterm --external @xterm/addon-fit --external @xterm/addon-search --external @xterm/addon-web-links --external @principal-ade/industry-theme --external @principal-ade/panel-framework-core --external lucide-react --external clsx",
|
|
27
|
+
"build:esm": "NODE_ENV=production bun build ./index.ts --outdir ./dist --entry-naming [dir]/[name].[ext] --format esm --target browser --external react --external react-dom --external @xterm/xterm --external @xterm/addon-fit --external @xterm/addon-search --external @xterm/addon-web-links --external @xterm/addon-webgl --external @principal-ade/industry-theme --external @principal-ade/panel-framework-core --external lucide-react --external clsx",
|
|
28
28
|
"build:tools": "bun build ./src/tools/index.ts --outfile ./dist/tools.bundle.js --format esm --target browser",
|
|
29
29
|
"build:types": "tsc --project tsconfig.build.json --emitDeclarationOnly --declaration --declarationMap",
|
|
30
30
|
"build:styles": "cp src/styles/terminal-theme.css dist/styles.css",
|
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
"@xterm/addon-fit": ">=0.10.0",
|
|
64
64
|
"@xterm/addon-search": ">=0.15.0",
|
|
65
65
|
"@xterm/addon-web-links": ">=0.11.0",
|
|
66
|
+
"@xterm/addon-webgl": ">=0.18.0",
|
|
66
67
|
"@xterm/xterm": ">=5.5.0",
|
|
67
68
|
"lucide-react": ">=0.263.0",
|
|
68
69
|
"react": ">=19.0.0",
|
|
@@ -71,6 +72,9 @@
|
|
|
71
72
|
"peerDependenciesMeta": {
|
|
72
73
|
"lucide-react": {
|
|
73
74
|
"optional": true
|
|
75
|
+
},
|
|
76
|
+
"@xterm/addon-webgl": {
|
|
77
|
+
"optional": true
|
|
74
78
|
}
|
|
75
79
|
},
|
|
76
80
|
"devDependencies": {
|
|
@@ -90,6 +94,7 @@
|
|
|
90
94
|
"@xterm/addon-fit": "^0.10.0",
|
|
91
95
|
"@xterm/addon-search": "^0.15.0",
|
|
92
96
|
"@xterm/addon-web-links": "^0.11.0",
|
|
97
|
+
"@xterm/addon-webgl": "^0.18.0",
|
|
93
98
|
"@xterm/xterm": "^5.5.0",
|
|
94
99
|
"esbuild": "^0.25.8",
|
|
95
100
|
"eslint": "^9.32.0",
|