Requirements, application design (incl. concept-API-contract voor het contactformulier), units en functional design voor U1. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2.4 KiB
Domain Entities — theme-foundation (U1)
graph TD
TS[ThemeState] -->|"variant"| V[Variant b or e]
TS -->|"mode"| M[Mode light or dark]
TS -->|"modeSource"| MS[ModeSource system or user]
M -->|"persisted as"| SM[StoredMode in localStorage]
TS -->|"drives"| DA[html data-variant and data-mode]
DA -->|"selects"| TK[Token set]
TR[TransitionState] -->|"target"| V
TR -->|"phase"| PH[idle cover swap reveal]
classDef state fill:#63b3ed,stroke:#2b6cb0,color:#000;
classDef value fill:#9ae6b4,stroke:#2f855a,color:#000;
classDef out fill:#f6e05e,stroke:#c05621,color:#000;
class TS,TR state;
class V,M,MS,PH value;
class SM,DA,TK out;
Text alternative: the theme state holds variant, mode and where the mode came from; mode is persisted, the state is written to the html element, which selects the token set; a separate transition state tracks the switch animation toward a target variant.
ThemeState
| Field | Type | Rule |
|---|---|---|
variant |
'b' | 'e' |
initial always 'b'; never persisted |
mode |
'light' | 'dark' |
initial from stored value, else system preference |
modeSource |
'system' | 'user' |
'system' until the user clicks the mode button |
StoredMode
- localStorage key
slp-software-mode, value'light'or'dark'only; anything else counts as "nothing stored". Reads and writes are guarded (private mode, blocked storage). - The old key
slp-software-theme(red/purple) is ignored and removed once on startup.
TransitionState
| Field | Type | Rule |
|---|---|---|
phase |
'idle' | 'cover' | 'swap' | 'reveal' |
idle when reduced motion is on or no switch is running |
target |
Variant | null |
variant being switched to |
Token sets (CSS custom properties)
Selected by html[data-variant][data-mode]: B light, B dark, E light, E dark. Semantic names stay (--color-bg, --color-surface, --color-surface-2, --color-line, --color-text, --color-muted, --color-accent, --color-accent-soft, --color-accent-line, --color-accent-hover, --color-accent-contrast) so existing Tailwind color names keep working. Accents: B #7A1414, E #AC0000. B dark values follow the canvas (page #0F0E0E, ink #F3F0EC, muted #B3ADA7, alt #181615, card #232020, line #3A3532, marks #E5524A); E dark values per era are defined in U5; U1 provides the E base tokens as placeholders.