From f28e5a2dbd73f80310912d804757329d0a57f2ce Mon Sep 17 00:00:00 2001 From: Nakul Srivastava Date: Fri, 20 Nov 2026 10:25:41 +0530 Subject: [PATCH 01/40] feat(ui): design tokens and glass window Mica window effect, set-theme capability, dashboard_supports_glass command, token ladder and easing curves. Co-Authored-By: Claude Sonnet 5.5 --- .../src-tauri/capabilities/dashboard.json | 7 +++ apps/desktop/src-tauri/src/lib.rs | 39 +++++++++++++++ apps/desktop/src-tauri/tauri.conf.json | 3 +- apps/desktop/src/components/layers.ts | 2 + apps/desktop/src/lib/tauri.ts | 6 +++ apps/desktop/src/styles.css | 50 +++++++++++++++++++ 6 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 apps/desktop/src-tauri/capabilities/dashboard.json create mode 100644 apps/desktop/src/components/layers.ts diff --git a/apps/desktop/src-tauri/capabilities/dashboard.json b/apps/desktop/src-tauri/capabilities/dashboard.json new file mode 100644 index 0000000..0973701 --- /dev/null +++ b/apps/desktop/src-tauri/capabilities/dashboard.json @@ -0,0 +1,7 @@ +{ + "$schema": "../gen/schemas/desktop-schema.json", + "identifier": "dashboard-window", + "description": "Lets the dashboard follow its light/dark toggle with the native window theme (Mica).", + "windows": ["dashboard"], + "permissions": ["core:window:allow-set-theme"] +} diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rs index eca8cdc..c334994 100644 --- a/apps/desktop/src-tauri/src/lib.rs +++ b/apps/desktop/src-tauri/src/lib.rs @@ -245,6 +245,44 @@ fn launched_in_background() -> bool { }) } +/// Whether the dashboard's Mica backdrop exists on this OS (Windows 11, build +/// 22000 or later). Elsewhere the page keeps an opaque background, because a +/// transparent window without a backdrop would show the desktop through it. +#[tauri::command] +fn dashboard_supports_glass() -> bool { + #[cfg(target_os = "windows")] + { + #[repr(C)] + struct OsVersionInfo { + size: u32, + major: u32, + minor: u32, + build: u32, + platform: u32, + service_pack: [u16; 128], + } + #[link(name = "ntdll")] + unsafe extern "system" { + fn RtlGetVersion(info: *mut OsVersionInfo) -> i32; + } + let mut info = OsVersionInfo { + size: std::mem::size_of::() as u32, + major: 0, + minor: 0, + build: 0, + platform: 0, + service_pack: [0; 128], + }; + // SAFETY: `info` is a correctly sized, writable OSVERSIONINFOW and `size` is set. + let status = unsafe { RtlGetVersion(&mut info) }; + status == 0 && info.build >= 22000 + } + #[cfg(not(target_os = "windows"))] + { + false + } +} + #[tauri::command] fn dashboard_ready( app: AppHandle, @@ -2886,6 +2924,7 @@ pub fn run() { begin_capture, show_capture_surface, dashboard_ready, + dashboard_supports_glass, open_in_showcase, take_pending_showcase, on_screen_session, diff --git a/apps/desktop/src-tauri/tauri.conf.json b/apps/desktop/src-tauri/tauri.conf.json index 24a515f..2cb19a5 100644 --- a/apps/desktop/src-tauri/tauri.conf.json +++ b/apps/desktop/src-tauri/tauri.conf.json @@ -22,7 +22,8 @@ "minHeight": 640, "center": true, "decorations": true, - "transparent": false, + "transparent": true, + "windowEffects": { "effects": ["mica"] }, "resizable": true, "skipTaskbar": false, "focus": true diff --git a/apps/desktop/src/components/layers.ts b/apps/desktop/src/components/layers.ts new file mode 100644 index 0000000..c827438 --- /dev/null +++ b/apps/desktop/src/components/layers.ts @@ -0,0 +1,2 @@ +/** Stacking order for dashboard overlays. Use these instead of raw `z-*` numbers. */ +export const LAYER = { popover: 80, submenu: 81, dialog: 90, toast: 100 } as const; diff --git a/apps/desktop/src/lib/tauri.ts b/apps/desktop/src/lib/tauri.ts index 831055c..a0fdfb0 100644 --- a/apps/desktop/src/lib/tauri.ts +++ b/apps/desktop/src/lib/tauri.ts @@ -832,3 +832,9 @@ export async function startNoteDrag(id: string): Promise { if (!isTauri()) return; await invoke("notes_start_drag", { id }); } + +/** True when the OS can draw the dashboard's Mica backdrop (Windows 11). Falls back to opaque. */ +export async function dashboardSupportsGlass(): Promise { + if (!isTauri()) return false; + return invoke("dashboard_supports_glass"); +} diff --git a/apps/desktop/src/styles.css b/apps/desktop/src/styles.css index 1c0601c..bb4b3fd 100644 --- a/apps/desktop/src/styles.css +++ b/apps/desktop/src/styles.css @@ -2,6 +2,12 @@ @custom-variant dark (&:where(.dark, .dark *)); :root { + --theme-hue: 60; + --theme-saturation: 4%; + --background-lightness: 97%; + --content-lightness: 13%; + --glass-tint: 3%; + --glass-base: 72%; --snaphub-accent: #d9ff43; --capture-overlay: rgb(7 8 7 / 64%); --color-lime-300: var(--snaphub-accent); @@ -16,6 +22,50 @@ text-rendering: geometricPrecision; } +.dark { + --background-lightness: 10%; + --content-lightness: 93%; + --glass-tint: 5%; + --glass-base: 70%; +} + +@theme { + --color-background-base: hsl(var(--theme-hue) var(--theme-saturation) var(--background-lightness)); + --color-content: hsl(var(--theme-hue) var(--theme-saturation) var(--content-lightness)); + --color-accent: var(--snaphub-accent); + --color-accent-ink: #12130f; + --color-danger: #dc2626; + + /* A surface arriving: page, dialog, popover. */ + --ease-arrive: cubic-bezier(0.16, 1, 0.3, 1); + /* Collapse, toast, icon swap. */ + --ease-settle: cubic-bezier(0.22, 1, 0.36, 1); + /* Follows the pointer: indicators, switch thumb. */ + --ease-track: cubic-bezier(0.2, 0.8, 0.2, 1); +} + +/* Dashboard page: Mica shows through, carrying a breath of the accent. */ +body.dashboard-surface { + background: var(--color-background-base); + color: var(--color-content); +} + +html.glass { + background: transparent; +} + +html.glass body.dashboard-surface { + background: + linear-gradient(color-mix(in oklab, var(--color-accent) var(--glass-tint), transparent) 0 0), + color-mix(in oklab, var(--color-background-base) var(--glass-base), transparent); +} + +html.dark-dashboard-swap *, +html.dark-dashboard-swap *::before, +html.dark-dashboard-swap *::after { + transition: none !important; +} + * { box-sizing: border-box; } From 414eab0d45fe171219c94c611a829c976e7f208d Mon Sep 17 00:00:00 2001 From: Nakul Srivastava Date: Fri, 20 Nov 2026 10:25:42 +0530 Subject: [PATCH 02/40] feat(ui): shared Switch, SettingsCard, SettingRow, Segmented, Keycap, Button, PageHeader Co-Authored-By: Claude Sonnet 5.5 --- apps/desktop/src/components/ui/Button.tsx | 27 ++++++++ apps/desktop/src/components/ui/Keycap.tsx | 8 +++ apps/desktop/src/components/ui/PageHeader.tsx | 15 +++++ apps/desktop/src/components/ui/Segmented.tsx | 63 +++++++++++++++++++ apps/desktop/src/components/ui/SettingRow.tsx | 18 ++++++ .../src/components/ui/SettingsCard.tsx | 60 ++++++++++++++++++ apps/desktop/src/components/ui/Switch.tsx | 30 +++++++++ 7 files changed, 221 insertions(+) create mode 100644 apps/desktop/src/components/ui/Button.tsx create mode 100644 apps/desktop/src/components/ui/Keycap.tsx create mode 100644 apps/desktop/src/components/ui/PageHeader.tsx create mode 100644 apps/desktop/src/components/ui/Segmented.tsx create mode 100644 apps/desktop/src/components/ui/SettingRow.tsx create mode 100644 apps/desktop/src/components/ui/SettingsCard.tsx create mode 100644 apps/desktop/src/components/ui/Switch.tsx diff --git a/apps/desktop/src/components/ui/Button.tsx b/apps/desktop/src/components/ui/Button.tsx new file mode 100644 index 0000000..0662be6 --- /dev/null +++ b/apps/desktop/src/components/ui/Button.tsx @@ -0,0 +1,27 @@ +import type { ButtonHTMLAttributes } from "react"; + +type ButtonVariant = "primary" | "secondary" | "ghost"; + +type ButtonProps = ButtonHTMLAttributes & { + variant?: ButtonVariant; +}; + +const variantClasses: Record = { + primary: "bg-accent text-accent-ink hover:brightness-95 active:scale-[0.97]", + secondary: "bg-content/6 text-content hover:bg-content/10 active:scale-[0.97]", + ghost: "text-content/60 hover:bg-content/6 hover:text-content", +}; + +/** + * Press feedback (`scale 0.97`) is limited to primary and secondary: those commit + * an action. Disabled buttons drop to 40% and ignore hover and press. + */ +export function Button({ variant = "secondary", className = "", type = "button", ...rest }: ButtonProps): React.JSX.Element { + return ( + + ); + })} + + ); +} diff --git a/apps/desktop/src/components/ui/SettingRow.tsx b/apps/desktop/src/components/ui/SettingRow.tsx new file mode 100644 index 0000000..53365f9 --- /dev/null +++ b/apps/desktop/src/components/ui/SettingRow.tsx @@ -0,0 +1,18 @@ +type SettingRowProps = { + label: string; + hint?: string; + children: React.ReactNode; +}; + +/** A label (and optional hint) on the left, its control on the right. Rows divide themselves. */ +export function SettingRow({ label, hint, children }: SettingRowProps): React.JSX.Element { + return ( +
+
+

{label}

+ {hint === undefined ? null :

{hint}

} +
+
{children}
+
+ ); +} diff --git a/apps/desktop/src/components/ui/SettingsCard.tsx b/apps/desktop/src/components/ui/SettingsCard.tsx new file mode 100644 index 0000000..0b43904 --- /dev/null +++ b/apps/desktop/src/components/ui/SettingsCard.tsx @@ -0,0 +1,60 @@ +import { ChevronDown, type CapkitIconComponent } from "../icons"; + +type SettingsCardProps = { + id: Id; + open: boolean; + onToggle: (id: Id) => void; + icon: CapkitIconComponent; + title: string; + /** The current value, shown while the card is closed so most people never expand it. */ + summary?: React.ReactNode; + /** One supporting line, shown only when open. */ + hint?: string; + children: React.ReactNode; +}; + +/** + * One collapsible settings group, following the ARIA accordion pattern: the + * `h2` holds a single button, and that whole header row is the click target. + * The body animates with `grid-template-rows` (open 220 ms, close 160 ms) and is + * `inert` while closed so focus and the accessibility tree skip it. Several + * cards may be open at once; each animates alone. + */ +export function SettingsCard({ id, open, onToggle, icon: Icon, title, summary, hint, children }: SettingsCardProps): React.JSX.Element { + const bodyId = `settings-section-${id}`; + return ( +
+

+ +

+
+
+
+ {hint === undefined ? null :

{hint}

} + {children} +
+
+
+
+ ); +} diff --git a/apps/desktop/src/components/ui/Switch.tsx b/apps/desktop/src/components/ui/Switch.tsx new file mode 100644 index 0000000..eb197c6 --- /dev/null +++ b/apps/desktop/src/components/ui/Switch.tsx @@ -0,0 +1,30 @@ +type SwitchProps = { + checked: boolean; + onChange: (checked: boolean) => void; + /** Accessible name of the switch. */ + label: string; + disabled?: boolean; +}; + +/** + * The one on/off control in the dashboard. A visually hidden checkbox with + * `role="switch"` sits inside a `