@homepages/concrete 1.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 +59 -0
- package/README.md +174 -0
- package/codemods/manifest.json +9 -0
- package/dist/artifact/playground/client/assets/index-BSA1yutg.css +1 -0
- package/dist/artifact/playground/client/assets/index-JloQyj8h.js +1101 -0
- package/dist/artifact/playground/client/index.html +13 -0
- package/dist/artifact/playground/client/island-canvas-host.mjs +1 -0
- package/dist/artifact/playground/host.mjs +127 -0
- package/dist/asset-modules.d.ts +99 -0
- package/dist/base.css +220 -0
- package/dist/browser/site-config.d.ts +18 -0
- package/dist/browser/site-config.js +56 -0
- package/dist/browser/submit-lead.d.ts +98 -0
- package/dist/browser/submit-lead.js +188 -0
- package/dist/browser.d.ts +3 -0
- package/dist/browser.js +4 -0
- package/dist/cli/build/artifact.js +225 -0
- package/dist/cli/build/captures.js +67 -0
- package/dist/cli/build/esbuild.js +127 -0
- package/dist/cli/build/fixtures.js +96 -0
- package/dist/cli/build/icons.js +76 -0
- package/dist/cli/build/index.js +38 -0
- package/dist/cli/build/playground.js +31 -0
- package/dist/cli/build/sections.js +236 -0
- package/dist/cli/build/source.js +62 -0
- package/dist/cli/build/static.js +156 -0
- package/dist/cli/capture/bundle.js +37 -0
- package/dist/cli/capture/capture-browser.js +51 -0
- package/dist/cli/capture/capture.js +121 -0
- package/dist/cli/check/analyze.js +95 -0
- package/dist/cli/check/index.js +19 -0
- package/dist/cli/check/load-workspace.js +119 -0
- package/dist/cli/check/messages.js +16 -0
- package/dist/cli/check/render/class-conflicts.js +39 -0
- package/dist/cli/check/render/html.js +86 -0
- package/dist/cli/check/render/inputs.js +53 -0
- package/dist/cli/check/render/invariants.js +58 -0
- package/dist/cli/check/render/island-frames.js +72 -0
- package/dist/cli/check/render/marker-coverage.js +102 -0
- package/dist/cli/check/render/nav.js +64 -0
- package/dist/cli/check/report.js +73 -0
- package/dist/cli/check/stages/bundles.js +129 -0
- package/dist/cli/check/stages/composition.js +67 -0
- package/dist/cli/check/stages/contracts.js +22 -0
- package/dist/cli/check/stages/dependencies.js +261 -0
- package/dist/cli/check/stages/fixtures.js +74 -0
- package/dist/cli/check/stages/lint.js +41 -0
- package/dist/cli/check/stages/logic.js +63 -0
- package/dist/cli/check/stages/render.js +144 -0
- package/dist/cli/check/stages/sections.js +83 -0
- package/dist/cli/check/stages/stylesheet.js +31 -0
- package/dist/cli/check/stages/typecheck.js +68 -0
- package/dist/cli/check/stages/workspace.js +26 -0
- package/dist/cli/commands.js +342 -0
- package/dist/cli/currency/cache.js +89 -0
- package/dist/cli/currency/decide.js +65 -0
- package/dist/cli/currency/opt-out.js +16 -0
- package/dist/cli/currency/preamble.js +183 -0
- package/dist/cli/currency/prompt.js +28 -0
- package/dist/cli/currency/refresh.js +44 -0
- package/dist/cli/currency/resolve-latest.js +185 -0
- package/dist/cli/currency/version-order.js +38 -0
- package/dist/cli/dev/crop.js +22 -0
- package/dist/cli/dev/hmr.js +26 -0
- package/dist/cli/dev/http.js +129 -0
- package/dist/cli/dev/index.js +70 -0
- package/dist/cli/dev/islands.js +390 -0
- package/dist/cli/dev/load-template.js +46 -0
- package/dist/cli/dev/request-error.js +22 -0
- package/dist/cli/dev/server.js +307 -0
- package/dist/cli/dev/tsconfig-paths.js +95 -0
- package/dist/cli/dev/vite.js +85 -0
- package/dist/cli/dev/workspace-reader.js +274 -0
- package/dist/cli/io.d.ts +14 -0
- package/dist/cli/media/cache.js +125 -0
- package/dist/cli/media/derive.js +252 -0
- package/dist/cli/media/deriver-plugin.js +71 -0
- package/dist/cli/property/index.js +180 -0
- package/dist/cli/property/library.js +137 -0
- package/dist/cli/publish/client.js +119 -0
- package/dist/cli/publish/freshness.js +66 -0
- package/dist/cli/publish/git.js +43 -0
- package/dist/cli/publish/index.js +207 -0
- package/dist/cli/publish/pack.js +78 -0
- package/dist/cli/publish/report.js +98 -0
- package/dist/cli/publish/target.js +87 -0
- package/dist/cli/publish/wire.js +29 -0
- package/dist/cli/tar.js +87 -0
- package/dist/cli/upgrade/codemod.js +56 -0
- package/dist/cli/upgrade/index.js +263 -0
- package/dist/cli/upgrade/manifest.js +72 -0
- package/dist/cli/upgrade/plan.js +68 -0
- package/dist/cli/upgrade/stage.js +71 -0
- package/dist/cli/version.d.ts +12 -0
- package/dist/cli/version.js +15 -0
- package/dist/cli/workspace.js +108 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.js +94 -0
- package/dist/css/compile.js +77 -0
- package/dist/css/graph.js +109 -0
- package/dist/css/inline.js +132 -0
- package/dist/css/rules.js +65 -0
- package/dist/design-system/format-variants.js +127 -0
- package/dist/eslint/authoring.js +46 -0
- package/dist/eslint/correctness.js +42 -0
- package/dist/eslint/rules/editor-declaration.js +103 -0
- package/dist/eslint/rules/editor-reason.js +135 -0
- package/dist/eslint/rules/island-imports.js +20 -0
- package/dist/eslint/rules/jsx-visitor.js +20 -0
- package/dist/eslint/rules/no-client-runtime.js +88 -0
- package/dist/eslint/rules/no-editor-globals.js +60 -0
- package/dist/eslint/rules/no-hard-coded-color.js +183 -0
- package/dist/eslint/rules/no-inline-style.js +24 -0
- package/dist/eslint/rules/no-marker-literal.js +37 -0
- package/dist/eslint/rules/no-nondeterminism.js +44 -0
- package/dist/eslint/rules/no-px-breakpoint.js +44 -0
- package/dist/eslint/rules/no-raw-values.js +45 -0
- package/dist/eslint/rules/serializable-props.js +95 -0
- package/dist/eslint.d.ts +6 -0
- package/dist/eslint.js +26 -0
- package/dist/fixtures/brand.d.ts +4 -0
- package/dist/fixtures/brand.js +9 -0
- package/dist/fixtures/bundle-rule.js +67 -0
- package/dist/fixtures/canonical.d.ts +149 -0
- package/dist/fixtures/image-dimensions.js +59 -0
- package/dist/fixtures/load.js +154 -0
- package/dist/fixtures/media-plugin.js +141 -0
- package/dist/fixtures/media.js +165 -0
- package/dist/fixtures/property.js +210 -0
- package/dist/fixtures/resolve.js +202 -0
- package/dist/fixtures/rows.js +108 -0
- package/dist/fixtures/synthesize-empties.js +42 -0
- package/dist/fixtures.d.ts +213 -0
- package/dist/fixtures.js +37 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.js +37 -0
- package/dist/islands/client-module.js +97 -0
- package/dist/islands/marker.d.ts +43 -0
- package/dist/islands/marker.js +44 -0
- package/dist/node_modules/.pnpm/fflate@0.8.3/node_modules/fflate/esm/browser.js +687 -0
- package/dist/packages/external/concrete/package.js +5 -0
- package/dist/packages/internal/fact-interpolation/dist/index.js +22 -0
- package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +111 -0
- package/dist/packages/internal/fill-bake/dist/display.js +9 -0
- package/dist/packages/internal/fill-bake/dist/index.js +6 -0
- package/dist/packages/internal/fill-bake/dist/reconcile-cross-section.js +170 -0
- package/dist/packages/internal/fill-vocabulary/dist/facts.d.ts +32 -0
- package/dist/packages/internal/fill-vocabulary/dist/facts.js +131 -0
- package/dist/packages/internal/fill-vocabulary/dist/row-planners.js +73 -0
- package/dist/packages/internal/format-geometry/dist/capture.js +404 -0
- package/dist/packages/internal/format-geometry/dist/format.d.ts +41 -0
- package/dist/packages/internal/format-geometry/dist/geometry.js +58 -0
- package/dist/packages/internal/format-geometry/dist/index.js +4 -0
- package/dist/packages/internal/image-descriptor/dist/index.d.ts +35 -0
- package/dist/packages/internal/image-ladder/dist/crop.js +82 -0
- package/dist/packages/internal/image-ladder/dist/encode.js +23 -0
- package/dist/packages/internal/image-ladder/dist/index.js +4 -0
- package/dist/packages/internal/image-ladder/dist/policy.js +102 -0
- package/dist/packages/internal/island-runtime/dist/capture-holds.d.ts +13 -0
- package/dist/packages/internal/island-runtime/dist/capture-holds.js +45 -0
- package/dist/packages/internal/island-runtime/dist/contract.d.ts +176 -0
- package/dist/packages/internal/island-runtime/dist/contract.js +94 -0
- package/dist/packages/internal/island-runtime/dist/editor-instance-context.js +15 -0
- package/dist/packages/internal/island-runtime/dist/index.d.ts +103 -0
- package/dist/packages/internal/island-runtime/dist/index.js +163 -0
- package/dist/packages/internal/island-runtime/dist/use-capture-ready.d.ts +19 -0
- package/dist/packages/internal/island-runtime/dist/use-capture-ready.js +39 -0
- package/dist/packages/internal/island-runtime/dist/use-editor.d.ts +22 -0
- package/dist/packages/internal/island-runtime/dist/use-editor.js +54 -0
- package/dist/packages/internal/island-runtime/dist/viewport-schedule.js +105 -0
- package/dist/packages/internal/property-facts/dist/derive-facts-view.js +25 -0
- package/dist/packages/internal/property-facts/dist/index.js +3 -0
- package/dist/packages/internal/property-facts/dist/property-facts-CSdkSuD7.js +181 -0
- package/dist/packages/internal/section-contracts/dist/cap-contract.js +59 -0
- package/dist/packages/internal/section-contracts/dist/catalog.js +102 -0
- package/dist/packages/internal/section-contracts/dist/choose-select-contract.js +24 -0
- package/dist/packages/internal/section-contracts/dist/count-bounds-contract.js +48 -0
- package/dist/packages/internal/section-contracts/dist/display-contract.js +30 -0
- package/dist/packages/internal/section-contracts/dist/display-evidence-contract.js +17 -0
- package/dist/packages/internal/section-contracts/dist/group-contract.js +21 -0
- package/dist/packages/internal/section-contracts/dist/index.js +26 -0
- package/dist/packages/internal/section-contracts/dist/interpolation-contract.js +48 -0
- package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +53 -0
- package/dist/packages/internal/section-contracts/dist/list-scalar-contract.js +70 -0
- package/dist/packages/internal/section-contracts/dist/name-title-contract.js +27 -0
- package/dist/packages/internal/section-contracts/dist/nested-slot-contract.js +12 -0
- package/dist/packages/internal/section-contracts/dist/option-source-contract.js +22 -0
- package/dist/packages/internal/section-contracts/dist/poi-curation-contract.js +18 -0
- package/dist/packages/internal/section-contracts/dist/pooling-field-contract.js +30 -0
- package/dist/packages/internal/section-contracts/dist/record-collection-contract.js +24 -0
- package/dist/packages/internal/section-contracts/dist/row-contract.js +37 -0
- package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +38 -0
- package/dist/packages/internal/section-contracts/dist/runners.js +181 -0
- package/dist/packages/internal/section-contracts/dist/select-contract.js +28 -0
- package/dist/packages/internal/section-contracts/dist/source-contract.js +48 -0
- package/dist/packages/internal/section-contracts/dist/source-filter-contract.js +15 -0
- package/dist/packages/internal/section-contracts/dist/sources-contract.js +28 -0
- package/dist/packages/internal/section-contracts/dist/url-contract.js +20 -0
- package/dist/packages/internal/source-resolution/dist/index.js +222 -0
- package/dist/packages/internal/template-artifact/dist/hash.js +50 -0
- package/dist/packages/internal/template-artifact/dist/index.js +7 -0
- package/dist/packages/internal/template-artifact/dist/layout.js +165 -0
- package/dist/packages/internal/template-artifact/dist/manifest.js +73 -0
- package/dist/packages/internal/template-artifact/dist/sha256.js +138 -0
- package/dist/packages/internal/template-artifact/dist/verify.js +275 -0
- package/dist/packages/internal/template-contracts/dist/collection-editing.js +38 -0
- package/dist/packages/internal/template-contracts/dist/content-categories.d.ts +10 -0
- package/dist/packages/internal/template-contracts/dist/content-categories.js +17 -0
- package/dist/packages/internal/template-contracts/dist/document-value.d.ts +33 -0
- package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +81 -0
- package/dist/packages/internal/template-contracts/dist/facts-view.js +136 -0
- package/dist/packages/internal/template-contracts/dist/layout.js +17 -0
- package/dist/packages/internal/template-contracts/dist/markers.d.ts +40 -0
- package/dist/packages/internal/template-contracts/dist/markers.js +41 -0
- package/dist/packages/internal/template-contracts/dist/poi-row.d.ts +63 -0
- package/dist/packages/internal/template-contracts/dist/select-key.js +13 -0
- package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +1112 -0
- package/dist/packages/internal/template-contracts/dist/slot-catalog.js +1109 -0
- package/dist/packages/internal/template-contracts/dist/slot-overrides.js +11 -0
- package/dist/packages/internal/template-contracts/dist/tour-value.d.ts +45 -0
- package/dist/packages/internal/template-contracts/dist/video-value.d.ts +63 -0
- package/dist/playground/host/page-state.js +12 -0
- package/dist/playground/host/paths.js +9 -0
- package/dist/playground/layout.js +24 -0
- package/dist/playground/wire.js +36 -0
- package/dist/playground-island-runtime.d.ts +3 -0
- package/dist/playground-island-runtime.js +4 -0
- package/dist/primitives/FrameShell.d.ts +29 -0
- package/dist/primitives/FrameShell.js +34 -0
- package/dist/primitives/Image.d.ts +119 -0
- package/dist/primitives/Image.js +173 -0
- package/dist/primitives/Section.d.ts +22 -0
- package/dist/primitives/Section.js +26 -0
- package/dist/primitives/Tour.d.ts +43 -0
- package/dist/primitives/Tour.js +72 -0
- package/dist/primitives/Video.d.ts +57 -0
- package/dist/primitives/Video.js +116 -0
- package/dist/primitives/embed-playback.js +50 -0
- package/dist/primitives/index.d.ts +11 -0
- package/dist/primitives/marker-attrs.js +44 -0
- package/dist/primitives/object-fit.js +11 -0
- package/dist/primitives/picture-sources.d.ts +24 -0
- package/dist/primitives/picture-sources.js +52 -0
- package/dist/primitives/probe-context.js +24 -0
- package/dist/primitives/slot-bindings.d.ts +96 -0
- package/dist/primitives/slot-bindings.js +226 -0
- package/dist/primitives/slot-document.d.ts +35 -0
- package/dist/primitives/slot-document.js +37 -0
- package/dist/primitives/slot-group.d.ts +40 -0
- package/dist/primitives/slot-group.js +45 -0
- package/dist/primitives/slot-list.d.ts +21 -0
- package/dist/primitives/slot-list.js +23 -0
- package/dist/primitives/slot-media.d.ts +71 -0
- package/dist/primitives/slot-media.js +98 -0
- package/dist/primitives/slot-scalar.d.ts +53 -0
- package/dist/primitives/slot-scalar.js +98 -0
- package/dist/primitives/slot.d.ts +26 -0
- package/dist/primitives/slot.js +28 -0
- package/dist/rules/registry.js +479 -0
- package/dist/schema/compute.d.ts +22 -0
- package/dist/schema/compute.js +30 -0
- package/dist/schema/define-schema.d.ts +27 -0
- package/dist/schema/define-schema.js +73 -0
- package/dist/schema/extract-fill-spec.js +246 -0
- package/dist/schema/extract-used-facts.js +176 -0
- package/dist/schema/fact.d.ts +65 -0
- package/dist/schema/fact.js +33 -0
- package/dist/schema/fill-builders.d.ts +387 -0
- package/dist/schema/fill-builders.js +263 -0
- package/dist/schema/fill-declaration.d.ts +76 -0
- package/dist/schema/fill-declaration.js +43 -0
- package/dist/schema/fill-spec.d.ts +18 -0
- package/dist/schema/fill-spec.js +170 -0
- package/dist/schema/format-presets.d.ts +27 -0
- package/dist/schema/format-presets.js +76 -0
- package/dist/schema/format.d.ts +22 -0
- package/dist/schema/format.js +40 -0
- package/dist/schema/formats.d.ts +6 -0
- package/dist/schema/formats.js +7 -0
- package/dist/schema/layout.d.ts +32 -0
- package/dist/schema/layout.js +30 -0
- package/dist/schema/manifest.js +300 -0
- package/dist/schema/property-facts.d.ts +83 -0
- package/dist/schema/runtime-values.d.ts +88 -0
- package/dist/schema/section-nav.d.ts +38 -0
- package/dist/schema/section-nav.js +29 -0
- package/dist/schema/section-props.d.ts +98 -0
- package/dist/schema/section-schema.d.ts +53 -0
- package/dist/schema/section-schema.js +54 -0
- package/dist/schema/slot-builders.d.ts +497 -0
- package/dist/schema/slot-builders.js +331 -0
- package/dist/schema/slot-types.d.ts +110 -0
- package/dist/schema/slot-types.js +187 -0
- package/dist/section/declare.d.ts +44 -0
- package/dist/section/declare.js +27 -0
- package/dist/section/discovery.js +76 -0
- package/dist/section/groups.js +74 -0
- package/dist/section/materialize.js +28 -0
- package/dist/section/placements.js +28 -0
- package/dist/section/section.d.ts +69 -0
- package/dist/section/section.js +101 -0
- package/dist/site-analytics.d.ts +1 -0
- package/dist/site-analytics.js +15 -0
- package/dist/site-runtime/analytics.js +97 -0
- package/dist/site-runtime/site-integrations.js +97 -0
- package/dist/styles.css +60 -0
- package/dist/template/define-template.d.ts +139 -0
- package/dist/template/define-template.js +98 -0
- package/dist/template/logic-build.js +191 -0
- package/dist/template/logic-shim.d.ts +43 -0
- package/dist/template/logic-shim.js +52 -0
- package/dist/template/logic-transform.js +92 -0
- package/dist/template/materialize.js +107 -0
- package/dist/template/reconcile.d.ts +67 -0
- package/dist/template/reconcile.js +25 -0
- package/dist/template/running-copy.js +58 -0
- package/guide/reference/cli/INDEX.md +79 -0
- package/guide/reference/cli/build.md +48 -0
- package/guide/reference/cli/check.md +49 -0
- package/guide/reference/cli/dev.md +46 -0
- package/guide/reference/cli/property-add.md +53 -0
- package/guide/reference/cli/property-list.md +46 -0
- package/guide/reference/cli/publish.md +54 -0
- package/guide/reference/cli/upgrade.md +48 -0
- package/guide/reference/rules/INDEX.md +190 -0
- package/package.json +137 -0
- package/tsconfig.base.json +16 -0
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import { ReferralField } from "../packages/internal/template-contracts/dist/slot-catalog.js";
|
|
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";
|
|
5
|
+
//#region src/schema/fill-builders.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* The abstention declaration every PRODUCING builder admits. Its prose states
|
|
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.
|
|
14
|
+
*
|
|
15
|
+
* What "nothing" is follows the produced slot: `null` for a single asset, `""`
|
|
16
|
+
* for text, `[]` for a list — the ordinary empty values a renderer already
|
|
17
|
+
* handles. Two declarations admit none at all: a `meta.display` entry's
|
|
18
|
+
* countless `chooseFrom` (a display entry always resolves a case), and a list
|
|
19
|
+
* whose rows come from the facts or from the platform's place search — `check`
|
|
20
|
+
* rejects those, because no model discretion exists there to abstain.
|
|
21
|
+
*/
|
|
22
|
+
interface Abstainable {
|
|
23
|
+
/**
|
|
24
|
+
* When producing nothing is right, in prose — the criterion the model judges
|
|
25
|
+
* abstention against. Omit it and the decision must produce a value.
|
|
26
|
+
*/
|
|
27
|
+
none?: string;
|
|
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 {
|
|
51
|
+
/**
|
|
52
|
+
* How many items to produce. A range `{ min, max }` where the model picks or
|
|
53
|
+
* chooses (media pools, select vocabularies), a literal `N` or that same range
|
|
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.
|
|
61
|
+
*/
|
|
62
|
+
count?: number | {
|
|
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;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Fills ANY list slot. What the model does — pick from the media pool, choose
|
|
81
|
+
* from a select vocabulary, generate scalar items, curate places — is never
|
|
82
|
+
* declared here: it derives from the slot's own declared item, so one builder
|
|
83
|
+
* serves every list and only the parameters vary. On a record item the same
|
|
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
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
declare function listFill(i: ListFillInput): BuiltDecision<"list-fill">;
|
|
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;
|
|
261
|
+
/**
|
|
262
|
+
* The abstention brief — when originating no rows at all is right. Presence
|
|
263
|
+
* enables abstention; the prose is the bar the model judges it against.
|
|
264
|
+
*/
|
|
265
|
+
none?: string;
|
|
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;
|
|
281
|
+
/**
|
|
282
|
+
* The abstention brief — when originating no rows at all is right. Presence
|
|
283
|
+
* enables abstention; the prose is the bar the model judges it against.
|
|
284
|
+
*/
|
|
285
|
+
none?: string;
|
|
286
|
+
}
|
|
287
|
+
/** How a collection's rows come into existence — the emitted decision's `rows:` axis. */
|
|
288
|
+
type RowOrigination = ChosenRows | NamedRows | {
|
|
289
|
+
mode: "facts";
|
|
290
|
+
iterate: IterableFactsField;
|
|
291
|
+
};
|
|
292
|
+
/**
|
|
293
|
+
* A one-key choice from a closed vocabulary, steered by `pick` prose — what
|
|
294
|
+
* `chooseFrom({ pick })` (no `count`) returns. Two positions take it: a
|
|
295
|
+
* `meta.display` entry's `fill:`, where the model picks ONE case from the
|
|
296
|
+
* entry's own declared cases, and a record row's `select.of` field, where the
|
|
297
|
+
* model picks one key from that field's own `values` per row (the builder
|
|
298
|
+
* spells it `select-assign` for the row planner). A countless choice satisfies
|
|
299
|
+
* no record list's `fill:`.
|
|
300
|
+
*/
|
|
301
|
+
interface DisplayChoice {
|
|
302
|
+
mode: "choose";
|
|
303
|
+
pick: string;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Rows the model picks from the row's own select vocabulary — `count.min`..`count.max`
|
|
307
|
+
* of them, steered by `pick` prose. The vocabulary is NOT restated here; the
|
|
308
|
+
* executor reads it off the inner select slot's own `values`, exactly as a
|
|
309
|
+
* `listFill` on a select-element list does one level up.
|
|
310
|
+
*
|
|
311
|
+
* Without `count`, the same builder declares a one-key choice: a `meta.display`
|
|
312
|
+
* entry's fill — the model chooses ONE case from the entry's declared cases —
|
|
313
|
+
* or a record row's `select.of` field, chosen per row from that field's own
|
|
314
|
+
* `values`. There is no count to author, and no `none`: a display entry always
|
|
315
|
+
* resolves a case, and a row's select lands `""` when the model does not
|
|
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.
|
|
351
|
+
* @example
|
|
352
|
+
* ```ts
|
|
353
|
+
* import { document, list, listFill, nameRows, text } from "@homepages/concrete";
|
|
354
|
+
*
|
|
355
|
+
* list.of(
|
|
356
|
+
* {
|
|
357
|
+
* folder_name: text.short({ cap: 40, label: "Folder name" }),
|
|
358
|
+
* documents: list.of(document({ label: "Document" }), {
|
|
359
|
+
* label: "Folder documents",
|
|
360
|
+
* max: 8,
|
|
361
|
+
* fill: listFill({ count: { min: 1, max: 8 }, pick: "The files under this name." }),
|
|
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
|
+
* );
|
|
375
|
+
* ```
|
|
376
|
+
*/
|
|
377
|
+
declare function nameRows(i: {
|
|
378
|
+
count: {
|
|
379
|
+
min: number;
|
|
380
|
+
max: number;
|
|
381
|
+
};
|
|
382
|
+
pick: string;
|
|
383
|
+
structureHint?: string;
|
|
384
|
+
none?: string;
|
|
385
|
+
} & Readable): NamedRows;
|
|
386
|
+
//#endregion
|
|
387
|
+
export { BuiltDecision, ChosenRows, DecisionKind, DisplayChoice, NamedRows, RowOrigination, chooseFrom, contactAssign, documentAssign, imageAssign, listFill, nameRows, textBlock, tourAssign, videoAssign };
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { withReads } from "./fill-declaration.js";
|
|
2
|
+
|
|
3
|
+
//#region src/schema/fill-builders.ts
|
|
4
|
+
function compact(o) {
|
|
5
|
+
const out = {};
|
|
6
|
+
for (const [k, v] of Object.entries(o)) if (v !== void 0) out[k] = v;
|
|
7
|
+
return out;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Fills ANY list slot. What the model does — pick from the media pool, choose
|
|
11
|
+
* from a select vocabulary, generate scalar items, curate places — is never
|
|
12
|
+
* declared here: it derives from the slot's own declared item, so one builder
|
|
13
|
+
* serves every list and only the parameters vary. On a record item the same
|
|
14
|
+
* declaration seats each row field's own `fill:` beside it.
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { listFill } from "@homepages/concrete";
|
|
18
|
+
*
|
|
19
|
+
* // On list.of(text.short({ cap: 80 })) — generates six short items.
|
|
20
|
+
* listFill({ count: 6, structureHint: "Short noun phrases.", voice: "Concrete.", content: "Six highlights." });
|
|
21
|
+
*
|
|
22
|
+
* // The same list, bounded rather than fixed: six to eight, the model's call.
|
|
23
|
+
* listFill({ count: { min: 6, max: 8 }, structureHint: "Short noun phrases.", content: "The features this unit really has." });
|
|
24
|
+
*
|
|
25
|
+
* // On list.of(image()) — picks and orders from the property's photos.
|
|
26
|
+
* listFill({ count: { min: 3, max: 8 }, pick: "The strongest set." });
|
|
27
|
+
*
|
|
28
|
+
* // On a row's list.of(document()) — files a subset of the property's documents
|
|
29
|
+
* // into each row; a document lands in at most one row, and the section's
|
|
30
|
+
* // later list fills draw from what remains.
|
|
31
|
+
* listFill({ count: { min: 1, max: 8 }, pick: "The files that belong in this folder." });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
function listFill(i) {
|
|
35
|
+
const { reads, ...config } = i;
|
|
36
|
+
return withReads(compact({
|
|
37
|
+
type: "list-fill",
|
|
38
|
+
...config
|
|
39
|
+
}), reads);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Fills a single `image` slot by having the model choose one photo from the
|
|
43
|
+
* property's full pool. `pick` is the selection-brief prose. This builder always
|
|
44
|
+
* emits the prompt-driven form (`pick`) — it has no fact-seeded
|
|
45
|
+
* counterpart.
|
|
46
|
+
*
|
|
47
|
+
* A `fallback` chains a `contactAssign` behind the photo pick: when the photo
|
|
48
|
+
* pool yields nothing — the model abstained under `none`, or the property has no
|
|
49
|
+
* photos — the contact pick fills the same slot with the chosen card's logo or
|
|
50
|
+
* headshot. That is how a slot prefers a mark the property uploaded and still
|
|
51
|
+
* lands on a contact's when none was.
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* import { contactAssign, imageAssign } from "@homepages/concrete";
|
|
55
|
+
*
|
|
56
|
+
* imageAssign({ pick: "Pick the striking exterior." });
|
|
57
|
+
*
|
|
58
|
+
* // The builder's own mark from the uploads; else the developer's card, else the primary's.
|
|
59
|
+
* imageAssign({
|
|
60
|
+
* pick: "The builder's or developer's own mark among the uploads.",
|
|
61
|
+
* none: "No upload is a builder's mark.",
|
|
62
|
+
* fallback: contactAssign({ pick: "The developer or builder; else the primary contact.", field: "logo_dark" }),
|
|
63
|
+
* });
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
function imageAssign(i) {
|
|
67
|
+
const fallback = "fallback" in i ? compact({ ...i.fallback }) : void 0;
|
|
68
|
+
return compact({
|
|
69
|
+
type: "image-assign",
|
|
70
|
+
pick: i.pick,
|
|
71
|
+
none: i.none,
|
|
72
|
+
fallback
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Fills a single `video` slot by having the model choose one clip from the
|
|
77
|
+
* property's video pool. `pick` is the selection-brief prose. Unlike
|
|
78
|
+
* `imageAssign`, there is no fact-seeded mode — a video only ever reaches a
|
|
79
|
+
* slot by selection.
|
|
80
|
+
*/
|
|
81
|
+
function videoAssign(i) {
|
|
82
|
+
return compact({
|
|
83
|
+
type: "video-assign",
|
|
84
|
+
pick: i.pick,
|
|
85
|
+
none: i.none
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Fills a single `tour` slot by having the model choose one 3D tour from the
|
|
90
|
+
* property's tour pool. `pick` is the selection-brief prose. Like `videoAssign`
|
|
91
|
+
* there is no fact-seeded mode — a tour only ever reaches a slot by selection —
|
|
92
|
+
* and the candidates the model sees are the property's tour links, never its
|
|
93
|
+
* videos: the pool is named by the decision type, not by a parameter.
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* import { tourAssign } from "@homepages/concrete";
|
|
97
|
+
*
|
|
98
|
+
* tourAssign({ pick: "The whole-home walkthrough, not a single-room scan." });
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
function tourAssign(i) {
|
|
102
|
+
return compact({
|
|
103
|
+
type: "tour-assign",
|
|
104
|
+
pick: i.pick,
|
|
105
|
+
none: i.none
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Fills a single `document` slot by having the model choose one file from the
|
|
110
|
+
* documents stored on the property. `pick` is the selection-brief prose — and it
|
|
111
|
+
* is the whole brief, so write it against what a document IS: the model sees each
|
|
112
|
+
* candidate's filename, file type, and whatever text was distilled out of it (a
|
|
113
|
+
* spreadsheet or slide deck carries none, so name the file type when it matters).
|
|
114
|
+
* @example
|
|
115
|
+
* ```ts
|
|
116
|
+
* import { documentAssign } from "@homepages/concrete";
|
|
117
|
+
*
|
|
118
|
+
* documentAssign({ pick: "The offering brochure — a multi-page PDF about the whole property, not a single-unit floor plan." });
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
function documentAssign(i) {
|
|
122
|
+
return compact({
|
|
123
|
+
type: "document-assign",
|
|
124
|
+
pick: i.pick,
|
|
125
|
+
none: i.none
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Fills a single `image` or `text` slot from ONE of the property's attached
|
|
130
|
+
* contacts, chosen by the model against `pick`. The property's contact cards
|
|
131
|
+
* are the candidates (name, title, organisation, and which one is primary); the
|
|
132
|
+
* chosen card's `field` is what the slot receives — so the same decision puts a
|
|
133
|
+
* developer's logo on an `image` slot or a builder's name on a `text` slot.
|
|
134
|
+
* Write the brief against what a card SHOWS: a card carries no role, so "the
|
|
135
|
+
* developer" is read off its title and organisation. Say what to do when no
|
|
136
|
+
* card fits ("else the primary contact"); with exactly one card, or none, no
|
|
137
|
+
* model call is made.
|
|
138
|
+
* @example
|
|
139
|
+
* ```ts
|
|
140
|
+
* import { contactAssign } from "@homepages/concrete";
|
|
141
|
+
*
|
|
142
|
+
* contactAssign({ pick: "The developer or builder of the property; else the primary contact.", field: "logo_dark" });
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
function contactAssign(i) {
|
|
146
|
+
return compact({
|
|
147
|
+
type: "contact-assign",
|
|
148
|
+
pick: i.pick,
|
|
149
|
+
field: i.field,
|
|
150
|
+
none: i.none
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Fills a `text` slot with model-generated prose. `structure` is the prose
|
|
155
|
+
* shape to generate. `perspective` is the required grammatical person the copy
|
|
156
|
+
* is written in — there is no omitted mode, so a reader never has to know a
|
|
157
|
+
* default. `voice` is the required tone/style brief; `content` is an optional
|
|
158
|
+
* additional prompt.
|
|
159
|
+
*
|
|
160
|
+
* The character budget lives on the slot: omit `cap` and the executor writes to
|
|
161
|
+
* the slot's own `cap`. State one here only to ask the model for a STRICTLY
|
|
162
|
+
* SHORTER piece than the slot holds — a cap at or above the slot's is rejected
|
|
163
|
+
* at validation, as a restatement and a silent trim respectively.
|
|
164
|
+
*
|
|
165
|
+
* `reads` puts facts beyond the slice's standing contents in front of the model
|
|
166
|
+
* for THIS brief — `reads: ["photos"]` when the copy describes what the photos
|
|
167
|
+
* show. The section's `reads` is the union over its decisions.
|
|
168
|
+
* @example
|
|
169
|
+
* ```ts
|
|
170
|
+
* import { textBlock } from "@homepages/concrete";
|
|
171
|
+
*
|
|
172
|
+
* // The slot declares the budget: text.medium({ cap: 60, label: "Headline" })
|
|
173
|
+
* textBlock({
|
|
174
|
+
* structure: "single_sentence",
|
|
175
|
+
* perspective: "third",
|
|
176
|
+
* voice: "Confident premium-listing voice.",
|
|
177
|
+
* content: "Write a marketing headline.",
|
|
178
|
+
* });
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
function textBlock(i) {
|
|
182
|
+
return withReads(compact({
|
|
183
|
+
type: "text-block",
|
|
184
|
+
cap: i.cap,
|
|
185
|
+
structure: i.structure,
|
|
186
|
+
perspective: i.perspective,
|
|
187
|
+
voice: i.voice,
|
|
188
|
+
content: i.content,
|
|
189
|
+
none: i.none
|
|
190
|
+
}), i.reads);
|
|
191
|
+
}
|
|
192
|
+
function chooseFrom(i) {
|
|
193
|
+
if (i.count === void 0) return withReads({
|
|
194
|
+
mode: "choose",
|
|
195
|
+
pick: i.pick
|
|
196
|
+
}, i.reads);
|
|
197
|
+
return withReads(i.none === void 0 ? {
|
|
198
|
+
mode: "choose",
|
|
199
|
+
count: i.count,
|
|
200
|
+
pick: i.pick
|
|
201
|
+
} : {
|
|
202
|
+
mode: "choose",
|
|
203
|
+
count: i.count,
|
|
204
|
+
pick: i.pick,
|
|
205
|
+
none: i.none
|
|
206
|
+
}, i.reads);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Rows the model originates by NAMING each one — `count.min`..`count.max` of
|
|
210
|
+
* them, steered by `pick` prose. `chooseFrom`'s sibling for the case where no
|
|
211
|
+
* closed vocabulary can be written down in advance: a document library's
|
|
212
|
+
* folders are named for the files a particular property happens to carry, so a
|
|
213
|
+
* fixed list either misses the name that fits or offers names nothing fills.
|
|
214
|
+
*
|
|
215
|
+
* WHICH FIELD the name lands in is not authored — the list's own `title:`
|
|
216
|
+
* already names the field the editor titles a row with, and that is the field
|
|
217
|
+
* the model writes. Its `cap` is the name's character budget, for the same
|
|
218
|
+
* reason: it is already declared. Extraction rejects a slot whose `title:` is
|
|
219
|
+
* absent or names a field that is not `text`, and a titled field that declares
|
|
220
|
+
* a `fill:` of its own: the model writes that field, so state the name's shape
|
|
221
|
+
* in `structureHint` instead.
|
|
222
|
+
*
|
|
223
|
+
* Rows are deduped case-insensitively (first wins) and capped at `count.max`.
|
|
224
|
+
* There is no top-up to `count.min` the way `chooseFrom` has one: a closed
|
|
225
|
+
* vocabulary has unused keys to fall back on, an open one has nothing.
|
|
226
|
+
* @example
|
|
227
|
+
* ```ts
|
|
228
|
+
* import { document, list, listFill, nameRows, text } from "@homepages/concrete";
|
|
229
|
+
*
|
|
230
|
+
* list.of(
|
|
231
|
+
* {
|
|
232
|
+
* folder_name: text.short({ cap: 40, label: "Folder name" }),
|
|
233
|
+
* documents: list.of(document({ label: "Document" }), {
|
|
234
|
+
* label: "Folder documents",
|
|
235
|
+
* max: 8,
|
|
236
|
+
* fill: listFill({ count: { min: 1, max: 8 }, pick: "The files under this name." }),
|
|
237
|
+
* }),
|
|
238
|
+
* },
|
|
239
|
+
* {
|
|
240
|
+
* label: "Document folders",
|
|
241
|
+
* title: "folder_name",
|
|
242
|
+
* max: 6,
|
|
243
|
+
* fill: nameRows({
|
|
244
|
+
* count: { min: 0, max: 4 },
|
|
245
|
+
* pick: "Name a folder only where several files plainly group under one heading.",
|
|
246
|
+
* structureHint: "Title Case.",
|
|
247
|
+
* }),
|
|
248
|
+
* },
|
|
249
|
+
* );
|
|
250
|
+
* ```
|
|
251
|
+
*/
|
|
252
|
+
function nameRows(i) {
|
|
253
|
+
return withReads(compact({
|
|
254
|
+
mode: "name",
|
|
255
|
+
count: i.count,
|
|
256
|
+
pick: i.pick,
|
|
257
|
+
structureHint: i.structureHint,
|
|
258
|
+
none: i.none
|
|
259
|
+
}), i.reads);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
//#endregion
|
|
263
|
+
export { chooseFrom, contactAssign, documentAssign, imageAssign, listFill, nameRows, textBlock, tourAssign, videoAssign };
|