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

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
@@ -1698,6 +1698,7 @@ var TabbedTerminalPanelInner = ({
1698
1698
  const customTabsKey = React2.useMemo(() => {
1699
1699
  return initialTabs.filter((tab) => tab.contentType !== "terminal").map((tab) => tab.id).sort().join(",");
1700
1700
  }, [initialTabs]);
1701
+ const tabToActivateRef = useRef3(null);
1701
1702
  useEffect4(() => {
1702
1703
  const customTabsFromProp = initialTabs.filter((tab) => tab.contentType !== "terminal");
1703
1704
  setOwnedTabs((prevTabs) => {
@@ -1714,9 +1715,21 @@ var TabbedTerminalPanelInner = ({
1714
1715
  if (!customTabsChanged) {
1715
1716
  return prevTabs;
1716
1717
  }
1718
+ const prevCustomTabIds = new Set(prevCustomTabs.map((t) => t.id));
1719
+ const newlyAddedTabs = customTabsFromProp.filter((tab) => !prevCustomTabIds.has(tab.id));
1720
+ if (newlyAddedTabs.length > 0) {
1721
+ const newTabToActivate = newlyAddedTabs[newlyAddedTabs.length - 1];
1722
+ tabToActivateRef.current = newTabToActivate.id;
1723
+ }
1717
1724
  return mergedTabs;
1718
1725
  });
1719
1726
  }, [customTabsKey]);
1727
+ useEffect4(() => {
1728
+ if (tabToActivateRef.current) {
1729
+ setActiveTabId(tabToActivateRef.current);
1730
+ tabToActivateRef.current = null;
1731
+ }
1732
+ }, [customTabsKey]);
1720
1733
  const getOwnedTabLabel = useCallback2((index, _directory) => {
1721
1734
  if (tabLabelPrefix) {
1722
1735
  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;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"}
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;AAylCD,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.6",
3
+ "version": "0.2.8",
4
4
  "description": "Industry-themed xterm.js terminal components with panel framework integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",