@homepages/concrete 8.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 +988 -0
- package/README.md +20 -9
- package/codemods/list-grammar.mjs +923 -0
- package/codemods/manifest.json +60 -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 +251 -33
- 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 +34 -10
- 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-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 -1
- package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +15 -20
- 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 +74 -10
- package/dist/packages/internal/section-contracts/dist/select-contract.js +0 -8
- package/dist/packages/internal/section-contracts/dist/source-contract.js +103 -46
- 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 +42 -21
- package/dist/packages/internal/source-resolution/dist/index.js +113 -72
- 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 +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 +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 +49 -3
- 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 +335 -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 +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 -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 +28 -24
- 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/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/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,40 +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
|
-
"write"
|
|
7
|
-
"estimate",
|
|
8
|
-
"write-items"
|
|
9
|
-
];
|
|
10
|
-
function writes(slot, planned = []) {
|
|
9
|
+
function writes(node, slot, planned = []) {
|
|
10
|
+
if (node.verb !== void 0) return node.verb === "write";
|
|
11
11
|
if (slot === void 0) return false;
|
|
12
|
-
|
|
13
|
-
if (origination === void 0) return false;
|
|
14
|
-
return WRITES.includes(origination.kind);
|
|
12
|
+
return impliedVerbOf(slot, planned) === "write" && holderOf(slot).shape !== "objects";
|
|
15
13
|
}
|
|
16
|
-
function readsAFact(reads, rowsAreFacts) {
|
|
14
|
+
function readsAFact(reads, rowsAreFacts, memberIsFact) {
|
|
17
15
|
return (reads ?? []).some((ref) => {
|
|
18
|
-
|
|
19
|
-
|
|
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;
|
|
20
22
|
});
|
|
21
23
|
}
|
|
22
|
-
function assertWriterReadsFactContract(schema, decision, sectionKey) {
|
|
24
|
+
function assertWriterReadsFactContract(schema, decision, sectionKey, fillSpec = { decisions: [decision] }) {
|
|
23
25
|
if (decision.kind !== "text" && decision.kind !== "number" && decision.kind !== "list") return;
|
|
24
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
|
+
};
|
|
25
39
|
const writing = [];
|
|
26
40
|
let rowsAreFacts = false;
|
|
41
|
+
let fieldsReadAFact = false;
|
|
27
42
|
for (const slotId of decision.produces) {
|
|
28
|
-
const slot = schema
|
|
43
|
+
const slot = producedSlot(schema, slotId);
|
|
29
44
|
if (slot === void 0) continue;
|
|
30
|
-
|
|
31
|
-
if (
|
|
32
|
-
|
|
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
|
+
}
|
|
33
54
|
}
|
|
34
55
|
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
|
|
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.`);
|
|
38
59
|
}
|
|
39
60
|
|
|
40
61
|
//#endregion
|
|
@@ -1,36 +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
|
-
return
|
|
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
|
+
});
|
|
8
24
|
}
|
|
9
25
|
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 : [];
|
|
26
|
+
return readLegacyRows(facts, "contacts");
|
|
16
27
|
}
|
|
17
|
-
const
|
|
18
|
-
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);
|
|
19
29
|
const REFERRAL_IMAGE_FIELD_SET = new Set(REFERRAL_IMAGE_FIELDS);
|
|
20
30
|
const LOGO_VARIANT_FALLBACK = {
|
|
21
31
|
logo_dark: {
|
|
22
|
-
other:
|
|
32
|
+
other: "logo_light",
|
|
23
33
|
mask: "black"
|
|
24
34
|
},
|
|
25
35
|
logo_light: {
|
|
26
|
-
other:
|
|
36
|
+
other: "logo_dark",
|
|
27
37
|
mask: "white"
|
|
28
38
|
}
|
|
29
39
|
};
|
|
30
40
|
function resolveContactCardField(contact, field) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const raw = contact?.[key] ?? null;
|
|
41
|
+
if (!REFERRAL_FIELD_SET.has(field)) return null;
|
|
42
|
+
const raw = contact?.[field] ?? null;
|
|
34
43
|
if (REFERRAL_IMAGE_FIELD_SET.has(field)) {
|
|
35
44
|
const assetId = typeof raw === "string" && raw.trim().length > 0 ? raw.trim() : null;
|
|
36
45
|
if (assetId !== null) return { asset_id: assetId };
|
|
@@ -48,45 +57,33 @@ function resolveContactCardField(contact, field) {
|
|
|
48
57
|
if (raw === null || raw === void 0) return "";
|
|
49
58
|
return typeof raw === "string" ? raw : String(raw);
|
|
50
59
|
}
|
|
51
|
-
const
|
|
60
|
+
const PRIMARY_CONTACT_FACT_TO_CONTACT_MEMBER = {
|
|
52
61
|
primary_contact_name: "name",
|
|
53
62
|
primary_contact_title: "title",
|
|
54
63
|
primary_contact_bio: "bio",
|
|
55
64
|
primary_contact_email: "email",
|
|
56
65
|
primary_contact_phone: "phone",
|
|
57
66
|
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: "
|
|
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"
|
|
66
75
|
};
|
|
67
76
|
function primaryContactFactValue(facts, factKey) {
|
|
68
|
-
const key =
|
|
77
|
+
const key = PRIMARY_CONTACT_FACT_TO_CONTACT_MEMBER[factKey];
|
|
69
78
|
if (key === void 0) return void 0;
|
|
70
|
-
const raw =
|
|
79
|
+
const raw = contactsOf(facts)[0]?.[key] ?? null;
|
|
71
80
|
return typeof raw === "string" ? raw : null;
|
|
72
81
|
}
|
|
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
|
-
}
|
|
82
|
+
function tableRowsOf(table, facts) {
|
|
83
|
+
const key = tableKey(table);
|
|
84
|
+
return key.reading === "legacy" ? readLegacyRows(facts, key.table) : registryTableRows(key.table, facts);
|
|
88
85
|
}
|
|
89
|
-
const CONTACT_MEMBER_FACT = Object.fromEntries(Object.entries(
|
|
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]));
|
|
90
87
|
function mediaRefOf(raw) {
|
|
91
88
|
if (typeof raw !== "string") return null;
|
|
92
89
|
const assetId = raw.trim();
|
|
@@ -101,32 +98,69 @@ function mediaRefListOf(raw) {
|
|
|
101
98
|
return [ref];
|
|
102
99
|
});
|
|
103
100
|
}
|
|
104
|
-
function
|
|
105
|
-
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];
|
|
106
108
|
if (descriptor === void 0) return null;
|
|
107
|
-
if (
|
|
109
|
+
if (table === "contacts") {
|
|
108
110
|
const fact = CONTACT_MEMBER_FACT[member];
|
|
109
111
|
if (fact !== void 0) return resolveContactScalar(row, fact);
|
|
110
112
|
}
|
|
111
|
-
|
|
112
|
-
const raw = row[descriptor.path] ?? null;
|
|
113
|
+
const raw = row[member] ?? null;
|
|
113
114
|
if (descriptor.value_type === "image") return mediaRefOf(raw);
|
|
114
115
|
if (descriptor.value_type === "image_list") return mediaRefListOf(raw);
|
|
115
116
|
return raw;
|
|
116
117
|
}
|
|
117
|
-
function
|
|
118
|
-
const
|
|
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);
|
|
119
149
|
const members = rowMemberSources(fields);
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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]);
|
|
124
159
|
return out;
|
|
125
160
|
});
|
|
126
161
|
}
|
|
127
162
|
function firstUnit(facts) {
|
|
128
|
-
|
|
129
|
-
return [...facts.units].sort((a, b) => a.position - b.position)[0];
|
|
163
|
+
return tableRowsOf("units", facts)[0];
|
|
130
164
|
}
|
|
131
165
|
function resolveUnitScalar(unit, field) {
|
|
132
166
|
switch (field) {
|
|
@@ -139,35 +173,42 @@ function resolveUnitScalar(unit, field) {
|
|
|
139
173
|
}
|
|
140
174
|
}
|
|
141
175
|
function resolvePropertyScalar(facts, field) {
|
|
176
|
+
const address = readLegacyFact(facts, "address");
|
|
142
177
|
if (field === "address") {
|
|
143
|
-
if (
|
|
144
|
-
return
|
|
178
|
+
if (address && typeof address === "object") return address.display ?? null;
|
|
179
|
+
return address;
|
|
145
180
|
}
|
|
146
181
|
const part = ADDRESS_PARTS[field];
|
|
147
|
-
if (part !== void 0) return readAddressPart(
|
|
182
|
+
if (part !== void 0) return readAddressPart(address, part);
|
|
148
183
|
const virtual = primaryContactFactValue(facts, field);
|
|
149
184
|
if (virtual !== void 0) return virtual;
|
|
150
|
-
return facts
|
|
185
|
+
return readLegacyFact(facts, field);
|
|
151
186
|
}
|
|
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
|
-
}));
|
|
187
|
+
const CONTACT_FIELD_TO_CONTACT_MEMBER = Object.fromEntries(Object.entries(CONTACT_MEMBER_FACT).map(([member, fact]) => [fact, member]));
|
|
157
188
|
function resolveContactScalar(contact, field) {
|
|
158
|
-
if (
|
|
159
|
-
const key =
|
|
189
|
+
if (REFERRAL_FIELD_SET.has(field)) return resolveContactCardField(contact, field);
|
|
190
|
+
const key = CONTACT_FIELD_TO_CONTACT_MEMBER[field];
|
|
160
191
|
if (key === void 0) return null;
|
|
161
192
|
const raw = contact?.[key] ?? null;
|
|
162
193
|
if (typeof raw !== "string") return null;
|
|
163
194
|
const trimmed = raw.trim();
|
|
164
195
|
return trimmed.length > 0 ? trimmed : null;
|
|
165
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
|
+
}
|
|
166
206
|
function readFrom(field, ctx) {
|
|
207
|
+
if (isRegistryFactKey(field)) return readFactRef(ctx.facts, field);
|
|
167
208
|
const desc = SOURCE_FIELDS[field];
|
|
168
209
|
if (!desc) return null;
|
|
169
|
-
if (Object.hasOwn(
|
|
170
|
-
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);
|
|
171
212
|
if (desc.container === "unit") return resolveUnitScalar(ctx.unit ?? firstUnit(ctx.facts), field);
|
|
172
213
|
return resolvePropertyScalar(ctx.facts, field);
|
|
173
214
|
}
|
|
@@ -185,4 +226,4 @@ function readAddressPart(address, part) {
|
|
|
185
226
|
}
|
|
186
227
|
|
|
187
228
|
//#endregion
|
|
188
|
-
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),
|
|
@@ -5,8 +5,9 @@ import { ArtifactManifest, readArtifactSchema } from "./manifest.js";
|
|
|
5
5
|
|
|
6
6
|
//#region ../../internal/template-artifact/dist/verify.js
|
|
7
7
|
const decoder = new TextDecoder("utf-8", { fatal: true });
|
|
8
|
-
const
|
|
9
|
-
const
|
|
8
|
+
const RETIRED_FILE = "used-facts.json";
|
|
9
|
+
const SECTION_FILE_NAMES = /* @__PURE__ */ new Set([...Object.values(SECTION_FILES), RETIRED_FILE]);
|
|
10
|
+
const TEMPLATE_FILE_NAMES = /* @__PURE__ */ new Set([...Object.values(TEMPLATE_FILES), RETIRED_FILE]);
|
|
10
11
|
const ISLAND_CHUNK = new RegExp(`^${SECTION_ISLANDS_DIR}/[A-Za-z0-9._-]+\\.mjs$`);
|
|
11
12
|
const FLAT_FILE = /^[A-Za-z0-9._-]+$/;
|
|
12
13
|
const CLIENT_SEGMENT = /^(?!\.{1,2}$)[A-Za-z0-9._-]+$/;
|
|
@@ -31,22 +32,6 @@ function readJson(files, path, problems) {
|
|
|
31
32
|
return null;
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
|
-
function checkUsedFacts(value, path, problems) {
|
|
35
|
-
if (!Array.isArray(value) || !value.every((entry) => typeof entry === "string")) {
|
|
36
|
-
problems.push({
|
|
37
|
-
path,
|
|
38
|
-
message: "used facts must be an array of fact keys, never null"
|
|
39
|
-
});
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
for (let i = 1; i < value.length; i++) if (value[i - 1] >= value[i]) {
|
|
43
|
-
problems.push({
|
|
44
|
-
path,
|
|
45
|
-
message: `used facts must be sorted with no repeat; "${value[i]}" follows "${value[i - 1]}"`
|
|
46
|
-
});
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
35
|
function composedSections(composition) {
|
|
51
36
|
const pages = composition?.pages;
|
|
52
37
|
if (!Array.isArray(pages)) return null;
|
|
@@ -70,10 +55,10 @@ function verifyArtifact(files) {
|
|
|
70
55
|
problems
|
|
71
56
|
};
|
|
72
57
|
const schema = readArtifactSchema(raw.value);
|
|
73
|
-
if (schema !==
|
|
58
|
+
if (schema !== 3) {
|
|
74
59
|
problems.push({
|
|
75
60
|
path: MANIFEST_FILE,
|
|
76
|
-
message: schema === null ? `carries no integer artifact_schema; this reader knows ${String(
|
|
61
|
+
message: schema === null ? `carries no integer artifact_schema; this reader knows ${String(3)}` : `artifact_schema ${String(schema)} is not one this reader knows (it knows ${String(3)})`
|
|
77
62
|
});
|
|
78
63
|
return {
|
|
79
64
|
manifest: null,
|
|
@@ -171,10 +156,13 @@ function verifyArtifact(files) {
|
|
|
171
156
|
const path = sectionPath(section.key, file);
|
|
172
157
|
if (files.has(path)) readJson(files, path, problems);
|
|
173
158
|
}
|
|
174
|
-
const
|
|
175
|
-
if (files.has(
|
|
176
|
-
const
|
|
177
|
-
if (
|
|
159
|
+
const graphPath = sectionPath(section.key, SECTION_FILES.readGraph);
|
|
160
|
+
if (files.has(graphPath)) {
|
|
161
|
+
const graph = readJson(files, graphPath, problems);
|
|
162
|
+
if (graph !== null && !Array.isArray(graph.value?.slots)) problems.push({
|
|
163
|
+
path: graphPath,
|
|
164
|
+
message: "a read graph is an object carrying its `slots` array"
|
|
165
|
+
});
|
|
178
166
|
}
|
|
179
167
|
let actual;
|
|
180
168
|
try {
|
|
@@ -213,11 +201,6 @@ function verifyArtifact(files) {
|
|
|
213
201
|
}
|
|
214
202
|
}
|
|
215
203
|
}
|
|
216
|
-
const templateUsed = templatePath(TEMPLATE_FILES.usedFacts);
|
|
217
|
-
if (files.has(templateUsed)) {
|
|
218
|
-
const used = readJson(files, templateUsed, problems);
|
|
219
|
-
if (used !== null) checkUsedFacts(used.value, templateUsed, problems);
|
|
220
|
-
}
|
|
221
204
|
if (files.has(templatePath(TEMPLATE_FILES.preview))) readJson(files, templatePath(TEMPLATE_FILES.preview), problems);
|
|
222
205
|
const bindingPath = templatePath(TEMPLATE_FILES.staticAssets);
|
|
223
206
|
if (files.has(bindingPath)) {
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//#region ../../internal/template-contracts/dist/address-value.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* How an address was placed: picked from autocomplete, typed and pinned by hand, or
|
|
4
|
+
* resolved by the platform's lookup for a `fill.find` — its parts and coordinates off
|
|
5
|
+
* the lookup's record, the unit the reference wrote carried beside them.
|
|
6
|
+
*/
|
|
7
|
+
declare const ADDRESS_SOURCES: readonly ["autocomplete", "manual_pinned", "resolved"];
|
|
8
|
+
/** One of {@link ADDRESS_SOURCES}. */
|
|
9
|
+
type AddressSource = (typeof ADDRESS_SOURCES)[number];
|
|
10
|
+
/**
|
|
11
|
+
* An address slot's stored value. Every part is `null` when absent — never `""`, so a
|
|
12
|
+
* section tests a part for presence — and the coordinates are a pair: both or neither.
|
|
13
|
+
*/
|
|
14
|
+
type AddressValue = {
|
|
15
|
+
/** Street line ("123 Main St"). */
|
|
16
|
+
street: string | null;
|
|
17
|
+
/** Apartment, suite or unit designator ("Apt 4B"). */
|
|
18
|
+
unit: string | null;
|
|
19
|
+
/** City ("Springfield"). */
|
|
20
|
+
city: string | null;
|
|
21
|
+
/** State or region ("IL"). */
|
|
22
|
+
state: string | null;
|
|
23
|
+
/** Postal code ("62704"). */
|
|
24
|
+
postal: string | null;
|
|
25
|
+
/** Latitude of the pin; `null` until the address is geocoded. */
|
|
26
|
+
latitude: number | null;
|
|
27
|
+
/** Longitude of the pin; `null` until the address is geocoded. */
|
|
28
|
+
longitude: number | null;
|
|
29
|
+
/** How the address was placed. */
|
|
30
|
+
source: AddressSource | null;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* An address with the lines the platform derives from it beside its stored parts — the
|
|
34
|
+
* facts document's shape of an address. Not what an author reads: an address slot, a
|
|
35
|
+
* registry key and `Slot.Address` offer the {@link AddressValue} alone.
|
|
36
|
+
*/
|
|
37
|
+
type AddressView = AddressValue & {
|
|
38
|
+
/** The address as one line: "123 Main St, Apt 4B, Springfield, IL 62704". */
|
|
39
|
+
display: string | null;
|
|
40
|
+
/** The street line without its street type ("123 Main"), for a short label. */
|
|
41
|
+
street_no_type: string | null;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* The members an address slot offers a reader (`address.city`): every stored part but
|
|
45
|
+
* `source` — which is a slot's own key, its binding — and nothing derived. Each is
|
|
46
|
+
* read-only: a part edited alone would break the agreement the value holds.
|
|
47
|
+
*/
|
|
48
|
+
declare const ADDRESS_MEMBERS: readonly ["street", "unit", "city", "state", "postal", "latitude", "longitude"];
|
|
49
|
+
/** One of {@link ADDRESS_MEMBERS}. */
|
|
50
|
+
type AddressMember = (typeof ADDRESS_MEMBERS)[number];
|
|
51
|
+
//#endregion
|
|
52
|
+
export { ADDRESS_MEMBERS, ADDRESS_SOURCES, AddressMember, AddressSource, AddressValue, AddressView };
|