@homepages/concrete 6.2.0 → 8.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 +152 -0
- package/codemods/manifest.json +19 -0
- package/codemods/object-form-only.mjs +39 -0
- package/codemods/steps/list-object-form.mjs +688 -0
- package/codemods/steps/select-object-form.mjs +210 -0
- package/dist/artifact/playground/client/assets/index-Dn_xT16-.js +1101 -0
- package/dist/artifact/playground/client/index.html +1 -1
- package/dist/artifact/playground/host.mjs +14 -14
- package/dist/asset-modules.d.ts +2 -1
- package/dist/cli/check/stages/render.js +1 -1
- package/dist/cli/check/stages/sections.js +1 -1
- package/dist/fixtures/canonical.d.ts +2 -5
- package/dist/fixtures/media.js +11 -25
- package/dist/fixtures/property.js +28 -16
- package/dist/fixtures/resolve.js +31 -17
- package/dist/fixtures/rows.js +3 -83
- package/dist/fixtures.d.ts +17 -9
- package/dist/index.d.ts +9 -9
- package/dist/packages/external/concrete/package.js +1 -1
- package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +32 -10
- package/dist/packages/internal/fill-bake/dist/derive-source.js +15 -4
- package/dist/packages/internal/fill-bake/dist/index.js +2 -2
- package/dist/packages/internal/fill-vocabulary/dist/origination.js +6 -61
- package/dist/packages/internal/fill-vocabulary/dist/row-reads.js +15 -0
- package/dist/packages/internal/property-facts/dist/index.js +1 -1
- package/dist/packages/internal/property-facts/dist/{property-facts-5pxZnlkh.js → property-facts-Cy7-O4p0.js} +2 -5
- package/dist/packages/internal/section-contracts/dist/catalog.js +2 -22
- package/dist/packages/internal/section-contracts/dist/fill-spec-view.js +6 -1
- package/dist/packages/internal/section-contracts/dist/group-contract.js +1 -3
- package/dist/packages/internal/section-contracts/dist/index.js +0 -5
- package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +16 -7
- package/dist/packages/internal/section-contracts/dist/list-scalar-contract.js +1 -5
- package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +14 -0
- package/dist/packages/internal/section-contracts/dist/runners.js +3 -28
- package/dist/packages/internal/section-contracts/dist/source-contract.js +93 -20
- package/dist/packages/internal/section-contracts/dist/writer-reads-fact-contract.js +19 -9
- package/dist/packages/internal/source-resolution/dist/index.js +48 -57
- package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +6 -17
- package/dist/packages/internal/template-contracts/dist/facts-view.js +4 -23
- package/dist/packages/internal/template-contracts/dist/row-sources.js +20 -0
- package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +362 -380
- package/dist/packages/internal/template-contracts/dist/slot-catalog.js +289 -293
- package/dist/primitives/slot-bindings.d.ts +7 -40
- package/dist/primitives/slot-bindings.js +10 -12
- package/dist/schema/define-schema.d.ts +1 -1
- package/dist/schema/define-schema.js +13 -1
- package/dist/schema/extract-fill-spec.js +14 -17
- package/dist/schema/fact.d.ts +2 -19
- package/dist/schema/fill-builders.d.ts +4 -3
- package/dist/schema/fill-spec.js +18 -1
- package/dist/schema/layout.d.ts +6 -8
- package/dist/schema/layout.js +3 -9
- package/dist/schema/property-facts.d.ts +17 -47
- package/dist/schema/row-fields.js +88 -0
- package/dist/schema/row-ref.d.ts +59 -0
- package/dist/schema/row-ref.js +28 -0
- package/dist/schema/runtime-values.d.ts +8 -13
- package/dist/schema/section-props.d.ts +19 -26
- package/dist/schema/section-schema.d.ts +6 -6
- package/dist/schema/section-schema.js +2 -2
- package/dist/schema/slot-builders.d.ts +247 -122
- package/dist/schema/slot-builders.js +57 -28
- package/dist/schema/slot-ref.d.ts +18 -2
- package/dist/schema/slot-ref.js +11 -3
- package/dist/schema/slot-types.d.ts +7 -7
- package/dist/schema/slot-types.js +55 -19
- package/dist/section/declare.d.ts +1 -1
- package/dist/section/section.d.ts +3 -3
- package/dist/template/logic-shim.d.ts +1 -1
- package/guide/reference/cli/INDEX.md +2 -2
- package/guide/reference/cli/build.md +1 -1
- package/guide/reference/cli/check.md +1 -1
- package/guide/reference/cli/dev.md +1 -1
- package/guide/reference/cli/property-add.md +1 -1
- package/guide/reference/cli/property-list.md +1 -1
- package/guide/reference/cli/publish.md +1 -1
- package/guide/reference/cli/upgrade.md +1 -1
- package/guide/reference/rules/INDEX.md +3 -8
- package/package.json +1 -1
- package/tsconfig.base.json +1 -0
- package/dist/artifact/playground/client/assets/index-Cqz-jjVw.js +0 -1101
- package/dist/packages/internal/section-contracts/dist/choose-select-contract.js +0 -20
- package/dist/packages/internal/section-contracts/dist/name-title-contract.js +0 -20
- package/dist/packages/internal/section-contracts/dist/pooling-field-contract.js +0 -20
- package/dist/packages/internal/section-contracts/dist/row-contract.js +0 -37
- package/dist/packages/internal/section-contracts/dist/source-filter-contract.js +0 -15
- package/dist/packages/internal/template-contracts/dist/layout.js +0 -10
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { COLLECTIONS, FACT_GRAPH } from "../packages/internal/template-contracts/dist/slot-catalog.js";
|
|
2
|
+
import { isSiblingSlot, isSlotRef } from "./slot-ref.js";
|
|
3
|
+
|
|
4
|
+
//#region src/schema/row-ref.ts
|
|
5
|
+
function boundCollection(source) {
|
|
6
|
+
if (typeof source !== "object" || source === null) return void 0;
|
|
7
|
+
const { kind, field } = source;
|
|
8
|
+
return kind === "direct" && typeof field === "string" && Object.hasOwn(COLLECTIONS, field) ? field : void 0;
|
|
9
|
+
}
|
|
10
|
+
function collectionMembers(c) {
|
|
11
|
+
const row = FACT_GRAPH[c].row;
|
|
12
|
+
return Object.keys(row).filter((member) => member !== COLLECTIONS[c].idKey);
|
|
13
|
+
}
|
|
14
|
+
function rowRef(field) {
|
|
15
|
+
return Object.freeze({
|
|
16
|
+
kind: "row",
|
|
17
|
+
field
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function rowReference(source) {
|
|
21
|
+
const collection = boundCollection(source);
|
|
22
|
+
if (collection !== void 0) return Object.freeze(Object.fromEntries(collectionMembers(collection).map((member) => [member, rowRef(member)])));
|
|
23
|
+
if (!((typeof source === "object" && source !== null ? source.kind : void 0) === "compute" || isSlotRef(source) || isSiblingSlot(source))) return Object.freeze({});
|
|
24
|
+
return new Proxy({}, { get: (_target, member) => typeof member === "string" ? rowRef(member) : void 0 });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { boundCollection, collectionMembers, rowReference };
|
|
@@ -3,7 +3,7 @@ import { VideoCollectionValue, VideoValue } from "../packages/internal/template-
|
|
|
3
3
|
import { TourCollectionValue, TourValue } from "../packages/internal/template-contracts/dist/tour-value.js";
|
|
4
4
|
import { DocumentCollectionValue, DocumentValue } from "../packages/internal/template-contracts/dist/document-value.js";
|
|
5
5
|
import { PoiPhoto, PoiRow } from "../packages/internal/template-contracts/dist/poi-row.js";
|
|
6
|
-
import { ComparableRow, Coordinates,
|
|
6
|
+
import { ComparableRow, Coordinates, Narrative } from "./property-facts.js";
|
|
7
7
|
//#region src/schema/runtime-values.d.ts
|
|
8
8
|
/**
|
|
9
9
|
* An image slot's runtime value after resolution: `url`/`alt` plus optional
|
|
@@ -29,20 +29,15 @@ type ImageValue = {
|
|
|
29
29
|
responsive?: ResponsiveImage | null;
|
|
30
30
|
} | null;
|
|
31
31
|
responsive?: ResponsiveImage | null;
|
|
32
|
+
/**
|
|
33
|
+
* A unit's floor plan only — an element of a row field bound to `unit.floor_plans`:
|
|
34
|
+
* the plan's floor label ("Upper Level"), or `null` for an unlabelled plan. Absent on
|
|
35
|
+
* every other image.
|
|
36
|
+
*/
|
|
37
|
+
floor_label?: string | null;
|
|
32
38
|
};
|
|
33
39
|
/** An image list slot's runtime value: an ordered array of `ImageValue`, possibly empty. */
|
|
34
40
|
type ImageCollectionValue = ImageValue[];
|
|
35
|
-
/**
|
|
36
|
-
* The members every row of a `contacts`-bound record list carries, whatever
|
|
37
|
-
* the slot declares: `id`, the contact's stable row identity. Every other
|
|
38
|
-
* member of a contact row is one of the slot's own declared fields, keyed by
|
|
39
|
-
* its declaration and typed from its builder — a contact row has no
|
|
40
|
-
* projection-only members, so reading a field the slot does not declare is a
|
|
41
|
-
* compile error.
|
|
42
|
-
*/
|
|
43
|
-
type ContactRow = {
|
|
44
|
-
id: string;
|
|
45
|
-
};
|
|
46
41
|
/**
|
|
47
42
|
* A raster image the template itself ships — a build-time `import` of a file
|
|
48
43
|
* under the template's own assets — resolved to its optimized responsive
|
|
@@ -73,4 +68,4 @@ type PlaybackConfig = {
|
|
|
73
68
|
preload?: "none" | "metadata" | "auto";
|
|
74
69
|
};
|
|
75
70
|
//#endregion
|
|
76
|
-
export { AuthorImage, type ComparableRow,
|
|
71
|
+
export { AuthorImage, type ComparableRow, type Coordinates, type DocumentCollectionValue, type DocumentValue, ImageCollectionValue, ImageValue, type Narrative, PlaybackConfig, type PoiPhoto, type PoiRow, type TourCollectionValue, type TourValue, type VideoCollectionValue, type VideoValue };
|
|
@@ -4,7 +4,7 @@ import { TourValue } from "../packages/internal/template-contracts/dist/tour-val
|
|
|
4
4
|
import { DocumentValue } from "../packages/internal/template-contracts/dist/document-value.js";
|
|
5
5
|
import { PoiRow } from "../packages/internal/template-contracts/dist/poi-row.js";
|
|
6
6
|
import { ImageValue } from "./runtime-values.js";
|
|
7
|
-
import {
|
|
7
|
+
import { CollectionIdKey } from "./row-ref.js";
|
|
8
8
|
import { SectionNav } from "./section-nav.js";
|
|
9
9
|
import { SectionSchemaShape } from "./section-schema.js";
|
|
10
10
|
//#region src/schema/section-props.d.ts
|
|
@@ -14,10 +14,10 @@ import { SectionSchemaShape } from "./section-schema.js";
|
|
|
14
14
|
* normalized by the binding layer. String-valued kinds (`text`, `select`,
|
|
15
15
|
* `url`) are plain `string` — the canonical blank is `""`, never `null`; a
|
|
16
16
|
* `number`, `image`, `poi` or `document` slot's blank is `null`. A `list` slot is always an
|
|
17
|
-
* array, never `null` — an empty list is the absent state. A record list
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
17
|
+
* array, never `null` — an empty list is the absent state. A record list's row
|
|
18
|
+
* is its identity plus its declared fields and nothing else: a list bound to a
|
|
19
|
+
* collection carries that collection's identity key (a unit's `unit_id`, a
|
|
20
|
+
* contact's or comparable's `id`), every other record list the stamped `id`.
|
|
21
21
|
*/
|
|
22
22
|
type SlotValue<S> = S extends {
|
|
23
23
|
type: "text";
|
|
@@ -32,27 +32,29 @@ type SlotValue<S> = S extends {
|
|
|
32
32
|
} ? VideoValue | null : S extends {
|
|
33
33
|
type: "tour";
|
|
34
34
|
} ? TourValue | null : S extends {
|
|
35
|
+
type: "list";
|
|
36
|
+
readonly __row?: infer R;
|
|
37
|
+
} ? (unknown extends R ? ListValue<S> : R[]) : S extends {
|
|
38
|
+
type: "poi";
|
|
39
|
+
} ? PoiRow | null : S extends {
|
|
40
|
+
type: "url";
|
|
41
|
+
} ? string : S extends {
|
|
42
|
+
type: "document";
|
|
43
|
+
} ? DocumentValue | null : never;
|
|
44
|
+
type ListValue<S> = S extends {
|
|
35
45
|
type: "list";
|
|
36
46
|
source: {
|
|
37
47
|
kind: "direct";
|
|
38
48
|
field: infer F extends CollectionField;
|
|
39
49
|
};
|
|
40
50
|
fields: infer I;
|
|
41
|
-
} ?
|
|
51
|
+
} ? BoundRowValue<F, I>[] : S extends {
|
|
42
52
|
type: "list";
|
|
43
53
|
fields: infer I;
|
|
44
54
|
} ? RowValue<I>[] : S extends {
|
|
45
55
|
type: "list";
|
|
46
56
|
element: infer E;
|
|
47
|
-
} ? NonNullable<SlotValue<E>>[] :
|
|
48
|
-
type: "list";
|
|
49
|
-
} ? unknown[] : S extends {
|
|
50
|
-
type: "poi";
|
|
51
|
-
} ? PoiRow | null : S extends {
|
|
52
|
-
type: "url";
|
|
53
|
-
} ? string : S extends {
|
|
54
|
-
type: "document";
|
|
55
|
-
} ? DocumentValue | null : never;
|
|
57
|
+
} ? NonNullable<SlotValue<E>>[] : unknown[];
|
|
56
58
|
/**
|
|
57
59
|
* One row of a record `list` slot, derived from the declared `fields` record:
|
|
58
60
|
* the editor-stamped `id` — which every persisted row carries though `fields`
|
|
@@ -63,16 +65,7 @@ type SlotValue<S> = S extends {
|
|
|
63
65
|
type RowValue<I> = {
|
|
64
66
|
id: string;
|
|
65
67
|
} & { [K in keyof I]: SlotValue<I[K]>; };
|
|
66
|
-
|
|
67
|
-
* One row of a record `list` bound whole-row to a bakeable fact array
|
|
68
|
-
* (`source: fact.property.units` / `fact.property.contacts`): the members the
|
|
69
|
-
* collection projects onto every row (`CollectionRowValues[F]`), plus each
|
|
70
|
-
* declared field the base does not already carry, typed from its builder. A
|
|
71
|
-
* field the base does carry keeps the base's type — the bake delivers that
|
|
72
|
-
* shape whether or not the field is also declared. A contact row's base is its
|
|
73
|
-
* `id`, so its every other member is a declared field.
|
|
74
|
-
*/
|
|
75
|
-
type BakedRowValue<F extends CollectionField, I> = CollectionRowValues[F] & { [K in Exclude<keyof I, keyof CollectionRowValues[F]>]: SlotValue<I[K]>; };
|
|
68
|
+
type BoundRowValue<C extends CollectionField, I> = { [K in CollectionIdKey<C>]: string; } & { [K in keyof I]: SlotValue<I[K]>; };
|
|
76
69
|
type VariantOf<S extends SectionSchemaShape> = S["meta"] extends {
|
|
77
70
|
display: {
|
|
78
71
|
variant: {
|
|
@@ -93,4 +86,4 @@ type SectionProps<S extends SectionSchemaShape> = {
|
|
|
93
86
|
variant: VariantOf<S>;
|
|
94
87
|
};
|
|
95
88
|
//#endregion
|
|
96
|
-
export {
|
|
89
|
+
export { BoundRowValue, RowValue, SectionProps, SlotValue };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { Slot } from "./slot-types.js";
|
|
1
2
|
import { VideoCollectionValue, VideoValue } from "../packages/internal/template-contracts/dist/video-value.js";
|
|
2
3
|
import { TourCollectionValue, TourValue } from "../packages/internal/template-contracts/dist/tour-value.js";
|
|
3
4
|
import { DocumentCollectionValue, DocumentValue } from "../packages/internal/template-contracts/dist/document-value.js";
|
|
4
5
|
import { PoiPhoto, PoiRow } from "../packages/internal/template-contracts/dist/poi-row.js";
|
|
5
|
-
import { ComparableRow, Coordinates,
|
|
6
|
-
import { AuthorImage,
|
|
7
|
-
import {
|
|
8
|
-
import { BakedRowValue, RowValue, SectionProps, SlotValue } from "./section-props.js";
|
|
6
|
+
import { ComparableRow, Coordinates, Narrative } from "./property-facts.js";
|
|
7
|
+
import { AuthorImage, ImageCollectionValue, ImageValue, PlaybackConfig } from "./runtime-values.js";
|
|
8
|
+
import { RowValue, SectionProps, SlotValue } from "./section-props.js";
|
|
9
9
|
import { z } from "zod";
|
|
10
10
|
//#region src/schema/section-schema.d.ts
|
|
11
11
|
/** One `meta.display` entry as consumers read it: declared `cases` (first =
|
|
@@ -39,7 +39,7 @@ declare const SectionSchema: z.ZodObject<{
|
|
|
39
39
|
groups: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
40
40
|
id: z.ZodString;
|
|
41
41
|
label: z.ZodString;
|
|
42
|
-
members: z.ZodArray<z.
|
|
42
|
+
members: z.ZodArray<z.ZodString>;
|
|
43
43
|
}, z.core.$strict>>>;
|
|
44
44
|
display: z.ZodOptional<z.ZodType<DisplayShape, DisplayShape, z.core.$ZodTypeInternals<DisplayShape, DisplayShape>>>;
|
|
45
45
|
}, z.core.$strict>;
|
|
@@ -49,4 +49,4 @@ declare const SectionSchema: z.ZodObject<{
|
|
|
49
49
|
/** The authored input shape of `SectionSchema` — what `as const satisfies SectionSchemaShape` checks a section's `schema.ts` against. */
|
|
50
50
|
type SectionSchemaShape = z.input<typeof SectionSchema>;
|
|
51
51
|
//#endregion
|
|
52
|
-
export { type AuthorImage, type ComparableRow, type
|
|
52
|
+
export { type AuthorImage, type ComparableRow, type Coordinates, DisplayEntryShape, DisplayShape, type DocumentCollectionValue, type DocumentValue, 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 VideoCollectionValue, type VideoValue };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CONTENT_SLOT_TYPES, REF_SLOT_TYPES, SLOT_TYPES } from "../packages/internal/template-contracts/dist/slot-catalog.js";
|
|
1
|
+
import { CONTENT_SLOT_TYPES, REFERRAL_FIELDS, REF_SLOT_TYPES, SLOT_TYPES } from "../packages/internal/template-contracts/dist/slot-catalog.js";
|
|
2
2
|
import { SerializedReads, SlotDef, defaultForSlotType } from "./slot-types.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ import { z } from "zod";
|
|
|
6
6
|
const SlotGroupDef = z.object({
|
|
7
7
|
id: z.string(),
|
|
8
8
|
label: z.string(),
|
|
9
|
-
members: z.array(z.
|
|
9
|
+
members: z.array(z.string()).min(1)
|
|
10
10
|
}).strict();
|
|
11
11
|
const DisplayEntryDef = z.object({
|
|
12
12
|
cases: z.array(z.string().min(1)).min(1),
|