@industry-theme/xterm-terminal-panel 0.9.0 → 0.9.1

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
@@ -38,7 +38,7 @@ import {
38
38
  // package.json
39
39
  var package_default = {
40
40
  name: "@industry-theme/xterm-terminal-panel",
41
- version: "0.9.0",
41
+ version: "0.9.1",
42
42
  description: "Industry-themed xterm.js terminal components with panel framework integration",
43
43
  type: "module",
44
44
  sideEffects: [
@@ -1650,6 +1650,9 @@ var GhosttyRenderer = forwardRef4(
1650
1650
  const termRef = useRef3(null);
1651
1651
  const fitRef = useRef3(null);
1652
1652
  const readyRef = useRef3(false);
1653
+ const pendingWritesRef = useRef3([]);
1654
+ const autoFocusRef = useRef3(autoFocus);
1655
+ autoFocusRef.current = autoFocus;
1653
1656
  const callbacks = useRef3({ onData, onResize, onReady, onScrollPositionChange, onShortcut });
1654
1657
  callbacks.current = { onData, onResize, onReady, onScrollPositionChange, onShortcut };
1655
1658
  const readScrollPosition = useCallback2(() => {
@@ -1677,6 +1680,14 @@ var GhosttyRenderer = forwardRef4(
1677
1680
  }
1678
1681
  }
1679
1682
  }, []);
1683
+ const write = useCallback2((data) => {
1684
+ const term = termRef.current;
1685
+ if (term) {
1686
+ term.write(data);
1687
+ } else {
1688
+ pendingWritesRef.current.push(data);
1689
+ }
1690
+ }, []);
1680
1691
  useEffect2(() => {
1681
1692
  const container = containerRef.current;
1682
1693
  if (!container) return;
@@ -1725,7 +1736,12 @@ var GhosttyRenderer = forwardRef4(
1725
1736
  return false;
1726
1737
  });
1727
1738
  fit();
1728
- if (autoFocus) term.focus();
1739
+ if (pendingWritesRef.current.length > 0) {
1740
+ const pending = pendingWritesRef.current;
1741
+ pendingWritesRef.current = [];
1742
+ for (const chunk of pending) term.write(chunk);
1743
+ }
1744
+ if (autoFocusRef.current) term.focus();
1729
1745
  };
1730
1746
  init2();
1731
1747
  return () => {
@@ -1743,7 +1759,6 @@ var GhosttyRenderer = forwardRef4(
1743
1759
  scrollback,
1744
1760
  transparent,
1745
1761
  backgroundColor,
1746
- autoFocus,
1747
1762
  theme.colors.background,
1748
1763
  theme.colors.text,
1749
1764
  theme.fonts.monospace,
@@ -1758,12 +1773,16 @@ var GhosttyRenderer = forwardRef4(
1758
1773
  return () => observer.disconnect();
1759
1774
  }, [fit]);
1760
1775
  useEffect2(() => {
1761
- if (isVisible) fit();
1776
+ if (!isVisible) return;
1777
+ fit();
1762
1778
  }, [isVisible, fit]);
1779
+ useEffect2(() => {
1780
+ if (isVisible && autoFocus) termRef.current?.focus();
1781
+ }, [isVisible, autoFocus]);
1763
1782
  useImperativeHandle3(
1764
1783
  ref,
1765
1784
  () => ({
1766
- write: (data) => termRef.current?.write(data),
1785
+ write,
1767
1786
  clear: () => termRef.current?.clear(),
1768
1787
  focus: () => termRef.current?.focus(),
1769
1788
  blur: () => termRef.current?.blur(),
@@ -1778,7 +1797,7 @@ var GhosttyRenderer = forwardRef4(
1778
1797
  },
1779
1798
  getScrollPosition: readScrollPosition
1780
1799
  }),
1781
- [fit, readScrollPosition]
1800
+ [fit, readScrollPosition, write]
1782
1801
  );
1783
1802
  return /* @__PURE__ */ jsx6(
1784
1803
  "div",
@@ -1 +1 @@
1
- {"version":3,"file":"GhosttyRenderer.d.ts","sourceRoot":"","sources":["../../../src/renderer/GhosttyRenderer.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAO5B,MAAM,WAAW,oBAAqB,SAAQ,qBAAqB;IACjE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,GAAG,WAAW,GAAG,KAAK,CAAC;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAeD,eAAO,MAAM,eAAe,yHA0M3B,CAAC"}
1
+ {"version":3,"file":"GhosttyRenderer.d.ts","sourceRoot":"","sources":["../../../src/renderer/GhosttyRenderer.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAO5B,MAAM,WAAW,oBAAqB,SAAQ,qBAAqB;IACjE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,GAAG,WAAW,GAAG,KAAK,CAAC;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAuBD,eAAO,MAAM,eAAe,yHA0O3B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@industry-theme/xterm-terminal-panel",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "Industry-themed xterm.js terminal components with panel framework integration",
5
5
  "type": "module",
6
6
  "sideEffects": [