@homepages/concrete 5.0.0 → 6.0.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/CHANGELOG.md +336 -0
- package/README.md +28 -17
- package/codemods/fill-is-a-source.mjs +533 -0
- package/codemods/manifest.json +12 -0
- package/codemods/reads-replace-reconcile.mjs +285 -0
- package/dist/artifact/playground/client/assets/{index-D1fwOGVK.js → index-u3T7DiSN.js} +96 -96
- package/dist/artifact/playground/client/index.html +1 -1
- package/dist/artifact/playground/host.mjs +23 -23
- package/dist/base.css +3 -8
- package/dist/browser/site-config.js +1 -16
- package/dist/browser/submit-lead.js +0 -31
- package/dist/cli/build/artifact.js +16 -23
- package/dist/cli/build/captures.js +0 -6
- package/dist/cli/build/esbuild.js +0 -17
- package/dist/cli/build/fixtures.js +15 -30
- package/dist/cli/build/icons.js +0 -3
- package/dist/cli/build/index.js +1 -1
- package/dist/cli/build/playground.js +4 -8
- package/dist/cli/build/sections.js +9 -30
- package/dist/cli/build/source.js +52 -27
- package/dist/cli/build/static.js +4 -25
- package/dist/cli/capture/bundle.js +0 -9
- package/dist/cli/capture/capture-browser.js +0 -14
- package/dist/cli/capture/capture.js +1 -8
- package/dist/cli/check/analyze.js +2 -5
- package/dist/cli/check/index.js +1 -1
- package/dist/cli/check/line-endings.js +52 -0
- package/dist/cli/check/load-workspace.js +3 -8
- package/dist/cli/check/portable-names.js +48 -0
- package/dist/cli/check/render/class-conflicts.js +0 -5
- package/dist/cli/check/render/html.js +0 -1
- package/dist/cli/check/render/invariants.js +0 -5
- package/dist/cli/check/render/island-frames.js +0 -25
- package/dist/cli/check/render/marker-coverage.js +0 -20
- package/dist/cli/check/render/nav.js +0 -33
- package/dist/cli/check/report.js +0 -3
- package/dist/cli/check/stages/bundles.js +1 -9
- package/dist/cli/check/stages/composition.js +3 -2
- package/dist/cli/check/stages/dependencies.js +7 -38
- package/dist/cli/check/stages/fixtures.js +3 -31
- package/dist/cli/check/stages/lint.js +2 -2
- package/dist/cli/check/stages/logic.js +3 -34
- package/dist/cli/check/stages/relations.js +46 -0
- package/dist/cli/check/stages/render.js +0 -1
- package/dist/cli/check/stages/sections.js +3 -3
- package/dist/cli/check/stages/stylesheet.js +1 -1
- package/dist/cli/check/stages/typecheck.js +5 -11
- package/dist/cli/check/stages/workspace.js +36 -14
- package/dist/cli/commands.js +9 -56
- package/dist/cli/currency/cache.js +4 -17
- package/dist/cli/currency/decide.js +0 -14
- package/dist/cli/currency/opt-out.js +0 -7
- package/dist/cli/currency/preamble.js +3 -24
- package/dist/cli/currency/prompt.js +0 -1
- package/dist/cli/currency/refresh.js +5 -12
- package/dist/cli/currency/resolve-latest.js +3 -64
- package/dist/cli/currency/version-order.js +0 -12
- package/dist/cli/dev/crop.js +0 -2
- package/dist/cli/dev/http.js +0 -13
- package/dist/cli/dev/index.js +3 -4
- package/dist/cli/dev/islands.js +25 -70
- package/dist/cli/dev/listen.js +26 -0
- package/dist/cli/dev/load-template.js +0 -1
- package/dist/cli/dev/request-error.js +0 -4
- package/dist/cli/dev/server.js +46 -52
- package/dist/cli/dev/tsconfig-paths.js +0 -13
- package/dist/cli/dev/vite.js +9 -38
- package/dist/cli/dev/workspace-reader.js +4 -34
- package/dist/cli/media/cache.js +4 -51
- package/dist/cli/media/derive.js +2 -94
- package/dist/cli/media/deriver-plugin.js +0 -2
- package/dist/cli/media/frame-rung-floor.js +0 -6
- package/dist/cli/property/index.js +0 -4
- package/dist/cli/property/library.js +6 -24
- package/dist/cli/publish/client.js +0 -1
- package/dist/cli/publish/freshness.js +0 -2
- package/dist/cli/publish/git.js +2 -8
- package/dist/cli/publish/index.js +8 -15
- package/dist/cli/publish/pack.js +5 -6
- package/dist/cli/publish/report.js +0 -6
- package/dist/cli/publish/target.js +16 -13
- package/dist/cli/publish/wire.js +0 -6
- package/dist/cli/tar.js +2 -9
- package/dist/cli/upgrade/codemod.js +0 -8
- package/dist/cli/upgrade/index.js +0 -24
- package/dist/cli/upgrade/manifest.js +0 -12
- package/dist/cli/upgrade/plan.js +0 -17
- package/dist/cli/upgrade/stage.js +12 -15
- package/dist/cli/version.js +0 -8
- package/dist/cli/workspace.js +2 -34
- package/dist/cli.js +4 -21
- package/dist/css/compile.js +25 -28
- package/dist/css/graph.js +3 -10
- package/dist/css/inline.js +3 -13
- package/dist/css/rules.js +6 -43
- package/dist/design-system/format-variants.js +0 -22
- package/dist/eslint/authoring.js +0 -2
- package/dist/eslint/correctness.js +0 -7
- package/dist/eslint/rules/editor-reason.js +0 -11
- package/dist/eslint/rules/island-ids.js +0 -1
- package/dist/eslint/rules/jsx-visitor.js +0 -13
- package/dist/eslint/rules/no-editor-globals.js +0 -2
- package/dist/eslint/rules/no-raw-values.js +0 -1
- package/dist/fixtures/brand.js +0 -1
- package/dist/fixtures/bundle-rule.js +4 -9
- package/dist/fixtures/canonical.d.ts +20 -0
- package/dist/fixtures/image-dimensions.js +0 -1
- package/dist/fixtures/load.js +8 -17
- package/dist/fixtures/media-plugin.js +4 -31
- package/dist/fixtures/media.js +0 -21
- package/dist/fixtures/package-stylesheets.js +0 -6
- package/dist/fixtures/property.js +16 -15
- package/dist/fixtures/resolve.js +102 -29
- package/dist/fixtures/rows.js +12 -11
- package/dist/fixtures/synthesize-empties.js +0 -4
- package/dist/fixtures.d.ts +19 -4
- package/dist/fixtures.js +0 -18
- package/dist/index.d.ts +8 -9
- package/dist/index.js +2 -11
- package/dist/islands/client-module.js +0 -11
- package/dist/islands/marker.js +0 -33
- package/dist/node_modules/.pnpm/fflate@0.8.3/node_modules/fflate/esm/browser.js +0 -20
- package/dist/packages/external/concrete/package.js +1 -1
- package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +21 -35
- package/dist/packages/internal/fill-bake/dist/compute-reads.js +4 -0
- package/dist/packages/internal/fill-bake/dist/derive-source.js +40 -0
- package/dist/packages/internal/fill-bake/dist/display.js +0 -1
- package/dist/packages/internal/fill-bake/dist/index.js +4 -4
- package/dist/packages/internal/fill-vocabulary/dist/origination.js +106 -0
- package/dist/packages/internal/fill-vocabulary/dist/row-planners.js +1 -49
- package/dist/packages/internal/format-geometry/dist/capture.js +10 -240
- package/dist/packages/internal/format-geometry/dist/geometry.js +0 -6
- package/dist/packages/internal/image-ladder/dist/crop.js +0 -12
- package/dist/packages/internal/image-ladder/dist/policy.js +0 -14
- package/dist/packages/internal/island-runtime/dist/capture-holds.js +0 -13
- package/dist/packages/internal/island-runtime/dist/contract.js +0 -34
- package/dist/packages/internal/island-runtime/dist/editor-instance-context.js +0 -1
- package/dist/packages/internal/island-runtime/dist/index.js +0 -34
- package/dist/packages/internal/island-runtime/dist/island-id-context.js +0 -1
- package/dist/packages/internal/island-runtime/dist/use-capture-ready.js +0 -15
- package/dist/packages/internal/island-runtime/dist/use-editor.js +0 -10
- package/dist/packages/internal/island-runtime/dist/use-island-id.js +0 -32
- package/dist/packages/internal/property-facts/dist/derive-facts-view.js +2 -17
- package/dist/packages/internal/property-facts/dist/index.js +1 -1
- package/dist/packages/internal/property-facts/dist/{property-facts-CSdkSuD7.js → property-facts-5pxZnlkh.js} +13 -2
- package/dist/packages/internal/section-contracts/dist/cap-contract.js +1 -18
- package/dist/packages/internal/section-contracts/dist/catalog.js +16 -8
- package/dist/packages/internal/section-contracts/dist/choose-select-contract.js +12 -16
- package/dist/packages/internal/section-contracts/dist/count-bounds-contract.js +5 -11
- package/dist/packages/internal/section-contracts/dist/display-contract.js +2 -0
- package/dist/packages/internal/section-contracts/dist/display-evidence-contract.js +2 -8
- package/dist/packages/internal/section-contracts/dist/fill-spec-view.js +13 -0
- package/dist/packages/internal/section-contracts/dist/index.js +2 -1
- package/dist/packages/internal/section-contracts/dist/interpolation-contract.js +16 -42
- package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +24 -43
- package/dist/packages/internal/section-contracts/dist/name-title-contract.js +11 -18
- package/dist/packages/internal/section-contracts/dist/poi-curation-contract.js +10 -12
- package/dist/packages/internal/section-contracts/dist/pooling-field-contract.js +3 -13
- package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +6 -18
- package/dist/packages/internal/section-contracts/dist/runners.js +21 -13
- package/dist/packages/internal/section-contracts/dist/source-contract.js +13 -2
- package/dist/packages/internal/section-contracts/dist/writer-reads-fact-contract.js +31 -0
- package/dist/packages/internal/source-resolution/dist/index.js +1 -9
- package/dist/packages/internal/template-artifact/dist/hash.js +0 -8
- package/dist/packages/internal/template-artifact/dist/index.js +1 -1
- package/dist/packages/internal/template-artifact/dist/layout.js +0 -39
- package/dist/packages/internal/template-artifact/dist/manifest.js +1 -9
- package/dist/packages/internal/template-artifact/dist/sha256.js +0 -1
- package/dist/packages/internal/template-artifact/dist/verify.js +2 -4
- package/dist/packages/internal/template-contracts/dist/collection-editing.js +0 -16
- package/dist/packages/internal/template-contracts/dist/content-categories.js +0 -4
- package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +16 -10
- package/dist/packages/internal/template-contracts/dist/facts-view.js +15 -28
- package/dist/packages/internal/template-contracts/dist/layout.js +0 -7
- package/dist/packages/internal/template-contracts/dist/markers.js +0 -29
- package/dist/packages/internal/template-contracts/dist/select-key.js +0 -6
- package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +56 -34
- package/dist/packages/internal/template-contracts/dist/slot-catalog.js +22 -389
- package/dist/platform/file-url.js +8 -0
- package/dist/platform/fs.js +73 -0
- package/dist/platform/names.js +63 -0
- package/dist/platform/order.js +7 -0
- package/dist/platform/paths.js +62 -0
- package/dist/platform/process.js +97 -0
- package/dist/playground/host/page-state.js +0 -2
- package/dist/playground/host/paths.js +0 -1
- package/dist/playground/layout.js +0 -7
- package/dist/playground/wire.js +0 -8
- package/dist/primitives/FrameShell.js +0 -18
- package/dist/primitives/Image.d.ts +5 -1
- package/dist/primitives/Image.js +2 -68
- package/dist/primitives/Section.js +0 -13
- package/dist/primitives/Tour.js +0 -26
- package/dist/primitives/Video.js +0 -32
- package/dist/primitives/embed-playback.js +0 -1
- package/dist/primitives/marker-attrs.js +0 -17
- package/dist/primitives/picture-sources.js +6 -1
- package/dist/primitives/probe-context.js +0 -7
- package/dist/primitives/slot-bindings.js +0 -46
- package/dist/primitives/slot-document.js +0 -11
- package/dist/primitives/slot-group.js +0 -9
- package/dist/primitives/slot-media.js +0 -27
- package/dist/primitives/slot-scalar.js +0 -4
- package/dist/primitives/slot.js +0 -6
- package/dist/rules/registry.js +42 -24
- package/dist/schema/compute.d.ts +46 -8
- package/dist/schema/compute.js +21 -15
- package/dist/schema/define-schema.d.ts +1 -1
- package/dist/schema/define-schema.js +37 -17
- package/dist/schema/extract-fill-spec.js +93 -180
- package/dist/schema/extract-used-facts.js +16 -158
- package/dist/schema/fact.d.ts +25 -12
- package/dist/schema/fact.js +7 -11
- package/dist/schema/fill-builders.d.ts +91 -366
- package/dist/schema/fill-builders.js +21 -259
- package/dist/schema/fill-declaration.d.ts +7 -69
- package/dist/schema/fill-declaration.js +5 -34
- package/dist/schema/fill-spec.js +59 -148
- package/dist/schema/format-presets.js +0 -12
- package/dist/schema/format.js +0 -7
- package/dist/schema/layout.js +0 -10
- package/dist/schema/manifest.js +0 -39
- package/dist/schema/property-facts.d.ts +20 -0
- package/dist/schema/section-nav.js +0 -15
- package/dist/schema/section-schema.d.ts +0 -1
- package/dist/schema/section-schema.js +4 -20
- package/dist/schema/slot-builders.d.ts +128 -117
- package/dist/schema/slot-builders.js +18 -201
- package/dist/schema/slot-ref.d.ts +63 -0
- package/dist/schema/slot-ref.js +33 -0
- package/dist/schema/slot-types.d.ts +3 -2
- package/dist/schema/slot-types.js +11 -20
- package/dist/section/declare.d.ts +14 -10
- package/dist/section/declare.js +13 -2
- package/dist/section/discovery.js +6 -21
- package/dist/section/groups.js +0 -6
- package/dist/section/materialize.js +0 -5
- package/dist/section/placements.js +0 -4
- package/dist/section/section.d.ts +8 -5
- package/dist/section/section.js +7 -29
- package/dist/styles.css +5 -0
- package/dist/template/define-template.d.ts +0 -4
- package/dist/template/define-template.js +1 -15
- package/dist/template/logic-build.js +8 -35
- package/dist/template/logic-shim.d.ts +4 -5
- package/dist/template/logic-shim.js +2 -6
- package/dist/template/logic-transform.js +0 -6
- package/dist/template/materialize.js +52 -43
- package/dist/template/mirror-types.js +43 -0
- package/dist/template/running-copy.js +5 -20
- package/dist/template/section-reads.js +83 -0
- package/guide/reference/cli/INDEX.md +12 -6
- package/guide/reference/cli/build.md +1 -1
- package/guide/reference/cli/check.md +1 -1
- package/guide/reference/cli/dev.md +3 -3
- package/guide/reference/cli/property-add.md +1 -1
- package/guide/reference/cli/property-list.md +1 -1
- package/guide/reference/cli/publish.md +4 -2
- package/guide/reference/cli/upgrade.md +1 -1
- package/guide/reference/rules/INDEX.md +26 -13
- package/package.json +4 -2
- package/dist/packages/internal/fact-interpolation/dist/index.js +0 -22
- package/dist/packages/internal/fill-bake/dist/reconcile-cross-section.js +0 -170
- package/dist/packages/internal/fill-vocabulary/dist/facts.d.ts +0 -32
- package/dist/packages/internal/fill-vocabulary/dist/facts.js +0 -131
- package/dist/packages/internal/template-contracts/dist/slot-overrides.js +0 -11
- package/dist/schema/fill-spec.d.ts +0 -18
- package/dist/template/reconcile.d.ts +0 -67
- package/dist/template/reconcile.js +0 -25
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { DISPLAY_ENTRIES } from "../../template-contracts/dist/slot-catalog.js";
|
|
2
2
|
import { COLLECTION_PROJECTIONS, buildUnitFloorplanList, readFrom, rowFieldSources } from "../../source-resolution/dist/index.js";
|
|
3
3
|
import { buildDeriveFactsView } from "../../property-facts/dist/derive-facts-view.js";
|
|
4
|
+
import { callDerived, readsAnySlot } from "./derive-source.js";
|
|
4
5
|
import { declaredDisplay } from "./display.js";
|
|
5
6
|
|
|
6
7
|
//#region ../../internal/fill-bake/dist/bake-property-ref.js
|
|
@@ -38,28 +39,19 @@ function bakePropertyRefSlots(schema, facts, ctx) {
|
|
|
38
39
|
}
|
|
39
40
|
const derived = derivedSource(def);
|
|
40
41
|
if (derived !== null) {
|
|
41
|
-
|
|
42
|
+
if (readsAnySlot(def.source)) continue;
|
|
43
|
+
const resolved = resolveDerivedHandle(derived.transform, def.source, deriveFacts, ctx, { slot_id: name });
|
|
42
44
|
out[name] = resolved === null ? null : resolved.value;
|
|
43
45
|
continue;
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
48
|
return out;
|
|
47
49
|
}
|
|
48
|
-
|
|
49
|
-
* One authored `compute()` handle, bound to the derive-time facts view. Returns
|
|
50
|
-
* `null` when the bundle does not carry the handle at all or the fn threw —
|
|
51
|
-
* one failure channel for both, with one structured log. An unresolvable handle
|
|
52
|
-
* is raised into that channel rather than resolving quietly: with the registry
|
|
53
|
-
* gone this log is the only thing that makes a stale section pin — a
|
|
54
|
-
* schema naming a handle its logic bundle never exported — observable in
|
|
55
|
-
* production. What an unresolved handle MEANS is the caller's: a slot bakes
|
|
56
|
-
* null, a display entry falls back to its first declared case.
|
|
57
|
-
*/
|
|
58
|
-
function resolveDerivedHandle(derivedHandle, deriveFacts, ctx, target) {
|
|
50
|
+
function resolveDerivedHandle(derivedHandle, source, deriveFacts, ctx, target, readSlot) {
|
|
59
51
|
const authored = ctx?.computed[derivedHandle];
|
|
60
52
|
try {
|
|
61
53
|
if (authored === void 0) throw new Error(`derived handle "${derivedHandle}" is not in the section's computed map`);
|
|
62
|
-
return { value: authored
|
|
54
|
+
return { value: callDerived(authored, source, deriveFacts, readSlot) };
|
|
63
55
|
} catch (err) {
|
|
64
56
|
ctx?.log?.error({
|
|
65
57
|
event: "derive_function_threw",
|
|
@@ -71,16 +63,6 @@ function resolveDerivedHandle(derivedHandle, deriveFacts, ctx, target) {
|
|
|
71
63
|
return null;
|
|
72
64
|
}
|
|
73
65
|
}
|
|
74
|
-
/**
|
|
75
|
-
* The `source`-origin entries of a section's `display` block, resolved from the
|
|
76
|
-
* same facts bundle its slots bake from. `fill`-origin entries are absent by
|
|
77
|
-
* design — the `display-select` decision decides those — and so is any entry
|
|
78
|
-
* whose compute failed or answered outside its declared cases: an unresolved
|
|
79
|
-
* entry falls back to its first declared case at completion (./display.ts).
|
|
80
|
-
*
|
|
81
|
-
* An entry's origin is always the `derived` literal `defineSchema` rewrites a
|
|
82
|
-
* `compute()` binding to, so there is no `direct` axis to dispatch here.
|
|
83
|
-
*/
|
|
84
66
|
function bakeDisplayEntries(schema, facts, ctx) {
|
|
85
67
|
const display = declaredDisplay(schema);
|
|
86
68
|
const out = {};
|
|
@@ -90,22 +72,26 @@ function bakeDisplayEntries(schema, facts, ctx) {
|
|
|
90
72
|
const def = display[entry];
|
|
91
73
|
const derivedHandle = def?.source?.transform;
|
|
92
74
|
if (def === void 0 || typeof derivedHandle !== "string") continue;
|
|
93
|
-
|
|
75
|
+
if (readsAnySlot(def.source)) continue;
|
|
76
|
+
const resolved = resolveDerivedHandle(derivedHandle, def.source, deriveFacts, ctx, { display_entry: entry });
|
|
94
77
|
if (resolved === null) continue;
|
|
95
|
-
const answer =
|
|
96
|
-
if (
|
|
97
|
-
ctx?.log?.error({
|
|
98
|
-
event: "display_compute_out_of_vocabulary",
|
|
99
|
-
section_key: ctx.section_key,
|
|
100
|
-
display_entry: entry,
|
|
101
|
-
answer: resolved.value
|
|
102
|
-
}, "display: source compute answered outside its declared cases; falling back to the first case");
|
|
103
|
-
continue;
|
|
104
|
-
}
|
|
78
|
+
const answer = inDeclaredCases(def, entry, resolved.value, ctx);
|
|
79
|
+
if (answer === null) continue;
|
|
105
80
|
out[entry] = answer;
|
|
106
81
|
}
|
|
107
82
|
return out;
|
|
108
83
|
}
|
|
84
|
+
function inDeclaredCases(def, entry, value, ctx) {
|
|
85
|
+
const answer = typeof value === "string" ? value : "";
|
|
86
|
+
if (def.cases?.includes(answer) === true) return answer;
|
|
87
|
+
ctx?.log?.error({
|
|
88
|
+
event: "display_compute_out_of_vocabulary",
|
|
89
|
+
section_key: ctx.section_key,
|
|
90
|
+
display_entry: entry,
|
|
91
|
+
answer: value
|
|
92
|
+
}, "display: source compute answered outside its declared cases; falling back to the first case");
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
109
95
|
|
|
110
96
|
//#endregion
|
|
111
|
-
export { bakeDisplayEntries, bakePropertyRefSlots, derivedSource, directField, resolveDirectField };
|
|
97
|
+
export { bakeDisplayEntries, bakePropertyRefSlots, derivedSource, directField, inDeclaredCases, resolveDerivedHandle, resolveDirectField };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { readFact } from "../../template-contracts/dist/facts-view.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../internal/fill-bake/dist/derive-source.js
|
|
4
|
+
function readsOf(source) {
|
|
5
|
+
if (source === null || typeof source !== "object") return [];
|
|
6
|
+
const reads = source.reads;
|
|
7
|
+
return Array.isArray(reads) ? reads : [];
|
|
8
|
+
}
|
|
9
|
+
function slotRefOf(entry) {
|
|
10
|
+
const { kind, section, slot } = entry ?? {};
|
|
11
|
+
return kind === "slot" && typeof section === "string" && typeof slot === "string" ? {
|
|
12
|
+
kind,
|
|
13
|
+
section,
|
|
14
|
+
slot
|
|
15
|
+
} : null;
|
|
16
|
+
}
|
|
17
|
+
function declaredReads(source) {
|
|
18
|
+
return readsOf(source).map((entry, i) => {
|
|
19
|
+
const { kind, key } = entry ?? {};
|
|
20
|
+
if (kind === "fact" && typeof key === "string") return {
|
|
21
|
+
kind: "fact",
|
|
22
|
+
key
|
|
23
|
+
};
|
|
24
|
+
const slotRef = slotRefOf(entry);
|
|
25
|
+
if (slotRef !== null) return slotRef;
|
|
26
|
+
throw new Error(`reads[${String(i)}] is not a fact or slot ref: ${JSON.stringify(entry)}`);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function declaredSlotRefs(source) {
|
|
30
|
+
return readsOf(source).flatMap((entry) => slotRefOf(entry) ?? []);
|
|
31
|
+
}
|
|
32
|
+
function readsAnySlot(source) {
|
|
33
|
+
return declaredSlotRefs(source).length > 0;
|
|
34
|
+
}
|
|
35
|
+
function callDerived(fn, source, facts, readSlot) {
|
|
36
|
+
return fn(...declaredReads(source).map((ref) => ref.kind === "fact" ? readFact(facts(), ref.key) : readSlot?.(ref)));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
export { callDerived, declaredReads, declaredSlotRefs, readsAnySlot };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
//#region ../../internal/fill-bake/dist/display.js
|
|
2
|
-
/** The section's declared display entries, defensive against loose JSONB. */
|
|
3
2
|
function declaredDisplay(schema) {
|
|
4
3
|
const display = schema.display;
|
|
5
4
|
return display !== null && typeof display === "object" ? display : {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { callDerived, declaredReads, declaredSlotRefs, readsAnySlot } from "./derive-source.js";
|
|
2
2
|
import { declaredDisplay } from "./display.js";
|
|
3
|
-
import { bakeDisplayEntries, bakePropertyRefSlots, derivedSource, directField, resolveDirectField } from "./bake-property-ref.js";
|
|
4
|
-
import
|
|
3
|
+
import { bakeDisplayEntries, bakePropertyRefSlots, derivedSource, directField, resolveDerivedHandle, resolveDirectField } from "./bake-property-ref.js";
|
|
4
|
+
import "./compute-reads.js";
|
|
5
5
|
|
|
6
|
-
export {
|
|
6
|
+
export { bakeDisplayEntries, bakePropertyRefSlots };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { poolingPrimitiveOf } from "./row-planners.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../internal/fill-vocabulary/dist/origination.js
|
|
4
|
+
const LEGACY_COLLECTION_ITEM = {
|
|
5
|
+
image_collection: "image",
|
|
6
|
+
video_collection: "video",
|
|
7
|
+
poi_list: "poi"
|
|
8
|
+
};
|
|
9
|
+
function isListSlot(slot) {
|
|
10
|
+
return slot.type === "list" || slot.type !== void 0 && slot.type in LEGACY_COLLECTION_ITEM;
|
|
11
|
+
}
|
|
12
|
+
function pooledFieldsOf(fields) {
|
|
13
|
+
const found = [];
|
|
14
|
+
for (const [field, def] of Object.entries(fields)) {
|
|
15
|
+
if (def.source !== void 0) continue;
|
|
16
|
+
const pool = poolingPrimitiveOf(def);
|
|
17
|
+
if (pool !== void 0) found.push({
|
|
18
|
+
field,
|
|
19
|
+
pool
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return found;
|
|
23
|
+
}
|
|
24
|
+
function selectFieldsOf(fields) {
|
|
25
|
+
return Object.entries(fields).filter(([, def]) => def.type === "select" && Array.isArray(def.values)).map(([name]) => name);
|
|
26
|
+
}
|
|
27
|
+
function keyRows(slot, fields) {
|
|
28
|
+
const selects = selectFieldsOf(fields);
|
|
29
|
+
const title = slot.title;
|
|
30
|
+
if (title !== void 0) {
|
|
31
|
+
const def = fields[title];
|
|
32
|
+
if (def?.type === "text") return {
|
|
33
|
+
kind: "keyed-rows",
|
|
34
|
+
keyField: title,
|
|
35
|
+
keys: "written"
|
|
36
|
+
};
|
|
37
|
+
if (def?.type === "select" && selects.includes(title)) return {
|
|
38
|
+
kind: "keyed-rows",
|
|
39
|
+
keyField: title,
|
|
40
|
+
keys: "picked"
|
|
41
|
+
};
|
|
42
|
+
return def?.type === void 0 ? {
|
|
43
|
+
kind: "no-key",
|
|
44
|
+
title
|
|
45
|
+
} : {
|
|
46
|
+
kind: "no-key",
|
|
47
|
+
title,
|
|
48
|
+
titleType: def.type
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
if (selects.length === 1) return {
|
|
52
|
+
kind: "keyed-rows",
|
|
53
|
+
keyField: selects[0],
|
|
54
|
+
keys: "picked"
|
|
55
|
+
};
|
|
56
|
+
return { kind: "no-key" };
|
|
57
|
+
}
|
|
58
|
+
function originationFor(slot) {
|
|
59
|
+
if (isListSlot(slot)) {
|
|
60
|
+
const fields = slot.fields;
|
|
61
|
+
if (fields !== void 0) {
|
|
62
|
+
const bound = slot.source;
|
|
63
|
+
if (bound?.kind === "direct" && bound.field !== void 0) return {
|
|
64
|
+
kind: "bound-rows",
|
|
65
|
+
iterate: bound.field
|
|
66
|
+
};
|
|
67
|
+
const pooled = pooledFieldsOf(fields);
|
|
68
|
+
const key = keyRows(slot, fields);
|
|
69
|
+
if (pooled.length === 1 && !(key.kind === "keyed-rows" && key.keys === "picked")) return {
|
|
70
|
+
kind: "pick-assets",
|
|
71
|
+
pool: pooled[0].pool,
|
|
72
|
+
field: pooled[0].field
|
|
73
|
+
};
|
|
74
|
+
if (key.kind === "keyed-rows") return key;
|
|
75
|
+
const { kind: _noKey, ...pointed } = key;
|
|
76
|
+
return {
|
|
77
|
+
kind: "unkeyed-rows",
|
|
78
|
+
...pointed,
|
|
79
|
+
selects: selectFieldsOf(fields),
|
|
80
|
+
pools: pooled.map((p) => p.field)
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
const item = slot.element?.type ?? LEGACY_COLLECTION_ITEM[slot.type ?? ""];
|
|
84
|
+
if (item === "poi") return { kind: "curate" };
|
|
85
|
+
const pool = poolingPrimitiveOf({ type: item });
|
|
86
|
+
if (pool !== void 0) return {
|
|
87
|
+
kind: "pick-assets",
|
|
88
|
+
pool
|
|
89
|
+
};
|
|
90
|
+
if (item === "select") return { kind: "pick-keys" };
|
|
91
|
+
return { kind: "write-items" };
|
|
92
|
+
}
|
|
93
|
+
if (slot.type === "text") return { kind: "write" };
|
|
94
|
+
if (slot.type === "select") return {
|
|
95
|
+
kind: "pick-one",
|
|
96
|
+
from: "values"
|
|
97
|
+
};
|
|
98
|
+
const pool = poolingPrimitiveOf(slot);
|
|
99
|
+
if (pool !== void 0) return {
|
|
100
|
+
kind: "pick-one",
|
|
101
|
+
from: pool
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
//#endregion
|
|
106
|
+
export { isListSlot, originationFor };
|
|
@@ -1,55 +1,13 @@
|
|
|
1
1
|
//#region ../../internal/fill-vocabulary/dist/row-planners.js
|
|
2
|
-
/**
|
|
3
|
-
* The decision `type` each planner reads off a row field's fill declaration.
|
|
4
|
-
*
|
|
5
|
-
* Adding an entry is a claim that the executor implements it; the executor's own
|
|
6
|
-
* suite asserts its planner map against these keys, so the claim fails there
|
|
7
|
-
* rather than in a worker.
|
|
8
|
-
*/
|
|
9
|
-
const PLANNER_DECISION_TYPES = {
|
|
10
|
-
text: "text-block",
|
|
11
|
-
list: "list-fill",
|
|
12
|
-
select: "list-fill",
|
|
13
|
-
choice: "select-assign",
|
|
14
|
-
assets: "list-fill",
|
|
15
|
-
image: "image-assign",
|
|
16
|
-
video: "video-assign",
|
|
17
|
-
tour: "tour-assign",
|
|
18
|
-
document: "document-assign"
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* The asset primitives a list may pool its ROWS from, and a row field may pick
|
|
22
|
-
* one of. Each names a property-level candidate pool the model selects out of by
|
|
23
|
-
* id — photos, videos, 3D tours, and stored documents.
|
|
24
|
-
*/
|
|
25
2
|
const POOLING_PRIMITIVES = [
|
|
26
3
|
"image",
|
|
27
4
|
"video",
|
|
28
5
|
"tour",
|
|
29
6
|
"document"
|
|
30
7
|
];
|
|
31
|
-
/**
|
|
32
|
-
* The pool a declared field draws from, or `undefined` when it draws from none.
|
|
33
|
-
*
|
|
34
|
-
* The same derivation answers both questions the family asks of a media
|
|
35
|
-
* declaration — which pool ORIGINATION draws rows from, and which pool a row
|
|
36
|
-
* field's planner picks one asset from — so "this is a media declaration"
|
|
37
|
-
* cannot mean one thing at the list level and another inside a row.
|
|
38
|
-
*/
|
|
39
8
|
function poolingPrimitiveOf(field) {
|
|
40
9
|
return POOLING_PRIMITIVES.includes(field.type ?? "") ? field.type : void 0;
|
|
41
10
|
}
|
|
42
|
-
/**
|
|
43
|
-
* The planner a row field's declared item content selects, or `undefined` when
|
|
44
|
-
* that primitive takes no fill at all. A `list` splits on its ELEMENT: a select
|
|
45
|
-
* element's own `values` are the vocabulary the select planner picks from, a
|
|
46
|
-
* pooled element's pool is the vocabulary the assets planner picks from, a
|
|
47
|
-
* scalar element is what the list planner writes — and a poi element selects NO
|
|
48
|
-
* planner: rows are filled in one batched call over the whole list, and nothing
|
|
49
|
-
* says how a Places result set would divide per row. A bare `select` is the
|
|
50
|
-
* choice planner, one key from its own `values`; `number` and `url` select none,
|
|
51
|
-
* since no model writes a figure or a link.
|
|
52
|
-
*/
|
|
53
11
|
function plannerForField(field) {
|
|
54
12
|
if (field.type === "list") {
|
|
55
13
|
const element = field.element?.type;
|
|
@@ -62,12 +20,6 @@ function plannerForField(field) {
|
|
|
62
20
|
if (field.type === "select") return "choice";
|
|
63
21
|
return poolingPrimitiveOf(field);
|
|
64
22
|
}
|
|
65
|
-
/**
|
|
66
|
-
* The decision types a row field may be filled with — the planner table's own
|
|
67
|
-
* values, so the set both validate surfaces reject against cannot drift from the
|
|
68
|
-
* planners the executor implements.
|
|
69
|
-
*/
|
|
70
|
-
const EXECUTABLE_NESTED_TYPES = [...new Set(Object.values(PLANNER_DECISION_TYPES))];
|
|
71
23
|
|
|
72
24
|
//#endregion
|
|
73
|
-
export {
|
|
25
|
+
export { POOLING_PRIMITIVES, plannerForField, poolingPrimitiveOf };
|