@peripheries/renderer 0.23.0 → 0.24.0
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/README.md +62 -34
- package/dist/catalog.js +2 -6
- package/dist/chunks/{forms-CCAE7sCu.js → forms-DxA9WzCt.js} +0 -6
- package/dist/chunks/{load-CjPvISzH.js → load-b38vUiZM.js} +0 -4
- package/dist/chunks/{page-bundles-DLRIBP8g.js → page-bundles-CPj_vx-J.js} +1 -5
- package/dist/chunks/{persistence-DCMakM9H.js → persistence-hurkUUQ0.js} +0 -6
- package/dist/chunks/{projection-yvYKzMOS.js → projection-zhu32_KJ.js} +1 -15
- package/dist/chunks/{query-LnTbQghF.js → query-D6xQbTFK.js} +0 -6
- package/dist/chunks/{refs-BLUokra5.js → refs-Csgh6rXq.js} +0 -4
- package/dist/chunks/{structure-BrKSgzRJ.js → structure-CKBtQHJq.js} +1 -7
- package/dist/chunks/{validate-B_g7719l.js → validate-BcB_PA1k.js} +2 -10
- package/dist/core.js +26 -26
- package/dist/forms.js +1 -1
- package/dist/print.js +0 -24
- package/dist/react.js +9 -27
- package/dist/runtime.js +2 -12
- package/dist/styles.css +9 -15
- package/dist/testing.js +5 -21
- package/dist/theme.js +0 -10
- package/dist/types/catalog/check.d.ts +0 -13
- package/dist/types/core/actions.d.ts +0 -24
- package/dist/types/core/bundles/load.d.ts +0 -23
- package/dist/types/core/bundles/page-bundles.d.ts +0 -9
- package/dist/types/core/bundles/refs.d.ts +1 -28
- package/dist/types/core/bundles/resolve.d.ts +0 -10
- package/dist/types/core/cell-props.d.ts +0 -20
- package/dist/types/core/cells.d.ts +0 -21
- package/dist/types/core/data-context.d.ts +0 -22
- package/dist/types/core/diagnostics.d.ts +1 -3
- package/dist/types/core/graph.d.ts +0 -54
- package/dist/types/core/index.d.ts +1 -0
- package/dist/types/core/layers.d.ts +8 -0
- package/dist/types/core/layers.gen.d.ts +12 -0
- package/dist/types/core/layout.d.ts +0 -9
- package/dist/types/core/load-page.d.ts +0 -111
- package/dist/types/core/query.d.ts +0 -64
- package/dist/types/core/references.d.ts +0 -21
- package/dist/types/core/release.d.ts +0 -10
- package/dist/types/core/rules.d.ts +0 -1
- package/dist/types/core/selected.d.ts +0 -5
- package/dist/types/core/sources.d.ts +5 -64
- package/dist/types/core/store/create-store.d.ts +0 -6
- package/dist/types/core/store/persistence.d.ts +0 -1
- package/dist/types/core/store/projection.d.ts +0 -5
- package/dist/types/core/store/scope-keys.d.ts +0 -1
- package/dist/types/core/store/types.d.ts +0 -6
- package/dist/types/core/structure.d.ts +0 -33
- package/dist/types/core/types.d.ts +0 -13
- package/dist/types/core/validate.d.ts +0 -12
- package/dist/types/core/values.d.ts +0 -6
- package/dist/types/forms/conditions.d.ts +0 -37
- package/dist/types/forms/index.d.ts +1 -0
- package/dist/types/forms/model.d.ts +4 -48
- package/dist/types/forms/port.d.ts +0 -22
- package/dist/types/forms/section.d.ts +22 -0
- package/dist/types/print/document-bindings.d.ts +0 -61
- package/dist/types/print/document-profile.d.ts +0 -137
- package/dist/types/print/map-staleness.d.ts +0 -66
- package/dist/types/print/page-map.d.ts +1 -334
- package/dist/types/print/paginate.d.ts +0 -190
- package/dist/types/print/print-layout.d.ts +0 -161
- package/dist/types/print/print-lint.d.ts +0 -109
- package/dist/types/print/print-policy.d.ts +0 -184
- package/dist/types/print/print-stylesheet.d.ts +0 -135
- package/dist/types/print/running-header.d.ts +0 -86
- package/dist/types/print/structure-print.d.ts +1 -243
- package/dist/types/react/cell-states.d.ts +0 -2
- package/dist/types/react/cell-view.d.ts +0 -16
- package/dist/types/react/page-renderer.d.ts +0 -37
- package/dist/types/react/structure-view.d.ts +0 -12
- package/dist/types/react/use-cell-store.d.ts +0 -5
- package/dist/types/react/use-container-size.d.ts +0 -5
- package/dist/types/react/use-forms-runtime.d.ts +2 -55
- package/dist/types/react/use-paging.d.ts +0 -9
- package/dist/types/runtime/boot.d.ts +0 -11
- package/dist/types/runtime/install.d.ts +0 -15
- package/dist/types/runtime/shims.d.ts +0 -8
- package/dist/types/runtime/store-export.d.ts +0 -7
- package/dist/types/testing/base-props.d.ts +0 -1
- package/dist/types/testing/components.d.ts +0 -8
- package/dist/types/testing/form-workbook.d.ts +0 -3
- package/dist/types/testing/golden.d.ts +0 -16
- package/dist/types/testing/ids.d.ts +0 -2
- package/dist/types/testing/sources.d.ts +0 -7
- package/dist/types/theme/check.d.ts +0 -2
- package/dist/types/theme/color.d.ts +0 -12
- package/dist/types/theme/derive.d.ts +0 -12
- package/dist/types/theme/parse.d.ts +0 -7
- package/package.json +2 -2
- package/dist/catalog.js.map +0 -1
- package/dist/chunks/forms-CCAE7sCu.js.map +0 -1
- package/dist/chunks/load-CjPvISzH.js.map +0 -1
- package/dist/chunks/page-bundles-DLRIBP8g.js.map +0 -1
- package/dist/chunks/persistence-DCMakM9H.js.map +0 -1
- package/dist/chunks/projection-yvYKzMOS.js.map +0 -1
- package/dist/chunks/query-LnTbQghF.js.map +0 -1
- package/dist/chunks/refs-BLUokra5.js.map +0 -1
- package/dist/chunks/structure-BrKSgzRJ.js.map +0 -1
- package/dist/chunks/validate-B_g7719l.js.map +0 -1
- package/dist/core.js.map +0 -1
- package/dist/print.js.map +0 -1
- package/dist/react.js.map +0 -1
- package/dist/runtime.js.map +0 -1
- package/dist/testing.js.map +0 -1
- package/dist/theme.js.map +0 -1
|
@@ -10,60 +10,33 @@ export type LineageRef = {
|
|
|
10
10
|
} | {
|
|
11
11
|
kind: 'pinned';
|
|
12
12
|
bundleId: string;
|
|
13
|
-
}
|
|
14
|
-
/** A shared lineage (design/core-and-tokens.md §4), imported by its specifier. */
|
|
15
|
-
| {
|
|
13
|
+
} | {
|
|
16
14
|
kind: 'shared';
|
|
17
15
|
specifier: string;
|
|
18
16
|
orgSlug: string;
|
|
19
17
|
bundle: string;
|
|
20
18
|
};
|
|
21
|
-
/** A row of `shared_lineage_live`, as the scope needs it. */
|
|
22
19
|
export type SharedLineage = {
|
|
23
20
|
specifier: string;
|
|
24
21
|
org_slug: string;
|
|
25
22
|
bundle_name: string;
|
|
26
23
|
};
|
|
27
|
-
/** The shared lineage `@core/Name` resolves from first. */
|
|
28
24
|
export declare const CORE_SPECIFIER = "@stack/core";
|
|
29
25
|
export declare const MAIN = "main";
|
|
30
26
|
export declare const PUBLIC = "public";
|
|
31
|
-
/**
|
|
32
|
-
* Normalise a config ref. An org slug means that org's main lineage. A named
|
|
33
|
-
* lineage without `org_slug` belongs to the page's org, so it needs `pageOrgId`;
|
|
34
|
-
* without one it is dropped rather than guessed.
|
|
35
|
-
*/
|
|
36
27
|
export declare function normalizeRef(ref: unknown, pageOrgId?: string | null): LineageRef | null;
|
|
37
28
|
export declare const refKey: (r: LineageRef) => string;
|
|
38
|
-
/** Where a page's bundles come from, nearest level first (cell refs are per cell). */
|
|
39
29
|
export type BundleScopeInput = {
|
|
40
30
|
pageOrgId?: string | null;
|
|
41
|
-
/** `project_page.metadata.bundle_refs` */
|
|
42
31
|
pageRefs?: unknown[] | null;
|
|
43
|
-
/** `project_template.{org_id, bundle_name}` */
|
|
44
32
|
projectTemplate?: {
|
|
45
33
|
orgId: string;
|
|
46
34
|
bundleName: string | null;
|
|
47
35
|
} | null;
|
|
48
|
-
/** The section's route entry `bundle_ref` (R3). */
|
|
49
36
|
sectionRef?: unknown;
|
|
50
|
-
/**
|
|
51
|
-
* The orgs whose main lineages are fallbacks: the page's own org first, then
|
|
52
|
-
* the org template's advisor org. Only the first comes before the shared
|
|
53
|
-
* lineages.
|
|
54
|
-
*/
|
|
55
37
|
orgs?: Array<{
|
|
56
38
|
id: string;
|
|
57
39
|
}>;
|
|
58
|
-
/** `shared_lineage_live`: the shared lineages, after the page's own lineages. */
|
|
59
40
|
shared?: readonly SharedLineage[];
|
|
60
41
|
};
|
|
61
|
-
/**
|
|
62
|
-
* The ordered, de-duplicated lineage list for a page: page → project →
|
|
63
|
-
* section → the page org's main → shared lineages → the advisor org's main
|
|
64
|
-
* (design/core-and-tokens.md §3). The page's own lineages replace a shared
|
|
65
|
-
* component by exporting the same name; the advisor's main only fills names
|
|
66
|
-
* that neither they nor the shared lineages export, so an advisor org's
|
|
67
|
-
* legacy copy of a core component never shadows core on a client's page.
|
|
68
|
-
*/
|
|
69
42
|
export declare function bundleScope(input: BundleScopeInput): LineageRef[];
|
|
@@ -3,18 +3,8 @@ import type { LoadedBundle } from './load.js';
|
|
|
3
3
|
export type CoreRegistry = Record<string, ComponentType<Record<string, unknown>>>;
|
|
4
4
|
export type ResolvedComponent = {
|
|
5
5
|
Component: ComponentType<Record<string, unknown>>;
|
|
6
|
-
/** Which bundle supplied it, or 'core'. */
|
|
7
6
|
source: string;
|
|
8
7
|
};
|
|
9
|
-
/**
|
|
10
|
-
* One cascade (design/core.md §6, design/bundles.md §2, design/core-and-tokens.md §3):
|
|
11
|
-
* - `@core/Name` comes from `stack/core`, then the host's registry;
|
|
12
|
-
* - a cell with its own bundle_ref resolves from that bundle, then the host;
|
|
13
|
-
* - otherwise the page's bundles, nearest level first (org lineages, then the
|
|
14
|
-
* shared ones), then the host.
|
|
15
|
-
* The nearest wins on a name collision: that is how an org lineage replaces a
|
|
16
|
-
* shared component. `host:Name` is retired (renderer.md §10): no cell used it.
|
|
17
|
-
*/
|
|
18
8
|
export declare function resolveComponent(name: string, { cellBundle, scope, core }: {
|
|
19
9
|
cellBundle?: LoadedBundle | null;
|
|
20
10
|
scope: LoadedBundle[];
|
|
@@ -4,22 +4,10 @@ export type CellStatus = {
|
|
|
4
4
|
isError: boolean;
|
|
5
5
|
errors?: Error[];
|
|
6
6
|
};
|
|
7
|
-
/**
|
|
8
|
-
* A cell's own `data` prop (the PWA's projectDataBundle): its static values,
|
|
9
|
-
* then each declared key read from the page context. Every declared key is
|
|
10
|
-
* present, `undefined` while loading.
|
|
11
|
-
*/
|
|
12
7
|
export declare function projectCellData(cell: PageCell, ctx: DataContext): {
|
|
13
8
|
data: Record<string, unknown>;
|
|
14
9
|
status: CellStatus;
|
|
15
10
|
} | null;
|
|
16
|
-
/**
|
|
17
|
-
* The labels a cell reads whose query failed and left nothing (shell audit
|
|
18
|
-
* S1): its declared data keys and the labels its props and conditions refer
|
|
19
|
-
* to. A failed read must not render as an empty list. A query that never ran because a
|
|
20
|
-
* reference resolved to nothing (a client-scoped read with no client in view, a page with no
|
|
21
|
-
* data yet) hasn't failed: the cell renders without it, and the diagnostic says why.
|
|
22
|
-
*/
|
|
23
11
|
export declare function failedLabels(cell: PageCell, data: DataContext): string[];
|
|
24
12
|
export type AssembledInputs = {
|
|
25
13
|
resolvedProps: Record<string, unknown>;
|
|
@@ -27,7 +15,6 @@ export type AssembledInputs = {
|
|
|
27
15
|
baseProps: unknown;
|
|
28
16
|
cellData: ReturnType<typeof projectCellData>;
|
|
29
17
|
actions: Record<string, unknown> | undefined;
|
|
30
|
-
/** Paged labels the cell reads (apps.md §6), each with hasMore and loadMore. */
|
|
31
18
|
paging?: Record<string, {
|
|
32
19
|
hasMore: boolean;
|
|
33
20
|
isLoadingMore: boolean;
|
|
@@ -45,11 +32,4 @@ export type AssembledInputs = {
|
|
|
45
32
|
context: Record<string, unknown>;
|
|
46
33
|
renderComponent?: (key: string, props?: Record<string, unknown>) => unknown;
|
|
47
34
|
};
|
|
48
|
-
/**
|
|
49
|
-
* The PWA's order (CellRenderer.tsx:973-989), so contract props win over
|
|
50
|
-
* `cell.props`: props, children, isLoading / error, baseProps, data / status,
|
|
51
|
-
* actions, the store bundles; then what's new here: size, navigate, context
|
|
52
|
-
* (design/core.md §4). `isLoading` / `error` come from the cell's own data,
|
|
53
|
-
* not, as in the PWA, from whichever page key came first.
|
|
54
|
-
*/
|
|
55
35
|
export declare function assembleCellProps(i: AssembledInputs): Record<string, unknown>;
|
|
@@ -1,39 +1,18 @@
|
|
|
1
1
|
import type { Diagnostic } from './graph.js';
|
|
2
2
|
import type { PageCell } from './types.js';
|
|
3
|
-
/** The config fields a thin ref took from its DSNS (the PWA's HYDRATED_CELL_FIELDS, which the agency's publish mirrors). */
|
|
4
3
|
export declare const HYDRATED_CELL_FIELDS: readonly ["component", "props", "layout", "conditions", "children", "traversal", "data", "bundle_ref", "actions", "embed"];
|
|
5
|
-
/** Also kept, unlike the PWA, whose hydration and publish dropped them (design/core.md §3). */
|
|
6
4
|
export declare const STORE_FIELDS: readonly ["selections", "viewState", "live"];
|
|
7
|
-
/** What a ref's node owns: everything but the cell's placement. A field its config sets wins, as a whole. */
|
|
8
5
|
export declare const CONTENT_FIELDS: readonly [...("data" | "component" | "props" | "conditions" | "children" | "traversal" | "bundle_ref" | "actions" | "embed")[], "selections", "viewState", "live"];
|
|
9
|
-
/** Where a rendered cell's content came from. */
|
|
10
6
|
export type CellSource = 'inline' | 'node' | 'fallback' | 'pending';
|
|
11
|
-
/** A cell as the renderer reads it: its content resolved, `graph_node_id` its own node (if any). */
|
|
12
7
|
export type ResolvedCell = PageCell & {
|
|
13
8
|
source: CellSource;
|
|
14
9
|
};
|
|
15
|
-
/**
|
|
16
|
-
* The one place the authored forms are read (design/renderer.md §3.1):
|
|
17
|
-
* 1 inline; 2 inline with a `ref`; 3 `{ id, graph_node_id }` (legacy thin ref,
|
|
18
|
-
* read as 2); 4 inline with a `graph_node_id` (legacy, read as 1, walking
|
|
19
|
-
* from that node). Legacy forms are reported, so their use can be counted.
|
|
20
|
-
*/
|
|
21
10
|
export declare function normalizeCell(cell: PageCell, path?: string): {
|
|
22
11
|
cell: PageCell;
|
|
23
12
|
diagnostics: Diagnostic[];
|
|
24
13
|
};
|
|
25
|
-
/** Whether a (normalized) cell's content is managed by a node. */
|
|
26
14
|
export declare const hasRef: (cell: PageCell) => cell is PageCell & {
|
|
27
15
|
ref: NonNullable<PageCell["ref"]>;
|
|
28
16
|
};
|
|
29
|
-
/**
|
|
30
|
-
* A normalized cell with its node's `page_cell_config` (design/renderer.md §3.2):
|
|
31
|
-
* - the node owns the content (CONTENT_FIELDS): a field the config sets wins;
|
|
32
|
-
* - the page owns the placement: `id`, and `layout` when the entry has one;
|
|
33
|
-
* - `name` from the entry if it has one; `metadata` merged, entry then config;
|
|
34
|
-
* - no config: the entry renders as it is when it names a component
|
|
35
|
-
* (`fallback`), else the cell is `pending`.
|
|
36
|
-
*/
|
|
37
17
|
export declare function resolveCell(cell: PageCell, config: Record<string, unknown> | null | undefined): ResolvedCell;
|
|
38
|
-
/** Cells no other cell lists in `children`: what a flat page renders, in content order. */
|
|
39
18
|
export declare function rootCells<T extends PageCell>(cells: T[]): T[];
|
|
@@ -2,48 +2,26 @@ import { type NodeBinding, type NodeRecord, type QueryDescriptor, type StateName
|
|
|
2
2
|
import { readField, type Diagnostic, type ProcessSystems } from './graph.js';
|
|
3
3
|
export { readField };
|
|
4
4
|
import type { DataContext, ProjectPage } from './types.js';
|
|
5
|
-
/** A system a declaration reads: by name from the page's process, or named outright by id. */
|
|
6
5
|
export type StateRead = {
|
|
7
6
|
name?: StateName;
|
|
8
7
|
systemId: string;
|
|
9
8
|
};
|
|
10
|
-
/** A declaration with the systems it reads, in merge order. */
|
|
11
9
|
export type ResolvedDeclaration = NodeBinding & {
|
|
12
10
|
reads: StateRead[];
|
|
13
11
|
};
|
|
14
|
-
/**
|
|
15
|
-
* Declarations (`data.queries`) with the systems each reads: `system_id`
|
|
16
|
-
* outright, else its `state` names (default `eng_data`) through the page's
|
|
17
|
-
* systems. Only node bindings: a retired registry binding is left to
|
|
18
|
-
* validation. A declaration none of whose systems exist
|
|
19
|
-
* is dropped, with a diagnostic.
|
|
20
|
-
*/
|
|
21
12
|
export declare function resolveDeclarations(queries: Record<string, unknown> | undefined, systems: ProcessSystems, diagnostics?: Diagnostic[], cellId?: string): Record<string, ResolvedDeclaration>;
|
|
22
|
-
/** The inline descriptors among declarations (`{ descriptor }`), by label (design/data.md §3). */
|
|
23
13
|
export declare function collectDescriptors(queries: Record<string, unknown> | undefined): Record<string, QueryDescriptor>;
|
|
24
|
-
/** The page's own declarations (`content.data.queries`), which every cell sees. */
|
|
25
14
|
export declare const collectDeclarations: (page: ProjectPage, systems: ProcessSystems, diagnostics?: Diagnostic[]) => Record<string, ResolvedDeclaration>;
|
|
26
|
-
/** The page's static values (`content.data.static`), which every cell sees. */
|
|
27
15
|
export declare function collectStatic(page: ProjectPage): Record<string, unknown>;
|
|
28
|
-
/**
|
|
29
|
-
* The page-wide DataContext: static, then declared on top. A declared label
|
|
30
|
-
* whose producer has no state resolves to null. `states` is keyed
|
|
31
|
-
* `<system_id>/<graph_node_id>`; `records` holds the NodeRecords for
|
|
32
|
-
* `as: 'record'` declarations, by graph node id. Traversal is per cell
|
|
33
|
-
* (the cell's walk; design/renderer.md §5.2), not part of this context.
|
|
34
|
-
*/
|
|
35
16
|
export declare function buildDataContext(input: {
|
|
36
17
|
static: Record<string, unknown>;
|
|
37
18
|
declared: Record<string, ResolvedDeclaration>;
|
|
38
19
|
states: Map<string, unknown>;
|
|
39
20
|
records?: Record<string, NodeRecord>;
|
|
40
|
-
/** The id of each newest state, keyed as `states`: where an edit of a declared value goes (INV-DOC-6). */
|
|
41
21
|
stateIds?: Map<string, string>;
|
|
42
|
-
/** What version each state was read at (StateRow), by `system/node`, when the page was read at one. */
|
|
43
22
|
stateVersions?: Map<string, {
|
|
44
23
|
versionId: string | null;
|
|
45
24
|
outOfScope: boolean;
|
|
46
25
|
}>;
|
|
47
|
-
/** Whose static values these are: the page's (the default) or a cell's. */
|
|
48
26
|
staticScope?: 'page' | 'cell';
|
|
49
27
|
}): DataContext;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export type DiagnosticEntry = {
|
|
2
|
-
/** What the diagnostic means, in a sentence. */
|
|
3
2
|
meaning: string;
|
|
4
|
-
/** What to change. */
|
|
5
3
|
fix: string;
|
|
6
4
|
};
|
|
7
5
|
export declare const DIAGNOSTICS: {
|
|
@@ -111,7 +109,7 @@ export declare const DIAGNOSTICS: {
|
|
|
111
109
|
};
|
|
112
110
|
readonly UNSUPPORTED_REGISTRY_BINDING: {
|
|
113
111
|
readonly meaning: "A binding names a registry query (`{ registry: \"x.y\" }`) from the retired host contract.";
|
|
114
|
-
readonly fix: "Copy the matching recipe’s descriptor into `{ descriptor }` (the component’s pattern pack has it), or bind the graph node that produces the data.
|
|
112
|
+
readonly fix: "Copy the matching recipe’s descriptor into `{ descriptor }` (the component’s pattern pack has it), or bind the graph node that produces the data.";
|
|
115
113
|
};
|
|
116
114
|
readonly STATE_UNKNOWN_NAME: {
|
|
117
115
|
readonly meaning: "A state name is not `<tier>_<role>`.";
|
|
@@ -1,81 +1,37 @@
|
|
|
1
1
|
import { type EdgeRecord, type NodeRecord, type StateName, type StateRecord, type Traversal, type TraversalConfig } from '@peripheries/runtime';
|
|
2
2
|
import type { DiagnosticCode } from './diagnostics.js';
|
|
3
3
|
import type { PageCell } from './types.js';
|
|
4
|
-
/** The page's systems by name, from its process's graphs (and, for eng_data, the page's metadata fallback). */
|
|
5
4
|
export type ProcessSystems = Partial<Record<StateName, string>>;
|
|
6
|
-
/**
|
|
7
|
-
* A main, keyless system on one of a process's graphs, as GraphSource.graphSystems returns it:
|
|
8
|
-
* the graph's `graph_type` (its tier) and the system's layer role (`system_layer.role`; null for
|
|
9
|
-
* a layer that isn't a role, such as `edits`).
|
|
10
|
-
*/
|
|
11
5
|
export type GraphSystem = {
|
|
12
6
|
id: string;
|
|
13
7
|
graph_type: string | null;
|
|
14
8
|
role: string | null;
|
|
15
9
|
};
|
|
16
|
-
/**
|
|
17
|
-
* A process's systems by name from its graphs (systems.md §3: the tier is `graph.graph_type`, the
|
|
18
|
-
* role the layer's): every registered layer with a role, not only the four the process columns
|
|
19
|
-
* cache. A layer without a role, or a graph of another type, has no name.
|
|
20
|
-
*/
|
|
21
10
|
export declare function systemsFromGraphs(rows: readonly GraphSystem[] | null | undefined): ProcessSystems;
|
|
22
|
-
/**
|
|
23
|
-
* Something wrong with a page's configuration (design/renderer.md §7). Codes
|
|
24
|
-
* are stable, so tools can explain them; `legacy` marks a form still read but
|
|
25
|
-
* on its way out.
|
|
26
|
-
*/
|
|
27
11
|
export type Diagnostic = {
|
|
28
12
|
severity: 'error' | 'warning' | 'legacy';
|
|
29
|
-
/** One of DIAGNOSTICS' keys, which says what it means and how to fix it. */
|
|
30
13
|
code: DiagnosticCode;
|
|
31
14
|
message: string;
|
|
32
|
-
/** Where in the page, e.g. `content.cells[3].traversal`. */
|
|
33
15
|
path?: string;
|
|
34
16
|
cellId?: string;
|
|
35
17
|
label?: string;
|
|
36
|
-
/** The nearest names in scope, for a name that isn't there (CELL_UNKNOWN_COMPONENT). */
|
|
37
18
|
suggestions?: string[];
|
|
38
19
|
};
|
|
39
|
-
/** A process row's system columns, `<tier>_<role>_system_id`, as names. */
|
|
40
20
|
export declare function systemsFromProcess(row: Record<string, unknown> | null | undefined): ProcessSystems;
|
|
41
|
-
/** The state names a read asks for, in order, duplicates dropped; the default when it names none. */
|
|
42
21
|
export declare function stateNames(state: unknown): {
|
|
43
22
|
names: StateName[];
|
|
44
23
|
unknown: string[];
|
|
45
24
|
};
|
|
46
|
-
/** A value at a dot-path: the whole value without one. */
|
|
47
25
|
export declare function readField(state: unknown, field?: string): unknown;
|
|
48
|
-
/**
|
|
49
|
-
* Several systems' data for one node, merged in order, later winning: plain
|
|
50
|
-
* objects key by key, anything else replaces. `undefined` when none had any,
|
|
51
|
-
* so "not loaded" and "empty" differ.
|
|
52
|
-
*/
|
|
53
26
|
export declare function mergeStates(values: readonly unknown[]): unknown;
|
|
54
|
-
/** The named states of a NodeRecord, merged, then `field`. */
|
|
55
27
|
export declare function stateValue(state: NodeRecord['state'], names: readonly StateName[], field?: string): unknown;
|
|
56
28
|
export type WalkStart = {
|
|
57
29
|
graphNodeId: string;
|
|
58
30
|
kind: 'cell' | 'page';
|
|
59
31
|
};
|
|
60
|
-
/** A cell's own node (a thin ref's, or an inline cell's `graph_node_id`), else the page node (agency doc 17). */
|
|
61
32
|
export declare function resolveWalkStart(cell: Pick<PageCell, 'graph_node_id' | 'metadata'>, pageGraphNodeId: string | null | undefined): WalkStart | null;
|
|
62
|
-
/**
|
|
63
|
-
* Labels no declaration or walk can take: the cell's walk, the route's
|
|
64
|
-
* parameters, the host's props, the viewer and the location (design/data.md
|
|
65
|
-
* §5); `input` (an action's argument) and `scope` (the apps release) are kept free.
|
|
66
|
-
*/
|
|
67
33
|
export declare const RESERVED_LABELS: readonly ["_traversal", "params", "baseProps", "viewer", "context", "input", "scope"];
|
|
68
|
-
/**
|
|
69
|
-
* Every data label a cell's props and conditions read with a whole-string
|
|
70
|
-
* `@label…` reference. Inside an `@each` projection's `map`, its element's
|
|
71
|
-
* label (`as`) is the projection's own, not the page's.
|
|
72
|
-
*/
|
|
73
34
|
export declare function referencedLabels(cell: Pick<PageCell, 'props' | 'conditions'>): Set<string>;
|
|
74
|
-
/**
|
|
75
|
-
* Whether a cell's walk has anything to give it (design/renderer.md §5.2): it
|
|
76
|
-
* reads `@_traversal`, or a label nothing explicit provides. Declarations win
|
|
77
|
-
* over what a walk finds, so a walk whose labels are all declared changes nothing.
|
|
78
|
-
*/
|
|
79
35
|
export declare function needsWalk(cell: PageCell, explicit: ReadonlySet<string>): boolean;
|
|
80
36
|
export type WalkRequest = {
|
|
81
37
|
start: WalkStart;
|
|
@@ -84,7 +40,6 @@ export type WalkRequest = {
|
|
|
84
40
|
nodeTypes: string[] | null;
|
|
85
41
|
maxDepth: number;
|
|
86
42
|
maxNodes: number;
|
|
87
|
-
/** The state names asked for, and the system each resolves to. */
|
|
88
43
|
states: Array<{
|
|
89
44
|
name: StateName;
|
|
90
45
|
systemId: string;
|
|
@@ -92,14 +47,11 @@ export type WalkRequest = {
|
|
|
92
47
|
excludeNodeTypes: string[] | null;
|
|
93
48
|
excludeEdgeTypes: string[] | null;
|
|
94
49
|
};
|
|
95
|
-
/** A cell's walk as a request, or why it can't run. */
|
|
96
50
|
export declare function walkRequest(config: TraversalConfig, start: WalkStart, systems: ProcessSystems): {
|
|
97
51
|
request?: WalkRequest;
|
|
98
52
|
diagnostics: Omit<Diagnostic, 'cellId'>[];
|
|
99
53
|
};
|
|
100
|
-
/** One walk per distinct question: cells asking the same one from the same start share it. */
|
|
101
54
|
export declare const walkKey: (r: WalkRequest) => string;
|
|
102
|
-
/** What walk_graph returns: nodes with their states keyed by system id. */
|
|
103
55
|
export type RawWalk = {
|
|
104
56
|
nodes: Array<Omit<NodeRecord, 'state'> & {
|
|
105
57
|
state: Record<string, StateRecord | null>;
|
|
@@ -112,12 +64,6 @@ export type WalkBinding = {
|
|
|
112
64
|
graph_node_id: string;
|
|
113
65
|
field?: string;
|
|
114
66
|
};
|
|
115
|
-
/**
|
|
116
|
-
* A walk's result for its cells: `@_traversal` (NodeRecords with states by
|
|
117
|
-
* name, noise stripped, edges only between what's left), and the labels its
|
|
118
|
-
* `binding_key` nodes provide. Two nodes with one key is a diagnostic, and
|
|
119
|
-
* neither binds.
|
|
120
|
-
*/
|
|
121
67
|
export declare function readWalk(raw: RawWalk, request: WalkRequest): {
|
|
122
68
|
traversal: Traversal;
|
|
123
69
|
bindings: WalkBinding[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { CONTENT_FIELDS, hasRef, HYDRATED_CELL_FIELDS, normalizeCell, resolveCell, rootCells, STORE_FIELDS, type CellSource, type ResolvedCell } from './cells.js';
|
|
2
2
|
export { buildDataContext, collectDeclarations, collectDescriptors, collectStatic, readField, resolveDeclarations, type ResolvedDeclaration, type StateRead } from './data-context.js';
|
|
3
3
|
export { mergeStates, needsWalk, readWalk, referencedLabels, RESERVED_LABELS, resolveWalkStart, stateNames, stateValue, systemsFromGraphs, systemsFromProcess, walkKey, walkRequest, type Diagnostic, type GraphSystem, type ProcessSystems, type RawWalk, type WalkBinding, type WalkRequest, type WalkStart, } from './graph.js';
|
|
4
|
+
export { LAYER_ROLES, layerName, type LayerType } from './layers.js';
|
|
4
5
|
export { loadPageData, resolveDataSystem, resolveSystems, type CellData, type CellWalk, type GraphSource, type NodeRecordRow, type PageRuntime, type PageScope, type QueryPage, type ReadContext, type StateRow } from './load-page.js';
|
|
5
6
|
export { descriptorShape, orderByVariable, PAGING_VARIABLES, pageVariables, prepareDocument, queryKey, RENDER_FUNCTIONS, RENDER_FUNCTIONS_AHEAD, resolveDescriptorVariables, selectionShape, shapeAt, UnsafeDocumentError, validateDescriptor, VARIABLE_NAMESPACES, variableLabels, variableReferences, type PreparedDocument, type ResolvedVariables, type SelectionShape, } from './query.js';
|
|
6
7
|
export { selectionIssues } from './selected.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const LAYER_ROLES: {
|
|
2
|
+
readonly answer: null;
|
|
3
|
+
readonly "appraisal-system": "appraisal";
|
|
4
|
+
readonly "data-system": "data";
|
|
5
|
+
readonly edits: null;
|
|
6
|
+
readonly "model-system": "model";
|
|
7
|
+
readonly organisation: null;
|
|
8
|
+
readonly "process-system": "process";
|
|
9
|
+
readonly question: null;
|
|
10
|
+
readonly submission: null;
|
|
11
|
+
};
|
|
12
|
+
export type LayerType = keyof typeof LAYER_ROLES;
|
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
2
|
import type { CellLayout, PageCell } from './types.js';
|
|
3
|
-
/** The page container (the PWA's ProjectPageRenderer): stack by default; grid of `columns` (12); flex. */
|
|
4
3
|
export declare function pageContainerStyle(layout: Record<string, unknown> | null | undefined): CSSProperties;
|
|
5
|
-
/** A cell's placement in the page grid; a nested cell gets none. */
|
|
6
4
|
export declare function cellPlacementStyle(layout: CellLayout | undefined): CSSProperties;
|
|
7
|
-
/** Hooks for CSS: the renderer's responsive rules (styles.css) and bundles read these names (design/bundles.md §6). */
|
|
8
5
|
export declare function cellAttributes(cell: PageCell): Record<string, string>;
|
|
9
|
-
/**
|
|
10
|
-
* A document page's profile (`layout.profile`), set as `data-profile` on the
|
|
11
|
-
* page container so the document kit's `--doc-*` tokens resolve for it
|
|
12
|
-
* (design/core-and-tokens.md §6.5). Only a document page has one, and only a
|
|
13
|
-
* slug: the value becomes an attribute.
|
|
14
|
-
*/
|
|
15
6
|
export declare function documentProfile(layout: Record<string, unknown> | null | undefined): string | undefined;
|
|
@@ -2,15 +2,9 @@ import { type EmbedSelector, type NodeRecord, type QueryDescriptor, type StateRe
|
|
|
2
2
|
import { type ResolvedCell } from './cells.js';
|
|
3
3
|
import { type Diagnostic, type GraphSystem, type ProcessSystems, type RawWalk, type WalkRequest } from './graph.js';
|
|
4
4
|
import type { DataContext, DataEntry, ProjectPage } from './types.js';
|
|
5
|
-
/**
|
|
6
|
-
* The version a read is made at (versions.md §5.1): a release, a channel or a branch id, opaque
|
|
7
|
-
* to the renderer. Passed as each read's last argument only when the page isn't read at main, so
|
|
8
|
-
* a source that takes no context reads main, as before.
|
|
9
|
-
*/
|
|
10
5
|
export type ReadContext = {
|
|
11
6
|
versionId: string;
|
|
12
7
|
};
|
|
13
|
-
/** A state row as a source returns it; the version fields when it was read at a version (StateAsOf). */
|
|
14
8
|
export type StateRow = {
|
|
15
9
|
id: string;
|
|
16
10
|
data: unknown;
|
|
@@ -18,105 +12,40 @@ export type StateRow = {
|
|
|
18
12
|
unversioned?: boolean;
|
|
19
13
|
outOfScope?: boolean;
|
|
20
14
|
};
|
|
21
|
-
/** A NodeRecord as a source returns it: its states keyed by system id. */
|
|
22
15
|
export type NodeRecordRow = Omit<NodeRecord, 'state'> & {
|
|
23
16
|
stateBySystem: Record<string, StateRecord | null>;
|
|
24
17
|
};
|
|
25
|
-
/**
|
|
26
|
-
* Where a page's graph data comes from (design/renderer.md §6). The host's
|
|
27
|
-
* reads GraphQL under the viewer's JWT; the harness's reads fixtures; the
|
|
28
|
-
* agency's reads its own client. Every method may cache.
|
|
29
|
-
*/
|
|
30
18
|
export interface GraphSource {
|
|
31
|
-
/**
|
|
32
|
-
* The main, keyless systems on a process's graphs, with each graph's type and each layer's role
|
|
33
|
-
* (systems.md §3): how a page finds its systems, any registered layer included. Optional for
|
|
34
|
-
* 0.22 sources, which have `processSystems`; G4 drops the process columns, so a source needs this
|
|
35
|
-
* by then.
|
|
36
|
-
*/
|
|
37
19
|
graphSystems?(processId: string): Promise<GraphSystem[]>;
|
|
38
|
-
/**
|
|
39
|
-
* The process row: its `<tier>_<role>_system_id` columns, a cache of the four role layers.
|
|
40
|
-
* Read only by a source without `graphSystems`.
|
|
41
|
-
*/
|
|
42
20
|
processSystems?(processId: string): Promise<Record<string, unknown> | null>;
|
|
43
|
-
/** The newest `page_cell_config` of each cell node in a system. */
|
|
44
21
|
cellConfigs(systemId: string, graphNodeIds: string[], context?: ReadContext): Promise<Record<string, Record<string, unknown> | null>>;
|
|
45
|
-
/** The newest state's data of each node in a system; missing nodes absent. */
|
|
46
22
|
latestStates(systemId: string, graphNodeIds: string[], context?: ReadContext): Promise<Record<string, unknown>>;
|
|
47
|
-
/**
|
|
48
|
-
* The same, with each state's id: what a content edit's version check names (INV-DOC-6).
|
|
49
|
-
* Optional: without it, declared values carry no state id, and can't be edited.
|
|
50
|
-
*/
|
|
51
23
|
latestStateRows?(systemId: string, graphNodeIds: string[], context?: ReadContext): Promise<Record<string, StateRow>>;
|
|
52
24
|
walk(request: WalkRequest, context?: ReadContext): Promise<RawWalk>;
|
|
53
25
|
nodeRecords(graphNodeIds: string[], systemIds: string[], context?: ReadContext): Promise<Record<string, NodeRecordRow>>;
|
|
54
|
-
/**
|
|
55
|
-
* A query, as the viewer, its result shaped by the descriptor's `result`
|
|
56
|
-
* (design/data.md §6). Variables are resolved, `$orderBy` included. The
|
|
57
|
-
* host runs it through prepareDocument; a harness answers from fixtures
|
|
58
|
-
* keyed by the operation's name.
|
|
59
|
-
*/
|
|
60
26
|
query(descriptor: QueryDescriptor, variables: Record<string, unknown>): Promise<unknown>;
|
|
61
|
-
/**
|
|
62
|
-
* One page of a paged descriptor (QueryDescriptor.paging): the connection at
|
|
63
|
-
* `result.path`, its nodes shaped as `query` shapes them, and its pageInfo.
|
|
64
|
-
* Optional: without it a paged label loads its first page through `query`,
|
|
65
|
-
* with no more to load.
|
|
66
|
-
*/
|
|
67
27
|
queryPage?(descriptor: QueryDescriptor, variables: Record<string, unknown>): Promise<QueryPage>;
|
|
68
|
-
/**
|
|
69
|
-
* Of these systems, the main ones (`system.version` null; versions.md §4.6, graph-model G1):
|
|
70
|
-
* a page reads main only, so a branch system a ref, a declaration or a walk names is read as
|
|
71
|
-
* absent (SYSTEM_NOT_MAIN). Optional: without it, every system named is read.
|
|
72
|
-
*/
|
|
73
28
|
mainSystems?(systemIds: string[]): Promise<ReadonlySet<string>>;
|
|
74
|
-
/**
|
|
75
|
-
* The page an embed cell names (PageCell.embed, resolved), as the viewer:
|
|
76
|
-
* by id, or the newest published of a type in a project. Null when none is
|
|
77
|
-
* readable. Optional: without it, embed cells report EMBED_NOT_FOUND.
|
|
78
|
-
*/
|
|
79
29
|
page?(selector: EmbedSelector, context?: ReadContext): Promise<ProjectPage | null>;
|
|
80
30
|
}
|
|
81
|
-
/** One page of a paged label. */
|
|
82
31
|
export type QueryPage = {
|
|
83
32
|
items: unknown[];
|
|
84
33
|
hasMore: boolean;
|
|
85
34
|
endCursor: string | null;
|
|
86
35
|
};
|
|
87
|
-
/** What a page's queries may read besides labels (design/data.md §5). */
|
|
88
36
|
export type PageScope = {
|
|
89
37
|
params?: Record<string, unknown>;
|
|
90
38
|
baseProps?: unknown;
|
|
91
|
-
/** The signed-in person: `userId`, `isAdvisor`, `isClient`… */
|
|
92
39
|
viewer?: unknown;
|
|
93
|
-
/** The host's location context (core.md §8); the page's own ids are added. */
|
|
94
40
|
context?: Record<string, unknown>;
|
|
95
|
-
/** Set when loading an embedded page: its own embeds don't load. */
|
|
96
41
|
embedded?: boolean;
|
|
97
|
-
/**
|
|
98
|
-
* The version the page is read at (versions.md §6.3), resolved by the host: every read takes it,
|
|
99
|
-
* and `@context.version` / `@context.versionKind` name it. Absent or main: today's reads.
|
|
100
|
-
*/
|
|
101
42
|
version?: VersionContext;
|
|
102
|
-
/**
|
|
103
|
-
* When the page is read at a release, the release it recorded for each page it embeds (its
|
|
104
|
-
* `metadata.embeds`, from versions_for; versions.md §5.3): an embed renders that release, and
|
|
105
|
-
* one not recorded renders at the viewer's context.
|
|
106
|
-
*/
|
|
107
43
|
recordedEmbeds?: RecordedEmbed[];
|
|
108
44
|
};
|
|
109
|
-
/** A cell's own walk: `@_traversal`, and the labels its `binding_key` nodes provide. */
|
|
110
45
|
export type CellWalk = {
|
|
111
46
|
traversal: Traversal;
|
|
112
47
|
labels: DataContext;
|
|
113
48
|
};
|
|
114
|
-
/**
|
|
115
|
-
* A cell's own data (design/renderer.md §5.2): its static values, its
|
|
116
|
-
* declarations (inline, or from its ref's config) and its walk. A cell
|
|
117
|
-
* resolves against, lowest first: static (the page's, then its own), its
|
|
118
|
-
* walk, the page's declarations, its own declarations.
|
|
119
|
-
*/
|
|
120
49
|
export type CellData = {
|
|
121
50
|
static: DataContext;
|
|
122
51
|
declared: DataContext;
|
|
@@ -124,63 +53,23 @@ export type CellData = {
|
|
|
124
53
|
};
|
|
125
54
|
export type PageRuntime = {
|
|
126
55
|
page: ProjectPage;
|
|
127
|
-
/** Every cell, its content resolved: inline as written, a ref's from its node (or its fallback). */
|
|
128
56
|
cells: ResolvedCell[];
|
|
129
|
-
/** Ref cells with neither a node config nor a component of their own: rendered as pending. */
|
|
130
57
|
unresolved: string[];
|
|
131
|
-
/** The page's static values, then its declarations on top: what every cell sees. */
|
|
132
58
|
data: DataContext;
|
|
133
|
-
/** Labels the page declares: a walk's label of the same name never replaces them. */
|
|
134
59
|
declared: string[];
|
|
135
|
-
/** Each cell's own data, by cell id (only cells that have some). */
|
|
136
60
|
cellData: Record<string, CellData>;
|
|
137
61
|
systems: ProcessSystems;
|
|
138
62
|
engDataSystemId: string | null;
|
|
139
|
-
/**
|
|
140
|
-
* Every graph node the page reads: its own, its cells', its producers', its
|
|
141
|
-
* walks' starts. Their graphs are the Realtime topics the page joins
|
|
142
|
-
* (design/data.md §10).
|
|
143
|
-
*/
|
|
144
63
|
graphNodeIds: string[];
|
|
145
|
-
/** The version the page was read at; absent at main. */
|
|
146
64
|
version?: VersionContext;
|
|
147
|
-
/**
|
|
148
|
-
* The versions the page's states were read from, at a version (each row's `version_id`; nodes
|
|
149
|
-
* outside the scope left out): what print and an embed say they show ("Release N"). Absent at
|
|
150
|
-
* main, or when the source returns no rows with versions.
|
|
151
|
-
*/
|
|
152
65
|
readVersionIds?: string[];
|
|
153
|
-
/** An embedded page's version: the release its host recorded for it, or the viewer's context. */
|
|
154
66
|
embedVersion?: 'recorded' | 'context';
|
|
155
|
-
/** Each embed cell's page, loaded as the viewer (null when not found), by cell id. */
|
|
156
67
|
embeds?: Record<string, PageRuntime | null>;
|
|
157
68
|
diagnostics: Diagnostic[];
|
|
158
69
|
};
|
|
159
70
|
type SystemsSource = Pick<GraphSource, 'graphSystems' | 'processSystems'>;
|
|
160
|
-
/**
|
|
161
|
-
* A page's systems by name: the main systems on its process's graphs (`graphSystems`; a 0.22
|
|
162
|
-
* source's process columns otherwise), with `metadata.systemGraph` as eng_data's fallback for a
|
|
163
|
-
* page without a process. `metadata.pageProcess`, a copy of the process columns, isn't read: G4
|
|
164
|
-
* drops the columns it copies.
|
|
165
|
-
*/
|
|
166
71
|
export declare function resolveSystems(source: SystemsSource, page: ProjectPage): Promise<ProcessSystems>;
|
|
167
|
-
/** The page's DSNS: what thin refs hydrate from and what declarations read by default. */
|
|
168
72
|
export declare function resolveDataSystem(source: SystemsSource, page: ProjectPage): Promise<string | null>;
|
|
169
|
-
/**
|
|
170
|
-
* Everything a page needs before it renders (design/core.md §3, stages 1–3;
|
|
171
|
-
* design/renderer.md §3, §5; design/data.md §6): read every ref's node config
|
|
172
|
-
* (one read per system), then every declaration's producer (one read per
|
|
173
|
-
* system), every walk a cell needs, any NodeRecords, and the queries whose
|
|
174
|
-
* variables read no label, in parallel; then the queries whose variables read
|
|
175
|
-
* a label, and those found in live query nodes. Framework-free: the source
|
|
176
|
-
* decides how each read runs (the host's runs in its route loader, through
|
|
177
|
-
* TanStack Query, under the viewer's JWT).
|
|
178
|
-
*/
|
|
179
|
-
/**
|
|
180
|
-
* A query that didn't run because references resolved to nothing. It has nothing to show yet
|
|
181
|
-
* (`unresolved`) only when every reference is simply absent; one into a label whose read failed
|
|
182
|
-
* is that failure (shell audit S1), not an empty result.
|
|
183
|
-
*/
|
|
184
73
|
export declare function unresolvedEntry(missing: string[], data: DataContext): DataEntry;
|
|
185
74
|
export declare function loadPageData(page: ProjectPage, source: GraphSource, scope?: PageScope): Promise<PageRuntime>;
|
|
186
75
|
export {};
|