@homepages/concrete 9.1.0 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +81 -0
- package/README.md +1 -1
- package/codemods/manifest.json +5 -148
- package/dist/artifact/playground/client/assets/index-ByeGGedv.js +1259 -0
- package/dist/artifact/playground/client/assets/index-CxWPYOH2.css +1 -0
- package/dist/artifact/playground/client/index.html +2 -2
- package/dist/artifact/playground/client/island-canvas-host.mjs +1 -1
- package/dist/artifact/playground/host.mjs +42 -42
- package/dist/base.css +1 -8
- package/dist/cli/build/artifact.js +3 -2
- package/dist/cli/build/fixtures.js +2 -0
- package/dist/cli/check/render/inputs.js +3 -3
- package/dist/cli/check/stages/sections.js +6 -7
- package/dist/cli/dev/workspace-reader.js +10 -2
- package/dist/css/compile.js +3 -6
- package/dist/css/rules.js +1 -51
- package/dist/design-system/format-variants.js +1 -1
- package/dist/fixtures/media-store.js +3 -3
- package/dist/fixtures/resolve.js +28 -16
- package/dist/fixtures/rows.js +2 -2
- package/dist/fixtures/synthesize-empties.js +3 -1
- package/dist/fixtures.d.ts +1 -1
- package/dist/index.d.ts +7 -8
- package/dist/packages/external/concrete/package.js +1 -1
- package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +8 -6
- package/dist/packages/internal/fill-bake/dist/compute-reads.js +8 -4
- package/dist/packages/internal/fill-bake/dist/index.js +1 -1
- package/dist/packages/internal/fill-bake/dist/item-merge.js +32 -6
- package/dist/packages/internal/fill-bake/dist/linked-merge.js +5 -5
- package/dist/packages/internal/fill-bake/dist/list-grammar.js +4 -26
- package/dist/packages/internal/fill-vocabulary/dist/holder.js +3 -14
- package/dist/packages/internal/fill-vocabulary/dist/resolved-decision.js +1 -1
- package/dist/packages/internal/media-resolution/dist/document.js +17 -16
- package/dist/packages/internal/media-resolution/dist/image.js +41 -95
- package/dist/packages/internal/media-resolution/dist/index.js +1 -1
- package/dist/packages/internal/media-resolution/dist/list.js +11 -11
- package/dist/packages/internal/media-resolution/dist/media.js +17 -16
- package/dist/packages/internal/media-resolution/dist/records.js +4 -2
- package/dist/packages/internal/media-resolution/dist/slot.js +5 -5
- package/dist/packages/internal/media-resolution/dist/tour.js +17 -16
- package/dist/packages/internal/media-resolution/dist/video.js +24 -24
- package/dist/packages/internal/property-facts/dist/registry-facts.js +8 -1
- package/dist/packages/internal/section-contracts/dist/catalog.js +1 -5
- package/dist/packages/internal/section-contracts/dist/directly-linked-list-contract.js +2 -3
- package/dist/packages/internal/section-contracts/dist/fill-verb-contract.js +6 -3
- package/dist/packages/internal/section-contracts/dist/index.js +0 -1
- package/dist/packages/internal/section-contracts/dist/object-contract.js +4 -2
- package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +1 -1
- package/dist/packages/internal/section-contracts/dist/row-rule-contract.js +4 -2
- package/dist/packages/internal/section-contracts/dist/row-source-contract.js +7 -8
- package/dist/packages/internal/section-contracts/dist/runners.js +2 -11
- package/dist/packages/internal/section-contracts/dist/select-contract.js +7 -1
- package/dist/packages/internal/section-contracts/dist/source-contract.js +14 -10
- package/dist/packages/internal/section-contracts/dist/sources-contract.js +0 -2
- package/dist/packages/internal/section-contracts/dist/table-member.js +5 -8
- package/dist/packages/internal/source-resolution/dist/index.js +21 -188
- package/dist/packages/internal/template-artifact/dist/index.js +1 -1
- package/dist/packages/internal/template-artifact/dist/layout.js +12 -10
- package/dist/packages/internal/template-artifact/dist/manifest.js +1 -1
- package/dist/packages/internal/template-artifact/dist/verify.js +26 -14
- package/dist/packages/internal/template-contracts/dist/content-pick.js +24 -1
- package/dist/packages/internal/template-contracts/dist/document-value.d.ts +4 -6
- package/dist/packages/internal/template-contracts/dist/fact-keys.d.ts +3 -2
- package/dist/packages/internal/template-contracts/dist/fact-keys.js +19 -43
- package/dist/packages/internal/template-contracts/dist/fact-registry.d.ts +24 -3
- package/dist/packages/internal/template-contracts/dist/fact-registry.js +10 -3
- package/dist/packages/internal/template-contracts/dist/fill-builders.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/fill-builders.js +2 -6
- package/dist/packages/internal/template-contracts/dist/fill-spec-schema.js +4 -1
- package/dist/packages/internal/template-contracts/dist/fill-spec.js +7 -6
- package/dist/packages/internal/template-contracts/dist/list.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/list.js +7 -29
- package/dist/packages/internal/template-contracts/dist/mirror-kind.js +2 -2
- package/dist/packages/internal/template-contracts/dist/object.js +3 -2
- package/dist/packages/internal/template-contracts/dist/primitive-descriptors.js +1 -1
- package/dist/packages/internal/template-contracts/dist/process-builders.d.ts +2 -2
- package/dist/packages/internal/template-contracts/dist/read-graph.js +5 -32
- package/dist/packages/internal/template-contracts/dist/ref-locate.js +10 -6
- package/dist/packages/internal/template-contracts/dist/registry-facts.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/registry-facts.js +13 -24
- package/dist/packages/internal/template-contracts/dist/registry-shape.d.ts +20 -4
- package/dist/packages/internal/template-contracts/dist/registry-shape.js +69 -11
- package/dist/packages/internal/template-contracts/dist/row-planners.js +1 -1
- package/dist/packages/internal/template-contracts/dist/row-ref.d.ts +4 -7
- package/dist/packages/internal/template-contracts/dist/row-ref.js +7 -23
- package/dist/packages/internal/template-contracts/dist/row-sources.js +3 -3
- package/dist/packages/internal/template-contracts/dist/row.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/row.js +6 -7
- package/dist/packages/internal/template-contracts/dist/runtime-values.d.ts +11 -27
- package/dist/packages/internal/template-contracts/dist/section-schema-types.d.ts +1 -0
- package/dist/packages/internal/template-contracts/dist/slot-builders.d.ts +29 -37
- package/dist/packages/internal/template-contracts/dist/slot-builders.js +3 -8
- package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +2 -702
- package/dist/packages/internal/template-contracts/dist/slot-catalog.js +2 -498
- package/dist/packages/internal/template-contracts/dist/slot-overrides.js +4 -1
- package/dist/packages/internal/template-contracts/dist/slot-ref.d.ts +10 -5
- package/dist/packages/internal/template-contracts/dist/slot-value.d.ts +2 -1
- package/dist/packages/internal/template-contracts/dist/table-members.d.ts +5 -12
- package/dist/packages/internal/template-contracts/dist/table-members.js +7 -37
- package/dist/packages/internal/template-contracts/dist/tour-value.d.ts +4 -6
- package/dist/packages/internal/template-contracts/dist/video-value.d.ts +3 -4
- package/dist/primitives/Image.d.ts +4 -4
- package/dist/primitives/Tour.d.ts +2 -2
- package/dist/primitives/Video.d.ts +2 -2
- package/dist/primitives/slot-bindings.js +6 -13
- package/dist/primitives/slot-document.d.ts +1 -1
- package/dist/primitives/slot-download.d.ts +4 -2
- package/dist/primitives/slot-media.d.ts +6 -3
- package/dist/primitives/slot-media.js +1 -1
- package/dist/rules/registry.js +0 -6
- package/dist/schema/fact.d.ts +19 -52
- package/dist/schema/fact.js +6 -25
- package/dist/schema/facts-view.d.ts +1 -2
- package/dist/schema/format-presets.d.ts +1 -1
- package/dist/schema/property-facts.d.ts +1 -62
- package/dist/schema/section-schema.d.ts +6 -6
- package/dist/schema/section-schema.js +1 -1
- package/dist/styles.css +4 -4
- package/dist/template/define-template.js +0 -1
- package/guide/reference/cli/INDEX.md +2 -2
- package/guide/reference/cli/build.md +1 -1
- package/guide/reference/cli/check.md +1 -1
- package/guide/reference/cli/dev.md +1 -1
- package/guide/reference/cli/property-add.md +1 -1
- package/guide/reference/cli/property-list.md +1 -1
- package/guide/reference/cli/publish.md +1 -1
- package/guide/reference/cli/upgrade.md +1 -1
- package/guide/reference/rules/INDEX.md +2 -4
- package/package.json +2 -2
- package/codemods/fill-is-a-source.mjs +0 -533
- package/codemods/framework-namespace.mjs +0 -107
- package/codemods/list-grammar.mjs +0 -923
- package/codemods/object-form-only.mjs +0 -39
- package/codemods/platform-namespace.mjs +0 -83
- package/codemods/process-builders.mjs +0 -198
- package/codemods/reads-replace-reconcile.mjs +0 -285
- package/codemods/slot-object.mjs +0 -1097
- package/codemods/steps/content-object-fields.mjs +0 -324
- package/codemods/steps/list-object-form.mjs +0 -687
- package/codemods/steps/select-object-form.mjs +0 -210
- package/codemods/table-rows.mjs +0 -568
- package/codemods/theme-collapse.mjs +0 -396
- package/codemods/unlayer-author-css.mjs +0 -194
- package/codemods/unwrap-object-fields.mjs +0 -310
- package/codemods/viewer-slot-document.mjs +0 -131
- package/codemods/write-property-as-facts-document.mjs +0 -716
- package/codemods/write-the-address-line.mjs +0 -255
- package/codemods/write-the-registry-members.mjs +0 -653
- package/codemods/write-the-select-from.mjs +0 -141
- package/codemods/write-the-sole-from.mjs +0 -369
- package/codemods/write-the-table-from.mjs +0 -267
- package/codemods/write-the-whole-item.mjs +0 -512
- package/codemods/writeback-drop.mjs +0 -168
- package/codemods/written-contact-address.mjs +0 -162
- package/codemods/written-media-category.mjs +0 -227
- package/codemods/written-ref-kinds-name-the-layer.mjs +0 -172
- package/codemods/written-uploads-replace-pool-reads.mjs +0 -454
- package/codemods/written-uploads-sort-into-lists.mjs +0 -405
- package/codemods/written-uploads-stated-in-sorted-lists.mjs +0 -295
- package/codemods/written-video-sources-drop.mjs +0 -144
- package/codemods/written-without-pick-none.mjs +0 -146
- package/codemods/written-without-retired-knowledge.mjs +0 -223
- package/codemods/written-without-the-media-key.mjs +0 -202
- package/codemods/written-without-the-property-type.mjs +0 -249
- package/dist/artifact/playground/client/assets/index-BOYbgBnP.js +0 -1259
- package/dist/artifact/playground/client/assets/index-DDOcM0zA.css +0 -1
- package/dist/packages/internal/section-contracts/dist/option-source-contract.js +0 -22
- package/dist/packages/internal/template-contracts/dist/comparable-address.js +0 -19
- package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +0 -62
- package/dist/packages/internal/template-contracts/dist/legacy-facts.js +0 -167
- package/dist/packages/internal/template-contracts/dist/registry-aliases.js +0 -77
|
@@ -47,11 +47,14 @@ function mergeSourcedItems(input) {
|
|
|
47
47
|
const id = cur[idKey];
|
|
48
48
|
if (typeof id === "string") currentById.set(id, cur);
|
|
49
49
|
}
|
|
50
|
-
if (membership === "source")
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
if (membership === "source") {
|
|
51
|
+
if (input.ordered === true) return mergeOrderedSourceItems(current, freshSource, input, idKey);
|
|
52
|
+
return freshSource.map((fresh) => {
|
|
53
|
+
const id = fresh[idKey];
|
|
54
|
+
const cur = typeof id === "string" ? currentById.get(id) : void 0;
|
|
55
|
+
return cur === void 0 ? fresh : mergeItem(cur, fresh, overrides?.[id], generatedFields, idKey, true);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
55
58
|
const freshById = /* @__PURE__ */ new Map();
|
|
56
59
|
for (const fresh of freshSource) {
|
|
57
60
|
const id = fresh[idKey];
|
|
@@ -63,8 +66,30 @@ function mergeSourcedItems(input) {
|
|
|
63
66
|
return fresh === void 0 ? cur : mergeItem(cur, fresh, overrides?.[id], generatedFields, idKey, true);
|
|
64
67
|
});
|
|
65
68
|
}
|
|
69
|
+
function mergeOrderedSourceItems(current, freshSource, input, idKey) {
|
|
70
|
+
const freshById = /* @__PURE__ */ new Map();
|
|
71
|
+
for (const fresh of freshSource) {
|
|
72
|
+
const id = fresh[idKey];
|
|
73
|
+
if (typeof id === "string") freshById.set(id, fresh);
|
|
74
|
+
}
|
|
75
|
+
const out = [];
|
|
76
|
+
const emitted = /* @__PURE__ */ new Set();
|
|
77
|
+
for (const cur of current) {
|
|
78
|
+
const id = cur[idKey];
|
|
79
|
+
const fresh = typeof id === "string" ? freshById.get(id) : void 0;
|
|
80
|
+
if (fresh === void 0 || emitted.has(id)) continue;
|
|
81
|
+
out.push(mergeItem(cur, fresh, input.overrides?.[id], input.generatedFields, idKey, true));
|
|
82
|
+
emitted.add(id);
|
|
83
|
+
}
|
|
84
|
+
for (const fresh of freshSource) {
|
|
85
|
+
const id = fresh[idKey];
|
|
86
|
+
if (typeof id === "string" && emitted.has(id)) continue;
|
|
87
|
+
out.push(fresh);
|
|
88
|
+
}
|
|
89
|
+
return out;
|
|
90
|
+
}
|
|
66
91
|
function mergeTableItems(input) {
|
|
67
|
-
const { current, freshSource, overrides, removed, generatedFields, idKey } = input;
|
|
92
|
+
const { current, freshSource, overrides, removed, generatedFields, idKey, ordered } = input;
|
|
68
93
|
const freshById = /* @__PURE__ */ new Map();
|
|
69
94
|
for (const f of freshSource) {
|
|
70
95
|
const id = f[idKey];
|
|
@@ -89,6 +114,7 @@ function mergeTableItems(input) {
|
|
|
89
114
|
if (removed?.[id] === true) continue;
|
|
90
115
|
out.push(fresh);
|
|
91
116
|
}
|
|
117
|
+
if (ordered === true) return out;
|
|
92
118
|
const freshIndex = /* @__PURE__ */ new Map();
|
|
93
119
|
freshSource.forEach((f, i) => {
|
|
94
120
|
const id = f[idKey];
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import { contentMediaIdOf } from "../../template-contracts/dist/registry-facts.js";
|
|
1
2
|
import { elementIdentity } from "../../template-contracts/dist/ref-locate.js";
|
|
2
3
|
|
|
3
4
|
//#region ../../internal/fill-bake/dist/linked-merge.js
|
|
4
5
|
const isFields = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
return typeof value["asset_id"] === "string" && value["asset_id"] !== "" ? value["asset_id"] : null;
|
|
6
|
+
function mediaOf(value) {
|
|
7
|
+
return contentMediaIdOf(value) ?? null;
|
|
8
8
|
}
|
|
9
9
|
function mergeLinkedValue(current, fresh) {
|
|
10
|
-
const
|
|
11
|
-
if (
|
|
10
|
+
const media = mediaOf(fresh);
|
|
11
|
+
if (media !== null) return mediaOf(current) === media ? current : fresh;
|
|
12
12
|
if (Array.isArray(fresh)) return Array.isArray(current) ? mergeLinkedList(current, fresh) : fresh;
|
|
13
13
|
if (isFields(fresh)) return isFields(current) ? mergeLinkedFields(current, fresh) : fresh;
|
|
14
14
|
return fresh;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { normalizeAddressValue } from "../../template-contracts/dist/address-value.js";
|
|
2
2
|
import { storedAsRefs } from "../../template-contracts/dist/registry-facts.js";
|
|
3
3
|
import { attributedRows, elementIdentity } from "../../template-contracts/dist/ref-locate.js";
|
|
4
|
-
import {
|
|
5
|
-
import { elementRowKeys, memberSourceOf, rowMemberSources } from "../../template-contracts/dist/row-sources.js";
|
|
4
|
+
import { elementRowKeys, memberSourceOf } from "../../template-contracts/dist/row-sources.js";
|
|
6
5
|
import { projectTableRows, readRowMember } from "../../source-resolution/dist/index.js";
|
|
7
6
|
|
|
8
7
|
//#region ../../internal/fill-bake/dist/list-grammar.js
|
|
@@ -19,7 +18,7 @@ function decisionProducing(scope, path) {
|
|
|
19
18
|
function rowIdentity(element, table) {
|
|
20
19
|
if (typeof element === "string") return element === "" ? null : element;
|
|
21
20
|
if (table !== null && isRecord(element)) {
|
|
22
|
-
const id = element[
|
|
21
|
+
const id = element["id"];
|
|
23
22
|
if (typeof id === "string" && id !== "") return id;
|
|
24
23
|
}
|
|
25
24
|
return elementIdentity(element, table);
|
|
@@ -43,12 +42,6 @@ function computedRow(element, tables, facts) {
|
|
|
43
42
|
id: rowIdentity(element, first)
|
|
44
43
|
};
|
|
45
44
|
}
|
|
46
|
-
function registryReadingOf(table) {
|
|
47
|
-
return {
|
|
48
|
-
table: table.table,
|
|
49
|
-
reading: "registry"
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
45
|
function readResolvedRowMember(row, member, facts) {
|
|
53
46
|
if (row.table !== null) return row.id === null ? null : storedAsRefs(readRowMember(row.table, row.id, member, facts));
|
|
54
47
|
return isRecord(row.element) ? row.element[member] ?? null : null;
|
|
@@ -75,16 +68,9 @@ function projectElements(elements, projection) {
|
|
|
75
68
|
const fields = element.type === "object" ? element.fields ?? {} : void 0;
|
|
76
69
|
if (table !== null) {
|
|
77
70
|
if (fields === void 0) return elements.map((identified) => identified.id);
|
|
78
|
-
const members = rowMemberSources(fields);
|
|
79
71
|
return elements.flatMap(({ element: held, id }) => {
|
|
80
|
-
const
|
|
81
|
-
const [projected] = storedAsRefs(projectTableRows(table, facts, fields, computes, [rowId]));
|
|
72
|
+
const [projected] = storedAsRefs(projectTableRows(table, facts, fields, computes, [typeof held === "string" ? held : id]));
|
|
82
73
|
if (projected === void 0) return [];
|
|
83
|
-
for (const [key, field] of Object.entries(fields)) {
|
|
84
|
-
const nested = nestedItemOf(field);
|
|
85
|
-
const member = members[key];
|
|
86
|
-
if (nested !== void 0 && member !== void 0 && readsElementRows(nested)) projected[key] = storedAsRefs(readRowMember(registryReadingOf(table), rowId, member, facts));
|
|
87
|
-
}
|
|
88
74
|
return [withNestedLists({
|
|
89
75
|
...projected,
|
|
90
76
|
id
|
|
@@ -98,14 +84,6 @@ function projectElements(elements, projection) {
|
|
|
98
84
|
function nestedItemOf(def) {
|
|
99
85
|
return isGrammarList(def) && def.element?.type === "object" ? def.element : void 0;
|
|
100
86
|
}
|
|
101
|
-
function readsElementRows(declaration) {
|
|
102
|
-
const fields = declaration.fields ?? {};
|
|
103
|
-
return elementRowKeys(fields).length > 0 || Object.keys(rowMemberSources(fields)).length > 0;
|
|
104
|
-
}
|
|
105
|
-
function readNestedMember(row, member, nestedItem, facts) {
|
|
106
|
-
if (row.table !== null && row.id !== null && readsElementRows(nestedItem)) return storedAsRefs(readRowMember(registryReadingOf(row.table), row.id, member, facts));
|
|
107
|
-
return readResolvedRowMember(row, member, facts);
|
|
108
|
-
}
|
|
109
87
|
function projectNestedList(value, nestedItem, facts) {
|
|
110
88
|
if (!Array.isArray(value)) return value;
|
|
111
89
|
const ids = contentIdentities(value);
|
|
@@ -171,4 +149,4 @@ function storedElements(stored, fields, table) {
|
|
|
171
149
|
}
|
|
172
150
|
|
|
173
151
|
//#endregion
|
|
174
|
-
export { computedRow, contentIdentities, decisionProducing, isGrammarList, nestedItemOf, objectElementFields, projectElements, projectNestedList,
|
|
152
|
+
export { computedRow, contentIdentities, decisionProducing, isGrammarList, nestedItemOf, objectElementFields, projectElements, projectNestedList, readResolvedRowMember, rowIdentity, storedElements };
|
|
@@ -3,17 +3,6 @@ import { listItemFieldsOf } from "../../template-contracts/dist/row-sources.js";
|
|
|
3
3
|
import "./row-planners.js";
|
|
4
4
|
|
|
5
5
|
//#region ../../internal/fill-vocabulary/dist/holder.js
|
|
6
|
-
const LEGACY_COLLECTION_ITEM = {
|
|
7
|
-
image_collection: "image",
|
|
8
|
-
video_collection: "video",
|
|
9
|
-
poi_list: "poi"
|
|
10
|
-
};
|
|
11
|
-
function isListSlot(slot) {
|
|
12
|
-
return slot.type === "list" || slot.type !== void 0 && slot.type in LEGACY_COLLECTION_ITEM;
|
|
13
|
-
}
|
|
14
|
-
function listItemTypeOf(slot) {
|
|
15
|
-
return slot.element?.type ?? LEGACY_COLLECTION_ITEM[slot.type ?? ""];
|
|
16
|
-
}
|
|
17
6
|
function poolOfKind(kind) {
|
|
18
7
|
return kind === void 0 ? void 0 : poolingPrimitiveOf({ type: kind });
|
|
19
8
|
}
|
|
@@ -22,14 +11,14 @@ function bindsElement(field) {
|
|
|
22
11
|
return field.type !== "row" && source?.kind === "element";
|
|
23
12
|
}
|
|
24
13
|
function holderOf(slot) {
|
|
25
|
-
if (
|
|
14
|
+
if (slot.type !== "list") return {
|
|
26
15
|
shape: "one",
|
|
27
16
|
type: slot.type
|
|
28
17
|
};
|
|
29
18
|
const fields = listItemFieldsOf(slot);
|
|
30
19
|
if (fields === void 0) return {
|
|
31
20
|
shape: "list",
|
|
32
|
-
item:
|
|
21
|
+
item: slot.element?.type
|
|
33
22
|
};
|
|
34
23
|
const bound = slot.source?.kind === "home" ? slot.source.key : void 0;
|
|
35
24
|
return {
|
|
@@ -48,4 +37,4 @@ function holderLabel(holder) {
|
|
|
48
37
|
}
|
|
49
38
|
|
|
50
39
|
//#endregion
|
|
51
|
-
export { bindsElement, holderLabel, holderOf, isFactBound,
|
|
40
|
+
export { bindsElement, holderLabel, holderOf, isFactBound, poolOfKind };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { contentMediaIdOf } from "../../template-contracts/dist/registry-facts.js";
|
|
1
2
|
import { readLadder } from "./store.js";
|
|
2
3
|
|
|
3
4
|
//#region ../../internal/media-resolution/dist/document.js
|
|
4
5
|
const DEFAULT = {
|
|
5
|
-
|
|
6
|
+
id: "",
|
|
6
7
|
url: "",
|
|
7
8
|
filename: "",
|
|
8
9
|
content_type: "",
|
|
@@ -15,7 +16,7 @@ async function withPreview(out, previewKey, store) {
|
|
|
15
16
|
out.poster = await store.fileUrl(previewKey);
|
|
16
17
|
} catch (err) {
|
|
17
18
|
store.log?.warn({
|
|
18
|
-
|
|
19
|
+
media_id: out.id,
|
|
19
20
|
err: err.message
|
|
20
21
|
}, "resolve-document-slot: preview presign failed; no poster");
|
|
21
22
|
return out;
|
|
@@ -24,35 +25,35 @@ async function withPreview(out, previewKey, store) {
|
|
|
24
25
|
if (responsive) out.poster_responsive = responsive;
|
|
25
26
|
return out;
|
|
26
27
|
}
|
|
27
|
-
async function resolveDocumentSlot(value,
|
|
28
|
+
async function resolveDocumentSlot(value, records, store) {
|
|
28
29
|
if (value === null) return null;
|
|
29
30
|
if (typeof value !== "object") return DEFAULT;
|
|
30
31
|
const v = value;
|
|
31
|
-
const
|
|
32
|
-
if (!
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
35
|
-
store.log?.warn({
|
|
32
|
+
const mediaId = contentMediaIdOf(v) ?? "";
|
|
33
|
+
if (!mediaId) return DEFAULT;
|
|
34
|
+
const record = records.get(mediaId);
|
|
35
|
+
if (record === void 0) {
|
|
36
|
+
store.log?.warn({ media_id: mediaId }, "resolve-document-slot: no media the render may reach");
|
|
36
37
|
return DEFAULT;
|
|
37
38
|
}
|
|
38
|
-
const key =
|
|
39
|
+
const key = record.key;
|
|
39
40
|
if (key === null) {
|
|
40
|
-
store.log?.warn({
|
|
41
|
+
store.log?.warn({ media_id: mediaId }, "resolve-document-slot: media has no stored object");
|
|
41
42
|
return DEFAULT;
|
|
42
43
|
}
|
|
43
44
|
try {
|
|
44
|
-
const filename =
|
|
45
|
+
const filename = (v.picked === null && typeof v.name === "string" && v.name !== "" ? v.name : null) ?? record.name;
|
|
45
46
|
return await withPreview({
|
|
46
|
-
|
|
47
|
+
id: mediaId,
|
|
47
48
|
url: store.namedFileUrl ? await store.namedFileUrl(key, filename) : await store.fileUrl(key),
|
|
48
49
|
filename,
|
|
49
|
-
content_type:
|
|
50
|
-
size_bytes:
|
|
50
|
+
content_type: record.mime ?? "",
|
|
51
|
+
size_bytes: record.bytes ?? 0,
|
|
51
52
|
poster: ""
|
|
52
|
-
},
|
|
53
|
+
}, record.renditions.poster?.key ?? null, store);
|
|
53
54
|
} catch (err) {
|
|
54
55
|
store.log?.error({
|
|
55
|
-
|
|
56
|
+
media_id: mediaId,
|
|
56
57
|
err: err.message
|
|
57
58
|
}, "resolve-document-slot: presign failed; soft-empty document");
|
|
58
59
|
return DEFAULT;
|
|
@@ -1,35 +1,35 @@
|
|
|
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() {
|
|
8
8
|
return {
|
|
9
|
-
|
|
9
|
+
id: "",
|
|
10
10
|
url: "",
|
|
11
11
|
alt: ""
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
function servedKeyOf(
|
|
15
|
-
const maskKey = mask === void 0 ? void 0 :
|
|
16
|
-
const cutKey = cropsPart(
|
|
17
|
-
return maskKey ??
|
|
14
|
+
function servedKeyOf(record, mask) {
|
|
15
|
+
const maskKey = mask === void 0 ? void 0 : record.renditions[mask === "white" ? "mask_white" : "mask_black"]?.key;
|
|
16
|
+
const cutKey = cropsPart(record.crop) ? record.renditions.crop?.key : void 0;
|
|
17
|
+
return maskKey ?? record.renditions.cutout?.key ?? cutKey ?? record.key;
|
|
18
18
|
}
|
|
19
|
-
async function
|
|
20
|
-
if (
|
|
21
|
-
store.log?.warn({ id }, "resolve-
|
|
19
|
+
async function resolveImageMedia(id, record, store, opts) {
|
|
20
|
+
if (record === void 0) {
|
|
21
|
+
store.log?.warn({ id }, "resolve-media-id: no image media the render may reach; no media");
|
|
22
22
|
return null;
|
|
23
23
|
}
|
|
24
|
-
if (
|
|
24
|
+
if (record.kind !== "image") {
|
|
25
25
|
store.log?.warn({
|
|
26
26
|
id,
|
|
27
|
-
kind:
|
|
28
|
-
}, "resolve-
|
|
27
|
+
kind: record.kind
|
|
28
|
+
}, "resolve-media-id: media is not an image; no media");
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
31
31
|
try {
|
|
32
|
-
const servedKey = servedKeyOf(
|
|
32
|
+
const servedKey = servedKeyOf(record, opts?.mask);
|
|
33
33
|
return {
|
|
34
34
|
url: await store.servedUrl(servedKey),
|
|
35
35
|
source_key: servedKey
|
|
@@ -38,58 +38,29 @@ async function resolveImageAsset(id, asset, store, opts) {
|
|
|
38
38
|
store.log?.error({
|
|
39
39
|
id,
|
|
40
40
|
err: err.message
|
|
41
|
-
}, "resolve-
|
|
41
|
+
}, "resolve-media-id: presign failed; no media");
|
|
42
42
|
return null;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
function clamp01(n) {
|
|
46
|
-
return n < 0 ? 0 : n > 1 ? 1 : n;
|
|
47
|
-
}
|
|
48
|
-
function normalizeRect(v) {
|
|
49
|
-
const nx = typeof v.nx === "number" ? v.nx : 0;
|
|
50
|
-
const ny = typeof v.ny === "number" ? v.ny : 0;
|
|
51
|
-
const nw = typeof v.nw === "number" ? v.nw : 1;
|
|
52
|
-
const nh = typeof v.nh === "number" ? v.nh : 1;
|
|
53
|
-
if (![
|
|
54
|
-
nx,
|
|
55
|
-
ny,
|
|
56
|
-
nw,
|
|
57
|
-
nh
|
|
58
|
-
].every(Number.isFinite)) return null;
|
|
59
|
-
const r = {
|
|
60
|
-
nx: clamp01(nx),
|
|
61
|
-
ny: clamp01(ny),
|
|
62
|
-
nw: clamp01(nw),
|
|
63
|
-
nh: clamp01(nh)
|
|
64
|
-
};
|
|
65
|
-
if (r.nx === 0 && r.ny === 0 && r.nw === 1 && r.nh === 1) return null;
|
|
66
|
-
return r;
|
|
67
|
-
}
|
|
68
45
|
function renditionKey(rendition) {
|
|
69
46
|
const key = rendition && typeof rendition === "object" ? rendition.key : void 0;
|
|
70
47
|
return typeof key === "string" && key.length > 0 ? key : null;
|
|
71
48
|
}
|
|
72
49
|
function framingCrop(framing, at, mobile) {
|
|
73
|
-
const
|
|
74
|
-
const stored = rect === null ? null : {
|
|
75
|
-
x: rect.nx,
|
|
76
|
-
y: rect.ny,
|
|
77
|
-
width: rect.nw,
|
|
78
|
-
height: rect.nh
|
|
79
|
-
};
|
|
50
|
+
const stored = storedCrop(framing.crop);
|
|
80
51
|
return at === void 0 ? stored : placeCrop(stored, at.imageAspect, at.aspects, mobile);
|
|
81
52
|
}
|
|
82
53
|
function cutKeyOf(framing, photoId, crop) {
|
|
83
54
|
if (!cropsPart(crop)) return null;
|
|
84
|
-
const key = renditionKey((framing.renditions && typeof framing.renditions === "object" ? framing.renditions : {}).crop)
|
|
55
|
+
const key = renditionKey((framing.renditions && typeof framing.renditions === "object" ? framing.renditions : {}).crop);
|
|
85
56
|
return key !== null && cropKeyOwner(key) === photoId ? key : null;
|
|
86
57
|
}
|
|
87
58
|
function slotCutKey(v, at) {
|
|
88
|
-
return cutKeyOf(v,
|
|
59
|
+
return cutKeyOf(v, readMediaId(v), framingCrop(v, at));
|
|
89
60
|
}
|
|
90
61
|
function mobileCutKey(v, at) {
|
|
91
62
|
const mobile = v.mobile && typeof v.mobile === "object" ? v.mobile : at === void 0 ? null : {};
|
|
92
|
-
return mobile === null ? null : cutKeyOf(mobile,
|
|
63
|
+
return mobile === null ? null : cutKeyOf(mobile, readMediaId(v), framingCrop(mobile, at, "mobile"));
|
|
93
64
|
}
|
|
94
65
|
async function mobileCropUrl(key, store) {
|
|
95
66
|
try {
|
|
@@ -99,7 +70,7 @@ async function mobileCropUrl(key, store) {
|
|
|
99
70
|
}
|
|
100
71
|
}
|
|
101
72
|
function slotServedKey(v, mask, at) {
|
|
102
|
-
const photoId =
|
|
73
|
+
const photoId = readMediaId(v);
|
|
103
74
|
const renditions = v.renditions && typeof v.renditions === "object" ? v.renditions : {};
|
|
104
75
|
const own = (name) => {
|
|
105
76
|
const key = renditionKey(renditions[name]);
|
|
@@ -107,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
|
|
111
|
-
return
|
|
81
|
+
function readMediaId(v) {
|
|
82
|
+
return contentMediaIdOf(v) ?? "";
|
|
112
83
|
}
|
|
113
|
-
async function resolveImageValue(value,
|
|
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 =
|
|
97
|
+
const photoId = readMediaId(v);
|
|
128
98
|
const mask = v.mask === "white" || v.mask === "black" ? v.mask : null;
|
|
129
|
-
const
|
|
99
|
+
const record = photoId ? records.get(photoId) : void 0;
|
|
130
100
|
const at = aspects === void 0 ? void 0 : {
|
|
131
101
|
aspects,
|
|
132
|
-
imageAspect: imageAspectOf(
|
|
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;
|
|
@@ -139,46 +109,42 @@ async function resolveImageValue(value, assets, store, aspects) {
|
|
|
139
109
|
let desktopKey;
|
|
140
110
|
if (placedKey) {
|
|
141
111
|
base = {
|
|
142
|
-
|
|
112
|
+
id: photoId,
|
|
143
113
|
url: await store.servedUrl(placedKey),
|
|
144
114
|
alt
|
|
145
115
|
};
|
|
146
116
|
desktopKey = placedKey;
|
|
147
|
-
const uncropped = await
|
|
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
|
|
120
|
+
const served = await resolveImageMedia(photoId, record, store, mask ? { mask } : void 0);
|
|
151
121
|
if (!served) return {
|
|
152
|
-
value:
|
|
122
|
+
value: emptyImage(),
|
|
153
123
|
desktopKey: null,
|
|
154
124
|
mobileKey
|
|
155
125
|
};
|
|
156
126
|
base = {
|
|
157
|
-
|
|
127
|
+
id: photoId,
|
|
158
128
|
url: served.url,
|
|
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:
|
|
133
|
+
value: emptyImage(),
|
|
171
134
|
desktopKey: null,
|
|
172
135
|
mobileKey: null
|
|
173
136
|
};
|
|
174
137
|
return {
|
|
175
|
-
value:
|
|
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(
|
|
181
|
-
if (
|
|
146
|
+
function imageAspectOf(record, ar) {
|
|
147
|
+
if (record?.kind === "image" && record.width !== null && record.height !== null && record.width > 0 && record.height > 0) return record.width / record.height;
|
|
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,
|
|
200
|
-
const entry = await resolveImageValue(value,
|
|
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,
|
|
172
|
+
export { attachResponsive, emptyImage, mobileCutKey, resolveImageMedia, resolveImageSlot, resolveImageValue, servedKeyOf, slotCutKey };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cropKeyOwner } from "./crop-key.js";
|
|
2
2
|
import { resolveDocumentSlot } from "./document.js";
|
|
3
|
-
import { attachResponsive, emptyImage, mobileCutKey,
|
|
3
|
+
import { attachResponsive, emptyImage, mobileCutKey, resolveImageMedia, resolveImageSlot, resolveImageValue, servedKeyOf, slotCutKey } from "./image.js";
|
|
4
4
|
import { resolveTourSlot } from "./tour.js";
|
|
5
5
|
import { resolveVideoSlot } from "./video.js";
|
|
6
6
|
import { resolveMediaSlot } from "./media.js";
|
|
@@ -36,14 +36,14 @@ async function resolvePrimitiveItems(members, primitive, ctx, element) {
|
|
|
36
36
|
switch (primitive) {
|
|
37
37
|
case "image": {
|
|
38
38
|
const entries = [];
|
|
39
|
-
for (const member of members) entries.push(await resolveImageValue(member, ctx.
|
|
39
|
+
for (const member of members) entries.push(await resolveImageValue(member, ctx.records, ctx.store, slotCropAspects(element?.crop)));
|
|
40
40
|
await attachResponsive(entries, ctx.store);
|
|
41
41
|
return entries.map((entry) => entry.value ?? emptyImage());
|
|
42
42
|
}
|
|
43
|
-
case "video": return (await Promise.all(members.map((member) => resolveVideoSlot(member, ctx.
|
|
44
|
-
case "tour": return (await Promise.all(members.map((member) => resolveTourSlot(member, ctx.
|
|
45
|
-
case "document": return (await Promise.all(members.map((member) => resolveDocumentSlot(member, ctx.
|
|
46
|
-
case "media": return (await Promise.all(members.map((member) => resolveMediaSlot(member, element ?? {}, ctx.
|
|
43
|
+
case "video": return (await Promise.all(members.map((member) => resolveVideoSlot(member, ctx.records, ctx.store)))).filter((v) => v !== null);
|
|
44
|
+
case "tour": return (await Promise.all(members.map((member) => resolveTourSlot(member, ctx.records, ctx.store)))).filter((t) => t !== null);
|
|
45
|
+
case "document": return (await Promise.all(members.map((member) => resolveDocumentSlot(member, ctx.records, ctx.store)))).filter((d) => d !== null);
|
|
46
|
+
case "media": return (await Promise.all(members.map((member) => resolveMediaSlot(member, element ?? {}, ctx.records, ctx.store)))).filter((m) => m !== null);
|
|
47
47
|
case "poi": return members.map((member) => ctx.resolvePoi(member));
|
|
48
48
|
case "scalar": return members;
|
|
49
49
|
}
|
|
@@ -84,14 +84,14 @@ async function resolveField(value, field, ctx, batch) {
|
|
|
84
84
|
if (itemContentOf(field) !== null) return resolveNestedList(value, field, ctx, batch);
|
|
85
85
|
switch (primitiveOf(field.type)) {
|
|
86
86
|
case "image": {
|
|
87
|
-
const entry = await resolveImageValue(value, ctx.
|
|
87
|
+
const entry = await resolveImageValue(value, ctx.records, ctx.store, slotCropAspects(field.crop));
|
|
88
88
|
batch.push(entry);
|
|
89
89
|
return entry.value;
|
|
90
90
|
}
|
|
91
|
-
case "video": return resolveVideoSlot(value, ctx.
|
|
92
|
-
case "tour": return resolveTourSlot(value, ctx.
|
|
93
|
-
case "document": return resolveDocumentSlot(value, ctx.
|
|
94
|
-
case "media": return resolveMediaSlot(value, field, ctx.
|
|
91
|
+
case "video": return resolveVideoSlot(value, ctx.records, ctx.store);
|
|
92
|
+
case "tour": return resolveTourSlot(value, ctx.records, ctx.store);
|
|
93
|
+
case "document": return resolveDocumentSlot(value, ctx.records, ctx.store);
|
|
94
|
+
case "media": return resolveMediaSlot(value, field, ctx.records, ctx.store);
|
|
95
95
|
case "poi": return ctx.resolvePoi(value);
|
|
96
96
|
case "scalar": return value;
|
|
97
97
|
}
|
|
@@ -103,7 +103,7 @@ async function resolveNestedList(value, field, ctx, batch) {
|
|
|
103
103
|
if (content.kind === "record") return resolveRecordRows(value, content.fields, ctx, batch);
|
|
104
104
|
if (content.primitive !== "image") return resolvePrimitiveItems(value, content.primitive, ctx, field.element);
|
|
105
105
|
const entries = [];
|
|
106
|
-
for (const member of value) entries.push(await resolveImageValue(member, ctx.
|
|
106
|
+
for (const member of value) entries.push(await resolveImageValue(member, ctx.records, ctx.store, slotCropAspects(field.element?.crop)));
|
|
107
107
|
batch.push(...entries);
|
|
108
108
|
return entries.map((entry) => entry.value ?? emptyImage());
|
|
109
109
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { declaredKinds } from "../../template-contracts/dist/slot-catalog.js";
|
|
2
|
+
import { contentMediaIdOf } from "../../template-contracts/dist/registry-facts.js";
|
|
2
3
|
import { resolveDocumentSlot } from "./document.js";
|
|
3
4
|
import { slotCropAspects } from "../../template-contracts/dist/content-pick.js";
|
|
4
5
|
import { resolveImageSlot } from "./image.js";
|
|
@@ -6,47 +7,47 @@ import { resolveTourSlot } from "./tour.js";
|
|
|
6
7
|
import { resolveVideoSlot } from "./video.js";
|
|
7
8
|
|
|
8
9
|
//#region ../../internal/media-resolution/dist/media.js
|
|
9
|
-
async function resolveMediaSlot(value, declaration,
|
|
10
|
+
async function resolveMediaSlot(value, declaration, records, store) {
|
|
10
11
|
if (value === null || typeof value !== "object") return null;
|
|
11
|
-
const
|
|
12
|
-
if (
|
|
13
|
-
const
|
|
14
|
-
if (
|
|
15
|
-
store.log?.warn({
|
|
12
|
+
const mediaId = contentMediaIdOf(value);
|
|
13
|
+
if (mediaId === void 0) return null;
|
|
14
|
+
const record = records.get(mediaId);
|
|
15
|
+
if (record === void 0) {
|
|
16
|
+
store.log?.warn({ media_id: mediaId }, "resolve-media-slot: no media the render may reach");
|
|
16
17
|
return null;
|
|
17
18
|
}
|
|
18
|
-
if (!declaredKinds(declaration).includes(
|
|
19
|
+
if (!declaredKinds(declaration).includes(record.kind)) {
|
|
19
20
|
store.log?.warn({
|
|
20
|
-
|
|
21
|
-
kind:
|
|
22
|
-
}, "resolve-media-slot:
|
|
21
|
+
media_id: mediaId,
|
|
22
|
+
kind: record.kind
|
|
23
|
+
}, "resolve-media-slot: media is of a kind the slot does not hold");
|
|
23
24
|
return null;
|
|
24
25
|
}
|
|
25
|
-
const reference = {
|
|
26
|
-
switch (
|
|
26
|
+
const reference = { media: mediaId };
|
|
27
|
+
switch (record.kind) {
|
|
27
28
|
case "image": {
|
|
28
|
-
const image = await resolveImageSlot(value,
|
|
29
|
+
const image = await resolveImageSlot(value, records, store, slotCropAspects(declaration.crop));
|
|
29
30
|
return image === null ? null : {
|
|
30
31
|
...image,
|
|
31
32
|
kind: "image"
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
35
|
case "video": {
|
|
35
|
-
const video = await resolveVideoSlot(reference,
|
|
36
|
+
const video = await resolveVideoSlot(reference, records, store);
|
|
36
37
|
return video === null ? null : {
|
|
37
38
|
...video,
|
|
38
39
|
kind: "video"
|
|
39
40
|
};
|
|
40
41
|
}
|
|
41
42
|
case "tour": {
|
|
42
|
-
const tour = await resolveTourSlot(reference,
|
|
43
|
+
const tour = await resolveTourSlot(reference, records, store);
|
|
43
44
|
return tour === null ? null : {
|
|
44
45
|
...tour,
|
|
45
46
|
kind: "tour"
|
|
46
47
|
};
|
|
47
48
|
}
|
|
48
49
|
case "document": {
|
|
49
|
-
const document = await resolveDocumentSlot(reference,
|
|
50
|
+
const document = await resolveDocumentSlot(reference, records, store);
|
|
50
51
|
return document === null ? null : {
|
|
51
52
|
...document,
|
|
52
53
|
kind: "document"
|