@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
|
@@ -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,40 +1,56 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { rowTableOf } from "../../template-contracts/dist/ref-locate.js";
|
|
2
|
+
import { memberSourceOf } from "../../template-contracts/dist/row-sources.js";
|
|
3
|
+
import { holderOf } from "../../fill-vocabulary/dist/holder.js";
|
|
4
|
+
import { elementIsFact, grammarSlots, producedSlot, slotInScope } from "./grammar-scope.js";
|
|
3
5
|
|
|
4
6
|
//#region ../../internal/section-contracts/dist/writer-reads-fact-contract.js
|
|
5
|
-
|
|
6
|
-
"write"
|
|
7
|
-
"estimate",
|
|
8
|
-
"write-items"
|
|
9
|
-
];
|
|
10
|
-
function writes(slot, planned = []) {
|
|
11
|
-
if (slot === void 0) return false;
|
|
12
|
-
const origination = originationFor(slot, planned);
|
|
13
|
-
if (origination === void 0) return false;
|
|
14
|
-
return WRITES.includes(origination.kind);
|
|
7
|
+
function writes(node) {
|
|
8
|
+
return node.verb === "write";
|
|
15
9
|
}
|
|
16
|
-
function readsAFact(reads, rowsAreFacts) {
|
|
10
|
+
function readsAFact(reads, rowsAreFacts, memberIsFact) {
|
|
17
11
|
return (reads ?? []).some((ref) => {
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
if (ref === null || typeof ref !== "object") return false;
|
|
13
|
+
const kind = ref.kind;
|
|
14
|
+
if (kind === "home") return true;
|
|
15
|
+
if (kind === "element") return memberIsFact(ref);
|
|
16
|
+
if (kind !== "row") return false;
|
|
17
|
+
return "slot" in ref ? memberIsFact(ref) : rowsAreFacts;
|
|
20
18
|
});
|
|
21
19
|
}
|
|
22
|
-
function assertWriterReadsFactContract(schema, decision, sectionKey) {
|
|
20
|
+
function assertWriterReadsFactContract(schema, decision, sectionKey, fillSpec = { decisions: [decision] }) {
|
|
23
21
|
if (decision.kind !== "text" && decision.kind !== "number" && decision.kind !== "list") return;
|
|
24
22
|
const fill = decision;
|
|
23
|
+
const ctx = {
|
|
24
|
+
key: sectionKey,
|
|
25
|
+
schema,
|
|
26
|
+
fillSpec
|
|
27
|
+
};
|
|
28
|
+
const scoped = grammarSlots(schema);
|
|
29
|
+
const memberIsFact = (reader) => (ref) => {
|
|
30
|
+
if (ref.kind === "element") return reader?.container !== void 0 && reader.place === "item-field" && elementIsFact(ctx, reader.container);
|
|
31
|
+
const member = memberSourceOf(ref);
|
|
32
|
+
const row = member === null || reader === void 0 ? void 0 : slotInScope(schema, reader, member.slot);
|
|
33
|
+
return row?.def.type === "row" && rowTableOf(row.def) !== null;
|
|
34
|
+
};
|
|
25
35
|
const writing = [];
|
|
26
36
|
let rowsAreFacts = false;
|
|
37
|
+
let fieldsReadAFact = false;
|
|
27
38
|
for (const slotId of decision.produces) {
|
|
28
|
-
const slot = schema
|
|
39
|
+
const slot = producedSlot(schema, slotId);
|
|
29
40
|
if (slot === void 0) continue;
|
|
30
|
-
|
|
31
|
-
if (
|
|
32
|
-
|
|
41
|
+
const holder = holderOf(slot);
|
|
42
|
+
if (holder.shape === "objects" && holder.bound !== void 0) rowsAreFacts = true;
|
|
43
|
+
if (writes(fill)) writing.push(slotId);
|
|
44
|
+
for (const [field, node] of Object.entries(fill.fields ?? {})) {
|
|
45
|
+
if (writes(node)) writing.push(`${slotId}.${field}`);
|
|
46
|
+
const reader = scoped.find((s) => s.place === "item-field" && s.path === `${slotId}.${field}`);
|
|
47
|
+
if (readsAFact(node.reads, rowsAreFacts, memberIsFact(reader))) fieldsReadAFact = true;
|
|
48
|
+
}
|
|
33
49
|
}
|
|
34
50
|
if (writing.length === 0) return;
|
|
35
|
-
const
|
|
36
|
-
if (readsAFact(fill.reads, false
|
|
37
|
-
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
|
|
51
|
+
const reader = scoped.find((s) => s.place !== "element" && decision.produces.includes(s.path));
|
|
52
|
+
if (fieldsReadAFact || readsAFact(fill.reads, false, memberIsFact(reader))) return;
|
|
53
|
+
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.`);
|
|
38
54
|
}
|
|
39
55
|
|
|
40
56
|
//#endregion
|
|
@@ -1,36 +1,44 @@
|
|
|
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 { isMediaListKey, isRegistryFactKey, readRegistryFact, registryPropertyRoot } from "../../template-contracts/dist/fact-keys.js";
|
|
5
|
+
import { rowIdentityKey, tableFields, tableRowMember } from "../../template-contracts/dist/table-members.js";
|
|
6
|
+
import { elementRowKeys, rowMemberSources } from "../../template-contracts/dist/row-sources.js";
|
|
7
|
+
import { readLegacyFact, readLegacyRows } from "../../template-contracts/dist/legacy-facts.js";
|
|
4
8
|
|
|
5
9
|
//#region ../../internal/source-resolution/dist/index.js
|
|
6
|
-
function
|
|
7
|
-
return
|
|
10
|
+
function tableKey(table) {
|
|
11
|
+
return typeof table === "string" ? {
|
|
12
|
+
table,
|
|
13
|
+
reading: "legacy"
|
|
14
|
+
} : table;
|
|
15
|
+
}
|
|
16
|
+
function registryTableRows(table, facts) {
|
|
17
|
+
const addresses = Object.entries(tableFields(table)).filter(([, declaration]) => memberValueType(declaration) === "address").map(([name]) => name);
|
|
18
|
+
return facts[table].map((item) => {
|
|
19
|
+
const row = { ...item };
|
|
20
|
+
for (const name of addresses) row[name] = normalizeAddressValue(item[name]);
|
|
21
|
+
return row;
|
|
22
|
+
});
|
|
8
23
|
}
|
|
9
24
|
function contactsOf(facts) {
|
|
10
|
-
|
|
11
|
-
return Array.isArray(raw) ? raw : [];
|
|
12
|
-
}
|
|
13
|
-
function comparablesOf(facts) {
|
|
14
|
-
const raw = facts.comparables;
|
|
15
|
-
return Array.isArray(raw) ? raw : [];
|
|
25
|
+
return readLegacyRows(facts, "contacts");
|
|
16
26
|
}
|
|
17
|
-
const
|
|
18
|
-
const REFERRAL_FIELD_TO_CONTACT_KEY = Object.fromEntries(REFERRAL_FIELDS.map((field) => [field, CONTACT_ROW[field].path]));
|
|
27
|
+
const REFERRAL_FIELD_SET = new Set(REFERRAL_FIELDS);
|
|
19
28
|
const REFERRAL_IMAGE_FIELD_SET = new Set(REFERRAL_IMAGE_FIELDS);
|
|
20
29
|
const LOGO_VARIANT_FALLBACK = {
|
|
21
30
|
logo_dark: {
|
|
22
|
-
other:
|
|
31
|
+
other: "logo_light",
|
|
23
32
|
mask: "black"
|
|
24
33
|
},
|
|
25
34
|
logo_light: {
|
|
26
|
-
other:
|
|
35
|
+
other: "logo_dark",
|
|
27
36
|
mask: "white"
|
|
28
37
|
}
|
|
29
38
|
};
|
|
30
39
|
function resolveContactCardField(contact, field) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const raw = contact?.[key] ?? null;
|
|
40
|
+
if (!REFERRAL_FIELD_SET.has(field)) return null;
|
|
41
|
+
const raw = contact?.[field] ?? null;
|
|
34
42
|
if (REFERRAL_IMAGE_FIELD_SET.has(field)) {
|
|
35
43
|
const assetId = typeof raw === "string" && raw.trim().length > 0 ? raw.trim() : null;
|
|
36
44
|
if (assetId !== null) return { asset_id: assetId };
|
|
@@ -48,45 +56,33 @@ function resolveContactCardField(contact, field) {
|
|
|
48
56
|
if (raw === null || raw === void 0) return "";
|
|
49
57
|
return typeof raw === "string" ? raw : String(raw);
|
|
50
58
|
}
|
|
51
|
-
const
|
|
59
|
+
const PRIMARY_CONTACT_FACT_TO_CONTACT_MEMBER = {
|
|
52
60
|
primary_contact_name: "name",
|
|
53
61
|
primary_contact_title: "title",
|
|
54
62
|
primary_contact_bio: "bio",
|
|
55
63
|
primary_contact_email: "email",
|
|
56
64
|
primary_contact_phone: "phone",
|
|
57
65
|
primary_contact_address: "address",
|
|
58
|
-
primary_contact_website_url: "
|
|
59
|
-
primary_contact_avatar_upload_id: "
|
|
60
|
-
primary_contact_logo_dark_upload_id: "
|
|
61
|
-
primary_contact_logo_light_upload_id: "
|
|
62
|
-
primary_contact_instagram_url: "
|
|
63
|
-
primary_contact_linkedin_url: "
|
|
64
|
-
primary_contact_x_url: "
|
|
65
|
-
primary_contact_facebook_url: "
|
|
66
|
+
primary_contact_website_url: "website",
|
|
67
|
+
primary_contact_avatar_upload_id: "headshot",
|
|
68
|
+
primary_contact_logo_dark_upload_id: "logo_dark",
|
|
69
|
+
primary_contact_logo_light_upload_id: "logo_light",
|
|
70
|
+
primary_contact_instagram_url: "instagram",
|
|
71
|
+
primary_contact_linkedin_url: "linkedin",
|
|
72
|
+
primary_contact_x_url: "x",
|
|
73
|
+
primary_contact_facebook_url: "facebook"
|
|
66
74
|
};
|
|
67
75
|
function primaryContactFactValue(facts, factKey) {
|
|
68
|
-
const key =
|
|
76
|
+
const key = PRIMARY_CONTACT_FACT_TO_CONTACT_MEMBER[factKey];
|
|
69
77
|
if (key === void 0) return void 0;
|
|
70
|
-
const raw =
|
|
78
|
+
const raw = contactsOf(facts)[0]?.[key] ?? null;
|
|
71
79
|
return typeof raw === "string" ? raw : null;
|
|
72
80
|
}
|
|
73
|
-
function
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
case "condo_townhome": return "Condo";
|
|
77
|
-
case "multi_family":
|
|
78
|
-
case "investment": return null;
|
|
79
|
-
default: return null;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
function collectionRowsOf(collection, facts) {
|
|
83
|
-
switch (collection) {
|
|
84
|
-
case "units": return [...facts.units].sort((a, b) => a.position - b.position);
|
|
85
|
-
case "contacts": return contactsOf(facts);
|
|
86
|
-
case "comparables": return comparablesOf(facts);
|
|
87
|
-
}
|
|
81
|
+
function tableRowsOf(table, facts) {
|
|
82
|
+
const key = tableKey(table);
|
|
83
|
+
return key.reading === "legacy" ? readLegacyRows(facts, key.table) : registryTableRows(key.table, facts);
|
|
88
84
|
}
|
|
89
|
-
const CONTACT_MEMBER_FACT = Object.fromEntries(Object.entries(
|
|
85
|
+
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]));
|
|
90
86
|
function mediaRefOf(raw) {
|
|
91
87
|
if (typeof raw !== "string") return null;
|
|
92
88
|
const assetId = raw.trim();
|
|
@@ -101,32 +97,69 @@ function mediaRefListOf(raw) {
|
|
|
101
97
|
return [ref];
|
|
102
98
|
});
|
|
103
99
|
}
|
|
104
|
-
function
|
|
105
|
-
const
|
|
100
|
+
function readMemberOf(table, row, member) {
|
|
101
|
+
const key = tableKey(table);
|
|
102
|
+
if (key.reading === "legacy") return readLegacyMemberOf(key.table, row, member);
|
|
103
|
+
return readRegistryMemberOf(key.table, row, member);
|
|
104
|
+
}
|
|
105
|
+
function readLegacyMemberOf(table, row, member) {
|
|
106
|
+
const descriptor = FACT_GRAPH[table].row[member];
|
|
106
107
|
if (descriptor === void 0) return null;
|
|
107
|
-
if (
|
|
108
|
+
if (table === "contacts") {
|
|
108
109
|
const fact = CONTACT_MEMBER_FACT[member];
|
|
109
110
|
if (fact !== void 0) return resolveContactScalar(row, fact);
|
|
110
111
|
}
|
|
111
|
-
|
|
112
|
-
const raw = row[descriptor.path] ?? null;
|
|
112
|
+
const raw = row[member] ?? null;
|
|
113
113
|
if (descriptor.value_type === "image") return mediaRefOf(raw);
|
|
114
114
|
if (descriptor.value_type === "image_list") return mediaRefListOf(raw);
|
|
115
115
|
return raw;
|
|
116
116
|
}
|
|
117
|
-
function
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
117
|
+
function readRegistryMemberOf(table, row, path) {
|
|
118
|
+
const lookup = tableRowMember({
|
|
119
|
+
table,
|
|
120
|
+
reading: "registry"
|
|
121
|
+
}, path);
|
|
122
|
+
if (lookup.kind === "identity") return row["id"] ?? null;
|
|
123
|
+
if (lookup.kind === "unknown") return null;
|
|
124
|
+
const dot = path.indexOf(".");
|
|
125
|
+
if (dot === -1) return row[path] ?? null;
|
|
126
|
+
const part = path.slice(dot + 1);
|
|
127
|
+
return isAddressMember(part) ? addressMember(row[path.slice(0, dot)], part) : null;
|
|
128
|
+
}
|
|
129
|
+
function tableRowIds(table, facts) {
|
|
130
|
+
const idKey = rowIdentityKey(tableKey(table));
|
|
131
|
+
return tableRowsOf(table, facts).flatMap((row) => {
|
|
132
|
+
const id = row[idKey];
|
|
133
|
+
return typeof id === "string" ? [id] : [];
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function tableRowById(table, id, facts) {
|
|
137
|
+
const idKey = rowIdentityKey(tableKey(table));
|
|
138
|
+
return tableRowsOf(table, facts).find((row) => row[idKey] === id);
|
|
139
|
+
}
|
|
140
|
+
function readRowMember(table, id, member, facts) {
|
|
141
|
+
const row = tableRowById(table, id, facts);
|
|
142
|
+
return row === void 0 ? null : readMemberOf(table, row, member);
|
|
143
|
+
}
|
|
144
|
+
function projectTableRows(table, facts, fields, rowComputes = {}, ids) {
|
|
145
|
+
const elementRows = elementRowKeys(fields);
|
|
146
|
+
return projectRows(tableKey(table), facts, rowMemberSources(fields), elementRows, rowComputes, ids);
|
|
147
|
+
}
|
|
148
|
+
function projectRows(key, facts, members, elementRows, rowComputes, ids) {
|
|
149
|
+
const rowId = rowIdentityKey(key);
|
|
150
|
+
return (ids === void 0 ? tableRowsOf(key, facts) : ids.flatMap((id) => {
|
|
151
|
+
const row = tableRowById(key, id, facts);
|
|
152
|
+
return row === void 0 ? [] : [row];
|
|
153
|
+
})).map((row) => {
|
|
154
|
+
const out = { id: row[rowId] };
|
|
155
|
+
for (const field of elementRows) out[field] = row[rowId];
|
|
156
|
+
for (const [field, member] of Object.entries(members)) out[field] = readMemberOf(key, row, member);
|
|
157
|
+
for (const [field, compute] of Object.entries(rowComputes)) out[field] = compute((member) => readMemberOf(key, row, member), row[rowId]);
|
|
124
158
|
return out;
|
|
125
159
|
});
|
|
126
160
|
}
|
|
127
161
|
function firstUnit(facts) {
|
|
128
|
-
|
|
129
|
-
return [...facts.units].sort((a, b) => a.position - b.position)[0];
|
|
162
|
+
return tableRowsOf("units", facts)[0];
|
|
130
163
|
}
|
|
131
164
|
function resolveUnitScalar(unit, field) {
|
|
132
165
|
switch (field) {
|
|
@@ -139,35 +172,42 @@ function resolveUnitScalar(unit, field) {
|
|
|
139
172
|
}
|
|
140
173
|
}
|
|
141
174
|
function resolvePropertyScalar(facts, field) {
|
|
175
|
+
const address = readLegacyFact(facts, "address");
|
|
142
176
|
if (field === "address") {
|
|
143
|
-
if (
|
|
144
|
-
return
|
|
177
|
+
if (address && typeof address === "object") return address.display ?? null;
|
|
178
|
+
return address;
|
|
145
179
|
}
|
|
146
180
|
const part = ADDRESS_PARTS[field];
|
|
147
|
-
if (part !== void 0) return readAddressPart(
|
|
181
|
+
if (part !== void 0) return readAddressPart(address, part);
|
|
148
182
|
const virtual = primaryContactFactValue(facts, field);
|
|
149
183
|
if (virtual !== void 0) return virtual;
|
|
150
|
-
return facts
|
|
184
|
+
return readLegacyFact(facts, field);
|
|
151
185
|
}
|
|
152
|
-
const
|
|
153
|
-
if (entry.role !== "bindable" || entry.container !== "contact") return [];
|
|
154
|
-
const key = /^contacts\[\]\.(\w+)$/.exec(entry.path)?.[1];
|
|
155
|
-
return key === void 0 ? [] : [[name, key]];
|
|
156
|
-
}));
|
|
186
|
+
const CONTACT_FIELD_TO_CONTACT_MEMBER = Object.fromEntries(Object.entries(CONTACT_MEMBER_FACT).map(([member, fact]) => [fact, member]));
|
|
157
187
|
function resolveContactScalar(contact, field) {
|
|
158
|
-
if (
|
|
159
|
-
const key =
|
|
188
|
+
if (REFERRAL_FIELD_SET.has(field)) return resolveContactCardField(contact, field);
|
|
189
|
+
const key = CONTACT_FIELD_TO_CONTACT_MEMBER[field];
|
|
160
190
|
if (key === void 0) return null;
|
|
161
191
|
const raw = contact?.[key] ?? null;
|
|
162
192
|
if (typeof raw !== "string") return null;
|
|
163
193
|
const trimmed = raw.trim();
|
|
164
194
|
return trimmed.length > 0 ? trimmed : null;
|
|
165
195
|
}
|
|
196
|
+
function readFactRef(facts, key) {
|
|
197
|
+
if (isRegistryFactKey(key)) return readRegistryFact(key, registryPropertyRoot(facts));
|
|
198
|
+
if (isMediaListKey(key)) return facts[key.slice(9)];
|
|
199
|
+
const table = tableKeyOf(key);
|
|
200
|
+
if (table?.reading === "registry") return registryTableRows(table.table, facts);
|
|
201
|
+
const column = tableColumnOfKey(key);
|
|
202
|
+
if (column !== null) return registryTableRows(column.table, facts).map((row) => row[column.member] ?? null);
|
|
203
|
+
return readLegacyFact(facts, key);
|
|
204
|
+
}
|
|
166
205
|
function readFrom(field, ctx) {
|
|
206
|
+
if (isRegistryFactKey(field)) return readFactRef(ctx.facts, field);
|
|
167
207
|
const desc = SOURCE_FIELDS[field];
|
|
168
208
|
if (!desc) return null;
|
|
169
|
-
if (Object.hasOwn(
|
|
170
|
-
if (desc.container === "contact") return resolveContactScalar(ctx.contact ??
|
|
209
|
+
if (Object.hasOwn(TABLES, field)) return null;
|
|
210
|
+
if (desc.container === "contact") return resolveContactScalar(ctx.contact ?? contactsOf(ctx.facts)[0], field);
|
|
171
211
|
if (desc.container === "unit") return resolveUnitScalar(ctx.unit ?? firstUnit(ctx.facts), field);
|
|
172
212
|
return resolvePropertyScalar(ctx.facts, field);
|
|
173
213
|
}
|
|
@@ -185,4 +225,4 @@ function readAddressPart(address, part) {
|
|
|
185
225
|
}
|
|
186
226
|
|
|
187
227
|
//#endregion
|
|
188
|
-
export {
|
|
228
|
+
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),
|