@homepages/concrete 8.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.
- package/CHANGELOG.md +1005 -0
- package/README.md +20 -9
- package/codemods/list-grammar.mjs +923 -0
- package/codemods/manifest.json +64 -0
- package/codemods/process-builders.mjs +198 -0
- package/codemods/slot-object.mjs +1097 -0
- package/codemods/steps/content-object-fields.mjs +324 -0
- package/codemods/steps/list-object-form.mjs +6 -7
- package/codemods/table-rows.mjs +568 -0
- package/codemods/unwrap-object-fields.mjs +310 -0
- package/codemods/viewer-slot-document.mjs +131 -0
- package/codemods/write-property-as-facts-document.mjs +716 -0
- package/codemods/write-the-address-line.mjs +255 -0
- package/codemods/write-the-registry-members.mjs +653 -0
- package/codemods/write-the-select-from.mjs +141 -0
- package/codemods/write-the-sole-from.mjs +369 -0
- package/codemods/write-the-table-from.mjs +267 -0
- package/codemods/write-the-whole-item.mjs +512 -0
- package/codemods/writeback-drop.mjs +168 -0
- package/codemods/written-contact-address.mjs +162 -0
- package/codemods/written-media-category.mjs +227 -0
- package/codemods/written-ref-kinds-name-the-layer.mjs +172 -0
- package/codemods/written-uploads-replace-pool-reads.mjs +454 -0
- package/codemods/written-uploads-sort-into-lists.mjs +405 -0
- package/codemods/written-uploads-stated-in-sorted-lists.mjs +295 -0
- package/codemods/written-video-sources-drop.mjs +144 -0
- package/codemods/written-without-pick-none.mjs +146 -0
- package/codemods/written-without-retired-knowledge.mjs +223 -0
- package/codemods/written-without-the-media-key.mjs +202 -0
- package/codemods/written-without-the-property-type.mjs +249 -0
- package/dist/artifact/playground/client/assets/index-BOYbgBnP.js +1259 -0
- package/dist/artifact/playground/client/assets/index-DDOcM0zA.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 +61 -27
- package/dist/base.css +58 -1
- package/dist/cli/build/artifact.js +6 -9
- package/dist/cli/build/captures.js +2 -12
- package/dist/cli/build/esbuild.js +1 -25
- package/dist/cli/build/fixtures.js +2 -1
- package/dist/cli/build/icons.js +1 -1
- package/dist/cli/build/static.js +2 -2
- package/dist/cli/capture/capture.js +8 -9
- package/dist/cli/check/analyze.js +8 -1
- package/dist/cli/check/load-outdir.js +47 -0
- package/dist/cli/check/load-workspace.js +4 -4
- package/dist/cli/check/render/html.js +1 -2
- package/dist/cli/check/render/inputs.js +10 -3
- package/dist/cli/check/render/island-frames.js +2 -1
- package/dist/cli/check/render/marker-coverage.js +23 -15
- package/dist/cli/check/report.js +5 -0
- package/dist/cli/check/stages/bundles.js +1 -1
- package/dist/cli/check/stages/relations.js +1 -1
- package/dist/cli/check/stages/render.js +48 -33
- package/dist/cli/check/stages/sections.js +83 -31
- package/dist/cli/check/stages/workspace.js +2 -0
- package/dist/cli/check/template-key.js +16 -0
- package/dist/cli/commands.js +1 -1
- package/dist/cli/dev/crop.js +1 -1
- package/dist/cli/dev/fixture-ladders.js +96 -0
- package/dist/cli/dev/islands.js +12 -123
- package/dist/cli/dev/listen.js +20 -1
- package/dist/cli/dev/load-template.js +1 -1
- package/dist/cli/dev/server.js +35 -10
- package/dist/cli/dev/vite.js +9 -7
- package/dist/cli/dev/workspace-reader.js +16 -16
- package/dist/cli/media/derive.js +43 -57
- package/dist/cli/media/frame-rung-floor.js +0 -1
- package/dist/cli/property/index.js +1 -6
- package/dist/css/inline.js +1 -22
- package/dist/eslint/rules/no-marker-literal.js +1 -1
- package/dist/fixtures/load.js +16 -7
- package/dist/fixtures/media-plugin.js +17 -12
- package/dist/fixtures/media-store.js +115 -0
- package/dist/fixtures/property.js +345 -126
- package/dist/fixtures/resolve.js +260 -251
- package/dist/fixtures/rows.js +4 -11
- package/dist/fixtures.d.ts +234 -109
- package/dist/index.d.ts +25 -16
- package/dist/index.js +10 -6
- package/dist/islands/marker.js +2 -1
- package/dist/packages/external/concrete/package.js +1 -1
- package/dist/packages/internal/canvas-core/dist/island-host.js +62 -0
- package/dist/packages/internal/canvas-core/dist/island-shields.js +30 -0
- package/dist/packages/internal/capture-settle/dist/index.js +3 -0
- package/dist/packages/internal/capture-settle/dist/island-markers.d.ts +13 -0
- package/dist/packages/internal/capture-settle/dist/island-markers.js +6 -0
- package/dist/packages/internal/capture-settle/dist/settle.js +150 -0
- package/dist/packages/internal/{image-ladder/dist/crop.js → crop-region/dist/index.js} +21 -20
- package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +250 -46
- package/dist/packages/internal/fill-bake/dist/compute-reads.js +361 -4
- package/dist/packages/internal/fill-bake/dist/derive-source.js +25 -18
- package/dist/packages/internal/fill-bake/dist/index.js +9 -3
- package/dist/packages/internal/fill-bake/dist/item-merge.js +113 -0
- package/dist/packages/internal/fill-bake/dist/item-overrides.js +1 -0
- package/dist/packages/internal/fill-bake/dist/linked-merge.js +38 -0
- package/dist/packages/internal/fill-bake/dist/list-grammar.js +174 -0
- package/dist/packages/internal/fill-bake/dist/stored-row-reader.js +1 -0
- package/dist/packages/internal/fill-vocabulary/dist/holder.js +51 -0
- package/dist/packages/internal/fill-vocabulary/dist/resolved-decision.js +363 -0
- package/dist/packages/internal/fill-vocabulary/dist/row-planners.js +1 -23
- package/dist/packages/internal/fill-vocabulary/dist/verbs.js +60 -0
- package/dist/packages/internal/format-geometry/dist/capture.js +11 -147
- package/dist/packages/internal/format-geometry/dist/format.d.ts +8 -2
- package/dist/packages/internal/format-geometry/dist/geometry.js +13 -2
- package/dist/packages/internal/image-ladder/dist/encode.js +27 -14
- package/dist/packages/internal/image-ladder/dist/index.js +3 -3
- package/dist/packages/internal/image-ladder/dist/policy.js +28 -53
- package/dist/packages/internal/island-runtime/dist/capture-holds.js +1 -1
- package/dist/packages/internal/island-runtime/dist/contract.d.ts +3 -12
- package/dist/packages/internal/island-runtime/dist/contract.js +2 -2
- package/dist/packages/internal/island-runtime/dist/index.d.ts +3 -7
- package/dist/packages/internal/island-runtime/dist/index.js +2 -1
- package/dist/packages/internal/island-runtime/dist/viewport-schedule.js +1 -1
- package/dist/packages/internal/media-resolution/dist/crop-key.js +7 -0
- package/dist/packages/internal/media-resolution/dist/document.js +63 -0
- package/dist/packages/internal/media-resolution/dist/image.js +226 -0
- package/dist/packages/internal/media-resolution/dist/index.js +11 -0
- package/dist/packages/internal/media-resolution/dist/list.js +112 -0
- package/dist/packages/internal/media-resolution/dist/media.js +59 -0
- package/dist/packages/internal/media-resolution/dist/records.js +7 -0
- package/dist/packages/internal/media-resolution/dist/slot.js +37 -0
- package/dist/packages/internal/media-resolution/dist/store.js +19 -0
- package/dist/packages/internal/media-resolution/dist/tour.js +59 -0
- package/dist/packages/internal/media-resolution/dist/video.js +93 -0
- package/dist/packages/internal/property-facts/dist/registry-facts.js +245 -0
- package/dist/packages/internal/section-contracts/dist/cap-contract.js +8 -17
- package/dist/packages/internal/section-contracts/dist/catalog.js +34 -14
- package/dist/packages/internal/section-contracts/dist/count-bounds-contract.js +11 -2
- package/dist/packages/internal/section-contracts/dist/directly-linked-list-contract.js +21 -0
- package/dist/packages/internal/section-contracts/dist/fill-options.js +12 -0
- package/dist/packages/internal/section-contracts/dist/fill-spec-view.js +1 -5
- package/dist/packages/internal/section-contracts/dist/fill-verb-contract.js +95 -0
- package/dist/packages/internal/section-contracts/dist/grammar-scope.js +154 -0
- package/dist/packages/internal/section-contracts/dist/index.js +7 -2
- package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +2 -36
- package/dist/packages/internal/section-contracts/dist/list-scalar-contract.js +12 -21
- package/dist/packages/internal/section-contracts/dist/list-source-contract.js +46 -0
- package/dist/packages/internal/section-contracts/dist/nested-slot-contract.js +11 -2
- package/dist/packages/internal/section-contracts/dist/object-contract.js +92 -0
- package/dist/packages/internal/section-contracts/dist/poi-curation-contract.js +9 -5
- package/dist/packages/internal/section-contracts/dist/reads-acyclic-contract.js +63 -0
- package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +6 -17
- package/dist/packages/internal/section-contracts/dist/row-rule-contract.js +80 -0
- package/dist/packages/internal/section-contracts/dist/row-source-contract.js +67 -0
- package/dist/packages/internal/section-contracts/dist/runners.js +77 -18
- package/dist/packages/internal/section-contracts/dist/select-contract.js +0 -8
- package/dist/packages/internal/section-contracts/dist/source-contract.js +89 -95
- package/dist/packages/internal/section-contracts/dist/sources-contract.js +47 -17
- package/dist/packages/internal/section-contracts/dist/table-member.js +16 -0
- package/dist/packages/internal/section-contracts/dist/writer-reads-fact-contract.js +39 -23
- package/dist/packages/internal/source-resolution/dist/index.js +113 -73
- package/dist/packages/internal/static-assets-binding/dist/section-asset-url.js +16 -0
- package/dist/packages/internal/street-address/dist/index.js +72 -0
- package/dist/packages/internal/template-artifact/dist/asset-mime.js +30 -0
- package/dist/packages/internal/template-artifact/dist/layout.js +1 -2
- package/dist/packages/internal/template-artifact/dist/manifest.js +1 -1
- package/dist/packages/internal/template-artifact/dist/verify.js +12 -29
- package/dist/packages/internal/template-contracts/dist/address-value.d.ts +52 -0
- package/dist/packages/internal/template-contracts/dist/address-value.js +90 -0
- package/dist/packages/internal/template-contracts/dist/comparable-address.js +19 -0
- package/dist/{schema → packages/internal/template-contracts/dist}/compute.d.ts +29 -6
- package/dist/{schema → packages/internal/template-contracts/dist}/compute.js +11 -13
- package/dist/packages/internal/template-contracts/dist/content-pick.js +51 -0
- package/dist/packages/internal/template-contracts/dist/decision-fills.js +81 -0
- package/dist/packages/internal/template-contracts/dist/display-overrides.js +7 -0
- package/dist/packages/internal/template-contracts/dist/document-value.d.ts +16 -5
- package/dist/packages/internal/template-contracts/dist/fact-compute.d.ts +24 -0
- package/dist/packages/internal/template-contracts/dist/fact-compute.js +30 -0
- package/dist/packages/internal/template-contracts/dist/fact-keys.d.ts +44 -0
- package/dist/packages/internal/template-contracts/dist/fact-keys.js +88 -0
- package/dist/packages/internal/template-contracts/dist/fact-registry.d.ts +290 -0
- package/dist/packages/internal/template-contracts/dist/fact-registry.js +598 -0
- package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +10 -24
- package/dist/packages/internal/template-contracts/dist/fill-builders.d.ts +157 -0
- package/dist/packages/internal/template-contracts/dist/fill-builders.js +79 -0
- package/dist/packages/internal/template-contracts/dist/fill-declaration.d.ts +14 -0
- package/dist/{schema → packages/internal/template-contracts/dist}/fill-declaration.js +6 -5
- package/dist/packages/internal/template-contracts/dist/fill-spec-schema.js +93 -0
- package/dist/packages/internal/template-contracts/dist/fill-spec.js +291 -0
- package/dist/packages/internal/template-contracts/dist/findable.js +8 -0
- package/dist/packages/internal/template-contracts/dist/floor-presets.js +13 -0
- package/dist/packages/internal/template-contracts/dist/icon-names.d.ts +5 -0
- package/dist/packages/internal/template-contracts/dist/icon-names.js +70 -0
- package/dist/packages/internal/template-contracts/dist/legacy-facts.js +167 -0
- package/dist/packages/internal/template-contracts/dist/list-editing.js +93 -0
- package/dist/packages/internal/template-contracts/dist/list.d.ts +215 -0
- package/dist/packages/internal/template-contracts/dist/list.js +258 -0
- package/dist/packages/internal/template-contracts/dist/markers.d.ts +2 -2
- package/dist/packages/internal/template-contracts/dist/media-candidates.js +38 -0
- package/dist/packages/internal/template-contracts/dist/mirror-kind.js +48 -0
- package/dist/packages/internal/template-contracts/dist/number-display.js +10 -0
- package/dist/packages/internal/template-contracts/dist/object.d.ts +89 -0
- package/dist/packages/internal/template-contracts/dist/object.js +131 -0
- package/dist/packages/internal/template-contracts/dist/poi-row.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/primitive-descriptors.d.ts +1 -0
- package/dist/packages/internal/template-contracts/dist/primitive-descriptors.js +162 -0
- package/dist/packages/internal/template-contracts/dist/process-builders.d.ts +77 -0
- package/dist/packages/internal/template-contracts/dist/process-builders.js +73 -0
- package/dist/packages/internal/template-contracts/dist/read-graph.js +240 -0
- package/dist/packages/internal/template-contracts/dist/ref-locate.js +176 -0
- package/dist/packages/internal/template-contracts/dist/registry-aliases.js +77 -0
- package/dist/packages/internal/template-contracts/dist/registry-facts.d.ts +270 -0
- package/dist/packages/internal/template-contracts/dist/registry-facts.js +202 -0
- package/dist/packages/internal/template-contracts/dist/registry-shape.d.ts +41 -0
- package/dist/packages/internal/template-contracts/dist/registry-shape.js +135 -0
- package/dist/packages/internal/template-contracts/dist/resolve-scope.js +103 -0
- package/dist/packages/internal/{image-descriptor/dist/index.d.ts → template-contracts/dist/responsive-image.d.ts} +1 -1
- package/dist/packages/internal/template-contracts/dist/row-planners.js +29 -0
- package/dist/packages/internal/template-contracts/dist/row-ref.d.ts +127 -0
- package/dist/packages/internal/template-contracts/dist/row-ref.js +101 -0
- package/dist/packages/internal/template-contracts/dist/row-sources.js +41 -5
- package/dist/packages/internal/template-contracts/dist/row.d.ts +155 -0
- package/dist/packages/internal/template-contracts/dist/row.js +84 -0
- package/dist/packages/internal/template-contracts/dist/runtime-values.d.ts +97 -0
- package/dist/packages/internal/template-contracts/dist/slot-builders.d.ts +782 -0
- package/dist/packages/internal/template-contracts/dist/slot-builders.js +233 -0
- package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +233 -405
- package/dist/packages/internal/template-contracts/dist/slot-catalog.js +331 -227
- package/dist/packages/internal/template-contracts/dist/slot-overrides.js +21 -0
- package/dist/packages/internal/template-contracts/dist/slot-ref.d.ts +155 -0
- package/dist/packages/internal/template-contracts/dist/slot-ref.js +76 -0
- package/dist/packages/internal/template-contracts/dist/slot-types.d.ts +163 -0
- package/dist/packages/internal/template-contracts/dist/slot-types.js +139 -0
- package/dist/packages/internal/template-contracts/dist/slot-value.d.ts +95 -0
- package/dist/packages/internal/template-contracts/dist/table-members.d.ts +25 -0
- package/dist/packages/internal/template-contracts/dist/table-members.js +90 -0
- package/dist/packages/internal/template-contracts/dist/tour-value.d.ts +5 -5
- package/dist/packages/internal/template-contracts/dist/value-contracts.js +15 -0
- package/dist/packages/internal/template-contracts/dist/video-value.d.ts +2 -2
- package/dist/platform/fs.js +5 -2
- package/dist/playground/canvas-island-host.d.ts +11 -0
- package/dist/playground/canvas-island-host.js +29 -0
- package/dist/playground/canvas-markers.js +14 -0
- package/dist/playground-island-runtime.d.ts +3 -2
- package/dist/playground-island-runtime.js +3 -2
- package/dist/primitives/FrameShell.js +0 -1
- package/dist/primitives/Image.d.ts +5 -4
- package/dist/primitives/Tour.d.ts +1 -1
- package/dist/primitives/Video.d.ts +2 -2
- package/dist/primitives/index.d.ts +2 -3
- package/dist/primitives/picture-sources.js +2 -2
- package/dist/primitives/probe-context.js +2 -12
- package/dist/primitives/slot-address.d.ts +44 -0
- package/dist/primitives/slot-address.js +19 -0
- package/dist/primitives/slot-bindings.d.ts +65 -26
- package/dist/primitives/slot-bindings.js +104 -46
- package/dist/primitives/slot-document.d.ts +23 -18
- package/dist/primitives/slot-document.js +39 -14
- package/dist/primitives/slot-download.d.ts +39 -0
- package/dist/primitives/slot-download.js +39 -0
- package/dist/primitives/slot-list.d.ts +3 -3
- package/dist/primitives/slot-list.js +0 -2
- package/dist/primitives/slot-media.d.ts +24 -5
- package/dist/primitives/slot-media.js +6 -9
- package/dist/primitives/slot-object.d.ts +49 -0
- package/dist/primitives/slot-object.js +20 -0
- package/dist/primitives/slot-scalar.d.ts +27 -2
- package/dist/primitives/slot-scalar.js +50 -7
- package/dist/primitives/slot.d.ts +13 -6
- package/dist/primitives/slot.js +10 -3
- package/dist/rules/registry.js +25 -30
- package/dist/schema/define-schema.d.ts +4 -8
- package/dist/schema/define-schema.js +178 -79
- package/dist/schema/extract-fill-spec.js +2 -153
- package/dist/schema/fact.d.ts +57 -15
- package/dist/schema/fact.js +42 -7
- package/dist/schema/facts-view.d.ts +14 -0
- package/dist/schema/format.d.ts +1 -0
- package/dist/schema/format.js +2 -1
- package/dist/schema/manifest.js +24 -0
- package/dist/schema/property-facts.d.ts +8 -12
- package/dist/schema/section-props.d.ts +2 -66
- package/dist/schema/section-schema.d.ts +8 -11
- package/dist/schema/section-schema.js +27 -10
- package/dist/section/declare.d.ts +18 -7
- package/dist/section/declare.js +18 -5
- package/dist/section/materialize.js +3 -8
- package/dist/section/section.d.ts +12 -8
- package/dist/section/section.js +1 -1
- package/dist/template/logic-shim.d.ts +14 -7
- package/dist/template/logic-shim.js +14 -7
- package/dist/template/materialize.js +17 -18
- package/dist/template/mirror-types.js +30 -31
- package/dist/template/section-reads.js +85 -9
- 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 +2 -2
- package/guide/reference/cli/publish.md +1 -1
- package/guide/reference/cli/upgrade.md +1 -1
- package/guide/reference/rules/INDEX.md +29 -25
- package/package.json +9 -8
- package/dist/artifact/playground/client/assets/index-CckS2ONm.css +0 -1
- package/dist/artifact/playground/client/assets/index-Dn_xT16-.js +0 -1101
- package/dist/fixtures/canonical.d.ts +0 -166
- package/dist/fixtures/media.js +0 -163
- package/dist/packages/internal/fill-vocabulary/dist/origination.js +0 -51
- package/dist/packages/internal/fill-vocabulary/dist/row-reads.js +0 -15
- package/dist/packages/internal/format-geometry/dist/index.js +0 -4
- package/dist/packages/internal/property-facts/dist/derive-facts-view.js +0 -10
- package/dist/packages/internal/property-facts/dist/index.js +0 -3
- package/dist/packages/internal/property-facts/dist/property-facts-Cy7-O4p0.js +0 -189
- package/dist/packages/internal/section-contracts/dist/group-contract.js +0 -19
- package/dist/packages/internal/section-contracts/dist/record-collection-contract.js +0 -24
- package/dist/packages/internal/template-contracts/dist/collection-editing.js +0 -22
- package/dist/packages/internal/template-contracts/dist/facts-view.js +0 -104
- package/dist/packages/internal/template-contracts/dist/select-key.js +0 -7
- package/dist/primitives/slot-group.d.ts +0 -40
- package/dist/primitives/slot-group.js +0 -36
- package/dist/schema/extract-used-facts.js +0 -34
- package/dist/schema/fill-builders.d.ts +0 -115
- package/dist/schema/fill-builders.js +0 -25
- package/dist/schema/fill-declaration.d.ts +0 -14
- package/dist/schema/fill-spec.js +0 -98
- package/dist/schema/layout.d.ts +0 -30
- package/dist/schema/layout.js +0 -14
- package/dist/schema/row-fields.js +0 -88
- package/dist/schema/row-ref.d.ts +0 -59
- package/dist/schema/row-ref.js +0 -28
- package/dist/schema/runtime-values.d.ts +0 -71
- package/dist/schema/section-nav.js +0 -14
- package/dist/schema/slot-builders.d.ts +0 -633
- package/dist/schema/slot-builders.js +0 -177
- package/dist/schema/slot-ref.d.ts +0 -79
- package/dist/schema/slot-ref.js +0 -41
- package/dist/schema/slot-types.d.ts +0 -111
- package/dist/schema/slot-types.js +0 -214
- package/dist/section/groups.js +0 -68
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { tableKeyOf, tableKeyOfSource } from "./slot-catalog.js";
|
|
2
|
+
import "./mirror-kind.js";
|
|
3
|
+
|
|
4
|
+
//#region ../../internal/template-contracts/dist/ref-locate.js
|
|
5
|
+
function refSectionKey(key) {
|
|
6
|
+
const slash = key.indexOf("/");
|
|
7
|
+
return slash === -1 ? key : key.slice(slash + 1);
|
|
8
|
+
}
|
|
9
|
+
function placementOf(pages, pageState = []) {
|
|
10
|
+
const first = /* @__PURE__ */ new Map();
|
|
11
|
+
for (const page of pages) for (const entry of page.sections) {
|
|
12
|
+
const key = refSectionKey(entry.section);
|
|
13
|
+
if (!first.has(key)) first.set(key, entry.instance_id);
|
|
14
|
+
}
|
|
15
|
+
const disabled = new Set(pageState.filter((state) => !state.enabled).map((state) => state.page_id));
|
|
16
|
+
const readable = (localKey) => {
|
|
17
|
+
const instanceId = first.get(localKey);
|
|
18
|
+
if (instanceId === void 0) return void 0;
|
|
19
|
+
return pages.filter((page) => page.sections.some((entry) => entry.instance_id === instanceId)).every((page) => disabled.has(page.id)) ? void 0 : instanceId;
|
|
20
|
+
};
|
|
21
|
+
function locate(ref, reader) {
|
|
22
|
+
if (ref.kind === "home") return {
|
|
23
|
+
layer: "home",
|
|
24
|
+
key: ref.key
|
|
25
|
+
};
|
|
26
|
+
const instanceId = ref.section === refSectionKey(reader.section) ? reader.instanceId : readable(ref.section);
|
|
27
|
+
return instanceId === void 0 ? void 0 : {
|
|
28
|
+
layer: "section",
|
|
29
|
+
instanceId,
|
|
30
|
+
slot: ref.slot
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
readable,
|
|
35
|
+
locate
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function mirrorRefOf(def) {
|
|
39
|
+
if (def.type === "object") return null;
|
|
40
|
+
const source = def.source;
|
|
41
|
+
if (source === null || typeof source !== "object") return null;
|
|
42
|
+
const { kind, section, slot } = source;
|
|
43
|
+
return kind === "section" && typeof section === "string" && typeof slot === "string" ? {
|
|
44
|
+
kind: "section",
|
|
45
|
+
section,
|
|
46
|
+
slot
|
|
47
|
+
} : null;
|
|
48
|
+
}
|
|
49
|
+
const isRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
50
|
+
function sectionSlotAt(slots, id) {
|
|
51
|
+
if (Object.hasOwn(slots, id)) return slots[id];
|
|
52
|
+
const dot = id.indexOf(".");
|
|
53
|
+
if (dot <= 0) return void 0;
|
|
54
|
+
const object = slots[id.slice(0, dot)];
|
|
55
|
+
if (object?.type !== "object" || !isRecord(object.fields)) return void 0;
|
|
56
|
+
const field = id.slice(dot + 1);
|
|
57
|
+
return Object.hasOwn(object.fields, field) ? object.fields[field] : void 0;
|
|
58
|
+
}
|
|
59
|
+
function slotInScope(slots, reader, key) {
|
|
60
|
+
if (reader.siblings !== void 0 && Object.hasOwn(reader.siblings, key)) return {
|
|
61
|
+
path: reader.container === void 0 ? key : `${reader.container}.${key}`,
|
|
62
|
+
def: reader.siblings[key],
|
|
63
|
+
sibling: true
|
|
64
|
+
};
|
|
65
|
+
if (reader.nested === true) return void 0;
|
|
66
|
+
const def = sectionSlotAt(slots, key);
|
|
67
|
+
return def === void 0 ? void 0 : {
|
|
68
|
+
path: key,
|
|
69
|
+
def,
|
|
70
|
+
sibling: false
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function isHolderKind(type) {
|
|
74
|
+
return type === "row" || type === "address";
|
|
75
|
+
}
|
|
76
|
+
function holderOf(slots, reader, key) {
|
|
77
|
+
const found = slotInScope(slots, reader, key);
|
|
78
|
+
if (found === void 0 || !isHolderKind(found.def.type)) return void 0;
|
|
79
|
+
return {
|
|
80
|
+
...found,
|
|
81
|
+
kind: found.def.type
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function rowTableOf(row) {
|
|
85
|
+
return tableKeyOf(row.from);
|
|
86
|
+
}
|
|
87
|
+
function rowTablesOf(row) {
|
|
88
|
+
if (!Array.isArray(row.from)) {
|
|
89
|
+
const table = rowTableOf(row);
|
|
90
|
+
return table === null ? [] : [table];
|
|
91
|
+
}
|
|
92
|
+
return row.from.flatMap((key) => tableKeyOf(key) ?? []);
|
|
93
|
+
}
|
|
94
|
+
function attributedRows(facts, tables) {
|
|
95
|
+
const seen = /* @__PURE__ */ new Set();
|
|
96
|
+
const out = [];
|
|
97
|
+
for (const table of tables) {
|
|
98
|
+
const rows = facts[table.table];
|
|
99
|
+
for (const row of rows) {
|
|
100
|
+
const id = nonEmpty(row["id"]);
|
|
101
|
+
if (id === null || seen.has(id)) continue;
|
|
102
|
+
seen.add(id);
|
|
103
|
+
out.push({
|
|
104
|
+
id,
|
|
105
|
+
table
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return out;
|
|
110
|
+
}
|
|
111
|
+
function heldRowTableOf(facts, tables, id) {
|
|
112
|
+
if (tables.length > 1 && id !== null) {
|
|
113
|
+
const held = attributedRows(facts, tables).find((row) => row.id === id);
|
|
114
|
+
if (held !== void 0) return held.table;
|
|
115
|
+
}
|
|
116
|
+
return tables[0] ?? null;
|
|
117
|
+
}
|
|
118
|
+
function itemHolderOf(item) {
|
|
119
|
+
if (item === void 0) return void 0;
|
|
120
|
+
if (isElementSource(item.source)) return item;
|
|
121
|
+
if (item.type !== "object" || !isRecord(item.fields)) return void 0;
|
|
122
|
+
const held = Object.values(item.fields).filter((field) => isElementSource(field.source));
|
|
123
|
+
return held.length === 1 ? held[0] : void 0;
|
|
124
|
+
}
|
|
125
|
+
function itemRowTablesOf(item) {
|
|
126
|
+
const holder = itemHolderOf(item);
|
|
127
|
+
return holder?.type === "row" ? rowTablesOf(holder) : [];
|
|
128
|
+
}
|
|
129
|
+
function isElementSource(source) {
|
|
130
|
+
return isRecord(source) && source["kind"] === "element";
|
|
131
|
+
}
|
|
132
|
+
function slotTableOf(scope, id) {
|
|
133
|
+
return oneTable(tablesAt(scope, scope.section, scope.slots, id, /* @__PURE__ */ new Set()));
|
|
134
|
+
}
|
|
135
|
+
function listTableOf(scope, list) {
|
|
136
|
+
return oneTable(listTablesOf(scope, list));
|
|
137
|
+
}
|
|
138
|
+
function listTablesOf(scope, list) {
|
|
139
|
+
return listTables(scope, scope.section, scope.slots, list, /* @__PURE__ */ new Set());
|
|
140
|
+
}
|
|
141
|
+
function oneTable(tables) {
|
|
142
|
+
return tables.length === 1 ? tables[0] : null;
|
|
143
|
+
}
|
|
144
|
+
function tablesAt(scope, section, slots, id, seen) {
|
|
145
|
+
const visit = `${section ?? ""}\u0000${id}`;
|
|
146
|
+
if (seen.has(visit)) return [];
|
|
147
|
+
seen.add(visit);
|
|
148
|
+
const def = sectionSlotAt(slots, id);
|
|
149
|
+
if (def?.type === "row") return rowTablesOf(def);
|
|
150
|
+
if (def?.type === "list") return listTables(scope, section, slots, def, seen);
|
|
151
|
+
return [];
|
|
152
|
+
}
|
|
153
|
+
function listTables(scope, section, slots, list, seen) {
|
|
154
|
+
const source = isRecord(list.source) ? list.source : void 0;
|
|
155
|
+
if (source === void 0 || source["kind"] === "authored" || source["kind"] === "derived") return itemRowTablesOf(list.element);
|
|
156
|
+
const table = tableKeyOfSource(source);
|
|
157
|
+
if (table !== null) return [table];
|
|
158
|
+
const { kind, section: target, slot } = source;
|
|
159
|
+
if (kind !== "section" || typeof target !== "string" || typeof slot !== "string") return [];
|
|
160
|
+
if (target === section) return tablesAt(scope, section, slots, slot, seen);
|
|
161
|
+
const other = scope.sectionSlots?.(target);
|
|
162
|
+
return other === void 0 ? [] : tablesAt(scope, target, other, slot, seen);
|
|
163
|
+
}
|
|
164
|
+
const nonEmpty = (value) => typeof value === "string" && value !== "" ? value : null;
|
|
165
|
+
function elementIdentity(element, table = null) {
|
|
166
|
+
if (typeof element === "string") return table === null ? null : nonEmpty(element);
|
|
167
|
+
const field = elementIdentityField(element);
|
|
168
|
+
return field === null ? null : nonEmpty(element[field]);
|
|
169
|
+
}
|
|
170
|
+
function elementIdentityField(element) {
|
|
171
|
+
if (!isRecord(element)) return null;
|
|
172
|
+
return ["id", "asset_id"].find((key) => nonEmpty(element[key]) !== null) ?? null;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
//#endregion
|
|
176
|
+
export { attributedRows, elementIdentity, elementIdentityField, heldRowTableOf, holderOf, isHolderKind, itemHolderOf, itemRowTablesOf, listTableOf, listTablesOf, mirrorRefOf, placementOf, refSectionKey, rowTableOf, rowTablesOf, sectionSlotAt, slotInScope, slotTableOf };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { isLegacyTable, tableKeyOf } from "./slot-catalog.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../internal/template-contracts/dist/registry-aliases.js
|
|
4
|
+
const REGISTRY_FACT_LEGACY = {
|
|
5
|
+
"property.listing_intent": "listing_intent",
|
|
6
|
+
"property.description": "description",
|
|
7
|
+
"property.address": "address",
|
|
8
|
+
"property.address.street": "address_street",
|
|
9
|
+
"property.address.unit": "address_unit",
|
|
10
|
+
"property.address.city": "address_city",
|
|
11
|
+
"property.address.state": "address_state",
|
|
12
|
+
"property.address.postal": "address_postal",
|
|
13
|
+
"property.address.latitude": "lat",
|
|
14
|
+
"property.address.longitude": "lon"
|
|
15
|
+
};
|
|
16
|
+
const REGISTRY_MEMBER_LEGACY = {
|
|
17
|
+
units: {
|
|
18
|
+
label: "unit_label",
|
|
19
|
+
beds: "beds",
|
|
20
|
+
baths: "baths",
|
|
21
|
+
sqft: "sqft",
|
|
22
|
+
price: "price"
|
|
23
|
+
},
|
|
24
|
+
contacts: {
|
|
25
|
+
headshot: "headshot",
|
|
26
|
+
name: "name",
|
|
27
|
+
title: "title",
|
|
28
|
+
org_name: "org_name",
|
|
29
|
+
email: "email",
|
|
30
|
+
phone: "phone",
|
|
31
|
+
website: "website",
|
|
32
|
+
bio: "bio",
|
|
33
|
+
logo_dark: "logo_dark",
|
|
34
|
+
logo_light: "logo_light",
|
|
35
|
+
instagram: "instagram",
|
|
36
|
+
linkedin: "linkedin",
|
|
37
|
+
x: "x",
|
|
38
|
+
facebook: "facebook"
|
|
39
|
+
},
|
|
40
|
+
comparables: {
|
|
41
|
+
price: "price",
|
|
42
|
+
sale_date: "sale_date",
|
|
43
|
+
beds: "beds",
|
|
44
|
+
baths: "baths",
|
|
45
|
+
sqft: "sqft",
|
|
46
|
+
photo: "photo",
|
|
47
|
+
year_built: "year_built",
|
|
48
|
+
lot_sqft: "lot_sqft",
|
|
49
|
+
stories: "stories",
|
|
50
|
+
units: "units",
|
|
51
|
+
hoa_monthly: "hoa_monthly",
|
|
52
|
+
list_price: "list_price",
|
|
53
|
+
listed_date: "listed_date",
|
|
54
|
+
mls_number: "mls_number",
|
|
55
|
+
description: "description",
|
|
56
|
+
status: "status",
|
|
57
|
+
distance_m: "distance_m",
|
|
58
|
+
price_period: "price_period"
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
function legacyMemberOf(table, member) {
|
|
62
|
+
const members = REGISTRY_MEMBER_LEGACY[table];
|
|
63
|
+
return Object.hasOwn(members, member) ? members[member] : null;
|
|
64
|
+
}
|
|
65
|
+
function registryMemberOfLegacy(table, legacy) {
|
|
66
|
+
const members = REGISTRY_MEMBER_LEGACY[table];
|
|
67
|
+
return Object.keys(members).find((member) => members[member] === legacy) ?? null;
|
|
68
|
+
}
|
|
69
|
+
function legacyFactKey(key) {
|
|
70
|
+
const aliases = REGISTRY_FACT_LEGACY;
|
|
71
|
+
if (Object.hasOwn(aliases, key)) return aliases[key];
|
|
72
|
+
const table = tableKeyOf(key)?.table;
|
|
73
|
+
return table !== void 0 && isLegacyTable(table) ? table : key;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
//#endregion
|
|
77
|
+
export { REGISTRY_FACT_LEGACY, REGISTRY_MEMBER_LEGACY, legacyFactKey, legacyMemberOf, registryMemberOfLegacy };
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import { AddressView } from "./address-value.js";
|
|
2
|
+
import { MediaKind } from "./slot-catalog.js";
|
|
3
|
+
import { FactHome, LibraryFactRegistry, PropertyFactRegistry } from "./fact-registry.js";
|
|
4
|
+
//#region ../../internal/template-contracts/dist/registry-facts.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* What a home picking place holds — a media declaration with `from`: the id of the owning
|
|
7
|
+
* item at the root of its `from` chain (P3) and, beside it, the framing the place reads as
|
|
8
|
+
* where any place of its chain carries its own (place framing F1, F2). It reads as that
|
|
9
|
+
* item's value merged with its file, its crop and place renditions this framing's.
|
|
10
|
+
*/
|
|
11
|
+
interface MediaReference {
|
|
12
|
+
media: string;
|
|
13
|
+
/** The place's own crop (place framing F1): present — null included, the whole frame — is own; absent is none, read down the chain. */
|
|
14
|
+
crop?: MediaCrop | null;
|
|
15
|
+
/** The place renditions the place's own processes wrote, by name; a name absent is none. */
|
|
16
|
+
renditions?: Partial<PlaceRenditions>;
|
|
17
|
+
}
|
|
18
|
+
/** A media value as the facts document holds it: an owning place's value in place, or a picking place's reference. */
|
|
19
|
+
type DocumentMediaValue = HomeMediaValue | MediaReference;
|
|
20
|
+
/** Whether a file's gating processing has finished — a record's `state` is its file's. */
|
|
21
|
+
type FileState = "processing" | "ready" | "failed";
|
|
22
|
+
/** The file renditions: derived from the file alone, so every place over the file shares them. */
|
|
23
|
+
declare const FILE_RENDITION_NAMES: readonly ["master", "poster", "encode"];
|
|
24
|
+
/**
|
|
25
|
+
* The place renditions: derived from a place's crop, so each place's are its own — the
|
|
26
|
+
* `crop` cut (the original under the crop), and the cut-out and its masks.
|
|
27
|
+
*/
|
|
28
|
+
declare const PLACE_RENDITION_NAMES: readonly ["crop", "cutout", "mask_white", "mask_black"];
|
|
29
|
+
/** A file rendition's name — one of `FILE_RENDITION_NAMES`. */
|
|
30
|
+
type FileRenditionName = (typeof FILE_RENDITION_NAMES)[number];
|
|
31
|
+
/** A place rendition's name — one of `PLACE_RENDITION_NAMES`. */
|
|
32
|
+
type PlaceRenditionName = (typeof PLACE_RENDITION_NAMES)[number];
|
|
33
|
+
/** One rendition: its storage key — never a URL — and what is known of its bytes. */
|
|
34
|
+
interface Rendition {
|
|
35
|
+
key: string;
|
|
36
|
+
mime: string | null;
|
|
37
|
+
width: number | null;
|
|
38
|
+
height: number | null;
|
|
39
|
+
bytes: number | null;
|
|
40
|
+
}
|
|
41
|
+
/** A file's renditions by name, each `null` where the kind has none or its bytes do not exist yet. */
|
|
42
|
+
type FileRenditions = { [N in FileRenditionName]: Rendition | null; };
|
|
43
|
+
/** A place's renditions by name, each with the inputs it was cut at; `null` where the kind has none or its bytes do not exist yet. */
|
|
44
|
+
type PlaceRenditions = { [N in PlaceRenditionName]: PlaceRendition | null; };
|
|
45
|
+
/** A place's framing: a rect normalized 0–1 over the original's oriented frame. */
|
|
46
|
+
interface MediaCrop {
|
|
47
|
+
x: number;
|
|
48
|
+
y: number;
|
|
49
|
+
width: number;
|
|
50
|
+
height: number;
|
|
51
|
+
}
|
|
52
|
+
/** The members every file carries, before its kind narrows them — what is true of the bytes, never of a place. */
|
|
53
|
+
interface FileMembers {
|
|
54
|
+
/** The file's id. */
|
|
55
|
+
id: string;
|
|
56
|
+
kind: MediaKind;
|
|
57
|
+
/** The original's storage key — never a URL; null on a pasted link, which has no stored bytes. */
|
|
58
|
+
key: string | null;
|
|
59
|
+
/** The original's MIME type. */
|
|
60
|
+
mime: string | null;
|
|
61
|
+
/** The original's size in bytes. */
|
|
62
|
+
bytes: number | null;
|
|
63
|
+
/** A pasted link's URL, as pasted. */
|
|
64
|
+
url: string | null;
|
|
65
|
+
/** The link provider that claims `url`. */
|
|
66
|
+
provider: string | null;
|
|
67
|
+
/** When the file was born, ISO 8601. */
|
|
68
|
+
added_at: string;
|
|
69
|
+
/**
|
|
70
|
+
* What understand wrote of the file for a reader who cannot see it: plain-language
|
|
71
|
+
* statements, one fact each — what it is and how it was made, what it shows, every word
|
|
72
|
+
* printed on it verbatim, how it looks. Never shown to a person. Null means not yet
|
|
73
|
+
* understood: unknown, never empty.
|
|
74
|
+
*/
|
|
75
|
+
account: string | null;
|
|
76
|
+
/** A document's page count. Null means uncounted: not yet, or an office file, which nothing pages. */
|
|
77
|
+
page_count: number | null;
|
|
78
|
+
/** The file's own running time. Null means unknown, never short. */
|
|
79
|
+
duration_ms: number | null;
|
|
80
|
+
/** The original's intrinsic width. */
|
|
81
|
+
width: number | null;
|
|
82
|
+
/** The original's intrinsic height. */
|
|
83
|
+
height: number | null;
|
|
84
|
+
/** When the provider says it was captured, ISO 8601. */
|
|
85
|
+
captured_at: string | null;
|
|
86
|
+
/** A tour's scan count, as its provider reports it. */
|
|
87
|
+
scan_count: number | null;
|
|
88
|
+
/**
|
|
89
|
+
* A video's poster hint: the instant, in milliseconds, of the frame a model chose as
|
|
90
|
+
* its poster. Null means no choice yet, and the poster is the representative frame.
|
|
91
|
+
*/
|
|
92
|
+
poster_at_ms: number | null;
|
|
93
|
+
/** The file's renditions. */
|
|
94
|
+
renditions: FileRenditions;
|
|
95
|
+
/** Whether its gating processing has finished. */
|
|
96
|
+
state: FileState;
|
|
97
|
+
}
|
|
98
|
+
/** An image file: a photo, a floor plan, a logo, a headshot. */
|
|
99
|
+
interface ImageFile extends FileMembers {
|
|
100
|
+
kind: "image";
|
|
101
|
+
key: string;
|
|
102
|
+
url: null;
|
|
103
|
+
provider: null;
|
|
104
|
+
page_count: null;
|
|
105
|
+
duration_ms: null;
|
|
106
|
+
poster_at_ms: null;
|
|
107
|
+
captured_at: null;
|
|
108
|
+
scan_count: null;
|
|
109
|
+
renditions: FileRenditions & {
|
|
110
|
+
poster: null;
|
|
111
|
+
encode: null;
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/** A video file: a hosted file (`url` null), or a pasted provider link. */
|
|
115
|
+
interface VideoFile extends FileMembers {
|
|
116
|
+
kind: "video";
|
|
117
|
+
page_count: null;
|
|
118
|
+
scan_count: null;
|
|
119
|
+
renditions: FileRenditions & {
|
|
120
|
+
master: null;
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
/** A 3D tour link. */
|
|
124
|
+
interface TourFile extends FileMembers {
|
|
125
|
+
kind: "tour";
|
|
126
|
+
key: null;
|
|
127
|
+
mime: null;
|
|
128
|
+
bytes: null;
|
|
129
|
+
url: string;
|
|
130
|
+
provider: string;
|
|
131
|
+
page_count: null;
|
|
132
|
+
duration_ms: null;
|
|
133
|
+
poster_at_ms: null;
|
|
134
|
+
width: null;
|
|
135
|
+
height: null;
|
|
136
|
+
renditions: FileRenditions & {
|
|
137
|
+
master: null;
|
|
138
|
+
encode: null;
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
/** An attachable document. */
|
|
142
|
+
interface DocumentFile extends FileMembers {
|
|
143
|
+
kind: "document";
|
|
144
|
+
key: string;
|
|
145
|
+
url: null;
|
|
146
|
+
provider: null;
|
|
147
|
+
duration_ms: null;
|
|
148
|
+
poster_at_ms: null;
|
|
149
|
+
width: null;
|
|
150
|
+
height: null;
|
|
151
|
+
captured_at: null;
|
|
152
|
+
scan_count: null;
|
|
153
|
+
renditions: FileRenditions & {
|
|
154
|
+
master: null;
|
|
155
|
+
encode: null;
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
/** One file, narrowed by its kind. Named `MediaFile`, not `File`, so it never shadows the DOM's `File` where a browser imports it. */
|
|
159
|
+
type MediaFile = ImageFile | VideoFile | TourFile | DocumentFile;
|
|
160
|
+
/** The value a home owning place holds — an `uploads` item, a contact's `headshot`. */
|
|
161
|
+
interface HomeMediaValue {
|
|
162
|
+
/** The media id, minted at birth: the owning item's identity, what a reference names. */
|
|
163
|
+
id: string;
|
|
164
|
+
/** The file id. */
|
|
165
|
+
file: string;
|
|
166
|
+
/** The place's framing over the original; null is the whole frame. Only an image's place crops. */
|
|
167
|
+
crop: MediaCrop | null;
|
|
168
|
+
/** What a person called it; null reads as the file's own name (`fileNameOf`). */
|
|
169
|
+
name: string | null;
|
|
170
|
+
/** The renditions this place's processing cut over its `crop`. */
|
|
171
|
+
renditions: PlaceRenditions;
|
|
172
|
+
}
|
|
173
|
+
/** What a place rendition was cut at: the place's crop and the process entry's options, in the clear (P5). */
|
|
174
|
+
interface RenditionInputs {
|
|
175
|
+
crop: MediaCrop | null;
|
|
176
|
+
options: Record<string, unknown>;
|
|
177
|
+
/** The version of the pass that cut it, where that pass is versioned (the cut-out's); a newer pass re-cuts. */
|
|
178
|
+
version?: string;
|
|
179
|
+
}
|
|
180
|
+
/** A rendition a place's own processing cut, with the inputs it was cut at. */
|
|
181
|
+
interface PlaceRendition extends Rendition {
|
|
182
|
+
over: RenditionInputs;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* The place members a record carries: a home value's, `name` resolved. `id` is the media
|
|
186
|
+
* id and `file` the file's — one id while an `intake.upload` row is both.
|
|
187
|
+
*/
|
|
188
|
+
interface PlaceMembers {
|
|
189
|
+
id: string;
|
|
190
|
+
file: string;
|
|
191
|
+
crop: MediaCrop | null;
|
|
192
|
+
/** The display name: what a person called it, else the file's own name (`fileNameOf`). */
|
|
193
|
+
name: string;
|
|
194
|
+
}
|
|
195
|
+
/** The place renditions of a kind nothing crops: no framing, so nothing is cut. */
|
|
196
|
+
type Uncut = {
|
|
197
|
+
crop: null;
|
|
198
|
+
cutout: null;
|
|
199
|
+
mask_white: null;
|
|
200
|
+
mask_black: null;
|
|
201
|
+
};
|
|
202
|
+
/** An image's record: its file, and its place's crop and cut. */
|
|
203
|
+
interface ImageMedia extends Omit<ImageFile, "id" | "renditions">, PlaceMembers {
|
|
204
|
+
renditions: ImageFile["renditions"] & PlaceRenditions;
|
|
205
|
+
}
|
|
206
|
+
/** A video's record. */
|
|
207
|
+
interface VideoMedia extends Omit<VideoFile, "id" | "renditions">, PlaceMembers {
|
|
208
|
+
crop: null;
|
|
209
|
+
renditions: VideoFile["renditions"] & Uncut;
|
|
210
|
+
}
|
|
211
|
+
/** A tour's record. */
|
|
212
|
+
interface TourMedia extends Omit<TourFile, "id" | "renditions">, PlaceMembers {
|
|
213
|
+
crop: null;
|
|
214
|
+
renditions: TourFile["renditions"] & Uncut;
|
|
215
|
+
}
|
|
216
|
+
/** A document's record. */
|
|
217
|
+
interface DocumentMedia extends Omit<DocumentFile, "id" | "renditions">, PlaceMembers {
|
|
218
|
+
crop: null;
|
|
219
|
+
renditions: DocumentFile["renditions"] & Uncut;
|
|
220
|
+
}
|
|
221
|
+
/** One media record — a place's value and its file read as one; what every reader of media receives. */
|
|
222
|
+
type Media = ImageMedia | VideoMedia | TourMedia | DocumentMedia;
|
|
223
|
+
type Registries = {
|
|
224
|
+
property: PropertyFactRegistry;
|
|
225
|
+
library: LibraryFactRegistry;
|
|
226
|
+
};
|
|
227
|
+
/** The element declaration of list fact `K` of home `H` — what a `row` from it holds. */
|
|
228
|
+
type ListElementOf<H extends FactHome, K> = K extends keyof Registries[H]["pages"] ? Registries[H]["pages"][K] extends {
|
|
229
|
+
readonly declaration: {
|
|
230
|
+
readonly element: infer E;
|
|
231
|
+
};
|
|
232
|
+
} ? E : never : never;
|
|
233
|
+
/** The value a fact declaration `D` holds in the document. */
|
|
234
|
+
type FactValue<D> = D extends {
|
|
235
|
+
readonly type: "list";
|
|
236
|
+
readonly element: infer E;
|
|
237
|
+
} ? FactItem<E>[] : D extends {
|
|
238
|
+
readonly type: "object";
|
|
239
|
+
readonly fields: infer F;
|
|
240
|
+
} ? { -readonly [K in keyof F]: FactValue<F[K]>; } : D extends {
|
|
241
|
+
readonly type: "row";
|
|
242
|
+
readonly from: `${infer H extends FactHome}.${infer K}`;
|
|
243
|
+
} ? FactItem<ListElementOf<H, K>> : D extends {
|
|
244
|
+
readonly type: "address";
|
|
245
|
+
} ? AddressView : D extends {
|
|
246
|
+
readonly type: MediaKind | "media";
|
|
247
|
+
} // Which of the two a place holds is its `from`'s (P3), which a builder's declaration
|
|
248
|
+
? DocumentMediaValue | null : D extends {
|
|
249
|
+
readonly type: "number";
|
|
250
|
+
} ? number | null : string | null;
|
|
251
|
+
/**
|
|
252
|
+
* One item of a list whose element is `E`: an object's carries its row `id`; a row is
|
|
253
|
+
* the row it picks, resolved — its `id` and members (`pickedRowOf`); a value is never
|
|
254
|
+
* null — an empty item is no item.
|
|
255
|
+
*/
|
|
256
|
+
type FactItem<E> = E extends {
|
|
257
|
+
readonly type: "object";
|
|
258
|
+
} ? {
|
|
259
|
+
id: string;
|
|
260
|
+
} & FactValue<E> : E extends {
|
|
261
|
+
readonly type: "row";
|
|
262
|
+
} ? FactValue<E> : NonNullable<FactValue<E>>;
|
|
263
|
+
type PropertyPages = PropertyFactRegistry["pages"];
|
|
264
|
+
/** One property's facts as `propertyFacts` declares them, and the files their media values are over. */
|
|
265
|
+
type RegistryFacts = { -readonly [K in keyof PropertyPages]: FactValue<PropertyPages[K]["declaration"]>; } & {
|
|
266
|
+
/** The file of every owning value the document holds, keyed by its id. */
|
|
267
|
+
files: Record<string, MediaFile>;
|
|
268
|
+
};
|
|
269
|
+
//#endregion
|
|
270
|
+
export { DocumentFile, DocumentMedia, DocumentMediaValue, FILE_RENDITION_NAMES, FactItem, FactValue, FileRenditionName, FileRenditions, FileState, HomeMediaValue, ImageFile, ImageMedia, Media, MediaCrop, MediaFile, MediaReference, PLACE_RENDITION_NAMES, PlaceMembers, PlaceRendition, PlaceRenditionName, PlaceRenditions, RegistryFacts, Rendition, RenditionInputs, TourFile, TourMedia, VideoFile, VideoMedia };
|