@lssm/lib.contracts 0.0.0-canary-20251209233744 → 0.0.0-canary-20251210081515
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-config/docs/app-config.docblock.js +220 -0
- package/dist/capabilities/docs/capabilities.docblock.js +1 -0
- package/dist/data-views/docs/data-views.docblock.js +1 -0
- package/dist/docs/PUBLISHING.docblock.js +76 -0
- package/dist/docs/accessibility_wcag_compliance_specs.docblock.js +350 -0
- package/dist/docs/index.js +1 -0
- package/dist/docs/meta.docs.js +13 -0
- package/dist/docs/presentations.js +1 -0
- package/dist/docs/registry.js +1 -0
- package/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +383 -0
- package/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +68 -0
- package/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +140 -0
- package/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +86 -0
- package/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +1 -0
- package/dist/docs/tech/contracts/README.docblock.js +1 -0
- package/dist/docs/tech/contracts/create-subscription.docblock.js +1 -0
- package/dist/docs/tech/contracts/graphql-typed-outputs.docblock.js +180 -0
- package/dist/docs/tech/contracts/migrations.docblock.js +1 -0
- package/dist/docs/tech/contracts/ops-to-presentation-linking.docblock.js +62 -0
- package/dist/docs/tech/contracts/overlays.docblock.js +68 -0
- package/dist/docs/tech/contracts/tests.docblock.js +132 -0
- package/dist/docs/tech/contracts/themes.docblock.js +1 -0
- package/dist/docs/tech/contracts/vertical-pocket-family-office.docblock.js +106 -0
- package/dist/docs/tech/lifecycle-stage-system.docblock.js +213 -0
- package/dist/docs/tech/mcp-endpoints.docblock.js +1 -0
- package/dist/docs/tech/presentation-runtime.docblock.js +1 -0
- package/dist/docs/tech/schema/README.docblock.js +262 -0
- package/dist/docs/tech/templates/runtime.docblock.js +1 -0
- package/dist/docs/tech/workflows/overview.docblock.js +1 -0
- package/dist/docs/tech-contracts.docs.js +76 -0
- package/dist/docs/types.js +0 -0
- package/dist/experiments/docs/experiments.docblock.js +128 -0
- package/dist/forms/docs/forms.docblock.js +1 -0
- package/dist/index.js +1 -1
- package/dist/integrations/docs/integrations.docblock.js +101 -0
- package/dist/knowledge/docs/knowledge.docblock.js +138 -0
- package/dist/openbanking/docs/openbanking.docblock.js +109 -0
- package/dist/policy/docs/policy.docblock.js +1 -0
- package/dist/presentations/docs/presentations-conventions.docblock.js +8 -0
- package/dist/regenerator/docs/regenerator.docblock.js +184 -0
- package/dist/registry.js +1 -1
- package/dist/server/index.js +1 -1
- package/dist/telemetry/docs/telemetry.docblock.js +139 -0
- package/package.json +81 -4
- package/dist/server/graphql-schema-export.js +0 -1
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import{registerDocBlocks as e}from"../../docs/registry.js";import"../../registry.js";const t=[{id:`docs.tech.contracts.app-config`,title:`App Configuration Layers`,summary:`App orchestration is split into three explicit layers:`,kind:`reference`,visibility:`public`,route:`/docs/tech/contracts/app-config`,tags:[`tech`,`contracts`,`app-config`],body:`## App Configuration Layers
|
|
2
|
+
|
|
3
|
+
App orchestration is split into three explicit layers:
|
|
4
|
+
|
|
5
|
+
1. **AppBlueprintSpec** – global, versioned description of what an app can look like. Stored in Git, no tenant/environment data.
|
|
6
|
+
2. **TenantAppConfig** – tenant/environment overrides that the future Studio edits. Stored per tenant (DB/contract), mutable at runtime.
|
|
7
|
+
3. **ResolvedAppConfig** – pure, merged view consumed by the runtime. Derived in-memory from a blueprint + tenant config.
|
|
8
|
+
|
|
9
|
+
- Types & registry: \`packages/libs/contracts/src/app-config/spec.ts\`
|
|
10
|
+
- Resolution helpers: \`packages/libs/contracts/src/app-config/runtime.ts\`
|
|
11
|
+
- CLI wizard (blueprint scaffolding): \`contractspec create app-config\`
|
|
12
|
+
|
|
13
|
+
### 1. AppBlueprintSpec
|
|
14
|
+
|
|
15
|
+
\`\`\`ts
|
|
16
|
+
export interface AppBlueprintSpec {
|
|
17
|
+
meta: AppBlueprintMeta; // { name, version, appId, ownership }
|
|
18
|
+
capabilities?: { enabled?: CapabilityRef[]; disabled?: CapabilityRef[] };
|
|
19
|
+
features?: { include?: FeatureRef[]; exclude?: FeatureRef[] };
|
|
20
|
+
integrationSlots?: AppIntegrationSlot[];
|
|
21
|
+
branding?: BrandingDefaults;
|
|
22
|
+
dataViews?: Record<string, SpecPointer>;
|
|
23
|
+
workflows?: Record<string, SpecPointer>;
|
|
24
|
+
policies?: PolicyRef[];
|
|
25
|
+
theme?: AppThemeBinding;
|
|
26
|
+
telemetry?: TelemetryBinding;
|
|
27
|
+
experiments?: { active?: ExperimentRef[]; paused?: ExperimentRef[] };
|
|
28
|
+
featureFlags?: FeatureFlagState[];
|
|
29
|
+
routes?: AppRouteConfig[];
|
|
30
|
+
notes?: string;
|
|
31
|
+
}
|
|
32
|
+
\`\`\`
|
|
33
|
+
|
|
34
|
+
Register blueprints with \`AppBlueprintRegistry\`. Blueprints only capture the default/global experience.
|
|
35
|
+
|
|
36
|
+
- **Integration slots** declare the categories and capability requirements an app expects (e.g. \`"primary-payments"\` must be a payments provider that supports managed or BYOK credentials). Slots never include secrets; tenants bind concrete connections later.
|
|
37
|
+
- **Branding defaults** provide message-key based names, placeholder assets, and theme token references that downstream tenants can override.
|
|
38
|
+
|
|
39
|
+
### 2. TenantAppConfig
|
|
40
|
+
|
|
41
|
+
\`\`\`ts
|
|
42
|
+
export interface TenantAppConfig {
|
|
43
|
+
meta: TenantAppConfigMeta; // { id, tenantId, appId, blueprintName/version, environment?, version, timestamps }
|
|
44
|
+
capabilities?: { enable?: CapabilityRef[]; disable?: CapabilityRef[] };
|
|
45
|
+
features?: { include?: FeatureRef[]; exclude?: FeatureRef[] };
|
|
46
|
+
dataViewOverrides?: TenantSpecOverride[];
|
|
47
|
+
workflowOverrides?: TenantSpecOverride[];
|
|
48
|
+
additionalPolicies?: PolicyRef[];
|
|
49
|
+
themeOverride?: { primary?: ThemeRef | null; fallbacks?: ThemeRef[] };
|
|
50
|
+
telemetryOverride?: { spec?: SpecPointer | null; disabledEvents?: string[] };
|
|
51
|
+
experiments?: { active?: ExperimentRef[]; paused?: ExperimentRef[] };
|
|
52
|
+
featureFlags?: FeatureFlagState[];
|
|
53
|
+
routeOverrides?: TenantRouteOverride[];
|
|
54
|
+
integrations?: AppIntegrationBinding[];
|
|
55
|
+
knowledge?: AppKnowledgeBinding[];
|
|
56
|
+
branding?: TenantBrandingConfig;
|
|
57
|
+
notes?: string;
|
|
58
|
+
}
|
|
59
|
+
\`\`\`
|
|
60
|
+
|
|
61
|
+
This object represents what a tenant edits via the Studio (stored in DB/contracts later).
|
|
62
|
+
|
|
63
|
+
- **AppIntegrationBinding** now maps \`slotId\` → \`connectionId\` (plus optional workflow scopes). It no longer carries capability lists; those are defined once in the slot.
|
|
64
|
+
- **TenantBrandingConfig** allows per-tenant names, assets, and domain overrides while keeping secrets and large files out of blueprints.
|
|
65
|
+
|
|
66
|
+
### 3. ResolvedAppConfig
|
|
67
|
+
|
|
68
|
+
\`\`\`ts
|
|
69
|
+
export interface ResolvedAppConfig {
|
|
70
|
+
appId: string;
|
|
71
|
+
tenantId: string;
|
|
72
|
+
environment?: string;
|
|
73
|
+
blueprintName: string;
|
|
74
|
+
blueprintVersion: number;
|
|
75
|
+
configVersion: number;
|
|
76
|
+
capabilities: { enabled: CapabilityRef[]; disabled: CapabilityRef[] };
|
|
77
|
+
features: { include: FeatureRef[]; exclude: FeatureRef[] };
|
|
78
|
+
dataViews: Record<string, SpecPointer>;
|
|
79
|
+
workflows: Record<string, SpecPointer>;
|
|
80
|
+
policies: PolicyRef[];
|
|
81
|
+
theme?: AppThemeBinding;
|
|
82
|
+
telemetry?: TelemetryBinding;
|
|
83
|
+
experiments: { catalog: ExperimentRef[]; active: ExperimentRef[]; paused: ExperimentRef[] };
|
|
84
|
+
featureFlags: FeatureFlagState[];
|
|
85
|
+
routes: AppRouteConfig[];
|
|
86
|
+
integrations: ResolvedIntegration[];
|
|
87
|
+
knowledge: ResolvedKnowledge[];
|
|
88
|
+
branding: ResolvedBranding;
|
|
89
|
+
notes?: string;
|
|
90
|
+
}
|
|
91
|
+
\`\`\`
|
|
92
|
+
|
|
93
|
+
Use \`resolveAppConfig(blueprint, tenant)\` to produce this merged view. No IO, no registry lookups—pure data merge.
|
|
94
|
+
|
|
95
|
+
- \`resolveAppConfig\` validates slot/category/mode constraints when \`integrationConnections\` and \`integrationSpecs\` are provided.
|
|
96
|
+
- \`branding\` merges blueprint defaults with tenant overrides, producing a runtime-friendly shape (resolved asset URLs, color values, and effective domain).
|
|
97
|
+
|
|
98
|
+
### Materializing specs
|
|
99
|
+
|
|
100
|
+
\`composeAppConfig(blueprint, tenant, registries, { strict })\`:
|
|
101
|
+
|
|
102
|
+
1. Calls \`resolveAppConfig\` to build the merged pointers.
|
|
103
|
+
2. Looks up referenced specs in the provided registries.
|
|
104
|
+
3. Returns:
|
|
105
|
+
- \`resolved\` – the merged pointer view
|
|
106
|
+
- \`capabilities\`, \`features\`, \`dataViews\`, \`workflows\`, \`policies\`, \`theme\`, \`telemetry\`, \`experiments\`
|
|
107
|
+
- \`missing\` – unresolved references (strict mode throws).
|
|
108
|
+
|
|
109
|
+
\`\`\`ts
|
|
110
|
+
const blueprint = blueprintRegistry.get('core.app', 1)!;
|
|
111
|
+
const tenant = loadTenantConfigFromDB();
|
|
112
|
+
|
|
113
|
+
const composition = composeAppConfig(blueprint, tenant, {
|
|
114
|
+
capabilities,
|
|
115
|
+
features,
|
|
116
|
+
dataViews,
|
|
117
|
+
workflows,
|
|
118
|
+
policies,
|
|
119
|
+
themes,
|
|
120
|
+
telemetry,
|
|
121
|
+
experiments,
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
if (composition.missing.length) {
|
|
125
|
+
console.warn('Unresolved references', composition.missing);
|
|
126
|
+
}
|
|
127
|
+
\`\`\`
|
|
128
|
+
|
|
129
|
+
### CLI workflow
|
|
130
|
+
|
|
131
|
+
\`\`\`
|
|
132
|
+
contractspec create app-config
|
|
133
|
+
\`\`\`
|
|
134
|
+
|
|
135
|
+
Generates an \`AppBlueprintSpec\`. A separate flow will later scaffold tenant configs.
|
|
136
|
+
|
|
137
|
+
### Best practices
|
|
138
|
+
|
|
139
|
+
1. Keep blueprint and tenant versions monotonic; bump when referenced spec versions change.
|
|
140
|
+
2. Favor stable slot keys (e.g. \`dataViews.dashboard\`) to align with Studio UX.
|
|
141
|
+
3. Reference telemetry and experiments declared in their respective specs to maintain observability.
|
|
142
|
+
4. Run \`resolveAppConfig\` in pure unit tests and \`composeAppConfig(..., { strict: true })\` in CI to catch drift early.
|
|
143
|
+
5. Pair resolved configs with \`TestSpec\` scenarios to guard tenant experiences end-to-end.
|
|
144
|
+
|
|
145
|
+
### Static validation
|
|
146
|
+
|
|
147
|
+
Use the validation helpers in \`@lssm/lib.contracts/app-config/validation\` to keep blueprints and tenant configs safe before publish time.
|
|
148
|
+
|
|
149
|
+
\`\`\`ts
|
|
150
|
+
import {
|
|
151
|
+
validateConfig,
|
|
152
|
+
validateBlueprint,
|
|
153
|
+
validateTenantConfig,
|
|
154
|
+
validateResolvedConfig,
|
|
155
|
+
} from '@lssm/lib.contracts/app-config/validation';
|
|
156
|
+
|
|
157
|
+
const context = {
|
|
158
|
+
integrationSpecs,
|
|
159
|
+
tenantConnections,
|
|
160
|
+
knowledgeSpaces,
|
|
161
|
+
knowledgeSources,
|
|
162
|
+
translationCatalogs: {
|
|
163
|
+
blueprint: blueprintCatalog,
|
|
164
|
+
platform: platformCatalog,
|
|
165
|
+
},
|
|
166
|
+
existingConfigs,
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
const blueprintReport = validateBlueprint(blueprint, context);
|
|
170
|
+
const tenantReport = validateTenantConfig(blueprint, tenant, context);
|
|
171
|
+
const publishReport = validateConfig(blueprint, tenant, context);
|
|
172
|
+
\`\`\`
|
|
173
|
+
|
|
174
|
+
- \`ValidationResult\` exposes \`valid\`, plus structured \`errors\`, \`warnings\`, and \`info\`.
|
|
175
|
+
- Core rules cover capability references, integration slot bindings (category/ownership/capabilities), knowledge bindings, branding constraints (domains + assets), and translation coverage.
|
|
176
|
+
- Call \`validateBlueprint\` in CI when committing new specs, and \`validateConfig\` before promoting/publishing a tenant config.
|
|
177
|
+
- \`validateResolvedConfig\` can be used as a runtime pre-flight check when composing full configs for workflows.
|
|
178
|
+
- CLI usage example (blueprint + tenant):
|
|
179
|
+
|
|
180
|
+
\`\`\`
|
|
181
|
+
pnpm contractspec validate \\
|
|
182
|
+
packages/examples/integration-stripe/blueprint.ts \\
|
|
183
|
+
--blueprint packages/examples/integration-stripe/blueprint.ts \\
|
|
184
|
+
--tenant-config packages/examples/integration-stripe/tenant.ts
|
|
185
|
+
\`\`\`
|
|
186
|
+
- Repository script:
|
|
187
|
+
|
|
188
|
+
\`\`\`
|
|
189
|
+
bun run validate:blueprints
|
|
190
|
+
\`\`\`
|
|
191
|
+
|
|
192
|
+
Runs the static validator for the sample blueprints/tenants and is wired into CI.
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
### Lifecycle types & events
|
|
196
|
+
|
|
197
|
+
To model multi-step configuration changes, use the lifecycle helpers exported from \`@lssm/lib.contracts/app-config\`:
|
|
198
|
+
|
|
199
|
+
\`\`\`ts
|
|
200
|
+
import type {
|
|
201
|
+
ConfigStatus,
|
|
202
|
+
TenantAppConfigVersion,
|
|
203
|
+
ConfigTransition,
|
|
204
|
+
} from '@lssm/lib.contracts/app-config';
|
|
205
|
+
import {
|
|
206
|
+
ConfigDraftCreatedEvent,
|
|
207
|
+
ConfigPromotedToPreviewEvent,
|
|
208
|
+
ConfigPublishedEvent,
|
|
209
|
+
ConfigRolledBackEvent,
|
|
210
|
+
} from '@lssm/lib.contracts/app-config';
|
|
211
|
+
\`\`\`
|
|
212
|
+
|
|
213
|
+
- \`ConfigStatus\` enumerates the canonical states: \`draft\`, \`preview\`, \`published\`, \`archived\`, \`superseded\`.
|
|
214
|
+
- \`TenantAppConfigMeta\` now includes lifecycle metadata (\`status\`, \`createdBy\`, \`publishedBy\`, \`publishedAt\`, \`rolledBackFrom\`, \`rolledBackTo\`, \`changeSummary\`).
|
|
215
|
+
- \`TenantAppConfigVersion\` couples the lifecycle-aware metadata with the \`TenantAppConfig\` payload for history views.
|
|
216
|
+
- \`ConfigTransition\` captures state changes with actor, timestamp, and optional reason.
|
|
217
|
+
- Lifecycle events (\`app_config.draft_created\`, \`app_config.promoted_to_preview\`, \`app_config.published\`, \`app_config.rolled_back\`) standardize observability across services.
|
|
218
|
+
- Lifecycle contract specs (\`appConfig.lifecycle.*\`) expose typed commands/queries for create → preview → publish → rollback flows.
|
|
219
|
+
|
|
220
|
+
`}];e(t);export{t as tech_contracts_app_config_DocBlocks};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{registerDocBlocks as e}from"../../docs/registry.js";import"../../registry.js";const t=[{id:`docs.tech.contracts.capabilities`,title:`CapabilitySpec Overview`,summary:"Capability specs provide a canonical, versioned contract for what a module offers (`provides`) and what it depends on (`requires`). They enable safe composition across features, automated validation during `installFeature`, and consistent documentation for shared surfaces (APIs, events, workflows, UI, resources).",kind:`reference`,visibility:`public`,route:`/docs/tech/contracts/capabilities`,tags:[`tech`,`contracts`,`capabilities`],body:"# CapabilitySpec Overview\n\n## Purpose\n\nCapability specs provide a canonical, versioned contract for what a module offers (`provides`) and what it depends on (`requires`). They enable safe composition across features, automated validation during `installFeature`, and consistent documentation for shared surfaces (APIs, events, workflows, UI, resources).\n\n## Schema\n\nDefined in `@lssm/lib.contracts/src/capabilities.ts`.\n\n```ts\nexport interface CapabilitySpec {\n meta: CapabilityMeta; // ownership metadata + { key, version, kind }\n provides?: CapabilitySurfaceRef[]; // what concrete surfaces this capability exposes\n requires?: CapabilityRequirement[];// capabilities that must already exist\n}\n```\n\n- **CapabilityMeta**\n - `key`: stable slug (e.g., `payments.stripe`)\n - `version`: bump on breaking changes\n - `kind`: `'api' | 'event' | 'data' | 'ui' | 'integration'`\n - ownership fields (`title`, `description`, `domain`, `owners`, `tags`, `stability`)\n- **CapabilitySurfaceRef**\n - `surface`: `'operation' | 'event' | 'workflow' | 'presentation' | 'resource'`\n - `name` / `version`: points to the declared contract (operation name, event name, etc.)\n - optional `description`\n- **CapabilityRequirement**\n - `key`: capability slug to satisfy\n - `version?`: pin to an exact version when required (defaults to highest registered)\n - `kind?`: extra guard if the same key hosts multiple kinds\n - `optional?`: skip strict enforcement (informational requirement)\n - `reason?`: why this dependency exists (docs + tooling)\n\n## Registry\n\n`CapabilityRegistry` provides:\n\n- `register(spec)`: register a capability (`key + version` must be unique)\n- `get(key, version?)`: retrieve the exact or highest version\n- `list()`: inspect all capabilities\n- `satisfies(requirement, additional?)`: check if a requirement is met (includes locally provided capabilities passed via `additional`)\n\n## Feature Integration\n\n`FeatureModuleSpec` now accepts:\n\n```ts\ncapabilities?: {\n provides?: CapabilityRef[]; // capabilities this feature exposes\n requires?: CapabilityRequirement[]; // capabilities the feature needs\n};\n```\n\nDuring `installFeature`:\n\n1. `provides` entries must exist in the `CapabilityRegistry`.\n2. `requires` entries must be satisfied either by:\n - the same feature’s `provides`,\n - or existing capabilities already registered in the global registry.\n\nErrors are thrown when dependencies cannot be satisfied, preventing unsafe module composition.\n\n## Authoring Guidelines\n\n1. **Register capability specs** in a shared package (e.g., `packages/.../capabilities`) before referencing them in features.\n2. **Version consciously**: bump capability versions when the provided surfaces or contract semantics change.\n3. **Document dependencies** via `reason` strings to help operators understand why a capability is required.\n4. **Prefer stable keys** that map to business/technical domains (`billing.invoices`, `payments.stripe`, `cms.assets`).\n5. When introducing new capability kinds, update the `CapabilityKind` union and accompanying docs/tests.\n\n## Tooling (Roadmap)\n\n- CLI validation warns when feature specs reference missing capabilities.\n- Future build steps will leverage capability data to scaffold adapters and enforce policy in generated code.\n- Capability metadata will surface in docs/LLM guides to describe module marketplaces and installation flows.\n\n"}];e(t);export{t as tech_contracts_capabilities_DocBlocks};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{registerDocBlocks as e}from"../../docs/registry.js";import"../../registry.js";const t=[{id:`docs.tech.contracts.data-views`,title:`DataViewSpec Overview`,summary:"`DataViewSpec` is the declarative contract for projecting entities into list/detail/table/grid experiences. Each spec ties to contract operations (`source.primary`, `source.item`) and describes how the UI should present, sort, and filter records. Host applications use the spec to render UI with shared components (`DataViewRenderer`, `DataViewList`, `DataViewTable`, `DataViewDetail`) while keeping presentation logic in a single source of truth.",kind:`reference`,visibility:`public`,route:`/docs/tech/contracts/data-views`,tags:[`tech`,`contracts`,`data-views`],body:"# DataViewSpec Overview\n\n## Purpose\n\n`DataViewSpec` is the declarative contract for projecting entities into list/detail/table/grid experiences. Each spec ties to contract operations (`source.primary`, `source.item`) and describes how the UI should present, sort, and filter records. Host applications use the spec to render UI with shared components (`DataViewRenderer`, `DataViewList`, `DataViewTable`, `DataViewDetail`) while keeping presentation logic in a single source of truth.\n\n## Location\n\n- Type definitions and registry: `packages/libs/contracts/src/data-views.ts`\n- React renderers: `packages/libs/design-system/src/components/data-view`\n- CLI scaffolding: `contractspec create --type data-view`\n\n## Schema Highlights\n\n```ts\nexport interface DataViewSpec {\n meta: DataViewMeta; // ownership meta + { name, version, entity }\n source: DataViewSource; // contract operations and refresh events\n view: DataViewConfig; // union of list/detail/table/grid definitions\n states?: DataViewStates; // optional empty/error/loading presentations\n policy?: { flags?: string[]; pii?: string[] };\n}\n```\n\n- **DataViewMeta**: `name`, `version`, `entity`, ownership metadata (title, description, domain, owners, tags, stability).\n- **DataViewSource**:\n - `primary`: required query operation (`OpRef`) for fetching collections.\n - `item`: optional detail query (recommended for `detail` views).\n - `mutations`: optional create/update/delete operation refs.\n - `refreshEvents`: events that should trigger refresh.\n- **DataViewConfig** (union):\n - `list`: card/compact list, `primaryField`, `secondaryFields`.\n - `table`: column configuration (`columns`, alignments, density).\n - `detail`: sections of fields for record inspection.\n - `grid`: multi-column grid (rendered as card list today).\n- **DataViewField**: `key`, `label`, `dataPath`, formatting hints (`format`), sort/filter toggles, optional presentation override.\n- **DataViewFilter**: describes filter inputs (search, enum, number, date, boolean).\n- **DataViewAction**: simple declarative actions (`navigation` or `operation`).\n\n## Registry Usage\n\n```ts\nimport { DataViewRegistry } from '@lssm/lib.contracts/data-views';\nimport { ResidentsDataView } from './data-views/residents.data-view';\n\nconst registry = new DataViewRegistry();\nregistry.register(ResidentsDataView);\n\nconst listView = registry.get('residents.admin.list');\n```\n\nRegistries guard against duplicate `(name, version)` pairs and make latest-version lookup trivial.\n\n## Rendering\n\n```tsx\nimport { DataViewRenderer } from '@lssm/lib.design-system';\nimport { ResidentsDataView } from '../contracts/data-views/residents.data-view';\n\nfunction ResidentsTable({ rows }: { rows: Record<string, unknown>[] }) {\n return (\n <DataViewRenderer\n spec={ResidentsDataView}\n items={rows}\n onRowClick={(row) => console.log('Selected', row)}\n />\n );\n}\n```\n\nFor more control, use specific components:\n\n- `DataViewList` – friendly cards/rows\n- `DataViewTable` – tabular presentation with optional header/footers\n- `DataViewDetail` – two-column grouped layout for record inspection\n\nRenderers rely on the field definitions (`dataPath`, `format`) to extract values and render them consistently.\n\n## CLI Scaffolding\n\n```bash\n# Interactive wizard\ncontractspec create --type data-view\n\n# Generates packages/.../data-views/<name>.data-view.ts\n\n# Optional renderer scaffold\ncontractspec build path/to/<name>.data-view.ts\n# → produces <name>.renderer.tsx that wraps DataViewRenderer with sensible props\n```\n\nWizard prompts:\n- name (dot notation), version, entity\n- kind (`list`, `table`, `detail`, `grid`)\n- primary query operation (required) and optional item query\n- fields (label, data path, format, sorting/filtering)\n\n## Authoring Guidelines\n\n1. **Separation of data & presentation**: keep fetching logic inside contract operations; DataViewSpec only references them via `source`.\n2. **Versioning**: bump `meta.version` when field membership, ordering, or semantics change.\n3. **Consistency**: reuse common field keys across modules to enable shared renderers and filters.\n4. **States**: reference `PresentationRef` for empty/error/loader states to ensure consistent UX.\n5. **Actions**: prefer referencing contract operations instead of embedding business logic in the UI.\n\n## Roadmap\n\n- Derived filters from `fields.filterable` (auto-generated UI).\n- Table density presets per platform.\n- Bridge to PolicySpec for field-level visibility (Phase 2 policy expansion).\n- Automated docs/LLM sync via CLI.\n\n"}];e(t);export{t as tech_contracts_data_views_DocBlocks};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import{registerDocBlocks as e}from"./registry.js";const t=[{id:`docs.PUBLISHING`,title:`Publishing ContractSpec Libraries`,summary:`This guide describes how we release the ContractSpec libraries to npm. We use a dual-track release system: **Stable** (manual) and **Canary** (automatic).`,kind:`reference`,visibility:`public`,route:`/docs/PUBLISHING`,tags:[`PUBLISHING`],body:`# Publishing ContractSpec Libraries
|
|
2
|
+
|
|
3
|
+
This guide describes how we release the ContractSpec libraries to npm. We use a dual-track release system: **Stable** (manual) and **Canary** (automatic).
|
|
4
|
+
|
|
5
|
+
## Release Tracks
|
|
6
|
+
|
|
7
|
+
| Track | Branch | npm Tag | Frequency | Versioning | Use Case |
|
|
8
|
+
|-------|--------|---------|-----------|------------|----------|
|
|
9
|
+
| **Stable** | \`release\` | \`latest\` | Manual | SemVer (e.g., \`1.7.4\`) | Production, external users |
|
|
10
|
+
| **Canary** | \`main\` | \`canary\` | Every Push | Snapshot (e.g., \`1.7.4-canary...\`) | Dev, internal testing |
|
|
11
|
+
|
|
12
|
+
## Prerequisites
|
|
13
|
+
|
|
14
|
+
- ✅ \`NPM_TOKEN\` secret is configured in GitHub (owner or automation token with _publish_ scope).
|
|
15
|
+
- ✅ \`GITHUB_TOKEN\` (built-in) has permissions to create PRs (enabled by default in new repos).
|
|
16
|
+
- ✅ For stable releases: \`release\` branch exists and is protected.
|
|
17
|
+
|
|
18
|
+
## Canary Workflow (Automatic)
|
|
19
|
+
|
|
20
|
+
Every commit pushed to \`main\` triggers the \`.github/workflows/publish-canary.yml\` workflow.
|
|
21
|
+
|
|
22
|
+
1. **Trigger**: Push to \`main\`.
|
|
23
|
+
2. **Versioning**: Runs \`changeset version --snapshot canary\` to generate a temporary snapshot version.
|
|
24
|
+
3. **Publish**: Packages are published to npm with the \`canary\` tag using \`changeset publish --tag canary\`.
|
|
25
|
+
|
|
26
|
+
### Consuming Canary Builds
|
|
27
|
+
|
|
28
|
+
To install the latest bleeding-edge version:
|
|
29
|
+
|
|
30
|
+
\`\`\`bash
|
|
31
|
+
npm install @lssm/lib.contracts@canary
|
|
32
|
+
# or
|
|
33
|
+
bun add @lssm/lib.contracts@canary
|
|
34
|
+
\`\`\`
|
|
35
|
+
|
|
36
|
+
## Stable Release Workflow (Manual)
|
|
37
|
+
|
|
38
|
+
Stable releases are managed via the \`release\` branch using the standard [Changesets Action](https://github.com/changesets/action).
|
|
39
|
+
|
|
40
|
+
1. **Develop on \`main\`**: Create features and fixes.
|
|
41
|
+
2. **Add Changesets**: Run \`bun changeset\` to document changes and impact (major/minor/patch).
|
|
42
|
+
3. **Merge to \`release\`**: When ready to ship, open a PR from \`main\` to \`release\` or merge manually.
|
|
43
|
+
4. **"Version Packages" PR**:
|
|
44
|
+
- The GitHub Action detects new changesets and automatically creates a Pull Request titled **"Version Packages"**.
|
|
45
|
+
- This PR contains the version bumps and updated \`CHANGELOG.md\` files.
|
|
46
|
+
5. **Merge & Publish**:
|
|
47
|
+
- Review and merge the "Version Packages" PR.
|
|
48
|
+
- The Action runs again, detects the versions have been bumped, builds the libraries, and publishes them to npm with the \`latest\` tag.
|
|
49
|
+
|
|
50
|
+
### Publishing Steps
|
|
51
|
+
|
|
52
|
+
1. Ensure all changesets are present on \`main\`.
|
|
53
|
+
2. Merge \`main\` into \`release\`:
|
|
54
|
+
\`\`\`bash
|
|
55
|
+
git checkout release
|
|
56
|
+
git pull origin release
|
|
57
|
+
git merge main
|
|
58
|
+
git push origin release
|
|
59
|
+
\`\`\`
|
|
60
|
+
3. Go to GitHub Pull Requests. You will see a **"Version Packages"** PR created by the bot.
|
|
61
|
+
4. Merge that PR.
|
|
62
|
+
5. The release is now live on npm!
|
|
63
|
+
|
|
64
|
+
## Manual Verification (Optional)
|
|
65
|
+
|
|
66
|
+
Before publishing a new version you can run:
|
|
67
|
+
|
|
68
|
+
\`\`\`bash
|
|
69
|
+
bun run build:not-apps
|
|
70
|
+
npx npm-packlist --json packages/libs/contracts
|
|
71
|
+
\`\`\`
|
|
72
|
+
|
|
73
|
+
## Rollback
|
|
74
|
+
|
|
75
|
+
If a publish fails mid-way, re-run the workflow once the issue is fixed. Already published packages are skipped automatically. Use \`npm deprecate <package>@<version>\` if we need to warn consumers about a broken release.
|
|
76
|
+
`}];e(t);export{t as PUBLISHING_DocBlocks};
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
import{registerDocBlocks as e}from"./registry.js";const t=[{id:`docs.accessibility_wcag_compliance_specs`,title:`Accessibility & WCAG Compliance — **specs.md**`,summary:`> **Goal:** Ship interfaces that are usable by everyone, by default. This spec sets non‑negotiable rules, checklists, and CI gates to meet **WCAG\xA02.2 AA** (aim for AAA where low‑cost), align with **EN\xA0301\xA0549** (EU), and keep parity on **web (Next.js)** and **mobile (Expo/React\xA0Native)**.`,kind:`reference`,visibility:`public`,route:`/docs/accessibility_wcag_compliance_specs`,tags:[`accessibility_wcag_compliance_specs`],body:`# Accessibility & WCAG Compliance — **specs.md**
|
|
2
|
+
|
|
3
|
+
> **Goal:** Ship interfaces that are usable by everyone, by default. This spec sets non‑negotiable rules, checklists, and CI gates to meet **WCAG\xA02.2 AA** (aim for AAA where low‑cost), align with **EN\xA0301\xA0549** (EU), and keep parity on **web (Next.js)** and **mobile (Expo/React\xA0Native)**.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 0) Scope & Principles
|
|
8
|
+
|
|
9
|
+
- **Standards:** WCAG\xA02.2\xA0AA (incl. new 2.2 SCs: Focus Not Obscured, Focus Appearance, Target Size, Dragging Movements, Accessible Authentication, Redundant Entry). EN\xA0301\xA0549 compliance by conformance to WCAG.
|
|
10
|
+
- **Principles:** Perceivable, Operable, Understandable, Robust (POUR).
|
|
11
|
+
- **Rule of ARIA:** “No ARIA is better than bad ARIA.” Prefer native elements.
|
|
12
|
+
- **Definition of Done (DoD):** No Critical/Major a11y issues in CI; keyboard complete; SR (screen reader) smoke test passed; contrasts pass; acceptance criteria below satisfied.
|
|
13
|
+
- **Repo Alignment:** Web apps use **Radix Primitives + shadcn** wrappers centralized in \`packages/lssm/libs/ui-kit-web\`. Prefer those components over per‑app duplicates (\`packages/*/apps/*/src/components/ui\`). When missing, add to \`ui-kit-web\` first, then adopt app‑side.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 1) Design Requirements (Design System & Tokens)
|
|
18
|
+
|
|
19
|
+
**1.1 Color & Contrast**
|
|
20
|
+
|
|
21
|
+
- Body text, icons essential to meaning: **≥\xA04.5:1**; large text (≥\xA018.66px regular / 14px bold): **≥\xA03:1**.
|
|
22
|
+
- Interactive states (default/hover/active/disabled/focus) must maintain contrast **≥\xA03:1** against adjacent colors; text within components follows text ratios.
|
|
23
|
+
- Provide light & dark themes with tokens that guarantee minimums. **Never rely solely on color** to convey meaning; pair with text, shape, or icon.
|
|
24
|
+
|
|
25
|
+
**1.2 Focus Indicators (WCAG\xA02.4.11/12)**
|
|
26
|
+
|
|
27
|
+
- Every interactive element has a **visible focus** with clear offset; indicator contrast **≥\xA03:1** vs adjacent colors and indicator **area ≥\xA02\xA0CSS\xA0px** thick.
|
|
28
|
+
- Focus **must not be obscured** by sticky headers/footers or scroll containers.
|
|
29
|
+
|
|
30
|
+
**1.3 Motion & Preferences**
|
|
31
|
+
|
|
32
|
+
- Respect \`prefers-reduced-motion\`: suppress large parallax, auto‑animations; provide instant alternatives.
|
|
33
|
+
- Avoid motion that could trigger vestibular issues; under PRM, use fade/scale under **150ms**.
|
|
34
|
+
|
|
35
|
+
**1.4 Target Size (2.5.8)**
|
|
36
|
+
|
|
37
|
+
- Hit areas **≥\xA024×24\xA0CSS\xA0px** (web) and **≥\xA044×44\xA0dp** (mobile) unless exempt.
|
|
38
|
+
|
|
39
|
+
**1.5 Typography & Layout**
|
|
40
|
+
|
|
41
|
+
- Support zoom to **400%** without loss of content/functionality; responsive reflow at **320\xA0CSS\xA0px** width.
|
|
42
|
+
- Maintain clear heading hierarchy (h1…h6), one **h1** per view.
|
|
43
|
+
|
|
44
|
+
- Repository baseline (Web): default body text uses Tailwind \`text-lg\` (≈18px). As of 2025‑09‑20, the repository bumped all Tailwind typography scale usages by +1 step (e.g., \`text-sm\`→\`text-base\`, \`text-base\`→\`text-lg\`, …, \`text-8xl\`→\`text-9xl\`). For long‑form content, default to \`prose-lg\`.
|
|
45
|
+
- Do not use \`text-xs\` for body copy. Reserve \`text-sm\` only for non‑essential meta (timestamps, fine print) while ensuring contrast and touch targets remain compliant.
|
|
46
|
+
- When increasing font size, ensure line height supports readability. Prefer Tailwind defaults or \`leading-relaxed\`/\`leading-7\` for body text where dense blocks appear.
|
|
47
|
+
|
|
48
|
+
**1.6 Iconography & Imagery**
|
|
49
|
+
|
|
50
|
+
- Decorative images: \`alt=""\` or \`aria-hidden="true"\`.
|
|
51
|
+
- Informative images: concise, specific **alt**; complex charts require a **data table or long description**.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## 2) Content Requirements (UX Writing)
|
|
56
|
+
|
|
57
|
+
- Links say **what happens** (avoid “click here”).
|
|
58
|
+
- Buttons start with verbs; avoid ambiguous labels.
|
|
59
|
+
- Form labels are **visible**; placeholders are **not labels**.
|
|
60
|
+
- Error messages: human + programmatic association; avoid color‑only.
|
|
61
|
+
- Authentication: allow **copy/paste**, password managers, and avoid cognitive tests alone (**3.3.7/3.3.8/3.3.9**).
|
|
62
|
+
- Avoid CAPTCHAs that block users; if unavoidable, provide **multiple alternatives** (logic-free).
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## 3) Engineering Requirements (Web — Next.js/React)
|
|
67
|
+
|
|
68
|
+
> Use and extend \`packages/lssm/libs/ui-kit-web\` as the default UI surface. It wraps **Radix** primitives with sensible a11y defaults (focus rings, roles, keyboard, ARIA binding). When a gap exists, add it to \`ui-kit-web\` first.
|
|
69
|
+
|
|
70
|
+
**3.1 Semantics & Landmarks**
|
|
71
|
+
|
|
72
|
+
- Use native elements: \`<button>\`, \`<a href>\`, \`<label for>\`, \`<fieldset>\`, \`<legend>\`, \`<table>\`, etc.
|
|
73
|
+
- Landmarks per page: \`header\`, \`nav\`, \`main\`, \`aside\`, \`footer\`. Provide a **Skip to main content** link.
|
|
74
|
+
- Provide a **Route Announcer** (\`aria-live="polite"\`) and move focus to page **h1** after navigation.
|
|
75
|
+
|
|
76
|
+
**3.2 Keyboard**
|
|
77
|
+
|
|
78
|
+
- All functionality available with keyboard alone. Tab order follows DOM/visual order; **no keyboard traps**.
|
|
79
|
+
- Common bindings:
|
|
80
|
+
- Space/Enter → activate button; Enter on link;
|
|
81
|
+
- Esc closes dialogs/menus;
|
|
82
|
+
- Arrow keys for lists/menus/tablists with **roving tabindex**.
|
|
83
|
+
|
|
84
|
+
**3.3 Focus Management**
|
|
85
|
+
|
|
86
|
+
- On route change (Next.js), move focus to the page \`<h1>\` or container and announce via a live region.
|
|
87
|
+
- Dialogs/menus: **trap focus** inside; return focus to invoking control on close.
|
|
88
|
+
- Don’t steal focus except after explicit user action.
|
|
89
|
+
|
|
90
|
+
**3.4 Forms**
|
|
91
|
+
|
|
92
|
+
- Each input has a \`<label>\` or \`aria-label\`. Group related inputs with \`<fieldset><legend>\`.
|
|
93
|
+
- Associate errors via \`aria-describedby\` or inline IDs; announce with \`role="alert"\` (assertive only for critical).
|
|
94
|
+
- Provide **autocomplete** tokens for known fields; show **inline validation** and do not block on **onBlur** alone.
|
|
95
|
+
|
|
96
|
+
**3.5 ARIA Usage**
|
|
97
|
+
|
|
98
|
+
- Only when needed; match patterns (dialog, menu, combobox, tablist, listbox) per ARIA Authoring Practices.
|
|
99
|
+
- Ensure **name/role/value** are programmatically determinable.
|
|
100
|
+
|
|
101
|
+
**3.6 Media**
|
|
102
|
+
|
|
103
|
+
- Videos: **captions**; provide **transcripts** for audio; audio descriptions for essential visual info.
|
|
104
|
+
- No auto‑playing audio. Auto‑playing video must be muted and pausable; provide controls.
|
|
105
|
+
|
|
106
|
+
**3.7 Tables & Data**
|
|
107
|
+
|
|
108
|
+
- Use \`<th scope>\` for headers; captions via \`<caption>\`; announce sorting via \`aria-sort\`.
|
|
109
|
+
- Provide CSV/JSON export where charts are primary.
|
|
110
|
+
|
|
111
|
+
**3.8 Performance & Robustness**
|
|
112
|
+
|
|
113
|
+
- Avoid content shifts that move focus; reserve space or use skeletons.
|
|
114
|
+
- Maintain accessible names through hydration/SSR; avoid \`dangerouslySetInnerHTML\` where possible.
|
|
115
|
+
|
|
116
|
+
**3.9 Next.js specifics**
|
|
117
|
+
|
|
118
|
+
- Use \`next/link\` for navigation; ensure links are **links**, not buttons.
|
|
119
|
+
- \`next/image\` must include **alt** (empty if decorative).
|
|
120
|
+
- Announce route changes with a **global live region** and shift focus to the new view.
|
|
121
|
+
|
|
122
|
+
**3.10 Accessibility library integration**
|
|
123
|
+
|
|
124
|
+
- Import \`@lssm/lib.accessibility\` at app root. It auto-imports its \`styles.css\` via the package entry; ensure bundlers keep CSS side effects. If your app tree-shakes CSS, explicitly import the stylesheet once in your root layout:
|
|
125
|
+
|
|
126
|
+
\`\`\`tsx
|
|
127
|
+
// app/layout.tsx
|
|
128
|
+
import '@lssm/lib.accessibility'; // includes tokens and provider exports
|
|
129
|
+
// or if needed: import '@lssm/lib.accessibility/src/styles.css';
|
|
130
|
+
\`\`\`
|
|
131
|
+
|
|
132
|
+
- Wrap the app with \`AccessibilityProvider\` and include an element with \`id="main"\` for the skip link target.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## 3b) lssm/ui-kit-web — Component Patterns & Defaults
|
|
137
|
+
|
|
138
|
+
> Source: \`packages/lssm/libs/ui-kit-web/ui/*\`
|
|
139
|
+
|
|
140
|
+
- **Button/Input/Textarea**: Built‑in \`focus-visible\` rings; ensure visible labels via \`FormLabel\` or \`aria-label\`.
|
|
141
|
+
- **Form** (\`form.tsx\`): \`FormControl\` wires \`aria-invalid\` and \`aria-describedby\` to \`FormMessage\` and \`FormDescription\`. Prefer \`FormMessage\` for inline errors. Add \`role="alert"\` only for critical.
|
|
142
|
+
- **Dialog/Sheet/Dropdown**: Use Radix wrappers for focus‑trap and return‑focus. Provide \`DialogTitle\` + \`DialogDescription\` for name/description.
|
|
143
|
+
- **Select/Combobox**: Prefer \`SelectTrigger\` with visible label; for icon‑only triggers, supply \`aria-label\`. Document examples in each app.
|
|
144
|
+
- **Tabs**: Use \`TabsList\`, \`TabsTrigger\`, \`TabsContent\`; names are programmatically determinable.
|
|
145
|
+
- **Toast/Toaster**: Prefer non‑blocking announcements; map critical to assertive region; include action buttons with clear labels.
|
|
146
|
+
- **Table**: Use \`TableCaption\`; ensure \`TableHead\` cells use proper \`scope\`. Provide \`aria-sort\` on sortable headers.
|
|
147
|
+
- **Utilities to add (repo action)**:
|
|
148
|
+
- \`SkipLink\` component and pattern in layouts.
|
|
149
|
+
- \`RouteAnnouncer\` (\`aria-live="polite"\`) and **FocusOnRouteChange** helper.
|
|
150
|
+
- \`VisuallyHidden\` wrapper (Radix visually-hidden or minimal utility).
|
|
151
|
+
- \`useReducedMotion\` helper; honor in animated components.
|
|
152
|
+
- Touch‑size variants (≥44×44) for interactive atoms.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## 4) Engineering Requirements (Mobile — Expo/React\xA0Native)
|
|
157
|
+
|
|
158
|
+
- Set \`accessibilityLabel\`, \`accessibilityHint\`, and \`accessibilityRole\` on touchables.
|
|
159
|
+
- Ensure **hit slop** / min size **≥\xA044×44\xA0dp**.
|
|
160
|
+
- Support Dynamic Type / font scaling; no clipped text at **200%**.
|
|
161
|
+
- Respect **Invert Colors** and **Reduce Motion**; avoid flashing.
|
|
162
|
+
- Group related items with \`accessibilityElements\` ordering; hide decoration with \`accessible={false}\` or \`importantForAccessibility="no-hide-descendants"\` when appropriate.
|
|
163
|
+
- Test with **VoiceOver (iOS)** and **TalkBack (Android)**.
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## 5) Component Patterns (Acceptance Rules)
|
|
168
|
+
|
|
169
|
+
**Buttons & Links**
|
|
170
|
+
|
|
171
|
+
- Use \`<button>\` for actions, \`<a href>\` for navigation. Provide disabled states that are perceivable beyond color.
|
|
172
|
+
|
|
173
|
+
**Navigation**
|
|
174
|
+
|
|
175
|
+
- Provide **Skip link**. One primary nav landmark. Indicate current page (\`aria-current="page"\`).
|
|
176
|
+
|
|
177
|
+
**Menus/Combobox/Autocomplete**
|
|
178
|
+
|
|
179
|
+
- Follow ARIA patterns: focus moves into list; \`aria-expanded\`, \`aria-controls\`, \`aria-activedescendant\` when applicable; Esc closes; typing filters.
|
|
180
|
+
|
|
181
|
+
**Modals/Dialogs**
|
|
182
|
+
|
|
183
|
+
- \`role="dialog"\` or \`alertdialog\` with **label**; focus trapped; background inert; Esc closes; return focus to trigger.
|
|
184
|
+
|
|
185
|
+
**Tabs**
|
|
186
|
+
|
|
187
|
+
- \`role="tablist"\`; tabs are in the tab order; arrow keys switch focus; content is \`role="tabpanel"\` with \`aria-labelledby\`.
|
|
188
|
+
|
|
189
|
+
**Toasts/Notifications**
|
|
190
|
+
|
|
191
|
+
- Non-critical: \`aria-live="polite"\`; critical: \`role="alert"\` sparingly.
|
|
192
|
+
|
|
193
|
+
**Infinite Scroll / “Load More”**
|
|
194
|
+
|
|
195
|
+
- Provide **Load more** control; announce new content to SR; preserve keyboard position.
|
|
196
|
+
|
|
197
|
+
**Drag & Drop (2.5.7)**
|
|
198
|
+
|
|
199
|
+
- Provide **non‑drag** alternative (e.g., move up/down buttons).
|
|
200
|
+
|
|
201
|
+
**Charts & Maps**
|
|
202
|
+
|
|
203
|
+
- Provide **table alternative** or textual summary; keyboard access to datapoints where interactive.
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## 6) Testing & CI (Blocking Gates)
|
|
208
|
+
|
|
209
|
+
**Static & Unit**
|
|
210
|
+
|
|
211
|
+
- \`eslint-plugin-jsx-a11y\` — error on violations.
|
|
212
|
+
- \`jest-axe\` — unit tests for components.
|
|
213
|
+
|
|
214
|
+
**Automated Integration**
|
|
215
|
+
|
|
216
|
+
- \`axe-core\` via Playwright or Cypress on critical flows.
|
|
217
|
+
- \`pa11y-ci\` on key routes; threshold: **0 Critical / 0 Serious** to merge.
|
|
218
|
+
- Lighthouse CI a11y score **≥\xA095** on target pages.
|
|
219
|
+
|
|
220
|
+
**Manual QA (per release)**
|
|
221
|
+
|
|
222
|
+
- **Keyboard patrol:** navigate primary flows without mouse.
|
|
223
|
+
- **Screen reader smoke:** NVDA (Windows) or VoiceOver (macOS/iOS) across login, navigation, forms, dialogs.
|
|
224
|
+
- **Zoom & Reflow:** 200–400% & 320\xA0px width.
|
|
225
|
+
- **Color/Contrast check:** tokens in both themes.
|
|
226
|
+
|
|
227
|
+
**Reporting**
|
|
228
|
+
|
|
229
|
+
- A11y issues labeled: \`a11y-blocker\`, \`a11y-bug\`, \`a11y-enhancement\` with WCAG ref.
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## 7) Repository‑Specific Adoption Plan
|
|
234
|
+
|
|
235
|
+
- Centralize UI usage on \`packages/lssm/libs/ui-kit-web\` and de‑duplicate per‑app \`components/ui\` where feasible.
|
|
236
|
+
- Introduce \`SkipLink\`, \`RouteAnnouncer\`, \`FocusOnRouteChange\`, and \`VisuallyHidden\` in \`ui-kit-web\`. Adopt in app layouts (\`app/layout.tsx\`) first.
|
|
237
|
+
- Add \`useReducedMotion\` and wire into animated components (e.g., \`drawer\`, \`tooltip\`, \`carousel\`).
|
|
238
|
+
- Add touch‑size variants to \`Button\`, \`IconButton\`, \`TabsTrigger\`, toggles.
|
|
239
|
+
- Document Select label patterns and error association in Forms.
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## 8) Code Snippets
|
|
244
|
+
|
|
245
|
+
**Skip Link**
|
|
246
|
+
|
|
247
|
+
\`\`\`html
|
|
248
|
+
<a
|
|
249
|
+
class="sr-only focus:not-sr-only focus-visible:outline focus-visible:ring-4 focus-visible:ring-offset-2"
|
|
250
|
+
href="#main"
|
|
251
|
+
>Skip to main content</a
|
|
252
|
+
>
|
|
253
|
+
<main id="main">…</main>
|
|
254
|
+
\`\`\`
|
|
255
|
+
|
|
256
|
+
**Dialog (Radix + shadcn/ui) — essentials**
|
|
257
|
+
|
|
258
|
+
\`\`\`tsx
|
|
259
|
+
// Ensure label, description, focus trap, and return focus on close remain intact
|
|
260
|
+
<Dialog>
|
|
261
|
+
<DialogTrigger asChild>
|
|
262
|
+
<button aria-haspopup="dialog">Open settings</button>
|
|
263
|
+
</DialogTrigger>
|
|
264
|
+
<DialogContent aria-describedby="settings-desc">
|
|
265
|
+
<DialogTitle>Settings</DialogTitle>
|
|
266
|
+
<p id="settings-desc">Update your preferences.</p>
|
|
267
|
+
<DialogClose asChild>
|
|
268
|
+
<button>Close</button>
|
|
269
|
+
</DialogClose>
|
|
270
|
+
</DialogContent>
|
|
271
|
+
</Dialog>
|
|
272
|
+
\`\`\`
|
|
273
|
+
|
|
274
|
+
**Form error association**
|
|
275
|
+
|
|
276
|
+
\`\`\`tsx
|
|
277
|
+
<label htmlFor="email">Email</label>
|
|
278
|
+
<input id="email" name="email" type="email" aria-describedby="email-err" />
|
|
279
|
+
<p id="email-err" role="alert">Enter a valid email.</p>
|
|
280
|
+
\`\`\`
|
|
281
|
+
|
|
282
|
+
**Route change announcement (Next.js)**
|
|
283
|
+
|
|
284
|
+
\`\`\`tsx
|
|
285
|
+
// Add once at app root
|
|
286
|
+
<div
|
|
287
|
+
aria-live="polite"
|
|
288
|
+
aria-atomic="true"
|
|
289
|
+
id="route-announcer"
|
|
290
|
+
className="sr-only"
|
|
291
|
+
/>
|
|
292
|
+
\`\`\`
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## 9) Exceptions & Waivers
|
|
297
|
+
|
|
298
|
+
- If a criterion cannot be met, file an issue with: context, attempted alternatives, WCAG reference, impact assessment, and a remediation date. **Temporary waivers only.**
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
## 10) Ownership
|
|
303
|
+
|
|
304
|
+
- **Design:** maintains token contrast, component specs.
|
|
305
|
+
- **Engineering:** enforces CI gates, implements patterns.
|
|
306
|
+
- **QA:** runs manual checks per release.
|
|
307
|
+
- **PM:** blocks release if AA not met on user‑visible flows.
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## 11) References (internalize; no external dependency at runtime)
|
|
312
|
+
|
|
313
|
+
- WCAG\xA02.2 (AA), EN\xA0301\xA0549. ARIA Authoring Practices. Platform HIG (Apple, Material).
|
|
314
|
+
- \`packages/lssm/libs/ui-kit-web\` as the canonical UI source for web.
|
|
315
|
+
|
|
316
|
+
> **Bottom line:** Shipping means **accessible by default**. We don’t trade a11y for speed; we bake it into speed.
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
## 12) Adoption Status (2025-09-23)
|
|
321
|
+
|
|
322
|
+
- web-artisan: AccessibilityProvider integrated; sr-only/forced-colors applied; 44x44 targets; forms announce errors; jest-axe and cypress-axe in place.
|
|
323
|
+
- web-strit: AccessibilityProvider integrated; forced-colors, sr-only; forms announce errors; 44x44 targets; contrast tokens and text-scale wired; jest-axe and cypress-axe in place.
|
|
324
|
+
- web-coliving: AccessibilityProvider integrated; forced-colors and focus visibility added; text-scale wired; landing pages converted to \`Section\`/stacks with text-lg defaults; CTA capture standardized; ESLint guard for text-xs in main content; jest-axe and cypress-axe in place. Next: audit icon-only controls and ensure 44x44 targets; add role="alert" where critical.
|
|
325
|
+
|
|
326
|
+
> CI gates: run eslint a11y, jest-axe on components, and cypress-axe on critical flows per app.
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
## 13) CI Hardening & Visual QA
|
|
331
|
+
|
|
332
|
+
- Linting: Run eslint with jsx-a11y rules across all web apps; block on violations.
|
|
333
|
+
- Unit: Run jest-axe for ui-kit-web and app-level components.
|
|
334
|
+
- Integration: cypress-axe on key flows (auth, forms, dialogs, tables).
|
|
335
|
+
- Synthetic scans: pa11y-ci on critical pages (0 Critical/Serious policy).
|
|
336
|
+
- Performance/A11y audit: Lighthouse CI with a11y score >= 95 on target routes.
|
|
337
|
+
- Artifacts: Upload pa11y and Lighthouse reports per PR; annotate failures.
|
|
338
|
+
|
|
339
|
+
### Recent additions (2025-09-26)
|
|
340
|
+
|
|
341
|
+
- AutocompleteInput (groceries): Upgraded to ARIA combobox pattern with \`aria-controls\`, \`aria-activedescendant\`, \`Escape\`/\`Tab\` handling, and labelled listbox.
|
|
342
|
+
- Cypress a11y tests added for furniture and incidents modules on \`/modules\` and operators flows; checks run axe with critical/serious impacts.
|
|
343
|
+
|
|
344
|
+
## 14) Accessibility Telemetry (PostHog)
|
|
345
|
+
|
|
346
|
+
- Events (anonymized): a11y_pref_changed (text_scale, contrast_mode, reduce_motion), a11y_panel_opened.
|
|
347
|
+
- Properties: app, route, previous_value, new_value, timestamp.
|
|
348
|
+
- Dashboards: Adoption over time, per app/route; correlation with reduced bounce on forms.
|
|
349
|
+
- Privacy: No PII; aggregate only.
|
|
350
|
+
`}];e(t);export{t as accessibility_wcag_compliance_specs_DocBlocks};
|