culater 1.1.1 → 1.1.3
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/lib/server.js +12 -29
- package/package.json +1 -1
package/lib/server.js
CHANGED
|
@@ -382,6 +382,7 @@ function createCliSpinner(initialLabel, color = '36') {
|
|
|
382
382
|
let frameIndex = 0;
|
|
383
383
|
let started = false;
|
|
384
384
|
let label = initialLabel;
|
|
385
|
+
let startTime = null;
|
|
385
386
|
|
|
386
387
|
const clearLine = () => {
|
|
387
388
|
process.stdout.write('\r\x1b[2K');
|
|
@@ -390,13 +391,16 @@ function createCliSpinner(initialLabel, color = '36') {
|
|
|
390
391
|
const render = () => {
|
|
391
392
|
const frame = frames[frameIndex % frames.length];
|
|
392
393
|
frameIndex += 1;
|
|
393
|
-
|
|
394
|
+
const elapsed = startTime ? Math.floor((Date.now() - startTime) / 1000) : 0;
|
|
395
|
+
const sec = elapsed > 0 ? ` \x1b[90m${elapsed}s\x1b[0m` : '';
|
|
396
|
+
process.stdout.write(`\r\x1b[2K\x1b[${color}m${frame}\x1b[0m ${label}${sec}`);
|
|
394
397
|
};
|
|
395
398
|
|
|
396
399
|
return {
|
|
397
400
|
start() {
|
|
398
401
|
if (started) return;
|
|
399
402
|
started = true;
|
|
403
|
+
startTime = Date.now();
|
|
400
404
|
if (!isTty) {
|
|
401
405
|
console.log(label);
|
|
402
406
|
return;
|
|
@@ -557,21 +561,18 @@ const LOGIN_HTML = `<!DOCTYPE html>
|
|
|
557
561
|
<html>
|
|
558
562
|
<head>
|
|
559
563
|
<meta charset="UTF-8">
|
|
560
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
564
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, interactive-widget=resizes-content">
|
|
561
565
|
<title>culater</title>
|
|
562
566
|
<style>
|
|
563
|
-
:root{--bg0:#06080d;--bg1:#0f1522;--glass
|
|
567
|
+
:root{--bg0:#06080d;--bg1:#0f1522;--glass-border:rgba(255,255,255,0.14);--ink:#f1f5ff;--muted:#9ba5bd;--danger:#ff839d}
|
|
564
568
|
*{box-sizing:border-box;margin:0;padding:0}
|
|
565
|
-
html
|
|
569
|
+
html{height:100%}
|
|
566
570
|
body{
|
|
567
571
|
font-family:'SF Pro Text','SF Pro Display','Avenir Next',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
|
|
568
572
|
min-height:100dvh;display:flex;align-items:center;justify-content:center;
|
|
569
|
-
padding:calc(24px + env(safe-area-inset-top))
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
}
|
|
573
|
-
body.keyboard-open{
|
|
574
|
-
align-items:flex-start;padding-top:calc(12px + env(safe-area-inset-top))
|
|
573
|
+
padding:24px;padding-top:calc(24px + env(safe-area-inset-top));padding-bottom:calc(24px + env(safe-area-inset-bottom));
|
|
574
|
+
color:var(--ink);
|
|
575
|
+
background:radial-gradient(1200px 900px at 15% -10%,#1d2c44 0%,transparent 46%),radial-gradient(900px 700px at 110% 0%,#1f3e39 0%,transparent 44%),linear-gradient(160deg,var(--bg0),var(--bg1) 62%,#091119)
|
|
575
576
|
}
|
|
576
577
|
body::before{
|
|
577
578
|
content:'';position:fixed;inset:0;pointer-events:none;opacity:.32;
|
|
@@ -580,9 +581,7 @@ const LOGIN_HTML = `<!DOCTYPE html>
|
|
|
580
581
|
.box{
|
|
581
582
|
position:relative;z-index:1;width:min(360px,100%);padding:28px 24px 24px;border-radius:24px;
|
|
582
583
|
border:1px solid var(--glass-border);background:linear-gradient(180deg,rgba(17,24,37,.84),rgba(10,15,24,.82));
|
|
583
|
-
backdrop-filter:blur(18px);box-shadow:0 20px 60px rgba(2,4,8,.5)
|
|
584
|
-
transform:translateY(clamp(-220px,calc(var(--login-kb-offset) * -0.62),0px));
|
|
585
|
-
transition:transform .18s ease
|
|
584
|
+
backdrop-filter:blur(18px);box-shadow:0 20px 60px rgba(2,4,8,.5)
|
|
586
585
|
}
|
|
587
586
|
h1{font-size:34px;letter-spacing:.02em;font-weight:650;margin-bottom:6px}
|
|
588
587
|
.sub{color:var(--muted);font-size:13px;line-height:1.5;margin-bottom:20px}
|
|
@@ -614,22 +613,6 @@ const LOGIN_HTML = `<!DOCTYPE html>
|
|
|
614
613
|
if (location.search.includes('error')) {
|
|
615
614
|
document.getElementById('e').textContent = 'Invalid password';
|
|
616
615
|
}
|
|
617
|
-
|
|
618
|
-
const root = document.documentElement;
|
|
619
|
-
const body = document.body;
|
|
620
|
-
|
|
621
|
-
const adjustForKeyboard = () => {
|
|
622
|
-
if (!window.visualViewport) return;
|
|
623
|
-
const offset = Math.max(0, window.innerHeight - window.visualViewport.height - window.visualViewport.offsetTop);
|
|
624
|
-
root.style.setProperty('--login-kb-offset', offset + 'px');
|
|
625
|
-
body.classList.toggle('keyboard-open', offset > 56);
|
|
626
|
-
};
|
|
627
|
-
|
|
628
|
-
if (window.visualViewport) {
|
|
629
|
-
window.visualViewport.addEventListener('resize', adjustForKeyboard);
|
|
630
|
-
window.visualViewport.addEventListener('scroll', adjustForKeyboard);
|
|
631
|
-
adjustForKeyboard();
|
|
632
|
-
}
|
|
633
616
|
</script>
|
|
634
617
|
</body>
|
|
635
618
|
</html>`;
|