tokmon 0.14.1 → 0.14.3
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 +44 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -608,8 +608,9 @@ function glyphs() {
|
|
|
608
608
|
}
|
|
609
609
|
|
|
610
610
|
// src/app.tsx
|
|
611
|
+
import { spawn } from "child_process";
|
|
611
612
|
import { useState as useState3, useEffect as useEffect3, useCallback, useRef as useRef2, useMemo } from "react";
|
|
612
|
-
import { Box as Box7, Text as Text7, useInput, useStdout, useApp } from "ink";
|
|
613
|
+
import { Box as Box7, Text as Text7, Transform, useInput, useStdout, useApp } from "ink";
|
|
613
614
|
import { useMouse } from "@zenobius/ink-mouse";
|
|
614
615
|
|
|
615
616
|
// src/http.ts
|
|
@@ -3883,6 +3884,35 @@ var CURSOR_SORTS = [
|
|
|
3883
3884
|
{ label: "model", dir: null }
|
|
3884
3885
|
];
|
|
3885
3886
|
var IS_TTY = process.stdin.isTTY === true;
|
|
3887
|
+
var REPO_URL = "https://github.com/DavidIlie/tokmon";
|
|
3888
|
+
function detectHyperlinks(env, isTTY) {
|
|
3889
|
+
const force = env.FORCE_HYPERLINK;
|
|
3890
|
+
if (force != null && force !== "") return force !== "0" && force.toLowerCase() !== "false";
|
|
3891
|
+
if (!isTTY || env.TERM === "dumb" || env.NO_HYPERLINK) return false;
|
|
3892
|
+
if (env.WT_SESSION || env.ConEmuANSI === "ON" || env.KITTY_WINDOW_ID || env.TERM === "xterm-kitty") return true;
|
|
3893
|
+
if (env.KONSOLE_VERSION || env.TERMINAL_EMULATOR === "JetBrains-JediTerm") return true;
|
|
3894
|
+
if (env.VTE_VERSION && Number(env.VTE_VERSION) >= 5e3) return true;
|
|
3895
|
+
const tp = env.TERM_PROGRAM;
|
|
3896
|
+
if (tp) {
|
|
3897
|
+
const [maj, min] = (env.TERM_PROGRAM_VERSION ?? "").split(".").map((n) => Number(n) || 0);
|
|
3898
|
+
if (tp === "iTerm.app") return maj > 3 || maj === 3 && min >= 1;
|
|
3899
|
+
if (tp === "vscode" || tp === "WezTerm" || tp === "ghostty" || tp === "Hyper" || tp === "Tabby" || tp === "rio") return true;
|
|
3900
|
+
}
|
|
3901
|
+
return false;
|
|
3902
|
+
}
|
|
3903
|
+
var HYPERLINKS = detectHyperlinks(process.env, process.stdout.isTTY === true);
|
|
3904
|
+
function openUrl(url) {
|
|
3905
|
+
try {
|
|
3906
|
+
if (process.platform === "darwin") spawn("open", [url], { stdio: "ignore", detached: true }).unref();
|
|
3907
|
+
else if (process.platform === "win32") spawn("cmd", ["/c", "start", "", url], { stdio: "ignore", detached: true }).unref();
|
|
3908
|
+
else spawn("xdg-open", [url], { stdio: "ignore", detached: true }).unref();
|
|
3909
|
+
} catch {
|
|
3910
|
+
}
|
|
3911
|
+
}
|
|
3912
|
+
function osc8(text, url) {
|
|
3913
|
+
if (!HYPERLINKS) return text;
|
|
3914
|
+
return `\x1B]8;;${url}\x07${text}\x1B]8;;\x07`;
|
|
3915
|
+
}
|
|
3886
3916
|
var DEBOUNCE_MS = 300;
|
|
3887
3917
|
var LOADER_GRACE_MS = 600;
|
|
3888
3918
|
var LOADER_MAX_MS = 8e3;
|
|
@@ -4904,9 +4934,9 @@ function Footer({ hasAccounts, paginated, cols }) {
|
|
|
4904
4934
|
const showPage = paginated && inner >= BASE2 + (showJump ? JUMP : 0) + PAGE;
|
|
4905
4935
|
return /* @__PURE__ */ jsxs7(Box7, { marginTop: 1, flexWrap: "nowrap", children: [
|
|
4906
4936
|
/* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "by " }),
|
|
4907
|
-
/* @__PURE__ */ jsx7(Text7, { children: "David Ilie" }),
|
|
4937
|
+
/* @__PURE__ */ jsx7(ClickableBox, { onClick: () => openUrl(REPO_URL), children: /* @__PURE__ */ jsx7(Transform, { transform: (s) => osc8(s, REPO_URL), children: /* @__PURE__ */ jsx7(Text7, { underline: true, children: "David Ilie" }) }) }),
|
|
4908
4938
|
/* @__PURE__ */ jsx7(Text7, { dimColor: true, children: " (" }),
|
|
4909
|
-
/* @__PURE__ */ jsx7(Text7, { color: "cyan", children: "davidilie.com" }),
|
|
4939
|
+
/* @__PURE__ */ jsx7(ClickableBox, { onClick: () => openUrl("https://davidilie.com"), children: /* @__PURE__ */ jsx7(Transform, { transform: (s) => osc8(s, "https://davidilie.com"), children: /* @__PURE__ */ jsx7(Text7, { color: "cyan", underline: true, children: "davidilie.com" }) }) }),
|
|
4910
4940
|
/* @__PURE__ */ jsxs7(Text7, { dimColor: true, children: [
|
|
4911
4941
|
") ",
|
|
4912
4942
|
glyphs().middot,
|
|
@@ -5002,8 +5032,16 @@ for (let i = 0; i < args.length; i++) {
|
|
|
5002
5032
|
}
|
|
5003
5033
|
}
|
|
5004
5034
|
var config = await loadConfig();
|
|
5005
|
-
|
|
5006
|
-
|
|
5035
|
+
var altScreen = config.clearScreen && process.stdout.isTTY === true;
|
|
5036
|
+
var leaveAltScreen = () => {
|
|
5037
|
+
try {
|
|
5038
|
+
process.stdout.write("\x1B[?1049l");
|
|
5039
|
+
} catch {
|
|
5040
|
+
}
|
|
5041
|
+
};
|
|
5042
|
+
if (altScreen) {
|
|
5043
|
+
process.stdout.write("\x1B[?1049h\x1B[H");
|
|
5044
|
+
process.once("exit", leaveAltScreen);
|
|
5007
5045
|
}
|
|
5008
5046
|
setGlyphs(resolveGlyphs({
|
|
5009
5047
|
flag: asciiFlag,
|
|
@@ -5015,3 +5053,4 @@ setGlyphs(resolveGlyphs({
|
|
|
5015
5053
|
var { waitUntilExit } = render(/* @__PURE__ */ jsx8(MouseProvider, { children: /* @__PURE__ */ jsx8(App, { interval, initialConfig: config }) }));
|
|
5016
5054
|
await waitUntilExit();
|
|
5017
5055
|
await flushDisk();
|
|
5056
|
+
if (altScreen) leaveAltScreen();
|