@industry-theme/xterm-terminal-panel 0.2.5 → 0.2.7

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,9 @@ 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]);
1698
1701
  useEffect4(() => {
1699
1702
  const customTabsFromProp = initialTabs.filter((tab) => tab.contentType !== "terminal");
1700
1703
  setOwnedTabs((prevTabs) => {
@@ -1711,9 +1714,15 @@ var TabbedTerminalPanelInner = ({
1711
1714
  if (!customTabsChanged) {
1712
1715
  return prevTabs;
1713
1716
  }
1717
+ const prevCustomTabIds = new Set(prevCustomTabs.map((t) => t.id));
1718
+ const newlyAddedTabs = customTabsFromProp.filter((tab) => !prevCustomTabIds.has(tab.id));
1719
+ if (newlyAddedTabs.length > 0) {
1720
+ const newTabToActivate = newlyAddedTabs[newlyAddedTabs.length - 1];
1721
+ setActiveTabId(newTabToActivate.id);
1722
+ }
1714
1723
  return mergedTabs;
1715
1724
  });
1716
- }, [initialTabs]);
1725
+ }, [customTabsKey]);
1717
1726
  const getOwnedTabLabel = useCallback2((index, _directory) => {
1718
1727
  if (tabLabelPrefix) {
1719
1728
  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;AA0jCD,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;AA8kCD,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.5",
3
+ "version": "0.2.7",
4
4
  "description": "Industry-themed xterm.js terminal components with panel framework integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",