@homepages/concrete 8.0.0 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1005 -0
- package/README.md +20 -9
- package/codemods/list-grammar.mjs +923 -0
- package/codemods/manifest.json +64 -0
- package/codemods/process-builders.mjs +198 -0
- package/codemods/slot-object.mjs +1097 -0
- package/codemods/steps/content-object-fields.mjs +324 -0
- package/codemods/steps/list-object-form.mjs +6 -7
- package/codemods/table-rows.mjs +568 -0
- package/codemods/unwrap-object-fields.mjs +310 -0
- package/codemods/viewer-slot-document.mjs +131 -0
- package/codemods/write-property-as-facts-document.mjs +716 -0
- package/codemods/write-the-address-line.mjs +255 -0
- package/codemods/write-the-registry-members.mjs +653 -0
- package/codemods/write-the-select-from.mjs +141 -0
- package/codemods/write-the-sole-from.mjs +369 -0
- package/codemods/write-the-table-from.mjs +267 -0
- package/codemods/write-the-whole-item.mjs +512 -0
- package/codemods/writeback-drop.mjs +168 -0
- package/codemods/written-contact-address.mjs +162 -0
- package/codemods/written-media-category.mjs +227 -0
- package/codemods/written-ref-kinds-name-the-layer.mjs +172 -0
- package/codemods/written-uploads-replace-pool-reads.mjs +454 -0
- package/codemods/written-uploads-sort-into-lists.mjs +405 -0
- package/codemods/written-uploads-stated-in-sorted-lists.mjs +295 -0
- package/codemods/written-video-sources-drop.mjs +144 -0
- package/codemods/written-without-pick-none.mjs +146 -0
- package/codemods/written-without-retired-knowledge.mjs +223 -0
- package/codemods/written-without-the-media-key.mjs +202 -0
- package/codemods/written-without-the-property-type.mjs +249 -0
- package/dist/artifact/playground/client/assets/index-BOYbgBnP.js +1259 -0
- package/dist/artifact/playground/client/assets/index-DDOcM0zA.css +1 -0
- package/dist/artifact/playground/client/index.html +2 -2
- package/dist/artifact/playground/client/island-canvas-host.mjs +1 -1
- package/dist/artifact/playground/host.mjs +61 -27
- package/dist/base.css +58 -1
- package/dist/cli/build/artifact.js +6 -9
- package/dist/cli/build/captures.js +2 -12
- package/dist/cli/build/esbuild.js +1 -25
- package/dist/cli/build/fixtures.js +2 -1
- package/dist/cli/build/icons.js +1 -1
- package/dist/cli/build/static.js +2 -2
- package/dist/cli/capture/capture.js +8 -9
- package/dist/cli/check/analyze.js +8 -1
- package/dist/cli/check/load-outdir.js +47 -0
- package/dist/cli/check/load-workspace.js +4 -4
- package/dist/cli/check/render/html.js +1 -2
- package/dist/cli/check/render/inputs.js +10 -3
- package/dist/cli/check/render/island-frames.js +2 -1
- package/dist/cli/check/render/marker-coverage.js +23 -15
- package/dist/cli/check/report.js +5 -0
- package/dist/cli/check/stages/bundles.js +1 -1
- package/dist/cli/check/stages/relations.js +1 -1
- package/dist/cli/check/stages/render.js +48 -33
- package/dist/cli/check/stages/sections.js +83 -31
- package/dist/cli/check/stages/workspace.js +2 -0
- package/dist/cli/check/template-key.js +16 -0
- package/dist/cli/commands.js +1 -1
- package/dist/cli/dev/crop.js +1 -1
- package/dist/cli/dev/fixture-ladders.js +96 -0
- package/dist/cli/dev/islands.js +12 -123
- package/dist/cli/dev/listen.js +20 -1
- package/dist/cli/dev/load-template.js +1 -1
- package/dist/cli/dev/server.js +35 -10
- package/dist/cli/dev/vite.js +9 -7
- package/dist/cli/dev/workspace-reader.js +16 -16
- package/dist/cli/media/derive.js +43 -57
- package/dist/cli/media/frame-rung-floor.js +0 -1
- package/dist/cli/property/index.js +1 -6
- package/dist/css/inline.js +1 -22
- package/dist/eslint/rules/no-marker-literal.js +1 -1
- package/dist/fixtures/load.js +16 -7
- package/dist/fixtures/media-plugin.js +17 -12
- package/dist/fixtures/media-store.js +115 -0
- package/dist/fixtures/property.js +345 -126
- package/dist/fixtures/resolve.js +260 -251
- package/dist/fixtures/rows.js +4 -11
- package/dist/fixtures.d.ts +234 -109
- package/dist/index.d.ts +25 -16
- package/dist/index.js +10 -6
- package/dist/islands/marker.js +2 -1
- package/dist/packages/external/concrete/package.js +1 -1
- package/dist/packages/internal/canvas-core/dist/island-host.js +62 -0
- package/dist/packages/internal/canvas-core/dist/island-shields.js +30 -0
- package/dist/packages/internal/capture-settle/dist/index.js +3 -0
- package/dist/packages/internal/capture-settle/dist/island-markers.d.ts +13 -0
- package/dist/packages/internal/capture-settle/dist/island-markers.js +6 -0
- package/dist/packages/internal/capture-settle/dist/settle.js +150 -0
- package/dist/packages/internal/{image-ladder/dist/crop.js → crop-region/dist/index.js} +21 -20
- package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +250 -46
- package/dist/packages/internal/fill-bake/dist/compute-reads.js +361 -4
- package/dist/packages/internal/fill-bake/dist/derive-source.js +25 -18
- package/dist/packages/internal/fill-bake/dist/index.js +9 -3
- package/dist/packages/internal/fill-bake/dist/item-merge.js +113 -0
- package/dist/packages/internal/fill-bake/dist/item-overrides.js +1 -0
- package/dist/packages/internal/fill-bake/dist/linked-merge.js +38 -0
- package/dist/packages/internal/fill-bake/dist/list-grammar.js +174 -0
- package/dist/packages/internal/fill-bake/dist/stored-row-reader.js +1 -0
- package/dist/packages/internal/fill-vocabulary/dist/holder.js +51 -0
- package/dist/packages/internal/fill-vocabulary/dist/resolved-decision.js +363 -0
- package/dist/packages/internal/fill-vocabulary/dist/row-planners.js +1 -23
- package/dist/packages/internal/fill-vocabulary/dist/verbs.js +60 -0
- package/dist/packages/internal/format-geometry/dist/capture.js +11 -147
- package/dist/packages/internal/format-geometry/dist/format.d.ts +8 -2
- package/dist/packages/internal/format-geometry/dist/geometry.js +13 -2
- package/dist/packages/internal/image-ladder/dist/encode.js +27 -14
- package/dist/packages/internal/image-ladder/dist/index.js +3 -3
- package/dist/packages/internal/image-ladder/dist/policy.js +28 -53
- package/dist/packages/internal/island-runtime/dist/capture-holds.js +1 -1
- package/dist/packages/internal/island-runtime/dist/contract.d.ts +3 -12
- package/dist/packages/internal/island-runtime/dist/contract.js +2 -2
- package/dist/packages/internal/island-runtime/dist/index.d.ts +3 -7
- package/dist/packages/internal/island-runtime/dist/index.js +2 -1
- package/dist/packages/internal/island-runtime/dist/viewport-schedule.js +1 -1
- package/dist/packages/internal/media-resolution/dist/crop-key.js +7 -0
- package/dist/packages/internal/media-resolution/dist/document.js +63 -0
- package/dist/packages/internal/media-resolution/dist/image.js +226 -0
- package/dist/packages/internal/media-resolution/dist/index.js +11 -0
- package/dist/packages/internal/media-resolution/dist/list.js +112 -0
- package/dist/packages/internal/media-resolution/dist/media.js +59 -0
- package/dist/packages/internal/media-resolution/dist/records.js +7 -0
- package/dist/packages/internal/media-resolution/dist/slot.js +37 -0
- package/dist/packages/internal/media-resolution/dist/store.js +19 -0
- package/dist/packages/internal/media-resolution/dist/tour.js +59 -0
- package/dist/packages/internal/media-resolution/dist/video.js +93 -0
- package/dist/packages/internal/property-facts/dist/registry-facts.js +245 -0
- package/dist/packages/internal/section-contracts/dist/cap-contract.js +8 -17
- package/dist/packages/internal/section-contracts/dist/catalog.js +34 -14
- package/dist/packages/internal/section-contracts/dist/count-bounds-contract.js +11 -2
- package/dist/packages/internal/section-contracts/dist/directly-linked-list-contract.js +21 -0
- package/dist/packages/internal/section-contracts/dist/fill-options.js +12 -0
- package/dist/packages/internal/section-contracts/dist/fill-spec-view.js +1 -5
- package/dist/packages/internal/section-contracts/dist/fill-verb-contract.js +95 -0
- package/dist/packages/internal/section-contracts/dist/grammar-scope.js +154 -0
- package/dist/packages/internal/section-contracts/dist/index.js +7 -2
- package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +2 -36
- package/dist/packages/internal/section-contracts/dist/list-scalar-contract.js +12 -21
- package/dist/packages/internal/section-contracts/dist/list-source-contract.js +46 -0
- package/dist/packages/internal/section-contracts/dist/nested-slot-contract.js +11 -2
- package/dist/packages/internal/section-contracts/dist/object-contract.js +92 -0
- package/dist/packages/internal/section-contracts/dist/poi-curation-contract.js +9 -5
- package/dist/packages/internal/section-contracts/dist/reads-acyclic-contract.js +63 -0
- package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +6 -17
- package/dist/packages/internal/section-contracts/dist/row-rule-contract.js +80 -0
- package/dist/packages/internal/section-contracts/dist/row-source-contract.js +67 -0
- package/dist/packages/internal/section-contracts/dist/runners.js +77 -18
- package/dist/packages/internal/section-contracts/dist/select-contract.js +0 -8
- package/dist/packages/internal/section-contracts/dist/source-contract.js +89 -95
- package/dist/packages/internal/section-contracts/dist/sources-contract.js +47 -17
- package/dist/packages/internal/section-contracts/dist/table-member.js +16 -0
- package/dist/packages/internal/section-contracts/dist/writer-reads-fact-contract.js +39 -23
- package/dist/packages/internal/source-resolution/dist/index.js +113 -73
- package/dist/packages/internal/static-assets-binding/dist/section-asset-url.js +16 -0
- package/dist/packages/internal/street-address/dist/index.js +72 -0
- package/dist/packages/internal/template-artifact/dist/asset-mime.js +30 -0
- package/dist/packages/internal/template-artifact/dist/layout.js +1 -2
- package/dist/packages/internal/template-artifact/dist/manifest.js +1 -1
- package/dist/packages/internal/template-artifact/dist/verify.js +12 -29
- package/dist/packages/internal/template-contracts/dist/address-value.d.ts +52 -0
- package/dist/packages/internal/template-contracts/dist/address-value.js +90 -0
- package/dist/packages/internal/template-contracts/dist/comparable-address.js +19 -0
- package/dist/{schema → packages/internal/template-contracts/dist}/compute.d.ts +29 -6
- package/dist/{schema → packages/internal/template-contracts/dist}/compute.js +11 -13
- package/dist/packages/internal/template-contracts/dist/content-pick.js +51 -0
- package/dist/packages/internal/template-contracts/dist/decision-fills.js +81 -0
- package/dist/packages/internal/template-contracts/dist/display-overrides.js +7 -0
- package/dist/packages/internal/template-contracts/dist/document-value.d.ts +16 -5
- package/dist/packages/internal/template-contracts/dist/fact-compute.d.ts +24 -0
- package/dist/packages/internal/template-contracts/dist/fact-compute.js +30 -0
- package/dist/packages/internal/template-contracts/dist/fact-keys.d.ts +44 -0
- package/dist/packages/internal/template-contracts/dist/fact-keys.js +88 -0
- package/dist/packages/internal/template-contracts/dist/fact-registry.d.ts +290 -0
- package/dist/packages/internal/template-contracts/dist/fact-registry.js +598 -0
- package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +10 -24
- package/dist/packages/internal/template-contracts/dist/fill-builders.d.ts +157 -0
- package/dist/packages/internal/template-contracts/dist/fill-builders.js +79 -0
- package/dist/packages/internal/template-contracts/dist/fill-declaration.d.ts +14 -0
- package/dist/{schema → packages/internal/template-contracts/dist}/fill-declaration.js +6 -5
- package/dist/packages/internal/template-contracts/dist/fill-spec-schema.js +93 -0
- package/dist/packages/internal/template-contracts/dist/fill-spec.js +291 -0
- package/dist/packages/internal/template-contracts/dist/findable.js +8 -0
- package/dist/packages/internal/template-contracts/dist/floor-presets.js +13 -0
- package/dist/packages/internal/template-contracts/dist/icon-names.d.ts +5 -0
- package/dist/packages/internal/template-contracts/dist/icon-names.js +70 -0
- package/dist/packages/internal/template-contracts/dist/legacy-facts.js +167 -0
- package/dist/packages/internal/template-contracts/dist/list-editing.js +93 -0
- package/dist/packages/internal/template-contracts/dist/list.d.ts +215 -0
- package/dist/packages/internal/template-contracts/dist/list.js +258 -0
- package/dist/packages/internal/template-contracts/dist/markers.d.ts +2 -2
- package/dist/packages/internal/template-contracts/dist/media-candidates.js +38 -0
- package/dist/packages/internal/template-contracts/dist/mirror-kind.js +48 -0
- package/dist/packages/internal/template-contracts/dist/number-display.js +10 -0
- package/dist/packages/internal/template-contracts/dist/object.d.ts +89 -0
- package/dist/packages/internal/template-contracts/dist/object.js +131 -0
- package/dist/packages/internal/template-contracts/dist/poi-row.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/primitive-descriptors.d.ts +1 -0
- package/dist/packages/internal/template-contracts/dist/primitive-descriptors.js +162 -0
- package/dist/packages/internal/template-contracts/dist/process-builders.d.ts +77 -0
- package/dist/packages/internal/template-contracts/dist/process-builders.js +73 -0
- package/dist/packages/internal/template-contracts/dist/read-graph.js +240 -0
- package/dist/packages/internal/template-contracts/dist/ref-locate.js +176 -0
- package/dist/packages/internal/template-contracts/dist/registry-aliases.js +77 -0
- package/dist/packages/internal/template-contracts/dist/registry-facts.d.ts +270 -0
- package/dist/packages/internal/template-contracts/dist/registry-facts.js +202 -0
- package/dist/packages/internal/template-contracts/dist/registry-shape.d.ts +41 -0
- package/dist/packages/internal/template-contracts/dist/registry-shape.js +135 -0
- package/dist/packages/internal/template-contracts/dist/resolve-scope.js +103 -0
- package/dist/packages/internal/{image-descriptor/dist/index.d.ts → template-contracts/dist/responsive-image.d.ts} +1 -1
- package/dist/packages/internal/template-contracts/dist/row-planners.js +29 -0
- package/dist/packages/internal/template-contracts/dist/row-ref.d.ts +127 -0
- package/dist/packages/internal/template-contracts/dist/row-ref.js +101 -0
- package/dist/packages/internal/template-contracts/dist/row-sources.js +41 -5
- package/dist/packages/internal/template-contracts/dist/row.d.ts +155 -0
- package/dist/packages/internal/template-contracts/dist/row.js +84 -0
- package/dist/packages/internal/template-contracts/dist/runtime-values.d.ts +97 -0
- package/dist/packages/internal/template-contracts/dist/slot-builders.d.ts +782 -0
- package/dist/packages/internal/template-contracts/dist/slot-builders.js +233 -0
- package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +233 -405
- package/dist/packages/internal/template-contracts/dist/slot-catalog.js +331 -227
- package/dist/packages/internal/template-contracts/dist/slot-overrides.js +21 -0
- package/dist/packages/internal/template-contracts/dist/slot-ref.d.ts +155 -0
- package/dist/packages/internal/template-contracts/dist/slot-ref.js +76 -0
- package/dist/packages/internal/template-contracts/dist/slot-types.d.ts +163 -0
- package/dist/packages/internal/template-contracts/dist/slot-types.js +139 -0
- package/dist/packages/internal/template-contracts/dist/slot-value.d.ts +95 -0
- package/dist/packages/internal/template-contracts/dist/table-members.d.ts +25 -0
- package/dist/packages/internal/template-contracts/dist/table-members.js +90 -0
- package/dist/packages/internal/template-contracts/dist/tour-value.d.ts +5 -5
- package/dist/packages/internal/template-contracts/dist/value-contracts.js +15 -0
- package/dist/packages/internal/template-contracts/dist/video-value.d.ts +2 -2
- package/dist/platform/fs.js +5 -2
- package/dist/playground/canvas-island-host.d.ts +11 -0
- package/dist/playground/canvas-island-host.js +29 -0
- package/dist/playground/canvas-markers.js +14 -0
- package/dist/playground-island-runtime.d.ts +3 -2
- package/dist/playground-island-runtime.js +3 -2
- package/dist/primitives/FrameShell.js +0 -1
- package/dist/primitives/Image.d.ts +5 -4
- package/dist/primitives/Tour.d.ts +1 -1
- package/dist/primitives/Video.d.ts +2 -2
- package/dist/primitives/index.d.ts +2 -3
- package/dist/primitives/picture-sources.js +2 -2
- package/dist/primitives/probe-context.js +2 -12
- package/dist/primitives/slot-address.d.ts +44 -0
- package/dist/primitives/slot-address.js +19 -0
- package/dist/primitives/slot-bindings.d.ts +65 -26
- package/dist/primitives/slot-bindings.js +104 -46
- package/dist/primitives/slot-document.d.ts +23 -18
- package/dist/primitives/slot-document.js +39 -14
- package/dist/primitives/slot-download.d.ts +39 -0
- package/dist/primitives/slot-download.js +39 -0
- package/dist/primitives/slot-list.d.ts +3 -3
- package/dist/primitives/slot-list.js +0 -2
- package/dist/primitives/slot-media.d.ts +24 -5
- package/dist/primitives/slot-media.js +6 -9
- package/dist/primitives/slot-object.d.ts +49 -0
- package/dist/primitives/slot-object.js +20 -0
- package/dist/primitives/slot-scalar.d.ts +27 -2
- package/dist/primitives/slot-scalar.js +50 -7
- package/dist/primitives/slot.d.ts +13 -6
- package/dist/primitives/slot.js +10 -3
- package/dist/rules/registry.js +25 -30
- package/dist/schema/define-schema.d.ts +4 -8
- package/dist/schema/define-schema.js +178 -79
- package/dist/schema/extract-fill-spec.js +2 -153
- package/dist/schema/fact.d.ts +57 -15
- package/dist/schema/fact.js +42 -7
- package/dist/schema/facts-view.d.ts +14 -0
- package/dist/schema/format.d.ts +1 -0
- package/dist/schema/format.js +2 -1
- package/dist/schema/manifest.js +24 -0
- package/dist/schema/property-facts.d.ts +8 -12
- package/dist/schema/section-props.d.ts +2 -66
- package/dist/schema/section-schema.d.ts +8 -11
- package/dist/schema/section-schema.js +27 -10
- package/dist/section/declare.d.ts +18 -7
- package/dist/section/declare.js +18 -5
- package/dist/section/materialize.js +3 -8
- package/dist/section/section.d.ts +12 -8
- package/dist/section/section.js +1 -1
- package/dist/template/logic-shim.d.ts +14 -7
- package/dist/template/logic-shim.js +14 -7
- package/dist/template/materialize.js +17 -18
- package/dist/template/mirror-types.js +30 -31
- package/dist/template/section-reads.js +85 -9
- package/guide/reference/cli/INDEX.md +2 -2
- package/guide/reference/cli/build.md +1 -1
- package/guide/reference/cli/check.md +1 -1
- package/guide/reference/cli/dev.md +1 -1
- package/guide/reference/cli/property-add.md +1 -1
- package/guide/reference/cli/property-list.md +2 -2
- package/guide/reference/cli/publish.md +1 -1
- package/guide/reference/cli/upgrade.md +1 -1
- package/guide/reference/rules/INDEX.md +29 -25
- package/package.json +9 -8
- package/dist/artifact/playground/client/assets/index-CckS2ONm.css +0 -1
- package/dist/artifact/playground/client/assets/index-Dn_xT16-.js +0 -1101
- package/dist/fixtures/canonical.d.ts +0 -166
- package/dist/fixtures/media.js +0 -163
- package/dist/packages/internal/fill-vocabulary/dist/origination.js +0 -51
- package/dist/packages/internal/fill-vocabulary/dist/row-reads.js +0 -15
- package/dist/packages/internal/format-geometry/dist/index.js +0 -4
- package/dist/packages/internal/property-facts/dist/derive-facts-view.js +0 -10
- package/dist/packages/internal/property-facts/dist/index.js +0 -3
- package/dist/packages/internal/property-facts/dist/property-facts-Cy7-O4p0.js +0 -189
- package/dist/packages/internal/section-contracts/dist/group-contract.js +0 -19
- package/dist/packages/internal/section-contracts/dist/record-collection-contract.js +0 -24
- package/dist/packages/internal/template-contracts/dist/collection-editing.js +0 -22
- package/dist/packages/internal/template-contracts/dist/facts-view.js +0 -104
- package/dist/packages/internal/template-contracts/dist/select-key.js +0 -7
- package/dist/primitives/slot-group.d.ts +0 -40
- package/dist/primitives/slot-group.js +0 -36
- package/dist/schema/extract-used-facts.js +0 -34
- package/dist/schema/fill-builders.d.ts +0 -115
- package/dist/schema/fill-builders.js +0 -25
- package/dist/schema/fill-declaration.d.ts +0 -14
- package/dist/schema/fill-spec.js +0 -98
- package/dist/schema/layout.d.ts +0 -30
- package/dist/schema/layout.js +0 -14
- package/dist/schema/row-fields.js +0 -88
- package/dist/schema/row-ref.d.ts +0 -59
- package/dist/schema/row-ref.js +0 -28
- package/dist/schema/runtime-values.d.ts +0 -71
- package/dist/schema/section-nav.js +0 -14
- package/dist/schema/slot-builders.d.ts +0 -633
- package/dist/schema/slot-builders.js +0 -177
- package/dist/schema/slot-ref.d.ts +0 -79
- package/dist/schema/slot-ref.js +0 -41
- package/dist/schema/slot-types.d.ts +0 -111
- package/dist/schema/slot-types.js +0 -214
- package/dist/section/groups.js +0 -68
|
@@ -0,0 +1,782 @@
|
|
|
1
|
+
import { AddressValue } from "./address-value.js";
|
|
2
|
+
import { DocumentValue } from "./document-value.js";
|
|
3
|
+
import { LinkKind, LinkProviderId, MediaKind, SourceFieldName } from "./slot-catalog.js";
|
|
4
|
+
import { TourValue } from "./tour-value.js";
|
|
5
|
+
import { VideoValue } from "./video-value.js";
|
|
6
|
+
import { ImageValue, MediaValue, PlaybackConfig } from "./runtime-values.js";
|
|
7
|
+
import { ComputeBinding, RequiringCompute } from "./compute.js";
|
|
8
|
+
import { AddressMembers } from "./row-ref.js";
|
|
9
|
+
import { SlotValue } from "./slot-value.js";
|
|
10
|
+
import { ComputeRead, ElementRef, FactRef, RefValue, RowRef, SerializedSectionRef, SiblingSlot, SlotRef } from "./slot-ref.js";
|
|
11
|
+
import { FillBinding, FindFill, PickFill, WriteFill } from "./fill-builders.js";
|
|
12
|
+
import { FillMark } from "./fill-declaration.js";
|
|
13
|
+
import { IconName } from "./icon-names.js";
|
|
14
|
+
import { HolderProcessOf } from "./process-builders.js";
|
|
15
|
+
import { FactHome } from "./fact-registry.js";
|
|
16
|
+
import { DocumentMedia, DocumentMediaValue, ImageMedia, TourMedia, VideoMedia } from "./registry-facts.js";
|
|
17
|
+
//#region ../../internal/template-contracts/dist/slot-builders.d.ts
|
|
18
|
+
/** A registry key as a ref spells it — home first (`property.address.city`). */
|
|
19
|
+
type RegistryKeySpelling = `${FactHome}.${string}`;
|
|
20
|
+
/** What a scalar registry fact holds — an address's part included, the address itself not. */
|
|
21
|
+
type ScalarFactValue = string | number | null;
|
|
22
|
+
/**
|
|
23
|
+
* Where a slot's value comes from: the `home` ref a `fact.*` entry emits into a
|
|
24
|
+
* builder's `source` — a legacy field, or a registry fact holding a scalar — or the
|
|
25
|
+
* `derived` literal `defineSchema` rewrites a `compute()` binding to, whose `transform`
|
|
26
|
+
* is the slot's own path. A whole address is no value of these: only an `address` slot
|
|
27
|
+
* binds it ({@link AddressFactSource}).
|
|
28
|
+
*/
|
|
29
|
+
type SlotSource = {
|
|
30
|
+
kind: "home";
|
|
31
|
+
key: SourceFieldName;
|
|
32
|
+
} | FactRef<RegistryKeySpelling, ScalarFactValue> | {
|
|
33
|
+
kind: "derived";
|
|
34
|
+
transform: string;
|
|
35
|
+
};
|
|
36
|
+
/** A whole address as a source — `fact.property.address`, which an `address` slot binds. */
|
|
37
|
+
type AddressFactSource = FactRef<RegistryKeySpelling, AddressValue | null>;
|
|
38
|
+
/** A single image as a source — `fact.property.hero`, which an `image` slot binds. */
|
|
39
|
+
type ImageFactSource = FactRef<RegistryKeySpelling, DocumentMediaValue | null>;
|
|
40
|
+
type SourceMark<HasSource> = HasSource extends SlotSource | AddressFactSource | ImageFactSource | ComputeBinding<unknown> | RowRef | ElementRef ? {
|
|
41
|
+
source: HasSource;
|
|
42
|
+
} : HasSource extends MirrorSource ? {
|
|
43
|
+
source: SerializedSectionRef;
|
|
44
|
+
} : unknown;
|
|
45
|
+
/**
|
|
46
|
+
* A MIRROR's `source:` — another slot, whose value this slot IS: another section's
|
|
47
|
+
* slot ref (`Hero.slots.title`, `Video.display.variant`) or, inside one section, a
|
|
48
|
+
* sibling slot's own const. It serializes as the section ref `{ kind: "section", section,
|
|
49
|
+
* slot }` — the form a list's and a row's slot source take — and its value is the
|
|
50
|
+
* upstream's. Its edit writes the upstream, where the value is stored. A slot seeded
|
|
51
|
+
* from another but free to diverge is a `compute()` over that read instead.
|
|
52
|
+
*/
|
|
53
|
+
type MirrorSource = SlotRef | SiblingSlot;
|
|
54
|
+
/** Everything a value builder's `source:` takes. */
|
|
55
|
+
type SourceBinding = SlotSource | RowRef | ElementRef | ComputeBinding<unknown> | MirrorSource | FillBinding | readonly [FillBinding, ...FillBinding[]];
|
|
56
|
+
/** The value a mirror's upstream holds — a ref's phantom, or a sibling slot's own value type. */
|
|
57
|
+
type MirroredValue<Upstream> = Upstream extends SlotRef ? RefValue<Upstream> : SlotValue<Upstream>;
|
|
58
|
+
/**
|
|
59
|
+
* The value-type check a mirror, a row member or an element owes: the upstream's value
|
|
60
|
+
* type must be assignable to this slot kind's `CV` — what a `compute()` here must
|
|
61
|
+
* return. `MemberCV` widens it for a member (a text slot also holds a number member,
|
|
62
|
+
* "3 beds"). A table row's element is read only through a row. A projection or a join
|
|
63
|
+
* is a `compute()`, never a mirror. A mismatch demands a key no author can supply, so
|
|
64
|
+
* the compile error names both types. Any other `source` owes nothing — beside the
|
|
65
|
+
* `required` rule every source is held to ({@link RequiredOption}).
|
|
66
|
+
*/
|
|
67
|
+
type MirrorOption<HasSource, CV, MemberCV = CV> = RequiredOption<HasSource> & MirrorValueOption<HasSource, CV, MemberCV>;
|
|
68
|
+
/**
|
|
69
|
+
* Whether `required: true` may stand beside a `source:` — the type half of
|
|
70
|
+
* {@link refuseRequiredSource}. A mirror requires its upstream, never itself; a
|
|
71
|
+
* `compute()` requires exactly its `requires`, so one naming none has nothing to require.
|
|
72
|
+
* Every other source — none, a fill, a fact, a row's member, the element — admits it.
|
|
73
|
+
*/
|
|
74
|
+
type RequiredOption<HasSource> = HasSource extends RequiringCompute<unknown> ? unknown : HasSource extends ComputeBinding<unknown> | MirrorSource ? {
|
|
75
|
+
readonly required?: never;
|
|
76
|
+
} : unknown;
|
|
77
|
+
/** The value-type half of {@link MirrorOption}: what an upstream owes the holder it sources, `required` aside. */
|
|
78
|
+
type MirrorValueOption<HasSource, CV, MemberCV = CV> = HasSource extends MirrorSource ? [MirroredValue<HasSource>] extends [CV] ? unknown : {
|
|
79
|
+
"a mirrored slot's value type must be assignable to this slot's": [upstream: MirroredValue<HasSource>, slot: CV];
|
|
80
|
+
} : HasSource extends RowRef<string, infer Member, unknown> ? [Member] extends [MemberCV] ? unknown : {
|
|
81
|
+
"a row member's value type must be assignable to this slot's": [member: Member, slot: CV];
|
|
82
|
+
} : HasSource extends ElementRef<infer Value, infer Table> ? [Table] extends [string] ? {
|
|
83
|
+
"a table's row is read through a row slot — declare `row({ label, from, source: el })` and read its members": Table;
|
|
84
|
+
} : [Value] extends [CV] ? unknown : {
|
|
85
|
+
"an element's value type must be assignable to this slot's": [element: Value, slot: CV];
|
|
86
|
+
} : unknown;
|
|
87
|
+
/** The shape of a fill node's own keys, beside its verb — what a kind's admitted verb is checked against. */
|
|
88
|
+
interface FillNodeShape {
|
|
89
|
+
readonly brief: string;
|
|
90
|
+
readonly reads?: readonly ComputeRead[];
|
|
91
|
+
}
|
|
92
|
+
/** The `fill.write` a kind whose value is written takes: no `of`, the slot being its output. */
|
|
93
|
+
type WriteFillFor = WriteFill<FillNodeShape & {
|
|
94
|
+
readonly none?: true;
|
|
95
|
+
}>;
|
|
96
|
+
/** The `fill.find` a kind a platform lookup finds takes: no `of`, the lookup supplying the value. */
|
|
97
|
+
type FindFillFor = FindFill<FillNodeShape & {
|
|
98
|
+
readonly none?: true;
|
|
99
|
+
}>;
|
|
100
|
+
/**
|
|
101
|
+
* The `fill.pick` a kind holding its own candidate set takes — a select's `from`, a media
|
|
102
|
+
* slot's `from`. It names no `of`: the holder's set is what the model picks from.
|
|
103
|
+
*/
|
|
104
|
+
type HeldPickFill = PickFill<FillNodeShape & {
|
|
105
|
+
readonly of?: never;
|
|
106
|
+
readonly unique?: boolean;
|
|
107
|
+
readonly none?: never;
|
|
108
|
+
}>;
|
|
109
|
+
/**
|
|
110
|
+
* An `image` slot's crop — the ASSET's contract: what the cropper cuts, and which cut
|
|
111
|
+
* a viewport is served. It paints no box; the rendered box is your own classes.
|
|
112
|
+
* `mode` picks the cropper behavior ("locked" keeps `aspect`, w/h; "free" resizes any
|
|
113
|
+
* edge), `aspectLabel` is the cropper's pill text. `mobile` declares a distinct second
|
|
114
|
+
* cut for narrow viewports: the cropper offers a desktop/mobile toggle at its `aspect`,
|
|
115
|
+
* and `<Image>` serves that cut below `breakpoint` — a VIEWPORT width, the only thing a
|
|
116
|
+
* `<picture><source media>` can switch on. `Slot.Image` reads it off the slot; a raw
|
|
117
|
+
* `<Image>` takes the same number as `mobileBreakpoint`.
|
|
118
|
+
*/
|
|
119
|
+
interface CropConfig {
|
|
120
|
+
mode: "locked" | "free";
|
|
121
|
+
aspect?: number;
|
|
122
|
+
aspectLabel?: string;
|
|
123
|
+
mobile?: {
|
|
124
|
+
aspect: number;
|
|
125
|
+
breakpoint: number;
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
interface CommonOptions<CV = never, F = never> {
|
|
129
|
+
label?: string;
|
|
130
|
+
locked?: boolean;
|
|
131
|
+
required?: boolean;
|
|
132
|
+
source?: SlotSource | RowRef | ElementRef | ComputeBinding<CV> | MirrorSource | F | readonly [F, ...F[]];
|
|
133
|
+
placeholder?: string;
|
|
134
|
+
when?: string | readonly string[];
|
|
135
|
+
}
|
|
136
|
+
interface Head {
|
|
137
|
+
locked?: true;
|
|
138
|
+
required?: true;
|
|
139
|
+
label?: string;
|
|
140
|
+
source?: SlotSource | AddressFactSource | ImageFactSource | RowRef | ElementRef | ComputeBinding<unknown> | SerializedSectionRef;
|
|
141
|
+
placeholder?: string;
|
|
142
|
+
when?: string | readonly string[];
|
|
143
|
+
}
|
|
144
|
+
/** The serialized shape `text.short`/`.medium`/`.long` emit — a `text`-kind slot. */
|
|
145
|
+
interface TextSlotDef<Size extends "short" | "medium" | "long"> extends Head {
|
|
146
|
+
type: "text";
|
|
147
|
+
size: Size;
|
|
148
|
+
cap?: number;
|
|
149
|
+
}
|
|
150
|
+
/** The fill a `text` slot takes: it is written, at the slot's own kind. */
|
|
151
|
+
type TextFill = WriteFillFor;
|
|
152
|
+
interface TextOptions extends CommonOptions<string | null, TextFill> {
|
|
153
|
+
cap?: number;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* The text slot, sized by the member you pick: `text.short` / `.medium` / `.long`.
|
|
157
|
+
*
|
|
158
|
+
* `cap` is the slot's character budget and the ONLY declaration of it: it bounds what a
|
|
159
|
+
* user may type in the editor, and a `fill.write` producing the slot writes to it. As a
|
|
160
|
+
* written list's `item` (`item: text.short({ cap: 40 })`) the kind is the budget every
|
|
161
|
+
* written element is held to.
|
|
162
|
+
* @example
|
|
163
|
+
* ```ts
|
|
164
|
+
* import { fact, fill, text } from "@homepages/concrete";
|
|
165
|
+
*
|
|
166
|
+
* text.medium({
|
|
167
|
+
* cap: 60,
|
|
168
|
+
* label: "Headline",
|
|
169
|
+
* source: fill.write({
|
|
170
|
+
* reads: [fact.property.address, fact.description],
|
|
171
|
+
* brief: "A marketing headline in one sentence. Confident, no exclamation marks.",
|
|
172
|
+
* }),
|
|
173
|
+
* });
|
|
174
|
+
* ```
|
|
175
|
+
*/
|
|
176
|
+
declare const text: {
|
|
177
|
+
short: <const HasSource extends SourceBinding | undefined = undefined>(opts: TextOptions & {
|
|
178
|
+
source?: HasSource | undefined;
|
|
179
|
+
} & RequiredOption<HasSource> & MirrorValueOption<HasSource, string | null, string | number | null>) => TextSlotDef<"short"> & SourceMark<HasSource> & FillMark;
|
|
180
|
+
medium: <const HasSource extends SourceBinding | undefined = undefined>(opts: TextOptions & {
|
|
181
|
+
source?: HasSource | undefined;
|
|
182
|
+
} & RequiredOption<HasSource> & MirrorValueOption<HasSource, string | null, string | number | null>) => TextSlotDef<"medium"> & SourceMark<HasSource> & FillMark;
|
|
183
|
+
long: <const HasSource extends SourceBinding | undefined = undefined>(opts: TextOptions & {
|
|
184
|
+
source?: HasSource | undefined;
|
|
185
|
+
} & RequiredOption<HasSource> & MirrorValueOption<HasSource, string | null, string | number | null>) => TextSlotDef<"long"> & SourceMark<HasSource> & FillMark;
|
|
186
|
+
};
|
|
187
|
+
/** The serialized shape the `number` builder emits — a `number`-kind slot. */
|
|
188
|
+
interface NumberSlotDef extends Head {
|
|
189
|
+
type: "number";
|
|
190
|
+
thousandsSep?: boolean;
|
|
191
|
+
decimals?: boolean;
|
|
192
|
+
maxDigits?: number;
|
|
193
|
+
}
|
|
194
|
+
/** The fill a `number` slot takes: the model writes — ESTIMATES — the figure. */
|
|
195
|
+
type NumberFill = WriteFillFor;
|
|
196
|
+
interface NumberOptions extends CommonOptions<number | null, NumberFill> {
|
|
197
|
+
thousandsSep?: boolean;
|
|
198
|
+
decimals?: boolean;
|
|
199
|
+
maxDigits?: number;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* A numeric slot. `thousandsSep` groups the figure with `,` (`1,630`) and `decimals`
|
|
203
|
+
* admits a fraction (`2.5`; a whole number without it) — `Slot.Number` renders the
|
|
204
|
+
* value that way unless the author passes `format` — and `maxDigits` caps the digit
|
|
205
|
+
* count the editor accepts. A unit (`$`, `sq ft`) is the template's own markup around
|
|
206
|
+
* the value.
|
|
207
|
+
*
|
|
208
|
+
* A figure the platform holds is a fact: bind it (`source:` a fact, a row member, a
|
|
209
|
+
* slot or a `compute()`). `source: fill.write({ brief, reads })` is for a figure that is
|
|
210
|
+
* a judgement rather than a fact — an ESTIMATE the model proposes and the user
|
|
211
|
+
* confirms, such as a suggested price band. The model returns a number, rounded to a
|
|
212
|
+
* whole one unless the slot declares `decimals`; `none: true` lets it leave the slot
|
|
213
|
+
* empty.
|
|
214
|
+
* @example
|
|
215
|
+
* ```ts
|
|
216
|
+
* import { fact, fill, number } from "@homepages/concrete";
|
|
217
|
+
*
|
|
218
|
+
* number({
|
|
219
|
+
* label: "Suggested list price",
|
|
220
|
+
* thousandsSep: true,
|
|
221
|
+
* source: fill.write({
|
|
222
|
+
* reads: [fact.property.units, fact.property.comparables],
|
|
223
|
+
* brief: "The most likely sale price, in whole dollars, rounded to $5,000.",
|
|
224
|
+
* }),
|
|
225
|
+
* });
|
|
226
|
+
* ```
|
|
227
|
+
*/
|
|
228
|
+
declare function number<const HasSource extends SourceBinding | undefined = undefined>(opts: NumberOptions & {
|
|
229
|
+
source?: HasSource;
|
|
230
|
+
} & MirrorOption<HasSource, number | null>): NumberSlotDef & SourceMark<HasSource> & FillMark;
|
|
231
|
+
/**
|
|
232
|
+
* One authored select choice: a bare string (value === label), or a stored key with its
|
|
233
|
+
* display text — and, optionally, the icon and the one-line description the editor's
|
|
234
|
+
* dropdown draws beside the label.
|
|
235
|
+
* @example
|
|
236
|
+
* ```ts
|
|
237
|
+
* { value: "condo_townhome", label: "Condo / townhome", icon: "building", description: "One unit in a shared building or row" }
|
|
238
|
+
* ```
|
|
239
|
+
*/
|
|
240
|
+
type SelectOptionInput = string | SelectOptionObject;
|
|
241
|
+
/** The object form of a select choice — see {@link SelectOptionInput}. */
|
|
242
|
+
interface SelectOptionObject {
|
|
243
|
+
/** The key the content stores. Rewording `label` never changes it. */
|
|
244
|
+
value: string;
|
|
245
|
+
/** What the editor shows for the choice. */
|
|
246
|
+
label: string;
|
|
247
|
+
/** An icon from the editor's set, drawn before the label. */
|
|
248
|
+
icon?: IconName;
|
|
249
|
+
/** One line under the label, saying what choosing it means. */
|
|
250
|
+
description?: string;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* The serialized shape a select slot emits — a `select`-kind slot. `values` (the
|
|
254
|
+
* authored `from`, stored under the wire's name) and `options.source` (a fact-derived
|
|
255
|
+
* vocabulary) are mutually exclusive: which one is present depends on whether the slot
|
|
256
|
+
* was built with `select({ from })` or `select({ source: fact.… })`.
|
|
257
|
+
*/
|
|
258
|
+
interface SelectSlotDef extends Head {
|
|
259
|
+
type: "select";
|
|
260
|
+
values?: SelectOptionInput[];
|
|
261
|
+
options?: {
|
|
262
|
+
source: string;
|
|
263
|
+
};
|
|
264
|
+
creatable?: boolean;
|
|
265
|
+
}
|
|
266
|
+
/** The one source that supplies a select's vocabulary: a fact binding. */
|
|
267
|
+
type FactSource = Extract<SlotSource, {
|
|
268
|
+
kind: "home";
|
|
269
|
+
}>;
|
|
270
|
+
interface SelectFactOptions extends Omit<CommonOptions<never>, "source" | "label"> {
|
|
271
|
+
label: string;
|
|
272
|
+
creatable?: boolean;
|
|
273
|
+
from?: never;
|
|
274
|
+
}
|
|
275
|
+
interface SelectChoiceOptions extends Omit<CommonOptions<never>, "source" | "label"> {
|
|
276
|
+
label: string;
|
|
277
|
+
from: readonly SelectOptionInput[];
|
|
278
|
+
creatable?: boolean;
|
|
279
|
+
source?: ComputeBinding<string | null> | MirrorSource | RowRef | ElementRef | HeldPickFill;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* The fill a `meta.display` entry takes: the model picks ONE of the entry's own cases —
|
|
283
|
+
* its `from` — and names no `of`. An entry always resolves a case, so it never abstains.
|
|
284
|
+
*/
|
|
285
|
+
type DisplayFill = PickFill<FillNodeShape & {
|
|
286
|
+
readonly of?: never;
|
|
287
|
+
readonly unique?: never;
|
|
288
|
+
readonly none?: never;
|
|
289
|
+
}>;
|
|
290
|
+
/**
|
|
291
|
+
* One `meta.display` entry as authored under `display:` — the declared `cases` (the
|
|
292
|
+
* FIRST is the default and the failure posture), an optional `locked` opting the entry
|
|
293
|
+
* out of user switching, and its one origin as written: `source: compute(fn)` (still a
|
|
294
|
+
* live binding here; `defineSchema` strips it into the logic bundle exactly as it does a
|
|
295
|
+
* slot's) or `source: fill.pick({ brief })`, which picks one of its cases.
|
|
296
|
+
*/
|
|
297
|
+
interface DisplayEntryInput<C extends readonly string[] = readonly string[]> {
|
|
298
|
+
cases: [...C];
|
|
299
|
+
locked?: true;
|
|
300
|
+
source?: ComputeBinding<C[number]> | DisplayFill;
|
|
301
|
+
}
|
|
302
|
+
interface DisplaySelectOptions<C extends readonly [string, ...string[]]> {
|
|
303
|
+
from: C;
|
|
304
|
+
locked?: boolean;
|
|
305
|
+
source?: ComputeBinding<NoInfer<C>[number]> | DisplayFill;
|
|
306
|
+
label?: never;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* The select builder: a slot, an object's field, a list's item, or a `meta.display`
|
|
310
|
+
* entry, each declared with one options object.
|
|
311
|
+
*
|
|
312
|
+
* As a slot or field it declares exactly one set of choices:
|
|
313
|
+
* `select({ label, from: [...] })` for an authored vocabulary, or
|
|
314
|
+
* `select({ label, source: fact.… })` for one the fact supplies. An authored select
|
|
315
|
+
* inside a list's item is picked per item from its `from` (`source: fill.pick({ brief })`)
|
|
316
|
+
* or bound to the element when the list's elements are its keys
|
|
317
|
+
* (`source: key`).
|
|
318
|
+
*
|
|
319
|
+
* As a display entry — under `display:`, with no `label` —
|
|
320
|
+
* `select({ from: cases, source: compute({ reads }, fn) })` or
|
|
321
|
+
* `select({ from: cases, source: fill.pick({ brief }) })` declares a `meta.display`
|
|
322
|
+
* `visibility`/`variant`: the first case is the default and the failure posture,
|
|
323
|
+
* `locked: true` opts a variant out of user switching, and the entry takes exactly one
|
|
324
|
+
* origin.
|
|
325
|
+
* @example
|
|
326
|
+
* ```ts
|
|
327
|
+
* import { compute, fact, fill, select } from "@homepages/concrete";
|
|
328
|
+
*
|
|
329
|
+
* select({ label: "Status", from: ["for_sale", "sold"] });
|
|
330
|
+
* select({ label: "Listing status", source: fact.property.listing_intent });
|
|
331
|
+
* select({ from: ["visible", "hidden"], source: compute({ reads: [fact.property.uploads] }, (uploads) => (uploads.some((asset) => asset.kind === "tour") ? "visible" : "hidden")) });
|
|
332
|
+
* const VARIANTS = ["classic", "editorial"] as const;
|
|
333
|
+
* select({ from: VARIANTS, source: fill.pick({ brief: "Prefer editorial for story-driven narratives." }) });
|
|
334
|
+
* ```
|
|
335
|
+
*/
|
|
336
|
+
interface SelectBuilder {
|
|
337
|
+
<const C extends readonly [string, ...string[]]>(opts: DisplaySelectOptions<C>): DisplayEntryInput<C>;
|
|
338
|
+
<const HasSource extends SourceBinding | undefined = undefined>(opts: SelectChoiceOptions & {
|
|
339
|
+
source?: HasSource;
|
|
340
|
+
} & MirrorOption<HasSource, string | null>): SelectSlotDef & SourceMark<HasSource> & FillMark;
|
|
341
|
+
<const HasSource extends FactSource>(opts: SelectFactOptions & {
|
|
342
|
+
source: HasSource;
|
|
343
|
+
}): SelectSlotDef & SourceMark<HasSource>;
|
|
344
|
+
}
|
|
345
|
+
/** The select builder — see {@link SelectBuilder}. */
|
|
346
|
+
declare const select: SelectBuilder;
|
|
347
|
+
interface UrlOptions extends CommonOptions<string | null, WriteFillFor> {
|
|
348
|
+
accepts?: LinkKind | LinkProviderId;
|
|
349
|
+
}
|
|
350
|
+
/** The serialized shape the `url` builder emits — a `url`-kind slot. */
|
|
351
|
+
interface UrlSlotDef extends Head {
|
|
352
|
+
type: "url";
|
|
353
|
+
accepts?: LinkKind | LinkProviderId;
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* A URL string slot. `accepts` names a single link kind (such as `"tour"`) or
|
|
357
|
+
* link-provider id (such as `"matterport"`) the value must match. A link kind with no
|
|
358
|
+
* provider behind it admits no url at all, which the type cannot say — check time
|
|
359
|
+
* rejects those.
|
|
360
|
+
*
|
|
361
|
+
* `source` takes a fact, a row member, a slot, a `compute()` or `fill.write` — the
|
|
362
|
+
* model writes a full web address, and a value that is not one (or that `accepts`
|
|
363
|
+
* refuses) is retried and then reported as a failed fill, never stored.
|
|
364
|
+
* @example
|
|
365
|
+
* ```ts
|
|
366
|
+
* import { fill, url } from "@homepages/concrete";
|
|
367
|
+
*
|
|
368
|
+
* url({ label: "Tour URL", accepts: "tour", source: fill.write({ brief: "The tour link.", none: true }) });
|
|
369
|
+
* ```
|
|
370
|
+
*/
|
|
371
|
+
declare function url<const HasSource extends SourceBinding | undefined = undefined>(opts: UrlOptions & {
|
|
372
|
+
source?: HasSource;
|
|
373
|
+
} & MirrorOption<HasSource, string | null>): UrlSlotDef & SourceMark<HasSource> & FillMark;
|
|
374
|
+
type ValidatedStringOptions = CommonOptions<string | null, WriteFillFor>;
|
|
375
|
+
/** The serialized shape the `date` builder emits — a `date`-kind slot. */
|
|
376
|
+
interface DateSlotDef extends Head {
|
|
377
|
+
type: "date";
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* A calendar day, stored as an ISO `YYYY-MM-DD` string — or `null`, the explicit
|
|
381
|
+
* "none" (a comparable that has not sold), which is its empty state rather than a
|
|
382
|
+
* blank field. Render it with `Slot.Date`, whose `format` decides how the day reads.
|
|
383
|
+
*
|
|
384
|
+
* `source` takes a fact, a row member, a slot, a `compute()` or `fill.write` — the
|
|
385
|
+
* model writes a real day as `YYYY-MM-DD`, and a value that is not one is retried and
|
|
386
|
+
* then reported as a failed fill, never stored. `concrete check` refuses a fixture
|
|
387
|
+
* value that is not a real day.
|
|
388
|
+
* @example
|
|
389
|
+
* ```ts
|
|
390
|
+
* import { date, fill } from "@homepages/concrete";
|
|
391
|
+
*
|
|
392
|
+
* date({ label: "Sale date" });
|
|
393
|
+
* date({ label: "Open house", source: fill.write({ brief: "The first open house day." }) });
|
|
394
|
+
* ```
|
|
395
|
+
*/
|
|
396
|
+
declare function date<const HasSource extends SourceBinding | undefined = undefined>(opts: ValidatedStringOptions & {
|
|
397
|
+
source?: HasSource;
|
|
398
|
+
} & MirrorOption<HasSource, string | null>): DateSlotDef & SourceMark<HasSource> & FillMark;
|
|
399
|
+
/** The serialized shape the `email` builder emits — an `email`-kind slot. */
|
|
400
|
+
interface EmailSlotDef extends Head {
|
|
401
|
+
type: "email";
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* An email address. Render it with `Slot.Email`, which links the stored address
|
|
405
|
+
* (`mailto:`) so no section builds the link by hand.
|
|
406
|
+
*
|
|
407
|
+
* `source` takes a fact, a row member, a slot, a `compute()` or `fill.write` — the
|
|
408
|
+
* model writes an address, and a value that is not one is retried and then reported as
|
|
409
|
+
* a failed fill, never stored. `concrete check` refuses a fixture value that is not an
|
|
410
|
+
* address.
|
|
411
|
+
* @example
|
|
412
|
+
* ```ts
|
|
413
|
+
* import { email } from "@homepages/concrete";
|
|
414
|
+
*
|
|
415
|
+
* email({ label: "Agent email" });
|
|
416
|
+
* ```
|
|
417
|
+
*/
|
|
418
|
+
declare function email<const HasSource extends SourceBinding | undefined = undefined>(opts: ValidatedStringOptions & {
|
|
419
|
+
source?: HasSource;
|
|
420
|
+
} & MirrorOption<HasSource, string | null>): EmailSlotDef & SourceMark<HasSource> & FillMark;
|
|
421
|
+
/** The serialized shape the `phone` builder emits — a `phone`-kind slot. */
|
|
422
|
+
interface PhoneSlotDef extends Head {
|
|
423
|
+
type: "phone";
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* A phone number. Render it with `Slot.Phone`, which dials the stored number (`tel:`)
|
|
427
|
+
* and prints a ten-digit North American number as `(512) 555-1234` unless you pass
|
|
428
|
+
* your own `format`.
|
|
429
|
+
*
|
|
430
|
+
* `source` takes a fact, a row member, a slot, a `compute()` or `fill.write` — the
|
|
431
|
+
* model writes a number a dialer can call, and a value that is not one is retried and
|
|
432
|
+
* then reported as a failed fill, never stored. `concrete check` refuses a fixture
|
|
433
|
+
* value no dialer could call.
|
|
434
|
+
* @example
|
|
435
|
+
* ```ts
|
|
436
|
+
* import { phone } from "@homepages/concrete";
|
|
437
|
+
*
|
|
438
|
+
* phone({ label: "Office phone" });
|
|
439
|
+
* ```
|
|
440
|
+
*/
|
|
441
|
+
declare function phone<const HasSource extends SourceBinding | undefined = undefined>(opts: ValidatedStringOptions & {
|
|
442
|
+
source?: HasSource;
|
|
443
|
+
} & MirrorOption<HasSource, string | null>): PhoneSlotDef & SourceMark<HasSource> & FillMark;
|
|
444
|
+
interface AddressOptions {
|
|
445
|
+
label?: string;
|
|
446
|
+
locked?: boolean;
|
|
447
|
+
required?: boolean;
|
|
448
|
+
placeholder?: string;
|
|
449
|
+
when?: string | readonly string[];
|
|
450
|
+
source?: AddressFactSource | RowRef | ComputeBinding<AddressValue | null> | MirrorSource | ElementRef | FindFillFor;
|
|
451
|
+
}
|
|
452
|
+
/** The serialized shape the `address` builder emits — an `address`-kind slot. */
|
|
453
|
+
interface AddressSlotDef extends Head {
|
|
454
|
+
type: "address";
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* One place: its street, unit, city, state and postal code, and its coordinates, held
|
|
458
|
+
* as ONE value because the parts and the pin must agree. Render it with
|
|
459
|
+
* `Slot.Address`, which hands your markup the parts.
|
|
460
|
+
*
|
|
461
|
+
* Its `source:` is the property's address (`fact.property.address`), a row's address
|
|
462
|
+
* member (`contact.address`, which edits the row's stored address), a `compute()`
|
|
463
|
+
* returning an `AddressValue` (or `null`), another address slot, inside a list's item
|
|
464
|
+
* the element, or `fill.find({ brief, reads })` —
|
|
465
|
+
* the platform finds the address: the one the reads write (when `fact.property.uploads`
|
|
466
|
+
* is among them and its documents' notes give a street address), kept only when the address
|
|
467
|
+
* it looks up has the same street number and street and the same postal code or
|
|
468
|
+
* city, the unit the documents wrote carried onto it; else the best match of a search
|
|
469
|
+
* around the home that the brief describes. Every part and the coordinates come from
|
|
470
|
+
* the lookup, `source: "resolved"`. `none: true` admits finding nothing; without it,
|
|
471
|
+
* finding nothing is a failed fill and the slot keeps what it held. A find also fills
|
|
472
|
+
* an object's address field and a list of addresses
|
|
473
|
+
* (`list({ label: "Offices", max: 3, source: fill.find({ brief }), item: address() })`).
|
|
474
|
+
* No model writes or picks an address.
|
|
475
|
+
*
|
|
476
|
+
* The value `address()` returns also reads its parts — `street`, `unit`, `city`,
|
|
477
|
+
* `state`, `postal`, `latitude` and `longitude` — as members, exactly as a row's members
|
|
478
|
+
* are read: legal as another slot's `source:` and in any `reads`. A slot bound to a
|
|
479
|
+
* part is read-only: a part edited alone would no longer agree with the rest. An
|
|
480
|
+
* absent part reads `null`.
|
|
481
|
+
* A `compute()` reading the address itself receives the whole value; a one-line
|
|
482
|
+
* address, or any other formatting, is yours to write there or in the `Slot.Address`
|
|
483
|
+
* render.
|
|
484
|
+
* @example
|
|
485
|
+
* ```ts
|
|
486
|
+
* import { address, compute, fact, fill, text } from "@homepages/concrete";
|
|
487
|
+
*
|
|
488
|
+
* const place = address({ label: "Address", source: fact.property.address });
|
|
489
|
+
* text.short({ label: "City", source: place.city });
|
|
490
|
+
* text.short({
|
|
491
|
+
* label: "Street and city",
|
|
492
|
+
* source: compute({ reads: [fact.property.address] }, (home) => [home?.street, home?.city].filter(Boolean).join(", ")),
|
|
493
|
+
* });
|
|
494
|
+
*
|
|
495
|
+
* address({
|
|
496
|
+
* label: "Sales office",
|
|
497
|
+
* source: fill.find({ reads: [fact.property.uploads], brief: "The community sales office." }),
|
|
498
|
+
* });
|
|
499
|
+
* ```
|
|
500
|
+
*/
|
|
501
|
+
declare function address<const HasSource extends AddressOptions["source"] = undefined>(opts?: AddressOptions & {
|
|
502
|
+
source?: HasSource;
|
|
503
|
+
} & MirrorOption<HasSource, AddressValue | null>): AddressSlotDef & SourceMark<HasSource> & AddressMembers & FillMark;
|
|
504
|
+
/** The fill a single asset slot takes: one pick, out of its candidate set. */
|
|
505
|
+
type AssetFill = HeldPickFill;
|
|
506
|
+
/** A home list of media, as declared: a list whose item is a media declaration. */
|
|
507
|
+
interface MediaListDeclaration {
|
|
508
|
+
readonly type: "list";
|
|
509
|
+
readonly element: {
|
|
510
|
+
readonly type: MediaKind | "media";
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
/** A home list of media wrapped in its page — the property's `uploads`. */
|
|
514
|
+
interface MediaListPage {
|
|
515
|
+
readonly head: object;
|
|
516
|
+
readonly declaration: MediaListDeclaration;
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* The media list a media declaration picks `from`. In a section, the list's `fact.*` ref
|
|
520
|
+
* — `fact.property.property_media` for what shows the property, `fact.property.floor_plans` for its
|
|
521
|
+
* plans, `fact.property.uploads` for everything it holds. In a fact registry, a sibling
|
|
522
|
+
* media list by its const.
|
|
523
|
+
*/
|
|
524
|
+
type MediaListFrom = FactRef<RegistryKeySpelling, readonly DocumentMediaValue[]> | MediaListPage | MediaListDeclaration;
|
|
525
|
+
/**
|
|
526
|
+
* A media declaration's `from`: one media list, or an ordered list of them. `from: a`
|
|
527
|
+
* and `from: [a]` are one declaration. The candidates are the union in declared order —
|
|
528
|
+
* list order first, each list's own order within it — and one asset in two lists is one
|
|
529
|
+
* candidate, attributed to the first.
|
|
530
|
+
*/
|
|
531
|
+
type MediaFromLists = MediaListFrom | readonly [MediaListFrom, ...MediaListFrom[]];
|
|
532
|
+
/** The keys a media declaration of `Kinds` takes, beside its kind's own options. */
|
|
533
|
+
interface MediaFilterOptions<Kinds extends MediaKind> {
|
|
534
|
+
/**
|
|
535
|
+
* The media list the declaration picks from: its candidates are the list's assets of
|
|
536
|
+
* its kinds, which a picker offers and a `fill.pick` chooses among. Absent, the
|
|
537
|
+
* declaration owns its asset — a one-off the user uploads or pastes into it. An ordered
|
|
538
|
+
* list of lists picks from their union; each list must hold items of the declaration's
|
|
539
|
+
* kinds.
|
|
540
|
+
*/
|
|
541
|
+
from?: MediaFromLists;
|
|
542
|
+
/**
|
|
543
|
+
* The processes run on every asset that becomes the value — `process.cutout()`, the
|
|
544
|
+
* background removed; `process.autocrop({ brief })`, cropped to its subject (an
|
|
545
|
+
* image's). Declare it where an asset first lands; a slot picking from a list that
|
|
546
|
+
* declares it reads the result and declares nothing.
|
|
547
|
+
*/
|
|
548
|
+
process?: readonly [HolderProcessOf<Kinds>, ...HolderProcessOf<Kinds>[]];
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* The keys a media builder takes, decided by its `source`: a slot bound to a fact — a
|
|
552
|
+
* direct fact, a row's member, an item's element — holds what that fact holds and takes
|
|
553
|
+
* none; a `fill.pick` chooses from the declaration's `from`, so it must name one.
|
|
554
|
+
*/
|
|
555
|
+
type MediaFilterOption<HasSource, Kind extends MediaKind> = HasSource extends {
|
|
556
|
+
kind: "home";
|
|
557
|
+
} | RowRef | ElementRef ? {
|
|
558
|
+
from?: never;
|
|
559
|
+
process?: never;
|
|
560
|
+
} : HasSource extends {
|
|
561
|
+
readonly verb: "pick";
|
|
562
|
+
} | readonly {
|
|
563
|
+
readonly verb: string;
|
|
564
|
+
}[] ? MediaFilterOptions<Kind> & {
|
|
565
|
+
from: MediaFromLists;
|
|
566
|
+
} : MediaFilterOptions<Kind>;
|
|
567
|
+
/** The keys a media declaration emits. */
|
|
568
|
+
interface MediaFilterKeys<Kinds extends MediaKind> {
|
|
569
|
+
from?: string | MediaListPage | MediaListDeclaration | readonly (string | MediaListPage | MediaListDeclaration)[];
|
|
570
|
+
process?: HolderProcessOf<Kinds>[];
|
|
571
|
+
}
|
|
572
|
+
interface ImageOptions extends Omit<CommonOptions<ImageValue | ImageMedia | null, AssetFill>, "source"> {
|
|
573
|
+
source?: CommonOptions<ImageValue | ImageMedia | null, AssetFill>["source"] | ImageFactSource;
|
|
574
|
+
crop?: CropConfig;
|
|
575
|
+
}
|
|
576
|
+
/** The serialized shape the `image` builder emits — an `image`-kind slot. */
|
|
577
|
+
interface ImageSlotDef extends Head, MediaFilterKeys<"image"> {
|
|
578
|
+
type: "image";
|
|
579
|
+
crop?: CropConfig;
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* A single image slot — the resolved value is always one `ImageValue`, never a list,
|
|
583
|
+
* so it carries no count bounds (a list of them does). `crop` is the asset's contract —
|
|
584
|
+
* the editor's cropper and `<Image>`'s mobile-crop switch read it; the box the image
|
|
585
|
+
* renders in is the section's own classes. `source: fill.pick({ brief })` picks one
|
|
586
|
+
* image out of its `from`.
|
|
587
|
+
*
|
|
588
|
+
* `from` names the list the image is picked from — `fact.property.property_media` for the
|
|
589
|
+
* property's photos, `fact.property.floor_plans` for its plans, `fact.property.uploads`
|
|
590
|
+
* for every image it holds — which is what the picker offers and what a fill picks
|
|
591
|
+
* among. Absent, the slot owns its image: the user uploads or pastes one into it. A slot
|
|
592
|
+
* bound to a fact or a row's member states none: it holds what that fact holds —
|
|
593
|
+
* `source: fact.property.hero` binds the property's cover photo.
|
|
594
|
+
* @example
|
|
595
|
+
* ```ts
|
|
596
|
+
* import { fact, fill, image } from "@homepages/concrete";
|
|
597
|
+
*
|
|
598
|
+
* image({
|
|
599
|
+
* label: "Hero photo",
|
|
600
|
+
* crop: { mode: "locked", aspect: 16 / 9 },
|
|
601
|
+
* from: fact.property.property_media,
|
|
602
|
+
* source: fill.pick({ brief: "The strongest exterior." }),
|
|
603
|
+
* });
|
|
604
|
+
* ```
|
|
605
|
+
*/
|
|
606
|
+
declare function image<const HasSource extends SourceBinding | ImageFactSource | undefined = undefined>(opts?: ImageOptions & {
|
|
607
|
+
source?: HasSource;
|
|
608
|
+
} & MirrorOption<HasSource, ImageValue | ImageMedia | null> & MediaFilterOption<HasSource, "image">): ImageSlotDef & SourceMark<HasSource> & FillMark;
|
|
609
|
+
interface VideoOptions extends CommonOptions<VideoValue | VideoMedia | null, AssetFill> {
|
|
610
|
+
playback?: PlaybackConfig;
|
|
611
|
+
}
|
|
612
|
+
/** The serialized shape the `video` builder emits — a `video`-kind slot. */
|
|
613
|
+
interface VideoSlotDef extends Head, MediaFilterKeys<"video"> {
|
|
614
|
+
type: "video";
|
|
615
|
+
playback?: PlaybackConfig;
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* A single video slot, resolved as a `VideoValue`. Unlike `image`, there is no `crop` —
|
|
619
|
+
* a video is selected, never re-edited. It holds an uploaded video or a pasted provider
|
|
620
|
+
* link (YouTube, Vimeo) alike. `playback` configures the renderer's `<Video>` — a link
|
|
621
|
+
* honours it as far as its player allows; the box it plays in is your own classes.
|
|
622
|
+
* `source: fill.pick({ brief })` picks one of the videos of its `from`
|
|
623
|
+
* (`fact.property.property_media`).
|
|
624
|
+
* @example
|
|
625
|
+
* ```ts
|
|
626
|
+
* import { fact, video } from "@homepages/concrete";
|
|
627
|
+
*
|
|
628
|
+
* video({ label: "Property video", from: fact.property.property_media, playback: { controls: true } });
|
|
629
|
+
* ```
|
|
630
|
+
*/
|
|
631
|
+
declare function video<const HasSource extends SourceBinding | undefined = undefined>(opts?: VideoOptions & {
|
|
632
|
+
source?: HasSource;
|
|
633
|
+
} & MirrorOption<HasSource, VideoValue | VideoMedia | null> & MediaFilterOption<HasSource, "video">): VideoSlotDef & SourceMark<HasSource> & FillMark;
|
|
634
|
+
type TourOptions = CommonOptions<TourValue | TourMedia | null, AssetFill>;
|
|
635
|
+
/** The serialized shape the `tour` builder emits — a `tour`-kind slot. */
|
|
636
|
+
interface TourSlotDef extends Head, MediaFilterKeys<"tour"> {
|
|
637
|
+
type: "tour";
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* A single 3D-tour slot, resolved as a `TourValue`. Its own kind rather than a third
|
|
641
|
+
* video source: `playback` is meaningless on a walkthrough, and a fill's candidates
|
|
642
|
+
* would otherwise mix videos with tour models. It has no type-specific option at all;
|
|
643
|
+
* which providers are admitted widens in the link-provider catalog, never on a slot.
|
|
644
|
+
*
|
|
645
|
+
* Render it with `<Slot.Tour>` for the embed, `<Slot.Image>` for the tour's thumbnail,
|
|
646
|
+
* or both — two positions from one selection. `source: fill.pick({ brief })` picks one of
|
|
647
|
+
* the tours of its `from` (`fact.property.property_media`).
|
|
648
|
+
* @example
|
|
649
|
+
* ```ts
|
|
650
|
+
* import { fact, fill, tour } from "@homepages/concrete";
|
|
651
|
+
*
|
|
652
|
+
* tour({
|
|
653
|
+
* label: "3D tour",
|
|
654
|
+
* from: fact.property.property_media,
|
|
655
|
+
* source: fill.pick({ brief: "The whole-home walkthrough, not a single-room scan." }),
|
|
656
|
+
* });
|
|
657
|
+
* ```
|
|
658
|
+
*/
|
|
659
|
+
declare function tour<const HasSource extends SourceBinding | undefined = undefined>(opts?: TourOptions & {
|
|
660
|
+
source?: HasSource;
|
|
661
|
+
} & MirrorOption<HasSource, TourValue | TourMedia | null> & MediaFilterOption<HasSource, "tour">): TourSlotDef & SourceMark<HasSource> & FillMark;
|
|
662
|
+
interface PoiOptions {
|
|
663
|
+
label?: string;
|
|
664
|
+
locked?: boolean;
|
|
665
|
+
required?: boolean;
|
|
666
|
+
placeholder?: string;
|
|
667
|
+
when?: string | readonly string[];
|
|
668
|
+
source?: FindFillFor;
|
|
669
|
+
}
|
|
670
|
+
/** The serialized shape the `poi` builder emits — a `poi`-kind slot. */
|
|
671
|
+
interface PoiSlotDef extends Head {
|
|
672
|
+
type: "poi";
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* A single point of interest — one platform-built place (a `PoiRow`). The platform
|
|
676
|
+
* owns the row's content; there is nothing to configure beyond the head.
|
|
677
|
+
*
|
|
678
|
+
* Without a `source` the place is picked in the editor's place search.
|
|
679
|
+
* `source: fill.find({ brief, reads })` has the platform find exactly one: the place
|
|
680
|
+
* the reads name (when `fact.property.uploads` is among them and its documents' notes
|
|
681
|
+
* name one), else the best match of a search around the home that the brief describes.
|
|
682
|
+
* `none: true` admits finding nothing; without it, finding nothing is a failed fill
|
|
683
|
+
* and the slot keeps what it held. Usable standalone or as a list's item
|
|
684
|
+
* (`list({ label: "Restaurants", max: 3, source: fill.find({ brief }), item: poi() })`).
|
|
685
|
+
* @example
|
|
686
|
+
* ```ts
|
|
687
|
+
* import { fact, fill, poi } from "@homepages/concrete";
|
|
688
|
+
*
|
|
689
|
+
* poi({ label: "Nearest station", placeholder: "Search places…" });
|
|
690
|
+
* poi({
|
|
691
|
+
* label: "Clubhouse",
|
|
692
|
+
* source: fill.find({ reads: [fact.property.uploads], brief: "The community's HOA clubhouse." }),
|
|
693
|
+
* });
|
|
694
|
+
* ```
|
|
695
|
+
*/
|
|
696
|
+
declare function poi<const HasSource extends PoiOptions["source"] = undefined>(opts?: PoiOptions & {
|
|
697
|
+
source?: HasSource;
|
|
698
|
+
}): PoiSlotDef & SourceMark<HasSource> & FillMark;
|
|
699
|
+
interface DocumentOptions {
|
|
700
|
+
label?: string;
|
|
701
|
+
locked?: boolean;
|
|
702
|
+
required?: boolean;
|
|
703
|
+
placeholder?: string;
|
|
704
|
+
when?: string | readonly string[];
|
|
705
|
+
source?: AssetFill | ElementRef<DocumentValue | DocumentMedia, null>;
|
|
706
|
+
}
|
|
707
|
+
/** The serialized shape the `document` builder emits — a `document`-kind slot. */
|
|
708
|
+
interface DocumentSlotDef extends Head, MediaFilterKeys<"document"> {
|
|
709
|
+
type: "document";
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* A single platform-hosted document — a pdf, spreadsheet, or office file the visitor
|
|
713
|
+
* opens in the browser or downloads. The value resolves to one `DocumentValue` (served
|
|
714
|
+
* url plus filename, type, size and the first page's preview). Render a link to it with
|
|
715
|
+
* `Slot.Download`, embed a PDF in place with `Slot.Document`, or draw its first page with
|
|
716
|
+
* `Slot.Image`.
|
|
717
|
+
*
|
|
718
|
+
* Reach for `url({ accepts: "file" })` instead when the file lives somewhere else — a
|
|
719
|
+
* Drive or Dropbox link the platform neither stores nor serves.
|
|
720
|
+
*
|
|
721
|
+
* `source: fill.pick({ brief })` picks one file out of the documents of its `from` —
|
|
722
|
+
* `fact.property.uploads`, every document stored on the property. The model sees each
|
|
723
|
+
* candidate's filename, file type, and whatever text was distilled out of it (a
|
|
724
|
+
* spreadsheet or slide deck carries none, so name the file type when it matters).
|
|
725
|
+
* @example
|
|
726
|
+
* ```ts
|
|
727
|
+
* import { document, fact, fill } from "@homepages/concrete";
|
|
728
|
+
*
|
|
729
|
+
* document({
|
|
730
|
+
* label: "Offering brochure",
|
|
731
|
+
* from: fact.property.uploads,
|
|
732
|
+
* source: fill.pick({ brief: "The offering brochure: a multi-page PDF about the whole property, not a single-unit floor plan." }),
|
|
733
|
+
* });
|
|
734
|
+
* ```
|
|
735
|
+
*/
|
|
736
|
+
declare function document<const HasSource extends DocumentOptions["source"] = undefined>(opts?: DocumentOptions & {
|
|
737
|
+
source?: HasSource;
|
|
738
|
+
} & MediaFilterOption<HasSource, "document">): DocumentSlotDef & SourceMark<HasSource> & FillMark;
|
|
739
|
+
/** The asset record of one of `Kinds` — what a `compute()` hands an open-kind media slot. */
|
|
740
|
+
type AssetOfKind<Kinds extends MediaKind> = Extract<ImageMedia | VideoMedia | TourMedia | DocumentMedia, {
|
|
741
|
+
kind: Kinds;
|
|
742
|
+
}>;
|
|
743
|
+
interface MediaOptions<Kinds extends MediaKind> extends CommonOptions<MediaValue<Kinds> | AssetOfKind<Kinds> | null, AssetFill> {
|
|
744
|
+
/** The kinds the field may hold. Absent: all four — an image, a video, a tour or a document. */
|
|
745
|
+
kinds?: readonly [Kinds, ...Kinds[]];
|
|
746
|
+
}
|
|
747
|
+
/** The serialized shape the `media` builder emits — a media value whose kind is one of `Kinds`. */
|
|
748
|
+
interface MediaSlotDef<Kinds extends MediaKind = MediaKind> extends Head, MediaFilterKeys<Kinds> {
|
|
749
|
+
type: "media";
|
|
750
|
+
kinds?: Kinds[];
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* A media value whose kind is left open among `kinds` — an image, a video, a tour or a
|
|
754
|
+
* document, whichever is picked. `from` names the list it is picked from; its candidates
|
|
755
|
+
* are that list's assets of `kinds`, and `source: fill.pick({ brief })` picks one of
|
|
756
|
+
* them. Absent, the slot owns its asset: the user uploads or pastes one into it.
|
|
757
|
+
*
|
|
758
|
+
* Its value carries the asset's `kind`. There is no `Slot.Media`: narrow on `kind` and
|
|
759
|
+
* render that kind's own `Slot.Video`, `Slot.Tour` or `Slot.Document`, handing it the
|
|
760
|
+
* narrowed value; `Slot.Image` takes any of them, drawing a video's or tour's poster and
|
|
761
|
+
* a document's first page.
|
|
762
|
+
* @example
|
|
763
|
+
* ```tsx
|
|
764
|
+
* import { fact, fill, media, Slot } from "@homepages/concrete";
|
|
765
|
+
*
|
|
766
|
+
* const feature = media({
|
|
767
|
+
* label: "Photo or video",
|
|
768
|
+
* kinds: ["image", "video"],
|
|
769
|
+
* from: fact.property.property_media,
|
|
770
|
+
* source: fill.pick({ brief: "The one asset that sells the kitchen." }),
|
|
771
|
+
* });
|
|
772
|
+
*
|
|
773
|
+
* // in the renderer
|
|
774
|
+
* const { value } = slots.feature;
|
|
775
|
+
* value?.kind === "video" ? <Slot.Video slot={{ ...slots.feature, value }} /> : <Slot.Image slot={slots.feature} />;
|
|
776
|
+
* ```
|
|
777
|
+
*/
|
|
778
|
+
declare function media<const Kinds extends MediaKind = MediaKind, const HasSource extends SourceBinding | undefined = undefined>(opts?: MediaOptions<Kinds> & {
|
|
779
|
+
source?: HasSource;
|
|
780
|
+
} & MirrorOption<HasSource, MediaValue<Kinds> | AssetOfKind<Kinds> | null> & MediaFilterOption<HasSource, Kinds>): MediaSlotDef<Kinds> & SourceMark<HasSource> & FillMark;
|
|
781
|
+
//#endregion
|
|
782
|
+
export { AddressFactSource, AddressSlotDef, CropConfig, DateSlotDef, DisplayEntryInput, DisplayFill, DocumentSlotDef, EmailSlotDef, FindFillFor, HeldPickFill, ImageFactSource, ImageSlotDef, MediaFilterOption, MediaFromLists, MediaListDeclaration, MediaListFrom, MediaListPage, MediaSlotDef, MirrorOption, MirrorSource, MirrorValueOption, NumberSlotDef, PhoneSlotDef, PoiSlotDef, RequiredOption, SelectBuilder, SelectOptionInput, SelectOptionObject, SelectSlotDef, SlotSource, SourceBinding, SourceMark, TextSlotDef, TourSlotDef, UrlSlotDef, VideoSlotDef, WriteFillFor, address, date, document, email, image, media, number, phone, poi, select, text, tour, url, video };
|