@homepages/concrete 3.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 +52 -0
- package/codemods/framework-namespace.mjs +1 -1
- package/codemods/manifest.json +12 -0
- package/codemods/platform-namespace.mjs +83 -0
- package/codemods/theme-collapse.mjs +7 -5
- package/dist/artifact/playground/client/assets/{index-B3eNADCe.js → index-D1fwOGVK.js} +43 -49
- package/dist/artifact/playground/client/index.html +1 -1
- package/dist/artifact/playground/host.mjs +19 -19
- package/dist/base.css +21 -15
- package/dist/browser/site-config.d.ts +1 -1
- package/dist/browser/site-config.js +3 -2
- package/dist/packages/external/concrete/package.js +1 -1
- package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +2 -2
- package/dist/packages/internal/format-geometry/dist/capture.js +4 -4
- package/dist/packages/internal/island-runtime/dist/contract.d.ts +1 -1
- package/dist/packages/internal/section-contracts/dist/record-collection-contract.js +2 -2
- package/dist/packages/internal/source-resolution/dist/index.js +7 -24
- package/dist/primitives/FrameShell.d.ts +1 -1
- package/dist/primitives/FrameShell.js +1 -1
- 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 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,57 @@
|
|
|
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
|
+
|
|
26
|
+
## 4.0.0
|
|
27
|
+
|
|
28
|
+
### Major Changes
|
|
29
|
+
|
|
30
|
+
- a473312: The last three `tr-` names move onto `concrete-`: the frame root class `.tr-frame` (`FRAME_ROOT_CLASS`) becomes `.concrete-frame`, the published `<body>` class `.tr-root` becomes `.concrete-root`, and the per-site config island `#tr-site-config` becomes `#concrete-site-config`. Nothing here is yours to do by hand — `concrete upgrade` applies exactly this map for you, through the `platform-namespace` codemod this release ships.
|
|
31
|
+
|
|
32
|
+
These are the three the previous major deliberately left alone. They are the PLATFORM's names, stamped onto every rendered artifact by the publish and capture surfaces rather than derived by concrete — `base.css` only styles the first of them — and while the older framework was still serving pages off the same names, moving them meant either a runtime flag threaded through four platform packages or a break for a framework that could not take one. That framework is gone, so they move now, together, which is what keeps a rendered artifact and the page that previewed it from ever disagreeing about the class they share.
|
|
33
|
+
|
|
34
|
+
What this asks of a workspace: a stylesheet selecting `.tr-frame` or `.tr-root`, and a script reading `#tr-site-config`, should select the new names. The codemod rewrites all three in every `.css`, `.ts` and `.tsx` under the workspace — selectors, `className` and `id` strings, `getElementById` arguments and comments alike. It applies the whole map and only the map, is deterministic, and reports nothing as yours, so whatever it rewrote is not yours to check afterwards. Your own names are untouched: `.tr-rooted` and `--tr-frame-bg` are yours and stay.
|
|
35
|
+
|
|
36
|
+
The old spellings keep working for a transition window, on both sides. The platform stamps both body classes, both frame classes and both config ids, so a page built from an artifact published before this release still renders its frame and still posts its lead form. And this release's `base.css` styles both frame classes and `readSiteConfig()` falls back to the old id, so an artifact built on it still works if the platform publishing it has not yet moved. That window closes in a later release; run the codemod now rather than then.
|
|
37
|
+
|
|
38
|
+
`FRAME_ROOT_CLASS` is exported, so its VALUE changes under you if you read it. Read it rather than spelling the class, and nothing else here reaches you.
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- 317c555: The "Template assets unavailable" notice a canvas frame shows when a template has no published static-assets binding now says to re-publish the template, not "the template registry", which was the name of the publishing pipeline `concrete publish` replaced. Wording only: when the notice appears and what it blocks are unchanged.
|
|
43
|
+
- 7660d1e: The bake context a fixture resolves against now always carries a `computed` map: a section that authors no `compute()` gets an empty one, where the type previously allowed `null` for a section whose behavior had never been compiled at all. That state no longer exists — every build compiles a section's author code, and the platform refuses a published section version that carries none — so nothing a template or fixture does changes. Only the type stops describing a case the pipeline cannot produce.
|
|
44
|
+
- 8825400: No behavior change: the package no longer declares two workspace devDependencies that
|
|
45
|
+
nothing in its source imported. Both existed only to serve the framework this one
|
|
46
|
+
replaced, and went with it. The published tarball is identical apart from those two
|
|
47
|
+
lines of its manifest.
|
|
48
|
+
- 89b6e3c: The playground sidebar lays out every group card's fields the way the editor does: two adjacent short fields share a row, whatever the group's `members` spell. A `[a, b]` pair in a group's `members` still places both slots in that card, but it no longer switches the card, or every other card in the section, to its authored rows. A record list item's `layout` still sets its rows exactly as written.
|
|
49
|
+
- 7f183f0: The `theme-collapse` codemod reads a token declaration that closes its line with a
|
|
50
|
+
comment (`--tr-text-xs: 0.75rem; /* 12 */`). It used to take that line for something it
|
|
51
|
+
could not read and leave the whole stylesheet alone, so a template that annotated its
|
|
52
|
+
type scale step by step came out of `concrete upgrade` with its doubled theme untouched
|
|
53
|
+
and one line of report. The comment now travels with the value into the one `@theme`.
|
|
54
|
+
|
|
3
55
|
## 3.0.0
|
|
4
56
|
|
|
5
57
|
### Major Changes
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
// the publish and capture surfaces, not derived by concrete — `base.css` only styles
|
|
20
20
|
// them. They rename together in a release of their own, so that an artifact and the page
|
|
21
21
|
// that previewed it never disagree about the class they share. A workspace selecting
|
|
22
|
-
// `.tr-frame` keeps working here
|
|
22
|
+
// `.tr-frame` keeps working here; `platform-namespace`, in 4.0.0, is what moves it.
|
|
23
23
|
//
|
|
24
24
|
// Nothing is ever reported as yours: the map is total and mechanical, so whatever this
|
|
25
25
|
// rewrote is not yours to touch.
|
package/codemods/manifest.json
CHANGED
|
@@ -33,6 +33,18 @@
|
|
|
33
33
|
"manual": [
|
|
34
34
|
"name the layout tokens the report lists in the Tailwind namespace whose utility spends them, then respell their uses as utilities."
|
|
35
35
|
]
|
|
36
|
+
},
|
|
37
|
+
"4.0.0": {
|
|
38
|
+
"codemods": [
|
|
39
|
+
"platform-namespace"
|
|
40
|
+
],
|
|
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
|
+
]
|
|
36
48
|
}
|
|
37
49
|
}
|
|
38
50
|
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// 4.0.0 — the three names the PLATFORM stamps spell `concrete-` too.
|
|
2
|
+
//
|
|
3
|
+
// `framework-namespace` (3.0.0) moved every name concrete itself derives and deliberately
|
|
4
|
+
// left three behind: `.tr-frame`, `.tr-root` and `#tr-site-config`. Those are stamped
|
|
5
|
+
// onto a rendered artifact by the publish and capture surfaces rather than derived here —
|
|
6
|
+
// `FRAME_ROOT_CLASS` in `@homepages/format-geometry`, the published `<body>` class and
|
|
7
|
+
// the per-site config island — and concrete's `base.css` only styles the first of them.
|
|
8
|
+
// Moving them then would have meant either a runtime flag threaded through four platform
|
|
9
|
+
// packages or a break for the older framework, which was still serving a live customer
|
|
10
|
+
// off the same names. That framework is gone, so they move now.
|
|
11
|
+
//
|
|
12
|
+
// What that means for a workspace: a stylesheet selecting `.tr-frame` or `.tr-root`, or
|
|
13
|
+
// a script reading `#tr-site-config`, is on borrowed time. The platform stamps both
|
|
14
|
+
// spellings for a transition window, so pages built before this release keep working,
|
|
15
|
+
// and once that window closes the old names match nothing. This codemod applies exactly
|
|
16
|
+
// those three renames, in every `.css`, `.ts` and `.tsx` under the workspace —
|
|
17
|
+
// selectors, `className` and `id` strings, `getElementById` arguments and comments alike.
|
|
18
|
+
//
|
|
19
|
+
// Nothing is ever reported as yours: the map is total and mechanical, so whatever this
|
|
20
|
+
// rewrote is not yours to check afterwards.
|
|
21
|
+
|
|
22
|
+
import { readdir, readFile, writeFile } from "node:fs/promises";
|
|
23
|
+
import { join, relative } from "node:path";
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The §4.2 map, whole. Three names, none of them a custom property: two classes and one
|
|
27
|
+
* element id, so none carries a leading `--`.
|
|
28
|
+
*/
|
|
29
|
+
const RENAMES = new Map([
|
|
30
|
+
["tr-frame", "concrete-frame"],
|
|
31
|
+
["tr-root", "concrete-root"],
|
|
32
|
+
["tr-site-config", "concrete-site-config"],
|
|
33
|
+
]);
|
|
34
|
+
|
|
35
|
+
const escaped = (name) => name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* One name from the map, bounded.
|
|
39
|
+
*
|
|
40
|
+
* The two boundaries are what keep a workspace's own `--tr-frame-bg` or `.tr-rooted`
|
|
41
|
+
* clear of this map, and what makes `tr-frame` miss the `--tr-frame-window-*` properties
|
|
42
|
+
* and `tr-frame-*` counters `framework-namespace` already moved.
|
|
43
|
+
*/
|
|
44
|
+
const NAME = new RegExp(
|
|
45
|
+
`(?<![\\w-])(?:${[...RENAMES.keys()]
|
|
46
|
+
.sort((a, b) => b.length - a.length)
|
|
47
|
+
.map(escaped)
|
|
48
|
+
.join("|")})(?![\\w-])`,
|
|
49
|
+
"g",
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
/** The file kinds a workspace spells these names in. */
|
|
53
|
+
const EXTENSIONS = [".css", ".ts", ".tsx"];
|
|
54
|
+
const SKIP_DIRS = new Set(["node_modules", ".concrete", ".git", "dist", "build"]);
|
|
55
|
+
|
|
56
|
+
/** Every source file under `root`, absolute, skipping build output and dependencies. */
|
|
57
|
+
async function sourceFiles(root) {
|
|
58
|
+
const found = [];
|
|
59
|
+
async function walk(dir) {
|
|
60
|
+
for (const entry of await readdir(dir, { withFileTypes: true })) {
|
|
61
|
+
if (entry.isDirectory()) {
|
|
62
|
+
if (!SKIP_DIRS.has(entry.name)) await walk(join(dir, entry.name));
|
|
63
|
+
} else if (EXTENSIONS.some((extension) => entry.name.endsWith(extension))) {
|
|
64
|
+
found.push(join(dir, entry.name));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
await walk(root);
|
|
69
|
+
return found.sort();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** @param {string} root @returns {Promise<{rewritten: string[], notRewritten: {file: string, reason: string}[]}>} */
|
|
73
|
+
export default async function platformNamespace(root) {
|
|
74
|
+
const rewritten = [];
|
|
75
|
+
for (const file of await sourceFiles(root)) {
|
|
76
|
+
const before = await readFile(file, "utf8");
|
|
77
|
+
const after = before.replace(NAME, (name) => RENAMES.get(name) ?? name);
|
|
78
|
+
if (after === before) continue;
|
|
79
|
+
await writeFile(file, after);
|
|
80
|
+
rewritten.push(relative(root, file).split("\\").join("/"));
|
|
81
|
+
}
|
|
82
|
+
return { rewritten, notRewritten: [] };
|
|
83
|
+
}
|
|
@@ -168,13 +168,14 @@ function topLevelRules(css) {
|
|
|
168
168
|
return rules;
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
|
|
171
|
+
/** One declaration on its line, and the one comment it may close on (`--text-xs: 0.75rem; /* 12 *\/`). */
|
|
172
|
+
const DECLARATION = /^\s*(--[A-Za-z0-9_-]+)\s*:\s*(.+?);\s*(\/\*(?:(?!\*\/).)*\*\/)?\s*$/;
|
|
172
173
|
|
|
173
174
|
/**
|
|
174
175
|
* A block body read as declarations, each carrying the lines that introduce it — its
|
|
175
176
|
* comments and the blank lines around them, so prose written about a value travels with
|
|
176
|
-
* the value when it moves
|
|
177
|
-
* one whole declaration.
|
|
177
|
+
* the value when it moves, and the comment closing its own line. Null when a line is
|
|
178
|
+
* neither blank, nor part of a comment, nor one whole declaration.
|
|
178
179
|
*/
|
|
179
180
|
function declarations(body) {
|
|
180
181
|
const lines = body.split("\n");
|
|
@@ -202,7 +203,7 @@ function declarations(body) {
|
|
|
202
203
|
}
|
|
203
204
|
const matched = DECLARATION.exec(line);
|
|
204
205
|
if (matched === null) return null;
|
|
205
|
-
entries.push({ lead, property: matched[1], value: matched[2].trim(), line });
|
|
206
|
+
entries.push({ lead, property: matched[1], value: matched[2].trim(), comment: matched[3], line });
|
|
206
207
|
lead = [];
|
|
207
208
|
}
|
|
208
209
|
return inComment ? null : { entries, trailing: lead };
|
|
@@ -288,7 +289,8 @@ function planFile(css) {
|
|
|
288
289
|
}
|
|
289
290
|
rename.set(mirrored[1], entry.property);
|
|
290
291
|
consumed.add(mirrored[1]);
|
|
291
|
-
|
|
292
|
+
const collapsed = entry.line.replace(entry.value, () => source.value);
|
|
293
|
+
lines.push(...entry.lead, ...source.lead, source.comment === undefined ? collapsed : `${collapsed.trimEnd()} ${source.comment}`);
|
|
292
294
|
}
|
|
293
295
|
// An `@theme inline` holding nothing mirrors nothing, so there is no collapse to
|
|
294
296
|
// make and rewriting it would only reformat a block nobody asked about.
|