ccstatusline 2.2.19 → 2.2.20
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/README.md +15 -5
- package/dist/ccstatusline.js +1052 -82
- package/package.json +3 -3
package/dist/ccstatusline.js
CHANGED
|
@@ -1355,7 +1355,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
1355
1355
|
exports.useTransition = function() {
|
|
1356
1356
|
return resolveDispatcher().useTransition();
|
|
1357
1357
|
};
|
|
1358
|
-
exports.version = "19.2.
|
|
1358
|
+
exports.version = "19.2.7";
|
|
1359
1359
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
1360
1360
|
})();
|
|
1361
1361
|
});
|
|
@@ -54706,35 +54706,70 @@ function getOriginUrl(cwd2, deps) {
|
|
|
54706
54706
|
const url2 = runGitForCache(["remote", "get-url", "--", "origin"], cwd2, deps);
|
|
54707
54707
|
return url2.length > 0 ? url2 : null;
|
|
54708
54708
|
}
|
|
54709
|
+
function isSshRemoteUrl(url2) {
|
|
54710
|
+
const trimmed = url2.trim().toLowerCase();
|
|
54711
|
+
return trimmed.startsWith("ssh://") || !trimmed.includes("://");
|
|
54712
|
+
}
|
|
54713
|
+
function resolveSshHostAlias(host, deps) {
|
|
54714
|
+
try {
|
|
54715
|
+
const output = deps.execFileSync("ssh", ["-G", host], {
|
|
54716
|
+
encoding: "utf8",
|
|
54717
|
+
stdio: ["pipe", "pipe", "ignore"],
|
|
54718
|
+
timeout: CLI_TIMEOUT,
|
|
54719
|
+
windowsHide: true
|
|
54720
|
+
}).trim();
|
|
54721
|
+
for (const line of output.split(/\r?\n/)) {
|
|
54722
|
+
const match = /^hostname\s+(.+)$/i.exec(line.trim());
|
|
54723
|
+
if (match?.[1]) {
|
|
54724
|
+
return match[1].toLowerCase();
|
|
54725
|
+
}
|
|
54726
|
+
}
|
|
54727
|
+
} catch {}
|
|
54728
|
+
return host.toLowerCase();
|
|
54729
|
+
}
|
|
54730
|
+
function getNamedForgeProvider(host) {
|
|
54731
|
+
if (host.includes("github")) {
|
|
54732
|
+
return "gh";
|
|
54733
|
+
}
|
|
54734
|
+
if (host.includes("gitlab")) {
|
|
54735
|
+
return "glab";
|
|
54736
|
+
}
|
|
54737
|
+
return null;
|
|
54738
|
+
}
|
|
54739
|
+
function getEffectiveRemoteHost(url2, host, deps) {
|
|
54740
|
+
const normalizedHost = host.toLowerCase();
|
|
54741
|
+
if (!isSshRemoteUrl(url2) || getNamedForgeProvider(normalizedHost)) {
|
|
54742
|
+
return normalizedHost;
|
|
54743
|
+
}
|
|
54744
|
+
return resolveSshHostAlias(normalizedHost, deps);
|
|
54745
|
+
}
|
|
54709
54746
|
function getOriginHost(cwd2, deps) {
|
|
54710
54747
|
const url2 = getOriginUrl(cwd2, deps);
|
|
54711
54748
|
if (!url2) {
|
|
54712
54749
|
return null;
|
|
54713
54750
|
}
|
|
54714
54751
|
const parsed = parseRemoteUrl(url2);
|
|
54715
|
-
return parsed ? parsed.host
|
|
54752
|
+
return parsed ? getEffectiveRemoteHost(url2, parsed.host, deps) : null;
|
|
54716
54753
|
}
|
|
54717
|
-
function toHttpsRepoRef(url2) {
|
|
54754
|
+
function toHttpsRepoRef(url2, deps) {
|
|
54718
54755
|
const parsed = parseRemoteUrl(url2);
|
|
54719
54756
|
if (!parsed) {
|
|
54720
54757
|
return null;
|
|
54721
54758
|
}
|
|
54722
|
-
return `https://${parsed.host}/${parsed.owner}/${parsed.repo}`;
|
|
54759
|
+
return `https://${getEffectiveRemoteHost(url2, parsed.host, deps)}/${parsed.owner}/${parsed.repo}`;
|
|
54723
54760
|
}
|
|
54724
54761
|
function getOriginRepoRef(cwd2, deps) {
|
|
54725
54762
|
const url2 = getOriginUrl(cwd2, deps);
|
|
54726
|
-
return url2 ? toHttpsRepoRef(url2) : null;
|
|
54763
|
+
return url2 ? toHttpsRepoRef(url2, deps) : null;
|
|
54727
54764
|
}
|
|
54728
54765
|
function getProviderCandidates(cwd2, deps) {
|
|
54729
54766
|
const host = getOriginHost(cwd2, deps);
|
|
54730
54767
|
if (!host) {
|
|
54731
54768
|
return ["gh", "glab"];
|
|
54732
54769
|
}
|
|
54733
|
-
|
|
54734
|
-
|
|
54735
|
-
|
|
54736
|
-
if (host.includes("gitlab")) {
|
|
54737
|
-
return ["glab"];
|
|
54770
|
+
const namedForgeProvider = getNamedForgeProvider(host);
|
|
54771
|
+
if (namedForgeProvider) {
|
|
54772
|
+
return [namedForgeProvider];
|
|
54738
54773
|
}
|
|
54739
54774
|
const authed = [];
|
|
54740
54775
|
if (isCliAuthedForHost("glab", host, deps)) {
|
|
@@ -56099,6 +56134,278 @@ function getContextWindowSize(data) {
|
|
|
56099
56134
|
return getContextWindowMetrics(data).windowSize;
|
|
56100
56135
|
}
|
|
56101
56136
|
|
|
56137
|
+
// src/utils/gradient.ts
|
|
56138
|
+
function isGradientSpec(value) {
|
|
56139
|
+
return value?.startsWith(GRADIENT_PREFIX) ?? false;
|
|
56140
|
+
}
|
|
56141
|
+
function parseGradientSpec(value) {
|
|
56142
|
+
if (!value?.startsWith(GRADIENT_PREFIX)) {
|
|
56143
|
+
return null;
|
|
56144
|
+
}
|
|
56145
|
+
const body = value.slice(GRADIENT_PREFIX.length).trim();
|
|
56146
|
+
if (!body) {
|
|
56147
|
+
return null;
|
|
56148
|
+
}
|
|
56149
|
+
const preset = GRADIENT_PRESETS[body.toLowerCase()];
|
|
56150
|
+
const rawStops = preset ?? body.split(body.includes(",") ? "," : "-");
|
|
56151
|
+
const stops = rawStops.map((stop) => stop.trim()).filter((stop) => stop.length > 0).map(resolveStopToRgb).filter((rgb) => rgb !== null);
|
|
56152
|
+
return stops.length >= 2 ? stops : null;
|
|
56153
|
+
}
|
|
56154
|
+
function hexToRgb(hex3) {
|
|
56155
|
+
if (!HEX_PATTERN.test(hex3)) {
|
|
56156
|
+
return null;
|
|
56157
|
+
}
|
|
56158
|
+
return {
|
|
56159
|
+
r: parseInt(hex3.slice(0, 2), 16),
|
|
56160
|
+
g: parseInt(hex3.slice(2, 4), 16),
|
|
56161
|
+
b: parseInt(hex3.slice(4, 6), 16)
|
|
56162
|
+
};
|
|
56163
|
+
}
|
|
56164
|
+
function resolveStopToRgb(stop) {
|
|
56165
|
+
if (stop.startsWith("hex:")) {
|
|
56166
|
+
return hexToRgb(stop.slice(4));
|
|
56167
|
+
}
|
|
56168
|
+
if (stop.startsWith("#")) {
|
|
56169
|
+
return hexToRgb(stop.slice(1));
|
|
56170
|
+
}
|
|
56171
|
+
return hexToRgb(stop);
|
|
56172
|
+
}
|
|
56173
|
+
function srgbToLinear(channel) {
|
|
56174
|
+
const normalized = channel / 255;
|
|
56175
|
+
return normalized <= 0.04045 ? normalized / 12.92 : ((normalized + 0.055) / 1.055) ** 2.4;
|
|
56176
|
+
}
|
|
56177
|
+
function linearToSrgb(channel) {
|
|
56178
|
+
const value = channel <= 0.0031308 ? 12.92 * channel : 1.055 * channel ** (1 / 2.4) - 0.055;
|
|
56179
|
+
return Math.round(Math.min(1, Math.max(0, value)) * 255);
|
|
56180
|
+
}
|
|
56181
|
+
function rgbToOklab(rgb) {
|
|
56182
|
+
const lr = srgbToLinear(rgb.r);
|
|
56183
|
+
const lg = srgbToLinear(rgb.g);
|
|
56184
|
+
const lb = srgbToLinear(rgb.b);
|
|
56185
|
+
const l = 0.4122214708 * lr + 0.5363325363 * lg + 0.0514459929 * lb;
|
|
56186
|
+
const m = 0.2119034982 * lr + 0.6806995451 * lg + 0.1073969566 * lb;
|
|
56187
|
+
const s = 0.0883024619 * lr + 0.2817188376 * lg + 0.6299787005 * lb;
|
|
56188
|
+
const lCbrt = Math.cbrt(l);
|
|
56189
|
+
const mCbrt = Math.cbrt(m);
|
|
56190
|
+
const sCbrt = Math.cbrt(s);
|
|
56191
|
+
return {
|
|
56192
|
+
L: 0.2104542553 * lCbrt + 0.793617785 * mCbrt - 0.0040720468 * sCbrt,
|
|
56193
|
+
a: 1.9779984951 * lCbrt - 2.428592205 * mCbrt + 0.4505937099 * sCbrt,
|
|
56194
|
+
b: 0.0259040371 * lCbrt + 0.7827717662 * mCbrt - 0.808675766 * sCbrt
|
|
56195
|
+
};
|
|
56196
|
+
}
|
|
56197
|
+
function oklabToRgb(lab) {
|
|
56198
|
+
const lCbrt = lab.L + 0.3963377774 * lab.a + 0.2158037573 * lab.b;
|
|
56199
|
+
const mCbrt = lab.L - 0.1055613458 * lab.a - 0.0638541728 * lab.b;
|
|
56200
|
+
const sCbrt = lab.L - 0.0894841775 * lab.a - 1.291485548 * lab.b;
|
|
56201
|
+
const l = lCbrt ** 3;
|
|
56202
|
+
const m = mCbrt ** 3;
|
|
56203
|
+
const s = sCbrt ** 3;
|
|
56204
|
+
return {
|
|
56205
|
+
r: linearToSrgb(4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s),
|
|
56206
|
+
g: linearToSrgb(-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s),
|
|
56207
|
+
b: linearToSrgb(-0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s)
|
|
56208
|
+
};
|
|
56209
|
+
}
|
|
56210
|
+
function sampleGradient(stops, t) {
|
|
56211
|
+
const first = stops[0];
|
|
56212
|
+
if (first === undefined) {
|
|
56213
|
+
return { r: 0, g: 0, b: 0 };
|
|
56214
|
+
}
|
|
56215
|
+
if (stops.length === 1) {
|
|
56216
|
+
return first;
|
|
56217
|
+
}
|
|
56218
|
+
const clamped = Math.min(1, Math.max(0, t));
|
|
56219
|
+
const scaled = clamped * (stops.length - 1);
|
|
56220
|
+
const lowerIndex = Math.min(stops.length - 2, Math.floor(scaled));
|
|
56221
|
+
const lower = stops[lowerIndex];
|
|
56222
|
+
const upper = stops[lowerIndex + 1];
|
|
56223
|
+
if (lower === undefined || upper === undefined) {
|
|
56224
|
+
return first;
|
|
56225
|
+
}
|
|
56226
|
+
const fraction = scaled - lowerIndex;
|
|
56227
|
+
const labLower = rgbToOklab(lower);
|
|
56228
|
+
const labUpper = rgbToOklab(upper);
|
|
56229
|
+
return oklabToRgb({
|
|
56230
|
+
L: labLower.L + (labUpper.L - labLower.L) * fraction,
|
|
56231
|
+
a: labLower.a + (labUpper.a - labLower.a) * fraction,
|
|
56232
|
+
b: labLower.b + (labUpper.b - labLower.b) * fraction
|
|
56233
|
+
});
|
|
56234
|
+
}
|
|
56235
|
+
function rgbToAnsi256(rgb) {
|
|
56236
|
+
if (rgb.r === rgb.g && rgb.g === rgb.b) {
|
|
56237
|
+
if (rgb.r < 8) {
|
|
56238
|
+
return 16;
|
|
56239
|
+
}
|
|
56240
|
+
if (rgb.r > 248) {
|
|
56241
|
+
return 231;
|
|
56242
|
+
}
|
|
56243
|
+
return Math.round((rgb.r - 8) / 247 * 24) + 232;
|
|
56244
|
+
}
|
|
56245
|
+
return 16 + 36 * Math.round(rgb.r / 255 * 5) + 6 * Math.round(rgb.g / 255 * 5) + Math.round(rgb.b / 255 * 5);
|
|
56246
|
+
}
|
|
56247
|
+
function gradientCodeAt(stops, t, colorLevel) {
|
|
56248
|
+
const rgb = sampleGradient(stops, t);
|
|
56249
|
+
if (colorLevel === "truecolor") {
|
|
56250
|
+
return `\x1B[38;2;${rgb.r};${rgb.g};${rgb.b}m`;
|
|
56251
|
+
}
|
|
56252
|
+
return `\x1B[38;5;${rgbToAnsi256(rgb)}m`;
|
|
56253
|
+
}
|
|
56254
|
+
function isCsiFinalByte(codePoint) {
|
|
56255
|
+
return codePoint >= 64 && codePoint <= 126;
|
|
56256
|
+
}
|
|
56257
|
+
function consumeCsi(input, start, bodyStart) {
|
|
56258
|
+
let index = bodyStart;
|
|
56259
|
+
while (index < input.length) {
|
|
56260
|
+
const codePoint = input.charCodeAt(index);
|
|
56261
|
+
if (isCsiFinalByte(codePoint)) {
|
|
56262
|
+
const end = index + 1;
|
|
56263
|
+
return {
|
|
56264
|
+
nextIndex: end,
|
|
56265
|
+
sequence: input.slice(start, end)
|
|
56266
|
+
};
|
|
56267
|
+
}
|
|
56268
|
+
index++;
|
|
56269
|
+
}
|
|
56270
|
+
return {
|
|
56271
|
+
nextIndex: input.length,
|
|
56272
|
+
sequence: input.slice(start)
|
|
56273
|
+
};
|
|
56274
|
+
}
|
|
56275
|
+
function consumeOsc(input, start, bodyStart) {
|
|
56276
|
+
let index = bodyStart;
|
|
56277
|
+
while (index < input.length) {
|
|
56278
|
+
const current = input[index];
|
|
56279
|
+
if (!current) {
|
|
56280
|
+
break;
|
|
56281
|
+
}
|
|
56282
|
+
if (current === BEL2 || current === ST) {
|
|
56283
|
+
const end = index + 1;
|
|
56284
|
+
return {
|
|
56285
|
+
nextIndex: end,
|
|
56286
|
+
sequence: input.slice(start, end)
|
|
56287
|
+
};
|
|
56288
|
+
}
|
|
56289
|
+
if (current === ESC2 && input[index + 1] === "\\") {
|
|
56290
|
+
const end = index + 2;
|
|
56291
|
+
return {
|
|
56292
|
+
nextIndex: end,
|
|
56293
|
+
sequence: input.slice(start, end)
|
|
56294
|
+
};
|
|
56295
|
+
}
|
|
56296
|
+
index++;
|
|
56297
|
+
}
|
|
56298
|
+
return {
|
|
56299
|
+
nextIndex: input.length,
|
|
56300
|
+
sequence: input.slice(start)
|
|
56301
|
+
};
|
|
56302
|
+
}
|
|
56303
|
+
function consumeEscapeSequence(input, index) {
|
|
56304
|
+
const current = input[index];
|
|
56305
|
+
if (!current) {
|
|
56306
|
+
return null;
|
|
56307
|
+
}
|
|
56308
|
+
if (current === ESC2) {
|
|
56309
|
+
const next = input[index + 1];
|
|
56310
|
+
if (next === "[") {
|
|
56311
|
+
return consumeCsi(input, index, index + 2);
|
|
56312
|
+
}
|
|
56313
|
+
if (next === "]") {
|
|
56314
|
+
return consumeOsc(input, index, index + 2);
|
|
56315
|
+
}
|
|
56316
|
+
if (next) {
|
|
56317
|
+
return {
|
|
56318
|
+
nextIndex: index + 2,
|
|
56319
|
+
sequence: input.slice(index, index + 2)
|
|
56320
|
+
};
|
|
56321
|
+
}
|
|
56322
|
+
return {
|
|
56323
|
+
nextIndex: input.length,
|
|
56324
|
+
sequence: current
|
|
56325
|
+
};
|
|
56326
|
+
}
|
|
56327
|
+
if (current === C1_CSI) {
|
|
56328
|
+
return consumeCsi(input, index, index + 1);
|
|
56329
|
+
}
|
|
56330
|
+
if (current === C1_OSC) {
|
|
56331
|
+
return consumeOsc(input, index, index + 1);
|
|
56332
|
+
}
|
|
56333
|
+
return null;
|
|
56334
|
+
}
|
|
56335
|
+
function applyGradientToText(text, stops, colorLevel) {
|
|
56336
|
+
if (colorLevel === "ansi16" || text.length === 0) {
|
|
56337
|
+
return text;
|
|
56338
|
+
}
|
|
56339
|
+
let visibleCount = 0;
|
|
56340
|
+
let scanIndex = 0;
|
|
56341
|
+
while (scanIndex < text.length) {
|
|
56342
|
+
const escape3 = consumeEscapeSequence(text, scanIndex);
|
|
56343
|
+
if (escape3) {
|
|
56344
|
+
scanIndex = escape3.nextIndex;
|
|
56345
|
+
continue;
|
|
56346
|
+
}
|
|
56347
|
+
const codePoint = text.codePointAt(scanIndex);
|
|
56348
|
+
if (codePoint === undefined) {
|
|
56349
|
+
break;
|
|
56350
|
+
}
|
|
56351
|
+
const ch = String.fromCodePoint(codePoint);
|
|
56352
|
+
if (!WHITESPACE.test(ch)) {
|
|
56353
|
+
visibleCount++;
|
|
56354
|
+
}
|
|
56355
|
+
scanIndex += ch.length;
|
|
56356
|
+
}
|
|
56357
|
+
if (visibleCount === 0) {
|
|
56358
|
+
return text;
|
|
56359
|
+
}
|
|
56360
|
+
const denominator = Math.max(1, visibleCount - 1);
|
|
56361
|
+
let result2 = "";
|
|
56362
|
+
let index = 0;
|
|
56363
|
+
let textIndex = 0;
|
|
56364
|
+
while (textIndex < text.length) {
|
|
56365
|
+
const escape3 = consumeEscapeSequence(text, textIndex);
|
|
56366
|
+
if (escape3) {
|
|
56367
|
+
result2 += escape3.sequence;
|
|
56368
|
+
textIndex = escape3.nextIndex;
|
|
56369
|
+
continue;
|
|
56370
|
+
}
|
|
56371
|
+
const codePoint = text.codePointAt(textIndex);
|
|
56372
|
+
if (codePoint === undefined) {
|
|
56373
|
+
break;
|
|
56374
|
+
}
|
|
56375
|
+
const ch = String.fromCodePoint(codePoint);
|
|
56376
|
+
if (WHITESPACE.test(ch)) {
|
|
56377
|
+
result2 += ch;
|
|
56378
|
+
textIndex += ch.length;
|
|
56379
|
+
continue;
|
|
56380
|
+
}
|
|
56381
|
+
result2 += gradientCodeAt(stops, index / denominator, colorLevel) + ch;
|
|
56382
|
+
index++;
|
|
56383
|
+
textIndex += ch.length;
|
|
56384
|
+
}
|
|
56385
|
+
return result2;
|
|
56386
|
+
}
|
|
56387
|
+
var GRADIENT_PREFIX = "gradient:", HEX_PATTERN, ESC2 = "\x1B", BEL2 = "\x07", C1_CSI = "", C1_OSC = "", ST = "", GRADIENT_PRESETS, GRADIENT_PRESET_NAMES, WHITESPACE;
|
|
56388
|
+
var init_gradient = __esm(() => {
|
|
56389
|
+
HEX_PATTERN = /^[0-9A-Fa-f]{6}$/;
|
|
56390
|
+
GRADIENT_PRESETS = {
|
|
56391
|
+
atlas: ["#feac5e", "#c779d0", "#4bc0c8"],
|
|
56392
|
+
cristal: ["#bdfff3", "#4ac29a"],
|
|
56393
|
+
teen: ["#77a1d3", "#79cbca", "#e684ae"],
|
|
56394
|
+
mind: ["#473b7b", "#3584a7", "#30d2be"],
|
|
56395
|
+
morning: ["#ff5f6d", "#ffc371"],
|
|
56396
|
+
vice: ["#5ee7df", "#b490ca"],
|
|
56397
|
+
passion: ["#f43b47", "#453a94"],
|
|
56398
|
+
fruit: ["#ff4e50", "#f9d423"],
|
|
56399
|
+
instagram: ["#833ab4", "#fd1d1d", "#fcb045"],
|
|
56400
|
+
retro: ["#3f51b1", "#5a55ae", "#7b5fac", "#8f6aae", "#a86aa4", "#cc6b8e", "#f18271", "#f3a469", "#f7c978"],
|
|
56401
|
+
summer: ["#fdbb2d", "#22c1c3"],
|
|
56402
|
+
rainbow: ["#ff0000", "#ffff00", "#00ff00", "#00ffff", "#0000ff", "#ff00ff", "#ff0000"],
|
|
56403
|
+
pastel: ["#aee9d8", "#cdeeb0", "#f6f0a8", "#f7c8a8", "#f3aecb", "#c3b6f0", "#aee9d8"]
|
|
56404
|
+
};
|
|
56405
|
+
GRADIENT_PRESET_NAMES = Object.keys(GRADIENT_PRESETS);
|
|
56406
|
+
WHITESPACE = /\s/;
|
|
56407
|
+
});
|
|
56408
|
+
|
|
56102
56409
|
// src/utils/ansi.ts
|
|
56103
56410
|
function createUnicodePropertyRegex(pattern) {
|
|
56104
56411
|
try {
|
|
@@ -56217,14 +56524,14 @@ function getTextDisplayWidth(text) {
|
|
|
56217
56524
|
}
|
|
56218
56525
|
return width;
|
|
56219
56526
|
}
|
|
56220
|
-
function
|
|
56527
|
+
function isCsiFinalByte2(codePoint) {
|
|
56221
56528
|
return codePoint >= 64 && codePoint <= 126;
|
|
56222
56529
|
}
|
|
56223
56530
|
function parseCsi(input, start, bodyStart) {
|
|
56224
56531
|
let index = bodyStart;
|
|
56225
56532
|
while (index < input.length) {
|
|
56226
56533
|
const codePoint = input.charCodeAt(index);
|
|
56227
|
-
if (
|
|
56534
|
+
if (isCsiFinalByte2(codePoint)) {
|
|
56228
56535
|
const end = index + 1;
|
|
56229
56536
|
return {
|
|
56230
56537
|
nextIndex: end,
|
|
@@ -56256,7 +56563,7 @@ function parseOsc(input, start, bodyStart) {
|
|
|
56256
56563
|
if (!current) {
|
|
56257
56564
|
break;
|
|
56258
56565
|
}
|
|
56259
|
-
if (current ===
|
|
56566
|
+
if (current === BEL3) {
|
|
56260
56567
|
const end = index + 1;
|
|
56261
56568
|
const body = input.slice(bodyStart, index);
|
|
56262
56569
|
return {
|
|
@@ -56266,7 +56573,7 @@ function parseOsc(input, start, bodyStart) {
|
|
|
56266
56573
|
osc8Terminator: "bel"
|
|
56267
56574
|
};
|
|
56268
56575
|
}
|
|
56269
|
-
if (current ===
|
|
56576
|
+
if (current === ST2) {
|
|
56270
56577
|
const end = index + 1;
|
|
56271
56578
|
const body = input.slice(bodyStart, index);
|
|
56272
56579
|
return {
|
|
@@ -56276,7 +56583,7 @@ function parseOsc(input, start, bodyStart) {
|
|
|
56276
56583
|
osc8Terminator: "st"
|
|
56277
56584
|
};
|
|
56278
56585
|
}
|
|
56279
|
-
if (current ===
|
|
56586
|
+
if (current === ESC3 && input[index + 1] === "\\") {
|
|
56280
56587
|
const end = index + 2;
|
|
56281
56588
|
const body = input.slice(bodyStart, index);
|
|
56282
56589
|
return {
|
|
@@ -56298,7 +56605,7 @@ function parseEscapeSequence(input, index) {
|
|
|
56298
56605
|
if (!current) {
|
|
56299
56606
|
return null;
|
|
56300
56607
|
}
|
|
56301
|
-
if (current ===
|
|
56608
|
+
if (current === ESC3) {
|
|
56302
56609
|
const next = input[index + 1];
|
|
56303
56610
|
if (next === "[") {
|
|
56304
56611
|
return parseCsi(input, index, index + 2);
|
|
@@ -56317,19 +56624,19 @@ function parseEscapeSequence(input, index) {
|
|
|
56317
56624
|
sequence: current
|
|
56318
56625
|
};
|
|
56319
56626
|
}
|
|
56320
|
-
if (current ===
|
|
56627
|
+
if (current === C1_CSI2) {
|
|
56321
56628
|
return parseCsi(input, index, index + 1);
|
|
56322
56629
|
}
|
|
56323
|
-
if (current ===
|
|
56630
|
+
if (current === C1_OSC2) {
|
|
56324
56631
|
return parseOsc(input, index, index + 1);
|
|
56325
56632
|
}
|
|
56326
56633
|
return null;
|
|
56327
56634
|
}
|
|
56328
56635
|
function getOsc8CloseSequence(terminator) {
|
|
56329
56636
|
if (terminator === "bel") {
|
|
56330
|
-
return `${
|
|
56637
|
+
return `${ESC3}]8;;${BEL3}`;
|
|
56331
56638
|
}
|
|
56332
|
-
return `${
|
|
56639
|
+
return `${ESC3}]8;;${ESC3}\\`;
|
|
56333
56640
|
}
|
|
56334
56641
|
function stripSgrCodes(text) {
|
|
56335
56642
|
return text.replace(SGR_REGEX, "");
|
|
@@ -56340,7 +56647,7 @@ function stripOscCodes(text) {
|
|
|
56340
56647
|
while (index < text.length) {
|
|
56341
56648
|
const escape3 = parseEscapeSequence(text, index);
|
|
56342
56649
|
if (escape3) {
|
|
56343
|
-
const isOsc = escape3.sequence.startsWith(`${
|
|
56650
|
+
const isOsc = escape3.sequence.startsWith(`${ESC3}]`) || escape3.sequence.startsWith(C1_OSC2);
|
|
56344
56651
|
if (!isOsc) {
|
|
56345
56652
|
result2 += escape3.sequence;
|
|
56346
56653
|
}
|
|
@@ -56440,9 +56747,56 @@ function truncateStyledText(text, maxWidth, options = {}) {
|
|
|
56440
56747
|
}
|
|
56441
56748
|
return output + ellipsis;
|
|
56442
56749
|
}
|
|
56443
|
-
|
|
56750
|
+
function applyLineGradientSegment(text, stops, colorLevel, startColumn, totalWidth) {
|
|
56751
|
+
const visibleWidth = getVisibleWidth(text);
|
|
56752
|
+
if (stops.length === 0 || colorLevel === "ansi16") {
|
|
56753
|
+
return {
|
|
56754
|
+
text,
|
|
56755
|
+
nextColumn: startColumn + visibleWidth
|
|
56756
|
+
};
|
|
56757
|
+
}
|
|
56758
|
+
if (totalWidth <= 1) {
|
|
56759
|
+
return {
|
|
56760
|
+
text,
|
|
56761
|
+
nextColumn: startColumn + visibleWidth
|
|
56762
|
+
};
|
|
56763
|
+
}
|
|
56764
|
+
const denominator = totalWidth - 1;
|
|
56765
|
+
let output = "";
|
|
56766
|
+
let column = startColumn;
|
|
56767
|
+
let index = 0;
|
|
56768
|
+
while (index < text.length) {
|
|
56769
|
+
const escape3 = parseEscapeSequence(text, index);
|
|
56770
|
+
if (escape3) {
|
|
56771
|
+
output += escape3.sequence;
|
|
56772
|
+
index = escape3.nextIndex;
|
|
56773
|
+
continue;
|
|
56774
|
+
}
|
|
56775
|
+
const cluster = consumeDisplayCluster(text, index);
|
|
56776
|
+
if (!cluster) {
|
|
56777
|
+
break;
|
|
56778
|
+
}
|
|
56779
|
+
output += gradientCodeAt(stops, column / denominator, colorLevel) + cluster.text;
|
|
56780
|
+
column += getClusterWidth(cluster.text);
|
|
56781
|
+
index = cluster.nextIndex;
|
|
56782
|
+
}
|
|
56783
|
+
return {
|
|
56784
|
+
text: output,
|
|
56785
|
+
nextColumn: column
|
|
56786
|
+
};
|
|
56787
|
+
}
|
|
56788
|
+
function applyLineGradient(text, stops, colorLevel) {
|
|
56789
|
+
const totalWidth = getVisibleWidth(text);
|
|
56790
|
+
const result2 = applyLineGradientSegment(text, stops, colorLevel, 0, totalWidth);
|
|
56791
|
+
if (result2.text === text) {
|
|
56792
|
+
return text;
|
|
56793
|
+
}
|
|
56794
|
+
return `${result2.text}\x1B[39m`;
|
|
56795
|
+
}
|
|
56796
|
+
var ESC3 = "\x1B", BEL3 = "\x07", C1_CSI2 = "", C1_OSC2 = "", ST2 = "", ZERO_WIDTH_JOINER = 8205, COMBINING_ENCLOSING_KEYCAP = 8419, VARIATION_SELECTOR_START = 65024, VARIATION_SELECTOR_END = 65039, VARIATION_SELECTOR_SUPPLEMENT_START = 917760, VARIATION_SELECTOR_SUPPLEMENT_END = 917999, REGIONAL_INDICATOR_START = 127462, REGIONAL_INDICATOR_END = 127487, SGR_REGEX, EXTENDED_PICTOGRAPHIC_REGEX, EMOJI_PRESENTATION_REGEX, EMOJI_MODIFIER_REGEX, COMBINING_MARK_REGEX;
|
|
56444
56797
|
var init_ansi = __esm(() => {
|
|
56445
56798
|
init_string_width();
|
|
56799
|
+
init_gradient();
|
|
56446
56800
|
SGR_REGEX = /\x1b\[[0-9;]*m/g;
|
|
56447
56801
|
EXTENDED_PICTOGRAPHIC_REGEX = createUnicodePropertyRegex("\\p{Extended_Pictographic}");
|
|
56448
56802
|
EMOJI_PRESENTATION_REGEX = createUnicodePropertyRegex("\\p{Emoji_Presentation}");
|
|
@@ -56554,6 +56908,10 @@ function applyColors(text, foregroundColor, backgroundColor, bold, colorLevel =
|
|
|
56554
56908
|
}
|
|
56555
56909
|
}
|
|
56556
56910
|
if (foregroundColor) {
|
|
56911
|
+
const gradientStops = parseGradientSpec(foregroundColor);
|
|
56912
|
+
if (gradientStops && colorLevel !== "ansi16") {
|
|
56913
|
+
return prefix + applyGradientToText(text, gradientStops, colorLevel) + "\x1B[39m" + suffix;
|
|
56914
|
+
}
|
|
56557
56915
|
const fgCode = getColorAnsiCode(foregroundColor, colorLevel, false);
|
|
56558
56916
|
if (fgCode) {
|
|
56559
56917
|
prefix += fgCode;
|
|
@@ -56565,6 +56923,20 @@ function applyColors(text, foregroundColor, backgroundColor, bold, colorLevel =
|
|
|
56565
56923
|
function getColorAnsiCode(colorName, colorLevel = "ansi16", isBackground = false) {
|
|
56566
56924
|
if (!colorName)
|
|
56567
56925
|
return "";
|
|
56926
|
+
if (isGradientSpec(colorName)) {
|
|
56927
|
+
const stops = parseGradientSpec(colorName);
|
|
56928
|
+
const first = stops?.[0];
|
|
56929
|
+
if (!first)
|
|
56930
|
+
return "";
|
|
56931
|
+
if (colorLevel === "ansi16") {
|
|
56932
|
+
return "";
|
|
56933
|
+
}
|
|
56934
|
+
if (colorLevel === "ansi256") {
|
|
56935
|
+
const code = rgbToAnsi256(first);
|
|
56936
|
+
return isBackground ? `\x1B[48;5;${code}m` : `\x1B[38;5;${code}m`;
|
|
56937
|
+
}
|
|
56938
|
+
return isBackground ? `\x1B[48;2;${first.r};${first.g};${first.b}m` : `\x1B[38;2;${first.r};${first.g};${first.b}m`;
|
|
56939
|
+
}
|
|
56568
56940
|
if (colorName.startsWith("ansi256:")) {
|
|
56569
56941
|
const code = parseInt(colorName.substring(8), 10);
|
|
56570
56942
|
if (!isNaN(code) && code >= 0 && code <= 255) {
|
|
@@ -56634,6 +57006,7 @@ function getDefaultPowerlineTheme() {
|
|
|
56634
57006
|
var COLOR_MAP, POWERLINE_THEMES;
|
|
56635
57007
|
var init_colors = __esm(() => {
|
|
56636
57008
|
init_source();
|
|
57009
|
+
init_gradient();
|
|
56637
57010
|
COLOR_MAP = createColorMap();
|
|
56638
57011
|
POWERLINE_THEMES = {
|
|
56639
57012
|
custom: {
|
|
@@ -57027,7 +57400,7 @@ function getTerminalWidth() {
|
|
|
57027
57400
|
function canDetectTerminalWidth() {
|
|
57028
57401
|
return probeTerminalWidth() !== null;
|
|
57029
57402
|
}
|
|
57030
|
-
var __dirname = "/home/runner/work/ccstatusline/ccstatusline/src/utils", PACKAGE_VERSION = "2.2.
|
|
57403
|
+
var __dirname = "/home/runner/work/ccstatusline/ccstatusline/src/utils", PACKAGE_VERSION = "2.2.20";
|
|
57031
57404
|
var init_terminal = () => {};
|
|
57032
57405
|
|
|
57033
57406
|
// src/utils/renderer.ts
|
|
@@ -57038,6 +57411,10 @@ function formatTokens(count) {
|
|
|
57038
57411
|
return `${(count / 1000).toFixed(1)}k`;
|
|
57039
57412
|
return count.toString();
|
|
57040
57413
|
}
|
|
57414
|
+
function maybeApplyForegroundGradient(line, settings, colorLevel) {
|
|
57415
|
+
const stops = parseGradientSpec(settings.overrideForegroundColor);
|
|
57416
|
+
return stops ? applyLineGradient(line, stops, colorLevel) : line;
|
|
57417
|
+
}
|
|
57041
57418
|
function resolveEffectiveTerminalWidth(detectedWidth, settings, context) {
|
|
57042
57419
|
if (!detectedWidth) {
|
|
57043
57420
|
return null;
|
|
@@ -57090,6 +57467,7 @@ function renderPowerlineStatusLine(widgets, settings, context, lineIndex = 0, gl
|
|
|
57090
57467
|
}
|
|
57091
57468
|
}
|
|
57092
57469
|
const colorLevel = getColorLevelString(settings.colorLevel);
|
|
57470
|
+
const overrideForegroundGradientStops = parseGradientSpec(settings.overrideForegroundColor);
|
|
57093
57471
|
const filteredWidgets = widgets.filter((widget) => widget.type !== "separator" && widget.type !== "flex-separator");
|
|
57094
57472
|
if (filteredWidgets.length === 0)
|
|
57095
57473
|
return "";
|
|
@@ -57146,7 +57524,7 @@ function renderPowerlineStatusLine(widgets, settings, context, lineIndex = 0, gl
|
|
|
57146
57524
|
widgetColorIndex++;
|
|
57147
57525
|
}
|
|
57148
57526
|
}
|
|
57149
|
-
if (settings.overrideForegroundColor && settings.overrideForegroundColor !== "none") {
|
|
57527
|
+
if (settings.overrideForegroundColor && settings.overrideForegroundColor !== "none" && !isGradientSpec(settings.overrideForegroundColor)) {
|
|
57150
57528
|
fgColor = settings.overrideForegroundColor;
|
|
57151
57529
|
}
|
|
57152
57530
|
widgetElements.push({
|
|
@@ -57193,6 +57571,11 @@ function renderPowerlineStatusLine(widgets, settings, context, lineIndex = 0, gl
|
|
|
57193
57571
|
}
|
|
57194
57572
|
}
|
|
57195
57573
|
}
|
|
57574
|
+
const powerlineGradientWidth = overrideForegroundGradientStops && colorLevel !== "ansi16" ? widgetElements.reduce((sum2, element) => {
|
|
57575
|
+
const isPreserveColors = element.widget.type === "custom-command" && element.widget.preserveColors;
|
|
57576
|
+
return isPreserveColors ? sum2 : sum2 + getVisibleWidth(element.content);
|
|
57577
|
+
}, 0) : 0;
|
|
57578
|
+
let powerlineGradientColumn = 0;
|
|
57196
57579
|
let result2 = "";
|
|
57197
57580
|
if (startCap && widgetElements.length > 0) {
|
|
57198
57581
|
const firstWidget = widgetElements[0];
|
|
@@ -57216,13 +57599,20 @@ function renderPowerlineStatusLine(widgets, settings, context, lineIndex = 0, gl
|
|
|
57216
57599
|
if (shouldBold && !isPreserveColors) {
|
|
57217
57600
|
widgetContent += "\x1B[1m";
|
|
57218
57601
|
}
|
|
57219
|
-
|
|
57602
|
+
const textGradientStops = !isPreserveColors && powerlineGradientWidth > 1 ? overrideForegroundGradientStops : null;
|
|
57603
|
+
if (widget.fgColor && !isPreserveColors && !textGradientStops) {
|
|
57220
57604
|
widgetContent += getColorAnsiCode(widget.fgColor, colorLevel, false);
|
|
57221
57605
|
}
|
|
57222
57606
|
if (widget.bgColor) {
|
|
57223
57607
|
widgetContent += getColorAnsiCode(widget.bgColor, colorLevel, true);
|
|
57224
57608
|
}
|
|
57225
|
-
|
|
57609
|
+
if (textGradientStops) {
|
|
57610
|
+
const gradientResult = applyLineGradientSegment(widget.content, textGradientStops, colorLevel, powerlineGradientColumn, powerlineGradientWidth);
|
|
57611
|
+
widgetContent += gradientResult.text;
|
|
57612
|
+
powerlineGradientColumn = gradientResult.nextColumn;
|
|
57613
|
+
} else {
|
|
57614
|
+
widgetContent += widget.content;
|
|
57615
|
+
}
|
|
57226
57616
|
if (isPreserveColors) {
|
|
57227
57617
|
widgetContent += "\x1B[0m";
|
|
57228
57618
|
} else {
|
|
@@ -57399,7 +57789,7 @@ function calculateMaxWidthsFromPreRendered(preRenderedLines, settings) {
|
|
|
57399
57789
|
}
|
|
57400
57790
|
function renderStatusLineWithInfo(widgets, settings, context, preRenderedWidgets, preCalculatedMaxWidths) {
|
|
57401
57791
|
const line = renderStatusLine(widgets, settings, context, preRenderedWidgets, preCalculatedMaxWidths);
|
|
57402
|
-
const wasTruncated = line.includes("...");
|
|
57792
|
+
const wasTruncated = getVisibleText(line).includes("...");
|
|
57403
57793
|
return { line, wasTruncated };
|
|
57404
57794
|
}
|
|
57405
57795
|
function renderStatusLine(widgets, settings, context, preRenderedWidgets, preCalculatedMaxWidths) {
|
|
@@ -57410,8 +57800,13 @@ function renderStatusLine(widgets, settings, context, preRenderedWidgets, preCal
|
|
|
57410
57800
|
return renderPowerlineStatusLine(widgets, settings, context, context.lineIndex ?? 0, context.globalSeparatorIndex ?? 0, context.globalPowerlineThemeIndex ?? 0, preRenderedWidgets, preCalculatedMaxWidths);
|
|
57411
57801
|
const applyColorsWithOverride = (text, foregroundColor, backgroundColor, bold) => {
|
|
57412
57802
|
let fgColor = foregroundColor;
|
|
57413
|
-
|
|
57414
|
-
|
|
57803
|
+
const fgOverride = settings.overrideForegroundColor;
|
|
57804
|
+
if (fgOverride && fgOverride !== "none") {
|
|
57805
|
+
if (!isGradientSpec(fgOverride)) {
|
|
57806
|
+
fgColor = fgOverride;
|
|
57807
|
+
} else if (colorLevel !== "ansi16") {
|
|
57808
|
+
fgColor = undefined;
|
|
57809
|
+
}
|
|
57415
57810
|
}
|
|
57416
57811
|
let bgColor = backgroundColor;
|
|
57417
57812
|
if (settings.overrideBackgroundColor && settings.overrideBackgroundColor !== "none") {
|
|
@@ -57600,6 +57995,7 @@ function renderStatusLine(widgets, settings, context, preRenderedWidgets, preCal
|
|
|
57600
57995
|
statusLine = truncateStyledText(statusLine, maxWidth, { ellipsis: true });
|
|
57601
57996
|
}
|
|
57602
57997
|
}
|
|
57998
|
+
statusLine = maybeApplyForegroundGradient(statusLine, settings, colorLevel);
|
|
57603
57999
|
return statusLine;
|
|
57604
58000
|
}
|
|
57605
58001
|
var init_renderer2 = __esm(async () => {
|
|
@@ -57608,6 +58004,7 @@ var init_renderer2 = __esm(async () => {
|
|
|
57608
58004
|
init_ansi();
|
|
57609
58005
|
init_colors();
|
|
57610
58006
|
init_context_percentage();
|
|
58007
|
+
init_gradient();
|
|
57611
58008
|
init_terminal();
|
|
57612
58009
|
await init_widgets2();
|
|
57613
58010
|
});
|
|
@@ -57638,13 +58035,13 @@ class TokensInputWidget {
|
|
|
57638
58035
|
if (context.isPreview) {
|
|
57639
58036
|
return formatRawOrLabeledValue(item, "In: ", "15.2k");
|
|
57640
58037
|
}
|
|
58038
|
+
if (context.tokenMetrics) {
|
|
58039
|
+
return formatRawOrLabeledValue(item, "In: ", formatTokens(context.tokenMetrics.inputTokens));
|
|
58040
|
+
}
|
|
57641
58041
|
const inputTotalTokens = getContextWindowInputTotalTokens(context.data);
|
|
57642
58042
|
if (inputTotalTokens !== null) {
|
|
57643
58043
|
return formatRawOrLabeledValue(item, "In: ", formatTokens(inputTotalTokens));
|
|
57644
58044
|
}
|
|
57645
|
-
if (context.tokenMetrics) {
|
|
57646
|
-
return formatRawOrLabeledValue(item, "In: ", formatTokens(context.tokenMetrics.inputTokens));
|
|
57647
|
-
}
|
|
57648
58045
|
return null;
|
|
57649
58046
|
}
|
|
57650
58047
|
supportsRawValue() {
|
|
@@ -57679,13 +58076,13 @@ class TokensOutputWidget {
|
|
|
57679
58076
|
if (context.isPreview) {
|
|
57680
58077
|
return formatRawOrLabeledValue(item, "Out: ", "3.4k");
|
|
57681
58078
|
}
|
|
58079
|
+
if (context.tokenMetrics) {
|
|
58080
|
+
return formatRawOrLabeledValue(item, "Out: ", formatTokens(context.tokenMetrics.outputTokens));
|
|
58081
|
+
}
|
|
57682
58082
|
const outputTotalTokens = getContextWindowOutputTotalTokens(context.data);
|
|
57683
58083
|
if (outputTotalTokens !== null) {
|
|
57684
58084
|
return formatRawOrLabeledValue(item, "Out: ", formatTokens(outputTotalTokens));
|
|
57685
58085
|
}
|
|
57686
|
-
if (context.tokenMetrics) {
|
|
57687
|
-
return formatRawOrLabeledValue(item, "Out: ", formatTokens(context.tokenMetrics.outputTokens));
|
|
57688
|
-
}
|
|
57689
58086
|
return null;
|
|
57690
58087
|
}
|
|
57691
58088
|
supportsRawValue() {
|
|
@@ -58105,6 +58502,12 @@ function toggleUsageDateMode(item) {
|
|
|
58105
58502
|
function toggleUsageHourFormat(item) {
|
|
58106
58503
|
return toggleMetadataFlag(item, "hour12");
|
|
58107
58504
|
}
|
|
58505
|
+
function isUsageWeekdayEnabled(item) {
|
|
58506
|
+
return isMetadataFlagEnabled(item, "weekday");
|
|
58507
|
+
}
|
|
58508
|
+
function toggleUsageWeekday(item) {
|
|
58509
|
+
return toggleMetadataFlag(item, "weekday");
|
|
58510
|
+
}
|
|
58108
58511
|
function getUsageDisplayModifierText(item, options = {}) {
|
|
58109
58512
|
const mode = getUsageDisplayMode(item);
|
|
58110
58513
|
const modifiers = [];
|
|
@@ -58193,6 +58596,9 @@ function getUsageTimerCustomKeybinds(item, options = {}) {
|
|
|
58193
58596
|
if (options.includeHourFormat) {
|
|
58194
58597
|
keybinds.push(HOUR_FORMAT_TOGGLE_KEYBIND);
|
|
58195
58598
|
}
|
|
58599
|
+
if (options.includeWeekday) {
|
|
58600
|
+
keybinds.push(WEEKDAY_TOGGLE_KEYBIND);
|
|
58601
|
+
}
|
|
58196
58602
|
if (options.includeTimezone) {
|
|
58197
58603
|
keybinds.push(TIMEZONE_KEYBIND);
|
|
58198
58604
|
}
|
|
@@ -58202,7 +58608,7 @@ function getUsageTimerCustomKeybinds(item, options = {}) {
|
|
|
58202
58608
|
}
|
|
58203
58609
|
return keybinds;
|
|
58204
58610
|
}
|
|
58205
|
-
var SLIDER_WIDTH = 10, PROGRESS_TOGGLE_KEYBIND, INVERT_TOGGLE_KEYBIND, COMPACT_TOGGLE_KEYBIND, CURSOR_TOGGLE_KEYBIND, DATE_TOGGLE_KEYBIND, HOUR_FORMAT_TOGGLE_KEYBIND, TIMEZONE_KEYBIND, LOCALE_KEYBIND;
|
|
58611
|
+
var SLIDER_WIDTH = 10, PROGRESS_TOGGLE_KEYBIND, INVERT_TOGGLE_KEYBIND, COMPACT_TOGGLE_KEYBIND, CURSOR_TOGGLE_KEYBIND, DATE_TOGGLE_KEYBIND, HOUR_FORMAT_TOGGLE_KEYBIND, WEEKDAY_TOGGLE_KEYBIND, TIMEZONE_KEYBIND, LOCALE_KEYBIND;
|
|
58206
58612
|
var init_usage_display = __esm(() => {
|
|
58207
58613
|
init_locales2();
|
|
58208
58614
|
PROGRESS_TOGGLE_KEYBIND = { key: "p", label: "(p)rogress toggle", action: "toggle-progress" };
|
|
@@ -58211,6 +58617,7 @@ var init_usage_display = __esm(() => {
|
|
|
58211
58617
|
CURSOR_TOGGLE_KEYBIND = { key: "t", label: "(t)ime cursor", action: "toggle-cursor" };
|
|
58212
58618
|
DATE_TOGGLE_KEYBIND = { key: "t", label: "(t)imestamp", action: "toggle-date" };
|
|
58213
58619
|
HOUR_FORMAT_TOGGLE_KEYBIND = { key: "h", label: "12/24 (h)our", action: "toggle-hour-format" };
|
|
58620
|
+
WEEKDAY_TOGGLE_KEYBIND = { key: "w", label: "(w)eekday", action: "toggle-weekday" };
|
|
58214
58621
|
TIMEZONE_KEYBIND = { key: "z", label: "time(z)one", action: "edit-timezone" };
|
|
58215
58622
|
LOCALE_KEYBIND = { key: "l", label: "(l)ocale", action: "edit-locale" };
|
|
58216
58623
|
});
|
|
@@ -60481,7 +60888,7 @@ function hasRequiredUsageField(data, field) {
|
|
|
60481
60888
|
if (data[field] !== undefined) {
|
|
60482
60889
|
return true;
|
|
60483
60890
|
}
|
|
60484
|
-
return data.extraUsageEnabled
|
|
60891
|
+
return data.extraUsageEnabled !== undefined && EXTRA_USAGE_DETAIL_FIELDS.has(field);
|
|
60485
60892
|
}
|
|
60486
60893
|
function hasRequiredUsageFields(data, requiredFields = []) {
|
|
60487
60894
|
return requiredFields.every((field) => hasRequiredUsageField(data, field));
|
|
@@ -63113,6 +63520,9 @@ function buildRelative(cwd2, root) {
|
|
|
63113
63520
|
return p[p.length - 1] === "/" && result2 !== "" ? `${result2}/` : result2 || ".";
|
|
63114
63521
|
};
|
|
63115
63522
|
}
|
|
63523
|
+
function ensureNonDriveRelativePath(path5) {
|
|
63524
|
+
return path5.replace(DRIVE_RELATIVE_PATH, (match) => `${match}/`);
|
|
63525
|
+
}
|
|
63116
63526
|
function splitPattern(path5) {
|
|
63117
63527
|
var _result$parts;
|
|
63118
63528
|
const result2 = import_picomatch.default.scan(path5, splitPatternOptions);
|
|
@@ -63152,7 +63562,7 @@ function normalizePattern(pattern, opts, props, isIgnore) {
|
|
|
63152
63562
|
}
|
|
63153
63563
|
const potentialRoot = posix.join(cwd2, parentDir.slice(i * 3));
|
|
63154
63564
|
if (potentialRoot[0] !== "." && props.root.length > potentialRoot.length) {
|
|
63155
|
-
props.root = potentialRoot;
|
|
63565
|
+
props.root = ensureNonDriveRelativePath(potentialRoot);
|
|
63156
63566
|
props.depthOffset = -n + i;
|
|
63157
63567
|
}
|
|
63158
63568
|
}
|
|
@@ -63173,7 +63583,7 @@ function normalizePattern(pattern, opts, props, isIgnore) {
|
|
|
63173
63583
|
}
|
|
63174
63584
|
props.depthOffset = newCommonPath.length;
|
|
63175
63585
|
props.commonPath = newCommonPath;
|
|
63176
|
-
props.root = newCommonPath.length > 0 ? posix.join(cwd2, ...newCommonPath) : cwd2;
|
|
63586
|
+
props.root = ensureNonDriveRelativePath(newCommonPath.length > 0 ? posix.join(cwd2, ...newCommonPath) : cwd2);
|
|
63177
63587
|
}
|
|
63178
63588
|
return result2;
|
|
63179
63589
|
}
|
|
@@ -63272,11 +63682,11 @@ function formatPaths(paths, mapper) {
|
|
|
63272
63682
|
return paths;
|
|
63273
63683
|
}
|
|
63274
63684
|
function getOptions2(options) {
|
|
63275
|
-
const opts = {
|
|
63276
|
-
|
|
63277
|
-
|
|
63278
|
-
|
|
63279
|
-
opts.cwd = (opts.cwd instanceof URL ? fileURLToPath(opts.cwd) : resolve3(opts.cwd)).replace(BACKSLASHES, "/");
|
|
63685
|
+
const opts = Object.assign({}, options);
|
|
63686
|
+
for (const key in defaultOptions)
|
|
63687
|
+
if (opts[key] === undefined)
|
|
63688
|
+
Object.assign(opts, { [key]: defaultOptions[key] });
|
|
63689
|
+
opts.cwd = (opts.cwd instanceof URL ? fileURLToPath(opts.cwd) : resolve3(opts.cwd || process.cwd())).replace(BACKSLASHES, "/");
|
|
63280
63690
|
opts.ignore = ensureStringArray(opts.ignore);
|
|
63281
63691
|
opts.fs && (opts.fs = {
|
|
63282
63692
|
readdir: opts.fs.readdir || readdir,
|
|
@@ -63303,12 +63713,13 @@ function globSync(globInput, options) {
|
|
|
63303
63713
|
const [crawler, relative2] = getCrawler(globInput, options);
|
|
63304
63714
|
return crawler ? formatPaths(crawler.sync(), relative2) : [];
|
|
63305
63715
|
}
|
|
63306
|
-
var import_picomatch, isReadonlyArray, BACKSLASHES, isWin, ONLY_PARENT_DIRECTORIES, WIN32_ROOT_DIR, isRoot, splitPatternOptions, POSIX_UNESCAPED_GLOB_SYMBOLS, WIN32_UNESCAPED_GLOB_SYMBOLS, escapePosixPath = (path5) => path5.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&"), escapeWin32Path = (path5) => path5.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&"), escapePath, PARENT_DIRECTORY, ESCAPING_BACKSLASHES, defaultOptions;
|
|
63716
|
+
var import_picomatch, isReadonlyArray, BACKSLASHES, DRIVE_RELATIVE_PATH, isWin, ONLY_PARENT_DIRECTORIES, WIN32_ROOT_DIR, isRoot, splitPatternOptions, POSIX_UNESCAPED_GLOB_SYMBOLS, WIN32_UNESCAPED_GLOB_SYMBOLS, escapePosixPath = (path5) => path5.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&"), escapeWin32Path = (path5) => path5.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&"), escapePath, PARENT_DIRECTORY, ESCAPING_BACKSLASHES, defaultOptions;
|
|
63307
63717
|
var init_dist7 = __esm(() => {
|
|
63308
63718
|
init_dist6();
|
|
63309
63719
|
import_picomatch = __toESM(require_picomatch2(), 1);
|
|
63310
63720
|
isReadonlyArray = Array.isArray;
|
|
63311
63721
|
BACKSLASHES = /\\/g;
|
|
63722
|
+
DRIVE_RELATIVE_PATH = /^[A-Za-z]:$/;
|
|
63312
63723
|
isWin = process.platform === "win32";
|
|
63313
63724
|
ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
|
|
63314
63725
|
WIN32_ROOT_DIR = /^[A-Z]:\/$/i;
|
|
@@ -63321,7 +63732,6 @@ var init_dist7 = __esm(() => {
|
|
|
63321
63732
|
ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
|
|
63322
63733
|
defaultOptions = {
|
|
63323
63734
|
caseSensitiveMatch: true,
|
|
63324
|
-
cwd: process.cwd(),
|
|
63325
63735
|
debug: !!process.env.TINYGLOBBY_DEBUG,
|
|
63326
63736
|
expandDirectories: true,
|
|
63327
63737
|
followSymbolicLinks: true,
|
|
@@ -64133,44 +64543,69 @@ function formatUsageDuration(durationMs, compact2 = false, useDays = true) {
|
|
|
64133
64543
|
function pad2(value) {
|
|
64134
64544
|
return value.toString().padStart(2, "0");
|
|
64135
64545
|
}
|
|
64136
|
-
function formatResetAtUtc(date5, compact2, hour12) {
|
|
64546
|
+
function formatResetAtUtc(date5, compact2, hour12, weekday = false) {
|
|
64137
64547
|
const year = date5.getUTCFullYear();
|
|
64138
64548
|
const month = pad2(date5.getUTCMonth() + 1);
|
|
64139
64549
|
const day = pad2(date5.getUTCDate());
|
|
64140
64550
|
const hours = pad2(date5.getUTCHours());
|
|
64141
64551
|
const minutes = pad2(date5.getUTCMinutes());
|
|
64552
|
+
const weekdayName = weekday ? UTC_WEEKDAY_NAMES[date5.getUTCDay()] : "";
|
|
64142
64553
|
if (hour12) {
|
|
64143
64554
|
const hour = date5.getUTCHours();
|
|
64144
64555
|
const displayHour = hour % 12 || 12;
|
|
64145
64556
|
const period = hour >= 12 ? "PM" : "AM";
|
|
64557
|
+
if (weekday) {
|
|
64558
|
+
return compact2 ? `${weekdayName} ${displayHour}:${minutes} ${period}Z` : `${weekdayName} ${displayHour}:${minutes} ${period} UTC`;
|
|
64559
|
+
}
|
|
64146
64560
|
return compact2 ? `${month}-${day} ${displayHour}:${minutes} ${period}Z` : `${year}-${month}-${day} ${displayHour}:${minutes} ${period} UTC`;
|
|
64147
64561
|
}
|
|
64562
|
+
if (weekday) {
|
|
64563
|
+
return compact2 ? `${weekdayName} ${hours}:${minutes}Z` : `${weekdayName} ${hours}:${minutes} UTC`;
|
|
64564
|
+
}
|
|
64148
64565
|
return compact2 ? `${month}-${day} ${hours}:${minutes}Z` : `${year}-${month}-${day} ${hours}:${minutes} UTC`;
|
|
64149
64566
|
}
|
|
64150
64567
|
function normalizeDayPeriod(dayPeriod) {
|
|
64151
64568
|
return dayPeriod.replace(/\./g, "").toUpperCase();
|
|
64152
64569
|
}
|
|
64153
|
-
function formatResetAtInTimezone(date5, compact2, timezone, locale, hour12) {
|
|
64570
|
+
function formatResetAtInTimezone(date5, compact2, timezone, locale, hour12, weekday = false) {
|
|
64154
64571
|
try {
|
|
64155
|
-
const
|
|
64572
|
+
const options = {
|
|
64156
64573
|
timeZone: timezone,
|
|
64157
|
-
year: "numeric",
|
|
64158
|
-
month: "2-digit",
|
|
64159
|
-
day: "2-digit",
|
|
64160
64574
|
hour: "2-digit",
|
|
64161
64575
|
minute: "2-digit",
|
|
64162
64576
|
hour12,
|
|
64163
64577
|
timeZoneName: "short"
|
|
64164
|
-
}
|
|
64578
|
+
};
|
|
64579
|
+
if (weekday) {
|
|
64580
|
+
options.weekday = "short";
|
|
64581
|
+
} else {
|
|
64582
|
+
options.year = "numeric";
|
|
64583
|
+
options.month = "2-digit";
|
|
64584
|
+
options.day = "2-digit";
|
|
64585
|
+
}
|
|
64586
|
+
const formatter = new Intl.DateTimeFormat(locale, options);
|
|
64165
64587
|
const parts = formatter.formatToParts(date5);
|
|
64166
64588
|
const get2 = (type) => parts.find((p) => p.type === type)?.value ?? "";
|
|
64167
|
-
const year = get2("year");
|
|
64168
|
-
const month = get2("month");
|
|
64169
|
-
const day = get2("day");
|
|
64170
64589
|
const hour = get2("hour");
|
|
64171
64590
|
const minute = get2("minute");
|
|
64172
64591
|
const dayPeriod = get2("dayPeriod");
|
|
64173
64592
|
const tzName = get2("timeZoneName");
|
|
64593
|
+
if (weekday) {
|
|
64594
|
+
const weekdayName = get2("weekday");
|
|
64595
|
+
if (!weekdayName || !hour || !minute) {
|
|
64596
|
+
return null;
|
|
64597
|
+
}
|
|
64598
|
+
if (hour12) {
|
|
64599
|
+
const displayHour = hour.startsWith("0") ? hour.slice(1) : hour;
|
|
64600
|
+
const normalizedDayPeriod = dayPeriod ? normalizeDayPeriod(dayPeriod) : "";
|
|
64601
|
+
const time3 = `${displayHour}:${minute}${normalizedDayPeriod ? ` ${normalizedDayPeriod}` : ""}`;
|
|
64602
|
+
return compact2 ? `${weekdayName} ${time3}` : `${weekdayName} ${time3} ${tzName}`;
|
|
64603
|
+
}
|
|
64604
|
+
return compact2 ? `${weekdayName} ${hour}:${minute}` : `${weekdayName} ${hour}:${minute} ${tzName}`;
|
|
64605
|
+
}
|
|
64606
|
+
const year = get2("year");
|
|
64607
|
+
const month = get2("month");
|
|
64608
|
+
const day = get2("day");
|
|
64174
64609
|
if (!year || !month || !day || !hour || !minute) {
|
|
64175
64610
|
return null;
|
|
64176
64611
|
}
|
|
@@ -64185,7 +64620,7 @@ function formatResetAtInTimezone(date5, compact2, timezone, locale, hour12) {
|
|
|
64185
64620
|
return null;
|
|
64186
64621
|
}
|
|
64187
64622
|
}
|
|
64188
|
-
function formatUsageResetAt(resetAt, compact2 = false, timezone, localeOrHour12, hour12Arg = false) {
|
|
64623
|
+
function formatUsageResetAt(resetAt, compact2 = false, timezone, localeOrHour12, hour12Arg = false, weekday = false) {
|
|
64189
64624
|
if (!resetAt) {
|
|
64190
64625
|
return null;
|
|
64191
64626
|
}
|
|
@@ -64197,21 +64632,21 @@ function formatUsageResetAt(resetAt, compact2 = false, timezone, localeOrHour12,
|
|
|
64197
64632
|
const locale = typeof localeOrHour12 === "string" ? localeOrHour12 : undefined;
|
|
64198
64633
|
const hour12 = typeof localeOrHour12 === "boolean" ? localeOrHour12 : hour12Arg;
|
|
64199
64634
|
if (!timezone || timezone === "UTC") {
|
|
64200
|
-
return formatResetAtUtc(date5, compact2, hour12);
|
|
64635
|
+
return formatResetAtUtc(date5, compact2, hour12, weekday);
|
|
64201
64636
|
}
|
|
64202
64637
|
const resolvedTimezone = timezone === "local" ? undefined : timezone;
|
|
64203
64638
|
const resolvedLocale = locale && locale.length > 0 ? locale : DEFAULT_TZ_LOCALE;
|
|
64204
|
-
const localized = formatResetAtInTimezone(date5, compact2, resolvedTimezone, resolvedLocale, hour12);
|
|
64639
|
+
const localized = formatResetAtInTimezone(date5, compact2, resolvedTimezone, resolvedLocale, hour12, weekday);
|
|
64205
64640
|
if (localized) {
|
|
64206
64641
|
return localized;
|
|
64207
64642
|
}
|
|
64208
64643
|
if (resolvedLocale !== DEFAULT_TZ_LOCALE) {
|
|
64209
|
-
const fallback = formatResetAtInTimezone(date5, compact2, resolvedTimezone, DEFAULT_TZ_LOCALE, hour12);
|
|
64644
|
+
const fallback = formatResetAtInTimezone(date5, compact2, resolvedTimezone, DEFAULT_TZ_LOCALE, hour12, weekday);
|
|
64210
64645
|
if (fallback) {
|
|
64211
64646
|
return fallback;
|
|
64212
64647
|
}
|
|
64213
64648
|
}
|
|
64214
|
-
return formatResetAtUtc(date5, compact2, hour12);
|
|
64649
|
+
return formatResetAtUtc(date5, compact2, hour12, weekday);
|
|
64215
64650
|
}
|
|
64216
64651
|
function getUsageErrorMessage(error51) {
|
|
64217
64652
|
switch (error51) {
|
|
@@ -64232,10 +64667,11 @@ function makeUsageProgressBar(percent, width = 15) {
|
|
|
64232
64667
|
const empty2 = width - filled;
|
|
64233
64668
|
return "[" + "█".repeat(filled) + "░".repeat(empty2) + "]";
|
|
64234
64669
|
}
|
|
64235
|
-
var DEFAULT_TZ_LOCALE = "en-US";
|
|
64670
|
+
var UTC_WEEKDAY_NAMES, DEFAULT_TZ_LOCALE = "en-US";
|
|
64236
64671
|
var init_usage_windows = __esm(async () => {
|
|
64237
64672
|
init_usage_types();
|
|
64238
64673
|
await init_jsonl();
|
|
64674
|
+
UTC_WEEKDAY_NAMES = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
64239
64675
|
});
|
|
64240
64676
|
|
|
64241
64677
|
// src/utils/usage.ts
|
|
@@ -66099,7 +66535,7 @@ class ExtraUsageUtilizationWidget {
|
|
|
66099
66535
|
return getUsageErrorMessage(data.error);
|
|
66100
66536
|
return null;
|
|
66101
66537
|
}
|
|
66102
|
-
const percent = Math.max(0, Math.min(100, data.extraUsageUtilization
|
|
66538
|
+
const percent = Math.max(0, Math.min(100, data.extraUsageUtilization));
|
|
66103
66539
|
const renderedPercent = inverted ? 100 - percent : percent;
|
|
66104
66540
|
if (isUsageProgressMode(displayMode)) {
|
|
66105
66541
|
const width = getUsageProgressBarWidth(displayMode);
|
|
@@ -66166,7 +66602,8 @@ class ExtraUsageRemainingWidget {
|
|
|
66166
66602
|
return null;
|
|
66167
66603
|
}
|
|
66168
66604
|
const limitDollars = data.extraUsageLimit / 100;
|
|
66169
|
-
const
|
|
66605
|
+
const usedDollars = data.extraUsageUsed / 100;
|
|
66606
|
+
const remaining = Math.max(0, limitDollars - usedDollars);
|
|
66170
66607
|
const formatted = `$${remaining.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
|
|
66171
66608
|
return formatRawOrLabeledValue(item, "Overage Left: ", formatted);
|
|
66172
66609
|
}
|
|
@@ -67001,6 +67438,9 @@ function getWeeklyResetModifierText(item) {
|
|
|
67001
67438
|
if (isUsage12HourClock(item)) {
|
|
67002
67439
|
modifiers.push("12hr");
|
|
67003
67440
|
}
|
|
67441
|
+
if (isUsageWeekdayEnabled(item)) {
|
|
67442
|
+
modifiers.push("weekday");
|
|
67443
|
+
}
|
|
67004
67444
|
} else if (isWeeklyResetHoursOnly(item)) {
|
|
67005
67445
|
modifiers.push("hours only");
|
|
67006
67446
|
}
|
|
@@ -67051,6 +67491,9 @@ class WeeklyResetTimerWidget {
|
|
|
67051
67491
|
if (action === "toggle-hour-format") {
|
|
67052
67492
|
return toggleUsageHourFormat(item);
|
|
67053
67493
|
}
|
|
67494
|
+
if (action === "toggle-weekday") {
|
|
67495
|
+
return toggleUsageWeekday(item);
|
|
67496
|
+
}
|
|
67054
67497
|
if (action === "toggle-hours") {
|
|
67055
67498
|
return toggleWeeklyResetHoursOnly(item);
|
|
67056
67499
|
}
|
|
@@ -67075,8 +67518,10 @@ class WeeklyResetTimerWidget {
|
|
|
67075
67518
|
return formatRawOrLabeledValue(item, "Weekly Reset ", sliderDisplay);
|
|
67076
67519
|
}
|
|
67077
67520
|
if (dateMode) {
|
|
67078
|
-
const
|
|
67079
|
-
|
|
67521
|
+
const weekday = isUsageWeekdayEnabled(item);
|
|
67522
|
+
const resetAt = formatUsageResetAt(WEEKLY_RESET_PREVIEW_AT, compact2, getUsageTimezone(item), getUsageLocale(item), isUsage12HourClock(item), weekday);
|
|
67523
|
+
const fallback = weekday ? compact2 ? "Sun 08:30Z" : "Sun 08:30 UTC" : compact2 ? "03-15 08:30Z" : "2026-03-15 08:30 UTC";
|
|
67524
|
+
return formatRawOrLabeledValue(item, "Weekly Reset: ", resetAt ?? fallback);
|
|
67080
67525
|
}
|
|
67081
67526
|
return formatRawOrLabeledValue(item, "Weekly Reset: ", formatUsageDuration(WEEKLY_PREVIEW_DURATION_MS, compact2, useDays));
|
|
67082
67527
|
}
|
|
@@ -67104,7 +67549,7 @@ class WeeklyResetTimerWidget {
|
|
|
67104
67549
|
if (dateMode) {
|
|
67105
67550
|
const timezone = getUsageTimezone(item);
|
|
67106
67551
|
const locale = getUsageLocale(item);
|
|
67107
|
-
const resetAt = formatUsageResetAt(usageData.weeklyResetAt, compact2, timezone, locale, isUsage12HourClock(item));
|
|
67552
|
+
const resetAt = formatUsageResetAt(usageData.weeklyResetAt, compact2, timezone, locale, isUsage12HourClock(item), isUsageWeekdayEnabled(item));
|
|
67108
67553
|
if (resetAt) {
|
|
67109
67554
|
return formatRawOrLabeledValue(item, "Weekly Reset: ", resetAt);
|
|
67110
67555
|
}
|
|
@@ -67116,6 +67561,7 @@ class WeeklyResetTimerWidget {
|
|
|
67116
67561
|
const keybinds = getUsageTimerCustomKeybinds(item, {
|
|
67117
67562
|
includeDate: true,
|
|
67118
67563
|
includeHourFormat: true,
|
|
67564
|
+
includeWeekday: true,
|
|
67119
67565
|
includeLocale: true,
|
|
67120
67566
|
includeTimezone: true
|
|
67121
67567
|
});
|
|
@@ -68251,6 +68697,137 @@ var init_VoiceStatus = __esm(async () => {
|
|
|
68251
68697
|
FORMATS3 = ["icon", "icon-text", "text", "word"];
|
|
68252
68698
|
});
|
|
68253
68699
|
|
|
68700
|
+
// src/widgets/RemoteControlStatus.ts
|
|
68701
|
+
function getFormat4(item) {
|
|
68702
|
+
const f = item.metadata?.format;
|
|
68703
|
+
return FORMATS4.includes(f ?? "") ? f : DEFAULT_FORMAT4;
|
|
68704
|
+
}
|
|
68705
|
+
function setFormat4(item, format) {
|
|
68706
|
+
if (format === DEFAULT_FORMAT4) {
|
|
68707
|
+
const { format: removedFormat, ...restMetadata } = item.metadata ?? {};
|
|
68708
|
+
return {
|
|
68709
|
+
...item,
|
|
68710
|
+
metadata: Object.keys(restMetadata).length > 0 ? restMetadata : undefined
|
|
68711
|
+
};
|
|
68712
|
+
}
|
|
68713
|
+
return {
|
|
68714
|
+
...item,
|
|
68715
|
+
metadata: {
|
|
68716
|
+
...item.metadata ?? {},
|
|
68717
|
+
format
|
|
68718
|
+
}
|
|
68719
|
+
};
|
|
68720
|
+
}
|
|
68721
|
+
function isNerdFontEnabled4(item) {
|
|
68722
|
+
return item.metadata?.[NERD_FONT_METADATA_KEY4] === "true";
|
|
68723
|
+
}
|
|
68724
|
+
function toggleNerdFont4(item) {
|
|
68725
|
+
if (!isNerdFontEnabled4(item)) {
|
|
68726
|
+
return {
|
|
68727
|
+
...item,
|
|
68728
|
+
metadata: {
|
|
68729
|
+
...item.metadata ?? {},
|
|
68730
|
+
[NERD_FONT_METADATA_KEY4]: "true"
|
|
68731
|
+
}
|
|
68732
|
+
};
|
|
68733
|
+
}
|
|
68734
|
+
const { [NERD_FONT_METADATA_KEY4]: removedNerdFont, ...restMetadata } = item.metadata ?? {};
|
|
68735
|
+
return {
|
|
68736
|
+
...item,
|
|
68737
|
+
metadata: Object.keys(restMetadata).length > 0 ? restMetadata : undefined
|
|
68738
|
+
};
|
|
68739
|
+
}
|
|
68740
|
+
function formatStatus2(enabled, format, nerdFont) {
|
|
68741
|
+
const stateText = enabled ? "on" : "off";
|
|
68742
|
+
const stateDot = enabled ? STATE_DOT_ON2 : STATE_DOT_OFF2;
|
|
68743
|
+
const icon = nerdFont ? enabled ? SATELLITE_NERD_FONT : SATELLITE_SLASH_NERD_FONT : SATELLITE_EMOJI;
|
|
68744
|
+
switch (format) {
|
|
68745
|
+
case "icon":
|
|
68746
|
+
return nerdFont ? icon : `${icon} ${stateDot}`;
|
|
68747
|
+
case "icon-text":
|
|
68748
|
+
return `${icon} ${stateText}`;
|
|
68749
|
+
case "text":
|
|
68750
|
+
return stateText;
|
|
68751
|
+
case "word":
|
|
68752
|
+
return `remote ${stateText}`;
|
|
68753
|
+
case "label-check":
|
|
68754
|
+
return `remote ${enabled ? CHECK_EMOJI : CROSS_EMOJI}`;
|
|
68755
|
+
case "label-mark":
|
|
68756
|
+
return `remote ${enabled ? CHECK_MARK : CROSS_MARK}`;
|
|
68757
|
+
}
|
|
68758
|
+
}
|
|
68759
|
+
|
|
68760
|
+
class RemoteControlStatusWidget {
|
|
68761
|
+
getDefaultColor() {
|
|
68762
|
+
return "blue";
|
|
68763
|
+
}
|
|
68764
|
+
getDescription() {
|
|
68765
|
+
return "Shows whether Claude Code remote control is attached to the current session";
|
|
68766
|
+
}
|
|
68767
|
+
getDisplayName() {
|
|
68768
|
+
return "Remote Control Status";
|
|
68769
|
+
}
|
|
68770
|
+
getCategory() {
|
|
68771
|
+
return "Core";
|
|
68772
|
+
}
|
|
68773
|
+
getEditorDisplay(item) {
|
|
68774
|
+
const modifiers = [getFormat4(item)];
|
|
68775
|
+
if (isNerdFontEnabled4(item)) {
|
|
68776
|
+
modifiers.push("nerd font");
|
|
68777
|
+
}
|
|
68778
|
+
return {
|
|
68779
|
+
displayText: this.getDisplayName(),
|
|
68780
|
+
modifierText: `(${modifiers.join(", ")})`
|
|
68781
|
+
};
|
|
68782
|
+
}
|
|
68783
|
+
handleEditorAction(action, item) {
|
|
68784
|
+
if (action === CYCLE_FORMAT_ACTION4) {
|
|
68785
|
+
const currentFormat = getFormat4(item);
|
|
68786
|
+
const nextFormat = FORMATS4[(FORMATS4.indexOf(currentFormat) + 1) % FORMATS4.length] ?? DEFAULT_FORMAT4;
|
|
68787
|
+
return setFormat4(item, nextFormat);
|
|
68788
|
+
}
|
|
68789
|
+
if (action === TOGGLE_NERD_FONT_ACTION4) {
|
|
68790
|
+
return toggleNerdFont4(item);
|
|
68791
|
+
}
|
|
68792
|
+
return null;
|
|
68793
|
+
}
|
|
68794
|
+
render(item, context, _settings) {
|
|
68795
|
+
const format = getFormat4(item);
|
|
68796
|
+
const nerdFont = isNerdFontEnabled4(item);
|
|
68797
|
+
if (context.isPreview) {
|
|
68798
|
+
if (item.rawValue) {
|
|
68799
|
+
return "on";
|
|
68800
|
+
}
|
|
68801
|
+
return formatStatus2(true, format, nerdFont);
|
|
68802
|
+
}
|
|
68803
|
+
const status = getRemoteControlStatus(context.data?.session_id);
|
|
68804
|
+
if (status === null) {
|
|
68805
|
+
return null;
|
|
68806
|
+
}
|
|
68807
|
+
if (item.rawValue) {
|
|
68808
|
+
return status.enabled ? "on" : "off";
|
|
68809
|
+
}
|
|
68810
|
+
return formatStatus2(status.enabled, format, nerdFont);
|
|
68811
|
+
}
|
|
68812
|
+
getCustomKeybinds() {
|
|
68813
|
+
return [
|
|
68814
|
+
{ key: "f", label: "(f)ormat", action: CYCLE_FORMAT_ACTION4 },
|
|
68815
|
+
{ key: "n", label: "(n)erd font", action: TOGGLE_NERD_FONT_ACTION4 }
|
|
68816
|
+
];
|
|
68817
|
+
}
|
|
68818
|
+
supportsRawValue() {
|
|
68819
|
+
return true;
|
|
68820
|
+
}
|
|
68821
|
+
supportsColors(_item) {
|
|
68822
|
+
return true;
|
|
68823
|
+
}
|
|
68824
|
+
}
|
|
68825
|
+
var SATELLITE_EMOJI = "\uD83D\uDCE1", SATELLITE_NERD_FONT = "", SATELLITE_SLASH_NERD_FONT = "", STATE_DOT_OFF2 = "○", STATE_DOT_ON2 = "◉", FORMATS4, CHECK_EMOJI = "✅", CROSS_EMOJI = "❌", CHECK_MARK = "✓", CROSS_MARK = "✗", DEFAULT_FORMAT4 = "icon", CYCLE_FORMAT_ACTION4 = "cycle-format", TOGGLE_NERD_FONT_ACTION4 = "toggle-nerd-font", NERD_FONT_METADATA_KEY4 = "nerdFont";
|
|
68826
|
+
var init_RemoteControlStatus = __esm(async () => {
|
|
68827
|
+
await init_claude_settings();
|
|
68828
|
+
FORMATS4 = ["icon", "icon-text", "text", "word", "label-check", "label-mark"];
|
|
68829
|
+
});
|
|
68830
|
+
|
|
68254
68831
|
// src/widgets/index.ts
|
|
68255
68832
|
var init_widgets = __esm(async () => {
|
|
68256
68833
|
init_GitBranch();
|
|
@@ -68321,7 +68898,8 @@ var init_widgets = __esm(async () => {
|
|
|
68321
68898
|
init_Link(),
|
|
68322
68899
|
init_Skills(),
|
|
68323
68900
|
init_ThinkingEffort(),
|
|
68324
|
-
init_VoiceStatus()
|
|
68901
|
+
init_VoiceStatus(),
|
|
68902
|
+
init_RemoteControlStatus()
|
|
68325
68903
|
]);
|
|
68326
68904
|
});
|
|
68327
68905
|
|
|
@@ -68403,6 +68981,7 @@ var init_widget_manifest = __esm(async () => {
|
|
|
68403
68981
|
{ type: "thinking-effort", create: () => new ThinkingEffortWidget },
|
|
68404
68982
|
{ type: "vim-mode", create: () => new VimModeWidget },
|
|
68405
68983
|
{ type: "voice-status", create: () => new VoiceStatusWidget },
|
|
68984
|
+
{ type: "remote-control-status", create: () => new RemoteControlStatusWidget },
|
|
68406
68985
|
{ type: "worktree-mode", create: () => new GitWorktreeModeWidget },
|
|
68407
68986
|
{ type: "worktree-name", create: () => new GitWorktreeNameWidget },
|
|
68408
68987
|
{ type: "worktree-branch", create: () => new GitWorktreeBranchWidget },
|
|
@@ -69104,7 +69683,43 @@ function getVoiceConfig(cwd2 = process.cwd()) {
|
|
|
69104
69683
|
}
|
|
69105
69684
|
return anyFileExisted ? { enabled: false } : null;
|
|
69106
69685
|
}
|
|
69107
|
-
|
|
69686
|
+
function getRemoteControlStatus(sessionId) {
|
|
69687
|
+
if (!sessionId) {
|
|
69688
|
+
return null;
|
|
69689
|
+
}
|
|
69690
|
+
const sessionsDir = path9.join(getClaudeConfigDir(), "sessions");
|
|
69691
|
+
let entries;
|
|
69692
|
+
try {
|
|
69693
|
+
entries = fs12.readdirSync(sessionsDir);
|
|
69694
|
+
} catch {
|
|
69695
|
+
return null;
|
|
69696
|
+
}
|
|
69697
|
+
for (const entry of entries) {
|
|
69698
|
+
if (!entry.endsWith(".json")) {
|
|
69699
|
+
continue;
|
|
69700
|
+
}
|
|
69701
|
+
let content;
|
|
69702
|
+
try {
|
|
69703
|
+
content = fs12.readFileSync(path9.join(sessionsDir, entry), "utf-8");
|
|
69704
|
+
} catch {
|
|
69705
|
+
continue;
|
|
69706
|
+
}
|
|
69707
|
+
let parsed;
|
|
69708
|
+
try {
|
|
69709
|
+
parsed = JSON.parse(content);
|
|
69710
|
+
} catch {
|
|
69711
|
+
continue;
|
|
69712
|
+
}
|
|
69713
|
+
const result2 = RemoteSessionFileSchema.safeParse(parsed);
|
|
69714
|
+
if (!result2.success || result2.data.sessionId !== sessionId) {
|
|
69715
|
+
continue;
|
|
69716
|
+
}
|
|
69717
|
+
const bridge = result2.data.bridgeSessionId;
|
|
69718
|
+
return { enabled: typeof bridge === "string" && bridge.length > 0 };
|
|
69719
|
+
}
|
|
69720
|
+
return null;
|
|
69721
|
+
}
|
|
69722
|
+
var readFile4, writeFile2, mkdir2, CCSTATUSLINE_COMMANDS, PINNED_INSTALL_COMMANDS, VoiceConfigSchema, RemoteSessionFileSchema;
|
|
69108
69723
|
var init_claude_settings = __esm(async () => {
|
|
69109
69724
|
init_zod();
|
|
69110
69725
|
init_Settings();
|
|
@@ -69125,6 +69740,10 @@ var init_claude_settings = __esm(async () => {
|
|
|
69125
69740
|
BUN: (version2) => `bun add -g ccstatusline@${version2}`
|
|
69126
69741
|
};
|
|
69127
69742
|
VoiceConfigSchema = exports_external.object({ enabled: exports_external.boolean().optional() });
|
|
69743
|
+
RemoteSessionFileSchema = exports_external.object({
|
|
69744
|
+
sessionId: exports_external.string().optional(),
|
|
69745
|
+
bridgeSessionId: exports_external.string().nullable().optional()
|
|
69746
|
+
});
|
|
69128
69747
|
});
|
|
69129
69748
|
|
|
69130
69749
|
// node_modules/pluralize/pluralize.js
|
|
@@ -69716,6 +70335,9 @@ import { execFileSync as execFileSync5 } from "child_process";
|
|
|
69716
70335
|
import * as path10 from "path";
|
|
69717
70336
|
|
|
69718
70337
|
// src/utils/package-manager-executable.ts
|
|
70338
|
+
function getPackageManagerShellOptions(executable, platform2 = process.platform) {
|
|
70339
|
+
return platform2 === "win32" && /\.(?:cmd|bat)$/i.test(executable) ? { shell: true } : {};
|
|
70340
|
+
}
|
|
69719
70341
|
function getPackageManagerExecutable(packageManager, platform2 = process.platform) {
|
|
69720
70342
|
return packageManager === "npm" && platform2 === "win32" ? "npm.cmd" : packageManager;
|
|
69721
70343
|
}
|
|
@@ -69760,10 +70382,12 @@ function getCommandResolutionPaths(command, { platform: platform2 = process.plat
|
|
|
69760
70382
|
}
|
|
69761
70383
|
function getNpmGlobalBinDir(platform2) {
|
|
69762
70384
|
try {
|
|
69763
|
-
const
|
|
70385
|
+
const executable = getPackageManagerExecutable("npm", platform2);
|
|
70386
|
+
const prefix = execFileSync5(executable, ["prefix", "-g"], {
|
|
69764
70387
|
encoding: "utf-8",
|
|
69765
70388
|
timeout: COMMAND_LOOKUP_TIMEOUT_MS,
|
|
69766
|
-
windowsHide: true
|
|
70389
|
+
windowsHide: true,
|
|
70390
|
+
...getPackageManagerShellOptions(executable, platform2)
|
|
69767
70391
|
}).trim();
|
|
69768
70392
|
if (!prefix) {
|
|
69769
70393
|
return null;
|
|
@@ -69967,10 +70591,12 @@ function readPackageVersion(packageJsonPath) {
|
|
|
69967
70591
|
}
|
|
69968
70592
|
function getNpmGlobalPackageVersion(platform2) {
|
|
69969
70593
|
try {
|
|
69970
|
-
const
|
|
70594
|
+
const executable = getPackageManagerExecutable("npm", platform2);
|
|
70595
|
+
const rootDir = execFileSync6(executable, ["root", "-g"], {
|
|
69971
70596
|
encoding: "utf-8",
|
|
69972
70597
|
timeout: VERSION_LOOKUP_TIMEOUT_MS,
|
|
69973
|
-
windowsHide: true
|
|
70598
|
+
windowsHide: true,
|
|
70599
|
+
...getPackageManagerShellOptions(executable, platform2)
|
|
69974
70600
|
}).trim();
|
|
69975
70601
|
return rootDir ? readPackageVersion(appendPathSegment(appendPathSegment(rootDir, "ccstatusline"), "package.json")) : null;
|
|
69976
70602
|
} catch {
|
|
@@ -70077,7 +70703,11 @@ function runGlobalPackageUninstall(packageManager, { platform: platform2 = proce
|
|
|
70077
70703
|
const executable = getPackageManagerExecutable(packageManager, platform2);
|
|
70078
70704
|
const args = packageManager === "npm" ? ["uninstall", "-g", "ccstatusline"] : ["remove", "-g", "ccstatusline"];
|
|
70079
70705
|
return new Promise((resolve6, reject2) => {
|
|
70080
|
-
execFile(executable, args, {
|
|
70706
|
+
execFile(executable, args, {
|
|
70707
|
+
timeout: GLOBAL_PACKAGE_TIMEOUT_MS,
|
|
70708
|
+
windowsHide: true,
|
|
70709
|
+
...getPackageManagerShellOptions(executable, platform2)
|
|
70710
|
+
}, (error51) => {
|
|
70081
70711
|
if (error51) {
|
|
70082
70712
|
reject2(error51 instanceof Error ? error51 : new Error("Global uninstall command failed"));
|
|
70083
70713
|
return;
|
|
@@ -70595,7 +71225,11 @@ function runGlobalPackageInstall(packageManager, version2, { platform: platform4
|
|
|
70595
71225
|
const executable = getPackageManagerExecutable(packageManager, platform4);
|
|
70596
71226
|
const args = packageManager === "npm" ? ["install", "-g", `ccstatusline@${version2}`] : ["add", "-g", `ccstatusline@${version2}`];
|
|
70597
71227
|
return new Promise((resolve6, reject2) => {
|
|
70598
|
-
execFile2(executable, args, {
|
|
71228
|
+
execFile2(executable, args, {
|
|
71229
|
+
timeout: GLOBAL_UPDATE_TIMEOUT_MS,
|
|
71230
|
+
windowsHide: true,
|
|
71231
|
+
...getPackageManagerShellOptions(executable, platform4)
|
|
71232
|
+
}, (error51) => {
|
|
70599
71233
|
if (error51) {
|
|
70600
71234
|
reject2(error51 instanceof Error ? error51 : new Error("Global update command failed"));
|
|
70601
71235
|
return;
|
|
@@ -71034,6 +71668,7 @@ var SelectInput_default = SelectInput;
|
|
|
71034
71668
|
// src/tui/components/ColorMenu.tsx
|
|
71035
71669
|
init_ColorLevel();
|
|
71036
71670
|
init_colors();
|
|
71671
|
+
init_gradient();
|
|
71037
71672
|
init_input_guards();
|
|
71038
71673
|
await init_widgets2();
|
|
71039
71674
|
var import_react39 = __toESM(require_react(), 1);
|
|
@@ -71338,6 +71973,11 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
71338
71973
|
const [ansi256InputMode, setAnsi256InputMode] = import_react39.useState(false);
|
|
71339
71974
|
const [ansi256Input, setAnsi256Input] = import_react39.useState("");
|
|
71340
71975
|
const [showClearConfirm, setShowClearConfirm] = import_react39.useState(false);
|
|
71976
|
+
const [gradientMode, setGradientMode] = import_react39.useState(false);
|
|
71977
|
+
const [gradientIndex, setGradientIndex] = import_react39.useState(0);
|
|
71978
|
+
const [gradientCustomStep, setGradientCustomStep] = import_react39.useState(null);
|
|
71979
|
+
const [gradientStartHex, setGradientStartHex] = import_react39.useState("");
|
|
71980
|
+
const [gradientHexInput, setGradientHexInput] = import_react39.useState("");
|
|
71341
71981
|
const powerlineEnabled = settings.powerline.enabled;
|
|
71342
71982
|
const colorableWidgets = widgets.filter((widget) => {
|
|
71343
71983
|
if (widget.type === "separator") {
|
|
@@ -71417,6 +72057,62 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
71417
72057
|
}
|
|
71418
72058
|
return;
|
|
71419
72059
|
}
|
|
72060
|
+
if (gradientMode) {
|
|
72061
|
+
const exitGradient = () => {
|
|
72062
|
+
setGradientMode(false);
|
|
72063
|
+
setGradientCustomStep(null);
|
|
72064
|
+
setGradientStartHex("");
|
|
72065
|
+
setGradientHexInput("");
|
|
72066
|
+
};
|
|
72067
|
+
const applyGradientValue = (value) => {
|
|
72068
|
+
const selectedWidget2 = colorableWidgets.find((widget) => widget.id === highlightedItemId);
|
|
72069
|
+
if (selectedWidget2) {
|
|
72070
|
+
onUpdate(setWidgetColor(widgets, selectedWidget2.id, value, false));
|
|
72071
|
+
}
|
|
72072
|
+
exitGradient();
|
|
72073
|
+
};
|
|
72074
|
+
if (gradientCustomStep) {
|
|
72075
|
+
if (key.escape) {
|
|
72076
|
+
setGradientCustomStep(null);
|
|
72077
|
+
setGradientHexInput("");
|
|
72078
|
+
} else if (key.return) {
|
|
72079
|
+
if (gradientHexInput.length === 6) {
|
|
72080
|
+
if (gradientCustomStep === "start") {
|
|
72081
|
+
setGradientStartHex(gradientHexInput);
|
|
72082
|
+
setGradientHexInput("");
|
|
72083
|
+
setGradientCustomStep("end");
|
|
72084
|
+
} else {
|
|
72085
|
+
applyGradientValue(`gradient:${gradientStartHex}-${gradientHexInput}`);
|
|
72086
|
+
}
|
|
72087
|
+
}
|
|
72088
|
+
} else if (key.backspace || key.delete) {
|
|
72089
|
+
setGradientHexInput(gradientHexInput.slice(0, -1));
|
|
72090
|
+
} else if (shouldInsertInput(input, key) && gradientHexInput.length < 6) {
|
|
72091
|
+
const upperInput = input.toUpperCase();
|
|
72092
|
+
if (/^[0-9A-F]$/.test(upperInput)) {
|
|
72093
|
+
setGradientHexInput(gradientHexInput + upperInput);
|
|
72094
|
+
}
|
|
72095
|
+
}
|
|
72096
|
+
return;
|
|
72097
|
+
}
|
|
72098
|
+
const total = GRADIENT_PRESET_NAMES.length + 1;
|
|
72099
|
+
if (key.escape) {
|
|
72100
|
+
exitGradient();
|
|
72101
|
+
} else if (key.upArrow) {
|
|
72102
|
+
setGradientIndex((gradientIndex - 1 + total) % total);
|
|
72103
|
+
} else if (key.downArrow) {
|
|
72104
|
+
setGradientIndex((gradientIndex + 1) % total);
|
|
72105
|
+
} else if (key.return) {
|
|
72106
|
+
if (gradientIndex < GRADIENT_PRESET_NAMES.length) {
|
|
72107
|
+
applyGradientValue(`gradient:${GRADIENT_PRESET_NAMES[gradientIndex]}`);
|
|
72108
|
+
} else {
|
|
72109
|
+
setGradientStartHex("");
|
|
72110
|
+
setGradientHexInput("");
|
|
72111
|
+
setGradientCustomStep("start");
|
|
72112
|
+
}
|
|
72113
|
+
}
|
|
72114
|
+
return;
|
|
72115
|
+
}
|
|
71420
72116
|
if (input && /^[0-9]$/.test(input)) {
|
|
71421
72117
|
return;
|
|
71422
72118
|
}
|
|
@@ -71436,6 +72132,14 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
71436
72132
|
setAnsi256InputMode(true);
|
|
71437
72133
|
setAnsi256Input("");
|
|
71438
72134
|
}
|
|
72135
|
+
} else if (input === "g" || input === "G") {
|
|
72136
|
+
if (highlightedItemId && highlightedItemId !== "back" && !editingBackground && settings.colorLevel >= 2) {
|
|
72137
|
+
setGradientMode(true);
|
|
72138
|
+
setGradientIndex(0);
|
|
72139
|
+
setGradientCustomStep(null);
|
|
72140
|
+
setGradientStartHex("");
|
|
72141
|
+
setGradientHexInput("");
|
|
72142
|
+
}
|
|
71439
72143
|
} else if ((input === "s" || input === "S") && !key.ctrl) {
|
|
71440
72144
|
if (!settings.powerline.enabled && !settings.defaultSeparator) {
|
|
71441
72145
|
setShowSeparators(!showSeparators);
|
|
@@ -71587,6 +72291,13 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
71587
72291
|
displayName = `ANSI ${currentColor.substring(8)}`;
|
|
71588
72292
|
} else if (currentColor.startsWith("hex:")) {
|
|
71589
72293
|
displayName = `#${currentColor.substring(4)}`;
|
|
72294
|
+
} else if (currentColor.startsWith("gradient:")) {
|
|
72295
|
+
const body = currentColor.substring(9);
|
|
72296
|
+
if (GRADIENT_PRESET_NAMES.includes(body.toLowerCase())) {
|
|
72297
|
+
displayName = `Gradient: ${body.toLowerCase()}`;
|
|
72298
|
+
} else {
|
|
72299
|
+
displayName = `Gradient: ${body}`;
|
|
72300
|
+
}
|
|
71590
72301
|
} else {
|
|
71591
72302
|
const colorOption = colorOptions.find((c) => c.value === currentColor);
|
|
71592
72303
|
displayName = colorOption ? colorOption.name : currentColor;
|
|
@@ -71595,6 +72306,94 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
71595
72306
|
colorDisplay = applyColors(displayName, currentColor, undefined, false, level);
|
|
71596
72307
|
}
|
|
71597
72308
|
}
|
|
72309
|
+
if (gradientMode) {
|
|
72310
|
+
const level = getColorLevelString(settings.colorLevel);
|
|
72311
|
+
const widgetName = selectedWidget ? getItemLabel(selectedWidget) : "";
|
|
72312
|
+
if (gradientCustomStep) {
|
|
72313
|
+
return /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
|
|
72314
|
+
flexDirection: "column",
|
|
72315
|
+
children: [
|
|
72316
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
|
|
72317
|
+
bold: true,
|
|
72318
|
+
children: [
|
|
72319
|
+
"Custom Gradient",
|
|
72320
|
+
widgetName ? ` - ${widgetName}` : ""
|
|
72321
|
+
]
|
|
72322
|
+
}, undefined, true, undefined, this),
|
|
72323
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
|
|
72324
|
+
marginTop: 1,
|
|
72325
|
+
flexDirection: "column",
|
|
72326
|
+
children: [
|
|
72327
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
|
|
72328
|
+
children: gradientCustomStep === "start" ? "Enter START hex color (without #):" : "Enter END hex color (without #):"
|
|
72329
|
+
}, undefined, false, undefined, this),
|
|
72330
|
+
gradientCustomStep === "end" && /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
|
|
72331
|
+
dimColor: true,
|
|
72332
|
+
children: [
|
|
72333
|
+
"Start: #",
|
|
72334
|
+
gradientStartHex
|
|
72335
|
+
]
|
|
72336
|
+
}, undefined, true, undefined, this),
|
|
72337
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
|
|
72338
|
+
children: [
|
|
72339
|
+
"#",
|
|
72340
|
+
gradientHexInput,
|
|
72341
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
|
|
72342
|
+
dimColor: true,
|
|
72343
|
+
children: gradientHexInput.length < 6 ? "_".repeat(6 - gradientHexInput.length) : ""
|
|
72344
|
+
}, undefined, false, undefined, this)
|
|
72345
|
+
]
|
|
72346
|
+
}, undefined, true, undefined, this),
|
|
72347
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
|
|
72348
|
+
children: " "
|
|
72349
|
+
}, undefined, false, undefined, this),
|
|
72350
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
|
|
72351
|
+
dimColor: true,
|
|
72352
|
+
children: "Press Enter when done, ESC to go back"
|
|
72353
|
+
}, undefined, false, undefined, this)
|
|
72354
|
+
]
|
|
72355
|
+
}, undefined, true, undefined, this)
|
|
72356
|
+
]
|
|
72357
|
+
}, undefined, true, undefined, this);
|
|
72358
|
+
}
|
|
72359
|
+
return /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
|
|
72360
|
+
flexDirection: "column",
|
|
72361
|
+
children: [
|
|
72362
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
|
|
72363
|
+
bold: true,
|
|
72364
|
+
children: [
|
|
72365
|
+
"Select Gradient",
|
|
72366
|
+
widgetName ? ` - ${widgetName}` : ""
|
|
72367
|
+
]
|
|
72368
|
+
}, undefined, true, undefined, this),
|
|
72369
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
|
|
72370
|
+
marginTop: 1,
|
|
72371
|
+
children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
|
|
72372
|
+
dimColor: true,
|
|
72373
|
+
children: "↑↓ to select, Enter to apply, ESC to cancel"
|
|
72374
|
+
}, undefined, false, undefined, this)
|
|
72375
|
+
}, undefined, false, undefined, this),
|
|
72376
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
|
|
72377
|
+
marginTop: 1,
|
|
72378
|
+
flexDirection: "column",
|
|
72379
|
+
children: [
|
|
72380
|
+
GRADIENT_PRESET_NAMES.map((name, idx) => /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
|
|
72381
|
+
children: [
|
|
72382
|
+
idx === gradientIndex ? "▶ " : " ",
|
|
72383
|
+
applyColors(name, `gradient:${name}`, undefined, idx === gradientIndex, level)
|
|
72384
|
+
]
|
|
72385
|
+
}, name, true, undefined, this)),
|
|
72386
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
|
|
72387
|
+
children: [
|
|
72388
|
+
gradientIndex === GRADIENT_PRESET_NAMES.length ? "▶ " : " ",
|
|
72389
|
+
"Custom (enter two hex stops)"
|
|
72390
|
+
]
|
|
72391
|
+
}, "custom", true, undefined, this)
|
|
72392
|
+
]
|
|
72393
|
+
}, undefined, true, undefined, this)
|
|
72394
|
+
]
|
|
72395
|
+
}, undefined, true, undefined, this);
|
|
72396
|
+
}
|
|
71598
72397
|
if (showClearConfirm) {
|
|
71599
72398
|
return /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
|
|
71600
72399
|
flexDirection: "column",
|
|
@@ -71723,6 +72522,7 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
71723
72522
|
editingBackground ? "background" : "foreground",
|
|
71724
72523
|
", (f) to toggle bg/fg, (b)old,",
|
|
71725
72524
|
settings.colorLevel === 3 ? " (h)ex," : settings.colorLevel === 2 ? " (a)nsi256," : "",
|
|
72525
|
+
!editingBackground && settings.colorLevel >= 2 ? " (g)radient," : "",
|
|
71726
72526
|
" ",
|
|
71727
72527
|
"(r)eset, (c)lear all, ESC to go back"
|
|
71728
72528
|
]
|
|
@@ -71802,7 +72602,9 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
71802
72602
|
}, undefined, true, undefined, this);
|
|
71803
72603
|
};
|
|
71804
72604
|
// src/tui/components/GlobalOverridesMenu.tsx
|
|
72605
|
+
init_ColorLevel();
|
|
71805
72606
|
init_colors();
|
|
72607
|
+
init_gradient();
|
|
71806
72608
|
init_input_guards();
|
|
71807
72609
|
await init_build2();
|
|
71808
72610
|
var import_react40 = __toESM(require_react(), 1);
|
|
@@ -71816,6 +72618,11 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
|
|
|
71816
72618
|
const [inheritColors, setInheritColors] = import_react40.useState(settings.inheritSeparatorColors);
|
|
71817
72619
|
const [globalBold, setGlobalBold] = import_react40.useState(settings.globalBold);
|
|
71818
72620
|
const [minimalistMode, setMinimalistMode] = import_react40.useState(settings.minimalistMode);
|
|
72621
|
+
const [gradientMode, setGradientMode] = import_react40.useState(false);
|
|
72622
|
+
const [gradientIndex, setGradientIndex] = import_react40.useState(0);
|
|
72623
|
+
const [gradientCustomStep, setGradientCustomStep] = import_react40.useState(null);
|
|
72624
|
+
const [gradientStartHex, setGradientStartHex] = import_react40.useState("");
|
|
72625
|
+
const [gradientHexInput, setGradientHexInput] = import_react40.useState("");
|
|
71819
72626
|
const isPowerlineEnabled = settings.powerline.enabled;
|
|
71820
72627
|
const hasManualSeparators = settings.lines.some((line) => line.some((item) => item.type === "separator"));
|
|
71821
72628
|
const bgColors = ["none", ...COLOR_MAP.filter((c) => c.isBackground).map((c) => c.name)];
|
|
@@ -71863,6 +72670,60 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
|
|
|
71863
72670
|
}
|
|
71864
72671
|
} else if (confirmingSeparator) {
|
|
71865
72672
|
return;
|
|
72673
|
+
} else if (gradientMode) {
|
|
72674
|
+
const exitGradient = () => {
|
|
72675
|
+
setGradientMode(false);
|
|
72676
|
+
setGradientCustomStep(null);
|
|
72677
|
+
setGradientStartHex("");
|
|
72678
|
+
setGradientHexInput("");
|
|
72679
|
+
};
|
|
72680
|
+
const applyGradientValue = (value) => {
|
|
72681
|
+
onUpdate({
|
|
72682
|
+
...settings,
|
|
72683
|
+
overrideForegroundColor: value
|
|
72684
|
+
});
|
|
72685
|
+
exitGradient();
|
|
72686
|
+
};
|
|
72687
|
+
if (gradientCustomStep) {
|
|
72688
|
+
if (key.escape) {
|
|
72689
|
+
setGradientCustomStep(null);
|
|
72690
|
+
setGradientHexInput("");
|
|
72691
|
+
} else if (key.return) {
|
|
72692
|
+
if (gradientHexInput.length === 6) {
|
|
72693
|
+
if (gradientCustomStep === "start") {
|
|
72694
|
+
setGradientStartHex(gradientHexInput);
|
|
72695
|
+
setGradientHexInput("");
|
|
72696
|
+
setGradientCustomStep("end");
|
|
72697
|
+
} else {
|
|
72698
|
+
applyGradientValue(`gradient:${gradientStartHex}-${gradientHexInput}`);
|
|
72699
|
+
}
|
|
72700
|
+
}
|
|
72701
|
+
} else if (key.backspace || key.delete) {
|
|
72702
|
+
setGradientHexInput(gradientHexInput.slice(0, -1));
|
|
72703
|
+
} else if (shouldInsertInput(input, key) && gradientHexInput.length < 6) {
|
|
72704
|
+
const upperInput = input.toUpperCase();
|
|
72705
|
+
if (/^[0-9A-F]$/.test(upperInput)) {
|
|
72706
|
+
setGradientHexInput(gradientHexInput + upperInput);
|
|
72707
|
+
}
|
|
72708
|
+
}
|
|
72709
|
+
return;
|
|
72710
|
+
}
|
|
72711
|
+
const total = GRADIENT_PRESET_NAMES.length + 1;
|
|
72712
|
+
if (key.escape) {
|
|
72713
|
+
exitGradient();
|
|
72714
|
+
} else if (key.upArrow) {
|
|
72715
|
+
setGradientIndex((gradientIndex - 1 + total) % total);
|
|
72716
|
+
} else if (key.downArrow) {
|
|
72717
|
+
setGradientIndex((gradientIndex + 1) % total);
|
|
72718
|
+
} else if (key.return) {
|
|
72719
|
+
if (gradientIndex < GRADIENT_PRESET_NAMES.length) {
|
|
72720
|
+
applyGradientValue(`gradient:${GRADIENT_PRESET_NAMES[gradientIndex]}`);
|
|
72721
|
+
} else {
|
|
72722
|
+
setGradientStartHex("");
|
|
72723
|
+
setGradientHexInput("");
|
|
72724
|
+
setGradientCustomStep("start");
|
|
72725
|
+
}
|
|
72726
|
+
}
|
|
71866
72727
|
} else {
|
|
71867
72728
|
if (key.escape) {
|
|
71868
72729
|
onBack();
|
|
@@ -71917,6 +72778,12 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
|
|
|
71917
72778
|
};
|
|
71918
72779
|
onUpdate(updatedSettings);
|
|
71919
72780
|
} else if (input === "g" || input === "G") {
|
|
72781
|
+
setGradientMode(true);
|
|
72782
|
+
setGradientIndex(0);
|
|
72783
|
+
setGradientCustomStep(null);
|
|
72784
|
+
setGradientStartHex("");
|
|
72785
|
+
setGradientHexInput("");
|
|
72786
|
+
} else if (input === "x" || input === "X") {
|
|
71920
72787
|
const updatedSettings = {
|
|
71921
72788
|
...settings,
|
|
71922
72789
|
overrideForegroundColor: undefined
|
|
@@ -71925,6 +72792,87 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
|
|
|
71925
72792
|
}
|
|
71926
72793
|
}
|
|
71927
72794
|
});
|
|
72795
|
+
if (gradientMode) {
|
|
72796
|
+
const level = getColorLevelString(settings.colorLevel);
|
|
72797
|
+
if (gradientCustomStep) {
|
|
72798
|
+
return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Box_default, {
|
|
72799
|
+
flexDirection: "column",
|
|
72800
|
+
children: [
|
|
72801
|
+
/* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
|
|
72802
|
+
bold: true,
|
|
72803
|
+
children: "Custom Gradient - Override FG Color"
|
|
72804
|
+
}, undefined, false, undefined, this),
|
|
72805
|
+
/* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Box_default, {
|
|
72806
|
+
marginTop: 1,
|
|
72807
|
+
flexDirection: "column",
|
|
72808
|
+
children: [
|
|
72809
|
+
/* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
|
|
72810
|
+
children: gradientCustomStep === "start" ? "Enter START hex color (without #):" : "Enter END hex color (without #):"
|
|
72811
|
+
}, undefined, false, undefined, this),
|
|
72812
|
+
gradientCustomStep === "end" && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
|
|
72813
|
+
dimColor: true,
|
|
72814
|
+
children: [
|
|
72815
|
+
"Start: #",
|
|
72816
|
+
gradientStartHex
|
|
72817
|
+
]
|
|
72818
|
+
}, undefined, true, undefined, this),
|
|
72819
|
+
/* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
|
|
72820
|
+
children: [
|
|
72821
|
+
"#",
|
|
72822
|
+
gradientHexInput,
|
|
72823
|
+
/* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
|
|
72824
|
+
dimColor: true,
|
|
72825
|
+
children: gradientHexInput.length < 6 ? "_".repeat(6 - gradientHexInput.length) : ""
|
|
72826
|
+
}, undefined, false, undefined, this)
|
|
72827
|
+
]
|
|
72828
|
+
}, undefined, true, undefined, this),
|
|
72829
|
+
/* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
|
|
72830
|
+
children: " "
|
|
72831
|
+
}, undefined, false, undefined, this),
|
|
72832
|
+
/* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
|
|
72833
|
+
dimColor: true,
|
|
72834
|
+
children: "Press Enter when done, ESC to go back"
|
|
72835
|
+
}, undefined, false, undefined, this)
|
|
72836
|
+
]
|
|
72837
|
+
}, undefined, true, undefined, this)
|
|
72838
|
+
]
|
|
72839
|
+
}, undefined, true, undefined, this);
|
|
72840
|
+
}
|
|
72841
|
+
return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Box_default, {
|
|
72842
|
+
flexDirection: "column",
|
|
72843
|
+
children: [
|
|
72844
|
+
/* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
|
|
72845
|
+
bold: true,
|
|
72846
|
+
children: "Select Gradient - Override FG Color"
|
|
72847
|
+
}, undefined, false, undefined, this),
|
|
72848
|
+
/* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Box_default, {
|
|
72849
|
+
marginTop: 1,
|
|
72850
|
+
children: /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
|
|
72851
|
+
dimColor: true,
|
|
72852
|
+
children: "↑↓ to select, Enter to apply, ESC to cancel"
|
|
72853
|
+
}, undefined, false, undefined, this)
|
|
72854
|
+
}, undefined, false, undefined, this),
|
|
72855
|
+
/* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Box_default, {
|
|
72856
|
+
marginTop: 1,
|
|
72857
|
+
flexDirection: "column",
|
|
72858
|
+
children: [
|
|
72859
|
+
GRADIENT_PRESET_NAMES.map((name, idx) => /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
|
|
72860
|
+
children: [
|
|
72861
|
+
idx === gradientIndex ? "▶ " : " ",
|
|
72862
|
+
applyColors(name, `gradient:${name}`, undefined, idx === gradientIndex, level)
|
|
72863
|
+
]
|
|
72864
|
+
}, name, true, undefined, this)),
|
|
72865
|
+
/* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
|
|
72866
|
+
children: [
|
|
72867
|
+
gradientIndex === GRADIENT_PRESET_NAMES.length ? "▶ " : " ",
|
|
72868
|
+
"Custom (enter two hex stops)"
|
|
72869
|
+
]
|
|
72870
|
+
}, "custom", true, undefined, this)
|
|
72871
|
+
]
|
|
72872
|
+
}, undefined, true, undefined, this)
|
|
72873
|
+
]
|
|
72874
|
+
}, undefined, true, undefined, this);
|
|
72875
|
+
}
|
|
71928
72876
|
return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Box_default, {
|
|
71929
72877
|
flexDirection: "column",
|
|
71930
72878
|
children: [
|
|
@@ -72090,6 +73038,13 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
|
|
|
72090
73038
|
color: "gray",
|
|
72091
73039
|
children: "(none)"
|
|
72092
73040
|
}, undefined, false, undefined, this);
|
|
73041
|
+
} else if (fgColor.startsWith("gradient:")) {
|
|
73042
|
+
const body = fgColor.substring(9);
|
|
73043
|
+
const displayName = GRADIENT_PRESET_NAMES.includes(body.toLowerCase()) ? `Gradient: ${body.toLowerCase()}` : `Gradient: ${body}`;
|
|
73044
|
+
const level = getColorLevelString(settings.colorLevel);
|
|
73045
|
+
return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
|
|
73046
|
+
children: applyColors(displayName, fgColor, undefined, false, level)
|
|
73047
|
+
}, undefined, false, undefined, this);
|
|
72093
73048
|
} else {
|
|
72094
73049
|
const displayName = getColorDisplayName(fgColor);
|
|
72095
73050
|
const fgChalk = getChalkColor(fgColor, "ansi16", false);
|
|
@@ -72101,7 +73056,7 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
|
|
|
72101
73056
|
})(),
|
|
72102
73057
|
/* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
|
|
72103
73058
|
dimColor: true,
|
|
72104
|
-
children: " - (f) cycle, (g) clear"
|
|
73059
|
+
children: " - (f) cycle, (g) gradient, (x) clear"
|
|
72105
73060
|
}, undefined, false, undefined, this)
|
|
72106
73061
|
]
|
|
72107
73062
|
}, undefined, true, undefined, this),
|
|
@@ -74579,6 +75534,8 @@ var PowerlineSetup = ({
|
|
|
74579
75534
|
const [confirmingEnable, setConfirmingEnable] = import_react46.useState(false);
|
|
74580
75535
|
const [confirmingFontInstall, setConfirmingFontInstall] = import_react46.useState(false);
|
|
74581
75536
|
const hasSeparatorItems = settings.lines.some((line) => line.some((item) => item.type === "separator" || item.type === "flex-separator"));
|
|
75537
|
+
const hasGlobalFgOverride = Boolean(settings.overrideForegroundColor && settings.overrideForegroundColor !== "none");
|
|
75538
|
+
const globalOverrideMessage = hasGlobalFgOverride ? "⚠ Global override for FG active" : null;
|
|
74582
75539
|
use_input_default((input, key) => {
|
|
74583
75540
|
if (fontInstallMessage || installingFonts) {
|
|
74584
75541
|
if (fontInstallMessage && !key.escape) {
|
|
@@ -74671,10 +75628,22 @@ var PowerlineSetup = ({
|
|
|
74671
75628
|
return /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Box_default, {
|
|
74672
75629
|
flexDirection: "column",
|
|
74673
75630
|
children: [
|
|
74674
|
-
!confirmingFontInstall && !installingFonts && !fontInstallMessage && /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(
|
|
74675
|
-
|
|
74676
|
-
|
|
74677
|
-
|
|
75631
|
+
!confirmingFontInstall && !installingFonts && !fontInstallMessage && /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Box_default, {
|
|
75632
|
+
children: [
|
|
75633
|
+
/* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
|
|
75634
|
+
bold: true,
|
|
75635
|
+
children: "Powerline Setup"
|
|
75636
|
+
}, undefined, false, undefined, this),
|
|
75637
|
+
globalOverrideMessage && /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
|
|
75638
|
+
color: "yellow",
|
|
75639
|
+
dimColor: true,
|
|
75640
|
+
children: [
|
|
75641
|
+
". ",
|
|
75642
|
+
globalOverrideMessage
|
|
75643
|
+
]
|
|
75644
|
+
}, undefined, true, undefined, this)
|
|
75645
|
+
]
|
|
75646
|
+
}, undefined, true, undefined, this),
|
|
74678
75647
|
confirmingFontInstall ? /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Box_default, {
|
|
74679
75648
|
flexDirection: "column",
|
|
74680
75649
|
children: [
|
|
@@ -74960,7 +75929,7 @@ var PowerlineSetup = ({
|
|
|
74960
75929
|
children: [
|
|
74961
75930
|
/* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
|
|
74962
75931
|
dimColor: true,
|
|
74963
|
-
children: "
|
|
75932
|
+
children: "Powerline mode uses its own separator system"
|
|
74964
75933
|
}, undefined, false, undefined, this),
|
|
74965
75934
|
/* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
|
|
74966
75935
|
dimColor: true,
|
|
@@ -76982,6 +77951,7 @@ import * as fs15 from "fs";
|
|
|
76982
77951
|
import * as os14 from "os";
|
|
76983
77952
|
import * as path12 from "path";
|
|
76984
77953
|
var DEFAULT_DROP_THRESHOLD = 2;
|
|
77954
|
+
var MIN_CTX_PCT = 1;
|
|
76985
77955
|
var FRESH_PREV_CTX_PCT = -1;
|
|
76986
77956
|
var MAX_CACHE_FILE_BYTES = 4096;
|
|
76987
77957
|
var SESSION_ID_HASH_HEX_LEN = 32;
|
|
@@ -77005,7 +77975,7 @@ function normalizeOptions(options) {
|
|
|
77005
77975
|
return { dropThreshold, windowSize: options.windowSize ?? null };
|
|
77006
77976
|
}
|
|
77007
77977
|
function detectCompaction(currentCtxPct, state, options = DEFAULT_DROP_THRESHOLD) {
|
|
77008
|
-
if (!Number.isFinite(currentCtxPct) || currentCtxPct <
|
|
77978
|
+
if (!Number.isFinite(currentCtxPct) || currentCtxPct < MIN_CTX_PCT) {
|
|
77009
77979
|
return state;
|
|
77010
77980
|
}
|
|
77011
77981
|
const { dropThreshold, windowSize } = normalizeOptions(options);
|