Files
SluijsensandClaude Sonnet 5.5 1047c738b5 AI-DLC: inception en ontwerp voor redesign B/E met contactformulier
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>
2026-11-09 21:06:25 +01:00

3.7 KiB
Raw Permalink Blame History

Business Rules — theme-foundation (U1)

Id Rule
BR-U1-1 The variant is 'b' on every page load. It is never read from or written to storage or the URL.
BR-U1-2 Initial mode: a valid stored mode wins; otherwise dark if prefers-color-scheme: dark, else light.
BR-U1-3 While modeSource = 'system', the mode follows live changes of the system preference. After the user clicks the mode button, modeSource = 'user' and system changes are ignored.
BR-U1-4 The mode button toggles light and dark (two states), sets modeSource = 'user' and persists the new mode. Storage errors never break the toggle (state still changes for the session).
BR-U1-5 The initial data-variant and data-mode are set before first paint by a small same-origin script (/theme-init.js, no inline script, CSP-friendly) so there is no flash of the wrong theme; React then takes over the same values.
BR-U1-6 The variant button switches between B and E using the time-travel transition (cover → swap → reveal). After the swap the page scrolls to the top and focus moves to the start of the new page (skip target / main).
BR-U1-7 A live region announces the change in Dutch ("Tijdreis-weergave geladen." / "Terug naar de moderne weergave.").
BR-U1-8 E is loaded lazily. While it loads, the transition stays in cover. If loading fails, the variant stays 'b', the cover is removed and an alert says "De tijdreis kon niet worden geladen." with a retry; B stays usable.
BR-U1-9 Under prefers-reduced-motion: reduce there is no transition, no dither, no fade: the swap is immediate (all other rules still apply).
BR-U1-10 The mode is shared by both variants; switching variant keeps the mode.
BR-U1-11 The old red/purple themes and their classes (theme-red, theme-purple) are removed; the old storage key is ignored and removed.
BR-U1-12 Both buttons are real <button>s with accessible names, visible focus and at least 44×44 px touch targets on mobile; the mode button exposes aria-pressed (dark), the variant button has a label that changes with the current variant.

Decision flow: initial mode

graph TD
    S([Page load]) --> A{Stored mode valid}
    A -->|"yes"| B[Use stored mode and source user]
    A -->|"no"| C{System prefers dark}
    C -->|"yes"| D[Mode dark and source system]
    C -->|"no"| E[Mode light and source system]
    classDef start fill:#CE93D8,stroke:#6A1B9A,color:#000;
    classDef decision fill:#FFF59D,stroke:#F57F17,color:#000;
    classDef result fill:#9ae6b4,stroke:#2f855a,color:#000;
    class S start;
    class A,C decision;
    class B,D,E result;

Text alternative: a valid stored mode is used; otherwise the system preference decides, and the source is system.

Decision flow: variant switch

graph TD
    K([Variant button]) --> R{Reduced motion}
    R -->|"yes"| W[Swap immediately]
    R -->|"no"| CV[Cover with dither]
    CV --> L{Target is E}
    L -->|"yes"| LD[Load E chunk]
    L -->|"no"| W
    LD --> OK{Loaded}
    OK -->|"yes"| W
    OK -->|"no"| ER[Stay in B and show alert]
    W --> SC[Scroll to top and move focus]
    SC --> RV[Reveal and announce]
    classDef start fill:#CE93D8,stroke:#6A1B9A,color:#000;
    classDef decision fill:#FFF59D,stroke:#F57F17,color:#000;
    classDef step fill:#63b3ed,stroke:#2b6cb0,color:#000;
    classDef bad fill:#ffab91,stroke:#bf360c,color:#000;
    class K start;
    class R,L,OK decision;
    class W,CV,LD,SC,RV step;
    class ER bad;

Text alternative: the variant button covers the page with the dither (unless reduced motion), loads E when needed, swaps, scrolls to the top, reveals and announces; a loading failure keeps B and shows an alert.