create-absolutejs 0.2.1 → 0.2.2
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/index.js +70 -70
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -188,14 +188,14 @@ var W = { exports: {} };
|
|
|
188
188
|
return i;
|
|
189
189
|
}, u.slice = function(F, s, i) {
|
|
190
190
|
textLen = u.length(F), s = s || 0, i = i || 1, s < 0 && (s = textLen + s), i < 0 && (i = textLen + i);
|
|
191
|
-
for (var D = "",
|
|
191
|
+
for (var D = "", C = 0, n = t(F), E = 0;E < n.length; E++) {
|
|
192
192
|
var a = n[E], o = u.length(a);
|
|
193
|
-
if (
|
|
194
|
-
if (
|
|
193
|
+
if (C >= s - (o == 2 ? 1 : 0))
|
|
194
|
+
if (C + o <= i)
|
|
195
195
|
D += a;
|
|
196
196
|
else
|
|
197
197
|
break;
|
|
198
|
-
|
|
198
|
+
C += o;
|
|
199
199
|
}
|
|
200
200
|
return D;
|
|
201
201
|
};
|
|
@@ -234,19 +234,19 @@ var w = 10;
|
|
|
234
234
|
var N = (e = 0) => (u) => `\x1B[${u + e}m`;
|
|
235
235
|
var I = (e = 0) => (u) => `\x1B[${38 + e};5;${u}m`;
|
|
236
236
|
var R = (e = 0) => (u, t, F) => `\x1B[${38 + e};2;${u};${t};${F}m`;
|
|
237
|
-
var
|
|
238
|
-
Object.keys(
|
|
239
|
-
var iD = Object.keys(
|
|
240
|
-
var
|
|
237
|
+
var r = { modifier: { reset: [0, 0], bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], overline: [53, 55], inverse: [7, 27], hidden: [8, 28], strikethrough: [9, 29] }, color: { black: [30, 39], red: [31, 39], green: [32, 39], yellow: [33, 39], blue: [34, 39], magenta: [35, 39], cyan: [36, 39], white: [37, 39], blackBright: [90, 39], gray: [90, 39], grey: [90, 39], redBright: [91, 39], greenBright: [92, 39], yellowBright: [93, 39], blueBright: [94, 39], magentaBright: [95, 39], cyanBright: [96, 39], whiteBright: [97, 39] }, bgColor: { bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], bgYellow: [43, 49], bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], bgWhite: [47, 49], bgBlackBright: [100, 49], bgGray: [100, 49], bgGrey: [100, 49], bgRedBright: [101, 49], bgGreenBright: [102, 49], bgYellowBright: [103, 49], bgBlueBright: [104, 49], bgMagentaBright: [105, 49], bgCyanBright: [106, 49], bgWhiteBright: [107, 49] } };
|
|
238
|
+
Object.keys(r.modifier);
|
|
239
|
+
var iD = Object.keys(r.color);
|
|
240
|
+
var CD = Object.keys(r.bgColor);
|
|
241
241
|
[...iD];
|
|
242
|
-
function
|
|
242
|
+
function rD() {
|
|
243
243
|
const e = new Map;
|
|
244
|
-
for (const [u, t] of Object.entries(
|
|
244
|
+
for (const [u, t] of Object.entries(r)) {
|
|
245
245
|
for (const [F, s] of Object.entries(t))
|
|
246
|
-
|
|
247
|
-
Object.defineProperty(
|
|
246
|
+
r[F] = { open: `\x1B[${s[0]}m`, close: `\x1B[${s[1]}m` }, t[F] = r[F], e.set(s[0], s[1]);
|
|
247
|
+
Object.defineProperty(r, u, { value: t, enumerable: false });
|
|
248
248
|
}
|
|
249
|
-
return Object.defineProperty(
|
|
249
|
+
return Object.defineProperty(r, "codes", { value: e, enumerable: false }), r.color.close = "\x1B[39m", r.bgColor.close = "\x1B[49m", r.color.ansi = N(), r.color.ansi256 = I(), r.color.ansi16m = R(), r.bgColor.ansi = N(w), r.bgColor.ansi256 = I(w), r.bgColor.ansi16m = R(w), Object.defineProperties(r, { rgbToAnsi256: { value: (u, t, F) => u === t && t === F ? u < 8 ? 16 : u > 248 ? 231 : Math.round((u - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u / 255 * 5) + 6 * Math.round(t / 255 * 5) + Math.round(F / 255 * 5), enumerable: false }, hexToRgb: { value: (u) => {
|
|
250
250
|
const t = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));
|
|
251
251
|
if (!t)
|
|
252
252
|
return [0, 0, 0];
|
|
@@ -254,7 +254,7 @@ function CD() {
|
|
|
254
254
|
F.length === 3 && (F = [...F].map((i) => i + i).join(""));
|
|
255
255
|
const s = Number.parseInt(F, 16);
|
|
256
256
|
return [s >> 16 & 255, s >> 8 & 255, s & 255];
|
|
257
|
-
}, enumerable: false }, hexToAnsi256: { value: (u) =>
|
|
257
|
+
}, enumerable: false }, hexToAnsi256: { value: (u) => r.rgbToAnsi256(...r.hexToRgb(u)), enumerable: false }, ansi256ToAnsi: { value: (u) => {
|
|
258
258
|
if (u < 8)
|
|
259
259
|
return 30 + u;
|
|
260
260
|
if (u < 16)
|
|
@@ -264,17 +264,17 @@ function CD() {
|
|
|
264
264
|
t = ((u - 232) * 10 + 8) / 255, F = t, s = t;
|
|
265
265
|
else {
|
|
266
266
|
u -= 16;
|
|
267
|
-
const
|
|
268
|
-
t = Math.floor(u / 36) / 5, F = Math.floor(
|
|
267
|
+
const C = u % 36;
|
|
268
|
+
t = Math.floor(u / 36) / 5, F = Math.floor(C / 6) / 5, s = C % 6 / 5;
|
|
269
269
|
}
|
|
270
270
|
const i = Math.max(t, F, s) * 2;
|
|
271
271
|
if (i === 0)
|
|
272
272
|
return 30;
|
|
273
273
|
let D = 30 + (Math.round(s) << 2 | Math.round(F) << 1 | Math.round(t));
|
|
274
274
|
return i === 2 && (D += 60), D;
|
|
275
|
-
}, enumerable: false }, rgbToAnsi: { value: (u, t, F) =>
|
|
275
|
+
}, enumerable: false }, rgbToAnsi: { value: (u, t, F) => r.ansi256ToAnsi(r.rgbToAnsi256(u, t, F)), enumerable: false }, hexToAnsi: { value: (u) => r.ansi256ToAnsi(r.hexToAnsi256(u)), enumerable: false } }), r;
|
|
276
276
|
}
|
|
277
|
-
var ED =
|
|
277
|
+
var ED = rD();
|
|
278
278
|
var d = new Set(["\x1B", ""]);
|
|
279
279
|
var oD = 39;
|
|
280
280
|
var y = "\x07";
|
|
@@ -288,13 +288,13 @@ var aD = (e) => e.split(" ").map((u) => p(u));
|
|
|
288
288
|
var k = (e, u, t) => {
|
|
289
289
|
const F = [...u];
|
|
290
290
|
let s = false, i = false, D = p(P(e[e.length - 1]));
|
|
291
|
-
for (const [
|
|
291
|
+
for (const [C, n] of F.entries()) {
|
|
292
292
|
const E = p(n);
|
|
293
|
-
if (D + E <= t ? e[e.length - 1] += n : (e.push(n), D = 0), d.has(n) && (s = true, i = F.slice(
|
|
293
|
+
if (D + E <= t ? e[e.length - 1] += n : (e.push(n), D = 0), d.has(n) && (s = true, i = F.slice(C + 1).join("").startsWith(_)), s) {
|
|
294
294
|
i ? n === y && (s = false, i = false) : n === G && (s = false);
|
|
295
295
|
continue;
|
|
296
296
|
}
|
|
297
|
-
D += E, D === t &&
|
|
297
|
+
D += E, D === t && C < F.length - 1 && (e.push(""), D = 0);
|
|
298
298
|
}
|
|
299
299
|
!D && e[e.length - 1].length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
|
|
300
300
|
};
|
|
@@ -310,30 +310,30 @@ var lD = (e, u, t = {}) => {
|
|
|
310
310
|
return "";
|
|
311
311
|
let F = "", s, i;
|
|
312
312
|
const D = aD(e);
|
|
313
|
-
let
|
|
313
|
+
let C = [""];
|
|
314
314
|
for (const [E, a] of e.split(" ").entries()) {
|
|
315
|
-
t.trim !== false && (
|
|
316
|
-
let o = p(
|
|
317
|
-
if (E !== 0 && (o >= u && (t.wordWrap === false || t.trim === false) && (
|
|
315
|
+
t.trim !== false && (C[C.length - 1] = C[C.length - 1].trimStart());
|
|
316
|
+
let o = p(C[C.length - 1]);
|
|
317
|
+
if (E !== 0 && (o >= u && (t.wordWrap === false || t.trim === false) && (C.push(""), o = 0), (o > 0 || t.trim === false) && (C[C.length - 1] += " ", o++)), t.hard && D[E] > u) {
|
|
318
318
|
const c = u - o, f = 1 + Math.floor((D[E] - c - 1) / u);
|
|
319
|
-
Math.floor((D[E] - 1) / u) < f &&
|
|
319
|
+
Math.floor((D[E] - 1) / u) < f && C.push(""), k(C, a, u);
|
|
320
320
|
continue;
|
|
321
321
|
}
|
|
322
322
|
if (o + D[E] > u && o > 0 && D[E] > 0) {
|
|
323
323
|
if (t.wordWrap === false && o < u) {
|
|
324
|
-
k(
|
|
324
|
+
k(C, a, u);
|
|
325
325
|
continue;
|
|
326
326
|
}
|
|
327
|
-
|
|
327
|
+
C.push("");
|
|
328
328
|
}
|
|
329
329
|
if (o + D[E] > u && t.wordWrap === false) {
|
|
330
|
-
k(
|
|
330
|
+
k(C, a, u);
|
|
331
331
|
continue;
|
|
332
332
|
}
|
|
333
|
-
|
|
333
|
+
C[C.length - 1] += a;
|
|
334
334
|
}
|
|
335
|
-
t.trim !== false && (
|
|
336
|
-
const n = [...
|
|
335
|
+
t.trim !== false && (C = C.map((E) => hD(E)));
|
|
336
|
+
const n = [...C.join(`
|
|
337
337
|
`)];
|
|
338
338
|
for (const [E, a] of n.entries()) {
|
|
339
339
|
if (F += a, d.has(a)) {
|
|
@@ -389,15 +389,15 @@ function m(e, u) {
|
|
|
389
389
|
function fD({ input: e = j, output: u = M, overwrite: t = true, hideCursor: F = true } = {}) {
|
|
390
390
|
const s = g.createInterface({ input: e, output: u, prompt: "", tabSize: 1 });
|
|
391
391
|
g.emitKeypressEvents(e, s), e.isTTY && e.setRawMode(true);
|
|
392
|
-
const i = (D, { name:
|
|
392
|
+
const i = (D, { name: C, sequence: n }) => {
|
|
393
393
|
const E = String(D);
|
|
394
|
-
if ($([E,
|
|
394
|
+
if ($([E, C, n], "cancel")) {
|
|
395
395
|
F && u.write(import_sisteransi.cursor.show), process.exit(0);
|
|
396
396
|
return;
|
|
397
397
|
}
|
|
398
398
|
if (!t)
|
|
399
399
|
return;
|
|
400
|
-
const a =
|
|
400
|
+
const a = C === "return" ? 0 : -1, o = C === "return" ? -1 : 0;
|
|
401
401
|
g.moveCursor(u, a, o, () => {
|
|
402
402
|
g.clearLine(u, 1, () => {
|
|
403
403
|
e.once("keypress", i);
|
|
@@ -415,8 +415,8 @@ var h = (e, u, t) => (vD(e, typeof u != "symbol" ? u + "" : u, t), t);
|
|
|
415
415
|
class x {
|
|
416
416
|
constructor(u, t = true) {
|
|
417
417
|
h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", false), h(this, "_prevFrame", ""), h(this, "_subscribers", new Map), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
|
|
418
|
-
const { input: F = j, output: s = M, render: i, signal: D, ...
|
|
419
|
-
this.opts =
|
|
418
|
+
const { input: F = j, output: s = M, render: i, signal: D, ...C } = u;
|
|
419
|
+
this.opts = C, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i.bind(this), this._track = t, this._abortSignal = D, this.input = F, this.output = s;
|
|
420
420
|
}
|
|
421
421
|
unsubscribe() {
|
|
422
422
|
this._subscribers.clear();
|
|
@@ -459,7 +459,7 @@ class x {
|
|
|
459
459
|
}
|
|
460
460
|
onKeypress(u, t) {
|
|
461
461
|
if (this.state === "error" && (this.state = "active"), t?.name && (!this._track && B.aliases.has(t.name) && this.emit("cursor", B.aliases.get(t.name)), B.actions.has(t.name) && this.emit("cursor", t.name)), u && (u.toLowerCase() === "y" || u.toLowerCase() === "n") && this.emit("confirm", u.toLowerCase() === "y"), u === "\t" && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u && this.emit("key", u.toLowerCase()), t?.name === "return") {
|
|
462
|
-
if (
|
|
462
|
+
if (this.opts.validate) {
|
|
463
463
|
const F = this.opts.validate(this.value);
|
|
464
464
|
F && (this.error = F instanceof Error ? F.message : F, this.state = "error", this.rl?.write(this.value));
|
|
465
465
|
}
|
|
@@ -619,7 +619,7 @@ var u = (t, n) => V2 ? t : n;
|
|
|
619
619
|
var le = u("◆", "*");
|
|
620
620
|
var L2 = u("■", "x");
|
|
621
621
|
var W2 = u("▲", "x");
|
|
622
|
-
var
|
|
622
|
+
var C = u("◇", "o");
|
|
623
623
|
var ue = u("┌", "T");
|
|
624
624
|
var o = u("│", "|");
|
|
625
625
|
var d2 = u("└", "—");
|
|
@@ -886,7 +886,7 @@ var u2 = (t, n) => V3 ? t : n;
|
|
|
886
886
|
var le2 = u2("◆", "*");
|
|
887
887
|
var L3 = u2("■", "x");
|
|
888
888
|
var W3 = u2("▲", "x");
|
|
889
|
-
var
|
|
889
|
+
var C2 = u2("◇", "o");
|
|
890
890
|
var ue2 = u2("┌", "T");
|
|
891
891
|
var o2 = u2("│", "|");
|
|
892
892
|
var d3 = u2("└", "—");
|
|
@@ -914,15 +914,15 @@ var b2 = (t) => {
|
|
|
914
914
|
case "error":
|
|
915
915
|
return import_picocolors5.default.yellow(W3);
|
|
916
916
|
case "submit":
|
|
917
|
-
return import_picocolors5.default.green(
|
|
917
|
+
return import_picocolors5.default.green(C2);
|
|
918
918
|
}
|
|
919
919
|
};
|
|
920
920
|
var G2 = (t) => {
|
|
921
|
-
const { cursor: n, options:
|
|
921
|
+
const { cursor: n, options: r2, style: i } = t, s = t.maxItems ?? Number.POSITIVE_INFINITY, c = Math.max(process.stdout.rows - 4, 0), a = Math.min(c, Math.max(s, 5));
|
|
922
922
|
let l2 = 0;
|
|
923
|
-
n >= l2 + a - 3 ? l2 = Math.max(Math.min(n - a + 3,
|
|
924
|
-
const $2 = a <
|
|
925
|
-
return
|
|
923
|
+
n >= l2 + a - 3 ? l2 = Math.max(Math.min(n - a + 3, r2.length - a), 0) : n < l2 + 2 && (l2 = Math.max(n - 2, 0));
|
|
924
|
+
const $2 = a < r2.length && l2 > 0, g2 = a < r2.length && l2 + a < r2.length;
|
|
925
|
+
return r2.slice(l2, l2 + a).map((p2, v2, f) => {
|
|
926
926
|
const j2 = v2 === 0 && $2, E = v2 === f.length - 1 && g2;
|
|
927
927
|
return j2 || E ? import_picocolors5.default.dim("...") : i(p2, v2 + l2 === n);
|
|
928
928
|
});
|
|
@@ -930,7 +930,7 @@ var G2 = (t) => {
|
|
|
930
930
|
var he = (t) => new RD({ validate: t.validate, placeholder: t.placeholder, defaultValue: t.defaultValue, initialValue: t.initialValue, render() {
|
|
931
931
|
const n = `${import_picocolors5.default.gray(o2)}
|
|
932
932
|
${b2(this.state)} ${t.message}
|
|
933
|
-
`,
|
|
933
|
+
`, r2 = t.placeholder ? import_picocolors5.default.inverse(t.placeholder[0]) + import_picocolors5.default.dim(t.placeholder.slice(1)) : import_picocolors5.default.inverse(import_picocolors5.default.hidden("_")), i = this.value ? this.valueWithCursor : r2;
|
|
934
934
|
switch (this.state) {
|
|
935
935
|
case "error":
|
|
936
936
|
return `${n.trim()}
|
|
@@ -949,11 +949,11 @@ ${import_picocolors5.default.cyan(d3)}
|
|
|
949
949
|
}
|
|
950
950
|
} }).prompt();
|
|
951
951
|
var ye = (t) => {
|
|
952
|
-
const n = t.active ?? "Yes",
|
|
953
|
-
return new dD({ active: n, inactive:
|
|
952
|
+
const n = t.active ?? "Yes", r2 = t.inactive ?? "No";
|
|
953
|
+
return new dD({ active: n, inactive: r2, initialValue: t.initialValue ?? true, render() {
|
|
954
954
|
const i = `${import_picocolors5.default.gray(o2)}
|
|
955
955
|
${b2(this.state)} ${t.message}
|
|
956
|
-
`, s = this.value ? n :
|
|
956
|
+
`, s = this.value ? n : r2;
|
|
957
957
|
switch (this.state) {
|
|
958
958
|
case "submit":
|
|
959
959
|
return `${i}${import_picocolors5.default.gray(o2)} ${import_picocolors5.default.dim(s)}`;
|
|
@@ -961,20 +961,20 @@ ${b2(this.state)} ${t.message}
|
|
|
961
961
|
return `${i}${import_picocolors5.default.gray(o2)} ${import_picocolors5.default.strikethrough(import_picocolors5.default.dim(s))}
|
|
962
962
|
${import_picocolors5.default.gray(o2)}`;
|
|
963
963
|
default:
|
|
964
|
-
return `${i}${import_picocolors5.default.cyan(o2)} ${this.value ? `${import_picocolors5.default.green(k3)} ${n}` : `${import_picocolors5.default.dim(P3)} ${import_picocolors5.default.dim(n)}`} ${import_picocolors5.default.dim("/")} ${this.value ? `${import_picocolors5.default.dim(P3)} ${import_picocolors5.default.dim(
|
|
964
|
+
return `${i}${import_picocolors5.default.cyan(o2)} ${this.value ? `${import_picocolors5.default.green(k3)} ${n}` : `${import_picocolors5.default.dim(P3)} ${import_picocolors5.default.dim(n)}`} ${import_picocolors5.default.dim("/")} ${this.value ? `${import_picocolors5.default.dim(P3)} ${import_picocolors5.default.dim(r2)}` : `${import_picocolors5.default.green(k3)} ${r2}`}
|
|
965
965
|
${import_picocolors5.default.cyan(d3)}
|
|
966
966
|
`;
|
|
967
967
|
}
|
|
968
968
|
} }).prompt();
|
|
969
969
|
};
|
|
970
970
|
var ve = (t) => {
|
|
971
|
-
const n = (
|
|
972
|
-
const s =
|
|
971
|
+
const n = (r2, i) => {
|
|
972
|
+
const s = r2.label ?? String(r2.value);
|
|
973
973
|
switch (i) {
|
|
974
974
|
case "selected":
|
|
975
975
|
return `${import_picocolors5.default.dim(s)}`;
|
|
976
976
|
case "active":
|
|
977
|
-
return `${import_picocolors5.default.green(k3)} ${s} ${
|
|
977
|
+
return `${import_picocolors5.default.green(k3)} ${s} ${r2.hint ? import_picocolors5.default.dim(`(${r2.hint})`) : ""}`;
|
|
978
978
|
case "cancelled":
|
|
979
979
|
return `${import_picocolors5.default.strikethrough(import_picocolors5.default.dim(s))}`;
|
|
980
980
|
default:
|
|
@@ -982,17 +982,17 @@ var ve = (t) => {
|
|
|
982
982
|
}
|
|
983
983
|
};
|
|
984
984
|
return new LD({ options: t.options, initialValue: t.initialValue, render() {
|
|
985
|
-
const
|
|
985
|
+
const r2 = `${import_picocolors5.default.gray(o2)}
|
|
986
986
|
${b2(this.state)} ${t.message}
|
|
987
987
|
`;
|
|
988
988
|
switch (this.state) {
|
|
989
989
|
case "submit":
|
|
990
|
-
return `${
|
|
990
|
+
return `${r2}${import_picocolors5.default.gray(o2)} ${n(this.options[this.cursor], "selected")}`;
|
|
991
991
|
case "cancel":
|
|
992
|
-
return `${
|
|
992
|
+
return `${r2}${import_picocolors5.default.gray(o2)} ${n(this.options[this.cursor], "cancelled")}
|
|
993
993
|
${import_picocolors5.default.gray(o2)}`;
|
|
994
994
|
default:
|
|
995
|
-
return `${
|
|
995
|
+
return `${r2}${import_picocolors5.default.cyan(o2)} ${G2({ cursor: this.cursor, options: this.options, maxItems: t.maxItems, style: (i, s) => n(i, s ? "active" : "inactive") }).join(`
|
|
996
996
|
${import_picocolors5.default.cyan(o2)} `)}
|
|
997
997
|
${import_picocolors5.default.cyan(d3)}
|
|
998
998
|
`;
|
|
@@ -1000,16 +1000,16 @@ ${import_picocolors5.default.cyan(d3)}
|
|
|
1000
1000
|
} }).prompt();
|
|
1001
1001
|
};
|
|
1002
1002
|
var fe = (t) => {
|
|
1003
|
-
const n = (
|
|
1004
|
-
const s =
|
|
1005
|
-
return i === "active" ? `${import_picocolors5.default.cyan(A3)} ${s} ${
|
|
1003
|
+
const n = (r2, i) => {
|
|
1004
|
+
const s = r2.label ?? String(r2.value);
|
|
1005
|
+
return i === "active" ? `${import_picocolors5.default.cyan(A3)} ${s} ${r2.hint ? import_picocolors5.default.dim(`(${r2.hint})`) : ""}` : i === "selected" ? `${import_picocolors5.default.green(T2)} ${import_picocolors5.default.dim(s)} ${r2.hint ? import_picocolors5.default.dim(`(${r2.hint})`) : ""}` : i === "cancelled" ? `${import_picocolors5.default.strikethrough(import_picocolors5.default.dim(s))}` : i === "active-selected" ? `${import_picocolors5.default.green(T2)} ${s} ${r2.hint ? import_picocolors5.default.dim(`(${r2.hint})`) : ""}` : i === "submitted" ? `${import_picocolors5.default.dim(s)}` : `${import_picocolors5.default.dim(F2)} ${import_picocolors5.default.dim(s)}`;
|
|
1006
1006
|
};
|
|
1007
|
-
return new SD({ options: t.options, initialValues: t.initialValues, required: t.required ?? true, cursorAt: t.cursorAt, validate(
|
|
1008
|
-
if (this.required &&
|
|
1007
|
+
return new SD({ options: t.options, initialValues: t.initialValues, required: t.required ?? true, cursorAt: t.cursorAt, validate(r2) {
|
|
1008
|
+
if (this.required && r2.length === 0)
|
|
1009
1009
|
return `Please select at least one option.
|
|
1010
1010
|
${import_picocolors5.default.reset(import_picocolors5.default.dim(`Press ${import_picocolors5.default.gray(import_picocolors5.default.bgWhite(import_picocolors5.default.inverse(" space ")))} to select, ${import_picocolors5.default.gray(import_picocolors5.default.bgWhite(import_picocolors5.default.inverse(" enter ")))} to submit`))}`;
|
|
1011
1011
|
}, render() {
|
|
1012
|
-
const
|
|
1012
|
+
const r2 = `${import_picocolors5.default.gray(o2)}
|
|
1013
1013
|
${b2(this.state)} ${t.message}
|
|
1014
1014
|
`, i = (s, c) => {
|
|
1015
1015
|
const a = this.value.includes(s.value);
|
|
@@ -1017,23 +1017,23 @@ ${b2(this.state)} ${t.message}
|
|
|
1017
1017
|
};
|
|
1018
1018
|
switch (this.state) {
|
|
1019
1019
|
case "submit":
|
|
1020
|
-
return `${
|
|
1020
|
+
return `${r2}${import_picocolors5.default.gray(o2)} ${this.options.filter(({ value: s }) => this.value.includes(s)).map((s) => n(s, "submitted")).join(import_picocolors5.default.dim(", ")) || import_picocolors5.default.dim("none")}`;
|
|
1021
1021
|
case "cancel": {
|
|
1022
1022
|
const s = this.options.filter(({ value: c }) => this.value.includes(c)).map((c) => n(c, "cancelled")).join(import_picocolors5.default.dim(", "));
|
|
1023
|
-
return `${
|
|
1023
|
+
return `${r2}${import_picocolors5.default.gray(o2)} ${s.trim() ? `${s}
|
|
1024
1024
|
${import_picocolors5.default.gray(o2)}` : ""}`;
|
|
1025
1025
|
}
|
|
1026
1026
|
case "error": {
|
|
1027
1027
|
const s = this.error.split(`
|
|
1028
1028
|
`).map((c, a) => a === 0 ? `${import_picocolors5.default.yellow(d3)} ${import_picocolors5.default.yellow(c)}` : ` ${c}`).join(`
|
|
1029
1029
|
`);
|
|
1030
|
-
return `${
|
|
1030
|
+
return `${r2 + import_picocolors5.default.yellow(o2)} ${G2({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
|
|
1031
1031
|
${import_picocolors5.default.yellow(o2)} `)}
|
|
1032
1032
|
${s}
|
|
1033
1033
|
`;
|
|
1034
1034
|
}
|
|
1035
1035
|
default:
|
|
1036
|
-
return `${
|
|
1036
|
+
return `${r2}${import_picocolors5.default.cyan(o2)} ${G2({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
|
|
1037
1037
|
${import_picocolors5.default.cyan(o2)} `)}
|
|
1038
1038
|
${import_picocolors5.default.cyan(d3)}
|
|
1039
1039
|
`;
|
|
@@ -1047,7 +1047,7 @@ var xe = (t = "") => {
|
|
|
1047
1047
|
};
|
|
1048
1048
|
var J3 = `${import_picocolors5.default.gray(o2)} `;
|
|
1049
1049
|
var Y2 = ({ indicator: t = "dots" } = {}) => {
|
|
1050
|
-
const n = V3 ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"],
|
|
1050
|
+
const n = V3 ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"], r2 = V3 ? 80 : 120, i = process.env.CI === "true";
|
|
1051
1051
|
let s, c, a = false, l2 = "", $2, g2 = performance.now();
|
|
1052
1052
|
const p2 = (m2) => {
|
|
1053
1053
|
const h2 = m2 > 1 ? "Something went wrong" : "Canceled";
|
|
@@ -1085,10 +1085,10 @@ var Y2 = ({ indicator: t = "dots" } = {}) => {
|
|
|
1085
1085
|
process.stdout.write(`${I2} ${l2}${z2}`);
|
|
1086
1086
|
}
|
|
1087
1087
|
h2 = h2 + 1 < n.length ? h2 + 1 : 0, w2 = w2 < n.length ? w2 + 0.125 : 0;
|
|
1088
|
-
},
|
|
1088
|
+
}, r2);
|
|
1089
1089
|
}, N2 = (m2 = "", h2 = 0) => {
|
|
1090
1090
|
a = false, clearInterval(c), B2();
|
|
1091
|
-
const w2 = h2 === 0 ? import_picocolors5.default.green(
|
|
1091
|
+
const w2 = h2 === 0 ? import_picocolors5.default.green(C2) : h2 === 1 ? import_picocolors5.default.red(L3) : import_picocolors5.default.red(W3);
|
|
1092
1092
|
l2 = R2(m2 ?? l2), t === "timer" ? process.stdout.write(`${w2} ${l2} ${O2(g2)}
|
|
1093
1093
|
`) : process.stdout.write(`${w2} ${l2}
|
|
1094
1094
|
`), E(), s();
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"create-absolutejs": "dist/index.js"
|
|
5
5
|
},
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@clack/prompts": "0.
|
|
7
|
+
"@clack/prompts": "0.11.0",
|
|
8
8
|
"picocolors": "1.1.1"
|
|
9
9
|
},
|
|
10
10
|
"description": "A CLI tool to create a new AbsoluteJS project",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"typecheck": "bun run tsc --noEmit"
|
|
47
47
|
},
|
|
48
48
|
"type": "module",
|
|
49
|
-
"version": "0.2.
|
|
49
|
+
"version": "0.2.2"
|
|
50
50
|
}
|