Files
ForgeBase/docs/Max_Design_System.md
T
williamandClaude Sonnet 5 d46a1ca69f feat(design-system): apply Max_Design_System tokens to all components
Add docs/Max_Design_System.md as the mandatory source of truth for
every Max Avatar component (existing and future): CSS custom properties
(tokens.css), the documented component library for the upcoming coach
pipeline UI (chat bubble, module panel, exercise card, stepper, input
bar, badge, code block — components.css), and bespoke app-level
components that follow the same tokens where the doc has no direct
equivalent (thinking indicator, banners, login panel — app.css).

Rewrite LoginView, ThinkingIndicator, UpdateBanner and VoiceErrorBanner
to use these classes instead of ad-hoc inline styles with hardcoded
hex colors. Self-host Inter and JetBrains Mono via @fontsource (the
only two fonts the design system allows) since the renderer's CSP has
no external font-src. Drop base.css's unused electron-vite boilerplate
palette (--ev-c-*) in favor of the design tokens.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-31 21:07:54 +01:00

396 lines
9.8 KiB
Markdown

# Max — Design System & CSS Template
> Ce document définit les tokens CSS et les règles visuelles à respecter pour tous les composants de Max. Max est un **avatar 3D de bureau** — les composants sont des **panneaux flottants**, des **bulles**, des **cartes** qui apparaissent autour de l'avatar. Pas des pages entières.
---
## Contexte d'utilisation
Max s'affiche comme une fenêtre Electron transparente, always-on-top. Les composants UI sont de petites surfaces qui apparaissent autour ou à côté de l'avatar 3D selon le contexte :
- Une **bulle de chat** pour les messages
- Un **panneau de module** pour afficher le contenu de cours
- Des **cartes d'exercice** pour les exercices
- Un **stepper** pour la progression dans le pipeline
- Une **barre de saisie** pour l'input utilisateur
- Des **badges de statut** pour indiquer l'état de Max
Tous ces composants sont compacts, semi-transparents, et ne doivent jamais cacher l'avatar.
---
## Tokens CSS
À placer dans un fichier `src/renderer/styles/tokens.css` importé globalement.
```css
:root {
/* ── Couleurs de base ── */
--bg: #0C0D12; /* fond principal de la fenêtre */
--surface: #111318; /* surface des panneaux */
--surface-2: #16181F; /* surface secondaire, hover */
/* ── Bordures ── */
--border: rgba(255, 255, 255, 0.06);
--border-active: rgba(99, 102, 241, 0.30);
--border-hover: rgba(255, 255, 255, 0.10);
/* ── Accent ── */
--accent: #6366F1; /* indigo — couleur principale */
--accent-dim: rgba(99, 102, 241, 0.12); /* fond des éléments actifs */
--accent-glow: rgba(99, 102, 241, 0.08); /* halo très subtil avatar uniquement */
/* ── Texte ── */
--text-1: #E4E6EE; /* texte principal */
--text-2: #6B7280; /* texte secondaire, labels */
--text-3: #2D3148; /* texte désactivé, placeholders */
/* ── Sémantique ── */
--green: #34D399;
--green-dim: rgba(52, 211, 153, 0.10);
--amber: #FBBF24;
--red: #F87171;
/* ── Typographie ── */
--font-sans: 'Inter', system-ui, sans-serif;
--font-mono: 'JetBrains Mono', 'Fira Code', monospace;
--text-xs: 11px;
--text-sm: 12px;
--text-base: 13.5px;
--text-md: 15px;
--text-lg: 18px;
--weight-normal: 400;
--weight-medium: 500;
--weight-semi: 600;
--leading-tight: 1.4;
--leading-body: 1.75;
/* ── Espace ── */
--space-1: 4px;
--space-2: 8px;
--space-3: 12px;
--space-4: 16px;
--space-5: 20px;
--space-6: 24px;
/* ── Rayons ── */
--radius-sm: 6px;
--radius-md: 9px;
--radius-lg: 14px;
--radius-full: 9999px;
/* ── Ombres ── */
--shadow-panel: 0 8px 32px rgba(0, 0, 0, 0.45);
--shadow-card: 0 2px 8px rgba(0, 0, 0, 0.30);
/* ── Transitions ── */
--ease: 0.15s ease;
}
```
---
## Composants
### Chat bubble — bulle de message
```css
/* Conteneur de conversation */
.chat-bubble {
max-width: 280px;
padding: var(--space-3) var(--space-4);
border-radius: var(--radius-lg);
font-family: var(--font-sans);
font-size: var(--text-base);
line-height: var(--leading-body);
box-shadow: var(--shadow-panel);
}
/* Message de Max */
.chat-bubble--max {
background: var(--surface);
border: 1px solid var(--border);
color: var(--text-1);
border-bottom-left-radius: var(--radius-sm);
}
/* Message de l'utilisateur */
.chat-bubble--user {
background: var(--accent-dim);
border: 1px solid var(--border-active);
color: var(--text-1);
border-bottom-right-radius: var(--radius-sm);
align-self: flex-end;
}
```
### Module panel — panneau de cours
```css
.module-panel {
width: 420px;
max-height: 520px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
box-shadow: var(--shadow-panel);
display: flex;
flex-direction: column;
overflow: hidden;
}
.module-panel__header {
padding: var(--space-4) var(--space-5);
border-bottom: 1px solid var(--border);
flex-shrink: 0;
}
.module-panel__tag {
font-size: var(--text-xs);
font-weight: var(--weight-medium);
color: var(--accent);
margin-bottom: var(--space-1);
}
.module-panel__title {
font-size: var(--text-md);
font-weight: var(--weight-semi);
letter-spacing: -0.3px;
color: var(--text-1);
}
.module-panel__body {
flex: 1;
overflow-y: auto;
padding: var(--space-5);
font-size: var(--text-base);
line-height: var(--leading-body);
color: #9097B0;
scrollbar-width: thin;
scrollbar-color: var(--surface-2) transparent;
}
```
### Exercise card — carte d'exercice
```css
.ex-card {
padding: var(--space-4);
background: var(--bg);
border: 1px solid var(--border);
border-radius: var(--radius-md);
cursor: pointer;
transition: border-color var(--ease);
}
.ex-card:hover {
border-color: var(--border-active);
}
.ex-card__level {
font-size: var(--text-xs);
font-weight: var(--weight-medium);
margin-bottom: var(--space-2);
}
.ex-card__level--easy { color: var(--green); }
.ex-card__level--medium { color: var(--amber); }
.ex-card__level--hard { color: var(--red); }
.ex-card__text {
font-size: var(--text-sm);
color: var(--text-2);
line-height: var(--leading-tight);
}
```
### Pipeline stepper — progression session
```css
.step {
display: flex;
align-items: center;
gap: var(--space-2);
padding: var(--space-2) var(--space-2);
border-radius: var(--radius-sm);
border: 1px solid transparent;
}
.step--done { opacity: 0.45; }
.step--pending { opacity: 0.25; }
.step--active {
background: var(--accent-dim);
border-color: var(--border-active);
}
.step__num {
width: 18px;
height: 18px;
border-radius: 5px;
display: flex;
align-items: center;
justify-content: center;
font-size: 9px;
font-weight: var(--weight-semi);
flex-shrink: 0;
}
.step--done .step__num { background: var(--green-dim); color: var(--green); }
.step--active .step__num { background: var(--accent); color: white; }
.step--pending .step__num { background: var(--surface-2); color: var(--text-3); border: 1px solid var(--border); }
.step__label {
font-size: var(--text-sm);
font-weight: var(--weight-medium);
color: var(--text-2);
}
.step--active .step__label { color: var(--text-1); }
```
### Input bar — barre de saisie
```css
.input-bar {
display: flex;
align-items: center;
gap: var(--space-2);
padding: var(--space-2) var(--space-3);
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-md);
transition: border-color var(--ease);
width: 320px;
}
.input-bar:focus-within {
border-color: var(--border-active);
}
.input-bar input {
flex: 1;
border: none;
background: none;
outline: none;
font-family: var(--font-sans);
font-size: var(--text-base);
color: var(--text-1);
caret-color: var(--accent);
}
.input-bar input::placeholder { color: var(--text-3); }
.input-bar__btn {
width: 28px;
height: 28px;
border-radius: var(--radius-sm);
border: 1px solid var(--border);
background: none;
color: var(--text-2);
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all var(--ease);
flex-shrink: 0;
}
.input-bar__btn:hover { background: var(--surface-2); color: var(--text-1); }
.input-bar__send {
width: 28px;
height: 28px;
border-radius: var(--radius-sm);
border: none;
background: var(--accent);
color: white;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
opacity: 0.9;
transition: opacity var(--ease);
flex-shrink: 0;
}
.input-bar__send:hover { opacity: 1; }
```
### Badge — statut et labels
```css
.badge {
display: inline-flex;
align-items: center;
gap: var(--space-1);
padding: 3px var(--space-2);
border-radius: var(--radius-full);
font-size: var(--text-xs);
font-weight: var(--weight-medium);
white-space: nowrap;
}
.badge--active { background: var(--accent-dim); color: #A5B4FC; border: 1px solid var(--border-active); }
.badge--success { background: var(--green-dim); color: var(--green); }
.badge--neutral { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
/* Point de statut live */
.live-dot {
width: 5px;
height: 5px;
border-radius: 50%;
background: var(--green);
animation: blink 2.5s ease-in-out infinite;
}
@keyframes blink {
0%, 100% { opacity: 1; }
60% { opacity: 0.3; }
}
```
### Code block — affichage de code
```css
.code-block {
background: #0A0B0F;
border: 1px solid var(--border);
border-radius: var(--radius-md);
padding: var(--space-4) var(--space-5);
font-family: var(--font-mono);
font-size: 12px;
line-height: 1.65;
color: #8892B0;
overflow-x: auto;
tab-size: 2;
}
/* Syntax highlighting */
.token-kw { color: #8B8BDB; } /* keywords */
.token-fn { color: #88C0D0; } /* functions */
.token-str { color: #A3BE8C; } /* strings */
.token-num { color: #D08770; } /* numbers */
.token-cm { color: #3B4261; font-style: italic; } /* comments */
```
---
## Règles visuelles — ce que l'IA codeuse ne doit pas faire
| Interdit | Pourquoi |
| --- | --- |
| Utiliser une couleur hors des tokens | Crée de l'incohérence visuelle |
| Ajouter des ombres colorées (box-shadow coloré) | Réservé au halo de l'avatar uniquement |
| Utiliser `border-radius` hors des variables | Les rayons doivent être cohérents |
| Animer autre chose que les dots et le live-dot | Les animations doivent être discrètes |
| Dépasser 420px de largeur pour un panneau | Max est un composant de bureau, pas une page |
| Utiliser du blanc pur (#FFF) ou du noir pur (#000) | Toujours utiliser les tokens |
| Mettre du texte en all-caps | Jamais dans cette interface |
| Utiliser un dégradé visible sur du texte | Réservé au logo "Max." uniquement |
| Ajouter des icônes emoji dans les composants | Utiliser une lib d'icônes (Lucide) |
| Importer une nouvelle police | Inter et JetBrains Mono uniquement |