@industry-theme/xterm-terminal-panel 0.5.31 → 0.5.33
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
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
// package.json
|
|
36
36
|
var package_default = {
|
|
37
37
|
name: "@industry-theme/xterm-terminal-panel",
|
|
38
|
-
version: "0.5.
|
|
38
|
+
version: "0.5.33",
|
|
39
39
|
description: "Industry-themed xterm.js terminal components with panel framework integration",
|
|
40
40
|
type: "module",
|
|
41
41
|
main: "dist/index.js",
|
|
@@ -1767,9 +1767,19 @@ var TerminalPanel = ({
|
|
|
1767
1767
|
const isScrollLockedRef = useRef2(scrollPosition.isScrollLocked);
|
|
1768
1768
|
const terminalDirectory = getTerminalDirectory(context2, terminalScope);
|
|
1769
1769
|
const pendingSessionIdRef = useRef2(null);
|
|
1770
|
+
const pendingPortEventsRef = useRef2([]);
|
|
1770
1771
|
useEffect3(() => {
|
|
1771
1772
|
let mounted = true;
|
|
1772
1773
|
let unsubscribePortReady = null;
|
|
1774
|
+
const adoptPort = (port) => {
|
|
1775
|
+
dataPortRef.current = port;
|
|
1776
|
+
if (typeof port.start === "function") {
|
|
1777
|
+
port.start();
|
|
1778
|
+
}
|
|
1779
|
+
if (mounted) {
|
|
1780
|
+
setUsingMessagePort(true);
|
|
1781
|
+
}
|
|
1782
|
+
};
|
|
1773
1783
|
const initTerminal = async () => {
|
|
1774
1784
|
try {
|
|
1775
1785
|
if (!actions.createTerminalSession) {
|
|
@@ -1779,23 +1789,35 @@ var TerminalPanel = ({
|
|
|
1779
1789
|
throw new Error("MessagePort support not available. Host must provide onTerminalPortReady action.");
|
|
1780
1790
|
}
|
|
1781
1791
|
unsubscribePortReady = actions.onTerminalPortReady((data, port) => {
|
|
1792
|
+
if (pendingSessionIdRef.current === null) {
|
|
1793
|
+
pendingPortEventsRef.current.push({ data, port });
|
|
1794
|
+
return;
|
|
1795
|
+
}
|
|
1782
1796
|
if (data.sessionId === pendingSessionIdRef.current || data.sessionId === sessionId) {
|
|
1783
|
-
|
|
1784
|
-
if (typeof port.start === "function") {
|
|
1785
|
-
port.start();
|
|
1786
|
-
}
|
|
1787
|
-
if (mounted) {
|
|
1788
|
-
setUsingMessagePort(true);
|
|
1789
|
-
}
|
|
1797
|
+
adoptPort(port);
|
|
1790
1798
|
}
|
|
1791
1799
|
});
|
|
1792
1800
|
const id = await actions.createTerminalSession({
|
|
1793
1801
|
cwd: terminalDirectory || undefined
|
|
1794
1802
|
});
|
|
1795
1803
|
pendingSessionIdRef.current = id;
|
|
1804
|
+
const buffered = pendingPortEventsRef.current;
|
|
1805
|
+
pendingPortEventsRef.current = [];
|
|
1806
|
+
for (const evt of buffered) {
|
|
1807
|
+
if (evt.data.sessionId === id && !dataPortRef.current) {
|
|
1808
|
+
adoptPort(evt.port);
|
|
1809
|
+
}
|
|
1810
|
+
}
|
|
1796
1811
|
if (actions.claimTerminalOwnership) {
|
|
1797
1812
|
await actions.claimTerminalOwnership(id);
|
|
1798
1813
|
}
|
|
1814
|
+
if (!dataPortRef.current && actions.requestTerminalDataPort) {
|
|
1815
|
+
try {
|
|
1816
|
+
await actions.requestTerminalDataPort(id);
|
|
1817
|
+
} catch (portErr) {
|
|
1818
|
+
console.warn("[TerminalPanel] requestTerminalDataPort failed:", portErr);
|
|
1819
|
+
}
|
|
1820
|
+
}
|
|
1799
1821
|
if (mounted) {
|
|
1800
1822
|
setSessionId(id);
|
|
1801
1823
|
setIsInitializing(false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TerminalPanel.d.ts","sourceRoot":"","sources":["../../../src/panels/TerminalPanel.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAiB,MAAM,gBAAgB,CAAC;AAqBxE,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"TerminalPanel.d.ts","sourceRoot":"","sources":["../../../src/panels/TerminalPanel.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAiB,MAAM,gBAAgB,CAAC;AAqBxE,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAgdtD,CAAC"}
|
package/package.json
CHANGED