@homepages/concrete 9.0.0 → 10.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 +69 -0
- package/README.md +3 -3
- package/codemods/manifest.json +14 -0
- package/codemods/registry-keys-only.mjs +113 -0
- package/codemods/steps/list-object-form.mjs +2 -3
- package/codemods/steps/registry-key-reads.mjs +276 -0
- package/dist/artifact/playground/client/assets/index-BFNHB7VM.css +1 -0
- package/dist/artifact/playground/client/assets/index-Div1yo6s.js +1259 -0
- package/dist/artifact/playground/client/index.html +2 -2
- package/dist/artifact/playground/host.mjs +42 -42
- package/dist/cli/build/artifact.js +2 -1
- package/dist/cli/build/fixtures.js +2 -1
- package/dist/cli/check/render/inputs.js +3 -3
- package/dist/cli/check/stages/sections.js +5 -6
- package/dist/cli/check/stages/workspace.js +2 -0
- package/dist/cli/check/template-key.js +16 -0
- package/dist/cli/dev/workspace-reader.js +9 -2
- package/dist/fixtures/media-store.js +3 -3
- package/dist/fixtures/resolve.js +28 -23
- package/dist/fixtures/synthesize-empties.js +3 -1
- package/dist/fixtures.d.ts +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/packages/external/concrete/package.js +1 -1
- package/dist/packages/internal/capture-settle/dist/island-markers.d.ts +1 -1
- package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +15 -27
- package/dist/packages/internal/fill-bake/dist/compute-reads.js +12 -12
- package/dist/packages/internal/fill-bake/dist/derive-source.js +7 -14
- package/dist/packages/internal/fill-bake/dist/index.js +4 -3
- package/dist/packages/internal/fill-bake/dist/item-merge.js +36 -16
- package/dist/packages/internal/fill-bake/dist/item-overrides.js +1 -28
- package/dist/packages/internal/fill-bake/dist/linked-merge.js +5 -7
- package/dist/packages/internal/fill-bake/dist/list-grammar.js +11 -34
- package/dist/packages/internal/fill-bake/dist/stored-row-reader.js +1 -0
- package/dist/packages/internal/fill-vocabulary/dist/resolved-decision.js +12 -39
- package/dist/packages/internal/fill-vocabulary/dist/verbs.js +2 -17
- package/dist/packages/internal/media-resolution/dist/document.js +16 -15
- package/dist/packages/internal/media-resolution/dist/image.js +38 -94
- package/dist/packages/internal/media-resolution/dist/index.js +1 -1
- package/dist/packages/internal/media-resolution/dist/list.js +12 -12
- package/dist/packages/internal/media-resolution/dist/media.js +17 -16
- package/dist/packages/internal/media-resolution/dist/records.js +4 -2
- package/dist/packages/internal/media-resolution/dist/slot.js +9 -6
- package/dist/packages/internal/media-resolution/dist/tour.js +12 -11
- package/dist/packages/internal/media-resolution/dist/video.js +16 -16
- package/dist/packages/internal/property-facts/dist/registry-facts.js +10 -2
- package/dist/packages/internal/section-contracts/dist/catalog.js +2 -10
- package/dist/packages/internal/section-contracts/dist/directly-linked-list-contract.js +5 -12
- package/dist/packages/internal/section-contracts/dist/fill-spec-view.js +1 -5
- package/dist/packages/internal/section-contracts/dist/fill-verb-contract.js +7 -5
- package/dist/packages/internal/section-contracts/dist/grammar-scope.js +1 -1
- package/dist/packages/internal/section-contracts/dist/index.js +0 -2
- package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +0 -29
- package/dist/packages/internal/section-contracts/dist/list-scalar-contract.js +2 -16
- package/dist/packages/internal/section-contracts/dist/nested-slot-contract.js +6 -6
- package/dist/packages/internal/section-contracts/dist/object-contract.js +4 -2
- package/dist/packages/internal/section-contracts/dist/poi-curation-contract.js +6 -2
- package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +1 -15
- package/dist/packages/internal/section-contracts/dist/row-rule-contract.js +6 -7
- package/dist/packages/internal/section-contracts/dist/row-source-contract.js +7 -8
- package/dist/packages/internal/section-contracts/dist/runners.js +5 -17
- package/dist/packages/internal/section-contracts/dist/select-contract.js +7 -1
- package/dist/packages/internal/section-contracts/dist/source-contract.js +20 -79
- package/dist/packages/internal/section-contracts/dist/sources-contract.js +1 -1
- package/dist/packages/internal/section-contracts/dist/table-member.js +5 -8
- package/dist/packages/internal/section-contracts/dist/writer-reads-fact-contract.js +5 -10
- package/dist/packages/internal/source-resolution/dist/index.js +21 -189
- package/dist/packages/internal/template-artifact/dist/index.js +2 -2
- package/dist/packages/internal/template-artifact/dist/layout.js +3 -1
- package/dist/packages/internal/template-artifact/dist/verify.js +32 -16
- package/dist/packages/internal/template-contracts/dist/content-pick.js +24 -1
- package/dist/packages/internal/template-contracts/dist/decision-fills.js +2 -6
- package/dist/packages/internal/template-contracts/dist/document-value.d.ts +2 -2
- package/dist/packages/internal/template-contracts/dist/fact-keys.d.ts +3 -2
- package/dist/packages/internal/template-contracts/dist/fact-keys.js +19 -43
- package/dist/packages/internal/template-contracts/dist/fact-registry.d.ts +24 -3
- package/dist/packages/internal/template-contracts/dist/fact-registry.js +14 -7
- package/dist/packages/internal/template-contracts/dist/fill-builders.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/fill-spec-schema.js +3 -68
- package/dist/packages/internal/template-contracts/dist/fill-spec.js +7 -6
- package/dist/packages/internal/template-contracts/dist/list-editing.js +0 -1
- package/dist/packages/internal/template-contracts/dist/list.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/list.js +7 -15
- package/dist/packages/internal/template-contracts/dist/media-candidates.js +1 -1
- package/dist/packages/internal/template-contracts/dist/mirror-kind.js +2 -2
- package/dist/packages/internal/template-contracts/dist/object.js +3 -2
- package/dist/packages/internal/template-contracts/dist/primitive-descriptors.js +2 -2
- package/dist/packages/internal/template-contracts/dist/process-builders.d.ts +2 -2
- package/dist/packages/internal/template-contracts/dist/read-graph.js +14 -51
- package/dist/packages/internal/template-contracts/dist/ref-locate.js +15 -27
- package/dist/packages/internal/template-contracts/dist/registry-facts.d.ts +3 -1
- package/dist/packages/internal/template-contracts/dist/registry-facts.js +13 -24
- package/dist/packages/internal/template-contracts/dist/registry-shape.d.ts +20 -4
- package/dist/packages/internal/template-contracts/dist/registry-shape.js +69 -11
- package/dist/packages/internal/template-contracts/dist/row-planners.js +1 -1
- package/dist/packages/internal/template-contracts/dist/row-ref.d.ts +5 -14
- package/dist/packages/internal/template-contracts/dist/row-ref.js +7 -23
- package/dist/packages/internal/template-contracts/dist/row-sources.js +6 -16
- package/dist/packages/internal/template-contracts/dist/row.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/row.js +6 -7
- package/dist/packages/internal/template-contracts/dist/runtime-values.d.ts +5 -20
- package/dist/packages/internal/template-contracts/dist/section-schema-types.d.ts +1 -0
- package/dist/packages/internal/template-contracts/dist/slot-builders.d.ts +29 -37
- package/dist/packages/internal/template-contracts/dist/slot-builders.js +4 -7
- package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +2 -733
- package/dist/packages/internal/template-contracts/dist/slot-catalog.js +2 -502
- package/dist/packages/internal/template-contracts/dist/slot-overrides.js +4 -1
- package/dist/packages/internal/template-contracts/dist/slot-ref.d.ts +4 -4
- package/dist/packages/internal/template-contracts/dist/slot-types.js +1 -2
- package/dist/packages/internal/template-contracts/dist/slot-value.d.ts +9 -10
- package/dist/packages/internal/template-contracts/dist/table-members.d.ts +5 -12
- package/dist/packages/internal/template-contracts/dist/table-members.js +7 -37
- package/dist/packages/internal/template-contracts/dist/tour-value.d.ts +2 -2
- package/dist/primitives/Image.d.ts +3 -3
- package/dist/primitives/slot-bindings.js +2 -2
- package/dist/primitives/slot-download.d.ts +1 -1
- package/dist/primitives/slot-media.d.ts +1 -1
- package/dist/rules/registry.js +6 -0
- package/dist/schema/fact.d.ts +19 -52
- package/dist/schema/fact.js +6 -25
- package/dist/schema/facts-view.d.ts +1 -2
- package/dist/schema/property-facts.d.ts +1 -62
- package/dist/schema/section-schema.d.ts +2 -2
- package/dist/schema/section-schema.js +1 -1
- package/dist/section/section.d.ts +2 -2
- package/guide/reference/cli/INDEX.md +2 -2
- package/guide/reference/cli/build.md +1 -1
- package/guide/reference/cli/check.md +1 -1
- package/guide/reference/cli/dev.md +1 -1
- package/guide/reference/cli/property-add.md +1 -1
- package/guide/reference/cli/property-list.md +1 -1
- package/guide/reference/cli/publish.md +1 -1
- package/guide/reference/cli/upgrade.md +1 -1
- package/guide/reference/rules/INDEX.md +4 -5
- package/package.json +1 -1
- package/dist/artifact/playground/client/assets/index-BUmdDDX5.js +0 -1259
- package/dist/artifact/playground/client/assets/index-DDOcM0zA.css +0 -1
- package/dist/packages/internal/fill-vocabulary/dist/row-reads.js +0 -15
- package/dist/packages/internal/section-contracts/dist/group-contract.js +0 -19
- package/dist/packages/internal/section-contracts/dist/option-source-contract.js +0 -22
- package/dist/packages/internal/template-contracts/dist/comparable-address.js +0 -19
- package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +0 -62
- package/dist/packages/internal/template-contracts/dist/legacy-facts.js +0 -167
- package/dist/packages/internal/template-contracts/dist/registry-aliases.js +0 -77
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { cropsPart } from "../../template-contracts/dist/registry-facts.js";
|
|
1
|
+
import { contentMediaIdOf, cropsPart } from "../../template-contracts/dist/registry-facts.js";
|
|
2
2
|
import { cropKeyOwner } from "./crop-key.js";
|
|
3
3
|
import { readLadder } from "./store.js";
|
|
4
|
-
import { placeCrop } from "../../template-contracts/dist/content-pick.js";
|
|
4
|
+
import { placeCrop, storedCrop } from "../../template-contracts/dist/content-pick.js";
|
|
5
5
|
|
|
6
6
|
//#region ../../internal/media-resolution/dist/image.js
|
|
7
7
|
function emptyImage() {
|
|
@@ -11,25 +11,25 @@ function emptyImage() {
|
|
|
11
11
|
alt: ""
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
function servedKeyOf(
|
|
15
|
-
const maskKey = mask === void 0 ? void 0 :
|
|
16
|
-
const cutKey = cropsPart(
|
|
17
|
-
return maskKey ??
|
|
14
|
+
function servedKeyOf(record, mask) {
|
|
15
|
+
const maskKey = mask === void 0 ? void 0 : record.renditions[mask === "white" ? "mask_white" : "mask_black"]?.key;
|
|
16
|
+
const cutKey = cropsPart(record.crop) ? record.renditions.crop?.key : void 0;
|
|
17
|
+
return maskKey ?? record.renditions.cutout?.key ?? cutKey ?? record.key;
|
|
18
18
|
}
|
|
19
|
-
async function
|
|
20
|
-
if (
|
|
21
|
-
store.log?.warn({ id }, "resolve-
|
|
19
|
+
async function resolveImageMedia(id, record, store, opts) {
|
|
20
|
+
if (record === void 0) {
|
|
21
|
+
store.log?.warn({ id }, "resolve-media-id: no image media the render may reach; no media");
|
|
22
22
|
return null;
|
|
23
23
|
}
|
|
24
|
-
if (
|
|
24
|
+
if (record.kind !== "image") {
|
|
25
25
|
store.log?.warn({
|
|
26
26
|
id,
|
|
27
|
-
kind:
|
|
28
|
-
}, "resolve-
|
|
27
|
+
kind: record.kind
|
|
28
|
+
}, "resolve-media-id: media is not an image; no media");
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
31
31
|
try {
|
|
32
|
-
const servedKey = servedKeyOf(
|
|
32
|
+
const servedKey = servedKeyOf(record, opts?.mask);
|
|
33
33
|
return {
|
|
34
34
|
url: await store.servedUrl(servedKey),
|
|
35
35
|
source_key: servedKey
|
|
@@ -38,58 +38,29 @@ async function resolveImageAsset(id, asset, store, opts) {
|
|
|
38
38
|
store.log?.error({
|
|
39
39
|
id,
|
|
40
40
|
err: err.message
|
|
41
|
-
}, "resolve-
|
|
41
|
+
}, "resolve-media-id: presign failed; no media");
|
|
42
42
|
return null;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
function clamp01(n) {
|
|
46
|
-
return n < 0 ? 0 : n > 1 ? 1 : n;
|
|
47
|
-
}
|
|
48
|
-
function normalizeRect(v) {
|
|
49
|
-
const nx = typeof v.nx === "number" ? v.nx : 0;
|
|
50
|
-
const ny = typeof v.ny === "number" ? v.ny : 0;
|
|
51
|
-
const nw = typeof v.nw === "number" ? v.nw : 1;
|
|
52
|
-
const nh = typeof v.nh === "number" ? v.nh : 1;
|
|
53
|
-
if (![
|
|
54
|
-
nx,
|
|
55
|
-
ny,
|
|
56
|
-
nw,
|
|
57
|
-
nh
|
|
58
|
-
].every(Number.isFinite)) return null;
|
|
59
|
-
const r = {
|
|
60
|
-
nx: clamp01(nx),
|
|
61
|
-
ny: clamp01(ny),
|
|
62
|
-
nw: clamp01(nw),
|
|
63
|
-
nh: clamp01(nh)
|
|
64
|
-
};
|
|
65
|
-
if (r.nx === 0 && r.ny === 0 && r.nw === 1 && r.nh === 1) return null;
|
|
66
|
-
return r;
|
|
67
|
-
}
|
|
68
45
|
function renditionKey(rendition) {
|
|
69
46
|
const key = rendition && typeof rendition === "object" ? rendition.key : void 0;
|
|
70
47
|
return typeof key === "string" && key.length > 0 ? key : null;
|
|
71
48
|
}
|
|
72
49
|
function framingCrop(framing, at, mobile) {
|
|
73
|
-
const
|
|
74
|
-
const stored = rect === null ? null : {
|
|
75
|
-
x: rect.nx,
|
|
76
|
-
y: rect.ny,
|
|
77
|
-
width: rect.nw,
|
|
78
|
-
height: rect.nh
|
|
79
|
-
};
|
|
50
|
+
const stored = storedCrop(framing.crop);
|
|
80
51
|
return at === void 0 ? stored : placeCrop(stored, at.imageAspect, at.aspects, mobile);
|
|
81
52
|
}
|
|
82
53
|
function cutKeyOf(framing, photoId, crop) {
|
|
83
54
|
if (!cropsPart(crop)) return null;
|
|
84
|
-
const key = renditionKey((framing.renditions && typeof framing.renditions === "object" ? framing.renditions : {}).crop)
|
|
55
|
+
const key = renditionKey((framing.renditions && typeof framing.renditions === "object" ? framing.renditions : {}).crop);
|
|
85
56
|
return key !== null && cropKeyOwner(key) === photoId ? key : null;
|
|
86
57
|
}
|
|
87
58
|
function slotCutKey(v, at) {
|
|
88
|
-
return cutKeyOf(v,
|
|
59
|
+
return cutKeyOf(v, readMediaId(v), framingCrop(v, at));
|
|
89
60
|
}
|
|
90
61
|
function mobileCutKey(v, at) {
|
|
91
62
|
const mobile = v.mobile && typeof v.mobile === "object" ? v.mobile : at === void 0 ? null : {};
|
|
92
|
-
return mobile === null ? null : cutKeyOf(mobile,
|
|
63
|
+
return mobile === null ? null : cutKeyOf(mobile, readMediaId(v), framingCrop(mobile, at, "mobile"));
|
|
93
64
|
}
|
|
94
65
|
async function mobileCropUrl(key, store) {
|
|
95
66
|
try {
|
|
@@ -99,7 +70,7 @@ async function mobileCropUrl(key, store) {
|
|
|
99
70
|
}
|
|
100
71
|
}
|
|
101
72
|
function slotServedKey(v, mask, at) {
|
|
102
|
-
const photoId =
|
|
73
|
+
const photoId = readMediaId(v);
|
|
103
74
|
const renditions = v.renditions && typeof v.renditions === "object" ? v.renditions : {};
|
|
104
75
|
const own = (name) => {
|
|
105
76
|
const key = renditionKey(renditions[name]);
|
|
@@ -107,12 +78,10 @@ function slotServedKey(v, mask, at) {
|
|
|
107
78
|
};
|
|
108
79
|
return (mask === null ? null : own(mask === "white" ? "mask_white" : "mask_black")) ?? own("cutout") ?? (mask === null ? slotCutKey(v, at) : null);
|
|
109
80
|
}
|
|
110
|
-
function
|
|
111
|
-
|
|
112
|
-
if (typeof v.asset_id === "string" && v.asset_id) return v.asset_id;
|
|
113
|
-
return "";
|
|
81
|
+
function readMediaId(v) {
|
|
82
|
+
return contentMediaIdOf(v) ?? "";
|
|
114
83
|
}
|
|
115
|
-
async function resolveImageValue(value,
|
|
84
|
+
async function resolveImageValue(value, records, store, aspects) {
|
|
116
85
|
if (value === null) return {
|
|
117
86
|
value: null,
|
|
118
87
|
desktopKey: null,
|
|
@@ -124,14 +93,13 @@ async function resolveImageValue(value, assets, store, aspects) {
|
|
|
124
93
|
mobileKey: null
|
|
125
94
|
};
|
|
126
95
|
const v = value;
|
|
127
|
-
const rect = v.rect && typeof v.rect === "object" ? normalizeRect(v.rect) : null;
|
|
128
96
|
const ar = typeof v.ar === "number" ? v.ar : null;
|
|
129
|
-
const photoId =
|
|
97
|
+
const photoId = readMediaId(v);
|
|
130
98
|
const mask = v.mask === "white" || v.mask === "black" ? v.mask : null;
|
|
131
|
-
const
|
|
99
|
+
const record = photoId ? records.get(photoId) : void 0;
|
|
132
100
|
const at = aspects === void 0 ? void 0 : {
|
|
133
101
|
aspects,
|
|
134
|
-
imageAspect: imageAspectOf(
|
|
102
|
+
imageAspect: imageAspectOf(record, ar)
|
|
135
103
|
};
|
|
136
104
|
const mobileKey = photoId ? mobileCutKey(v, at) : null;
|
|
137
105
|
const mobile = mobileKey ? await mobileCropUrl(mobileKey, store) : null;
|
|
@@ -146,12 +114,12 @@ async function resolveImageValue(value, assets, store, aspects) {
|
|
|
146
114
|
alt
|
|
147
115
|
};
|
|
148
116
|
desktopKey = placedKey;
|
|
149
|
-
const uncropped = await
|
|
117
|
+
const uncropped = await resolveImageMedia(photoId, record, store);
|
|
150
118
|
if (uncropped && uncropped.url !== base.url) base.download_url = uncropped.url;
|
|
151
119
|
} else if (photoId) {
|
|
152
|
-
const served = await
|
|
120
|
+
const served = await resolveImageMedia(photoId, record, store, mask ? { mask } : void 0);
|
|
153
121
|
if (!served) return {
|
|
154
|
-
value:
|
|
122
|
+
value: emptyImage(),
|
|
155
123
|
desktopKey: null,
|
|
156
124
|
mobileKey
|
|
157
125
|
};
|
|
@@ -161,26 +129,22 @@ async function resolveImageValue(value, assets, store, aspects) {
|
|
|
161
129
|
alt
|
|
162
130
|
};
|
|
163
131
|
desktopKey = served.source_key;
|
|
164
|
-
} else if (typeof v.url === "string" && v.url.length > 0) {
|
|
165
|
-
base = {
|
|
166
|
-
photo_id: "",
|
|
167
|
-
url: v.url,
|
|
168
|
-
alt
|
|
169
|
-
};
|
|
170
|
-
desktopKey = null;
|
|
171
132
|
} else return {
|
|
172
|
-
value:
|
|
133
|
+
value: emptyImage(),
|
|
173
134
|
desktopKey: null,
|
|
174
135
|
mobileKey: null
|
|
175
136
|
};
|
|
176
137
|
return {
|
|
177
|
-
value:
|
|
138
|
+
value: mobile ? {
|
|
139
|
+
...base,
|
|
140
|
+
mobile
|
|
141
|
+
} : base,
|
|
178
142
|
desktopKey,
|
|
179
143
|
mobileKey: mobile ? mobileKey : null
|
|
180
144
|
};
|
|
181
145
|
}
|
|
182
|
-
function imageAspectOf(
|
|
183
|
-
if (
|
|
146
|
+
function imageAspectOf(record, ar) {
|
|
147
|
+
if (record?.kind === "image" && record.width !== null && record.height !== null && record.width > 0 && record.height > 0) return record.width / record.height;
|
|
184
148
|
return ar !== null && ar > 0 ? ar : null;
|
|
185
149
|
}
|
|
186
150
|
async function attachResponsive(entries, store) {
|
|
@@ -198,31 +162,11 @@ async function attachResponsive(entries, store) {
|
|
|
198
162
|
}
|
|
199
163
|
}
|
|
200
164
|
}
|
|
201
|
-
async function resolveImageSlot(value,
|
|
202
|
-
const entry = await resolveImageValue(value,
|
|
165
|
+
async function resolveImageSlot(value, records, store, aspects) {
|
|
166
|
+
const entry = await resolveImageValue(value, records, store, aspects);
|
|
203
167
|
await attachResponsive([entry], store);
|
|
204
168
|
return entry.value;
|
|
205
169
|
}
|
|
206
|
-
function withUnit(resolved, v) {
|
|
207
|
-
const unitId = v.unit_id;
|
|
208
|
-
const unitLabel = v.unit_label;
|
|
209
|
-
if (typeof unitId === "string") resolved.unit_id = unitId;
|
|
210
|
-
else if (unitId === null) resolved.unit_id = null;
|
|
211
|
-
if (typeof unitLabel === "string") resolved.unit_label = unitLabel;
|
|
212
|
-
else if (unitLabel === null) resolved.unit_label = null;
|
|
213
|
-
if ("floor_label" in v) {
|
|
214
|
-
const floorLabel = typeof v.floor_label === "string" ? v.floor_label : null;
|
|
215
|
-
resolved.floor_label = floorLabel;
|
|
216
|
-
if (resolved.alt === "") resolved.alt = floorLabel ?? "Floor plan";
|
|
217
|
-
}
|
|
218
|
-
return resolved;
|
|
219
|
-
}
|
|
220
|
-
function attach(base, rect, ar, mobile) {
|
|
221
|
-
if (rect) base.rect = rect;
|
|
222
|
-
if (ar) base.ar = ar;
|
|
223
|
-
if (mobile) base.mobile = mobile;
|
|
224
|
-
return base;
|
|
225
|
-
}
|
|
226
170
|
|
|
227
171
|
//#endregion
|
|
228
|
-
export { attachResponsive, emptyImage, mobileCutKey,
|
|
172
|
+
export { attachResponsive, emptyImage, mobileCutKey, resolveImageMedia, resolveImageSlot, resolveImageValue, servedKeyOf, slotCutKey };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cropKeyOwner } from "./crop-key.js";
|
|
2
2
|
import { resolveDocumentSlot } from "./document.js";
|
|
3
|
-
import { attachResponsive, emptyImage, mobileCutKey,
|
|
3
|
+
import { attachResponsive, emptyImage, mobileCutKey, resolveImageMedia, resolveImageSlot, resolveImageValue, servedKeyOf, slotCutKey } from "./image.js";
|
|
4
4
|
import { resolveTourSlot } from "./tour.js";
|
|
5
5
|
import { resolveVideoSlot } from "./video.js";
|
|
6
6
|
import { resolveMediaSlot } from "./media.js";
|
|
@@ -17,7 +17,7 @@ function primitiveOf(type) {
|
|
|
17
17
|
}
|
|
18
18
|
function itemContentOf(slot) {
|
|
19
19
|
if (slot?.type !== "list") return null;
|
|
20
|
-
const fields = slot.
|
|
20
|
+
const fields = slot.element?.type === "object" ? slot.element?.fields : void 0;
|
|
21
21
|
return fields != null ? {
|
|
22
22
|
kind: "record",
|
|
23
23
|
fields
|
|
@@ -36,14 +36,14 @@ async function resolvePrimitiveItems(members, primitive, ctx, element) {
|
|
|
36
36
|
switch (primitive) {
|
|
37
37
|
case "image": {
|
|
38
38
|
const entries = [];
|
|
39
|
-
for (const member of members) entries.push(await resolveImageValue(member, ctx.
|
|
39
|
+
for (const member of members) entries.push(await resolveImageValue(member, ctx.records, ctx.store, slotCropAspects(element?.crop)));
|
|
40
40
|
await attachResponsive(entries, ctx.store);
|
|
41
41
|
return entries.map((entry) => entry.value ?? emptyImage());
|
|
42
42
|
}
|
|
43
|
-
case "video": return (await Promise.all(members.map((member) => resolveVideoSlot(member, ctx.
|
|
44
|
-
case "tour": return (await Promise.all(members.map((member) => resolveTourSlot(member, ctx.
|
|
45
|
-
case "document": return (await Promise.all(members.map((member) => resolveDocumentSlot(member, ctx.
|
|
46
|
-
case "media": return (await Promise.all(members.map((member) => resolveMediaSlot(member, element ?? {}, ctx.
|
|
43
|
+
case "video": return (await Promise.all(members.map((member) => resolveVideoSlot(member, ctx.records, ctx.store)))).filter((v) => v !== null);
|
|
44
|
+
case "tour": return (await Promise.all(members.map((member) => resolveTourSlot(member, ctx.records, ctx.store)))).filter((t) => t !== null);
|
|
45
|
+
case "document": return (await Promise.all(members.map((member) => resolveDocumentSlot(member, ctx.records, ctx.store)))).filter((d) => d !== null);
|
|
46
|
+
case "media": return (await Promise.all(members.map((member) => resolveMediaSlot(member, element ?? {}, ctx.records, ctx.store)))).filter((m) => m !== null);
|
|
47
47
|
case "poi": return members.map((member) => ctx.resolvePoi(member));
|
|
48
48
|
case "scalar": return members;
|
|
49
49
|
}
|
|
@@ -84,14 +84,14 @@ async function resolveField(value, field, ctx, batch) {
|
|
|
84
84
|
if (itemContentOf(field) !== null) return resolveNestedList(value, field, ctx, batch);
|
|
85
85
|
switch (primitiveOf(field.type)) {
|
|
86
86
|
case "image": {
|
|
87
|
-
const entry = await resolveImageValue(value, ctx.
|
|
87
|
+
const entry = await resolveImageValue(value, ctx.records, ctx.store, slotCropAspects(field.crop));
|
|
88
88
|
batch.push(entry);
|
|
89
89
|
return entry.value;
|
|
90
90
|
}
|
|
91
|
-
case "video": return resolveVideoSlot(value, ctx.
|
|
92
|
-
case "tour": return resolveTourSlot(value, ctx.
|
|
93
|
-
case "document": return resolveDocumentSlot(value, ctx.
|
|
94
|
-
case "media": return resolveMediaSlot(value, field, ctx.
|
|
91
|
+
case "video": return resolveVideoSlot(value, ctx.records, ctx.store);
|
|
92
|
+
case "tour": return resolveTourSlot(value, ctx.records, ctx.store);
|
|
93
|
+
case "document": return resolveDocumentSlot(value, ctx.records, ctx.store);
|
|
94
|
+
case "media": return resolveMediaSlot(value, field, ctx.records, ctx.store);
|
|
95
95
|
case "poi": return ctx.resolvePoi(value);
|
|
96
96
|
case "scalar": return value;
|
|
97
97
|
}
|
|
@@ -103,7 +103,7 @@ async function resolveNestedList(value, field, ctx, batch) {
|
|
|
103
103
|
if (content.kind === "record") return resolveRecordRows(value, content.fields, ctx, batch);
|
|
104
104
|
if (content.primitive !== "image") return resolvePrimitiveItems(value, content.primitive, ctx, field.element);
|
|
105
105
|
const entries = [];
|
|
106
|
-
for (const member of value) entries.push(await resolveImageValue(member, ctx.
|
|
106
|
+
for (const member of value) entries.push(await resolveImageValue(member, ctx.records, ctx.store, slotCropAspects(field.element?.crop)));
|
|
107
107
|
batch.push(...entries);
|
|
108
108
|
return entries.map((entry) => entry.value ?? emptyImage());
|
|
109
109
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { declaredKinds } from "../../template-contracts/dist/slot-catalog.js";
|
|
2
|
+
import { contentMediaIdOf } from "../../template-contracts/dist/registry-facts.js";
|
|
2
3
|
import { resolveDocumentSlot } from "./document.js";
|
|
3
4
|
import { slotCropAspects } from "../../template-contracts/dist/content-pick.js";
|
|
4
5
|
import { resolveImageSlot } from "./image.js";
|
|
@@ -6,47 +7,47 @@ import { resolveTourSlot } from "./tour.js";
|
|
|
6
7
|
import { resolveVideoSlot } from "./video.js";
|
|
7
8
|
|
|
8
9
|
//#region ../../internal/media-resolution/dist/media.js
|
|
9
|
-
async function resolveMediaSlot(value, declaration,
|
|
10
|
+
async function resolveMediaSlot(value, declaration, records, store) {
|
|
10
11
|
if (value === null || typeof value !== "object") return null;
|
|
11
|
-
const
|
|
12
|
-
if (
|
|
13
|
-
const
|
|
14
|
-
if (
|
|
15
|
-
store.log?.warn({
|
|
12
|
+
const mediaId = contentMediaIdOf(value);
|
|
13
|
+
if (mediaId === void 0) return null;
|
|
14
|
+
const record = records.get(mediaId);
|
|
15
|
+
if (record === void 0) {
|
|
16
|
+
store.log?.warn({ media_id: mediaId }, "resolve-media-slot: no media the render may reach");
|
|
16
17
|
return null;
|
|
17
18
|
}
|
|
18
|
-
if (!declaredKinds(declaration).includes(
|
|
19
|
+
if (!declaredKinds(declaration).includes(record.kind)) {
|
|
19
20
|
store.log?.warn({
|
|
20
|
-
|
|
21
|
-
kind:
|
|
22
|
-
}, "resolve-media-slot:
|
|
21
|
+
media_id: mediaId,
|
|
22
|
+
kind: record.kind
|
|
23
|
+
}, "resolve-media-slot: media is of a kind the slot does not hold");
|
|
23
24
|
return null;
|
|
24
25
|
}
|
|
25
|
-
const reference = {
|
|
26
|
-
switch (
|
|
26
|
+
const reference = { media: mediaId };
|
|
27
|
+
switch (record.kind) {
|
|
27
28
|
case "image": {
|
|
28
|
-
const image = await resolveImageSlot(value,
|
|
29
|
+
const image = await resolveImageSlot(value, records, store, slotCropAspects(declaration.crop));
|
|
29
30
|
return image === null ? null : {
|
|
30
31
|
...image,
|
|
31
32
|
kind: "image"
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
35
|
case "video": {
|
|
35
|
-
const video = await resolveVideoSlot(reference,
|
|
36
|
+
const video = await resolveVideoSlot(reference, records, store);
|
|
36
37
|
return video === null ? null : {
|
|
37
38
|
...video,
|
|
38
39
|
kind: "video"
|
|
39
40
|
};
|
|
40
41
|
}
|
|
41
42
|
case "tour": {
|
|
42
|
-
const tour = await resolveTourSlot(reference,
|
|
43
|
+
const tour = await resolveTourSlot(reference, records, store);
|
|
43
44
|
return tour === null ? null : {
|
|
44
45
|
...tour,
|
|
45
46
|
kind: "tour"
|
|
46
47
|
};
|
|
47
48
|
}
|
|
48
49
|
case "document": {
|
|
49
|
-
const document = await resolveDocumentSlot(reference,
|
|
50
|
+
const document = await resolveDocumentSlot(reference, records, store);
|
|
50
51
|
return document === null ? null : {
|
|
51
52
|
...document,
|
|
52
53
|
kind: "document"
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import "../../template-contracts/dist/registry-facts.js";
|
|
2
|
+
|
|
1
3
|
//#region ../../internal/media-resolution/dist/records.js
|
|
2
|
-
function recordsOf(
|
|
3
|
-
return new Map(Object.entries(
|
|
4
|
+
function recordsOf(byId) {
|
|
5
|
+
return new Map(Object.entries(byId ?? {}));
|
|
4
6
|
}
|
|
5
7
|
|
|
6
8
|
//#endregion
|
|
@@ -11,11 +11,11 @@ async function resolveSlotValue(value, slot, ctx) {
|
|
|
11
11
|
if (slot === void 0) return value;
|
|
12
12
|
if (itemContentOf(slot) !== null) return resolveListSlot(value, slot, ctx);
|
|
13
13
|
switch (slot.type) {
|
|
14
|
-
case "image": return resolveImageSlot(value, ctx.
|
|
15
|
-
case "video": return resolveVideoSlot(value, ctx.
|
|
16
|
-
case "tour": return resolveTourSlot(value, ctx.
|
|
17
|
-
case "document": return resolveDocumentSlot(value, ctx.
|
|
18
|
-
case "media": return resolveMediaSlot(value, slot, ctx.
|
|
14
|
+
case "image": return resolveImageSlot(value, ctx.records, ctx.store, slotCropAspects(slot.crop));
|
|
15
|
+
case "video": return resolveVideoSlot(value, ctx.records, ctx.store);
|
|
16
|
+
case "tour": return resolveTourSlot(value, ctx.records, ctx.store);
|
|
17
|
+
case "document": return resolveDocumentSlot(value, ctx.records, ctx.store);
|
|
18
|
+
case "media": return resolveMediaSlot(value, slot, ctx.records, ctx.store);
|
|
19
19
|
case "poi": return ctx.resolvePoi(value);
|
|
20
20
|
case "object": return resolveObject(value, slot, ctx);
|
|
21
21
|
default: return value;
|
|
@@ -25,7 +25,10 @@ async function resolveObject(value, slot, ctx) {
|
|
|
25
25
|
if (slot.fields == null || !value || typeof value !== "object" || Array.isArray(value)) return value;
|
|
26
26
|
const [row] = await resolveListSlot([value], {
|
|
27
27
|
type: "list",
|
|
28
|
-
|
|
28
|
+
element: {
|
|
29
|
+
type: "object",
|
|
30
|
+
fields: slot.fields
|
|
31
|
+
}
|
|
29
32
|
}, ctx);
|
|
30
33
|
return row;
|
|
31
34
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { tourEmbedUrl } from "../../template-contracts/dist/slot-catalog.js";
|
|
2
|
+
import { contentMediaIdOf } from "../../template-contracts/dist/registry-facts.js";
|
|
2
3
|
import { readLadder } from "./store.js";
|
|
3
4
|
|
|
4
5
|
//#region ../../internal/media-resolution/dist/tour.js
|
|
@@ -14,37 +15,37 @@ async function attachPosterResponsive(out, previewKey, store) {
|
|
|
14
15
|
if (responsive) out.poster_responsive = responsive;
|
|
15
16
|
return out;
|
|
16
17
|
}
|
|
17
|
-
async function resolveTourSlot(value,
|
|
18
|
+
async function resolveTourSlot(value, records, store) {
|
|
18
19
|
if (value === null) return null;
|
|
19
20
|
if (typeof value !== "object") return DEFAULT;
|
|
20
21
|
const v = value;
|
|
21
|
-
const tourId =
|
|
22
|
+
const tourId = contentMediaIdOf(v) ?? "";
|
|
22
23
|
if (!tourId) return DEFAULT;
|
|
23
|
-
const
|
|
24
|
-
if (
|
|
25
|
-
store.log?.warn({ tour_id: tourId }, "resolve-tour-slot: no tour
|
|
24
|
+
const record = records.get(tourId);
|
|
25
|
+
if (record === void 0) {
|
|
26
|
+
store.log?.warn({ tour_id: tourId }, "resolve-tour-slot: no tour media the render may reach");
|
|
26
27
|
return DEFAULT;
|
|
27
28
|
}
|
|
28
|
-
if (
|
|
29
|
+
if (record.kind !== "tour") {
|
|
29
30
|
store.log?.warn({
|
|
30
31
|
tour_id: tourId,
|
|
31
|
-
kind:
|
|
32
|
-
}, "resolve-tour-slot:
|
|
32
|
+
kind: record.kind
|
|
33
|
+
}, "resolve-tour-slot: media is not a tour");
|
|
33
34
|
return DEFAULT;
|
|
34
35
|
}
|
|
35
36
|
try {
|
|
36
|
-
const embed = tourEmbedUrl(
|
|
37
|
+
const embed = tourEmbedUrl(record.url);
|
|
37
38
|
if (embed === null) {
|
|
38
39
|
store.log?.warn({ tour_id: tourId }, "resolve-tour-slot: tour link embeds nowhere");
|
|
39
40
|
return DEFAULT;
|
|
40
41
|
}
|
|
41
|
-
const posterKey =
|
|
42
|
+
const posterKey = record.renditions.poster?.key ?? null;
|
|
42
43
|
return attachPosterResponsive({
|
|
43
44
|
tour_id: tourId,
|
|
44
45
|
url: embed,
|
|
45
46
|
poster: posterKey ? await store.fileUrl(posterKey) : "",
|
|
46
47
|
alt: typeof v.alt === "string" ? v.alt : "",
|
|
47
|
-
provider:
|
|
48
|
+
provider: record.provider
|
|
48
49
|
}, posterKey, store);
|
|
49
50
|
} catch (err) {
|
|
50
51
|
store.log?.error({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { videoEmbedUrl } from "../../template-contracts/dist/slot-catalog.js";
|
|
2
|
-
import { videoSourceOf } from "../../template-contracts/dist/registry-facts.js";
|
|
2
|
+
import { contentMediaIdOf, videoSourceOf } from "../../template-contracts/dist/registry-facts.js";
|
|
3
3
|
import { readLadder } from "./store.js";
|
|
4
4
|
|
|
5
5
|
//#region ../../internal/media-resolution/dist/video.js
|
|
@@ -15,29 +15,29 @@ async function attachPosterResponsive(out, previewKey, store) {
|
|
|
15
15
|
if (responsive) out.poster_responsive = responsive;
|
|
16
16
|
return out;
|
|
17
17
|
}
|
|
18
|
-
async function resolveVideoSlot(value,
|
|
18
|
+
async function resolveVideoSlot(value, records, store) {
|
|
19
19
|
if (value === null) return null;
|
|
20
20
|
if (typeof value !== "object") return DEFAULT;
|
|
21
21
|
const v = value;
|
|
22
|
-
const videoId =
|
|
22
|
+
const videoId = contentMediaIdOf(v) ?? "";
|
|
23
23
|
if (!videoId) return DEFAULT;
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
26
|
-
store.log?.warn({ video_id: videoId }, "resolve-video-slot: no video
|
|
24
|
+
const record = records.get(videoId);
|
|
25
|
+
if (record === void 0) {
|
|
26
|
+
store.log?.warn({ video_id: videoId }, "resolve-video-slot: no video media the render may reach");
|
|
27
27
|
return DEFAULT;
|
|
28
28
|
}
|
|
29
|
-
if (
|
|
29
|
+
if (record.kind !== "video") {
|
|
30
30
|
store.log?.warn({
|
|
31
31
|
video_id: videoId,
|
|
32
|
-
kind:
|
|
33
|
-
}, "resolve-video-slot:
|
|
32
|
+
kind: record.kind
|
|
33
|
+
}, "resolve-video-slot: media is not a video");
|
|
34
34
|
return DEFAULT;
|
|
35
35
|
}
|
|
36
|
-
const posterKey =
|
|
36
|
+
const posterKey = record.renditions.poster?.key ?? null;
|
|
37
37
|
const alt = typeof v.alt === "string" ? v.alt : "";
|
|
38
38
|
try {
|
|
39
|
-
if (videoSourceOf(
|
|
40
|
-
const url =
|
|
39
|
+
if (videoSourceOf(record) === "link") {
|
|
40
|
+
const url = record.url;
|
|
41
41
|
const embed = videoEmbedUrl(url);
|
|
42
42
|
if (!embed) {
|
|
43
43
|
store.log?.warn({ video_id: videoId }, "resolve-video-slot: link upload embeds nowhere");
|
|
@@ -50,17 +50,17 @@ async function resolveVideoSlot(value, assets, store) {
|
|
|
50
50
|
alt,
|
|
51
51
|
source: "link"
|
|
52
52
|
};
|
|
53
|
-
if (
|
|
53
|
+
if (record.provider !== null) out.provider = record.provider;
|
|
54
54
|
return attachPosterResponsive(out, posterKey, store);
|
|
55
55
|
}
|
|
56
56
|
const poster = posterKey ? await store.fileUrl(posterKey) : "";
|
|
57
|
-
const encode =
|
|
57
|
+
const encode = record.renditions.encode;
|
|
58
58
|
if (encode === null) {
|
|
59
59
|
store.log?.warn({
|
|
60
60
|
video_id: videoId,
|
|
61
|
-
state:
|
|
61
|
+
state: record.state
|
|
62
62
|
}, "resolve-video-slot: no encode; poster-only");
|
|
63
|
-
if (
|
|
63
|
+
if (record.state !== "failed") store.notePending?.({
|
|
64
64
|
kind: "video",
|
|
65
65
|
id: videoId
|
|
66
66
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ADDRESS_SOURCES } from "../../template-contracts/dist/address-value.js";
|
|
2
|
-
import { FILE_RENDITION_NAMES, PLACE_RENDITION_NAMES, RENDITION_NAMES, fileNameOf, framedAt, framingOver, hasOwnFraming, isHomeMediaValue, isMediaReference, mediaIdOf, mediaRecords, mergeMedia, readAsRecords, recordOf, splitMedia, videoSourceOf } from "../../template-contracts/dist/registry-facts.js";
|
|
2
|
+
import { FILE_RENDITION_NAMES, PLACE_RENDITION_NAMES, RENDITION_NAMES, contentMediaIdOf, fileNameOf, framedAt, framingOver, hasOwnFraming, isHomeMediaValue, isMediaReference, mediaIdOf, mediaRecords, mergeMedia, readAsRecords, recordOf, splitMedia, videoSourceOf } from "../../template-contracts/dist/registry-facts.js";
|
|
3
3
|
import { libraryFacts, listKeyOf, propertyFacts } from "../../template-contracts/dist/fact-registry.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
|
|
@@ -20,7 +20,8 @@ const CropSchema = z.object({
|
|
|
20
20
|
}).strict();
|
|
21
21
|
const RenditionInputsSchema = z.object({
|
|
22
22
|
crop: CropSchema.nullable(),
|
|
23
|
-
options: z.record(z.string(), z.unknown())
|
|
23
|
+
options: z.record(z.string(), z.unknown()),
|
|
24
|
+
version: z.string().optional()
|
|
24
25
|
}).strict();
|
|
25
26
|
const PlaceRenditionSchema = RenditionSchema.extend({ over: RenditionInputsSchema }).strict();
|
|
26
27
|
const ServedPlaceRenditionSchema = ServedRenditionSchema.extend({ over: RenditionInputsSchema }).strict();
|
|
@@ -177,6 +178,13 @@ const MediaReferenceSchema = z.object({
|
|
|
177
178
|
crop: CropSchema.nullable().optional(),
|
|
178
179
|
renditions: placeRenditions.partial().strict().optional()
|
|
179
180
|
}).strict();
|
|
181
|
+
const StoredHomeValueSchema = z.object({
|
|
182
|
+
id: z.string(),
|
|
183
|
+
file: z.string(),
|
|
184
|
+
crop: CropSchema.nullable(),
|
|
185
|
+
name: z.string().nullable(),
|
|
186
|
+
renditions: placeRenditions.partial().strict()
|
|
187
|
+
}).strict();
|
|
180
188
|
const REGISTRIES = {
|
|
181
189
|
property: propertyFacts,
|
|
182
190
|
library: libraryFacts
|
|
@@ -54,7 +54,7 @@ const SECTION_CONTRACT_CATALOG = [
|
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
56
|
id: "object",
|
|
57
|
-
summary: "An object groups value slots, rows, lists of value slots and lists of objects one level deep, holds no value of its own, is labelled by
|
|
57
|
+
summary: "An object groups value slots, rows, lists of value slots and lists of objects one level deep, holds no value of its own, is labelled by its label field, and names no field like its binding's own keys."
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
id: "list-source",
|
|
@@ -86,11 +86,7 @@ const SECTION_CONTRACT_CATALOG = [
|
|
|
86
86
|
},
|
|
87
87
|
{
|
|
88
88
|
id: "select",
|
|
89
|
-
summary: "A select
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
id: "option-source",
|
|
93
|
-
summary: "A select with an option source names a source the platform provides."
|
|
89
|
+
summary: "A select names its choices in exactly one place: its values, or a fact it is bound to that declares them."
|
|
94
90
|
},
|
|
95
91
|
{
|
|
96
92
|
id: "url",
|
|
@@ -103,10 +99,6 @@ const SECTION_CONTRACT_CATALOG = [
|
|
|
103
99
|
{
|
|
104
100
|
id: "interpolation",
|
|
105
101
|
summary: "A fill brief refers to its facts through reads and never interpolates one."
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
id: "group",
|
|
109
|
-
summary: "Group ids are unique, every group names real slots, and no slot sits in two groups."
|
|
110
102
|
}
|
|
111
103
|
];
|
|
112
104
|
|
|
@@ -1,22 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { tableBounds, tableForSlot } from "../../template-contracts/dist/registry-shape.js";
|
|
2
|
+
import "../../template-contracts/dist/table-members.js";
|
|
2
3
|
|
|
3
4
|
//#region ../../internal/section-contracts/dist/directly-linked-list-contract.js
|
|
4
5
|
function assertDirectlyLinkedListContract(schema, sectionKey) {
|
|
5
6
|
for (const [slotId, slotUnknown] of Object.entries(schema.slots)) {
|
|
6
7
|
const slot = slotUnknown;
|
|
7
|
-
|
|
8
|
-
if (slot.type !== "list" || slot.fields == null && !grammar) continue;
|
|
8
|
+
if (slot.type !== "list" || slot.element?.type !== "object" && slot.element?.type !== "row") continue;
|
|
9
9
|
const label = `list "${slotId}"`;
|
|
10
|
-
|
|
11
|
-
if (source?.kind !== "home") continue;
|
|
10
|
+
if (slot.source?.kind !== "home") continue;
|
|
12
11
|
const table = tableForSlot(slot);
|
|
13
|
-
if (table === null
|
|
14
|
-
if (table === null) {
|
|
15
|
-
const legal = Object.keys(REGISTRY_TABLE_KEYS).map((field) => `fact.property.${field}`).join(" / ");
|
|
16
|
-
throw new Error(`Section "${sectionKey}": ${label} is bound to the fact "${source.key ?? "?"}", which is not a known table. TABLES is a closed registry owned by @homepages/concrete — a workspace cannot add to it. A directly linked list may only bind a registry array (${legal}); for any other repeating data, drop \`source\` and give the slot a fill decision instead.`);
|
|
17
|
-
}
|
|
18
|
-
const entry = isLegacyTable(table) ? TABLES[table] : null;
|
|
19
|
-
if (entry !== null && !entry.ownership) throw new Error(`Section "${sectionKey}": ${label} table "${table}" declares no ownership in TABLES. TABLES is a closed registry owned by @homepages/concrete — this is a framework defect, not something a workspace can fix.`);
|
|
12
|
+
if (table === null) continue;
|
|
20
13
|
const inherited = tableBounds(table);
|
|
21
14
|
if (inherited.max !== void 0 && slot.max !== void 0 && slot.max >= inherited.max) throw new Error(`Section "${sectionKey}": ${label} declares max ${slot.max}, but table "${table}" already caps membership at ${inherited.max}. An explicit max is legal only if it is strictly lower; drop it to inherit ${inherited.max}.`);
|
|
22
15
|
if (inherited.min !== void 0 && slot.min !== void 0 && slot.min <= inherited.min) throw new Error(`Section "${sectionKey}": ${label} declares min ${slot.min}, but table "${table}" already requires at least ${inherited.min}. An explicit min is legal only if it is strictly higher; drop it to inherit ${inherited.min}.`);
|
|
@@ -9,10 +9,6 @@ const DECISION_KINDS = [
|
|
|
9
9
|
function isListFill(decision) {
|
|
10
10
|
return decision.kind === "list";
|
|
11
11
|
}
|
|
12
|
-
function plannedFieldsOf(decision) {
|
|
13
|
-
const fields = decision.fields;
|
|
14
|
-
return fields !== null && typeof fields === "object" ? Object.keys(fields) : [];
|
|
15
|
-
}
|
|
16
12
|
|
|
17
13
|
//#endregion
|
|
18
|
-
export { DECISION_KINDS, isListFill
|
|
14
|
+
export { DECISION_KINDS, isListFill };
|