Files
godoxy-yusing/internal/idlewatcher/html/style.css
yusing 5dc286f4a9 feat(idlewatcher): restyle loading page and style SSE log levels
Restyle the idle watcher loading UI with design tokens, light and dark
variants via `prefers-color-scheme`, and system font stacks (drop
Google Fonts). Tighten layout, animations, and console presentation.

In `loading.js`, pass event `level` into `addConsoleLine` and apply
`level-*` classes so log lines can reflect debug, info, warn, and
error. On the HTML side, set `color-scheme`, add an empty `alt` on the
logo, and mark the loading dots as `aria-hidden` for assistive
technology.
2026-04-23 17:23:39 +08:00

284 lines
5.8 KiB
CSS

:root {
color-scheme: light;
--fg: #141413;
--fg-secondary: #52514e;
--bg: #fafaf9;
--surface: #ffffff;
--rule: #292826;
--border: color-mix(in srgb, var(--rule) 12%, var(--bg));
--text: var(--fg);
--muted: var(--fg-secondary);
--faint: color-mix(in srgb, var(--rule) 9%, transparent);
--console-bg: #f5f5f4;
--msg-error: #b91c1c;
--text-emphasis: color-mix(in srgb, var(--fg) 92%, var(--bg) 8%);
--dot-size: 6px;
--logo-size: 72px;
--radius: 10px;
--font-sans:
ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
Roboto, "Helvetica Neue", sans-serif;
--font-mono:
ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;
--accent-starting: #52525b;
--accent-waking-dep: #0369a1;
--accent-dep-ready: #15803d;
--accent-container-woke: #047857;
--accent-waiting-ready: #b45309;
--accent-ready: #166534;
--accent-error: #dc2626;
--level-debug: color-mix(in srgb, var(--fg-secondary) 18%, transparent);
--level-info: transparent;
--level-warn: color-mix(in srgb, #b45309 16%, transparent);
--level-error: color-mix(in srgb, #dc2626 12%, transparent);
}
@media (prefers-color-scheme: dark) {
:root {
color-scheme: dark;
--fg: #ecebe8;
--fg-secondary: #9c9a94;
--bg: #0c0c0b;
--surface: #111113;
--rule: #5c5954;
--border: rgba(255, 255, 255, 0.06);
--text: var(--fg);
--muted: var(--fg-secondary);
--faint: rgba(255, 255, 255, 0.08);
--console-bg: #0a0a0b;
--msg-error: #fecaca;
--text-emphasis: rgba(255, 255, 255, 0.95);
--accent-starting: #a1a1aa;
--accent-waking-dep: #38bdf8;
--accent-dep-ready: #4ade80;
--accent-container-woke: #34d399;
--accent-waiting-ready: #fbbf24;
--accent-ready: #86efac;
--accent-error: #f87171;
--level-debug: rgba(161, 161, 170, 0.35);
--level-info: transparent;
--level-warn: rgba(251, 191, 36, 0.2);
--level-error: rgba(248, 113, 113, 0.12);
}
}
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html {
background-color: var(--bg);
-webkit-text-size-adjust: 100%;
}
body {
font-family: var(--font-sans);
font-size: 15px;
line-height: 1.45;
color: var(--text);
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: clamp(1rem, 4vw, 1.5rem);
background: var(--bg);
}
@media (prefers-color-scheme: dark) {
body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
}
.container {
width: 100%;
max-width: 520px;
display: flex;
flex-direction: column;
align-items: center;
gap: 28px;
padding: 28px 24px 24px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
}
.logo {
width: var(--logo-size);
height: var(--logo-size);
opacity: 0.92;
}
.loading-dots {
display: flex;
align-items: center;
justify-content: center;
gap: 6px;
height: 10px;
}
.dot {
width: var(--dot-size);
height: var(--dot-size);
border-radius: 50%;
background: var(--muted);
animation: pulse 1.2s ease-in-out infinite;
}
.dot:nth-child(1) {
animation-delay: 0ms;
}
.dot:nth-child(2) {
animation-delay: 160ms;
}
.dot:nth-child(3) {
animation-delay: 320ms;
}
@keyframes pulse {
0%,
100% {
opacity: 0.25;
transform: scale(0.92);
}
50% {
opacity: 1;
transform: scale(1);
}
}
.console {
width: 100%;
font-family: var(--font-mono);
font-size: 12px;
line-height: 1.5;
letter-spacing: -0.01em;
background: var(--console-bg);
border: 1px solid var(--border);
border-radius: calc(var(--radius) - 2px);
padding: 10px 0;
min-height: 180px;
max-height: 280px;
overflow-y: auto;
scrollbar-width: thin;
scrollbar-color: var(--faint) transparent;
}
.console-line {
display: grid;
grid-template-columns: 5.5rem 1fr;
column-gap: 12px;
align-items: baseline;
padding: 6px 12px 6px 14px;
border-inline-start: 2px solid var(--line-accent, var(--accent-starting));
background: linear-gradient(
90deg,
var(--level-bg, transparent) 0%,
transparent 48px
);
border-bottom: 1px solid var(--faint);
}
.console-line:last-child {
border-bottom: none;
}
.console-line.level-debug {
--level-bg: var(--level-debug);
}
.console-line.level-info {
--level-bg: var(--level-info);
}
.console-line.level-warn {
--level-bg: var(--level-warn);
}
.console-line.level-error {
--level-bg: var(--level-error);
border-inline-start-width: 3px;
}
.console-timestamp {
color: var(--muted);
font-variant-numeric: tabular-nums;
white-space: nowrap;
}
.console-message {
color: var(--text);
word-break: break-word;
white-space: pre-wrap;
}
.console-line.starting {
--line-accent: var(--accent-starting);
}
.console-line.waking_dep {
--line-accent: var(--accent-waking-dep);
}
.console-line.dep_ready {
--line-accent: var(--accent-dep-ready);
}
.console-line.container_woke {
--line-accent: var(--accent-container-woke);
}
.console-line.waiting_ready {
--line-accent: var(--accent-waiting-ready);
}
.console-line.ready {
--line-accent: var(--accent-ready);
}
.console-line.ready .console-message {
font-weight: 600;
color: var(--text-emphasis);
}
.console-line.error {
--line-accent: var(--accent-error);
}
.console-line.error .console-message {
color: var(--msg-error);
font-weight: 500;
}
.console-loading {
display: inline-flex;
align-items: center;
gap: 3px;
margin-inline-start: 6px;
vertical-align: middle;
}
.console-loading-dot {
width: 4px;
height: 4px;
border-radius: 50%;
background: var(--muted);
animation: pulse 1.2s ease-in-out infinite;
}
.console-loading-dot:nth-child(1) {
animation-delay: 0ms;
}
.console-loading-dot:nth-child(2) {
animation-delay: 160ms;
}
.console-loading-dot:nth-child(3) {
animation-delay: 320ms;
}