@homepages/concrete 2.0.0 → 4.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/codemods/framework-namespace.mjs +107 -0
  3. package/codemods/manifest.json +15 -0
  4. package/codemods/platform-namespace.mjs +83 -0
  5. package/codemods/theme-collapse.mjs +396 -0
  6. package/dist/artifact/playground/client/assets/{index-CW7co-u9.js → index-D1fwOGVK.js} +37 -37
  7. package/dist/artifact/playground/client/index.html +1 -1
  8. package/dist/artifact/playground/client/island-canvas-host.mjs +1 -1
  9. package/dist/artifact/playground/host.mjs +19 -19
  10. package/dist/base.css +57 -34
  11. package/dist/browser/site-config.d.ts +1 -1
  12. package/dist/browser/site-config.js +3 -2
  13. package/dist/cli/check/render/class-conflicts.js +1 -1
  14. package/dist/cli/dev/islands.js +2 -2
  15. package/dist/packages/external/concrete/package.js +1 -1
  16. package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +1 -1
  17. package/dist/packages/internal/format-geometry/dist/capture.js +4 -4
  18. package/dist/packages/internal/island-runtime/dist/contract.d.ts +1 -1
  19. package/dist/packages/internal/section-contracts/dist/record-collection-contract.js +2 -2
  20. package/dist/primitives/FrameShell.d.ts +1 -1
  21. package/dist/primitives/FrameShell.js +1 -1
  22. package/dist/primitives/Image.d.ts +1 -1
  23. package/dist/primitives/Image.js +3 -3
  24. package/dist/primitives/Section.d.ts +3 -3
  25. package/dist/primitives/Section.js +4 -4
  26. package/dist/primitives/Tour.d.ts +1 -1
  27. package/dist/primitives/Tour.js +3 -3
  28. package/dist/primitives/Video.d.ts +1 -1
  29. package/dist/primitives/Video.js +3 -3
  30. package/dist/styles.css +4 -3
  31. package/guide/reference/cli/INDEX.md +2 -2
  32. package/guide/reference/cli/build.md +1 -1
  33. package/guide/reference/cli/check.md +1 -1
  34. package/guide/reference/cli/dev.md +1 -1
  35. package/guide/reference/cli/property-add.md +1 -1
  36. package/guide/reference/cli/property-list.md +1 -1
  37. package/guide/reference/cli/publish.md +1 -1
  38. package/guide/reference/cli/upgrade.md +1 -1
  39. package/guide/reference/rules/INDEX.md +1 -1
  40. package/package.json +1 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,68 @@
1
1
  # @homepages/concrete
2
2
 
3
+ ## 4.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 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.
8
+
9
+ 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.
10
+
11
+ 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.
12
+
13
+ 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.
14
+
15
+ `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.
16
+
17
+ ### Patch Changes
18
+
19
+ - 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.
20
+ - 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.
21
+ - 8825400: No behavior change: the package no longer declares two workspace devDependencies that
22
+ nothing in its source imported. Both existed only to serve the framework this one
23
+ replaced, and went with it. The published tarball is identical apart from those two
24
+ lines of its manifest.
25
+ - 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.
26
+ - 7f183f0: The `theme-collapse` codemod reads a token declaration that closes its line with a
27
+ comment (`--tr-text-xs: 0.75rem; /* 12 */`). It used to take that line for something it
28
+ could not read and leave the whole stylesheet alone, so a template that annotated its
29
+ type scale step by step came out of `concrete upgrade` with its doubled theme untouched
30
+ and one line of report. The comment now travels with the value into the one `@theme`.
31
+
32
+ ## 3.0.0
33
+
34
+ ### Major Changes
35
+
36
+ - dd83c66: The framework's own CSS names move onto the `concrete-` namespace: the tokens `--tr-window-h`, `--tr-ease`, `--tr-duration-fast`, `--tr-duration-base` and `--tr-image-frame-bg`, and the classes `.tr-section`, `.tr-image-block` and `.tr-image-frame`. Nothing here is yours to do by hand — `concrete upgrade` applies exactly this map for you, through the `framework-namespace` codemod this release ships.
37
+
38
+ BREAKING: `base.css` no longer declares a `--tr-*` token or emits a `.tr-*` class, and `<Section>`, `<Image>`, `<Video>` and `<Tour>` emit the `concrete-` spellings. A stylesheet still reading `var(--tr-duration-fast)` or selecting `.tr-section` now matches nothing and renders a missing value.
39
+
40
+ The framework is called concrete and its names say so. `--tr-` came from the old kit, where a vendor prefix kept generated names clear of Tailwind's — and templates ported from that kit spell their _own_ tokens with it too, so one prefix had two owners and nothing told them apart. After this change a name is the framework's if and only if it reads `concrete-`, on both sides of the colon: `.concrete-section` is the section box model, `var(--concrete-window-h)` is the window the page is being viewed in, `--concrete-ease` and `--concrete-duration-*` are the motion constants `styles.css` aliases onto Tailwind's transition defaults.
41
+
42
+ `--concrete-image-frame-bg` is the one name in the set you declare rather than only read: it retints the `<Image>`/`<Video>` placeholder fill, and falls back to a neutral grey. Every other `--concrete-*` is declared in `base.css` and read from there.
43
+
44
+ Your own tokens are a separate move. They belong in one plain `@theme` under the Tailwind namespace whose utility spends them — `--color-ink`, `--spacing-gutter`, `--container-page` — with no prefix and no `:root` mirror; the `theme-collapse` codemod collapses the doubled shape and reports the layout tokens whose new name is a judgment only you can make.
45
+
46
+ One `tr-` name is deliberately untouched: `.tr-frame`, the frame root every capture surface stamps. It is the platform's class rather than the framework's — `base.css` styles it, nothing here derives it — and it renames with the rest of the platform's names, in its own release, so that a rendered artifact and the page that previewed it never disagree about the class they share.
47
+
48
+ - 2a73297: `concrete upgrade` now carries a workspace across the `concrete-` namespace rename on its own: this major ships the `framework-namespace` codemod.
49
+
50
+ It applies the whole map and only the map — the tokens `--tr-window-h`, `--tr-ease`, `--tr-duration-fast`, `--tr-duration-base` and `--tr-image-frame-bg`, the classes `.tr-section`, `.tr-image-block` and `.tr-image-frame`, and `base.css`'s own frame witness — to every `.css`, `.ts` and `.tsx` in the workspace, in declarations, `var()` reads, selectors, `className` strings and comments alike. It is deterministic and reports nothing as yours, so whatever it rewrote is not yours to check afterwards.
51
+
52
+ Your own tokens are untouched even where they share the old prefix: a `--tr-color-ink` of yours keeps its spelling here, and the `theme-collapse` codemod in this same release is what moves it. That separation is the whole point of the rename — one prefix had two owners and nothing told them apart, and after this a name is the framework's if and only if it reads `concrete-`.
53
+
54
+ `.tr-frame`, `.tr-root` and `#tr-site-config` are deliberately left alone. Those are the platform's names, stamped onto every rendered artifact rather than derived by concrete, and they move together in a release of their own; a stylesheet selecting `.tr-frame` keeps working across this one.
55
+
56
+ - 2a73297: Manual: name the layout tokens the report lists in the Tailwind namespace whose utility spends them, then respell their uses as utilities.
57
+
58
+ BREAKING: a template declares each of its tokens ONCE, in one plain `@theme`, under the Tailwind namespace whose utility spends it — `--color-ink`, `--spacing-gutter`, `--container-page` — with no prefix and no `:root` mirror. The doubled shape a ported template inherited is retired: a `:root` of values under a `--tr-` prefix, plus an `@theme inline` block aliasing each onto the Tailwind name that yields a utility.
59
+
60
+ `concrete upgrade` runs the `theme-collapse` codemod this major ships, which does the mechanical half. Every `@theme inline { --X: var(--tr-Y) }` entry whose `:root { --tr-Y: value }` stands in the same stylesheet becomes `--X: value` in a plain `@theme`, both originals go, and every read of it is respelled — `var(--tr-Y)` to `var(--X)` in a stylesheet, and in a `className` onto the utility the namespace generates, so `bg-[var(--tr-color-ink)]` becomes `bg-ink`. A `@media` `:root` override is respelled and kept, which is the honest shape for a responsive token: `@theme` emits the token on `:root`, so the override wins by source order and every utility spending it follows.
61
+
62
+ **What it hands back.** A `:root --tr-*` with no mirror is a layout token — the old kit generated an alias only for the namespaces it knew, so `--tr-container-max`, `--tr-container-pad`, `--tr-header-height` and their neighbours never had one. Each is reported to you with the rule for naming it, and its declaration and every read of it are left exactly as they stand. The name is a judgment nothing can make for you: it has to say what the value is FOR in this template (`gutter`, `header`, `page`) rather than where it came from (`m`, `container-pad`), it belongs to the namespace whose utility spends it — a length spent through `p-*`/`h-*`/`gap-*` is `--spacing-*`, a page or column max-width is `--container-*` — and it must not collide with a stock utility, since `--container-max` would make `max-w-max` ambiguous with `max-content`.
63
+
64
+ Why the doubled shape was residue rather than design: the alias layer's only purpose in the wider world is a runtime theme swap (`.dark { --primary: … }`) that no template has, and a vendor prefix exists to keep a third-party stylesheet clear of its host's names, which your own stylesheet never needs.
65
+
3
66
  ## 2.0.0
4
67
 
5
68
  ### Major Changes
@@ -0,0 +1,107 @@
1
+ // 3.0.0 — the framework's own CSS names spell `concrete-`.
2
+ //
3
+ // `base.css` used to declare its tokens under `--tr-` and emit its classes as `.tr-*`, a
4
+ // prefix inherited from the old kit. Templates ported from that kit spell their OWN
5
+ // tokens with it too, so one prefix had two owners and nothing told them apart. After
6
+ // this break a name is the framework's if and only if it reads `concrete-`, and
7
+ // `base.css` declares no `--tr-*` and emits no `.tr-*` at all — so a stylesheet still
8
+ // reading `var(--tr-duration-fast)` or selecting `.tr-section` matches nothing and
9
+ // renders a missing value.
10
+ //
11
+ // This codemod applies exactly that map, and only it: the sixteen names concrete itself
12
+ // emits, in every `.css`, `.ts` and `.tsx` under the workspace, in declarations, `var()`
13
+ // reads, selectors, `className` strings and comments alike. Everything else keeps its
14
+ // spelling, which is the point — `--tr-color-ink` in the same file is YOUR token, and
15
+ // `theme-collapse` is what moves it.
16
+ //
17
+ // THREE `tr-` NAMES ARE DELIBERATELY UNTOUCHED: `.tr-frame`, `.tr-root` and
18
+ // `#tr-site-config`. They are the platform's, stamped onto every rendered artifact by
19
+ // the publish and capture surfaces, not derived by concrete — `base.css` only styles
20
+ // them. They rename together in a release of their own, so that an artifact and the page
21
+ // that previewed it never disagree about the class they share. A workspace selecting
22
+ // `.tr-frame` keeps working here; `platform-namespace`, in 4.0.0, is what moves it.
23
+ //
24
+ // Nothing is ever reported as yours: the map is total and mechanical, so whatever this
25
+ // rewrote is not yours to touch.
26
+
27
+ import { readdir, readFile, writeFile } from "node:fs/promises";
28
+ import { join, relative } from "node:path";
29
+
30
+ /**
31
+ * The §4.1 map, whole. A custom property carries its `--`; a class, id or counter name
32
+ * does not, which is also what keeps `--tr-image-frame-bg` and the `.tr-image-frame`
33
+ * class two entries rather than one prefix match.
34
+ */
35
+ const RENAMES = new Map([
36
+ // Declared in base.css, read by templates.
37
+ ["--tr-window-h", "--concrete-window-h"],
38
+ ["--tr-ease", "--concrete-ease"],
39
+ ["--tr-duration-fast", "--concrete-duration-fast"],
40
+ ["--tr-duration-base", "--concrete-duration-base"],
41
+ // The one name in the set a template DECLARES rather than only reads.
42
+ ["--tr-image-frame-bg", "--concrete-image-frame-bg"],
43
+ // base.css's frame witness, private to it: its properties and its counters.
44
+ ["--tr-frame-window-w", "--concrete-frame-window-w"],
45
+ ["--tr-frame-window-h", "--concrete-frame-window-h"],
46
+ ["--tr-frame-window-mismatch", "--concrete-frame-window-mismatch"],
47
+ ["tr-frame-owed-w", "concrete-frame-owed-w"],
48
+ ["tr-frame-owed-h", "concrete-frame-owed-h"],
49
+ ["tr-frame-got-w", "concrete-frame-got-w"],
50
+ ["tr-frame-got-h", "concrete-frame-got-h"],
51
+ // Classes the primitives emit, and the dev canvas's own style element.
52
+ ["tr-section", "concrete-section"],
53
+ ["tr-image-block", "concrete-image-block"],
54
+ ["tr-image-frame", "concrete-image-frame"],
55
+ ["tr-canvas-shield-style", "concrete-canvas-shield-style"],
56
+ ]);
57
+
58
+ const escaped = (name) => name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
59
+
60
+ /**
61
+ * One name from the map, bounded.
62
+ *
63
+ * Longest alternative first, so `--tr-frame-window-w` is never read as the untouched
64
+ * `tr-frame` plus a suffix. The two boundaries are what make `.tr-frame` and
65
+ * `.tr-image-frame-bg` miss `tr-image-frame`, and what keeps `--tr-ease` clear of a
66
+ * template's own `--tr-ease-out`.
67
+ */
68
+ const NAME = new RegExp(
69
+ `(?<![\\w-])(?:${[...RENAMES.keys()]
70
+ .sort((a, b) => b.length - a.length)
71
+ .map(escaped)
72
+ .join("|")})(?![\\w-])`,
73
+ "g",
74
+ );
75
+
76
+ /** The file kinds a workspace spells these names in. */
77
+ const EXTENSIONS = [".css", ".ts", ".tsx"];
78
+ const SKIP_DIRS = new Set(["node_modules", ".concrete", ".git", "dist", "build"]);
79
+
80
+ /** Every source file under `root`, absolute, skipping build output and dependencies. */
81
+ async function sourceFiles(root) {
82
+ const found = [];
83
+ async function walk(dir) {
84
+ for (const entry of await readdir(dir, { withFileTypes: true })) {
85
+ if (entry.isDirectory()) {
86
+ if (!SKIP_DIRS.has(entry.name)) await walk(join(dir, entry.name));
87
+ } else if (EXTENSIONS.some((extension) => entry.name.endsWith(extension))) {
88
+ found.push(join(dir, entry.name));
89
+ }
90
+ }
91
+ }
92
+ await walk(root);
93
+ return found.sort();
94
+ }
95
+
96
+ /** @param {string} root @returns {Promise<{rewritten: string[], notRewritten: {file: string, reason: string}[]}>} */
97
+ export default async function frameworkNamespace(root) {
98
+ const rewritten = [];
99
+ for (const file of await sourceFiles(root)) {
100
+ const before = await readFile(file, "utf8");
101
+ const after = before.replace(NAME, (name) => RENAMES.get(name) ?? name);
102
+ if (after === before) continue;
103
+ await writeFile(file, after);
104
+ rewritten.push(relative(root, file).split("\\").join("/"));
105
+ }
106
+ return { rewritten, notRewritten: [] };
107
+ }
@@ -24,6 +24,21 @@
24
24
  "manual": [
25
25
  "replace every `useId()` in a `\"use client\"` module with an id composed from `useIslandId()` \u2014 `` const bodyId = `${useIslandId()}-body`; `` \u2014 adding your own suffix per id, and a discriminator from your own data (a row key, a facet name) wherever one component renders more than once inside a single island."
26
26
  ]
27
+ },
28
+ "3.0.0": {
29
+ "codemods": [
30
+ "framework-namespace",
31
+ "theme-collapse"
32
+ ],
33
+ "manual": [
34
+ "name the layout tokens the report lists in the Tailwind namespace whose utility spends them, then respell their uses as utilities."
35
+ ]
36
+ },
37
+ "4.0.0": {
38
+ "codemods": [
39
+ "platform-namespace"
40
+ ],
41
+ "manual": []
27
42
  }
28
43
  }
29
44
  }
@@ -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
+ }