@homepages/concrete 10.0.0 → 11.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 (104) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/codemods/manifest.json +5 -158
  3. package/dist/artifact/playground/client/assets/index-ByeGGedv.js +1259 -0
  4. package/dist/artifact/playground/client/assets/index-CxWPYOH2.css +1 -0
  5. package/dist/artifact/playground/client/index.html +2 -2
  6. package/dist/artifact/playground/client/island-canvas-host.mjs +1 -1
  7. package/dist/artifact/playground/host.mjs +26 -26
  8. package/dist/base.css +1 -8
  9. package/dist/cli/build/artifact.js +1 -1
  10. package/dist/cli/build/fixtures.js +3 -2
  11. package/dist/cli/check/stages/sections.js +1 -1
  12. package/dist/cli/dev/workspace-reader.js +3 -2
  13. package/dist/css/compile.js +3 -6
  14. package/dist/css/rules.js +1 -51
  15. package/dist/design-system/format-variants.js +1 -1
  16. package/dist/fixtures/resolve.js +5 -1
  17. package/dist/fixtures/rows.js +2 -2
  18. package/dist/index.d.ts +5 -5
  19. package/dist/packages/external/concrete/package.js +1 -1
  20. package/dist/packages/internal/fill-vocabulary/dist/holder.js +3 -14
  21. package/dist/packages/internal/media-resolution/dist/document.js +3 -3
  22. package/dist/packages/internal/media-resolution/dist/image.js +3 -3
  23. package/dist/packages/internal/media-resolution/dist/tour.js +6 -6
  24. package/dist/packages/internal/media-resolution/dist/video.js +9 -9
  25. package/dist/packages/internal/section-contracts/dist/fill-verb-contract.js +1 -0
  26. package/dist/packages/internal/section-contracts/dist/runners.js +1 -3
  27. package/dist/packages/internal/section-contracts/dist/source-contract.js +3 -3
  28. package/dist/packages/internal/section-contracts/dist/sources-contract.js +0 -2
  29. package/dist/packages/internal/template-artifact/dist/index.js +2 -2
  30. package/dist/packages/internal/template-artifact/dist/layout.js +11 -11
  31. package/dist/packages/internal/template-artifact/dist/manifest.js +1 -1
  32. package/dist/packages/internal/template-artifact/dist/verify.js +13 -17
  33. package/dist/packages/internal/template-contracts/dist/document-value.d.ts +3 -5
  34. package/dist/packages/internal/template-contracts/dist/fill-builders.js +2 -6
  35. package/dist/packages/internal/template-contracts/dist/fill-spec-schema.js +4 -1
  36. package/dist/packages/internal/template-contracts/dist/list.js +0 -14
  37. package/dist/packages/internal/template-contracts/dist/primitive-descriptors.js +1 -1
  38. package/dist/packages/internal/template-contracts/dist/runtime-values.d.ts +6 -7
  39. package/dist/packages/internal/template-contracts/dist/slot-builders.js +0 -2
  40. package/dist/packages/internal/template-contracts/dist/slot-ref.d.ts +6 -1
  41. package/dist/packages/internal/template-contracts/dist/tour-value.d.ts +2 -4
  42. package/dist/packages/internal/template-contracts/dist/video-value.d.ts +3 -4
  43. package/dist/primitives/Image.d.ts +2 -2
  44. package/dist/primitives/Tour.d.ts +2 -2
  45. package/dist/primitives/Video.d.ts +2 -2
  46. package/dist/primitives/slot-bindings.js +6 -13
  47. package/dist/primitives/slot-document.d.ts +1 -1
  48. package/dist/primitives/slot-download.d.ts +3 -1
  49. package/dist/primitives/slot-media.d.ts +5 -2
  50. package/dist/primitives/slot-media.js +1 -1
  51. package/dist/rules/registry.js +0 -6
  52. package/dist/schema/format-presets.d.ts +1 -1
  53. package/dist/schema/section-schema.d.ts +5 -5
  54. package/dist/styles.css +4 -4
  55. package/dist/template/define-template.js +0 -1
  56. package/guide/reference/cli/INDEX.md +2 -2
  57. package/guide/reference/cli/build.md +1 -1
  58. package/guide/reference/cli/check.md +1 -1
  59. package/guide/reference/cli/dev.md +1 -1
  60. package/guide/reference/cli/property-add.md +1 -1
  61. package/guide/reference/cli/property-list.md +1 -1
  62. package/guide/reference/cli/publish.md +1 -1
  63. package/guide/reference/cli/upgrade.md +1 -1
  64. package/guide/reference/rules/INDEX.md +1 -2
  65. package/package.json +2 -2
  66. package/codemods/fill-is-a-source.mjs +0 -533
  67. package/codemods/framework-namespace.mjs +0 -107
  68. package/codemods/list-grammar.mjs +0 -923
  69. package/codemods/object-form-only.mjs +0 -39
  70. package/codemods/platform-namespace.mjs +0 -83
  71. package/codemods/process-builders.mjs +0 -198
  72. package/codemods/reads-replace-reconcile.mjs +0 -285
  73. package/codemods/registry-keys-only.mjs +0 -113
  74. package/codemods/slot-object.mjs +0 -1097
  75. package/codemods/steps/content-object-fields.mjs +0 -324
  76. package/codemods/steps/list-object-form.mjs +0 -686
  77. package/codemods/steps/registry-key-reads.mjs +0 -276
  78. package/codemods/steps/select-object-form.mjs +0 -210
  79. package/codemods/table-rows.mjs +0 -568
  80. package/codemods/theme-collapse.mjs +0 -396
  81. package/codemods/unlayer-author-css.mjs +0 -194
  82. package/codemods/unwrap-object-fields.mjs +0 -310
  83. package/codemods/viewer-slot-document.mjs +0 -131
  84. package/codemods/write-property-as-facts-document.mjs +0 -716
  85. package/codemods/write-the-address-line.mjs +0 -255
  86. package/codemods/write-the-registry-members.mjs +0 -653
  87. package/codemods/write-the-select-from.mjs +0 -141
  88. package/codemods/write-the-sole-from.mjs +0 -369
  89. package/codemods/write-the-table-from.mjs +0 -267
  90. package/codemods/write-the-whole-item.mjs +0 -512
  91. package/codemods/writeback-drop.mjs +0 -168
  92. package/codemods/written-contact-address.mjs +0 -162
  93. package/codemods/written-media-category.mjs +0 -227
  94. package/codemods/written-ref-kinds-name-the-layer.mjs +0 -172
  95. package/codemods/written-uploads-replace-pool-reads.mjs +0 -454
  96. package/codemods/written-uploads-sort-into-lists.mjs +0 -405
  97. package/codemods/written-uploads-stated-in-sorted-lists.mjs +0 -295
  98. package/codemods/written-video-sources-drop.mjs +0 -144
  99. package/codemods/written-without-pick-none.mjs +0 -146
  100. package/codemods/written-without-retired-knowledge.mjs +0 -223
  101. package/codemods/written-without-the-media-key.mjs +0 -202
  102. package/codemods/written-without-the-property-type.mjs +0 -249
  103. package/dist/artifact/playground/client/assets/index-BFNHB7VM.css +0 -1
  104. package/dist/artifact/playground/client/assets/index-Div1yo6s.js +0 -1259
@@ -1,113 +0,0 @@
1
- // 10.0.0 — a section reads a property's facts by their registry keys alone.
2
- //
3
- // 9.x typed flat spellings beside the registry's: `fact.description`,
4
- // `fact.contact.<member>` and `fact.unit.<member>` (hinted at by
5
- // `sections/legacy-fact-key`, with the rewrite shipped as a codemod step), and the
6
- // address's parts as `fact.property.address_street`, `_unit`, `_city`, `_state`,
7
- // `_postal`, `fact.property.latitude` and `fact.property.longitude`. This release removes
8
- // every one, so a section reading one fails to typecheck, and drops the public types
9
- // nothing reads any more: `FactsAddress`, `ComparableRow`, `Narrative` and
10
- // `DirectFactRef`.
11
- //
12
- // What this codemod does, in one pass over the workspace:
13
- //
14
- // - runs the step, `steps/registry-key-reads.mjs`: the description becomes
15
- // `fact.property.description`, and a contact's or a unit's member is read through a
16
- // locked row of its table, declared once per section;
17
- // - then reads each address part off the address, in every `.ts` and `.tsx` that
18
- // imports `fact` from the package: `fact.property.address_street` becomes
19
- // `fact.property.address.street`, `fact.property.latitude`
20
- // `fact.property.address.latitude`, and so on for each part.
21
- //
22
- // What it leaves to you is what the step reports, per file, and what no rewrite can
23
- // make: a part reads `null` where the flat spelling read `""`, so a `compute()` over one
24
- // may need its body changed, which the typecheck names; and the removed types, named
25
- // otherwise (an address `AddressValue`, a comparable a `compute()` reads
26
- // `FactsComparable`).
27
-
28
- import { readdir, readFile, writeFile } from "node:fs/promises";
29
- import { join, relative, sep } from "node:path";
30
-
31
- import ts from "typescript";
32
-
33
- import registryKeyReads from "./steps/registry-key-reads.mjs";
34
-
35
- const CONCRETE = "@homepages/concrete";
36
-
37
- const EXTENSIONS = [".ts", ".tsx"];
38
- const SKIP_DIRS = new Set(["node_modules", ".concrete", ".git", "dist", "build"]);
39
-
40
- /** Each flat address spelling and the address part it read. */
41
- const ADDRESS_PARTS = {
42
- address_street: "street",
43
- address_unit: "unit",
44
- address_city: "city",
45
- address_state: "state",
46
- address_postal: "postal",
47
- latitude: "latitude",
48
- longitude: "longitude",
49
- };
50
-
51
- async function sourceFiles(root) {
52
- const found = [];
53
- async function walk(dir) {
54
- for (const entry of await readdir(dir, { withFileTypes: true })) {
55
- if (entry.isDirectory()) {
56
- if (!SKIP_DIRS.has(entry.name)) await walk(join(dir, entry.name));
57
- } else if (EXTENSIONS.some((ext) => entry.name.endsWith(ext)) && !entry.name.endsWith(".d.ts")) {
58
- found.push(join(dir, entry.name));
59
- }
60
- }
61
- }
62
- await walk(root);
63
- return found.sort();
64
- }
65
-
66
- /** `text` with each flat address read respelled as a read of its part, or `null` when it has none. */
67
- function addressParts(text, file) {
68
- if (!text.includes(CONCRETE)) return null;
69
- const sf = ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true, file.endsWith(".tsx") ? ts.ScriptKind.TSX : ts.ScriptKind.TS);
70
- let factName;
71
- for (const statement of sf.statements) {
72
- if (!ts.isImportDeclaration(statement) || !ts.isStringLiteral(statement.moduleSpecifier) || statement.moduleSpecifier.text !== CONCRETE) continue;
73
- const bindings = statement.importClause?.namedBindings;
74
- if (bindings === undefined || !ts.isNamedImports(bindings)) continue;
75
- for (const element of bindings.elements) if ((element.propertyName ?? element.name).text === "fact") factName = element.name.text;
76
- }
77
- if (factName === undefined) return null;
78
-
79
- const edits = [];
80
- const visit = (node) => {
81
- if (
82
- ts.isPropertyAccessExpression(node) &&
83
- Object.hasOwn(ADDRESS_PARTS, node.name.text) &&
84
- ts.isPropertyAccessExpression(node.expression) &&
85
- node.expression.name.text === "property" &&
86
- ts.isIdentifier(node.expression.expression) &&
87
- node.expression.expression.text === factName
88
- ) {
89
- edits.push({ start: node.name.getStart(sf), end: node.name.getEnd(), text: `address.${ADDRESS_PARTS[node.name.text]}` });
90
- return;
91
- }
92
- ts.forEachChild(node, visit);
93
- };
94
- visit(sf);
95
- if (edits.length === 0) return null;
96
- let out = text;
97
- for (const edit of edits.sort((a, b) => b.start - a.start)) out = out.slice(0, edit.start) + edit.text + out.slice(edit.end);
98
- return out;
99
- }
100
-
101
- /** @param {string} root @returns {Promise<{rewritten: string[], notRewritten: {file: string, reason: string}[]}>} */
102
- export default async function registryKeysOnly(root) {
103
- const report = await registryKeyReads(root);
104
- const rewritten = new Set(report.rewritten);
105
- for (const path of await sourceFiles(root)) {
106
- const text = await readFile(path, "utf8");
107
- const out = addressParts(text, path);
108
- if (out === null) continue;
109
- await writeFile(path, out, "utf8");
110
- rewritten.add(relative(root, path).split(sep).join("/"));
111
- }
112
- return { rewritten: [...rewritten].sort(), notRewritten: report.notRewritten };
113
- }