@peripheries/renderer 0.23.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 (100) hide show
  1. package/README.md +45 -33
  2. package/dist/catalog.js +2 -6
  3. package/dist/chunks/{forms-CCAE7sCu.js → forms-DxA9WzCt.js} +0 -6
  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-LnTbQghF.js → query-D6xQbTFK.js} +0 -6
  9. package/dist/chunks/{refs-BLUokra5.js → refs-Csgh6rXq.js} +0 -4
  10. package/dist/chunks/{structure-BrKSgzRJ.js → structure-CKBtQHJq.js} +1 -7
  11. package/dist/chunks/{validate-B_g7719l.js → validate-BcB_PA1k.js} +2 -10
  12. package/dist/core.js +9 -25
  13. package/dist/forms.js +1 -1
  14. package/dist/print.js +0 -24
  15. package/dist/react.js +4 -22
  16. package/dist/runtime.js +2 -12
  17. package/dist/styles.css +9 -15
  18. package/dist/testing.js +5 -21
  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 +0 -22
  29. package/dist/types/core/diagnostics.d.ts +1 -3
  30. package/dist/types/core/graph.d.ts +0 -54
  31. package/dist/types/core/layout.d.ts +0 -9
  32. package/dist/types/core/load-page.d.ts +0 -111
  33. package/dist/types/core/query.d.ts +0 -64
  34. package/dist/types/core/references.d.ts +0 -21
  35. package/dist/types/core/release.d.ts +0 -10
  36. package/dist/types/core/rules.d.ts +0 -1
  37. package/dist/types/core/selected.d.ts +0 -5
  38. package/dist/types/core/sources.d.ts +5 -64
  39. package/dist/types/core/store/create-store.d.ts +0 -6
  40. package/dist/types/core/store/persistence.d.ts +0 -1
  41. package/dist/types/core/store/projection.d.ts +0 -5
  42. package/dist/types/core/store/scope-keys.d.ts +0 -1
  43. package/dist/types/core/store/types.d.ts +0 -6
  44. package/dist/types/core/structure.d.ts +0 -33
  45. package/dist/types/core/types.d.ts +0 -13
  46. package/dist/types/core/validate.d.ts +0 -12
  47. package/dist/types/core/values.d.ts +0 -6
  48. package/dist/types/forms/conditions.d.ts +0 -37
  49. package/dist/types/forms/model.d.ts +0 -44
  50. package/dist/types/forms/port.d.ts +0 -22
  51. package/dist/types/print/document-bindings.d.ts +0 -61
  52. package/dist/types/print/document-profile.d.ts +0 -137
  53. package/dist/types/print/map-staleness.d.ts +0 -66
  54. package/dist/types/print/page-map.d.ts +1 -334
  55. package/dist/types/print/paginate.d.ts +0 -190
  56. package/dist/types/print/print-layout.d.ts +0 -161
  57. package/dist/types/print/print-lint.d.ts +0 -109
  58. package/dist/types/print/print-policy.d.ts +0 -184
  59. package/dist/types/print/print-stylesheet.d.ts +0 -135
  60. package/dist/types/print/running-header.d.ts +0 -86
  61. package/dist/types/print/structure-print.d.ts +1 -243
  62. package/dist/types/react/cell-states.d.ts +0 -2
  63. package/dist/types/react/cell-view.d.ts +0 -16
  64. package/dist/types/react/page-renderer.d.ts +0 -37
  65. package/dist/types/react/structure-view.d.ts +0 -12
  66. package/dist/types/react/use-cell-store.d.ts +0 -5
  67. package/dist/types/react/use-container-size.d.ts +0 -5
  68. package/dist/types/react/use-forms-runtime.d.ts +1 -55
  69. package/dist/types/react/use-paging.d.ts +0 -9
  70. package/dist/types/runtime/boot.d.ts +0 -11
  71. package/dist/types/runtime/install.d.ts +0 -15
  72. package/dist/types/runtime/shims.d.ts +0 -8
  73. package/dist/types/runtime/store-export.d.ts +0 -7
  74. package/dist/types/testing/base-props.d.ts +0 -1
  75. package/dist/types/testing/components.d.ts +0 -8
  76. package/dist/types/testing/form-workbook.d.ts +0 -3
  77. package/dist/types/testing/golden.d.ts +0 -16
  78. package/dist/types/testing/ids.d.ts +0 -2
  79. package/dist/types/testing/sources.d.ts +0 -7
  80. package/dist/types/theme/check.d.ts +0 -2
  81. package/dist/types/theme/color.d.ts +0 -12
  82. package/dist/types/theme/derive.d.ts +0 -12
  83. package/dist/types/theme/parse.d.ts +0 -7
  84. package/package.json +2 -2
  85. package/dist/catalog.js.map +0 -1
  86. package/dist/chunks/forms-CCAE7sCu.js.map +0 -1
  87. package/dist/chunks/load-CjPvISzH.js.map +0 -1
  88. package/dist/chunks/page-bundles-DLRIBP8g.js.map +0 -1
  89. package/dist/chunks/persistence-DCMakM9H.js.map +0 -1
  90. package/dist/chunks/projection-yvYKzMOS.js.map +0 -1
  91. package/dist/chunks/query-LnTbQghF.js.map +0 -1
  92. package/dist/chunks/refs-BLUokra5.js.map +0 -1
  93. package/dist/chunks/structure-BrKSgzRJ.js.map +0 -1
  94. package/dist/chunks/validate-B_g7719l.js.map +0 -1
  95. package/dist/core.js.map +0 -1
  96. package/dist/print.js.map +0 -1
  97. package/dist/react.js.map +0 -1
  98. package/dist/runtime.js.map +0 -1
  99. package/dist/testing.js.map +0 -1
  100. package/dist/theme.js.map +0 -1
package/dist/react.js CHANGED
@@ -1,11 +1,10 @@
1
- import { T as rootCells, _ as failedLabels, a as projectSelections, d as resolveComponent, f as cellAttributes, g as assembleCellProps, h as pageContainerStyle, i as projectLive, m as documentProfile, n as attachViewStateSetters, o as projectViewState, p as cellPlacementStyle, s as shallowEqualBundle, t as attachSelectionSetters, u as resolveScopeId, v as projectCellData } from "./chunks/projection-yvYKzMOS.js";
2
- import { C as passesConditions, S as pageContext, T as settled, b as cellResolutionContext, c as pageVariables, v as EACH_DEFAULT_AS, w as resolveReferences, y as cellContext } from "./chunks/query-LnTbQghF.js";
3
- import { a as deriveSectionReferences, b as declaredActions, c as nodePrintStyle, d as referencesFor, f as sectionAnchor, g as usesStructureLayout, i as deriveSectionNumbering, l as normalizeStructure, m as structureIssues, o as isSectionNode, p as sortByOrder, r as deriveElementReferences, s as mergeSectionReferences, t as PAGE_DOCUMENT, u as numberingFor } from "./chunks/structure-BrKSgzRJ.js";
4
- import { a as goToQuestion, c as missing, f as progress, g as visibleSteps, h as stepKind, i as goTo, l as move, m as settle, n as enterAdvances, o as isReadOnlyStatus, p as questionsOf, s as linkTo, t as defaultMode, u as positionFromLink } from "./chunks/forms-CCAE7sCu.js";
1
+ import { T as rootCells, _ as failedLabels, a as projectSelections, d as resolveComponent, f as cellAttributes, g as assembleCellProps, h as pageContainerStyle, i as projectLive, m as documentProfile, n as attachViewStateSetters, o as projectViewState, p as cellPlacementStyle, s as shallowEqualBundle, t as attachSelectionSetters, u as resolveScopeId, v as projectCellData } from "./chunks/projection-zhu32_KJ.js";
2
+ import { C as passesConditions, S as pageContext, T as settled, b as cellResolutionContext, c as pageVariables, v as EACH_DEFAULT_AS, w as resolveReferences, y as cellContext } from "./chunks/query-D6xQbTFK.js";
3
+ import { a as deriveSectionReferences, b as declaredActions, c as nodePrintStyle, d as referencesFor, f as sectionAnchor, g as usesStructureLayout, i as deriveSectionNumbering, l as normalizeStructure, m as structureIssues, o as isSectionNode, p as sortByOrder, r as deriveElementReferences, s as mergeSectionReferences, t as PAGE_DOCUMENT, u as numberingFor } from "./chunks/structure-CKBtQHJq.js";
4
+ import { a as goToQuestion, c as missing, f as progress, g as visibleSteps, h as stepKind, i as goTo, l as move, m as settle, n as enterAdvances, o as isReadOnlyStatus, p as questionsOf, s as linkTo, t as defaultMode, u as positionFromLink } from "./chunks/forms-DxA9WzCt.js";
5
5
  import { Component, Fragment, Suspense, useCallback, useEffect, useMemo, useRef, useState } from "react";
6
6
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
7
  import { useSelector } from "@tanstack/react-store";
8
- //#region packages/renderer/src/react/cell-states.tsx
9
8
  function CellPlaceholder({ state }) {
10
9
  return jsx("div", {
11
10
  className: "cell-placeholder",
@@ -43,8 +42,6 @@ var CellErrorBoundary = class extends Component {
43
42
  }) : this.props.children;
44
43
  }
45
44
  };
46
- //#endregion
47
- //#region packages/renderer/src/react/use-cell-store.ts
48
45
  function useCellStore(cell, scope, api) {
49
46
  const selections = useSelector(api.store, (s) => projectSelections(cell.selections, s, scope), { compare: shallowEqualBundle });
50
47
  const viewState = useSelector(api.store, (s) => projectViewState(cell.viewState, s, scope), { compare: shallowEqualBundle });
@@ -81,8 +78,6 @@ function useCellStore(cell, scope, api) {
81
78
  scope.projectId
82
79
  ]);
83
80
  }
84
- //#endregion
85
- //#region packages/renderer/src/react/use-container-size.ts
86
81
  function useContainerSize(ref, enabled) {
87
82
  const [size, setSize] = useState();
88
83
  useEffect(() => {
@@ -107,8 +102,6 @@ function useContainerSize(ref, enabled) {
107
102
  }, [ref, enabled]);
108
103
  return size;
109
104
  }
110
- //#endregion
111
- //#region packages/renderer/src/react/use-paging.ts
112
105
  var LABEL_REF = /@([A-Za-z0-9_$-]+)/g;
113
106
  function cellLabels(cell) {
114
107
  const out = new Set(Object.keys(cell.data?.queries ?? {}));
@@ -208,8 +201,6 @@ function usePaging(cell, entries, loadPage) {
208
201
  loadPage
209
202
  ]);
210
203
  }
211
- //#endregion
212
- //#region packages/renderer/src/react/cell-view.tsx
213
204
  var REPEAT_SLOT = "item";
214
205
  function useSoftNavigation(navigate) {
215
206
  return useCallback((e) => {
@@ -439,8 +430,6 @@ function CellView({ cell, env, nested = false, injectedProps }) {
439
430
  children: body
440
431
  });
441
432
  }
442
- //#endregion
443
- //#region packages/renderer/src/react/structure-view.tsx
444
433
  function useStructureFacts(structure, cells, env, documents) {
445
434
  return useMemo(() => {
446
435
  const numbering = deriveSectionNumbering(structure);
@@ -535,8 +524,6 @@ function StructureView({ nodes, env, facts, level = 0, documentId = PAGE_DOCUMEN
535
524
  }, `${node.sectionId ?? ""}\u0000${node.cellId ?? index}`);
536
525
  }) });
537
526
  }
538
- //#endregion
539
- //#region packages/renderer/src/react/page-renderer.tsx
540
527
  var warn = (d) => console.warn(`[render] ${d.code}${d.cellId ? ` (cell ${d.cellId})` : ""}: ${d.message}`);
541
528
  function PageRenderer({ runtime, bundles, params, baseProps, context, viewer, environment }) {
542
529
  const { page, cells } = runtime;
@@ -651,8 +638,6 @@ function PageRenderer({ runtime, bundles, params, baseProps, context, viewer, en
651
638
  }, cell.id))
652
639
  });
653
640
  }
654
- //#endregion
655
- //#region packages/renderer/src/react/use-forms-runtime.ts
656
641
  var FORM_SAVE_DEBOUNCE_MS = 3e3;
657
642
  var answerInputId = (key) => `form-answer-${key.replace(/[^\w-]/g, "_")}`;
658
643
  var reviewOf = (notes) => {
@@ -995,7 +980,4 @@ function bindActions(v, path, latest) {
995
980
  if (v && typeof v === "object") return Object.fromEntries(Object.entries(v).map(([k, x]) => [k, bindActions(x, [...path, k], latest)]));
996
981
  return v;
997
982
  }
998
- //#endregion
999
983
  export { CellErrorBoundary, CellNotice, CellPlaceholder, CellView, FORM_SAVE_DEBOUNCE_MS, PageRenderer, StructureView, answerInputId, cellLabels, useCellStore, useContainerSize, useFormsRuntime, usePaging, useStructureFacts };
1000
-
1001
- //# sourceMappingURL=react.js.map
package/dist/runtime.js CHANGED
@@ -1,5 +1,5 @@
1
- import { s as runtimeReady } from "./chunks/load-CjPvISzH.js";
2
- import { a as createStackStore, t as clearAllScopes } from "./chunks/persistence-DCMakM9H.js";
1
+ import { s as runtimeReady } from "./chunks/load-b38vUiZM.js";
2
+ import { a as createStackStore, t as clearAllScopes } from "./chunks/persistence-hurkUUQ0.js";
3
3
  import { PINNED_RUNTIMES, READY_GLOBAL, RESOLVE_GLOBAL, RUNTIME_GLOBAL, buildImportMap } from "@peripheries/runtime";
4
4
  import * as React from "react";
5
5
  import * as JsxRuntime from "react/jsx-runtime";
@@ -8,7 +8,6 @@ import * as ReactDOM from "react-dom";
8
8
  import * as ReactDOMClient from "react-dom/client";
9
9
  import * as JsxDevRuntime from "react/jsx-dev-runtime";
10
10
  import * as zustand from "zustand";
11
- //#region packages/renderer/src/runtime/boot.ts
12
11
  var RUNTIME_BOOT_SCRIPT = `(function(g){if(g.${READY_GLOBAL})return;g.${READY_GLOBAL}=new Promise(function(r){g.${RESOLVE_GLOBAL}=r;});})(globalThis);`;
13
12
  function importMapFor(shared = []) {
14
13
  return { imports: buildImportMap(shared).imports };
@@ -17,8 +16,6 @@ function importMapJson(shared = []) {
17
16
  return JSON.stringify(importMapFor(shared)).replace(/</g, "\\u003c");
18
17
  }
19
18
  var IMPORT_MAP_JSON = importMapJson();
20
- //#endregion
21
- //#region packages/renderer/src/runtime/store-export.ts
22
19
  var singleton = null;
23
20
  function getStackStore() {
24
21
  return singleton ??= createStackStore();
@@ -43,8 +40,6 @@ function buildStoreRuntime() {
43
40
  selectors
44
41
  };
45
42
  }
46
- //#endregion
47
- //#region packages/renderer/src/runtime/install.ts
48
43
  function buildRuntime(extra = {}) {
49
44
  return {
50
45
  react: React,
@@ -68,8 +63,6 @@ function installRuntime(g = globalThis, extra = {}) {
68
63
  g[RESOLVE_GLOBAL]?.();
69
64
  return runtime;
70
65
  }
71
- //#endregion
72
- //#region packages/renderer/src/runtime/shims.ts
73
66
  function shimFileName(specifier) {
74
67
  const base = PINNED_RUNTIMES[specifier].url.split("/").pop();
75
68
  if (!base?.endsWith(".js")) throw new Error(`[runtime] ${specifier}: url is not a .js file`);
@@ -92,7 +85,4 @@ function renderShim(specifier, names, hasDefault) {
92
85
  }
93
86
  return lines.join("\n") + "\n";
94
87
  }
95
- //#endregion
96
88
  export { IMPORT_MAP_JSON, RUNTIME_BOOT_SCRIPT, buildRuntime, getStackStore, importMapFor, importMapJson, installRuntime, renderShim, resetStackStore, runtimeReady, selectors, shimFileName, useStackStore };
97
-
98
- //# sourceMappingURL=runtime.js.map
package/dist/styles.css CHANGED
@@ -1,23 +1,17 @@
1
- /* @peripheries/renderer/styles.css: what the renderer's markup needs (design/renderer.md §2).
2
- Import it once per app. Everything is in the `renderer` layer (design/core-and-tokens.md §7.2):
3
- above the reset and the tokens, below every bundle and the org's theme. */
1
+
4
2
 
5
3
  @layer renderer {
6
- /* ── Page cells (design/core.md §3–4) ─────────────────────────────────────
7
- The page and every cell are size containers, so layout responds to the
8
- space a component actually has, not the viewport. */
4
+
9
5
  :root {
10
6
  --cell-placeholder-bg: var(--color-surface-sunken, #f1f1f1);
11
7
  --cell-notice-bg: var(--color-warning-surface, #fff4d6);
12
8
  --cell-notice-fg: var(--color-warning, #6b4e00);
13
9
  }
14
- /* A page reads the theme's body font and ink, so a cell that sets neither still matches it. */
10
+
15
11
  [data-page-container] { font-family: var(--font-body, system-ui, sans-serif); color: var(--color-text, inherit); }
16
12
  [data-page-container] { container: page / inline-size; }
17
13
  .cell { container: cell / inline-size; min-width: 0; }
18
- /* A child cell sizes to what it holds: inside its parent's flex or grid parts (a Card's header, an
19
- Inline) an inline-size container would have no width of its own and collapse to nothing. Its
20
- `@container cell` queries read the parent cell's width instead. */
14
+
21
15
  .cell[data-nested] { container: none; }
22
16
  .cell-placeholder { min-height: 6rem; border-radius: 0.5rem; background: var(--cell-placeholder-bg); }
23
17
  .cell-placeholder[aria-busy='true'] { animation: cell-pulse 1.5s ease-in-out infinite; }
@@ -25,24 +19,24 @@
25
19
  @media (prefers-reduced-motion: reduce) { .cell-placeholder[aria-busy='true'] { animation: none; } }
26
20
  .cell-notice { padding: 0.75rem 1rem; border-radius: 0.5rem; background: var(--cell-notice-bg); color: var(--cell-notice-fg); }
27
21
 
28
- /* Responsive buckets: each fires at or below its width (narrow 480, compact 720, wide 1024). */
22
+
29
23
  [data-show-when] { display: none; }
30
24
  @container page (max-width: 1024px) {
31
25
  [data-hide-when='wide'] { display: none; }
32
26
  [data-show-when='wide'] { display: revert; }
33
- [data-stack-when='wide'] { grid-column: 1 / -1 !important; } /* over the inline span */
27
+ [data-stack-when='wide'] { grid-column: 1 / -1 !important; }
34
28
  [data-truncate-when='wide'] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
35
29
  }
36
30
  @container page (max-width: 720px) {
37
31
  [data-hide-when='compact'] { display: none; }
38
32
  [data-show-when='compact'] { display: revert; }
39
- [data-stack-when='compact'] { grid-column: 1 / -1 !important; } /* over the inline span */
33
+ [data-stack-when='compact'] { grid-column: 1 / -1 !important; }
40
34
  [data-truncate-when='compact'] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
41
35
  }
42
36
  @container page (max-width: 480px) {
43
37
  [data-hide-when='narrow'] { display: none; }
44
38
  [data-show-when='narrow'] { display: revert; }
45
- [data-stack-when='narrow'] { grid-column: 1 / -1 !important; } /* over the inline span */
39
+ [data-stack-when='narrow'] { grid-column: 1 / -1 !important; }
46
40
  [data-truncate-when='narrow'] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
47
41
  }
48
42
 
@@ -54,6 +48,6 @@
54
48
  }
55
49
  }
56
50
 
57
- /* Document structure: sections span a grid page; inside, content stacks. */
51
+
58
52
  .structure-section { grid-column: 1 / -1; display: flex; flex-direction: column; gap: inherit; }
59
53
  }
package/dist/testing.js CHANGED
@@ -1,10 +1,9 @@
1
- import { l as prepareDocument } from "./chunks/query-LnTbQghF.js";
2
- import { o as projectModule } from "./chunks/load-CjPvISzH.js";
3
- import { i as bundleScope } from "./chunks/refs-BLUokra5.js";
4
- import { n as pageBundles, t as pageBundleRefs } from "./chunks/page-bundles-DLRIBP8g.js";
5
- import { r as fromPageSteps } from "./chunks/forms-CCAE7sCu.js";
1
+ import { l as prepareDocument } from "./chunks/query-D6xQbTFK.js";
2
+ import { o as projectModule } from "./chunks/load-b38vUiZM.js";
3
+ import { i as bundleScope } from "./chunks/refs-Csgh6rXq.js";
4
+ import { n as pageBundles, t as pageBundleRefs } from "./chunks/page-bundles-CPj_vx-J.js";
5
+ import { r as fromPageSteps } from "./chunks/forms-DxA9WzCt.js";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
- //#region \0rolldown/runtime.js
8
7
  var __defProp = Object.defineProperty;
9
8
  var __exportAll = (all, no_symbols) => {
10
9
  let target = {};
@@ -15,8 +14,6 @@ var __exportAll = (all, no_symbols) => {
15
14
  if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
16
15
  return target;
17
16
  };
18
- //#endregion
19
- //#region packages/renderer/src/testing/ids.ts
20
17
  var fixtureId = (n) => `00000000-0000-4000-8000-${String(n).padStart(12, "0")}`;
21
18
  var FIXTURE_ID = /^00000000-0000-4000-8000-\d{12}$/;
22
19
  var FIXTURE_ORG_SLUGS = ["example-client", "example-advisor"];
@@ -29,8 +26,6 @@ var ADVISOR_ORG = {
29
26
  id: fixtureId(2),
30
27
  slug: "example-advisor"
31
28
  };
32
- //#endregion
33
- //#region packages/renderer/src/testing/base-props.ts
34
29
  var FIXTURE_BASE_PROPS = {
35
30
  user: {
36
31
  id: fixtureId(3),
@@ -47,8 +42,6 @@ var FIXTURE_BASE_PROPS = {
47
42
  secondaryColor: "#c8a13a"
48
43
  }
49
44
  };
50
- //#endregion
51
- //#region packages/renderer/src/testing/components.tsx
52
45
  var components_exports = __exportAll({
53
46
  Badge: () => Badge,
54
47
  Boom: () => Boom,
@@ -183,8 +176,6 @@ var advisorKit = {
183
176
  }),
184
177
  Badge
185
178
  };
186
- //#endregion
187
- //#region packages/renderer/src/testing/golden.ts
188
179
  var bundle = (n, org, module, contracts) => ({
189
180
  row: {
190
181
  id: fixtureId(n),
@@ -830,8 +821,6 @@ var GOLDEN_PAGES = [
830
821
  mixedPage,
831
822
  walkPage
832
823
  ];
833
- //#endregion
834
- //#region packages/renderer/src/testing/sources.ts
835
824
  function goldenGraphSource(g) {
836
825
  const calls = [];
837
826
  const pick = (rows, systemId, ids) => (rows ?? []).filter((r) => r.system_id === systemId && ids.includes(r.graph_node_id));
@@ -1117,8 +1106,6 @@ var form_workbook_page_default = {
1117
1106
  "submit": { "required": "warn" }
1118
1107
  }
1119
1108
  };
1120
- //#endregion
1121
- //#region packages/renderer/src/testing/form-workbook.ts
1122
1109
  var SINGLE_LINE = new Set([
1123
1110
  "text",
1124
1111
  "number",
@@ -1153,7 +1140,4 @@ function formWorkbookItem(cellId) {
1153
1140
  };
1154
1141
  }
1155
1142
  var formWorkbookModel = () => fromPageSteps(form_workbook_page_default, formWorkbookItem);
1156
- //#endregion
1157
1143
  export { ADVISOR_ORG, CLIENT_ORG, FIXTURE_BASE_PROPS, FIXTURE_EMAIL_DOMAIN, FIXTURE_ID, FIXTURE_ORG_SLUGS, GOLDEN_PAGES, dashboardPage, documentPage, components_exports as fixtureComponents, fixtureId, formWorkbookItem, formWorkbookModel, formWorkbookPage, goldenBundleRow, goldenBundles, goldenGraphSource, goldenScope, mixedPage, thinRefPage, walkPage };
1158
-
1159
- //# sourceMappingURL=testing.js.map
package/dist/theme.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { SEMANTIC_TOKENS } from "@peripheries/runtime";
2
- //#region packages/renderer/src/theme/color.ts
3
2
  var NUMBER = /^[+-]?(\d+\.?\d*|\.\d+)(e[+-]?\d+)?$/i;
4
3
  var clamp01 = (n) => Math.min(1, Math.max(0, n));
5
4
  function hexColor(value) {
@@ -199,8 +198,6 @@ function contrastRatio(foreground, background) {
199
198
  const b = relativeLuminance(bg);
200
199
  return (Math.max(a, b) + .05) / (Math.min(a, b) + .05);
201
200
  }
202
- //#endregion
203
- //#region packages/renderer/src/theme/parse.ts
204
201
  var SEMANTIC = new Set(SEMANTIC_TOKENS);
205
202
  var UNSAFE = /[<>{};\\]|\/\*|\*\/|[\u0000-\u001f\u007f]/;
206
203
  var isSafeCssValue = (value) => value.trim() !== "" && !UNSAFE.test(value);
@@ -381,8 +378,6 @@ function parseTheme(raw) {
381
378
  }
382
379
  return read;
383
380
  }
384
- //#endregion
385
- //#region packages/renderer/src/theme/derive.ts
386
381
  var FALLBACK_BASE = {
387
382
  "color-bg": "#ffffff",
388
383
  "color-text": "#0a0a0a"
@@ -505,8 +500,6 @@ function themeCss(theme, base) {
505
500
  const lines = Object.entries(themeTokens(theme, base)).filter(([name, value]) => /^[a-z0-9-]+$/.test(name) && typeof value === "string" && isSafeCssValue(value)).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([name, value]) => ` --${name}: ${value.trim()};`);
506
501
  return lines.length ? `@layer theme {\n :root {\n${lines.join("\n")}\n }\n}\n` : "";
507
502
  }
508
- //#endregion
509
- //#region packages/renderer/src/theme/check.ts
510
503
  var CONTRAST_PAIRS = [
511
504
  [
512
505
  "color-text",
@@ -603,7 +596,4 @@ function checkTheme(theme, base = {}) {
603
596
  }
604
597
  return diagnostics;
605
598
  }
606
- //#endregion
607
599
  export { CONTRAST_PAIRS, checkTheme, contrastRatio, fromOklch, parseColor, parseTheme, relativeLuminance, themeCss, themeTokens, toHex, toOklch };
608
-
609
- //# sourceMappingURL=theme.js.map
@@ -3,29 +3,16 @@ import type { Diagnostic } from '../core/graph.js';
3
3
  import type { ProjectPage } from '../core/types.js';
4
4
  import { type Catalog } from '../core/validate.js';
5
5
  export type CatalogInput = {
6
- /** `<org_slug>/<bundle_name>` of the bundle being emitted. */
7
6
  lineage: string;
8
7
  rows: KnowledgeRow[];
9
8
  links: KnowledgeLink[];
10
- /** This bundle's registry: every component it exports, with its props contract. */
11
9
  registry: Record<string, {
12
10
  props_schema?: unknown;
13
11
  }>;
14
- /** Components of other lineages in scope, which snippets may use (core, say). */
15
12
  scopeRegistry?: Record<string, {
16
13
  props_schema?: unknown;
17
14
  }>;
18
- /** Whether another lineage's row is live in scope; undefined leaves such links unchecked. */
19
15
  inScope?: (lineage: string, kind: KnowledgeKind, key: string) => boolean | undefined;
20
16
  };
21
17
  export declare function checkCatalog(input: CatalogInput): Diagnostic[];
22
- /**
23
- * PROP_INVALID: each literal prop value of the page's inline cells against its
24
- * prop's schema in the catalog. A value holding a reference is left alone; its
25
- * type is known only once it resolves. An `@each` projection is judged by its
26
- * `map` instead (design/renderer.md §5.4): its keys against the items schema
27
- * (a required key missing is PROP_INVALID, an undeclared one PROP_UNKNOWN),
28
- * and its literal values against theirs. Run it beside validatePage, which
29
- * can't (core holds no JSON Schema validator).
30
- */
31
18
  export declare function validatePageProps(page: Pick<ProjectPage, 'content'>, catalog: Catalog): Diagnostic[];
@@ -5,46 +5,22 @@ export type ActionDeclaration = string | {
5
5
  registry: string;
6
6
  entityKey?: string;
7
7
  };
8
- /** `registry#entityKey` when the action names an entity, else the registry key. */
9
8
  export declare const actionBindingKey: (registry: string, entityKey?: string) => string;
10
- /** A declaration's registry key, entity and binding key; null when it names no registry. */
11
9
  export declare function normalizeActionDeclaration(decl: unknown): {
12
10
  registry: string;
13
11
  entityKey?: string;
14
12
  bindingKey: string;
15
13
  } | null;
16
- /**
17
- * The cell's actions from the page's, by the PWA's lookup order: its binding
18
- * key, then its registry key, then the name the cell uses. Undefined when none match.
19
- */
20
14
  export declare function projectCellActions(declarations: Record<string, unknown> | undefined, pageActions: Record<string, CellAction> | undefined): Record<string, CellAction> | undefined;
21
- /**
22
- * What is wrong with a declared action, as messages: an unknown action, a
23
- * field it requires missing, a field it doesn't take, `append` without
24
- * exactly one of `patch` and `data` (append), `patch` or `name` (edit), a malformed reference, or a projection.
25
- */
26
15
  export declare function actionProblems(decl: GraphActionDeclaration): Array<{
27
16
  field?: string;
28
17
  message: string;
29
18
  }>;
30
- /** The references a declaration reads, by namespace or label (`input`, `period`…). */
31
19
  export declare function actionReferences(decl: GraphActionDeclaration): string[];
32
- /**
33
- * A declaration resolved for one call: the props resolver, with `@input` the
34
- * component's argument. A reference that resolves to nothing in a required
35
- * field makes it `INVALID`, so no write runs with a hole in it.
36
- */
37
20
  export declare function resolveAction(name: string, cellId: string, decl: GraphActionDeclaration, ctx: ResolutionContext, input: unknown): {
38
21
  action: ResolvedAction;
39
22
  } | {
40
23
  result: WriteResult;
41
24
  };
42
- /** Runs a resolved action as the viewer: the host's write path, or a harness's mock. Never throws. */
43
25
  export type RunAction = (action: ResolvedAction) => Promise<WriteResult>;
44
- /**
45
- * A cell's declared actions as the functions its component calls. Each
46
- * resolves its declaration against the cell's context and the call's input,
47
- * then hands it to `runAction`; a call never throws. Registry declarations
48
- * are left to `projectCellActions`.
49
- */
50
26
  export declare function declaredActions(cell: Pick<PageCell, 'id' | 'actions'>, ctx: ResolutionContext, runAction: RunAction | undefined): Record<string, CellAction> | undefined;
@@ -1,5 +1,4 @@
1
1
  import type { ComponentType } from 'react';
2
- /** A bundle row as the loader needs it. RLS decides which rows the viewer sees. */
3
2
  export type BundleRow = {
4
3
  id: string;
5
4
  org_id: string;
@@ -13,52 +12,30 @@ export type BundleRow = {
13
12
  component_name: string | null;
14
13
  exposed_export: string | null;
15
14
  }>;
16
- /** A shared lineage's specifier: the loader imports it by this, never by URL. */
17
15
  specifier?: string | null;
18
16
  };
19
17
  export type LoadedBundle = {
20
18
  id: string;
21
19
  label: string;
22
- /** Set for a shared lineage (`@stack/core`). */
23
20
  specifier?: string;
24
21
  components: Record<string, ComponentType<Record<string, unknown>>>;
25
- /** `contracts.json`: per-component @data / @action / @printPolicy / @size. */
26
22
  contracts: Record<string, unknown>;
27
23
  documentProfiles?: unknown;
28
24
  paginatorBindings?: unknown;
29
25
  };
30
- /** A function, forwardRef, memo or lazy export: something React can render. */
31
26
  export declare function isComponentExport(value: unknown): value is ComponentType<Record<string, unknown>>;
32
- /** Map registry rows (`exposed_export` → `component_name`) onto a module, and lift the bundle-level exports. */
33
27
  export declare function projectModule(row: BundleRow, mod: Record<string, unknown>, contracts?: Record<string, unknown>): LoadedBundle;
34
28
  export type BundleFiles = {
35
- /** A file of the bundle's version, or null when the row has no files. */
36
29
  url: (row: BundleRow, file: string) => string | null;
37
30
  import?: (url: string) => Promise<Record<string, unknown>>;
38
31
  fetch?: (url: string) => Promise<Response>;
39
32
  };
40
- /** Resolves once the host has installed its runtime (`@peripheries/renderer/runtime`'s installRuntime). */
41
33
  export declare function runtimeReady(g?: Record<string, unknown>): Promise<void>;
42
- /**
43
- * Load one bundle, once per bundle id (ids are immutable). Waits for the
44
- * shared runtime first, so the bundle's bare imports resolve to the host's.
45
- * A shared lineage is imported by its specifier, which the page's import map
46
- * points at its live version: dependents that import it get the same module
47
- * instance, and so the same React contexts (design/core-and-tokens.md §4).
48
- */
49
34
  export declare function loadBundle(row: BundleRow, files: BundleFiles): Promise<LoadedBundle>;
50
- /** What loading a page's bundles came to: the ones that imported, and the row ids of those that didn't. */
51
35
  export type LoadedBundles = {
52
36
  loaded: LoadedBundle[];
53
37
  failed: string[];
54
38
  };
55
- /**
56
- * Load every bundle in scope in parallel; a failure drops that bundle, not the
57
- * page, and is reported in `failed` so a host can show it and try again
58
- * rather than keep the partial set (shell audit S1).
59
- */
60
39
  export declare function loadBundlesSettled(rows: BundleRow[], files: BundleFiles): Promise<LoadedBundles>;
61
- /** Load every bundle in scope in parallel; a failure drops that bundle, not the page. */
62
40
  export declare function loadBundles(rows: BundleRow[], files: BundleFiles): Promise<LoadedBundle[]>;
63
- /** Test seam. */
64
41
  export declare function _clearBundleCache(): void;
@@ -1,19 +1,10 @@
1
1
  import type { PageCell } from '../types.js';
2
2
  import type { BundleRow, LoadedBundle } from './load.js';
3
3
  import { type LineageRef } from './refs.js';
4
- /** Every lineage the page and its cells reference: the scope, then any cell's own bundle_ref. */
5
4
  export declare function pageBundleRefs(scope: LineageRef[], cells: PageCell[], pageOrgId: string | null): LineageRef[];
6
- /** The bundles a page renders with: its scope, nearest first, and each cell's own bundle_ref. */
7
5
  export type PageBundles = {
8
- /** null while the bundles load (and always on the server). */
9
6
  scope: LoadedBundle[] | null;
10
7
  forCell: (cell: PageCell) => LoadedBundle | null;
11
- /** The rows couldn't be read, or a bundle didn't import: a cell without its component shows an error and a retry, not "not available". */
12
8
  failed: boolean;
13
9
  };
14
- /**
15
- * Match the loaded bundles to the page's scope and to cells' own refs. `rows`
16
- * are the bundle rows found for `pageBundleRefs(scope, …)`; `loaded` is null
17
- * until they have imported.
18
- */
19
10
  export declare function pageBundles(scope: LineageRef[], rows: BundleRow[], loaded: LoadedBundle[] | null, pageOrgId: string | null, failed?: boolean): PageBundles;
@@ -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[];