@rotorsoft/act-diagram 1.1.2 → 1.1.4
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/.tsbuildinfo +1 -1
- package/dist/cli/act.js +101 -79
- package/dist/cli/act.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +8 -8
package/dist/cli/act.js
CHANGED
|
@@ -111,16 +111,16 @@ var require_src = __commonJS({
|
|
|
111
111
|
var CSI2 = `${ESC3}[`;
|
|
112
112
|
var beep = "\x07";
|
|
113
113
|
var cursor3 = {
|
|
114
|
-
to(x,
|
|
115
|
-
if (!
|
|
116
|
-
return `${CSI2}${
|
|
114
|
+
to(x, y2) {
|
|
115
|
+
if (!y2) return `${CSI2}${x + 1}G`;
|
|
116
|
+
return `${CSI2}${y2 + 1};${x + 1}H`;
|
|
117
117
|
},
|
|
118
|
-
move(x,
|
|
118
|
+
move(x, y2) {
|
|
119
119
|
let ret = "";
|
|
120
120
|
if (x < 0) ret += `${CSI2}${-x}D`;
|
|
121
121
|
else if (x > 0) ret += `${CSI2}${x}C`;
|
|
122
|
-
if (
|
|
123
|
-
else if (
|
|
122
|
+
if (y2 < 0) ret += `${CSI2}${-y2}A`;
|
|
123
|
+
else if (y2 > 0) ret += `${CSI2}${y2}B`;
|
|
124
124
|
return ret;
|
|
125
125
|
},
|
|
126
126
|
up: (count = 1) => `${CSI2}${count}A`,
|
|
@@ -2248,7 +2248,7 @@ function format_markdown(idx) {
|
|
|
2248
2248
|
import { writeFile } from "fs/promises";
|
|
2249
2249
|
import { resolve as resolve3 } from "path";
|
|
2250
2250
|
|
|
2251
|
-
// ../../node_modules/.pnpm/@clack+core@1.
|
|
2251
|
+
// ../../node_modules/.pnpm/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs
|
|
2252
2252
|
import { styleText } from "util";
|
|
2253
2253
|
import { stdout, stdin } from "process";
|
|
2254
2254
|
import * as l from "readline";
|
|
@@ -2590,7 +2590,7 @@ function wrapAnsi(string, columns, options) {
|
|
|
2590
2590
|
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
2591
2591
|
}
|
|
2592
2592
|
|
|
2593
|
-
// ../../node_modules/.pnpm/@clack+core@1.
|
|
2593
|
+
// ../../node_modules/.pnpm/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs
|
|
2594
2594
|
var import_sisteransi = __toESM(require_src(), 1);
|
|
2595
2595
|
import { ReadStream } from "tty";
|
|
2596
2596
|
function findCursor(s, o, l2) {
|
|
@@ -2631,6 +2631,7 @@ var settings = {
|
|
|
2631
2631
|
error: "Something went wrong"
|
|
2632
2632
|
},
|
|
2633
2633
|
withGuide: true,
|
|
2634
|
+
accessible: void 0,
|
|
2634
2635
|
date: {
|
|
2635
2636
|
monthNames: [...t],
|
|
2636
2637
|
messages: {
|
|
@@ -2642,6 +2643,12 @@ var settings = {
|
|
|
2642
2643
|
}
|
|
2643
2644
|
}
|
|
2644
2645
|
};
|
|
2646
|
+
function isAccessible(n3) {
|
|
2647
|
+
if (n3 !== void 0) return n3;
|
|
2648
|
+
if (settings.accessible !== void 0) return settings.accessible;
|
|
2649
|
+
const e = process.env.ACCESSIBLE;
|
|
2650
|
+
return e !== void 0 && e !== "" && e !== "0" && e !== "false";
|
|
2651
|
+
}
|
|
2645
2652
|
function isActionKey(n3, e) {
|
|
2646
2653
|
if (typeof n3 == "string")
|
|
2647
2654
|
return settings.aliases.get(n3) === e;
|
|
@@ -2675,30 +2682,26 @@ function setRawMode(e, r2) {
|
|
|
2675
2682
|
}
|
|
2676
2683
|
var getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
|
|
2677
2684
|
var getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
|
|
2678
|
-
function wrapTextWithPrefix(e, r2, o,
|
|
2685
|
+
function wrapTextWithPrefix(e, r2, o, n3 = o, s = o, t2) {
|
|
2679
2686
|
const f = getColumns(e ?? stdout);
|
|
2680
2687
|
return wrapAnsi(r2, f - o.length, {
|
|
2681
2688
|
hard: true,
|
|
2682
2689
|
trim: false
|
|
2683
2690
|
}).split(`
|
|
2684
2691
|
`).map((c2, i2, m) => {
|
|
2685
|
-
const d =
|
|
2686
|
-
return i2 === 0 ? `${
|
|
2692
|
+
const d = t2 ? t2(c2, i2) : c2;
|
|
2693
|
+
return i2 === 0 ? `${n3}${d}` : i2 === m.length - 1 ? `${s}${d}` : `${o}${d}`;
|
|
2687
2694
|
}).join(`
|
|
2688
2695
|
`);
|
|
2689
2696
|
}
|
|
2690
|
-
function runValidation(e,
|
|
2697
|
+
function runValidation(e, a2) {
|
|
2691
2698
|
if ("~standard" in e) {
|
|
2692
|
-
const
|
|
2693
|
-
|
|
2694
|
-
throw new TypeError(
|
|
2695
|
-
"Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic."
|
|
2696
|
-
);
|
|
2697
|
-
return a2.issues?.at(0)?.message;
|
|
2699
|
+
const n3 = e["~standard"].validate(a2);
|
|
2700
|
+
return n3 instanceof Promise ? n3.then((r2) => r2.issues?.at(0)?.message) : n3.issues?.at(0)?.message;
|
|
2698
2701
|
}
|
|
2699
|
-
return e(
|
|
2702
|
+
return e(a2);
|
|
2700
2703
|
}
|
|
2701
|
-
var
|
|
2704
|
+
var y = class {
|
|
2702
2705
|
input;
|
|
2703
2706
|
output;
|
|
2704
2707
|
_abortSignal;
|
|
@@ -2713,9 +2716,17 @@ var V = class {
|
|
|
2713
2716
|
error = "";
|
|
2714
2717
|
value;
|
|
2715
2718
|
userInput = "";
|
|
2719
|
+
/**
|
|
2720
|
+
* Whether accessible (static, screen-reader friendly) output is enabled for
|
|
2721
|
+
* this prompt, resolved from the `accessible` option, the global setting,
|
|
2722
|
+
* and the `ACCESSIBLE` env var.
|
|
2723
|
+
*/
|
|
2724
|
+
get accessible() {
|
|
2725
|
+
return isAccessible(this.opts.accessible);
|
|
2726
|
+
}
|
|
2716
2727
|
constructor(t2, e = true) {
|
|
2717
|
-
const { input: i2 = stdin, output:
|
|
2718
|
-
this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render =
|
|
2728
|
+
const { input: i2 = stdin, output: s = stdout, render: r2, signal: n3, ...o } = t2;
|
|
2729
|
+
this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = r2.bind(this), this._track = e, this._abortSignal = n3, this.input = i2, this.output = s;
|
|
2719
2730
|
}
|
|
2720
2731
|
/**
|
|
2721
2732
|
* Unsubscribe all listeners
|
|
@@ -2753,11 +2764,11 @@ var V = class {
|
|
|
2753
2764
|
* @param data - The data to pass to the callback
|
|
2754
2765
|
*/
|
|
2755
2766
|
emit(t2, ...e) {
|
|
2756
|
-
const i2 = this._subscribers.get(t2) ?? [],
|
|
2757
|
-
for (const
|
|
2758
|
-
|
|
2759
|
-
for (const
|
|
2760
|
-
|
|
2767
|
+
const i2 = this._subscribers.get(t2) ?? [], s = [];
|
|
2768
|
+
for (const r2 of i2)
|
|
2769
|
+
r2.cb(...e), r2.once && s.push(() => i2.splice(i2.indexOf(r2), 1));
|
|
2770
|
+
for (const r2 of s)
|
|
2771
|
+
r2();
|
|
2761
2772
|
}
|
|
2762
2773
|
prompt() {
|
|
2763
2774
|
return new Promise((t2) => {
|
|
@@ -2800,15 +2811,18 @@ var V = class {
|
|
|
2800
2811
|
_clearUserInput() {
|
|
2801
2812
|
this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
|
|
2802
2813
|
}
|
|
2803
|
-
onKeypress(t2, e) {
|
|
2804
|
-
if (this.
|
|
2805
|
-
if (this.
|
|
2806
|
-
|
|
2807
|
-
|
|
2814
|
+
async onKeypress(t2, e) {
|
|
2815
|
+
if (this.state !== "validating") {
|
|
2816
|
+
if (this._track && e.name !== "return" && (e.name && this._isActionKey(t2, e) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t2 && (t2.toLowerCase() === "y" || t2.toLowerCase() === "n") && this.emit("confirm", t2.toLowerCase() === "y"), this.emit("key", t2, e), e?.name === "return" && this._shouldSubmit(t2, e)) {
|
|
2817
|
+
if (this.opts.validate) {
|
|
2818
|
+
const i2 = runValidation(this.opts.validate, this.value);
|
|
2819
|
+
let s;
|
|
2820
|
+
i2 instanceof Promise ? (this.state = "validating", this.render(), s = await i2) : s = i2, s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
|
|
2821
|
+
}
|
|
2822
|
+
this.state !== "error" && (this.state = "submit");
|
|
2808
2823
|
}
|
|
2809
|
-
this.state
|
|
2824
|
+
isActionKey([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
2810
2825
|
}
|
|
2811
|
-
isActionKey([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
2812
2826
|
}
|
|
2813
2827
|
close() {
|
|
2814
2828
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
@@ -2830,28 +2844,28 @@ var V = class {
|
|
|
2830
2844
|
else {
|
|
2831
2845
|
const e = diffLines(this._prevFrame, t2), i2 = getRows(this.output);
|
|
2832
2846
|
if (this.restoreCursor(), e) {
|
|
2833
|
-
const
|
|
2834
|
-
let
|
|
2835
|
-
if (
|
|
2847
|
+
const s = Math.max(0, e.numLinesAfter - i2), r2 = Math.max(0, e.numLinesBefore - i2);
|
|
2848
|
+
let n3 = e.lines.find((o) => o >= s);
|
|
2849
|
+
if (n3 === void 0) {
|
|
2836
2850
|
this._prevFrame = t2;
|
|
2837
2851
|
return;
|
|
2838
2852
|
}
|
|
2839
2853
|
if (e.lines.length === 1) {
|
|
2840
|
-
this.output.write(import_sisteransi.cursor.move(0,
|
|
2854
|
+
this.output.write(import_sisteransi.cursor.move(0, n3 - r2)), this.output.write(import_sisteransi.erase.lines(1));
|
|
2841
2855
|
const o = t2.split(`
|
|
2842
2856
|
`);
|
|
2843
|
-
this.output.write(o[
|
|
2857
|
+
this.output.write(o[n3]), this._prevFrame = t2, this.output.write(import_sisteransi.cursor.move(0, o.length - n3 - 1));
|
|
2844
2858
|
return;
|
|
2845
2859
|
} else if (e.lines.length > 1) {
|
|
2846
|
-
if (
|
|
2847
|
-
|
|
2860
|
+
if (s < r2)
|
|
2861
|
+
n3 = s;
|
|
2848
2862
|
else {
|
|
2849
|
-
const h2 =
|
|
2863
|
+
const h2 = n3 - r2;
|
|
2850
2864
|
h2 > 0 && this.output.write(import_sisteransi.cursor.move(0, h2));
|
|
2851
2865
|
}
|
|
2852
2866
|
this.output.write(import_sisteransi.erase.down());
|
|
2853
2867
|
const f = t2.split(`
|
|
2854
|
-
`).slice(
|
|
2868
|
+
`).slice(n3);
|
|
2855
2869
|
this.output.write(f.join(`
|
|
2856
2870
|
`)), this._prevFrame = t2;
|
|
2857
2871
|
return;
|
|
@@ -2863,7 +2877,7 @@ var V = class {
|
|
|
2863
2877
|
}
|
|
2864
2878
|
}
|
|
2865
2879
|
};
|
|
2866
|
-
var n$1 = class n extends
|
|
2880
|
+
var n$1 = class n extends y {
|
|
2867
2881
|
options;
|
|
2868
2882
|
cursor = 0;
|
|
2869
2883
|
get _selectedValue() {
|
|
@@ -2891,7 +2905,7 @@ var n$1 = class n extends V {
|
|
|
2891
2905
|
});
|
|
2892
2906
|
}
|
|
2893
2907
|
};
|
|
2894
|
-
var n2 = class extends
|
|
2908
|
+
var n2 = class extends y {
|
|
2895
2909
|
get userInputWithCursor() {
|
|
2896
2910
|
if (this.state === "submit")
|
|
2897
2911
|
return this.userInput;
|
|
@@ -2916,7 +2930,7 @@ var n2 = class extends V {
|
|
|
2916
2930
|
}
|
|
2917
2931
|
};
|
|
2918
2932
|
|
|
2919
|
-
// ../../node_modules/.pnpm/@clack+prompts@1.
|
|
2933
|
+
// ../../node_modules/.pnpm/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs
|
|
2920
2934
|
import { styleText as styleText2, stripVTControlCharacters } from "util";
|
|
2921
2935
|
import process$1 from "process";
|
|
2922
2936
|
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
@@ -2966,6 +2980,8 @@ var symbol = (o) => {
|
|
|
2966
2980
|
return styleText2("yellow", S_STEP_ERROR);
|
|
2967
2981
|
case "submit":
|
|
2968
2982
|
return styleText2("green", S_STEP_SUBMIT);
|
|
2983
|
+
case "validating":
|
|
2984
|
+
return styleText2("dim", S_STEP_ACTIVE);
|
|
2969
2985
|
}
|
|
2970
2986
|
};
|
|
2971
2987
|
var symbolBar = (o) => {
|
|
@@ -3021,8 +3037,8 @@ var limitOptions = ({
|
|
|
3021
3037
|
), s = [];
|
|
3022
3038
|
let g = 0;
|
|
3023
3039
|
d && g++, c2 && g++;
|
|
3024
|
-
const T = f + (d ? 1 : 0),
|
|
3025
|
-
for (let t2 = T; t2 <
|
|
3040
|
+
const T = f + (d ? 1 : 0), y2 = W - (c2 ? 1 : 0);
|
|
3041
|
+
for (let t2 = T; t2 < y2; t2++) {
|
|
3026
3042
|
const n3 = e[t2], o = n3 ? w(n3, t2 === l2) : "", h2 = wrapAnsi(o, i2, {
|
|
3027
3043
|
hard: true,
|
|
3028
3044
|
trim: false
|
|
@@ -3070,9 +3086,9 @@ var log = {
|
|
|
3070
3086
|
const g = Array.isArray(s) ? s : s.split(`
|
|
3071
3087
|
`);
|
|
3072
3088
|
if (g.length > 0) {
|
|
3073
|
-
const [i2, ...
|
|
3089
|
+
const [i2, ...y2] = g;
|
|
3074
3090
|
i2.length > 0 ? t2.push(`${O}${i2}`) : t2.push(o ? e : "");
|
|
3075
|
-
for (const p of
|
|
3091
|
+
for (const p of y2)
|
|
3076
3092
|
p.length > 0 ? t2.push(`${u3}${p}`) : t2.push(o ? r2 : "");
|
|
3077
3093
|
}
|
|
3078
3094
|
m.write(`${t2.join(`
|
|
@@ -3177,19 +3193,19 @@ ${styleText2("gray", S_BAR)}` : ""}`;
|
|
|
3177
3193
|
}
|
|
3178
3194
|
default: {
|
|
3179
3195
|
const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u3.split(`
|
|
3180
|
-
`).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [],
|
|
3181
|
-
`),
|
|
3196
|
+
`).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
|
|
3197
|
+
`), b = p.length + 1;
|
|
3182
3198
|
return `${u3}${r2}${limitOptions({
|
|
3183
3199
|
output: t2.output,
|
|
3184
3200
|
cursor: this.cursor,
|
|
3185
3201
|
options: this.options,
|
|
3186
3202
|
maxItems: t2.maxItems,
|
|
3187
3203
|
columnPadding: r2.length,
|
|
3188
|
-
rowPadding: a2 +
|
|
3204
|
+
rowPadding: a2 + b,
|
|
3189
3205
|
style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
|
|
3190
3206
|
}).join(`
|
|
3191
3207
|
${r2}`)}
|
|
3192
|
-
${
|
|
3208
|
+
${f}
|
|
3193
3209
|
`;
|
|
3194
3210
|
}
|
|
3195
3211
|
}
|
|
@@ -3197,42 +3213,48 @@ ${b}
|
|
|
3197
3213
|
}).prompt();
|
|
3198
3214
|
};
|
|
3199
3215
|
var i = `${styleText2("gray", S_BAR)} `;
|
|
3200
|
-
var text = (
|
|
3201
|
-
validate:
|
|
3202
|
-
placeholder:
|
|
3203
|
-
defaultValue:
|
|
3204
|
-
initialValue:
|
|
3205
|
-
output:
|
|
3206
|
-
signal:
|
|
3207
|
-
input:
|
|
3216
|
+
var text = (t2) => new n2({
|
|
3217
|
+
validate: t2.validate,
|
|
3218
|
+
placeholder: t2.placeholder,
|
|
3219
|
+
defaultValue: t2.defaultValue,
|
|
3220
|
+
initialValue: t2.initialValue,
|
|
3221
|
+
output: t2.output,
|
|
3222
|
+
signal: t2.signal,
|
|
3223
|
+
input: t2.input,
|
|
3208
3224
|
render() {
|
|
3209
|
-
const
|
|
3210
|
-
` : ""}${symbol(this.state)} `}${
|
|
3211
|
-
`,
|
|
3225
|
+
const r2 = t2?.withGuide ?? settings.withGuide, l2 = `${`${r2 ? `${styleText2("gray", S_BAR)}
|
|
3226
|
+
` : ""}${symbol(this.state)} `}${t2.message}
|
|
3227
|
+
`, d = t2.placeholder && t2.placeholder.length > 0 ? (
|
|
3212
3228
|
// biome-ignore lint/style/noNonNullAssertion: guarded by placeholder.length > 0
|
|
3213
|
-
styleText2("inverse",
|
|
3214
|
-
) : styleText2(["inverse", "hidden"], "_"), o = this.userInput ? this.userInputWithCursor :
|
|
3229
|
+
styleText2("inverse", t2.placeholder[0]) + styleText2("dim", t2.placeholder.slice(1))
|
|
3230
|
+
) : styleText2(["inverse", "hidden"], "_"), o = this.userInput ? this.userInputWithCursor : d, s = this.value ?? "";
|
|
3215
3231
|
switch (this.state) {
|
|
3232
|
+
case "validating": {
|
|
3233
|
+
const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "", c2 = styleText2("dim", o), $ = styleText2("dim", "Validating...");
|
|
3234
|
+
return `${l2}${n3}${c2}
|
|
3235
|
+
${i2} ${$}
|
|
3236
|
+
`;
|
|
3237
|
+
}
|
|
3216
3238
|
case "error": {
|
|
3217
|
-
const n3 = this.error ? ` ${styleText2("yellow", this.error)}` : "",
|
|
3218
|
-
return `${
|
|
3219
|
-
${
|
|
3220
|
-
${
|
|
3239
|
+
const n3 = this.error ? ` ${styleText2("yellow", this.error)}` : "", i2 = r2 ? `${styleText2("yellow", S_BAR)} ` : "", c2 = r2 ? styleText2("yellow", S_BAR_END) : "";
|
|
3240
|
+
return `${l2.trim()}
|
|
3241
|
+
${i2}${o}
|
|
3242
|
+
${c2}${n3}
|
|
3221
3243
|
`;
|
|
3222
3244
|
}
|
|
3223
3245
|
case "submit": {
|
|
3224
|
-
const n3 =
|
|
3225
|
-
return `${
|
|
3246
|
+
const n3 = s ? `${r2 ? " " : ""}${styleText2("dim", s)}` : "", i2 = r2 ? styleText2("gray", S_BAR) : "";
|
|
3247
|
+
return `${l2}${i2}${n3}`;
|
|
3226
3248
|
}
|
|
3227
3249
|
case "cancel": {
|
|
3228
|
-
const n3 =
|
|
3229
|
-
return `${
|
|
3230
|
-
${
|
|
3250
|
+
const n3 = s ? ` ${styleText2(["strikethrough", "dim"], s)}` : "", i2 = r2 ? styleText2("gray", S_BAR) : "";
|
|
3251
|
+
return `${l2}${i2}${n3}${s.trim() ? `
|
|
3252
|
+
${i2}` : ""}`;
|
|
3231
3253
|
}
|
|
3232
3254
|
default: {
|
|
3233
|
-
const n3 =
|
|
3234
|
-
return `${
|
|
3235
|
-
${
|
|
3255
|
+
const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "";
|
|
3256
|
+
return `${l2}${n3}${o}
|
|
3257
|
+
${i2}
|
|
3236
3258
|
`;
|
|
3237
3259
|
}
|
|
3238
3260
|
}
|