@homepages/concrete 4.0.0 → 6.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 +359 -0
- package/README.md +28 -17
- package/codemods/fill-is-a-source.mjs +533 -0
- package/codemods/manifest.json +18 -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 -13
- 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 +22 -36
- 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 +5 -30
- 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 +62 -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.d.ts +3 -2
- 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 +33 -18
- 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/runtime-values.d.ts +6 -18
- package/dist/schema/section-nav.js +0 -15
- package/dist/schema/section-props.d.ts +7 -9
- 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
|
@@ -1,387 +1,112 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { IterableFactsField } from "../packages/internal/fill-vocabulary/dist/facts.js";
|
|
3
|
-
import { TextStructure } from "./fill-spec.js";
|
|
4
|
-
import { Readable } from "./fill-declaration.js";
|
|
1
|
+
import { Ref } from "./slot-ref.js";
|
|
5
2
|
//#region src/schema/fill-builders.d.ts
|
|
6
3
|
/**
|
|
7
|
-
*
|
|
8
|
-
* when producing nothing is the right answer for this decision, and the model is
|
|
9
|
-
* handed it as the criterion beside the rest of the brief (interpolated against
|
|
10
|
-
* the facts slice exactly as `pick` and `content` are). Presence is what enables
|
|
11
|
-
* abstention — there is no boolean form, because enabling it without stating the
|
|
12
|
-
* bar would give the model an unguided way out — and absence means the decision
|
|
13
|
-
* must produce a value.
|
|
4
|
+
* How many items a list fill produces.
|
|
14
5
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
6
|
+
* - `N` — exactly N. A closed candidate set (a photo pool, a vocabulary) clamps N
|
|
7
|
+
* to what it holds.
|
|
8
|
+
* - `{ max }` — as many as the brief admits, up to `max`.
|
|
9
|
+
* - `{ min, max }` — the same, with `min` as a target the platform retries toward.
|
|
10
|
+
* An answer still short of it is kept, never padded.
|
|
11
|
+
*
|
|
12
|
+
* Omit it and the slot's own `max` bounds the list (else the candidate supply).
|
|
13
|
+
* Zero is reachable only through `none`.
|
|
21
14
|
*/
|
|
22
|
-
|
|
15
|
+
type FillCount = number | {
|
|
16
|
+
readonly max: number;
|
|
17
|
+
} | {
|
|
18
|
+
readonly min: number;
|
|
19
|
+
readonly max: number;
|
|
20
|
+
};
|
|
21
|
+
/** The enforced options a fill may carry beside its brief, by name. */
|
|
22
|
+
interface FillOptionTypes {
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
24
|
+
* `true` admits the empty answer (`""`, `null`, `[]`); omit it and an empty answer
|
|
25
|
+
* is a defect the platform retries. The switch only — the brief's last sentence
|
|
26
|
+
* says when nothing is the right answer.
|
|
26
27
|
*/
|
|
27
|
-
none
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
* The refusal the pool-only assigns carry: their executors are handed the
|
|
31
|
-
* candidate pool and never the fact slice, so a `reads` there would widen
|
|
32
|
-
* nothing — `never` keeps even a hoisted options object from declaring one.
|
|
33
|
-
*/
|
|
34
|
-
interface ReadsNothing {
|
|
35
|
-
reads?: never;
|
|
36
|
-
}
|
|
37
|
-
/** The serialized decision type discriminant a builder is legal for (its phantom marker). */
|
|
38
|
-
type DecisionKind = "image-assign" | "video-assign" | "tour-assign" | "document-assign" | "contact-assign" | "text-block" | "list-fill" | "select-assign";
|
|
39
|
-
/**
|
|
40
|
-
* A fill builder's output: the serialized decision object minus `id`/`produces`
|
|
41
|
-
* (which extraction supplies from the slot key), tagged with a compile-time-only
|
|
42
|
-
* `__kind` marker so a slot builder's `fill:` parameter can check the decision
|
|
43
|
-
* against that slot's kind. `__kind` never appears at runtime — only `type` and
|
|
44
|
-
* the decision's own fields do.
|
|
45
|
-
*/
|
|
46
|
-
type BuiltDecision<K extends DecisionKind> = Record<string, unknown> & {
|
|
47
|
-
type: K;
|
|
48
|
-
__kind?: K;
|
|
49
|
-
};
|
|
50
|
-
interface ListFillInput extends Abstainable, Readable {
|
|
28
|
+
none: true;
|
|
29
|
+
/** How many items a list produces — see `FillCount`. */
|
|
30
|
+
count: FillCount;
|
|
51
31
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* where it generates (scalar text items), `{ max }` alone where the platform
|
|
55
|
-
* curates (places). Omit it and the slot's own `min`/`max` bounds govern.
|
|
56
|
-
*
|
|
57
|
-
* On a GENERATED list the two spellings differ in who decides the length: `6`
|
|
58
|
-
* asks for exactly six, and `{ min: 6, max: 8 }` bounds the answer while
|
|
59
|
-
* leaving the count to the material — which is what you want wherever a thin
|
|
60
|
-
* subject would otherwise be padded to the number with invented entries.
|
|
32
|
+
* A character budget STRICTLY below the slot's own `cap` (for a list of text,
|
|
33
|
+
* below its item's). Omit it and the model writes to the slot's cap.
|
|
61
34
|
*/
|
|
62
|
-
|
|
63
|
-
min?: number;
|
|
64
|
-
max?: number;
|
|
65
|
-
};
|
|
66
|
-
/** The selection brief — which items belong, most clearly supported first. */
|
|
67
|
-
pick?: string;
|
|
68
|
-
/** Sequence the WHOLE media pool as a room-by-room tour instead of picking a subset. */
|
|
69
|
-
order?: "walkthrough";
|
|
70
|
-
/** Per-item character budget, only to ask for STRICTLY SHORTER items than the element holds. */
|
|
71
|
-
cap?: number;
|
|
72
|
-
/** The shape of each generated item (`"Title Case"`, `"short noun phrases"`, …). */
|
|
73
|
-
structureHint?: string;
|
|
74
|
-
/** Tone/style brief for generated items. */
|
|
75
|
-
voice?: string;
|
|
76
|
-
/** Additional generation prompt. */
|
|
77
|
-
content?: string;
|
|
35
|
+
cap: number;
|
|
78
36
|
}
|
|
37
|
+
/** The name of an enforced fill option — what a slot kind admits a subset of. */
|
|
38
|
+
type FillOptionName = keyof FillOptionTypes;
|
|
79
39
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* declaration seats each row field's own `fill:` beside it.
|
|
85
|
-
* @example
|
|
86
|
-
* ```ts
|
|
87
|
-
* import { listFill } from "@homepages/concrete";
|
|
88
|
-
*
|
|
89
|
-
* // On list.of(text.short({ cap: 80 })) — generates six short items.
|
|
90
|
-
* listFill({ count: 6, structureHint: "Short noun phrases.", voice: "Concrete.", content: "Six highlights." });
|
|
91
|
-
*
|
|
92
|
-
* // The same list, bounded rather than fixed: six to eight, the model's call.
|
|
93
|
-
* listFill({ count: { min: 6, max: 8 }, structureHint: "Short noun phrases.", content: "The features this unit really has." });
|
|
94
|
-
*
|
|
95
|
-
* // On list.of(image()) — picks and orders from the property's photos.
|
|
96
|
-
* listFill({ count: { min: 3, max: 8 }, pick: "The strongest set." });
|
|
97
|
-
*
|
|
98
|
-
* // On a row's list.of(document()) — files a subset of the property's documents
|
|
99
|
-
* // into each row; a document lands in at most one row, and the section's
|
|
100
|
-
* // later list fills draw from what remains.
|
|
101
|
-
* listFill({ count: { min: 1, max: 8 }, pick: "The files that belong in this folder." });
|
|
102
|
-
* ```
|
|
40
|
+
* What `fill()` takes on a slot that admits the options `Legal`: the brief and
|
|
41
|
+
* `reads` everywhere, each `Legal` option optionally, and every other option
|
|
42
|
+
* refused (`?: never`) so a hoisted options object is refused too — not only a
|
|
43
|
+
* literal's excess key.
|
|
103
44
|
*/
|
|
104
|
-
|
|
105
|
-
interface ImageAssignInput extends Abstainable, ReadsNothing {
|
|
106
|
-
pick: string;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* A photo pick that chains a contact pick behind it. `fallback` runs on the same
|
|
110
|
-
* slot when the photo pool yields nothing — the model abstained under `none`, or
|
|
111
|
-
* the property has no photos — so `none` is required beside it: without a bar to
|
|
112
|
-
* abstain against, the chain could only ever reach the fallback on an empty pool.
|
|
113
|
-
*/
|
|
114
|
-
interface ImageAssignWithFallbackInput extends ImageAssignInput {
|
|
115
|
-
none: string;
|
|
116
|
-
/** The contact pick that fills the slot when no photo does — `contactAssign({ pick, field })` with an image `field`. */
|
|
117
|
-
fallback: BuiltDecision<"contact-assign">;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Fills a single `image` slot by having the model choose one photo from the
|
|
121
|
-
* property's full pool. `pick` is the selection-brief prose. This builder always
|
|
122
|
-
* emits the prompt-driven form (`pick`) — it has no fact-seeded
|
|
123
|
-
* counterpart.
|
|
124
|
-
*
|
|
125
|
-
* A `fallback` chains a `contactAssign` behind the photo pick: when the photo
|
|
126
|
-
* pool yields nothing — the model abstained under `none`, or the property has no
|
|
127
|
-
* photos — the contact pick fills the same slot with the chosen card's logo or
|
|
128
|
-
* headshot. That is how a slot prefers a mark the property uploaded and still
|
|
129
|
-
* lands on a contact's when none was.
|
|
130
|
-
* @example
|
|
131
|
-
* ```ts
|
|
132
|
-
* import { contactAssign, imageAssign } from "@homepages/concrete";
|
|
133
|
-
*
|
|
134
|
-
* imageAssign({ pick: "Pick the striking exterior." });
|
|
135
|
-
*
|
|
136
|
-
* // The builder's own mark from the uploads; else the developer's card, else the primary's.
|
|
137
|
-
* imageAssign({
|
|
138
|
-
* pick: "The builder's or developer's own mark among the uploads.",
|
|
139
|
-
* none: "No upload is a builder's mark.",
|
|
140
|
-
* fallback: contactAssign({ pick: "The developer or builder; else the primary contact.", field: "logo_dark" }),
|
|
141
|
-
* });
|
|
142
|
-
* ```
|
|
143
|
-
*/
|
|
144
|
-
declare function imageAssign(i: ImageAssignInput | ImageAssignWithFallbackInput): BuiltDecision<"image-assign">;
|
|
145
|
-
interface VideoAssignInput extends Abstainable, ReadsNothing {
|
|
146
|
-
pick: string;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Fills a single `video` slot by having the model choose one clip from the
|
|
150
|
-
* property's video pool. `pick` is the selection-brief prose. Unlike
|
|
151
|
-
* `imageAssign`, there is no fact-seeded mode — a video only ever reaches a
|
|
152
|
-
* slot by selection.
|
|
153
|
-
*/
|
|
154
|
-
declare function videoAssign(i: VideoAssignInput): BuiltDecision<"video-assign">;
|
|
155
|
-
interface TourAssignInput extends Abstainable, ReadsNothing {
|
|
156
|
-
pick: string;
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Fills a single `tour` slot by having the model choose one 3D tour from the
|
|
160
|
-
* property's tour pool. `pick` is the selection-brief prose. Like `videoAssign`
|
|
161
|
-
* there is no fact-seeded mode — a tour only ever reaches a slot by selection —
|
|
162
|
-
* and the candidates the model sees are the property's tour links, never its
|
|
163
|
-
* videos: the pool is named by the decision type, not by a parameter.
|
|
164
|
-
* @example
|
|
165
|
-
* ```ts
|
|
166
|
-
* import { tourAssign } from "@homepages/concrete";
|
|
167
|
-
*
|
|
168
|
-
* tourAssign({ pick: "The whole-home walkthrough, not a single-room scan." });
|
|
169
|
-
* ```
|
|
170
|
-
*/
|
|
171
|
-
declare function tourAssign(i: TourAssignInput): BuiltDecision<"tour-assign">;
|
|
172
|
-
interface DocumentAssignInput extends Abstainable, ReadsNothing {
|
|
173
|
-
pick: string;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Fills a single `document` slot by having the model choose one file from the
|
|
177
|
-
* documents stored on the property. `pick` is the selection-brief prose — and it
|
|
178
|
-
* is the whole brief, so write it against what a document IS: the model sees each
|
|
179
|
-
* candidate's filename, file type, and whatever text was distilled out of it (a
|
|
180
|
-
* spreadsheet or slide deck carries none, so name the file type when it matters).
|
|
181
|
-
* @example
|
|
182
|
-
* ```ts
|
|
183
|
-
* import { documentAssign } from "@homepages/concrete";
|
|
184
|
-
*
|
|
185
|
-
* documentAssign({ pick: "The offering brochure — a multi-page PDF about the whole property, not a single-unit floor plan." });
|
|
186
|
-
* ```
|
|
187
|
-
*/
|
|
188
|
-
declare function documentAssign(i: DocumentAssignInput): BuiltDecision<"document-assign">;
|
|
189
|
-
interface ContactAssignInput extends Abstainable, ReadsNothing {
|
|
190
|
-
/** The selection brief — which attached contact the slot is about, and what to do when none fits. */
|
|
191
|
-
pick: string;
|
|
192
|
-
/** The referral field of the chosen card the slot bakes — an image field (`logo_dark`, `headshot`, …) on an `image` slot, a scalar (`name`, `org_name`, …) on a `text` slot. */
|
|
193
|
-
field: ReferralField;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Fills a single `image` or `text` slot from ONE of the property's attached
|
|
197
|
-
* contacts, chosen by the model against `pick`. The property's contact cards
|
|
198
|
-
* are the candidates (name, title, organisation, and which one is primary); the
|
|
199
|
-
* chosen card's `field` is what the slot receives — so the same decision puts a
|
|
200
|
-
* developer's logo on an `image` slot or a builder's name on a `text` slot.
|
|
201
|
-
* Write the brief against what a card SHOWS: a card carries no role, so "the
|
|
202
|
-
* developer" is read off its title and organisation. Say what to do when no
|
|
203
|
-
* card fits ("else the primary contact"); with exactly one card, or none, no
|
|
204
|
-
* model call is made.
|
|
205
|
-
* @example
|
|
206
|
-
* ```ts
|
|
207
|
-
* import { contactAssign } from "@homepages/concrete";
|
|
208
|
-
*
|
|
209
|
-
* contactAssign({ pick: "The developer or builder of the property; else the primary contact.", field: "logo_dark" });
|
|
210
|
-
* ```
|
|
211
|
-
*/
|
|
212
|
-
declare function contactAssign(i: ContactAssignInput): BuiltDecision<"contact-assign">;
|
|
213
|
-
interface TextBlockInput extends Abstainable, Readable {
|
|
214
|
-
cap?: number;
|
|
215
|
-
structure: TextStructure;
|
|
216
|
-
perspective: "first" | "second" | "third";
|
|
217
|
-
voice: string;
|
|
218
|
-
content?: string;
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Fills a `text` slot with model-generated prose. `structure` is the prose
|
|
222
|
-
* shape to generate. `perspective` is the required grammatical person the copy
|
|
223
|
-
* is written in — there is no omitted mode, so a reader never has to know a
|
|
224
|
-
* default. `voice` is the required tone/style brief; `content` is an optional
|
|
225
|
-
* additional prompt.
|
|
226
|
-
*
|
|
227
|
-
* The character budget lives on the slot: omit `cap` and the executor writes to
|
|
228
|
-
* the slot's own `cap`. State one here only to ask the model for a STRICTLY
|
|
229
|
-
* SHORTER piece than the slot holds — a cap at or above the slot's is rejected
|
|
230
|
-
* at validation, as a restatement and a silent trim respectively.
|
|
231
|
-
*
|
|
232
|
-
* `reads` puts facts beyond the slice's standing contents in front of the model
|
|
233
|
-
* for THIS brief — `reads: ["photos"]` when the copy describes what the photos
|
|
234
|
-
* show. The section's `reads` is the union over its decisions.
|
|
235
|
-
* @example
|
|
236
|
-
* ```ts
|
|
237
|
-
* import { textBlock } from "@homepages/concrete";
|
|
238
|
-
*
|
|
239
|
-
* // The slot declares the budget: text.medium({ cap: 60, label: "Headline" })
|
|
240
|
-
* textBlock({
|
|
241
|
-
* structure: "single_sentence",
|
|
242
|
-
* perspective: "third",
|
|
243
|
-
* voice: "Confident premium-listing voice.",
|
|
244
|
-
* content: "Write a marketing headline.",
|
|
245
|
-
* });
|
|
246
|
-
* ```
|
|
247
|
-
*/
|
|
248
|
-
declare function textBlock(i: TextBlockInput): BuiltDecision<"text-block">;
|
|
249
|
-
/**
|
|
250
|
-
* Rows the model originates by picking from the row's own select vocabulary —
|
|
251
|
-
* what `chooseFrom` returns, and the one thing a record list slot's own
|
|
252
|
-
* `fill:` may hold.
|
|
253
|
-
*/
|
|
254
|
-
interface ChosenRows {
|
|
255
|
-
mode: "choose";
|
|
256
|
-
count: {
|
|
257
|
-
min: number;
|
|
258
|
-
max: number;
|
|
259
|
-
};
|
|
260
|
-
pick: string;
|
|
45
|
+
type FillInput<Legal extends FillOptionName = FillOptionName> = {
|
|
261
46
|
/**
|
|
262
|
-
* The
|
|
263
|
-
*
|
|
47
|
+
* The whole instruction, in prose: what to write or pick, its shape, its tone,
|
|
48
|
+
* and anything else the model should know. The one prose key a fill has.
|
|
264
49
|
*/
|
|
265
|
-
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* Rows the model originates by WRITING each row's name — what `nameRows`
|
|
269
|
-
* returns. The counted sibling of `ChosenRows`: identical machinery, an open
|
|
270
|
-
* vocabulary instead of a closed one.
|
|
271
|
-
*/
|
|
272
|
-
interface NamedRows {
|
|
273
|
-
mode: "name";
|
|
274
|
-
count: {
|
|
275
|
-
min: number;
|
|
276
|
-
max: number;
|
|
277
|
-
};
|
|
278
|
-
pick: string;
|
|
279
|
-
/** The shape of a written name (`"Title Case"`, `"short noun phrases"`, …). */
|
|
280
|
-
structureHint?: string;
|
|
50
|
+
readonly brief: string;
|
|
281
51
|
/**
|
|
282
|
-
*
|
|
283
|
-
*
|
|
52
|
+
* Exactly what the model sees beside the brief: fact refs (`fact.property.address`,
|
|
53
|
+
* `fact.description`) and slot refs of other sections (`Hero.slots.headline`).
|
|
54
|
+
* A pick's candidates come from the slot's own pool and need no read.
|
|
284
55
|
*/
|
|
285
|
-
|
|
286
|
-
}
|
|
287
|
-
/**
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
*
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
* `
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
* answer, which is the same blank the editor shows. The overloads keep the two
|
|
317
|
-
* apart: a record list's `fill:` takes only the counted form, and only that
|
|
318
|
-
* form abstains.
|
|
319
|
-
*/
|
|
320
|
-
declare function chooseFrom(i: {
|
|
321
|
-
count: {
|
|
322
|
-
min: number;
|
|
323
|
-
max: number;
|
|
324
|
-
};
|
|
325
|
-
pick: string;
|
|
326
|
-
none?: string;
|
|
327
|
-
} & Readable): ChosenRows;
|
|
328
|
-
declare function chooseFrom(i: {
|
|
329
|
-
pick: string;
|
|
330
|
-
count?: never;
|
|
331
|
-
none?: never;
|
|
332
|
-
} & Readable): DisplayChoice;
|
|
333
|
-
/**
|
|
334
|
-
* Rows the model originates by NAMING each one — `count.min`..`count.max` of
|
|
335
|
-
* them, steered by `pick` prose. `chooseFrom`'s sibling for the case where no
|
|
336
|
-
* closed vocabulary can be written down in advance: a document library's
|
|
337
|
-
* folders are named for the files a particular property happens to carry, so a
|
|
338
|
-
* fixed list either misses the name that fits or offers names nothing fills.
|
|
339
|
-
*
|
|
340
|
-
* WHICH FIELD the name lands in is not authored — the list's own `title:`
|
|
341
|
-
* already names the field the editor titles a row with, and that is the field
|
|
342
|
-
* the model writes. Its `cap` is the name's character budget, for the same
|
|
343
|
-
* reason: it is already declared. Extraction rejects a slot whose `title:` is
|
|
344
|
-
* absent or names a field that is not `text`, and a titled field that declares
|
|
345
|
-
* a `fill:` of its own: the model writes that field, so state the name's shape
|
|
346
|
-
* in `structureHint` instead.
|
|
347
|
-
*
|
|
348
|
-
* Rows are deduped case-insensitively (first wins) and capped at `count.max`.
|
|
349
|
-
* There is no top-up to `count.min` the way `chooseFrom` has one: a closed
|
|
350
|
-
* vocabulary has unused keys to fall back on, an open one has nothing.
|
|
56
|
+
readonly reads?: readonly Ref[];
|
|
57
|
+
} & { readonly [K in Legal]?: FillOptionTypes[K]; } & { readonly [K in Exclude<FillOptionName, Legal>]?: never; };
|
|
58
|
+
/**
|
|
59
|
+
* A fill as a slot's `source:` holds it — what `fill()` returns. `O` is the input
|
|
60
|
+
* as written, which is what lets a slot builder refuse an option its kind cannot
|
|
61
|
+
* enforce.
|
|
62
|
+
*/
|
|
63
|
+
type FillBinding<O extends FillInput = FillInput> = {
|
|
64
|
+
readonly kind: "fill";
|
|
65
|
+
} & O;
|
|
66
|
+
/** The fill a slot kind admitting the options `Legal` takes as its `source:`. */
|
|
67
|
+
type FillFor<Legal extends FillOptionName> = FillBinding<FillInput<Legal>>;
|
|
68
|
+
type NoOtherKeys<O> = { [K in Exclude<keyof O, keyof FillInput>]: never; };
|
|
69
|
+
/**
|
|
70
|
+
* The model produces this slot's value, once, from `brief` and exactly the refs in
|
|
71
|
+
* `reads`. What it does is the slot's own fact — a `text` slot is written, an
|
|
72
|
+
* `image` picked from the property's photos, a `list.of(image())` a subset of them,
|
|
73
|
+
* a record list keyed by its `title:` field originated row by row — so one builder
|
|
74
|
+
* serves every slot, and only the options differ:
|
|
75
|
+
*
|
|
76
|
+
* | Option | Legal on |
|
|
77
|
+
* |---|---|
|
|
78
|
+
* | `brief` (required) | every fill |
|
|
79
|
+
* | `reads` | every fill |
|
|
80
|
+
* | `none` | every producing slot, except a list of places and a display entry |
|
|
81
|
+
* | `count` | lists |
|
|
82
|
+
* | `cap` | `text`, and a list of `text` |
|
|
83
|
+
*
|
|
84
|
+
* An option on a slot that cannot enforce it does not compile. A filled slot is
|
|
85
|
+
* the user's once filled: nothing re-fills it when a fact changes, unlike a bound
|
|
86
|
+
* or computed slot.
|
|
351
87
|
* @example
|
|
352
88
|
* ```ts
|
|
353
|
-
* import {
|
|
89
|
+
* import { fact, fill, image, list, text } from "@homepages/concrete";
|
|
90
|
+
*
|
|
91
|
+
* text.medium({
|
|
92
|
+
* label: "Headline",
|
|
93
|
+
* cap: 60,
|
|
94
|
+
* source: fill({
|
|
95
|
+
* reads: [fact.property.address, fact.description],
|
|
96
|
+
* brief: "A marketing headline. Confident, no exclamation marks.",
|
|
97
|
+
* }),
|
|
98
|
+
* });
|
|
354
99
|
*
|
|
355
|
-
* list.of(
|
|
356
|
-
*
|
|
357
|
-
*
|
|
358
|
-
*
|
|
359
|
-
*
|
|
360
|
-
*
|
|
361
|
-
*
|
|
362
|
-
*
|
|
363
|
-
* },
|
|
364
|
-
* {
|
|
365
|
-
* label: "Document folders",
|
|
366
|
-
* title: "folder_name",
|
|
367
|
-
* max: 6,
|
|
368
|
-
* fill: nameRows({
|
|
369
|
-
* count: { min: 0, max: 4 },
|
|
370
|
-
* pick: "Name a folder only where several files plainly group under one heading.",
|
|
371
|
-
* structureHint: "Title Case.",
|
|
372
|
-
* }),
|
|
373
|
-
* },
|
|
374
|
-
* );
|
|
100
|
+
* list.of(image({ label: "Photo" }), {
|
|
101
|
+
* label: "Gallery",
|
|
102
|
+
* max: 8,
|
|
103
|
+
* source: fill({
|
|
104
|
+
* brief: "Every photograph of the property, ordered as a walk through it. Drop anything that is not a photograph of the property; when nothing is, produce nothing.",
|
|
105
|
+
* none: true,
|
|
106
|
+
* }),
|
|
107
|
+
* });
|
|
375
108
|
* ```
|
|
376
109
|
*/
|
|
377
|
-
declare function
|
|
378
|
-
count: {
|
|
379
|
-
min: number;
|
|
380
|
-
max: number;
|
|
381
|
-
};
|
|
382
|
-
pick: string;
|
|
383
|
-
structureHint?: string;
|
|
384
|
-
none?: string;
|
|
385
|
-
} & Readable): NamedRows;
|
|
110
|
+
declare function fill<const O extends FillInput>(options: O & NoOtherKeys<O>): FillBinding<O>;
|
|
386
111
|
//#endregion
|
|
387
|
-
export {
|
|
112
|
+
export { FillBinding, FillCount, FillFor, FillInput, FillOptionName, fill };
|