@homepages/concrete 9.1.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.
Files changed (118) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +1 -1
  3. package/codemods/manifest.json +10 -0
  4. package/codemods/registry-keys-only.mjs +113 -0
  5. package/codemods/steps/list-object-form.mjs +2 -3
  6. package/codemods/steps/registry-key-reads.mjs +276 -0
  7. package/dist/artifact/playground/client/assets/index-BFNHB7VM.css +1 -0
  8. package/dist/artifact/playground/client/assets/index-Div1yo6s.js +1259 -0
  9. package/dist/artifact/playground/client/index.html +2 -2
  10. package/dist/artifact/playground/host.mjs +42 -42
  11. package/dist/cli/build/artifact.js +2 -1
  12. package/dist/cli/build/fixtures.js +2 -1
  13. package/dist/cli/check/render/inputs.js +3 -3
  14. package/dist/cli/check/stages/sections.js +5 -6
  15. package/dist/cli/dev/workspace-reader.js +9 -2
  16. package/dist/fixtures/media-store.js +3 -3
  17. package/dist/fixtures/resolve.js +24 -16
  18. package/dist/fixtures/synthesize-empties.js +3 -1
  19. package/dist/fixtures.d.ts +1 -1
  20. package/dist/index.d.ts +3 -4
  21. package/dist/packages/external/concrete/package.js +1 -1
  22. package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +8 -6
  23. package/dist/packages/internal/fill-bake/dist/compute-reads.js +8 -4
  24. package/dist/packages/internal/fill-bake/dist/index.js +1 -1
  25. package/dist/packages/internal/fill-bake/dist/item-merge.js +32 -6
  26. package/dist/packages/internal/fill-bake/dist/linked-merge.js +5 -5
  27. package/dist/packages/internal/fill-bake/dist/list-grammar.js +4 -26
  28. package/dist/packages/internal/fill-vocabulary/dist/resolved-decision.js +1 -1
  29. package/dist/packages/internal/media-resolution/dist/document.js +16 -15
  30. package/dist/packages/internal/media-resolution/dist/image.js +38 -92
  31. package/dist/packages/internal/media-resolution/dist/index.js +1 -1
  32. package/dist/packages/internal/media-resolution/dist/list.js +11 -11
  33. package/dist/packages/internal/media-resolution/dist/media.js +17 -16
  34. package/dist/packages/internal/media-resolution/dist/records.js +4 -2
  35. package/dist/packages/internal/media-resolution/dist/slot.js +5 -5
  36. package/dist/packages/internal/media-resolution/dist/tour.js +12 -11
  37. package/dist/packages/internal/media-resolution/dist/video.js +16 -16
  38. package/dist/packages/internal/property-facts/dist/registry-facts.js +8 -1
  39. package/dist/packages/internal/section-contracts/dist/catalog.js +1 -5
  40. package/dist/packages/internal/section-contracts/dist/directly-linked-list-contract.js +2 -3
  41. package/dist/packages/internal/section-contracts/dist/fill-verb-contract.js +5 -3
  42. package/dist/packages/internal/section-contracts/dist/index.js +0 -1
  43. package/dist/packages/internal/section-contracts/dist/object-contract.js +4 -2
  44. package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +1 -1
  45. package/dist/packages/internal/section-contracts/dist/row-rule-contract.js +4 -2
  46. package/dist/packages/internal/section-contracts/dist/row-source-contract.js +7 -8
  47. package/dist/packages/internal/section-contracts/dist/runners.js +1 -8
  48. package/dist/packages/internal/section-contracts/dist/select-contract.js +7 -1
  49. package/dist/packages/internal/section-contracts/dist/source-contract.js +12 -8
  50. package/dist/packages/internal/section-contracts/dist/sources-contract.js +1 -1
  51. package/dist/packages/internal/section-contracts/dist/table-member.js +5 -8
  52. package/dist/packages/internal/source-resolution/dist/index.js +21 -188
  53. package/dist/packages/internal/template-artifact/dist/index.js +2 -2
  54. package/dist/packages/internal/template-artifact/dist/layout.js +3 -1
  55. package/dist/packages/internal/template-artifact/dist/verify.js +32 -16
  56. package/dist/packages/internal/template-contracts/dist/content-pick.js +24 -1
  57. package/dist/packages/internal/template-contracts/dist/document-value.d.ts +2 -2
  58. package/dist/packages/internal/template-contracts/dist/fact-keys.d.ts +3 -2
  59. package/dist/packages/internal/template-contracts/dist/fact-keys.js +19 -43
  60. package/dist/packages/internal/template-contracts/dist/fact-registry.d.ts +24 -3
  61. package/dist/packages/internal/template-contracts/dist/fact-registry.js +10 -3
  62. package/dist/packages/internal/template-contracts/dist/fill-builders.d.ts +1 -1
  63. package/dist/packages/internal/template-contracts/dist/fill-spec.js +7 -6
  64. package/dist/packages/internal/template-contracts/dist/list.d.ts +1 -1
  65. package/dist/packages/internal/template-contracts/dist/list.js +7 -15
  66. package/dist/packages/internal/template-contracts/dist/mirror-kind.js +2 -2
  67. package/dist/packages/internal/template-contracts/dist/object.js +3 -2
  68. package/dist/packages/internal/template-contracts/dist/process-builders.d.ts +2 -2
  69. package/dist/packages/internal/template-contracts/dist/read-graph.js +5 -32
  70. package/dist/packages/internal/template-contracts/dist/ref-locate.js +10 -6
  71. package/dist/packages/internal/template-contracts/dist/registry-facts.d.ts +1 -1
  72. package/dist/packages/internal/template-contracts/dist/registry-facts.js +13 -24
  73. package/dist/packages/internal/template-contracts/dist/registry-shape.d.ts +20 -4
  74. package/dist/packages/internal/template-contracts/dist/registry-shape.js +69 -11
  75. package/dist/packages/internal/template-contracts/dist/row-planners.js +1 -1
  76. package/dist/packages/internal/template-contracts/dist/row-ref.d.ts +4 -7
  77. package/dist/packages/internal/template-contracts/dist/row-ref.js +7 -23
  78. package/dist/packages/internal/template-contracts/dist/row-sources.js +3 -3
  79. package/dist/packages/internal/template-contracts/dist/row.d.ts +1 -1
  80. package/dist/packages/internal/template-contracts/dist/row.js +6 -7
  81. package/dist/packages/internal/template-contracts/dist/runtime-values.d.ts +5 -20
  82. package/dist/packages/internal/template-contracts/dist/section-schema-types.d.ts +1 -0
  83. package/dist/packages/internal/template-contracts/dist/slot-builders.d.ts +29 -37
  84. package/dist/packages/internal/template-contracts/dist/slot-builders.js +4 -7
  85. package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +2 -702
  86. package/dist/packages/internal/template-contracts/dist/slot-catalog.js +2 -498
  87. package/dist/packages/internal/template-contracts/dist/slot-overrides.js +4 -1
  88. package/dist/packages/internal/template-contracts/dist/slot-ref.d.ts +4 -4
  89. package/dist/packages/internal/template-contracts/dist/slot-value.d.ts +2 -1
  90. package/dist/packages/internal/template-contracts/dist/table-members.d.ts +5 -12
  91. package/dist/packages/internal/template-contracts/dist/table-members.js +7 -37
  92. package/dist/packages/internal/template-contracts/dist/tour-value.d.ts +2 -2
  93. package/dist/primitives/Image.d.ts +3 -3
  94. package/dist/primitives/slot-download.d.ts +1 -1
  95. package/dist/primitives/slot-media.d.ts +1 -1
  96. package/dist/schema/fact.d.ts +19 -52
  97. package/dist/schema/fact.js +6 -25
  98. package/dist/schema/facts-view.d.ts +1 -2
  99. package/dist/schema/property-facts.d.ts +1 -62
  100. package/dist/schema/section-schema.d.ts +2 -2
  101. package/dist/schema/section-schema.js +1 -1
  102. package/guide/reference/cli/INDEX.md +2 -2
  103. package/guide/reference/cli/build.md +1 -1
  104. package/guide/reference/cli/check.md +1 -1
  105. package/guide/reference/cli/dev.md +1 -1
  106. package/guide/reference/cli/property-add.md +1 -1
  107. package/guide/reference/cli/property-list.md +1 -1
  108. package/guide/reference/cli/publish.md +1 -1
  109. package/guide/reference/cli/upgrade.md +1 -1
  110. package/guide/reference/rules/INDEX.md +2 -3
  111. package/package.json +1 -1
  112. package/dist/artifact/playground/client/assets/index-BOYbgBnP.js +0 -1259
  113. package/dist/artifact/playground/client/assets/index-DDOcM0zA.css +0 -1
  114. package/dist/packages/internal/section-contracts/dist/option-source-contract.js +0 -22
  115. package/dist/packages/internal/template-contracts/dist/comparable-address.js +0 -19
  116. package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +0 -62
  117. package/dist/packages/internal/template-contracts/dist/legacy-facts.js +0 -167
  118. 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(asset, mask) {
15
- const maskKey = mask === void 0 ? void 0 : asset.renditions[mask === "white" ? "mask_white" : "mask_black"]?.key;
16
- const cutKey = cropsPart(asset.crop) ? asset.renditions.crop?.key : void 0;
17
- return maskKey ?? asset.renditions.cutout?.key ?? cutKey ?? asset.key;
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 resolveImageAsset(id, asset, store, opts) {
20
- if (asset === void 0) {
21
- store.log?.warn({ id }, "resolve-asset-id: no image asset the render may reach; no asset");
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 (asset.kind !== "image") {
24
+ if (record.kind !== "image") {
25
25
  store.log?.warn({
26
26
  id,
27
- kind: asset.kind
28
- }, "resolve-asset-id: asset is not an image; no asset");
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(asset, opts?.mask);
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-asset-id: presign failed; no asset");
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 rect = framing.rect && typeof framing.rect === "object" ? normalizeRect(framing.rect) : null;
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) ?? (typeof framing.crop_key === "string" && framing.crop_key.length > 0 ? framing.crop_key : null);
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, readAssetId(v), framingCrop(v, at));
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, readAssetId(v), framingCrop(mobile, at, "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 = readAssetId(v);
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,10 +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 readAssetId(v) {
111
- return typeof v.asset_id === "string" ? v.asset_id : "";
81
+ function readMediaId(v) {
82
+ return contentMediaIdOf(v) ?? "";
112
83
  }
113
- async function resolveImageValue(value, assets, store, aspects) {
84
+ async function resolveImageValue(value, records, store, aspects) {
114
85
  if (value === null) return {
115
86
  value: null,
116
87
  desktopKey: null,
@@ -122,14 +93,13 @@ async function resolveImageValue(value, assets, store, aspects) {
122
93
  mobileKey: null
123
94
  };
124
95
  const v = value;
125
- const rect = v.rect && typeof v.rect === "object" ? normalizeRect(v.rect) : null;
126
96
  const ar = typeof v.ar === "number" ? v.ar : null;
127
- const photoId = readAssetId(v);
97
+ const photoId = readMediaId(v);
128
98
  const mask = v.mask === "white" || v.mask === "black" ? v.mask : null;
129
- const asset = photoId ? assets.get(photoId) : void 0;
99
+ const record = photoId ? records.get(photoId) : void 0;
130
100
  const at = aspects === void 0 ? void 0 : {
131
101
  aspects,
132
- imageAspect: imageAspectOf(asset, ar)
102
+ imageAspect: imageAspectOf(record, ar)
133
103
  };
134
104
  const mobileKey = photoId ? mobileCutKey(v, at) : null;
135
105
  const mobile = mobileKey ? await mobileCropUrl(mobileKey, store) : null;
@@ -144,12 +114,12 @@ async function resolveImageValue(value, assets, store, aspects) {
144
114
  alt
145
115
  };
146
116
  desktopKey = placedKey;
147
- const uncropped = await resolveImageAsset(photoId, asset, store);
117
+ const uncropped = await resolveImageMedia(photoId, record, store);
148
118
  if (uncropped && uncropped.url !== base.url) base.download_url = uncropped.url;
149
119
  } else if (photoId) {
150
- const served = await resolveImageAsset(photoId, asset, store, mask ? { mask } : void 0);
120
+ const served = await resolveImageMedia(photoId, record, store, mask ? { mask } : void 0);
151
121
  if (!served) return {
152
- value: withUnit(emptyImage(), v),
122
+ value: emptyImage(),
153
123
  desktopKey: null,
154
124
  mobileKey
155
125
  };
@@ -159,26 +129,22 @@ async function resolveImageValue(value, assets, store, aspects) {
159
129
  alt
160
130
  };
161
131
  desktopKey = served.source_key;
162
- } else if (typeof v.url === "string" && v.url.length > 0) {
163
- base = {
164
- photo_id: "",
165
- url: v.url,
166
- alt
167
- };
168
- desktopKey = null;
169
132
  } else return {
170
- value: withUnit(emptyImage(), v),
133
+ value: emptyImage(),
171
134
  desktopKey: null,
172
135
  mobileKey: null
173
136
  };
174
137
  return {
175
- value: withUnit(attach(base, rect, ar, mobile), v),
138
+ value: mobile ? {
139
+ ...base,
140
+ mobile
141
+ } : base,
176
142
  desktopKey,
177
143
  mobileKey: mobile ? mobileKey : null
178
144
  };
179
145
  }
180
- function imageAspectOf(asset, ar) {
181
- if (asset?.kind === "image" && asset.width !== null && asset.height !== null && asset.width > 0 && asset.height > 0) return asset.width / asset.height;
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;
182
148
  return ar !== null && ar > 0 ? ar : null;
183
149
  }
184
150
  async function attachResponsive(entries, store) {
@@ -196,31 +162,11 @@ async function attachResponsive(entries, store) {
196
162
  }
197
163
  }
198
164
  }
199
- async function resolveImageSlot(value, assets, store, aspects) {
200
- const entry = await resolveImageValue(value, assets, store, aspects);
165
+ async function resolveImageSlot(value, records, store, aspects) {
166
+ const entry = await resolveImageValue(value, records, store, aspects);
201
167
  await attachResponsive([entry], store);
202
168
  return entry.value;
203
169
  }
204
- function withUnit(resolved, v) {
205
- const unitId = v.unit_id;
206
- const unitLabel = v.unit_label;
207
- if (typeof unitId === "string") resolved.unit_id = unitId;
208
- else if (unitId === null) resolved.unit_id = null;
209
- if (typeof unitLabel === "string") resolved.unit_label = unitLabel;
210
- else if (unitLabel === null) resolved.unit_label = null;
211
- if ("floor_label" in v) {
212
- const floorLabel = typeof v.floor_label === "string" ? v.floor_label : null;
213
- resolved.floor_label = floorLabel;
214
- if (resolved.alt === "") resolved.alt = floorLabel ?? "Floor plan";
215
- }
216
- return resolved;
217
- }
218
- function attach(base, rect, ar, mobile) {
219
- if (rect) base.rect = rect;
220
- if (ar) base.ar = ar;
221
- if (mobile) base.mobile = mobile;
222
- return base;
223
- }
224
170
 
225
171
  //#endregion
226
- export { attachResponsive, emptyImage, mobileCutKey, normalizeRect, resolveImageAsset, resolveImageSlot, resolveImageValue, servedKeyOf, slotCutKey };
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, normalizeRect, resolveImageAsset, resolveImageSlot, resolveImageValue, servedKeyOf, slotCutKey } from "./image.js";
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";
@@ -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.assets, ctx.store, slotCropAspects(element?.crop)));
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.assets, ctx.store)))).filter((v) => v !== null);
44
- case "tour": return (await Promise.all(members.map((member) => resolveTourSlot(member, ctx.assets, ctx.store)))).filter((t) => t !== null);
45
- case "document": return (await Promise.all(members.map((member) => resolveDocumentSlot(member, ctx.assets, ctx.store)))).filter((d) => d !== null);
46
- case "media": return (await Promise.all(members.map((member) => resolveMediaSlot(member, element ?? {}, ctx.assets, ctx.store)))).filter((m) => m !== null);
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.assets, ctx.store, slotCropAspects(field.crop));
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.assets, ctx.store);
92
- case "tour": return resolveTourSlot(value, ctx.assets, ctx.store);
93
- case "document": return resolveDocumentSlot(value, ctx.assets, ctx.store);
94
- case "media": return resolveMediaSlot(value, field, ctx.assets, ctx.store);
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.assets, ctx.store, slotCropAspects(field.element?.crop)));
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, assets, store) {
10
+ async function resolveMediaSlot(value, declaration, records, store) {
10
11
  if (value === null || typeof value !== "object") return null;
11
- const assetId = value.asset_id;
12
- if (typeof assetId !== "string" || assetId === "") return null;
13
- const asset = assets.get(assetId);
14
- if (asset === void 0) {
15
- store.log?.warn({ asset_id: assetId }, "resolve-media-slot: no asset the render may reach");
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(asset.kind)) {
19
+ if (!declaredKinds(declaration).includes(record.kind)) {
19
20
  store.log?.warn({
20
- asset_id: assetId,
21
- kind: asset.kind
22
- }, "resolve-media-slot: asset is of a kind the slot does not hold");
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 = { asset_id: assetId };
26
- switch (asset.kind) {
26
+ const reference = { media: mediaId };
27
+ switch (record.kind) {
27
28
  case "image": {
28
- const image = await resolveImageSlot(value, assets, store, slotCropAspects(declaration.crop));
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, assets, store);
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, assets, store);
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, assets, store);
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(assets) {
3
- return new Map(Object.entries(assets ?? {}));
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.assets, ctx.store, slotCropAspects(slot.crop));
15
- case "video": return resolveVideoSlot(value, ctx.assets, ctx.store);
16
- case "tour": return resolveTourSlot(value, ctx.assets, ctx.store);
17
- case "document": return resolveDocumentSlot(value, ctx.assets, ctx.store);
18
- case "media": return resolveMediaSlot(value, slot, ctx.assets, ctx.store);
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;
@@ -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, assets, store) {
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 = typeof v.asset_id === "string" ? v.asset_id : "";
22
+ const tourId = contentMediaIdOf(v) ?? "";
22
23
  if (!tourId) return DEFAULT;
23
- const asset = assets.get(tourId);
24
- if (asset === void 0) {
25
- store.log?.warn({ tour_id: tourId }, "resolve-tour-slot: no tour asset the render may reach");
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 (asset.kind !== "tour") {
29
+ if (record.kind !== "tour") {
29
30
  store.log?.warn({
30
31
  tour_id: tourId,
31
- kind: asset.kind
32
- }, "resolve-tour-slot: asset is not a tour");
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(asset.url);
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 = asset.renditions.poster?.key ?? null;
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: asset.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, assets, store) {
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 = typeof v.asset_id === "string" ? v.asset_id : "";
22
+ const videoId = contentMediaIdOf(v) ?? "";
23
23
  if (!videoId) return DEFAULT;
24
- const asset = assets.get(videoId);
25
- if (asset === void 0) {
26
- store.log?.warn({ video_id: videoId }, "resolve-video-slot: no video asset the render may reach");
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 (asset.kind !== "video") {
29
+ if (record.kind !== "video") {
30
30
  store.log?.warn({
31
31
  video_id: videoId,
32
- kind: asset.kind
33
- }, "resolve-video-slot: asset is not a video");
32
+ kind: record.kind
33
+ }, "resolve-video-slot: media is not a video");
34
34
  return DEFAULT;
35
35
  }
36
- const posterKey = asset.renditions.poster?.key ?? null;
36
+ const posterKey = record.renditions.poster?.key ?? null;
37
37
  const alt = typeof v.alt === "string" ? v.alt : "";
38
38
  try {
39
- if (videoSourceOf(asset) === "link") {
40
- const url = asset.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 (asset.provider !== null) out.provider = asset.provider;
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 = asset.renditions.encode;
57
+ const encode = record.renditions.encode;
58
58
  if (encode === null) {
59
59
  store.log?.warn({
60
60
  video_id: videoId,
61
- state: asset.state
61
+ state: record.state
62
62
  }, "resolve-video-slot: no encode; poster-only");
63
- if (asset.state !== "failed") store.notePending?.({
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
 
@@ -178,6 +178,13 @@ const MediaReferenceSchema = z.object({
178
178
  crop: CropSchema.nullable().optional(),
179
179
  renditions: placeRenditions.partial().strict().optional()
180
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();
181
188
  const REGISTRIES = {
182
189
  property: propertyFacts,
183
190
  library: libraryFacts
@@ -86,11 +86,7 @@ const SECTION_CONTRACT_CATALOG = [
86
86
  },
87
87
  {
88
88
  id: "select",
89
- summary: "A select declares exactly one of values or options."
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",
@@ -1,4 +1,5 @@
1
- import { TABLES, isLegacyTable, tableBounds, tableForSlot } from "../../template-contracts/dist/slot-catalog.js";
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) {
@@ -9,8 +10,6 @@ function assertDirectlyLinkedListContract(schema, sectionKey) {
9
10
  if (slot.source?.kind !== "home") continue;
10
11
  const table = tableForSlot(slot);
11
12
  if (table === null) continue;
12
- const entry = isLegacyTable(table) ? TABLES[table] : null;
13
- 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.`);
14
13
  const inherited = tableBounds(table);
15
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}.`);
16
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}.`);
@@ -1,6 +1,8 @@
1
- import { SLOT_TYPES, tableKeyOf } from "../../template-contracts/dist/slot-catalog.js";
1
+ import { SLOT_TYPES } from "../../template-contracts/dist/slot-catalog.js";
2
2
  import { readMediaOf } from "../../template-contracts/dist/media-candidates.js";
3
+ import { tableOf } from "../../template-contracts/dist/registry-shape.js";
3
4
  import { isMediaListKey } from "../../template-contracts/dist/fact-keys.js";
5
+ import "../../template-contracts/dist/table-members.js";
4
6
  import { FINDABLE_KINDS, isFindableKind } from "../../template-contracts/dist/findable.js";
5
7
  import { listItemFieldsOf } from "../../template-contracts/dist/row-sources.js";
6
8
  import { readFillVerb } from "../../fill-vocabulary/dist/verbs.js";
@@ -19,7 +21,7 @@ function checkCandidates(of, where) {
19
21
  if (!isRecord(of)) throw new Error(`${where} picks \`of\` ${JSON.stringify(of)}, which is no list of candidates.`);
20
22
  if (of["type"] === "media") {
21
23
  const from = readMediaOf(of)?.from;
22
- if (from === void 0 || !from.every((list) => isMediaListKey(list))) throw new Error(`${where} picks \`of\` ${JSON.stringify(of)} — a media pick states the media list of the property it picks \`from\` and its \`kinds\`; a media slot with no \`from\` owns its asset, and nothing picks it.`);
24
+ if (from === void 0 || !from.every((list) => isMediaListKey(list))) throw new Error(`${where} picks \`of\` ${JSON.stringify(of)} — a media pick states the media list of the property it picks \`from\` and its \`kinds\`; a media slot with no \`from\` owns its media, and nothing picks it.`);
23
25
  return;
24
26
  }
25
27
  if (typeof of["type"] === "string") {
@@ -28,7 +30,7 @@ function checkCandidates(of, where) {
28
30
  return;
29
31
  }
30
32
  const { kind, key, section, slot, transform } = of;
31
- if (kind === "home" && typeof key === "string" && tableKeyOf(key) !== null) return;
33
+ if (kind === "home" && typeof key === "string" && tableOf(key) !== null) return;
32
34
  if (kind === "section" && typeof section === "string" && typeof slot === "string") return;
33
35
  if (kind === "derived" && typeof transform === "string") return;
34
36
  throw new Error(`${where} picks \`of\` ${JSON.stringify(of)}, which is not a list of candidates — a table, a media slot's \`from\` list, a list slot, a compute, or a select's values.`);
@@ -10,7 +10,6 @@ import { assertNestedSlotTypes } from "./nested-slot-contract.js";
10
10
  import { assertDirectlyLinkedListContract } from "./directly-linked-list-contract.js";
11
11
  import { assertFillVerbContract } from "./fill-verb-contract.js";
12
12
  import { assertObjectContract } from "./object-contract.js";
13
- import { assertOptionSourceContract } from "./option-source-contract.js";
14
13
  import { assertPoiCurationContract } from "./poi-curation-contract.js";
15
14
  import { assertReadsAcyclicContract } from "./reads-acyclic-contract.js";
16
15
  import { assertRowFillContract } from "./row-fill-contract.js";
@@ -1,4 +1,6 @@
1
- import { OBJECT_BINDING_OWN_KEYS, SLOT_TYPES, tableKeyOf } from "../../template-contracts/dist/slot-catalog.js";
1
+ import { OBJECT_BINDING_OWN_KEYS, SLOT_TYPES } from "../../template-contracts/dist/slot-catalog.js";
2
+ import { tableOf } from "../../template-contracts/dist/registry-shape.js";
3
+ import "../../template-contracts/dist/table-members.js";
2
4
  import { fillOf, grammarSlots, nestedItemOf } from "./grammar-scope.js";
3
5
 
4
6
  //#region ../../internal/section-contracts/dist/object-contract.js
@@ -67,7 +69,7 @@ function checkNestedField(ctx, field) {
67
69
  const where = `Section "${ctx.key}": "${field.path}"`;
68
70
  const source = field.def.source;
69
71
  if (source === void 0) return;
70
- if (source.kind === "element" && field.def.type === "row" && tableKeyOf(field.def.from) !== null) throw new Error(`${where} is a table's row holding the element — the element of a list inside an object is a member's item; hold it in a row \`from\` that member.`);
72
+ if (source.kind === "element" && field.def.type === "row" && tableOf(field.def.from) !== null) throw new Error(`${where} is a table's row holding the element — the element of a list inside an object is a member's item; hold it in a row \`from\` that member.`);
71
73
  if (source.kind === "element") return;
72
74
  if (field.def.type !== "row" && source.kind === "row" && typeof source.slot === "string" && field.siblings?.[source.slot]?.type === "row") return;
73
75
  throw new Error(`${where} is sourced by ${JSON.stringify(source)} — an item of a list inside an object reads its element, a row \`from\` its member, or a row beside it; ${NESTED_HOME}.`);
@@ -20,7 +20,7 @@ function assertRowFillContract(schema, decision, sectionKey) {
20
20
  if (!rowField) throw new Error(`Section "${sectionKey}": list fill "${decision.id}" field "${field}" is not a declared field of "${slotId}" (declared: ${declared.length > 0 ? declared.join(", ") : "none"}).`);
21
21
  if (rowField.source) throw new Error(`Section "${sectionKey}": list fill "${decision.id}" fills field "${field}" of "${slotId}", which is source-bound (source.kind "${rowField.source.kind ?? "?"}") — the fact bakes it; drop the decision.`);
22
22
  if (rowField.type === "row") continue;
23
- if (plannerForField(rowField) === void 0) throw new Error(`Section "${sectionKey}": list fill "${decision.id}" fills field "${field}" of "${slotId}" (type "${rowField.type}"), which no row can be filled with — a row field is written or picked inside the list's one batched call: text, a date, an email, a phone, a url, a select key, an asset, or a list of those.`);
23
+ if (plannerForField(rowField) === void 0) throw new Error(`Section "${sectionKey}": list fill "${decision.id}" fills field "${field}" of "${slotId}" (type "${rowField.type}"), which no row can be filled with — a row field is written or picked inside the list's one batched call: text, a date, an email, a phone, a url, a select key, a media value, or a list of those.`);
24
24
  }
25
25
  }
26
26
  }