Files
SnowLuma/packages/webui/src/index.css
T
DrSmoothl 985dfd4705 feat(webui): animated login background + three independent motion settings
Login page now has a mouse-reactive wavy-line background (ported a-waves +
embedded Perlin noise, themed to the accent, rendered behind the card which
sits on a 95%-opaque blurred surface so content stays readable). A "我觉得这个
界面很卡怎么办?" link opens a dialog that toggles it off — a device-local
preference (localStorage, works pre-auth, defaults off when the OS prefers
reduced motion), independent of the system motion settings.

Motion settings are now three:
- 关闭登录页的动效 — the login background toggle above (device-local).
- 减弱动效 (reduceMotion) — soft: transforms/springs off, durations
  collapsed, page/sidebar instant; gentle entrance fades remain.
- 关闭全部动效 (disableMotion, NEW appearance field) — everything reduce does
  plus data-no-motion CSS (kills pulse dots; spinners excluded so "busy"
  stays legible) and the entrance opacity fades gated off across
  overview/processes/logs/config lists.
2026-06-14 00:41:18 +08:00

368 lines
13 KiB
CSS

@import "tailwindcss";
@import "tw-animate-css";
@custom-variant dark (&:where(.dark, .dark *));
/* ──────────────────────────────────────────────
Theme tokens (sky-blue accent)
────────────────────────────────────────────── */
:root {
--radius: 0.75rem;
--background: oklch(99% 0.004 240);
--foreground: oklch(20% 0.03 250);
--card: oklch(100% 0 0);
--card-foreground: oklch(20% 0.03 250);
--popover: oklch(100% 0 0);
--popover-foreground: oklch(20% 0.03 250);
/* sky-500 */
--primary: oklch(68.5% 0.155 230);
--primary-foreground: oklch(99% 0.005 240);
--secondary: oklch(96% 0.012 240);
--secondary-foreground: oklch(25% 0.03 250);
--muted: oklch(96% 0.012 240);
--muted-foreground: oklch(50% 0.02 250);
--accent: oklch(94% 0.03 230);
--accent-foreground: oklch(35% 0.07 230);
--destructive: oklch(60% 0.22 27);
--destructive-foreground: oklch(99% 0.005 240);
--success: oklch(70% 0.15 160);
--warning: oklch(78% 0.16 80);
--border: oklch(92% 0.01 240);
--input: oklch(94% 0.012 240);
--ring: oklch(68.5% 0.155 230);
--sidebar: oklch(98% 0.006 240);
--sidebar-foreground: oklch(25% 0.03 250);
--sidebar-primary: oklch(68.5% 0.155 230);
--sidebar-primary-foreground: oklch(99% 0.005 240);
--sidebar-accent: oklch(94% 0.025 230);
--sidebar-accent-foreground: oklch(35% 0.08 230);
--sidebar-border: oklch(92% 0.01 240);
--sidebar-ring: oklch(68.5% 0.155 230);
}
.dark {
--background: oklch(16% 0.02 250);
--foreground: oklch(96% 0.01 240);
--card: oklch(20% 0.025 250);
--card-foreground: oklch(96% 0.01 240);
--popover: oklch(20% 0.025 250);
--popover-foreground: oklch(96% 0.01 240);
--primary: oklch(75% 0.14 230);
--primary-foreground: oklch(15% 0.02 250);
--secondary: oklch(25% 0.025 250);
--secondary-foreground: oklch(96% 0.01 240);
--muted: oklch(24% 0.02 250);
--muted-foreground: oklch(68% 0.02 240);
--accent: oklch(28% 0.05 230);
--accent-foreground: oklch(85% 0.1 230);
--destructive: oklch(62% 0.2 27);
--destructive-foreground: oklch(98% 0.005 240);
--success: oklch(72% 0.15 160);
--warning: oklch(80% 0.16 80);
--border: oklch(28% 0.02 250);
--input: oklch(26% 0.02 250);
--ring: oklch(75% 0.14 230);
--sidebar: oklch(18% 0.022 250);
--sidebar-foreground: oklch(92% 0.01 240);
--sidebar-primary: oklch(75% 0.14 230);
--sidebar-primary-foreground: oklch(15% 0.02 250);
--sidebar-accent: oklch(28% 0.05 230);
--sidebar-accent-foreground: oklch(85% 0.1 230);
--sidebar-border: oklch(26% 0.02 250);
--sidebar-ring: oklch(75% 0.14 230);
}
@theme inline {
--color-background: var(--background);
--color-foreground: var(--foreground);
--color-card: var(--card);
--color-card-foreground: var(--card-foreground);
--color-popover: var(--popover);
--color-popover-foreground: var(--popover-foreground);
--color-primary: var(--primary);
--color-primary-foreground: var(--primary-foreground);
--color-secondary: var(--secondary);
--color-secondary-foreground: var(--secondary-foreground);
--color-muted: var(--muted);
--color-muted-foreground: var(--muted-foreground);
--color-accent: var(--accent);
--color-accent-foreground: var(--accent-foreground);
--color-destructive: var(--destructive);
--color-destructive-foreground: var(--destructive-foreground);
--color-success: var(--success);
--color-warning: var(--warning);
--color-border: var(--border);
--color-input: var(--input);
--color-ring: var(--ring);
--color-sidebar: var(--sidebar);
--color-sidebar-foreground: var(--sidebar-foreground);
--color-sidebar-primary: var(--sidebar-primary);
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
--color-sidebar-accent: var(--sidebar-accent);
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
--color-sidebar-border: var(--sidebar-border);
--color-sidebar-ring: var(--sidebar-ring);
--radius-sm: calc(var(--radius) - 4px);
--radius-md: calc(var(--radius) - 2px);
--radius-lg: var(--radius);
--radius-xl: calc(var(--radius) + 4px);
--font-sans: 'Inter', 'Noto Sans SC', system-ui, -apple-system, sans-serif;
--font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
}
@layer base {
* {
border-color: var(--border);
}
html, body, #root {
height: 100%;
}
body {
margin: 0;
background-color: var(--background);
color: var(--foreground);
font-family: var(--font-sans);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
line-height: 1.5;
}
::selection {
background-color: color-mix(in oklab, var(--primary) 28%, transparent);
color: var(--foreground);
}
/* Density: compact tightens the global rhythm a touch. Use rem (not px) so
it still tracks the UI-scale root font-size. */
html[data-density="compact"] body {
font-size: 0.84rem;
line-height: 1.45;
}
html[data-density="compact"] {
--tw-leading: 1.4;
}
}
/* ──────────────────────────────────────────────
Customization layers (driven by ThemeContext via
data-* attributes + CSS vars on <html>)
────────────────────────────────────────────── */
/* Dark intensity: "black" pushes the dark palette toward true black for
OLED screens. Only meaningful in dark mode. */
.dark[data-dark-intensity="black"] {
--background: oklch(0% 0 0);
--foreground: oklch(97% 0.01 240);
--card: oklch(13% 0.008 250);
--card-foreground: oklch(96% 0.01 240);
--popover: oklch(13% 0.008 250);
--popover-foreground: oklch(96% 0.01 240);
--secondary: oklch(17% 0.012 250);
--muted: oklch(15% 0.01 250);
--muted-foreground: oklch(66% 0.02 240);
--border: oklch(22% 0.012 250);
--input: oklch(19% 0.012 250);
--sidebar: oklch(5% 0.006 250);
--sidebar-border: oklch(20% 0.012 250);
}
/* Sidebar style: how distinct the sidebar surface is from the main canvas. */
html[data-sidebar-style="panel"] {
--sidebar: color-mix(in oklab, var(--card) 90%, var(--primary) 4%);
}
html[data-sidebar-style="accent"] {
--sidebar: color-mix(in oklab, var(--background) 76%, var(--primary) 24%);
--sidebar-foreground: color-mix(in oklab, var(--foreground) 85%, var(--primary));
--sidebar-border: color-mix(in oklab, var(--border) 60%, var(--primary) 40%);
}
/* High contrast: strengthen borders + dim-text contrast for legibility. */
html[data-contrast="high"] {
--border: color-mix(in oklab, var(--foreground) 55%, var(--border));
--input: color-mix(in oklab, var(--foreground) 45%, var(--input));
--muted-foreground: color-mix(in oklab, var(--foreground) 78%, var(--muted-foreground));
--sidebar-border: color-mix(in oklab, var(--foreground) 55%, var(--sidebar-border));
}
/* Reduce motion: a CSS fallback for non-Framer transitions/animations.
Framer Motion itself is handled by <MotionConfig reducedMotion>. */
html[data-reduce-motion="1"] *,
html[data-reduce-motion="1"] *::before,
html[data-reduce-motion="1"] *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
scroll-behavior: auto !important;
}
/* 关闭全部动效: harder than reduce — remove CSS animations outright (e.g. the
pulsing status dots) rather than just collapsing their duration. Framer
entrance fades are gated in components on `disableMotion`. */
html[data-no-motion="1"] *:not(.animate-spin),
html[data-no-motion="1"] *::before,
html[data-no-motion="1"] *::after {
/* Exclude .animate-spin: loading spinners encode "busy", not decoration —
freezing them reads as a hang. Everything else (e.g. pulse dots) stops. */
animation: none !important;
}
/* ──────────────────────────────────────────────
Native scrollbars — themed to match. Radix ScrollArea hides its own
native bar and renders a custom thumb, so this only styles plain overflow
containers (textareas, <pre>, the settings rail, grid widget bodies…).
────────────────────────────────────────────── */
html {
scrollbar-width: thin;
scrollbar-color: color-mix(in oklab, var(--foreground) 22%, transparent) transparent;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
background-color: color-mix(in oklab, var(--foreground) 22%, transparent);
border-radius: 9999px;
border: 2px solid transparent;
background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
background-color: color-mix(in oklab, var(--foreground) 38%, transparent);
}
::-webkit-scrollbar-corner { background: transparent; }
/* ──────────────────────────────────────────────
Login background — wavy SVG line field (see <LoginWaves>). Themed to the
accent so it reads as a subtle decorative backdrop behind the login card.
────────────────────────────────────────────── */
.login-waves {
color: color-mix(in oklab, var(--primary) 26%, transparent);
}
.login-waves path {
fill: none;
stroke: currentColor;
stroke-width: 1px;
}
/* ──────────────────────────────────────────────
Custom range slider (via the <Slider> component, class `.slider`).
The component sets `--slider-pct` for the WebKit filled track; Firefox
uses native ::-moz-range-progress.
────────────────────────────────────────────── */
.slider {
-webkit-appearance: none;
appearance: none;
width: 100%;
/* Match the track height so WebKit can't top-align a short track inside a
taller input; the 1rem thumb overflows symmetrically as the grab target. */
height: 0.375rem;
background: transparent;
cursor: pointer;
}
.slider::-webkit-slider-runnable-track {
height: 0.375rem;
border-radius: 9999px;
background: linear-gradient(to right,
var(--primary) var(--slider-pct, 0%),
var(--muted) var(--slider-pct, 0%));
}
.slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
margin-top: -0.3125rem; /* center the 1rem thumb on the 0.375rem track */
height: 1rem;
width: 1rem;
border-radius: 9999px;
background: var(--background);
border: 2px solid var(--primary);
box-shadow: 0 1px 2px rgb(0 0 0 / 0.18);
transition: transform 0.12s ease;
}
.slider:active::-webkit-slider-thumb { transform: scale(1.12); }
.slider:focus-visible::-webkit-slider-thumb {
box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 40%, transparent);
}
.slider::-moz-range-track {
height: 0.375rem;
border-radius: 9999px;
background: var(--muted);
}
.slider::-moz-range-progress {
height: 0.375rem;
border-radius: 9999px;
background: var(--primary);
}
.slider::-moz-range-thumb {
height: 1rem;
width: 1rem;
border: 2px solid var(--primary);
border-radius: 9999px;
background: var(--background);
box-shadow: 0 1px 2px rgb(0 0 0 / 0.18);
}
.slider:focus-visible::-moz-range-thumb {
box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 40%, transparent);
}
/* The global reduce-motion rule can't match pseudo-elements, so kill the
thumb's active-scale transition explicitly. */
html[data-reduce-motion="1"] .slider::-webkit-slider-thumb { transition: none !important; }
/* ──────────────────────────────────────────────
gridstack dashboard — mesh the library's item shell with our cards.
The widget content (a Card) owns its own bg/border/rounding, so the
gridstack content box is just a transparent, full-bleed container.
────────────────────────────────────────────── */
.grid-stack {
/* Negative inset cancels gridstack's per-item margin at the edges so the
grid lines up with surrounding page padding. */
background: transparent;
}
.grid-stack-item-content {
inset: 0;
overflow: visible;
background: transparent;
display: block;
}
/* The drag placeholder (drop target preview). */
.grid-stack > .grid-stack-placeholder > .placeholder-content {
border: 2px dashed var(--primary);
background: color-mix(in oklab, var(--primary) 8%, transparent);
border-radius: var(--radius);
}
/* Resize handle — only present while editing (grid is interactive). Make the
bottom-right grip obvious so it's clearly draggable. */
.grid-stack-item > .ui-resizable-se {
width: 18px;
height: 18px;
right: 5px;
bottom: 5px;
background-image: none;
transform: none;
border-right: 3px solid var(--primary);
border-bottom: 3px solid var(--primary);
border-bottom-right-radius: 5px;
opacity: 0.65;
z-index: 30;
}
.grid-stack-item:hover > .ui-resizable-se {
opacity: 1;
}