scream-code 0.4.3 → 0.4.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/main.mjs +19 -11
- package/package.json +1 -1
package/dist/main.mjs
CHANGED
|
@@ -135452,6 +135452,7 @@ const SHADOW_CHARS = new Set([
|
|
|
135452
135452
|
]);
|
|
135453
135453
|
const SHEEN_STEP = 2;
|
|
135454
135454
|
const SHEEN_INTERVAL_MS = 150;
|
|
135455
|
+
const LOADING_DURATION_MS = 2200;
|
|
135455
135456
|
const THEME_ACCENT = {
|
|
135456
135457
|
dark: [
|
|
135457
135458
|
78,
|
|
@@ -135580,6 +135581,7 @@ function supportsAnsi() {
|
|
|
135580
135581
|
function runLoadingAnimation(theme = "dark") {
|
|
135581
135582
|
if (!supportsAnsi()) {
|
|
135582
135583
|
for (const line of LOGO) stdout.write(`${fg(...LOGO_RGB)}${line}${RESET}\n`);
|
|
135584
|
+
stdout.write(`${BOLD}${fg(...THEME_ACCENT[theme])}正在唤醒核心...${RESET}\n`);
|
|
135583
135585
|
return Promise.resolve();
|
|
135584
135586
|
}
|
|
135585
135587
|
return new Promise((resolve) => {
|
|
@@ -135603,7 +135605,7 @@ function runLoadingAnimation(theme = "dark") {
|
|
|
135603
135605
|
lines.push(centerPad(colored, cols));
|
|
135604
135606
|
}
|
|
135605
135607
|
if (phase === "loading") lines.push(centerPad(renderShimmer(shimmerPulse, accent), cols));
|
|
135606
|
-
else lines.push(centerPad(`${BOLD}${fg(...accent)}
|
|
135608
|
+
else lines.push(centerPad(`${BOLD}${fg(...accent)}按下 ENTER 唤醒核心${RESET}`, cols));
|
|
135607
135609
|
lines.push("");
|
|
135608
135610
|
lines.push("");
|
|
135609
135611
|
lines.push(centerPad(`${fg(...DIM_RGB)}按住 Ctrl+C 即可退出 Scream Code${RESET}`, cols));
|
|
@@ -135620,9 +135622,22 @@ function runLoadingAnimation(theme = "dark") {
|
|
|
135620
135622
|
shimmerPulse = (shimmerPulse + 1) % 10;
|
|
135621
135623
|
render();
|
|
135622
135624
|
}
|
|
135625
|
+
function onData(data) {
|
|
135626
|
+
const key = data.toString();
|
|
135627
|
+
if (key === "") {
|
|
135628
|
+
interrupt();
|
|
135629
|
+
return;
|
|
135630
|
+
}
|
|
135631
|
+
if ((key === "\r" || key === "\n") && phase === "ready") {
|
|
135632
|
+
cleanup();
|
|
135633
|
+
resolve();
|
|
135634
|
+
}
|
|
135635
|
+
}
|
|
135623
135636
|
function cleanup() {
|
|
135624
135637
|
clearInterval(timer);
|
|
135625
|
-
stdin.
|
|
135638
|
+
stdin.off("data", onData);
|
|
135639
|
+
process$1.off("SIGINT", interrupt);
|
|
135640
|
+
process$1.off("SIGTERM", interrupt);
|
|
135626
135641
|
stdin.setRawMode(false);
|
|
135627
135642
|
stdout.write("\x1B[?25h");
|
|
135628
135643
|
stdout.write("\x1B[?1049l");
|
|
@@ -135634,20 +135649,13 @@ function runLoadingAnimation(theme = "dark") {
|
|
|
135634
135649
|
process$1.on("SIGINT", interrupt);
|
|
135635
135650
|
process$1.on("SIGTERM", interrupt);
|
|
135636
135651
|
stdin.setRawMode(true);
|
|
135637
|
-
stdin.on("data",
|
|
135638
|
-
const key = data.toString();
|
|
135639
|
-
if (key === "") interrupt();
|
|
135640
|
-
if ((key === "\r" || key === "\n") && phase === "ready") {
|
|
135641
|
-
cleanup();
|
|
135642
|
-
resolve();
|
|
135643
|
-
}
|
|
135644
|
-
});
|
|
135652
|
+
stdin.on("data", onData);
|
|
135645
135653
|
render();
|
|
135646
135654
|
const timer = setInterval(tick, SHEEN_INTERVAL_MS);
|
|
135647
135655
|
setTimeout(() => {
|
|
135648
135656
|
phase = "ready";
|
|
135649
135657
|
render();
|
|
135650
|
-
},
|
|
135658
|
+
}, LOADING_DURATION_MS);
|
|
135651
135659
|
});
|
|
135652
135660
|
}
|
|
135653
135661
|
//#endregion
|