Repository Public
1# SP Drive Visual System 2.0 — web23The token contract is shared by the three clients and lives in `sp-drive-macos.git`, `docs/next/DESIGN-SYSTEM-V2.md`4(macOS: `SPDTheme`). This file is the **web section**: how the web application mirrors those tokens, what it adds, the5components built on them and the motion rules. Implementation: `apps/web/src/styles.css` (tokens, motion),6`apps/web/src/ui.tsx` (building blocks), `apps/web/src/next/` (2.0 screens).78## 1. Principles, as applied on the web9101. **Calm surfaces.** White canvas (`canvas`), one pane colour for the sidebar and the inspector (`surface`), one well11 behind previews and tracks (`sunken`). No gradient background, no glow, no card around a whole screen. Lists and12 groups are delimited by a hairline (`elevation.e0`), not by a filled card.132. **Editorial type.** The serif (`ui-serif, "New York", "Iowan Old Style", Georgia`) names places and moments: every14 `h1` (folder titles, screen titles), dialog titles, empty states, the product name. Everything you operate is the15 system sans. Group labels are the `eyebrow` (10 px, semibold, +0.06 em, uppercase).163. **One accent.** Violet `brand` for controls, selection, progress, links. The indigo → violet gradient exists in the17 app mark only. The 1.0 gradient classes (`.grad`, `.btn-grad`, `.text-grad`) are kept as names and are now flat.184. **Restrained translucency.** `.glass` (the `bar` colour + 20 px blur) is used where content really passes19 underneath: the command palette, menus and popovers, the phone tab bar. Nowhere else.205. **Meaning is never colour alone.** Status colours always come with a glyph or a word (`Badge`, activity dots carry21 an icon, the live indicator has a label, chart swatches have a name and a value).226. **Motion explains, then gets out of the way.** Every animation is one of the named motions below, transform /23 opacity only, with a reduced form.2425## 2. Tokens2627All tokens are CSS custom properties on `:root`, re-declared under `.dark` (the class is on `<html>`, or on a subtree28such as the immersive viewer) and under `@media (prefers-contrast: more)`. Names and values are the shared ones.2930| Shared token | CSS variable | Tailwind utility used in components |31|---|---|---|32| `brand`, `brandIndigo` | `--spd-color-brand`, `--spd-color-brand-indigo` | `bg-accent`, `text-accent` |33| `brandWash`, `selection` | `--spd-color-brand-wash`, `--spd-color-selection` | `bg-accent-soft`, `bg-selection` |34| `canvas`, `surface`, `surfaceRaised`, `sunken` | `--spd-color-canvas` / `-surface` / `-surface-raised` / `-sunken` | `bg-canvas` (`bg-bg`), `bg-pane` (`bg-hover`), `bg-surface` / `bg-raised`, `bg-well` |35| `hairline` | `--spd-color-hairline` | `border-line`, `divide-line` |36| `textPrimary`, `textSecondary`, `textTertiary` | `--spd-color-text-primary` / `-secondary` / `-tertiary` | `text-ink`, `text-ink-2`, (see below) |37| `onBrand` | `--spd-color-on-brand` | `text-on-brand`, `text-accent-ink` |38| `positive`, `warning`, `critical` | `--spd-color-positive` / `-warning` / `-critical` | `text-ok` / `text-warn` / `text-danger` (+ `bg-*-soft`) |39| type scale `display … figure` | `--spd-type-display`, `-title`, `-headline`, `-body`, `-body-strong`, `-callout`, `-caption`, `-eyebrow`, `-mono`, `-figure` (CSS `font` shorthands) | classes `.spd-display`, `.spd-title`, `.spd-eyebrow`, `.spd-mono`, `.spd-figure` |40| `Space.xxs … xxxl` | `--spd-space-xxs` … `--spd-space-xxxl` (2 · 4 · 8 · 12 · 16 · 24 · 32 · 48) | Tailwind's 4-px scale (`gap-2` = `sm`, `p-4` = `lg`…) |41| `Radius.xs … xl` | `--spd-radius-xs` … `-xl` (4 · 6 · 10 · 14 · 20) | `rounded-md` 6, `rounded-[10px]` / `rounded-xl` 10, `rounded-[12px]`, `rounded-[14px]`, `rounded-[20px]` |42| `Size.gridCell`, `Size.palette` | `--spd-size-grid-cell` (148), `--spd-size-palette` (620) | grid `minmax(10.5rem, 1fr)` (168 px: the 148 step plus the cell padding); palette `max-w-[620px]` |43| `Elevation.e0 … e3` | `--spd-elevation-e0` … `-e3` (each includes the hairline; shadow opacity ×1.7 in dark through `--spd-shadow-k`) | `shadow-(--spd-elevation-e0)`, `shadow-card` = e1, `shadow-pop` = e2 |44| durations, curves | `--spd-duration-instant/quick/standard/slow`, `--spd-curve-standard/enter/exit/spring-snappy/spring-gentle` | — |45| motions | `--spd-motion-select/hover/navigate/reveal/dismiss/drop/progress/ambient` (`<duration> <curve>`) | classes of §4 |4647The short names the 1.0 components were written with (`--bg`, `--surface`, `--ink`, `--accent`, `--line`…) are now48aliases of the shared tokens, declared once: this is what re-skinned the 8,000 existing lines without rewriting them.4950### Web additions (not in the shared table)5152| CSS variable | Light / dark | Why |53|---|---|---|54| `--spd-color-text-tertiary-aa` | `#6C6C76` / `#9696A0` | `textTertiary` is 3.4 : 1 on white. The web uses the tertiary role for 11–13 px captions everywhere, which WCAG AA wants at 4.5 : 1. `text-ink-3` therefore maps to this AA form (5.2 : 1 on white, 5.9 : 1 on the dark canvas); the exact `textTertiary` stays available for large glyphs and chart neutrals. |55| `--spd-color-hairline-strong` | black 17 % / white 20 % | Field borders (inputs, selects) need more than a separator to read as a control. |56| `--spd-color-positive-wash`, `-warning-wash`, `-critical-wash` | status colour at 10–16 % | Soft fills behind status text (badges, banners). |57| `--spd-color-scrim`, `--spd-color-bar` | — | The veil under sheets; the translucent bar/menu material. |58| `--spd-viz-1 … 8` | `#2a78d6 #eb6834 #1baf7a #eda100 #e87ba4 #008300 #6250d6 #e34948` / dark steps | Categorical palette of the storage charts, in fixed slots (image, PDF, document, sheet, video, audio, archive, text). Checked with a colour-vision validator on both canvases: adjacent pairs ≥ ΔE 8 under protan/deutan simulation, ≥ ΔE 15 for normal vision. Three light-mode slots are under 3 : 1 against white, so a swatch is never alone: the legend always gives the name and the value. |59| `--spd-curve-spring-snappy`, `-spring-gentle` | cubic-bézier approximations | CSS has no spring; the two shared springs are approximated (`(0.3, 1.25, 0.5, 1)`, `(0.25, 1.1, 0.4, 1)`). |6061Body size: the shared `body` is 13 px (macOS point size). The web uses 13 px for rows, menus and controls on pointer62devices (`sm:` and up) and 15–16 px on phones (touch targets 44 px, and iOS zooms a focused field under 16 px).6364Contrast computed (WCAG 2.1 ratio, light / dark, against `canvas`): `textPrimary` 18.0 / 15.4 · `textSecondary` 6.6 /657.1 · `textTertiary` 3.4 / 4.2 (hence the AA form) · tertiary-AA 5.2 / 5.9 (4.8 on `surface` and on `surfaceRaised`66dark) · `brand` 5.8 / 5.7 · `onBrand` on `brand` 5.8 / 6.1 · `positive` 4.1 / 7.8 · `warning` 4.0 / 9.3 · `critical`675.3 / 6.2. In light mode `positive` and `warning` are under 4.5 : 1: they are used with a glyph, at 13 px medium or68larger, or as fills — never as the only carrier of a small caption.6970## 3. Components7172| Component | Where | Notes |73|---|---|---|74| Shell | `shell/Shell.tsx` | Sidebar on `surface` with a hairline (places · collections · library · storage meter), top bar (search well, live indicator, transfers, theme, notifications, account). Phones: compact top bar + translucent tab bar (4 destinations + "Plus"). |75| Buttons | `ui.tsx` `Button`, `IconButton` | Radius `md`; 44 px on touch, 36 px with a pointer. Primary = flat `brand`. |76| Dialog | `ui.tsx` `Dialog` | `layout="sheet"` (bottom sheet on phones, card elsewhere, `wide` / `wide="xl"`), `"palette"` (bare translucent panel, 620 px, near the top), `"side"`. Focus is trapped and restored, Escape closes, the title is the accessible name. |77| Menu | `ui.tsx` `Menu` | Popover on pointer devices (translucent, e2), action sheet on phones. Arrow keys, Home/End, Escape. |78| Empty state | `ui.tsx` `EmptyState`, `art.tsx` | Halo symbol in the accent, `display` title, one sentence, **real actions** (upload, new folder, receive files here, clear filters, search by meaning, go to my files). |79| Folder tile / file card / list row | `explorer/Items.tsx` | Folder: a hairline tile with the accent symbol. File: the thumbnail in a `sunken` well (radius `md`), name and facts under it, no card chrome. Selected: `selection` wash + accent ring. List: one hairline group, 48 px rows (64 px on phones). Search results add the snippet with `<mark>` and a page chip. |80| Inspector | `next/Inspector.tsx` | Docked pane (sheet on phones, side pane in the viewer): Details · Activity · Text · Members · Ask. Opening it never leaves the listing. |81| Transfer centre | `explorer/UploadPanel.tsx` | Mounted by the shell: reachable from every screen (top-bar button, palette). Ring + bar with real bytes, speed, remaining bytes, pause / resume / retry / cancel, interrupted sessions, history from `GET /uploads?state=recent`. Stays beside the inspector. |82| Command palette | `shell/Palette.tsx` | Actions of the screen in front (from `next/context.ts`), navigation, collections, recent files, files by name and content with the passage. |83| Timeline | `next/Activity.tsx` | Icon dot + sentence + who + when, grouped by day; used by the inspector, the folder dialog, the member view and the account page. |84| Time machine | `next/TimeMachine.tsx` | Version rail + comparison pane: line diff (Myers, `next/diff.ts`), images and PDF pages side by side, an explicit statement for other binary formats. |85| Storage charts | `next/Storage.tsx` | Segmented quota bar, stacked bar by kind with a labelled legend, squarified treemap with drill-down, 90-day bars, largest files with proportional washes. Plain SVG/CSS, ~200 lines, no chart library. |86| Collection builder | `next/Collections.tsx` | Field · comparison · value rows, all/any, sort, live preview from `POST /collections/preview`. |87| Members | `next/Members.tsx`, `next/Shared.tsx` | Invite by exact address, role picker with what each role allows, workspace name, folder activity; member side with role-appropriate UI. |88| AI | `next/ai/` | Streamed answer, `[n]` citation chips that reveal and open the source, route/model selector with original monochrome marks (`marks.tsx`: MacLustr, Anthropic, OpenAI, OpenRouter) and the maker of the model in words, explicit unavailable states, review list for suggestions. |89| Portal builder | `sharing/RequestDialog.tsx`, `next/PortalPreview.tsx` | The 1.0 form beside a live, inert preview of the public page ("Deposit" / "After sending"). |90| Public pages | `public-pages/` | Same tokens; the portal keeps its owner-chosen brand colour for the header band and the send button. |9192Accessibility rules applied everywhere: every control has a text label or `aria-label`; tabs are `role="tab"` with93`aria-selected`; the listing is a `grid` with roving focus; focus is visible (2 px accent outline, fields show their94own border ring); dialogs and sheets trap and restore focus; live regions announce transfers, answers and counts;95nothing depends on hover (treemap and chart hints are also reachable by focus, and their figures are in the legends).9697## 4. Motion9899| Motion | CSS | Used for | Reduced motion |100|---|---|---|---|101| `select` | `var(--spd-motion-select)` | selection, pressed states | instant |102| `hover` | `var(--spd-motion-hover)` — `.press` | hover washes, button press (scale 0.97) | instant |103| `navigate` | `.anim-nav[data-dir]` (`nav-deeper` / `nav-back`: 18 px + fade), `.anim-side`, `.anim-rise` | **Fluid folder navigation**: entering a folder slides the listing in from the right, going back from the left, same level cross-fades (the direction comes from the breadcrumb depth). Side panes arrive from their edge. | 0.10 s fade, no shift (`--spd-navigate-shift: 0`) |104| `reveal` | `.anim-pop`, `.anim-sheet` | palette, menus, dialogs (sheet from the bottom on phones) | 0.10 s fade |105| `dismiss` | `var(--spd-motion-dismiss)` | closing | 0.10 s fade |106| `drop` | `.drop-target` (`drop-pulse`: scale 1 → 1.05 → 1.03, wash, accent ring, e2) | **A valid drop target answers the drag**: folder tiles, breadcrumb crumbs, the upload surface of a shared folder, the desktop drop overlay | wash and ring only |107| `progress` | `transform: scaleX()` with `var(--spd-motion-progress)`; `stroke-dashoffset` for rings | progress bars, the storage meter, the transfer ring | same |108| `ambient` | `.anim-ambient` | the live indicator while the stream is down | removed |109| chart entrance | `.anim-grow-x`, `.anim-grow-y`, `.anim-cell` (slow, `enter`) | storage bars and treemap cells growing from their baseline | none (global rule below) |110111**File card → preview morph.** Opening a file runs a View Transition: the thumbnail of the card gets112`view-transition-name: spd-morph`, the state changes inside `document.startViewTransition` (`flushSync`), and the113content area of the viewer carries the same name — the browser animates one element from the card's rectangle to the114full preview (`::view-transition-group(spd-morph)`, slow / enter). Closing runs it backwards. Where the API is missing115(Firefox at the time of writing) or reduced motion is on, the viewer simply fades in. The theme switch uses the root116view transition.117118Rules: only `transform` and `opacity` are animated (progress bars are scaled, not resized; rings animate a stroke119offset); nothing loops except `ambient`, the spinner and the loading shimmer;120`@media (prefers-reduced-motion: reduce)` maps the motion variables to their reduced forms and cuts every remaining121animation and view transition to nothing.122123## 5. What is deliberately not here124125- No external font, icon font, script or image: the CSP is `script-src 'self'; connect-src 'self'`. Icons are inline126 SVG paths (`glyphs.tsx`), illustrations are drawn in code.127- No chart or animation library.128- "Spatial Drive" (free canvas) is not part of this delivery — see `PERF-web.md` / the delivery notes.129