@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,633 +0,0 @@
|
|
|
1
|
-
import { CollectionField, LinkKind, LinkProviderId, SourceFieldName, VideoSource, WritableSourceFieldName } from "../packages/internal/template-contracts/dist/slot-catalog.js";
|
|
2
|
-
import { FillBinding, FillFor } from "./fill-builders.js";
|
|
3
|
-
import { FillMark } from "./fill-declaration.js";
|
|
4
|
-
import { ListFieldSlot, ListItemSlot } from "./slot-types.js";
|
|
5
|
-
import { RefValue, RowRef, SiblingSlot, SlotRef } from "./slot-ref.js";
|
|
6
|
-
import { ComputeBinding } from "./compute.js";
|
|
7
|
-
import { VideoValue } from "../packages/internal/template-contracts/dist/video-value.js";
|
|
8
|
-
import { TourValue } from "../packages/internal/template-contracts/dist/tour-value.js";
|
|
9
|
-
import { ImageValue, PlaybackConfig } from "./runtime-values.js";
|
|
10
|
-
import { RowOf } from "./row-ref.js";
|
|
11
|
-
import { BoundRowValue, RowValue, SlotValue } from "./section-props.js";
|
|
12
|
-
//#region src/schema/slot-builders.d.ts
|
|
13
|
-
/**
|
|
14
|
-
* Where a slot's value comes from: the `direct` literal a `fact.*` entry emits
|
|
15
|
-
* into a builder's `source`, or the `derived` literal `defineSchema` rewrites a
|
|
16
|
-
* `compute()` binding to — whose `transform` is always the slot's own key.
|
|
17
|
-
*/
|
|
18
|
-
type SlotSource = {
|
|
19
|
-
kind: "direct";
|
|
20
|
-
field: SourceFieldName;
|
|
21
|
-
} | {
|
|
22
|
-
kind: "derived";
|
|
23
|
-
transform: string;
|
|
24
|
-
};
|
|
25
|
-
type SourceMark<HasSource extends SourceBinding | undefined> = HasSource extends SlotSource | ComputeBinding<unknown> | RowRef ? {
|
|
26
|
-
source: HasSource;
|
|
27
|
-
} : HasSource extends MirrorSource ? {
|
|
28
|
-
source: ComputeBinding<unknown>;
|
|
29
|
-
} : unknown;
|
|
30
|
-
/**
|
|
31
|
-
* A MIRROR's `source:` — another slot, whose value this slot IS: another section's
|
|
32
|
-
* slot ref (`Hero.slots.title`, `Video.display.variant`) or, inside one section, a
|
|
33
|
-
* sibling slot's own const. The builder rewrites it to the identity `compute()` over
|
|
34
|
-
* that one read, so the slot settles, propagates and takes a user's whole-slot
|
|
35
|
-
* override exactly as a computed slot does. Nothing writes through to the upstream.
|
|
36
|
-
*/
|
|
37
|
-
type MirrorSource = SlotRef | SiblingSlot;
|
|
38
|
-
/** Everything a builder's `source:` takes: a fact, a row member, a `compute()`, a mirrored slot, or a `fill()`. */
|
|
39
|
-
type SourceBinding = SlotSource | RowRef | ComputeBinding<unknown> | MirrorSource | FillBinding;
|
|
40
|
-
/** The value a mirror's upstream holds — a ref's phantom, or a sibling slot's own value type. */
|
|
41
|
-
type MirroredValue<Upstream> = Upstream extends SlotRef ? RefValue<Upstream> : SlotValue<Upstream>;
|
|
42
|
-
/**
|
|
43
|
-
* The value-type check a mirror or a row member owes: the upstream's value type must
|
|
44
|
-
* be assignable to this slot kind's `CV` — what a `compute()` here must return. A
|
|
45
|
-
* projection or a join is a `compute()`, never a mirror. A mismatch demands a key no
|
|
46
|
-
* author can supply, so the compile error names both types. Any other `source` owes
|
|
47
|
-
* nothing.
|
|
48
|
-
*/
|
|
49
|
-
type MirrorOption<HasSource, CV> = HasSource extends MirrorSource ? [MirroredValue<HasSource>] extends [CV] ? unknown : {
|
|
50
|
-
"a mirrored slot's value type must be assignable to this slot's": [upstream: MirroredValue<HasSource>, slot: CV];
|
|
51
|
-
} : HasSource extends RowRef<string, infer Member> ? [Member] extends [CV] ? unknown : {
|
|
52
|
-
"a row member's value type must be assignable to this slot's": [member: Member, slot: CV];
|
|
53
|
-
} : unknown;
|
|
54
|
-
/**
|
|
55
|
-
* The `writeback` key a builder's options must carry, decided by the slot's
|
|
56
|
-
* `source`. A direct fact binding or a row member REQUIRES the boolean —
|
|
57
|
-
* `true`/`false` where the catalog entry or the member is writable, the literal
|
|
58
|
-
* `false` where it is read-only, so the answer to "do edits propagate?" is visible
|
|
59
|
-
* without opening the catalog. A `compute()` binding and an unsourced (AI-filled /
|
|
60
|
-
* authored) slot admit no `writeback` key at all: nothing can write back through a
|
|
61
|
-
* derivation, and propagation is meaningless for generated content.
|
|
62
|
-
*/
|
|
63
|
-
type WritebackOption<HasSource extends SourceBinding | undefined> = HasSource extends {
|
|
64
|
-
kind: "direct";
|
|
65
|
-
field: infer F;
|
|
66
|
-
} ? [F] extends [WritableSourceFieldName] ? {
|
|
67
|
-
writeback: boolean;
|
|
68
|
-
} : {
|
|
69
|
-
writeback: false;
|
|
70
|
-
} : HasSource extends RowRef<string, unknown, infer Writable> ? [Writable] extends [true] ? {
|
|
71
|
-
writeback: boolean;
|
|
72
|
-
} : {
|
|
73
|
-
writeback: false;
|
|
74
|
-
} : {
|
|
75
|
-
writeback?: never;
|
|
76
|
-
};
|
|
77
|
-
/**
|
|
78
|
-
* An `image` slot's crop — the ASSET's contract: what the cropper cuts, and which cut
|
|
79
|
-
* a viewport is served. It paints no box; the rendered box is your own classes.
|
|
80
|
-
* `mode` picks the cropper behavior ("locked" keeps `aspect`, w/h; "free" resizes any
|
|
81
|
-
* edge), `aspectLabel` is the cropper's pill text. `mobile` declares a distinct second
|
|
82
|
-
* cut for narrow viewports: the cropper offers a desktop/mobile toggle at its `aspect`,
|
|
83
|
-
* and `<Image>` serves that cut below `breakpoint` — a VIEWPORT width, the only thing a
|
|
84
|
-
* `<picture><source media>` can switch on. `Slot.Image` reads it off the slot; a raw
|
|
85
|
-
* `<Image>` takes the same number as `mobileBreakpoint`.
|
|
86
|
-
*/
|
|
87
|
-
interface CropConfig {
|
|
88
|
-
mode: "locked" | "free";
|
|
89
|
-
aspect?: number;
|
|
90
|
-
aspectLabel?: string;
|
|
91
|
-
mobile?: {
|
|
92
|
-
aspect: number;
|
|
93
|
-
breakpoint: number;
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
interface CommonOptions<CV = never, F = never> {
|
|
97
|
-
label: string;
|
|
98
|
-
locked?: boolean;
|
|
99
|
-
source?: SlotSource | RowRef | ComputeBinding<CV> | MirrorSource | F;
|
|
100
|
-
writeback?: boolean;
|
|
101
|
-
placeholder?: string;
|
|
102
|
-
when?: string | readonly string[];
|
|
103
|
-
}
|
|
104
|
-
interface Head {
|
|
105
|
-
locked?: true;
|
|
106
|
-
label: string;
|
|
107
|
-
source?: SlotSource | RowRef | ComputeBinding<unknown>;
|
|
108
|
-
writeback?: boolean;
|
|
109
|
-
placeholder?: string;
|
|
110
|
-
when?: string | readonly string[];
|
|
111
|
-
}
|
|
112
|
-
/** The fill a `text` slot takes: it is written, so a lower `cap` and `none` both bind. */
|
|
113
|
-
type TextFill = FillFor<"cap" | "none">;
|
|
114
|
-
interface TextOptions extends CommonOptions<string | null, TextFill> {
|
|
115
|
-
cap?: number;
|
|
116
|
-
}
|
|
117
|
-
/** The serialized shape `text.short`/`.medium`/`.long` emit — a `text`-kind `SlotDef`. */
|
|
118
|
-
interface TextSlotDef<Size extends "short" | "medium" | "long"> extends Head {
|
|
119
|
-
type: "text";
|
|
120
|
-
size: Size;
|
|
121
|
-
cap?: number;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* The text slot, sized by the member you pick: `text.short` / `.medium` / `.long`.
|
|
125
|
-
*
|
|
126
|
-
* `cap` is the slot's character budget and the ONLY declaration of it: it bounds
|
|
127
|
-
* what a user may type in the editor, and a `fill()` producing the slot inherits it
|
|
128
|
-
* as the budget the model writes to. A filled slot must declare one; the fill's own
|
|
129
|
-
* `cap` only ever asks for something strictly shorter.
|
|
130
|
-
* @example
|
|
131
|
-
* ```ts
|
|
132
|
-
* import { fact, fill, text } from "@homepages/concrete";
|
|
133
|
-
*
|
|
134
|
-
* text.medium({
|
|
135
|
-
* cap: 60,
|
|
136
|
-
* label: "Headline",
|
|
137
|
-
* source: fill({
|
|
138
|
-
* reads: [fact.property.address, fact.description],
|
|
139
|
-
* brief: "A marketing headline in one sentence. Confident, no exclamation marks.",
|
|
140
|
-
* }),
|
|
141
|
-
* });
|
|
142
|
-
* ```
|
|
143
|
-
*/
|
|
144
|
-
declare const text: {
|
|
145
|
-
short: <const HasSource extends SourceBinding | undefined = undefined>(opts: TextOptions & {
|
|
146
|
-
source?: HasSource | undefined;
|
|
147
|
-
} & WritebackOption<HasSource> & MirrorOption<HasSource, string | null>) => TextSlotDef<"short"> & SourceMark<HasSource> & FillMark;
|
|
148
|
-
medium: <const HasSource extends SourceBinding | undefined = undefined>(opts: TextOptions & {
|
|
149
|
-
source?: HasSource | undefined;
|
|
150
|
-
} & WritebackOption<HasSource> & MirrorOption<HasSource, string | null>) => TextSlotDef<"medium"> & SourceMark<HasSource> & FillMark;
|
|
151
|
-
long: <const HasSource extends SourceBinding | undefined = undefined>(opts: TextOptions & {
|
|
152
|
-
source?: HasSource | undefined;
|
|
153
|
-
} & WritebackOption<HasSource> & MirrorOption<HasSource, string | null>) => TextSlotDef<"long"> & SourceMark<HasSource> & FillMark;
|
|
154
|
-
};
|
|
155
|
-
/**
|
|
156
|
-
* The fill a `number` slot takes: the model ESTIMATES the figure, so only `none`
|
|
157
|
-
* binds — there is no character budget to lower and no count of one value.
|
|
158
|
-
*/
|
|
159
|
-
type NumberFill = FillFor<"none">;
|
|
160
|
-
interface NumberOptions extends CommonOptions<number | null, NumberFill> {
|
|
161
|
-
prefix?: string;
|
|
162
|
-
suffix?: string;
|
|
163
|
-
thousandsSep?: boolean;
|
|
164
|
-
decimals?: boolean;
|
|
165
|
-
maxDigits?: number;
|
|
166
|
-
}
|
|
167
|
-
/** The serialized shape the `number` builder emits — a `number`-kind `SlotDef`. */
|
|
168
|
-
interface NumberSlotDef extends Head {
|
|
169
|
-
type: "number";
|
|
170
|
-
prefix?: string;
|
|
171
|
-
suffix?: string;
|
|
172
|
-
thousandsSep?: boolean;
|
|
173
|
-
decimals?: boolean;
|
|
174
|
-
maxDigits?: number;
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* A numeric slot. `prefix`/`suffix` are rendered strings (such as `"$"` /
|
|
178
|
-
* `" sq ft"`), `thousandsSep` toggles grouping-separator formatting, `decimals`
|
|
179
|
-
* toggles decimal display, and `maxDigits` caps the digit count — all read by
|
|
180
|
-
* the renderer's number formatting, not enforced as an input range.
|
|
181
|
-
*
|
|
182
|
-
* A figure the platform holds is a fact: bind it (`source:` a fact, a slot or a
|
|
183
|
-
* `compute()`). `source: fill({ brief, reads })` is for a figure that is a
|
|
184
|
-
* judgement rather than a fact — an ESTIMATE the model proposes and the user
|
|
185
|
-
* confirms, such as a suggested price band. The model returns a number, rounded to
|
|
186
|
-
* a whole one unless the slot declares `decimals`; `none: true` lets it leave the
|
|
187
|
-
* slot empty. A fill takes no `cap` and no `count`, and a record row's number field
|
|
188
|
-
* takes no fill at all.
|
|
189
|
-
* @example
|
|
190
|
-
* ```ts
|
|
191
|
-
* import { fact, fill, number } from "@homepages/concrete";
|
|
192
|
-
*
|
|
193
|
-
* number({ source: fact.unit.sqft, writeback: true, label: "Square feet", thousandsSep: true, suffix: "sqft", maxDigits: 7 });
|
|
194
|
-
*
|
|
195
|
-
* number({
|
|
196
|
-
* label: "Suggested list price",
|
|
197
|
-
* prefix: "$",
|
|
198
|
-
* thousandsSep: true,
|
|
199
|
-
* source: fill({
|
|
200
|
-
* reads: [fact.property.units, fact.property.comparables],
|
|
201
|
-
* brief: "The most likely sale price, in whole dollars, rounded to $5,000.",
|
|
202
|
-
* }),
|
|
203
|
-
* });
|
|
204
|
-
* ```
|
|
205
|
-
*/
|
|
206
|
-
declare function number<const HasSource extends SourceBinding | undefined = undefined>(opts: NumberOptions & {
|
|
207
|
-
source?: HasSource;
|
|
208
|
-
} & WritebackOption<HasSource> & MirrorOption<HasSource, number | null>): NumberSlotDef & SourceMark<HasSource> & FillMark;
|
|
209
|
-
/** One authored select choice: a bare string (value === label) or a stored key with display text. */
|
|
210
|
-
type SelectOptionInput = string | {
|
|
211
|
-
value: string;
|
|
212
|
-
label: string;
|
|
213
|
-
};
|
|
214
|
-
/**
|
|
215
|
-
* The serialized shape a select slot emits — a `select`-kind `SlotDef`.
|
|
216
|
-
* `values` (the authored `options`, stored under their old name) and
|
|
217
|
-
* `options.source` (a fact-derived vocabulary) are mutually exclusive: which one is
|
|
218
|
-
* present depends on whether the slot was built with `select({ options })` or
|
|
219
|
-
* `select({ source: fact.… })`. `unique` rides only on a record row's field; a
|
|
220
|
-
* list's single item hands it to the list (`list({ item })`), which stores it there.
|
|
221
|
-
*/
|
|
222
|
-
interface SelectSlotDef extends Head {
|
|
223
|
-
type: "select";
|
|
224
|
-
values?: SelectOptionInput[];
|
|
225
|
-
options?: {
|
|
226
|
-
source: string;
|
|
227
|
-
};
|
|
228
|
-
creatable?: boolean;
|
|
229
|
-
unique?: true;
|
|
230
|
-
}
|
|
231
|
-
/** The one source that supplies a select's vocabulary: a direct fact binding. */
|
|
232
|
-
type FactSource = Extract<SlotSource, {
|
|
233
|
-
kind: "direct";
|
|
234
|
-
}>;
|
|
235
|
-
interface SelectFactOptions extends Omit<CommonOptions<never>, "source"> {
|
|
236
|
-
creatable?: boolean;
|
|
237
|
-
options?: never;
|
|
238
|
-
unique?: never;
|
|
239
|
-
}
|
|
240
|
-
type SelectFill = FillFor<"none">;
|
|
241
|
-
interface SelectChoiceOptions extends Omit<CommonOptions<never>, "source"> {
|
|
242
|
-
options: readonly SelectOptionInput[];
|
|
243
|
-
creatable?: boolean;
|
|
244
|
-
unique?: true;
|
|
245
|
-
source?: ComputeBinding<string | null> | MirrorSource | RowRef | SelectFill;
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* The fill a `meta.display` entry takes: the model picks ONE of the entry's own
|
|
249
|
-
* cases. The brief and `reads` alone — an entry always resolves a case, so it
|
|
250
|
-
* never abstains, and a pick of one has no count or cap.
|
|
251
|
-
*/
|
|
252
|
-
type DisplayFill = FillFor<never>;
|
|
253
|
-
/**
|
|
254
|
-
* One `meta.display` entry as authored under `defineSchema`'s `display:` —
|
|
255
|
-
* the declared `cases` (the FIRST is the default and the failure posture), an
|
|
256
|
-
* optional `locked` opting the entry out of user switching, and its one origin as
|
|
257
|
-
* written: `source: compute(fn)` (still a live binding here; `defineSchema` strips
|
|
258
|
-
* it into the logic bundle exactly as it does a slot's) or `source: fill({ brief })`.
|
|
259
|
-
*/
|
|
260
|
-
interface DisplayEntryInput<C extends readonly string[] = readonly string[]> {
|
|
261
|
-
cases: [...C];
|
|
262
|
-
locked?: true;
|
|
263
|
-
source?: ComputeBinding<C[number]> | DisplayFill;
|
|
264
|
-
}
|
|
265
|
-
interface DisplaySelectOptions<C extends readonly [string, ...string[]]> {
|
|
266
|
-
options: C;
|
|
267
|
-
locked?: boolean;
|
|
268
|
-
source?: ComputeBinding<NoInfer<C>[number]> | DisplayFill;
|
|
269
|
-
label?: never;
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* The select builder: a slot, a record row's field, a list's item, or a
|
|
273
|
-
* `meta.display` entry, each declared with one options object.
|
|
274
|
-
*
|
|
275
|
-
* As a slot or field it declares exactly one set of choices:
|
|
276
|
-
* `select({ label, options: [...] })` for an authored vocabulary, or
|
|
277
|
-
* `select({ label, source: fact.… })` for one the fact supplies. A top-level select
|
|
278
|
-
* is bound (or computed) and is never filled. As a record row's field, an authored
|
|
279
|
-
* select declares its own origin like every row field: a member of the row, or its
|
|
280
|
-
* own `source: fill({ brief })`, which picks this one field's key per row in the
|
|
281
|
-
* list's batched call. Inside a list, `unique: true` says a picked value does not
|
|
282
|
-
* repeat across the rows.
|
|
283
|
-
*
|
|
284
|
-
* As a display entry — under `display:`, with no `label` —
|
|
285
|
-
* `select({ options: cases, source: compute({ reads }, fn) })` or
|
|
286
|
-
* `select({ options: cases, source: fill({ brief }) })` declares a `meta.display`
|
|
287
|
-
* `visibility`/`variant`: the first case is the default and the failure posture,
|
|
288
|
-
* `locked: true` opts a variant out of user switching, and the entry takes exactly
|
|
289
|
-
* one origin.
|
|
290
|
-
* @example
|
|
291
|
-
* ```ts
|
|
292
|
-
* import { compute, fact, fill, select } from "@homepages/concrete";
|
|
293
|
-
*
|
|
294
|
-
* select({ label: "Status", options: ["for_sale", "sold"] });
|
|
295
|
-
* select({ label: "Listing status", source: fact.property.listing_intent, writeback: true });
|
|
296
|
-
* select({ label: "Comparable status", options: ["regular", "highlight"], source: fill({ brief: "Highlight the two or three strongest sales." }) });
|
|
297
|
-
* select({ options: ["visible", "hidden"], source: compute({ reads: [fact.tours] }, (tours) => (tours.length > 0 ? "visible" : "hidden")) });
|
|
298
|
-
* select({ options: ["classic", "editorial"], source: fill({ brief: "Prefer editorial for story-driven narratives." }) });
|
|
299
|
-
* ```
|
|
300
|
-
*/
|
|
301
|
-
interface SelectBuilder {
|
|
302
|
-
<const C extends readonly [string, ...string[]]>(opts: DisplaySelectOptions<C>): DisplayEntryInput<C>;
|
|
303
|
-
<const HasSource extends SourceBinding | undefined = undefined>(opts: SelectChoiceOptions & {
|
|
304
|
-
source?: HasSource;
|
|
305
|
-
} & WritebackOption<HasSource> & MirrorOption<HasSource, string | null>): SelectSlotDef & SourceMark<HasSource> & FillMark;
|
|
306
|
-
<const HasSource extends FactSource>(opts: SelectFactOptions & {
|
|
307
|
-
source: HasSource;
|
|
308
|
-
} & WritebackOption<HasSource>): SelectSlotDef & SourceMark<HasSource>;
|
|
309
|
-
}
|
|
310
|
-
/** The select builder — see {@link SelectBuilder}. */
|
|
311
|
-
declare const select: SelectBuilder;
|
|
312
|
-
interface UrlOptions extends CommonOptions<string | null> {
|
|
313
|
-
accepts?: LinkKind | LinkProviderId;
|
|
314
|
-
}
|
|
315
|
-
/** The serialized shape the `url` builder emits — a `url`-kind `SlotDef`. */
|
|
316
|
-
interface UrlSlotDef extends Head {
|
|
317
|
-
type: "url";
|
|
318
|
-
accepts?: LinkKind | LinkProviderId;
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* A URL string slot. `accepts` names a single link kind (such as `"tour"`) or
|
|
322
|
-
* link-provider id (such as `"matterport"`) the value must match. A link kind
|
|
323
|
-
* with no provider behind it admits no url at all, which the type cannot say —
|
|
324
|
-
* check time rejects those.
|
|
325
|
-
*
|
|
326
|
-
* Binding-only: no fill produces a url, so `source` takes a fact, a slot or a
|
|
327
|
-
* `compute()`, never a `fill()`.
|
|
328
|
-
* @example
|
|
329
|
-
* ```ts
|
|
330
|
-
* import { url } from "@homepages/concrete";
|
|
331
|
-
*
|
|
332
|
-
* url({ label: "Tour URL", accepts: "tour" });
|
|
333
|
-
* ```
|
|
334
|
-
*/
|
|
335
|
-
declare function url<const HasSource extends SourceBinding | undefined = undefined>(opts: UrlOptions & {
|
|
336
|
-
source?: HasSource;
|
|
337
|
-
} & WritebackOption<HasSource> & MirrorOption<HasSource, string | null>): UrlSlotDef & SourceMark<HasSource>;
|
|
338
|
-
/** The fill a single-asset slot takes: one pick out of that type's pool, which may abstain. */
|
|
339
|
-
type AssetFill = FillFor<"none">;
|
|
340
|
-
interface AssetRowOptions {
|
|
341
|
-
unique?: true;
|
|
342
|
-
}
|
|
343
|
-
interface ImageOptions extends CommonOptions<ImageValue | null, AssetFill>, AssetRowOptions {
|
|
344
|
-
crop?: CropConfig;
|
|
345
|
-
}
|
|
346
|
-
/** The serialized shape the `image` builder emits — an `image`-kind `SlotDef`. */
|
|
347
|
-
interface ImageSlotDef extends Head {
|
|
348
|
-
type: "image";
|
|
349
|
-
crop?: CropConfig;
|
|
350
|
-
unique?: true;
|
|
351
|
-
}
|
|
352
|
-
/**
|
|
353
|
-
* A single image slot — the resolved value is always one `ImageValue`, never a
|
|
354
|
-
* list, so it carries no count bounds (a list of them does). `crop` is the asset's
|
|
355
|
-
* contract — the editor's cropper and `<Image>`'s mobile-crop switch read it; the box
|
|
356
|
-
* the image renders in is the section's own classes.
|
|
357
|
-
* `source: fill({ brief })` picks one of the property's photos.
|
|
358
|
-
* @example
|
|
359
|
-
* ```ts
|
|
360
|
-
* import { fill, image } from "@homepages/concrete";
|
|
361
|
-
*
|
|
362
|
-
* image({ label: "Hero photo", crop: { mode: "locked", aspect: 16 / 9 }, source: fill({ brief: "The strongest exterior." }) });
|
|
363
|
-
* ```
|
|
364
|
-
*/
|
|
365
|
-
declare function image<const HasSource extends SourceBinding | undefined = undefined>(opts: ImageOptions & {
|
|
366
|
-
source?: HasSource;
|
|
367
|
-
} & WritebackOption<HasSource> & MirrorOption<HasSource, ImageValue | null>): ImageSlotDef & SourceMark<HasSource> & FillMark;
|
|
368
|
-
type VideoSources = readonly [VideoSource, ...VideoSource[]];
|
|
369
|
-
interface VideoOptions extends CommonOptions<VideoValue | null, AssetFill>, AssetRowOptions {
|
|
370
|
-
playback?: PlaybackConfig;
|
|
371
|
-
sources?: VideoSources;
|
|
372
|
-
}
|
|
373
|
-
/** The serialized shape the `video` builder emits — a `video`-kind `SlotDef`. */
|
|
374
|
-
interface VideoSlotDef extends Head {
|
|
375
|
-
type: "video";
|
|
376
|
-
playback?: PlaybackConfig;
|
|
377
|
-
sources?: VideoSources;
|
|
378
|
-
unique?: true;
|
|
379
|
-
}
|
|
380
|
-
/**
|
|
381
|
-
* A single video slot, resolved as a `VideoValue`. Unlike `image`, there is no
|
|
382
|
-
* `crop` — a video is selected, never re-edited. `sources` opts into which
|
|
383
|
-
* origins the value may come from (`"upload"`, `"link"`); omitted means
|
|
384
|
-
* upload-only. `playback` configures the renderer's `<Video>`; the box it plays
|
|
385
|
-
* in is your own classes.
|
|
386
|
-
* `source: fill({ brief })` picks one of the property's videos.
|
|
387
|
-
* @example
|
|
388
|
-
* ```ts
|
|
389
|
-
* import { video } from "@homepages/concrete";
|
|
390
|
-
*
|
|
391
|
-
* video({ label: "Property video", playback: { controls: true }, sources: ["upload", "link"] });
|
|
392
|
-
* ```
|
|
393
|
-
*/
|
|
394
|
-
declare function video<const HasSource extends SourceBinding | undefined = undefined>(opts: VideoOptions & {
|
|
395
|
-
source?: HasSource;
|
|
396
|
-
} & WritebackOption<HasSource> & MirrorOption<HasSource, VideoValue | null>): VideoSlotDef & SourceMark<HasSource> & FillMark;
|
|
397
|
-
type TourOptions = CommonOptions<TourValue | null, AssetFill> & AssetRowOptions;
|
|
398
|
-
/** The serialized shape the `tour` builder emits — a `tour`-kind `SlotDef`. */
|
|
399
|
-
interface TourSlotDef extends Head {
|
|
400
|
-
type: "tour";
|
|
401
|
-
unique?: true;
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* A single 3D-tour slot, resolved as a `TourValue`. Its own kind rather than a
|
|
405
|
-
* third video source: `playback` is meaningless on a walkthrough, and the fill
|
|
406
|
-
* pool would otherwise mix videos with tour models. It has no type-specific
|
|
407
|
-
* option at all — no `crop` (a tour is selected, never edited), no `playback`,
|
|
408
|
-
* no `sources` and no `accepts`; which providers are admitted widens in the
|
|
409
|
-
* link-provider catalog, never on a slot, and the box the embed fills is your
|
|
410
|
-
* own classes.
|
|
411
|
-
*
|
|
412
|
-
* Render it with `<Slot.Tour>` for the embed, `<Slot.Image>` for the tour's
|
|
413
|
-
* thumbnail, or both — two positions from one selection.
|
|
414
|
-
* `source: fill({ brief })` picks one of the property's tours.
|
|
415
|
-
* @example
|
|
416
|
-
* ```ts
|
|
417
|
-
* import { fill, tour } from "@homepages/concrete";
|
|
418
|
-
*
|
|
419
|
-
* tour({ label: "3D tour", source: fill({ brief: "The whole-home walkthrough, not a single-room scan." }) });
|
|
420
|
-
* ```
|
|
421
|
-
*/
|
|
422
|
-
declare function tour<const HasSource extends SourceBinding | undefined = undefined>(opts: TourOptions & {
|
|
423
|
-
source?: HasSource;
|
|
424
|
-
} & WritebackOption<HasSource> & MirrorOption<HasSource, TourValue | null>): TourSlotDef & SourceMark<HasSource> & FillMark;
|
|
425
|
-
type StripHead<E> = Omit<E, "locked" | "unique">;
|
|
426
|
-
/**
|
|
427
|
-
* The serialized shape a single-item list emits — a `list`-kind `SlotDef` carrying
|
|
428
|
-
* `element` (never `fields`). `element` is the bare item shape (its `locked` is
|
|
429
|
-
* stripped, since a list holds present items, not an editable slot itself).
|
|
430
|
-
* `min`/`max` bound the list's item count; `unique` says no two items hold the same
|
|
431
|
-
* value — written on the item (`select({ …, unique: true })`, `image({ …, unique: true })`),
|
|
432
|
-
* stored here — and is passed through as-authored: this module does not itself
|
|
433
|
-
* deduplicate anything.
|
|
434
|
-
*/
|
|
435
|
-
interface ListSlotDef<E> extends Head {
|
|
436
|
-
type: "list";
|
|
437
|
-
element: E;
|
|
438
|
-
min?: number;
|
|
439
|
-
max?: number;
|
|
440
|
-
unique?: boolean;
|
|
441
|
-
}
|
|
442
|
-
type ListFillFor<E> = E extends {
|
|
443
|
-
type: "text";
|
|
444
|
-
} ? FillFor<"count" | "cap" | "none"> : E extends {
|
|
445
|
-
type: "poi";
|
|
446
|
-
} ? FillFor<"count"> : FillFor<"count" | "none">;
|
|
447
|
-
type ListRecordFill = FillFor<"count" | "none">;
|
|
448
|
-
/**
|
|
449
|
-
* The serialized shape a record list emits — a `list`-kind `SlotDef` carrying
|
|
450
|
-
* `fields` (never `element`), plus the record-item surface: `title` (the field whose
|
|
451
|
-
* value titles each row). Its fields' declaration order is the row's order; which of
|
|
452
|
-
* them share a row is the editor's rule.
|
|
453
|
-
*/
|
|
454
|
-
interface ListRecordSlotDef<I extends Record<string, ListFieldSlot>> extends Head {
|
|
455
|
-
type: "list";
|
|
456
|
-
fields: I;
|
|
457
|
-
title?: string;
|
|
458
|
-
min?: number;
|
|
459
|
-
max?: number;
|
|
460
|
-
}
|
|
461
|
-
interface ListHeadOptions {
|
|
462
|
-
label: string;
|
|
463
|
-
locked?: boolean;
|
|
464
|
-
placeholder?: string;
|
|
465
|
-
when?: string | readonly string[];
|
|
466
|
-
min?: number;
|
|
467
|
-
max?: number;
|
|
468
|
-
}
|
|
469
|
-
/** `list({ item })`: one slot per entry. Its distinctness is the item's `unique`. */
|
|
470
|
-
interface ListItemOptions<E> extends ListHeadOptions {
|
|
471
|
-
item: E;
|
|
472
|
-
fields?: never;
|
|
473
|
-
title?: never;
|
|
474
|
-
source?: SlotSource | RowRef | ComputeBinding<NonNullable<SlotValue<E>>[]> | MirrorSource | ListFillFor<E>;
|
|
475
|
-
writeback?: boolean;
|
|
476
|
-
}
|
|
477
|
-
/** A collection a record list's rows are baked from: `fact.property.units`, `.contacts` or `.comparables`. */
|
|
478
|
-
type CollectionSource = {
|
|
479
|
-
readonly kind: "direct";
|
|
480
|
-
readonly field: CollectionField;
|
|
481
|
-
};
|
|
482
|
-
/** Where a record list's rows come from: a collection, a `compute()` or a slot holding rows, or the model. */
|
|
483
|
-
type ListRowsSource = CollectionSource | ComputeBinding<readonly object[]> | MirrorSource | ListRecordFill;
|
|
484
|
-
/**
|
|
485
|
-
* `list({ fields })`: a record per entry. `fields` receives the row reference, whose
|
|
486
|
-
* members the `source` decides (`RowOf`); `title` names the field that titles a row.
|
|
487
|
-
*/
|
|
488
|
-
interface ListFieldsOptions<HasSource, I> extends ListHeadOptions {
|
|
489
|
-
source?: HasSource;
|
|
490
|
-
fields: (row: RowOf<HasSource>) => I;
|
|
491
|
-
item?: never;
|
|
492
|
-
title?: NoInfer<keyof I & string>;
|
|
493
|
-
writeback?: boolean;
|
|
494
|
-
}
|
|
495
|
-
/**
|
|
496
|
-
* One baked row of a record list: the collection's identity key beside each declared
|
|
497
|
-
* field — nothing of the collection reaches a row a field does not name. A row the
|
|
498
|
-
* model or a `compute()` supplies carries the stamped `id` instead.
|
|
499
|
-
*/
|
|
500
|
-
type DeclaredRow<HasSource, I> = HasSource extends {
|
|
501
|
-
kind: "direct";
|
|
502
|
-
field: infer C extends CollectionField;
|
|
503
|
-
} ? BoundRowValue<C, I> : RowValue<I>;
|
|
504
|
-
/** What a `fields` list's rows are typed as, carried as a phantom `SlotValue` reads. */
|
|
505
|
-
type DeclaredRowsMark<HasSource, I> = {
|
|
506
|
-
readonly __row?: DeclaredRow<HasSource, I>;
|
|
507
|
-
};
|
|
508
|
-
/**
|
|
509
|
-
* The list slot — one primitive for everything multi-item, declared with one options
|
|
510
|
-
* object and exactly one of `item` or `fields`.
|
|
511
|
-
*
|
|
512
|
-
* `item` is one slot per entry: `list({ label: "Features", item: text.short({ label: "Feature", cap: 80 }) })`.
|
|
513
|
-
* A select or media item may say `unique: true`: no two entries hold the same value.
|
|
514
|
-
*
|
|
515
|
-
* `fields` is a record per entry, written as a function of the row reference, whose
|
|
516
|
-
* members follow the list's `source`:
|
|
517
|
-
*
|
|
518
|
-
* - bound to a collection (`fact.property.units`, `.contacts`, `.comparables`), `row`
|
|
519
|
-
* offers that collection's members — `unit.beds`, `contact.headshot`, `comp.photo` —
|
|
520
|
-
* each a legal row field `source:` (with `writeback`, `true` only on a writable
|
|
521
|
-
* member) and a legal `reads` entry of a row field's `fill()` or `compute()`;
|
|
522
|
-
* - sourced by a `compute()` or another slot, `row` offers the members of that value's
|
|
523
|
-
* rows;
|
|
524
|
-
* - sourced by a `fill()`, the model writes each row, and every field declares its own
|
|
525
|
-
* `fill()`: a field reads an EARLIER field of its row by that field's const.
|
|
526
|
-
*
|
|
527
|
-
* Every row field declares its origin — a row member, a `fill()` or a `compute()`. A
|
|
528
|
-
* property fact is the same value in every row, so it is read inside a field's
|
|
529
|
-
* `reads`, never bound; `fact.unit.*` and `fact.contact.*` name the primary row.
|
|
530
|
-
* Inside a list, `unique: true` on a select or media field says its value does not
|
|
531
|
-
* repeat across the rows.
|
|
532
|
-
*
|
|
533
|
-
* Depth is fixed: an item is never a list, a record field is never a record, and a
|
|
534
|
-
* field-level list holds a single non-record item.
|
|
535
|
-
* @example
|
|
536
|
-
* ```ts
|
|
537
|
-
* import { fact, fill, image, list, number, text } from "@homepages/concrete";
|
|
538
|
-
*
|
|
539
|
-
* list({
|
|
540
|
-
* label: "Units",
|
|
541
|
-
* source: fact.property.units,
|
|
542
|
-
* writeback: false,
|
|
543
|
-
* title: "unit_label",
|
|
544
|
-
* fields: (unit) => ({
|
|
545
|
-
* unit_label: text.medium({ label: "Unit name", cap: 40, source: unit.unit_label, writeback: true }),
|
|
546
|
-
* beds: number({ label: "Beds", source: unit.beds, writeback: true }),
|
|
547
|
-
* floor_plans: list({ label: "Floor plans", source: unit.floor_plans, writeback: false, item: image({ label: "Floor plan" }) }),
|
|
548
|
-
* }),
|
|
549
|
-
* });
|
|
550
|
-
*
|
|
551
|
-
* list({
|
|
552
|
-
* label: "FAQ",
|
|
553
|
-
* source: fill({ count: 6, brief: "Questions a buyer would ask, each on a different topic." }),
|
|
554
|
-
* fields: () => {
|
|
555
|
-
* const question = text.medium({ label: "Question", cap: 72, source: fill({ brief: "One question." }) });
|
|
556
|
-
* return {
|
|
557
|
-
* question,
|
|
558
|
-
* answer: text.long({ label: "Answer", cap: 300, source: fill({ reads: [fact.description, question], brief: "Answer it." }) }),
|
|
559
|
-
* };
|
|
560
|
-
* },
|
|
561
|
-
* });
|
|
562
|
-
* ```
|
|
563
|
-
*/
|
|
564
|
-
interface ListBuilder {
|
|
565
|
-
<const E extends ListItemSlot, const HasSource extends SourceBinding | undefined = undefined>(opts: ListItemOptions<E> & {
|
|
566
|
-
source?: HasSource;
|
|
567
|
-
} & WritebackOption<HasSource> & MirrorOption<HasSource, NonNullable<SlotValue<E>>[]>): ListSlotDef<StripHead<E>> & SourceMark<HasSource> & FillMark;
|
|
568
|
-
<const I extends Record<string, ListFieldSlot>, const HasSource extends ListRowsSource | undefined = undefined>(opts: ListFieldsOptions<HasSource, I> & WritebackOption<HasSource>): ListRecordSlotDef<I> & SourceMark<HasSource> & FillMark & DeclaredRowsMark<HasSource, I>;
|
|
569
|
-
}
|
|
570
|
-
/** The list builder — see {@link ListBuilder}. */
|
|
571
|
-
declare const list: ListBuilder;
|
|
572
|
-
interface PoiOptions {
|
|
573
|
-
label: string;
|
|
574
|
-
locked?: boolean;
|
|
575
|
-
placeholder?: string;
|
|
576
|
-
when?: string | readonly string[];
|
|
577
|
-
}
|
|
578
|
-
/** The serialized shape the `poi` builder emits — a `poi`-kind `SlotDef`. */
|
|
579
|
-
interface PoiSlotDef extends Head {
|
|
580
|
-
type: "poi";
|
|
581
|
-
}
|
|
582
|
-
/**
|
|
583
|
-
* A single point of interest — one platform-built place (a `PoiRow`), picked
|
|
584
|
-
* in the editor's place search. The platform owns the row's content; there is
|
|
585
|
-
* nothing to configure beyond the head. Usable standalone or as a list item
|
|
586
|
-
* (`list({ label: "Restaurants", item: poi({ label: "Restaurant" }) })`).
|
|
587
|
-
* @example
|
|
588
|
-
* ```ts
|
|
589
|
-
* import { poi } from "@homepages/concrete";
|
|
590
|
-
*
|
|
591
|
-
* poi({ label: "Nearest station", placeholder: "Search places…" });
|
|
592
|
-
* ```
|
|
593
|
-
*/
|
|
594
|
-
declare function poi(opts: PoiOptions): PoiSlotDef;
|
|
595
|
-
interface DocumentOptions extends AssetRowOptions {
|
|
596
|
-
label: string;
|
|
597
|
-
locked?: boolean;
|
|
598
|
-
placeholder?: string;
|
|
599
|
-
when?: string | readonly string[];
|
|
600
|
-
source?: AssetFill;
|
|
601
|
-
}
|
|
602
|
-
/** The serialized shape the `document` builder emits — a `document`-kind `SlotDef`. */
|
|
603
|
-
interface DocumentSlotDef extends Head {
|
|
604
|
-
type: "document";
|
|
605
|
-
unique?: true;
|
|
606
|
-
}
|
|
607
|
-
/**
|
|
608
|
-
* A single platform-hosted document — a pdf, spreadsheet, or office file the
|
|
609
|
-
* visitor opens in the browser or downloads. The value resolves to one
|
|
610
|
-
* `DocumentValue` (served url plus filename, type and size); render it with
|
|
611
|
-
* `Slot.Document`, which is one anchor.
|
|
612
|
-
*
|
|
613
|
-
* Reach for `url({ accepts: "file" })` instead when the file lives somewhere
|
|
614
|
-
* else — a Drive or Dropbox link the platform neither stores nor serves.
|
|
615
|
-
*
|
|
616
|
-
* `source: fill({ brief })` picks one file out of the documents stored on the
|
|
617
|
-
* property. The model sees each candidate's filename, file type, and whatever text
|
|
618
|
-
* was distilled out of it (a spreadsheet or slide deck carries none, so name the
|
|
619
|
-
* file type when it matters). Usable standalone or as a list item — a
|
|
620
|
-
* `list({ item: document(…) })` carries its own fill and picks a SET from the same pool.
|
|
621
|
-
* @example
|
|
622
|
-
* ```ts
|
|
623
|
-
* import { document, fill } from "@homepages/concrete";
|
|
624
|
-
*
|
|
625
|
-
* document({
|
|
626
|
-
* label: "Offering brochure",
|
|
627
|
-
* source: fill({ brief: "The offering brochure: a multi-page PDF about the whole property, not a single-unit floor plan." }),
|
|
628
|
-
* });
|
|
629
|
-
* ```
|
|
630
|
-
*/
|
|
631
|
-
declare function document(opts: DocumentOptions): DocumentSlotDef & FillMark;
|
|
632
|
-
//#endregion
|
|
633
|
-
export { CropConfig, DeclaredRow, DeclaredRowsMark, DisplayEntryInput, DisplayFill, DocumentSlotDef, ImageSlotDef, ListBuilder, ListRecordSlotDef, ListSlotDef, MirrorOption, MirrorSource, NumberSlotDef, PoiSlotDef, SelectBuilder, SelectOptionInput, SelectSlotDef, SlotSource, SourceBinding, SourceMark, TextSlotDef, TourSlotDef, UrlSlotDef, VideoSlotDef, WritebackOption, document, image, list, number, poi, select, text, tour, url, video };
|