tokmon 0.19.6 → 0.19.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/cli.js +12 -11
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1539,16 +1539,20 @@ function applyStartup(c, cliInterval) {
|
|
|
1539
1539
|
}
|
|
1540
1540
|
function useTerminalSize(settleMs = 90) {
|
|
1541
1541
|
const { stdout } = useStdout();
|
|
1542
|
-
const
|
|
1542
|
+
const read = () => ({ cols: stdout?.columns || 80, rows: stdout?.rows || 24 });
|
|
1543
|
+
const [size, setSize] = useState3(read);
|
|
1544
|
+
const [live, setLive] = useState3(read);
|
|
1543
1545
|
const [resizing, setResizing] = useState3(false);
|
|
1544
1546
|
useEffect3(() => {
|
|
1545
1547
|
if (!stdout) return;
|
|
1546
1548
|
let t;
|
|
1549
|
+
const now = () => ({ cols: stdout.columns || 80, rows: stdout.rows || 24 });
|
|
1547
1550
|
const settle = () => {
|
|
1548
|
-
setSize(
|
|
1551
|
+
setSize(now());
|
|
1549
1552
|
setResizing(false);
|
|
1550
1553
|
};
|
|
1551
1554
|
const onResize = () => {
|
|
1555
|
+
setLive(now());
|
|
1552
1556
|
setResizing(true);
|
|
1553
1557
|
if (t) clearTimeout(t);
|
|
1554
1558
|
t = setTimeout(settle, settleMs);
|
|
@@ -1559,12 +1563,9 @@ function useTerminalSize(settleMs = 90) {
|
|
|
1559
1563
|
stdout.off("resize", onResize);
|
|
1560
1564
|
};
|
|
1561
1565
|
}, [stdout, settleMs]);
|
|
1562
|
-
return { cols: size.cols, rows: size.rows, resizing };
|
|
1566
|
+
return { cols: size.cols, rows: size.rows, resizing, live };
|
|
1563
1567
|
}
|
|
1564
|
-
function ResizingView() {
|
|
1565
|
-
const { stdout } = useStdout();
|
|
1566
|
-
const cols = stdout?.columns ?? 80;
|
|
1567
|
-
const rows = stdout?.rows ?? 24;
|
|
1568
|
+
function ResizingView({ cols, rows }) {
|
|
1568
1569
|
return /* @__PURE__ */ jsx7(Box7, { width: cols, height: rows, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxs7(Text7, { dimColor: true, children: [
|
|
1569
1570
|
glyphs().dotSel,
|
|
1570
1571
|
" resizing\u2026 ",
|
|
@@ -1605,7 +1606,7 @@ function App({ interval: cliInterval, initialConfig }) {
|
|
|
1605
1606
|
const loaderDone = useRef2(false);
|
|
1606
1607
|
const prevShowPicker = useRef2(false);
|
|
1607
1608
|
const { exit } = useApp();
|
|
1608
|
-
const { cols, rows, resizing } = useTerminalSize();
|
|
1609
|
+
const { cols, rows, resizing, live } = useTerminalSize();
|
|
1609
1610
|
const webRef = useRef2(null);
|
|
1610
1611
|
const webBusyRef = useRef2(false);
|
|
1611
1612
|
const webCooldownRef = useRef2(0);
|
|
@@ -1645,13 +1646,13 @@ function App({ interval: cliInterval, initialConfig }) {
|
|
|
1645
1646
|
const headerRows = cols < 70 ? 2 : 1;
|
|
1646
1647
|
const CHROME = 2 + headerRows + 3 + (hasStrip ? 1 + stripLines : 0) + 2 + 2;
|
|
1647
1648
|
const gridBudget = Math.max(1, rows - CHROME);
|
|
1648
|
-
const dashLayout = chooseLayout(
|
|
1649
|
+
const dashLayout = useMemo(() => chooseLayout(
|
|
1649
1650
|
Math.max(56, cols - 4),
|
|
1650
1651
|
gridBudget,
|
|
1651
1652
|
groups.length,
|
|
1652
1653
|
focusId !== null || cfg.dashboardLayout === "single",
|
|
1653
1654
|
cols
|
|
1654
|
-
);
|
|
1655
|
+
), [cols, gridBudget, groups.length, focusId, cfg.dashboardLayout]);
|
|
1655
1656
|
const dashPageCount = dashLayout.pageCount;
|
|
1656
1657
|
const dashPaginated = dashPageCount > 1;
|
|
1657
1658
|
dashPageCountRef.current = dashPageCount;
|
|
@@ -2384,7 +2385,7 @@ function App({ interval: cliInterval, initialConfig }) {
|
|
|
2384
2385
|
}, { isActive: IS_TTY });
|
|
2385
2386
|
if (error) return /* @__PURE__ */ jsx7(Box7, { padding: 1, children: /* @__PURE__ */ jsx7(Text7, { color: "red", children: error }) });
|
|
2386
2387
|
if (!config2) return /* @__PURE__ */ jsx7(Box7, { padding: 1, children: /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Loading..." }) });
|
|
2387
|
-
if (resizing) return /* @__PURE__ */ jsx7(ResizingView, {});
|
|
2388
|
+
if (resizing) return /* @__PURE__ */ jsx7(ResizingView, { cols: live.cols, rows: live.rows });
|
|
2388
2389
|
if (showPicker) {
|
|
2389
2390
|
return /* @__PURE__ */ jsx7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, height: rows, children: /* @__PURE__ */ jsx7(
|
|
2390
2391
|
Onboarding,
|
package/package.json
CHANGED