@homepages/concrete 9.1.0 → 10.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 +52 -0
- package/README.md +1 -1
- package/codemods/manifest.json +10 -0
- package/codemods/registry-keys-only.mjs +113 -0
- package/codemods/steps/list-object-form.mjs +2 -3
- package/codemods/steps/registry-key-reads.mjs +276 -0
- package/dist/artifact/playground/client/assets/index-BFNHB7VM.css +1 -0
- package/dist/artifact/playground/client/assets/index-Div1yo6s.js +1259 -0
- package/dist/artifact/playground/client/index.html +2 -2
- package/dist/artifact/playground/host.mjs +42 -42
- package/dist/cli/build/artifact.js +2 -1
- package/dist/cli/build/fixtures.js +2 -1
- package/dist/cli/check/render/inputs.js +3 -3
- package/dist/cli/check/stages/sections.js +5 -6
- package/dist/cli/dev/workspace-reader.js +9 -2
- package/dist/fixtures/media-store.js +3 -3
- package/dist/fixtures/resolve.js +24 -16
- package/dist/fixtures/synthesize-empties.js +3 -1
- package/dist/fixtures.d.ts +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/packages/external/concrete/package.js +1 -1
- package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +8 -6
- package/dist/packages/internal/fill-bake/dist/compute-reads.js +8 -4
- package/dist/packages/internal/fill-bake/dist/index.js +1 -1
- package/dist/packages/internal/fill-bake/dist/item-merge.js +32 -6
- package/dist/packages/internal/fill-bake/dist/linked-merge.js +5 -5
- package/dist/packages/internal/fill-bake/dist/list-grammar.js +4 -26
- package/dist/packages/internal/fill-vocabulary/dist/resolved-decision.js +1 -1
- package/dist/packages/internal/media-resolution/dist/document.js +16 -15
- package/dist/packages/internal/media-resolution/dist/image.js +38 -92
- package/dist/packages/internal/media-resolution/dist/index.js +1 -1
- package/dist/packages/internal/media-resolution/dist/list.js +11 -11
- package/dist/packages/internal/media-resolution/dist/media.js +17 -16
- package/dist/packages/internal/media-resolution/dist/records.js +4 -2
- package/dist/packages/internal/media-resolution/dist/slot.js +5 -5
- package/dist/packages/internal/media-resolution/dist/tour.js +12 -11
- package/dist/packages/internal/media-resolution/dist/video.js +16 -16
- package/dist/packages/internal/property-facts/dist/registry-facts.js +8 -1
- package/dist/packages/internal/section-contracts/dist/catalog.js +1 -5
- package/dist/packages/internal/section-contracts/dist/directly-linked-list-contract.js +2 -3
- package/dist/packages/internal/section-contracts/dist/fill-verb-contract.js +5 -3
- package/dist/packages/internal/section-contracts/dist/index.js +0 -1
- package/dist/packages/internal/section-contracts/dist/object-contract.js +4 -2
- package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +1 -1
- package/dist/packages/internal/section-contracts/dist/row-rule-contract.js +4 -2
- package/dist/packages/internal/section-contracts/dist/row-source-contract.js +7 -8
- package/dist/packages/internal/section-contracts/dist/runners.js +1 -8
- package/dist/packages/internal/section-contracts/dist/select-contract.js +7 -1
- package/dist/packages/internal/section-contracts/dist/source-contract.js +12 -8
- package/dist/packages/internal/section-contracts/dist/sources-contract.js +1 -1
- package/dist/packages/internal/section-contracts/dist/table-member.js +5 -8
- package/dist/packages/internal/source-resolution/dist/index.js +21 -188
- package/dist/packages/internal/template-artifact/dist/index.js +2 -2
- package/dist/packages/internal/template-artifact/dist/layout.js +3 -1
- package/dist/packages/internal/template-artifact/dist/verify.js +32 -16
- package/dist/packages/internal/template-contracts/dist/content-pick.js +24 -1
- package/dist/packages/internal/template-contracts/dist/document-value.d.ts +2 -2
- package/dist/packages/internal/template-contracts/dist/fact-keys.d.ts +3 -2
- package/dist/packages/internal/template-contracts/dist/fact-keys.js +19 -43
- package/dist/packages/internal/template-contracts/dist/fact-registry.d.ts +24 -3
- package/dist/packages/internal/template-contracts/dist/fact-registry.js +10 -3
- package/dist/packages/internal/template-contracts/dist/fill-builders.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/fill-spec.js +7 -6
- package/dist/packages/internal/template-contracts/dist/list.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/list.js +7 -15
- package/dist/packages/internal/template-contracts/dist/mirror-kind.js +2 -2
- package/dist/packages/internal/template-contracts/dist/object.js +3 -2
- package/dist/packages/internal/template-contracts/dist/process-builders.d.ts +2 -2
- package/dist/packages/internal/template-contracts/dist/read-graph.js +5 -32
- package/dist/packages/internal/template-contracts/dist/ref-locate.js +10 -6
- package/dist/packages/internal/template-contracts/dist/registry-facts.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/registry-facts.js +13 -24
- package/dist/packages/internal/template-contracts/dist/registry-shape.d.ts +20 -4
- package/dist/packages/internal/template-contracts/dist/registry-shape.js +69 -11
- package/dist/packages/internal/template-contracts/dist/row-planners.js +1 -1
- package/dist/packages/internal/template-contracts/dist/row-ref.d.ts +4 -7
- package/dist/packages/internal/template-contracts/dist/row-ref.js +7 -23
- package/dist/packages/internal/template-contracts/dist/row-sources.js +3 -3
- package/dist/packages/internal/template-contracts/dist/row.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/row.js +6 -7
- package/dist/packages/internal/template-contracts/dist/runtime-values.d.ts +5 -20
- package/dist/packages/internal/template-contracts/dist/section-schema-types.d.ts +1 -0
- package/dist/packages/internal/template-contracts/dist/slot-builders.d.ts +29 -37
- package/dist/packages/internal/template-contracts/dist/slot-builders.js +4 -7
- package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +2 -702
- package/dist/packages/internal/template-contracts/dist/slot-catalog.js +2 -498
- package/dist/packages/internal/template-contracts/dist/slot-overrides.js +4 -1
- package/dist/packages/internal/template-contracts/dist/slot-ref.d.ts +4 -4
- package/dist/packages/internal/template-contracts/dist/slot-value.d.ts +2 -1
- package/dist/packages/internal/template-contracts/dist/table-members.d.ts +5 -12
- package/dist/packages/internal/template-contracts/dist/table-members.js +7 -37
- package/dist/packages/internal/template-contracts/dist/tour-value.d.ts +2 -2
- package/dist/primitives/Image.d.ts +3 -3
- package/dist/primitives/slot-download.d.ts +1 -1
- package/dist/primitives/slot-media.d.ts +1 -1
- package/dist/schema/fact.d.ts +19 -52
- package/dist/schema/fact.js +6 -25
- package/dist/schema/facts-view.d.ts +1 -2
- package/dist/schema/property-facts.d.ts +1 -62
- package/dist/schema/section-schema.d.ts +2 -2
- package/dist/schema/section-schema.js +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 +2 -3
- package/package.json +1 -1
- package/dist/artifact/playground/client/assets/index-BOYbgBnP.js +0 -1259
- package/dist/artifact/playground/client/assets/index-DDOcM0zA.css +0 -1
- package/dist/packages/internal/section-contracts/dist/option-source-contract.js +0 -22
- package/dist/packages/internal/template-contracts/dist/comparable-address.js +0 -19
- package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +0 -62
- package/dist/packages/internal/template-contracts/dist/legacy-facts.js +0 -167
- package/dist/packages/internal/template-contracts/dist/registry-aliases.js +0 -77
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { LibraryFactRegistry, PropertyTablePages } from "./fact-registry.js";
|
|
1
|
+
import { LibraryTablePages, PropertyTablePages } from "./fact-registry.js";
|
|
3
2
|
//#region ../../internal/template-contracts/dist/registry-shape.d.ts
|
|
3
|
+
type LibraryTable = keyof LibraryTablePages & string;
|
|
4
|
+
/**
|
|
5
|
+
* A table's name — a list of objects a home declares, by its page: the property's own and
|
|
6
|
+
* the library's (`contacts`). Typed off each home's table pages (`PropertyTablePages`,
|
|
7
|
+
* `LibraryTablePages`), which the registries' own types cannot be read for: the grammar
|
|
8
|
+
* that builds them reads this type. `fact-registry.test.ts` holds both to `tableNames()`.
|
|
9
|
+
*/
|
|
10
|
+
type RegistryTable = (keyof PropertyTablePages & string) | LibraryTable;
|
|
11
|
+
/** A table's registry key: a property list reading it (`property.units`, `property.contacts`), or the library list holding it (`library.contacts`). */
|
|
12
|
+
type RegistryTableKey = `property.${RegistryTable}` | `library.${LibraryTable}`;
|
|
4
13
|
type ItemFieldsOf<Page> = Page extends {
|
|
5
14
|
readonly declaration: {
|
|
6
15
|
readonly element: {
|
|
@@ -8,6 +17,13 @@ type ItemFieldsOf<Page> = Page extends {
|
|
|
8
17
|
};
|
|
9
18
|
};
|
|
10
19
|
} ? F : never;
|
|
20
|
+
/** The item declaration of a table's list, as the registry types it — off the table's own page (see {@link TableFieldsOf}). */
|
|
21
|
+
type TableElementOf<T extends RegistryTable> = T extends LibraryTable ? ItemOf<LibraryTablePages[T]> : T extends keyof PropertyTablePages ? ItemOf<PropertyTablePages[T]> : never;
|
|
22
|
+
type ItemOf<Page> = Page extends {
|
|
23
|
+
readonly declaration: {
|
|
24
|
+
readonly element: infer E;
|
|
25
|
+
};
|
|
26
|
+
} ? E : never;
|
|
11
27
|
/**
|
|
12
28
|
* The declarations of a table's members, as the registry types them — the library's
|
|
13
29
|
* contacts, the property's other lists. A property table is read off its own page
|
|
@@ -15,7 +31,7 @@ type ItemFieldsOf<Page> = Page extends {
|
|
|
15
31
|
* contacts from a row's members, which are typed here, so it cannot be read while it is
|
|
16
32
|
* being typed.
|
|
17
33
|
*/
|
|
18
|
-
type TableFieldsOf<T extends RegistryTable> = T extends
|
|
34
|
+
type TableFieldsOf<T extends RegistryTable> = T extends LibraryTable ? ItemFieldsOf<LibraryTablePages[T]> : T extends keyof PropertyTablePages ? ItemFieldsOf<PropertyTablePages[T]> : never;
|
|
19
35
|
/** {@link memberValueType}, at the type level. */
|
|
20
36
|
type MemberValueTypeOf<D> = D extends {
|
|
21
37
|
readonly type: "list";
|
|
@@ -38,4 +54,4 @@ type MemberValueTypeOf<D> = D extends {
|
|
|
38
54
|
readonly type: "text" | "select" | "email" | "phone" | "url" | "date";
|
|
39
55
|
} ? "text" : never;
|
|
40
56
|
//#endregion
|
|
41
|
-
export { MemberValueTypeOf, TableFieldsOf };
|
|
57
|
+
export { MemberValueTypeOf, RegistryTable, RegistryTableKey, TableElementOf, TableFieldsOf };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ADDRESS_MEMBERS } from "./address-value.js";
|
|
2
|
-
import {
|
|
2
|
+
import { isMediaKind } from "./slot-catalog.js";
|
|
3
3
|
import { isFactCompute } from "./fact-compute.js";
|
|
4
4
|
import "./media-candidates.js";
|
|
5
5
|
|
|
@@ -88,8 +88,63 @@ function factValueType(key, declaration) {
|
|
|
88
88
|
function addressPartValueType(part) {
|
|
89
89
|
return part === "latitude" || part === "longitude" ? "number" : "text";
|
|
90
90
|
}
|
|
91
|
+
function tableOfList(name, declaration) {
|
|
92
|
+
if (declaration.type !== "list") return null;
|
|
93
|
+
const element = declaration.element;
|
|
94
|
+
if (element.type === "object") return name;
|
|
95
|
+
if (element.type === "row") return element.from.slice(element.from.indexOf(".") + 1);
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
let TABLE_KEYS;
|
|
99
|
+
function linkedTableKeys() {
|
|
100
|
+
if (TABLE_KEYS !== void 0) return TABLE_KEYS;
|
|
101
|
+
linkedRegistry("library");
|
|
102
|
+
const keys = /* @__PURE__ */ new Map();
|
|
103
|
+
for (const registry of LINKED.values()) for (const [name, page] of Object.entries(registry.pages)) {
|
|
104
|
+
const table = tableOfList(name, page.declaration);
|
|
105
|
+
if (table !== null) keys.set(`${registry.home}.${name}`, table);
|
|
106
|
+
}
|
|
107
|
+
if (LINKED.has("property") && LINKED.has("library")) TABLE_KEYS = keys;
|
|
108
|
+
return keys;
|
|
109
|
+
}
|
|
110
|
+
function tableNames() {
|
|
111
|
+
return [...new Set(linkedTableKeys().values())];
|
|
112
|
+
}
|
|
113
|
+
function tableOf(key) {
|
|
114
|
+
return typeof key === "string" ? linkedTableKeys().get(key) ?? null : null;
|
|
115
|
+
}
|
|
116
|
+
function tableOfSource(source) {
|
|
117
|
+
return source?.kind === "home" ? tableOf(source.key) : null;
|
|
118
|
+
}
|
|
119
|
+
function tableForSlot(slot) {
|
|
120
|
+
return tableOfSource(slot.source);
|
|
121
|
+
}
|
|
91
122
|
function tableHome(table) {
|
|
92
|
-
|
|
123
|
+
for (const registry of LINKED.values()) {
|
|
124
|
+
const page = Object.hasOwn(registry.pages, table) ? registry.pages[table] : void 0;
|
|
125
|
+
if (page?.declaration.type === "list" && page.declaration.element.type === "object") return registry.home;
|
|
126
|
+
}
|
|
127
|
+
throw new Error(`fact registry: no linked registry declares a table "${table}"`);
|
|
128
|
+
}
|
|
129
|
+
function tableKey(table) {
|
|
130
|
+
return `property.${table}`;
|
|
131
|
+
}
|
|
132
|
+
function tableBounds(table) {
|
|
133
|
+
const declaration = linkedRegistry("property").pages[table]?.declaration;
|
|
134
|
+
if (declaration?.type !== "list") return {};
|
|
135
|
+
return {
|
|
136
|
+
...typeof declaration.min === "number" ? { min: declaration.min } : {},
|
|
137
|
+
...typeof declaration.max === "number" ? { max: declaration.max } : {}
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function stampTableBounds(slots) {
|
|
141
|
+
for (const slot of Object.values(slots)) {
|
|
142
|
+
const table = tableForSlot(slot);
|
|
143
|
+
if (table === null) continue;
|
|
144
|
+
const inherited = tableBounds(table);
|
|
145
|
+
if (slot.min === void 0 && inherited.min !== void 0) slot.min = inherited.min;
|
|
146
|
+
if (slot.max === void 0 && inherited.max !== void 0) slot.max = inherited.max;
|
|
147
|
+
}
|
|
93
148
|
}
|
|
94
149
|
function tableFieldsIn(registry, table) {
|
|
95
150
|
const page = registry.pages[table];
|
|
@@ -103,15 +158,18 @@ function linkedTableFields(table) {
|
|
|
103
158
|
function fieldOf(fields, member) {
|
|
104
159
|
return Object.hasOwn(fields, member) ? fields[member] : void 0;
|
|
105
160
|
}
|
|
161
|
+
function tableMemberValueType(table, member) {
|
|
162
|
+
const declaration = fieldOf(linkedTableFields(table), member);
|
|
163
|
+
return declaration === void 0 ? void 0 : memberValueType(declaration);
|
|
164
|
+
}
|
|
106
165
|
function memberListOfKey(key) {
|
|
107
166
|
if (typeof key !== "string") return null;
|
|
108
167
|
const dot = key.lastIndexOf(".");
|
|
109
168
|
if (dot <= 0) return null;
|
|
110
|
-
const table =
|
|
111
|
-
if (table
|
|
169
|
+
const table = tableOf(key.slice(0, dot));
|
|
170
|
+
if (table === null) return null;
|
|
112
171
|
const member = key.slice(dot + 1);
|
|
113
|
-
|
|
114
|
-
return declaration !== void 0 && memberValueType(declaration) === "row_list" ? {
|
|
172
|
+
return tableMemberValueType(table, member) === "row_list" ? {
|
|
115
173
|
table,
|
|
116
174
|
member
|
|
117
175
|
} : null;
|
|
@@ -121,15 +179,15 @@ function tableColumnOfKey(key) {
|
|
|
121
179
|
const dot = key.lastIndexOf(".");
|
|
122
180
|
if (dot <= 0) return null;
|
|
123
181
|
const tableKey = key.slice(0, dot);
|
|
124
|
-
const table =
|
|
125
|
-
if (table
|
|
182
|
+
const table = tableOf(tableKey);
|
|
183
|
+
if (table === null) return null;
|
|
126
184
|
const member = key.slice(dot + 1);
|
|
127
|
-
return
|
|
128
|
-
table
|
|
185
|
+
return tableMemberValueType(table, member) === void 0 ? null : {
|
|
186
|
+
table,
|
|
129
187
|
tableKey,
|
|
130
188
|
member
|
|
131
189
|
};
|
|
132
190
|
}
|
|
133
191
|
|
|
134
192
|
//#endregion
|
|
135
|
-
export { addressPartValueType, fieldOf, isDerived, isMediaListDeclaration, linkRegistry, linkedRegistry, linkedTableFields, mediaListKeysOf, memberListOfKey, memberValueType, registryFactsOf, tableColumnOfKey, tableFieldsIn, tableHome };
|
|
193
|
+
export { addressPartValueType, fieldOf, isDerived, isMediaListDeclaration, linkRegistry, linkedRegistry, linkedTableFields, mediaListKeysOf, memberListOfKey, memberValueType, registryFactsOf, stampTableBounds, tableBounds, tableColumnOfKey, tableFieldsIn, tableForSlot, tableHome, tableKey, tableMemberValueType, tableNames, tableOf, tableOfSource };
|
|
@@ -17,7 +17,7 @@ function plannerForField(field) {
|
|
|
17
17
|
const element = field.element?.type;
|
|
18
18
|
if (element === "select") return "select";
|
|
19
19
|
if (isFindableKind(element) || element === "object" || element === "row") return void 0;
|
|
20
|
-
if (poolingPrimitiveOf({ type: element }) !== void 0) return "
|
|
20
|
+
if (poolingPrimitiveOf({ type: element }) !== void 0) return "mediaList";
|
|
21
21
|
return "list";
|
|
22
22
|
}
|
|
23
23
|
if (field.type === "text" || isValueKind(field.type)) return "text";
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import { AddressMember, AddressValue } from "./address-value.js";
|
|
2
|
-
import { LIBRARY_TABLE_KEYS, REGISTRY_TABLE_KEYS, RegistryTable, RegistryTableKey } from "./slot-catalog.js";
|
|
3
2
|
import { PoiRow } from "./poi-row.js";
|
|
4
3
|
import { ImageValue } from "./runtime-values.js";
|
|
5
|
-
import { MemberValueTypeOf, TableFieldsOf } from "./registry-shape.js";
|
|
4
|
+
import { MemberValueTypeOf, RegistryTable, RegistryTableKey, TableFieldsOf } from "./registry-shape.js";
|
|
6
5
|
import { RegistryTableRow } from "./table-members.js";
|
|
7
6
|
import { ComputeBinding } from "./compute.js";
|
|
8
7
|
import { SlotValue } from "./slot-value.js";
|
|
9
8
|
import { ElementRef, RowRef, SiblingSlot, SlotRef } from "./slot-ref.js";
|
|
10
9
|
import { DocumentMediaValue } from "./registry-facts.js";
|
|
11
10
|
//#region ../../internal/template-contracts/dist/row-ref.d.ts
|
|
12
|
-
/** The library key naming table `T`, where the library holds its rows. */
|
|
13
|
-
type LibraryKeyOf<T extends RegistryTable> = T extends keyof typeof LIBRARY_TABLE_KEYS ? (typeof LIBRARY_TABLE_KEYS)[T] : never;
|
|
14
11
|
/** The table a registry table key names — `units` for `property.units`, `contacts` for `library.contacts`. */
|
|
15
|
-
type TableOfKey<K extends RegistryTableKey> =
|
|
12
|
+
type TableOfKey<K extends RegistryTableKey> = K extends `${string}.${infer T extends RegistryTable}` ? T : never;
|
|
16
13
|
/**
|
|
17
14
|
* The keys a row slot's definition owns (`RowSlotDef`'s, ./row.ts). A row answers each
|
|
18
15
|
* from its definition — present or not — and never as a member, but where its table has
|
|
@@ -71,8 +68,8 @@ type MemberRef<T extends RegistryTable, M extends keyof Members<T> & string> = R
|
|
|
71
68
|
/**
|
|
72
69
|
* What a row of table `K` offers: one member ref per member of the table's registry row
|
|
73
70
|
* (`linkedTableFields`). A slot sourced by one fits its value (`MemberValue`); a
|
|
74
|
-
* `compute()` reading one receives what the facts document holds — an image's
|
|
75
|
-
* `{
|
|
71
|
+
* `compute()` reading one receives what the facts document holds — an image's value
|
|
72
|
+
* or `{ media }` reference, `null` for an unanswered member. The mapping only FILTERS the table's
|
|
76
73
|
* keys, so each member's doc comment is what an author reads hovering `unit.beds`.
|
|
77
74
|
*/
|
|
78
75
|
type TableRow<K extends RegistryTableKey> = { readonly [M in keyof Members<TableOfKey<K>> & string]: MemberRef<TableOfKey<K>, M>; };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { isAddressMember } from "./address-value.js";
|
|
2
|
-
import { FACT_GRAPH, TABLES } from "./slot-catalog.js";
|
|
3
2
|
import { ROW_OF } from "./slot-ref.js";
|
|
4
|
-
import {
|
|
3
|
+
import { linkedTableFields, tableMemberValueType } from "./registry-shape.js";
|
|
5
4
|
|
|
6
5
|
//#region ../../internal/template-contracts/dist/row-ref.js
|
|
7
6
|
const ROW_OWN_KEYS = [
|
|
@@ -23,12 +22,10 @@ function withTable(slot, table) {
|
|
|
23
22
|
function carriedTable(x) {
|
|
24
23
|
if (typeof x !== "object" || x === null) return null;
|
|
25
24
|
const table = x[TABLE_OF];
|
|
26
|
-
return typeof table === "
|
|
25
|
+
return typeof table === "string" ? table : null;
|
|
27
26
|
}
|
|
28
|
-
function tableMembers(
|
|
29
|
-
|
|
30
|
-
const row = FACT_GRAPH[key.table].row;
|
|
31
|
-
return Object.keys(row).filter((member) => member !== TABLES[key.table].idKey && !ROW_OWN.has(member));
|
|
27
|
+
function tableMembers(table) {
|
|
28
|
+
return Object.keys(linkedTableFields(table));
|
|
32
29
|
}
|
|
33
30
|
function memberRef(row, field) {
|
|
34
31
|
return Object.freeze({
|
|
@@ -48,19 +45,6 @@ function rowDefinition(slot) {
|
|
|
48
45
|
const definition = slot[ROW_DEFINITION];
|
|
49
46
|
return typeof definition === "object" && definition !== null ? definition : slot;
|
|
50
47
|
}
|
|
51
|
-
function isAddressValued(table, member) {
|
|
52
|
-
if (table.reading === "legacy") return false;
|
|
53
|
-
const declaration = fieldOf(linkedTableFields(table.table), member);
|
|
54
|
-
return declaration !== void 0 && memberValueType(declaration) === "address";
|
|
55
|
-
}
|
|
56
|
-
function memberKindOf(table, member) {
|
|
57
|
-
if (table.reading === "legacy") {
|
|
58
|
-
const row = FACT_GRAPH[table.table].row;
|
|
59
|
-
return Object.hasOwn(row, member) ? String(row[member].value_type) : void 0;
|
|
60
|
-
}
|
|
61
|
-
const declaration = fieldOf(linkedTableFields(table.table), member);
|
|
62
|
-
return declaration === void 0 ? void 0 : String(memberValueType(declaration) ?? "");
|
|
63
|
-
}
|
|
64
48
|
const PROBED_KEYS = /* @__PURE__ */ new Set([
|
|
65
49
|
"then",
|
|
66
50
|
"toJSON",
|
|
@@ -77,12 +61,12 @@ function rowWithMembers(def, table, also = []) {
|
|
|
77
61
|
if (typeof key !== "string") return Reflect.get(target, key, receiver);
|
|
78
62
|
if (table !== null && members !== null) {
|
|
79
63
|
const tables = [table, ...also];
|
|
80
|
-
const kinds = tables.map((each) => each === table
|
|
64
|
+
const kinds = tables.map((each) => each === table && !members.has(key) ? void 0 : tableMemberValueType(each, key));
|
|
81
65
|
if (kinds.every((kind) => kind === void 0)) return Reflect.get(target, key, receiver);
|
|
82
66
|
const misfit = kinds.findIndex((kind) => kind === void 0 || kind !== kinds[0]);
|
|
83
|
-
if (misfit === -1) return
|
|
67
|
+
if (misfit === -1) return kinds[0] === "address" ? addressMemberRef(proxy, key) : memberRef(proxy, key);
|
|
84
68
|
if (key in target || ROW_OWN.has(key)) return Reflect.get(target, key, receiver);
|
|
85
|
-
throw new Error(`row: "${String(target.label)}" reads the member "${key}", which its \`from\` table ${tables[misfit]
|
|
69
|
+
throw new Error(`row: "${String(target.label)}" reads the member "${key}", which its \`from\` table ${tables[misfit]} ${kinds[misfit] === void 0 ? "lacks" : "holds at another kind"} — every table a row names carries every member its readers read, at one kind.`);
|
|
86
70
|
}
|
|
87
71
|
if (key in target || ROW_OWN.has(key)) return Reflect.get(target, key, receiver);
|
|
88
72
|
return PROBED_KEYS.has(key) ? void 0 : memberRef(proxy, key);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { tableOf } from "./registry-shape.js";
|
|
2
2
|
|
|
3
3
|
//#region ../../internal/template-contracts/dist/row-sources.js
|
|
4
4
|
function sourceRecord(source) {
|
|
@@ -34,10 +34,10 @@ function listSourceOf(list) {
|
|
|
34
34
|
if (src === null || src["kind"] === "authored") return { kind: "none" };
|
|
35
35
|
const { kind, key, section, slot, transform } = src;
|
|
36
36
|
if (kind === "home" && typeof key === "string") {
|
|
37
|
-
const table =
|
|
37
|
+
const table = tableOf(key);
|
|
38
38
|
if (table !== null) return {
|
|
39
39
|
kind: "table",
|
|
40
|
-
table
|
|
40
|
+
table
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
if (kind === "section" && typeof section === "string" && typeof slot === "string") return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RegistryTableKey } from "./
|
|
1
|
+
import { RegistryTableKey } from "./registry-shape.js";
|
|
2
2
|
import { ComputeBinding } from "./compute.js";
|
|
3
3
|
import { MemberListItem, MemberListRow, OriginTableOf, TableRow } from "./row-ref.js";
|
|
4
4
|
import { ComputeRead, ElementRef, RowRef, SiblingSlot, SiblingSource, SlotRef } from "./slot-ref.js";
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { tableKeyOf } from "./slot-catalog.js";
|
|
2
1
|
import { isElementRef, isFactRef, isSiblingSlot, isSlotRef, rowOfMember } from "./slot-ref.js";
|
|
3
2
|
import { isComputeBinding } from "./compute.js";
|
|
4
3
|
import { fillsOfSource } from "./fill-builders.js";
|
|
5
|
-
import { memberListOfKey } from "./registry-shape.js";
|
|
4
|
+
import { memberListOfKey, tableOf } from "./registry-shape.js";
|
|
6
5
|
import { carriedTable, rowDefinition, rowWithMembers, withTable } from "./row-ref.js";
|
|
7
6
|
import { headWith } from "./slot-builders.js";
|
|
8
7
|
|
|
@@ -26,7 +25,7 @@ function bakeRowSource(source, label) {
|
|
|
26
25
|
}
|
|
27
26
|
function fromKey(from, label) {
|
|
28
27
|
if (Array.isArray(from)) return fromTables(from, label);
|
|
29
|
-
const table = isFactRef(from) ?
|
|
28
|
+
const table = isFactRef(from) ? tableOf(from.key) : null;
|
|
30
29
|
if (table !== null) return {
|
|
31
30
|
key: from.key,
|
|
32
31
|
tables: [table]
|
|
@@ -46,9 +45,9 @@ function fromTables(from, label) {
|
|
|
46
45
|
const keys = [];
|
|
47
46
|
const tables = [];
|
|
48
47
|
for (const entry of from) {
|
|
49
|
-
const table = isFactRef(entry) ?
|
|
48
|
+
const table = isFactRef(entry) ? tableOf(entry.key) : null;
|
|
50
49
|
if (table === null) throw new Error(`row: "${label}"'s \`from\` lists ${isFactRef(entry) ? `the fact "${entry.key}", which is not a table` : "something that is no table"} — a row's list of \`from\` names tables (\`[fact.property.contacts, …]\`); a list-valued member is a row's only \`from\`.`);
|
|
51
|
-
if (tables.
|
|
50
|
+
if (tables.includes(table)) throw new Error(`row: "${label}" names the ${table} table twice in \`from\` — each table is named once.`);
|
|
52
51
|
keys.push(entry.key);
|
|
53
52
|
tables.push(table);
|
|
54
53
|
}
|
|
@@ -59,8 +58,8 @@ function fromTables(from, label) {
|
|
|
59
58
|
}
|
|
60
59
|
function assertSourceFits(source, tables, label) {
|
|
61
60
|
const held = carriedTable(isSiblingSlot(source) ? source : isElementRef(source) ? source : void 0);
|
|
62
|
-
if (held === null || tables.
|
|
63
|
-
throw new Error(`row: "${label}" is \`from\` the ${tables.
|
|
61
|
+
if (held === null || tables.includes(held)) return;
|
|
62
|
+
throw new Error(`row: "${label}" is \`from\` the ${tables.join(", ")} table${tables.length === 1 ? "" : "s"} but its source holds a row of ${held} — a row's source yields a row of its own \`from\`.`);
|
|
64
63
|
}
|
|
65
64
|
function row(opts) {
|
|
66
65
|
const { key, tables } = fromKey(opts.from, opts.label);
|
|
@@ -7,23 +7,15 @@ import { VideoCollectionValue, VideoValue } from "./video-value.js";
|
|
|
7
7
|
import { PoiPhoto, PoiRow } from "./poi-row.js";
|
|
8
8
|
//#region ../../internal/template-contracts/dist/runtime-values.d.ts
|
|
9
9
|
/**
|
|
10
|
-
* An image slot's runtime value after resolution: `url`/`alt`
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* `responsive`.
|
|
10
|
+
* An image slot's runtime value after resolution: `url`/`alt` and the served
|
|
11
|
+
* sources. The crop is cut into `url` itself — the kit reconstructs none of it at
|
|
12
|
+
* render time, and the crop a slot stores is the editor's, never resolved; a
|
|
13
|
+
* renderer reads only `url`, `alt`, `mobile`, and `responsive`.
|
|
15
14
|
*/
|
|
16
15
|
type ImageValue = {
|
|
17
16
|
photo_id: string;
|
|
18
17
|
url: string;
|
|
19
18
|
alt: string;
|
|
20
|
-
rect?: {
|
|
21
|
-
nx: number;
|
|
22
|
-
ny: number;
|
|
23
|
-
nw: number;
|
|
24
|
-
nh: number;
|
|
25
|
-
} | null;
|
|
26
|
-
ar?: number | null;
|
|
27
19
|
mobile?: {
|
|
28
20
|
url: string;
|
|
29
21
|
responsive?: ResponsiveImage | null;
|
|
@@ -34,13 +26,6 @@ type ImageValue = {
|
|
|
34
26
|
* serves a crop. Absent, the download is `url` itself.
|
|
35
27
|
*/
|
|
36
28
|
download_url?: string;
|
|
37
|
-
/**
|
|
38
|
-
* A unit's floor plan only, read whole as an image off a section published on the
|
|
39
|
-
* units table's legacy key: the plan's floor label ("Upper Level"), or `null` for an
|
|
40
|
-
* unlabelled plan. Absent on every other image. A section on `fact.property.units`
|
|
41
|
-
* reads each plan as its `{ id, image, floor }` item, through a row declared from it.
|
|
42
|
-
*/
|
|
43
|
-
floor_label?: string | null;
|
|
44
29
|
};
|
|
45
30
|
/** An image list slot's runtime value: an ordered array of `ImageValue`, possibly empty. */
|
|
46
31
|
type ImageCollectionValue = ImageValue[];
|
|
@@ -74,7 +59,7 @@ type PlaybackConfig = {
|
|
|
74
59
|
preload?: "none" | "metadata" | "auto";
|
|
75
60
|
};
|
|
76
61
|
/**
|
|
77
|
-
* An open-kind `media` slot's runtime value: the resolved value of the
|
|
62
|
+
* An open-kind `media` slot's runtime value: the resolved value of the media's own kind,
|
|
78
63
|
* carrying that `kind` beside it, narrowed to the kinds the slot declares. Narrow on
|
|
79
64
|
* `kind` before handing it to that kind's `Slot.*`; `Slot.Image` draws any of them — an
|
|
80
65
|
* image itself, a video's or tour's poster, a document's first page.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./slot-ref.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AddressValue } from "./address-value.js";
|
|
2
2
|
import { DocumentValue } from "./document-value.js";
|
|
3
|
-
import { LinkKind, LinkProviderId, MediaKind
|
|
3
|
+
import { LinkKind, LinkProviderId, MediaKind } from "./slot-catalog.js";
|
|
4
4
|
import { TourValue } from "./tour-value.js";
|
|
5
5
|
import { VideoValue } from "./video-value.js";
|
|
6
6
|
import { ImageValue, MediaValue, PlaybackConfig } from "./runtime-values.js";
|
|
@@ -21,15 +21,11 @@ type RegistryKeySpelling = `${FactHome}.${string}`;
|
|
|
21
21
|
type ScalarFactValue = string | number | null;
|
|
22
22
|
/**
|
|
23
23
|
* Where a slot's value comes from: the `home` ref a `fact.*` entry emits into a
|
|
24
|
-
* builder's `source` — a
|
|
25
|
-
* `derived` literal `defineSchema` rewrites a `compute()` binding to, whose `transform`
|
|
24
|
+
* builder's `source` — a registry fact holding a scalar — or the `derived` literal `defineSchema` rewrites a `compute()` binding to, whose `transform`
|
|
26
25
|
* is the slot's own path. A whole address is no value of these: only an `address` slot
|
|
27
26
|
* binds it ({@link AddressFactSource}).
|
|
28
27
|
*/
|
|
29
|
-
type SlotSource = {
|
|
30
|
-
kind: "home";
|
|
31
|
-
key: SourceFieldName;
|
|
32
|
-
} | FactRef<RegistryKeySpelling, ScalarFactValue> | {
|
|
28
|
+
type SlotSource = FactRef<RegistryKeySpelling, ScalarFactValue> | {
|
|
33
29
|
kind: "derived";
|
|
34
30
|
transform: string;
|
|
35
31
|
};
|
|
@@ -107,7 +103,7 @@ type HeldPickFill = PickFill<FillNodeShape & {
|
|
|
107
103
|
readonly none?: never;
|
|
108
104
|
}>;
|
|
109
105
|
/**
|
|
110
|
-
* An `image` slot's crop — the
|
|
106
|
+
* An `image` slot's crop — the MEDIA's contract: what the cropper cuts, and which cut
|
|
111
107
|
* a viewport is served. It paints no box; the rendered box is your own classes.
|
|
112
108
|
* `mode` picks the cropper behavior ("locked" keeps `aspect`, w/h; "free" resizes any
|
|
113
109
|
* edge), `aspectLabel` is the cropper's pill text. `mobile` declares a distinct second
|
|
@@ -250,17 +246,13 @@ interface SelectOptionObject {
|
|
|
250
246
|
description?: string;
|
|
251
247
|
}
|
|
252
248
|
/**
|
|
253
|
-
* The serialized shape a select slot emits — a `select`-kind slot. `values`
|
|
254
|
-
* authored `from`, stored under the wire's name
|
|
255
|
-
*
|
|
256
|
-
* was built with `select({ from })` or `select({ source: fact.… })`.
|
|
249
|
+
* The serialized shape a select slot emits — a `select`-kind slot. `values` is the
|
|
250
|
+
* authored `from`, stored under the wire's name; a select built with
|
|
251
|
+
* `select({ source: fact.… })` carries none, offering the choices its fact declares.
|
|
257
252
|
*/
|
|
258
253
|
interface SelectSlotDef extends Head {
|
|
259
254
|
type: "select";
|
|
260
255
|
values?: SelectOptionInput[];
|
|
261
|
-
options?: {
|
|
262
|
-
source: string;
|
|
263
|
-
};
|
|
264
256
|
creatable?: boolean;
|
|
265
257
|
}
|
|
266
258
|
/** The one source that supplies a select's vocabulary: a fact binding. */
|
|
@@ -328,7 +320,7 @@ interface DisplaySelectOptions<C extends readonly [string, ...string[]]> {
|
|
|
328
320
|
*
|
|
329
321
|
* select({ label: "Status", from: ["for_sale", "sold"] });
|
|
330
322
|
* select({ label: "Listing status", source: fact.property.listing_intent });
|
|
331
|
-
* select({ from: ["visible", "hidden"], source: compute({ reads: [fact.property.uploads] }, (uploads) => (uploads.some((
|
|
323
|
+
* select({ from: ["visible", "hidden"], source: compute({ reads: [fact.property.uploads] }, (uploads) => (uploads.some((upload) => upload.kind === "tour") ? "visible" : "hidden")) });
|
|
332
324
|
* const VARIANTS = ["classic", "editorial"] as const;
|
|
333
325
|
* select({ from: VARIANTS, source: fill.pick({ brief: "Prefer editorial for story-driven narratives." }) });
|
|
334
326
|
* ```
|
|
@@ -501,8 +493,8 @@ interface AddressSlotDef extends Head {
|
|
|
501
493
|
declare function address<const HasSource extends AddressOptions["source"] = undefined>(opts?: AddressOptions & {
|
|
502
494
|
source?: HasSource;
|
|
503
495
|
} & MirrorOption<HasSource, AddressValue | null>): AddressSlotDef & SourceMark<HasSource> & AddressMembers & FillMark;
|
|
504
|
-
/** The fill a single
|
|
505
|
-
type
|
|
496
|
+
/** The fill a single media slot takes: one pick, out of its candidate set. */
|
|
497
|
+
type MediaFill = HeldPickFill;
|
|
506
498
|
/** A home list of media, as declared: a list whose item is a media declaration. */
|
|
507
499
|
interface MediaListDeclaration {
|
|
508
500
|
readonly type: "list";
|
|
@@ -525,24 +517,24 @@ type MediaListFrom = FactRef<RegistryKeySpelling, readonly DocumentMediaValue[]>
|
|
|
525
517
|
/**
|
|
526
518
|
* A media declaration's `from`: one media list, or an ordered list of them. `from: a`
|
|
527
519
|
* and `from: [a]` are one declaration. The candidates are the union in declared order —
|
|
528
|
-
* list order first, each list's own order within it — and one
|
|
520
|
+
* list order first, each list's own order within it — and one media value in two lists is one
|
|
529
521
|
* candidate, attributed to the first.
|
|
530
522
|
*/
|
|
531
523
|
type MediaFromLists = MediaListFrom | readonly [MediaListFrom, ...MediaListFrom[]];
|
|
532
524
|
/** The keys a media declaration of `Kinds` takes, beside its kind's own options. */
|
|
533
525
|
interface MediaFilterOptions<Kinds extends MediaKind> {
|
|
534
526
|
/**
|
|
535
|
-
* The media list the declaration picks from: its candidates are the list's
|
|
527
|
+
* The media list the declaration picks from: its candidates are the list's media of
|
|
536
528
|
* its kinds, which a picker offers and a `fill.pick` chooses among. Absent, the
|
|
537
|
-
* declaration owns its
|
|
529
|
+
* declaration owns its media — a one-off the user uploads or pastes into it. An ordered
|
|
538
530
|
* list of lists picks from their union; each list must hold items of the declaration's
|
|
539
531
|
* kinds.
|
|
540
532
|
*/
|
|
541
533
|
from?: MediaFromLists;
|
|
542
534
|
/**
|
|
543
|
-
* The processes run on every
|
|
535
|
+
* The processes run on every media value that becomes the value — `process.cutout()`, the
|
|
544
536
|
* background removed; `process.autocrop({ brief })`, cropped to its subject (an
|
|
545
|
-
* image's). Declare it where
|
|
537
|
+
* image's). Declare it where a file first lands; a slot picking from a list that
|
|
546
538
|
* declares it reads the result and declares nothing.
|
|
547
539
|
*/
|
|
548
540
|
process?: readonly [HolderProcessOf<Kinds>, ...HolderProcessOf<Kinds>[]];
|
|
@@ -569,8 +561,8 @@ interface MediaFilterKeys<Kinds extends MediaKind> {
|
|
|
569
561
|
from?: string | MediaListPage | MediaListDeclaration | readonly (string | MediaListPage | MediaListDeclaration)[];
|
|
570
562
|
process?: HolderProcessOf<Kinds>[];
|
|
571
563
|
}
|
|
572
|
-
interface ImageOptions extends Omit<CommonOptions<ImageValue | ImageMedia | null,
|
|
573
|
-
source?: CommonOptions<ImageValue | ImageMedia | null,
|
|
564
|
+
interface ImageOptions extends Omit<CommonOptions<ImageValue | ImageMedia | null, MediaFill>, "source"> {
|
|
565
|
+
source?: CommonOptions<ImageValue | ImageMedia | null, MediaFill>["source"] | ImageFactSource;
|
|
574
566
|
crop?: CropConfig;
|
|
575
567
|
}
|
|
576
568
|
/** The serialized shape the `image` builder emits — an `image`-kind slot. */
|
|
@@ -580,7 +572,7 @@ interface ImageSlotDef extends Head, MediaFilterKeys<"image"> {
|
|
|
580
572
|
}
|
|
581
573
|
/**
|
|
582
574
|
* A single image slot — the resolved value is always one `ImageValue`, never a list,
|
|
583
|
-
* so it carries no count bounds (a list of them does). `crop` is the
|
|
575
|
+
* so it carries no count bounds (a list of them does). `crop` is the media's contract —
|
|
584
576
|
* the editor's cropper and `<Image>`'s mobile-crop switch read it; the box the image
|
|
585
577
|
* renders in is the section's own classes. `source: fill.pick({ brief })` picks one
|
|
586
578
|
* image out of its `from`.
|
|
@@ -606,7 +598,7 @@ interface ImageSlotDef extends Head, MediaFilterKeys<"image"> {
|
|
|
606
598
|
declare function image<const HasSource extends SourceBinding | ImageFactSource | undefined = undefined>(opts?: ImageOptions & {
|
|
607
599
|
source?: HasSource;
|
|
608
600
|
} & MirrorOption<HasSource, ImageValue | ImageMedia | null> & MediaFilterOption<HasSource, "image">): ImageSlotDef & SourceMark<HasSource> & FillMark;
|
|
609
|
-
interface VideoOptions extends CommonOptions<VideoValue | VideoMedia | null,
|
|
601
|
+
interface VideoOptions extends CommonOptions<VideoValue | VideoMedia | null, MediaFill> {
|
|
610
602
|
playback?: PlaybackConfig;
|
|
611
603
|
}
|
|
612
604
|
/** The serialized shape the `video` builder emits — a `video`-kind slot. */
|
|
@@ -631,7 +623,7 @@ interface VideoSlotDef extends Head, MediaFilterKeys<"video"> {
|
|
|
631
623
|
declare function video<const HasSource extends SourceBinding | undefined = undefined>(opts?: VideoOptions & {
|
|
632
624
|
source?: HasSource;
|
|
633
625
|
} & MirrorOption<HasSource, VideoValue | VideoMedia | null> & MediaFilterOption<HasSource, "video">): VideoSlotDef & SourceMark<HasSource> & FillMark;
|
|
634
|
-
type TourOptions = CommonOptions<TourValue | TourMedia | null,
|
|
626
|
+
type TourOptions = CommonOptions<TourValue | TourMedia | null, MediaFill>;
|
|
635
627
|
/** The serialized shape the `tour` builder emits — a `tour`-kind slot. */
|
|
636
628
|
interface TourSlotDef extends Head, MediaFilterKeys<"tour"> {
|
|
637
629
|
type: "tour";
|
|
@@ -702,7 +694,7 @@ interface DocumentOptions {
|
|
|
702
694
|
required?: boolean;
|
|
703
695
|
placeholder?: string;
|
|
704
696
|
when?: string | readonly string[];
|
|
705
|
-
source?:
|
|
697
|
+
source?: MediaFill | ElementRef<DocumentValue | DocumentMedia, null>;
|
|
706
698
|
}
|
|
707
699
|
/** The serialized shape the `document` builder emits — a `document`-kind slot. */
|
|
708
700
|
interface DocumentSlotDef extends Head, MediaFilterKeys<"document"> {
|
|
@@ -736,11 +728,11 @@ interface DocumentSlotDef extends Head, MediaFilterKeys<"document"> {
|
|
|
736
728
|
declare function document<const HasSource extends DocumentOptions["source"] = undefined>(opts?: DocumentOptions & {
|
|
737
729
|
source?: HasSource;
|
|
738
730
|
} & MediaFilterOption<HasSource, "document">): DocumentSlotDef & SourceMark<HasSource> & FillMark;
|
|
739
|
-
/** The
|
|
740
|
-
type
|
|
731
|
+
/** The media record of one of `Kinds` — what a `compute()` hands an open-kind media slot. */
|
|
732
|
+
type MediaOfKind<Kinds extends MediaKind> = Extract<ImageMedia | VideoMedia | TourMedia | DocumentMedia, {
|
|
741
733
|
kind: Kinds;
|
|
742
734
|
}>;
|
|
743
|
-
interface MediaOptions<Kinds extends MediaKind> extends CommonOptions<MediaValue<Kinds> |
|
|
735
|
+
interface MediaOptions<Kinds extends MediaKind> extends CommonOptions<MediaValue<Kinds> | MediaOfKind<Kinds> | null, MediaFill> {
|
|
744
736
|
/** The kinds the field may hold. Absent: all four — an image, a video, a tour or a document. */
|
|
745
737
|
kinds?: readonly [Kinds, ...Kinds[]];
|
|
746
738
|
}
|
|
@@ -752,10 +744,10 @@ interface MediaSlotDef<Kinds extends MediaKind = MediaKind> extends Head, MediaF
|
|
|
752
744
|
/**
|
|
753
745
|
* A media value whose kind is left open among `kinds` — an image, a video, a tour or a
|
|
754
746
|
* document, whichever is picked. `from` names the list it is picked from; its candidates
|
|
755
|
-
* are that list's
|
|
756
|
-
* them. Absent, the slot owns its
|
|
747
|
+
* are that list's media of `kinds`, and `source: fill.pick({ brief })` picks one of
|
|
748
|
+
* them. Absent, the slot owns its media: the user uploads or pastes one into it.
|
|
757
749
|
*
|
|
758
|
-
* Its value carries the
|
|
750
|
+
* Its value carries the media's `kind`. There is no `Slot.Media`: narrow on `kind` and
|
|
759
751
|
* render that kind's own `Slot.Video`, `Slot.Tour` or `Slot.Document`, handing it the
|
|
760
752
|
* narrowed value; `Slot.Image` takes any of them, drawing a video's or tour's poster and
|
|
761
753
|
* a document's first page.
|
|
@@ -767,7 +759,7 @@ interface MediaSlotDef<Kinds extends MediaKind = MediaKind> extends Head, MediaF
|
|
|
767
759
|
* label: "Photo or video",
|
|
768
760
|
* kinds: ["image", "video"],
|
|
769
761
|
* from: fact.property.property_media,
|
|
770
|
-
* source: fill.pick({ brief: "The one
|
|
762
|
+
* source: fill.pick({ brief: "The one photo or video that sells the kitchen." }),
|
|
771
763
|
* });
|
|
772
764
|
*
|
|
773
765
|
* // in the renderer
|
|
@@ -777,6 +769,6 @@ interface MediaSlotDef<Kinds extends MediaKind = MediaKind> extends Head, MediaF
|
|
|
777
769
|
*/
|
|
778
770
|
declare function media<const Kinds extends MediaKind = MediaKind, const HasSource extends SourceBinding | undefined = undefined>(opts?: MediaOptions<Kinds> & {
|
|
779
771
|
source?: HasSource;
|
|
780
|
-
} & MirrorOption<HasSource, MediaValue<Kinds> |
|
|
772
|
+
} & MirrorOption<HasSource, MediaValue<Kinds> | MediaOfKind<Kinds> | null> & MediaFilterOption<HasSource, Kinds>): MediaSlotDef<Kinds> & SourceMark<HasSource> & FillMark;
|
|
781
773
|
//#endregion
|
|
782
774
|
export { AddressFactSource, AddressSlotDef, CropConfig, DateSlotDef, DisplayEntryInput, DisplayFill, DocumentSlotDef, EmailSlotDef, FindFillFor, HeldPickFill, ImageFactSource, ImageSlotDef, MediaFilterOption, MediaFromLists, MediaListDeclaration, MediaListFrom, MediaListPage, MediaSlotDef, MirrorOption, MirrorSource, MirrorValueOption, NumberSlotDef, PhoneSlotDef, PoiSlotDef, RequiredOption, SelectBuilder, SelectOptionInput, SelectOptionObject, SelectSlotDef, SlotSource, SourceBinding, SourceMark, TextSlotDef, TourSlotDef, UrlSlotDef, VideoSlotDef, WriteFillFor, address, date, document, email, image, media, number, phone, poi, select, text, tour, url, video };
|