@industry-theme/xterm-terminal-panel 0.5.32 → 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.32",
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,20 +1789,25 @@ 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
- dataPortRef.current = port;
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
  }
@@ -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,CAobtD,CAAC"}
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@industry-theme/xterm-terminal-panel",
3
- "version": "0.5.32",
3
+ "version": "0.5.33",
4
4
  "description": "Industry-themed xterm.js terminal components with panel framework integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",