@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.
Files changed (143) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/README.md +3 -3
  3. package/codemods/manifest.json +14 -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/check/stages/workspace.js +2 -0
  16. package/dist/cli/check/template-key.js +16 -0
  17. package/dist/cli/dev/workspace-reader.js +9 -2
  18. package/dist/fixtures/media-store.js +3 -3
  19. package/dist/fixtures/resolve.js +28 -23
  20. package/dist/fixtures/synthesize-empties.js +3 -1
  21. package/dist/fixtures.d.ts +1 -1
  22. package/dist/index.d.ts +3 -4
  23. package/dist/packages/external/concrete/package.js +1 -1
  24. package/dist/packages/internal/capture-settle/dist/island-markers.d.ts +1 -1
  25. package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +15 -27
  26. package/dist/packages/internal/fill-bake/dist/compute-reads.js +12 -12
  27. package/dist/packages/internal/fill-bake/dist/derive-source.js +7 -14
  28. package/dist/packages/internal/fill-bake/dist/index.js +4 -3
  29. package/dist/packages/internal/fill-bake/dist/item-merge.js +36 -16
  30. package/dist/packages/internal/fill-bake/dist/item-overrides.js +1 -28
  31. package/dist/packages/internal/fill-bake/dist/linked-merge.js +5 -7
  32. package/dist/packages/internal/fill-bake/dist/list-grammar.js +11 -34
  33. package/dist/packages/internal/fill-bake/dist/stored-row-reader.js +1 -0
  34. package/dist/packages/internal/fill-vocabulary/dist/resolved-decision.js +12 -39
  35. package/dist/packages/internal/fill-vocabulary/dist/verbs.js +2 -17
  36. package/dist/packages/internal/media-resolution/dist/document.js +16 -15
  37. package/dist/packages/internal/media-resolution/dist/image.js +38 -94
  38. package/dist/packages/internal/media-resolution/dist/index.js +1 -1
  39. package/dist/packages/internal/media-resolution/dist/list.js +12 -12
  40. package/dist/packages/internal/media-resolution/dist/media.js +17 -16
  41. package/dist/packages/internal/media-resolution/dist/records.js +4 -2
  42. package/dist/packages/internal/media-resolution/dist/slot.js +9 -6
  43. package/dist/packages/internal/media-resolution/dist/tour.js +12 -11
  44. package/dist/packages/internal/media-resolution/dist/video.js +16 -16
  45. package/dist/packages/internal/property-facts/dist/registry-facts.js +10 -2
  46. package/dist/packages/internal/section-contracts/dist/catalog.js +2 -10
  47. package/dist/packages/internal/section-contracts/dist/directly-linked-list-contract.js +5 -12
  48. package/dist/packages/internal/section-contracts/dist/fill-spec-view.js +1 -5
  49. package/dist/packages/internal/section-contracts/dist/fill-verb-contract.js +7 -5
  50. package/dist/packages/internal/section-contracts/dist/grammar-scope.js +1 -1
  51. package/dist/packages/internal/section-contracts/dist/index.js +0 -2
  52. package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +0 -29
  53. package/dist/packages/internal/section-contracts/dist/list-scalar-contract.js +2 -16
  54. package/dist/packages/internal/section-contracts/dist/nested-slot-contract.js +6 -6
  55. package/dist/packages/internal/section-contracts/dist/object-contract.js +4 -2
  56. package/dist/packages/internal/section-contracts/dist/poi-curation-contract.js +6 -2
  57. package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +1 -15
  58. package/dist/packages/internal/section-contracts/dist/row-rule-contract.js +6 -7
  59. package/dist/packages/internal/section-contracts/dist/row-source-contract.js +7 -8
  60. package/dist/packages/internal/section-contracts/dist/runners.js +5 -17
  61. package/dist/packages/internal/section-contracts/dist/select-contract.js +7 -1
  62. package/dist/packages/internal/section-contracts/dist/source-contract.js +20 -79
  63. package/dist/packages/internal/section-contracts/dist/sources-contract.js +1 -1
  64. package/dist/packages/internal/section-contracts/dist/table-member.js +5 -8
  65. package/dist/packages/internal/section-contracts/dist/writer-reads-fact-contract.js +5 -10
  66. package/dist/packages/internal/source-resolution/dist/index.js +21 -189
  67. package/dist/packages/internal/template-artifact/dist/index.js +2 -2
  68. package/dist/packages/internal/template-artifact/dist/layout.js +3 -1
  69. package/dist/packages/internal/template-artifact/dist/verify.js +32 -16
  70. package/dist/packages/internal/template-contracts/dist/content-pick.js +24 -1
  71. package/dist/packages/internal/template-contracts/dist/decision-fills.js +2 -6
  72. package/dist/packages/internal/template-contracts/dist/document-value.d.ts +2 -2
  73. package/dist/packages/internal/template-contracts/dist/fact-keys.d.ts +3 -2
  74. package/dist/packages/internal/template-contracts/dist/fact-keys.js +19 -43
  75. package/dist/packages/internal/template-contracts/dist/fact-registry.d.ts +24 -3
  76. package/dist/packages/internal/template-contracts/dist/fact-registry.js +14 -7
  77. package/dist/packages/internal/template-contracts/dist/fill-builders.d.ts +1 -1
  78. package/dist/packages/internal/template-contracts/dist/fill-spec-schema.js +3 -68
  79. package/dist/packages/internal/template-contracts/dist/fill-spec.js +7 -6
  80. package/dist/packages/internal/template-contracts/dist/list-editing.js +0 -1
  81. package/dist/packages/internal/template-contracts/dist/list.d.ts +1 -1
  82. package/dist/packages/internal/template-contracts/dist/list.js +7 -15
  83. package/dist/packages/internal/template-contracts/dist/media-candidates.js +1 -1
  84. package/dist/packages/internal/template-contracts/dist/mirror-kind.js +2 -2
  85. package/dist/packages/internal/template-contracts/dist/object.js +3 -2
  86. package/dist/packages/internal/template-contracts/dist/primitive-descriptors.js +2 -2
  87. package/dist/packages/internal/template-contracts/dist/process-builders.d.ts +2 -2
  88. package/dist/packages/internal/template-contracts/dist/read-graph.js +14 -51
  89. package/dist/packages/internal/template-contracts/dist/ref-locate.js +15 -27
  90. package/dist/packages/internal/template-contracts/dist/registry-facts.d.ts +3 -1
  91. package/dist/packages/internal/template-contracts/dist/registry-facts.js +13 -24
  92. package/dist/packages/internal/template-contracts/dist/registry-shape.d.ts +20 -4
  93. package/dist/packages/internal/template-contracts/dist/registry-shape.js +69 -11
  94. package/dist/packages/internal/template-contracts/dist/row-planners.js +1 -1
  95. package/dist/packages/internal/template-contracts/dist/row-ref.d.ts +5 -14
  96. package/dist/packages/internal/template-contracts/dist/row-ref.js +7 -23
  97. package/dist/packages/internal/template-contracts/dist/row-sources.js +6 -16
  98. package/dist/packages/internal/template-contracts/dist/row.d.ts +1 -1
  99. package/dist/packages/internal/template-contracts/dist/row.js +6 -7
  100. package/dist/packages/internal/template-contracts/dist/runtime-values.d.ts +5 -20
  101. package/dist/packages/internal/template-contracts/dist/section-schema-types.d.ts +1 -0
  102. package/dist/packages/internal/template-contracts/dist/slot-builders.d.ts +29 -37
  103. package/dist/packages/internal/template-contracts/dist/slot-builders.js +4 -7
  104. package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +2 -733
  105. package/dist/packages/internal/template-contracts/dist/slot-catalog.js +2 -502
  106. package/dist/packages/internal/template-contracts/dist/slot-overrides.js +4 -1
  107. package/dist/packages/internal/template-contracts/dist/slot-ref.d.ts +4 -4
  108. package/dist/packages/internal/template-contracts/dist/slot-types.js +1 -2
  109. package/dist/packages/internal/template-contracts/dist/slot-value.d.ts +9 -10
  110. package/dist/packages/internal/template-contracts/dist/table-members.d.ts +5 -12
  111. package/dist/packages/internal/template-contracts/dist/table-members.js +7 -37
  112. package/dist/packages/internal/template-contracts/dist/tour-value.d.ts +2 -2
  113. package/dist/primitives/Image.d.ts +3 -3
  114. package/dist/primitives/slot-bindings.js +2 -2
  115. package/dist/primitives/slot-download.d.ts +1 -1
  116. package/dist/primitives/slot-media.d.ts +1 -1
  117. package/dist/rules/registry.js +6 -0
  118. package/dist/schema/fact.d.ts +19 -52
  119. package/dist/schema/fact.js +6 -25
  120. package/dist/schema/facts-view.d.ts +1 -2
  121. package/dist/schema/property-facts.d.ts +1 -62
  122. package/dist/schema/section-schema.d.ts +2 -2
  123. package/dist/schema/section-schema.js +1 -1
  124. package/dist/section/section.d.ts +2 -2
  125. package/guide/reference/cli/INDEX.md +2 -2
  126. package/guide/reference/cli/build.md +1 -1
  127. package/guide/reference/cli/check.md +1 -1
  128. package/guide/reference/cli/dev.md +1 -1
  129. package/guide/reference/cli/property-add.md +1 -1
  130. package/guide/reference/cli/property-list.md +1 -1
  131. package/guide/reference/cli/publish.md +1 -1
  132. package/guide/reference/cli/upgrade.md +1 -1
  133. package/guide/reference/rules/INDEX.md +4 -5
  134. package/package.json +1 -1
  135. package/dist/artifact/playground/client/assets/index-BUmdDDX5.js +0 -1259
  136. package/dist/artifact/playground/client/assets/index-DDOcM0zA.css +0 -1
  137. package/dist/packages/internal/fill-vocabulary/dist/row-reads.js +0 -15
  138. package/dist/packages/internal/section-contracts/dist/group-contract.js +0 -19
  139. package/dist/packages/internal/section-contracts/dist/option-source-contract.js +0 -22
  140. package/dist/packages/internal/template-contracts/dist/comparable-address.js +0 -19
  141. package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +0 -62
  142. package/dist/packages/internal/template-contracts/dist/legacy-facts.js +0 -167
  143. package/dist/packages/internal/template-contracts/dist/registry-aliases.js +0 -77
@@ -1,15 +1,11 @@
1
1
  import { rowTableOf } from "../../template-contracts/dist/ref-locate.js";
2
- import { listItemFieldsOf, memberSourceOf } from "../../template-contracts/dist/row-sources.js";
2
+ import { memberSourceOf } from "../../template-contracts/dist/row-sources.js";
3
3
  import { holderOf } from "../../fill-vocabulary/dist/holder.js";
4
- import { impliedVerbOf } from "../../fill-vocabulary/dist/verbs.js";
5
4
  import { elementIsFact, grammarSlots, producedSlot, slotInScope } from "./grammar-scope.js";
6
- import { plannedFieldsOf } from "./fill-spec-view.js";
7
5
 
8
6
  //#region ../../internal/section-contracts/dist/writer-reads-fact-contract.js
9
- function writes(node, slot, planned = []) {
10
- if (node.verb !== void 0) return node.verb === "write";
11
- if (slot === void 0) return false;
12
- return impliedVerbOf(slot, planned) === "write" && holderOf(slot).shape !== "objects";
7
+ function writes(node) {
8
+ return node.verb === "write";
13
9
  }
14
10
  function readsAFact(reads, rowsAreFacts, memberIsFact) {
15
11
  return (reads ?? []).some((ref) => {
@@ -44,10 +40,9 @@ function assertWriterReadsFactContract(schema, decision, sectionKey, fillSpec =
44
40
  if (slot === void 0) continue;
45
41
  const holder = holderOf(slot);
46
42
  if (holder.shape === "objects" && holder.bound !== void 0) rowsAreFacts = true;
47
- if (decision.verb === void 0 && (decision.kind === "text" || decision.kind === "number") || writes(fill, slot, plannedFieldsOf(decision))) writing.push(slotId);
48
- const itemFields = listItemFieldsOf(slot);
43
+ if (writes(fill)) writing.push(slotId);
49
44
  for (const [field, node] of Object.entries(fill.fields ?? {})) {
50
- if (writes(node, itemFields?.[field])) writing.push(`${slotId}.${field}`);
45
+ if (writes(node)) writing.push(`${slotId}.${field}`);
51
46
  const reader = scoped.find((s) => s.place === "item-field" && s.path === `${slotId}.${field}`);
52
47
  if (readsAFact(node.reads, rowsAreFacts, memberIsFact(reader))) fieldsReadAFact = true;
53
48
  }
@@ -1,20 +1,11 @@
1
1
  import { addressMember, isAddressMember, normalizeAddressValue } from "../../template-contracts/dist/address-value.js";
2
- import { FACT_GRAPH, FACT_PROJECTIONS, REFERRAL_FIELDS, REFERRAL_IMAGE_FIELDS, SOURCE_FIELDS, TABLES, tableKeyOf } from "../../template-contracts/dist/slot-catalog.js";
3
- import { memberValueType, tableColumnOfKey } from "../../template-contracts/dist/registry-shape.js";
4
- import { elementIdentityKey } from "../../template-contracts/dist/ref-locate.js";
5
- import { isMediaListKey, isRegistryFactKey, readRegistryFact, registryPropertyRoot } from "../../template-contracts/dist/fact-keys.js";
6
- import { rowIdentityKey, tableFields, tableRowMember } from "../../template-contracts/dist/table-members.js";
2
+ import { memberValueType, tableColumnOfKey, tableOf } from "../../template-contracts/dist/registry-shape.js";
3
+ import { isMediaListKey, isRegistryFactKey, readRegistryFact } from "../../template-contracts/dist/fact-keys.js";
4
+ import { tableFields, tableRowMember } from "../../template-contracts/dist/table-members.js";
7
5
  import { elementRowKeys, rowMemberSources } from "../../template-contracts/dist/row-sources.js";
8
- import { readLegacyFact, readLegacyRows } from "../../template-contracts/dist/legacy-facts.js";
9
6
 
10
7
  //#region ../../internal/source-resolution/dist/index.js
11
- function tableKey(table) {
12
- return typeof table === "string" ? {
13
- table,
14
- reading: "legacy"
15
- } : table;
16
- }
17
- function registryTableRows(table, facts) {
8
+ function tableRows(table, facts) {
18
9
  const addresses = Object.entries(tableFields(table)).filter(([, declaration]) => memberValueType(declaration) === "address").map(([name]) => name);
19
10
  return facts[table].map((item) => {
20
11
  const row = { ...item };
@@ -22,104 +13,8 @@ function registryTableRows(table, facts) {
22
13
  return row;
23
14
  });
24
15
  }
25
- function contactsOf(facts) {
26
- return readLegacyRows(facts, "contacts");
27
- }
28
- const REFERRAL_FIELD_SET = new Set(REFERRAL_FIELDS);
29
- const REFERRAL_IMAGE_FIELD_SET = new Set(REFERRAL_IMAGE_FIELDS);
30
- const LOGO_VARIANT_FALLBACK = {
31
- logo_dark: {
32
- other: "logo_light",
33
- mask: "black"
34
- },
35
- logo_light: {
36
- other: "logo_dark",
37
- mask: "white"
38
- }
39
- };
40
- function resolveContactCardField(contact, field) {
41
- if (!REFERRAL_FIELD_SET.has(field)) return null;
42
- const raw = contact?.[field] ?? null;
43
- if (REFERRAL_IMAGE_FIELD_SET.has(field)) {
44
- const assetId = typeof raw === "string" && raw.trim().length > 0 ? raw.trim() : null;
45
- if (assetId !== null) return { asset_id: assetId };
46
- const fb = LOGO_VARIANT_FALLBACK[field];
47
- if (fb !== void 0) {
48
- const otherRaw = contact?.[fb.other] ?? null;
49
- const otherId = typeof otherRaw === "string" && otherRaw.trim().length > 0 ? otherRaw.trim() : null;
50
- if (otherId !== null) return {
51
- asset_id: otherId,
52
- mask: fb.mask
53
- };
54
- }
55
- return null;
56
- }
57
- if (raw === null || raw === void 0) return "";
58
- return typeof raw === "string" ? raw : String(raw);
59
- }
60
- const PRIMARY_CONTACT_FACT_TO_CONTACT_MEMBER = {
61
- primary_contact_name: "name",
62
- primary_contact_title: "title",
63
- primary_contact_bio: "bio",
64
- primary_contact_email: "email",
65
- primary_contact_phone: "phone",
66
- primary_contact_address: "address",
67
- primary_contact_website_url: "website",
68
- primary_contact_avatar_upload_id: "headshot",
69
- primary_contact_logo_dark_upload_id: "logo_dark",
70
- primary_contact_logo_light_upload_id: "logo_light",
71
- primary_contact_instagram_url: "instagram",
72
- primary_contact_linkedin_url: "linkedin",
73
- primary_contact_x_url: "x",
74
- primary_contact_facebook_url: "facebook"
75
- };
76
- function primaryContactFactValue(facts, factKey) {
77
- const key = PRIMARY_CONTACT_FACT_TO_CONTACT_MEMBER[factKey];
78
- if (key === void 0) return void 0;
79
- const raw = contactsOf(facts)[0]?.[key] ?? null;
80
- return typeof raw === "string" ? raw : null;
81
- }
82
- function tableRowsOf(table, facts) {
83
- const key = tableKey(table);
84
- return key.reading === "legacy" ? readLegacyRows(facts, key.table) : registryTableRows(key.table, facts);
85
- }
86
- const CONTACT_MEMBER_FACT = Object.fromEntries(Object.entries(FACT_GRAPH.contacts.row).filter(([, member]) => member.primary === true).map(([name]) => [name, FACT_PROJECTIONS.contact[name] ?? name]));
87
- function mediaRefOf(raw) {
88
- if (typeof raw !== "string") return null;
89
- const assetId = raw.trim();
90
- return assetId.length > 0 ? { asset_id: assetId } : null;
91
- }
92
- function mediaRefListOf(raw) {
93
- if (!Array.isArray(raw)) return [];
94
- return [...raw].sort((a, b) => (typeof a["position"] === "number" ? a["position"] : 0) - (typeof b["position"] === "number" ? b["position"] : 0)).flatMap((element) => {
95
- const ref = mediaRefOf(element["id"]);
96
- if (ref === null) return [];
97
- if ("floor_label" in element) ref.floor_label = typeof element["floor_label"] === "string" ? element["floor_label"] : null;
98
- return [ref];
99
- });
100
- }
101
- function readMemberOf(table, row, member) {
102
- const key = tableKey(table);
103
- if (key.reading === "legacy") return readLegacyMemberOf(key.table, row, member);
104
- return readRegistryMemberOf(key.table, row, member);
105
- }
106
- function readLegacyMemberOf(table, row, member) {
107
- const descriptor = FACT_GRAPH[table].row[member];
108
- if (descriptor === void 0) return null;
109
- if (table === "contacts") {
110
- const fact = CONTACT_MEMBER_FACT[member];
111
- if (fact !== void 0) return resolveContactScalar(row, fact);
112
- }
113
- const raw = row[member] ?? null;
114
- if (descriptor.value_type === "image") return mediaRefOf(raw);
115
- if (descriptor.value_type === "image_list") return mediaRefListOf(raw);
116
- return raw;
117
- }
118
- function readRegistryMemberOf(table, row, path) {
119
- const lookup = tableRowMember({
120
- table,
121
- reading: "registry"
122
- }, path);
16
+ function readMemberOf(table, row, path) {
17
+ const lookup = tableRowMember(table, path);
123
18
  if (lookup.kind === "identity") return row["id"] ?? null;
124
19
  if (lookup.kind === "unknown") return null;
125
20
  const dot = path.indexOf(".");
@@ -128,102 +23,39 @@ function readRegistryMemberOf(table, row, path) {
128
23
  return isAddressMember(part) ? addressMember(row[path.slice(0, dot)], part) : null;
129
24
  }
130
25
  function tableRowIds(table, facts) {
131
- const idKey = rowIdentityKey(tableKey(table));
132
- return tableRowsOf(table, facts).flatMap((row) => {
133
- const id = row[idKey];
134
- return typeof id === "string" ? [id] : [];
135
- });
26
+ return tableRows(table, facts).map((row) => row.id);
136
27
  }
137
28
  function tableRowById(table, id, facts) {
138
- const idKey = rowIdentityKey(tableKey(table));
139
- return tableRowsOf(table, facts).find((row) => row[idKey] === id);
29
+ return tableRows(table, facts).find((row) => row.id === id);
140
30
  }
141
31
  function readRowMember(table, id, member, facts) {
142
32
  const row = tableRowById(table, id, facts);
143
33
  return row === void 0 ? null : readMemberOf(table, row, member);
144
34
  }
145
35
  function projectTableRows(table, facts, fields, rowComputes = {}, ids) {
146
- const key = tableKey(table);
147
- const idKey = elementIdentityKey(key.table);
148
- const rowId = rowIdentityKey(key);
149
- const members = rowMemberSources(fields);
150
36
  const elementRows = elementRowKeys(fields);
151
- return (ids === void 0 ? tableRowsOf(table, facts) : ids.flatMap((id) => {
37
+ return projectRows(table, facts, rowMemberSources(fields), elementRows, rowComputes, ids);
38
+ }
39
+ function projectRows(table, facts, members, elementRows, rowComputes, ids) {
40
+ return (ids === void 0 ? tableRows(table, facts) : ids.flatMap((id) => {
152
41
  const row = tableRowById(table, id, facts);
153
42
  return row === void 0 ? [] : [row];
154
43
  })).map((row) => {
155
- const out = { [idKey]: row[rowId] };
156
- for (const field of elementRows) out[field] = row[rowId];
157
- for (const [field, member] of Object.entries(members)) out[field] = readMemberOf(key, row, member);
158
- for (const [field, compute] of Object.entries(rowComputes)) out[field] = compute((member) => readMemberOf(key, row, member), row[rowId]);
44
+ const out = { id: row.id };
45
+ for (const field of elementRows) out[field] = row.id;
46
+ for (const [field, member] of Object.entries(members)) out[field] = readMemberOf(table, row, member);
47
+ for (const [field, compute] of Object.entries(rowComputes)) out[field] = compute((member) => readMemberOf(table, row, member), row.id);
159
48
  return out;
160
49
  });
161
50
  }
162
- function firstUnit(facts) {
163
- return tableRowsOf("units", facts)[0];
164
- }
165
- function resolveUnitScalar(unit, field) {
166
- switch (field) {
167
- case "beds": return unit?.beds ?? null;
168
- case "baths": return unit?.baths ?? null;
169
- case "sqft": return unit?.sqft ?? null;
170
- case "price": return unit?.price ?? null;
171
- case "unit_label": return unit?.unit_label ?? null;
172
- default: return null;
173
- }
174
- }
175
- function resolvePropertyScalar(facts, field) {
176
- const address = readLegacyFact(facts, "address");
177
- if (field === "address") {
178
- if (address && typeof address === "object") return address.display ?? null;
179
- return address;
180
- }
181
- const part = ADDRESS_PARTS[field];
182
- if (part !== void 0) return readAddressPart(address, part);
183
- const virtual = primaryContactFactValue(facts, field);
184
- if (virtual !== void 0) return virtual;
185
- return readLegacyFact(facts, field);
186
- }
187
- const CONTACT_FIELD_TO_CONTACT_MEMBER = Object.fromEntries(Object.entries(CONTACT_MEMBER_FACT).map(([member, fact]) => [fact, member]));
188
- function resolveContactScalar(contact, field) {
189
- if (REFERRAL_FIELD_SET.has(field)) return resolveContactCardField(contact, field);
190
- const key = CONTACT_FIELD_TO_CONTACT_MEMBER[field];
191
- if (key === void 0) return null;
192
- const raw = contact?.[key] ?? null;
193
- if (typeof raw !== "string") return null;
194
- const trimmed = raw.trim();
195
- return trimmed.length > 0 ? trimmed : null;
196
- }
197
51
  function readFactRef(facts, key) {
198
- if (isRegistryFactKey(key)) return readRegistryFact(key, registryPropertyRoot(facts));
52
+ if (isRegistryFactKey(key)) return readRegistryFact(key, facts);
199
53
  if (isMediaListKey(key)) return facts[key.slice(9)];
200
- const table = tableKeyOf(key);
201
- if (table?.reading === "registry") return registryTableRows(table.table, facts);
54
+ const table = tableOf(key);
55
+ if (table !== null) return tableRows(table, facts);
202
56
  const column = tableColumnOfKey(key);
203
- if (column !== null) return registryTableRows(column.table, facts).map((row) => row[column.member] ?? null);
204
- return readLegacyFact(facts, key);
205
- }
206
- function readFrom(field, ctx) {
207
- if (isRegistryFactKey(field)) return readFactRef(ctx.facts, field);
208
- const desc = SOURCE_FIELDS[field];
209
- if (!desc) return null;
210
- if (Object.hasOwn(TABLES, field)) return null;
211
- if (desc.container === "contact") return resolveContactScalar(ctx.contact ?? contactsOf(ctx.facts)[0], field);
212
- if (desc.container === "unit") return resolveUnitScalar(ctx.unit ?? firstUnit(ctx.facts), field);
213
- return resolvePropertyScalar(ctx.facts, field);
214
- }
215
- const ADDRESS_PARTS = {
216
- address_street: "street",
217
- address_unit: "unit",
218
- address_city: "city",
219
- address_state: "state",
220
- address_postal: "postal"
221
- };
222
- function readAddressPart(address, part) {
223
- if (!address || typeof address !== "object") return null;
224
- const trimmed = (address[part] ?? "").trim();
225
- return trimmed.length > 0 ? trimmed : null;
57
+ if (column !== null) return tableRows(column.table, facts).map((row) => row[column.member] ?? null);
226
58
  }
227
59
 
228
60
  //#endregion
229
- export { primaryContactFactValue, projectTableRows, readFactRef, readFrom, readRowMember, registryTableRows, resolveContactCardField, tableRowById, tableRowIds };
61
+ export { projectTableRows, readFactRef, readRowMember, tableRowById, tableRowIds, tableRows };
@@ -1,7 +1,7 @@
1
- import { ASSETS_DIR, ASSET_URL_PREFIX, CAPTURES_DIR, CAPTURE_FILES, FIXTURES_DIR, FIXTURE_FILES, MANIFEST_FILE, PLAYGROUND_CLIENT_DIR, PLAYGROUND_DIR, PLAYGROUND_FILES, SECTIONS_DIR, SECTION_FILES, SECTION_ISLANDS_DIR, STATIC_DIR, TEMPLATE_DIR, TEMPLATE_FILES, UNHASHED_DIRS, assetPath, boundFiles, capturePath, fixturePath, isFixtureId, isSectionKey, isTemplateKey, islandPath, playgroundPath, publishedSectionKey, sectionDir, sectionOfIslandKey, sectionPath, staticPath, templatePath } from "./layout.js";
1
+ import { ASSETS_DIR, ASSET_URL_PREFIX, CAPTURES_DIR, CAPTURE_FILES, FIXTURES_DIR, FIXTURE_FILES, FIXTURE_OPTIONAL_FILES, MANIFEST_FILE, PLAYGROUND_CLIENT_DIR, PLAYGROUND_DIR, PLAYGROUND_FILES, SECTIONS_DIR, SECTION_FILES, SECTION_ISLANDS_DIR, STATIC_DIR, STORED_DIRS, TEMPLATE_DIR, TEMPLATE_FILES, UNHASHED_DIRS, assetPath, boundFiles, capturePath, fixturePath, isFixtureId, isSectionKey, isTemplateKey, islandPath, playgroundPath, publishedSectionKey, sectionDir, sectionOfIslandKey, sectionPath, staticPath, templatePath } from "./layout.js";
2
2
  import { sha256Hex } from "./sha256.js";
3
3
  import { listingDigest, sectionContentHash, sourceDigest, templateContentHash } from "./hash.js";
4
4
  import { ArtifactManifest, ArtifactScope, ArtifactSection, readArtifactSchema } from "./manifest.js";
5
5
  import { verifyArtifact } from "./verify.js";
6
6
 
7
- export { ASSET_URL_PREFIX, ArtifactManifest, CAPTURE_FILES, FIXTURES_DIR, FIXTURE_FILES, MANIFEST_FILE, PLAYGROUND_CLIENT_DIR, PLAYGROUND_DIR, PLAYGROUND_FILES, SECTION_FILES, TEMPLATE_FILES, assetPath, capturePath, fixturePath, isFixtureId, isSectionKey, isTemplateKey, islandPath, playgroundPath, publishedSectionKey, sectionContentHash, sectionDir, sectionPath, sourceDigest, staticPath, templateContentHash, templatePath, verifyArtifact };
7
+ export { ASSET_URL_PREFIX, ArtifactManifest, CAPTURE_FILES, FIXTURES_DIR, FIXTURE_FILES, FIXTURE_OPTIONAL_FILES, MANIFEST_FILE, PLAYGROUND_CLIENT_DIR, PLAYGROUND_DIR, PLAYGROUND_FILES, SECTION_FILES, TEMPLATE_FILES, assetPath, capturePath, fixturePath, isFixtureId, isSectionKey, isTemplateKey, islandPath, playgroundPath, publishedSectionKey, sectionContentHash, sectionDir, sectionPath, sourceDigest, staticPath, templateContentHash, templatePath, verifyArtifact };
@@ -14,11 +14,13 @@ const UNHASHED_DIRS = [
14
14
  PLAYGROUND_DIR,
15
15
  CAPTURES_DIR
16
16
  ];
17
+ const STORED_DIRS = [ASSETS_DIR, CAPTURES_DIR];
17
18
  const FIXTURE_FILES = {
18
19
  contentDoc: "content-doc.json",
19
20
  property: "property.json",
20
21
  meta: "meta.json"
21
22
  };
23
+ const FIXTURE_OPTIONAL_FILES = { settledDoc: "settled-doc.json" };
22
24
  const CAPTURE_FILES = {
23
25
  bundle: "bundle.zip",
24
26
  document: "document.pdf"
@@ -122,4 +124,4 @@ function boundFiles(binding) {
122
124
  }
123
125
 
124
126
  //#endregion
125
- export { ASSETS_DIR, ASSET_URL_PREFIX, CAPTURES_DIR, CAPTURE_FILES, FIXTURES_DIR, FIXTURE_FILES, MANIFEST_FILE, PLAYGROUND_CLIENT_DIR, PLAYGROUND_DIR, PLAYGROUND_FILES, SECTIONS_DIR, SECTION_FILES, SECTION_ISLANDS_DIR, STATIC_DIR, TEMPLATE_DIR, TEMPLATE_FILES, UNHASHED_DIRS, assetPath, boundFiles, capturePath, fixturePath, isFixtureId, isSectionKey, isTemplateKey, islandPath, playgroundPath, publishedSectionKey, sectionDir, sectionOfIslandKey, sectionPath, staticPath, templatePath };
127
+ export { ASSETS_DIR, ASSET_URL_PREFIX, CAPTURES_DIR, CAPTURE_FILES, FIXTURES_DIR, FIXTURE_FILES, FIXTURE_OPTIONAL_FILES, MANIFEST_FILE, PLAYGROUND_CLIENT_DIR, PLAYGROUND_DIR, PLAYGROUND_FILES, SECTIONS_DIR, SECTION_FILES, SECTION_ISLANDS_DIR, STATIC_DIR, STORED_DIRS, TEMPLATE_DIR, TEMPLATE_FILES, UNHASHED_DIRS, assetPath, boundFiles, capturePath, fixturePath, isFixtureId, isSectionKey, isTemplateKey, islandPath, playgroundPath, publishedSectionKey, sectionDir, sectionOfIslandKey, sectionPath, staticPath, templatePath };
@@ -1,4 +1,4 @@
1
- import { ASSETS_DIR, ASSET_URL_PREFIX, FIXTURES_DIR, FIXTURE_FILES, MANIFEST_FILE, PLAYGROUND_CLIENT_DIR, PLAYGROUND_DIR, PLAYGROUND_FILES, SECTIONS_DIR, SECTION_FILES, SECTION_ISLANDS_DIR, STATIC_DIR, TEMPLATE_DIR, TEMPLATE_FILES, UNHASHED_DIRS, boundFiles, fixturePath, playgroundPath, sectionPath, templatePath } from "./layout.js";
1
+ import { ASSETS_DIR, ASSET_URL_PREFIX, FIXTURES_DIR, FIXTURE_FILES, FIXTURE_OPTIONAL_FILES, MANIFEST_FILE, PLAYGROUND_CLIENT_DIR, PLAYGROUND_DIR, PLAYGROUND_FILES, SECTIONS_DIR, SECTION_FILES, SECTION_ISLANDS_DIR, STATIC_DIR, STORED_DIRS, TEMPLATE_DIR, TEMPLATE_FILES, UNHASHED_DIRS, boundFiles, fixturePath, playgroundPath, sectionPath, templatePath } from "./layout.js";
2
2
  import { sha256Hex } from "./sha256.js";
3
3
  import { sectionContentHash, templateContentHash } from "./hash.js";
4
4
  import { ArtifactManifest, readArtifactSchema } from "./manifest.js";
@@ -11,7 +11,7 @@ const TEMPLATE_FILE_NAMES = /* @__PURE__ */ new Set([...Object.values(TEMPLATE_F
11
11
  const ISLAND_CHUNK = new RegExp(`^${SECTION_ISLANDS_DIR}/[A-Za-z0-9._-]+\\.mjs$`);
12
12
  const FLAT_FILE = /^[A-Za-z0-9._-]+$/;
13
13
  const CLIENT_SEGMENT = /^(?!\.{1,2}$)[A-Za-z0-9._-]+$/;
14
- const FIXTURE_FILE_NAMES = new Set(Object.values(FIXTURE_FILES));
14
+ const FIXTURE_FILE_NAMES = /* @__PURE__ */ new Set([...Object.values(FIXTURE_FILES), ...Object.values(FIXTURE_OPTIONAL_FILES)]);
15
15
  const ASSET_URL = new RegExp(`${ASSET_URL_PREFIX.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&")}([A-Za-z0-9._-]+)`, "g");
16
16
  function readJson(files, path, problems) {
17
17
  const bytes = files.get(path);
@@ -47,8 +47,17 @@ function composedSections(composition) {
47
47
  }
48
48
  return keys;
49
49
  }
50
- function verifyArtifact(files) {
50
+ function verifyArtifact(files, stored = /* @__PURE__ */ new Map()) {
51
51
  const problems = [];
52
+ const present = (path) => files.has(path) || stored.has(path);
53
+ for (const path of stored.keys()) if (files.has(path)) problems.push({
54
+ path,
55
+ message: "is carried both as bytes and as a stored file"
56
+ });
57
+ else if (!STORED_DIRS.includes(path.split("/")[0])) problems.push({
58
+ path,
59
+ message: `is held as a stored file, which only ${STORED_DIRS.map((dir) => `${dir}/`).join(" and ")} may be`
60
+ });
52
61
  const raw = readJson(files, MANIFEST_FILE, problems);
53
62
  if (raw === null) return {
54
63
  manifest: null,
@@ -78,7 +87,7 @@ function verifyArtifact(files) {
78
87
  }
79
88
  const manifest = parsed.data;
80
89
  const listed = new Set(manifest.sections.map((section) => section.key));
81
- for (const path of files.keys()) {
90
+ for (const path of [...files.keys(), ...stored.keys()]) {
82
91
  if (path === "manifest.json") continue;
83
92
  const slash = path.indexOf("/");
84
93
  const top = slash < 0 ? path : path.slice(0, slash);
@@ -135,13 +144,16 @@ function verifyArtifact(files) {
135
144
  path: playgroundPath(file),
136
145
  message: "missing"
137
146
  });
138
- for (const id of manifest.fixtures) for (const file of Object.values(FIXTURE_FILES)) {
139
- const path = fixturePath(id, file);
140
- if (readJson(files, path, problems) === null) continue;
141
- for (const match of decoder.decode(files.get(path)).matchAll(ASSET_URL)) if (!files.has(`${"assets"}/${match[1]}`)) problems.push({
142
- path,
143
- message: `names ${match[0]}, which ${ASSETS_DIR}/ does not carry`
144
- });
147
+ for (const id of manifest.fixtures) {
148
+ const optional = Object.values(FIXTURE_OPTIONAL_FILES).filter((file) => files.has(fixturePath(id, file)));
149
+ for (const file of [...Object.values(FIXTURE_FILES), ...optional]) {
150
+ const path = fixturePath(id, file);
151
+ if (readJson(files, path, problems) === null) continue;
152
+ for (const match of decoder.decode(files.get(path)).matchAll(ASSET_URL)) if (!present(`${"assets"}/${match[1]}`)) problems.push({
153
+ path,
154
+ message: `names ${match[0]}, which ${ASSETS_DIR}/ does not carry`
155
+ });
156
+ }
145
157
  }
146
158
  const sectionHashes = /* @__PURE__ */ new Map();
147
159
  for (const section of manifest.sections) {
@@ -219,14 +231,18 @@ function verifyArtifact(files) {
219
231
  for (const file of bound ?? []) {
220
232
  boundPaths.add(file.path);
221
233
  const bytes = files.get(file.path);
222
- if (bytes === void 0) problems.push({
234
+ const digest = stored.get(file.path)?.sha256;
235
+ if (bytes === void 0 && digest === void 0) problems.push({
223
236
  path: file.path,
224
237
  message: `named by the binding as ${file.filename}, and missing`
225
238
  });
226
- else if (file.contentHash !== void 0 && sha256Hex(bytes) !== file.contentHash) problems.push({
227
- path: file.path,
228
- message: `the binding states content hash ${file.contentHash} for ${file.filename}; the bytes hash to ${sha256Hex(bytes)}`
229
- });
239
+ else if (file.contentHash !== void 0) {
240
+ const actual = digest ?? sha256Hex(bytes);
241
+ if (actual !== file.contentHash) problems.push({
242
+ path: file.path,
243
+ message: `the binding states content hash ${file.contentHash} for ${file.filename}; the bytes hash to ${actual}`
244
+ });
245
+ }
230
246
  }
231
247
  if (bound !== void 0) for (const path of files.keys()) {
232
248
  const parts = path.split("/");
@@ -4,6 +4,29 @@ import "./fact-registry.js";
4
4
 
5
5
  //#region ../../internal/template-contracts/dist/content-pick.js
6
6
  const DEFAULT_SLOT_ASPECT = 16 / 10;
7
+ function storedCrop(crop) {
8
+ if (crop === null || typeof crop !== "object") return null;
9
+ const box = crop;
10
+ const [x, y, width, height] = [
11
+ "x",
12
+ "y",
13
+ "width",
14
+ "height"
15
+ ].map((key) => box[key]);
16
+ if (![
17
+ x,
18
+ y,
19
+ width,
20
+ height
21
+ ].every((n) => typeof n === "number" && Number.isFinite(n))) return null;
22
+ if (x === 0 && y === 0 && width === 1 && height === 1) return null;
23
+ return {
24
+ x,
25
+ y,
26
+ width,
27
+ height
28
+ };
29
+ }
7
30
  function slotCropAspects(crop) {
8
31
  if (crop === null || typeof crop !== "object") return {
9
32
  mode: "free",
@@ -48,4 +71,4 @@ function placeCrop(stored, imageAspect, aspects, framing) {
48
71
  }
49
72
 
50
73
  //#endregion
51
- export { DEFAULT_SLOT_ASPECT, defaultCrop, placeCrop, sameCrop, slotCropAspects };
74
+ export { DEFAULT_SLOT_ASPECT, defaultCrop, placeCrop, sameCrop, slotCropAspects, storedCrop };
@@ -11,15 +11,11 @@ function isRecord(value) {
11
11
  return value !== null && typeof value === "object" && !Array.isArray(value);
12
12
  }
13
13
  function decisionFills(node) {
14
- if (!isRecord(node)) return [];
15
- if (Array.isArray(node["fills"])) return node["fills"].filter(isRecord).map((fill) => ({
14
+ if (!isRecord(node) || !Array.isArray(node["fills"])) return [];
15
+ return node["fills"].filter(isRecord).map((fill) => ({
16
16
  ...fill,
17
17
  kind: "fill"
18
18
  }));
19
- if (node["verb"] === void 0 && node["brief"] === void 0) return [];
20
- const fill = { kind: "fill" };
21
- for (const key of WIRE_FILL_KEYS) if (node[key] !== void 0) fill[key] = node[key];
22
- return [fill];
23
19
  }
24
20
  function isHomeRef(value) {
25
21
  return isRecord(value) && value["kind"] === "home" && typeof value["key"] === "string";
@@ -10,7 +10,7 @@ import { ResponsiveImage } from "./responsive-image.js";
10
10
  * poster.
11
11
  */
12
12
  type DocumentValue = {
13
- /** The `intake.upload` row this slot points at — the whole stored value. */
13
+ /** The media this slot points at — the whole stored value. */
14
14
  asset_id: string;
15
15
  /**
16
16
  * Served source — the editor gets a presigned URL, a published page gets the
@@ -32,7 +32,7 @@ type DocumentValue = {
32
32
  * The first page's preview URL, or `''` when there is none — a preview is
33
33
  * rendered after the upload lands, and only for a PDF. Named like a video's
34
34
  * and a tour's poster because it plays the same part: the still `<Slot.Image>`
35
- * draws for a slot whose asset is not itself an image.
35
+ * draws for a slot whose media is not itself an image.
36
36
  */
37
37
  poster: string;
38
38
  /** The preview's responsive ladder, when one exists. Absent, `<Image>` falls back to `poster`. */
@@ -2,6 +2,7 @@ import { AddressMember, AddressValue } from "./address-value.js";
2
2
  import { MediaKind } from "./slot-catalog.js";
3
3
  import { PropertyFactRegistry } from "./fact-registry.js";
4
4
  import { MediaReference } from "./registry-facts.js";
5
+ import "./section-schema-types.js";
5
6
  //#region ../../internal/template-contracts/dist/fact-keys.d.ts
6
7
  type PropertyPages = PropertyFactRegistry["pages"];
7
8
  type PageName = keyof PropertyPages & string;
@@ -21,7 +22,7 @@ type AddressRegistryFactKey = `property.${AddressPageName}`;
21
22
  /**
22
23
  * The value a fact ref or a bound slot receives for registry key `K` — `readFacts`'
23
24
  * (./registry-shape) reading of its declaration, typed: an address its value, a part
24
- * its part, a number a number, an image its media reference (a read hands its asset's
25
+ * its part, a number a number, an image its media reference (a read hands its media
25
26
  * record), every other scalar text.
26
27
  */
27
28
  type RegistryFactValue<K extends RegistryFactKey> = K extends `${AddressRegistryFactKey}.${infer M extends AddressMember}` ? AddressValue[M] : K extends `property.${infer P extends FactPageName}` ? DeclarationOf<P> extends {
@@ -38,7 +39,7 @@ type MediaListName = { [P in PageName]: DeclarationOf<P> extends {
38
39
  readonly type: MediaKind | "media";
39
40
  };
40
41
  } ? P : never; }[PageName];
41
- /** A media list's registry key — what a media declaration's `from` names and a `compute()` reads as its assets' records. */
42
+ /** A media list's registry key — what a media declaration's `from` names and a `compute()` reads as its media records. */
42
43
  type MediaListKey = `property.${MediaListName}`;
43
44
  //#endregion
44
45
  export { AddressRegistryFactKey, MediaListKey, MediaListName, RegistryFactKey, RegistryFactValue };
@@ -1,8 +1,7 @@
1
1
  import { normalizeAddressValue } from "./address-value.js";
2
- import { FACT_GRAPH, SOURCE_FIELDS, declaredKinds, tableKeyOf } from "./slot-catalog.js";
2
+ import { declaredKinds } from "./slot-catalog.js";
3
3
  import { mediaIdOf } from "./registry-facts.js";
4
- import { mediaListKeysOf, registryFactsOf, tableColumnOfKey } from "./registry-shape.js";
5
- import { legacyFactKey } from "./registry-aliases.js";
4
+ import { mediaListKeysOf, registryFactsOf, tableColumnOfKey, tableOf } from "./registry-shape.js";
6
5
  import { propertyFacts } from "./fact-registry.js";
7
6
 
8
7
  //#region ../../internal/template-contracts/dist/fact-keys.js
@@ -20,19 +19,6 @@ function registryFact(key) {
20
19
  function registryFactValueType(key) {
21
20
  return registryFact(key).value_type;
22
21
  }
23
- function sourceFieldDescriptor(field) {
24
- const fields = SOURCE_FIELDS;
25
- if (!isRegistryFactKey(field)) {
26
- const legacy = legacyFactKey(field);
27
- return Object.hasOwn(fields, legacy) ? fields[legacy] : void 0;
28
- }
29
- const value_type = registryFactValueType(field);
30
- return {
31
- container: "property",
32
- value_type,
33
- ...value_type === "image" ? { image: true } : {}
34
- };
35
- }
36
22
  function mediaListKeys() {
37
23
  return mediaListKeysOf(propertyFacts);
38
24
  }
@@ -45,19 +31,12 @@ function mediaListKinds(key) {
45
31
  return element === void 0 ? void 0 : declaredKinds(element);
46
32
  }
47
33
  function isReadableFactKey(key) {
48
- if (isRegistryFactKey(key) || isMediaListKey(key) || tableKeyOf(key) !== null || tableColumnOfKey(key) !== null) return true;
49
- return Object.hasOwn(FACT_GRAPH, key);
34
+ return isRegistryFactKey(key) || isMediaListKey(key) || tableOf(key) !== null || tableColumnOfKey(key) !== null;
50
35
  }
51
- function registryPropertyRoot(facts) {
52
- return {
53
- address: facts.address,
54
- lat: facts.address.latitude,
55
- lon: facts.address.longitude,
56
- listing_intent: facts.listing_intent,
57
- description: facts.description,
58
- hero: facts.hero,
59
- site_url: facts.site_url
60
- };
36
+ function factSelectValues(key) {
37
+ if (!isRegistryFactKey(key)) return void 0;
38
+ const declaration = registryFact(key).declaration;
39
+ return declaration.type === "select" ? declaration.values : void 0;
61
40
  }
62
41
  function text(value) {
63
42
  return typeof value === "string" ? value : null;
@@ -66,23 +45,20 @@ function mediaRef(value) {
66
45
  const id = mediaIdOf(value);
67
46
  return id === void 0 ? null : { media: id };
68
47
  }
69
- function readRegistryFact(key, root) {
70
- switch (key) {
71
- case "property.listing_intent": return text(root.listing_intent);
72
- case "property.description": return text(root.description);
73
- case "property.hero": return mediaRef(root.hero);
74
- case "property.site_url": return text(root.site_url);
75
- default: {
76
- const address = normalizeAddressValue({
77
- ...root.address !== null && typeof root.address === "object" ? root.address : {},
78
- latitude: root.lat,
79
- longitude: root.lon
80
- });
81
- if (key === "property.address") return address;
82
- return address === null ? null : address[key.slice(17)];
48
+ function readRegistryFact(key, facts) {
49
+ const [, name = "", part] = key.split(".");
50
+ const value = facts[name];
51
+ switch (registryFactValueType(`property.${name}`)) {
52
+ case "address": {
53
+ const address = normalizeAddressValue(value);
54
+ if (part === void 0) return address;
55
+ return address === null ? null : address[part];
83
56
  }
57
+ case "image": return mediaRef(value);
58
+ case "number": return typeof value === "number" ? value : null;
59
+ case "text": return text(value);
84
60
  }
85
61
  }
86
62
 
87
63
  //#endregion
88
- export { isMediaListKey, isReadableFactKey, isRegistryFactKey, legacyFactKey, mediaListKeys, mediaListKinds, readRegistryFact, registryFact, registryFactKeys, registryFactValueType, registryPropertyRoot, sourceFieldDescriptor };
64
+ export { factSelectValues, isMediaListKey, isReadableFactKey, isRegistryFactKey, mediaListKeys, mediaListKinds, readRegistryFact, registryFact, registryFactKeys, registryFactValueType };