feat(fp): WP-14 — Storybook taxonomy reorg + Layers MDX

Retitle all 49 stories into a sidebar that makes the DDD seam visible:
Foundations (curriculum) -> Design System (Atoms/Molecules/Organisms/
Templates/Devtools, everything in shared/ui + shared/layout) -> Domein
(Registratie/Herregistratie/Auth/Brief, everything in a context's ui/).
Pin the order via storySort. Add layers.mdx explaining the split and
linking the enforcing eslint rules; document the story-title convention
in CLAUDE.md. Fix a stale "status banner" reference in atomic-design.mdx
left over from WP-13's upload-status-banner deletion.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-03 23:32:19 +02:00
parent cbf697b8fa
commit 8b19fad558
56 changed files with 1578 additions and 1470 deletions

View File

@@ -81,8 +81,8 @@ composes atoms; it adds no new visual primitives of its own.
### Organism — `document-upload`
`shared/ui/upload/document-upload` composes molecules (a file input, status banner,
progress bar, chips) into a section that owns real upload behaviour.
`shared/ui/upload/document-upload` composes molecules (a file input, alert, progress bar,
chips) into a section that owns real upload behaviour.
<Canvas of={DocumentUploadStories.Default} />

83
src/docs/layers.mdx Normal file
View File

@@ -0,0 +1,83 @@
import { Meta } from '@storybook/addon-docs/blocks';
<Meta title="Foundations/Layers & Contexts" />
# Layers & contexts
This sidebar is laid out to **be** the architecture, not just document it: **Foundations**
(this curriculum) → **Design System** (reusable, domain-free) → **Domein** (the six DDD
contexts). If a component lives under a context's `ui/`, it's in Domein; everything else
in `shared/ui`/`shared/layout` is Design System. See [Atomic design](?path=/docs/foundations-atomic-design--docs)
for the Atoms → Molecules → Organisms → Templates ladder inside Design System.
## Six contexts, one direction
```
src/app/<context>/<layer>/
```
Contexts: `shared` (the base layer — depends on nothing), `auth`, `registratie`,
`herregistratie`, `brief` (letter-composition teaching slice), `showcase` (teaching page,
sanctioned to read every context — nothing imports it).
**Dependencies only point inward and in one declared direction between contexts:**
```
herregistratie → registratie → shared
auth → shared
brief → shared
```
Never the other way — `registratie` may not import `herregistratie`, and no context but
`shared` is imported by everyone.
## Five layers, one direction
| Layer | Job | Angular allowed? |
| --- | --- | --- |
| `domain/` | business rules + data types | **No — pure TS.** |
| `application/` | coordinate state/tasks (stores, commands) | yes (signals) |
| `infrastructure/` | where data comes from (HTTP adapters) | yes (HTTP) |
| `contracts/` | wire DTOs (the FE⇄BE seam) | no |
| `ui/` | how it looks (components, pages) | yes |
`ui → application → domain`; `ui`/`layout` never import `infrastructure/` directly — they
reach data through an application store or command.
## This is enforced, not just written down
`eslint.config.mjs` fails the build on every rule above:
- `domain/` importing `@angular/*` at all (any context).
- `shared/` importing a feature context (`@auth/*`, `@registratie/*`, `@herregistratie/*`,
`@brief/*`) — the base layer depends on nothing.
- `registratie/` importing `@herregistratie/*`/`@brief/*`, `auth/`/`brief/` importing a
sibling context — the cross-context direction above.
- `contracts/**` importing **anything** — not Angular, not an alias, not even a relative
path (ADR-0001's wire seam has to stay a pure DTO shape).
- `ui/**`/`layout/**` importing `*/infrastructure/*` — the anti-corruption boundary
(ADR-0001) stays behind a store/command, so a page can never bypass it and hand-recompute
a business rule the backend already decided.
- The generated `ApiClient` imported as a value outside an `infrastructure/` adapter
(type-only DTO imports are exempt — they grant no network access).
Two components get a documented exemption from the "nothing reaches across" rule:
`shared/ui/debug-state` (reads every root store, for the dev-only state panel) and
`showcase/` (reads every context, for side-by-side teaching pages). Both exemptions live
next to the rule they break, in `eslint.config.mjs`, so they can't rot silently.
## The English/Dutch seam
Shared/reusable UI is named in **English** (language-agnostic: `button`, `wizard-shell`);
domain contexts are named in **Dutch** (`registratie`, `herregistratie`, `*.machine.ts`).
Pick the language by which side of the seam the code is on — it's the same seam this
sidebar's Design System/Domein split makes visible.
## See it in the sidebar
Compare a Design System primitive with the same shape reused across contexts:
- [Design System → Molecules → Application Link](?path=/story/design-system-molecules-application-link--navigatie) —
domain-free, the caller supplies heading/subtitle/cta.
- [Domein → Registratie → Aanvraag Block](?path=/story/domein-registratie-aanvraag-block--concept) —
a context-specific organism composed from Design System atoms/molecules.