Restructure into DDD bounded contexts + functional state management

Reorganise from atomic-design-only folders into bounded contexts
(auth / registratie / herregistratie) over a shared kernel, each split into
domain / application / infrastructure / ui layers. Dependencies point inward;
the domain layer is framework-free. Path aliases (@shared/@auth/@registratie/
@herregistratie) make import direction explicit.

State management (Elm-style, native TS, no new deps):
- shared/application/store.ts — createStore(init, update): pure reducer + signal
- shared/application/remote-data.ts — add map/map2/map3/andThen combinators so
  several services fold into one RemoteData; <app-async> gains an [rd] input
- registratie/application/big-profile.store.ts — root singleton combining the
  BIG-register and BRP services via map2 into one state; holds the optimistic
  herregistratie flag shared with the dashboard
- herregistratie: machine gains a WizardMsg union + pure reduce; submit is a
  command that calls infra and dispatches the result, with optimistic update +
  rollback against the shared store
- auth: SessionStore + DigiD adapter + functional route guard; login establishes
  the session, protected routes use canActivate

Rich domain: registration.policy.ts (statusColor/label, herregistratie
eligibility, invariants); BigNummer/Postcode/Uren value objects with smart
constructors. status-badge is now domain-free (colour/label inputs).

Specs for the reducer, RemoteData combinators, and eligibility policy.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-26 07:20:13 +02:00
parent 6bd6e854c7
commit 2114514ad7
74 changed files with 841 additions and 347 deletions

View File

@@ -0,0 +1,33 @@
import { Component, OnDestroy, OnInit, computed, input, signal } from '@angular/core';
/** Atom: skeleton placeholder (grey shimmer). Delay-gated so it never flashes
on fast responses. Render `count` lines shaped roughly like the content. */
@Component({
selector: 'app-skeleton',
styles: [`
:host{display:block}
.sk{background:linear-gradient(90deg,#e8ebee 25%,#f3f5f6 37%,#e8ebee 63%);
background-size:400% 100%;animation:sh 1.4s ease infinite;border-radius:4px;
margin-block-end:0.6rem}
@keyframes sh{0%{background-position:100% 0}100%{background-position:0 0}}
`],
template: `
@if (visible()) {
@for (l of lines(); track $index) {
<div class="sk" [style.width]="width()" [style.height]="height()"></div>
}
}
`,
})
export class SkeletonComponent implements OnInit, OnDestroy {
width = input('100%');
height = input('1rem');
count = input(1);
delay = input(150);
protected visible = signal(false);
protected lines = computed(() => Array(this.count()).fill(0));
private timer?: ReturnType<typeof setTimeout>;
ngOnInit() { this.timer = setTimeout(() => this.visible.set(true), this.delay()); }
ngOnDestroy() { clearTimeout(this.timer); }
}

View File

@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from '@storybook/angular';
import { SkeletonComponent } from './skeleton.component';
const meta: Meta<SkeletonComponent> = {
title: 'Atoms/Skeleton',
component: SkeletonComponent,
args: { delay: 0 },
};
export default meta;
type Story = StoryObj<SkeletonComponent>;
export const SingleLine: Story = { args: { width: '60%', height: '1rem' } };
export const CardPlaceholder: Story = { args: { height: '2.5rem', count: 6 } };