@industry-theme/xterm-terminal-panel 0.5.35 → 0.6.0
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.css +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +678 -177
- package/dist/src/components/TerminalOverlay.d.ts +8 -0
- package/dist/src/components/TerminalOverlay.d.ts.map +1 -0
- package/dist/src/components/TerminalSession.d.ts +43 -0
- package/dist/src/components/TerminalSession.d.ts.map +1 -0
- package/dist/src/renderer/TerminalRenderer.d.ts +34 -0
- package/dist/src/renderer/TerminalRenderer.d.ts.map +1 -0
- package/dist/src/renderer/XtermRenderer.d.ts +14 -0
- package/dist/src/renderer/XtermRenderer.d.ts.map +1 -0
- package/dist/styles.css +5 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
// package.json
|
|
36
36
|
var package_default = {
|
|
37
37
|
name: "@industry-theme/xterm-terminal-panel",
|
|
38
|
-
version: "0.
|
|
38
|
+
version: "0.6.0",
|
|
39
39
|
description: "Industry-themed xterm.js terminal components with panel framework integration",
|
|
40
40
|
type: "module",
|
|
41
41
|
main: "dist/index.js",
|
|
@@ -1281,11 +1281,509 @@ var ThemedTerminalWithProvider = forwardRef2((props, ref) => {
|
|
|
1281
1281
|
});
|
|
1282
1282
|
});
|
|
1283
1283
|
ThemedTerminalWithProvider.displayName = "ThemedTerminalWithProvider";
|
|
1284
|
-
// src/
|
|
1284
|
+
// src/renderer/XtermRenderer.tsx
|
|
1285
|
+
import { forwardRef as forwardRef3, useImperativeHandle as useImperativeHandle2, useRef as useRef2 } from "react";
|
|
1286
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
1287
|
+
var XtermRenderer = forwardRef3((props, ref) => {
|
|
1288
|
+
const { transparent, ...rest } = props;
|
|
1289
|
+
const innerRef = useRef2(null);
|
|
1290
|
+
useImperativeHandle2(ref, () => ({
|
|
1291
|
+
write: (data) => innerRef.current?.write(data),
|
|
1292
|
+
clear: () => innerRef.current?.clear(),
|
|
1293
|
+
focus: () => innerRef.current?.focus(),
|
|
1294
|
+
blur: () => innerRef.current?.blur(),
|
|
1295
|
+
fit: () => innerRef.current?.fit(),
|
|
1296
|
+
resize: (cols, rows) => innerRef.current?.resize(cols, rows),
|
|
1297
|
+
scrollToBottom: () => innerRef.current?.scrollToBottom(),
|
|
1298
|
+
scrollLines: (delta) => {
|
|
1299
|
+
innerRef.current?.getTerminal()?.scrollLines(delta);
|
|
1300
|
+
},
|
|
1301
|
+
getDimensions: () => {
|
|
1302
|
+
const term = innerRef.current?.getTerminal();
|
|
1303
|
+
if (!term || !term.cols || !term.rows)
|
|
1304
|
+
return null;
|
|
1305
|
+
return { cols: term.cols, rows: term.rows };
|
|
1306
|
+
},
|
|
1307
|
+
getScrollPosition: () => innerRef.current?.getScrollPosition() ?? {
|
|
1308
|
+
isAtTop: false,
|
|
1309
|
+
isAtBottom: true,
|
|
1310
|
+
isScrollLocked: false
|
|
1311
|
+
},
|
|
1312
|
+
isScrollLocked: () => innerRef.current?.isScrollLocked() ?? false
|
|
1313
|
+
}), []);
|
|
1314
|
+
return /* @__PURE__ */ jsx4(ThemedTerminalWithProvider, {
|
|
1315
|
+
ref: innerRef,
|
|
1316
|
+
...rest,
|
|
1317
|
+
hideHeader: true,
|
|
1318
|
+
activityDetection: false,
|
|
1319
|
+
allowTransparency: transparent
|
|
1320
|
+
});
|
|
1321
|
+
});
|
|
1322
|
+
XtermRenderer.displayName = "XtermRenderer";
|
|
1323
|
+
// src/components/TerminalSession.tsx
|
|
1285
1324
|
import { useTheme as useTheme2 } from "@principal-ade/industry-theme";
|
|
1325
|
+
import {
|
|
1326
|
+
forwardRef as forwardRef4,
|
|
1327
|
+
useCallback as useCallback2,
|
|
1328
|
+
useEffect as useEffect2,
|
|
1329
|
+
useImperativeHandle as useImperativeHandle3,
|
|
1330
|
+
useRef as useRef3,
|
|
1331
|
+
useState as useState2
|
|
1332
|
+
} from "react";
|
|
1333
|
+
|
|
1334
|
+
// src/components/TerminalOverlay.tsx
|
|
1335
|
+
import { Monitor as Monitor2 } from "lucide-react";
|
|
1336
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1337
|
+
var TerminalOverlay = ({ state, theme }) => /* @__PURE__ */ jsxs3("div", {
|
|
1338
|
+
style: {
|
|
1339
|
+
position: "absolute",
|
|
1340
|
+
top: 0,
|
|
1341
|
+
left: 0,
|
|
1342
|
+
right: 0,
|
|
1343
|
+
bottom: 0,
|
|
1344
|
+
display: "flex",
|
|
1345
|
+
flexDirection: "column",
|
|
1346
|
+
alignItems: "center",
|
|
1347
|
+
justifyContent: "center",
|
|
1348
|
+
backgroundColor: theme.colors.background,
|
|
1349
|
+
opacity: state.opacity ?? 1,
|
|
1350
|
+
gap: "16px",
|
|
1351
|
+
padding: "32px",
|
|
1352
|
+
zIndex: 10
|
|
1353
|
+
},
|
|
1354
|
+
children: [
|
|
1355
|
+
/* @__PURE__ */ jsx5(Monitor2, {
|
|
1356
|
+
size: 48,
|
|
1357
|
+
color: theme.colors.textSecondary
|
|
1358
|
+
}),
|
|
1359
|
+
/* @__PURE__ */ jsx5("div", {
|
|
1360
|
+
style: {
|
|
1361
|
+
fontSize: "16px",
|
|
1362
|
+
fontWeight: "500",
|
|
1363
|
+
color: theme.colors.text,
|
|
1364
|
+
textAlign: "center"
|
|
1365
|
+
},
|
|
1366
|
+
children: state.message
|
|
1367
|
+
}),
|
|
1368
|
+
state.subtitle && /* @__PURE__ */ jsx5("div", {
|
|
1369
|
+
style: {
|
|
1370
|
+
fontSize: "14px",
|
|
1371
|
+
color: theme.colors.textSecondary,
|
|
1372
|
+
textAlign: "center",
|
|
1373
|
+
maxWidth: "400px"
|
|
1374
|
+
},
|
|
1375
|
+
children: state.subtitle
|
|
1376
|
+
}),
|
|
1377
|
+
state.actions && state.actions.length > 0 && /* @__PURE__ */ jsx5("div", {
|
|
1378
|
+
style: {
|
|
1379
|
+
display: "flex",
|
|
1380
|
+
gap: "12px",
|
|
1381
|
+
marginTop: "8px"
|
|
1382
|
+
},
|
|
1383
|
+
children: state.actions.map((action) => /* @__PURE__ */ jsxs3("button", {
|
|
1384
|
+
type: "button",
|
|
1385
|
+
onClick: action.onClick,
|
|
1386
|
+
style: {
|
|
1387
|
+
padding: "8px 16px",
|
|
1388
|
+
backgroundColor: action.primary ? theme.colors.primary : "transparent",
|
|
1389
|
+
color: action.primary ? "#ffffff" : theme.colors.text,
|
|
1390
|
+
border: action.primary ? "none" : `1px solid ${theme.colors.border}`,
|
|
1391
|
+
borderRadius: "6px",
|
|
1392
|
+
cursor: "pointer",
|
|
1393
|
+
fontSize: "14px",
|
|
1394
|
+
fontWeight: "500",
|
|
1395
|
+
display: "flex",
|
|
1396
|
+
alignItems: "center",
|
|
1397
|
+
gap: "8px",
|
|
1398
|
+
transition: "all 0.2s"
|
|
1399
|
+
},
|
|
1400
|
+
onMouseEnter: (e) => {
|
|
1401
|
+
if (action.primary) {
|
|
1402
|
+
e.currentTarget.style.opacity = "0.8";
|
|
1403
|
+
} else {
|
|
1404
|
+
e.currentTarget.style.backgroundColor = theme.colors.backgroundSecondary;
|
|
1405
|
+
}
|
|
1406
|
+
},
|
|
1407
|
+
onMouseLeave: (e) => {
|
|
1408
|
+
if (action.primary) {
|
|
1409
|
+
e.currentTarget.style.opacity = "1";
|
|
1410
|
+
} else {
|
|
1411
|
+
e.currentTarget.style.backgroundColor = "transparent";
|
|
1412
|
+
}
|
|
1413
|
+
},
|
|
1414
|
+
children: [
|
|
1415
|
+
action.icon,
|
|
1416
|
+
action.label
|
|
1417
|
+
]
|
|
1418
|
+
}, action.label))
|
|
1419
|
+
})
|
|
1420
|
+
]
|
|
1421
|
+
});
|
|
1422
|
+
|
|
1423
|
+
// src/components/TerminalSession.tsx
|
|
1424
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1425
|
+
var TerminalSession = forwardRef4((props, ref) => {
|
|
1426
|
+
const {
|
|
1427
|
+
actions,
|
|
1428
|
+
renderer: Renderer = XtermRenderer,
|
|
1429
|
+
transparent,
|
|
1430
|
+
backgroundColor,
|
|
1431
|
+
defaultScrollLocked,
|
|
1432
|
+
autoFocus = true,
|
|
1433
|
+
isVisible = true,
|
|
1434
|
+
scrollback = 1e4,
|
|
1435
|
+
sessionId: sessionIdProp = null,
|
|
1436
|
+
onSessionCreated,
|
|
1437
|
+
cwd,
|
|
1438
|
+
command,
|
|
1439
|
+
sessionContext,
|
|
1440
|
+
persistOnUnmount = false,
|
|
1441
|
+
enableOwnership = false,
|
|
1442
|
+
isForeign = false,
|
|
1443
|
+
events,
|
|
1444
|
+
activityDetection = false,
|
|
1445
|
+
activityTimeout = 500,
|
|
1446
|
+
onActivityChange,
|
|
1447
|
+
onScrollPositionChange,
|
|
1448
|
+
onLinkClick,
|
|
1449
|
+
onShortcut,
|
|
1450
|
+
overlayState,
|
|
1451
|
+
isWorking = false,
|
|
1452
|
+
workingMessage,
|
|
1453
|
+
workingSubtitle
|
|
1454
|
+
} = props;
|
|
1455
|
+
const { theme } = useTheme2();
|
|
1456
|
+
const rendererRef = useRef3(null);
|
|
1457
|
+
const [localSessionId, setLocalSessionId] = useState2(sessionIdProp);
|
|
1458
|
+
const [isInitialized, setIsInitialized] = useState2(false);
|
|
1459
|
+
const hasInitializedRef = useRef3(false);
|
|
1460
|
+
const pendingSessionIdRef = useRef3(null);
|
|
1461
|
+
const [shouldRenderTerminal, setShouldRenderTerminal] = useState2(true);
|
|
1462
|
+
const [ownerWindowId, setOwnerWindowId] = useState2(null);
|
|
1463
|
+
const needsRefreshOnResizeRef = useRef3(false);
|
|
1464
|
+
const [scrollPosition, setScrollPosition] = useState2({
|
|
1465
|
+
isAtTop: false,
|
|
1466
|
+
isAtBottom: true,
|
|
1467
|
+
isScrollLocked: defaultScrollLocked ?? false
|
|
1468
|
+
});
|
|
1469
|
+
const isActiveRef = useRef3(false);
|
|
1470
|
+
const activityStartedAtRef = useRef3(0);
|
|
1471
|
+
const activityTimerRef = useRef3(null);
|
|
1472
|
+
const claimAndConnect = useCallback2(async (targetSessionId, force = false) => {
|
|
1473
|
+
if (!enableOwnership)
|
|
1474
|
+
return;
|
|
1475
|
+
try {
|
|
1476
|
+
if (actions.claimTerminalOwnership) {
|
|
1477
|
+
await actions.claimTerminalOwnership(targetSessionId, force);
|
|
1478
|
+
}
|
|
1479
|
+
if (force && actions.requestTerminalDataPort) {
|
|
1480
|
+
await actions.requestTerminalDataPort(targetSessionId);
|
|
1481
|
+
}
|
|
1482
|
+
setShouldRenderTerminal(true);
|
|
1483
|
+
setOwnerWindowId(null);
|
|
1484
|
+
if (force) {
|
|
1485
|
+
needsRefreshOnResizeRef.current = true;
|
|
1486
|
+
}
|
|
1487
|
+
} catch (error) {
|
|
1488
|
+
console.error("[TerminalSession] Failed to claim ownership:", error);
|
|
1489
|
+
throw error;
|
|
1490
|
+
}
|
|
1491
|
+
}, [actions, enableOwnership]);
|
|
1492
|
+
useEffect2(() => {
|
|
1493
|
+
if (hasInitializedRef.current)
|
|
1494
|
+
return;
|
|
1495
|
+
hasInitializedRef.current = true;
|
|
1496
|
+
let mounted = true;
|
|
1497
|
+
const init = async () => {
|
|
1498
|
+
try {
|
|
1499
|
+
if (sessionIdProp) {
|
|
1500
|
+
if (enableOwnership) {
|
|
1501
|
+
if (isForeign && actions.checkTerminalOwnership) {
|
|
1502
|
+
const status = await actions.checkTerminalOwnership(sessionIdProp);
|
|
1503
|
+
if (status.ownedByWindowId && !status.ownedByThisWindow) {
|
|
1504
|
+
setShouldRenderTerminal(false);
|
|
1505
|
+
setOwnerWindowId(status.ownedByWindowId);
|
|
1506
|
+
}
|
|
1507
|
+
} else {
|
|
1508
|
+
await claimAndConnect(sessionIdProp);
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
if (mounted) {
|
|
1512
|
+
setLocalSessionId(sessionIdProp);
|
|
1513
|
+
setIsInitialized(true);
|
|
1514
|
+
}
|
|
1515
|
+
return;
|
|
1516
|
+
}
|
|
1517
|
+
if (!actions.createTerminalSession) {
|
|
1518
|
+
if (mounted)
|
|
1519
|
+
setIsInitialized(true);
|
|
1520
|
+
return;
|
|
1521
|
+
}
|
|
1522
|
+
const newId = await actions.createTerminalSession({
|
|
1523
|
+
cwd,
|
|
1524
|
+
command,
|
|
1525
|
+
context: sessionContext
|
|
1526
|
+
});
|
|
1527
|
+
pendingSessionIdRef.current = newId;
|
|
1528
|
+
if (!mounted)
|
|
1529
|
+
return;
|
|
1530
|
+
if (enableOwnership) {
|
|
1531
|
+
await claimAndConnect(newId);
|
|
1532
|
+
}
|
|
1533
|
+
setLocalSessionId(newId);
|
|
1534
|
+
setIsInitialized(true);
|
|
1535
|
+
onSessionCreated?.(newId);
|
|
1536
|
+
} catch (err) {
|
|
1537
|
+
console.error("[TerminalSession] init failed:", err);
|
|
1538
|
+
if (mounted)
|
|
1539
|
+
setIsInitialized(true);
|
|
1540
|
+
}
|
|
1541
|
+
};
|
|
1542
|
+
init();
|
|
1543
|
+
return () => {
|
|
1544
|
+
mounted = false;
|
|
1545
|
+
if (!persistOnUnmount && pendingSessionIdRef.current && actions.destroyTerminalSession) {
|
|
1546
|
+
actions.destroyTerminalSession(pendingSessionIdRef.current);
|
|
1547
|
+
}
|
|
1548
|
+
};
|
|
1549
|
+
}, []);
|
|
1550
|
+
const observeActivity = useCallback2(() => {
|
|
1551
|
+
if (!activityDetection)
|
|
1552
|
+
return;
|
|
1553
|
+
const now = Date.now();
|
|
1554
|
+
const emitBus = (isWorking2) => {
|
|
1555
|
+
if (!events || !localSessionId)
|
|
1556
|
+
return;
|
|
1557
|
+
events.emit({
|
|
1558
|
+
type: "terminal:activity-changed",
|
|
1559
|
+
source: "TerminalSession",
|
|
1560
|
+
timestamp: Date.now(),
|
|
1561
|
+
payload: {
|
|
1562
|
+
sessionId: localSessionId,
|
|
1563
|
+
activityType: isWorking2 ? "started" : "stopped",
|
|
1564
|
+
isWorking: isWorking2
|
|
1565
|
+
}
|
|
1566
|
+
});
|
|
1567
|
+
};
|
|
1568
|
+
if (!isActiveRef.current) {
|
|
1569
|
+
isActiveRef.current = true;
|
|
1570
|
+
activityStartedAtRef.current = now;
|
|
1571
|
+
onActivityChange?.({ isActive: true, startedAt: now });
|
|
1572
|
+
emitBus(true);
|
|
1573
|
+
}
|
|
1574
|
+
if (activityTimerRef.current)
|
|
1575
|
+
clearTimeout(activityTimerRef.current);
|
|
1576
|
+
activityTimerRef.current = setTimeout(() => {
|
|
1577
|
+
if (isActiveRef.current) {
|
|
1578
|
+
isActiveRef.current = false;
|
|
1579
|
+
onActivityChange?.({
|
|
1580
|
+
isActive: false,
|
|
1581
|
+
duration: Date.now() - activityStartedAtRef.current
|
|
1582
|
+
});
|
|
1583
|
+
emitBus(false);
|
|
1584
|
+
}
|
|
1585
|
+
}, activityTimeout);
|
|
1586
|
+
}, [activityDetection, activityTimeout, onActivityChange, events, localSessionId]);
|
|
1587
|
+
useEffect2(() => {
|
|
1588
|
+
if (!localSessionId || !isInitialized || !shouldRenderTerminal)
|
|
1589
|
+
return;
|
|
1590
|
+
if (!actions.onTerminalData)
|
|
1591
|
+
return;
|
|
1592
|
+
const unsubscribe = actions.onTerminalData(localSessionId, (data) => {
|
|
1593
|
+
rendererRef.current?.write(data);
|
|
1594
|
+
observeActivity();
|
|
1595
|
+
});
|
|
1596
|
+
return () => {
|
|
1597
|
+
unsubscribe();
|
|
1598
|
+
};
|
|
1599
|
+
}, [localSessionId, isInitialized, shouldRenderTerminal, actions, observeActivity]);
|
|
1600
|
+
useEffect2(() => {
|
|
1601
|
+
return () => {
|
|
1602
|
+
if (activityTimerRef.current)
|
|
1603
|
+
clearTimeout(activityTimerRef.current);
|
|
1604
|
+
};
|
|
1605
|
+
}, []);
|
|
1606
|
+
const handleData = useCallback2((data) => {
|
|
1607
|
+
if (localSessionId && actions.writeToTerminal) {
|
|
1608
|
+
actions.writeToTerminal(localSessionId, data);
|
|
1609
|
+
}
|
|
1610
|
+
}, [localSessionId, actions]);
|
|
1611
|
+
const handleResize = useCallback2((cols, rows) => {
|
|
1612
|
+
if (localSessionId && actions.resizeTerminal) {
|
|
1613
|
+
actions.resizeTerminal(localSessionId, cols, rows);
|
|
1614
|
+
}
|
|
1615
|
+
}, [localSessionId, actions]);
|
|
1616
|
+
const handleReady = useCallback2((cols, rows) => {
|
|
1617
|
+
if (!localSessionId || !actions.resizeTerminal)
|
|
1618
|
+
return;
|
|
1619
|
+
const shouldForce = needsRefreshOnResizeRef.current;
|
|
1620
|
+
if (!shouldForce) {
|
|
1621
|
+
actions.resizeTerminal(localSessionId, cols, rows, false);
|
|
1622
|
+
return;
|
|
1623
|
+
}
|
|
1624
|
+
needsRefreshOnResizeRef.current = false;
|
|
1625
|
+
const restoreAndResize = async () => {
|
|
1626
|
+
let bufferRestored = false;
|
|
1627
|
+
if (actions.getTerminalBuffer && rendererRef.current) {
|
|
1628
|
+
try {
|
|
1629
|
+
const buffer = await actions.getTerminalBuffer(localSessionId);
|
|
1630
|
+
if (buffer) {
|
|
1631
|
+
rendererRef.current.write(buffer);
|
|
1632
|
+
bufferRestored = true;
|
|
1633
|
+
}
|
|
1634
|
+
} catch (err) {
|
|
1635
|
+
console.warn("[TerminalSession] Failed to restore buffer:", err);
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
actions.resizeTerminal(localSessionId, cols, rows, !bufferRestored);
|
|
1639
|
+
};
|
|
1640
|
+
restoreAndResize();
|
|
1641
|
+
}, [localSessionId, actions]);
|
|
1642
|
+
const handleLinkClickInternal = useCallback2((url, modifiers) => {
|
|
1643
|
+
onLinkClick?.(url, modifiers);
|
|
1644
|
+
if (localSessionId && events) {
|
|
1645
|
+
events.emit({
|
|
1646
|
+
type: "terminal:link-click",
|
|
1647
|
+
source: "TerminalSession",
|
|
1648
|
+
timestamp: Date.now(),
|
|
1649
|
+
payload: {
|
|
1650
|
+
url,
|
|
1651
|
+
sessionId: localSessionId,
|
|
1652
|
+
shiftKey: modifiers.shiftKey,
|
|
1653
|
+
metaKey: modifiers.metaKey,
|
|
1654
|
+
ctrlKey: modifiers.ctrlKey,
|
|
1655
|
+
altKey: modifiers.altKey
|
|
1656
|
+
}
|
|
1657
|
+
});
|
|
1658
|
+
}
|
|
1659
|
+
}, [localSessionId, events, onLinkClick]);
|
|
1660
|
+
const handleShortcutInternal = useCallback2((evt) => {
|
|
1661
|
+
onShortcut?.(evt);
|
|
1662
|
+
if (localSessionId && events) {
|
|
1663
|
+
events.emit({
|
|
1664
|
+
type: "terminal:shortcut",
|
|
1665
|
+
source: "TerminalSession",
|
|
1666
|
+
timestamp: Date.now(),
|
|
1667
|
+
payload: {
|
|
1668
|
+
shortcut: evt.shortcut,
|
|
1669
|
+
sessionId: localSessionId
|
|
1670
|
+
}
|
|
1671
|
+
});
|
|
1672
|
+
}
|
|
1673
|
+
}, [localSessionId, events, onShortcut]);
|
|
1674
|
+
const handleScrollPositionChangeInternal = useCallback2((p) => {
|
|
1675
|
+
setScrollPosition(p);
|
|
1676
|
+
onScrollPositionChange?.(p);
|
|
1677
|
+
}, [onScrollPositionChange]);
|
|
1678
|
+
useEffect2(() => {
|
|
1679
|
+
if (!enableOwnership)
|
|
1680
|
+
return;
|
|
1681
|
+
if (!localSessionId || !actions.onOwnershipLost)
|
|
1682
|
+
return;
|
|
1683
|
+
const unsubscribe = actions.onOwnershipLost((data) => {
|
|
1684
|
+
if (data.sessionId === localSessionId) {
|
|
1685
|
+
setShouldRenderTerminal(false);
|
|
1686
|
+
setOwnerWindowId(data.newOwnerWindowId);
|
|
1687
|
+
}
|
|
1688
|
+
});
|
|
1689
|
+
return () => {
|
|
1690
|
+
unsubscribe();
|
|
1691
|
+
};
|
|
1692
|
+
}, [enableOwnership, localSessionId, actions]);
|
|
1693
|
+
const handleTakeControl = useCallback2(async () => {
|
|
1694
|
+
if (!localSessionId)
|
|
1695
|
+
return;
|
|
1696
|
+
await claimAndConnect(localSessionId, true);
|
|
1697
|
+
}, [localSessionId, claimAndConnect]);
|
|
1698
|
+
useImperativeHandle3(ref, () => ({
|
|
1699
|
+
scrollToBottom: () => rendererRef.current?.scrollToBottom(),
|
|
1700
|
+
toggleScrollLock: () => {
|
|
1701
|
+
if (scrollPosition.isScrollLocked) {
|
|
1702
|
+
rendererRef.current?.scrollLines(-1);
|
|
1703
|
+
} else {
|
|
1704
|
+
rendererRef.current?.scrollToBottom();
|
|
1705
|
+
}
|
|
1706
|
+
},
|
|
1707
|
+
focus: () => rendererRef.current?.focus(),
|
|
1708
|
+
clear: () => rendererRef.current?.clear(),
|
|
1709
|
+
getSessionId: () => localSessionId
|
|
1710
|
+
}), [scrollPosition.isScrollLocked, localSessionId]);
|
|
1711
|
+
if (!isInitialized) {
|
|
1712
|
+
return /* @__PURE__ */ jsxs4("div", {
|
|
1713
|
+
style: {
|
|
1714
|
+
display: "flex",
|
|
1715
|
+
height: "100%",
|
|
1716
|
+
width: "100%",
|
|
1717
|
+
backgroundColor: transparent ? "transparent" : theme.colors.background,
|
|
1718
|
+
padding: "10px 0 0 10px"
|
|
1719
|
+
},
|
|
1720
|
+
children: [
|
|
1721
|
+
/* @__PURE__ */ jsx6("div", {
|
|
1722
|
+
style: {
|
|
1723
|
+
width: "8px",
|
|
1724
|
+
height: "17px",
|
|
1725
|
+
backgroundColor: theme.colors.text,
|
|
1726
|
+
animation: "terminal-session-cursor-blink 1s step-end infinite"
|
|
1727
|
+
}
|
|
1728
|
+
}),
|
|
1729
|
+
/* @__PURE__ */ jsx6("style", {
|
|
1730
|
+
children: `@keyframes terminal-session-cursor-blink {
|
|
1731
|
+
0%, 100% { opacity: 1; }
|
|
1732
|
+
50% { opacity: 0; }
|
|
1733
|
+
}`
|
|
1734
|
+
})
|
|
1735
|
+
]
|
|
1736
|
+
});
|
|
1737
|
+
}
|
|
1738
|
+
const ownershipLostOverlay = enableOwnership && !shouldRenderTerminal ? {
|
|
1739
|
+
message: "This terminal is active in another window",
|
|
1740
|
+
subtitle: ownerWindowId ? `Window ID: ${ownerWindowId}` : "Another window owns this terminal session",
|
|
1741
|
+
actions: [
|
|
1742
|
+
{
|
|
1743
|
+
label: "Take Control",
|
|
1744
|
+
onClick: handleTakeControl,
|
|
1745
|
+
primary: true
|
|
1746
|
+
}
|
|
1747
|
+
],
|
|
1748
|
+
opacity: 1
|
|
1749
|
+
} : undefined;
|
|
1750
|
+
const effectiveOverlay = ownershipLostOverlay ?? overlayState;
|
|
1751
|
+
return /* @__PURE__ */ jsxs4("div", {
|
|
1752
|
+
style: { position: "relative", height: "100%", width: "100%" },
|
|
1753
|
+
children: [
|
|
1754
|
+
/* @__PURE__ */ jsx6(Renderer, {
|
|
1755
|
+
ref: rendererRef,
|
|
1756
|
+
onData: shouldRenderTerminal ? handleData : undefined,
|
|
1757
|
+
onResize: shouldRenderTerminal ? handleResize : undefined,
|
|
1758
|
+
onReady: shouldRenderTerminal ? handleReady : undefined,
|
|
1759
|
+
onLinkClick: shouldRenderTerminal ? handleLinkClickInternal : undefined,
|
|
1760
|
+
onScrollPositionChange: shouldRenderTerminal ? handleScrollPositionChangeInternal : undefined,
|
|
1761
|
+
onShortcut: handleShortcutInternal,
|
|
1762
|
+
autoFocus: autoFocus && shouldRenderTerminal,
|
|
1763
|
+
isVisible,
|
|
1764
|
+
defaultScrollLocked,
|
|
1765
|
+
scrollback,
|
|
1766
|
+
transparent,
|
|
1767
|
+
backgroundColor
|
|
1768
|
+
}, shouldRenderTerminal ? "active" : "overlay"),
|
|
1769
|
+
effectiveOverlay && /* @__PURE__ */ jsx6(TerminalOverlay, {
|
|
1770
|
+
state: effectiveOverlay,
|
|
1771
|
+
theme
|
|
1772
|
+
}),
|
|
1773
|
+
isWorking && !effectiveOverlay && /* @__PURE__ */ jsx6(WorkingOverlay, {
|
|
1774
|
+
theme,
|
|
1775
|
+
message: workingMessage,
|
|
1776
|
+
subtitle: workingSubtitle
|
|
1777
|
+
})
|
|
1778
|
+
]
|
|
1779
|
+
});
|
|
1780
|
+
});
|
|
1781
|
+
TerminalSession.displayName = "TerminalSession";
|
|
1782
|
+
// src/hooks/useThemedTerminal.ts
|
|
1783
|
+
import { useTheme as useTheme3 } from "@principal-ade/industry-theme";
|
|
1286
1784
|
import { useMemo } from "react";
|
|
1287
1785
|
function useThemedTerminal() {
|
|
1288
|
-
const { theme } =
|
|
1786
|
+
const { theme } = useTheme3();
|
|
1289
1787
|
const terminalOptions = useMemo(() => ({
|
|
1290
1788
|
cursorBlink: true,
|
|
1291
1789
|
fontSize: 14,
|
|
@@ -1317,14 +1815,14 @@ function useThemedTerminal() {
|
|
|
1317
1815
|
};
|
|
1318
1816
|
}
|
|
1319
1817
|
// src/components/TabBar/TabBar.tsx
|
|
1320
|
-
import { useTheme as
|
|
1818
|
+
import { useTheme as useTheme5 } from "@principal-ade/industry-theme";
|
|
1321
1819
|
import { Plus } from "lucide-react";
|
|
1322
|
-
import { useState as
|
|
1820
|
+
import { useState as useState3, useCallback as useCallback4 } from "react";
|
|
1323
1821
|
|
|
1324
1822
|
// src/components/TabBar/TabButton.tsx
|
|
1325
|
-
import { useTheme as
|
|
1326
|
-
import { useCallback as
|
|
1327
|
-
import { jsx as
|
|
1823
|
+
import { useTheme as useTheme4 } from "@principal-ade/industry-theme";
|
|
1824
|
+
import { useCallback as useCallback3 } from "react";
|
|
1825
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1328
1826
|
var TabButton = ({
|
|
1329
1827
|
tab,
|
|
1330
1828
|
isActive,
|
|
@@ -1347,10 +1845,10 @@ var TabButton = ({
|
|
|
1347
1845
|
onDragLeave,
|
|
1348
1846
|
isBeingDragged: _isBeingDragged = false
|
|
1349
1847
|
}) => {
|
|
1350
|
-
const { theme } =
|
|
1848
|
+
const { theme } = useTheme4();
|
|
1351
1849
|
const showCloseButton = isHovered || isActive;
|
|
1352
1850
|
const closable = tab.closable !== false;
|
|
1353
|
-
const handleDragStart =
|
|
1851
|
+
const handleDragStart = useCallback3((e) => {
|
|
1354
1852
|
const target = e.currentTarget;
|
|
1355
1853
|
e.dataTransfer.setData("application/x-tab-association", tab.id);
|
|
1356
1854
|
e.dataTransfer.effectAllowed = "move";
|
|
@@ -1375,27 +1873,27 @@ var TabButton = ({
|
|
|
1375
1873
|
}
|
|
1376
1874
|
onDragStart?.(tab.id);
|
|
1377
1875
|
}, [tab.id, onDragStart]);
|
|
1378
|
-
const handleDragEnd =
|
|
1876
|
+
const handleDragEnd = useCallback3(() => {
|
|
1379
1877
|
onDragEnd?.();
|
|
1380
1878
|
}, [onDragEnd]);
|
|
1381
|
-
const handleDragOver =
|
|
1879
|
+
const handleDragOver = useCallback3((e) => {
|
|
1382
1880
|
if (canAcceptDrop) {
|
|
1383
1881
|
e.preventDefault();
|
|
1384
1882
|
e.dataTransfer.dropEffect = "move";
|
|
1385
1883
|
}
|
|
1386
1884
|
}, [canAcceptDrop]);
|
|
1387
|
-
const handleDrop =
|
|
1885
|
+
const handleDrop = useCallback3((e) => {
|
|
1388
1886
|
e.preventDefault();
|
|
1389
1887
|
const draggedTabId = e.dataTransfer.getData("application/x-tab-association");
|
|
1390
1888
|
if (draggedTabId && draggedTabId !== tab.id) {
|
|
1391
1889
|
onDrop?.(draggedTabId);
|
|
1392
1890
|
}
|
|
1393
1891
|
}, [tab.id, onDrop]);
|
|
1394
|
-
const handleDragEnter =
|
|
1892
|
+
const handleDragEnter = useCallback3((e) => {
|
|
1395
1893
|
e.preventDefault();
|
|
1396
1894
|
onDragEnter?.();
|
|
1397
1895
|
}, [onDragEnter]);
|
|
1398
|
-
const handleDragLeave =
|
|
1896
|
+
const handleDragLeave = useCallback3((e) => {
|
|
1399
1897
|
e.preventDefault();
|
|
1400
1898
|
onDragLeave?.();
|
|
1401
1899
|
}, [onDragLeave]);
|
|
@@ -1409,7 +1907,7 @@ var TabButton = ({
|
|
|
1409
1907
|
}
|
|
1410
1908
|
return {};
|
|
1411
1909
|
};
|
|
1412
|
-
return /* @__PURE__ */
|
|
1910
|
+
return /* @__PURE__ */ jsxs5("div", {
|
|
1413
1911
|
"data-tab-id": tab.id,
|
|
1414
1912
|
draggable,
|
|
1415
1913
|
onDragStart: draggable ? handleDragStart : undefined,
|
|
@@ -1445,7 +1943,7 @@ var TabButton = ({
|
|
|
1445
1943
|
...getDragOverStyles()
|
|
1446
1944
|
},
|
|
1447
1945
|
children: [
|
|
1448
|
-
closable && showCloseButton && /* @__PURE__ */
|
|
1946
|
+
closable && showCloseButton && /* @__PURE__ */ jsx7("button", {
|
|
1449
1947
|
onClick: (e) => {
|
|
1450
1948
|
e.stopPropagation();
|
|
1451
1949
|
onClose();
|
|
@@ -1477,7 +1975,7 @@ var TabButton = ({
|
|
|
1477
1975
|
(() => {
|
|
1478
1976
|
const icon = renderIcon ? renderIcon(tab) : undefined;
|
|
1479
1977
|
const displayIcon = icon !== undefined ? icon : tab.icon;
|
|
1480
|
-
return displayIcon ? /* @__PURE__ */
|
|
1978
|
+
return displayIcon ? /* @__PURE__ */ jsx7("div", {
|
|
1481
1979
|
style: { flexShrink: 0, display: "flex", alignItems: "center", pointerEvents: "none" },
|
|
1482
1980
|
children: displayIcon
|
|
1483
1981
|
}) : null;
|
|
@@ -1485,7 +1983,7 @@ var TabButton = ({
|
|
|
1485
1983
|
(() => {
|
|
1486
1984
|
const label = renderLabel ? renderLabel(tab) : undefined;
|
|
1487
1985
|
const displayLabel = label !== undefined ? label : tab.label;
|
|
1488
|
-
return /* @__PURE__ */
|
|
1986
|
+
return /* @__PURE__ */ jsx7("span", {
|
|
1489
1987
|
style: {
|
|
1490
1988
|
overflow: "hidden",
|
|
1491
1989
|
textOverflow: "ellipsis",
|
|
@@ -1496,7 +1994,7 @@ var TabButton = ({
|
|
|
1496
1994
|
children: displayLabel
|
|
1497
1995
|
});
|
|
1498
1996
|
})(),
|
|
1499
|
-
renderAccessory ? renderAccessory(tab) : keyboardHint && /* @__PURE__ */
|
|
1997
|
+
renderAccessory ? renderAccessory(tab) : keyboardHint && /* @__PURE__ */ jsx7("span", {
|
|
1500
1998
|
style: {
|
|
1501
1999
|
fontSize: theme.fontSizes[0],
|
|
1502
2000
|
color: theme.colors.textSecondary,
|
|
@@ -1511,7 +2009,7 @@ var TabButton = ({
|
|
|
1511
2009
|
TabButton.displayName = "TabButton";
|
|
1512
2010
|
|
|
1513
2011
|
// src/components/TabBar/TabBar.tsx
|
|
1514
|
-
import { jsx as
|
|
2012
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1515
2013
|
var TabBar = ({
|
|
1516
2014
|
tabs,
|
|
1517
2015
|
activeTabId,
|
|
@@ -1529,31 +2027,31 @@ var TabBar = ({
|
|
|
1529
2027
|
canDropOnTab,
|
|
1530
2028
|
enableDragAndDrop = false
|
|
1531
2029
|
}) => {
|
|
1532
|
-
const { theme } =
|
|
1533
|
-
const [hoveredTabId, setHoveredTabId] =
|
|
1534
|
-
const [draggedTabId, setDraggedTabId] =
|
|
1535
|
-
const [dragOverTabId, setDragOverTabId] =
|
|
1536
|
-
const handleDragStart =
|
|
2030
|
+
const { theme } = useTheme5();
|
|
2031
|
+
const [hoveredTabId, setHoveredTabId] = useState3(null);
|
|
2032
|
+
const [draggedTabId, setDraggedTabId] = useState3(null);
|
|
2033
|
+
const [dragOverTabId, setDragOverTabId] = useState3(null);
|
|
2034
|
+
const handleDragStart = useCallback4((tabId) => {
|
|
1537
2035
|
setDraggedTabId(tabId);
|
|
1538
2036
|
}, []);
|
|
1539
|
-
const handleDragEnd =
|
|
2037
|
+
const handleDragEnd = useCallback4(() => {
|
|
1540
2038
|
setDraggedTabId(null);
|
|
1541
2039
|
setDragOverTabId(null);
|
|
1542
2040
|
}, []);
|
|
1543
|
-
const handleDrop =
|
|
2041
|
+
const handleDrop = useCallback4((targetTabId, draggedId) => {
|
|
1544
2042
|
if (draggedId !== targetTabId) {
|
|
1545
2043
|
onTabDrop?.(draggedId, targetTabId);
|
|
1546
2044
|
}
|
|
1547
2045
|
setDraggedTabId(null);
|
|
1548
2046
|
setDragOverTabId(null);
|
|
1549
2047
|
}, [onTabDrop]);
|
|
1550
|
-
const handleDragEnter =
|
|
2048
|
+
const handleDragEnter = useCallback4((tabId) => {
|
|
1551
2049
|
setDragOverTabId(tabId);
|
|
1552
2050
|
}, []);
|
|
1553
|
-
const handleDragLeave =
|
|
2051
|
+
const handleDragLeave = useCallback4(() => {
|
|
1554
2052
|
setDragOverTabId(null);
|
|
1555
2053
|
}, []);
|
|
1556
|
-
return /* @__PURE__ */
|
|
2054
|
+
return /* @__PURE__ */ jsxs6("div", {
|
|
1557
2055
|
className,
|
|
1558
2056
|
style: {
|
|
1559
2057
|
display: "flex",
|
|
@@ -1563,7 +2061,7 @@ var TabBar = ({
|
|
|
1563
2061
|
boxSizing: "border-box"
|
|
1564
2062
|
},
|
|
1565
2063
|
children: [
|
|
1566
|
-
leftSection && /* @__PURE__ */
|
|
2064
|
+
leftSection && /* @__PURE__ */ jsx8("div", {
|
|
1567
2065
|
style: {
|
|
1568
2066
|
display: "flex",
|
|
1569
2067
|
alignItems: "center",
|
|
@@ -1576,7 +2074,7 @@ var TabBar = ({
|
|
|
1576
2074
|
},
|
|
1577
2075
|
children: leftSection
|
|
1578
2076
|
}),
|
|
1579
|
-
/* @__PURE__ */
|
|
2077
|
+
/* @__PURE__ */ jsx8("div", {
|
|
1580
2078
|
style: {
|
|
1581
2079
|
display: "flex",
|
|
1582
2080
|
alignItems: "center",
|
|
@@ -1588,7 +2086,7 @@ var TabBar = ({
|
|
|
1588
2086
|
},
|
|
1589
2087
|
children: tabs.map((tab, index) => {
|
|
1590
2088
|
const canDrop = enableDragAndDrop && draggedTabId !== null && draggedTabId !== tab.id ? canDropOnTab ? canDropOnTab(draggedTabId, tab.id) : true : false;
|
|
1591
|
-
return /* @__PURE__ */
|
|
2089
|
+
return /* @__PURE__ */ jsx8(TabButton, {
|
|
1592
2090
|
tab,
|
|
1593
2091
|
isActive: tab.id === activeTabId,
|
|
1594
2092
|
isHovered: tab.id === hoveredTabId,
|
|
@@ -1612,7 +2110,7 @@ var TabBar = ({
|
|
|
1612
2110
|
}, tab.id);
|
|
1613
2111
|
})
|
|
1614
2112
|
}),
|
|
1615
|
-
rightSection !== undefined ? rightSection && /* @__PURE__ */
|
|
2113
|
+
rightSection !== undefined ? rightSection && /* @__PURE__ */ jsx8("div", {
|
|
1616
2114
|
style: {
|
|
1617
2115
|
display: "flex",
|
|
1618
2116
|
alignItems: "center",
|
|
@@ -1624,7 +2122,7 @@ var TabBar = ({
|
|
|
1624
2122
|
boxSizing: "border-box"
|
|
1625
2123
|
},
|
|
1626
2124
|
children: rightSection
|
|
1627
|
-
}) : onNewTab && /* @__PURE__ */
|
|
2125
|
+
}) : onNewTab && /* @__PURE__ */ jsx8("div", {
|
|
1628
2126
|
style: {
|
|
1629
2127
|
display: "flex",
|
|
1630
2128
|
alignItems: "center",
|
|
@@ -1635,7 +2133,7 @@ var TabBar = ({
|
|
|
1635
2133
|
borderBottom: `1px solid ${theme.colors.border}`,
|
|
1636
2134
|
boxSizing: "border-box"
|
|
1637
2135
|
},
|
|
1638
|
-
children: /* @__PURE__ */
|
|
2136
|
+
children: /* @__PURE__ */ jsx8("button", {
|
|
1639
2137
|
onClick: onNewTab,
|
|
1640
2138
|
style: {
|
|
1641
2139
|
display: "flex",
|
|
@@ -1656,7 +2154,7 @@ var TabBar = ({
|
|
|
1656
2154
|
e.currentTarget.style.backgroundColor = "transparent";
|
|
1657
2155
|
},
|
|
1658
2156
|
title: "New Tab (⌘T)",
|
|
1659
|
-
children: /* @__PURE__ */
|
|
2157
|
+
children: /* @__PURE__ */ jsx8(Plus, {
|
|
1660
2158
|
size: 14
|
|
1661
2159
|
})
|
|
1662
2160
|
})
|
|
@@ -1670,14 +2168,14 @@ function isTabOfType(tab, contentType) {
|
|
|
1670
2168
|
return tab.contentType === contentType;
|
|
1671
2169
|
}
|
|
1672
2170
|
// src/hooks/useTabKeyboardShortcuts.ts
|
|
1673
|
-
import { useEffect as
|
|
2171
|
+
import { useEffect as useEffect3 } from "react";
|
|
1674
2172
|
var useTabKeyboardShortcuts = ({
|
|
1675
2173
|
onNewTab,
|
|
1676
2174
|
onCloseTab,
|
|
1677
2175
|
onSwitchToTab,
|
|
1678
2176
|
enabled = true
|
|
1679
2177
|
}) => {
|
|
1680
|
-
|
|
2178
|
+
useEffect3(() => {
|
|
1681
2179
|
if (!enabled)
|
|
1682
2180
|
return;
|
|
1683
2181
|
const handleKeyDown = (e) => {
|
|
@@ -1707,9 +2205,9 @@ var useTabKeyboardShortcuts = ({
|
|
|
1707
2205
|
}, [enabled, onNewTab, onCloseTab, onSwitchToTab]);
|
|
1708
2206
|
};
|
|
1709
2207
|
// src/panels/TerminalPanel.tsx
|
|
1710
|
-
import { useTheme as
|
|
2208
|
+
import { useTheme as useTheme6 } from "@principal-ade/industry-theme";
|
|
1711
2209
|
import { Lock, Unlock, ArrowDown } from "lucide-react";
|
|
1712
|
-
import { useCallback as
|
|
2210
|
+
import { useCallback as useCallback5, useEffect as useEffect4, useRef as useRef4, useState as useState4 } from "react";
|
|
1713
2211
|
|
|
1714
2212
|
// src/panel-types/index.ts
|
|
1715
2213
|
function getTerminalSessions(context2) {
|
|
@@ -1743,7 +2241,7 @@ function getTerminalSlice(context2) {
|
|
|
1743
2241
|
}
|
|
1744
2242
|
|
|
1745
2243
|
// src/panels/TerminalPanel.tsx
|
|
1746
|
-
import { jsx as
|
|
2244
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1747
2245
|
var TerminalPanel = ({
|
|
1748
2246
|
context: context2,
|
|
1749
2247
|
actions,
|
|
@@ -1752,20 +2250,20 @@ var TerminalPanel = ({
|
|
|
1752
2250
|
allowTransparency = false,
|
|
1753
2251
|
backgroundColor
|
|
1754
2252
|
}) => {
|
|
1755
|
-
const { theme } =
|
|
1756
|
-
const [sessionId, setSessionId] =
|
|
1757
|
-
const [error, setError] =
|
|
1758
|
-
const [isInitializing, setIsInitializing] =
|
|
1759
|
-
const [scrollPosition, setScrollPosition] =
|
|
2253
|
+
const { theme } = useTheme6();
|
|
2254
|
+
const [sessionId, setSessionId] = useState4(null);
|
|
2255
|
+
const [error, setError] = useState4(null);
|
|
2256
|
+
const [isInitializing, setIsInitializing] = useState4(true);
|
|
2257
|
+
const [scrollPosition, setScrollPosition] = useState4({
|
|
1760
2258
|
isAtTop: false,
|
|
1761
2259
|
isAtBottom: true,
|
|
1762
2260
|
isScrollLocked: false
|
|
1763
2261
|
});
|
|
1764
|
-
const terminalRef =
|
|
1765
|
-
const isScrollLockedRef =
|
|
2262
|
+
const terminalRef = useRef4(null);
|
|
2263
|
+
const isScrollLockedRef = useRef4(scrollPosition.isScrollLocked);
|
|
1766
2264
|
const terminalDirectory = getTerminalDirectory(context2, terminalScope);
|
|
1767
|
-
const pendingSessionIdRef =
|
|
1768
|
-
|
|
2265
|
+
const pendingSessionIdRef = useRef4(null);
|
|
2266
|
+
useEffect4(() => {
|
|
1769
2267
|
let mounted = true;
|
|
1770
2268
|
const initTerminal = async () => {
|
|
1771
2269
|
try {
|
|
@@ -1798,7 +2296,7 @@ var TerminalPanel = ({
|
|
|
1798
2296
|
}
|
|
1799
2297
|
};
|
|
1800
2298
|
}, []);
|
|
1801
|
-
|
|
2299
|
+
useEffect4(() => {
|
|
1802
2300
|
if (!sessionId)
|
|
1803
2301
|
return;
|
|
1804
2302
|
if (!actions.onTerminalData) {
|
|
@@ -1835,13 +2333,13 @@ var TerminalPanel = ({
|
|
|
1835
2333
|
unsubscribe();
|
|
1836
2334
|
};
|
|
1837
2335
|
}, [sessionId, actions.onTerminalData]);
|
|
1838
|
-
const handleTerminalData =
|
|
2336
|
+
const handleTerminalData = useCallback5((data) => {
|
|
1839
2337
|
if (sessionId && actions.writeToTerminal) {
|
|
1840
2338
|
actions.writeToTerminal(sessionId, data);
|
|
1841
2339
|
}
|
|
1842
2340
|
}, [sessionId, actions.writeToTerminal]);
|
|
1843
|
-
const hasNotifiedPtyRef =
|
|
1844
|
-
const handleTerminalResize =
|
|
2341
|
+
const hasNotifiedPtyRef = useRef4(false);
|
|
2342
|
+
const handleTerminalResize = useCallback5((cols, rows) => {
|
|
1845
2343
|
if (sessionId && actions.resizeTerminal) {
|
|
1846
2344
|
const isInitialNotification = !hasNotifiedPtyRef.current;
|
|
1847
2345
|
actions.resizeTerminal(sessionId, cols, rows);
|
|
@@ -1853,10 +2351,10 @@ var TerminalPanel = ({
|
|
|
1853
2351
|
hasNotifiedPtyRef.current = true;
|
|
1854
2352
|
}
|
|
1855
2353
|
}, [sessionId, actions.resizeTerminal, actions.writeToTerminal]);
|
|
1856
|
-
|
|
2354
|
+
useEffect4(() => {
|
|
1857
2355
|
hasNotifiedPtyRef.current = false;
|
|
1858
2356
|
}, [sessionId]);
|
|
1859
|
-
|
|
2357
|
+
useEffect4(() => {
|
|
1860
2358
|
if (!sessionId || !actions.resizeTerminal)
|
|
1861
2359
|
return;
|
|
1862
2360
|
if (hasNotifiedPtyRef.current)
|
|
@@ -1871,13 +2369,13 @@ var TerminalPanel = ({
|
|
|
1871
2369
|
setTimeout(() => writeFn(sessionId, "\f"), 50);
|
|
1872
2370
|
}
|
|
1873
2371
|
}, [sessionId, actions.resizeTerminal, actions.writeToTerminal]);
|
|
1874
|
-
const handleScrollPositionChange =
|
|
2372
|
+
const handleScrollPositionChange = useCallback5((position) => {
|
|
1875
2373
|
setScrollPosition(position);
|
|
1876
2374
|
isScrollLockedRef.current = position.isScrollLocked;
|
|
1877
2375
|
}, []);
|
|
1878
2376
|
const sessionInfo = sessionId ? getTerminalSession(context2, sessionId) : undefined;
|
|
1879
2377
|
if (error) {
|
|
1880
|
-
return /* @__PURE__ */
|
|
2378
|
+
return /* @__PURE__ */ jsxs7("div", {
|
|
1881
2379
|
style: {
|
|
1882
2380
|
padding: "20px",
|
|
1883
2381
|
color: "#ef4444",
|
|
@@ -1890,11 +2388,11 @@ var TerminalPanel = ({
|
|
|
1890
2388
|
gap: "10px"
|
|
1891
2389
|
},
|
|
1892
2390
|
children: [
|
|
1893
|
-
/* @__PURE__ */
|
|
2391
|
+
/* @__PURE__ */ jsx9("div", {
|
|
1894
2392
|
style: { fontSize: "16px", fontWeight: "bold" },
|
|
1895
2393
|
children: "Terminal Error"
|
|
1896
2394
|
}),
|
|
1897
|
-
/* @__PURE__ */
|
|
2395
|
+
/* @__PURE__ */ jsx9("div", {
|
|
1898
2396
|
style: { fontSize: "14px", opacity: 0.8 },
|
|
1899
2397
|
children: error
|
|
1900
2398
|
})
|
|
@@ -1902,7 +2400,7 @@ var TerminalPanel = ({
|
|
|
1902
2400
|
});
|
|
1903
2401
|
}
|
|
1904
2402
|
if (isInitializing || !sessionId) {
|
|
1905
|
-
return /* @__PURE__ */
|
|
2403
|
+
return /* @__PURE__ */ jsx9("div", {
|
|
1906
2404
|
style: {
|
|
1907
2405
|
padding: "20px",
|
|
1908
2406
|
color: "#a0a0a0",
|
|
@@ -1928,10 +2426,10 @@ var TerminalPanel = ({
|
|
|
1928
2426
|
terminalRef.current?.scrollToBottom();
|
|
1929
2427
|
}
|
|
1930
2428
|
};
|
|
1931
|
-
return /* @__PURE__ */
|
|
2429
|
+
return /* @__PURE__ */ jsxs7("div", {
|
|
1932
2430
|
style: { height: "100%", width: "100%", display: "flex", flexDirection: "column" },
|
|
1933
2431
|
children: [
|
|
1934
|
-
/* @__PURE__ */
|
|
2432
|
+
/* @__PURE__ */ jsxs7("div", {
|
|
1935
2433
|
style: {
|
|
1936
2434
|
display: "flex",
|
|
1937
2435
|
gap: "8px",
|
|
@@ -1941,7 +2439,7 @@ var TerminalPanel = ({
|
|
|
1941
2439
|
alignItems: "center"
|
|
1942
2440
|
},
|
|
1943
2441
|
children: [
|
|
1944
|
-
/* @__PURE__ */
|
|
2442
|
+
/* @__PURE__ */ jsxs7("span", {
|
|
1945
2443
|
style: {
|
|
1946
2444
|
fontSize: "12px",
|
|
1947
2445
|
color: theme.colors.textSecondary,
|
|
@@ -1954,7 +2452,7 @@ var TerminalPanel = ({
|
|
|
1954
2452
|
sessionInfo?.shell
|
|
1955
2453
|
]
|
|
1956
2454
|
}),
|
|
1957
|
-
/* @__PURE__ */
|
|
2455
|
+
/* @__PURE__ */ jsxs7("button", {
|
|
1958
2456
|
onClick: handleToggleScrollLock,
|
|
1959
2457
|
style: {
|
|
1960
2458
|
display: "flex",
|
|
@@ -1973,17 +2471,17 @@ var TerminalPanel = ({
|
|
|
1973
2471
|
onMouseLeave: (e) => e.currentTarget.style.opacity = "1",
|
|
1974
2472
|
title: scrollPosition.isScrollLocked ? "Click to unlock scroll" : "Click to lock scroll to bottom",
|
|
1975
2473
|
children: [
|
|
1976
|
-
scrollPosition.isScrollLocked ? /* @__PURE__ */
|
|
2474
|
+
scrollPosition.isScrollLocked ? /* @__PURE__ */ jsx9(Lock, {
|
|
1977
2475
|
size: 12
|
|
1978
|
-
}) : /* @__PURE__ */
|
|
2476
|
+
}) : /* @__PURE__ */ jsx9(Unlock, {
|
|
1979
2477
|
size: 12
|
|
1980
2478
|
}),
|
|
1981
|
-
/* @__PURE__ */
|
|
2479
|
+
/* @__PURE__ */ jsx9("span", {
|
|
1982
2480
|
children: scrollPosition.isScrollLocked ? "Locked" : "Unlocked"
|
|
1983
2481
|
})
|
|
1984
2482
|
]
|
|
1985
2483
|
}),
|
|
1986
|
-
/* @__PURE__ */
|
|
2484
|
+
/* @__PURE__ */ jsxs7("button", {
|
|
1987
2485
|
onClick: handleScrollToBottom,
|
|
1988
2486
|
disabled: scrollPosition.isAtBottom,
|
|
1989
2487
|
style: {
|
|
@@ -2004,19 +2502,19 @@ var TerminalPanel = ({
|
|
|
2004
2502
|
onMouseLeave: (e) => !scrollPosition.isAtBottom && (e.currentTarget.style.opacity = "1"),
|
|
2005
2503
|
title: "Scroll to bottom and lock",
|
|
2006
2504
|
children: [
|
|
2007
|
-
/* @__PURE__ */
|
|
2505
|
+
/* @__PURE__ */ jsx9(ArrowDown, {
|
|
2008
2506
|
size: 12
|
|
2009
2507
|
}),
|
|
2010
|
-
/* @__PURE__ */
|
|
2508
|
+
/* @__PURE__ */ jsx9("span", {
|
|
2011
2509
|
children: "Bottom"
|
|
2012
2510
|
})
|
|
2013
2511
|
]
|
|
2014
2512
|
})
|
|
2015
2513
|
]
|
|
2016
2514
|
}),
|
|
2017
|
-
/* @__PURE__ */
|
|
2515
|
+
/* @__PURE__ */ jsx9("div", {
|
|
2018
2516
|
style: { flex: 1 },
|
|
2019
|
-
children: /* @__PURE__ */
|
|
2517
|
+
children: /* @__PURE__ */ jsx9(ThemedTerminalWithProvider, {
|
|
2020
2518
|
ref: terminalRef,
|
|
2021
2519
|
onData: handleTerminalData,
|
|
2022
2520
|
onResize: handleTerminalResize,
|
|
@@ -2036,20 +2534,20 @@ var TerminalPanel = ({
|
|
|
2036
2534
|
});
|
|
2037
2535
|
};
|
|
2038
2536
|
// src/panels/TabbedTerminalPanel.tsx
|
|
2039
|
-
import { useTheme as
|
|
2537
|
+
import { useTheme as useTheme7 } from "@principal-ade/industry-theme";
|
|
2040
2538
|
import { CollapsibleSplitPane } from "@principal-ade/panels";
|
|
2041
2539
|
import { Terminal as TerminalIcon2, Lock as Lock2, Unlock as Unlock2, Box, Boxes, Paperclip } from "lucide-react";
|
|
2042
2540
|
import React3, {
|
|
2043
|
-
useState as
|
|
2044
|
-
useCallback as
|
|
2045
|
-
useEffect as
|
|
2046
|
-
useRef as
|
|
2541
|
+
useState as useState5,
|
|
2542
|
+
useCallback as useCallback6,
|
|
2543
|
+
useEffect as useEffect5,
|
|
2544
|
+
useRef as useRef5
|
|
2047
2545
|
} from "react";
|
|
2048
|
-
import { jsx as
|
|
2049
|
-
var ActivityIndicator = ({ color, isAnimating }) => /* @__PURE__ */
|
|
2546
|
+
import { jsx as jsx10, jsxs as jsxs8, Fragment as Fragment2 } from "react/jsx-runtime";
|
|
2547
|
+
var ActivityIndicator = ({ color, isAnimating }) => /* @__PURE__ */ jsxs8("div", {
|
|
2050
2548
|
style: { display: "flex", gap: 1, alignItems: "center", height: 12 },
|
|
2051
2549
|
children: [
|
|
2052
|
-
[0, 1, 2, 3, 4].map((i) => /* @__PURE__ */
|
|
2550
|
+
[0, 1, 2, 3, 4].map((i) => /* @__PURE__ */ jsx10("div", {
|
|
2053
2551
|
style: {
|
|
2054
2552
|
width: 2,
|
|
2055
2553
|
height: 10,
|
|
@@ -2060,7 +2558,7 @@ var ActivityIndicator = ({ color, isAnimating }) => /* @__PURE__ */ jsxs6("div",
|
|
|
2060
2558
|
animation: isAnimating ? `waveSine 1.2s ease-in-out ${i * 0.1}s infinite` : "none"
|
|
2061
2559
|
}
|
|
2062
2560
|
}, i)),
|
|
2063
|
-
/* @__PURE__ */
|
|
2561
|
+
/* @__PURE__ */ jsx10("style", {
|
|
2064
2562
|
children: `
|
|
2065
2563
|
@keyframes waveSine {
|
|
2066
2564
|
0%, 100% { transform: scaleY(0.4); }
|
|
@@ -2072,20 +2570,20 @@ var ActivityIndicator = ({ color, isAnimating }) => /* @__PURE__ */ jsxs6("div",
|
|
|
2072
2570
|
});
|
|
2073
2571
|
function TerminalTabContentInner(props, ref) {
|
|
2074
2572
|
const { tab, sessionId, isActive, isVisible, actions, events, terminalContext, onSessionCreated, onScrollPositionChange, isForeign = false, defaultScrollLocked, activityDetection = true, activityTimeout = 500, autoShowBlinds = false, onActivityStateChange } = props;
|
|
2075
|
-
const { theme } =
|
|
2076
|
-
const terminalRef =
|
|
2077
|
-
const [localSessionId, setLocalSessionId] =
|
|
2078
|
-
const [isInitialized, setIsInitialized] =
|
|
2079
|
-
const hasInitializedRef =
|
|
2080
|
-
const [scrollPosition, setScrollPosition] =
|
|
2573
|
+
const { theme } = useTheme7();
|
|
2574
|
+
const terminalRef = useRef5(null);
|
|
2575
|
+
const [localSessionId, setLocalSessionId] = useState5(sessionId);
|
|
2576
|
+
const [isInitialized, setIsInitialized] = useState5(false);
|
|
2577
|
+
const hasInitializedRef = useRef5(false);
|
|
2578
|
+
const [scrollPosition, setScrollPosition] = useState5({
|
|
2081
2579
|
isAtTop: false,
|
|
2082
2580
|
isAtBottom: true,
|
|
2083
2581
|
isScrollLocked: false
|
|
2084
2582
|
});
|
|
2085
|
-
const [shouldRenderTerminal, setShouldRenderTerminal] =
|
|
2086
|
-
const [ownerWindowId, setOwnerWindowId] =
|
|
2087
|
-
const needsRefreshOnResizeRef =
|
|
2088
|
-
const claimAndConnect =
|
|
2583
|
+
const [shouldRenderTerminal, setShouldRenderTerminal] = useState5(true);
|
|
2584
|
+
const [ownerWindowId, setOwnerWindowId] = useState5(null);
|
|
2585
|
+
const needsRefreshOnResizeRef = useRef5(false);
|
|
2586
|
+
const claimAndConnect = useCallback6(async (targetSessionId, force = false) => {
|
|
2089
2587
|
try {
|
|
2090
2588
|
if (actions.claimTerminalOwnership) {
|
|
2091
2589
|
await actions.claimTerminalOwnership(targetSessionId, force);
|
|
@@ -2103,7 +2601,7 @@ function TerminalTabContentInner(props, ref) {
|
|
|
2103
2601
|
throw error;
|
|
2104
2602
|
}
|
|
2105
2603
|
}, [actions]);
|
|
2106
|
-
|
|
2604
|
+
useEffect5(() => {
|
|
2107
2605
|
if (hasInitializedRef.current) {
|
|
2108
2606
|
return;
|
|
2109
2607
|
}
|
|
@@ -2196,7 +2694,7 @@ function TerminalTabContentInner(props, ref) {
|
|
|
2196
2694
|
mounted = false;
|
|
2197
2695
|
};
|
|
2198
2696
|
}, []);
|
|
2199
|
-
|
|
2697
|
+
useEffect5(() => {
|
|
2200
2698
|
if (!localSessionId || !isInitialized || !shouldRenderTerminal) {
|
|
2201
2699
|
return;
|
|
2202
2700
|
}
|
|
@@ -2246,17 +2744,17 @@ function TerminalTabContentInner(props, ref) {
|
|
|
2246
2744
|
unsubscribe();
|
|
2247
2745
|
};
|
|
2248
2746
|
}, [localSessionId, isInitialized, actions, shouldRenderTerminal, tab.id]);
|
|
2249
|
-
const handleData =
|
|
2747
|
+
const handleData = useCallback6((data) => {
|
|
2250
2748
|
if (localSessionId && actions.writeToTerminal) {
|
|
2251
2749
|
actions.writeToTerminal(localSessionId, data);
|
|
2252
2750
|
}
|
|
2253
2751
|
}, [localSessionId, actions]);
|
|
2254
|
-
const handleResize =
|
|
2752
|
+
const handleResize = useCallback6((cols, rows) => {
|
|
2255
2753
|
if (localSessionId && actions.resizeTerminal) {
|
|
2256
2754
|
actions.resizeTerminal(localSessionId, cols, rows);
|
|
2257
2755
|
}
|
|
2258
2756
|
}, [localSessionId, actions]);
|
|
2259
|
-
const handleReady =
|
|
2757
|
+
const handleReady = useCallback6((cols, rows) => {
|
|
2260
2758
|
if (!localSessionId || !actions.resizeTerminal) {
|
|
2261
2759
|
return;
|
|
2262
2760
|
}
|
|
@@ -2284,7 +2782,7 @@ function TerminalTabContentInner(props, ref) {
|
|
|
2284
2782
|
};
|
|
2285
2783
|
restoreBufferAndResize();
|
|
2286
2784
|
}, [localSessionId, actions]);
|
|
2287
|
-
const handleLinkClick =
|
|
2785
|
+
const handleLinkClick = useCallback6((url, modifiers) => {
|
|
2288
2786
|
if (localSessionId) {
|
|
2289
2787
|
events.emit({
|
|
2290
2788
|
type: "terminal:link-click",
|
|
@@ -2301,7 +2799,7 @@ function TerminalTabContentInner(props, ref) {
|
|
|
2301
2799
|
});
|
|
2302
2800
|
}
|
|
2303
2801
|
}, [localSessionId, events]);
|
|
2304
|
-
|
|
2802
|
+
useEffect5(() => {
|
|
2305
2803
|
if (!localSessionId || !actions.onOwnershipLost) {
|
|
2306
2804
|
return;
|
|
2307
2805
|
}
|
|
@@ -2315,17 +2813,17 @@ function TerminalTabContentInner(props, ref) {
|
|
|
2315
2813
|
unsubscribe();
|
|
2316
2814
|
};
|
|
2317
2815
|
}, [localSessionId, actions]);
|
|
2318
|
-
const handleTakeControl =
|
|
2816
|
+
const handleTakeControl = useCallback6(async () => {
|
|
2319
2817
|
if (!localSessionId) {
|
|
2320
2818
|
return;
|
|
2321
2819
|
}
|
|
2322
2820
|
await claimAndConnect(localSessionId, true);
|
|
2323
2821
|
}, [localSessionId, claimAndConnect]);
|
|
2324
|
-
const handleScrollPositionChange =
|
|
2822
|
+
const handleScrollPositionChange = useCallback6((position) => {
|
|
2325
2823
|
setScrollPosition(position);
|
|
2326
2824
|
onScrollPositionChange?.(tab.id, position);
|
|
2327
2825
|
}, [tab.id, onScrollPositionChange]);
|
|
2328
|
-
const handleShortcut =
|
|
2826
|
+
const handleShortcut = useCallback6((shortcutEvent) => {
|
|
2329
2827
|
if (localSessionId) {
|
|
2330
2828
|
events.emit({
|
|
2331
2829
|
type: "terminal:shortcut",
|
|
@@ -2338,7 +2836,7 @@ function TerminalTabContentInner(props, ref) {
|
|
|
2338
2836
|
});
|
|
2339
2837
|
}
|
|
2340
2838
|
}, [localSessionId, events]);
|
|
2341
|
-
const handleActivityChange =
|
|
2839
|
+
const handleActivityChange = useCallback6((state) => {
|
|
2342
2840
|
if (localSessionId) {
|
|
2343
2841
|
onActivityStateChange?.(localSessionId, state.isActive);
|
|
2344
2842
|
events.emit({
|
|
@@ -2353,10 +2851,10 @@ function TerminalTabContentInner(props, ref) {
|
|
|
2353
2851
|
});
|
|
2354
2852
|
}
|
|
2355
2853
|
}, [localSessionId, events, onActivityStateChange]);
|
|
2356
|
-
const handleScrollToBottom =
|
|
2854
|
+
const handleScrollToBottom = useCallback6(() => {
|
|
2357
2855
|
terminalRef.current?.scrollToBottom();
|
|
2358
2856
|
}, []);
|
|
2359
|
-
const handleToggleScrollLock =
|
|
2857
|
+
const handleToggleScrollLock = useCallback6(() => {
|
|
2360
2858
|
if (scrollPosition.isScrollLocked) {
|
|
2361
2859
|
const terminal = terminalRef.current?.getTerminal();
|
|
2362
2860
|
if (terminal) {
|
|
@@ -2371,7 +2869,7 @@ function TerminalTabContentInner(props, ref) {
|
|
|
2371
2869
|
toggleScrollLock: handleToggleScrollLock
|
|
2372
2870
|
}), [handleScrollToBottom, handleToggleScrollLock]);
|
|
2373
2871
|
if (!isInitialized) {
|
|
2374
|
-
return /* @__PURE__ */
|
|
2872
|
+
return /* @__PURE__ */ jsxs8("div", {
|
|
2375
2873
|
style: {
|
|
2376
2874
|
display: isActive ? "flex" : "none",
|
|
2377
2875
|
height: "100%",
|
|
@@ -2380,7 +2878,7 @@ function TerminalTabContentInner(props, ref) {
|
|
|
2380
2878
|
padding: "10px 0 0 10px"
|
|
2381
2879
|
},
|
|
2382
2880
|
children: [
|
|
2383
|
-
/* @__PURE__ */
|
|
2881
|
+
/* @__PURE__ */ jsx10("div", {
|
|
2384
2882
|
style: {
|
|
2385
2883
|
width: "8px",
|
|
2386
2884
|
height: "17px",
|
|
@@ -2388,7 +2886,7 @@ function TerminalTabContentInner(props, ref) {
|
|
|
2388
2886
|
animation: "blink 1s step-end infinite"
|
|
2389
2887
|
}
|
|
2390
2888
|
}),
|
|
2391
|
-
/* @__PURE__ */
|
|
2889
|
+
/* @__PURE__ */ jsx10("style", {
|
|
2392
2890
|
children: `
|
|
2393
2891
|
@keyframes blink {
|
|
2394
2892
|
0%, 100% { opacity: 1; }
|
|
@@ -2411,14 +2909,14 @@ function TerminalTabContentInner(props, ref) {
|
|
|
2411
2909
|
],
|
|
2412
2910
|
opacity: 1
|
|
2413
2911
|
} : undefined;
|
|
2414
|
-
return /* @__PURE__ */
|
|
2912
|
+
return /* @__PURE__ */ jsx10("div", {
|
|
2415
2913
|
style: {
|
|
2416
2914
|
display: isActive ? "flex" : "none",
|
|
2417
2915
|
flexDirection: "column",
|
|
2418
2916
|
height: "100%",
|
|
2419
2917
|
width: "100%"
|
|
2420
2918
|
},
|
|
2421
|
-
children: /* @__PURE__ */
|
|
2919
|
+
children: /* @__PURE__ */ jsx10(ThemedTerminalWithProvider, {
|
|
2422
2920
|
ref: terminalRef,
|
|
2423
2921
|
onData: shouldRenderTerminal ? handleData : undefined,
|
|
2424
2922
|
onResize: shouldRenderTerminal ? handleResize : undefined,
|
|
@@ -2507,11 +3005,11 @@ var TabbedTerminalPanelInner = ({
|
|
|
2507
3005
|
onTabAssociate: onTabAssociateProp,
|
|
2508
3006
|
onTabDissociate: _onTabDissociate
|
|
2509
3007
|
}) => {
|
|
2510
|
-
const { theme } =
|
|
3008
|
+
const { theme } = useTheme7();
|
|
2511
3009
|
const onTabAssociate = actions.onTabAssociate ?? onTabAssociateProp;
|
|
2512
|
-
const [ownedTabs, setOwnedTabs] =
|
|
2513
|
-
const [foreignTabs, setForeignTabs] =
|
|
2514
|
-
const [internalActiveTabId, setInternalActiveTabId] =
|
|
3010
|
+
const [ownedTabs, setOwnedTabs] = useState5(initialTabs);
|
|
3011
|
+
const [foreignTabs, setForeignTabs] = useState5([]);
|
|
3012
|
+
const [internalActiveTabId, setInternalActiveTabId] = useState5(null);
|
|
2515
3013
|
const isControlled = activeTabIdProp !== undefined;
|
|
2516
3014
|
const activeTabId = isControlled ? activeTabIdProp : internalActiveTabId;
|
|
2517
3015
|
const setActiveTabId = React3.useCallback((tabId) => {
|
|
@@ -2522,20 +3020,20 @@ var TabbedTerminalPanelInner = ({
|
|
|
2522
3020
|
onActiveTabChange?.(tabId);
|
|
2523
3021
|
}
|
|
2524
3022
|
}, [isControlled, onActiveTabChange]);
|
|
2525
|
-
const [activatedTabs, setActivatedTabs] =
|
|
3023
|
+
const [activatedTabs, setActivatedTabs] = useState5(() => new Set);
|
|
2526
3024
|
React3.useEffect(() => {
|
|
2527
3025
|
if (activeTabId && !activatedTabs.has(activeTabId)) {
|
|
2528
3026
|
setActivatedTabs((prev) => new Set(prev).add(activeTabId));
|
|
2529
3027
|
}
|
|
2530
3028
|
}, [activeTabId, activatedTabs]);
|
|
2531
|
-
const [sessionIds, setSessionIds] =
|
|
2532
|
-
const [scrollPositions, setScrollPositions] =
|
|
2533
|
-
const [activityStates, setActivityStates] =
|
|
3029
|
+
const [sessionIds, setSessionIds] = useState5(new Map);
|
|
3030
|
+
const [scrollPositions, setScrollPositions] = useState5(new Map);
|
|
3031
|
+
const [activityStates, setActivityStates] = useState5(new Map);
|
|
2534
3032
|
const customTabsKey = React3.useMemo(() => {
|
|
2535
3033
|
const customTabs = initialTabs.filter((tab) => tab.contentType !== "terminal");
|
|
2536
3034
|
return JSON.stringify(customTabs);
|
|
2537
3035
|
}, [initialTabs]);
|
|
2538
|
-
|
|
3036
|
+
useEffect5(() => {
|
|
2539
3037
|
const customTabsFromProp = initialTabs.filter((tab) => tab.contentType !== "terminal");
|
|
2540
3038
|
setOwnedTabs((prevTabs) => {
|
|
2541
3039
|
const existingTerminalTabs = prevTabs.filter((tab) => tab.contentType === "terminal");
|
|
@@ -2556,7 +3054,7 @@ var TabbedTerminalPanelInner = ({
|
|
|
2556
3054
|
return mergedTabs;
|
|
2557
3055
|
});
|
|
2558
3056
|
}, [customTabsKey]);
|
|
2559
|
-
|
|
3057
|
+
useEffect5(() => {
|
|
2560
3058
|
if (!requestFocusTabId) {
|
|
2561
3059
|
return;
|
|
2562
3060
|
}
|
|
@@ -2571,7 +3069,7 @@ var TabbedTerminalPanelInner = ({
|
|
|
2571
3069
|
onFocusTabHandled?.();
|
|
2572
3070
|
}
|
|
2573
3071
|
}, [requestFocusTabId, ownedTabs, foreignTabs, setActiveTabId, onFocusTabHandled, activeTabId]);
|
|
2574
|
-
const getOwnedTabLabel =
|
|
3072
|
+
const getOwnedTabLabel = useCallback6((index, _directory) => {
|
|
2575
3073
|
if (tabLabelPrefix) {
|
|
2576
3074
|
return `${tabLabelPrefix} ${index + 1}`;
|
|
2577
3075
|
}
|
|
@@ -2597,9 +3095,9 @@ var TabbedTerminalPanelInner = ({
|
|
|
2597
3095
|
}
|
|
2598
3096
|
}));
|
|
2599
3097
|
}, [tabs]);
|
|
2600
|
-
const tabRefsMap =
|
|
2601
|
-
const refCallbacksMap =
|
|
2602
|
-
const getRefCallback =
|
|
3098
|
+
const tabRefsMap = useRef5(new Map);
|
|
3099
|
+
const refCallbacksMap = useRef5(new Map);
|
|
3100
|
+
const getRefCallback = useCallback6((tabId) => {
|
|
2603
3101
|
let callback = refCallbacksMap.current.get(tabId);
|
|
2604
3102
|
if (!callback) {
|
|
2605
3103
|
callback = (ref) => {
|
|
@@ -2613,10 +3111,10 @@ var TabbedTerminalPanelInner = ({
|
|
|
2613
3111
|
}
|
|
2614
3112
|
return callback;
|
|
2615
3113
|
}, []);
|
|
2616
|
-
const hasInitializedRef =
|
|
2617
|
-
const isCreatingTabRef =
|
|
2618
|
-
const headerRef =
|
|
2619
|
-
const handleTabScrollPositionChange =
|
|
3114
|
+
const hasInitializedRef = useRef5(false);
|
|
3115
|
+
const isCreatingTabRef = useRef5(false);
|
|
3116
|
+
const headerRef = useRef5(null);
|
|
3117
|
+
const handleTabScrollPositionChange = useCallback6((tabId, position) => {
|
|
2620
3118
|
setScrollPositions((prev) => new Map(prev).set(tabId, position));
|
|
2621
3119
|
}, []);
|
|
2622
3120
|
const defaultScrollPosition = {
|
|
@@ -2624,12 +3122,12 @@ var TabbedTerminalPanelInner = ({
|
|
|
2624
3122
|
isAtBottom: true,
|
|
2625
3123
|
isScrollLocked: false
|
|
2626
3124
|
};
|
|
2627
|
-
const handleToggleScrollLock =
|
|
3125
|
+
const handleToggleScrollLock = useCallback6(() => {
|
|
2628
3126
|
if (activeTabId) {
|
|
2629
3127
|
tabRefsMap.current.get(activeTabId)?.toggleScrollLock();
|
|
2630
3128
|
}
|
|
2631
3129
|
}, [activeTabId]);
|
|
2632
|
-
const restoreOwnedSessions =
|
|
3130
|
+
const restoreOwnedSessions = useCallback6(async () => {
|
|
2633
3131
|
try {
|
|
2634
3132
|
let sessions = [];
|
|
2635
3133
|
if (actions.listTerminalSessions) {
|
|
@@ -2681,7 +3179,7 @@ var TabbedTerminalPanelInner = ({
|
|
|
2681
3179
|
console.error("[TabbedTerminalPanel] Failed to restore owned sessions:", err);
|
|
2682
3180
|
}
|
|
2683
3181
|
}, [terminalContext, sessionIds, activeTabId, onTabsChange, actions, directory, setActiveTabId]);
|
|
2684
|
-
const fetchForeignSessions =
|
|
3182
|
+
const fetchForeignSessions = useCallback6(async () => {
|
|
2685
3183
|
try {
|
|
2686
3184
|
if (!actions.listTerminalSessions) {
|
|
2687
3185
|
return;
|
|
@@ -2713,7 +3211,7 @@ var TabbedTerminalPanelInner = ({
|
|
|
2713
3211
|
console.error("[TabbedTerminalPanel] Failed to fetch foreign sessions:", err);
|
|
2714
3212
|
}
|
|
2715
3213
|
}, [terminalContext, actions]);
|
|
2716
|
-
const clearForeignTabs =
|
|
3214
|
+
const clearForeignTabs = useCallback6(() => {
|
|
2717
3215
|
setForeignTabs((prevForeign) => {
|
|
2718
3216
|
const foreignTabIds = new Set(prevForeign.map((t) => t.id));
|
|
2719
3217
|
setSessionIds((prev) => {
|
|
@@ -2724,13 +3222,13 @@ var TabbedTerminalPanelInner = ({
|
|
|
2724
3222
|
return [];
|
|
2725
3223
|
});
|
|
2726
3224
|
}, []);
|
|
2727
|
-
|
|
3225
|
+
useEffect5(() => {
|
|
2728
3226
|
if (hasInitializedRef.current)
|
|
2729
3227
|
return;
|
|
2730
3228
|
hasInitializedRef.current = true;
|
|
2731
3229
|
restoreOwnedSessions();
|
|
2732
3230
|
}, []);
|
|
2733
|
-
|
|
3231
|
+
useEffect5(() => {
|
|
2734
3232
|
const handleSessionCreated2 = (event) => {
|
|
2735
3233
|
const customEvent = event;
|
|
2736
3234
|
const { context: context2 } = customEvent.detail || {};
|
|
@@ -2744,17 +3242,17 @@ var TabbedTerminalPanelInner = ({
|
|
|
2744
3242
|
window.removeEventListener("terminal-session-created", handleSessionCreated2);
|
|
2745
3243
|
};
|
|
2746
3244
|
}, [terminalContext, restoreOwnedSessions]);
|
|
2747
|
-
|
|
3245
|
+
useEffect5(() => {
|
|
2748
3246
|
if (showAllTerminals) {
|
|
2749
3247
|
fetchForeignSessions();
|
|
2750
3248
|
} else {
|
|
2751
3249
|
clearForeignTabs();
|
|
2752
3250
|
}
|
|
2753
3251
|
}, [showAllTerminals, fetchForeignSessions, clearForeignTabs]);
|
|
2754
|
-
const switchTab =
|
|
3252
|
+
const switchTab = useCallback6((tabId) => {
|
|
2755
3253
|
setActiveTabId(tabId);
|
|
2756
3254
|
}, [setActiveTabId]);
|
|
2757
|
-
const addNewTab =
|
|
3255
|
+
const addNewTab = useCallback6((label, command, targetDirectory) => {
|
|
2758
3256
|
const targetDir = targetDirectory || directory;
|
|
2759
3257
|
const directoryName = targetDir.split("/").pop() || targetDir;
|
|
2760
3258
|
const newTab = {
|
|
@@ -2772,10 +3270,10 @@ var TabbedTerminalPanelInner = ({
|
|
|
2772
3270
|
});
|
|
2773
3271
|
setActiveTabId(newTab.id);
|
|
2774
3272
|
}, [directory, onTabsChange]);
|
|
2775
|
-
const isForeignTab =
|
|
3273
|
+
const isForeignTab = useCallback6((tabId) => {
|
|
2776
3274
|
return tabId.startsWith("tab-foreign-");
|
|
2777
3275
|
}, []);
|
|
2778
|
-
const closeTab =
|
|
3276
|
+
const closeTab = useCallback6(async (tabId) => {
|
|
2779
3277
|
const sessionId = sessionIds.get(tabId);
|
|
2780
3278
|
const isForeign = isForeignTab(tabId);
|
|
2781
3279
|
if (!isForeign && sessionId && actions.destroyTerminalSession) {
|
|
@@ -2845,10 +3343,10 @@ var TabbedTerminalPanelInner = ({
|
|
|
2845
3343
|
});
|
|
2846
3344
|
}
|
|
2847
3345
|
}, [activeTabId, sessionIds, actions, onTabsChange, isForeignTab, ownedTabs, foreignTabs]);
|
|
2848
|
-
const handleSessionCreated =
|
|
3346
|
+
const handleSessionCreated = useCallback6((tabId, sessionId) => {
|
|
2849
3347
|
setSessionIds((prev) => new Map(prev).set(tabId, sessionId));
|
|
2850
3348
|
}, []);
|
|
2851
|
-
const handleActivityStateChange =
|
|
3349
|
+
const handleActivityStateChange = useCallback6((sessionId, isActive) => {
|
|
2852
3350
|
setActivityStates((prev) => {
|
|
2853
3351
|
const next = new Map(prev);
|
|
2854
3352
|
if (isActive) {
|
|
@@ -2879,7 +3377,7 @@ var TabbedTerminalPanelInner = ({
|
|
|
2879
3377
|
}
|
|
2880
3378
|
}
|
|
2881
3379
|
});
|
|
2882
|
-
const renderTabAccessory =
|
|
3380
|
+
const renderTabAccessory = useCallback6((tab) => {
|
|
2883
3381
|
const tabSessionId = sessionIds.get(tab.id);
|
|
2884
3382
|
const hasExternalWorkingState = tabSessionId ? workingStates?.[tabSessionId]?.isWorking : false;
|
|
2885
3383
|
const hasInternalActivity = tabSessionId ? activityStates.get(tabSessionId) : false;
|
|
@@ -2888,9 +3386,9 @@ var TabbedTerminalPanelInner = ({
|
|
|
2888
3386
|
if (!isActive)
|
|
2889
3387
|
return null;
|
|
2890
3388
|
const scrollPosition = scrollPositions.get(tab.id) ?? defaultScrollPosition;
|
|
2891
|
-
return /* @__PURE__ */
|
|
3389
|
+
return /* @__PURE__ */ jsxs8(Fragment2, {
|
|
2892
3390
|
children: [
|
|
2893
|
-
/* @__PURE__ */
|
|
3391
|
+
/* @__PURE__ */ jsx10("button", {
|
|
2894
3392
|
onClick: (e) => {
|
|
2895
3393
|
e.stopPropagation();
|
|
2896
3394
|
handleToggleScrollLock();
|
|
@@ -2915,13 +3413,13 @@ var TabbedTerminalPanelInner = ({
|
|
|
2915
3413
|
e.currentTarget.style.backgroundColor = "transparent";
|
|
2916
3414
|
},
|
|
2917
3415
|
title: scrollPosition.isScrollLocked ? "Scroll locked" : "Scroll unlocked",
|
|
2918
|
-
children: scrollPosition.isScrollLocked ? /* @__PURE__ */
|
|
3416
|
+
children: scrollPosition.isScrollLocked ? /* @__PURE__ */ jsx10(Lock2, {
|
|
2919
3417
|
size: 10
|
|
2920
|
-
}) : /* @__PURE__ */
|
|
3418
|
+
}) : /* @__PURE__ */ jsx10(Unlock2, {
|
|
2921
3419
|
size: 10
|
|
2922
3420
|
})
|
|
2923
3421
|
}),
|
|
2924
|
-
/* @__PURE__ */
|
|
3422
|
+
/* @__PURE__ */ jsx10("div", {
|
|
2925
3423
|
style: {
|
|
2926
3424
|
position: "absolute",
|
|
2927
3425
|
right: "8px",
|
|
@@ -2932,7 +3430,7 @@ var TabbedTerminalPanelInner = ({
|
|
|
2932
3430
|
height: "16px"
|
|
2933
3431
|
},
|
|
2934
3432
|
title: isWorking ? "Terminal active" : "Terminal idle",
|
|
2935
|
-
children: /* @__PURE__ */
|
|
3433
|
+
children: /* @__PURE__ */ jsx10(ActivityIndicator, {
|
|
2936
3434
|
color: theme.colors.primary,
|
|
2937
3435
|
isAnimating: isWorking ?? false
|
|
2938
3436
|
})
|
|
@@ -2940,8 +3438,8 @@ var TabbedTerminalPanelInner = ({
|
|
|
2940
3438
|
]
|
|
2941
3439
|
});
|
|
2942
3440
|
}, [activeTabId, scrollPositions, defaultScrollPosition, handleToggleScrollLock, theme, sessionIds, workingStates, activityStates]);
|
|
2943
|
-
const renderTerminalWithAssociation =
|
|
2944
|
-
const terminalContent = /* @__PURE__ */
|
|
3441
|
+
const renderTerminalWithAssociation = useCallback6((tab, isActive, sessionId, association) => {
|
|
3442
|
+
const terminalContent = /* @__PURE__ */ jsx10(TerminalTabContent, {
|
|
2945
3443
|
ref: getRefCallback(tab.id),
|
|
2946
3444
|
tab,
|
|
2947
3445
|
sessionId,
|
|
@@ -2960,7 +3458,7 @@ var TabbedTerminalPanelInner = ({
|
|
|
2960
3458
|
onActivityStateChange: handleActivityStateChange
|
|
2961
3459
|
}, `terminal-${tab.id}`);
|
|
2962
3460
|
const hasAssociation = !!association;
|
|
2963
|
-
const secondaryContent = hasAssociation && renderAssociatedContent ? renderAssociatedContent(association.associatedTabId, isActive) : /* @__PURE__ */
|
|
3461
|
+
const secondaryContent = hasAssociation && renderAssociatedContent ? renderAssociatedContent(association.associatedTabId, isActive) : /* @__PURE__ */ jsx10("div", {
|
|
2964
3462
|
style: {
|
|
2965
3463
|
height: "100%",
|
|
2966
3464
|
display: "flex",
|
|
@@ -2972,12 +3470,12 @@ var TabbedTerminalPanelInner = ({
|
|
|
2972
3470
|
},
|
|
2973
3471
|
children: "Drag a tab here to associate it with this terminal"
|
|
2974
3472
|
});
|
|
2975
|
-
const headerConfig = hasAssociation && getAssociatedHeader ? getAssociatedHeader(association.associatedTabId) : { title: "Drop zone", icon: /* @__PURE__ */
|
|
3473
|
+
const headerConfig = hasAssociation && getAssociatedHeader ? getAssociatedHeader(association.associatedTabId) : { title: "Drop zone", icon: /* @__PURE__ */ jsx10(Paperclip, {
|
|
2976
3474
|
size: 14
|
|
2977
3475
|
}) };
|
|
2978
3476
|
const isCollapsed = hasAssociation ? association.collapsed : true;
|
|
2979
3477
|
const handleCollapsedChange = hasAssociation ? (collapsed) => onAssociationCollapsedChange?.(tab.id, collapsed) : undefined;
|
|
2980
|
-
return /* @__PURE__ */
|
|
3478
|
+
return /* @__PURE__ */ jsx10(CollapsibleSplitPane, {
|
|
2981
3479
|
style: { height: "100%" },
|
|
2982
3480
|
primaryContent: terminalContent,
|
|
2983
3481
|
secondaryContent,
|
|
@@ -3008,7 +3506,7 @@ var TabbedTerminalPanelInner = ({
|
|
|
3008
3506
|
onAssociationRatioChange,
|
|
3009
3507
|
theme
|
|
3010
3508
|
]);
|
|
3011
|
-
const handleTabDrop =
|
|
3509
|
+
const handleTabDrop = useCallback6((draggedTabId, targetTabId) => {
|
|
3012
3510
|
const draggedTab = tabs.find((t) => t.id === draggedTabId);
|
|
3013
3511
|
const targetTab = tabs.find((t) => t.id === targetTabId);
|
|
3014
3512
|
if (targetTab?.contentType === "terminal" && draggedTab?.contentType !== "terminal") {
|
|
@@ -3016,13 +3514,13 @@ var TabbedTerminalPanelInner = ({
|
|
|
3016
3514
|
setActiveTabId(targetTabId);
|
|
3017
3515
|
}
|
|
3018
3516
|
}, [tabs, onTabAssociate, setActiveTabId]);
|
|
3019
|
-
const canDropOnTab =
|
|
3517
|
+
const canDropOnTab = useCallback6((draggedTabId, targetTabId) => {
|
|
3020
3518
|
const draggedTab = tabs.find((t) => t.id === draggedTabId);
|
|
3021
3519
|
const targetTab = tabs.find((t) => t.id === targetTabId);
|
|
3022
3520
|
return targetTab?.contentType === "terminal" && draggedTab?.contentType !== "terminal";
|
|
3023
3521
|
}, [tabs]);
|
|
3024
|
-
const [isDragOverContent, setIsDragOverContent] =
|
|
3025
|
-
const handleContentDragEnter =
|
|
3522
|
+
const [isDragOverContent, setIsDragOverContent] = useState5(false);
|
|
3523
|
+
const handleContentDragEnter = useCallback6((e) => {
|
|
3026
3524
|
e.preventDefault();
|
|
3027
3525
|
if (activeTabId) {
|
|
3028
3526
|
const activeTab = tabs.find((t) => t.id === activeTabId);
|
|
@@ -3031,13 +3529,13 @@ var TabbedTerminalPanelInner = ({
|
|
|
3031
3529
|
}
|
|
3032
3530
|
}
|
|
3033
3531
|
}, [activeTabId, tabs]);
|
|
3034
|
-
const handleContentDragLeave =
|
|
3532
|
+
const handleContentDragLeave = useCallback6((e) => {
|
|
3035
3533
|
const relatedTarget = e.relatedTarget;
|
|
3036
3534
|
if (!e.currentTarget.contains(relatedTarget)) {
|
|
3037
3535
|
setIsDragOverContent(false);
|
|
3038
3536
|
}
|
|
3039
3537
|
}, []);
|
|
3040
|
-
const handleContentDrop =
|
|
3538
|
+
const handleContentDrop = useCallback6((e) => {
|
|
3041
3539
|
e.preventDefault();
|
|
3042
3540
|
e.stopPropagation();
|
|
3043
3541
|
setIsDragOverContent(false);
|
|
@@ -3052,7 +3550,7 @@ var TabbedTerminalPanelInner = ({
|
|
|
3052
3550
|
setActiveTabId(activeTabId);
|
|
3053
3551
|
}
|
|
3054
3552
|
}, [activeTabId, tabs, onTabAssociate, setActiveTabId]);
|
|
3055
|
-
return /* @__PURE__ */
|
|
3553
|
+
return /* @__PURE__ */ jsxs8("div", {
|
|
3056
3554
|
style: {
|
|
3057
3555
|
display: "flex",
|
|
3058
3556
|
flexDirection: "column",
|
|
@@ -3060,15 +3558,15 @@ var TabbedTerminalPanelInner = ({
|
|
|
3060
3558
|
backgroundColor: theme.colors.background
|
|
3061
3559
|
},
|
|
3062
3560
|
children: [
|
|
3063
|
-
!hideHeader && /* @__PURE__ */
|
|
3561
|
+
!hideHeader && /* @__PURE__ */ jsx10("div", {
|
|
3064
3562
|
ref: headerRef,
|
|
3065
|
-
children: /* @__PURE__ */
|
|
3563
|
+
children: /* @__PURE__ */ jsx10(TabBar, {
|
|
3066
3564
|
tabs: genericTabs,
|
|
3067
3565
|
activeTabId,
|
|
3068
3566
|
onTabClick: switchTab,
|
|
3069
3567
|
onTabClose: closeTab,
|
|
3070
3568
|
onNewTab: addNewTab,
|
|
3071
|
-
leftSection: /* @__PURE__ */
|
|
3569
|
+
leftSection: /* @__PURE__ */ jsx10("button", {
|
|
3072
3570
|
onClick: () => onShowAllTerminalsChange?.(!showAllTerminals),
|
|
3073
3571
|
style: {
|
|
3074
3572
|
display: "flex",
|
|
@@ -3093,9 +3591,9 @@ var TabbedTerminalPanelInner = ({
|
|
|
3093
3591
|
}
|
|
3094
3592
|
},
|
|
3095
3593
|
title: showAllTerminals ? "Showing all terminals (click to filter by context)" : "Show all terminals",
|
|
3096
|
-
children: showAllTerminals ? /* @__PURE__ */
|
|
3594
|
+
children: showAllTerminals ? /* @__PURE__ */ jsx10(Boxes, {
|
|
3097
3595
|
size: 14
|
|
3098
|
-
}) : /* @__PURE__ */
|
|
3596
|
+
}) : /* @__PURE__ */ jsx10(Box, {
|
|
3099
3597
|
size: 14
|
|
3100
3598
|
})
|
|
3101
3599
|
}),
|
|
@@ -3108,7 +3606,7 @@ var TabbedTerminalPanelInner = ({
|
|
|
3108
3606
|
canDropOnTab
|
|
3109
3607
|
})
|
|
3110
3608
|
}),
|
|
3111
|
-
/* @__PURE__ */
|
|
3609
|
+
/* @__PURE__ */ jsxs8("div", {
|
|
3112
3610
|
style: {
|
|
3113
3611
|
flex: 1,
|
|
3114
3612
|
display: "flex",
|
|
@@ -3162,7 +3660,7 @@ var TabbedTerminalPanelInner = ({
|
|
|
3162
3660
|
const customContent = renderTabContent(tab, isActive, sessionId, width);
|
|
3163
3661
|
if (customContent === null && tab.contentType === "terminal") {
|
|
3164
3662
|
const association = associations?.[tab.id];
|
|
3165
|
-
return /* @__PURE__ */
|
|
3663
|
+
return /* @__PURE__ */ jsx10("div", {
|
|
3166
3664
|
style: {
|
|
3167
3665
|
display: isActive ? "flex" : "none",
|
|
3168
3666
|
flexDirection: "column",
|
|
@@ -3173,7 +3671,7 @@ var TabbedTerminalPanelInner = ({
|
|
|
3173
3671
|
}, tab.id);
|
|
3174
3672
|
}
|
|
3175
3673
|
const hasBeenActivated = activatedTabs.has(tab.id);
|
|
3176
|
-
return /* @__PURE__ */
|
|
3674
|
+
return /* @__PURE__ */ jsx10("div", {
|
|
3177
3675
|
style: {
|
|
3178
3676
|
display: isActive ? "flex" : "none",
|
|
3179
3677
|
flexDirection: "column",
|
|
@@ -3185,7 +3683,7 @@ var TabbedTerminalPanelInner = ({
|
|
|
3185
3683
|
}
|
|
3186
3684
|
if (tab.contentType === "terminal") {
|
|
3187
3685
|
const association = associations?.[tab.id];
|
|
3188
|
-
return /* @__PURE__ */
|
|
3686
|
+
return /* @__PURE__ */ jsx10("div", {
|
|
3189
3687
|
style: {
|
|
3190
3688
|
display: isActive ? "flex" : "none",
|
|
3191
3689
|
flexDirection: "column",
|
|
@@ -3195,7 +3693,7 @@ var TabbedTerminalPanelInner = ({
|
|
|
3195
3693
|
children: renderTerminalWithAssociation(tab, isActive, sessionId, association)
|
|
3196
3694
|
}, tab.id);
|
|
3197
3695
|
}
|
|
3198
|
-
return /* @__PURE__ */
|
|
3696
|
+
return /* @__PURE__ */ jsxs8("div", {
|
|
3199
3697
|
style: {
|
|
3200
3698
|
display: isActive ? "flex" : "none",
|
|
3201
3699
|
alignItems: "center",
|
|
@@ -3204,20 +3702,20 @@ var TabbedTerminalPanelInner = ({
|
|
|
3204
3702
|
color: theme.colors.textSecondary
|
|
3205
3703
|
},
|
|
3206
3704
|
children: [
|
|
3207
|
-
/* @__PURE__ */
|
|
3705
|
+
/* @__PURE__ */ jsxs8("p", {
|
|
3208
3706
|
children: [
|
|
3209
3707
|
"Unknown content type: ",
|
|
3210
3708
|
tab.contentType
|
|
3211
3709
|
]
|
|
3212
3710
|
}),
|
|
3213
|
-
/* @__PURE__ */
|
|
3711
|
+
/* @__PURE__ */ jsx10("p", {
|
|
3214
3712
|
style: { fontSize: theme.fontSizes[0], marginTop: "8px" },
|
|
3215
3713
|
children: "Provide a renderTabContent prop to render custom tab types"
|
|
3216
3714
|
})
|
|
3217
3715
|
]
|
|
3218
3716
|
}, tab.id);
|
|
3219
3717
|
}),
|
|
3220
|
-
tabs.length === 0 && /* @__PURE__ */
|
|
3718
|
+
tabs.length === 0 && /* @__PURE__ */ jsxs8("div", {
|
|
3221
3719
|
style: {
|
|
3222
3720
|
display: "flex",
|
|
3223
3721
|
flexDirection: "column",
|
|
@@ -3227,11 +3725,11 @@ var TabbedTerminalPanelInner = ({
|
|
|
3227
3725
|
color: theme.colors.textSecondary
|
|
3228
3726
|
},
|
|
3229
3727
|
children: [
|
|
3230
|
-
/* @__PURE__ */
|
|
3728
|
+
/* @__PURE__ */ jsx10(TerminalIcon2, {
|
|
3231
3729
|
size: 32,
|
|
3232
3730
|
style: { opacity: 0.5, marginBottom: "16px" }
|
|
3233
3731
|
}),
|
|
3234
|
-
/* @__PURE__ */
|
|
3732
|
+
/* @__PURE__ */ jsx10("button", {
|
|
3235
3733
|
onClick: () => addNewTab(),
|
|
3236
3734
|
style: {
|
|
3237
3735
|
marginTop: "16px",
|
|
@@ -3516,10 +4014,13 @@ export {
|
|
|
3516
4014
|
context,
|
|
3517
4015
|
closeTerminalSessionTool,
|
|
3518
4016
|
clearTerminalTool,
|
|
4017
|
+
XtermRenderer,
|
|
3519
4018
|
WorkingOverlay,
|
|
3520
4019
|
ThemedTerminalWithProvider,
|
|
3521
4020
|
ThemedTerminal,
|
|
4021
|
+
TerminalSession,
|
|
3522
4022
|
TerminalPanel,
|
|
4023
|
+
TerminalOverlay,
|
|
3523
4024
|
TabbedTerminalPanel,
|
|
3524
4025
|
TabButton,
|
|
3525
4026
|
TabBar,
|