Repository Public
1# SP Wallet Design System (NEXT) — 2.023One system for the web app, the macOS app and the iOS app. Same values, native components on each platform.45**Source of truth:** `design/tokens.json`. Generated by `node scripts/gen-design-tokens.mjs`:67| Output | Used by |8|---|---|9| `apps/web/src/tokens.css` — CSS variables (light, dark, system), type-role classes, life-cycle tones | web |10| `apps/web/src/tokens.gen.ts` — life-cycle status vocabulary, series names | web |11| `design/generated/SPWalletTokens.swift` — `SPTokens` (palette, series, aurora, type scale, spacing, radii, elevation, motion, status) | copied into the `SPWalletUI` Swift target, used by macOS and iOS |1213`node scripts/gen-design-tokens.mjs --check` fails when an output is stale, and generation itself fails when a text pair14drops under 4.5 : 1 (the `contrast` list of the token file, plus the balance-card text against the aurora's lightest15possible point). A screen never writes a literal colour, size, radius or duration.1617## 1. Principles18191. **The amount is the hero.** One dominant figure per screen, in the display role; everything else is quiet.202. **Honest before handsome.** Every figure says what it is (estimate, as of when, partial). A review shows every signed21 field in full. Nothing the owner is about to approve is animated, truncated or folded away. A stale value looks stale.223. **Depth by layering.** Hairlines, soft elevation, translucent bars. One gradient only: the balance card's aurora.234. **Colour never carries a meaning alone.** Gains keep sign and arrow, states keep symbol and word, chart parts keep24 name and share.255. **Native on each platform.** Same tokens; navigation, controls, gestures, typography scaling and motion come from the26 platform (SwiftUI on Apple, the browser on the web). No web view in the native apps, no imitation of iOS on the web.276. **Motion is short and optional.** Transform and opacity only, ≤ 360 ms, none under Reduce Motion.2829## 2. Tokens3031**Colour** (light / dark): `bg`, `surface`, `elev`, `line`, `ink`, `mute`, `accent`, `positive`, `negative`, `caution`,32`primary` / `onPrimary`, `onNegative`, `plate`, and the balance card's `heroBase` / `heroInk` / `heroMute` (identical in33both themes). All text pairs ≥ 4.5 : 1; measured values are printed by the generator.34Changes from v9: `blue` → `accent` (slightly deeper in light, 6.7 : 1), `emerald` → `positive`, `danger` → `negative`,35`warn` → `caution`; in dark the primary button is ink-on-light instead of emerald (emerald is kept for meaning only);36a sixth data series; the aurora is defined by tokens and shared with the native apps.3738**Type scale** — eleven roles: `display` 44, `title1` 30, `title2` 22, `headline` 17, `body` 15, `bodyStrong` 15,39`callout` 14, `footnote` 13, `eyebrow` 11.5 (caps), `micro` 11, `mono` 13. System fonts. Web sizes are emitted in `rem`40(the reader's browser text size applies). On Apple each role maps to a Dynamic Type text style and scales with it; display41amounts shrink to fit (`minimumScaleFactor`) rather than truncate. Amounts in columns use tabular figures; display amounts42use proportional figures.4344**Spacing** 4-pt grid (`space.1` = 4 … `space.16` = 64). **Layout**: gutter 20, card padding 20, row ≥ 60, asset row 68,45target ≥ 44, content max 1120, reading max 672, sidebar 256. **Radius**: `xs` 8, `sm` 12, `md` 16, `lg` 22 (cards),46`xl` 28 (balance card, sheets), `full`. **Elevation**: `e1` card, `e2` raised control, `e3` sheet / balance card.47**Motion**: 90 / 140 / 220 / 360 ms; easings `standard`, `spring`, `exit`; Apple spring response 0.36, damping 0.86.4849## 3. Transfer status — one vocabulary5051The API field `lifecycle` has fourteen values. Each has one tone, one symbol and one word on the three platforms52(`status` in the token file):5354| lifecycle | tone | FR | EN |55|---|---|---|---|56| draft | mute | Brouillon | Draft |57| awaiting_confirmation | accent | À confirmer | Awaiting confirmation |58| awaiting_signature | accent | Signature en cours | Awaiting signature |59| signed | accent | Signée | Signed |60| broadcasting | accent | Envoi au réseau | Broadcasting |61| pending | caution | En attente | Pending |62| confirming | accent | En confirmation | Confirming (in a block, not final; shows `confirmations`) |63| confirmed | positive | Confirmée | Confirmed — said only of a final transaction |64| failed | negative | Échouée | Failed |65| replaced | caution | Remplacée | Replaced |66| dropped | caution | Non incluse | Dropped |67| expired | mute | Expirée | Expired |68| rejected | mute | Refusée par vous | Rejected |69| not_sent | mute | Signée, non envoyée | Signed, not sent |7071`dropped` and `replaced` always show their explanation (`errorCode` text) and, while `watched` is true, the line72"still watched". A client older than `lifecycle` reads `state`.7374## 4. Components (same anatomy everywhere)7576| Component | Anatomy and rules |77|---|---|78| **Balance card** | aurora over `heroBase`, radius `xl`, `e3`. Eyebrow "Valeur estimée" · display amount · change chip (absolute + %, sign and arrow, period named) · freshness line ("à jour à 14:32" / "partiel : 2 réseaux indisponibles"). Hidden-balance mode replaces figures by "••••" everywhere at once. Never a performance word for an estimate. |79| **Range selector** | segmented `1D 1W 1M 3M 1Y ALL` (FR: `1J 1S 1M 3M 1A TOUT`); arrow keys on web and macOS; selection announced. |80| **Value chart** | line in `accent` with a soft area, no grid; scrub shows value and date; points flagged incomplete are not drawn (a gap is shown as a gap); accessible summary (first, last, min, max, change); haptic tick on iOS scrubbing. Flows (deposits / withdrawals) are marked on the axis so that a deposit does not read as a gain. |81| **Allocation** | one horizontal bar in series colours + a legend list with name and share; toggle "par actif / par réseau". Not a donut. |82| **Asset row** | logo with network badge · name + network · amount + fiat · 24 h change. Unverified token: caution "Non vérifié" pill, never a price. Hidden assets live under "Masqués". |83| **Transaction row / detail** | direction symbol · counterparty (contact label when known, else shortened address, full on detail) · amount · status pill from §3. Detail: every field, hash with copy and explorer link, confirmations, fee paid ("frais payés") or fee estimate labelled as such, timeline of the life cycle with times. |84| **Status pill** | symbol + word, tone tint at 10–14 % with tone text (≥ 4.5 : 1). |85| **Stat tile** | eyebrow label · headline value · footnote context (network fee now, fees paid this month, inflow / outflow). |86| **Notice / banner** | tone bar, symbol, sentence, optional action. Levels: info, caution, negative. Stale-data banner is caution and names the time. |87| **Buttons** | primary (one per screen), secondary (elev fill), quiet (text), destructive. Height 48 touch / 32 pointer (macOS regular). Busy state keeps the label and adds a spinner; never changes width. |88| **Sheet / dialog** | radius `xl` top, `e3`, scrim; focus trapped and restored; Escape closes unless an operation's outcome is unknown. |89| **Fields** | 16 px text minimum on touch; inline validation message under the field; address fields are mono with paste, scan (iOS), contact picker. |90| **Skeleton / empty / error** | skeleton shaped like the content; empty state says what will appear and offers the first action; error state names what failed and offers Retry — a spinner is never the final state. |91| **Review (approval)** | generated from the canonical object: every signed field, ordered, labelled, full values. The passkey button states the action and the amount. |92| **Outcome-unknown panel** | caution: "État inconnu — ne renvoyez pas." Retry-check, link to Activity. No reset, no cancel. |9394## 5. Screens9596**Dashboard.** Balance card → range selector + value chart → quick actions (Envoyer, Recevoir, Échanger, Scanner on iOS) →97alerts strip (only when something needs attention) → allocation → held assets (top 6, "tout voir") → recent activity (5) →98tiles: network fees now, fees paid (period), inflow / outflow (period).99Web desktop and macOS: two columns (value + assets | activity + tiles) inside `contentMax`; phone: one column.100101**Assets.** Search (name, symbol, network, contract) · filters (held, favourites, network) · rows · "Masqués". Asset page:102price chart, holding, per-network breakdown, contract with copy / explorer, movements of that asset (server-filtered).103104**Send.** Asset and network → recipient (paste, scan, contacts; validation per network; warnings) → amount (fiat105equivalent, Max, available) → review → passkey → tracker (life-cycle timeline, live by the event stream).106107**Receive.** Network → QR on a white plate, address in full, copy, share (address or payment URI), network notices.108109**Activity.** Timeline by day, filters (kind, asset, network, status, period), search, cursor pagination, export CSV.110111**Contacts.** List, add, edit, delete, favourite; network-bound; changing an address requires confirming the old and new112values and raises a security event.113114**Security Center.** Signer and halt state · passkeys (list from the signer, add, revoke) · sessions (current marked,115revoke one, revoke all) · last logins · security alerts · limits (read-only) · recovery status ("phrase notée : jamais /116date") · backups.117118**Settings.** Language, currency, appearance (system / light / dark), privacy (hide balances, widget / notification119content), notifications, networks status, about (version + commit).120121**Search (⌘K on web and macOS, pull-down on iOS).** Assets, contacts, transactions (hash, address, amount), settings.122123## 6. Platform mapping124125| | Web | macOS | iOS / iPadOS |126|---|---|---|---|127| Navigation | sidebar ≥ 1024 px, tab bar below | `NavigationSplitView` sidebar, multiple windows, toolbar search | `TabView` (compact), sidebar (regular) |128| Type scaling | `rem` | Dynamic Type text styles | Dynamic Type, tested to AX3 on core screens |129| Theme | system / light / dark, stored in account settings | system (override in settings) | system (override in settings) |130| Pointer | hover, focus ring, shortcuts | hover, context menus, keyboard commands, menus | touch, context menus, haptics, pull to refresh |131| Unlock | WebAuthn | Touch ID app lock + passkey | Face ID app lock + passkey |132| Privacy | hide balances | lock covers every window; hide balances | privacy cover in the app switcher (above sheets); widgets and notifications without amounts unless enabled |133| Haptics | — | — | selection (range, scrub), success (confirmed), warning (dropped / replaced), error (failed) |134135## 7. Accessibility136137Contrast ≥ 4.5 : 1 for text (checked at generation); targets ≥ 44 pt; visible focus; every chart has a text summary;138every status has a word; reduced motion honoured; VoiceOver labels on every control and amount (amounts read with unit139and currency, addresses read in groups); no information by colour or position alone; forms announce errors.140141## 8. Migration from v9142143Web: `styles.css` imports `tokens.css`; v9 variable names stay as aliases for one release (`--blue` → `--accent`, …) while144screens move to the roles and type classes; literal pixel sizes are replaced by type roles and spacing tokens.145iOS: `Components/Theme.swift` reads `SPTokens`; fixed-size fonts become scaled roles. macOS: the indigo gradient, system146greys, donuts and letter discs are replaced by the shared tokens, the aurora card, the allocation bar and the real logos.147