@industry-theme/xterm-terminal-panel 0.2.4 → 0.2.6

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
@@ -1695,6 +1695,28 @@ var TabbedTerminalPanelInner = ({
1695
1695
  const [activeTabId, setActiveTabId] = useState4(null);
1696
1696
  const [sessionIds, setSessionIds] = useState4(new Map);
1697
1697
  const [scrollPositions, setScrollPositions] = useState4(new Map);
1698
+ const customTabsKey = React2.useMemo(() => {
1699
+ return initialTabs.filter((tab) => tab.contentType !== "terminal").map((tab) => tab.id).sort().join(",");
1700
+ }, [initialTabs]);
1701
+ useEffect4(() => {
1702
+ const customTabsFromProp = initialTabs.filter((tab) => tab.contentType !== "terminal");
1703
+ setOwnedTabs((prevTabs) => {
1704
+ const existingTerminalTabs = prevTabs.filter((tab) => tab.contentType === "terminal");
1705
+ const customTabIds = new Set(customTabsFromProp.map((t) => t.id));
1706
+ const existingCustomTabs = prevTabs.filter((tab) => tab.contentType !== "terminal" && !customTabIds.has(tab.id));
1707
+ const mergedTabs = [
1708
+ ...existingTerminalTabs,
1709
+ ...existingCustomTabs,
1710
+ ...customTabsFromProp
1711
+ ];
1712
+ const prevCustomTabs = prevTabs.filter((tab) => tab.contentType !== "terminal");
1713
+ const customTabsChanged = prevCustomTabs.length !== customTabsFromProp.length || !customTabsFromProp.every((tab) => prevCustomTabs.some((prev) => prev.id === tab.id));
1714
+ if (!customTabsChanged) {
1715
+ return prevTabs;
1716
+ }
1717
+ return mergedTabs;
1718
+ });
1719
+ }, [customTabsKey]);
1698
1720
  const getOwnedTabLabel = useCallback2((index, _directory) => {
1699
1721
  if (tabLabelPrefix) {
1700
1722
  return `${tabLabelPrefix} ${index + 1}`;
@@ -1 +1 @@
1
- {"version":3,"file":"TabbedTerminalPanel.d.ts","sourceRoot":"","sources":["../../../src/panels/TabbedTerminalPanel.tsx"],"names":[],"mappings":"AAGA,OAAO,KAKN,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,EACV,wBAAwB,EACxB,WAAW,EAIZ,MAAM,gBAAgB,CAAC;AAyBxB,MAAM,WAAW,qBAAqB;IACpC,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAC9B;AAohCD,eAAO,MAAM,mBAAmB,EAAkC,CAAC,IAAI,SAAS,OAAO,cAAc,EAAE,OAAO,GAAG,WAAW,EAC1H,KAAK,EAAE,wBAAwB,CAAC,IAAI,CAAC,KAClC,KAAK,CAAC,YAAY,CAAC"}
1
+ {"version":3,"file":"TabbedTerminalPanel.d.ts","sourceRoot":"","sources":["../../../src/panels/TabbedTerminalPanel.tsx"],"names":[],"mappings":"AAGA,OAAO,KAKN,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,EACV,wBAAwB,EACxB,WAAW,EAIZ,MAAM,gBAAgB,CAAC;AAyBxB,MAAM,WAAW,qBAAqB;IACpC,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAC9B;AAokCD,eAAO,MAAM,mBAAmB,EAAkC,CAAC,IAAI,SAAS,OAAO,cAAc,EAAE,OAAO,GAAG,WAAW,EAC1H,KAAK,EAAE,wBAAwB,CAAC,IAAI,CAAC,KAClC,KAAK,CAAC,YAAY,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@industry-theme/xterm-terminal-panel",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "Industry-themed xterm.js terminal components with panel framework integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",