postboy-tui 1.3.5 → 1.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1199 -208
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -32071,13 +32071,13 @@ var require_figures = __commonJS((exports, module) => {
|
|
|
32071
32071
|
|
|
32072
32072
|
// node_modules/inquirer/lib/objects/separator.js
|
|
32073
32073
|
var require_separator = __commonJS((exports, module) => {
|
|
32074
|
-
var
|
|
32074
|
+
var chalk5 = require_source();
|
|
32075
32075
|
var figures = require_figures();
|
|
32076
32076
|
|
|
32077
32077
|
class Separator {
|
|
32078
32078
|
constructor(line) {
|
|
32079
32079
|
this.type = "separator";
|
|
32080
|
-
this.line =
|
|
32080
|
+
this.line = chalk5.dim(line || new Array(15).join(figures.line));
|
|
32081
32081
|
}
|
|
32082
32082
|
toString() {
|
|
32083
32083
|
return this.line;
|
|
@@ -32668,11 +32668,11 @@ var require_isPlainObject = __commonJS((exports, module) => {
|
|
|
32668
32668
|
if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
|
|
32669
32669
|
return false;
|
|
32670
32670
|
}
|
|
32671
|
-
var
|
|
32672
|
-
if (
|
|
32671
|
+
var proto3 = getPrototype(value);
|
|
32672
|
+
if (proto3 === null) {
|
|
32673
32673
|
return true;
|
|
32674
32674
|
}
|
|
32675
|
-
var Ctor = hasOwnProperty.call(
|
|
32675
|
+
var Ctor = hasOwnProperty.call(proto3, "constructor") && proto3.constructor;
|
|
32676
32676
|
return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
|
|
32677
32677
|
}
|
|
32678
32678
|
module.exports = isPlainObject;
|
|
@@ -36378,7 +36378,7 @@ var require_innerFrom = __commonJS((exports) => {
|
|
|
36378
36378
|
exports.fromIterable = fromIterable;
|
|
36379
36379
|
function fromAsyncIterable(asyncIterable) {
|
|
36380
36380
|
return new Observable_1.Observable(function(subscriber) {
|
|
36381
|
-
|
|
36381
|
+
process14(asyncIterable, subscriber).catch(function(err) {
|
|
36382
36382
|
return subscriber.error(err);
|
|
36383
36383
|
});
|
|
36384
36384
|
});
|
|
@@ -36388,7 +36388,7 @@ var require_innerFrom = __commonJS((exports) => {
|
|
|
36388
36388
|
return fromAsyncIterable(isReadableStreamLike_1.readableStreamLikeToAsyncGenerator(readableStream));
|
|
36389
36389
|
}
|
|
36390
36390
|
exports.fromReadableStreamLike = fromReadableStreamLike;
|
|
36391
|
-
function
|
|
36391
|
+
function process14(asyncIterable, subscriber) {
|
|
36392
36392
|
var asyncIterable_1, asyncIterable_1_1;
|
|
36393
36393
|
var e_2, _a;
|
|
36394
36394
|
return __awaiter(this, undefined, undefined, function() {
|
|
@@ -43378,8 +43378,8 @@ var require__arrayLikeKeys = __commonJS((exports, module) => {
|
|
|
43378
43378
|
var require__isPrototype = __commonJS((exports, module) => {
|
|
43379
43379
|
var objectProto = Object.prototype;
|
|
43380
43380
|
function isPrototype(value) {
|
|
43381
|
-
var Ctor = value && value.constructor,
|
|
43382
|
-
return value ===
|
|
43381
|
+
var Ctor = value && value.constructor, proto3 = typeof Ctor == "function" && Ctor.prototype || objectProto;
|
|
43382
|
+
return value === proto3;
|
|
43383
43383
|
}
|
|
43384
43384
|
module.exports = isPrototype;
|
|
43385
43385
|
});
|
|
@@ -44019,14 +44019,14 @@ var require__baseCreate = __commonJS((exports, module) => {
|
|
|
44019
44019
|
var objectCreate = Object.create;
|
|
44020
44020
|
var baseCreate = function() {
|
|
44021
44021
|
function object() {}
|
|
44022
|
-
return function(
|
|
44023
|
-
if (!isObject(
|
|
44022
|
+
return function(proto3) {
|
|
44023
|
+
if (!isObject(proto3)) {
|
|
44024
44024
|
return {};
|
|
44025
44025
|
}
|
|
44026
44026
|
if (objectCreate) {
|
|
44027
|
-
return objectCreate(
|
|
44027
|
+
return objectCreate(proto3);
|
|
44028
44028
|
}
|
|
44029
|
-
object.prototype =
|
|
44029
|
+
object.prototype = proto3;
|
|
44030
44030
|
var result = new object;
|
|
44031
44031
|
object.prototype = undefined;
|
|
44032
44032
|
return result;
|
|
@@ -45097,7 +45097,7 @@ var require_string_width = __commonJS((exports, module) => {
|
|
|
45097
45097
|
var require_wrap_ansi = __commonJS((exports, module) => {
|
|
45098
45098
|
var stringWidth2 = require_string_width();
|
|
45099
45099
|
var stripAnsi2 = require_strip_ansi();
|
|
45100
|
-
var
|
|
45100
|
+
var ansiStyles7 = require_ansi_styles();
|
|
45101
45101
|
var ESCAPES5 = new Set([
|
|
45102
45102
|
"\x1B",
|
|
45103
45103
|
""
|
|
@@ -45226,7 +45226,7 @@ var require_wrap_ansi = __commonJS((exports, module) => {
|
|
|
45226
45226
|
escapeUrl = groups.uri.length === 0 ? undefined : groups.uri;
|
|
45227
45227
|
}
|
|
45228
45228
|
}
|
|
45229
|
-
const code =
|
|
45229
|
+
const code = ansiStyles7.codes.get(Number(escapeCode));
|
|
45230
45230
|
if (pre[index + 1] === `
|
|
45231
45231
|
`) {
|
|
45232
45232
|
if (escapeUrl) {
|
|
@@ -46949,19 +46949,19 @@ var require_is_unicode_supported = __commonJS((exports, module) => {
|
|
|
46949
46949
|
|
|
46950
46950
|
// node_modules/log-symbols/index.js
|
|
46951
46951
|
var require_log_symbols = __commonJS((exports, module) => {
|
|
46952
|
-
var
|
|
46952
|
+
var chalk5 = require_source();
|
|
46953
46953
|
var isUnicodeSupported = require_is_unicode_supported();
|
|
46954
46954
|
var main = {
|
|
46955
|
-
info:
|
|
46956
|
-
success:
|
|
46957
|
-
warning:
|
|
46958
|
-
error:
|
|
46955
|
+
info: chalk5.blue("ℹ"),
|
|
46956
|
+
success: chalk5.green("✔"),
|
|
46957
|
+
warning: chalk5.yellow("⚠"),
|
|
46958
|
+
error: chalk5.red("✖")
|
|
46959
46959
|
};
|
|
46960
46960
|
var fallback = {
|
|
46961
|
-
info:
|
|
46962
|
-
success:
|
|
46963
|
-
warning:
|
|
46964
|
-
error:
|
|
46961
|
+
info: chalk5.blue("i"),
|
|
46962
|
+
success: chalk5.green("√"),
|
|
46963
|
+
warning: chalk5.yellow("‼"),
|
|
46964
|
+
error: chalk5.red("×")
|
|
46965
46965
|
};
|
|
46966
46966
|
module.exports = isUnicodeSupported() ? main : fallback;
|
|
46967
46967
|
});
|
|
@@ -47007,7 +47007,7 @@ var require_clone2 = __commonJS((exports, module) => {
|
|
|
47007
47007
|
if (depth2 == 0)
|
|
47008
47008
|
return parent2;
|
|
47009
47009
|
var child;
|
|
47010
|
-
var
|
|
47010
|
+
var proto3;
|
|
47011
47011
|
if (typeof parent2 != "object") {
|
|
47012
47012
|
return parent2;
|
|
47013
47013
|
}
|
|
@@ -47029,11 +47029,11 @@ var require_clone2 = __commonJS((exports, module) => {
|
|
|
47029
47029
|
return child;
|
|
47030
47030
|
} else {
|
|
47031
47031
|
if (typeof prototype == "undefined") {
|
|
47032
|
-
|
|
47033
|
-
child = Object.create(
|
|
47032
|
+
proto3 = Object.getPrototypeOf(parent2);
|
|
47033
|
+
child = Object.create(proto3);
|
|
47034
47034
|
} else {
|
|
47035
47035
|
child = Object.create(prototype);
|
|
47036
|
-
|
|
47036
|
+
proto3 = prototype;
|
|
47037
47037
|
}
|
|
47038
47038
|
}
|
|
47039
47039
|
if (circular) {
|
|
@@ -47046,8 +47046,8 @@ var require_clone2 = __commonJS((exports, module) => {
|
|
|
47046
47046
|
}
|
|
47047
47047
|
for (var i in parent2) {
|
|
47048
47048
|
var attrs;
|
|
47049
|
-
if (
|
|
47050
|
-
attrs = Object.getOwnPropertyDescriptor(
|
|
47049
|
+
if (proto3) {
|
|
47050
|
+
attrs = Object.getOwnPropertyDescriptor(proto3, i);
|
|
47051
47051
|
}
|
|
47052
47052
|
if (attrs && attrs.set == null) {
|
|
47053
47053
|
continue;
|
|
@@ -50510,7 +50510,7 @@ var require_bl = __commonJS((exports, module) => {
|
|
|
50510
50510
|
// node_modules/ora/index.js
|
|
50511
50511
|
var require_ora = __commonJS((exports, module) => {
|
|
50512
50512
|
var readline = __require("readline");
|
|
50513
|
-
var
|
|
50513
|
+
var chalk5 = require_source();
|
|
50514
50514
|
var cliCursor2 = require_cli_cursor2();
|
|
50515
50515
|
var cliSpinners = require_cli_spinners();
|
|
50516
50516
|
var logSymbols = require_log_symbols();
|
|
@@ -50710,7 +50710,7 @@ var require_ora = __commonJS((exports, module) => {
|
|
|
50710
50710
|
const { frames } = this.spinner;
|
|
50711
50711
|
let frame = frames[this.frameIndex];
|
|
50712
50712
|
if (this.color) {
|
|
50713
|
-
frame =
|
|
50713
|
+
frame = chalk5[this.color](frame);
|
|
50714
50714
|
}
|
|
50715
50715
|
this.frameIndex = ++this.frameIndex % frames.length;
|
|
50716
50716
|
const fullPrefixText = typeof this.prefixText === "string" && this.prefixText !== "" ? this.prefixText + " " : "";
|
|
@@ -50955,7 +50955,7 @@ var require_base = __commonJS((exports, module) => {
|
|
|
50955
50955
|
defaults: require_defaults(),
|
|
50956
50956
|
clone: require_clone()
|
|
50957
50957
|
};
|
|
50958
|
-
var
|
|
50958
|
+
var chalk5 = require_source();
|
|
50959
50959
|
var runAsync = require_run_async();
|
|
50960
50960
|
var { filter, flatMap, share, take, takeUntil } = require_operators();
|
|
50961
50961
|
var Choices = require_choices();
|
|
@@ -50974,7 +50974,7 @@ var require_base = __commonJS((exports, module) => {
|
|
|
50974
50974
|
filteringText: "",
|
|
50975
50975
|
when: () => true,
|
|
50976
50976
|
suffix: "",
|
|
50977
|
-
prefix:
|
|
50977
|
+
prefix: chalk5.green("?")
|
|
50978
50978
|
});
|
|
50979
50979
|
if (!this.opt.name) {
|
|
50980
50980
|
this.throwParamError("name");
|
|
@@ -51029,12 +51029,12 @@ var require_base = __commonJS((exports, module) => {
|
|
|
51029
51029
|
return value;
|
|
51030
51030
|
}
|
|
51031
51031
|
getQuestion() {
|
|
51032
|
-
let message = (this.opt.prefix ? this.opt.prefix + " " : "") +
|
|
51032
|
+
let message = (this.opt.prefix ? this.opt.prefix + " " : "") + chalk5.bold(this.opt.message) + this.opt.suffix + chalk5.reset(" ");
|
|
51033
51033
|
if (this.opt.default != null && this.status !== "touched" && this.status !== "answered") {
|
|
51034
51034
|
if (this.opt.type === "password") {
|
|
51035
|
-
message +=
|
|
51035
|
+
message += chalk5.italic.dim("[hidden] ");
|
|
51036
51036
|
} else {
|
|
51037
|
-
message +=
|
|
51037
|
+
message += chalk5.dim("(" + this.opt.default + ") ");
|
|
51038
51038
|
}
|
|
51039
51039
|
}
|
|
51040
51040
|
return message;
|
|
@@ -51067,7 +51067,7 @@ var require_events = __commonJS((exports, module) => {
|
|
|
51067
51067
|
|
|
51068
51068
|
// node_modules/inquirer/lib/utils/paginator.js
|
|
51069
51069
|
var require_paginator = __commonJS((exports, module) => {
|
|
51070
|
-
var
|
|
51070
|
+
var chalk5 = require_source();
|
|
51071
51071
|
|
|
51072
51072
|
class Paginator {
|
|
51073
51073
|
constructor(screen, options = {}) {
|
|
@@ -51092,7 +51092,7 @@ var require_paginator = __commonJS((exports, module) => {
|
|
|
51092
51092
|
this.lastIndex = active;
|
|
51093
51093
|
return visibleLines.join(`
|
|
51094
51094
|
`) + `
|
|
51095
|
-
` +
|
|
51095
|
+
` + chalk5.dim("(Move up and down to reveal more choices)");
|
|
51096
51096
|
}
|
|
51097
51097
|
getInfiniteLines(lines, active, pageSize) {
|
|
51098
51098
|
if (this.pointer === undefined) {
|
|
@@ -51143,7 +51143,7 @@ var require_incrementListIndex = __commonJS((exports, module) => {
|
|
|
51143
51143
|
|
|
51144
51144
|
// node_modules/inquirer/lib/prompts/list.js
|
|
51145
51145
|
var require_list = __commonJS((exports, module) => {
|
|
51146
|
-
var
|
|
51146
|
+
var chalk5 = require_source();
|
|
51147
51147
|
var figures = require_figures();
|
|
51148
51148
|
var cliCursor2 = require_cli_cursor();
|
|
51149
51149
|
var runAsync = require_run_async();
|
|
@@ -51187,10 +51187,10 @@ var require_list = __commonJS((exports, module) => {
|
|
|
51187
51187
|
render() {
|
|
51188
51188
|
let message = this.getQuestion();
|
|
51189
51189
|
if (this.firstRender) {
|
|
51190
|
-
message +=
|
|
51190
|
+
message += chalk5.dim("(Use arrow keys)");
|
|
51191
51191
|
}
|
|
51192
51192
|
if (this.status === "answered") {
|
|
51193
|
-
message +=
|
|
51193
|
+
message += chalk5.cyan(this.opt.choices.getChoice(this.selected).short);
|
|
51194
51194
|
} else {
|
|
51195
51195
|
const choicesStr = listRender(this.opt.choices, this.selected);
|
|
51196
51196
|
const indexPosition = this.opt.choices.indexOf(this.opt.choices.getChoice(this.selected));
|
|
@@ -51261,7 +51261,7 @@ var require_list = __commonJS((exports, module) => {
|
|
|
51261
51261
|
const isSelected = i - separatorOffset === pointer;
|
|
51262
51262
|
let line = (isSelected ? figures.pointer + " " : " ") + choice.name;
|
|
51263
51263
|
if (isSelected) {
|
|
51264
|
-
line =
|
|
51264
|
+
line = chalk5.cyan(line);
|
|
51265
51265
|
}
|
|
51266
51266
|
output += line + `
|
|
51267
51267
|
`;
|
|
@@ -51273,7 +51273,7 @@ var require_list = __commonJS((exports, module) => {
|
|
|
51273
51273
|
|
|
51274
51274
|
// node_modules/inquirer/lib/prompts/input.js
|
|
51275
51275
|
var require_input = __commonJS((exports, module) => {
|
|
51276
|
-
var
|
|
51276
|
+
var chalk5 = require_source();
|
|
51277
51277
|
var { map, takeUntil } = require_operators();
|
|
51278
51278
|
var Base = require_base();
|
|
51279
51279
|
var observe = require_events();
|
|
@@ -51304,10 +51304,10 @@ var require_input = __commonJS((exports, module) => {
|
|
|
51304
51304
|
if (transformer) {
|
|
51305
51305
|
message += transformer(appendContent, this.answers, { isFinal });
|
|
51306
51306
|
} else {
|
|
51307
|
-
message += isFinal ?
|
|
51307
|
+
message += isFinal ? chalk5.cyan(appendContent) : appendContent;
|
|
51308
51308
|
}
|
|
51309
51309
|
if (error) {
|
|
51310
|
-
bottomContent =
|
|
51310
|
+
bottomContent = chalk5.red(">> ") + error;
|
|
51311
51311
|
}
|
|
51312
51312
|
this.screen.render(message, bottomContent);
|
|
51313
51313
|
}
|
|
@@ -51358,7 +51358,7 @@ var require_number = __commonJS((exports, module) => {
|
|
|
51358
51358
|
|
|
51359
51359
|
// node_modules/inquirer/lib/prompts/confirm.js
|
|
51360
51360
|
var require_confirm = __commonJS((exports, module) => {
|
|
51361
|
-
var
|
|
51361
|
+
var chalk5 = require_source();
|
|
51362
51362
|
var { take, takeUntil } = require_operators();
|
|
51363
51363
|
var Base = require_base();
|
|
51364
51364
|
var observe = require_events();
|
|
@@ -51392,7 +51392,7 @@ var require_confirm = __commonJS((exports, module) => {
|
|
|
51392
51392
|
render(answer) {
|
|
51393
51393
|
let message = this.getQuestion();
|
|
51394
51394
|
if (typeof answer === "boolean") {
|
|
51395
|
-
message +=
|
|
51395
|
+
message += chalk5.cyan(answer ? "Yes" : "No");
|
|
51396
51396
|
} else {
|
|
51397
51397
|
message += this.rl.line;
|
|
51398
51398
|
}
|
|
@@ -51415,7 +51415,7 @@ var require_confirm = __commonJS((exports, module) => {
|
|
|
51415
51415
|
|
|
51416
51416
|
// node_modules/inquirer/lib/prompts/rawlist.js
|
|
51417
51417
|
var require_rawlist = __commonJS((exports, module) => {
|
|
51418
|
-
var
|
|
51418
|
+
var chalk5 = require_source();
|
|
51419
51419
|
var { map, takeUntil } = require_operators();
|
|
51420
51420
|
var Base = require_base();
|
|
51421
51421
|
var Separator = require_separator();
|
|
@@ -51470,7 +51470,7 @@ var require_rawlist = __commonJS((exports, module) => {
|
|
|
51470
51470
|
let message = this.getQuestion();
|
|
51471
51471
|
let bottomContent = "";
|
|
51472
51472
|
if (this.status === "answered") {
|
|
51473
|
-
message +=
|
|
51473
|
+
message += chalk5.cyan(this.opt.choices.getChoice(this.selected).short);
|
|
51474
51474
|
} else {
|
|
51475
51475
|
const choicesStr = renderChoices(this.opt.choices, this.selected);
|
|
51476
51476
|
message += `
|
|
@@ -51481,7 +51481,7 @@ var require_rawlist = __commonJS((exports, module) => {
|
|
|
51481
51481
|
message += this.rl.line;
|
|
51482
51482
|
if (error) {
|
|
51483
51483
|
bottomContent = `
|
|
51484
|
-
` +
|
|
51484
|
+
` + chalk5.red(">> ") + error;
|
|
51485
51485
|
}
|
|
51486
51486
|
this.screen.render(message, bottomContent);
|
|
51487
51487
|
}
|
|
@@ -51549,7 +51549,7 @@ var require_rawlist = __commonJS((exports, module) => {
|
|
|
51549
51549
|
const index = i - separatorOffset;
|
|
51550
51550
|
let display = index + 1 + ") " + choice.name;
|
|
51551
51551
|
if (index === pointer) {
|
|
51552
|
-
display =
|
|
51552
|
+
display = chalk5.cyan(display);
|
|
51553
51553
|
}
|
|
51554
51554
|
output += display;
|
|
51555
51555
|
});
|
|
@@ -51560,7 +51560,7 @@ var require_rawlist = __commonJS((exports, module) => {
|
|
|
51560
51560
|
|
|
51561
51561
|
// node_modules/inquirer/lib/prompts/expand.js
|
|
51562
51562
|
var require_expand2 = __commonJS((exports, module) => {
|
|
51563
|
-
var
|
|
51563
|
+
var chalk5 = require_source();
|
|
51564
51564
|
var { map, takeUntil } = require_operators();
|
|
51565
51565
|
var Base = require_base();
|
|
51566
51566
|
var Separator = require_separator();
|
|
@@ -51602,7 +51602,7 @@ var require_expand2 = __commonJS((exports, module) => {
|
|
|
51602
51602
|
let message = this.getQuestion();
|
|
51603
51603
|
let bottomContent = "";
|
|
51604
51604
|
if (this.status === "answered") {
|
|
51605
|
-
message +=
|
|
51605
|
+
message += chalk5.cyan(this.answer);
|
|
51606
51606
|
} else if (this.status === "expanded") {
|
|
51607
51607
|
const choicesStr = renderChoices(this.opt.choices, this.selectedKey);
|
|
51608
51608
|
message += this.paginator.paginate(choicesStr, this.selectedKey, this.opt.pageSize);
|
|
@@ -51611,10 +51611,10 @@ var require_expand2 = __commonJS((exports, module) => {
|
|
|
51611
51611
|
}
|
|
51612
51612
|
message += this.rl.line;
|
|
51613
51613
|
if (error) {
|
|
51614
|
-
bottomContent =
|
|
51614
|
+
bottomContent = chalk5.red(">> ") + error;
|
|
51615
51615
|
}
|
|
51616
51616
|
if (hint) {
|
|
51617
|
-
bottomContent =
|
|
51617
|
+
bottomContent = chalk5.cyan(">> ") + hint;
|
|
51618
51618
|
}
|
|
51619
51619
|
this.screen.render(message, bottomContent);
|
|
51620
51620
|
}
|
|
@@ -51639,7 +51639,7 @@ var require_expand2 = __commonJS((exports, module) => {
|
|
|
51639
51639
|
}
|
|
51640
51640
|
let choiceStr = choice.key + ") " + choice.name;
|
|
51641
51641
|
if (this.selectedKey === choice.key) {
|
|
51642
|
-
choiceStr =
|
|
51642
|
+
choiceStr = chalk5.cyan(choiceStr);
|
|
51643
51643
|
}
|
|
51644
51644
|
output += choiceStr;
|
|
51645
51645
|
});
|
|
@@ -51720,7 +51720,7 @@ var require_expand2 = __commonJS((exports, module) => {
|
|
|
51720
51720
|
}
|
|
51721
51721
|
let choiceStr = choice.key + ") " + choice.name;
|
|
51722
51722
|
if (pointer === choice.key) {
|
|
51723
|
-
choiceStr =
|
|
51723
|
+
choiceStr = chalk5.cyan(choiceStr);
|
|
51724
51724
|
}
|
|
51725
51725
|
output += choiceStr;
|
|
51726
51726
|
});
|
|
@@ -51731,7 +51731,7 @@ var require_expand2 = __commonJS((exports, module) => {
|
|
|
51731
51731
|
|
|
51732
51732
|
// node_modules/inquirer/lib/prompts/checkbox.js
|
|
51733
51733
|
var require_checkbox = __commonJS((exports, module) => {
|
|
51734
|
-
var
|
|
51734
|
+
var chalk5 = require_source();
|
|
51735
51735
|
var cliCursor2 = require_cli_cursor();
|
|
51736
51736
|
var figures = require_figures();
|
|
51737
51737
|
var { map, takeUntil } = require_operators();
|
|
@@ -51779,10 +51779,10 @@ var require_checkbox = __commonJS((exports, module) => {
|
|
|
51779
51779
|
let message = this.getQuestion();
|
|
51780
51780
|
let bottomContent = "";
|
|
51781
51781
|
if (!this.dontShowHints) {
|
|
51782
|
-
message += "(Press " +
|
|
51782
|
+
message += "(Press " + chalk5.cyan.bold("<space>") + " to select, " + chalk5.cyan.bold("<a>") + " to toggle all, " + chalk5.cyan.bold("<i>") + " to invert selection, and " + chalk5.cyan.bold("<enter>") + " to proceed)";
|
|
51783
51783
|
}
|
|
51784
51784
|
if (this.status === "answered") {
|
|
51785
|
-
message +=
|
|
51785
|
+
message += chalk5.cyan(this.selection.join(", "));
|
|
51786
51786
|
} else {
|
|
51787
51787
|
const choicesStr = renderChoices(this.opt.choices, this.pointer);
|
|
51788
51788
|
const indexPosition = this.opt.choices.indexOf(this.opt.choices.getChoice(this.pointer));
|
|
@@ -51805,7 +51805,7 @@ var require_checkbox = __commonJS((exports, module) => {
|
|
|
51805
51805
|
` + this.paginator.paginate(choicesStr, realIndexPosition, this.opt.pageSize);
|
|
51806
51806
|
}
|
|
51807
51807
|
if (error) {
|
|
51808
|
-
bottomContent =
|
|
51808
|
+
bottomContent = chalk5.red(">> ") + error;
|
|
51809
51809
|
}
|
|
51810
51810
|
this.screen.render(message, bottomContent);
|
|
51811
51811
|
}
|
|
@@ -51885,7 +51885,7 @@ var require_checkbox = __commonJS((exports, module) => {
|
|
|
51885
51885
|
} else {
|
|
51886
51886
|
const line = getCheckbox(choice.checked) + " " + choice.name;
|
|
51887
51887
|
if (i - separatorOffset === pointer) {
|
|
51888
|
-
output +=
|
|
51888
|
+
output += chalk5.cyan(figures.pointer + line);
|
|
51889
51889
|
} else {
|
|
51890
51890
|
output += " " + line;
|
|
51891
51891
|
}
|
|
@@ -51896,14 +51896,14 @@ var require_checkbox = __commonJS((exports, module) => {
|
|
|
51896
51896
|
return output.replace(/\n$/, "");
|
|
51897
51897
|
}
|
|
51898
51898
|
function getCheckbox(checked) {
|
|
51899
|
-
return checked ?
|
|
51899
|
+
return checked ? chalk5.green(figures.radioOn) : figures.radioOff;
|
|
51900
51900
|
}
|
|
51901
51901
|
module.exports = CheckboxPrompt;
|
|
51902
51902
|
});
|
|
51903
51903
|
|
|
51904
51904
|
// node_modules/inquirer/lib/prompts/password.js
|
|
51905
51905
|
var require_password = __commonJS((exports, module) => {
|
|
51906
|
-
var
|
|
51906
|
+
var chalk5 = require_source();
|
|
51907
51907
|
var { map, takeUntil } = require_operators();
|
|
51908
51908
|
var Base = require_base();
|
|
51909
51909
|
var observe = require_events();
|
|
@@ -51938,15 +51938,15 @@ var require_password = __commonJS((exports, module) => {
|
|
|
51938
51938
|
}
|
|
51939
51939
|
if (error) {
|
|
51940
51940
|
bottomContent = `
|
|
51941
|
-
` +
|
|
51941
|
+
` + chalk5.red(">> ") + error;
|
|
51942
51942
|
}
|
|
51943
51943
|
this.screen.render(message, bottomContent);
|
|
51944
51944
|
}
|
|
51945
51945
|
getMaskedValue(value) {
|
|
51946
51946
|
if (this.status === "answered") {
|
|
51947
|
-
return this.opt.mask ?
|
|
51947
|
+
return this.opt.mask ? chalk5.cyan(mask(value, this.opt.mask)) : chalk5.italic.dim("[hidden]");
|
|
51948
51948
|
}
|
|
51949
|
-
return this.opt.mask ? mask(value, this.opt.mask) :
|
|
51949
|
+
return this.opt.mask ? mask(value, this.opt.mask) : chalk5.italic.dim("[input is hidden] ");
|
|
51950
51950
|
}
|
|
51951
51951
|
getSpinningValue(value) {
|
|
51952
51952
|
return this.getMaskedValue(value);
|
|
@@ -61023,9 +61023,9 @@ var require_CreateFileError = __commonJS((exports) => {
|
|
|
61023
61023
|
var _newTarget = this.constructor;
|
|
61024
61024
|
var _this = _super.call(this, "Failed to create temporary file for editor") || this;
|
|
61025
61025
|
_this.originalError = originalError;
|
|
61026
|
-
var
|
|
61026
|
+
var proto3 = _newTarget.prototype;
|
|
61027
61027
|
if (Object.setPrototypeOf) {
|
|
61028
|
-
Object.setPrototypeOf(_this,
|
|
61028
|
+
Object.setPrototypeOf(_this, proto3);
|
|
61029
61029
|
} else {
|
|
61030
61030
|
_this.__proto__ = _newTarget.prototype;
|
|
61031
61031
|
}
|
|
@@ -61064,9 +61064,9 @@ var require_LaunchEditorError = __commonJS((exports) => {
|
|
|
61064
61064
|
var _newTarget = this.constructor;
|
|
61065
61065
|
var _this = _super.call(this, "Failed launch editor") || this;
|
|
61066
61066
|
_this.originalError = originalError;
|
|
61067
|
-
var
|
|
61067
|
+
var proto3 = _newTarget.prototype;
|
|
61068
61068
|
if (Object.setPrototypeOf) {
|
|
61069
|
-
Object.setPrototypeOf(_this,
|
|
61069
|
+
Object.setPrototypeOf(_this, proto3);
|
|
61070
61070
|
} else {
|
|
61071
61071
|
_this.__proto__ = _newTarget.prototype;
|
|
61072
61072
|
}
|
|
@@ -61105,9 +61105,9 @@ var require_ReadFileError = __commonJS((exports) => {
|
|
|
61105
61105
|
var _newTarget = this.constructor;
|
|
61106
61106
|
var _this = _super.call(this, "Failed to read temporary file") || this;
|
|
61107
61107
|
_this.originalError = originalError;
|
|
61108
|
-
var
|
|
61108
|
+
var proto3 = _newTarget.prototype;
|
|
61109
61109
|
if (Object.setPrototypeOf) {
|
|
61110
|
-
Object.setPrototypeOf(_this,
|
|
61110
|
+
Object.setPrototypeOf(_this, proto3);
|
|
61111
61111
|
} else {
|
|
61112
61112
|
_this.__proto__ = _newTarget.prototype;
|
|
61113
61113
|
}
|
|
@@ -61146,9 +61146,9 @@ var require_RemoveFileError = __commonJS((exports) => {
|
|
|
61146
61146
|
var _newTarget = this.constructor;
|
|
61147
61147
|
var _this = _super.call(this, "Failed to cleanup temporary file") || this;
|
|
61148
61148
|
_this.originalError = originalError;
|
|
61149
|
-
var
|
|
61149
|
+
var proto3 = _newTarget.prototype;
|
|
61150
61150
|
if (Object.setPrototypeOf) {
|
|
61151
|
-
Object.setPrototypeOf(_this,
|
|
61151
|
+
Object.setPrototypeOf(_this, proto3);
|
|
61152
61152
|
} else {
|
|
61153
61153
|
_this.__proto__ = _newTarget.prototype;
|
|
61154
61154
|
}
|
|
@@ -61344,7 +61344,7 @@ var require_main = __commonJS((exports) => {
|
|
|
61344
61344
|
|
|
61345
61345
|
// node_modules/inquirer/lib/prompts/editor.js
|
|
61346
61346
|
var require_editor = __commonJS((exports, module) => {
|
|
61347
|
-
var
|
|
61347
|
+
var chalk5 = require_source();
|
|
61348
61348
|
var { editAsync } = require_main();
|
|
61349
61349
|
var Base = require_base();
|
|
61350
61350
|
var observe = require_events();
|
|
@@ -61368,12 +61368,12 @@ var require_editor = __commonJS((exports, module) => {
|
|
|
61368
61368
|
let bottomContent = "";
|
|
61369
61369
|
let message = this.getQuestion();
|
|
61370
61370
|
if (this.status === "answered") {
|
|
61371
|
-
message +=
|
|
61371
|
+
message += chalk5.dim("Received");
|
|
61372
61372
|
} else {
|
|
61373
|
-
message +=
|
|
61373
|
+
message += chalk5.dim("Press <enter> to launch your preferred editor.");
|
|
61374
61374
|
}
|
|
61375
61375
|
if (error) {
|
|
61376
|
-
bottomContent =
|
|
61376
|
+
bottomContent = chalk5.red(">> ") + error;
|
|
61377
61377
|
}
|
|
61378
61378
|
this.screen.render(message, bottomContent);
|
|
61379
61379
|
}
|
|
@@ -61471,7 +61471,7 @@ var {
|
|
|
61471
61471
|
} = import__.default;
|
|
61472
61472
|
|
|
61473
61473
|
// src/index.ts
|
|
61474
|
-
var
|
|
61474
|
+
var import_chalk9 = __toESM(require_source(), 1);
|
|
61475
61475
|
|
|
61476
61476
|
// src/utils/logger.ts
|
|
61477
61477
|
var import_chalk = __toESM(require_source(), 1);
|
|
@@ -67534,7 +67534,7 @@ var useFocusManager = () => {
|
|
|
67534
67534
|
};
|
|
67535
67535
|
var use_focus_manager_default = useFocusManager;
|
|
67536
67536
|
// src/ui/app/ui.tsx
|
|
67537
|
-
var
|
|
67537
|
+
var import_react34 = __toESM(require_react(), 1);
|
|
67538
67538
|
|
|
67539
67539
|
// src/utils/history.ts
|
|
67540
67540
|
import { promises as fs2 } from "fs";
|
|
@@ -68280,9 +68280,584 @@ var Tabs = ({ tabs, activeTab, onChange, theme }) => /* @__PURE__ */ jsx_dev_run
|
|
|
68280
68280
|
}, tab2.name, false, undefined, this))
|
|
68281
68281
|
}, undefined, false, undefined, this);
|
|
68282
68282
|
|
|
68283
|
-
//
|
|
68283
|
+
// node_modules/ink-text-input/build/index.js
|
|
68284
68284
|
var import_react26 = __toESM(require_react(), 1);
|
|
68285
68285
|
|
|
68286
|
+
// node_modules/ink-text-input/node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
68287
|
+
var ANSI_BACKGROUND_OFFSET6 = 10;
|
|
68288
|
+
var wrapAnsi166 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
68289
|
+
var wrapAnsi2566 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
68290
|
+
var wrapAnsi16m6 = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
68291
|
+
var styles8 = {
|
|
68292
|
+
modifier: {
|
|
68293
|
+
reset: [0, 0],
|
|
68294
|
+
bold: [1, 22],
|
|
68295
|
+
dim: [2, 22],
|
|
68296
|
+
italic: [3, 23],
|
|
68297
|
+
underline: [4, 24],
|
|
68298
|
+
overline: [53, 55],
|
|
68299
|
+
inverse: [7, 27],
|
|
68300
|
+
hidden: [8, 28],
|
|
68301
|
+
strikethrough: [9, 29]
|
|
68302
|
+
},
|
|
68303
|
+
color: {
|
|
68304
|
+
black: [30, 39],
|
|
68305
|
+
red: [31, 39],
|
|
68306
|
+
green: [32, 39],
|
|
68307
|
+
yellow: [33, 39],
|
|
68308
|
+
blue: [34, 39],
|
|
68309
|
+
magenta: [35, 39],
|
|
68310
|
+
cyan: [36, 39],
|
|
68311
|
+
white: [37, 39],
|
|
68312
|
+
blackBright: [90, 39],
|
|
68313
|
+
gray: [90, 39],
|
|
68314
|
+
grey: [90, 39],
|
|
68315
|
+
redBright: [91, 39],
|
|
68316
|
+
greenBright: [92, 39],
|
|
68317
|
+
yellowBright: [93, 39],
|
|
68318
|
+
blueBright: [94, 39],
|
|
68319
|
+
magentaBright: [95, 39],
|
|
68320
|
+
cyanBright: [96, 39],
|
|
68321
|
+
whiteBright: [97, 39]
|
|
68322
|
+
},
|
|
68323
|
+
bgColor: {
|
|
68324
|
+
bgBlack: [40, 49],
|
|
68325
|
+
bgRed: [41, 49],
|
|
68326
|
+
bgGreen: [42, 49],
|
|
68327
|
+
bgYellow: [43, 49],
|
|
68328
|
+
bgBlue: [44, 49],
|
|
68329
|
+
bgMagenta: [45, 49],
|
|
68330
|
+
bgCyan: [46, 49],
|
|
68331
|
+
bgWhite: [47, 49],
|
|
68332
|
+
bgBlackBright: [100, 49],
|
|
68333
|
+
bgGray: [100, 49],
|
|
68334
|
+
bgGrey: [100, 49],
|
|
68335
|
+
bgRedBright: [101, 49],
|
|
68336
|
+
bgGreenBright: [102, 49],
|
|
68337
|
+
bgYellowBright: [103, 49],
|
|
68338
|
+
bgBlueBright: [104, 49],
|
|
68339
|
+
bgMagentaBright: [105, 49],
|
|
68340
|
+
bgCyanBright: [106, 49],
|
|
68341
|
+
bgWhiteBright: [107, 49]
|
|
68342
|
+
}
|
|
68343
|
+
};
|
|
68344
|
+
var modifierNames6 = Object.keys(styles8.modifier);
|
|
68345
|
+
var foregroundColorNames6 = Object.keys(styles8.color);
|
|
68346
|
+
var backgroundColorNames6 = Object.keys(styles8.bgColor);
|
|
68347
|
+
var colorNames6 = [...foregroundColorNames6, ...backgroundColorNames6];
|
|
68348
|
+
function assembleStyles6() {
|
|
68349
|
+
const codes = new Map;
|
|
68350
|
+
for (const [groupName, group] of Object.entries(styles8)) {
|
|
68351
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
68352
|
+
styles8[styleName] = {
|
|
68353
|
+
open: `\x1B[${style[0]}m`,
|
|
68354
|
+
close: `\x1B[${style[1]}m`
|
|
68355
|
+
};
|
|
68356
|
+
group[styleName] = styles8[styleName];
|
|
68357
|
+
codes.set(style[0], style[1]);
|
|
68358
|
+
}
|
|
68359
|
+
Object.defineProperty(styles8, groupName, {
|
|
68360
|
+
value: group,
|
|
68361
|
+
enumerable: false
|
|
68362
|
+
});
|
|
68363
|
+
}
|
|
68364
|
+
Object.defineProperty(styles8, "codes", {
|
|
68365
|
+
value: codes,
|
|
68366
|
+
enumerable: false
|
|
68367
|
+
});
|
|
68368
|
+
styles8.color.close = "\x1B[39m";
|
|
68369
|
+
styles8.bgColor.close = "\x1B[49m";
|
|
68370
|
+
styles8.color.ansi = wrapAnsi166();
|
|
68371
|
+
styles8.color.ansi256 = wrapAnsi2566();
|
|
68372
|
+
styles8.color.ansi16m = wrapAnsi16m6();
|
|
68373
|
+
styles8.bgColor.ansi = wrapAnsi166(ANSI_BACKGROUND_OFFSET6);
|
|
68374
|
+
styles8.bgColor.ansi256 = wrapAnsi2566(ANSI_BACKGROUND_OFFSET6);
|
|
68375
|
+
styles8.bgColor.ansi16m = wrapAnsi16m6(ANSI_BACKGROUND_OFFSET6);
|
|
68376
|
+
Object.defineProperties(styles8, {
|
|
68377
|
+
rgbToAnsi256: {
|
|
68378
|
+
value(red, green, blue) {
|
|
68379
|
+
if (red === green && green === blue) {
|
|
68380
|
+
if (red < 8) {
|
|
68381
|
+
return 16;
|
|
68382
|
+
}
|
|
68383
|
+
if (red > 248) {
|
|
68384
|
+
return 231;
|
|
68385
|
+
}
|
|
68386
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
|
68387
|
+
}
|
|
68388
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
68389
|
+
},
|
|
68390
|
+
enumerable: false
|
|
68391
|
+
},
|
|
68392
|
+
hexToRgb: {
|
|
68393
|
+
value(hex) {
|
|
68394
|
+
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
68395
|
+
if (!matches) {
|
|
68396
|
+
return [0, 0, 0];
|
|
68397
|
+
}
|
|
68398
|
+
let [colorString] = matches;
|
|
68399
|
+
if (colorString.length === 3) {
|
|
68400
|
+
colorString = [...colorString].map((character) => character + character).join("");
|
|
68401
|
+
}
|
|
68402
|
+
const integer = Number.parseInt(colorString, 16);
|
|
68403
|
+
return [
|
|
68404
|
+
integer >> 16 & 255,
|
|
68405
|
+
integer >> 8 & 255,
|
|
68406
|
+
integer & 255
|
|
68407
|
+
];
|
|
68408
|
+
},
|
|
68409
|
+
enumerable: false
|
|
68410
|
+
},
|
|
68411
|
+
hexToAnsi256: {
|
|
68412
|
+
value: (hex) => styles8.rgbToAnsi256(...styles8.hexToRgb(hex)),
|
|
68413
|
+
enumerable: false
|
|
68414
|
+
},
|
|
68415
|
+
ansi256ToAnsi: {
|
|
68416
|
+
value(code) {
|
|
68417
|
+
if (code < 8) {
|
|
68418
|
+
return 30 + code;
|
|
68419
|
+
}
|
|
68420
|
+
if (code < 16) {
|
|
68421
|
+
return 90 + (code - 8);
|
|
68422
|
+
}
|
|
68423
|
+
let red;
|
|
68424
|
+
let green;
|
|
68425
|
+
let blue;
|
|
68426
|
+
if (code >= 232) {
|
|
68427
|
+
red = ((code - 232) * 10 + 8) / 255;
|
|
68428
|
+
green = red;
|
|
68429
|
+
blue = red;
|
|
68430
|
+
} else {
|
|
68431
|
+
code -= 16;
|
|
68432
|
+
const remainder = code % 36;
|
|
68433
|
+
red = Math.floor(code / 36) / 5;
|
|
68434
|
+
green = Math.floor(remainder / 6) / 5;
|
|
68435
|
+
blue = remainder % 6 / 5;
|
|
68436
|
+
}
|
|
68437
|
+
const value = Math.max(red, green, blue) * 2;
|
|
68438
|
+
if (value === 0) {
|
|
68439
|
+
return 30;
|
|
68440
|
+
}
|
|
68441
|
+
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
68442
|
+
if (value === 2) {
|
|
68443
|
+
result += 60;
|
|
68444
|
+
}
|
|
68445
|
+
return result;
|
|
68446
|
+
},
|
|
68447
|
+
enumerable: false
|
|
68448
|
+
},
|
|
68449
|
+
rgbToAnsi: {
|
|
68450
|
+
value: (red, green, blue) => styles8.ansi256ToAnsi(styles8.rgbToAnsi256(red, green, blue)),
|
|
68451
|
+
enumerable: false
|
|
68452
|
+
},
|
|
68453
|
+
hexToAnsi: {
|
|
68454
|
+
value: (hex) => styles8.ansi256ToAnsi(styles8.hexToAnsi256(hex)),
|
|
68455
|
+
enumerable: false
|
|
68456
|
+
}
|
|
68457
|
+
});
|
|
68458
|
+
return styles8;
|
|
68459
|
+
}
|
|
68460
|
+
var ansiStyles6 = assembleStyles6();
|
|
68461
|
+
var ansi_styles_default6 = ansiStyles6;
|
|
68462
|
+
|
|
68463
|
+
// node_modules/ink-text-input/node_modules/chalk/source/vendor/supports-color/index.js
|
|
68464
|
+
import process13 from "node:process";
|
|
68465
|
+
import os3 from "node:os";
|
|
68466
|
+
import tty2 from "node:tty";
|
|
68467
|
+
function hasFlag2(flag, argv = globalThis.Deno ? globalThis.Deno.args : process13.argv) {
|
|
68468
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
68469
|
+
const position = argv.indexOf(prefix + flag);
|
|
68470
|
+
const terminatorPosition = argv.indexOf("--");
|
|
68471
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
68472
|
+
}
|
|
68473
|
+
var { env: env3 } = process13;
|
|
68474
|
+
var flagForceColor2;
|
|
68475
|
+
if (hasFlag2("no-color") || hasFlag2("no-colors") || hasFlag2("color=false") || hasFlag2("color=never")) {
|
|
68476
|
+
flagForceColor2 = 0;
|
|
68477
|
+
} else if (hasFlag2("color") || hasFlag2("colors") || hasFlag2("color=true") || hasFlag2("color=always")) {
|
|
68478
|
+
flagForceColor2 = 1;
|
|
68479
|
+
}
|
|
68480
|
+
function envForceColor2() {
|
|
68481
|
+
if ("FORCE_COLOR" in env3) {
|
|
68482
|
+
if (env3.FORCE_COLOR === "true") {
|
|
68483
|
+
return 1;
|
|
68484
|
+
}
|
|
68485
|
+
if (env3.FORCE_COLOR === "false") {
|
|
68486
|
+
return 0;
|
|
68487
|
+
}
|
|
68488
|
+
return env3.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env3.FORCE_COLOR, 10), 3);
|
|
68489
|
+
}
|
|
68490
|
+
}
|
|
68491
|
+
function translateLevel2(level) {
|
|
68492
|
+
if (level === 0) {
|
|
68493
|
+
return false;
|
|
68494
|
+
}
|
|
68495
|
+
return {
|
|
68496
|
+
level,
|
|
68497
|
+
hasBasic: true,
|
|
68498
|
+
has256: level >= 2,
|
|
68499
|
+
has16m: level >= 3
|
|
68500
|
+
};
|
|
68501
|
+
}
|
|
68502
|
+
function _supportsColor2(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
68503
|
+
const noFlagForceColor = envForceColor2();
|
|
68504
|
+
if (noFlagForceColor !== undefined) {
|
|
68505
|
+
flagForceColor2 = noFlagForceColor;
|
|
68506
|
+
}
|
|
68507
|
+
const forceColor = sniffFlags ? flagForceColor2 : noFlagForceColor;
|
|
68508
|
+
if (forceColor === 0) {
|
|
68509
|
+
return 0;
|
|
68510
|
+
}
|
|
68511
|
+
if (sniffFlags) {
|
|
68512
|
+
if (hasFlag2("color=16m") || hasFlag2("color=full") || hasFlag2("color=truecolor")) {
|
|
68513
|
+
return 3;
|
|
68514
|
+
}
|
|
68515
|
+
if (hasFlag2("color=256")) {
|
|
68516
|
+
return 2;
|
|
68517
|
+
}
|
|
68518
|
+
}
|
|
68519
|
+
if ("TF_BUILD" in env3 && "AGENT_NAME" in env3) {
|
|
68520
|
+
return 1;
|
|
68521
|
+
}
|
|
68522
|
+
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
|
68523
|
+
return 0;
|
|
68524
|
+
}
|
|
68525
|
+
const min = forceColor || 0;
|
|
68526
|
+
if (env3.TERM === "dumb") {
|
|
68527
|
+
return min;
|
|
68528
|
+
}
|
|
68529
|
+
if (process13.platform === "win32") {
|
|
68530
|
+
const osRelease = os3.release().split(".");
|
|
68531
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
68532
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
68533
|
+
}
|
|
68534
|
+
return 1;
|
|
68535
|
+
}
|
|
68536
|
+
if ("CI" in env3) {
|
|
68537
|
+
if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => (key in env3))) {
|
|
68538
|
+
return 3;
|
|
68539
|
+
}
|
|
68540
|
+
if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => (sign in env3)) || env3.CI_NAME === "codeship") {
|
|
68541
|
+
return 1;
|
|
68542
|
+
}
|
|
68543
|
+
return min;
|
|
68544
|
+
}
|
|
68545
|
+
if ("TEAMCITY_VERSION" in env3) {
|
|
68546
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env3.TEAMCITY_VERSION) ? 1 : 0;
|
|
68547
|
+
}
|
|
68548
|
+
if (env3.COLORTERM === "truecolor") {
|
|
68549
|
+
return 3;
|
|
68550
|
+
}
|
|
68551
|
+
if (env3.TERM === "xterm-kitty") {
|
|
68552
|
+
return 3;
|
|
68553
|
+
}
|
|
68554
|
+
if ("TERM_PROGRAM" in env3) {
|
|
68555
|
+
const version = Number.parseInt((env3.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
68556
|
+
switch (env3.TERM_PROGRAM) {
|
|
68557
|
+
case "iTerm.app": {
|
|
68558
|
+
return version >= 3 ? 3 : 2;
|
|
68559
|
+
}
|
|
68560
|
+
case "Apple_Terminal": {
|
|
68561
|
+
return 2;
|
|
68562
|
+
}
|
|
68563
|
+
}
|
|
68564
|
+
}
|
|
68565
|
+
if (/-256(color)?$/i.test(env3.TERM)) {
|
|
68566
|
+
return 2;
|
|
68567
|
+
}
|
|
68568
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env3.TERM)) {
|
|
68569
|
+
return 1;
|
|
68570
|
+
}
|
|
68571
|
+
if ("COLORTERM" in env3) {
|
|
68572
|
+
return 1;
|
|
68573
|
+
}
|
|
68574
|
+
return min;
|
|
68575
|
+
}
|
|
68576
|
+
function createSupportsColor2(stream, options = {}) {
|
|
68577
|
+
const level = _supportsColor2(stream, {
|
|
68578
|
+
streamIsTTY: stream && stream.isTTY,
|
|
68579
|
+
...options
|
|
68580
|
+
});
|
|
68581
|
+
return translateLevel2(level);
|
|
68582
|
+
}
|
|
68583
|
+
var supportsColor2 = {
|
|
68584
|
+
stdout: createSupportsColor2({ isTTY: tty2.isatty(1) }),
|
|
68585
|
+
stderr: createSupportsColor2({ isTTY: tty2.isatty(2) })
|
|
68586
|
+
};
|
|
68587
|
+
var supports_color_default2 = supportsColor2;
|
|
68588
|
+
|
|
68589
|
+
// node_modules/ink-text-input/node_modules/chalk/source/utilities.js
|
|
68590
|
+
function stringReplaceAll2(string, substring, replacer) {
|
|
68591
|
+
let index = string.indexOf(substring);
|
|
68592
|
+
if (index === -1) {
|
|
68593
|
+
return string;
|
|
68594
|
+
}
|
|
68595
|
+
const substringLength = substring.length;
|
|
68596
|
+
let endIndex = 0;
|
|
68597
|
+
let returnValue = "";
|
|
68598
|
+
do {
|
|
68599
|
+
returnValue += string.slice(endIndex, index) + substring + replacer;
|
|
68600
|
+
endIndex = index + substringLength;
|
|
68601
|
+
index = string.indexOf(substring, endIndex);
|
|
68602
|
+
} while (index !== -1);
|
|
68603
|
+
returnValue += string.slice(endIndex);
|
|
68604
|
+
return returnValue;
|
|
68605
|
+
}
|
|
68606
|
+
function stringEncaseCRLFWithFirstIndex2(string, prefix, postfix, index) {
|
|
68607
|
+
let endIndex = 0;
|
|
68608
|
+
let returnValue = "";
|
|
68609
|
+
do {
|
|
68610
|
+
const gotCR = string[index - 1] === "\r";
|
|
68611
|
+
returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? `\r
|
|
68612
|
+
` : `
|
|
68613
|
+
`) + postfix;
|
|
68614
|
+
endIndex = index + 1;
|
|
68615
|
+
index = string.indexOf(`
|
|
68616
|
+
`, endIndex);
|
|
68617
|
+
} while (index !== -1);
|
|
68618
|
+
returnValue += string.slice(endIndex);
|
|
68619
|
+
return returnValue;
|
|
68620
|
+
}
|
|
68621
|
+
|
|
68622
|
+
// node_modules/ink-text-input/node_modules/chalk/source/index.js
|
|
68623
|
+
var { stdout: stdoutColor2, stderr: stderrColor2 } = supports_color_default2;
|
|
68624
|
+
var GENERATOR2 = Symbol("GENERATOR");
|
|
68625
|
+
var STYLER2 = Symbol("STYLER");
|
|
68626
|
+
var IS_EMPTY2 = Symbol("IS_EMPTY");
|
|
68627
|
+
var levelMapping2 = [
|
|
68628
|
+
"ansi",
|
|
68629
|
+
"ansi",
|
|
68630
|
+
"ansi256",
|
|
68631
|
+
"ansi16m"
|
|
68632
|
+
];
|
|
68633
|
+
var styles9 = Object.create(null);
|
|
68634
|
+
var applyOptions2 = (object, options = {}) => {
|
|
68635
|
+
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
68636
|
+
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
68637
|
+
}
|
|
68638
|
+
const colorLevel = stdoutColor2 ? stdoutColor2.level : 0;
|
|
68639
|
+
object.level = options.level === undefined ? colorLevel : options.level;
|
|
68640
|
+
};
|
|
68641
|
+
var chalkFactory2 = (options) => {
|
|
68642
|
+
const chalk3 = (...strings) => strings.join(" ");
|
|
68643
|
+
applyOptions2(chalk3, options);
|
|
68644
|
+
Object.setPrototypeOf(chalk3, createChalk2.prototype);
|
|
68645
|
+
return chalk3;
|
|
68646
|
+
};
|
|
68647
|
+
function createChalk2(options) {
|
|
68648
|
+
return chalkFactory2(options);
|
|
68649
|
+
}
|
|
68650
|
+
Object.setPrototypeOf(createChalk2.prototype, Function.prototype);
|
|
68651
|
+
for (const [styleName, style] of Object.entries(ansi_styles_default6)) {
|
|
68652
|
+
styles9[styleName] = {
|
|
68653
|
+
get() {
|
|
68654
|
+
const builder = createBuilder2(this, createStyler2(style.open, style.close, this[STYLER2]), this[IS_EMPTY2]);
|
|
68655
|
+
Object.defineProperty(this, styleName, { value: builder });
|
|
68656
|
+
return builder;
|
|
68657
|
+
}
|
|
68658
|
+
};
|
|
68659
|
+
}
|
|
68660
|
+
styles9.visible = {
|
|
68661
|
+
get() {
|
|
68662
|
+
const builder = createBuilder2(this, this[STYLER2], true);
|
|
68663
|
+
Object.defineProperty(this, "visible", { value: builder });
|
|
68664
|
+
return builder;
|
|
68665
|
+
}
|
|
68666
|
+
};
|
|
68667
|
+
var getModelAnsi2 = (model, level, type, ...arguments_) => {
|
|
68668
|
+
if (model === "rgb") {
|
|
68669
|
+
if (level === "ansi16m") {
|
|
68670
|
+
return ansi_styles_default6[type].ansi16m(...arguments_);
|
|
68671
|
+
}
|
|
68672
|
+
if (level === "ansi256") {
|
|
68673
|
+
return ansi_styles_default6[type].ansi256(ansi_styles_default6.rgbToAnsi256(...arguments_));
|
|
68674
|
+
}
|
|
68675
|
+
return ansi_styles_default6[type].ansi(ansi_styles_default6.rgbToAnsi(...arguments_));
|
|
68676
|
+
}
|
|
68677
|
+
if (model === "hex") {
|
|
68678
|
+
return getModelAnsi2("rgb", level, type, ...ansi_styles_default6.hexToRgb(...arguments_));
|
|
68679
|
+
}
|
|
68680
|
+
return ansi_styles_default6[type][model](...arguments_);
|
|
68681
|
+
};
|
|
68682
|
+
var usedModels2 = ["rgb", "hex", "ansi256"];
|
|
68683
|
+
for (const model of usedModels2) {
|
|
68684
|
+
styles9[model] = {
|
|
68685
|
+
get() {
|
|
68686
|
+
const { level } = this;
|
|
68687
|
+
return function(...arguments_) {
|
|
68688
|
+
const styler = createStyler2(getModelAnsi2(model, levelMapping2[level], "color", ...arguments_), ansi_styles_default6.color.close, this[STYLER2]);
|
|
68689
|
+
return createBuilder2(this, styler, this[IS_EMPTY2]);
|
|
68690
|
+
};
|
|
68691
|
+
}
|
|
68692
|
+
};
|
|
68693
|
+
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
68694
|
+
styles9[bgModel] = {
|
|
68695
|
+
get() {
|
|
68696
|
+
const { level } = this;
|
|
68697
|
+
return function(...arguments_) {
|
|
68698
|
+
const styler = createStyler2(getModelAnsi2(model, levelMapping2[level], "bgColor", ...arguments_), ansi_styles_default6.bgColor.close, this[STYLER2]);
|
|
68699
|
+
return createBuilder2(this, styler, this[IS_EMPTY2]);
|
|
68700
|
+
};
|
|
68701
|
+
}
|
|
68702
|
+
};
|
|
68703
|
+
}
|
|
68704
|
+
var proto2 = Object.defineProperties(() => {}, {
|
|
68705
|
+
...styles9,
|
|
68706
|
+
level: {
|
|
68707
|
+
enumerable: true,
|
|
68708
|
+
get() {
|
|
68709
|
+
return this[GENERATOR2].level;
|
|
68710
|
+
},
|
|
68711
|
+
set(level) {
|
|
68712
|
+
this[GENERATOR2].level = level;
|
|
68713
|
+
}
|
|
68714
|
+
}
|
|
68715
|
+
});
|
|
68716
|
+
var createStyler2 = (open, close, parent) => {
|
|
68717
|
+
let openAll;
|
|
68718
|
+
let closeAll;
|
|
68719
|
+
if (parent === undefined) {
|
|
68720
|
+
openAll = open;
|
|
68721
|
+
closeAll = close;
|
|
68722
|
+
} else {
|
|
68723
|
+
openAll = parent.openAll + open;
|
|
68724
|
+
closeAll = close + parent.closeAll;
|
|
68725
|
+
}
|
|
68726
|
+
return {
|
|
68727
|
+
open,
|
|
68728
|
+
close,
|
|
68729
|
+
openAll,
|
|
68730
|
+
closeAll,
|
|
68731
|
+
parent
|
|
68732
|
+
};
|
|
68733
|
+
};
|
|
68734
|
+
var createBuilder2 = (self2, _styler, _isEmpty) => {
|
|
68735
|
+
const builder = (...arguments_) => applyStyle2(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
68736
|
+
Object.setPrototypeOf(builder, proto2);
|
|
68737
|
+
builder[GENERATOR2] = self2;
|
|
68738
|
+
builder[STYLER2] = _styler;
|
|
68739
|
+
builder[IS_EMPTY2] = _isEmpty;
|
|
68740
|
+
return builder;
|
|
68741
|
+
};
|
|
68742
|
+
var applyStyle2 = (self2, string) => {
|
|
68743
|
+
if (self2.level <= 0 || !string) {
|
|
68744
|
+
return self2[IS_EMPTY2] ? "" : string;
|
|
68745
|
+
}
|
|
68746
|
+
let styler = self2[STYLER2];
|
|
68747
|
+
if (styler === undefined) {
|
|
68748
|
+
return string;
|
|
68749
|
+
}
|
|
68750
|
+
const { openAll, closeAll } = styler;
|
|
68751
|
+
if (string.includes("\x1B")) {
|
|
68752
|
+
while (styler !== undefined) {
|
|
68753
|
+
string = stringReplaceAll2(string, styler.close, styler.open);
|
|
68754
|
+
styler = styler.parent;
|
|
68755
|
+
}
|
|
68756
|
+
}
|
|
68757
|
+
const lfIndex = string.indexOf(`
|
|
68758
|
+
`);
|
|
68759
|
+
if (lfIndex !== -1) {
|
|
68760
|
+
string = stringEncaseCRLFWithFirstIndex2(string, closeAll, openAll, lfIndex);
|
|
68761
|
+
}
|
|
68762
|
+
return openAll + string + closeAll;
|
|
68763
|
+
};
|
|
68764
|
+
Object.defineProperties(createChalk2.prototype, styles9);
|
|
68765
|
+
var chalk3 = createChalk2();
|
|
68766
|
+
var chalkStderr2 = createChalk2({ level: stderrColor2 ? stderrColor2.level : 0 });
|
|
68767
|
+
var source_default2 = chalk3;
|
|
68768
|
+
|
|
68769
|
+
// node_modules/ink-text-input/build/index.js
|
|
68770
|
+
function TextInput({ value: originalValue, placeholder = "", focus = true, mask, highlightPastedText = false, showCursor = true, onChange, onSubmit }) {
|
|
68771
|
+
const [state, setState] = import_react26.useState({
|
|
68772
|
+
cursorOffset: (originalValue || "").length,
|
|
68773
|
+
cursorWidth: 0
|
|
68774
|
+
});
|
|
68775
|
+
const { cursorOffset, cursorWidth } = state;
|
|
68776
|
+
import_react26.useEffect(() => {
|
|
68777
|
+
setState((previousState) => {
|
|
68778
|
+
if (!focus || !showCursor) {
|
|
68779
|
+
return previousState;
|
|
68780
|
+
}
|
|
68781
|
+
const newValue = originalValue || "";
|
|
68782
|
+
if (previousState.cursorOffset > newValue.length - 1) {
|
|
68783
|
+
return {
|
|
68784
|
+
cursorOffset: newValue.length,
|
|
68785
|
+
cursorWidth: 0
|
|
68786
|
+
};
|
|
68787
|
+
}
|
|
68788
|
+
return previousState;
|
|
68789
|
+
});
|
|
68790
|
+
}, [originalValue, focus, showCursor]);
|
|
68791
|
+
const cursorActualWidth = highlightPastedText ? cursorWidth : 0;
|
|
68792
|
+
const value = mask ? mask.repeat(originalValue.length) : originalValue;
|
|
68793
|
+
let renderedValue = value;
|
|
68794
|
+
let renderedPlaceholder = placeholder ? source_default2.grey(placeholder) : undefined;
|
|
68795
|
+
if (showCursor && focus) {
|
|
68796
|
+
renderedPlaceholder = placeholder.length > 0 ? source_default2.inverse(placeholder[0]) + source_default2.grey(placeholder.slice(1)) : source_default2.inverse(" ");
|
|
68797
|
+
renderedValue = value.length > 0 ? "" : source_default2.inverse(" ");
|
|
68798
|
+
let i = 0;
|
|
68799
|
+
for (const char of value) {
|
|
68800
|
+
renderedValue += i >= cursorOffset - cursorActualWidth && i <= cursorOffset ? source_default2.inverse(char) : char;
|
|
68801
|
+
i++;
|
|
68802
|
+
}
|
|
68803
|
+
if (value.length > 0 && cursorOffset === value.length) {
|
|
68804
|
+
renderedValue += source_default2.inverse(" ");
|
|
68805
|
+
}
|
|
68806
|
+
}
|
|
68807
|
+
use_input_default((input, key) => {
|
|
68808
|
+
if (key.upArrow || key.downArrow || key.ctrl && input === "c" || key.tab || key.shift && key.tab) {
|
|
68809
|
+
return;
|
|
68810
|
+
}
|
|
68811
|
+
if (key.return) {
|
|
68812
|
+
if (onSubmit) {
|
|
68813
|
+
onSubmit(originalValue);
|
|
68814
|
+
}
|
|
68815
|
+
return;
|
|
68816
|
+
}
|
|
68817
|
+
let nextCursorOffset = cursorOffset;
|
|
68818
|
+
let nextValue = originalValue;
|
|
68819
|
+
let nextCursorWidth = 0;
|
|
68820
|
+
if (key.leftArrow) {
|
|
68821
|
+
if (showCursor) {
|
|
68822
|
+
nextCursorOffset--;
|
|
68823
|
+
}
|
|
68824
|
+
} else if (key.rightArrow) {
|
|
68825
|
+
if (showCursor) {
|
|
68826
|
+
nextCursorOffset++;
|
|
68827
|
+
}
|
|
68828
|
+
} else if (key.backspace || key.delete) {
|
|
68829
|
+
if (cursorOffset > 0) {
|
|
68830
|
+
nextValue = originalValue.slice(0, cursorOffset - 1) + originalValue.slice(cursorOffset, originalValue.length);
|
|
68831
|
+
nextCursorOffset--;
|
|
68832
|
+
}
|
|
68833
|
+
} else {
|
|
68834
|
+
nextValue = originalValue.slice(0, cursorOffset) + input + originalValue.slice(cursorOffset, originalValue.length);
|
|
68835
|
+
nextCursorOffset += input.length;
|
|
68836
|
+
if (input.length > 1) {
|
|
68837
|
+
nextCursorWidth = input.length;
|
|
68838
|
+
}
|
|
68839
|
+
}
|
|
68840
|
+
if (cursorOffset < 0) {
|
|
68841
|
+
nextCursorOffset = 0;
|
|
68842
|
+
}
|
|
68843
|
+
if (cursorOffset > originalValue.length) {
|
|
68844
|
+
nextCursorOffset = originalValue.length;
|
|
68845
|
+
}
|
|
68846
|
+
setState({
|
|
68847
|
+
cursorOffset: nextCursorOffset,
|
|
68848
|
+
cursorWidth: nextCursorWidth
|
|
68849
|
+
});
|
|
68850
|
+
if (nextValue !== originalValue) {
|
|
68851
|
+
onChange(nextValue);
|
|
68852
|
+
}
|
|
68853
|
+
}, { isActive: focus });
|
|
68854
|
+
return import_react26.default.createElement(Text, null, placeholder ? value.length > 0 ? renderedValue : renderedPlaceholder : renderedValue);
|
|
68855
|
+
}
|
|
68856
|
+
var build_default = TextInput;
|
|
68857
|
+
|
|
68858
|
+
// src/ui/app/components/historylist.tsx
|
|
68859
|
+
var import_react27 = __toESM(require_react(), 1);
|
|
68860
|
+
|
|
68286
68861
|
// src/utils/colors.ts
|
|
68287
68862
|
var getStatusColor = (status, theme) => {
|
|
68288
68863
|
if (status.startsWith("2"))
|
|
@@ -68294,6 +68869,30 @@ var getStatusColor = (status, theme) => {
|
|
|
68294
68869
|
return theme.colors.accent;
|
|
68295
68870
|
};
|
|
68296
68871
|
|
|
68872
|
+
// src/utils/fuzzy.ts
|
|
68873
|
+
function fuzzyMatch(pattern, str) {
|
|
68874
|
+
if (!pattern)
|
|
68875
|
+
return { matched: true, score: 0, indices: [] };
|
|
68876
|
+
pattern = pattern.toLowerCase();
|
|
68877
|
+
str = str.toLowerCase();
|
|
68878
|
+
let patternIdx = 0;
|
|
68879
|
+
let score = 0;
|
|
68880
|
+
const indices = [];
|
|
68881
|
+
for (let i = 0;i < str.length && patternIdx < pattern.length; i++) {
|
|
68882
|
+
if (str[i] === pattern[patternIdx]) {
|
|
68883
|
+
score += 1;
|
|
68884
|
+
indices.push(i);
|
|
68885
|
+
patternIdx++;
|
|
68886
|
+
}
|
|
68887
|
+
}
|
|
68888
|
+
return { matched: patternIdx === pattern.length, score, indices };
|
|
68889
|
+
}
|
|
68890
|
+
function fuzzyFilter(items, pattern, getText) {
|
|
68891
|
+
if (!pattern)
|
|
68892
|
+
return items;
|
|
68893
|
+
return items.map((item) => ({ item, ...fuzzyMatch(pattern, getText(item)) })).filter((r) => r.matched).sort((a, b) => b.score - a.score).map((r) => r.item);
|
|
68894
|
+
}
|
|
68895
|
+
|
|
68297
68896
|
// src/ui/app/components/historylist.tsx
|
|
68298
68897
|
var jsx_dev_runtime5 = __toESM(require_jsx_dev_runtime(), 1);
|
|
68299
68898
|
var HistoryListItem = ({ item, isSelected, theme }) => {
|
|
@@ -68360,19 +68959,33 @@ var HistoryList = ({ history, onItemClick, theme }) => {
|
|
|
68360
68959
|
const { stdout } = use_stdout_default();
|
|
68361
68960
|
const { isFocused } = use_focus_default();
|
|
68362
68961
|
const { focusNext } = use_focus_manager_default();
|
|
68363
|
-
const [selectedIndex, setSelectedIndex] =
|
|
68364
|
-
const [scrollPosition, setScrollPosition] =
|
|
68365
|
-
const
|
|
68366
|
-
const
|
|
68367
|
-
|
|
68962
|
+
const [selectedIndex, setSelectedIndex] = import_react27.useState(0);
|
|
68963
|
+
const [scrollPosition, setScrollPosition] = import_react27.useState(0);
|
|
68964
|
+
const [searchQuery, setSearchQuery] = import_react27.useState("");
|
|
68965
|
+
const [isSearching, setIsSearching] = import_react27.useState(false);
|
|
68966
|
+
const listRef = import_react27.useRef(null);
|
|
68967
|
+
const filteredHistory = fuzzyFilter(history, searchQuery, (item) => `${item.method} ${item.url}`);
|
|
68968
|
+
const maxHeight = stdout.rows - 10;
|
|
68969
|
+
use_input_default((input, key) => {
|
|
68970
|
+
if (input === "/" && !isSearching) {
|
|
68971
|
+
setIsSearching(true);
|
|
68972
|
+
return;
|
|
68973
|
+
}
|
|
68974
|
+
if (key.escape && isSearching) {
|
|
68975
|
+
setIsSearching(false);
|
|
68976
|
+
setSearchQuery("");
|
|
68977
|
+
return;
|
|
68978
|
+
}
|
|
68979
|
+
if (isSearching)
|
|
68980
|
+
return;
|
|
68368
68981
|
if (key.upArrow) {
|
|
68369
68982
|
setSelectedIndex((prev) => Math.max(0, prev - 1));
|
|
68370
68983
|
}
|
|
68371
68984
|
if (key.downArrow) {
|
|
68372
|
-
setSelectedIndex((prev) => Math.min(
|
|
68985
|
+
setSelectedIndex((prev) => Math.min(filteredHistory.length - 1, prev + 1));
|
|
68373
68986
|
}
|
|
68374
|
-
if (key.return &&
|
|
68375
|
-
onItemClick(
|
|
68987
|
+
if (key.return && filteredHistory[selectedIndex]) {
|
|
68988
|
+
onItemClick(filteredHistory[selectedIndex]);
|
|
68376
68989
|
}
|
|
68377
68990
|
if (key.tab) {
|
|
68378
68991
|
focusNext();
|
|
@@ -68381,10 +68994,14 @@ var HistoryList = ({ history, onItemClick, theme }) => {
|
|
|
68381
68994
|
setScrollPosition((prev) => Math.max(0, prev - maxHeight));
|
|
68382
68995
|
}
|
|
68383
68996
|
if (key.pageDown) {
|
|
68384
|
-
setScrollPosition((prev) => Math.min(
|
|
68997
|
+
setScrollPosition((prev) => Math.min(filteredHistory.length - maxHeight, prev + maxHeight));
|
|
68385
68998
|
}
|
|
68386
68999
|
}, { isActive: isFocused });
|
|
68387
|
-
|
|
69000
|
+
import_react27.useEffect(() => {
|
|
69001
|
+
setSelectedIndex(0);
|
|
69002
|
+
setScrollPosition(0);
|
|
69003
|
+
}, [searchQuery]);
|
|
69004
|
+
import_react27.useEffect(() => {
|
|
68388
69005
|
if (selectedIndex < scrollPosition) {
|
|
68389
69006
|
setScrollPosition(selectedIndex);
|
|
68390
69007
|
} else if (selectedIndex >= scrollPosition + maxHeight) {
|
|
@@ -68394,22 +69011,55 @@ var HistoryList = ({ history, onItemClick, theme }) => {
|
|
|
68394
69011
|
return /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
68395
69012
|
flexDirection: "column",
|
|
68396
69013
|
flexGrow: 1,
|
|
68397
|
-
children:
|
|
68398
|
-
|
|
68399
|
-
|
|
68400
|
-
|
|
68401
|
-
|
|
68402
|
-
|
|
68403
|
-
|
|
68404
|
-
|
|
68405
|
-
|
|
68406
|
-
|
|
69014
|
+
children: [
|
|
69015
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
69016
|
+
paddingX: 1,
|
|
69017
|
+
marginBottom: 1,
|
|
69018
|
+
children: isSearching ? /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
69019
|
+
children: [
|
|
69020
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
69021
|
+
color: theme.colors.accent,
|
|
69022
|
+
children: "\uD83D\uDD0D "
|
|
69023
|
+
}, undefined, false, undefined, this),
|
|
69024
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(build_default, {
|
|
69025
|
+
value: searchQuery,
|
|
69026
|
+
onChange: setSearchQuery,
|
|
69027
|
+
placeholder: "Type to search...",
|
|
69028
|
+
focus: isSearching
|
|
69029
|
+
}, undefined, false, undefined, this)
|
|
69030
|
+
]
|
|
69031
|
+
}, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
69032
|
+
color: theme.colors.muted,
|
|
69033
|
+
dimColor: true,
|
|
69034
|
+
children: [
|
|
69035
|
+
"Press / to search",
|
|
69036
|
+
searchQuery && ` (filtered: "${searchQuery}")`
|
|
69037
|
+
]
|
|
69038
|
+
}, undefined, true, undefined, this)
|
|
69039
|
+
}, undefined, false, undefined, this),
|
|
69040
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
69041
|
+
flexDirection: "column",
|
|
69042
|
+
ref: listRef,
|
|
69043
|
+
children: filteredHistory.length === 0 ? /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
69044
|
+
paddingX: 1,
|
|
69045
|
+
children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
69046
|
+
color: theme.colors.muted,
|
|
69047
|
+
children: "No matches found"
|
|
69048
|
+
}, undefined, false, undefined, this)
|
|
69049
|
+
}, undefined, false, undefined, this) : filteredHistory.slice(scrollPosition, scrollPosition + maxHeight).map((item, index) => /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(HistoryListItem, {
|
|
69050
|
+
item,
|
|
69051
|
+
isSelected: isFocused && selectedIndex === scrollPosition + index,
|
|
69052
|
+
theme
|
|
69053
|
+
}, item.timestamp, false, undefined, this))
|
|
69054
|
+
}, undefined, false, undefined, this)
|
|
69055
|
+
]
|
|
69056
|
+
}, undefined, true, undefined, this);
|
|
68407
69057
|
};
|
|
68408
69058
|
|
|
68409
69059
|
// src/ui/app/components/footer.tsx
|
|
68410
|
-
var
|
|
69060
|
+
var import_react28 = __toESM(require_react(), 1);
|
|
68411
69061
|
var jsx_dev_runtime6 = __toESM(require_jsx_dev_runtime(), 1);
|
|
68412
|
-
var Footer =
|
|
69062
|
+
var Footer = import_react28.default.memo(({ theme }) => {
|
|
68413
69063
|
return /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Box_default, {
|
|
68414
69064
|
borderStyle: "round",
|
|
68415
69065
|
borderTopColor: theme.muted,
|
|
@@ -68423,14 +69073,14 @@ var Footer = import_react27.default.memo(({ theme }) => {
|
|
|
68423
69073
|
color: theme.primary,
|
|
68424
69074
|
children: "PostBoy"
|
|
68425
69075
|
}, undefined, false, undefined, this),
|
|
68426
|
-
" — [Q] Quit | [Ctrl+Enter] Send | [Ctrl+L/H] Switch Tabs | [T] Theme
|
|
69076
|
+
" — [Q] Quit | [Ctrl+Enter] Send | [Ctrl+L/H] Switch Tabs | [T] Theme | [E] Export | [Tab] Navigate"
|
|
68427
69077
|
]
|
|
68428
69078
|
}, undefined, true, undefined, this)
|
|
68429
69079
|
}, undefined, false, undefined, this);
|
|
68430
69080
|
});
|
|
68431
69081
|
|
|
68432
69082
|
// src/ui/app/components/themeselector.tsx
|
|
68433
|
-
var
|
|
69083
|
+
var import_react29 = __toESM(require_react(), 1);
|
|
68434
69084
|
var jsx_dev_runtime7 = __toESM(require_jsx_dev_runtime(), 1);
|
|
68435
69085
|
var getIndex = (theme) => {
|
|
68436
69086
|
let index = 0;
|
|
@@ -68471,9 +69121,9 @@ var getIndex = (theme) => {
|
|
|
68471
69121
|
return index;
|
|
68472
69122
|
};
|
|
68473
69123
|
var ThemeSelector = ({ onThemeChange, theme }) => {
|
|
68474
|
-
const [selectedIndex, setSelectedIndex] =
|
|
69124
|
+
const [selectedIndex, setSelectedIndex] = import_react29.useState(getIndex(theme.name));
|
|
68475
69125
|
const themeNames = Object.keys(themes);
|
|
68476
|
-
|
|
69126
|
+
import_react29.useEffect(() => {
|
|
68477
69127
|
const currentThemeIndex = themeNames.findIndex((name) => {
|
|
68478
69128
|
const themeColors = themes[name].colors;
|
|
68479
69129
|
return Object.entries(themeColors).every(([key, value]) => theme[key] === value);
|
|
@@ -68529,20 +69179,20 @@ var ThemeSelector = ({ onThemeChange, theme }) => {
|
|
|
68529
69179
|
};
|
|
68530
69180
|
|
|
68531
69181
|
// src/ui/app/components/scrollablebox.tsx
|
|
68532
|
-
var
|
|
69182
|
+
var import_react30 = __toESM(require_react(), 1);
|
|
68533
69183
|
var jsx_dev_runtime8 = __toESM(require_jsx_dev_runtime(), 1);
|
|
68534
69184
|
var ScrollableBox = ({ children }) => {
|
|
68535
69185
|
const { stdout } = use_stdout_default();
|
|
68536
|
-
const [scrollPosition, setScrollPosition] =
|
|
69186
|
+
const [scrollPosition, setScrollPosition] = import_react30.useState(0);
|
|
68537
69187
|
const maxHeight = stdout.rows - 10;
|
|
68538
|
-
const [contentHeight, setContentHeight] =
|
|
69188
|
+
const [contentHeight, setContentHeight] = import_react30.useState(0);
|
|
68539
69189
|
use_input_default((_, key) => {
|
|
68540
69190
|
if (key.pageUp)
|
|
68541
69191
|
setScrollPosition((prev) => Math.max(0, prev - maxHeight));
|
|
68542
69192
|
if (key.pageDown)
|
|
68543
69193
|
setScrollPosition((prev) => Math.min(contentHeight - maxHeight, prev + maxHeight));
|
|
68544
69194
|
});
|
|
68545
|
-
|
|
69195
|
+
import_react30.useEffect(() => {
|
|
68546
69196
|
const estimateHeight = (node) => {
|
|
68547
69197
|
if (!node)
|
|
68548
69198
|
return 0;
|
|
@@ -68551,7 +69201,7 @@ var ScrollableBox = ({ children }) => {
|
|
|
68551
69201
|
`).length;
|
|
68552
69202
|
if (Array.isArray(node))
|
|
68553
69203
|
return node.reduce((acc, child) => acc + estimateHeight(child), 0);
|
|
68554
|
-
if (
|
|
69204
|
+
if (import_react30.default.isValidElement(node))
|
|
68555
69205
|
return estimateHeight(node.props.children);
|
|
68556
69206
|
return 1;
|
|
68557
69207
|
};
|
|
@@ -68568,7 +69218,7 @@ var ScrollableBox = ({ children }) => {
|
|
|
68568
69218
|
children: /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
68569
69219
|
marginTop: -scrollPosition,
|
|
68570
69220
|
flexDirection: "column",
|
|
68571
|
-
children:
|
|
69221
|
+
children: import_react30.default.Children.map(children, (child) => import_react30.default.isValidElement(child) ? import_react30.default.cloneElement(child) : child)
|
|
68572
69222
|
}, undefined, false, undefined, this)
|
|
68573
69223
|
}, undefined, false, undefined, this),
|
|
68574
69224
|
contentHeight > maxHeight && /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
@@ -68583,9 +69233,9 @@ var ScrollableBox = ({ children }) => {
|
|
|
68583
69233
|
};
|
|
68584
69234
|
|
|
68585
69235
|
// src/ui/app/components/syntaxhighlighter.tsx
|
|
68586
|
-
var
|
|
69236
|
+
var import_react31 = __toESM(require_react(), 1);
|
|
68587
69237
|
var jsx_dev_runtime9 = __toESM(require_jsx_dev_runtime(), 1);
|
|
68588
|
-
var JsonSyntaxHighlight =
|
|
69238
|
+
var JsonSyntaxHighlight = import_react31.default.memo(({ jsonString, theme }) => {
|
|
68589
69239
|
try {
|
|
68590
69240
|
const json = JSON.parse(jsonString);
|
|
68591
69241
|
const prettyJson = JSON.stringify(json, null, 2);
|
|
@@ -68688,10 +69338,10 @@ var JsonSyntaxHighlight = import_react30.default.memo(({ jsonString, theme }) =>
|
|
|
68688
69338
|
});
|
|
68689
69339
|
|
|
68690
69340
|
// src/ui/app/components/responsepanel.tsx
|
|
68691
|
-
var
|
|
69341
|
+
var import_react32 = __toESM(require_react(), 1);
|
|
68692
69342
|
var jsx_dev_runtime10 = __toESM(require_jsx_dev_runtime(), 1);
|
|
68693
|
-
var ResponsePanel =
|
|
68694
|
-
const [activeTab, setActiveTab] =
|
|
69343
|
+
var ResponsePanel = import_react32.default.memo(({ response, theme }) => {
|
|
69344
|
+
const [activeTab, setActiveTab] = import_react32.useState("body");
|
|
68695
69345
|
const tabs = [{ name: "headers", label: "Headers" }, { name: "body", label: "Body" }];
|
|
68696
69346
|
return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Box_default, {
|
|
68697
69347
|
flexDirection: "column",
|
|
@@ -68765,15 +69415,341 @@ var ResponsePanel = import_react31.default.memo(({ response, theme }) => {
|
|
|
68765
69415
|
}, undefined, true, undefined, this);
|
|
68766
69416
|
});
|
|
68767
69417
|
|
|
69418
|
+
// src/ui/app/components/exportdialog.tsx
|
|
69419
|
+
var import_react33 = __toESM(require_react(), 1);
|
|
69420
|
+
|
|
69421
|
+
// src/utils/export.ts
|
|
69422
|
+
import { writeFile, mkdir } from "fs";
|
|
69423
|
+
import { spawn } from "child_process";
|
|
69424
|
+
import { promisify } from "util";
|
|
69425
|
+
import { dirname } from "path";
|
|
69426
|
+
var writeFileAsync = promisify(writeFile);
|
|
69427
|
+
var mkdirAsync = promisify(mkdir);
|
|
69428
|
+
var toCurl = (request) => {
|
|
69429
|
+
const parts = ["curl"];
|
|
69430
|
+
parts.push(`-X ${request.method}`);
|
|
69431
|
+
parts.push(`'${request.url}'`);
|
|
69432
|
+
try {
|
|
69433
|
+
const headers = JSON.parse(request.headers || "{}");
|
|
69434
|
+
Object.entries(headers).forEach(([key, value]) => {
|
|
69435
|
+
parts.push(`-H '${key}: ${value}'`);
|
|
69436
|
+
});
|
|
69437
|
+
} catch {}
|
|
69438
|
+
if (request.body && request.method !== "GET") {
|
|
69439
|
+
parts.push(`-d '${request.body}'`);
|
|
69440
|
+
}
|
|
69441
|
+
return parts.join(" \\\n ");
|
|
69442
|
+
};
|
|
69443
|
+
var toFetch = (request) => {
|
|
69444
|
+
const options = {
|
|
69445
|
+
method: request.method
|
|
69446
|
+
};
|
|
69447
|
+
try {
|
|
69448
|
+
const headers = JSON.parse(request.headers || "{}");
|
|
69449
|
+
if (Object.keys(headers).length > 0) {
|
|
69450
|
+
options.headers = headers;
|
|
69451
|
+
}
|
|
69452
|
+
} catch {}
|
|
69453
|
+
if (request.body && request.method !== "GET") {
|
|
69454
|
+
options.body = request.body;
|
|
69455
|
+
}
|
|
69456
|
+
const optionsStr = JSON.stringify(options, null, 2);
|
|
69457
|
+
return `fetch('${request.url}', ${optionsStr})
|
|
69458
|
+
.then(response => response.json())
|
|
69459
|
+
.then(data => console.log(data))
|
|
69460
|
+
.catch(error => console.error('Error:', error));`;
|
|
69461
|
+
};
|
|
69462
|
+
var copyToClipboard = async (text) => {
|
|
69463
|
+
return new Promise((resolve) => {
|
|
69464
|
+
const platform2 = process.platform;
|
|
69465
|
+
const clipboardCmds = platform2 === "darwin" ? [{ cmd: "pbcopy", args: [] }] : platform2 === "win32" ? [{ cmd: "clip", args: [] }] : [
|
|
69466
|
+
{ cmd: "wl-copy", args: [] },
|
|
69467
|
+
{ cmd: "xclip", args: ["-selection", "clipboard"] },
|
|
69468
|
+
{ cmd: "xsel", args: ["--clipboard", "--input"] }
|
|
69469
|
+
];
|
|
69470
|
+
const tryClipboard = (index) => {
|
|
69471
|
+
if (index >= clipboardCmds.length) {
|
|
69472
|
+
resolve(false);
|
|
69473
|
+
return;
|
|
69474
|
+
}
|
|
69475
|
+
const item = clipboardCmds[index];
|
|
69476
|
+
try {
|
|
69477
|
+
const proc = spawn(item.cmd, item.args, { stdio: ["pipe", "ignore", "ignore"] });
|
|
69478
|
+
proc.stdin.write(text);
|
|
69479
|
+
proc.stdin.end();
|
|
69480
|
+
proc.on("close", (code) => {
|
|
69481
|
+
if (code === 0) {
|
|
69482
|
+
resolve(true);
|
|
69483
|
+
} else {
|
|
69484
|
+
tryClipboard(index + 1);
|
|
69485
|
+
}
|
|
69486
|
+
});
|
|
69487
|
+
proc.on("error", () => tryClipboard(index + 1));
|
|
69488
|
+
} catch {
|
|
69489
|
+
tryClipboard(index + 1);
|
|
69490
|
+
}
|
|
69491
|
+
};
|
|
69492
|
+
tryClipboard(0);
|
|
69493
|
+
});
|
|
69494
|
+
};
|
|
69495
|
+
var saveToFile = async (content, filePath) => {
|
|
69496
|
+
try {
|
|
69497
|
+
const dir = dirname(filePath);
|
|
69498
|
+
await mkdirAsync(dir, { recursive: true });
|
|
69499
|
+
await writeFileAsync(filePath, content, "utf-8");
|
|
69500
|
+
return true;
|
|
69501
|
+
} catch {
|
|
69502
|
+
return false;
|
|
69503
|
+
}
|
|
69504
|
+
};
|
|
69505
|
+
|
|
69506
|
+
// src/ui/app/components/exportdialog.tsx
|
|
69507
|
+
var jsx_dev_runtime11 = __toESM(require_jsx_dev_runtime(), 1);
|
|
69508
|
+
var EXPORT_DIR = `${process.env.HOME}/.postboy/exports`;
|
|
69509
|
+
var ExportDialog = ({ request, onClose, theme }) => {
|
|
69510
|
+
const [format, setFormat] = import_react33.useState("curl");
|
|
69511
|
+
const [action, setAction] = import_react33.useState("copy");
|
|
69512
|
+
const [showSavePrompt, setShowSavePrompt] = import_react33.useState(false);
|
|
69513
|
+
const [filePath, setFilePath] = import_react33.useState("");
|
|
69514
|
+
const [message, setMessage] = import_react33.useState("");
|
|
69515
|
+
const [activeField, setActiveField] = import_react33.useState("format");
|
|
69516
|
+
const getExportContent = () => {
|
|
69517
|
+
return format === "curl" ? toCurl(request) : toFetch(request);
|
|
69518
|
+
};
|
|
69519
|
+
const handleExport = async () => {
|
|
69520
|
+
const content = getExportContent();
|
|
69521
|
+
if (action === "copy") {
|
|
69522
|
+
const success = await copyToClipboard(content);
|
|
69523
|
+
setMessage(success ? "Copied to clipboard!" : "Failed to copy. Try saving to file.");
|
|
69524
|
+
setTimeout(onClose, 1500);
|
|
69525
|
+
} else {
|
|
69526
|
+
setShowSavePrompt(true);
|
|
69527
|
+
setActiveField("path");
|
|
69528
|
+
}
|
|
69529
|
+
};
|
|
69530
|
+
const handleSave = async () => {
|
|
69531
|
+
if (!filePath.trim()) {
|
|
69532
|
+
setMessage("Please enter a file path");
|
|
69533
|
+
return;
|
|
69534
|
+
}
|
|
69535
|
+
const content = getExportContent();
|
|
69536
|
+
const ext = format === "curl" ? ".sh" : ".js";
|
|
69537
|
+
const fileName = filePath.endsWith(ext) ? filePath : filePath + ext;
|
|
69538
|
+
const finalPath = `${EXPORT_DIR}/${fileName}`;
|
|
69539
|
+
const success = await saveToFile(content, finalPath);
|
|
69540
|
+
setMessage(success ? `✓ File saved to:
|
|
69541
|
+
${finalPath}` : "Failed to save file");
|
|
69542
|
+
setTimeout(onClose, 3000);
|
|
69543
|
+
};
|
|
69544
|
+
use_input_default((input, key) => {
|
|
69545
|
+
if (key.escape) {
|
|
69546
|
+
if (showSavePrompt) {
|
|
69547
|
+
setShowSavePrompt(false);
|
|
69548
|
+
setActiveField("action");
|
|
69549
|
+
} else {
|
|
69550
|
+
onClose();
|
|
69551
|
+
}
|
|
69552
|
+
return;
|
|
69553
|
+
}
|
|
69554
|
+
if (showSavePrompt) {
|
|
69555
|
+
if (key.return) {
|
|
69556
|
+
handleSave();
|
|
69557
|
+
return;
|
|
69558
|
+
}
|
|
69559
|
+
if (key.backspace || key.delete) {
|
|
69560
|
+
setFilePath((p) => p.slice(0, -1));
|
|
69561
|
+
return;
|
|
69562
|
+
}
|
|
69563
|
+
if (!key.upArrow && !key.downArrow && !key.leftArrow && !key.rightArrow && !key.tab) {
|
|
69564
|
+
setFilePath((p) => p + input);
|
|
69565
|
+
}
|
|
69566
|
+
return;
|
|
69567
|
+
}
|
|
69568
|
+
if (key.tab) {
|
|
69569
|
+
setActiveField((f) => f === "format" ? "action" : "format");
|
|
69570
|
+
return;
|
|
69571
|
+
}
|
|
69572
|
+
if (key.return) {
|
|
69573
|
+
handleExport();
|
|
69574
|
+
return;
|
|
69575
|
+
}
|
|
69576
|
+
if (activeField === "format") {
|
|
69577
|
+
if (key.leftArrow || key.rightArrow || input === "h" || input === "l") {
|
|
69578
|
+
setFormat((f) => f === "curl" ? "fetch" : "curl");
|
|
69579
|
+
}
|
|
69580
|
+
} else if (activeField === "action") {
|
|
69581
|
+
if (key.leftArrow || key.rightArrow || input === "h" || input === "l") {
|
|
69582
|
+
setAction((a) => a === "copy" ? "save" : "copy");
|
|
69583
|
+
}
|
|
69584
|
+
}
|
|
69585
|
+
});
|
|
69586
|
+
const preview = getExportContent();
|
|
69587
|
+
return /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
69588
|
+
flexDirection: "column",
|
|
69589
|
+
borderStyle: "double",
|
|
69590
|
+
borderColor: theme.accent,
|
|
69591
|
+
padding: 1,
|
|
69592
|
+
children: [
|
|
69593
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
69594
|
+
marginBottom: 1,
|
|
69595
|
+
children: [
|
|
69596
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Text, {
|
|
69597
|
+
color: theme.accent,
|
|
69598
|
+
bold: true,
|
|
69599
|
+
children: "Export Request"
|
|
69600
|
+
}, undefined, false, undefined, this),
|
|
69601
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Text, {
|
|
69602
|
+
color: theme.muted,
|
|
69603
|
+
children: " (Tab: switch, ←→: select, Enter: confirm, Esc: cancel)"
|
|
69604
|
+
}, undefined, false, undefined, this)
|
|
69605
|
+
]
|
|
69606
|
+
}, undefined, true, undefined, this),
|
|
69607
|
+
message ? /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
69608
|
+
padding: 1,
|
|
69609
|
+
flexDirection: "column",
|
|
69610
|
+
borderStyle: "round",
|
|
69611
|
+
borderColor: theme.success,
|
|
69612
|
+
children: message.split(`
|
|
69613
|
+
`).map((line, i) => /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Text, {
|
|
69614
|
+
color: theme.success,
|
|
69615
|
+
bold: true,
|
|
69616
|
+
children: line
|
|
69617
|
+
}, i, false, undefined, this))
|
|
69618
|
+
}, undefined, false, undefined, this) : showSavePrompt ? /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
69619
|
+
flexDirection: "column",
|
|
69620
|
+
gap: 1,
|
|
69621
|
+
children: [
|
|
69622
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
69623
|
+
children: [
|
|
69624
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Text, {
|
|
69625
|
+
color: theme.primary,
|
|
69626
|
+
children: "File path: "
|
|
69627
|
+
}, undefined, false, undefined, this),
|
|
69628
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
69629
|
+
borderStyle: "round",
|
|
69630
|
+
borderColor: theme.accent,
|
|
69631
|
+
paddingX: 1,
|
|
69632
|
+
flexGrow: 1,
|
|
69633
|
+
children: [
|
|
69634
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Text, {
|
|
69635
|
+
color: theme.white,
|
|
69636
|
+
children: filePath
|
|
69637
|
+
}, undefined, false, undefined, this),
|
|
69638
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Text, {
|
|
69639
|
+
color: theme.accent,
|
|
69640
|
+
children: "▌"
|
|
69641
|
+
}, undefined, false, undefined, this)
|
|
69642
|
+
]
|
|
69643
|
+
}, undefined, true, undefined, this)
|
|
69644
|
+
]
|
|
69645
|
+
}, undefined, true, undefined, this),
|
|
69646
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Text, {
|
|
69647
|
+
color: theme.muted,
|
|
69648
|
+
children: [
|
|
69649
|
+
"Extension .",
|
|
69650
|
+
format === "curl" ? "sh" : "js",
|
|
69651
|
+
" will be added if not specified"
|
|
69652
|
+
]
|
|
69653
|
+
}, undefined, true, undefined, this)
|
|
69654
|
+
]
|
|
69655
|
+
}, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
69656
|
+
flexDirection: "column",
|
|
69657
|
+
gap: 1,
|
|
69658
|
+
children: [
|
|
69659
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
69660
|
+
gap: 2,
|
|
69661
|
+
children: [
|
|
69662
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Text, {
|
|
69663
|
+
color: theme.primary,
|
|
69664
|
+
children: "Format: "
|
|
69665
|
+
}, undefined, false, undefined, this),
|
|
69666
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
69667
|
+
borderStyle: "round",
|
|
69668
|
+
borderColor: activeField === "format" && format === "curl" ? theme.accent : theme.muted,
|
|
69669
|
+
paddingX: 1,
|
|
69670
|
+
children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Text, {
|
|
69671
|
+
color: format === "curl" ? theme.accent : theme.muted,
|
|
69672
|
+
bold: format === "curl",
|
|
69673
|
+
children: "cURL"
|
|
69674
|
+
}, undefined, false, undefined, this)
|
|
69675
|
+
}, undefined, false, undefined, this),
|
|
69676
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
69677
|
+
borderStyle: "round",
|
|
69678
|
+
borderColor: activeField === "format" && format === "fetch" ? theme.accent : theme.muted,
|
|
69679
|
+
paddingX: 1,
|
|
69680
|
+
children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Text, {
|
|
69681
|
+
color: format === "fetch" ? theme.accent : theme.muted,
|
|
69682
|
+
bold: format === "fetch",
|
|
69683
|
+
children: "Fetch"
|
|
69684
|
+
}, undefined, false, undefined, this)
|
|
69685
|
+
}, undefined, false, undefined, this)
|
|
69686
|
+
]
|
|
69687
|
+
}, undefined, true, undefined, this),
|
|
69688
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
69689
|
+
gap: 2,
|
|
69690
|
+
children: [
|
|
69691
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Text, {
|
|
69692
|
+
color: theme.primary,
|
|
69693
|
+
children: "Action: "
|
|
69694
|
+
}, undefined, false, undefined, this),
|
|
69695
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
69696
|
+
borderStyle: "round",
|
|
69697
|
+
borderColor: activeField === "action" && action === "copy" ? theme.accent : theme.muted,
|
|
69698
|
+
paddingX: 1,
|
|
69699
|
+
children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Text, {
|
|
69700
|
+
color: action === "copy" ? theme.accent : theme.muted,
|
|
69701
|
+
bold: action === "copy",
|
|
69702
|
+
children: "Copy to Clipboard"
|
|
69703
|
+
}, undefined, false, undefined, this)
|
|
69704
|
+
}, undefined, false, undefined, this),
|
|
69705
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
69706
|
+
borderStyle: "round",
|
|
69707
|
+
borderColor: activeField === "action" && action === "save" ? theme.accent : theme.muted,
|
|
69708
|
+
paddingX: 1,
|
|
69709
|
+
children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Text, {
|
|
69710
|
+
color: action === "save" ? theme.accent : theme.muted,
|
|
69711
|
+
bold: action === "save",
|
|
69712
|
+
children: "Save to File"
|
|
69713
|
+
}, undefined, false, undefined, this)
|
|
69714
|
+
}, undefined, false, undefined, this)
|
|
69715
|
+
]
|
|
69716
|
+
}, undefined, true, undefined, this),
|
|
69717
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
69718
|
+
flexDirection: "column",
|
|
69719
|
+
marginTop: 1,
|
|
69720
|
+
children: [
|
|
69721
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Text, {
|
|
69722
|
+
color: theme.primary,
|
|
69723
|
+
children: "Preview:"
|
|
69724
|
+
}, undefined, false, undefined, this),
|
|
69725
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
69726
|
+
borderStyle: "round",
|
|
69727
|
+
borderColor: theme.muted,
|
|
69728
|
+
padding: 1,
|
|
69729
|
+
flexDirection: "column",
|
|
69730
|
+
children: preview.split(`
|
|
69731
|
+
`).map((line, i) => /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Text, {
|
|
69732
|
+
color: theme.white,
|
|
69733
|
+
children: line
|
|
69734
|
+
}, i, false, undefined, this))
|
|
69735
|
+
}, undefined, false, undefined, this)
|
|
69736
|
+
]
|
|
69737
|
+
}, undefined, true, undefined, this)
|
|
69738
|
+
]
|
|
69739
|
+
}, undefined, true, undefined, this)
|
|
69740
|
+
]
|
|
69741
|
+
}, undefined, true, undefined, this);
|
|
69742
|
+
};
|
|
69743
|
+
|
|
68768
69744
|
// src/utils/themeManager.ts
|
|
68769
69745
|
import { promises as fs3 } from "fs";
|
|
68770
69746
|
import path2 from "path";
|
|
68771
|
-
import
|
|
69747
|
+
import os4 from "os";
|
|
68772
69748
|
|
|
68773
69749
|
class ThemeManager {
|
|
68774
69750
|
themeFile;
|
|
68775
69751
|
constructor() {
|
|
68776
|
-
const homeDir =
|
|
69752
|
+
const homeDir = os4.homedir();
|
|
68777
69753
|
const configDir = path2.join(homeDir, ".postboy");
|
|
68778
69754
|
this.themeFile = path2.join(configDir, "theme.json");
|
|
68779
69755
|
}
|
|
@@ -68868,21 +69844,21 @@ class ThemeManager {
|
|
|
68868
69844
|
var themeManager = new ThemeManager;
|
|
68869
69845
|
|
|
68870
69846
|
// src/ui/app/ui.tsx
|
|
68871
|
-
var
|
|
69847
|
+
var jsx_dev_runtime12 = __toESM(require_jsx_dev_runtime(), 1);
|
|
68872
69848
|
var SendButton = ({ onPress, loading, theme }) => {
|
|
68873
69849
|
const { isFocused } = use_focus_default();
|
|
68874
69850
|
use_input_default((_, key) => {
|
|
68875
69851
|
if (isFocused && key.return)
|
|
68876
69852
|
onPress();
|
|
68877
69853
|
});
|
|
68878
|
-
return /* @__PURE__ */
|
|
69854
|
+
return /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
|
|
68879
69855
|
borderStyle: "round",
|
|
68880
69856
|
paddingX: 2,
|
|
68881
69857
|
borderTopDimColor: true,
|
|
68882
69858
|
borderColor: isFocused ? theme.accent : theme.primary,
|
|
68883
|
-
children: loading ? /* @__PURE__ */
|
|
69859
|
+
children: loading ? /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Spinner, {
|
|
68884
69860
|
theme
|
|
68885
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */
|
|
69861
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
|
|
68886
69862
|
bold: true,
|
|
68887
69863
|
color: isFocused ? theme.accent : theme.white,
|
|
68888
69864
|
children: "\uD83D\uDE80 Send"
|
|
@@ -68890,12 +69866,12 @@ var SendButton = ({ onPress, loading, theme }) => {
|
|
|
68890
69866
|
}, undefined, false, undefined, this);
|
|
68891
69867
|
};
|
|
68892
69868
|
var HTTP_METHODS = ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD"];
|
|
68893
|
-
var RequestPanel =
|
|
69869
|
+
var RequestPanel = import_react34.default.memo(({ request, onMethodChange, onUrlChange, onHeadersChange, onBodyChange, onSend, loading, theme, historyUrls = [], onInputFocus }) => /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
|
|
68894
69870
|
flexDirection: "column",
|
|
68895
69871
|
gap: 1,
|
|
68896
69872
|
flexGrow: 1,
|
|
68897
69873
|
children: [
|
|
68898
|
-
/* @__PURE__ */
|
|
69874
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(FormField, {
|
|
68899
69875
|
label: "Method",
|
|
68900
69876
|
value: request.method,
|
|
68901
69877
|
onChange: onMethodChange,
|
|
@@ -68904,7 +69880,7 @@ var RequestPanel = import_react32.default.memo(({ request, onMethodChange, onUrl
|
|
|
68904
69880
|
suggestions: HTTP_METHODS,
|
|
68905
69881
|
onFocusChange: onInputFocus
|
|
68906
69882
|
}, undefined, false, undefined, this),
|
|
68907
|
-
/* @__PURE__ */
|
|
69883
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(FormField, {
|
|
68908
69884
|
label: "URL",
|
|
68909
69885
|
value: request.url,
|
|
68910
69886
|
onChange: onUrlChange,
|
|
@@ -68913,7 +69889,7 @@ var RequestPanel = import_react32.default.memo(({ request, onMethodChange, onUrl
|
|
|
68913
69889
|
suggestions: historyUrls,
|
|
68914
69890
|
onFocusChange: onInputFocus
|
|
68915
69891
|
}, undefined, false, undefined, this),
|
|
68916
|
-
/* @__PURE__ */
|
|
69892
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(KeyValueField, {
|
|
68917
69893
|
label: "Headers",
|
|
68918
69894
|
value: request.headers,
|
|
68919
69895
|
onChange: onHeadersChange,
|
|
@@ -68921,7 +69897,7 @@ var RequestPanel = import_react32.default.memo(({ request, onMethodChange, onUrl
|
|
|
68921
69897
|
theme,
|
|
68922
69898
|
onFocusChange: onInputFocus
|
|
68923
69899
|
}, undefined, false, undefined, this),
|
|
68924
|
-
/* @__PURE__ */
|
|
69900
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(KeyValueField, {
|
|
68925
69901
|
label: "Body",
|
|
68926
69902
|
value: request.body,
|
|
68927
69903
|
onChange: onBodyChange,
|
|
@@ -68929,10 +69905,10 @@ var RequestPanel = import_react32.default.memo(({ request, onMethodChange, onUrl
|
|
|
68929
69905
|
theme,
|
|
68930
69906
|
onFocusChange: onInputFocus
|
|
68931
69907
|
}, undefined, false, undefined, this),
|
|
68932
|
-
/* @__PURE__ */
|
|
69908
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
|
|
68933
69909
|
marginTop: 1,
|
|
68934
69910
|
justifyContent: "center",
|
|
68935
|
-
children: /* @__PURE__ */
|
|
69911
|
+
children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(SendButton, {
|
|
68936
69912
|
onPress: onSend,
|
|
68937
69913
|
loading,
|
|
68938
69914
|
theme
|
|
@@ -68941,27 +69917,27 @@ var RequestPanel = import_react32.default.memo(({ request, onMethodChange, onUrl
|
|
|
68941
69917
|
]
|
|
68942
69918
|
}, undefined, true, undefined, this));
|
|
68943
69919
|
var UI = () => {
|
|
68944
|
-
const [theme, setTheme] =
|
|
69920
|
+
const [theme, setTheme] = import_react34.useState(themes.catppuccin);
|
|
68945
69921
|
const { exit } = use_app_default();
|
|
68946
|
-
const [activeTab, setActiveTab] =
|
|
68947
|
-
const [request, setRequest] =
|
|
68948
|
-
const [response, setResponse] =
|
|
68949
|
-
const [history, setHistory] =
|
|
68950
|
-
const [loading, setLoading] =
|
|
68951
|
-
const requestRef =
|
|
69922
|
+
const [activeTab, setActiveTab] = import_react34.useState("request");
|
|
69923
|
+
const [request, setRequest] = import_react34.useState({ method: "GET", url: "", headers: "", body: "" });
|
|
69924
|
+
const [response, setResponse] = import_react34.useState({ statustext: "", status: "", headers: "", body: "", error: "" });
|
|
69925
|
+
const [history, setHistory] = import_react34.useState([]);
|
|
69926
|
+
const [loading, setLoading] = import_react34.useState(false);
|
|
69927
|
+
const requestRef = import_react34.useRef(request);
|
|
68952
69928
|
requestRef.current = request;
|
|
68953
|
-
|
|
69929
|
+
import_react34.useEffect(() => {
|
|
68954
69930
|
const loadHistory = async () => setHistory((await historyManager.loadHistory()).entries);
|
|
68955
69931
|
loadHistory();
|
|
68956
69932
|
}, []);
|
|
68957
|
-
|
|
69933
|
+
import_react34.useEffect(() => {
|
|
68958
69934
|
const loadTheme = async () => {
|
|
68959
69935
|
const loadedTheme = await themeManager.loadCurrTheme();
|
|
68960
69936
|
setTheme(loadedTheme);
|
|
68961
69937
|
};
|
|
68962
69938
|
loadTheme();
|
|
68963
69939
|
}, []);
|
|
68964
|
-
const handleSend =
|
|
69940
|
+
const handleSend = import_react34.useCallback(async () => {
|
|
68965
69941
|
setLoading(true);
|
|
68966
69942
|
const startTime = Date.now();
|
|
68967
69943
|
const currentRequest = requestRef.current;
|
|
@@ -69002,7 +69978,7 @@ var UI = () => {
|
|
|
69002
69978
|
themeManager.ChangeTheme(theme2);
|
|
69003
69979
|
setTheme(theme2);
|
|
69004
69980
|
};
|
|
69005
|
-
const handleHistoryClick =
|
|
69981
|
+
const handleHistoryClick = import_react34.useCallback((item) => {
|
|
69006
69982
|
setRequest({
|
|
69007
69983
|
method: item.method,
|
|
69008
69984
|
url: item.url,
|
|
@@ -69013,10 +69989,11 @@ var UI = () => {
|
|
|
69013
69989
|
}, []);
|
|
69014
69990
|
const tabs = [{ name: "request", label: "Request" }, { name: "response", label: "Response" }];
|
|
69015
69991
|
const activeIndex = tabs.findIndex((t) => t.name === activeTab);
|
|
69016
|
-
const [showThemeSelector, setShowThemeSelector] =
|
|
69017
|
-
const [
|
|
69992
|
+
const [showThemeSelector, setShowThemeSelector] = import_react34.useState(false);
|
|
69993
|
+
const [showExportDialog, setShowExportDialog] = import_react34.useState(false);
|
|
69994
|
+
const [inputFocused, setInputFocused] = import_react34.useState(false);
|
|
69018
69995
|
use_input_default((input, key) => {
|
|
69019
|
-
if (input === "q")
|
|
69996
|
+
if (input === "q" && !showExportDialog)
|
|
69020
69997
|
exit();
|
|
69021
69998
|
if (key.ctrl && key.return)
|
|
69022
69999
|
handleSend();
|
|
@@ -69026,87 +70003,101 @@ var UI = () => {
|
|
|
69026
70003
|
setActiveTab(tabs[(activeIndex - 1 + tabs.length) % tabs.length]?.name ?? "request");
|
|
69027
70004
|
if (key.escape && showThemeSelector)
|
|
69028
70005
|
setShowThemeSelector(false);
|
|
69029
|
-
if (
|
|
70006
|
+
if (key.escape && showExportDialog)
|
|
70007
|
+
setShowExportDialog(false);
|
|
70008
|
+
if ((input === "t" || input === "T") && !key.ctrl && !key.meta && !inputFocused && !showExportDialog)
|
|
69030
70009
|
setShowThemeSelector((prev) => !prev);
|
|
69031
|
-
|
|
69032
|
-
|
|
69033
|
-
|
|
69034
|
-
const
|
|
69035
|
-
const
|
|
70010
|
+
if ((input === "e" || input === "E") && !key.ctrl && !key.meta && !inputFocused && !showThemeSelector)
|
|
70011
|
+
setShowExportDialog((prev) => !prev);
|
|
70012
|
+
}, { isActive: !showExportDialog });
|
|
70013
|
+
const onMethodChange = import_react34.useCallback((method) => setRequest((r) => ({ ...r, method })), []);
|
|
70014
|
+
const onUrlChange = import_react34.useCallback((url) => setRequest((r) => ({ ...r, url })), []);
|
|
70015
|
+
const onHeadersChange = import_react34.useCallback((headers) => setRequest((r) => ({ ...r, headers })), []);
|
|
70016
|
+
const onBodyChange = import_react34.useCallback((body) => setRequest((r) => ({ ...r, body })), []);
|
|
69036
70017
|
const historyUrls = Array.from(new Set(history.map((h) => h.url))).filter(Boolean);
|
|
69037
|
-
return /* @__PURE__ */
|
|
70018
|
+
return /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
|
|
69038
70019
|
padding: 1,
|
|
69039
70020
|
flexDirection: "column",
|
|
69040
70021
|
flexGrow: 1,
|
|
69041
70022
|
children: [
|
|
69042
|
-
showThemeSelector && /* @__PURE__ */
|
|
70023
|
+
showThemeSelector && /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
|
|
69043
70024
|
flexDirection: "row",
|
|
69044
70025
|
justifyContent: "center",
|
|
69045
70026
|
marginBottom: 1,
|
|
69046
|
-
children: /* @__PURE__ */
|
|
70027
|
+
children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemeSelector, {
|
|
69047
70028
|
theme,
|
|
69048
70029
|
onThemeChange: (themeName) => {
|
|
69049
70030
|
handleThemeChange(themes[themeName]);
|
|
69050
70031
|
}
|
|
69051
70032
|
}, undefined, false, undefined, this)
|
|
69052
70033
|
}, undefined, false, undefined, this),
|
|
69053
|
-
/* @__PURE__ */
|
|
70034
|
+
showExportDialog && /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
|
|
70035
|
+
flexDirection: "row",
|
|
70036
|
+
justifyContent: "center",
|
|
70037
|
+
marginBottom: 1,
|
|
70038
|
+
children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ExportDialog, {
|
|
70039
|
+
request,
|
|
70040
|
+
onClose: () => setShowExportDialog(false),
|
|
70041
|
+
theme: theme.colors
|
|
70042
|
+
}, undefined, false, undefined, this)
|
|
70043
|
+
}, undefined, false, undefined, this),
|
|
70044
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
|
|
69054
70045
|
alignSelf: "center",
|
|
69055
70046
|
marginBottom: 1,
|
|
69056
|
-
children: /* @__PURE__ */
|
|
70047
|
+
children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
|
|
69057
70048
|
color: theme.colors.accent,
|
|
69058
70049
|
bold: true,
|
|
69059
70050
|
children: `┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓`
|
|
69060
70051
|
}, undefined, false, undefined, this)
|
|
69061
70052
|
}, undefined, false, undefined, this),
|
|
69062
|
-
/* @__PURE__ */
|
|
70053
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
|
|
69063
70054
|
alignSelf: "center",
|
|
69064
70055
|
marginBottom: 1,
|
|
69065
|
-
children: /* @__PURE__ */
|
|
70056
|
+
children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
|
|
69066
70057
|
color: theme.colors.primary,
|
|
69067
70058
|
bold: true,
|
|
69068
70059
|
children: `┃ \uD83D\uDEF0️ Welcome to PostBoy — The Modern Terminal API Client ┃`
|
|
69069
70060
|
}, undefined, false, undefined, this)
|
|
69070
70061
|
}, undefined, false, undefined, this),
|
|
69071
|
-
/* @__PURE__ */
|
|
70062
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
|
|
69072
70063
|
alignSelf: "center",
|
|
69073
70064
|
marginBottom: 1,
|
|
69074
|
-
children: /* @__PURE__ */
|
|
70065
|
+
children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
|
|
69075
70066
|
color: theme.colors.accent,
|
|
69076
70067
|
bold: true,
|
|
69077
70068
|
children: `┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛`
|
|
69078
70069
|
}, undefined, false, undefined, this)
|
|
69079
70070
|
}, undefined, false, undefined, this),
|
|
69080
|
-
/* @__PURE__ */
|
|
70071
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
|
|
69081
70072
|
flexGrow: 1,
|
|
69082
70073
|
children: [
|
|
69083
|
-
/* @__PURE__ */
|
|
70074
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
|
|
69084
70075
|
width: "40%",
|
|
69085
70076
|
borderColor: theme.colors.muted,
|
|
69086
70077
|
flexDirection: "column",
|
|
69087
70078
|
marginRight: 1,
|
|
69088
70079
|
children: [
|
|
69089
|
-
/* @__PURE__ */
|
|
70080
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
|
|
69090
70081
|
alignSelf: "center",
|
|
69091
70082
|
marginBottom: 1,
|
|
69092
|
-
children: /* @__PURE__ */
|
|
70083
|
+
children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
|
|
69093
70084
|
color: theme.colors.accent,
|
|
69094
70085
|
bold: true,
|
|
69095
70086
|
children: `┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓`
|
|
69096
70087
|
}, undefined, false, undefined, this)
|
|
69097
70088
|
}, undefined, false, undefined, this),
|
|
69098
|
-
/* @__PURE__ */
|
|
70089
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
|
|
69099
70090
|
borderTopColor: "grey",
|
|
69100
70091
|
borderColor: theme.colors.secondary,
|
|
69101
70092
|
paddingX: 1,
|
|
69102
70093
|
alignSelf: "center",
|
|
69103
|
-
children: /* @__PURE__ */
|
|
70094
|
+
children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
|
|
69104
70095
|
color: theme.colors.accent,
|
|
69105
70096
|
bold: true,
|
|
69106
70097
|
children: "\uD83D\uDCDC History"
|
|
69107
70098
|
}, undefined, false, undefined, this)
|
|
69108
70099
|
}, undefined, false, undefined, this),
|
|
69109
|
-
/* @__PURE__ */
|
|
70100
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
|
|
69110
70101
|
flexDirection: "column",
|
|
69111
70102
|
flexGrow: 1,
|
|
69112
70103
|
borderRightColor: "grey",
|
|
@@ -69115,22 +70106,22 @@ var UI = () => {
|
|
|
69115
70106
|
borderLeft: false,
|
|
69116
70107
|
borderBottom: false,
|
|
69117
70108
|
paddingY: 1,
|
|
69118
|
-
children: history.length === 0 ? /* @__PURE__ */
|
|
70109
|
+
children: history.length === 0 ? /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
|
|
69119
70110
|
padding: 1,
|
|
69120
|
-
children: /* @__PURE__ */
|
|
70111
|
+
children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
|
|
69121
70112
|
color: theme.colors.muted,
|
|
69122
70113
|
children: "No requests yet..."
|
|
69123
70114
|
}, undefined, false, undefined, this)
|
|
69124
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */
|
|
70115
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(HistoryList, {
|
|
69125
70116
|
history,
|
|
69126
70117
|
onItemClick: handleHistoryClick,
|
|
69127
70118
|
theme
|
|
69128
70119
|
}, undefined, false, undefined, this)
|
|
69129
70120
|
}, undefined, false, undefined, this),
|
|
69130
|
-
/* @__PURE__ */
|
|
70121
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
|
|
69131
70122
|
alignSelf: "center",
|
|
69132
70123
|
marginBottom: 1,
|
|
69133
|
-
children: /* @__PURE__ */
|
|
70124
|
+
children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
|
|
69134
70125
|
color: theme.colors.accent,
|
|
69135
70126
|
bold: true,
|
|
69136
70127
|
children: `┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛`
|
|
@@ -69138,36 +70129,36 @@ var UI = () => {
|
|
|
69138
70129
|
}, undefined, false, undefined, this)
|
|
69139
70130
|
]
|
|
69140
70131
|
}, undefined, true, undefined, this),
|
|
69141
|
-
/* @__PURE__ */
|
|
70132
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
|
|
69142
70133
|
width: "60%",
|
|
69143
70134
|
borderColor: theme.colors.muted,
|
|
69144
70135
|
padding: 1,
|
|
69145
70136
|
flexDirection: "column",
|
|
69146
70137
|
children: [
|
|
69147
|
-
/* @__PURE__ */
|
|
70138
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
|
|
69148
70139
|
alignSelf: "center",
|
|
69149
70140
|
marginBottom: 1,
|
|
69150
|
-
children: /* @__PURE__ */
|
|
70141
|
+
children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
|
|
69151
70142
|
color: theme.colors.accent,
|
|
69152
70143
|
bold: true,
|
|
69153
70144
|
children: `┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓`
|
|
69154
70145
|
}, undefined, false, undefined, this)
|
|
69155
70146
|
}, undefined, false, undefined, this),
|
|
69156
|
-
/* @__PURE__ */
|
|
70147
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Tabs, {
|
|
69157
70148
|
tabs,
|
|
69158
70149
|
activeTab,
|
|
69159
70150
|
onChange: setActiveTab,
|
|
69160
70151
|
theme
|
|
69161
70152
|
}, undefined, false, undefined, this),
|
|
69162
|
-
/* @__PURE__ */
|
|
70153
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
|
|
69163
70154
|
marginTop: 1,
|
|
69164
70155
|
flexDirection: "column",
|
|
69165
70156
|
flexGrow: 1,
|
|
69166
70157
|
children: [
|
|
69167
|
-
/* @__PURE__ */
|
|
70158
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
|
|
69168
70159
|
display: activeTab === "request" ? "flex" : "none",
|
|
69169
70160
|
flexGrow: 1,
|
|
69170
|
-
children: /* @__PURE__ */
|
|
70161
|
+
children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(RequestPanel, {
|
|
69171
70162
|
request,
|
|
69172
70163
|
onMethodChange,
|
|
69173
70164
|
onUrlChange,
|
|
@@ -69180,20 +70171,20 @@ var UI = () => {
|
|
|
69180
70171
|
onInputFocus: setInputFocused
|
|
69181
70172
|
}, undefined, false, undefined, this)
|
|
69182
70173
|
}, undefined, false, undefined, this),
|
|
69183
|
-
/* @__PURE__ */
|
|
70174
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
|
|
69184
70175
|
display: activeTab === "response" ? "flex" : "none",
|
|
69185
70176
|
flexGrow: 1,
|
|
69186
|
-
children: /* @__PURE__ */
|
|
70177
|
+
children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ResponsePanel, {
|
|
69187
70178
|
response,
|
|
69188
70179
|
theme
|
|
69189
70180
|
}, undefined, false, undefined, this)
|
|
69190
70181
|
}, undefined, false, undefined, this)
|
|
69191
70182
|
]
|
|
69192
70183
|
}, undefined, true, undefined, this),
|
|
69193
|
-
/* @__PURE__ */
|
|
70184
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
|
|
69194
70185
|
alignSelf: "center",
|
|
69195
70186
|
marginBottom: 1,
|
|
69196
|
-
children: /* @__PURE__ */
|
|
70187
|
+
children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
|
|
69197
70188
|
color: theme.colors.accent,
|
|
69198
70189
|
bold: true,
|
|
69199
70190
|
children: `┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛`
|
|
@@ -69203,7 +70194,7 @@ var UI = () => {
|
|
|
69203
70194
|
}, undefined, true, undefined, this)
|
|
69204
70195
|
]
|
|
69205
70196
|
}, undefined, true, undefined, this),
|
|
69206
|
-
/* @__PURE__ */
|
|
70197
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Footer, {
|
|
69207
70198
|
theme: theme.colors
|
|
69208
70199
|
}, undefined, false, undefined, this)
|
|
69209
70200
|
]
|
|
@@ -69212,14 +70203,14 @@ var UI = () => {
|
|
|
69212
70203
|
var ui_default = UI;
|
|
69213
70204
|
|
|
69214
70205
|
// src/ui/app/app.tsx
|
|
69215
|
-
var
|
|
70206
|
+
var jsx_dev_runtime13 = __toESM(require_jsx_dev_runtime(), 1);
|
|
69216
70207
|
function App2() {
|
|
69217
|
-
return /* @__PURE__ */
|
|
70208
|
+
return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ui_default, {}, undefined, false, undefined, this);
|
|
69218
70209
|
}
|
|
69219
70210
|
|
|
69220
70211
|
// src/commands/ui.tsx
|
|
69221
|
-
var
|
|
69222
|
-
var
|
|
70212
|
+
var import_chalk6 = __toESM(require_source(), 1);
|
|
70213
|
+
var jsx_dev_runtime14 = __toESM(require_jsx_dev_runtime(), 1);
|
|
69223
70214
|
var UIWrapper = () => {
|
|
69224
70215
|
const { exit } = use_app_default();
|
|
69225
70216
|
use_input_default((input) => {
|
|
@@ -69227,23 +70218,23 @@ var UIWrapper = () => {
|
|
|
69227
70218
|
exit();
|
|
69228
70219
|
}
|
|
69229
70220
|
});
|
|
69230
|
-
return /* @__PURE__ */
|
|
70221
|
+
return /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(Box_default, {
|
|
69231
70222
|
flexDirection: "column",
|
|
69232
70223
|
children: [
|
|
69233
|
-
/* @__PURE__ */
|
|
69234
|
-
children:
|
|
70224
|
+
/* @__PURE__ */ jsx_dev_runtime14.jsxDEV(Text, {
|
|
70225
|
+
children: import_chalk6.default.cyanBright(`PostBoy \uD83D\uDC8C`)
|
|
69235
70226
|
}, undefined, false, undefined, this),
|
|
69236
|
-
/* @__PURE__ */
|
|
70227
|
+
/* @__PURE__ */ jsx_dev_runtime14.jsxDEV(App2, {}, undefined, false, undefined, this)
|
|
69237
70228
|
]
|
|
69238
70229
|
}, undefined, true, undefined, this);
|
|
69239
70230
|
};
|
|
69240
70231
|
var uiCommand = () => {
|
|
69241
|
-
render_default(/* @__PURE__ */
|
|
70232
|
+
render_default(/* @__PURE__ */ jsx_dev_runtime14.jsxDEV(UIWrapper, {}, undefined, false, undefined, this));
|
|
69242
70233
|
};
|
|
69243
70234
|
|
|
69244
70235
|
// src/commands/test.ts
|
|
69245
70236
|
var import_inquirer = __toESM(require_inquirer(), 1);
|
|
69246
|
-
var
|
|
70237
|
+
var import_chalk7 = __toESM(require_source(), 1);
|
|
69247
70238
|
async function testCommand() {
|
|
69248
70239
|
logger.title(WELCOME_MESSAGE);
|
|
69249
70240
|
logger.info(SUBTITLE);
|
|
@@ -69251,13 +70242,13 @@ async function testCommand() {
|
|
|
69251
70242
|
{
|
|
69252
70243
|
type: "input",
|
|
69253
70244
|
name: "url",
|
|
69254
|
-
message:
|
|
70245
|
+
message: import_chalk7.default.green("Enter the API URL:"),
|
|
69255
70246
|
default: "leave this empty for selecting mock URL"
|
|
69256
70247
|
},
|
|
69257
70248
|
{
|
|
69258
70249
|
type: "list",
|
|
69259
70250
|
name: "MOCK_URL",
|
|
69260
|
-
message:
|
|
70251
|
+
message: import_chalk7.default.green("Select a mock URL:"),
|
|
69261
70252
|
choices: [
|
|
69262
70253
|
"https://jsonplaceholder.typicode.com/posts",
|
|
69263
70254
|
"https://jsonplaceholder.typicode.com/comments",
|
|
@@ -69268,19 +70259,19 @@ async function testCommand() {
|
|
|
69268
70259
|
{
|
|
69269
70260
|
type: "list",
|
|
69270
70261
|
name: "method",
|
|
69271
|
-
message:
|
|
70262
|
+
message: import_chalk7.default.green("Select HTTP method:"),
|
|
69272
70263
|
choices: ["GET", "POST", "PUT", "DELETE"]
|
|
69273
70264
|
},
|
|
69274
70265
|
{
|
|
69275
70266
|
type: "input",
|
|
69276
70267
|
name: "headers",
|
|
69277
|
-
message:
|
|
70268
|
+
message: import_chalk7.default.green("Enter headers (JSON format):"),
|
|
69278
70269
|
default: "{}"
|
|
69279
70270
|
},
|
|
69280
70271
|
{
|
|
69281
70272
|
type: "input",
|
|
69282
70273
|
name: "body",
|
|
69283
|
-
message:
|
|
70274
|
+
message: import_chalk7.default.green("Enter request body (JSON format):"),
|
|
69284
70275
|
default: "{}"
|
|
69285
70276
|
}
|
|
69286
70277
|
]);
|
|
@@ -69294,20 +70285,20 @@ Your request configuration:`);
|
|
|
69294
70285
|
Response received! ✨`);
|
|
69295
70286
|
logger.info(`Status: ${response.status}`);
|
|
69296
70287
|
logger.info(`Status Text: ${response.statusText}`);
|
|
69297
|
-
console.log(
|
|
70288
|
+
console.log(import_chalk7.default.green("Response Body :"));
|
|
69298
70289
|
+logger.info(await response.text());
|
|
69299
|
-
console.log(
|
|
70290
|
+
console.log(import_chalk7.default.green("Response Headers:"));
|
|
69300
70291
|
logger.info(JSON.stringify(response.headers, null, 2));
|
|
69301
70292
|
} catch (err) {
|
|
69302
70293
|
logger.error(`
|
|
69303
70294
|
Error occurred! ❌`);
|
|
69304
|
-
console.error(
|
|
70295
|
+
console.error(import_chalk7.default.magentaBright(err));
|
|
69305
70296
|
}
|
|
69306
70297
|
}
|
|
69307
70298
|
|
|
69308
70299
|
// src/commands/mock.ts
|
|
69309
70300
|
var import_inquirer2 = __toESM(require_inquirer(), 1);
|
|
69310
|
-
var
|
|
70301
|
+
var import_chalk8 = __toESM(require_source(), 1);
|
|
69311
70302
|
async function mockApis() {
|
|
69312
70303
|
logger.title(WELCOME_MESSAGE);
|
|
69313
70304
|
logger.info(SUBTITLE);
|
|
@@ -69346,7 +70337,7 @@ async function mockApis() {
|
|
|
69346
70337
|
{
|
|
69347
70338
|
type: "list",
|
|
69348
70339
|
name: "category",
|
|
69349
|
-
message:
|
|
70340
|
+
message: import_chalk8.default.green("Select categories :"),
|
|
69350
70341
|
choices: [
|
|
69351
70342
|
"posts",
|
|
69352
70343
|
"ecommerce/store",
|
|
@@ -69361,7 +70352,7 @@ async function mockApis() {
|
|
|
69361
70352
|
{
|
|
69362
70353
|
type: "list",
|
|
69363
70354
|
name: "method",
|
|
69364
|
-
message:
|
|
70355
|
+
message: import_chalk8.default.green("Select HTTP method:"),
|
|
69365
70356
|
choices: ["GET", "POST", "PUT", "DELETE"]
|
|
69366
70357
|
}
|
|
69367
70358
|
]);
|
|
@@ -69407,7 +70398,7 @@ async function mockApis() {
|
|
|
69407
70398
|
|
|
69408
70399
|
// src/index.ts
|
|
69409
70400
|
var program2 = new Command;
|
|
69410
|
-
program2.version("1.3.
|
|
70401
|
+
program2.version("1.3.7").description(import_chalk9.default.yellow("PostBoy CLI - Test your APIs with ease"));
|
|
69411
70402
|
program2.command("run").description("Run a test API request").action(testCommand);
|
|
69412
70403
|
program2.command("mock-list").description("List the mock API servers").action(mockApis);
|
|
69413
70404
|
program2.command("ui").description("UI for PostBoy").action(uiCommand);
|