@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
package/dist/print.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region packages/renderer/src/print/document-profile.ts
|
|
2
1
|
var bundleName = (bundle) => bundle.label ?? bundle.key ?? "(unkeyed)";
|
|
3
2
|
var DEFAULTS = {
|
|
4
3
|
profile: null,
|
|
@@ -73,8 +72,6 @@ function readMaxDepth(profile, bundleKey) {
|
|
|
73
72
|
}
|
|
74
73
|
return max;
|
|
75
74
|
}
|
|
76
|
-
//#endregion
|
|
77
|
-
//#region packages/renderer/src/print/document-bindings.ts
|
|
78
75
|
function asRecord(value) {
|
|
79
76
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
80
77
|
}
|
|
@@ -101,8 +98,6 @@ function resolveProfileId(page) {
|
|
|
101
98
|
if (fromMetadata !== void 0 && fromMetadata !== fromLayout) console.warn(`[document-bindings] page declares layout.profile=${JSON.stringify(fromLayout)} and metadata.profile=${JSON.stringify(fromMetadata)}. **layout wins.** These are two copies of one fact and only one is read — delete metadata.profile rather than keeping them in step by hand.`);
|
|
102
99
|
return fromLayout;
|
|
103
100
|
}
|
|
104
|
-
//#endregion
|
|
105
|
-
//#region packages/renderer/src/print/print-policy.ts
|
|
106
101
|
var BREAK_INSIDE = new Set(["avoid", "auto"]);
|
|
107
102
|
function toCount(value) {
|
|
108
103
|
if (!/^[1-9][0-9]*$/.test(value)) return void 0;
|
|
@@ -221,8 +216,6 @@ function deserializeConstraints(value) {
|
|
|
221
216
|
const { constraints } = parsePrintPolicy(raw);
|
|
222
217
|
return Object.keys(constraints).length > 0 ? constraints : void 0;
|
|
223
218
|
}
|
|
224
|
-
//#endregion
|
|
225
|
-
//#region packages/renderer/src/print/page-map.ts
|
|
226
219
|
function collectBlocks(root, printWidthPx, { measureRect, readConstraints, boxFor = defaultBoxFor, selector = "[data-cell-id]", sectionStart, blankBefore }) {
|
|
227
220
|
if (!root) return {
|
|
228
221
|
blocks: [],
|
|
@@ -444,8 +437,6 @@ function paperGeometryPx(sheet, margins, columns) {
|
|
|
444
437
|
columnsReconcile: railPx === 0 || printWidthPx + gutterPx + railPx === pageBoxWidthPx
|
|
445
438
|
};
|
|
446
439
|
}
|
|
447
|
-
//#endregion
|
|
448
|
-
//#region packages/renderer/src/print/paginate.ts
|
|
449
440
|
function mayNotSplit(c) {
|
|
450
441
|
if (!c) return true;
|
|
451
442
|
if (c.atomic) return true;
|
|
@@ -663,8 +654,6 @@ function paginate(blocks, { textBlockPx, keepWithNextScaleFloor = .6, sectionFil
|
|
|
663
654
|
idealPages: textBlockPx > 0 ? Number((total / textBlockPx).toFixed(2)) : 0
|
|
664
655
|
};
|
|
665
656
|
}
|
|
666
|
-
//#endregion
|
|
667
|
-
//#region packages/renderer/src/print/running-header.ts
|
|
668
657
|
function resolveRunningValues(map, bands, markers) {
|
|
669
658
|
const markerByCell = new Map(markers.map((m) => [m.cellId, m]));
|
|
670
659
|
const cellsOfBand = new Map(bands.map((b) => [b.id, b.members]));
|
|
@@ -711,8 +700,6 @@ function runningSlotValues(values, { continuedSuffix = " (continued)" } = {}) {
|
|
|
711
700
|
"section-title-continued": values.continued ? `${values.sectionTitle}${continuedSuffix}` : values.sectionTitle
|
|
712
701
|
};
|
|
713
702
|
}
|
|
714
|
-
//#endregion
|
|
715
|
-
//#region packages/renderer/src/print/print-stylesheet.ts
|
|
716
703
|
var warned = new Set();
|
|
717
704
|
function warnOnce(key, message) {
|
|
718
705
|
if (warned.has(key)) return;
|
|
@@ -862,8 +849,6 @@ function buildPageVariables(profile) {
|
|
|
862
849
|
}
|
|
863
850
|
return decls.length > 0 ? `:root {\n${decls.join("\n")}\n}` : "";
|
|
864
851
|
}
|
|
865
|
-
//#endregion
|
|
866
|
-
//#region packages/renderer/src/print/print-layout.ts
|
|
867
852
|
var SEPARATOR_MARGIN_PX = 48;
|
|
868
853
|
var SEPARATOR_PADDING_PX = 16;
|
|
869
854
|
var SEPARATOR_BORDER_PX = 2;
|
|
@@ -1048,8 +1033,6 @@ function round2(n) {
|
|
|
1048
1033
|
function round4(n) {
|
|
1049
1034
|
return Math.round(n * 1e4) / 1e4;
|
|
1050
1035
|
}
|
|
1051
|
-
//#endregion
|
|
1052
|
-
//#region packages/renderer/src/print/map-staleness.ts
|
|
1053
1036
|
function expectedHeightAfterTypesetting(measuredContainerPx, layout) {
|
|
1054
1037
|
return measuredContainerPx - layout.scaled.reduce((sum, r) => sum + (r.heightPx - r.scaledHeightPx), 0) + layout.screenExtraPx;
|
|
1055
1038
|
}
|
|
@@ -1065,8 +1048,6 @@ function mapStaleness(liveHeightPx, expectedPx, textBlockPx) {
|
|
|
1065
1048
|
tolerancePx
|
|
1066
1049
|
};
|
|
1067
1050
|
}
|
|
1068
|
-
//#endregion
|
|
1069
|
-
//#region packages/renderer/src/print/print-lint.ts
|
|
1070
1051
|
var VIEWPORT_UNIT = /(?<![\w-])(\d*\.?\d+)(v[hw]|vmin|vmax|[sld]v[hwbi]|vb|vi)(?![\w-])/gi;
|
|
1071
1052
|
var IGNORED_PROPERTIES = new Set(["container-type"]);
|
|
1072
1053
|
function viewportUnitsIn(cssText, where) {
|
|
@@ -1121,8 +1102,6 @@ function describe(el) {
|
|
|
1121
1102
|
if (cls) return `${el.tagName.toLowerCase()}.${cls.trim().split(/\s+/).slice(0, 2).join(".")}`;
|
|
1122
1103
|
return el.tagName.toLowerCase();
|
|
1123
1104
|
}
|
|
1124
|
-
//#endregion
|
|
1125
|
-
//#region packages/renderer/src/print/structure-print.ts
|
|
1126
1105
|
function setRowPageIntent(structure, cellId, intent) {
|
|
1127
1106
|
if (!structure || !cellId) return {
|
|
1128
1107
|
structure: structure ?? [],
|
|
@@ -1385,7 +1364,4 @@ function splitMarginalia(page, marginaliaCellId, hasReservedTrack) {
|
|
|
1385
1364
|
reason: null
|
|
1386
1365
|
};
|
|
1387
1366
|
}
|
|
1388
|
-
//#endregion
|
|
1389
1367
|
export { BLANK_PAGE_SEPARATOR_PX, DEFAULT_MARGINS, DEFAULT_SHEET, MissingRequiredBindingError, PRINT_POLICY_ATTR, RUNNING_SLOTS, SEPARATOR_TOTAL_PX, __clearDocumentProfileWarnings, __clearPrintStylesheetWarnings, applyRowPrint, auditPrintLint, buildPageStylesheet, buildPageVariables, buildPrintLayout, checkPaginatorBindings, collectBlocks, composeConstraints, constraintsFromBox, constraintsFromComputedStyle, constraintsResolver, cssLengthToPx, cssString, cssValue, deserializeConstraints, diffRowPrint, expectedHeightAfterTypesetting, findSlottedCellIds, forcedBreaksWithin, intentOfPrintBlock, isRunningSlot, mapStaleness, mediaReachesPrint, nodePrintConstraints, paginate, paperGeometryPx, parsePrintPolicy, printBlockForIntent, printByCellId, printPolicyToStyle, resolveDocumentProfile, resolvePlacement, resolveProfileId, resolveRegionBindings, resolveRunningValues, rowHasBlankPage, rowPageIntent, runningSlotValues, serializeConstraints, setRowBlankPage, setRowPageIntent, splitMarginalia, stalenessTolerancePx, viewportUnitsIn, withForcedBreaks };
|
|
1390
|
-
|
|
1391
|
-
//# sourceMappingURL=print.js.map
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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) => {
|
|
@@ -677,7 +662,7 @@ function useFormsRuntime(o) {
|
|
|
677
662
|
const steps = useMemo(() => visibleSteps(o.model, values), [o.model, values]);
|
|
678
663
|
const [at, setAt] = useState(() => positionFromLink(visibleSteps(o.model, answeredOf(o.initial)), mode, o.link ?? {}));
|
|
679
664
|
const here = settle(steps, mode, at);
|
|
680
|
-
const readOnly = isReadOnlyStatus(status);
|
|
665
|
+
const readOnly = o.readOnly === true || isReadOnlyStatus(status);
|
|
681
666
|
const opts = useRef(o);
|
|
682
667
|
opts.current = o;
|
|
683
668
|
const expected = useRef(new Map(Object.entries(o.initial).map(([k, a]) => [k, a.stateId ?? null])));
|
|
@@ -728,7 +713,7 @@ function useFormsRuntime(o) {
|
|
|
728
713
|
return chain.current;
|
|
729
714
|
}, []);
|
|
730
715
|
const change = useCallback((key, value) => {
|
|
731
|
-
if (
|
|
716
|
+
if (readOnly) return;
|
|
732
717
|
setValues((v) => ({
|
|
733
718
|
...v,
|
|
734
719
|
[key]: value
|
|
@@ -736,7 +721,7 @@ function useFormsRuntime(o) {
|
|
|
736
721
|
pending.current.set(key, value);
|
|
737
722
|
if (timer.current) clearTimeout(timer.current);
|
|
738
723
|
timer.current = setTimeout(() => void flush(), FORM_SAVE_DEBOUNCE_MS);
|
|
739
|
-
}, [flush,
|
|
724
|
+
}, [flush, readOnly]);
|
|
740
725
|
useEffect(() => {
|
|
741
726
|
const onLeave = () => void flush();
|
|
742
727
|
window.addEventListener("pagehide", onLeave);
|
|
@@ -856,7 +841,7 @@ function useFormsRuntime(o) {
|
|
|
856
841
|
refusal: refusals[q.key] ?? null,
|
|
857
842
|
inputId: answerInputId(q.key),
|
|
858
843
|
...port.upload ? { upload: async (file) => {
|
|
859
|
-
if (
|
|
844
|
+
if (readOnly) return {
|
|
860
845
|
ok: false,
|
|
861
846
|
refusal: words("FORM_NOT_OPEN")
|
|
862
847
|
};
|
|
@@ -934,7 +919,7 @@ function useFormsRuntime(o) {
|
|
|
934
919
|
run: () => void runSubmit(),
|
|
935
920
|
blocked: o.model.submitRequired === "block" && allMissing.length > 0
|
|
936
921
|
} : null,
|
|
937
|
-
reopen: status === "submitted" && o.model.submittable !== false ? {
|
|
922
|
+
reopen: status === "submitted" && !o.readOnly && o.model.submittable !== false ? {
|
|
938
923
|
label: "Edit answers",
|
|
939
924
|
run: () => void runReopen()
|
|
940
925
|
} : null,
|
|
@@ -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-
|
|
2
|
-
import { a as createStackStore, t as clearAllScopes } from "./chunks/persistence-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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; }
|
|
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; }
|
|
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; }
|
|
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
|
-
|
|
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-
|
|
2
|
-
import { o as projectModule } from "./chunks/load-
|
|
3
|
-
import { i as bundleScope } from "./chunks/refs-
|
|
4
|
-
import { n as pageBundles, t as pageBundleRefs } from "./chunks/page-bundles-
|
|
5
|
-
import { r as fromPageSteps } from "./chunks/forms-
|
|
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;
|