@homepages/concrete 7.0.0 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1007 -0
- package/README.md +20 -9
- package/codemods/list-grammar.mjs +923 -0
- package/codemods/manifest.json +66 -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-BUmdDDX5.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/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 +263 -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 +252 -35
- package/dist/packages/internal/fill-bake/dist/compute-reads.js +365 -4
- package/dist/packages/internal/fill-bake/dist/derive-source.js +35 -21
- package/dist/packages/internal/fill-bake/dist/index.js +8 -3
- package/dist/packages/internal/fill-bake/dist/item-merge.js +119 -0
- package/dist/packages/internal/fill-bake/dist/item-overrides.js +28 -0
- package/dist/packages/internal/fill-bake/dist/linked-merge.js +40 -0
- package/dist/packages/internal/fill-bake/dist/list-grammar.js +175 -0
- package/dist/packages/internal/fill-vocabulary/dist/holder.js +51 -0
- package/dist/packages/internal/fill-vocabulary/dist/resolved-decision.js +390 -0
- package/dist/packages/internal/fill-vocabulary/dist/row-planners.js +1 -23
- package/dist/packages/internal/fill-vocabulary/dist/row-reads.js +1 -1
- package/dist/packages/internal/fill-vocabulary/dist/verbs.js +75 -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 +228 -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 +34 -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 +244 -0
- package/dist/packages/internal/section-contracts/dist/cap-contract.js +8 -17
- package/dist/packages/internal/section-contracts/dist/catalog.js +35 -27
- 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 +27 -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 -0
- 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 -5
- package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +23 -19
- package/dist/packages/internal/section-contracts/dist/list-scalar-contract.js +12 -7
- 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 +5 -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 +7 -4
- package/dist/packages/internal/section-contracts/dist/row-rule-contract.js +83 -0
- package/dist/packages/internal/section-contracts/dist/row-source-contract.js +67 -0
- package/dist/packages/internal/section-contracts/dist/runners.js +77 -33
- package/dist/packages/internal/section-contracts/dist/select-contract.js +0 -8
- package/dist/packages/internal/section-contracts/dist/source-contract.js +120 -66
- 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 +43 -18
- package/dist/packages/internal/source-resolution/dist/index.js +113 -118
- 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 +85 -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 +12 -36
- 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 +158 -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 +94 -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 +250 -0
- package/dist/packages/internal/template-contracts/dist/ref-locate.js +192 -0
- package/dist/packages/internal/template-contracts/dist/registry-aliases.js +77 -0
- package/dist/packages/internal/template-contracts/dist/registry-facts.d.ts +268 -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 +133 -0
- package/dist/packages/internal/template-contracts/dist/row-ref.js +101 -0
- package/dist/packages/internal/template-contracts/dist/row-sources.js +48 -8
- 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 +243 -384
- package/dist/packages/internal/template-contracts/dist/slot-catalog.js +334 -230
- 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 +140 -0
- package/dist/packages/internal/template-contracts/dist/slot-value.d.ts +97 -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 +19 -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 -158
- 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 -11
- 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 -29
- package/package.json +9 -8
- package/dist/artifact/playground/client/assets/index-CckS2ONm.css +0 -1
- package/dist/artifact/playground/client/assets/index-D8eepVr-.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 -111
- 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/choose-select-contract.js +0 -20
- package/dist/packages/internal/section-contracts/dist/name-title-contract.js +0 -20
- package/dist/packages/internal/section-contracts/dist/pooling-field-contract.js +0 -22
- package/dist/packages/internal/section-contracts/dist/record-collection-contract.js +0 -24
- package/dist/packages/internal/section-contracts/dist/source-filter-contract.js +0 -15
- package/dist/packages/internal/template-contracts/dist/collection-editing.js +0 -22
- package/dist/packages/internal/template-contracts/dist/facts-view.js +0 -111
- 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 -89
- 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 -613
- 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
|
@@ -1,26 +1,56 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { declaredKinds, isMediaType, mediaDeclarationProblem } from "../../template-contracts/dist/slot-catalog.js";
|
|
2
|
+
import { isMediaListKey, mediaListKeys, mediaListKinds } from "../../template-contracts/dist/fact-keys.js";
|
|
2
3
|
|
|
3
4
|
//#region ../../internal/section-contracts/dist/sources-contract.js
|
|
4
5
|
function assertSourcesContract(schema, sectionKey) {
|
|
5
|
-
for (const [slotId,
|
|
6
|
+
for (const [slotId, slot] of Object.entries(schema.slots)) check(slot, sectionKey, slotId, false);
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const BINDING_KINDS = /* @__PURE__ */ new Set([
|
|
9
|
+
"home",
|
|
10
|
+
"row",
|
|
11
|
+
"element",
|
|
12
|
+
"section"
|
|
13
|
+
]);
|
|
14
|
+
function isBound(slot) {
|
|
15
|
+
const kind = slot.source?.kind;
|
|
16
|
+
return kind !== void 0 && BINDING_KINDS.has(kind);
|
|
17
|
+
}
|
|
18
|
+
function check(slot, sectionKey, path, inherited, picked = false) {
|
|
19
|
+
if (slot.sources !== void 0) throw new Error(`Section "${sectionKey}": slot "${path}" declares \`sources\`. A media slot takes a pasted link wherever a link provider claims its kind (a video, a tour) and declares nothing for it — \`concrete upgrade\` removes it.`);
|
|
20
|
+
const holdsPick = picked && slot.source?.kind === "element" && isMediaType(slot.type ?? "");
|
|
21
|
+
checkMediaFilter(slot, sectionKey, path, inherited || isBound(slot) && !holdsPick);
|
|
22
|
+
if (slot.element) {
|
|
23
|
+
const list = slot.type === "list";
|
|
24
|
+
check(slot.element, sectionKey, `${path}.element`, list && isBound(slot), list && slot.source === void 0);
|
|
12
25
|
}
|
|
13
|
-
if (slot.
|
|
14
|
-
if (slot.fields) for (const [fieldId, field] of Object.entries(slot.fields)) check(field, sectionKey, `${path}.${fieldId}`);
|
|
26
|
+
if (slot.fields) for (const [fieldId, field] of Object.entries(slot.fields)) check(field, sectionKey, `${path}.${fieldId}`, false, picked && slot.type === "object");
|
|
15
27
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
-
|
|
28
|
+
function checkMediaFilter(slot, sectionKey, path, bound) {
|
|
29
|
+
const kind = slot.type ?? "";
|
|
30
|
+
if ("category" in slot) throw new Error(`Section "${sectionKey}": slot "${path}" declares \`category\`. A media slot names the list it picks from in \`from\` (${mediaListKeys().map((key) => `"${key}"`).join(", ")}), or owns its asset without one.`);
|
|
31
|
+
if (!isMediaType(kind)) {
|
|
32
|
+
if (slot.from !== void 0 && kind !== "row") throw new Error(`Section "${sectionKey}": slot "${path}" declares \`from\`, but a section's ${kind === "select" ? "select states its values" : "slot names no candidates of its own"} — a media slot picks \`from\` a media list, a row from its table.`);
|
|
33
|
+
if (slot.process !== void 0) throw new Error(`Section "${sectionKey}": slot "${path}" declares \`process\`, which only a media slot (image, video, tour, document, media) carries.`);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const problem = mediaDeclarationProblem({
|
|
37
|
+
type: kind,
|
|
38
|
+
kinds: slot.kinds,
|
|
39
|
+
process: slot.process
|
|
40
|
+
});
|
|
41
|
+
if (problem !== null) throw new Error(`Section "${sectionKey}": ${kind} "${path}" ${problem}.`);
|
|
42
|
+
if (slot.from === void 0 && slot.process === void 0) return;
|
|
43
|
+
if (bound) throw new Error(`Section "${sectionKey}": ${kind} "${path}" is bound to a fact and declares \`${slot.from !== void 0 ? "from" : "process"}\`. A bound media slot holds what its fact holds — remove it.`);
|
|
44
|
+
const lists = slot.from === void 0 ? [] : Array.isArray(slot.from) ? slot.from : [slot.from];
|
|
45
|
+
const holds = declaredKinds({
|
|
46
|
+
type: kind,
|
|
47
|
+
kinds: slot.kinds
|
|
48
|
+
});
|
|
49
|
+
for (const [index, list] of lists.entries()) {
|
|
50
|
+
if (!isMediaListKey(list)) throw new Error(`Section "${sectionKey}": ${kind} "${path}" picks \`from\` ${JSON.stringify(list)}, which is no media list of the property — ${mediaListKeys().map((key) => `"${key}"`).join(", ")}.`);
|
|
51
|
+
if (lists.indexOf(list) !== index) throw new Error(`Section "${sectionKey}": ${kind} "${path}" picks \`from\` "${list}" twice — each list is named once.`);
|
|
52
|
+
const listed = mediaListKinds(list) ?? [];
|
|
53
|
+
if (listed.length > 0 && !holds.some((held) => listed.includes(held))) throw new Error(`Section "${sectionKey}": ${kind} "${path}" picks \`from\` "${list}", a list of ${listed.join(", ")}, whose items can never be ${holds.join(" or ")} — each list a media slot picks from holds items of its kinds.`);
|
|
24
54
|
}
|
|
25
55
|
}
|
|
26
56
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { REGISTRY_TABLE_KEYS } from "../../template-contracts/dist/slot-catalog.js";
|
|
2
|
+
import { tableRowMember } from "../../template-contracts/dist/table-members.js";
|
|
3
|
+
|
|
4
|
+
//#region ../../internal/section-contracts/dist/table-member.js
|
|
5
|
+
function tableKeySpelling(key) {
|
|
6
|
+
return key.reading === "legacy" ? key.table : REGISTRY_TABLE_KEYS[key.table];
|
|
7
|
+
}
|
|
8
|
+
function tableMemberOrRefuse(key, field, at, refusal) {
|
|
9
|
+
const found = tableRowMember(key, field);
|
|
10
|
+
if (found.kind === "identity") throw new Error(`${at}: ${refusal.identity}`);
|
|
11
|
+
if (found.kind === "unknown") throw new Error(`${at}: unknown ${refusal.noun} "${field}" — a "${tableKeySpelling(key)}" row offers ${found.offers.map((name) => `"${name}"`).join(", ")}.`);
|
|
12
|
+
return found;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { tableKeySpelling, tableMemberOrRefuse };
|
|
@@ -1,36 +1,61 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { rowTableOf } from "../../template-contracts/dist/ref-locate.js";
|
|
2
|
+
import { listItemFieldsOf, memberSourceOf } from "../../template-contracts/dist/row-sources.js";
|
|
3
|
+
import { holderOf } from "../../fill-vocabulary/dist/holder.js";
|
|
4
|
+
import { impliedVerbOf } from "../../fill-vocabulary/dist/verbs.js";
|
|
5
|
+
import { elementIsFact, grammarSlots, producedSlot, slotInScope } from "./grammar-scope.js";
|
|
2
6
|
import { plannedFieldsOf } from "./fill-spec-view.js";
|
|
3
7
|
|
|
4
8
|
//#region ../../internal/section-contracts/dist/writer-reads-fact-contract.js
|
|
5
|
-
|
|
6
|
-
|
|
9
|
+
function writes(node, slot, planned = []) {
|
|
10
|
+
if (node.verb !== void 0) return node.verb === "write";
|
|
7
11
|
if (slot === void 0) return false;
|
|
8
|
-
|
|
9
|
-
if (origination === void 0) return false;
|
|
10
|
-
return WRITES.includes(origination.kind) || origination.kind === "keyed-rows" && origination.keys === "written";
|
|
12
|
+
return impliedVerbOf(slot, planned) === "write" && holderOf(slot).shape !== "objects";
|
|
11
13
|
}
|
|
12
|
-
function readsAFact(reads, rowsAreFacts) {
|
|
14
|
+
function readsAFact(reads, rowsAreFacts, memberIsFact) {
|
|
13
15
|
return (reads ?? []).some((ref) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
if (ref === null || typeof ref !== "object") return false;
|
|
17
|
+
const kind = ref.kind;
|
|
18
|
+
if (kind === "home") return true;
|
|
19
|
+
if (kind === "element") return memberIsFact(ref);
|
|
20
|
+
if (kind !== "row") return false;
|
|
21
|
+
return "slot" in ref ? memberIsFact(ref) : rowsAreFacts;
|
|
16
22
|
});
|
|
17
23
|
}
|
|
18
|
-
function assertWriterReadsFactContract(schema, decision, sectionKey) {
|
|
19
|
-
if (decision.kind !== "text" && decision.kind !== "list") return;
|
|
24
|
+
function assertWriterReadsFactContract(schema, decision, sectionKey, fillSpec = { decisions: [decision] }) {
|
|
25
|
+
if (decision.kind !== "text" && decision.kind !== "number" && decision.kind !== "list") return;
|
|
20
26
|
const fill = decision;
|
|
27
|
+
const ctx = {
|
|
28
|
+
key: sectionKey,
|
|
29
|
+
schema,
|
|
30
|
+
fillSpec
|
|
31
|
+
};
|
|
32
|
+
const scoped = grammarSlots(schema);
|
|
33
|
+
const memberIsFact = (reader) => (ref) => {
|
|
34
|
+
if (ref.kind === "element") return reader?.container !== void 0 && reader.place === "item-field" && elementIsFact(ctx, reader.container);
|
|
35
|
+
const member = memberSourceOf(ref);
|
|
36
|
+
const row = member === null || reader === void 0 ? void 0 : slotInScope(schema, reader, member.slot);
|
|
37
|
+
return row?.def.type === "row" && rowTableOf(row.def) !== null;
|
|
38
|
+
};
|
|
21
39
|
const writing = [];
|
|
22
40
|
let rowsAreFacts = false;
|
|
41
|
+
let fieldsReadAFact = false;
|
|
23
42
|
for (const slotId of decision.produces) {
|
|
24
|
-
const slot = schema
|
|
43
|
+
const slot = producedSlot(schema, slotId);
|
|
25
44
|
if (slot === void 0) continue;
|
|
26
|
-
|
|
27
|
-
if (
|
|
28
|
-
|
|
45
|
+
const holder = holderOf(slot);
|
|
46
|
+
if (holder.shape === "objects" && holder.bound !== void 0) rowsAreFacts = true;
|
|
47
|
+
if (decision.verb === void 0 && (decision.kind === "text" || decision.kind === "number") || writes(fill, slot, plannedFieldsOf(decision))) writing.push(slotId);
|
|
48
|
+
const itemFields = listItemFieldsOf(slot);
|
|
49
|
+
for (const [field, node] of Object.entries(fill.fields ?? {})) {
|
|
50
|
+
if (writes(node, itemFields?.[field])) writing.push(`${slotId}.${field}`);
|
|
51
|
+
const reader = scoped.find((s) => s.place === "item-field" && s.path === `${slotId}.${field}`);
|
|
52
|
+
if (readsAFact(node.reads, rowsAreFacts, memberIsFact(reader))) fieldsReadAFact = true;
|
|
53
|
+
}
|
|
29
54
|
}
|
|
30
55
|
if (writing.length === 0) return;
|
|
31
|
-
const
|
|
32
|
-
if (readsAFact(fill.reads, false
|
|
33
|
-
throw new Error(`Section "${sectionKey}": fill "${decision.id}" writes ${writing.map((w) => `"${w}"`).join(", ")} but reads no fact — its model call is shown exactly its \`reads\`, so it would write from the brief alone. Declare the facts it writes from (\`reads: [fact.description]\`), on the fill or on the
|
|
56
|
+
const reader = scoped.find((s) => s.place !== "element" && decision.produces.includes(s.path));
|
|
57
|
+
if (fieldsReadAFact || readsAFact(fill.reads, false, memberIsFact(reader))) return;
|
|
58
|
+
throw new Error(`Section "${sectionKey}": fill "${decision.id}" writes ${writing.map((w) => `"${w}"`).join(", ")} but reads no fact — its model call is shown exactly its \`reads\`, so it would write from the brief alone. Declare the facts it writes from (\`reads: [fact.description]\`), on the fill or on the item field that writes.`);
|
|
34
59
|
}
|
|
35
60
|
|
|
36
61
|
//#endregion
|
|
@@ -1,44 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { addressMember, isAddressMember, normalizeAddressValue } from "../../template-contracts/dist/address-value.js";
|
|
2
|
+
import { FACT_GRAPH, FACT_PROJECTIONS, REFERRAL_FIELDS, REFERRAL_IMAGE_FIELDS, SOURCE_FIELDS, TABLES, tableKeyOf } from "../../template-contracts/dist/slot-catalog.js";
|
|
3
|
+
import { memberValueType, tableColumnOfKey } from "../../template-contracts/dist/registry-shape.js";
|
|
4
|
+
import { elementIdentityKey } from "../../template-contracts/dist/ref-locate.js";
|
|
5
|
+
import { isMediaListKey, isRegistryFactKey, readRegistryFact, registryPropertyRoot } from "../../template-contracts/dist/fact-keys.js";
|
|
6
|
+
import { rowIdentityKey, tableFields, tableRowMember } from "../../template-contracts/dist/table-members.js";
|
|
7
|
+
import { elementRowKeys, rowMemberSources } from "../../template-contracts/dist/row-sources.js";
|
|
8
|
+
import { readLegacyFact, readLegacyRows } from "../../template-contracts/dist/legacy-facts.js";
|
|
4
9
|
|
|
5
10
|
//#region ../../internal/source-resolution/dist/index.js
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
function tableKey(table) {
|
|
12
|
+
return typeof table === "string" ? {
|
|
13
|
+
table,
|
|
14
|
+
reading: "legacy"
|
|
15
|
+
} : table;
|
|
16
|
+
}
|
|
17
|
+
function registryTableRows(table, facts) {
|
|
18
|
+
const addresses = Object.entries(tableFields(table)).filter(([, declaration]) => memberValueType(declaration) === "address").map(([name]) => name);
|
|
19
|
+
return facts[table].map((item) => {
|
|
20
|
+
const row = { ...item };
|
|
21
|
+
for (const name of addresses) row[name] = normalizeAddressValue(item[name]);
|
|
22
|
+
return row;
|
|
23
|
+
});
|
|
16
24
|
}
|
|
17
25
|
function contactsOf(facts) {
|
|
18
|
-
|
|
19
|
-
return Array.isArray(raw) ? raw : [];
|
|
26
|
+
return readLegacyRows(facts, "contacts");
|
|
20
27
|
}
|
|
21
|
-
|
|
22
|
-
const raw = facts.comparables;
|
|
23
|
-
return Array.isArray(raw) ? raw : [];
|
|
24
|
-
}
|
|
25
|
-
const CONTACT_ROW = FACT_GRAPH.contacts.row;
|
|
26
|
-
const REFERRAL_FIELD_TO_CONTACT_KEY = Object.fromEntries(REFERRAL_FIELDS.map((field) => [field, CONTACT_ROW[field].path]));
|
|
28
|
+
const REFERRAL_FIELD_SET = new Set(REFERRAL_FIELDS);
|
|
27
29
|
const REFERRAL_IMAGE_FIELD_SET = new Set(REFERRAL_IMAGE_FIELDS);
|
|
28
30
|
const LOGO_VARIANT_FALLBACK = {
|
|
29
31
|
logo_dark: {
|
|
30
|
-
other:
|
|
32
|
+
other: "logo_light",
|
|
31
33
|
mask: "black"
|
|
32
34
|
},
|
|
33
35
|
logo_light: {
|
|
34
|
-
other:
|
|
36
|
+
other: "logo_dark",
|
|
35
37
|
mask: "white"
|
|
36
38
|
}
|
|
37
39
|
};
|
|
38
40
|
function resolveContactCardField(contact, field) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const raw = contact?.[key] ?? null;
|
|
41
|
+
if (!REFERRAL_FIELD_SET.has(field)) return null;
|
|
42
|
+
const raw = contact?.[field] ?? null;
|
|
42
43
|
if (REFERRAL_IMAGE_FIELD_SET.has(field)) {
|
|
43
44
|
const assetId = typeof raw === "string" && raw.trim().length > 0 ? raw.trim() : null;
|
|
44
45
|
if (assetId !== null) return { asset_id: assetId };
|
|
@@ -56,82 +57,33 @@ function resolveContactCardField(contact, field) {
|
|
|
56
57
|
if (raw === null || raw === void 0) return "";
|
|
57
58
|
return typeof raw === "string" ? raw : String(raw);
|
|
58
59
|
}
|
|
59
|
-
const
|
|
60
|
+
const PRIMARY_CONTACT_FACT_TO_CONTACT_MEMBER = {
|
|
60
61
|
primary_contact_name: "name",
|
|
61
62
|
primary_contact_title: "title",
|
|
62
63
|
primary_contact_bio: "bio",
|
|
63
64
|
primary_contact_email: "email",
|
|
64
65
|
primary_contact_phone: "phone",
|
|
65
66
|
primary_contact_address: "address",
|
|
66
|
-
primary_contact_website_url: "
|
|
67
|
-
primary_contact_avatar_upload_id: "
|
|
68
|
-
primary_contact_logo_dark_upload_id: "
|
|
69
|
-
primary_contact_logo_light_upload_id: "
|
|
70
|
-
primary_contact_instagram_url: "
|
|
71
|
-
primary_contact_linkedin_url: "
|
|
72
|
-
primary_contact_x_url: "
|
|
73
|
-
primary_contact_facebook_url: "
|
|
67
|
+
primary_contact_website_url: "website",
|
|
68
|
+
primary_contact_avatar_upload_id: "headshot",
|
|
69
|
+
primary_contact_logo_dark_upload_id: "logo_dark",
|
|
70
|
+
primary_contact_logo_light_upload_id: "logo_light",
|
|
71
|
+
primary_contact_instagram_url: "instagram",
|
|
72
|
+
primary_contact_linkedin_url: "linkedin",
|
|
73
|
+
primary_contact_x_url: "x",
|
|
74
|
+
primary_contact_facebook_url: "facebook"
|
|
74
75
|
};
|
|
75
76
|
function primaryContactFactValue(facts, factKey) {
|
|
76
|
-
const key =
|
|
77
|
+
const key = PRIMARY_CONTACT_FACT_TO_CONTACT_MEMBER[factKey];
|
|
77
78
|
if (key === void 0) return void 0;
|
|
78
|
-
const raw =
|
|
79
|
+
const raw = contactsOf(facts)[0]?.[key] ?? null;
|
|
79
80
|
return typeof raw === "string" ? raw : null;
|
|
80
81
|
}
|
|
81
|
-
function
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
case "condo_townhome": return "Condo";
|
|
85
|
-
case "multi_family":
|
|
86
|
-
case "investment": return null;
|
|
87
|
-
default: return null;
|
|
88
|
-
}
|
|
82
|
+
function tableRowsOf(table, facts) {
|
|
83
|
+
const key = tableKey(table);
|
|
84
|
+
return key.reading === "legacy" ? readLegacyRows(facts, key.table) : registryTableRows(key.table, facts);
|
|
89
85
|
}
|
|
90
|
-
|
|
91
|
-
return resolveContactScalar(c, field);
|
|
92
|
-
}
|
|
93
|
-
function buildContactsList(facts, fields) {
|
|
94
|
-
return contactsOf(facts).map((c) => {
|
|
95
|
-
const row = { id: c.id };
|
|
96
|
-
for (const [key, field] of Object.entries(fields)) row[key] = resolveContactRowField(c, field);
|
|
97
|
-
return row;
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
function buildUnitsList(facts, fields) {
|
|
101
|
-
const fallback = singleUnitLabelDefault(facts.property_type);
|
|
102
|
-
return [...facts.units].sort((a, b) => a.position - b.position).map((u) => {
|
|
103
|
-
const base = {
|
|
104
|
-
...u,
|
|
105
|
-
unit_label: u.unit_label ?? fallback
|
|
106
|
-
};
|
|
107
|
-
const row = { ...base };
|
|
108
|
-
for (const [key, field] of Object.entries(fields)) row[key] = resolveUnitScalar(base, field);
|
|
109
|
-
return row;
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
function buildUnitFloorplanList(facts) {
|
|
113
|
-
return [...facts.units].sort((a, b) => a.position - b.position).map((u) => ({
|
|
114
|
-
unit_id: u.unit_id,
|
|
115
|
-
unit_label: u.unit_label,
|
|
116
|
-
floorplans: [...u.floor_plans].sort((a, b) => a.position - b.position)
|
|
117
|
-
}));
|
|
118
|
-
}
|
|
119
|
-
function buildComparablesList(facts) {
|
|
120
|
-
return comparablesOf(facts).map((row) => ({ ...row }));
|
|
121
|
-
}
|
|
122
|
-
const COLLECTION_PROJECTIONS = {
|
|
123
|
-
units: buildUnitsList,
|
|
124
|
-
contacts: buildContactsList,
|
|
125
|
-
comparables: buildComparablesList
|
|
126
|
-
};
|
|
127
|
-
function collectionRowsOf(collection, facts) {
|
|
128
|
-
switch (collection) {
|
|
129
|
-
case "units": return [...facts.units].sort((a, b) => a.position - b.position);
|
|
130
|
-
case "contacts": return contactsOf(facts);
|
|
131
|
-
case "comparables": return comparablesOf(facts);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
const CONTACT_MEMBER_FACT = Object.fromEntries(Object.entries(CONTACT_ROW).filter(([, member]) => member.strength !== void 0).map(([name]) => [name, FACT_PROJECTIONS.contact[name] ?? name]));
|
|
86
|
+
const CONTACT_MEMBER_FACT = Object.fromEntries(Object.entries(FACT_GRAPH.contacts.row).filter(([, member]) => member.primary === true).map(([name]) => [name, FACT_PROJECTIONS.contact[name] ?? name]));
|
|
135
87
|
function mediaRefOf(raw) {
|
|
136
88
|
if (typeof raw !== "string") return null;
|
|
137
89
|
const assetId = raw.trim();
|
|
@@ -146,33 +98,69 @@ function mediaRefListOf(raw) {
|
|
|
146
98
|
return [ref];
|
|
147
99
|
});
|
|
148
100
|
}
|
|
149
|
-
function
|
|
150
|
-
const
|
|
101
|
+
function readMemberOf(table, row, member) {
|
|
102
|
+
const key = tableKey(table);
|
|
103
|
+
if (key.reading === "legacy") return readLegacyMemberOf(key.table, row, member);
|
|
104
|
+
return readRegistryMemberOf(key.table, row, member);
|
|
105
|
+
}
|
|
106
|
+
function readLegacyMemberOf(table, row, member) {
|
|
107
|
+
const descriptor = FACT_GRAPH[table].row[member];
|
|
151
108
|
if (descriptor === void 0) return null;
|
|
152
|
-
if (
|
|
109
|
+
if (table === "contacts") {
|
|
153
110
|
const fact = CONTACT_MEMBER_FACT[member];
|
|
154
111
|
if (fact !== void 0) return resolveContactScalar(row, fact);
|
|
155
112
|
}
|
|
156
|
-
|
|
157
|
-
const raw = row[descriptor.path] ?? null;
|
|
113
|
+
const raw = row[member] ?? null;
|
|
158
114
|
if (descriptor.value_type === "image") return mediaRefOf(raw);
|
|
159
115
|
if (descriptor.value_type === "image_list") return mediaRefListOf(raw);
|
|
160
116
|
return raw;
|
|
161
117
|
}
|
|
162
|
-
function
|
|
163
|
-
|
|
164
|
-
|
|
118
|
+
function readRegistryMemberOf(table, row, path) {
|
|
119
|
+
const lookup = tableRowMember({
|
|
120
|
+
table,
|
|
121
|
+
reading: "registry"
|
|
122
|
+
}, path);
|
|
123
|
+
if (lookup.kind === "identity") return row["id"] ?? null;
|
|
124
|
+
if (lookup.kind === "unknown") return null;
|
|
125
|
+
const dot = path.indexOf(".");
|
|
126
|
+
if (dot === -1) return row[path] ?? null;
|
|
127
|
+
const part = path.slice(dot + 1);
|
|
128
|
+
return isAddressMember(part) ? addressMember(row[path.slice(0, dot)], part) : null;
|
|
129
|
+
}
|
|
130
|
+
function tableRowIds(table, facts) {
|
|
131
|
+
const idKey = rowIdentityKey(tableKey(table));
|
|
132
|
+
return tableRowsOf(table, facts).flatMap((row) => {
|
|
133
|
+
const id = row[idKey];
|
|
134
|
+
return typeof id === "string" ? [id] : [];
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
function tableRowById(table, id, facts) {
|
|
138
|
+
const idKey = rowIdentityKey(tableKey(table));
|
|
139
|
+
return tableRowsOf(table, facts).find((row) => row[idKey] === id);
|
|
140
|
+
}
|
|
141
|
+
function readRowMember(table, id, member, facts) {
|
|
142
|
+
const row = tableRowById(table, id, facts);
|
|
143
|
+
return row === void 0 ? null : readMemberOf(table, row, member);
|
|
144
|
+
}
|
|
145
|
+
function projectTableRows(table, facts, fields, rowComputes = {}, ids) {
|
|
146
|
+
const key = tableKey(table);
|
|
147
|
+
const idKey = elementIdentityKey(key.table);
|
|
148
|
+
const rowId = rowIdentityKey(key);
|
|
165
149
|
const members = rowMemberSources(fields);
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
150
|
+
const elementRows = elementRowKeys(fields);
|
|
151
|
+
return (ids === void 0 ? tableRowsOf(table, facts) : ids.flatMap((id) => {
|
|
152
|
+
const row = tableRowById(table, id, facts);
|
|
153
|
+
return row === void 0 ? [] : [row];
|
|
154
|
+
})).map((row) => {
|
|
155
|
+
const out = { [idKey]: row[rowId] };
|
|
156
|
+
for (const field of elementRows) out[field] = row[rowId];
|
|
157
|
+
for (const [field, member] of Object.entries(members)) out[field] = readMemberOf(key, row, member);
|
|
158
|
+
for (const [field, compute] of Object.entries(rowComputes)) out[field] = compute((member) => readMemberOf(key, row, member), row[rowId]);
|
|
170
159
|
return out;
|
|
171
160
|
});
|
|
172
161
|
}
|
|
173
162
|
function firstUnit(facts) {
|
|
174
|
-
|
|
175
|
-
return [...facts.units].sort((a, b) => a.position - b.position)[0];
|
|
163
|
+
return tableRowsOf("units", facts)[0];
|
|
176
164
|
}
|
|
177
165
|
function resolveUnitScalar(unit, field) {
|
|
178
166
|
switch (field) {
|
|
@@ -185,35 +173,42 @@ function resolveUnitScalar(unit, field) {
|
|
|
185
173
|
}
|
|
186
174
|
}
|
|
187
175
|
function resolvePropertyScalar(facts, field) {
|
|
176
|
+
const address = readLegacyFact(facts, "address");
|
|
188
177
|
if (field === "address") {
|
|
189
|
-
if (
|
|
190
|
-
return
|
|
178
|
+
if (address && typeof address === "object") return address.display ?? null;
|
|
179
|
+
return address;
|
|
191
180
|
}
|
|
192
181
|
const part = ADDRESS_PARTS[field];
|
|
193
|
-
if (part !== void 0) return readAddressPart(
|
|
182
|
+
if (part !== void 0) return readAddressPart(address, part);
|
|
194
183
|
const virtual = primaryContactFactValue(facts, field);
|
|
195
184
|
if (virtual !== void 0) return virtual;
|
|
196
|
-
return facts
|
|
185
|
+
return readLegacyFact(facts, field);
|
|
197
186
|
}
|
|
198
|
-
const
|
|
199
|
-
if (entry.role !== "bindable" || entry.container !== "contact") return [];
|
|
200
|
-
const key = /^contacts\[\]\.(\w+)$/.exec(entry.path)?.[1];
|
|
201
|
-
return key === void 0 ? [] : [[name, key]];
|
|
202
|
-
}));
|
|
187
|
+
const CONTACT_FIELD_TO_CONTACT_MEMBER = Object.fromEntries(Object.entries(CONTACT_MEMBER_FACT).map(([member, fact]) => [fact, member]));
|
|
203
188
|
function resolveContactScalar(contact, field) {
|
|
204
|
-
if (
|
|
205
|
-
const key =
|
|
189
|
+
if (REFERRAL_FIELD_SET.has(field)) return resolveContactCardField(contact, field);
|
|
190
|
+
const key = CONTACT_FIELD_TO_CONTACT_MEMBER[field];
|
|
206
191
|
if (key === void 0) return null;
|
|
207
192
|
const raw = contact?.[key] ?? null;
|
|
208
193
|
if (typeof raw !== "string") return null;
|
|
209
194
|
const trimmed = raw.trim();
|
|
210
195
|
return trimmed.length > 0 ? trimmed : null;
|
|
211
196
|
}
|
|
197
|
+
function readFactRef(facts, key) {
|
|
198
|
+
if (isRegistryFactKey(key)) return readRegistryFact(key, registryPropertyRoot(facts));
|
|
199
|
+
if (isMediaListKey(key)) return facts[key.slice(9)];
|
|
200
|
+
const table = tableKeyOf(key);
|
|
201
|
+
if (table?.reading === "registry") return registryTableRows(table.table, facts);
|
|
202
|
+
const column = tableColumnOfKey(key);
|
|
203
|
+
if (column !== null) return registryTableRows(column.table, facts).map((row) => row[column.member] ?? null);
|
|
204
|
+
return readLegacyFact(facts, key);
|
|
205
|
+
}
|
|
212
206
|
function readFrom(field, ctx) {
|
|
207
|
+
if (isRegistryFactKey(field)) return readFactRef(ctx.facts, field);
|
|
213
208
|
const desc = SOURCE_FIELDS[field];
|
|
214
209
|
if (!desc) return null;
|
|
215
|
-
if (Object.hasOwn(
|
|
216
|
-
if (desc.container === "contact") return resolveContactScalar(ctx.contact ??
|
|
210
|
+
if (Object.hasOwn(TABLES, field)) return null;
|
|
211
|
+
if (desc.container === "contact") return resolveContactScalar(ctx.contact ?? contactsOf(ctx.facts)[0], field);
|
|
217
212
|
if (desc.container === "unit") return resolveUnitScalar(ctx.unit ?? firstUnit(ctx.facts), field);
|
|
218
213
|
return resolvePropertyScalar(ctx.facts, field);
|
|
219
214
|
}
|
|
@@ -231,4 +226,4 @@ function readAddressPart(address, part) {
|
|
|
231
226
|
}
|
|
232
227
|
|
|
233
228
|
//#endregion
|
|
234
|
-
export {
|
|
229
|
+
export { primaryContactFactValue, projectTableRows, readFactRef, readFrom, readRowMember, registryTableRows, resolveContactCardField, tableRowById, tableRowIds };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region ../../internal/static-assets-binding/dist/section-asset-url.js
|
|
2
|
+
const SECTION_ASSET_PREFIX = "/section-assets/";
|
|
3
|
+
const FILENAME = "[A-Za-z0-9._-]+\\.[A-Za-z0-9]+";
|
|
4
|
+
const FILENAME_RE = new RegExp(`^${FILENAME}$`);
|
|
5
|
+
const CANONICAL_REF_RE = new RegExp(`${SECTION_ASSET_PREFIX.replace(/\//g, "\\/")}(${FILENAME})`, "g");
|
|
6
|
+
function sectionAssetPrefix(profile) {
|
|
7
|
+
switch (profile.kind) {
|
|
8
|
+
case "canonical": return SECTION_ASSET_PREFIX;
|
|
9
|
+
case "publishedDocument": return "/assets/";
|
|
10
|
+
case "publishedStylesheet": return "";
|
|
11
|
+
case "canvas": return `${profile.basePath}runtime/section-asset/`;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { SECTION_ASSET_PREFIX, sectionAssetPrefix };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
//#region ../../internal/street-address/dist/index.js
|
|
2
|
+
const STREET_SUFFIXES = {
|
|
3
|
+
street: "st",
|
|
4
|
+
str: "st",
|
|
5
|
+
st: "st",
|
|
6
|
+
avenue: "ave",
|
|
7
|
+
aven: "ave",
|
|
8
|
+
av: "ave",
|
|
9
|
+
ave: "ave",
|
|
10
|
+
road: "rd",
|
|
11
|
+
rd: "rd",
|
|
12
|
+
drive: "dr",
|
|
13
|
+
dr: "dr",
|
|
14
|
+
boulevard: "blvd",
|
|
15
|
+
blvd: "blvd",
|
|
16
|
+
lane: "ln",
|
|
17
|
+
ln: "ln",
|
|
18
|
+
court: "ct",
|
|
19
|
+
ct: "ct",
|
|
20
|
+
circle: "cir",
|
|
21
|
+
cir: "cir",
|
|
22
|
+
place: "pl",
|
|
23
|
+
pl: "pl",
|
|
24
|
+
terrace: "ter",
|
|
25
|
+
ter: "ter",
|
|
26
|
+
parkway: "pkwy",
|
|
27
|
+
pkwy: "pkwy",
|
|
28
|
+
highway: "hwy",
|
|
29
|
+
hwy: "hwy",
|
|
30
|
+
way: "way",
|
|
31
|
+
trail: "trl",
|
|
32
|
+
trl: "trl",
|
|
33
|
+
square: "sq",
|
|
34
|
+
sq: "sq",
|
|
35
|
+
loop: "loop",
|
|
36
|
+
point: "pt",
|
|
37
|
+
pt: "pt"
|
|
38
|
+
};
|
|
39
|
+
const DIRECTIONALS = {
|
|
40
|
+
north: "n",
|
|
41
|
+
"n": "n",
|
|
42
|
+
south: "s",
|
|
43
|
+
"s": "s",
|
|
44
|
+
east: "e",
|
|
45
|
+
"e": "e",
|
|
46
|
+
west: "w",
|
|
47
|
+
"w": "w",
|
|
48
|
+
northeast: "ne",
|
|
49
|
+
ne: "ne",
|
|
50
|
+
northwest: "nw",
|
|
51
|
+
nw: "nw",
|
|
52
|
+
southeast: "se",
|
|
53
|
+
se: "se",
|
|
54
|
+
southwest: "sw",
|
|
55
|
+
sw: "sw"
|
|
56
|
+
};
|
|
57
|
+
function joinStreetUnit(street, unit) {
|
|
58
|
+
return [street, unit].map((part) => (part ?? "").trim()).filter((part) => part !== "").join(", ");
|
|
59
|
+
}
|
|
60
|
+
const MIN_NAMED_TOKENS = 2;
|
|
61
|
+
function streetNoType(street) {
|
|
62
|
+
const tokens = (street ?? "").trim().split(/\s+/).filter((token) => token !== "");
|
|
63
|
+
if (tokens.length === 0) return null;
|
|
64
|
+
const word = (index) => (tokens[index] ?? "").replace(/\.$/, "").toLowerCase();
|
|
65
|
+
let end = tokens.length;
|
|
66
|
+
if (end > 3 && DIRECTIONALS[word(end - 1)] !== void 0) end -= 1;
|
|
67
|
+
if (end - 1 >= MIN_NAMED_TOKENS && STREET_SUFFIXES[word(end - 1)] !== void 0) return tokens.slice(0, end - 1).join(" ");
|
|
68
|
+
return tokens.join(" ");
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
//#endregion
|
|
72
|
+
export { joinStreetUnit, streetNoType };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region ../../internal/template-artifact/dist/asset-mime.js
|
|
2
|
+
const ASSET_MIME = {
|
|
3
|
+
".svg": "image/svg+xml",
|
|
4
|
+
".png": "image/png",
|
|
5
|
+
".jpg": "image/jpeg",
|
|
6
|
+
".jpeg": "image/jpeg",
|
|
7
|
+
".gif": "image/gif",
|
|
8
|
+
".webp": "image/webp",
|
|
9
|
+
".avif": "image/avif",
|
|
10
|
+
".ico": "image/x-icon",
|
|
11
|
+
".woff": "font/woff",
|
|
12
|
+
".woff2": "font/woff2",
|
|
13
|
+
".ttf": "font/ttf",
|
|
14
|
+
".otf": "font/otf",
|
|
15
|
+
".eot": "application/vnd.ms-fontobject",
|
|
16
|
+
".mp4": "video/mp4",
|
|
17
|
+
".webm": "video/webm",
|
|
18
|
+
".mov": "video/quicktime",
|
|
19
|
+
".mp3": "audio/mpeg",
|
|
20
|
+
".wav": "audio/wav",
|
|
21
|
+
".pdf": "application/pdf",
|
|
22
|
+
".zip": "application/zip"
|
|
23
|
+
};
|
|
24
|
+
function assetContentType(filename) {
|
|
25
|
+
const ext = filename.slice(filename.lastIndexOf(".")).toLowerCase();
|
|
26
|
+
return ASSET_MIME[ext] ?? "application/octet-stream";
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
export { ASSET_MIME, assetContentType };
|
|
@@ -34,13 +34,12 @@ function playgroundPath(file) {
|
|
|
34
34
|
const SECTION_FILES = {
|
|
35
35
|
schema: "schema.json",
|
|
36
36
|
fillSpec: "fill-spec.json",
|
|
37
|
-
|
|
37
|
+
readGraph: "read-graph.json",
|
|
38
38
|
logic: "logic.mjs",
|
|
39
39
|
renderer: "renderer.mjs"
|
|
40
40
|
};
|
|
41
41
|
const TEMPLATE_FILES = {
|
|
42
42
|
composition: "composition.json",
|
|
43
|
-
usedFacts: "used-facts.json",
|
|
44
43
|
stylesheet: "template.css",
|
|
45
44
|
preview: "preview.json",
|
|
46
45
|
staticAssets: "static-assets.json"
|
|
@@ -11,7 +11,7 @@ const ArtifactSection = z.object({
|
|
|
11
11
|
content_hash: Sha256
|
|
12
12
|
}).strict();
|
|
13
13
|
const ArtifactManifest = z.object({
|
|
14
|
-
artifact_schema: z.literal(
|
|
14
|
+
artifact_schema: z.literal(3),
|
|
15
15
|
framework_version: z.string().min(1),
|
|
16
16
|
key: z.string().refine(isTemplateKey, "a template key: one path segment"),
|
|
17
17
|
display_name: z.string().min(1),
|