@industry-theme/xterm-terminal-panel 0.1.3 → 0.1.5

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
@@ -1049,7 +1049,8 @@ import React, {
1049
1049
  useRef as useRef3
1050
1050
  } from "react";
1051
1051
  import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
1052
- var TerminalTabContentInner = ({ tab, sessionId, isActive, isVisible, actions, terminalContext, onSessionCreated, onScrollPositionChange, isForeign = false }, ref) => {
1052
+ function TerminalTabContentInner(props, ref) {
1053
+ const { tab, sessionId, isActive, isVisible, actions, terminalContext, onSessionCreated, onScrollPositionChange, isForeign = false } = props;
1053
1054
  const terminalRef = useRef3(null);
1054
1055
  const [localSessionId, setLocalSessionId] = useState3(sessionId);
1055
1056
  const [isInitialized, setIsInitialized] = useState3(false);
@@ -1249,8 +1250,26 @@ var TerminalTabContentInner = ({ tab, sessionId, isActive, isVisible, actions, t
1249
1250
  overlayState
1250
1251
  }, shouldRenderTerminal ? "active" : "overlay")
1251
1252
  });
1253
+ }
1254
+ var areTerminalTabContentPropsEqual = (prevProps, nextProps) => {
1255
+ const tabEqual = prevProps.tab.id === nextProps.tab.id && prevProps.tab.directory === nextProps.tab.directory && prevProps.tab.isActive === nextProps.tab.isActive && prevProps.tab.label === nextProps.tab.label;
1256
+ const changes = [];
1257
+ if (!tabEqual)
1258
+ changes.push("tab");
1259
+ if (prevProps.sessionId !== nextProps.sessionId)
1260
+ changes.push("sessionId");
1261
+ if (prevProps.isActive !== nextProps.isActive)
1262
+ changes.push("isActive");
1263
+ if (prevProps.isVisible !== nextProps.isVisible)
1264
+ changes.push("isVisible");
1265
+ if (prevProps.terminalContext !== nextProps.terminalContext)
1266
+ changes.push("terminalContext");
1267
+ if (prevProps.isForeign !== nextProps.isForeign)
1268
+ changes.push("isForeign");
1269
+ return changes.length === 0;
1252
1270
  };
1253
- var TerminalTabContent = React.memo(React.forwardRef(TerminalTabContentInner));
1271
+ var TerminalTabContentForwarded = React.forwardRef(TerminalTabContentInner);
1272
+ var TerminalTabContent = React.memo(TerminalTabContentForwarded, areTerminalTabContentPropsEqual);
1254
1273
  TerminalTabContent.displayName = "TerminalTabContent";
1255
1274
  var TabbedTerminalPanelInner = ({
1256
1275
  context: _context,
@@ -1288,6 +1307,21 @@ var TabbedTerminalPanelInner = ({
1288
1307
  return [...labeledOwnedTabs, ...sortedForeignTabs];
1289
1308
  }, [ownedTabs, foreignTabs, getOwnedTabLabel]);
1290
1309
  const tabRefsMap = useRef3(new Map);
1310
+ const refCallbacksMap = useRef3(new Map);
1311
+ const getRefCallback = useCallback((tabId) => {
1312
+ let callback = refCallbacksMap.current.get(tabId);
1313
+ if (!callback) {
1314
+ callback = (ref) => {
1315
+ if (ref) {
1316
+ tabRefsMap.current.set(tabId, ref);
1317
+ } else {
1318
+ tabRefsMap.current.delete(tabId);
1319
+ }
1320
+ };
1321
+ refCallbacksMap.current.set(tabId, callback);
1322
+ }
1323
+ return callback;
1324
+ }, []);
1291
1325
  const hasInitializedRef = useRef3(false);
1292
1326
  const isCreatingTabRef = useRef3(false);
1293
1327
  const headerRef = useRef3(null);
@@ -1748,13 +1782,7 @@ var TabbedTerminalPanelInner = ({
1748
1782
  },
1749
1783
  children: [
1750
1784
  tabs.map((tab) => /* @__PURE__ */ jsx4(TerminalTabContent, {
1751
- ref: (ref) => {
1752
- if (ref) {
1753
- tabRefsMap.current.set(tab.id, ref);
1754
- } else {
1755
- tabRefsMap.current.delete(tab.id);
1756
- }
1757
- },
1785
+ ref: getRefCallback(tab.id),
1758
1786
  tab,
1759
1787
  sessionId: sessionIds.get(tab.id) || null,
1760
1788
  isActive: tab.id === activeTabId,
@@ -1806,7 +1834,28 @@ var TabbedTerminalPanelInner = ({
1806
1834
  };
1807
1835
  TabbedTerminalPanelInner.displayName = "TabbedTerminalPanelInner";
1808
1836
  var TabbedTerminalPanel = React.memo(TabbedTerminalPanelInner, (prevProps, nextProps) => {
1809
- return prevProps.terminalContext === nextProps.terminalContext && prevProps.directory === nextProps.directory && prevProps.hideHeader === nextProps.hideHeader && prevProps.isVisible === nextProps.isVisible && prevProps.showAllTerminals === nextProps.showAllTerminals && prevProps.tabLabelPrefix === nextProps.tabLabelPrefix && prevProps.actions === nextProps.actions && prevProps.onTabsChange === nextProps.onTabsChange && prevProps.onShowAllTerminalsChange === nextProps.onShowAllTerminalsChange && prevProps.initialTabs === nextProps.initialTabs;
1837
+ const changes = [];
1838
+ if (prevProps.terminalContext !== nextProps.terminalContext)
1839
+ changes.push("terminalContext");
1840
+ if (prevProps.directory !== nextProps.directory)
1841
+ changes.push("directory");
1842
+ if (prevProps.hideHeader !== nextProps.hideHeader)
1843
+ changes.push("hideHeader");
1844
+ if (prevProps.isVisible !== nextProps.isVisible)
1845
+ changes.push("isVisible");
1846
+ if (prevProps.showAllTerminals !== nextProps.showAllTerminals)
1847
+ changes.push("showAllTerminals");
1848
+ if (prevProps.tabLabelPrefix !== nextProps.tabLabelPrefix)
1849
+ changes.push("tabLabelPrefix");
1850
+ if (prevProps.actions !== nextProps.actions)
1851
+ changes.push("actions");
1852
+ if (prevProps.onTabsChange !== nextProps.onTabsChange)
1853
+ changes.push("onTabsChange");
1854
+ if (prevProps.onShowAllTerminalsChange !== nextProps.onShowAllTerminalsChange)
1855
+ changes.push("onShowAllTerminalsChange");
1856
+ if (prevProps.initialTabs !== nextProps.initialTabs)
1857
+ changes.push("initialTabs");
1858
+ return changes.length === 0;
1810
1859
  });
1811
1860
  TabbedTerminalPanel.displayName = "TabbedTerminalPanel";
1812
1861
  // src/tools/index.ts
@@ -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;AA6/BD,eAAO,MAAM,mBAAmB,sDAgB9B,CAAC"}
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;AAsiCD,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",
3
+ "version": "0.1.5",
4
4
  "description": "Industry-themed xterm.js terminal components with panel framework integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",