@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,53 @@
|
|
|
1
|
+
import { REFERRAL_FIELDS } from "../packages/internal/template-contracts/dist/slot-catalog.js";
|
|
2
|
+
import { VideoCollectionValue, VideoValue } from "../packages/internal/template-contracts/dist/video-value.js";
|
|
3
|
+
import { TourCollectionValue, TourValue } from "../packages/internal/template-contracts/dist/tour-value.js";
|
|
4
|
+
import { DocumentCollectionValue, DocumentValue } from "../packages/internal/template-contracts/dist/document-value.js";
|
|
5
|
+
import { PoiPhoto, PoiRow } from "../packages/internal/template-contracts/dist/poi-row.js";
|
|
6
|
+
import { ComparableRow, Coordinates, FloorplanAssignment, Narrative, UnitRow } from "./property-facts.js";
|
|
7
|
+
import { AuthorImage, ContactRow, ImageCollectionValue, ImageValue, PlaybackConfig } from "./runtime-values.js";
|
|
8
|
+
import { Slot } from "./slot-types.js";
|
|
9
|
+
import { BakedRowValue, RowValue, SectionProps, SlotValue } from "./section-props.js";
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
//#region src/schema/section-schema.d.ts
|
|
12
|
+
/** One `meta.display` entry as consumers read it: declared `cases` (first =
|
|
13
|
+
* default and failure posture), the user-switch `locked` opt-out, and at most
|
|
14
|
+
* one origin — a `source` binding or a `fill: { pick }` choice. */
|
|
15
|
+
interface DisplayEntryShape {
|
|
16
|
+
cases: readonly string[];
|
|
17
|
+
locked?: boolean;
|
|
18
|
+
source?: {
|
|
19
|
+
kind: string;
|
|
20
|
+
transform?: string;
|
|
21
|
+
};
|
|
22
|
+
fill?: {
|
|
23
|
+
pick: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/** The shape of a section's `meta.display` block. */
|
|
27
|
+
interface DisplayShape {
|
|
28
|
+
visibility?: DisplayEntryShape;
|
|
29
|
+
variant?: DisplayEntryShape;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Zod schema for a section's full authored `schema.ts` declaration: `meta`,
|
|
33
|
+
* its `slots` record, and a build-derived `slot_order` never written by an
|
|
34
|
+
* author directly.
|
|
35
|
+
*/
|
|
36
|
+
declare const SectionSchema: z.ZodObject<{
|
|
37
|
+
meta: z.ZodObject<{
|
|
38
|
+
displayName: z.ZodString;
|
|
39
|
+
anchor: z.ZodOptional<z.ZodString>;
|
|
40
|
+
groups: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
41
|
+
id: z.ZodString;
|
|
42
|
+
label: z.ZodString;
|
|
43
|
+
members: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodTuple<[z.ZodString, z.ZodString], null>]>>;
|
|
44
|
+
}, z.core.$strict>>>;
|
|
45
|
+
display: z.ZodOptional<z.ZodType<DisplayShape, DisplayShape, z.core.$ZodTypeInternals<DisplayShape, DisplayShape>>>;
|
|
46
|
+
}, z.core.$strict>;
|
|
47
|
+
slots: z.ZodRecord<z.ZodString, z.ZodType<Slot, Slot, z.core.$ZodTypeInternals<Slot, Slot>>>;
|
|
48
|
+
slot_order: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
49
|
+
}, z.core.$strict>;
|
|
50
|
+
/** The authored input shape of `SectionSchema` — what `as const satisfies SectionSchemaShape` checks a section's `schema.ts` against. */
|
|
51
|
+
type SectionSchemaShape = z.input<typeof SectionSchema>;
|
|
52
|
+
//#endregion
|
|
53
|
+
export { type AuthorImage, type ComparableRow, type ContactRow, type Coordinates, DisplayEntryShape, DisplayShape, type DocumentCollectionValue, type DocumentValue, type FloorplanAssignment, type ImageCollectionValue, type ImageValue, type Narrative, type PlaybackConfig, type PoiPhoto, type PoiRow, type RowValue, SectionSchema, SectionSchemaShape, type Slot, type SlotValue, type TourCollectionValue, type TourValue, type UnitRow, type VideoCollectionValue, type VideoValue };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { CONTENT_SLOT_TYPES, REFERRAL_FIELDS, REF_SLOT_TYPES, SLOT_TYPES } from "../packages/internal/template-contracts/dist/slot-catalog.js";
|
|
2
|
+
import { SlotDef, defaultForSlotType } from "./slot-types.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
//#region src/schema/section-schema.ts
|
|
6
|
+
/**
|
|
7
|
+
* A first-class sidebar grouping: collapses its member slots into one editor
|
|
8
|
+
* card. `members` is nestable — a bare slot id is a full-width row, a
|
|
9
|
+
* `[a, b]` tuple is one 2-up row.
|
|
10
|
+
*/
|
|
11
|
+
const SlotGroupDef = z.object({
|
|
12
|
+
id: z.string(),
|
|
13
|
+
label: z.string(),
|
|
14
|
+
members: z.array(z.union([z.string(), z.tuple([z.string(), z.string()])])).min(1)
|
|
15
|
+
}).strict();
|
|
16
|
+
const DisplayEntryDef = z.object({
|
|
17
|
+
cases: z.array(z.string().min(1)).min(1),
|
|
18
|
+
locked: z.boolean().optional(),
|
|
19
|
+
source: z.object({
|
|
20
|
+
kind: z.literal("derived"),
|
|
21
|
+
transform: z.string().min(1)
|
|
22
|
+
}).strict().optional(),
|
|
23
|
+
fill: z.object({ pick: z.string().min(1) }).strict().optional()
|
|
24
|
+
}).strict();
|
|
25
|
+
/** A section's serialized `meta.display`: `visibility` and `variant`, each an optional select-shaped entry. */
|
|
26
|
+
const DisplayDef = z.object({
|
|
27
|
+
visibility: DisplayEntryDef.optional(),
|
|
28
|
+
variant: DisplayEntryDef.optional()
|
|
29
|
+
}).strict();
|
|
30
|
+
/**
|
|
31
|
+
* Zod schema for a section's `meta`: presentation and structural facts kept
|
|
32
|
+
* separate from the content `slots` — display name, in-page anchor id,
|
|
33
|
+
* sidebar `groups`, and the `display` block owning section visibility and
|
|
34
|
+
* variant.
|
|
35
|
+
*/
|
|
36
|
+
const SectionMeta = z.object({
|
|
37
|
+
displayName: z.string().min(1),
|
|
38
|
+
anchor: z.string().min(1).optional(),
|
|
39
|
+
groups: z.array(SlotGroupDef).optional(),
|
|
40
|
+
display: DisplayDef.optional()
|
|
41
|
+
}).strict();
|
|
42
|
+
/**
|
|
43
|
+
* Zod schema for a section's full authored `schema.ts` declaration: `meta`,
|
|
44
|
+
* its `slots` record, and a build-derived `slot_order` never written by an
|
|
45
|
+
* author directly.
|
|
46
|
+
*/
|
|
47
|
+
const SectionSchema = z.object({
|
|
48
|
+
meta: SectionMeta,
|
|
49
|
+
slots: z.record(z.string(), SlotDef),
|
|
50
|
+
slot_order: z.array(z.string()).optional()
|
|
51
|
+
}).strict();
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
export { DisplayDef, SectionMeta, SectionSchema, SlotDef, SlotGroupDef };
|
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
import { LinkKind, LinkProviderId, SourceFieldName, SourceFilter, VideoSource, WritableSourceFieldName } from "../packages/internal/template-contracts/dist/slot-catalog.js";
|
|
2
|
+
import { VideoValue } from "../packages/internal/template-contracts/dist/video-value.js";
|
|
3
|
+
import { TourValue } from "../packages/internal/template-contracts/dist/tour-value.js";
|
|
4
|
+
import { ImageValue, PlaybackConfig } from "./runtime-values.js";
|
|
5
|
+
import { ComputeBinding } from "./compute.js";
|
|
6
|
+
import { BuiltDecision, ChosenRows, DisplayChoice, NamedRows } from "./fill-builders.js";
|
|
7
|
+
import { LayoutRow } from "./layout.js";
|
|
8
|
+
import { FillMark, FillOption } from "./fill-declaration.js";
|
|
9
|
+
import { ListFieldSlot, ListItemSlot } from "./slot-types.js";
|
|
10
|
+
import { RowValue, SlotValue } from "./section-props.js";
|
|
11
|
+
//#region src/schema/slot-builders.d.ts
|
|
12
|
+
/**
|
|
13
|
+
* Where a slot's value comes from: the `direct` literal a `fact.*` entry emits
|
|
14
|
+
* into a builder's `source`, or the `derived` literal `defineSchema` rewrites a
|
|
15
|
+
* `compute()` binding to — whose `transform` is always the slot's own key.
|
|
16
|
+
*/
|
|
17
|
+
type SlotSource = {
|
|
18
|
+
kind: "direct";
|
|
19
|
+
field: SourceFieldName;
|
|
20
|
+
} | {
|
|
21
|
+
kind: "derived";
|
|
22
|
+
transform: string;
|
|
23
|
+
};
|
|
24
|
+
type SourceMark<HasSource extends SlotSource | ComputeBinding<unknown> | undefined> = HasSource extends SlotSource | ComputeBinding<unknown> ? {
|
|
25
|
+
source: HasSource;
|
|
26
|
+
} : unknown;
|
|
27
|
+
/**
|
|
28
|
+
* The `writeback` key a builder's options must carry, decided by the slot's
|
|
29
|
+
* `source`. A direct fact binding REQUIRES the boolean — `true`/`false` where
|
|
30
|
+
* the catalog entry is writable, the literal `false` where it is read-only, so
|
|
31
|
+
* the answer to "do edits propagate?" is visible without opening the catalog.
|
|
32
|
+
* A `compute()` binding and an unsourced (AI-filled / authored) slot admit no
|
|
33
|
+
* `writeback` key at all: nothing can write back through a derivation, and
|
|
34
|
+
* propagation is meaningless for generated content.
|
|
35
|
+
*/
|
|
36
|
+
type WritebackOption<HasSource extends SlotSource | ComputeBinding<unknown> | undefined> = HasSource extends {
|
|
37
|
+
kind: "direct";
|
|
38
|
+
field: infer F;
|
|
39
|
+
} ? [F] extends [WritableSourceFieldName] ? {
|
|
40
|
+
writeback: boolean;
|
|
41
|
+
} : {
|
|
42
|
+
writeback: false;
|
|
43
|
+
} : {
|
|
44
|
+
writeback?: never;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* An `image` slot's crop — the ASSET's contract: what the cropper cuts, and which cut
|
|
48
|
+
* a viewport is served. It paints no box; the rendered box is your own classes.
|
|
49
|
+
* `mode` picks the cropper behavior ("locked" keeps `aspect`, w/h; "free" resizes any
|
|
50
|
+
* edge), `aspectLabel` is the cropper's pill text. `mobile` declares a distinct second
|
|
51
|
+
* cut for narrow viewports: the cropper offers a desktop/mobile toggle at its `aspect`,
|
|
52
|
+
* and `<Image>` serves that cut below `breakpoint` — a VIEWPORT width, the only thing a
|
|
53
|
+
* `<picture><source media>` can switch on. `Slot.Image` reads it off the slot; a raw
|
|
54
|
+
* `<Image>` takes the same number as `mobileBreakpoint`.
|
|
55
|
+
*/
|
|
56
|
+
interface CropConfig {
|
|
57
|
+
mode: "locked" | "free";
|
|
58
|
+
aspect?: number;
|
|
59
|
+
aspectLabel?: string;
|
|
60
|
+
mobile?: {
|
|
61
|
+
aspect: number;
|
|
62
|
+
breakpoint: number;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
interface CommonOptions<CV = never> {
|
|
66
|
+
label: string;
|
|
67
|
+
locked?: boolean;
|
|
68
|
+
source?: SlotSource | ComputeBinding<CV>;
|
|
69
|
+
writeback?: boolean;
|
|
70
|
+
placeholder?: string;
|
|
71
|
+
when?: string | readonly string[];
|
|
72
|
+
}
|
|
73
|
+
interface Head {
|
|
74
|
+
locked?: true;
|
|
75
|
+
label: string;
|
|
76
|
+
source?: SlotSource | ComputeBinding<unknown>;
|
|
77
|
+
writeback?: boolean;
|
|
78
|
+
placeholder?: string;
|
|
79
|
+
when?: string | readonly string[];
|
|
80
|
+
}
|
|
81
|
+
interface TextOptions extends CommonOptions<string | null> {
|
|
82
|
+
cap?: number;
|
|
83
|
+
}
|
|
84
|
+
/** The serialized shape `text.short`/`.medium`/`.long` emit — a `text`-kind `SlotDef`. */
|
|
85
|
+
interface TextSlotDef<Size extends "short" | "medium" | "long"> extends Head {
|
|
86
|
+
type: "text";
|
|
87
|
+
size: Size;
|
|
88
|
+
cap?: number;
|
|
89
|
+
}
|
|
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
|
+
/**
|
|
93
|
+
* The text slot, sized by the member you pick: `text.short` / `.medium` / `.long`.
|
|
94
|
+
*
|
|
95
|
+
* `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 the `textBlock` filling the slot inherits
|
|
97
|
+
* it as the budget the model is asked to write to. A slot an AI fill decision
|
|
98
|
+
* targets must declare one. `fill` takes that `textBlock` — the alternative to
|
|
99
|
+
* `source`, never its companion.
|
|
100
|
+
* @example
|
|
101
|
+
* ```ts
|
|
102
|
+
* import { text, textBlock } from "@homepages/concrete";
|
|
103
|
+
*
|
|
104
|
+
* text.medium({
|
|
105
|
+
* cap: 60,
|
|
106
|
+
* label: "Headline",
|
|
107
|
+
* fill: textBlock({
|
|
108
|
+
* structure: "single_sentence",
|
|
109
|
+
* perspective: "third",
|
|
110
|
+
* voice: "Confident premium-listing voice.",
|
|
111
|
+
* content: "Write a marketing headline.",
|
|
112
|
+
* }),
|
|
113
|
+
* });
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
declare const text: {
|
|
117
|
+
short: <const HasSource extends SlotSource | ComputeBinding<unknown> | undefined = undefined>(opts: TextOptions & {
|
|
118
|
+
source?: HasSource | undefined;
|
|
119
|
+
fill?: TextFill;
|
|
120
|
+
} & WritebackOption<HasSource> & FillOption<HasSource, TextFill>) => TextSlotDef<"short"> & SourceMark<HasSource> & FillMark<TextFill>;
|
|
121
|
+
medium: <const HasSource extends SlotSource | ComputeBinding<unknown> | undefined = undefined>(opts: TextOptions & {
|
|
122
|
+
source?: HasSource | undefined;
|
|
123
|
+
fill?: TextFill;
|
|
124
|
+
} & WritebackOption<HasSource> & FillOption<HasSource, TextFill>) => TextSlotDef<"medium"> & SourceMark<HasSource> & FillMark<TextFill>;
|
|
125
|
+
long: <const HasSource extends SlotSource | ComputeBinding<unknown> | undefined = undefined>(opts: TextOptions & {
|
|
126
|
+
source?: HasSource | undefined;
|
|
127
|
+
fill?: TextFill;
|
|
128
|
+
} & WritebackOption<HasSource> & FillOption<HasSource, TextFill>) => TextSlotDef<"long"> & SourceMark<HasSource> & FillMark<TextFill>;
|
|
129
|
+
};
|
|
130
|
+
interface NumberOptions extends CommonOptions<number | null> {
|
|
131
|
+
prefix?: string;
|
|
132
|
+
suffix?: string;
|
|
133
|
+
thousandsSep?: boolean;
|
|
134
|
+
decimals?: boolean;
|
|
135
|
+
maxDigits?: number;
|
|
136
|
+
}
|
|
137
|
+
/** The serialized shape the `number` builder emits — a `number`-kind `SlotDef`. */
|
|
138
|
+
interface NumberSlotDef extends Head {
|
|
139
|
+
type: "number";
|
|
140
|
+
prefix?: string;
|
|
141
|
+
suffix?: string;
|
|
142
|
+
thousandsSep?: boolean;
|
|
143
|
+
decimals?: boolean;
|
|
144
|
+
maxDigits?: number;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* A numeric slot. `prefix`/`suffix` are rendered strings (such as `"$"` /
|
|
148
|
+
* `" sq ft"`), `thousandsSep` toggles grouping-separator formatting, `decimals`
|
|
149
|
+
* toggles decimal display, and `maxDigits` caps the digit count — all read by
|
|
150
|
+
* the renderer's number formatting, not enforced as an input range.
|
|
151
|
+
*
|
|
152
|
+
* Binding-only: no fill decision produces a number, so this builder takes no
|
|
153
|
+
* `fill` — the value comes from `source`.
|
|
154
|
+
* @example
|
|
155
|
+
* ```ts
|
|
156
|
+
* import { fact, number } from "@homepages/concrete";
|
|
157
|
+
*
|
|
158
|
+
* number({ source: fact.unit.sqft, writeback: true, label: "Square feet", thousandsSep: true, suffix: "sqft", maxDigits: 7 });
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
declare function number<const HasSource extends SlotSource | ComputeBinding<unknown> | undefined = undefined>(opts: NumberOptions & {
|
|
162
|
+
source?: HasSource;
|
|
163
|
+
} & WritebackOption<HasSource>): NumberSlotDef & SourceMark<HasSource>;
|
|
164
|
+
/** One `select.of` option: a bare string (value === label) or a stored key with display text. */
|
|
165
|
+
type SelectOptionInput = string | {
|
|
166
|
+
value: string;
|
|
167
|
+
label: string;
|
|
168
|
+
};
|
|
169
|
+
interface SelectOptions extends CommonOptions<string | null> {
|
|
170
|
+
creatable?: boolean;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* The serialized shape `select`/`select.of` emit — a `select`-kind `SlotDef`.
|
|
174
|
+
* `values` (hand-authored vocabulary) and `options.source` (fact-derived
|
|
175
|
+
* vocabulary) are mutually exclusive; which one is present depends on whether
|
|
176
|
+
* the slot was built with `select.of([...])` or `select({ from })`.
|
|
177
|
+
*/
|
|
178
|
+
interface SelectSlotDef extends Head {
|
|
179
|
+
type: "select";
|
|
180
|
+
values?: SelectOptionInput[];
|
|
181
|
+
options?: {
|
|
182
|
+
source: string;
|
|
183
|
+
};
|
|
184
|
+
creatable?: boolean;
|
|
185
|
+
}
|
|
186
|
+
declare function selectFn<const HasSource extends SlotSource | ComputeBinding<unknown> | undefined = undefined>(opts: SelectOptions & {
|
|
187
|
+
source?: HasSource;
|
|
188
|
+
} & WritebackOption<HasSource>): SelectSlotDef & SourceMark<HasSource>;
|
|
189
|
+
type SelectFill = DisplayChoice & {
|
|
190
|
+
count?: never;
|
|
191
|
+
none?: never;
|
|
192
|
+
};
|
|
193
|
+
declare function selectOf<const HasSource extends SlotSource | ComputeBinding<unknown> | undefined = undefined>(values: readonly SelectOptionInput[], opts: SelectOptions & {
|
|
194
|
+
source?: HasSource;
|
|
195
|
+
fill?: SelectFill;
|
|
196
|
+
} & WritebackOption<HasSource> & FillOption<HasSource, SelectFill>): SelectSlotDef & SourceMark<HasSource> & FillMark<BuiltDecision<"select-assign">>;
|
|
197
|
+
/**
|
|
198
|
+
* One `meta.display` entry as authored under `defineSchema`'s `display:` —
|
|
199
|
+
* the declared `cases` (the FIRST is the default and the failure posture), an
|
|
200
|
+
* optional `locked` opting the entry out of user switching, and at most one
|
|
201
|
+
* origin as written (`source: compute(fn)` still a live binding here;
|
|
202
|
+
* `defineSchema` strips it into the logic bundle exactly as it does a slot's).
|
|
203
|
+
*/
|
|
204
|
+
interface DisplayEntryInput<C extends readonly string[] = readonly string[]> {
|
|
205
|
+
cases: [...C];
|
|
206
|
+
locked?: true;
|
|
207
|
+
source?: ComputeBinding<C[number]>;
|
|
208
|
+
fill?: DisplayChoice;
|
|
209
|
+
}
|
|
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
|
+
declare function displaySelect<const C extends readonly [string, ...string[]]>(cases: C, opts: {
|
|
221
|
+
locked?: boolean;
|
|
222
|
+
} & DisplayOriginOptions<C>): DisplayEntryInput<C>;
|
|
223
|
+
/**
|
|
224
|
+
* The select slot AND the `meta.display` entry, told apart by the call shape.
|
|
225
|
+
*
|
|
226
|
+
* 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 takes
|
|
228
|
+
* no `fill`. Inside a record item, `select.of` is written one of two ways: by
|
|
229
|
+
* the list's own counted `chooseFrom` origination, which picks the ROWS from
|
|
230
|
+
* this field's vocabulary, or — on a row that already exists, a fact-baked
|
|
231
|
+
* comparable say — by its own countless `chooseFrom({ pick })`, which picks
|
|
232
|
+
* this one field's key per row in the list's batched call.
|
|
233
|
+
*
|
|
234
|
+
* As a display entry: `select(cases, { source: compute(fn) })` or
|
|
235
|
+
* `select(cases, { fill: chooseFrom({ pick }) })` declares a `meta.display`
|
|
236
|
+
* `visibility`/`variant` — the first case is the default and the failure
|
|
237
|
+
* posture, `locked: true` opts a variant out of user switching, and the entry
|
|
238
|
+
* takes exactly one origin.
|
|
239
|
+
* @example
|
|
240
|
+
* ```ts
|
|
241
|
+
* import { chooseFrom, compute, select } from "@homepages/concrete";
|
|
242
|
+
*
|
|
243
|
+
* select.of(["for_sale", "sold"], { label: "Status" });
|
|
244
|
+
* select.of(["regular", "highlight"], { label: "Comparable status", fill: chooseFrom({ pick: "Highlight the two or three strongest sales." }) });
|
|
245
|
+
* select(["visible", "hidden"], { source: compute((f) => (f.tours.length > 0 ? "visible" : "hidden")) });
|
|
246
|
+
* select(["classic", "editorial"], { fill: chooseFrom({ pick: "Prefer editorial for story-driven narratives." }) });
|
|
247
|
+
* ```
|
|
248
|
+
*/
|
|
249
|
+
declare const select: typeof selectFn & typeof displaySelect & {
|
|
250
|
+
of: typeof selectOf;
|
|
251
|
+
};
|
|
252
|
+
interface UrlOptions extends CommonOptions<string | null> {
|
|
253
|
+
accepts?: LinkKind | LinkProviderId;
|
|
254
|
+
}
|
|
255
|
+
/** The serialized shape the `url` builder emits — a `url`-kind `SlotDef`. */
|
|
256
|
+
interface UrlSlotDef extends Head {
|
|
257
|
+
type: "url";
|
|
258
|
+
accepts?: LinkKind | LinkProviderId;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* A URL string slot. `accepts` names a single link kind (such as `"tour"`) or
|
|
262
|
+
* link-provider id (such as `"matterport"`) the value must match. A link kind
|
|
263
|
+
* with no provider behind it admits no url at all, which the type cannot say —
|
|
264
|
+
* check time rejects those.
|
|
265
|
+
*
|
|
266
|
+
* Binding-only: no fill decision produces a url, so this builder takes no
|
|
267
|
+
* `fill` — the value comes from `source`.
|
|
268
|
+
* @example
|
|
269
|
+
* ```ts
|
|
270
|
+
* import { url } from "@homepages/concrete";
|
|
271
|
+
*
|
|
272
|
+
* url({ label: "Tour URL", accepts: "tour" });
|
|
273
|
+
* ```
|
|
274
|
+
*/
|
|
275
|
+
declare function url<const HasSource extends SlotSource | ComputeBinding<unknown> | undefined = undefined>(opts: UrlOptions & {
|
|
276
|
+
source?: HasSource;
|
|
277
|
+
} & WritebackOption<HasSource>): UrlSlotDef & SourceMark<HasSource>;
|
|
278
|
+
interface ImageOptions extends CommonOptions<ImageValue | null> {
|
|
279
|
+
crop?: CropConfig;
|
|
280
|
+
sourceFilter?: SourceFilter;
|
|
281
|
+
}
|
|
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
|
+
/** The serialized shape the `image` builder emits — an `image`-kind `SlotDef`. */
|
|
285
|
+
interface ImageSlotDef extends Head {
|
|
286
|
+
type: "image";
|
|
287
|
+
crop?: CropConfig;
|
|
288
|
+
sourceFilter?: SourceFilter;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* A single image slot — the resolved value is always one `ImageValue`, never a
|
|
292
|
+
* list, so it carries no count bounds (a list of them does). `crop` is the asset's
|
|
293
|
+
* contract — the editor's cropper and `<Image>`'s mobile-crop switch read it; the box
|
|
294
|
+
* the image renders in is the section's own classes. `sourceFilter` narrows the
|
|
295
|
+
* candidate pool the editor offers, routing the slot to a dedicated picker.
|
|
296
|
+
* `fill` takes an `imageAssign`, or a `contactAssign` naming one of a contact's
|
|
297
|
+
* image fields — the alternative to `source`, never its companion.
|
|
298
|
+
* @example
|
|
299
|
+
* ```ts
|
|
300
|
+
* import { image } from "@homepages/concrete";
|
|
301
|
+
*
|
|
302
|
+
* image({ label: "Floor plan", sourceFilter: "floorplans" });
|
|
303
|
+
* ```
|
|
304
|
+
*/
|
|
305
|
+
declare function image<const HasSource extends SlotSource | ComputeBinding<unknown> | undefined = undefined>(opts: ImageOptions & {
|
|
306
|
+
source?: HasSource;
|
|
307
|
+
fill?: ImageFill;
|
|
308
|
+
} & WritebackOption<HasSource> & FillOption<HasSource, ImageFill>): ImageSlotDef & SourceMark<HasSource> & FillMark<ImageFill>;
|
|
309
|
+
type VideoSources = readonly [VideoSource, ...VideoSource[]];
|
|
310
|
+
interface VideoOptions extends CommonOptions<VideoValue | null> {
|
|
311
|
+
playback?: PlaybackConfig;
|
|
312
|
+
sources?: VideoSources;
|
|
313
|
+
}
|
|
314
|
+
/** The serialized shape the `video` builder emits — a `video`-kind `SlotDef`. */
|
|
315
|
+
interface VideoSlotDef extends Head {
|
|
316
|
+
type: "video";
|
|
317
|
+
playback?: PlaybackConfig;
|
|
318
|
+
sources?: VideoSources;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* A single video slot, resolved as a `VideoValue`. Unlike `image`, there is no
|
|
322
|
+
* `crop` — a video is selected, never re-edited. `sources` opts into which
|
|
323
|
+
* origins the value may come from (`"upload"`, `"link"`); omitted means
|
|
324
|
+
* upload-only. `playback` configures the renderer's `<Video>`; the box it plays
|
|
325
|
+
* in is your own classes.
|
|
326
|
+
* `fill` takes a `videoAssign` — the alternative to `source`, never its companion.
|
|
327
|
+
* @example
|
|
328
|
+
* ```ts
|
|
329
|
+
* import { video } from "@homepages/concrete";
|
|
330
|
+
*
|
|
331
|
+
* video({ label: "Property video", playback: { controls: true }, sources: ["upload", "link"] });
|
|
332
|
+
* ```
|
|
333
|
+
*/
|
|
334
|
+
declare function video<const HasSource extends SlotSource | ComputeBinding<unknown> | undefined = undefined>(opts: VideoOptions & {
|
|
335
|
+
source?: HasSource;
|
|
336
|
+
fill?: BuiltDecision<"video-assign">;
|
|
337
|
+
} & WritebackOption<HasSource> & FillOption<HasSource, BuiltDecision<"video-assign">>): VideoSlotDef & SourceMark<HasSource> & FillMark<BuiltDecision<"video-assign">>;
|
|
338
|
+
type TourOptions = CommonOptions<TourValue | null>;
|
|
339
|
+
/** The serialized shape the `tour` builder emits — a `tour`-kind `SlotDef`. */
|
|
340
|
+
interface TourSlotDef extends Head {
|
|
341
|
+
type: "tour";
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* A single 3D-tour slot, resolved as a `TourValue`. Its own kind rather than a
|
|
345
|
+
* third video source: `playback` is meaningless on a walkthrough, and the fill
|
|
346
|
+
* pool would otherwise mix videos with tour models. It has no type-specific
|
|
347
|
+
* option at all — no `crop` (a tour is selected, never edited), no `playback`,
|
|
348
|
+
* no `sources` and no `accepts`; which providers are admitted widens in the
|
|
349
|
+
* link-provider catalog, never on a slot, and the box the embed fills is your
|
|
350
|
+
* own classes.
|
|
351
|
+
*
|
|
352
|
+
* Render it with `<Slot.Tour>` for the embed, `<Slot.Image>` for the tour's
|
|
353
|
+
* thumbnail, or both — two positions from one selection.
|
|
354
|
+
* `fill` takes a `tourAssign` — the alternative to `source`, never its companion.
|
|
355
|
+
* @example
|
|
356
|
+
* ```ts
|
|
357
|
+
* import { tour, tourAssign } from "@homepages/concrete";
|
|
358
|
+
*
|
|
359
|
+
* tour({ label: "3D tour", fill: tourAssign({ pick: "The whole-home walkthrough." }) });
|
|
360
|
+
* ```
|
|
361
|
+
*/
|
|
362
|
+
declare function tour<const HasSource extends SlotSource | ComputeBinding<unknown> | undefined = undefined>(opts: TourOptions & {
|
|
363
|
+
source?: HasSource;
|
|
364
|
+
fill?: BuiltDecision<"tour-assign">;
|
|
365
|
+
} & WritebackOption<HasSource> & FillOption<HasSource, BuiltDecision<"tour-assign">>): TourSlotDef & SourceMark<HasSource> & FillMark<BuiltDecision<"tour-assign">>;
|
|
366
|
+
type StripHead<E> = Omit<E, "locked">;
|
|
367
|
+
interface ListOptions<E> extends CommonOptions<NonNullable<SlotValue<E>>[]> {
|
|
368
|
+
min?: number;
|
|
369
|
+
max?: number;
|
|
370
|
+
unique?: boolean;
|
|
371
|
+
title?: never;
|
|
372
|
+
layout?: never;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* The serialized shape `list.of` emits for a single-slot item — a `list`-kind
|
|
376
|
+
* `SlotDef` carrying `element` (never `fields`). `element` is the bare item
|
|
377
|
+
* shape (its `locked` is stripped, since a list holds present items, not an
|
|
378
|
+
* editable slot itself). `min`/`max` bound the list's
|
|
379
|
+
* item count; `unique` applies only when `element` is a `select.of`
|
|
380
|
+
* vocabulary, and is passed through as-authored — this module does not itself
|
|
381
|
+
* deduplicate anything.
|
|
382
|
+
*/
|
|
383
|
+
interface ListSlotDef<E> extends Head {
|
|
384
|
+
type: "list";
|
|
385
|
+
element: E;
|
|
386
|
+
min?: number;
|
|
387
|
+
max?: number;
|
|
388
|
+
unique?: boolean;
|
|
389
|
+
}
|
|
390
|
+
type ListFillFor<E> = E extends {
|
|
391
|
+
type: string;
|
|
392
|
+
} ? BuiltDecision<"list-fill"> : never;
|
|
393
|
+
type ListRecordFillFor<I> = ChosenRows | NamedRows | ([Extract<I[keyof I], {
|
|
394
|
+
type: "image" | "video" | "tour" | "document";
|
|
395
|
+
}>] extends [never] ? never : BuiltDecision<"list-fill">);
|
|
396
|
+
interface ListRecordOptions<I extends Record<string, ListFieldSlot>> extends CommonOptions<RowValue<I>[]> {
|
|
397
|
+
min?: number;
|
|
398
|
+
max?: number;
|
|
399
|
+
layout?: readonly LayoutRow<keyof I & string>[];
|
|
400
|
+
title?: keyof I & string;
|
|
401
|
+
unique?: never;
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* The serialized shape `list.of` emits for a record item — a `list`-kind
|
|
405
|
+
* `SlotDef` carrying `fields` (never `element`), plus the record-item surface:
|
|
406
|
+
* `layout` (authored ordering/pairing, flattened to bare rows) and `title`
|
|
407
|
+
* (the field whose value titles each row).
|
|
408
|
+
*/
|
|
409
|
+
interface ListRecordSlotDef<I extends Record<string, ListFieldSlot>> extends Head {
|
|
410
|
+
type: "list";
|
|
411
|
+
fields: I;
|
|
412
|
+
layout?: (string | [string, string])[];
|
|
413
|
+
title?: string;
|
|
414
|
+
min?: number;
|
|
415
|
+
max?: number;
|
|
416
|
+
}
|
|
417
|
+
declare function listOfElement<const E extends ListItemSlot, const HasSource extends SlotSource | ComputeBinding<unknown> | undefined = undefined>(element: E, opts: ListOptions<E> & {
|
|
418
|
+
source?: HasSource;
|
|
419
|
+
fill?: ListFillFor<E>;
|
|
420
|
+
} & WritebackOption<HasSource> & FillOption<HasSource, ListFillFor<E>>): ListSlotDef<StripHead<E>> & SourceMark<HasSource> & FillMark<ListFillFor<E>>;
|
|
421
|
+
declare function listOfRecord<const I extends Record<string, ListFieldSlot>, const HasSource extends SlotSource | ComputeBinding<unknown> | undefined = undefined>(fields: I, opts: ListRecordOptions<I> & {
|
|
422
|
+
source?: HasSource;
|
|
423
|
+
fill?: ListRecordFillFor<I>;
|
|
424
|
+
} & WritebackOption<HasSource> & FillOption<HasSource, ListRecordFillFor<I>>): ListRecordSlotDef<I> & SourceMark<HasSource> & FillMark<ListRecordFillFor<I>>;
|
|
425
|
+
/**
|
|
426
|
+
* The list slot — one primitive for everything multi-item. The item is a
|
|
427
|
+
* single slot (`list.of(text.short({ label: "Feature", cap: 80 }), { label: "Features" })`,
|
|
428
|
+
* `list.of(image({ label: "Photo", crop }), { min: 3, label: "Photos" })`,
|
|
429
|
+
* `list.of(poi({ label: "Restaurant" }), { max: 6, label: "Restaurants" })`)
|
|
430
|
+
* or a record of slots
|
|
431
|
+
* (`list.of({ photo: image({ label: "Photo" }), caption: text.short({ label: "Caption", cap: 80 }) }, { label: "Slides" })`).
|
|
432
|
+
* A single item emits `element`; a record emits `fields` with the optional
|
|
433
|
+
* `layout`/`title` row surface. Depth is fixed: an item is never a list, a
|
|
434
|
+
* record field is never a record, and a field-level list holds a single
|
|
435
|
+
* non-record item — each violation is a compile error here and a parse error
|
|
436
|
+
* on the wire.
|
|
437
|
+
*/
|
|
438
|
+
declare const list: {
|
|
439
|
+
of: typeof listOfElement & typeof listOfRecord;
|
|
440
|
+
};
|
|
441
|
+
interface PoiOptions {
|
|
442
|
+
label: string;
|
|
443
|
+
locked?: boolean;
|
|
444
|
+
placeholder?: string;
|
|
445
|
+
when?: string | readonly string[];
|
|
446
|
+
}
|
|
447
|
+
/** The serialized shape the `poi` builder emits — a `poi`-kind `SlotDef`. */
|
|
448
|
+
interface PoiSlotDef extends Head {
|
|
449
|
+
type: "poi";
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* A single point of interest — one platform-built place (a `PoiRow`), picked
|
|
453
|
+
* in the editor's place search. The platform owns the row's content; there is
|
|
454
|
+
* nothing to configure beyond the head. Usable standalone or as a list item
|
|
455
|
+
* (`list.of(poi({ label: "Restaurant" }), { label: "Restaurants" })`).
|
|
456
|
+
* @example
|
|
457
|
+
* ```ts
|
|
458
|
+
* import { poi } from "@homepages/concrete";
|
|
459
|
+
*
|
|
460
|
+
* poi({ label: "Nearest station", placeholder: "Search places…" });
|
|
461
|
+
* ```
|
|
462
|
+
*/
|
|
463
|
+
declare function poi(opts: PoiOptions): PoiSlotDef;
|
|
464
|
+
interface DocumentOptions {
|
|
465
|
+
label: string;
|
|
466
|
+
locked?: boolean;
|
|
467
|
+
placeholder?: string;
|
|
468
|
+
when?: string | readonly string[];
|
|
469
|
+
fill?: BuiltDecision<"document-assign">;
|
|
470
|
+
}
|
|
471
|
+
/** The serialized shape the `document` builder emits — a `document`-kind `SlotDef`. */
|
|
472
|
+
interface DocumentSlotDef extends Head {
|
|
473
|
+
type: "document";
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* A single platform-hosted document — a pdf, spreadsheet, or office file the
|
|
477
|
+
* visitor opens in the browser or downloads. The value resolves to one
|
|
478
|
+
* `DocumentValue` (served url plus filename, type and size); render it with
|
|
479
|
+
* `Slot.Document`, which is one anchor.
|
|
480
|
+
*
|
|
481
|
+
* Reach for `url({ accepts: "file" })` instead when the file lives somewhere
|
|
482
|
+
* else — a Drive or Dropbox link the platform neither stores nor serves.
|
|
483
|
+
*
|
|
484
|
+
* `fill` takes a `documentAssign`, which picks one file out of the documents
|
|
485
|
+
* stored on the property. Usable standalone or as a list item — a
|
|
486
|
+
* `list.of(document(...))` carries its own `listFill` and picks a SET from the
|
|
487
|
+
* same pool.
|
|
488
|
+
* @example
|
|
489
|
+
* ```ts
|
|
490
|
+
* import { document, documentAssign } from "@homepages/concrete";
|
|
491
|
+
*
|
|
492
|
+
* document({ label: "Offering brochure", fill: documentAssign({ pick: "The full property brochure." }) });
|
|
493
|
+
* ```
|
|
494
|
+
*/
|
|
495
|
+
declare function document(opts: DocumentOptions): DocumentSlotDef & FillMark<BuiltDecision<"document-assign">>;
|
|
496
|
+
//#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 };
|