@homepages/concrete 6.2.0 → 7.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 +133 -0
- package/codemods/manifest.json +13 -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-D8eepVr-.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 +31 -8
- 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 -1
- 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 +0 -4
- package/dist/packages/internal/section-contracts/dist/choose-select-contract.js +4 -4
- package/dist/packages/internal/section-contracts/dist/fill-spec-view.js +5 -1
- package/dist/packages/internal/section-contracts/dist/group-contract.js +1 -3
- package/dist/packages/internal/section-contracts/dist/index.js +0 -1
- package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +3 -3
- package/dist/packages/internal/section-contracts/dist/list-scalar-contract.js +1 -5
- package/dist/packages/internal/section-contracts/dist/name-title-contract.js +2 -2
- package/dist/packages/internal/section-contracts/dist/pooling-field-contract.js +3 -1
- package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +14 -0
- package/dist/packages/internal/section-contracts/dist/runners.js +0 -5
- package/dist/packages/internal/section-contracts/dist/source-contract.js +80 -4
- package/dist/packages/internal/section-contracts/dist/writer-reads-fact-contract.js +12 -6
- package/dist/packages/internal/source-resolution/dist/index.js +57 -20
- package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +16 -17
- package/dist/packages/internal/template-contracts/dist/facts-view.js +6 -18
- package/dist/packages/internal/template-contracts/dist/row-sources.js +26 -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 -289
- 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 +15 -13
- package/dist/schema/fact.d.ts +2 -19
- package/dist/schema/fill-builders.d.ts +4 -3
- package/dist/schema/fill-spec.js +9 -1
- package/dist/schema/layout.d.ts +6 -8
- package/dist/schema/layout.js +3 -9
- package/dist/schema/property-facts.d.ts +16 -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 +222 -117
- 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 +1 -2
- 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/row-contract.js +0 -37
- package/dist/packages/internal/template-contracts/dist/layout.js +0 -10
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
import { mirror } from "./compute.js";
|
|
2
2
|
import { isFillBinding } from "./fill-builders.js";
|
|
3
3
|
import { fillMark, getFill } from "./fill-declaration.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { isFactRef, isRowRef, isSiblingSlot, isSlotRef } from "./slot-ref.js";
|
|
5
|
+
import { rowReference } from "./row-ref.js";
|
|
6
|
+
import { resolveRowFields } from "./row-fields.js";
|
|
6
7
|
|
|
7
8
|
//#region src/schema/slot-builders.ts
|
|
9
|
+
function bakedSource(source) {
|
|
10
|
+
if (isSlotRef(source) || isSiblingSlot(source)) return mirror(source);
|
|
11
|
+
if (isRowRef(source)) return {
|
|
12
|
+
kind: "row",
|
|
13
|
+
field: source.field
|
|
14
|
+
};
|
|
15
|
+
return source;
|
|
16
|
+
}
|
|
8
17
|
function head(opts) {
|
|
9
18
|
const source = opts.source;
|
|
10
19
|
const baked = source !== void 0 && !isFillBinding(source);
|
|
11
20
|
return {
|
|
12
21
|
...opts.locked === true ? { locked: true } : {},
|
|
13
|
-
...baked ? { source:
|
|
22
|
+
...baked ? { source: bakedSource(source) } : {},
|
|
14
23
|
...fillMark(source),
|
|
15
24
|
...opts.writeback !== void 0 ? { writeback: opts.writeback } : {},
|
|
16
25
|
label: opts.label,
|
|
@@ -42,7 +51,7 @@ function number(opts) {
|
|
|
42
51
|
...opts.maxDigits !== void 0 ? { maxDigits: opts.maxDigits } : {}
|
|
43
52
|
};
|
|
44
53
|
}
|
|
45
|
-
function
|
|
54
|
+
function selectFromFact(opts) {
|
|
46
55
|
const source = opts.source;
|
|
47
56
|
return {
|
|
48
57
|
type: "select",
|
|
@@ -51,12 +60,14 @@ function selectFn(opts) {
|
|
|
51
60
|
...opts.creatable !== void 0 ? { creatable: opts.creatable } : {}
|
|
52
61
|
};
|
|
53
62
|
}
|
|
54
|
-
function
|
|
63
|
+
function selectFromOptions(opts) {
|
|
64
|
+
if (isFactRef(opts.source)) throw new Error(`select: "${opts.label}" declares both \`options\` and a fact \`source\` — a select takes exactly one set of choices.`);
|
|
55
65
|
return {
|
|
56
66
|
type: "select",
|
|
57
67
|
...head(opts),
|
|
58
|
-
values: [...
|
|
59
|
-
...opts.creatable !== void 0 ? { creatable: opts.creatable } : {}
|
|
68
|
+
values: [...opts.options],
|
|
69
|
+
...opts.creatable !== void 0 ? { creatable: opts.creatable } : {},
|
|
70
|
+
...opts.unique === true ? { unique: true } : {}
|
|
60
71
|
};
|
|
61
72
|
}
|
|
62
73
|
function displaySelect(cases, opts) {
|
|
@@ -66,10 +77,12 @@ function displaySelect(cases, opts) {
|
|
|
66
77
|
...opts.source !== void 0 ? { source: opts.source } : {}
|
|
67
78
|
};
|
|
68
79
|
}
|
|
69
|
-
function selectDispatch(
|
|
70
|
-
|
|
80
|
+
function selectDispatch(opts) {
|
|
81
|
+
if (Array.isArray(opts)) throw new Error("select: takes one options object — write the choices as `options`: `select({ options: [...], … })`.");
|
|
82
|
+
if (opts.label === void 0 && Array.isArray(opts.options)) return displaySelect(opts.options, opts);
|
|
83
|
+
return opts.options !== void 0 ? selectFromOptions(opts) : selectFromFact(opts);
|
|
71
84
|
}
|
|
72
|
-
const select =
|
|
85
|
+
const select = selectDispatch;
|
|
73
86
|
function url(opts) {
|
|
74
87
|
return {
|
|
75
88
|
type: "url",
|
|
@@ -81,56 +94,71 @@ function image(opts) {
|
|
|
81
94
|
return {
|
|
82
95
|
type: "image",
|
|
83
96
|
...head(opts),
|
|
84
|
-
...opts.
|
|
85
|
-
...opts
|
|
97
|
+
...opts.crop !== void 0 ? { crop: opts.crop } : {},
|
|
98
|
+
...uniqueOf(opts)
|
|
86
99
|
};
|
|
87
100
|
}
|
|
101
|
+
function uniqueOf(opts) {
|
|
102
|
+
return opts.unique === true ? { unique: true } : {};
|
|
103
|
+
}
|
|
88
104
|
function video(opts) {
|
|
89
105
|
return {
|
|
90
106
|
type: "video",
|
|
91
107
|
...head(opts),
|
|
92
108
|
...opts.playback !== void 0 ? { playback: opts.playback } : {},
|
|
93
|
-
...opts.sources !== void 0 ? { sources: opts.sources } : {}
|
|
109
|
+
...opts.sources !== void 0 ? { sources: opts.sources } : {},
|
|
110
|
+
...uniqueOf(opts)
|
|
94
111
|
};
|
|
95
112
|
}
|
|
96
113
|
function tour(opts) {
|
|
97
114
|
return {
|
|
98
115
|
type: "tour",
|
|
99
|
-
...head(opts)
|
|
116
|
+
...head(opts),
|
|
117
|
+
...uniqueOf(opts)
|
|
100
118
|
};
|
|
101
119
|
}
|
|
102
|
-
const
|
|
120
|
+
const ITEM_ONLY_KEYS = ["locked", "unique"];
|
|
103
121
|
function stripElementHead(element) {
|
|
104
122
|
const bare = {};
|
|
105
|
-
for (const [key, value] of Object.entries(element)) if (!
|
|
123
|
+
for (const [key, value] of Object.entries(element)) if (!ITEM_ONLY_KEYS.includes(key)) bare[key] = value;
|
|
106
124
|
return bare;
|
|
107
125
|
}
|
|
108
|
-
function
|
|
109
|
-
if (getFill(element) !== void 0) throw new Error(`list
|
|
126
|
+
function itemList(label, element, opts, unique) {
|
|
127
|
+
if (getFill(element) !== void 0) throw new Error(`list: the element of "${label}" declares a fill — one decision produces the whole list, so \`source: fill(…)\` belongs on the list slot.`);
|
|
110
128
|
return {
|
|
111
|
-
type: "list",
|
|
112
|
-
...head(opts),
|
|
113
129
|
element: stripElementHead(element),
|
|
114
130
|
...opts.min !== void 0 ? { min: opts.min } : {},
|
|
115
131
|
...opts.max !== void 0 ? { max: opts.max } : {},
|
|
116
|
-
...
|
|
132
|
+
...unique !== void 0 ? { unique } : {}
|
|
117
133
|
};
|
|
118
134
|
}
|
|
119
|
-
function
|
|
135
|
+
function listFromItem(opts) {
|
|
136
|
+
if (opts.unique !== void 0) throw new Error(`list: "${opts.label}" declares \`unique\` on the list — write it on the item, \`item: select({ …, unique: true })\`.`);
|
|
137
|
+
const element = opts.item;
|
|
138
|
+
const unique = element.unique === true ? true : void 0;
|
|
120
139
|
return {
|
|
121
140
|
type: "list",
|
|
122
141
|
...head(opts),
|
|
123
|
-
|
|
124
|
-
|
|
142
|
+
...itemList(opts.label, element, opts, unique)
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function listFromFields(opts) {
|
|
146
|
+
const declared = opts.fields(rowReference(opts.source));
|
|
147
|
+
return {
|
|
148
|
+
type: "list",
|
|
149
|
+
...head(opts),
|
|
150
|
+
fields: resolveRowFields(opts.label, opts.source, declared),
|
|
125
151
|
...opts.title !== void 0 ? { title: opts.title } : {},
|
|
126
152
|
...opts.min !== void 0 ? { min: opts.min } : {},
|
|
127
153
|
...opts.max !== void 0 ? { max: opts.max } : {}
|
|
128
154
|
};
|
|
129
155
|
}
|
|
130
|
-
function
|
|
131
|
-
|
|
156
|
+
function listDispatch(opts) {
|
|
157
|
+
const hasItem = opts.item !== void 0;
|
|
158
|
+
if (hasItem === (opts.fields !== void 0)) throw new Error(`list: "${String(opts.label)}" declares ${hasItem ? "both `item` and `fields`" : "neither `item` nor `fields`"} — a list declares exactly one: \`item\` for one slot per entry, \`fields\` for a record.`);
|
|
159
|
+
return hasItem ? listFromItem(opts) : listFromFields(opts);
|
|
132
160
|
}
|
|
133
|
-
const list =
|
|
161
|
+
const list = listDispatch;
|
|
134
162
|
function poi(opts) {
|
|
135
163
|
return {
|
|
136
164
|
type: "poi",
|
|
@@ -140,7 +168,8 @@ function poi(opts) {
|
|
|
140
168
|
function document(opts) {
|
|
141
169
|
return {
|
|
142
170
|
type: "document",
|
|
143
|
-
...head(opts)
|
|
171
|
+
...head(opts),
|
|
172
|
+
...uniqueOf(opts)
|
|
144
173
|
};
|
|
145
174
|
}
|
|
146
175
|
|
|
@@ -31,13 +31,29 @@ interface FactRef<Key extends string = string, Value = unknown> {
|
|
|
31
31
|
/** Phantom: the value a `compute()` callback receives for this ref. Never present at runtime. */
|
|
32
32
|
readonly __value?: Value;
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* One member of the row a record list hands each row — what `row.<member>` IS
|
|
36
|
+
* inside `list({ fields: (row) => … })`, and what an earlier field of the same row
|
|
37
|
+
* becomes once the list resolves it. Its runtime shape is its wire shape, as a fact
|
|
38
|
+
* ref's is: `{kind:"row", field}`, which the row field's `source:` emits verbatim.
|
|
39
|
+
* It resolves against the current row, never the primary one — that is what
|
|
40
|
+
* `fact.unit.*` / `fact.contact.*` name.
|
|
41
|
+
*/
|
|
42
|
+
interface RowRef<Field extends string = string, Value = unknown, Writable extends boolean = boolean> {
|
|
43
|
+
readonly kind: "row";
|
|
44
|
+
readonly field: Field;
|
|
45
|
+
/** Phantom: the member's value type. Never present at runtime. */
|
|
46
|
+
readonly __value?: Value;
|
|
47
|
+
/** Phantom: whether the member writes back, which decides a row field's `writeback`. Never present at runtime. */
|
|
48
|
+
readonly __writable?: Writable;
|
|
49
|
+
}
|
|
34
50
|
/**
|
|
35
51
|
* A typed handle on one value the platform can resolve — what `source:`, a
|
|
36
52
|
* `compute`'s `reads` and a fill decision's `reads` all take. A new kind is
|
|
37
53
|
* additive: it answers where its value comes from and when it settles, and
|
|
38
54
|
* changes no consumer.
|
|
39
55
|
*/
|
|
40
|
-
type Ref = FactRef | SlotRef;
|
|
56
|
+
type Ref = FactRef | SlotRef | RowRef;
|
|
41
57
|
/** A slot of the declaring section, named by its own const — see the module header. */
|
|
42
58
|
type SiblingSlot = Slot;
|
|
43
59
|
/** What a `compute`'s or a fill's `reads` (and a mirror's `source:`) may name: any ref, or a sibling slot. */
|
|
@@ -60,4 +76,4 @@ type ReadValue<R> = R extends SlotRef ? RefValue<R> | undefined : R extends Sibl
|
|
|
60
76
|
*/
|
|
61
77
|
type RefValues<Reads extends readonly ComputeRead[]> = { -readonly [I in keyof Reads]: ReadValue<Reads[I]>; };
|
|
62
78
|
//#endregion
|
|
63
|
-
export { ComputeRead, DISPLAY_REF_PREFIX, DisplayEntryName, FactRef, ReadValue, Ref, RefValue, RefValues, SiblingSlot, SlotRef };
|
|
79
|
+
export { ComputeRead, DISPLAY_REF_PREFIX, DisplayEntryName, FactRef, ReadValue, Ref, RefValue, RefValues, RowRef, SiblingSlot, SlotRef };
|
package/dist/schema/slot-ref.js
CHANGED
|
@@ -3,6 +3,9 @@ const DISPLAY_REF_PREFIX = "display.";
|
|
|
3
3
|
function isSlotRef(x) {
|
|
4
4
|
return typeof x === "object" && x !== null && "section" in x && typeof x.section === "string" && "slot" in x && typeof x.slot === "string";
|
|
5
5
|
}
|
|
6
|
+
function isRowRef(x) {
|
|
7
|
+
return typeof x === "object" && x !== null && "kind" in x && x.kind === "row" && "field" in x && typeof x.field === "string";
|
|
8
|
+
}
|
|
6
9
|
function isFactRef(x) {
|
|
7
10
|
return typeof x === "object" && x !== null && "kind" in x && x.kind === "direct" && "field" in x && typeof x.field === "string";
|
|
8
11
|
}
|
|
@@ -17,17 +20,22 @@ function serializeSlotRef(ref) {
|
|
|
17
20
|
};
|
|
18
21
|
}
|
|
19
22
|
function serializeRef(ref) {
|
|
20
|
-
|
|
23
|
+
if (isSlotRef(ref)) return serializeSlotRef(ref);
|
|
24
|
+
if (isRowRef(ref)) return {
|
|
25
|
+
kind: "row",
|
|
26
|
+
field: ref.field
|
|
27
|
+
};
|
|
28
|
+
return {
|
|
21
29
|
kind: "fact",
|
|
22
30
|
key: ref.field
|
|
23
31
|
};
|
|
24
32
|
}
|
|
25
33
|
function isSerializedSlotRef(ref) {
|
|
26
|
-
return ref.kind !== "fact";
|
|
34
|
+
return ref.kind !== "fact" && ref.kind !== "row";
|
|
27
35
|
}
|
|
28
36
|
function serializedSlotRefs(reads) {
|
|
29
37
|
return reads.filter(isSerializedSlotRef);
|
|
30
38
|
}
|
|
31
39
|
|
|
32
40
|
//#endregion
|
|
33
|
-
export { DISPLAY_REF_PREFIX, isFactRef, isSerializedSlotRef, isSiblingSlot, isSlotRef, serializeRef, serializeSlotRef, serializedSlotRefs };
|
|
41
|
+
export { DISPLAY_REF_PREFIX, isFactRef, isRowRef, isSerializedSlotRef, isSiblingSlot, isSlotRef, serializeRef, serializeSlotRef, serializedSlotRefs };
|
|
@@ -43,22 +43,26 @@ type SelectSlot = SlotBase & {
|
|
|
43
43
|
source: string;
|
|
44
44
|
};
|
|
45
45
|
creatable?: boolean;
|
|
46
|
+
/** A record field's cross-row distinctness — stored on a record's select or media field only. */
|
|
47
|
+
unique?: boolean;
|
|
46
48
|
};
|
|
47
49
|
/** Kind-level def type for an `image` slot — `SlotBinding<ImageSlot>` accepts any image slot. */
|
|
48
50
|
type ImageSlot = SlotBase & {
|
|
49
51
|
type: "image";
|
|
50
|
-
sourceFilter?: string;
|
|
51
52
|
crop?: unknown;
|
|
53
|
+
unique?: boolean;
|
|
52
54
|
};
|
|
53
55
|
/** Kind-level def type for a `video` slot — `SlotBinding<VideoSlot>` accepts any video slot. */
|
|
54
56
|
type VideoSlot = SlotBase & {
|
|
55
57
|
type: "video";
|
|
56
58
|
playback?: unknown;
|
|
57
59
|
sources?: unknown;
|
|
60
|
+
unique?: boolean;
|
|
58
61
|
};
|
|
59
62
|
/** Kind-level def type for a `tour` slot — `SlotBinding<TourSlot>` accepts any tour slot. */
|
|
60
63
|
type TourSlot = SlotBase & {
|
|
61
64
|
type: "tour";
|
|
65
|
+
unique?: boolean;
|
|
62
66
|
};
|
|
63
67
|
/** Kind-level def type for a `list` slot — the item is `element` (a single primitive) XOR `fields` (a record of slots). */
|
|
64
68
|
type ListSlot = SlotBase & {
|
|
@@ -69,13 +73,8 @@ type ListSlot = SlotBase & {
|
|
|
69
73
|
element?: Slot;
|
|
70
74
|
fields?: Record<string, ListFieldSlot>;
|
|
71
75
|
title?: string;
|
|
72
|
-
/** CI-stamped
|
|
76
|
+
/** CI-stamped record-item field order — the declaration order, which JSONB would drop. */
|
|
73
77
|
item_order?: string[];
|
|
74
|
-
/**
|
|
75
|
-
* A record item's nestable field layout: a bare id is full-width, an
|
|
76
|
-
* `[a, b]` tuple is one 2-up row. CI emits `item_order = flatten(layout)`.
|
|
77
|
-
*/
|
|
78
|
-
layout?: (string | [string, string])[];
|
|
79
78
|
};
|
|
80
79
|
/** Kind-level def type for a `poi` slot — one platform-built place; `SlotBinding<PoiSlot>` accepts any poi slot. */
|
|
81
80
|
type PoiSlot = SlotBase & {
|
|
@@ -89,6 +88,7 @@ type UrlSlot = SlotBase & {
|
|
|
89
88
|
/** Kind-level def type for a `document` slot — `SlotBinding<DocumentSlot>` accepts any document slot. */
|
|
90
89
|
type DocumentSlot = SlotBase & {
|
|
91
90
|
type: "document";
|
|
91
|
+
unique?: boolean;
|
|
92
92
|
};
|
|
93
93
|
/** Every slot kind an author may declare at a section's top level. */
|
|
94
94
|
type Slot = ListItemSlot | ListSlot;
|
|
@@ -25,14 +25,21 @@ const playbackConfigShape = { playback: z.object({
|
|
|
25
25
|
]).optional()
|
|
26
26
|
}).strict().refine((p) => p.autoplay !== true || p.muted === true, { message: "autoplay requires muted (browsers block unmuted autoplay)" }).optional() };
|
|
27
27
|
const videoSourcesShape = { sources: z.array(z.enum(VIDEO_SOURCES)).nonempty().optional() };
|
|
28
|
-
const SerializedReads = z.array(z.union([
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
const SerializedReads = z.array(z.union([
|
|
29
|
+
z.object({
|
|
30
|
+
kind: z.literal("fact"),
|
|
31
|
+
key: z.string().min(1)
|
|
32
|
+
}).strict(),
|
|
33
|
+
z.object({
|
|
34
|
+
kind: z.literal("row"),
|
|
35
|
+
field: z.string().min(1)
|
|
36
|
+
}).strict(),
|
|
37
|
+
z.object({
|
|
38
|
+
kind: z.literal("slot").default("slot"),
|
|
39
|
+
section: z.string().min(1),
|
|
40
|
+
slot: z.string().min(1)
|
|
41
|
+
}).strict()
|
|
42
|
+
])).min(1).optional();
|
|
36
43
|
const slotMetadataShape = {
|
|
37
44
|
label: z.string().min(1),
|
|
38
45
|
placeholder: z.string().optional(),
|
|
@@ -43,6 +50,10 @@ const slotMetadataShape = {
|
|
|
43
50
|
kind: z.literal("direct"),
|
|
44
51
|
field: z.string()
|
|
45
52
|
}).strict(),
|
|
53
|
+
z.object({
|
|
54
|
+
kind: z.literal("row"),
|
|
55
|
+
field: z.string().min(1)
|
|
56
|
+
}).strict(),
|
|
46
57
|
z.object({
|
|
47
58
|
kind: z.literal("derived"),
|
|
48
59
|
transform: z.string(),
|
|
@@ -85,10 +96,7 @@ const SLOT_TYPE_DESCRIPTORS = {
|
|
|
85
96
|
default: () => null
|
|
86
97
|
},
|
|
87
98
|
image: {
|
|
88
|
-
shape: {
|
|
89
|
-
sourceFilter: z.string().optional(),
|
|
90
|
-
...cropConfigShape
|
|
91
|
-
},
|
|
99
|
+
shape: { ...cropConfigShape },
|
|
92
100
|
default: () => ({
|
|
93
101
|
url: "",
|
|
94
102
|
alt: ""
|
|
@@ -122,8 +130,7 @@ const SLOT_TYPE_DESCRIPTORS = {
|
|
|
122
130
|
element: z.lazy(() => ListItemDef).optional(),
|
|
123
131
|
fields: z.record(z.string(), z.lazy(() => ListFieldDef)).optional(),
|
|
124
132
|
title: z.string().optional(),
|
|
125
|
-
item_order: z.array(z.string()).optional()
|
|
126
|
-
layout: z.array(z.union([z.string(), z.tuple([z.string(), z.string()])])).optional()
|
|
133
|
+
item_order: z.array(z.string()).optional()
|
|
127
134
|
},
|
|
128
135
|
default: () => []
|
|
129
136
|
},
|
|
@@ -148,10 +155,8 @@ function slotMember(type, shape) {
|
|
|
148
155
|
...slotMetadataShape
|
|
149
156
|
}).strict();
|
|
150
157
|
}
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
slotMember("number", SLOT_TYPE_DESCRIPTORS.number.shape),
|
|
154
|
-
slotMember("select", SLOT_TYPE_DESCRIPTORS.select.shape),
|
|
158
|
+
const SCALAR_DEF_MEMBERS = [slotMember("text", SLOT_TYPE_DESCRIPTORS.text.shape), slotMember("number", SLOT_TYPE_DESCRIPTORS.number.shape)];
|
|
159
|
+
const MEDIA_AND_LINK_DEF_MEMBERS = [
|
|
155
160
|
slotMember("image", SLOT_TYPE_DESCRIPTORS.image.shape),
|
|
156
161
|
slotMember("video", SLOT_TYPE_DESCRIPTORS.video.shape),
|
|
157
162
|
slotMember("tour", SLOT_TYPE_DESCRIPTORS.tour.shape),
|
|
@@ -159,6 +164,11 @@ const LIST_ITEM_DEF_MEMBERS = [
|
|
|
159
164
|
slotMember("url", SLOT_TYPE_DESCRIPTORS.url.shape),
|
|
160
165
|
slotMember("document", SLOT_TYPE_DESCRIPTORS.document.shape)
|
|
161
166
|
];
|
|
167
|
+
const LIST_ITEM_DEF_MEMBERS = [
|
|
168
|
+
...SCALAR_DEF_MEMBERS,
|
|
169
|
+
slotMember("select", SLOT_TYPE_DESCRIPTORS.select.shape),
|
|
170
|
+
...MEDIA_AND_LINK_DEF_MEMBERS
|
|
171
|
+
];
|
|
162
172
|
const ListItemDef = z.discriminatedUnion("type", [...LIST_ITEM_DEF_MEMBERS]);
|
|
163
173
|
const FIELD_LIST_DEF_MEMBER = slotMember("list", {
|
|
164
174
|
min: z.number().int().nonnegative().optional(),
|
|
@@ -166,7 +176,33 @@ const FIELD_LIST_DEF_MEMBER = slotMember("list", {
|
|
|
166
176
|
unique: z.boolean().optional(),
|
|
167
177
|
element: z.lazy(() => ListItemDef).optional()
|
|
168
178
|
});
|
|
169
|
-
const
|
|
179
|
+
const ROW_UNIQUE = { unique: z.boolean().optional() };
|
|
180
|
+
const ListFieldDef = z.discriminatedUnion("type", [
|
|
181
|
+
...SCALAR_DEF_MEMBERS,
|
|
182
|
+
slotMember("select", {
|
|
183
|
+
...SLOT_TYPE_DESCRIPTORS.select.shape,
|
|
184
|
+
...ROW_UNIQUE
|
|
185
|
+
}),
|
|
186
|
+
slotMember("image", {
|
|
187
|
+
...SLOT_TYPE_DESCRIPTORS.image.shape,
|
|
188
|
+
...ROW_UNIQUE
|
|
189
|
+
}),
|
|
190
|
+
slotMember("video", {
|
|
191
|
+
...SLOT_TYPE_DESCRIPTORS.video.shape,
|
|
192
|
+
...ROW_UNIQUE
|
|
193
|
+
}),
|
|
194
|
+
slotMember("tour", {
|
|
195
|
+
...SLOT_TYPE_DESCRIPTORS.tour.shape,
|
|
196
|
+
...ROW_UNIQUE
|
|
197
|
+
}),
|
|
198
|
+
slotMember("poi", SLOT_TYPE_DESCRIPTORS.poi.shape),
|
|
199
|
+
slotMember("url", SLOT_TYPE_DESCRIPTORS.url.shape),
|
|
200
|
+
slotMember("document", {
|
|
201
|
+
...SLOT_TYPE_DESCRIPTORS.document.shape,
|
|
202
|
+
...ROW_UNIQUE
|
|
203
|
+
}),
|
|
204
|
+
FIELD_LIST_DEF_MEMBER
|
|
205
|
+
]);
|
|
170
206
|
const SLOT_DEF_MEMBERS = [...LIST_ITEM_DEF_MEMBERS, slotMember("list", SLOT_TYPE_DESCRIPTORS.list.shape)];
|
|
171
207
|
const SlotDef = z.discriminatedUnion("type", [...SLOT_DEF_MEMBERS]);
|
|
172
208
|
function defaultForSlotType(type) {
|
|
@@ -16,7 +16,7 @@ interface SectionOptions<Key extends string, Slots extends Record<string, Slot>,
|
|
|
16
16
|
readonly label: string;
|
|
17
17
|
/** A required section is required wherever it is placed. Defaults to `false`. */
|
|
18
18
|
readonly required?: boolean;
|
|
19
|
-
/** Section `visibility` / `variant`, each an optional `select(cases, …)` entry. */
|
|
19
|
+
/** Section `visibility` / `variant`, each an optional `select({ options: cases, … })` entry. */
|
|
20
20
|
readonly display?: Display;
|
|
21
21
|
/** The slot declarations, in editor order. */
|
|
22
22
|
readonly slots: Slots;
|
|
@@ -19,9 +19,9 @@ interface SectionPlacementProps {
|
|
|
19
19
|
interface SectionRenderBindings<Slots extends Record<string, Slot>, Display extends DisplayInput> {
|
|
20
20
|
/**
|
|
21
21
|
* One binding per declared slot, keyed by slot id — what `bindSlots` returned to a Renderer.
|
|
22
|
-
* There is no raw `slots` beside it
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* There is no raw `slots` beside it. A record list's bound row is its identity plus
|
|
23
|
+
* its declared fields: a collection member the section reads is declared as a row
|
|
24
|
+
* field bound to that member (`source: comp.status`).
|
|
25
25
|
*/
|
|
26
26
|
readonly slot: SlotBindingMap<SectionSchemaOf<Slots, Display>>;
|
|
27
27
|
/** The build-injected navigation input: this section's anchor, the anchor map, the pages. */
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ATTR_ISLAND_FRAMELESS, ATTR_ISLAND_ID, ATTR_ISLAND_KEY, ATTR_ISLAND_PROPS, EDITOR_BRIDGE_PROP, EDITOR_BRIDGE_PROTOCOL, EditorBridge, EditorBridgeSelection, EditorSelection, ISLAND_CAPTURE_HOLDS_GLOBAL, ISLAND_ELEMENT, IslandComponent, IslandEditor, IslandEditorOptions, IslandModule, IslandProps, IslandPropsError, IslandServerFrame, deserializeIslandProps, islandId, serializeIslandProps } from "../packages/internal/island-runtime/dist/contract.js";
|
|
2
2
|
import { fill } from "../schema/fill-builders.js";
|
|
3
3
|
import { Slot as Slot$1 } from "../schema/slot-types.js";
|
|
4
|
-
import { fact } from "../schema/fact.js";
|
|
5
4
|
import { compute, getComputed } from "../schema/compute.js";
|
|
6
5
|
import { document, image, list, number, poi, select, text, tour, url, video } from "../schema/slot-builders.js";
|
|
7
6
|
import { DisplayInput } from "../schema/define-schema.js";
|
|
8
7
|
import { SectionDeclaration, SectionOptions } from "../section/declare.js";
|
|
9
8
|
import { ATTR_SECTION_INSTANCE_ID, ATTR_SLOT_FIELD, ATTR_SLOT_GROUP, ATTR_SLOT_ID, ATTR_SLOT_ITEM, ATTR_SLOT_TEXT_LEAF, ATTR_SLOT_UNSELECTABLE, ATTR_TR_ENHANCE } from "../packages/internal/template-contracts/dist/markers.js";
|
|
9
|
+
import { fact } from "../schema/fact.js";
|
|
10
10
|
import { presets } from "../schema/format-presets.js";
|
|
11
11
|
import { a4Landscape, a4Portrait, deck16x9, facebookPost, halfLetterFlyer, instagramPortrait, instagramSquare, instagramStory, letterLandscape, letterPortrait, linkedinPost, postcard6x4, postcard7x5, website, xPost } from "../schema/formats.js";
|
|
12
12
|
//#region src/template/logic-shim.d.ts
|
|
@@ -3,7 +3,7 @@ purpose: Every `concrete` command, with its full flag surface, exit codes and co
|
|
|
3
3
|
mode: reference
|
|
4
4
|
status: generated
|
|
5
5
|
generated_from: the concrete command table
|
|
6
|
-
applies_to: "@homepages/concrete >=
|
|
6
|
+
applies_to: "@homepages/concrete >=7.0.0 <8.0.0"
|
|
7
7
|
related: [INDEX.md]
|
|
8
8
|
---
|
|
9
9
|
# Command reference
|
|
@@ -79,7 +79,7 @@ of its flags.
|
|
|
79
79
|
|
|
80
80
|
## Versions
|
|
81
81
|
|
|
82
|
-
These pages describe `@homepages/concrete` **>=
|
|
82
|
+
These pages describe `@homepages/concrete` **>=7.0.0 <8.0.0**. The range, rather than
|
|
83
83
|
the exact version they were generated from: this reference is committed build output,
|
|
84
84
|
so a page stamped with a patch version would be stale the day it shipped.
|
|
85
85
|
`concrete --version` prints the installed one.
|
|
@@ -3,7 +3,7 @@ purpose: The `concrete build` command — its flags, exit codes and constraints.
|
|
|
3
3
|
mode: reference
|
|
4
4
|
status: generated
|
|
5
5
|
generated_from: the concrete command table
|
|
6
|
-
applies_to: "@homepages/concrete >=
|
|
6
|
+
applies_to: "@homepages/concrete >=7.0.0 <8.0.0"
|
|
7
7
|
related: [reference/cli/INDEX.md]
|
|
8
8
|
---
|
|
9
9
|
# concrete build
|
|
@@ -3,7 +3,7 @@ purpose: The `concrete check` command — its flags, exit codes and constraints.
|
|
|
3
3
|
mode: reference
|
|
4
4
|
status: generated
|
|
5
5
|
generated_from: the concrete command table
|
|
6
|
-
applies_to: "@homepages/concrete >=
|
|
6
|
+
applies_to: "@homepages/concrete >=7.0.0 <8.0.0"
|
|
7
7
|
related: [reference/cli/INDEX.md]
|
|
8
8
|
---
|
|
9
9
|
# concrete check
|
|
@@ -3,7 +3,7 @@ purpose: The `concrete dev` command — its flags, exit codes and constraints.
|
|
|
3
3
|
mode: reference
|
|
4
4
|
status: generated
|
|
5
5
|
generated_from: the concrete command table
|
|
6
|
-
applies_to: "@homepages/concrete >=
|
|
6
|
+
applies_to: "@homepages/concrete >=7.0.0 <8.0.0"
|
|
7
7
|
related: [reference/cli/INDEX.md]
|
|
8
8
|
---
|
|
9
9
|
# concrete dev
|
|
@@ -3,7 +3,7 @@ purpose: The `concrete property add` command — its flags, exit codes and const
|
|
|
3
3
|
mode: reference
|
|
4
4
|
status: generated
|
|
5
5
|
generated_from: the concrete command table
|
|
6
|
-
applies_to: "@homepages/concrete >=
|
|
6
|
+
applies_to: "@homepages/concrete >=7.0.0 <8.0.0"
|
|
7
7
|
related: [reference/cli/INDEX.md]
|
|
8
8
|
---
|
|
9
9
|
# concrete property add
|
|
@@ -3,7 +3,7 @@ purpose: The `concrete property list` command — its flags, exit codes and cons
|
|
|
3
3
|
mode: reference
|
|
4
4
|
status: generated
|
|
5
5
|
generated_from: the concrete command table
|
|
6
|
-
applies_to: "@homepages/concrete >=
|
|
6
|
+
applies_to: "@homepages/concrete >=7.0.0 <8.0.0"
|
|
7
7
|
related: [reference/cli/INDEX.md]
|
|
8
8
|
---
|
|
9
9
|
# concrete property list
|
|
@@ -3,7 +3,7 @@ purpose: The `concrete publish` command — its flags, exit codes and constraint
|
|
|
3
3
|
mode: reference
|
|
4
4
|
status: generated
|
|
5
5
|
generated_from: the concrete command table
|
|
6
|
-
applies_to: "@homepages/concrete >=
|
|
6
|
+
applies_to: "@homepages/concrete >=7.0.0 <8.0.0"
|
|
7
7
|
related: [reference/cli/INDEX.md]
|
|
8
8
|
---
|
|
9
9
|
# concrete publish
|
|
@@ -3,7 +3,7 @@ purpose: The `concrete upgrade` command — its flags, exit codes and constraint
|
|
|
3
3
|
mode: reference
|
|
4
4
|
status: generated
|
|
5
5
|
generated_from: the concrete command table
|
|
6
|
-
applies_to: "@homepages/concrete >=
|
|
6
|
+
applies_to: "@homepages/concrete >=7.0.0 <8.0.0"
|
|
7
7
|
related: [reference/cli/INDEX.md]
|
|
8
8
|
---
|
|
9
9
|
# concrete upgrade
|
|
@@ -3,7 +3,7 @@ purpose: Every rule `concrete check` grades, by the stage that grades it, in the
|
|
|
3
3
|
mode: reference
|
|
4
4
|
status: generated
|
|
5
5
|
generated_from: the concrete rule registry
|
|
6
|
-
applies_to: "@homepages/concrete >=
|
|
6
|
+
applies_to: "@homepages/concrete >=7.0.0 <8.0.0"
|
|
7
7
|
related: [reference/cli/check.md]
|
|
8
8
|
---
|
|
9
9
|
# Rule reference
|
|
@@ -165,7 +165,6 @@ Every placed section's schema and fill spec satisfy the contract assertions publ
|
|
|
165
165
|
| `concrete/contract/sources` | contract | Only a video slot declares sources, as a non-empty list of distinct known video sources. |
|
|
166
166
|
| `concrete/contract/interpolation` | contract | A fill brief refers to its facts through reads and never interpolates one. |
|
|
167
167
|
| `concrete/contract/group` | contract | Group ids are unique, every group names real slots, and no slot sits in two groups. |
|
|
168
|
-
| `concrete/contract/row` | contract | Every two-up row pairs adjacent short slots, and a record item's layout lists each field exactly once. |
|
|
169
168
|
|
|
170
169
|
## render
|
|
171
170
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@homepages/concrete",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "Concrete, the HomePages template framework: the authoring API, the contract primitives, the styles, the lint preset and the `concrete` command in one package that owns its whole toolchain.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|