tokmon 0.19.5 → 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.
Files changed (2) hide show
  1. package/dist/cli.js +41 -5
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1537,6 +1537,43 @@ function applyStartup(c, cliInterval) {
1537
1537
  if (c.defaultFocus === "all") c = { ...c, activeAccountId: null };
1538
1538
  return c;
1539
1539
  }
1540
+ function useTerminalSize(settleMs = 90) {
1541
+ const { stdout } = useStdout();
1542
+ const read = () => ({ cols: stdout?.columns || 80, rows: stdout?.rows || 24 });
1543
+ const [size, setSize] = useState3(read);
1544
+ const [live, setLive] = useState3(read);
1545
+ const [resizing, setResizing] = useState3(false);
1546
+ useEffect3(() => {
1547
+ if (!stdout) return;
1548
+ let t;
1549
+ const now = () => ({ cols: stdout.columns || 80, rows: stdout.rows || 24 });
1550
+ const settle = () => {
1551
+ setSize(now());
1552
+ setResizing(false);
1553
+ };
1554
+ const onResize = () => {
1555
+ setLive(now());
1556
+ setResizing(true);
1557
+ if (t) clearTimeout(t);
1558
+ t = setTimeout(settle, settleMs);
1559
+ };
1560
+ stdout.on("resize", onResize);
1561
+ return () => {
1562
+ if (t) clearTimeout(t);
1563
+ stdout.off("resize", onResize);
1564
+ };
1565
+ }, [stdout, settleMs]);
1566
+ return { cols: size.cols, rows: size.rows, resizing, live };
1567
+ }
1568
+ function ResizingView({ cols, rows }) {
1569
+ return /* @__PURE__ */ jsx7(Box7, { width: cols, height: rows, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxs7(Text7, { dimColor: true, children: [
1570
+ glyphs().dotSel,
1571
+ " resizing\u2026 ",
1572
+ /* @__PURE__ */ jsx7(Text7, { color: "greenBright", children: cols }),
1573
+ "\xD7",
1574
+ /* @__PURE__ */ jsx7(Text7, { color: "greenBright", children: rows })
1575
+ ] }) });
1576
+ }
1540
1577
  function App({ interval: cliInterval, initialConfig }) {
1541
1578
  const [config2, setConfig] = useState3(() => initialConfig ? applyStartup(initialConfig, cliInterval) : null);
1542
1579
  const [detected, setDetected] = useState3([]);
@@ -1568,10 +1605,8 @@ function App({ interval: cliInterval, initialConfig }) {
1568
1605
  const [loaderShownAt, setLoaderShownAt] = useState3(null);
1569
1606
  const loaderDone = useRef2(false);
1570
1607
  const prevShowPicker = useRef2(false);
1571
- const { stdout } = useStdout();
1572
1608
  const { exit } = useApp();
1573
- const rows = stdout?.rows ?? 24;
1574
- const cols = stdout?.columns ?? 80;
1609
+ const { cols, rows, resizing, live } = useTerminalSize();
1575
1610
  const webRef = useRef2(null);
1576
1611
  const webBusyRef = useRef2(false);
1577
1612
  const webCooldownRef = useRef2(0);
@@ -1611,13 +1646,13 @@ function App({ interval: cliInterval, initialConfig }) {
1611
1646
  const headerRows = cols < 70 ? 2 : 1;
1612
1647
  const CHROME = 2 + headerRows + 3 + (hasStrip ? 1 + stripLines : 0) + 2 + 2;
1613
1648
  const gridBudget = Math.max(1, rows - CHROME);
1614
- const dashLayout = chooseLayout(
1649
+ const dashLayout = useMemo(() => chooseLayout(
1615
1650
  Math.max(56, cols - 4),
1616
1651
  gridBudget,
1617
1652
  groups.length,
1618
1653
  focusId !== null || cfg.dashboardLayout === "single",
1619
1654
  cols
1620
- );
1655
+ ), [cols, gridBudget, groups.length, focusId, cfg.dashboardLayout]);
1621
1656
  const dashPageCount = dashLayout.pageCount;
1622
1657
  const dashPaginated = dashPageCount > 1;
1623
1658
  dashPageCountRef.current = dashPageCount;
@@ -2350,6 +2385,7 @@ function App({ interval: cliInterval, initialConfig }) {
2350
2385
  }, { isActive: IS_TTY });
2351
2386
  if (error) return /* @__PURE__ */ jsx7(Box7, { padding: 1, children: /* @__PURE__ */ jsx7(Text7, { color: "red", children: error }) });
2352
2387
  if (!config2) return /* @__PURE__ */ jsx7(Box7, { padding: 1, children: /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Loading..." }) });
2388
+ if (resizing) return /* @__PURE__ */ jsx7(ResizingView, { cols: live.cols, rows: live.rows });
2353
2389
  if (showPicker) {
2354
2390
  return /* @__PURE__ */ jsx7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, height: rows, children: /* @__PURE__ */ jsx7(
2355
2391
  Onboarding,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tokmon",
3
- "version": "0.19.5",
3
+ "version": "0.19.7",
4
4
  "description": "Terminal + web dashboard for Claude Code, Codex, Cursor, opencode, pi, Copilot, Gemini & more — usage, limits, and costs",
5
5
  "type": "module",
6
6
  "bin": {