@peripheries/renderer 0.22.0 → 0.23.1

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.
Files changed (103) hide show
  1. package/README.md +125 -23
  2. package/dist/catalog.js +2 -6
  3. package/dist/chunks/forms-DxA9WzCt.js +336 -0
  4. package/dist/chunks/{load-CjPvISzH.js → load-b38vUiZM.js} +0 -4
  5. package/dist/chunks/{page-bundles-DLRIBP8g.js → page-bundles-CPj_vx-J.js} +1 -5
  6. package/dist/chunks/{persistence-DCMakM9H.js → persistence-hurkUUQ0.js} +0 -6
  7. package/dist/chunks/{projection-yvYKzMOS.js → projection-zhu32_KJ.js} +1 -15
  8. package/dist/chunks/{query-BPuCJC1C.js → query-D6xQbTFK.js} +166 -12
  9. package/dist/chunks/{refs-BLUokra5.js → refs-Csgh6rXq.js} +0 -4
  10. package/dist/chunks/{structure-o9pYoDjD.js → structure-CKBtQHJq.js} +1 -7
  11. package/dist/chunks/{validate-4LgH8QMJ.js → validate-BcB_PA1k.js} +20 -13
  12. package/dist/core.js +138 -47
  13. package/dist/forms.js +2 -0
  14. package/dist/print.js +0 -24
  15. package/dist/react.js +352 -22
  16. package/dist/runtime.js +2 -12
  17. package/dist/styles.css +9 -15
  18. package/dist/testing.js +214 -19
  19. package/dist/theme.js +0 -10
  20. package/dist/types/catalog/check.d.ts +0 -13
  21. package/dist/types/core/actions.d.ts +0 -24
  22. package/dist/types/core/bundles/load.d.ts +0 -23
  23. package/dist/types/core/bundles/page-bundles.d.ts +0 -9
  24. package/dist/types/core/bundles/refs.d.ts +1 -28
  25. package/dist/types/core/bundles/resolve.d.ts +0 -10
  26. package/dist/types/core/cell-props.d.ts +0 -20
  27. package/dist/types/core/cells.d.ts +0 -21
  28. package/dist/types/core/data-context.d.ts +4 -21
  29. package/dist/types/core/diagnostics.d.ts +20 -6
  30. package/dist/types/core/graph.d.ts +6 -44
  31. package/dist/types/core/index.d.ts +4 -3
  32. package/dist/types/core/layout.d.ts +0 -9
  33. package/dist/types/core/load-page.d.ts +30 -88
  34. package/dist/types/core/query.d.ts +6 -52
  35. package/dist/types/core/references.d.ts +0 -21
  36. package/dist/types/core/release.d.ts +11 -0
  37. package/dist/types/core/rules.d.ts +0 -1
  38. package/dist/types/core/selected.d.ts +0 -5
  39. package/dist/types/core/sources.d.ts +10 -63
  40. package/dist/types/core/store/create-store.d.ts +0 -6
  41. package/dist/types/core/store/persistence.d.ts +0 -1
  42. package/dist/types/core/store/projection.d.ts +0 -5
  43. package/dist/types/core/store/scope-keys.d.ts +0 -1
  44. package/dist/types/core/store/types.d.ts +0 -6
  45. package/dist/types/core/structure.d.ts +0 -33
  46. package/dist/types/core/types.d.ts +2 -13
  47. package/dist/types/core/validate.d.ts +0 -12
  48. package/dist/types/core/values.d.ts +0 -6
  49. package/dist/types/forms/conditions.d.ts +18 -0
  50. package/dist/types/forms/index.d.ts +3 -0
  51. package/dist/types/forms/model.d.ts +90 -0
  52. package/dist/types/forms/port.d.ts +47 -0
  53. package/dist/types/print/document-bindings.d.ts +0 -61
  54. package/dist/types/print/document-profile.d.ts +0 -137
  55. package/dist/types/print/map-staleness.d.ts +0 -66
  56. package/dist/types/print/page-map.d.ts +1 -334
  57. package/dist/types/print/paginate.d.ts +0 -190
  58. package/dist/types/print/print-layout.d.ts +0 -161
  59. package/dist/types/print/print-lint.d.ts +0 -109
  60. package/dist/types/print/print-policy.d.ts +0 -184
  61. package/dist/types/print/print-stylesheet.d.ts +0 -135
  62. package/dist/types/print/running-header.d.ts +0 -86
  63. package/dist/types/print/structure-print.d.ts +1 -243
  64. package/dist/types/react/cell-states.d.ts +0 -2
  65. package/dist/types/react/cell-view.d.ts +1 -15
  66. package/dist/types/react/index.d.ts +1 -0
  67. package/dist/types/react/page-renderer.d.ts +1 -33
  68. package/dist/types/react/structure-view.d.ts +0 -12
  69. package/dist/types/react/use-cell-store.d.ts +0 -5
  70. package/dist/types/react/use-container-size.d.ts +0 -5
  71. package/dist/types/react/use-forms-runtime.d.ts +147 -0
  72. package/dist/types/react/use-paging.d.ts +0 -9
  73. package/dist/types/runtime/boot.d.ts +0 -11
  74. package/dist/types/runtime/install.d.ts +0 -15
  75. package/dist/types/runtime/shims.d.ts +0 -8
  76. package/dist/types/runtime/store-export.d.ts +0 -7
  77. package/dist/types/testing/base-props.d.ts +0 -1
  78. package/dist/types/testing/components.d.ts +0 -8
  79. package/dist/types/testing/form-workbook.d.ts +103 -0
  80. package/dist/types/testing/golden.d.ts +0 -16
  81. package/dist/types/testing/ids.d.ts +0 -2
  82. package/dist/types/testing/index.d.ts +1 -0
  83. package/dist/types/testing/sources.d.ts +0 -7
  84. package/dist/types/theme/check.d.ts +0 -2
  85. package/dist/types/theme/color.d.ts +0 -12
  86. package/dist/types/theme/derive.d.ts +0 -12
  87. package/dist/types/theme/parse.d.ts +0 -7
  88. package/package.json +6 -2
  89. package/dist/catalog.js.map +0 -1
  90. package/dist/chunks/load-CjPvISzH.js.map +0 -1
  91. package/dist/chunks/page-bundles-DLRIBP8g.js.map +0 -1
  92. package/dist/chunks/persistence-DCMakM9H.js.map +0 -1
  93. package/dist/chunks/projection-yvYKzMOS.js.map +0 -1
  94. package/dist/chunks/query-BPuCJC1C.js.map +0 -1
  95. package/dist/chunks/refs-BLUokra5.js.map +0 -1
  96. package/dist/chunks/structure-o9pYoDjD.js.map +0 -1
  97. package/dist/chunks/validate-4LgH8QMJ.js.map +0 -1
  98. package/dist/core.js.map +0 -1
  99. package/dist/print.js.map +0 -1
  100. package/dist/react.js.map +0 -1
  101. package/dist/runtime.js.map +0 -1
  102. package/dist/testing.js.map +0 -1
  103. package/dist/theme.js.map +0 -1
@@ -9,45 +9,20 @@ import type { StackStoreApi } from '../core/store/create-store.js';
9
9
  import type { PageCell } from '../core/types.js';
10
10
  import { type FrameProps } from './cell-view.js';
11
11
  import type { LoadPage } from './use-paging.js';
12
- /** What differs between the host, the component repos' harness and the agency's preview (design/renderer.md §6). */
13
12
  export type RendererEnvironment = {
14
- /** Default components: what a name resolves to when no bundle in scope exports it. */
15
13
  core: CoreRegistry;
16
14
  navigate: (to: string) => void;
17
- /** The shared store the cells' selections, viewState and live read. */
18
15
  store: StackStoreApi;
19
- /** A page configuration problem, for whoever is building the page. Default: a console warning. */
20
16
  onDiagnostic?: (d: Diagnostic) => void;
21
- /**
22
- * The actions a cell gets. The host has none until R2's write rule; the
23
- * component repos' harness gives mocks (`projectCellActions` applies the PWA's
24
- * lookup rule to a page-level map).
25
- */
26
17
  actionsFor?: (cell: PageCell) => Record<string, CellAction> | undefined;
27
- /**
28
- * Runs a cell's declared action (design/data.md §9.2), resolved against the
29
- * cell's data and the component's `@input`: the host's write path, as the
30
- * viewer, or a harness's mock. Without it a declared action reports `FAILED`.
31
- */
32
18
  runAction?: RunAction;
33
- /**
34
- * Loads a paged label's next page (QueryDescriptor.paging), as the viewer.
35
- * Without it a paged label shows its first page, with `hasMore` false.
36
- */
37
19
  loadPage?: LoadPage;
38
- /** A component threw. Default: a console error; the cell shows an error notice either way. */
39
20
  onCellError?: (cellId: string, error: Error) => void;
40
- /** A cell's prop reference resolved to nothing (a binding the page gets wrong). */
41
21
  onUnresolvedReference?: (cellId: string, ref: string) => void;
42
- /**
43
- * Each rendered cell's props, leaf by leaf, with where each value came from (INV-DOC-6): what
44
- * the edit layer maps to a write function with `editTarget`. Called as each cell renders.
45
- */
46
22
  onPropSources?: (cell: EditCell, sources: PropSourceEntry[]) => void;
47
- /** Reads the page again: a cell whose data or bundle failed offers it as "Try again" (shell audit S1). */
48
23
  retry?: () => void;
49
- /** Extra attributes and style for each cell's frame, e.g. a print policy the host doesn't apply yet. */
50
24
  frameProps?: (cell: PageCell, contract: ComponentContract | undefined) => FrameProps | undefined;
25
+ cellProps?: (cell: PageCell) => Record<string, unknown> | undefined;
51
26
  };
52
27
  export type PageRendererProps = {
53
28
  runtime: PageRuntime;
@@ -55,14 +30,7 @@ export type PageRendererProps = {
55
30
  params: Record<string, unknown>;
56
31
  baseProps: unknown;
57
32
  context: Record<string, unknown>;
58
- /** The signed-in person, for `@viewer.*` in props (design/data.md §5). */
59
33
  viewer?: unknown;
60
34
  environment: RendererEnvironment;
61
35
  };
62
- /**
63
- * One page, one renderer (design/core.md §3, stages 4–5). It fetches nothing:
64
- * the page's data comes in `runtime` (loadPageData) and its bundles in
65
- * `bundles`. On the server the bundles haven't imported, so each cell renders
66
- * as a placeholder sized by its layout.
67
- */
68
36
  export declare function PageRenderer({ runtime, bundles, params, baseProps, context, viewer, environment }: PageRendererProps): import("react").JSX.Element;
@@ -5,21 +5,9 @@ type Derived = {
5
5
  numbering: SectionNumbering;
6
6
  references: SectionReferences;
7
7
  };
8
- /**
9
- * Numbering and references for the whole page, derived once: a nested
10
- * renderer that re-derived them from its subtree would number the same
11
- * section differently. Clause citations read each cell's resolved `props.blocks`.
12
- */
13
8
  export declare function useStructureFacts(structure: LayoutNode[], cells: PageCell[], env: CellEnvironment, documents: Record<string, {
14
9
  label?: unknown;
15
10
  }> | undefined): Derived;
16
- /**
17
- * The document renderer (the PWA's StructureRenderer). A node naming a cell
18
- * renders it with the whole document's numbering, levels, titles, anchors and
19
- * references for the node's own document, and with the node's children as the
20
- * cell's child cells. A section node is a real `<section>` with a heading; a
21
- * container section with no cell renders its children itself.
22
- */
23
11
  export declare function StructureView({ nodes, env, facts, level, documentId, }: {
24
12
  nodes: Array<LayoutNode | string> | ResolvedLayoutNode[];
25
13
  env: CellEnvironment;
@@ -1,11 +1,6 @@
1
1
  import type { StackStoreApi } from '../core/store/create-store.js';
2
2
  import { type ScopeContext } from '../core/store/scope-keys.js';
3
3
  import type { PageCell } from '../core/types.js';
4
- /**
5
- * A cell's `selections`, `viewState` and `live` props from the shared store.
6
- * The selector returns values only, compared shallowly, so a cell re-renders
7
- * only when one of its own channels changes; setters are attached after.
8
- */
9
4
  export declare function useCellStore(cell: PageCell, scope: ScopeContext, api: StackStoreApi): {
10
5
  selections: import("../core/index.js").ProjectedBundle | undefined;
11
6
  viewState: import("../core/index.js").ProjectedBundle | undefined;
@@ -3,9 +3,4 @@ export type Size = {
3
3
  width: number;
4
4
  height: number;
5
5
  };
6
- /**
7
- * The element's measured size, in whole pixels, updated at most once per
8
- * frame (design/core.md §4). Only for components that declare they need it:
9
- * CSS container queries cover the rest for free.
10
- */
11
6
  export declare function useContainerSize(ref: RefObject<HTMLElement | null>, enabled: boolean): Size | undefined;
@@ -0,0 +1,147 @@
1
+ import { type KeyboardEvent } from 'react';
2
+ import { type DisplayMode, type FileToUpload, type FormLink, type FormModel, type FormQuestionDefinition, type FormsPort, type FormsRefusal, type Position, type StepKind, type SubmissionStatus } from '../forms/index.js';
3
+ export declare const FORM_SAVE_DEBOUNCE_MS = 3000;
4
+ export type FormSaveState = 'idle' | 'saving' | 'saved' | 'error';
5
+ export type FormAnswer = {
6
+ key: string;
7
+ label: string;
8
+ question: FormQuestionDefinition | null;
9
+ value: unknown;
10
+ change(value: unknown): void;
11
+ readOnly: boolean;
12
+ required: boolean;
13
+ missing: boolean;
14
+ refusal: string | null;
15
+ inputId: string;
16
+ upload?(file: FileToUpload): Promise<{
17
+ ok: true;
18
+ } | {
19
+ ok: false;
20
+ refusal: string;
21
+ }>;
22
+ openFile?(): Promise<string | null>;
23
+ };
24
+ export declare const answerInputId: (key: string) => string;
25
+ export type FormSlotProps = {
26
+ title: string;
27
+ chapter: {
28
+ id: string;
29
+ title: string;
30
+ } | null;
31
+ step: {
32
+ id: string;
33
+ title: string;
34
+ index: number;
35
+ count: number;
36
+ kind: StepKind;
37
+ label?: string;
38
+ };
39
+ sections: Array<{
40
+ id: string;
41
+ title: string;
42
+ chapter?: string;
43
+ kind: StepKind;
44
+ label?: string;
45
+ complete: boolean;
46
+ answered: number;
47
+ total: number;
48
+ current: boolean;
49
+ }>;
50
+ progress: {
51
+ answered: number;
52
+ required: number;
53
+ ratio: number;
54
+ total: {
55
+ answered: number;
56
+ count: number;
57
+ };
58
+ };
59
+ question: {
60
+ index: number;
61
+ count: number;
62
+ key: string;
63
+ next: {
64
+ label: string;
65
+ } | null;
66
+ answer?: FormAnswer;
67
+ } | null;
68
+ goToQuestion(key: string): void;
69
+ displayMode: DisplayMode;
70
+ setDisplayMode(mode: DisplayMode): void;
71
+ goToSection(stepId: string): void;
72
+ advance(): void;
73
+ back(): void;
74
+ canBack: boolean;
75
+ next: {
76
+ title: string;
77
+ } | null;
78
+ submit?: {
79
+ label: string;
80
+ run(): void;
81
+ blocked: boolean;
82
+ } | null;
83
+ reopen?: {
84
+ label: string;
85
+ run(): void;
86
+ } | null;
87
+ save: {
88
+ state: FormSaveState;
89
+ at?: string;
90
+ error?: string;
91
+ };
92
+ missing: Array<{
93
+ key: string;
94
+ label: string;
95
+ }>;
96
+ chapters?: Array<{
97
+ id: string;
98
+ title: string;
99
+ }>;
100
+ status?: SubmissionStatus | null;
101
+ readOnly?: boolean;
102
+ review?: {
103
+ status: SubmissionStatus;
104
+ note: string;
105
+ at: string;
106
+ by: string | null;
107
+ } | null;
108
+ };
109
+ export type FormsRuntimeOptions = {
110
+ model: FormModel;
111
+ port: FormsPort;
112
+ initial: Record<string, {
113
+ value: unknown;
114
+ stateId?: string | null;
115
+ }>;
116
+ status: SubmissionStatus | null;
117
+ visited?: string[];
118
+ link?: FormLink;
119
+ phone?: boolean;
120
+ onNavigate?(link: FormLink, how: {
121
+ replace: boolean;
122
+ }): void;
123
+ describe?(code: FormsRefusal): string;
124
+ notes?: Array<{
125
+ at: string;
126
+ text: string;
127
+ status?: SubmissionStatus;
128
+ by?: string | null;
129
+ }>;
130
+ };
131
+ export declare function useFormsRuntime(o: FormsRuntimeOptions): {
132
+ slots: FormSlotProps | null;
133
+ cellProps: (cell: {
134
+ id: string;
135
+ }) => Record<string, unknown> | undefined;
136
+ steps: import("../forms/index.js").FormStep[];
137
+ step: import("../forms/index.js").FormStep;
138
+ position: Position | null;
139
+ values: Record<string, unknown>;
140
+ change: (key: string, value: unknown) => void;
141
+ flush: () => Promise<void>;
142
+ readOnly: boolean;
143
+ status: SubmissionStatus | null;
144
+ headingRef: import("react").RefObject<HTMLElement | null>;
145
+ contentRef: import("react").RefObject<HTMLElement | null>;
146
+ onKeyDown: (e: KeyboardEvent) => void;
147
+ };
@@ -1,22 +1,13 @@
1
1
  import type { QueryPage } from '../core/load-page.js';
2
2
  import type { DataContext, DataEntry, PageCell } from '../core/types.js';
3
- /** Loads one more page of a paged label (RendererEnvironment.loadPage): the host's read, as the viewer. */
4
3
  export type LoadPage = (descriptor: NonNullable<DataEntry['page']>['descriptor'], variables: Record<string, unknown>) => Promise<QueryPage>;
5
- /** A paged label as a component sees it (apps.md §6). */
6
4
  export type LabelPaging = {
7
5
  hasMore: boolean;
8
6
  isLoadingMore: boolean;
9
7
  error: Error | null;
10
8
  loadMore: () => void;
11
9
  };
12
- /** The labels a cell reads: those it declares, and those its props reference. */
13
10
  export declare function cellLabels(cell: Pick<PageCell, 'props' | 'data'>): Set<string>;
14
- /**
15
- * A cell's paged labels (QueryDescriptor.paging): the pages it has loaded
16
- * beyond the first, appended to each label's data, and `loadMore` /
17
- * `hasMore` per label. A label whose first page reloads (a write, Realtime)
18
- * starts again from that page.
19
- */
20
11
  export declare function usePaging(cell: Pick<PageCell, 'props' | 'data'>, entries: DataContext, loadPage: LoadPage | undefined): {
21
12
  data: DataContext;
22
13
  paging: Record<string, LabelPaging> | undefined;
@@ -1,18 +1,7 @@
1
1
  import { type SharedImport } from '@peripheries/runtime';
2
- /**
3
- * A classic inline script that must run before any module: it creates the
4
- * promise every shim awaits. `installRuntime` resolves it.
5
- */
6
2
  export declare const RUNTIME_BOOT_SCRIPT: string;
7
- /**
8
- * The import map for a page: the pinned runtimes plus the shared lineages'
9
- * live versions (design/core-and-tokens.md §4). One map per page, because
10
- * Firefox doesn't merge several and a merged map keeps the first rule.
11
- */
12
3
  export declare function importMapFor(shared?: readonly SharedImport[]): {
13
4
  imports: Record<string, string>;
14
5
  };
15
- /** `importMapFor`, serialised for `<script type="importmap">`. `<` is escaped so a URL can't close the script. */
16
6
  export declare function importMapJson(shared?: readonly SharedImport[]): string;
17
- /** The import map with no shared lineages, serialised for `<script type="importmap">`. */
18
7
  export declare const IMPORT_MAP_JSON: string;
@@ -1,5 +1,4 @@
1
1
  import { READY_GLOBAL, RESOLVE_GLOBAL, RUNTIME_GLOBAL, type RuntimeSpecifier } from '@peripheries/runtime';
2
- /** `@peripheries/ui` is lent by the host (`extra`), not installed by the renderer. */
3
2
  export type StackRuntime = Record<Exclude<RuntimeSpecifier, '@peripheries/ui'>, unknown> & Record<string, unknown>;
4
3
  type RuntimeGlobals = {
5
4
  [RUNTIME_GLOBAL]?: StackRuntime;
@@ -7,20 +6,6 @@ type RuntimeGlobals = {
7
6
  [RESOLVE_GLOBAL]?: () => void;
8
7
  require?: (specifier: string) => unknown;
9
8
  };
10
- /**
11
- * The host's module instances by specifier. `extra` is what the host lends beyond the
12
- * renderer's own (`@peripheries/ui`), so the published renderer depends on nothing it
13
- * doesn't install itself.
14
- */
15
9
  export declare function buildRuntime(extra?: Record<string, unknown>): StackRuntime;
16
- /**
17
- * Puts the host's module instances where the `/_shared/*.js` shims look for
18
- * them, and releases every shim waiting on the boot promise. Idempotent.
19
- *
20
- * Also installs a `globalThis.require` for Rolldown's CJS interop: bundles
21
- * built with Vite 8 call `require('react')` from transitive CJS dependencies
22
- * at module init, which throws in a browser without it. The runtime modules
23
- * are already loaded, so it answers synchronously.
24
- */
25
10
  export declare function installRuntime(g?: RuntimeGlobals, extra?: Record<string, unknown>): StackRuntime;
26
11
  export { runtimeReady } from '../core/bundles/load.js';
@@ -1,11 +1,3 @@
1
1
  import { type RuntimeSpecifier } from '@peripheries/runtime';
2
- /** Output file name, taken from the URL the import map advertises, so the two can't disagree. */
3
2
  export declare function shimFileName(specifier: RuntimeSpecifier): string;
4
- /**
5
- * An ESM module that forwards `specifier` to the host's instance.
6
- *
7
- * It awaits the ready promise the boot script creates, so a bundle imported
8
- * before the host has installed its runtime waits instead of failing: the
9
- * "Failed to resolve module specifier" race cannot happen (channel-06 #10).
10
- */
11
3
  export declare function renderShim(specifier: RuntimeSpecifier, names: string[], hasDefault: boolean): string;
@@ -1,14 +1,7 @@
1
1
  import { type StackStoreApi } from '../core/store/create-store.js';
2
2
  import type { LiveEntry, ScopeId, StackStoreState } from '../core/store/types.js';
3
3
  export declare function getStackStore(): StackStoreApi;
4
- /**
5
- * Forget everything the shared store holds for the current viewer: its
6
- * selections, view state and live data, and every persisted scope. The host
7
- * calls it when the signed-in user changes or signs out, so nothing one
8
- * viewer selected or saw survives into the next viewer's session.
9
- */
10
4
  export declare function resetStackStore(): void;
11
- /** Subscribe a component to a slice of the shared store. */
12
5
  export declare function useStackStore<T>(selector: (state: StackStoreState) => T): T;
13
6
  export declare const selectors: {
14
7
  selection: (scope: ScopeId, channel: string) => (s: StackStoreState) => unknown;
@@ -1,3 +1,2 @@
1
1
  import type { BaseProps } from '@peripheries/runtime';
2
- /** What every cell gets as `baseProps` on a golden page: a synthetic viewer of the example client org. */
3
2
  export declare const FIXTURE_BASE_PROPS: BaseProps;
@@ -12,22 +12,15 @@ type SectionMaps = {
12
12
  }>;
13
13
  };
14
14
  export declare function Masthead({ title, subtitle }: Props): import("react").JSX.Element;
15
- /** Authored text arrives as `children` unless the cell has child cells. */
16
15
  export declare function Prose({ children }: Props): import("react").JSX.Element;
17
- /** A section body in the style of an org bundle's DocumentSection: it owns its section's anchor. */
18
16
  export declare function DocumentSection({ sectionId, title, body, blocks, children, sectionNumbers, sectionAnchors }: Props & SectionMaps): import("react").JSX.Element;
19
- /** A same-page citation: `§<number> <title>`, plus the clause's letter when it names one. */
20
17
  export declare function SectionReference({ to, sectionReferences }: Props & SectionMaps): import("react").JSX.Element;
21
18
  export declare function KpiCard({ label, value, data, status }: Props): import("react").JSX.Element;
22
- /** Writes a shared selection. */
23
19
  export declare function OptionList({ options, selections }: Props): import("react").JSX.Element;
24
- /** Reads the same selection. */
25
20
  export declare function SelectionEcho({ selections }: Props): import("react").JSX.Element;
26
21
  export declare function Boom(): never;
27
- /** Lists a walk's nodes with their plan and data states, as a backlog or flow cell would. */
28
22
  export declare function FlowList({ nodes, edges }: Props): import("react").JSX.Element;
29
23
  export declare function Badge({ text }: Props): import("react").JSX.Element;
30
- /** The example client org's main lineage. */
31
24
  export declare const clientKit: {
32
25
  Masthead: typeof Masthead;
33
26
  Prose: typeof Prose;
@@ -39,7 +32,6 @@ export declare const clientKit: {
39
32
  FlowList: typeof FlowList;
40
33
  Boom: typeof Boom;
41
34
  };
42
- /** The advisor org's main lineage: its own Prose (which the client's shadows) and a Badge only it has. */
43
35
  export declare const advisorKit: {
44
36
  Prose: ({ children }: Props) => import("react").JSX.Element;
45
37
  Badge: typeof Badge;
@@ -0,0 +1,103 @@
1
+ import { type FormItem, type FormModel } from '../forms/index.js';
2
+ export declare const formWorkbookPage: {
3
+ id: string;
4
+ name: string;
5
+ org_id: string;
6
+ project_id: string;
7
+ process_id: null;
8
+ graph_node_id: null;
9
+ page_type: string;
10
+ status: string;
11
+ is_template: boolean;
12
+ metadata: null;
13
+ content: {
14
+ cells: ({
15
+ id: string;
16
+ component: string;
17
+ props: {
18
+ blocks: {
19
+ text: string;
20
+ }[];
21
+ question?: undefined;
22
+ };
23
+ when?: undefined;
24
+ } | {
25
+ id: string;
26
+ component: string;
27
+ props: {
28
+ question: {
29
+ key: string;
30
+ label: string;
31
+ type: string;
32
+ required: boolean;
33
+ options?: undefined;
34
+ };
35
+ blocks?: undefined;
36
+ };
37
+ when?: undefined;
38
+ } | {
39
+ id: string;
40
+ component: string;
41
+ props: {
42
+ question: {
43
+ key: string;
44
+ label: string;
45
+ type: string;
46
+ required: boolean;
47
+ options: {
48
+ value: string;
49
+ label: string;
50
+ }[];
51
+ };
52
+ blocks?: undefined;
53
+ };
54
+ when?: undefined;
55
+ } | {
56
+ id: string;
57
+ component: string;
58
+ props: {
59
+ question: {
60
+ key: string;
61
+ label: string;
62
+ type: string;
63
+ required: boolean;
64
+ options?: undefined;
65
+ };
66
+ blocks?: undefined;
67
+ };
68
+ when: {
69
+ all: {
70
+ q: string;
71
+ op: string;
72
+ value: string;
73
+ }[];
74
+ };
75
+ } | {
76
+ id: string;
77
+ component: string;
78
+ props: {
79
+ blocks?: undefined;
80
+ question?: undefined;
81
+ };
82
+ when?: undefined;
83
+ })[];
84
+ };
85
+ layout: {
86
+ type: string;
87
+ chapters: {
88
+ id: string;
89
+ title: string;
90
+ }[];
91
+ steps: {
92
+ id: string;
93
+ title: string;
94
+ chapter: string;
95
+ cell_ids: string[];
96
+ }[];
97
+ submit: {
98
+ required: string;
99
+ };
100
+ };
101
+ };
102
+ export declare function formWorkbookItem(cellId: string): FormItem | null;
103
+ export declare const formWorkbookModel: () => FormModel;
@@ -8,49 +8,33 @@ export type GoldenBundle = {
8
8
  };
9
9
  export type GoldenPage = {
10
10
  name: string;
11
- /** What it proves, in one line. */
12
11
  purpose: string;
13
12
  page: ProjectPage;
14
- /** The process row: its id and its `<tier>_<role>_system_id` columns. */
15
13
  process?: {
16
14
  id: string;
17
15
  } & Record<string, string | null>;
18
- /** walk_graph's answers, by start node (and depth, when two walks share a start); states keyed by system id. */
19
16
  walks?: Array<{
20
17
  start: string;
21
18
  maxDepth?: number;
22
19
  result: RawWalk;
23
20
  }>;
24
- /** Newest `page_cell_config` per cell node (cell_config_latest). */
25
21
  configs?: Array<{
26
22
  system_id: string;
27
23
  graph_node_id: string;
28
24
  config: Record<string, unknown>;
29
25
  }>;
30
- /** Newest state per node (node_state_latest). */
31
26
  states?: Array<{
32
27
  system_id: string;
33
28
  graph_node_id: string;
34
29
  data: unknown;
35
30
  }>;
36
- /**
37
- * Queries' answers by operation name: what the label holds, already shaped
38
- * (design/data.md §6). A function of the variables answers per viewer or per id.
39
- */
40
31
  queries?: Record<string, unknown | ((variables: Record<string, unknown>) => unknown)>;
41
- /** Live bundles the viewer can see; the page's scope picks among them. */
42
32
  bundles: GoldenBundle[];
43
- /** The org template's advisor org, whose main lineage is in scope after the page's own org. */
44
33
  advisorOrgId?: string;
45
34
  };
46
- /** An SCG document: a frame cell, then sections numbered through a transparent container, a clause citation and child cells. */
47
35
  export declare const documentPage: GoldenPage;
48
- /** A grid dashboard fed by declared producers, with conditions, a crash, a missing component and a shared selection. */
49
36
  export declare const dashboardPage: GoldenPage;
50
- /** A legacy page of thin refs: configs from the cells' DSNS, their declarations hoisted, one config missing. */
51
37
  export declare const thinRefPage: GoldenPage;
52
- /** Every cell form on one page: inline, refs (one with a config, one falling back), a legacy thin ref, form 4, and a cross-org bundle. */
53
38
  export declare const mixedPage: GoldenPage;
54
- /** Walks from the page node: @_traversal with two systems, walk labels scoped to their cell, declarations winning, walks skipped when not needed. */
55
39
  export declare const walkPage: GoldenPage;
56
40
  export declare const GOLDEN_PAGES: GoldenPage[];
@@ -1,7 +1,5 @@
1
- /** A synthetic UUID: `fixtureId(7)` → `00000000-0000-4000-8000-000000000007`. */
2
1
  export declare const fixtureId: (n: number) => string;
3
2
  export declare const FIXTURE_ID: RegExp;
4
- /** The only org slugs and email domain a fixture may use. */
5
3
  export declare const FIXTURE_ORG_SLUGS: readonly ["example-client", "example-advisor"];
6
4
  export declare const FIXTURE_EMAIL_DOMAIN = "example.test";
7
5
  export declare const CLIENT_ORG: {
@@ -3,3 +3,4 @@ export * as fixtureComponents from './components.js';
3
3
  export { dashboardPage, documentPage, GOLDEN_PAGES, mixedPage, thinRefPage, walkPage, type GoldenBundle, type GoldenPage } from './golden.js';
4
4
  export { ADVISOR_ORG, CLIENT_ORG, FIXTURE_EMAIL_DOMAIN, FIXTURE_ID, FIXTURE_ORG_SLUGS, fixtureId } from './ids.js';
5
5
  export { goldenBundleRow, goldenBundles, goldenGraphSource, goldenScope, type SourceCall } from './sources.js';
6
+ export { formWorkbookItem, formWorkbookModel, formWorkbookPage } from './form-workbook.js';
@@ -8,18 +8,11 @@ export type SourceCall = {
8
8
  method: keyof GraphSource;
9
9
  args: unknown[];
10
10
  };
11
- /** A GraphSource over a golden page's process, configs, states and walks. */
12
11
  export declare function goldenGraphSource(g: GoldenPage): GraphSource & {
13
12
  calls: SourceCall[];
14
13
  };
15
- /** A golden bundle's registry row: every export, under its own name. */
16
14
  export declare function goldenBundleRow(b: GoldenBundle): BundleRow;
17
- /** The page's bundle scope, nearest first: its own refs, then its org's main lineage, then the advisor org's. */
18
15
  export declare function goldenScope(g: GoldenPage): LineageRef[];
19
- /**
20
- * The page's bundles, "imported" from the golden modules. `loaded: false` gives
21
- * what the server renders with: the rows, and no bundle yet.
22
- */
23
16
  export declare function goldenBundles(g: GoldenPage, cells: PageCell[], { loaded }?: {
24
17
  loaded?: boolean | undefined;
25
18
  }): PageBundles;
@@ -1,6 +1,4 @@
1
1
  import type { ThemeV2 } from '@peripheries/runtime';
2
2
  import type { ThemeDiagnostic } from './parse.js';
3
- /** [foreground, background, minimum ratio]: 4.5 for text, 3 for UI and large text. */
4
3
  export declare const CONTRAST_PAIRS: readonly (readonly [string, string, number])[];
5
- /** Contrast warnings for the theme's merged tier. Pairs whose values don't resolve to colours are skipped. */
6
4
  export declare function checkTheme(theme: ThemeV2, base?: Record<string, string>): ThemeDiagnostic[];
@@ -1,29 +1,17 @@
1
- /** A gamma-encoded sRGB colour, every channel 0–1. */
2
1
  export type Rgb = {
3
2
  r: number;
4
3
  g: number;
5
4
  b: number;
6
5
  alpha: number;
7
6
  };
8
- /** OKLCH: lightness 0–1, chroma (0–~0.4), hue in degrees. */
9
7
  export type Oklch = {
10
8
  l: number;
11
9
  c: number;
12
10
  h: number;
13
11
  };
14
- /** Parse a CSS colour: hex (#rgb, #rgba, #rrggbb, #rrggbbaa), rgb()/rgba(), hsl()/hsla() or oklch(), legacy or modern syntax. */
15
12
  export declare function parseColor(value: string): Rgb | null;
16
- /** `#rrggbb`, or `#rrggbbaa` when the colour is translucent. */
17
13
  export declare function toHex(color: Rgb): string;
18
- /** sRGB → OKLCH (alpha is dropped). Achromatic colours get hue 0. */
19
14
  export declare function toOklch(color: Rgb): Oklch;
20
- /** OKLCH → sRGB, mapped into gamut by reducing chroma at the same lightness and hue. */
21
15
  export declare function fromOklch(color: Oklch): Rgb;
22
- /** WCAG 2.x relative luminance. */
23
16
  export declare function relativeLuminance(color: Rgb): number;
24
- /**
25
- * WCAG 2.x contrast ratio (1–21) of a foreground on a background. A
26
- * translucent foreground is composited over the background, a translucent
27
- * background over white. Null when either colour doesn't parse.
28
- */
29
17
  export declare function contrastRatio(foreground: Rgb | string, background: Rgb | string): number | null;
@@ -1,18 +1,6 @@
1
1
  import type { ThemeV2 } from '@peripheries/runtime';
2
2
  import { type Rgb } from './color.js';
3
- /** What the derivation and the check assume when neither the theme nor the base sets them. */
4
3
  export declare const FALLBACK_BASE: Readonly<Record<string, string>>;
5
- /** Follow `var(--x)` through a flat token map (keys without `--`) to a colour. */
6
4
  export declare function resolveColor(value: string | undefined, tokens: Record<string, string>, depth?: number): Rgb | null;
7
- /**
8
- * The semantic overrides a theme sets (names without `--`). `base` is core's
9
- * flat default map; it supplies the background and text the derivation
10
- * contrasts against when the theme doesn't set them. Explicit `tokens` win.
11
- */
12
5
  export declare function themeTokens(theme: ThemeV2, base?: Record<string, string>): Record<string, string>;
13
- /**
14
- * The overrides as the `theme` cascade layer, one declaration per line,
15
- * sorted; '' when the theme sets nothing. A value that could break out of
16
- * a declaration or the `<style>` element is dropped.
17
- */
18
6
  export declare function themeCss(theme: ThemeV2, base?: Record<string, string>): string;
@@ -5,18 +5,11 @@ export type ThemeDiagnostic = {
5
5
  message: string;
6
6
  severity: 'error' | 'warning';
7
7
  };
8
- /** A value that is safe to write into a declaration in a `<style>` element. */
9
8
  export declare const isSafeCssValue: (value: string) => boolean;
10
- /** `var(--name)` or `var(--name, fallback)`. */
11
9
  export declare const VAR_REF: RegExp;
12
10
  type Read = {
13
11
  theme: ThemeV2;
14
12
  diagnostics: ThemeDiagnostic[];
15
13
  };
16
- /**
17
- * A template's theme as version 2. `version: 2` is validated as written; no
18
- * version (or `version: 1`) is the legacy shape, mapped per
19
- * design/core-and-tokens.md §6.1. Bad values are dropped with a diagnostic.
20
- */
21
14
  export declare function parseTheme(raw: unknown): Read;
22
15
  export {};