tokmon 0.19.5 → 0.19.6

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 +38 -3
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1537,6 +1537,42 @@ 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 [size, setSize] = useState3(() => ({ cols: stdout?.columns ?? 80, rows: stdout?.rows ?? 24 }));
1543
+ const [resizing, setResizing] = useState3(false);
1544
+ useEffect3(() => {
1545
+ if (!stdout) return;
1546
+ let t;
1547
+ const settle = () => {
1548
+ setSize({ cols: stdout.columns ?? 80, rows: stdout.rows ?? 24 });
1549
+ setResizing(false);
1550
+ };
1551
+ const onResize = () => {
1552
+ setResizing(true);
1553
+ if (t) clearTimeout(t);
1554
+ t = setTimeout(settle, settleMs);
1555
+ };
1556
+ stdout.on("resize", onResize);
1557
+ return () => {
1558
+ if (t) clearTimeout(t);
1559
+ stdout.off("resize", onResize);
1560
+ };
1561
+ }, [stdout, settleMs]);
1562
+ return { cols: size.cols, rows: size.rows, resizing };
1563
+ }
1564
+ function ResizingView() {
1565
+ const { stdout } = useStdout();
1566
+ const cols = stdout?.columns ?? 80;
1567
+ const rows = stdout?.rows ?? 24;
1568
+ return /* @__PURE__ */ jsx7(Box7, { width: cols, height: rows, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxs7(Text7, { dimColor: true, children: [
1569
+ glyphs().dotSel,
1570
+ " resizing\u2026 ",
1571
+ /* @__PURE__ */ jsx7(Text7, { color: "greenBright", children: cols }),
1572
+ "\xD7",
1573
+ /* @__PURE__ */ jsx7(Text7, { color: "greenBright", children: rows })
1574
+ ] }) });
1575
+ }
1540
1576
  function App({ interval: cliInterval, initialConfig }) {
1541
1577
  const [config2, setConfig] = useState3(() => initialConfig ? applyStartup(initialConfig, cliInterval) : null);
1542
1578
  const [detected, setDetected] = useState3([]);
@@ -1568,10 +1604,8 @@ function App({ interval: cliInterval, initialConfig }) {
1568
1604
  const [loaderShownAt, setLoaderShownAt] = useState3(null);
1569
1605
  const loaderDone = useRef2(false);
1570
1606
  const prevShowPicker = useRef2(false);
1571
- const { stdout } = useStdout();
1572
1607
  const { exit } = useApp();
1573
- const rows = stdout?.rows ?? 24;
1574
- const cols = stdout?.columns ?? 80;
1608
+ const { cols, rows, resizing } = useTerminalSize();
1575
1609
  const webRef = useRef2(null);
1576
1610
  const webBusyRef = useRef2(false);
1577
1611
  const webCooldownRef = useRef2(0);
@@ -2350,6 +2384,7 @@ function App({ interval: cliInterval, initialConfig }) {
2350
2384
  }, { isActive: IS_TTY });
2351
2385
  if (error) return /* @__PURE__ */ jsx7(Box7, { padding: 1, children: /* @__PURE__ */ jsx7(Text7, { color: "red", children: error }) });
2352
2386
  if (!config2) return /* @__PURE__ */ jsx7(Box7, { padding: 1, children: /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Loading..." }) });
2387
+ if (resizing) return /* @__PURE__ */ jsx7(ResizingView, {});
2353
2388
  if (showPicker) {
2354
2389
  return /* @__PURE__ */ jsx7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, height: rows, children: /* @__PURE__ */ jsx7(
2355
2390
  Onboarding,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tokmon",
3
- "version": "0.19.5",
3
+ "version": "0.19.6",
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": {