@homepages/concrete 5.0.0 → 6.0.1
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 +342 -0
- package/README.md +28 -17
- package/codemods/fill-is-a-source.mjs +533 -0
- package/codemods/manifest.json +16 -0
- package/codemods/reads-replace-reconcile.mjs +285 -0
- package/dist/artifact/playground/client/assets/{index-D1fwOGVK.js → index-u3T7DiSN.js} +96 -96
- package/dist/artifact/playground/client/index.html +1 -1
- package/dist/artifact/playground/host.mjs +23 -23
- package/dist/base.css +3 -8
- package/dist/browser/site-config.js +1 -16
- package/dist/browser/submit-lead.js +0 -31
- package/dist/cli/build/artifact.js +16 -23
- package/dist/cli/build/captures.js +0 -6
- package/dist/cli/build/esbuild.js +0 -17
- package/dist/cli/build/fixtures.js +15 -30
- package/dist/cli/build/icons.js +0 -3
- package/dist/cli/build/index.js +1 -1
- package/dist/cli/build/playground.js +4 -8
- package/dist/cli/build/sections.js +9 -30
- package/dist/cli/build/source.js +52 -27
- package/dist/cli/build/static.js +4 -25
- package/dist/cli/capture/bundle.js +0 -9
- package/dist/cli/capture/capture-browser.js +0 -14
- package/dist/cli/capture/capture.js +1 -8
- package/dist/cli/check/analyze.js +2 -5
- package/dist/cli/check/index.js +1 -1
- package/dist/cli/check/line-endings.js +52 -0
- package/dist/cli/check/load-workspace.js +3 -8
- package/dist/cli/check/portable-names.js +48 -0
- package/dist/cli/check/render/class-conflicts.js +0 -5
- package/dist/cli/check/render/html.js +0 -1
- package/dist/cli/check/render/invariants.js +0 -5
- package/dist/cli/check/render/island-frames.js +0 -25
- package/dist/cli/check/render/marker-coverage.js +0 -20
- package/dist/cli/check/render/nav.js +0 -33
- package/dist/cli/check/report.js +0 -3
- package/dist/cli/check/stages/bundles.js +1 -9
- package/dist/cli/check/stages/composition.js +3 -2
- package/dist/cli/check/stages/dependencies.js +7 -38
- package/dist/cli/check/stages/fixtures.js +3 -31
- package/dist/cli/check/stages/lint.js +2 -2
- package/dist/cli/check/stages/logic.js +3 -34
- package/dist/cli/check/stages/relations.js +46 -0
- package/dist/cli/check/stages/render.js +0 -1
- package/dist/cli/check/stages/sections.js +3 -3
- package/dist/cli/check/stages/stylesheet.js +1 -1
- package/dist/cli/check/stages/typecheck.js +5 -11
- package/dist/cli/check/stages/workspace.js +36 -14
- package/dist/cli/commands.js +9 -56
- package/dist/cli/currency/cache.js +4 -17
- package/dist/cli/currency/decide.js +0 -14
- package/dist/cli/currency/opt-out.js +0 -7
- package/dist/cli/currency/preamble.js +3 -24
- package/dist/cli/currency/prompt.js +0 -1
- package/dist/cli/currency/refresh.js +5 -12
- package/dist/cli/currency/resolve-latest.js +3 -64
- package/dist/cli/currency/version-order.js +0 -12
- package/dist/cli/dev/crop.js +0 -2
- package/dist/cli/dev/http.js +0 -13
- package/dist/cli/dev/index.js +3 -4
- package/dist/cli/dev/islands.js +25 -70
- package/dist/cli/dev/listen.js +26 -0
- package/dist/cli/dev/load-template.js +0 -1
- package/dist/cli/dev/request-error.js +0 -4
- package/dist/cli/dev/server.js +46 -52
- package/dist/cli/dev/tsconfig-paths.js +0 -13
- package/dist/cli/dev/vite.js +9 -38
- package/dist/cli/dev/workspace-reader.js +4 -34
- package/dist/cli/media/cache.js +4 -51
- package/dist/cli/media/derive.js +2 -94
- package/dist/cli/media/deriver-plugin.js +0 -2
- package/dist/cli/media/frame-rung-floor.js +0 -6
- package/dist/cli/property/index.js +0 -4
- package/dist/cli/property/library.js +6 -24
- package/dist/cli/publish/client.js +0 -1
- package/dist/cli/publish/freshness.js +0 -2
- package/dist/cli/publish/git.js +2 -8
- package/dist/cli/publish/index.js +8 -15
- package/dist/cli/publish/pack.js +5 -6
- package/dist/cli/publish/report.js +0 -6
- package/dist/cli/publish/target.js +16 -13
- package/dist/cli/publish/wire.js +0 -6
- package/dist/cli/tar.js +2 -9
- package/dist/cli/upgrade/codemod.js +0 -8
- package/dist/cli/upgrade/index.js +0 -24
- package/dist/cli/upgrade/manifest.js +0 -12
- package/dist/cli/upgrade/plan.js +0 -17
- package/dist/cli/upgrade/stage.js +12 -15
- package/dist/cli/version.js +0 -8
- package/dist/cli/workspace.js +2 -34
- package/dist/cli.js +4 -21
- package/dist/css/compile.js +25 -28
- package/dist/css/graph.js +3 -10
- package/dist/css/inline.js +3 -16
- package/dist/css/rules.js +6 -43
- package/dist/design-system/format-variants.js +0 -22
- package/dist/eslint/authoring.js +0 -2
- package/dist/eslint/correctness.js +0 -7
- package/dist/eslint/rules/editor-reason.js +0 -11
- package/dist/eslint/rules/island-ids.js +0 -1
- package/dist/eslint/rules/jsx-visitor.js +0 -13
- package/dist/eslint/rules/no-editor-globals.js +0 -2
- package/dist/eslint/rules/no-raw-values.js +0 -1
- package/dist/fixtures/brand.js +0 -1
- package/dist/fixtures/bundle-rule.js +4 -9
- package/dist/fixtures/canonical.d.ts +20 -0
- package/dist/fixtures/image-dimensions.js +0 -1
- package/dist/fixtures/load.js +8 -17
- package/dist/fixtures/media-plugin.js +4 -31
- package/dist/fixtures/media.js +0 -21
- package/dist/fixtures/package-stylesheets.js +0 -6
- package/dist/fixtures/property.js +16 -15
- package/dist/fixtures/resolve.js +102 -29
- package/dist/fixtures/rows.js +12 -11
- package/dist/fixtures/synthesize-empties.js +0 -4
- package/dist/fixtures.d.ts +19 -4
- package/dist/fixtures.js +0 -18
- package/dist/index.d.ts +8 -9
- package/dist/index.js +2 -11
- package/dist/islands/client-module.js +0 -11
- package/dist/islands/marker.js +0 -33
- package/dist/node_modules/.pnpm/fflate@0.8.3/node_modules/fflate/esm/browser.js +0 -20
- package/dist/packages/external/concrete/package.js +1 -1
- package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +21 -35
- package/dist/packages/internal/fill-bake/dist/compute-reads.js +4 -0
- package/dist/packages/internal/fill-bake/dist/derive-source.js +40 -0
- package/dist/packages/internal/fill-bake/dist/display.js +0 -1
- package/dist/packages/internal/fill-bake/dist/index.js +4 -4
- package/dist/packages/internal/fill-vocabulary/dist/origination.js +106 -0
- package/dist/packages/internal/fill-vocabulary/dist/row-planners.js +1 -49
- package/dist/packages/internal/format-geometry/dist/capture.js +10 -240
- package/dist/packages/internal/format-geometry/dist/geometry.js +0 -6
- package/dist/packages/internal/image-ladder/dist/crop.js +0 -12
- package/dist/packages/internal/image-ladder/dist/policy.js +0 -14
- package/dist/packages/internal/island-runtime/dist/capture-holds.js +0 -13
- package/dist/packages/internal/island-runtime/dist/contract.js +0 -34
- package/dist/packages/internal/island-runtime/dist/editor-instance-context.js +0 -1
- package/dist/packages/internal/island-runtime/dist/index.js +0 -34
- package/dist/packages/internal/island-runtime/dist/island-id-context.js +0 -1
- package/dist/packages/internal/island-runtime/dist/use-capture-ready.js +0 -15
- package/dist/packages/internal/island-runtime/dist/use-editor.js +0 -10
- package/dist/packages/internal/island-runtime/dist/use-island-id.js +0 -32
- package/dist/packages/internal/property-facts/dist/derive-facts-view.js +2 -17
- package/dist/packages/internal/property-facts/dist/index.js +1 -1
- package/dist/packages/internal/property-facts/dist/{property-facts-CSdkSuD7.js → property-facts-5pxZnlkh.js} +13 -2
- package/dist/packages/internal/section-contracts/dist/cap-contract.js +1 -18
- package/dist/packages/internal/section-contracts/dist/catalog.js +16 -8
- package/dist/packages/internal/section-contracts/dist/choose-select-contract.js +12 -16
- package/dist/packages/internal/section-contracts/dist/count-bounds-contract.js +5 -11
- package/dist/packages/internal/section-contracts/dist/display-contract.js +2 -0
- package/dist/packages/internal/section-contracts/dist/display-evidence-contract.js +2 -8
- package/dist/packages/internal/section-contracts/dist/fill-spec-view.js +13 -0
- package/dist/packages/internal/section-contracts/dist/index.js +2 -1
- package/dist/packages/internal/section-contracts/dist/interpolation-contract.js +16 -42
- package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +24 -43
- package/dist/packages/internal/section-contracts/dist/name-title-contract.js +11 -18
- package/dist/packages/internal/section-contracts/dist/poi-curation-contract.js +10 -12
- package/dist/packages/internal/section-contracts/dist/pooling-field-contract.js +3 -13
- package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +6 -18
- package/dist/packages/internal/section-contracts/dist/runners.js +21 -13
- package/dist/packages/internal/section-contracts/dist/source-contract.js +13 -2
- package/dist/packages/internal/section-contracts/dist/writer-reads-fact-contract.js +31 -0
- package/dist/packages/internal/source-resolution/dist/index.js +1 -9
- package/dist/packages/internal/template-artifact/dist/hash.js +0 -8
- package/dist/packages/internal/template-artifact/dist/index.js +1 -1
- package/dist/packages/internal/template-artifact/dist/layout.js +0 -39
- package/dist/packages/internal/template-artifact/dist/manifest.js +1 -9
- package/dist/packages/internal/template-artifact/dist/sha256.js +0 -1
- package/dist/packages/internal/template-artifact/dist/verify.js +2 -4
- package/dist/packages/internal/template-contracts/dist/collection-editing.js +0 -16
- package/dist/packages/internal/template-contracts/dist/content-categories.js +0 -4
- package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +16 -10
- package/dist/packages/internal/template-contracts/dist/facts-view.js +15 -28
- package/dist/packages/internal/template-contracts/dist/layout.js +0 -7
- package/dist/packages/internal/template-contracts/dist/markers.js +0 -29
- package/dist/packages/internal/template-contracts/dist/select-key.js +0 -6
- package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +56 -34
- package/dist/packages/internal/template-contracts/dist/slot-catalog.js +22 -389
- package/dist/platform/file-url.js +8 -0
- package/dist/platform/fs.js +73 -0
- package/dist/platform/names.js +63 -0
- package/dist/platform/order.js +7 -0
- package/dist/platform/paths.js +66 -0
- package/dist/platform/process.js +97 -0
- package/dist/playground/host/page-state.js +0 -2
- package/dist/playground/host/paths.js +0 -1
- package/dist/playground/layout.js +0 -7
- package/dist/playground/wire.js +0 -8
- package/dist/primitives/FrameShell.js +0 -18
- package/dist/primitives/Image.d.ts +5 -1
- package/dist/primitives/Image.js +2 -68
- package/dist/primitives/Section.js +0 -13
- package/dist/primitives/Tour.js +0 -26
- package/dist/primitives/Video.js +0 -32
- package/dist/primitives/embed-playback.js +0 -1
- package/dist/primitives/marker-attrs.js +0 -17
- package/dist/primitives/picture-sources.js +6 -1
- package/dist/primitives/probe-context.js +0 -7
- package/dist/primitives/slot-bindings.js +0 -46
- package/dist/primitives/slot-document.js +0 -11
- package/dist/primitives/slot-group.js +0 -9
- package/dist/primitives/slot-media.js +0 -27
- package/dist/primitives/slot-scalar.js +0 -4
- package/dist/primitives/slot.js +0 -6
- package/dist/rules/registry.js +42 -24
- package/dist/schema/compute.d.ts +46 -8
- package/dist/schema/compute.js +21 -15
- package/dist/schema/define-schema.d.ts +1 -1
- package/dist/schema/define-schema.js +37 -17
- package/dist/schema/extract-fill-spec.js +93 -180
- package/dist/schema/extract-used-facts.js +16 -158
- package/dist/schema/fact.d.ts +25 -12
- package/dist/schema/fact.js +7 -11
- package/dist/schema/fill-builders.d.ts +91 -366
- package/dist/schema/fill-builders.js +21 -259
- package/dist/schema/fill-declaration.d.ts +7 -69
- package/dist/schema/fill-declaration.js +5 -34
- package/dist/schema/fill-spec.js +59 -148
- package/dist/schema/format-presets.js +0 -12
- package/dist/schema/format.js +0 -7
- package/dist/schema/layout.js +0 -10
- package/dist/schema/manifest.js +0 -39
- package/dist/schema/property-facts.d.ts +20 -0
- package/dist/schema/section-nav.js +0 -15
- package/dist/schema/section-schema.d.ts +0 -1
- package/dist/schema/section-schema.js +4 -20
- package/dist/schema/slot-builders.d.ts +128 -117
- package/dist/schema/slot-builders.js +18 -201
- package/dist/schema/slot-ref.d.ts +63 -0
- package/dist/schema/slot-ref.js +33 -0
- package/dist/schema/slot-types.d.ts +3 -2
- package/dist/schema/slot-types.js +11 -20
- package/dist/section/declare.d.ts +14 -10
- package/dist/section/declare.js +13 -2
- package/dist/section/discovery.js +6 -21
- package/dist/section/groups.js +0 -6
- package/dist/section/materialize.js +0 -5
- package/dist/section/placements.js +0 -4
- package/dist/section/section.d.ts +8 -5
- package/dist/section/section.js +7 -29
- package/dist/styles.css +5 -0
- package/dist/template/define-template.d.ts +0 -4
- package/dist/template/define-template.js +1 -15
- package/dist/template/logic-build.js +8 -35
- package/dist/template/logic-shim.d.ts +4 -5
- package/dist/template/logic-shim.js +2 -6
- package/dist/template/logic-transform.js +0 -6
- package/dist/template/materialize.js +52 -43
- package/dist/template/mirror-types.js +43 -0
- package/dist/template/running-copy.js +5 -20
- package/dist/template/section-reads.js +83 -0
- package/guide/reference/cli/INDEX.md +12 -6
- package/guide/reference/cli/build.md +1 -1
- package/guide/reference/cli/check.md +1 -1
- package/guide/reference/cli/dev.md +3 -3
- package/guide/reference/cli/property-add.md +1 -1
- package/guide/reference/cli/property-list.md +1 -1
- package/guide/reference/cli/publish.md +4 -2
- package/guide/reference/cli/upgrade.md +1 -1
- package/guide/reference/rules/INDEX.md +26 -13
- package/package.json +4 -2
- package/dist/packages/internal/fact-interpolation/dist/index.js +0 -22
- package/dist/packages/internal/fill-bake/dist/reconcile-cross-section.js +0 -170
- package/dist/packages/internal/fill-vocabulary/dist/facts.d.ts +0 -32
- package/dist/packages/internal/fill-vocabulary/dist/facts.js +0 -131
- package/dist/packages/internal/template-contracts/dist/slot-overrides.js +0 -11
- package/dist/schema/fill-spec.d.ts +0 -18
- package/dist/template/reconcile.d.ts +0 -67
- package/dist/template/reconcile.js +0 -25
|
@@ -2,12 +2,13 @@ import { LinkKind, LinkProviderId, SourceFieldName, SourceFilter, VideoSource, W
|
|
|
2
2
|
import { VideoValue } from "../packages/internal/template-contracts/dist/video-value.js";
|
|
3
3
|
import { TourValue } from "../packages/internal/template-contracts/dist/tour-value.js";
|
|
4
4
|
import { ImageValue, PlaybackConfig } from "./runtime-values.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { LayoutRow } from "./layout.js";
|
|
8
|
-
import { FillMark, FillOption } from "./fill-declaration.js";
|
|
5
|
+
import { FillBinding, FillFor } from "./fill-builders.js";
|
|
6
|
+
import { FillMark } from "./fill-declaration.js";
|
|
9
7
|
import { ListFieldSlot, ListItemSlot } from "./slot-types.js";
|
|
8
|
+
import { RefValue, SiblingSlot, SlotRef } from "./slot-ref.js";
|
|
10
9
|
import { RowValue, SlotValue } from "./section-props.js";
|
|
10
|
+
import { LayoutRow } from "./layout.js";
|
|
11
|
+
import { ComputeBinding } from "./compute.js";
|
|
11
12
|
//#region src/schema/slot-builders.d.ts
|
|
12
13
|
/**
|
|
13
14
|
* Where a slot's value comes from: the `direct` literal a `fact.*` entry emits
|
|
@@ -21,8 +22,31 @@ type SlotSource = {
|
|
|
21
22
|
kind: "derived";
|
|
22
23
|
transform: string;
|
|
23
24
|
};
|
|
24
|
-
type SourceMark<HasSource extends
|
|
25
|
+
type SourceMark<HasSource extends SourceBinding | undefined> = HasSource extends SlotSource | ComputeBinding<unknown> ? {
|
|
25
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 `compute()`, a mirrored slot, or a `fill()`. */
|
|
39
|
+
type SourceBinding = SlotSource | 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 owes: its upstream's value type must be assignable
|
|
44
|
+
* to this slot kind's `CV` — what a `compute()` here must return. A projection or a
|
|
45
|
+
* join is a `compute()`, never a mirror. A mismatch demands a key no author can
|
|
46
|
+
* supply, so the compile error names both types. Any other `source` owes nothing.
|
|
47
|
+
*/
|
|
48
|
+
type MirrorOption<HasSource, CV> = HasSource extends MirrorSource ? [MirroredValue<HasSource>] extends [CV] ? unknown : {
|
|
49
|
+
"a mirrored slot's value type must be assignable to this slot's": [upstream: MirroredValue<HasSource>, slot: CV];
|
|
26
50
|
} : unknown;
|
|
27
51
|
/**
|
|
28
52
|
* The `writeback` key a builder's options must carry, decided by the slot's
|
|
@@ -33,7 +57,7 @@ type SourceMark<HasSource extends SlotSource | ComputeBinding<unknown> | undefin
|
|
|
33
57
|
* `writeback` key at all: nothing can write back through a derivation, and
|
|
34
58
|
* propagation is meaningless for generated content.
|
|
35
59
|
*/
|
|
36
|
-
type WritebackOption<HasSource extends
|
|
60
|
+
type WritebackOption<HasSource extends SourceBinding | undefined> = HasSource extends {
|
|
37
61
|
kind: "direct";
|
|
38
62
|
field: infer F;
|
|
39
63
|
} ? [F] extends [WritableSourceFieldName] ? {
|
|
@@ -62,10 +86,10 @@ interface CropConfig {
|
|
|
62
86
|
breakpoint: number;
|
|
63
87
|
};
|
|
64
88
|
}
|
|
65
|
-
interface CommonOptions<CV = never> {
|
|
89
|
+
interface CommonOptions<CV = never, F = never> {
|
|
66
90
|
label: string;
|
|
67
91
|
locked?: boolean;
|
|
68
|
-
source?: SlotSource | ComputeBinding<CV
|
|
92
|
+
source?: SlotSource | ComputeBinding<CV> | MirrorSource | F;
|
|
69
93
|
writeback?: boolean;
|
|
70
94
|
placeholder?: string;
|
|
71
95
|
when?: string | readonly string[];
|
|
@@ -78,7 +102,9 @@ interface Head {
|
|
|
78
102
|
placeholder?: string;
|
|
79
103
|
when?: string | readonly string[];
|
|
80
104
|
}
|
|
81
|
-
|
|
105
|
+
/** The fill a `text` slot takes: it is written, so a lower `cap` and `none` both bind. */
|
|
106
|
+
type TextFill = FillFor<"cap" | "none">;
|
|
107
|
+
interface TextOptions extends CommonOptions<string | null, TextFill> {
|
|
82
108
|
cap?: number;
|
|
83
109
|
}
|
|
84
110
|
/** The serialized shape `text.short`/`.medium`/`.long` emit — a `text`-kind `SlotDef`. */
|
|
@@ -87,45 +113,37 @@ interface TextSlotDef<Size extends "short" | "medium" | "long"> extends Head {
|
|
|
87
113
|
size: Size;
|
|
88
114
|
cap?: number;
|
|
89
115
|
}
|
|
90
|
-
/** What a `text` slot's `fill:` may hold: generated prose, or a contact pick of a scalar field. */
|
|
91
|
-
type TextFill = BuiltDecision<"text-block"> | BuiltDecision<"contact-assign">;
|
|
92
116
|
/**
|
|
93
117
|
* The text slot, sized by the member you pick: `text.short` / `.medium` / `.long`.
|
|
94
118
|
*
|
|
95
119
|
* `cap` is the slot's character budget and the ONLY declaration of it: it bounds
|
|
96
|
-
* what a user may type in the editor, and
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* `source`, never its companion.
|
|
120
|
+
* what a user may type in the editor, and a `fill()` producing the slot inherits it
|
|
121
|
+
* as the budget the model writes to. A filled slot must declare one; the fill's own
|
|
122
|
+
* `cap` only ever asks for something strictly shorter.
|
|
100
123
|
* @example
|
|
101
124
|
* ```ts
|
|
102
|
-
* import {
|
|
125
|
+
* import { fact, fill, text } from "@homepages/concrete";
|
|
103
126
|
*
|
|
104
127
|
* text.medium({
|
|
105
128
|
* cap: 60,
|
|
106
129
|
* label: "Headline",
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
* voice: "Confident premium-listing voice.",
|
|
111
|
-
* content: "Write a marketing headline.",
|
|
130
|
+
* source: fill({
|
|
131
|
+
* reads: [fact.property.address, fact.description],
|
|
132
|
+
* brief: "A marketing headline in one sentence. Confident, no exclamation marks.",
|
|
112
133
|
* }),
|
|
113
134
|
* });
|
|
114
135
|
* ```
|
|
115
136
|
*/
|
|
116
137
|
declare const text: {
|
|
117
|
-
short: <const HasSource extends
|
|
138
|
+
short: <const HasSource extends SourceBinding | undefined = undefined>(opts: TextOptions & {
|
|
118
139
|
source?: HasSource | undefined;
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
medium: <const HasSource extends SlotSource | ComputeBinding<unknown> | undefined = undefined>(opts: TextOptions & {
|
|
140
|
+
} & WritebackOption<HasSource> & MirrorOption<HasSource, string | null>) => TextSlotDef<"short"> & SourceMark<HasSource> & FillMark;
|
|
141
|
+
medium: <const HasSource extends SourceBinding | undefined = undefined>(opts: TextOptions & {
|
|
122
142
|
source?: HasSource | undefined;
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
long: <const HasSource extends SlotSource | ComputeBinding<unknown> | undefined = undefined>(opts: TextOptions & {
|
|
143
|
+
} & WritebackOption<HasSource> & MirrorOption<HasSource, string | null>) => TextSlotDef<"medium"> & SourceMark<HasSource> & FillMark;
|
|
144
|
+
long: <const HasSource extends SourceBinding | undefined = undefined>(opts: TextOptions & {
|
|
126
145
|
source?: HasSource | undefined;
|
|
127
|
-
|
|
128
|
-
} & WritebackOption<HasSource> & FillOption<HasSource, TextFill>) => TextSlotDef<"long"> & SourceMark<HasSource> & FillMark<TextFill>;
|
|
146
|
+
} & WritebackOption<HasSource> & MirrorOption<HasSource, string | null>) => TextSlotDef<"long"> & SourceMark<HasSource> & FillMark;
|
|
129
147
|
};
|
|
130
148
|
interface NumberOptions extends CommonOptions<number | null> {
|
|
131
149
|
prefix?: string;
|
|
@@ -149,8 +167,8 @@ interface NumberSlotDef extends Head {
|
|
|
149
167
|
* toggles decimal display, and `maxDigits` caps the digit count — all read by
|
|
150
168
|
* the renderer's number formatting, not enforced as an input range.
|
|
151
169
|
*
|
|
152
|
-
* Binding-only: no fill
|
|
153
|
-
* `
|
|
170
|
+
* Binding-only: no fill produces a number, so `source` takes a fact, a slot or a
|
|
171
|
+
* `compute()`, never a `fill()`.
|
|
154
172
|
* @example
|
|
155
173
|
* ```ts
|
|
156
174
|
* import { fact, number } from "@homepages/concrete";
|
|
@@ -158,9 +176,9 @@ interface NumberSlotDef extends Head {
|
|
|
158
176
|
* number({ source: fact.unit.sqft, writeback: true, label: "Square feet", thousandsSep: true, suffix: "sqft", maxDigits: 7 });
|
|
159
177
|
* ```
|
|
160
178
|
*/
|
|
161
|
-
declare function number<const HasSource extends
|
|
179
|
+
declare function number<const HasSource extends SourceBinding | undefined = undefined>(opts: NumberOptions & {
|
|
162
180
|
source?: HasSource;
|
|
163
|
-
} & WritebackOption<HasSource>): NumberSlotDef & SourceMark<HasSource>;
|
|
181
|
+
} & WritebackOption<HasSource> & MirrorOption<HasSource, number | null>): NumberSlotDef & SourceMark<HasSource>;
|
|
164
182
|
/** One `select.of` option: a bare string (value === label) or a stored key with display text. */
|
|
165
183
|
type SelectOptionInput = string | {
|
|
166
184
|
value: string;
|
|
@@ -183,67 +201,62 @@ interface SelectSlotDef extends Head {
|
|
|
183
201
|
};
|
|
184
202
|
creatable?: boolean;
|
|
185
203
|
}
|
|
186
|
-
declare function selectFn<const HasSource extends
|
|
204
|
+
declare function selectFn<const HasSource extends SourceBinding | undefined = undefined>(opts: SelectOptions & {
|
|
187
205
|
source?: HasSource;
|
|
188
|
-
} & WritebackOption<HasSource>): SelectSlotDef & SourceMark<HasSource>;
|
|
189
|
-
type SelectFill =
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
declare function selectOf<const HasSource extends
|
|
206
|
+
} & WritebackOption<HasSource> & MirrorOption<HasSource, string | null>): SelectSlotDef & SourceMark<HasSource>;
|
|
207
|
+
type SelectFill = FillFor<"none">;
|
|
208
|
+
interface SelectOfOptions extends CommonOptions<string | null, SelectFill> {
|
|
209
|
+
creatable?: boolean;
|
|
210
|
+
}
|
|
211
|
+
declare function selectOf<const HasSource extends SourceBinding | undefined = undefined>(values: readonly SelectOptionInput[], opts: SelectOfOptions & {
|
|
194
212
|
source?: HasSource;
|
|
195
|
-
|
|
196
|
-
|
|
213
|
+
} & WritebackOption<HasSource> & MirrorOption<HasSource, string | null>): SelectSlotDef & SourceMark<HasSource> & FillMark;
|
|
214
|
+
/**
|
|
215
|
+
* The fill a `meta.display` entry takes: the model picks ONE of the entry's own
|
|
216
|
+
* cases. The brief and `reads` alone — an entry always resolves a case, so it
|
|
217
|
+
* never abstains, and a pick of one has no count or cap.
|
|
218
|
+
*/
|
|
219
|
+
type DisplayFill = FillFor<never>;
|
|
197
220
|
/**
|
|
198
221
|
* One `meta.display` entry as authored under `defineSchema`'s `display:` —
|
|
199
222
|
* the declared `cases` (the FIRST is the default and the failure posture), an
|
|
200
|
-
* optional `locked` opting the entry out of user switching, and
|
|
201
|
-
*
|
|
202
|
-
*
|
|
223
|
+
* optional `locked` opting the entry out of user switching, and its one origin as
|
|
224
|
+
* written: `source: compute(fn)` (still a live binding here; `defineSchema` strips
|
|
225
|
+
* it into the logic bundle exactly as it does a slot's) or `source: fill({ brief })`.
|
|
203
226
|
*/
|
|
204
227
|
interface DisplayEntryInput<C extends readonly string[] = readonly string[]> {
|
|
205
228
|
cases: [...C];
|
|
206
229
|
locked?: true;
|
|
207
|
-
source?: ComputeBinding<C[number]
|
|
208
|
-
fill?: DisplayChoice;
|
|
230
|
+
source?: ComputeBinding<C[number]> | DisplayFill;
|
|
209
231
|
}
|
|
210
|
-
type DisplayOriginOptions<C extends readonly string[]> = {
|
|
211
|
-
source: ComputeBinding<C[number]>;
|
|
212
|
-
fill?: never;
|
|
213
|
-
} | {
|
|
214
|
-
fill: DisplayChoice;
|
|
215
|
-
source?: never;
|
|
216
|
-
} | {
|
|
217
|
-
source?: never;
|
|
218
|
-
fill?: never;
|
|
219
|
-
};
|
|
220
232
|
declare function displaySelect<const C extends readonly [string, ...string[]]>(cases: C, opts: {
|
|
221
233
|
locked?: boolean;
|
|
222
|
-
|
|
234
|
+
source?: ComputeBinding<C[number]> | DisplayFill;
|
|
235
|
+
}): DisplayEntryInput<C>;
|
|
223
236
|
/**
|
|
224
237
|
* The select slot AND the `meta.display` entry, told apart by the call shape.
|
|
225
238
|
*
|
|
226
239
|
* As a slot: `select({ from })` for a fact-derived vocabulary, `select.of([…])`
|
|
227
|
-
* for a hand-authored one. A top-level select is bound with `source` and
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
*
|
|
240
|
+
* for a hand-authored one. A top-level select is bound with `source` and is never
|
|
241
|
+
* filled. Inside a record item, `select.of` is written one of two ways: by the
|
|
242
|
+
* list's own `fill()`, which keys the ROWS on this field's vocabulary, or — on a
|
|
243
|
+
* row that already exists, a fact-baked comparable say — by its own
|
|
244
|
+
* `source: fill({ brief })`, which picks this one field's key per row in the
|
|
245
|
+
* list's batched call.
|
|
233
246
|
*
|
|
234
|
-
* As a display entry: `select(cases, { source: compute(fn) })` or
|
|
235
|
-
* `select(cases, {
|
|
247
|
+
* As a display entry: `select(cases, { source: compute({ reads }, fn) })` or
|
|
248
|
+
* `select(cases, { source: fill({ brief }) })` declares a `meta.display`
|
|
236
249
|
* `visibility`/`variant` — the first case is the default and the failure
|
|
237
250
|
* posture, `locked: true` opts a variant out of user switching, and the entry
|
|
238
251
|
* takes exactly one origin.
|
|
239
252
|
* @example
|
|
240
253
|
* ```ts
|
|
241
|
-
* import {
|
|
254
|
+
* import { compute, fact, fill, select } from "@homepages/concrete";
|
|
242
255
|
*
|
|
243
256
|
* select.of(["for_sale", "sold"], { label: "Status" });
|
|
244
|
-
* select.of(["regular", "highlight"], { label: "Comparable status",
|
|
245
|
-
* select(["visible", "hidden"], { source: compute((
|
|
246
|
-
* select(["classic", "editorial"], {
|
|
257
|
+
* select.of(["regular", "highlight"], { label: "Comparable status", source: fill({ brief: "Highlight the two or three strongest sales." }) });
|
|
258
|
+
* select(["visible", "hidden"], { source: compute({ reads: [fact.tours] }, (tours) => (tours.length > 0 ? "visible" : "hidden")) });
|
|
259
|
+
* select(["classic", "editorial"], { source: fill({ brief: "Prefer editorial for story-driven narratives." }) });
|
|
247
260
|
* ```
|
|
248
261
|
*/
|
|
249
262
|
declare const select: typeof selectFn & typeof displaySelect & {
|
|
@@ -263,8 +276,8 @@ interface UrlSlotDef extends Head {
|
|
|
263
276
|
* with no provider behind it admits no url at all, which the type cannot say —
|
|
264
277
|
* check time rejects those.
|
|
265
278
|
*
|
|
266
|
-
* Binding-only: no fill
|
|
267
|
-
* `
|
|
279
|
+
* Binding-only: no fill produces a url, so `source` takes a fact, a slot or a
|
|
280
|
+
* `compute()`, never a `fill()`.
|
|
268
281
|
* @example
|
|
269
282
|
* ```ts
|
|
270
283
|
* import { url } from "@homepages/concrete";
|
|
@@ -272,15 +285,15 @@ interface UrlSlotDef extends Head {
|
|
|
272
285
|
* url({ label: "Tour URL", accepts: "tour" });
|
|
273
286
|
* ```
|
|
274
287
|
*/
|
|
275
|
-
declare function url<const HasSource extends
|
|
288
|
+
declare function url<const HasSource extends SourceBinding | undefined = undefined>(opts: UrlOptions & {
|
|
276
289
|
source?: HasSource;
|
|
277
|
-
} & WritebackOption<HasSource>): UrlSlotDef & SourceMark<HasSource>;
|
|
278
|
-
|
|
290
|
+
} & WritebackOption<HasSource> & MirrorOption<HasSource, string | null>): UrlSlotDef & SourceMark<HasSource>;
|
|
291
|
+
/** The fill a single-asset slot takes: one pick out of that type's pool, which may abstain. */
|
|
292
|
+
type AssetFill = FillFor<"none">;
|
|
293
|
+
interface ImageOptions extends CommonOptions<ImageValue | null, AssetFill> {
|
|
279
294
|
crop?: CropConfig;
|
|
280
295
|
sourceFilter?: SourceFilter;
|
|
281
296
|
}
|
|
282
|
-
/** What an `image` slot's `fill:` may hold: a photo pick, or a contact pick of an image field. */
|
|
283
|
-
type ImageFill = BuiltDecision<"image-assign"> | BuiltDecision<"contact-assign">;
|
|
284
297
|
/** The serialized shape the `image` builder emits — an `image`-kind `SlotDef`. */
|
|
285
298
|
interface ImageSlotDef extends Head {
|
|
286
299
|
type: "image";
|
|
@@ -293,8 +306,7 @@ interface ImageSlotDef extends Head {
|
|
|
293
306
|
* contract — the editor's cropper and `<Image>`'s mobile-crop switch read it; the box
|
|
294
307
|
* the image renders in is the section's own classes. `sourceFilter` narrows the
|
|
295
308
|
* candidate pool the editor offers, routing the slot to a dedicated picker.
|
|
296
|
-
* `fill
|
|
297
|
-
* image fields — the alternative to `source`, never its companion.
|
|
309
|
+
* `source: fill({ brief })` picks one of the property's photos.
|
|
298
310
|
* @example
|
|
299
311
|
* ```ts
|
|
300
312
|
* import { image } from "@homepages/concrete";
|
|
@@ -302,12 +314,11 @@ interface ImageSlotDef extends Head {
|
|
|
302
314
|
* image({ label: "Floor plan", sourceFilter: "floorplans" });
|
|
303
315
|
* ```
|
|
304
316
|
*/
|
|
305
|
-
declare function image<const HasSource extends
|
|
317
|
+
declare function image<const HasSource extends SourceBinding | undefined = undefined>(opts: ImageOptions & {
|
|
306
318
|
source?: HasSource;
|
|
307
|
-
|
|
308
|
-
} & WritebackOption<HasSource> & FillOption<HasSource, ImageFill>): ImageSlotDef & SourceMark<HasSource> & FillMark<ImageFill>;
|
|
319
|
+
} & WritebackOption<HasSource> & MirrorOption<HasSource, ImageValue | null>): ImageSlotDef & SourceMark<HasSource> & FillMark;
|
|
309
320
|
type VideoSources = readonly [VideoSource, ...VideoSource[]];
|
|
310
|
-
interface VideoOptions extends CommonOptions<VideoValue | null> {
|
|
321
|
+
interface VideoOptions extends CommonOptions<VideoValue | null, AssetFill> {
|
|
311
322
|
playback?: PlaybackConfig;
|
|
312
323
|
sources?: VideoSources;
|
|
313
324
|
}
|
|
@@ -323,7 +334,7 @@ interface VideoSlotDef extends Head {
|
|
|
323
334
|
* origins the value may come from (`"upload"`, `"link"`); omitted means
|
|
324
335
|
* upload-only. `playback` configures the renderer's `<Video>`; the box it plays
|
|
325
336
|
* in is your own classes.
|
|
326
|
-
* `fill
|
|
337
|
+
* `source: fill({ brief })` picks one of the property's videos.
|
|
327
338
|
* @example
|
|
328
339
|
* ```ts
|
|
329
340
|
* import { video } from "@homepages/concrete";
|
|
@@ -331,11 +342,10 @@ interface VideoSlotDef extends Head {
|
|
|
331
342
|
* video({ label: "Property video", playback: { controls: true }, sources: ["upload", "link"] });
|
|
332
343
|
* ```
|
|
333
344
|
*/
|
|
334
|
-
declare function video<const HasSource extends
|
|
345
|
+
declare function video<const HasSource extends SourceBinding | undefined = undefined>(opts: VideoOptions & {
|
|
335
346
|
source?: HasSource;
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
type TourOptions = CommonOptions<TourValue | null>;
|
|
347
|
+
} & WritebackOption<HasSource> & MirrorOption<HasSource, VideoValue | null>): VideoSlotDef & SourceMark<HasSource> & FillMark;
|
|
348
|
+
type TourOptions = CommonOptions<TourValue | null, AssetFill>;
|
|
339
349
|
/** The serialized shape the `tour` builder emits — a `tour`-kind `SlotDef`. */
|
|
340
350
|
interface TourSlotDef extends Head {
|
|
341
351
|
type: "tour";
|
|
@@ -351,20 +361,19 @@ interface TourSlotDef extends Head {
|
|
|
351
361
|
*
|
|
352
362
|
* Render it with `<Slot.Tour>` for the embed, `<Slot.Image>` for the tour's
|
|
353
363
|
* thumbnail, or both — two positions from one selection.
|
|
354
|
-
* `fill
|
|
364
|
+
* `source: fill({ brief })` picks one of the property's tours.
|
|
355
365
|
* @example
|
|
356
366
|
* ```ts
|
|
357
|
-
* import {
|
|
367
|
+
* import { fill, tour } from "@homepages/concrete";
|
|
358
368
|
*
|
|
359
|
-
* tour({ label: "3D tour",
|
|
369
|
+
* tour({ label: "3D tour", source: fill({ brief: "The whole-home walkthrough, not a single-room scan." }) });
|
|
360
370
|
* ```
|
|
361
371
|
*/
|
|
362
|
-
declare function tour<const HasSource extends
|
|
372
|
+
declare function tour<const HasSource extends SourceBinding | undefined = undefined>(opts: TourOptions & {
|
|
363
373
|
source?: HasSource;
|
|
364
|
-
|
|
365
|
-
} & WritebackOption<HasSource> & FillOption<HasSource, BuiltDecision<"tour-assign">>): TourSlotDef & SourceMark<HasSource> & FillMark<BuiltDecision<"tour-assign">>;
|
|
374
|
+
} & WritebackOption<HasSource> & MirrorOption<HasSource, TourValue | null>): TourSlotDef & SourceMark<HasSource> & FillMark;
|
|
366
375
|
type StripHead<E> = Omit<E, "locked">;
|
|
367
|
-
interface ListOptions<E> extends CommonOptions<NonNullable<SlotValue<E>>[]
|
|
376
|
+
interface ListOptions<E> extends CommonOptions<NonNullable<SlotValue<E>>[], ListFillFor<E>> {
|
|
368
377
|
min?: number;
|
|
369
378
|
max?: number;
|
|
370
379
|
unique?: boolean;
|
|
@@ -388,12 +397,12 @@ interface ListSlotDef<E> extends Head {
|
|
|
388
397
|
unique?: boolean;
|
|
389
398
|
}
|
|
390
399
|
type ListFillFor<E> = E extends {
|
|
391
|
-
type:
|
|
392
|
-
} ?
|
|
393
|
-
type
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
interface ListRecordOptions<I extends Record<string, ListFieldSlot>> extends CommonOptions<RowValue<I>[]> {
|
|
400
|
+
type: "text";
|
|
401
|
+
} ? FillFor<"count" | "cap" | "none"> : E extends {
|
|
402
|
+
type: "poi";
|
|
403
|
+
} ? FillFor<"count"> : FillFor<"count" | "none">;
|
|
404
|
+
type ListRecordFill = FillFor<"count" | "none">;
|
|
405
|
+
interface ListRecordOptions<I extends Record<string, ListFieldSlot>> extends CommonOptions<RowValue<I>[], ListRecordFill> {
|
|
397
406
|
min?: number;
|
|
398
407
|
max?: number;
|
|
399
408
|
layout?: readonly LayoutRow<keyof I & string>[];
|
|
@@ -414,14 +423,12 @@ interface ListRecordSlotDef<I extends Record<string, ListFieldSlot>> extends Hea
|
|
|
414
423
|
min?: number;
|
|
415
424
|
max?: number;
|
|
416
425
|
}
|
|
417
|
-
declare function listOfElement<const E extends ListItemSlot, const HasSource extends
|
|
426
|
+
declare function listOfElement<const E extends ListItemSlot, const HasSource extends SourceBinding | undefined = undefined>(element: E, opts: ListOptions<E> & {
|
|
418
427
|
source?: HasSource;
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
declare function listOfRecord<const I extends Record<string, ListFieldSlot>, const HasSource extends SlotSource | ComputeBinding<unknown> | undefined = undefined>(fields: I, opts: ListRecordOptions<I> & {
|
|
428
|
+
} & WritebackOption<HasSource> & MirrorOption<HasSource, NonNullable<SlotValue<E>>[]>): ListSlotDef<StripHead<E>> & SourceMark<HasSource> & FillMark;
|
|
429
|
+
declare function listOfRecord<const I extends Record<string, ListFieldSlot>, const HasSource extends SourceBinding | undefined = undefined>(fields: I, opts: ListRecordOptions<I> & {
|
|
422
430
|
source?: HasSource;
|
|
423
|
-
|
|
424
|
-
} & WritebackOption<HasSource> & FillOption<HasSource, ListRecordFillFor<I>>): ListRecordSlotDef<I> & SourceMark<HasSource> & FillMark<ListRecordFillFor<I>>;
|
|
431
|
+
} & WritebackOption<HasSource> & MirrorOption<HasSource, RowValue<I>[]>): ListRecordSlotDef<I> & SourceMark<HasSource> & FillMark;
|
|
425
432
|
/**
|
|
426
433
|
* The list slot — one primitive for everything multi-item. The item is a
|
|
427
434
|
* single slot (`list.of(text.short({ label: "Feature", cap: 80 }), { label: "Features" })`,
|
|
@@ -466,7 +473,7 @@ interface DocumentOptions {
|
|
|
466
473
|
locked?: boolean;
|
|
467
474
|
placeholder?: string;
|
|
468
475
|
when?: string | readonly string[];
|
|
469
|
-
|
|
476
|
+
source?: AssetFill;
|
|
470
477
|
}
|
|
471
478
|
/** The serialized shape the `document` builder emits — a `document`-kind `SlotDef`. */
|
|
472
479
|
interface DocumentSlotDef extends Head {
|
|
@@ -481,17 +488,21 @@ interface DocumentSlotDef extends Head {
|
|
|
481
488
|
* Reach for `url({ accepts: "file" })` instead when the file lives somewhere
|
|
482
489
|
* else — a Drive or Dropbox link the platform neither stores nor serves.
|
|
483
490
|
*
|
|
484
|
-
* `fill
|
|
485
|
-
*
|
|
486
|
-
*
|
|
487
|
-
*
|
|
491
|
+
* `source: fill({ brief })` picks one file out of the documents stored on the
|
|
492
|
+
* property. The model sees each candidate's filename, file type, and whatever text
|
|
493
|
+
* was distilled out of it (a spreadsheet or slide deck carries none, so name the
|
|
494
|
+
* file type when it matters). Usable standalone or as a list item — a
|
|
495
|
+
* `list.of(document(...))` carries its own fill and picks a SET from the same pool.
|
|
488
496
|
* @example
|
|
489
497
|
* ```ts
|
|
490
|
-
* import { document,
|
|
498
|
+
* import { document, fill } from "@homepages/concrete";
|
|
491
499
|
*
|
|
492
|
-
* document({
|
|
500
|
+
* document({
|
|
501
|
+
* label: "Offering brochure",
|
|
502
|
+
* source: fill({ brief: "The offering brochure: a multi-page PDF about the whole property, not a single-unit floor plan." }),
|
|
503
|
+
* });
|
|
493
504
|
* ```
|
|
494
505
|
*/
|
|
495
|
-
declare function document(opts: DocumentOptions): DocumentSlotDef & FillMark
|
|
506
|
+
declare function document(opts: DocumentOptions): DocumentSlotDef & FillMark;
|
|
496
507
|
//#endregion
|
|
497
|
-
export { CropConfig, DisplayEntryInput, DocumentSlotDef, ImageSlotDef, ListRecordSlotDef, ListSlotDef, NumberSlotDef, PoiSlotDef, SelectOptionInput, SelectSlotDef, SlotSource, SourceMark, TextSlotDef, TourSlotDef, UrlSlotDef, VideoSlotDef, WritebackOption, document, image, list, number, poi, select, text, tour, url, video };
|
|
508
|
+
export { CropConfig, DisplayEntryInput, DisplayFill, DocumentSlotDef, ImageSlotDef, ListRecordSlotDef, ListSlotDef, MirrorOption, MirrorSource, NumberSlotDef, PoiSlotDef, SelectOptionInput, SelectSlotDef, SlotSource, SourceBinding, SourceMark, TextSlotDef, TourSlotDef, UrlSlotDef, VideoSlotDef, WritebackOption, document, image, list, number, poi, select, text, tour, url, video };
|