feat(webui): custom scrollbars + sliders, stat-tile fit, reduce-motion

- Scrollbars: theme native scrollbars (thin, token-colored thumb) for plain
  overflow containers; Radix ScrollArea keeps its own custom bar (it hides
  the native one, so no double bar).
- Sliders: new <Slider> component + `.slider` CSS replaces the native range
  inputs (UI scale / mask opacity / blur). Filled track + ring-bordered
  thumb, themed; input height matches the track so the thumb centers in every
  engine; Firefox fills via ::-moz-range-progress.
- Stat tiles: tighten the h=1 tile (py-2 + mt-0.5) so the three text lines +
  padding fit the 80px cell without hugging the border.
- Reduce motion: gate the always-present sidebar-width + page-transition
  animations to instant when enabled (Framer's reducedMotion only suppresses
  transforms, so these needed an explicit opt-out); kill the slider thumb
  transition too.
This commit is contained in:
DrSmoothl committed 2026-06-14 00:16:26 +08:00
1 parent 7d647e0ed7
commit 9dd46198cb
5 files changed
+129 -16

No files matched your search

@@ -28,6 +28,10 @@ export function MainLayout({ status, onLogout, children }: MainLayoutProps) {
return appearance.sidebarDefaultCollapsed;
});
const customBg = appearance.background.type !== 'none';
// Framer's reducedMotion only suppresses transforms, so the always-present
// width + page-transition animations need an explicit opt-out to make the
// “减少动效” setting actually felt.
const reduce = appearance.reduceMotion;
const { editing } = useLayout();
// Force the sidebar open while editing layout so its drag-to-reorder list
// has room (it returns to the user's collapsed pref on 完成).
@@ -46,7 +50,7 @@ export function MainLayout({ status, onLogout, children }: MainLayoutProps) {
<motion.aside
initial={false}
animate={{ width: effectiveCollapsed ? 64 : 248 }}
transition={{ type: 'spring', stiffness: 280, damping: 32 }}
transition={reduce ? { duration: 0 } : { type: 'spring', stiffness: 280, damping: 32 }}
className="relative h-full shrink-0 border-r overflow-hidden"
>
<Sidebar collapsed={effectiveCollapsed} />
@@ -85,10 +89,10 @@ export function MainLayout({ status, onLogout, children }: MainLayoutProps) {
<AnimatePresence mode="wait">
<motion.div
key={pathname}
initial={{ opacity: 0, y: 10 }}
initial={reduce ? false : { opacity: 0, y: 10 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: -8 }}
transition={{ duration: 0.22, ease: [0.16, 1, 0.3, 1] }}
exit={reduce ? { opacity: 0 } : { opacity: 0, y: -8 }}
transition={reduce ? { duration: 0 } : { duration: 0.22, ease: [0.16, 1, 0.3, 1] }}
>
{children}
</motion.div>