@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,598 @@
|
|
|
1
|
+
import { isMediaKind } from "./slot-catalog.js";
|
|
2
|
+
import { isElementRef, isFactRef, isRowRef, isSiblingPage, isSiblingSlot, isSiblingSource, isSlotRef, rowOfMember } from "./slot-ref.js";
|
|
3
|
+
import { compute } from "./compute.js";
|
|
4
|
+
import { isFactCompute } from "./fact-compute.js";
|
|
5
|
+
import { fill } from "./fill-builders.js";
|
|
6
|
+
import { getFills } from "./fill-declaration.js";
|
|
7
|
+
import { FLOOR_PRESETS } from "./floor-presets.js";
|
|
8
|
+
import { linkRegistry } from "./registry-shape.js";
|
|
9
|
+
import { mapSlotRefs, plainSlot } from "./resolve-scope.js";
|
|
10
|
+
import { address, date, email, image, media, number, phone, select, text, url } from "./slot-builders.js";
|
|
11
|
+
import { declaredFields, object } from "./object.js";
|
|
12
|
+
import { list } from "./list.js";
|
|
13
|
+
import { process } from "./process-builders.js";
|
|
14
|
+
import { row } from "./row.js";
|
|
15
|
+
|
|
16
|
+
//#region ../../internal/template-contracts/dist/fact-registry.js
|
|
17
|
+
const FACT_HOMES = ["property", "library"];
|
|
18
|
+
function listKeyOf(key) {
|
|
19
|
+
const dot = key.indexOf(".");
|
|
20
|
+
const home = dot === -1 ? "" : key.slice(0, dot);
|
|
21
|
+
if (!FACT_HOMES.includes(home)) throw new Error(`fact registry: "${key}" names no home's list fact`);
|
|
22
|
+
return {
|
|
23
|
+
home,
|
|
24
|
+
key: key.slice(dot + 1)
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function page(head, declaration) {
|
|
28
|
+
if ("label" in head) throw new Error("fact registry: a page head holds no `label` — the declaration states the fact's name");
|
|
29
|
+
for (const key of ["title", "description"]) {
|
|
30
|
+
const value = head[key];
|
|
31
|
+
if (typeof value === "string" && value.trim() === "") throw new Error(`fact registry: a page declares an empty ${key}`);
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
head,
|
|
35
|
+
declaration
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const RESOLVED_READ_KINDS = /* @__PURE__ */ new Set(["home", "item"]);
|
|
39
|
+
function resolveRead(at, read, scope) {
|
|
40
|
+
const own = typeof read === "object" && read !== null ? scope.pages.get(read) : void 0;
|
|
41
|
+
if (own !== void 0) return {
|
|
42
|
+
kind: "home",
|
|
43
|
+
key: `${scope.home}.${own}`
|
|
44
|
+
};
|
|
45
|
+
if (isSiblingPage(read)) {
|
|
46
|
+
const key = scope.pages.get(read);
|
|
47
|
+
if (key === void 0) throw new Error(`${at} reads a page that is not one of this registry's — a registry reads its own facts by their page's const.`);
|
|
48
|
+
return {
|
|
49
|
+
kind: "home",
|
|
50
|
+
key: `${scope.home}.${key}`
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const sibling = isSiblingSource(read) ? read.of : read;
|
|
54
|
+
if (isSiblingSlot(sibling)) {
|
|
55
|
+
const field = scope.fields?.get(sibling);
|
|
56
|
+
if (field === void 0) throw new Error(`${at} reads the declaration "${sibling.label ?? sibling.type}", which is not a field of the same item — a field reads its siblings by their consts, and a top-level fact by its page's const.`);
|
|
57
|
+
return {
|
|
58
|
+
kind: "item",
|
|
59
|
+
field
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
if (isFactRef(read) && [...scope.pages.values()].some((key) => read.key === `${scope.home}.${key}`)) return {
|
|
63
|
+
kind: "home",
|
|
64
|
+
key: read.key
|
|
65
|
+
};
|
|
66
|
+
if (isFactRef(read)) throw new Error(`${at} is bound to the fact "${read.key}" — a registry declares the facts; it reads a sibling page by its const and binds none.`);
|
|
67
|
+
if (isSlotRef(read)) throw new Error(`${at} reads a section's slot — a registry reads no section.`);
|
|
68
|
+
if (isElementRef(read) && scope.picked === true) return { kind: "element" };
|
|
69
|
+
if (isElementRef(read)) throw new Error(`${at} reads the element — a registry's list nothing picks is built by the user, so its item's fields read one another by const.`);
|
|
70
|
+
if (rowOfMember(read) !== void 0) throw new Error(`${at} reads the member "${read.field}" of a row that is not a field of the same item.`);
|
|
71
|
+
if (isRowRef(read) && typeof read.slot === "string") return {
|
|
72
|
+
kind: "row",
|
|
73
|
+
slot: read.slot,
|
|
74
|
+
field: read.field
|
|
75
|
+
};
|
|
76
|
+
if (typeof read === "object" && read !== null && RESOLVED_READ_KINDS.has(String(read.kind))) return read;
|
|
77
|
+
throw new Error(`${at} declares a read a registry cannot answer.`);
|
|
78
|
+
}
|
|
79
|
+
function resolveMediaLists(at, from, scope) {
|
|
80
|
+
if (!Array.isArray(from)) return resolveMediaList(at, from, scope);
|
|
81
|
+
return from.length === 1 ? resolveMediaList(at, from[0], scope) : from.map((list) => resolveMediaList(at, list, scope));
|
|
82
|
+
}
|
|
83
|
+
function resolveMediaList(at, from, scope) {
|
|
84
|
+
const key = typeof from === "object" && from !== null ? scope.pages.get(from) : void 0;
|
|
85
|
+
const resolved = typeof from === "string" ? from : key === void 0 ? void 0 : `${scope.home}.${key}`;
|
|
86
|
+
if (resolved === void 0 || !scope.mediaLists.has(resolved)) throw new Error(`${at} picks \`from\` something other than one of this registry's media lists — a media field picks from a list of media (the \`uploads\` page, a sorted list), by its const, or owns its asset.`);
|
|
87
|
+
return resolved;
|
|
88
|
+
}
|
|
89
|
+
function resolveCompute(at, binding, scope) {
|
|
90
|
+
const reads = binding.reads.map((read) => resolveRead(at, read, scope));
|
|
91
|
+
if (binding.requires === void 0) return {
|
|
92
|
+
kind: "compute",
|
|
93
|
+
fn: binding.fn,
|
|
94
|
+
reads
|
|
95
|
+
};
|
|
96
|
+
return {
|
|
97
|
+
kind: "compute",
|
|
98
|
+
fn: binding.fn,
|
|
99
|
+
reads,
|
|
100
|
+
requires: binding.requires.map((read) => resolveRead(at, read, scope))
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function refuseHolderKeys(at, slot) {
|
|
104
|
+
if (slot["when"] !== void 0) throw new Error(`${at} declares \`when\` — a registry has no display variant; a page is drawn when a template reads it.`);
|
|
105
|
+
if (slot["required"] !== void 0) throw new Error(`${at} declares \`required\` — a fact requires nothing on its own account; what a property must answer is what its templates require.`);
|
|
106
|
+
if (slot["type"] === "poi") throw new Error(`${at} is a poi — a place the platform builds is no fact.`);
|
|
107
|
+
}
|
|
108
|
+
function refuseObjectPicks(at, element) {
|
|
109
|
+
const { type, fields } = element;
|
|
110
|
+
if (type !== "object" || fields === void 0) return;
|
|
111
|
+
const picks = Object.entries(fields).filter(([, field]) => field.type === "row");
|
|
112
|
+
if (picks.length > 0) throw new Error(`${at} holds a picked row in ${picks.map(([key]) => `"${key}"`).join(", ")} — a list picking rows declares the row as its item (\`item: row({ from })\`), whose members are the row's.`);
|
|
113
|
+
}
|
|
114
|
+
function fieldScope(objectSlot) {
|
|
115
|
+
const fields = /* @__PURE__ */ new Map();
|
|
116
|
+
const stored = objectSlot.fields;
|
|
117
|
+
for (const source of [stored, declaredFields(objectSlot) ?? {}]) for (const [key, field] of Object.entries(source)) if (typeof field === "object" && field !== null) fields.set(field, key);
|
|
118
|
+
return fields;
|
|
119
|
+
}
|
|
120
|
+
function resolveDeclaration(at, slot, scope) {
|
|
121
|
+
refuseHolderKeys(at, slot);
|
|
122
|
+
let out = plainSlot(mapSlotRefs(slot, (read) => resolveRead(at, read, scope)));
|
|
123
|
+
if (out["from"] !== void 0 && (isMediaKind(String(out["type"])) || out["type"] === "media")) out = {
|
|
124
|
+
...out,
|
|
125
|
+
from: resolveMediaLists(at, slot.from, scope)
|
|
126
|
+
};
|
|
127
|
+
switch (out["type"]) {
|
|
128
|
+
case "object": {
|
|
129
|
+
const fields = {};
|
|
130
|
+
const inner = {
|
|
131
|
+
...scope,
|
|
132
|
+
fields: fieldScope(out)
|
|
133
|
+
};
|
|
134
|
+
for (const [key, field] of Object.entries(out["fields"])) fields[key] = resolveDeclaration(`${at}.${key}`, field, inner);
|
|
135
|
+
out = {
|
|
136
|
+
...out,
|
|
137
|
+
fields
|
|
138
|
+
};
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
case "list": {
|
|
142
|
+
const max = out["max"];
|
|
143
|
+
const top = {
|
|
144
|
+
home: scope.home,
|
|
145
|
+
pages: scope.pages,
|
|
146
|
+
mediaLists: scope.mediaLists
|
|
147
|
+
};
|
|
148
|
+
const picked = getFills(slot)?.some((binding) => binding.verb === "pick") === true;
|
|
149
|
+
const element = resolveDeclaration(`${at}[]`, out["element"], picked ? {
|
|
150
|
+
...top,
|
|
151
|
+
picked: true
|
|
152
|
+
} : top);
|
|
153
|
+
refuseObjectPicks(`${at}[]`, element);
|
|
154
|
+
out = {
|
|
155
|
+
...out,
|
|
156
|
+
element,
|
|
157
|
+
...isFactCompute(max) ? { max: resolveCompute(`${at}.max`, max, top) } : {}
|
|
158
|
+
};
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
default: break;
|
|
162
|
+
}
|
|
163
|
+
return out;
|
|
164
|
+
}
|
|
165
|
+
function resolvePage(home, key, authored, scope) {
|
|
166
|
+
const at = `${home}.${key}`;
|
|
167
|
+
const declaration = resolveDeclaration(at, authored.declaration, scope);
|
|
168
|
+
if (declaration.type === "object") throw new Error(`${at} is an object — a top-level fact is a value or a list; a group of fields is a list's item.`);
|
|
169
|
+
if (declaration.label === void 0) throw new Error(`${at} declares no \`label\` — a top-level fact states the name its page and its Details section show it by.`);
|
|
170
|
+
if (authored.head === null) return {
|
|
171
|
+
head: null,
|
|
172
|
+
declaration
|
|
173
|
+
};
|
|
174
|
+
const { title, description } = authored.head;
|
|
175
|
+
return {
|
|
176
|
+
head: {
|
|
177
|
+
title: typeof title === "string" ? title : resolveCompute(`${at}.title`, title, scope),
|
|
178
|
+
description: typeof description === "string" ? description : resolveCompute(`${at}.description`, description, scope)
|
|
179
|
+
},
|
|
180
|
+
declaration
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
const REGISTRY_OWN_KEYS = ["home", "pages"];
|
|
184
|
+
function isAuthoredPage(fact) {
|
|
185
|
+
return "head" in fact && "declaration" in fact;
|
|
186
|
+
}
|
|
187
|
+
function isMediaList(declaration) {
|
|
188
|
+
const element = declaration.element;
|
|
189
|
+
return declaration.type === "list" && typeof element?.type === "string" && (isMediaKind(element.type) || element.type === "media");
|
|
190
|
+
}
|
|
191
|
+
function defineFacts(home, pages) {
|
|
192
|
+
if (!FACT_HOMES.includes(home)) throw new Error(`fact registry: "${home}" is not a home`);
|
|
193
|
+
const keyOf = /* @__PURE__ */ new Map();
|
|
194
|
+
const mediaLists = /* @__PURE__ */ new Set();
|
|
195
|
+
const authored = {};
|
|
196
|
+
for (const [key, declared] of Object.entries(pages)) {
|
|
197
|
+
if (REGISTRY_OWN_KEYS.includes(key)) throw new Error(`fact registry: ${home} declares a page keyed "${key}", a registry's own key`);
|
|
198
|
+
keyOf.set(declared, key);
|
|
199
|
+
const fact = isAuthoredPage(declared) ? declared : {
|
|
200
|
+
head: null,
|
|
201
|
+
declaration: declared
|
|
202
|
+
};
|
|
203
|
+
authored[key] = fact;
|
|
204
|
+
if (isMediaList(fact.declaration)) mediaLists.add(`${home}.${key}`);
|
|
205
|
+
}
|
|
206
|
+
const scope = {
|
|
207
|
+
home,
|
|
208
|
+
pages: keyOf,
|
|
209
|
+
mediaLists
|
|
210
|
+
};
|
|
211
|
+
const resolved = {};
|
|
212
|
+
for (const [key, fact] of Object.entries(authored)) resolved[key] = resolvePage(home, key, fact, scope);
|
|
213
|
+
const registry = {
|
|
214
|
+
home,
|
|
215
|
+
pages: resolved
|
|
216
|
+
};
|
|
217
|
+
for (const key of Object.keys(pages)) registry[key] = {
|
|
218
|
+
kind: "home",
|
|
219
|
+
key: `${home}.${key}`
|
|
220
|
+
};
|
|
221
|
+
return registry;
|
|
222
|
+
}
|
|
223
|
+
const LISTING_INTENT_VALUES = [{
|
|
224
|
+
value: "for_sale",
|
|
225
|
+
label: "For sale",
|
|
226
|
+
icon: "tag",
|
|
227
|
+
description: "List price, finance details, and a sold-ready layout."
|
|
228
|
+
}, {
|
|
229
|
+
value: "for_rent",
|
|
230
|
+
label: "For rent",
|
|
231
|
+
icon: "key",
|
|
232
|
+
description: "Monthly rent, lease terms, pets, and utilities."
|
|
233
|
+
}];
|
|
234
|
+
const COMPARABLE_STATUS_VALUES = ["sold", "active"];
|
|
235
|
+
const COMPARABLE_PRICE_PERIOD_VALUES = ["total", "monthly"];
|
|
236
|
+
function comparableStatusOf(saleDate) {
|
|
237
|
+
return saleDate == null ? "active" : "sold";
|
|
238
|
+
}
|
|
239
|
+
function comparablePricePeriod(listingIntent) {
|
|
240
|
+
return listingIntent === "for_rent" ? "monthly" : "total";
|
|
241
|
+
}
|
|
242
|
+
const EARTH_RADIUS_METERS = 6371e3;
|
|
243
|
+
function haversineMeters(lat1, lon1, lat2, lon2) {
|
|
244
|
+
const toRad = (deg) => deg * Math.PI / 180;
|
|
245
|
+
const dLat = toRad(lat2 - lat1);
|
|
246
|
+
const dLon = toRad(lon2 - lon1);
|
|
247
|
+
const h = Math.sin(dLat / 2) ** 2 + Math.cos(toRad(lat1)) * Math.cos(toRad(lat2)) * Math.sin(dLon / 2) ** 2;
|
|
248
|
+
return 2 * EARTH_RADIUS_METERS * Math.asin(Math.sqrt(h));
|
|
249
|
+
}
|
|
250
|
+
function comparableDistanceMeters(comp, subject) {
|
|
251
|
+
if (comp?.latitude == null || comp.longitude == null || subject?.latitude == null || subject.longitude == null) return null;
|
|
252
|
+
return Math.round(haversineMeters(subject.latitude, subject.longitude, comp.latitude, comp.longitude));
|
|
253
|
+
}
|
|
254
|
+
const libraryFacts = defineFacts("library", { contacts: page({
|
|
255
|
+
title: "Your contacts",
|
|
256
|
+
description: "The people your listings name, with the headshots and logos they carry."
|
|
257
|
+
}, list({
|
|
258
|
+
label: "Contacts",
|
|
259
|
+
item: () => {
|
|
260
|
+
const name = text.short({
|
|
261
|
+
label: "Name",
|
|
262
|
+
cap: 256
|
|
263
|
+
});
|
|
264
|
+
return object({
|
|
265
|
+
label: name,
|
|
266
|
+
fields: {
|
|
267
|
+
headshot: image({ label: "Headshot" }),
|
|
268
|
+
name,
|
|
269
|
+
title: text.short({
|
|
270
|
+
label: "Title",
|
|
271
|
+
cap: 128
|
|
272
|
+
}),
|
|
273
|
+
org_name: text.short({
|
|
274
|
+
label: "Organization",
|
|
275
|
+
cap: 256
|
|
276
|
+
}),
|
|
277
|
+
email: email({ label: "Email" }),
|
|
278
|
+
phone: phone({ label: "Phone" }),
|
|
279
|
+
website: url({ label: "Website" }),
|
|
280
|
+
address: address({ label: "Address" }),
|
|
281
|
+
bio: text.long({
|
|
282
|
+
label: "Bio",
|
|
283
|
+
cap: 4e3
|
|
284
|
+
}),
|
|
285
|
+
logo_dark: image({
|
|
286
|
+
label: "Logo for light backgrounds",
|
|
287
|
+
process: [process.cutout()]
|
|
288
|
+
}),
|
|
289
|
+
logo_light: image({
|
|
290
|
+
label: "Logo for dark backgrounds",
|
|
291
|
+
process: [process.cutout()]
|
|
292
|
+
}),
|
|
293
|
+
instagram: url({ label: "Instagram" }),
|
|
294
|
+
linkedin: url({ label: "LinkedIn" }),
|
|
295
|
+
x: url({ label: "X" }),
|
|
296
|
+
facebook: url({ label: "Facebook" })
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
})) });
|
|
301
|
+
linkRegistry(libraryFacts);
|
|
302
|
+
const propertyAddress = page({
|
|
303
|
+
title: "What’s the address?",
|
|
304
|
+
description: "We’ll build your map and neighborhood details from this."
|
|
305
|
+
}, address({ label: "Address" }));
|
|
306
|
+
const listing_intent = page({
|
|
307
|
+
title: "For sale or for rent?",
|
|
308
|
+
description: "This adjusts the pricing details we ask for."
|
|
309
|
+
}, select({
|
|
310
|
+
label: "Listing intent",
|
|
311
|
+
from: [...LISTING_INTENT_VALUES]
|
|
312
|
+
}));
|
|
313
|
+
const uploads = page({
|
|
314
|
+
title: "Add photos, docs, and links",
|
|
315
|
+
description: "Everything you add helps fill and enrich your website."
|
|
316
|
+
}, list({
|
|
317
|
+
label: "Uploads",
|
|
318
|
+
item: media()
|
|
319
|
+
}));
|
|
320
|
+
const propertyMedia = list({
|
|
321
|
+
label: "Media",
|
|
322
|
+
item: media({
|
|
323
|
+
kinds: [
|
|
324
|
+
"image",
|
|
325
|
+
"video",
|
|
326
|
+
"tour"
|
|
327
|
+
],
|
|
328
|
+
from: uploads
|
|
329
|
+
}),
|
|
330
|
+
source: fill.pick({ brief: "Does this upload show the property? It belongs when its name or account says it is a photograph, a rendering, a video or a virtual tour of the property: its building, rooms, grounds, amenities, surroundings or views. It does not belong when its name or account says it is a floor plan or another diagram; a logo, wordmark or brand graphic; a headshot, portrait or other photograph of a person or people; a flyer, ad, business card, slide or other image that is mostly text; a screenshot; a map; or a scanned document page. When neither its name nor its account says what it is, you cannot tell. Order what belongs as a walk through the property: aerial and street views first, then the approach and entry, then the interiors room by room (living spaces, kitchen and dining, bedrooms, bathrooms), then outdoor spaces, amenities, surroundings and views, with every shot of one space together. A video or tour sits with the space it shows, and one of the whole property comes first." })
|
|
331
|
+
});
|
|
332
|
+
const floor_plans = list({
|
|
333
|
+
label: "Floor plans",
|
|
334
|
+
item: image({
|
|
335
|
+
label: "Floor plan",
|
|
336
|
+
from: uploads,
|
|
337
|
+
process: [process.cutout({ enclosed: "keep" })]
|
|
338
|
+
}),
|
|
339
|
+
source: fill.pick({ brief: "Is this upload exactly one floor plan? A floor plan is a top-down view of one floor of a dwelling's rooms and walls — drawn or rendered, flat or in 3D, at any size. It belongs when its name or account says it shows one floor plan, whatever title, figures or text are printed around it. It does not belong when its name or account says it holds two or more plans, or says it is something else: a building key or locator diagram (the building's outline with one unit shaded), a site, plot, parking or driveway diagram, a standalone legend, scale bar or north arrow, a logo, a photograph, or plain text. When neither its name nor its account says what it is, or how many plans it holds, you cannot tell. Order what belongs from the lowest floor to the highest; plans of several units go in the order the units are numbered, each unit's floors together." })
|
|
340
|
+
});
|
|
341
|
+
const propertyDocuments = list({
|
|
342
|
+
label: "Documents",
|
|
343
|
+
item: media({
|
|
344
|
+
kinds: [
|
|
345
|
+
"document",
|
|
346
|
+
"image",
|
|
347
|
+
"video"
|
|
348
|
+
],
|
|
349
|
+
from: uploads
|
|
350
|
+
}),
|
|
351
|
+
source: fill.pick({ brief: "Does this upload set out the property's specifics? It belongs when its name or account says it records its figures, finances, terms, legal record, condition or plans: an offering memorandum, brochure, listing sheet, rent roll, financials, comparables, lease, survey, site plan, plan set, disclosure or report. It does not belong when its name or account says it is a photograph, rendering, video or tour showing the property; an image of floor plans or elevations; a logo; a photograph of people; an ad, sign or announcement; a map; or notes for whoever makes the marketing. When neither its name nor its account says what it is, you cannot tell. Order what belongs as a buyer reads it: the offering memorandum, brochure or listing sheet first, then the financials, rent roll and comparables, then the leases, legal record and disclosures, then the reports, surveys and plans." })
|
|
352
|
+
});
|
|
353
|
+
const hero = image({
|
|
354
|
+
label: "Hero",
|
|
355
|
+
from: propertyMedia,
|
|
356
|
+
source: fill.pick({ brief: "Choose the single cover photo for the property's page. The cover is a wide banner above the property's address, so it must stand for the whole property at a glance. Only an image whose name or account says it is a photograph of the property can be chosen. Never choose a logo, wordmark or other brand graphic; an agent, team or company headshot; a flyer, ad, business card, slide or any image that is mostly text; a screenshot; a map; a scanned document or brochure page; or a floor plan or other diagram — nor an image whose name and account do not say what it is. Among the photographs of the property prefer, in order: a front exterior of the building; another exterior or aerial view; the widest, brightest shot of the main living space. Rank close-up details, bathrooms, utility spaces, empty rooms and anything that reads as a fragment rather than a place last: they are weaker covers, never excluded, so when they are the only photographs of the property, choose the best of them. If not one candidate is a photograph of the property, choose none: no banner beats a banner that is not the property." })
|
|
357
|
+
});
|
|
358
|
+
const site_url = url({ label: "Website" });
|
|
359
|
+
const UNIT_PLANS_BRIEF = "Is this floor plan labelled for this unit? Its label is read from its name and the text printed on it, never from the rooms drawn or any figures. It belongs when its label names this unit: the unit's label or a plain variant of it (\"Unit 3\", \"#3\", \"Apt 3\" and \"Residence 3\" all label \"Unit 3\"); a descriptor the unit's label carries in brackets, like \"(PH)\", may be left off. A plan labelling several units, such as a shared floor printed \"Unit 1/2/3\", belongs to each of them. It is excluded when it labels other units and not this one. When it labels no unit, you cannot tell. Order what belongs from the lowest floor to the highest.";
|
|
360
|
+
const UNIT_PHOTOS_BRIEF = "Is this photo labelled for this unit? Its label is read from its name, the text printed on it and a caption its account records, never from the rooms it shows, any figures, how much it looks like the unit or where it falls among the uploads. It belongs when its label names this unit: the unit's label or a plain variant of it (\"Unit 3\", \"#3\", \"Apt 3\" and \"Residence 3\" all label \"Unit 3\"); a descriptor the unit's label carries in brackets, like \"(PH)\", may be left off. A photo labelled for several units belongs to each of them. It is excluded when it labels other units and not this one. When it labels no unit, you cannot tell.";
|
|
361
|
+
const UNITS_BRIEF = [
|
|
362
|
+
"List every dwelling the uploads present with its own specs printed — its beds, baths, square feet, asking price or rent written out for that dwelling: the home a listing describes, or each unit a building's documents name or number. A dwelling the uploads only name, picture or mark with a status, with no specs of its own, is not listed. A plan or row printed for several units (\"Unit 4/6\") lists each of those units, each with what is printed for it. A dwelling named in several uploads, or on several pages, is one item carrying everything they print for it. A unit-mix row standing for several unnamed units is not a dwelling; neither is a commercial space, a whole building, a comparable property, a market average or a portfolio total.",
|
|
363
|
+
"Every member is what an upload prints as text for that dwelling, and nothing else. An upload's own text, as its account quotes it (a document's or a sheet's content, an image's printed words), is what it prints; the account's description of what a drawing, a photo or a map shows (the rooms, the doors, the spaces) is never a member's source. Never count rooms; never compute, round or convert a figure; never carry one across from another dwelling, a unit-mix average or the building's totals; never add what is usual for a dwelling of its kind. A figure printed for a neighbourhood, a development or the building is never a dwelling's, and a count or fee is 0 only where the uploads print none for that dwelling. A member no upload prints for that dwelling is null, and a null is always better than a guess.",
|
|
364
|
+
"label: the unit's own name as printed — its unit number or name (\"201\", \"Residence 201\", \"4B\", \"Penthouse 501\"), without a word marking its status (\"model\", \"available\") — and never its street address. A dwelling presented alone, with no unit name, is always labelled \"Home\", whatever name the uploads print for the home itself.",
|
|
365
|
+
"beds, baths, sqft: exactly as printed for that dwelling; a studio has one bedroom.",
|
|
366
|
+
"price: the asking price or monthly rent as written for that dwelling, or its status word (\"Sold\", \"Leased\", \"Request for Info\").",
|
|
367
|
+
"floor: the floor of its building the dwelling sits on, as printed (\"3\", \"PH\", \"Ground\", \"3 to 4\"); never read off its unit number.",
|
|
368
|
+
"hoa_monthly: the HOA, condo or strata fee printed per month for that dwelling. A fee printed for another period, or for the building, is null.",
|
|
369
|
+
"parking: the number of parking spaces printed for that dwelling (\"1 deeded space\" is 1, \"two-car garage\" is 2). Parking printed with no count, or for the building, is null.",
|
|
370
|
+
"lot_sqft: the lot size printed in square feet for that dwelling: a home's own lot. A lot in another unit, or the lot of a building several dwellings share, is null.",
|
|
371
|
+
"amenities: a feature this dwelling has that the other dwellings in its building do not, in a few words as an upload states it, such as \"Private roof deck\", \"Corner unit\", \"Harbor views\". Check each one against the other dwellings: a feature printed for two of them, or for the building, is the building's and goes on no dwelling, however a sheet praises it; a routine fitting or finish, a note printed on a plan, or what its other members already say sets nothing apart. Most dwellings have none. Leave the list empty when nothing is this one's alone.",
|
|
372
|
+
"When the uploads present no dwelling with its own specs printed, return no items."
|
|
373
|
+
].join("\n\n");
|
|
374
|
+
const unitLabel = text.short({ label: "Unit" });
|
|
375
|
+
const unitBeds = number({ label: "Beds" });
|
|
376
|
+
const unitBaths = number({
|
|
377
|
+
label: "Baths",
|
|
378
|
+
decimals: true
|
|
379
|
+
});
|
|
380
|
+
const rowSqft = number({
|
|
381
|
+
label: "Sq ft",
|
|
382
|
+
thousandsSep: true
|
|
383
|
+
});
|
|
384
|
+
const rowPrice = text.short({
|
|
385
|
+
label: "Price",
|
|
386
|
+
cap: 40
|
|
387
|
+
});
|
|
388
|
+
const rowFloor = text.short({
|
|
389
|
+
label: "Building floor(s)",
|
|
390
|
+
cap: 20
|
|
391
|
+
});
|
|
392
|
+
const rowParking = number({ label: "Parking spaces" });
|
|
393
|
+
const rowAmenities = list({
|
|
394
|
+
label: "Amenities",
|
|
395
|
+
max: 12,
|
|
396
|
+
item: text.short({ cap: 40 })
|
|
397
|
+
});
|
|
398
|
+
function rowFloorPlans(label, brief) {
|
|
399
|
+
return list({
|
|
400
|
+
label: "Floor plans",
|
|
401
|
+
source: fill.pick({
|
|
402
|
+
reads: [label],
|
|
403
|
+
brief
|
|
404
|
+
}),
|
|
405
|
+
item: object({ fields: {
|
|
406
|
+
image: image({
|
|
407
|
+
label: "Floor plan",
|
|
408
|
+
from: floor_plans
|
|
409
|
+
}),
|
|
410
|
+
floor: select({
|
|
411
|
+
label: "Floor",
|
|
412
|
+
from: [...FLOOR_PRESETS],
|
|
413
|
+
creatable: true
|
|
414
|
+
})
|
|
415
|
+
} })
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
function rowPhotos(label, brief) {
|
|
419
|
+
return list({
|
|
420
|
+
label: "Photos",
|
|
421
|
+
source: fill.pick({
|
|
422
|
+
reads: [label],
|
|
423
|
+
brief
|
|
424
|
+
}),
|
|
425
|
+
item: image({
|
|
426
|
+
label: "Photo",
|
|
427
|
+
from: propertyMedia
|
|
428
|
+
})
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
const units = page({
|
|
432
|
+
title: "Tell us about the units",
|
|
433
|
+
description: "Add each unit’s details and floor plans so they appear on your website."
|
|
434
|
+
}, list({
|
|
435
|
+
label: "Units",
|
|
436
|
+
source: fill.write({
|
|
437
|
+
reads: [uploads],
|
|
438
|
+
brief: UNITS_BRIEF
|
|
439
|
+
}),
|
|
440
|
+
item: object({
|
|
441
|
+
label: unitLabel,
|
|
442
|
+
fields: {
|
|
443
|
+
label: unitLabel,
|
|
444
|
+
beds: unitBeds,
|
|
445
|
+
baths: unitBaths,
|
|
446
|
+
sqft: rowSqft,
|
|
447
|
+
price: rowPrice,
|
|
448
|
+
floor: rowFloor,
|
|
449
|
+
hoa_monthly: number({ label: "Monthly HOA fee" }),
|
|
450
|
+
parking: rowParking,
|
|
451
|
+
lot_sqft: number({
|
|
452
|
+
label: "Lot sq ft",
|
|
453
|
+
thousandsSep: true
|
|
454
|
+
}),
|
|
455
|
+
amenities: rowAmenities,
|
|
456
|
+
floor_plans: rowFloorPlans(unitLabel, UNIT_PLANS_BRIEF),
|
|
457
|
+
photos: rowPhotos(unitLabel, UNIT_PHOTOS_BRIEF)
|
|
458
|
+
}
|
|
459
|
+
})
|
|
460
|
+
}));
|
|
461
|
+
const SPACE_PLANS_BRIEF = "Is this floor plan labelled for this space? Its label is read from its name and the text printed on it, never from the rooms drawn or any figures. It belongs when its label names this space: the space's label or a plain variant of it (\"Suite 200\", \"Ste 200\" and \"#200\" all label \"Suite 200\"); a descriptor the space's label carries in brackets may be left off. A plan labelling several spaces belongs to each of them. It is excluded when it labels other spaces and not this one. When it labels no space, you cannot tell. Order what belongs from the lowest floor to the highest.";
|
|
462
|
+
const SPACE_PHOTOS_BRIEF = "Is this photo labelled for this space? Its label is read from its name, the text printed on it and a caption its account records, never from what it shows, any figures, how much it looks like the space or where it falls among the uploads. It belongs when its label names this space: the space's label or a plain variant of it (\"Suite 200\", \"Ste 200\" and \"#200\" all label \"Suite 200\"); a descriptor the space's label carries in brackets may be left off. A photo labelled for several spaces belongs to each of them. It is excluded when it labels other spaces and not this one. When it labels no space, you cannot tell.";
|
|
463
|
+
const COMMERCIAL_SPACES_BRIEF = [
|
|
464
|
+
"List every commercial space the uploads present with its own specs printed — its use, square feet, rent or price written out for that space: each shop, office suite, restaurant or other non-residential space a building's documents name or number. A space the uploads only name, picture or mark with a status, with no specs of its own, is not listed. A space named in several uploads, or on several pages, is one item carrying everything they print for it. A dwelling is never a commercial space; neither is a whole building, a comparable property, a market average or a portfolio total.",
|
|
465
|
+
"Every member is what an upload prints as text for that space, and nothing else. An upload's own text, as its account quotes it (a document's or a sheet's content, an image's printed words), is what it prints; the account's description of what a drawing, a photo or a map shows is never a member's source. Never compute, round or convert a figure; never carry one across from another space or the building's totals; never add what is usual for a space of its kind. A member no upload prints for that space is null, and a null is always better than a guess.",
|
|
466
|
+
"label: the space's own name as printed (\"Retail A\", \"Suite 200\", \"Ground-floor restaurant\"), without a word marking its status (\"available\", \"leased\"), and never its street address.",
|
|
467
|
+
"use: what the space is for, as printed (\"Retail\", \"Office\", \"Restaurant\").",
|
|
468
|
+
"sqft: the square feet printed for that space.",
|
|
469
|
+
"price: the rent or price as written for that space (\"$45/SF/yr\", \"$8,500/mo\"), or its status word (\"Leased\", \"Call for pricing\").",
|
|
470
|
+
"floor: the floor of its building the space sits on, as printed (\"1\", \"Ground\", \"Mezzanine\"); never read off its suite number.",
|
|
471
|
+
"parking: the number of parking spaces printed for that space. Parking printed with no count, or for the building, is null.",
|
|
472
|
+
"amenities: a feature this space has that the other spaces in its building do not, in a few words as an upload states it, such as \"Corner frontage\", \"Drive-thru\", \"Grease trap\". Check each one against the other spaces: a feature printed for two of them, or for the building, is the building's and goes on no space, however a sheet praises it; a routine fitting or finish, a note printed on a plan, or what its other members already say sets nothing apart. Most spaces have none. Leave the list empty when nothing is this one's alone.",
|
|
473
|
+
"When the uploads present no commercial space with its own specs printed, return no items."
|
|
474
|
+
].join("\n\n");
|
|
475
|
+
const spaceLabel = text.short({ label: "Space" });
|
|
476
|
+
const commercial_spaces = page({
|
|
477
|
+
title: "Tell us about the commercial spaces",
|
|
478
|
+
description: "Add each space’s details and floor plans so they appear on your website."
|
|
479
|
+
}, list({
|
|
480
|
+
label: "Commercial spaces",
|
|
481
|
+
source: fill.write({
|
|
482
|
+
reads: [uploads],
|
|
483
|
+
brief: COMMERCIAL_SPACES_BRIEF
|
|
484
|
+
}),
|
|
485
|
+
item: object({
|
|
486
|
+
label: spaceLabel,
|
|
487
|
+
fields: {
|
|
488
|
+
label: spaceLabel,
|
|
489
|
+
use: text.short({
|
|
490
|
+
label: "Use",
|
|
491
|
+
cap: 40
|
|
492
|
+
}),
|
|
493
|
+
sqft: rowSqft,
|
|
494
|
+
price: rowPrice,
|
|
495
|
+
floor: rowFloor,
|
|
496
|
+
parking: rowParking,
|
|
497
|
+
amenities: rowAmenities,
|
|
498
|
+
floor_plans: rowFloorPlans(spaceLabel, SPACE_PLANS_BRIEF),
|
|
499
|
+
photos: rowPhotos(spaceLabel, SPACE_PHOTOS_BRIEF)
|
|
500
|
+
}
|
|
501
|
+
})
|
|
502
|
+
}));
|
|
503
|
+
const COMPARABLES_BRIEF = "The uploads may present comparable properties: other properties an upload sets beside the subject for comparison. The subject is the property the uploads are marketing, at the read address; in a building, that is the building and every unit the uploads market in it. Find every comparable and return it as an item. A property is a comparable because an upload compares it with the subject, and it may appear as a row in a sales or rent comparables table, as a panel with its own photo and figures, as a numbered pin in a map legend, or as a line in a survey of recent trades. An upload presenting the subject or one of its units for itself, such as its listing sheet, brochure, price list or market history, presents the subject, whatever unit line it prints beside the read street. Read every upload whole, including tables that continue from one page to the next. Copy each figure exactly as an upload states it for that property, and each listing's remarks word for word. Specs come only from what is printed as text: never count rooms or take a figure from what a floor plan drawing, a photo or a map shows; a studio has one bedroom. Never compute one: not by multiplying a price per unit by a unit count, not by dividing a price by a size, not by counting the days between two dates, not by converting a yearly fee to a monthly one, not by averaging rows, and never by carrying a figure across from a neighbouring row, a summary or the subject. If a property is listed in more than one place — on several pages, or in several uploads — return one item carrying every figure those places state. A figure no upload states for that property is null; a null is always better than a guess. Never return the subject, even where it appears in a comparables table or at the centre of a comparables map. Another unit of the subject's building is a comparable only where an upload sets it beside the subject as one, such as a sister unit's earlier sale in a comps table. Do not return a market, submarket or area average, a portfolio total, or anything that is not an individual property. When no upload compares another property with the subject, return no items.";
|
|
504
|
+
const comparablePlace = address({ label: "Address" });
|
|
505
|
+
const comparableSaleDate = date({ label: "Sale date" });
|
|
506
|
+
const comparables = page({
|
|
507
|
+
title: "Which properties compare?",
|
|
508
|
+
description: "Recently sold or listed homes like this one shape the pricing story."
|
|
509
|
+
}, list({
|
|
510
|
+
label: "Comparables",
|
|
511
|
+
max: 50,
|
|
512
|
+
source: fill.write({
|
|
513
|
+
reads: [uploads, propertyAddress],
|
|
514
|
+
brief: COMPARABLES_BRIEF
|
|
515
|
+
}),
|
|
516
|
+
item: object({
|
|
517
|
+
label: comparablePlace,
|
|
518
|
+
fields: {
|
|
519
|
+
address: comparablePlace,
|
|
520
|
+
price: number({ label: "Price" }),
|
|
521
|
+
sale_date: comparableSaleDate,
|
|
522
|
+
beds: number({ label: "Beds" }),
|
|
523
|
+
baths: number({
|
|
524
|
+
label: "Baths",
|
|
525
|
+
decimals: true
|
|
526
|
+
}),
|
|
527
|
+
sqft: number({ label: "Sq ft" }),
|
|
528
|
+
photo: image({ label: "Photo" }),
|
|
529
|
+
year_built: number({ label: "Year built" }),
|
|
530
|
+
lot_sqft: number({ label: "Lot sq ft" }),
|
|
531
|
+
stories: number({
|
|
532
|
+
label: "Stories",
|
|
533
|
+
decimals: true
|
|
534
|
+
}),
|
|
535
|
+
units: number({ label: "Units" }),
|
|
536
|
+
hoa_monthly: number({ label: "HOA per month" }),
|
|
537
|
+
list_price: number({ label: "List price" }),
|
|
538
|
+
listed_date: date({ label: "Listed date" }),
|
|
539
|
+
mls_number: text.short({ label: "MLS number" }),
|
|
540
|
+
description: text.long({ label: "Description" }),
|
|
541
|
+
status: select({
|
|
542
|
+
label: "Status",
|
|
543
|
+
from: [...COMPARABLE_STATUS_VALUES],
|
|
544
|
+
locked: true,
|
|
545
|
+
source: compute({ reads: [comparableSaleDate] }, (soldOn) => comparableStatusOf(soldOn))
|
|
546
|
+
}),
|
|
547
|
+
distance_m: number({
|
|
548
|
+
label: "Distance (m)",
|
|
549
|
+
locked: true,
|
|
550
|
+
source: compute({ reads: [comparablePlace, propertyAddress] }, (comp, subject) => comparableDistanceMeters(comp, subject))
|
|
551
|
+
}),
|
|
552
|
+
price_period: select({
|
|
553
|
+
label: "Price period",
|
|
554
|
+
from: [...COMPARABLE_PRICE_PERIOD_VALUES],
|
|
555
|
+
locked: true,
|
|
556
|
+
source: compute({ reads: [listing_intent] }, (intent) => comparablePricePeriod(intent))
|
|
557
|
+
})
|
|
558
|
+
}
|
|
559
|
+
})
|
|
560
|
+
}));
|
|
561
|
+
const contacts = page({
|
|
562
|
+
title: "Who’s on this listing?",
|
|
563
|
+
description: "Add the contacts for this property, and drag them into the order your marketing shows them."
|
|
564
|
+
}, list({
|
|
565
|
+
label: "Contacts",
|
|
566
|
+
min: 1,
|
|
567
|
+
max: 12,
|
|
568
|
+
source: fill.pick({
|
|
569
|
+
reads: [uploads],
|
|
570
|
+
brief: "Choose this listing's contacts from the library's contacts, judging each one's name, title, organisation, email and phone against the read uploads' names and accounts. A contact may be chosen only when an upload's name or account says it prints their email or phone, or their full name, as a contact for this listing — an agent, broker, or sales or leasing contact. A contact the uploads leave out, where their accounts name the listing's contacts, is not chosen. A shared organisation, a matching first name, or a name printed in another role (an architect, a photographer, a seller) is not evidence. When no upload's account names any contact, choose none. Order those chosen as the uploads present them for this listing, the first or most prominent first."
|
|
571
|
+
}),
|
|
572
|
+
item: row({
|
|
573
|
+
label: "Contact",
|
|
574
|
+
from: libraryFacts.contacts
|
|
575
|
+
})
|
|
576
|
+
}));
|
|
577
|
+
const propertyFacts = defineFacts("property", {
|
|
578
|
+
address: propertyAddress,
|
|
579
|
+
listing_intent,
|
|
580
|
+
description: page({
|
|
581
|
+
title: "Describe the property",
|
|
582
|
+
description: "Talk it up like you would to a buyer, and our AI writes your website copy."
|
|
583
|
+
}, text.long({ label: "Description" })),
|
|
584
|
+
uploads,
|
|
585
|
+
property_media: propertyMedia,
|
|
586
|
+
floor_plans,
|
|
587
|
+
property_documents: propertyDocuments,
|
|
588
|
+
hero,
|
|
589
|
+
site_url,
|
|
590
|
+
units,
|
|
591
|
+
commercial_spaces,
|
|
592
|
+
contacts,
|
|
593
|
+
comparables
|
|
594
|
+
});
|
|
595
|
+
linkRegistry(propertyFacts);
|
|
596
|
+
|
|
597
|
+
//#endregion
|
|
598
|
+
export { COMPARABLE_PRICE_PERIOD_VALUES, COMPARABLE_STATUS_VALUES, FACT_HOMES, LISTING_INTENT_VALUES, comparableDistanceMeters, comparablePricePeriod, comparableStatusOf, defineFacts, haversineMeters, libraryFacts, listKeyOf, page, propertyFacts, refuseHolderKeys };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FACT_GRAPH, FactGraphName, FactMemberDescriptor, FactProjections, FactShapeDescriptor, FactValueType } from "./slot-catalog.js";
|
|
2
|
+
import { RegistryFactKey, RegistryFactValue } from "./fact-keys.js";
|
|
2
3
|
//#region ../../internal/template-contracts/dist/facts-view.d.ts
|
|
3
4
|
type Graph = typeof FACT_GRAPH;
|
|
4
5
|
type ScalarType<V extends FactValueType> = V extends "number" ? number | null : V extends "boolean" ? boolean : V extends "text_list" ? readonly string[] : string | null;
|
|
@@ -44,33 +45,18 @@ type Facts = {
|
|
|
44
45
|
role: "readable";
|
|
45
46
|
} ? K : never]: EntryValue<K>; };
|
|
46
47
|
/**
|
|
47
|
-
* One
|
|
48
|
-
*
|
|
48
|
+
* One fact's value, by the key a ref stores — the type a typed fact ref
|
|
49
|
+
* (`fact.property.address.city`, `fact.description`) reads at.
|
|
49
50
|
*
|
|
50
51
|
* @remarks
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
52
|
+
* A registry key (`property.address.city`) reads the value the fact registry declares
|
|
53
|
+
* for it. Any other key is a fact graph entry, read as the projection {@link Facts}
|
|
54
|
+
* places it, named on its own so a ref's phantom value type and the view stay one
|
|
55
|
+
* derivation. The container is not a parameter: an entry's key is globally unique,
|
|
56
|
+
* and `fact.unit.beds` and `f.unit.beds` are the same registry entry read two ways.
|
|
55
57
|
*/
|
|
56
|
-
type FactValue<K extends FactGraphName> = EntryValue<K>;
|
|
57
|
-
/** One unit row of `property.units` (and the shape of the primary `unit`). */
|
|
58
|
-
type FactsUnit = FactsRow<"units">;
|
|
59
|
-
/** One full contact card of `property.contacts` (and the shape of the primary `contact`), spelled as `fact.contact.*` spells it. */
|
|
60
|
-
type FactsContact = FactsRow<"contacts">;
|
|
61
|
-
/** One property photo of the `photos` pool. */
|
|
62
|
-
type FactsPhoto = FactsRow<"photos">;
|
|
63
|
-
/** One video candidate of the `videos` pool — a hosted upload or a pasted provider link. */
|
|
64
|
-
type FactsVideo = FactsRow<"videos">;
|
|
65
|
-
/** One 3D tour of the `tours` pool. */
|
|
66
|
-
type FactsTour = FactsRow<"tours">;
|
|
67
|
-
/** One detected floor plan of the `floor_plans` pool, with its per-unit assignments. */
|
|
68
|
-
type FactsFloorPlan = FactsRow<"floor_plans">;
|
|
69
|
-
/** One attachable document of the `documents` pool. */
|
|
70
|
-
type FactsDocument = FactsRow<"documents">;
|
|
71
|
-
/** One distilled document-notes entry of the `document_notes` pool. */
|
|
72
|
-
type FactsDocumentNote = FactsRow<"document_notes">;
|
|
58
|
+
type FactValue<K extends FactGraphName | RegistryFactKey> = K extends RegistryFactKey ? RegistryFactValue<K> : EntryValue<K & FactGraphName>;
|
|
73
59
|
/** The structured address at `property.address`. */
|
|
74
60
|
type FactsAddress = Facts["property"]["address"];
|
|
75
61
|
//#endregion
|
|
76
|
-
export { FactPoolName, FactValue, Facts, FactsAddress,
|
|
62
|
+
export { FactPoolName, FactValue, Facts, FactsAddress, FactsRow };
|