@homepages/concrete 4.0.0 → 5.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 +23 -0
- package/codemods/manifest.json +6 -0
- package/dist/packages/external/concrete/package.js +1 -1
- package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +1 -1
- package/dist/packages/internal/source-resolution/dist/index.js +7 -24
- package/dist/primitives/slot-bindings.d.ts +3 -2
- package/dist/schema/fact.d.ts +8 -6
- package/dist/schema/runtime-values.d.ts +6 -18
- package/dist/schema/section-props.d.ts +7 -9
- 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 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @homepages/concrete
|
|
2
2
|
|
|
3
|
+
## 5.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- a0171a7: Manual: declare each contact field a section reads on its `fact.property.contacts` list, then read it under the key you declared it with.
|
|
8
|
+
|
|
9
|
+
BREAKING: a contact row's type now carries only what the row carries: `id` plus the fields its list declares, each under its declared key. `ContactRow` is now `{ id: string }`. It used to list twelve conventional members (`name`, `title`, `bio`, `email`, `phone`, `instagram`, `linkedin`, `x`, `facebook`, `website`, `headshot`, `logo`), and every contacts row was typed with all of them, declared or not.
|
|
10
|
+
|
|
11
|
+
The old type described a row that no contact list receives. A contact row's keys come from its list's declarations alone, so a list that declares `website_url: url({ source: fact.contact.website })` and no `x` bakes rows with `website_url` and without `x`. Before this release, `row.website` and `row.x` still compiled against that list and were `undefined` at runtime. Now both are type errors, raised where the read is written.
|
|
12
|
+
|
|
13
|
+
Unit and comparable rows are unchanged. Those projections carry their whole record on every row, so their undeclared members (`unit_id`, a comparable's `status`) are still typed.
|
|
14
|
+
|
|
15
|
+
What this asks of a workspace: fix each read the compiler now flags. If the section should show that value, declare the field on the list, and the platform bakes it. Otherwise delete the read, because it has always rendered as blank. No codemod can make this change, because only you know which fields a section means to show.
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 5fa2611: A `contacts`-bound record list that declares no direct-sourced row field now resolves
|
|
20
|
+
its fixture rows to `{ id }` alone, instead of a fixed twelve-key stand-in shape
|
|
21
|
+
(`name`, `title`, `bio`, … `logo`). A contact row's keys come only from its fields'
|
|
22
|
+
own `source:` declarations, in fixtures as in a fill, so a slot that forgot to bind its row fields renders empty rows in `concrete dev` rather than
|
|
23
|
+
rows carrying values it never declared. Every contacts list that binds its fields
|
|
24
|
+
resolves exactly as before.
|
|
25
|
+
|
|
3
26
|
## 4.0.0
|
|
4
27
|
|
|
5
28
|
### Major Changes
|
package/codemods/manifest.json
CHANGED
|
@@ -39,6 +39,12 @@
|
|
|
39
39
|
"platform-namespace"
|
|
40
40
|
],
|
|
41
41
|
"manual": []
|
|
42
|
+
},
|
|
43
|
+
"5.0.0": {
|
|
44
|
+
"codemods": [],
|
|
45
|
+
"manual": [
|
|
46
|
+
"declare each contact field a section reads on its `fact.property.contacts` list, then read it under the key you declared it with."
|
|
47
|
+
]
|
|
42
48
|
}
|
|
43
49
|
}
|
|
44
50
|
}
|
|
@@ -10,7 +10,7 @@ function directField(def) {
|
|
|
10
10
|
if (src["kind"] !== "direct") return null;
|
|
11
11
|
return typeof src["field"] === "string" ? src["field"] : null;
|
|
12
12
|
}
|
|
13
|
-
function resolveDirectField(field, facts, rowFields) {
|
|
13
|
+
function resolveDirectField(field, facts, rowFields = {}) {
|
|
14
14
|
if (Object.hasOwn(COLLECTION_PROJECTIONS, field)) return COLLECTION_PROJECTIONS[field](facts, rowFields);
|
|
15
15
|
if (field === "unit_floorplans") return buildUnitFloorplanList(facts);
|
|
16
16
|
return readFrom(field, { facts });
|
|
@@ -4,15 +4,14 @@ import { DEFAULT_FACTS_VIEW_YEAR, projectFactsView } from "../../template-contra
|
|
|
4
4
|
//#region ../../internal/source-resolution/dist/index.js
|
|
5
5
|
/**
|
|
6
6
|
* Extracts the {@link RowFieldSourceMap} from a slot's serialized row-field
|
|
7
|
-
* declarations (`fields`), keeping only direct-sourced entries.
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* declarations (`fields`), keeping only direct-sourced entries. A slot declaring
|
|
8
|
+
* none gets the empty mapping, never a stand-in shape: a row carries only what
|
|
9
|
+
* its schema declares.
|
|
10
10
|
*/
|
|
11
11
|
function rowFieldSources(fields) {
|
|
12
|
-
if (fields === void 0) return void 0;
|
|
13
12
|
const map = {};
|
|
14
|
-
for (const [key, field] of Object.entries(fields)) if (field.source?.kind === "direct" && typeof field.source.field === "string") map[key] = field.source.field;
|
|
15
|
-
return
|
|
13
|
+
for (const [key, field] of Object.entries(fields ?? {})) if (field.source?.kind === "direct" && typeof field.source.field === "string") map[key] = field.source.field;
|
|
14
|
+
return map;
|
|
16
15
|
}
|
|
17
16
|
function primaryContact(facts) {
|
|
18
17
|
return facts.contacts?.find((c) => c.primary) ?? facts.contacts?.[0];
|
|
@@ -103,28 +102,13 @@ function singleUnitLabelDefault(propertyType) {
|
|
|
103
102
|
default: return null;
|
|
104
103
|
}
|
|
105
104
|
}
|
|
106
|
-
const CONTACT_ROW_DEFAULT_FIELDS = {
|
|
107
|
-
name: "name",
|
|
108
|
-
title: "title",
|
|
109
|
-
bio: "bio",
|
|
110
|
-
email: "email",
|
|
111
|
-
phone: "phone",
|
|
112
|
-
instagram: "instagram",
|
|
113
|
-
linkedin: "linkedin",
|
|
114
|
-
x: "x",
|
|
115
|
-
facebook: "facebook",
|
|
116
|
-
website: "website",
|
|
117
|
-
headshot: "headshot",
|
|
118
|
-
logo: "logo_dark"
|
|
119
|
-
};
|
|
120
105
|
function resolveContactRowField(c, field) {
|
|
121
106
|
return resolveContactScalar(c, field);
|
|
122
107
|
}
|
|
123
108
|
function buildContactsList(facts, fields) {
|
|
124
|
-
const mapping = fields ?? CONTACT_ROW_DEFAULT_FIELDS;
|
|
125
109
|
return contactsOf(facts).map((c) => {
|
|
126
110
|
const row = { id: c.id };
|
|
127
|
-
for (const [key, field] of Object.entries(
|
|
111
|
+
for (const [key, field] of Object.entries(fields)) row[key] = resolveContactRowField(c, field);
|
|
128
112
|
return row;
|
|
129
113
|
});
|
|
130
114
|
}
|
|
@@ -135,7 +119,6 @@ function buildUnitsList(facts, fields) {
|
|
|
135
119
|
...u,
|
|
136
120
|
unit_label: u.unit_label ?? fallback
|
|
137
121
|
};
|
|
138
|
-
if (fields === void 0) return base;
|
|
139
122
|
const row = { ...base };
|
|
140
123
|
for (const [key, field] of Object.entries(fields)) row[key] = resolveUnitScalar(base, field);
|
|
141
124
|
return row;
|
|
@@ -198,7 +181,7 @@ function resolveContactScalar(contact, field) {
|
|
|
198
181
|
function readFrom(field, ctx) {
|
|
199
182
|
const desc = SOURCE_FIELDS[field];
|
|
200
183
|
if (!desc) return null;
|
|
201
|
-
if (Object.hasOwn(COLLECTION_PROJECTIONS, field)) return COLLECTION_PROJECTIONS[field](ctx.facts, ctx.rowFields);
|
|
184
|
+
if (Object.hasOwn(COLLECTION_PROJECTIONS, field)) return COLLECTION_PROJECTIONS[field](ctx.facts, ctx.rowFields ?? {});
|
|
202
185
|
if (desc.container === "contact") return resolveContactScalar(ctx.contact ?? primaryContact(ctx.facts), field);
|
|
203
186
|
if (desc.container === "unit") return resolveUnitScalar(ctx.unit ?? firstUnit(ctx.facts), field);
|
|
204
187
|
return resolvePropertyScalar(ctx.facts, field);
|
|
@@ -32,8 +32,9 @@ type ProjectedImageListKeys<F extends CollectionField, I> = { [K in keyof I & ke
|
|
|
32
32
|
type: "image";
|
|
33
33
|
} ? CollectionRowValues[F][K] extends readonly unknown[] ? K : never : never; }[keyof I & keyof CollectionRowValues[F]];
|
|
34
34
|
/**
|
|
35
|
-
* One bound row of a whole-row-baked record list: every member
|
|
36
|
-
*
|
|
35
|
+
* One bound row of a whole-row-baked record list: every member the collection projects
|
|
36
|
+
* onto each row whatever the slot declares (a unit's or comparable's whole record, a
|
|
37
|
+
* contact's `id` alone), with each DECLARED field at its normalized kind — except a declared
|
|
37
38
|
* `image` field the projection carries as a list (a unit's `floor_plans`, its ordered
|
|
38
39
|
* floor-plan assignments), which keeps the projection's list. That field's own
|
|
39
40
|
* `FieldBinding` still holds the `image` kind's value, so the primitives read it
|
package/dist/schema/fact.d.ts
CHANGED
|
@@ -4,12 +4,14 @@ import { ContactRow } from "./runtime-values.js";
|
|
|
4
4
|
//#region src/schema/fact.d.ts
|
|
5
5
|
type SourceFields = typeof SOURCE_FIELDS;
|
|
6
6
|
/**
|
|
7
|
-
* The
|
|
8
|
-
* record list may bind whole-row
|
|
9
|
-
* `fact.property.contacts`). `SlotValue` uses
|
|
10
|
-
* the base row type for such a slot
|
|
11
|
-
*
|
|
12
|
-
*
|
|
7
|
+
* The members each bakeable fact array projects onto every row, whatever the
|
|
8
|
+
* slot declares — one entry per collection a record list may bind whole-row
|
|
9
|
+
* (`source: fact.property.units` / `fact.property.contacts`). `SlotValue` uses
|
|
10
|
+
* the bound collection's entry as the base row type for such a slot and adds
|
|
11
|
+
* the declared fields the base does not carry, so `SectionProps` types its rows
|
|
12
|
+
* as the projection the renderer actually receives. A unit or comparable row
|
|
13
|
+
* carries its whole record; a contact row carries only its `id`, every other
|
|
14
|
+
* member being a declared field.
|
|
13
15
|
*/
|
|
14
16
|
type CollectionRowValues = {
|
|
15
17
|
units: UnitRow;
|
|
@@ -33,27 +33,15 @@ type ImageValue = {
|
|
|
33
33
|
/** An image list slot's runtime value: an ordered array of `ImageValue`, possibly empty. */
|
|
34
34
|
type ImageCollectionValue = ImageValue[];
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
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
42
|
*/
|
|
43
43
|
type ContactRow = {
|
|
44
44
|
id: string;
|
|
45
|
-
name: string;
|
|
46
|
-
title: string;
|
|
47
|
-
bio: string | null;
|
|
48
|
-
email: string;
|
|
49
|
-
phone: string;
|
|
50
|
-
instagram: string;
|
|
51
|
-
linkedin: string;
|
|
52
|
-
x: string;
|
|
53
|
-
facebook: string;
|
|
54
|
-
website: string;
|
|
55
|
-
headshot: ImageValue | null;
|
|
56
|
-
logo: ImageValue | null;
|
|
57
45
|
};
|
|
58
46
|
/**
|
|
59
47
|
* A raster image the template itself ships — a build-time `import` of a file
|
|
@@ -63,18 +63,16 @@ type SlotValue<S> = S extends {
|
|
|
63
63
|
type RowValue<I> = {
|
|
64
64
|
id: string;
|
|
65
65
|
} & { [K in keyof I]: SlotValue<I[K]>; };
|
|
66
|
-
type AuthoredRowFieldKeys<I> = { [K in keyof I]: I[K] extends {
|
|
67
|
-
source: unknown;
|
|
68
|
-
} ? never : K; }[keyof I];
|
|
69
66
|
/**
|
|
70
67
|
* One row of a record `list` bound whole-row to a bakeable fact array
|
|
71
|
-
* (`source: fact.property.units` / `fact.property.contacts`): the
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
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.
|
|
76
74
|
*/
|
|
77
|
-
type BakedRowValue<F extends CollectionField, I> = CollectionRowValues[F] & { [K in Exclude<
|
|
75
|
+
type BakedRowValue<F extends CollectionField, I> = CollectionRowValues[F] & { [K in Exclude<keyof I, keyof CollectionRowValues[F]>]: SlotValue<I[K]>; };
|
|
78
76
|
type VariantOf<S extends SectionSchemaShape> = S["meta"] extends {
|
|
79
77
|
display: {
|
|
80
78
|
variant: {
|
|
@@ -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 >=5.0.0 <6.0.0"
|
|
7
7
|
related: [INDEX.md]
|
|
8
8
|
---
|
|
9
9
|
# Command reference
|
|
@@ -73,7 +73,7 @@ of its flags.
|
|
|
73
73
|
|
|
74
74
|
## Versions
|
|
75
75
|
|
|
76
|
-
These pages describe `@homepages/concrete` **>=
|
|
76
|
+
These pages describe `@homepages/concrete` **>=5.0.0 <6.0.0**. The range, rather than
|
|
77
77
|
the exact version they were generated from: this reference is committed build output,
|
|
78
78
|
so a page stamped with a patch version would be stale the day it shipped.
|
|
79
79
|
`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 >=5.0.0 <6.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 >=5.0.0 <6.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 >=5.0.0 <6.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 >=5.0.0 <6.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 >=5.0.0 <6.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 >=5.0.0 <6.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 >=5.0.0 <6.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 >=5.0.0 <6.0.0"
|
|
7
7
|
related: [reference/cli/check.md]
|
|
8
8
|
---
|
|
9
9
|
# Rule reference
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@homepages/concrete",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.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",
|