@homepages/concrete 9.0.0 → 9.1.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 (67) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +2 -2
  3. package/codemods/manifest.json +4 -0
  4. package/dist/artifact/playground/client/assets/index-BOYbgBnP.js +1259 -0
  5. package/dist/artifact/playground/client/index.html +1 -1
  6. package/dist/artifact/playground/host.mjs +24 -24
  7. package/dist/cli/check/stages/workspace.js +2 -0
  8. package/dist/cli/check/template-key.js +16 -0
  9. package/dist/fixtures/resolve.js +4 -7
  10. package/dist/packages/external/concrete/package.js +1 -1
  11. package/dist/packages/internal/capture-settle/dist/island-markers.d.ts +1 -1
  12. package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +8 -22
  13. package/dist/packages/internal/fill-bake/dist/compute-reads.js +4 -8
  14. package/dist/packages/internal/fill-bake/dist/derive-source.js +7 -14
  15. package/dist/packages/internal/fill-bake/dist/index.js +3 -2
  16. package/dist/packages/internal/fill-bake/dist/item-merge.js +4 -10
  17. package/dist/packages/internal/fill-bake/dist/item-overrides.js +1 -28
  18. package/dist/packages/internal/fill-bake/dist/linked-merge.js +1 -3
  19. package/dist/packages/internal/fill-bake/dist/list-grammar.js +10 -11
  20. package/dist/packages/internal/fill-bake/dist/stored-row-reader.js +1 -0
  21. package/dist/packages/internal/fill-vocabulary/dist/resolved-decision.js +11 -38
  22. package/dist/packages/internal/fill-vocabulary/dist/verbs.js +2 -17
  23. package/dist/packages/internal/media-resolution/dist/image.js +6 -8
  24. package/dist/packages/internal/media-resolution/dist/list.js +1 -1
  25. package/dist/packages/internal/media-resolution/dist/slot.js +4 -1
  26. package/dist/packages/internal/media-resolution/dist/tour.js +1 -1
  27. package/dist/packages/internal/media-resolution/dist/video.js +1 -1
  28. package/dist/packages/internal/property-facts/dist/registry-facts.js +2 -1
  29. package/dist/packages/internal/section-contracts/dist/catalog.js +1 -5
  30. package/dist/packages/internal/section-contracts/dist/directly-linked-list-contract.js +4 -10
  31. package/dist/packages/internal/section-contracts/dist/fill-spec-view.js +1 -5
  32. package/dist/packages/internal/section-contracts/dist/fill-verb-contract.js +2 -2
  33. package/dist/packages/internal/section-contracts/dist/grammar-scope.js +1 -1
  34. package/dist/packages/internal/section-contracts/dist/index.js +0 -1
  35. package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +0 -29
  36. package/dist/packages/internal/section-contracts/dist/list-scalar-contract.js +2 -16
  37. package/dist/packages/internal/section-contracts/dist/nested-slot-contract.js +6 -6
  38. package/dist/packages/internal/section-contracts/dist/poi-curation-contract.js +6 -2
  39. package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +0 -14
  40. package/dist/packages/internal/section-contracts/dist/row-rule-contract.js +3 -6
  41. package/dist/packages/internal/section-contracts/dist/runners.js +4 -9
  42. package/dist/packages/internal/section-contracts/dist/source-contract.js +10 -73
  43. package/dist/packages/internal/section-contracts/dist/writer-reads-fact-contract.js +5 -10
  44. package/dist/packages/internal/source-resolution/dist/index.js +7 -8
  45. package/dist/packages/internal/template-contracts/dist/decision-fills.js +2 -6
  46. package/dist/packages/internal/template-contracts/dist/fact-registry.js +4 -4
  47. package/dist/packages/internal/template-contracts/dist/fill-spec-schema.js +3 -68
  48. package/dist/packages/internal/template-contracts/dist/list-editing.js +0 -1
  49. package/dist/packages/internal/template-contracts/dist/media-candidates.js +1 -1
  50. package/dist/packages/internal/template-contracts/dist/primitive-descriptors.js +2 -2
  51. package/dist/packages/internal/template-contracts/dist/read-graph.js +9 -19
  52. package/dist/packages/internal/template-contracts/dist/ref-locate.js +8 -24
  53. package/dist/packages/internal/template-contracts/dist/registry-facts.d.ts +2 -0
  54. package/dist/packages/internal/template-contracts/dist/row-ref.d.ts +2 -8
  55. package/dist/packages/internal/template-contracts/dist/row-sources.js +3 -13
  56. package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +1 -32
  57. package/dist/packages/internal/template-contracts/dist/slot-catalog.js +0 -4
  58. package/dist/packages/internal/template-contracts/dist/slot-types.js +1 -2
  59. package/dist/packages/internal/template-contracts/dist/slot-value.d.ts +7 -9
  60. package/dist/primitives/slot-bindings.js +2 -2
  61. package/dist/rules/registry.js +6 -0
  62. package/dist/section/section.d.ts +2 -2
  63. package/guide/reference/rules/INDEX.md +2 -2
  64. package/package.json +1 -1
  65. package/dist/artifact/playground/client/assets/index-BUmdDDX5.js +0 -1259
  66. package/dist/packages/internal/fill-vocabulary/dist/row-reads.js +0 -15
  67. package/dist/packages/internal/section-contracts/dist/group-contract.js +0 -19
@@ -4,6 +4,7 @@ import { loadFixtures } from "../../../fixtures/load.js";
4
4
  import { listSourcePaths } from "../../build/source.js";
5
5
  import { crlfTextViolations } from "../line-endings.js";
6
6
  import { unportableNameViolations } from "../portable-names.js";
7
+ import { templateKeyViolations } from "../template-key.js";
7
8
 
8
9
  //#region src/cli/check/stages/workspace.ts
9
10
  async function workspaceStage(ctx) {
@@ -11,6 +12,7 @@ async function workspaceStage(ctx) {
11
12
  ctx.workspace = workspace;
12
13
  const violations = [...workspace.violations, ...await crlfTextViolations(ctx.root)];
13
14
  if (workspace.template !== null) {
15
+ violations.push(...templateKeyViolations(workspace.template, TEMPLATE_FILE));
14
16
  try {
15
17
  ctx.discovered = await discoverSections({
16
18
  root: ctx.root,
@@ -0,0 +1,16 @@
1
+ //#region src/cli/check/template-key.ts
2
+ function templateKeyForName(name) {
3
+ return name.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean).join("-");
4
+ }
5
+ function templateKeyViolations(template, module) {
6
+ const expected = templateKeyForName(template.name);
7
+ if (template.key === expected) return [];
8
+ return [{
9
+ rule: "workspace/key-not-name",
10
+ file: module,
11
+ message: `The template key "${template.key}" does not spell its name "${template.name}"; the key is the name in lowercase kebab-case, "${expected}". Renaming a published template's key makes it a different template in the catalog: rename the stored key with it, or pick a name that spells the key.`
12
+ }];
13
+ }
14
+
15
+ //#endregion
16
+ export { templateKeyForName, templateKeyViolations };
@@ -1,7 +1,7 @@
1
1
  import { normalizeAddressValue } from "../packages/internal/template-contracts/dist/address-value.js";
2
2
  import { REGISTRY_TABLE_KEYS, declaredKinds, isEmailValue, isIsoDateValue, isMediaType, isPhoneValue } from "../packages/internal/template-contracts/dist/slot-catalog.js";
3
3
  import { getComputed } from "../packages/internal/template-contracts/dist/compute.js";
4
- import { elementIdentityKey, heldRowTableOf, listTableOf, placementOf, rowTablesOf } from "../packages/internal/template-contracts/dist/ref-locate.js";
4
+ import { heldRowTableOf, listTableOf, placementOf, rowTablesOf } from "../packages/internal/template-contracts/dist/ref-locate.js";
5
5
  import { fillSpecFromSchema } from "../schema/extract-fill-spec.js";
6
6
  import { elementRowKeys, listSourceOf, memberSourceOf } from "../packages/internal/template-contracts/dist/row-sources.js";
7
7
  import { objectFieldSlotId } from "../packages/internal/template-contracts/dist/slot-overrides.js";
@@ -212,15 +212,13 @@ function statedValue(fill, def, path, value, holds) {
212
212
  if (!Array.isArray(value)) return void 0;
213
213
  const fields = def.element.fields;
214
214
  const table = filledListTable(def);
215
- const identityKey = elementIdentityKey(table?.table ?? null);
216
215
  const elementRows = elementRowKeys(fields);
217
216
  return value.map((item, i) => {
218
217
  const record = isRecord(item) ? item : {};
219
218
  const out = statedFields(fill, fields, path, record, false);
220
219
  const held = elementRows.map((key) => record[key]).find((id) => typeof id === "string" && id !== "");
221
- const id = table === null ? record["id"] ?? `${path}-${String(i + 1)}` : held ?? record[identityKey] ?? record["id"];
222
220
  return {
223
- [identityKey]: id,
221
+ id: table === null ? record["id"] ?? `${path}-${String(i + 1)}` : held ?? record["id"],
224
222
  ...out
225
223
  };
226
224
  });
@@ -277,13 +275,12 @@ function fieldValue(def, path, baked, stated, decisions) {
277
275
  }
278
276
  function itemsValue(def, path, items, stated, decisions) {
279
277
  const fields = def.element?.fields ?? {};
280
- const identityKey = elementIdentityKey(listTableOf({ slots: {} }, def)?.table ?? null);
281
278
  const statedItems = Array.isArray(stated) ? stated.filter(isRecord) : [];
282
279
  const byIdentity = listSourceOf(def).kind === "none" && memberSourceOf(def.source) === null;
283
280
  return items.map((item, i) => {
284
281
  const baked = isRecord(item) ? item : {};
285
- const statedItem = byIdentity ? statedItems.find((candidate) => candidate[identityKey] === baked[identityKey]) : statedItems[i];
286
- const out = { [identityKey]: baked[identityKey] };
282
+ const statedItem = byIdentity ? statedItems.find((candidate) => candidate["id"] === baked["id"]) : statedItems[i];
283
+ const out = { id: baked["id"] };
287
284
  for (const [key, field] of Object.entries(fields)) out[key] = fieldValue(field, `${path}.${key}`, Object.hasOwn(baked, key) ? { value: baked[key] } : void 0, statedItem?.[key], decisions);
288
285
  return out;
289
286
  });
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "9.0.0";
2
+ var version = "9.1.0";
3
3
 
4
4
  //#endregion
5
5
  export { version };
@@ -1,5 +1,5 @@
1
1
  //#region ../../internal/capture-settle/dist/island-markers.d.ts
2
- /** Island key on the marker: `<section-key>:<ComponentName>`, e.g. `spw-essential/floorplan:UnitFilter`. */
2
+ /** Island key on the marker: `<section-key>:<ComponentName>`, e.g. `legacy-website/floorplan:UnitFilter`. */
3
3
  declare const ATTR_ISLAND_KEY = "data-tr-island";
4
4
  /**
5
5
  * The window property holding the page's OPEN capture holds, as a
@@ -1,13 +1,13 @@
1
1
  import { normalizeAddressValue } from "../../template-contracts/dist/address-value.js";
2
2
  import { DISPLAY_ENTRIES, tableKeyOf } from "../../template-contracts/dist/slot-catalog.js";
3
3
  import { storedAsRefs } from "../../template-contracts/dist/registry-facts.js";
4
- import { attributedRows, elementIdentity, heldRowTableOf, holderOf, isHolderKind, listTableOf, rowTablesOf } from "../../template-contracts/dist/ref-locate.js";
5
- import { elementRowKeys, listSourceOf, memberSourceOf, rowMemberSources } from "../../template-contracts/dist/row-sources.js";
4
+ import { attributedRows, heldRowTableOf, holderOf, isHolderKind, listTableOf, rowTablesOf } from "../../template-contracts/dist/ref-locate.js";
5
+ import { elementRowKeys, listSourceOf, memberSourceOf } from "../../template-contracts/dist/row-sources.js";
6
6
  import { objectFieldOf, objectFieldSlotId } from "../../template-contracts/dist/slot-overrides.js";
7
7
  import { projectTableRows, readFrom, tableRowIds } from "../../source-resolution/dist/index.js";
8
8
  import { callDerived, readsAnySlot } from "./derive-source.js";
9
9
  import { declaredDisplay } from "./display.js";
10
- import { computedRow, contentIdentities, decisionProducing, isGrammarList, nestedItemOf, objectElementFields, projectElements, projectNestedList, readNestedMember, readResolvedRowMember, storedElements } from "./list-grammar.js";
10
+ import { computedRow, contentIdentities, decisionProducing, isGrammarList, nestedItemOf, objectElementFields, projectElements, projectNestedList, readNestedMember, readResolvedRowMember, rowIdentity, storedElements } from "./list-grammar.js";
11
11
 
12
12
  //#region ../../internal/fill-bake/dist/bake-property-ref.js
13
13
  function boundFactKey(def) {
@@ -79,7 +79,7 @@ function bakeValueSlot(path, def, facts, ctx, bakeRows) {
79
79
  }
80
80
  const dField = boundFactKey(def);
81
81
  if (dField !== null) try {
82
- return { value: resolveDirectField(dField, facts, def.fields, rowComputesOf(path, def.fields, facts, ctx, itemScopeAt(bakeRows, path))) };
82
+ return { value: resolveDirectField(dField, facts) };
83
83
  } catch {
84
84
  return { value: null };
85
85
  }
@@ -87,12 +87,11 @@ function bakeValueSlot(path, def, facts, ctx, bakeRows) {
87
87
  if (derived !== null) {
88
88
  if (readsAnySlot(def.source)) return void 0;
89
89
  const resolved = resolveDerivedHandle(derived.transform, def.source, facts, ctx, { slot_id: path }, void 0, rowReaderOf(rowInScope, facts));
90
- return { value: resolved === null ? null : projectComputedRows(resolved.value, def.fields, rowComputesOf(path, def.fields, facts, ctx, itemScopeAt(bakeRows, path))) };
90
+ return { value: resolved === null ? null : resolved.value };
91
91
  }
92
92
  }
93
93
  function rowReaderOf(rowInScope, facts) {
94
94
  return (member, slot) => {
95
- if (slot === void 0) throw new Error(`reads the row member "${member}" outside a record list's row`);
96
95
  const row = rowInScope(slot);
97
96
  return row === void 0 ? void 0 : readResolvedRowMember(row, member, facts);
98
97
  };
@@ -221,7 +220,7 @@ function bakeGrammarList(path, def, facts, ctx, scope, bakeRows) {
221
220
  function identifiedElements(value, table) {
222
221
  const elements = Array.isArray(value) ? value : [];
223
222
  if (table !== null) return elements.flatMap((element) => {
224
- const id = elementIdentity(element, table);
223
+ const id = rowIdentity(element, table);
225
224
  return id === null ? [] : [{
226
225
  element: id,
227
226
  id
@@ -263,7 +262,7 @@ function rowComputesOf(listKey, fields, facts, ctx, around) {
263
262
  if (derived === null) continue;
264
263
  computes[fieldKey] = (readItemRow, element) => {
265
264
  const readRow = (member, slot) => {
266
- if (slot === void 0 || elementRows.has(slot)) return readItemRow(member);
265
+ if (elementRows.has(slot)) return readItemRow(member);
267
266
  const row = rowInScope(slot);
268
267
  return row === void 0 ? void 0 : readResolvedRowMember(row, member, facts);
269
268
  };
@@ -272,19 +271,6 @@ function rowComputesOf(listKey, fields, facts, ctx, around) {
272
271
  }
273
272
  return computes;
274
273
  }
275
- function projectComputedRows(value, fields, rowComputes) {
276
- if (!Array.isArray(value) || fields === void 0) return value;
277
- const members = rowMemberSources(fields);
278
- return value.map((computed) => {
279
- const computedRow = computed !== null && typeof computed === "object" ? computed : {};
280
- const readMember = (member) => computedRow[member] ?? null;
281
- const out = {};
282
- if (typeof computedRow["id"] === "string") out["id"] = computedRow["id"];
283
- for (const [key, member] of Object.entries(members)) out[key] = readMember(member);
284
- for (const [key, compute] of Object.entries(rowComputes)) out[key] = compute(readMember);
285
- return out;
286
- });
287
- }
288
274
  function resolveDerivedHandle(derivedHandle, source, facts, ctx, target, readSlot, readRow, readElement) {
289
275
  const authored = ctx?.computed[derivedHandle];
290
276
  try {
@@ -334,4 +320,4 @@ function inDeclaredCases(def, entry, value, ctx) {
334
320
  }
335
321
 
336
322
  //#endregion
337
- export { bakeDisplayEntries, bakePropertyRefSlots, boundFactKey, derivedSource, identifiedElements, inDeclaredCases, projectComputedRows, resolveDerivedHandle, resolveDirectField, rowComputesOf, topLevelRowReader };
323
+ export { bakeDisplayEntries, bakePropertyRefSlots, boundFactKey, derivedSource, identifiedElements, inDeclaredCases, resolveDerivedHandle, resolveDirectField, rowComputesOf, topLevelRowReader };
@@ -1,16 +1,15 @@
1
1
  import { normalizeAddressValue } from "../../template-contracts/dist/address-value.js";
2
2
  import { DISPLAY_ENTRIES } from "../../template-contracts/dist/slot-catalog.js";
3
- import { elementIdentityKey, heldRowTableOf, holderOf, mirrorRefOf, rowTablesOf, sectionSlotAt, slotTableOf } from "../../template-contracts/dist/ref-locate.js";
3
+ import { heldRowTableOf, holderOf, mirrorRefOf, rowTablesOf, sectionSlotAt, slotTableOf } from "../../template-contracts/dist/ref-locate.js";
4
4
  import { memberSourceOf } from "../../template-contracts/dist/row-sources.js";
5
5
  import { isSlotOverridden, itemOverridesForSlot, objectFieldOf, objectFieldSlotId } from "../../template-contracts/dist/slot-overrides.js";
6
6
  import { declaredSlotRefs } from "./derive-source.js";
7
7
  import { declaredDisplay } from "./display.js";
8
8
  import { computedRow, isGrammarList, objectElementFields, projectElements, readResolvedRowMember } from "./list-grammar.js";
9
- import { identifiedElements, inDeclaredCases, projectComputedRows, resolveDerivedHandle, rowComputesOf } from "./bake-property-ref.js";
9
+ import { identifiedElements, inDeclaredCases, resolveDerivedHandle, rowComputesOf } from "./bake-property-ref.js";
10
10
  import { isDisplayOverridden } from "../../template-contracts/dist/display-overrides.js";
11
11
  import { mergeLinkedValue } from "./linked-merge.js";
12
12
  import { mergeSourcedItems } from "./item-merge.js";
13
- import { keepOverriddenItemFields } from "./item-overrides.js";
14
13
 
15
14
  //#region ../../internal/fill-bake/dist/compute-reads.js
16
15
  const DISPLAY_PREFIX = "display.";
@@ -96,7 +95,6 @@ function applyComputeReads(input) {
96
95
  freshSource: items,
97
96
  overrides: itemOverridesForSlot(inst.slot_overrides, decl.key),
98
97
  generatedFields: [],
99
- idKey: elementIdentityKey(table?.table ?? null),
100
98
  membership: "source"
101
99
  });
102
100
  };
@@ -129,7 +127,6 @@ function applyComputeReads(input) {
129
127
  }, slot)?.path;
130
128
  };
131
129
  const rowReaderOf = (decl) => (member, slot) => {
132
- if (slot === void 0) throw new Error(`reads the row member "${member}" outside a list's item`);
133
130
  const path = holderPath(decl, slot);
134
131
  return path === void 0 ? void 0 : memberAt(decl.instanceId, path, member)?.value;
135
132
  };
@@ -163,9 +160,8 @@ function applyComputeReads(input) {
163
160
  return { value: listValue(inst, decl, table, items) };
164
161
  }
165
162
  const isList = decl.def.type === "list";
166
- const fresh = resolved === null ? isList ? [] : null : projectComputedRows(resolved.value ?? (isList ? [] : null), decl.def.fields, rowComputesOf(decl.key, decl.def.fields, facts, decl.section.bakeContext));
167
- const stored = storedRefValue(inst, decl.key);
168
- return { value: keepOverriddenItemFields(mergeLinkedValue(stored, fresh), stored, itemOverridesForSlot(inst.slot_overrides, decl.key)) };
163
+ const fresh = resolved === null ? isList ? [] : null : resolved.value ?? (isList ? [] : null);
164
+ return { value: mergeLinkedValue(storedRefValue(inst, decl.key), fresh) };
169
165
  };
170
166
  const write = (decl) => {
171
167
  const inst = working.get(decl.instanceId);
@@ -17,23 +17,16 @@ function sectionRefOf(entry) {
17
17
  }
18
18
  function declaredReads(source) {
19
19
  return readsOf(source).map((entry, i) => {
20
- const record = entry ?? {};
21
- const { kind, key, field } = record;
20
+ const { kind, key, slot, field } = entry ?? {};
22
21
  if (kind === "home" && typeof key === "string") return {
23
22
  kind: "home",
24
23
  key
25
24
  };
26
- if (kind === "row" && typeof field === "string") {
27
- const { slot } = record;
28
- return typeof slot === "string" && slot !== "" ? {
29
- kind: "row",
30
- slot,
31
- field
32
- } : {
33
- kind: "row",
34
- field
35
- };
36
- }
25
+ if (kind === "row" && typeof slot === "string" && slot !== "" && typeof field === "string") return {
26
+ kind: "row",
27
+ slot,
28
+ field
29
+ };
37
30
  if (kind === "element") return { kind: "element" };
38
31
  const sectionRef = sectionRefOf(entry);
39
32
  if (sectionRef !== null) return sectionRef;
@@ -51,7 +44,7 @@ function callDerived(fn, source, facts, readSlot, readRow, readElement) {
51
44
  if (ref.kind === "home") return readFactRef(facts, ref.key);
52
45
  if (ref.kind === "row") {
53
46
  if (readRow === void 0) throw new Error(`reads the row member "${ref.field}" with no row in scope`);
54
- return "slot" in ref ? readRow(ref.field, ref.slot) : readRow(ref.field);
47
+ return readRow(ref.field, ref.slot);
55
48
  }
56
49
  if (ref.kind === "element") {
57
50
  if (readElement === void 0) throw new Error("reads the element outside a list's item");
@@ -2,10 +2,11 @@ import { projectTableRows, readFactRef, readRowMember } from "../../source-resol
2
2
  import { callDerived, declaredReads, declaredSlotRefs, readsAnySlot } from "./derive-source.js";
3
3
  import { declaredDisplay } from "./display.js";
4
4
  import { decisionProducing, isGrammarList, objectElementFields, readResolvedRowMember, readsElementRows, rowIdentity } from "./list-grammar.js";
5
- import { bakeDisplayEntries, bakePropertyRefSlots, boundFactKey, derivedSource, identifiedElements, projectComputedRows, resolveDerivedHandle, resolveDirectField, rowComputesOf, topLevelRowReader } from "./bake-property-ref.js";
5
+ import { bakeDisplayEntries, bakePropertyRefSlots, boundFactKey, derivedSource, identifiedElements, resolveDerivedHandle, resolveDirectField, rowComputesOf, topLevelRowReader } from "./bake-property-ref.js";
6
6
  import { mergeLinkedValue } from "./linked-merge.js";
7
7
  import { mergeSourcedItems } from "./item-merge.js";
8
- import { keepOverriddenItemFields } from "./item-overrides.js";
9
8
  import { applyComputeReads, storedRefValue } from "./compute-reads.js";
9
+ import "./item-overrides.js";
10
+ import "./stored-row-reader.js";
10
11
 
11
12
  export { applyComputeReads, bakeDisplayEntries, bakePropertyRefSlots };
@@ -2,14 +2,6 @@ import { mergeLinkedValue } from "./linked-merge.js";
2
2
 
3
3
  //#region ../../internal/fill-bake/dist/item-merge.js
4
4
  const isTempId = (id) => typeof id === "string" && id.startsWith("tmp_");
5
- function spelledUnder(idKey, cur) {
6
- if (idKey === "id" || typeof cur[idKey] === "string" || typeof cur["id"] !== "string") return cur;
7
- const { id, ...rest } = cur;
8
- return {
9
- [idKey]: id,
10
- ...rest
11
- };
12
- }
13
5
  function oneItemPerIdentity(idKey, current) {
14
6
  const out = [];
15
7
  const at = /* @__PURE__ */ new Map();
@@ -42,12 +34,14 @@ function mergeItem(cur, fresh, itemOverrides, generatedFields, idKey, keepUnbake
42
34
  }
43
35
  function mergeSourcedItems(input) {
44
36
  const membership = input.membership ?? "table";
45
- const current = oneItemPerIdentity(input.idKey, input.current.map((cur) => spelledUnder(input.idKey, cur)));
37
+ const idKey = input.idKey ?? "id";
38
+ const current = oneItemPerIdentity(idKey, input.current);
46
39
  if (membership === "table") return mergeTableItems({
47
40
  ...input,
41
+ idKey,
48
42
  current
49
43
  });
50
- const { freshSource, overrides, generatedFields, idKey } = input;
44
+ const { freshSource, overrides, generatedFields } = input;
51
45
  const currentById = /* @__PURE__ */ new Map();
52
46
  for (const cur of current) {
53
47
  const id = cur[idKey];
@@ -1,28 +1 @@
1
- import { elementIdentity } from "../../template-contracts/dist/ref-locate.js";
2
-
3
- //#region ../../internal/fill-bake/dist/item-overrides.js
4
- function asEntry(value) {
5
- return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
6
- }
7
- function keepOverriddenItemFields(fresh, stored, marked) {
8
- if (!Array.isArray(fresh) || !Array.isArray(stored) || Object.keys(marked).length === 0) return fresh;
9
- const storedById = /* @__PURE__ */ new Map();
10
- for (const value of stored) {
11
- const entry = asEntry(value);
12
- const id = elementIdentity(entry);
13
- if (entry !== null && id !== null) storedById.set(id, entry);
14
- }
15
- return fresh.map((value) => {
16
- const entry = asEntry(value);
17
- const id = elementIdentity(entry);
18
- const fields = id === null ? void 0 : marked[id];
19
- const twin = id === null ? void 0 : storedById.get(id);
20
- if (entry === null || fields === void 0 || twin === void 0) return value;
21
- const kept = { ...entry };
22
- for (const field of Object.keys(fields)) if (field in twin) kept[field] = twin[field];
23
- return kept;
24
- });
25
- }
26
-
27
- //#endregion
28
- export { keepOverriddenItemFields };
1
+ import "../../template-contracts/dist/ref-locate.js";
@@ -4,9 +4,7 @@ import { elementIdentity } from "../../template-contracts/dist/ref-locate.js";
4
4
  const isFields = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
5
5
  function uploadOf(value) {
6
6
  if (!isFields(value)) return null;
7
- if (typeof value["asset_id"] === "string" && value["asset_id"] !== "") return value["asset_id"];
8
- if (typeof value["photo_id"] === "string" && value["photo_id"] !== "") return value["photo_id"];
9
- return null;
7
+ return typeof value["asset_id"] === "string" && value["asset_id"] !== "" ? value["asset_id"] : null;
10
8
  }
11
9
  function mergeLinkedValue(current, fresh) {
12
10
  const upload = uploadOf(fresh);
@@ -1,13 +1,14 @@
1
1
  import { normalizeAddressValue } from "../../template-contracts/dist/address-value.js";
2
2
  import { storedAsRefs } from "../../template-contracts/dist/registry-facts.js";
3
- import { attributedRows, elementIdentity, elementIdentityKey } from "../../template-contracts/dist/ref-locate.js";
4
- import { elementRowKeys, memberSourceOf, rowMemberOf, rowMemberSources } from "../../template-contracts/dist/row-sources.js";
3
+ import { attributedRows, elementIdentity } from "../../template-contracts/dist/ref-locate.js";
4
+ import { rowIdentityKey } from "../../template-contracts/dist/table-members.js";
5
+ import { elementRowKeys, memberSourceOf, rowMemberSources } from "../../template-contracts/dist/row-sources.js";
5
6
  import { projectTableRows, readRowMember } from "../../source-resolution/dist/index.js";
6
7
 
7
8
  //#region ../../internal/fill-bake/dist/list-grammar.js
8
9
  const isRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
9
10
  function isGrammarList(def) {
10
- return def.type === "list" && def.fields === void 0 && def.element !== void 0;
11
+ return def.type === "list" && def.element !== void 0;
11
12
  }
12
13
  function objectElementFields(def) {
13
14
  return def.element?.type === "object" ? def.element.fields ?? {} : void 0;
@@ -17,6 +18,10 @@ function decisionProducing(scope, path) {
17
18
  }
18
19
  function rowIdentity(element, table) {
19
20
  if (typeof element === "string") return element === "" ? null : element;
21
+ if (table !== null && isRecord(element)) {
22
+ const id = element[rowIdentityKey(table)];
23
+ if (typeof id === "string" && id !== "") return id;
24
+ }
20
25
  return elementIdentity(element, table);
21
26
  }
22
27
  function computedRow(element, tables, facts) {
@@ -70,7 +75,6 @@ function projectElements(elements, projection) {
70
75
  const fields = element.type === "object" ? element.fields ?? {} : void 0;
71
76
  if (table !== null) {
72
77
  if (fields === void 0) return elements.map((identified) => identified.id);
73
- const idKey = elementIdentityKey(table.table);
74
78
  const members = rowMemberSources(fields);
75
79
  return elements.flatMap(({ element: held, id }) => {
76
80
  const rowId = typeof held === "string" ? held : id;
@@ -83,7 +87,7 @@ function projectElements(elements, projection) {
83
87
  }
84
88
  return [withNestedLists({
85
89
  ...projected,
86
- [idKey]: id
90
+ id
87
91
  }, fields, facts)];
88
92
  });
89
93
  }
@@ -136,12 +140,7 @@ function projectContentItem({ element, id, storedItem }, fields, computes) {
136
140
  continue;
137
141
  }
138
142
  const member = memberSourceOf(field.source);
139
- if (member !== null && elementRows.has(member.slot)) {
140
- out[key] = readMember(member.field);
141
- continue;
142
- }
143
- const enclosing = rowMemberOf(field.source);
144
- if (enclosing !== null) out[key] = readMember(enclosing);
143
+ if (member !== null && elementRows.has(member.slot)) out[key] = readMember(member.field);
145
144
  }
146
145
  for (const [key, field] of Object.entries(fields)) {
147
146
  const member = memberSourceOf(field.source);
@@ -0,0 +1 @@
1
+ import "./bake-property-ref.js";
@@ -3,7 +3,7 @@ import { plannerForField } from "../../template-contracts/dist/row-planners.js";
3
3
  import { listItemFieldsOf } from "../../template-contracts/dist/row-sources.js";
4
4
  import "./row-planners.js";
5
5
  import { bindsElement, holderLabel, holderOf, isFactBound } from "./holder.js";
6
- import { impliedVerbOf, pickIsUnique, readFillVerb, verbRunsOn, writesElements } from "./verbs.js";
6
+ import { pickIsUnique, readFillVerb, verbRunsOn, writesElements } from "./verbs.js";
7
7
 
8
8
  //#region ../../internal/fill-vocabulary/dist/resolved-decision.js
9
9
  function producedSlotOf(slots, id) {
@@ -15,15 +15,6 @@ function producedSlotOf(slots, id) {
15
15
  const field = id.slice(dot + 1);
16
16
  return fields !== void 0 && Object.hasOwn(fields, field) ? fields[field] : void 0;
17
17
  }
18
- function declaredCountOf(raw) {
19
- if (typeof raw === "number") return raw;
20
- if (raw === null || typeof raw !== "object") return void 0;
21
- const { min, max } = raw;
22
- return {
23
- ...typeof min === "number" ? { min } : {},
24
- ...typeof max === "number" ? { max } : {}
25
- };
26
- }
27
18
  function capHolderOf(slot) {
28
19
  if (isValueKind(slot.type) || slot.type === "list" && isValueKind(slot.element?.type)) return null;
29
20
  if (listItemFieldsOf(slot) !== void 0) return null;
@@ -210,19 +201,8 @@ function noneOf(node, label) {
210
201
  if (node.none === true) return true;
211
202
  throw new Error(`${label}: \`none\` is \`true\` or absent, never ${JSON.stringify(node.none)}`);
212
203
  }
213
- const PICKING_PLANNERS = /* @__PURE__ */ new Set([
214
- "select",
215
- "choice",
216
- "assets",
217
- "image",
218
- "video",
219
- "tour",
220
- "document",
221
- "media"
222
- ]);
223
- function abstainsByVerdict(verb, planner) {
224
- if (verb !== void 0) return verb === "pick";
225
- return planner !== void 0 && PICKING_PLANNERS.has(planner);
204
+ function abstainsByVerdict(verb) {
205
+ return verb === "pick";
226
206
  }
227
207
  function findsPlaces(verb, holders) {
228
208
  return verb === "find" && holders.length > 0 && holders.every((holder) => holder !== void 0 && holdsPlaces(holder));
@@ -247,15 +227,9 @@ function writtenKindOfField(field, planner) {
247
227
  if (planner === "text") return writtenKindOfDeclared(field);
248
228
  if (planner === "list") return writtenKindOfDeclared(field.element);
249
229
  }
250
- function normalizedVerbOf(decision, slots) {
230
+ function normalizedVerbOf(decision) {
251
231
  if (decision.verb !== void 0) return readFillVerb(decision.verb);
252
- if (decision.kind === "display") return "pick";
253
- const planned = decision.fields !== null && typeof decision.fields === "object" ? Object.keys(decision.fields) : [];
254
- for (const id of decision.produces) {
255
- const slot = producedSlotOf(slots, id);
256
- const verb = slot === void 0 ? void 0 : impliedVerbOf(slot, planned);
257
- if (verb !== void 0) return verb;
258
- }
232
+ return decision.kind === "display" ? "pick" : void 0;
259
233
  }
260
234
  function honouredFor(base, written) {
261
235
  if (written === void 0) return base;
@@ -269,7 +243,7 @@ function resolveDecision(decision, slots) {
269
243
  const refused = [];
270
244
  const label = `fill "${decision.id}"`;
271
245
  const declaresVerb = decision.verb !== void 0;
272
- const verb = normalizedVerbOf(decision, slots);
246
+ const verb = normalizedVerbOf(decision);
273
247
  if (declaresVerb && decision.count !== void 0) refused.push({
274
248
  option: "count",
275
249
  where: decision.produces[0] ?? "",
@@ -305,7 +279,7 @@ function resolveDecision(decision, slots) {
305
279
  holder,
306
280
  runs: true,
307
281
  ...writtenKind === void 0 ? {} : { writtenKind },
308
- ...countEntry(honoured, declaresVerb, decision, slot),
282
+ ...countEntry(honoured, declaresVerb, slot),
309
283
  ...honoured.has("cap") ? capEntry(decision.cap, slot, writesElements(verb, holder)) : {}
310
284
  };
311
285
  });
@@ -335,13 +309,12 @@ function resolveDecision(decision, slots) {
335
309
  const honoured = honouredFor(HONOURED_BY_PLANNER[planner], writtenKind);
336
310
  const where = `${decision.produces[0]}.${name}`;
337
311
  refused.push(...refusalsOf(wire, honoured, `${label} field "${name}"`, where, `row field "${where}" (${planner})`));
338
- const declaredCount = wire.verb !== void 0 ? boundsOf(fieldSlot) : declaredCountOf(wire.count);
339
312
  return {
340
313
  ...base,
341
314
  ...writtenKind === void 0 ? {} : { writtenKind },
342
- mayAbstain: abstainsByVerdict(fieldVerb, planner) || base.mayAbstain && honoured.has("none"),
315
+ mayAbstain: abstainsByVerdict(fieldVerb) || base.mayAbstain && honoured.has("none"),
343
316
  ...honoured.has("count") ? { count: {
344
- declared: declaredCount,
317
+ declared: boundsOf(fieldSlot),
345
318
  holderMax: fieldSlot.max
346
319
  } } : {},
347
320
  ...honoured.has("cap") ? capEntry(wire.cap, fieldSlot) : {}
@@ -369,10 +342,10 @@ function boundsOf(slot) {
369
342
  ...typeof slot.max === "number" ? { max: slot.max } : {}
370
343
  };
371
344
  }
372
- function countEntry(honoured, declaresVerb, decision, slot) {
345
+ function countEntry(honoured, declaresVerb, slot) {
373
346
  if (!honoured.has("count")) return {};
374
347
  return { count: {
375
- declared: declaresVerb ? boundsOf(slot) : declaredCountOf(decision.count),
348
+ declared: declaresVerb ? boundsOf(slot) : void 0,
376
349
  holderMax: slot.max
377
350
  } };
378
351
  }
@@ -12,10 +12,8 @@ const FILL_VERBS = [
12
12
  function isFillVerb(value) {
13
13
  return typeof value === "string" && FILL_VERBS.includes(value);
14
14
  }
15
- const RETIRED_VERBS = { curate: "find" };
16
15
  function readFillVerb(value) {
17
- if (isFillVerb(value)) return value;
18
- return typeof value === "string" && Object.hasOwn(RETIRED_VERBS, value) ? RETIRED_VERBS[value] : void 0;
16
+ return isFillVerb(value) ? value : void 0;
19
17
  }
20
18
  function choosesOne(type) {
21
19
  return type === "select" || poolOfKind(type) !== void 0;
@@ -54,22 +52,9 @@ function verbRunsOn(verb, slot, planned = []) {
54
52
  function writesElements(verb, holder) {
55
53
  return verb === "write" && holder?.shape === "objects" && holder.bindsElement;
56
54
  }
57
- function impliedVerbOf(slot, planned = []) {
58
- const holder = holderOf(slot);
59
- if (holder.shape === "one") {
60
- if (choosesOne(holder.type)) return "pick";
61
- return writesOne(holder.type) ? "write" : void 0;
62
- }
63
- if (holder.shape === "list") {
64
- if (choosesOne(holder.item)) return "pick";
65
- if (isFindableKind(holder.item)) return "find";
66
- return holder.item === "row" ? void 0 : "write";
67
- }
68
- return holder.bound === void 0 && everyFieldPlanned(slot, planned) ? "write" : void 0;
69
- }
70
55
  function pickIsUnique(verb, node) {
71
56
  return verb === "pick" && node.unique !== false;
72
57
  }
73
58
 
74
59
  //#endregion
75
- export { FILL_VERBS, FINDABLE_KINDS, findRunsOn, impliedVerbOf, isFillVerb, isFindableKind, pickIsUnique, pickRunsOn, readFillVerb, verbRunsOn, writesElements };
60
+ export { FILL_VERBS, FINDABLE_KINDS, findRunsOn, isFillVerb, isFindableKind, pickIsUnique, pickRunsOn, readFillVerb, verbRunsOn, writesElements };
@@ -85,11 +85,11 @@ function cutKeyOf(framing, photoId, crop) {
85
85
  return key !== null && cropKeyOwner(key) === photoId ? key : null;
86
86
  }
87
87
  function slotCutKey(v, at) {
88
- return cutKeyOf(v, readPhotoId(v), framingCrop(v, at));
88
+ return cutKeyOf(v, readAssetId(v), framingCrop(v, at));
89
89
  }
90
90
  function mobileCutKey(v, at) {
91
91
  const mobile = v.mobile && typeof v.mobile === "object" ? v.mobile : at === void 0 ? null : {};
92
- return mobile === null ? null : cutKeyOf(mobile, readPhotoId(v), framingCrop(mobile, at, "mobile"));
92
+ return mobile === null ? null : cutKeyOf(mobile, readAssetId(v), framingCrop(mobile, at, "mobile"));
93
93
  }
94
94
  async function mobileCropUrl(key, store) {
95
95
  try {
@@ -99,7 +99,7 @@ async function mobileCropUrl(key, store) {
99
99
  }
100
100
  }
101
101
  function slotServedKey(v, mask, at) {
102
- const photoId = readPhotoId(v);
102
+ const photoId = readAssetId(v);
103
103
  const renditions = v.renditions && typeof v.renditions === "object" ? v.renditions : {};
104
104
  const own = (name) => {
105
105
  const key = renditionKey(renditions[name]);
@@ -107,10 +107,8 @@ function slotServedKey(v, mask, at) {
107
107
  };
108
108
  return (mask === null ? null : own(mask === "white" ? "mask_white" : "mask_black")) ?? own("cutout") ?? (mask === null ? slotCutKey(v, at) : null);
109
109
  }
110
- function readPhotoId(v) {
111
- if (typeof v.photo_id === "string" && v.photo_id) return v.photo_id;
112
- if (typeof v.asset_id === "string" && v.asset_id) return v.asset_id;
113
- return "";
110
+ function readAssetId(v) {
111
+ return typeof v.asset_id === "string" ? v.asset_id : "";
114
112
  }
115
113
  async function resolveImageValue(value, assets, store, aspects) {
116
114
  if (value === null) return {
@@ -126,7 +124,7 @@ async function resolveImageValue(value, assets, store, aspects) {
126
124
  const v = value;
127
125
  const rect = v.rect && typeof v.rect === "object" ? normalizeRect(v.rect) : null;
128
126
  const ar = typeof v.ar === "number" ? v.ar : null;
129
- const photoId = readPhotoId(v);
127
+ const photoId = readAssetId(v);
130
128
  const mask = v.mask === "white" || v.mask === "black" ? v.mask : null;
131
129
  const asset = photoId ? assets.get(photoId) : void 0;
132
130
  const at = aspects === void 0 ? void 0 : {
@@ -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.fields ?? (slot.element?.type === "object" ? slot.element?.fields : void 0);
20
+ const fields = slot.element?.type === "object" ? slot.element?.fields : void 0;
21
21
  return fields != null ? {
22
22
  kind: "record",
23
23
  fields
@@ -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
- fields: slot.fields
28
+ element: {
29
+ type: "object",
30
+ fields: slot.fields
31
+ }
29
32
  }, ctx);
30
33
  return row;
31
34
  }
@@ -18,7 +18,7 @@ async function resolveTourSlot(value, assets, store) {
18
18
  if (value === null) return null;
19
19
  if (typeof value !== "object") return DEFAULT;
20
20
  const v = value;
21
- const tourId = typeof v.tour_id === "string" && v.tour_id ? v.tour_id : typeof v.asset_id === "string" && v.asset_id ? v.asset_id : "";
21
+ const tourId = typeof v.asset_id === "string" ? v.asset_id : "";
22
22
  if (!tourId) return DEFAULT;
23
23
  const asset = assets.get(tourId);
24
24
  if (asset === void 0) {