@homepages/concrete 10.0.0 → 12.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 (121) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/codemods/manifest.json +7 -154
  3. package/dist/artifact/playground/client/assets/index-BcLGpWLR.js +1266 -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 +39 -40
  8. package/dist/base.css +18 -65
  9. package/dist/cli/build/artifact.js +1 -1
  10. package/dist/cli/build/fixtures.js +3 -2
  11. package/dist/cli/capture/capture.js +8 -6
  12. package/dist/cli/check/stages/sections.js +1 -1
  13. package/dist/cli/dev/workspace-reader.js +4 -2
  14. package/dist/css/compile.js +3 -6
  15. package/dist/css/rules.js +1 -51
  16. package/dist/design-system/format-variants.js +1 -1
  17. package/dist/fixtures/resolve.js +5 -1
  18. package/dist/fixtures/rows.js +2 -2
  19. package/dist/index.d.ts +5 -5
  20. package/dist/packages/external/concrete/package.js +1 -1
  21. package/dist/packages/internal/fill-bake/dist/compute-reads.js +1 -1
  22. package/dist/packages/internal/fill-bake/dist/held-rows.js +2 -0
  23. package/dist/packages/internal/fill-bake/dist/index.js +1 -0
  24. package/dist/packages/internal/fill-vocabulary/dist/holder.js +3 -14
  25. package/dist/packages/internal/format-geometry/dist/capture.js +3 -11
  26. package/dist/packages/internal/format-geometry/dist/format.d.ts +2 -8
  27. package/dist/packages/internal/format-geometry/dist/geometry.js +2 -13
  28. package/dist/packages/internal/media-resolution/dist/document.js +3 -3
  29. package/dist/packages/internal/media-resolution/dist/image.js +3 -3
  30. package/dist/packages/internal/media-resolution/dist/tour.js +6 -6
  31. package/dist/packages/internal/media-resolution/dist/video.js +9 -9
  32. package/dist/packages/internal/section-contracts/dist/fill-verb-contract.js +1 -0
  33. package/dist/packages/internal/section-contracts/dist/runners.js +1 -3
  34. package/dist/packages/internal/section-contracts/dist/source-contract.js +3 -3
  35. package/dist/packages/internal/section-contracts/dist/sources-contract.js +0 -2
  36. package/dist/packages/internal/template-artifact/dist/index.js +2 -2
  37. package/dist/packages/internal/template-artifact/dist/layout.js +11 -11
  38. package/dist/packages/internal/template-artifact/dist/manifest.js +1 -1
  39. package/dist/packages/internal/template-artifact/dist/verify.js +13 -17
  40. package/dist/packages/internal/template-contracts/dist/document-value.d.ts +3 -5
  41. package/dist/packages/internal/template-contracts/dist/fact-registry.js +1 -1
  42. package/dist/packages/internal/template-contracts/dist/fill-builders.js +2 -6
  43. package/dist/packages/internal/template-contracts/dist/fill-spec-schema.js +4 -1
  44. package/dist/packages/internal/template-contracts/dist/list.js +0 -14
  45. package/dist/packages/internal/template-contracts/dist/primitive-descriptors.js +1 -1
  46. package/dist/packages/internal/template-contracts/dist/runtime-values.d.ts +6 -7
  47. package/dist/packages/internal/template-contracts/dist/slot-builders.js +0 -2
  48. package/dist/packages/internal/template-contracts/dist/slot-ref.d.ts +6 -1
  49. package/dist/packages/internal/template-contracts/dist/tour-value.d.ts +2 -4
  50. package/dist/packages/internal/template-contracts/dist/video-value.d.ts +3 -4
  51. package/dist/primitives/FrameShell.d.ts +5 -2
  52. package/dist/primitives/FrameShell.js +2 -1
  53. package/dist/primitives/Image.d.ts +2 -2
  54. package/dist/primitives/Tour.d.ts +2 -2
  55. package/dist/primitives/Video.d.ts +2 -2
  56. package/dist/primitives/slot-bindings.js +6 -13
  57. package/dist/primitives/slot-document.d.ts +1 -1
  58. package/dist/primitives/slot-download.d.ts +3 -1
  59. package/dist/primitives/slot-media.d.ts +5 -2
  60. package/dist/primitives/slot-media.js +1 -1
  61. package/dist/rules/registry.js +1 -7
  62. package/dist/schema/format-presets.d.ts +1 -1
  63. package/dist/schema/format.d.ts +0 -1
  64. package/dist/schema/format.js +1 -2
  65. package/dist/schema/manifest.js +18 -24
  66. package/dist/schema/section-schema.d.ts +5 -5
  67. package/dist/site-analytics.js +6 -1
  68. package/dist/site-runtime/window-height.js +19 -0
  69. package/dist/styles.css +4 -4
  70. package/dist/template/define-template.d.ts +11 -0
  71. package/dist/template/define-template.js +1 -1
  72. package/dist/template/materialize.js +2 -0
  73. package/guide/reference/cli/INDEX.md +2 -2
  74. package/guide/reference/cli/build.md +1 -1
  75. package/guide/reference/cli/check.md +1 -1
  76. package/guide/reference/cli/dev.md +1 -1
  77. package/guide/reference/cli/property-add.md +1 -1
  78. package/guide/reference/cli/property-list.md +1 -1
  79. package/guide/reference/cli/publish.md +1 -1
  80. package/guide/reference/cli/upgrade.md +1 -1
  81. package/guide/reference/rules/INDEX.md +2 -3
  82. package/package.json +2 -2
  83. package/codemods/fill-is-a-source.mjs +0 -533
  84. package/codemods/framework-namespace.mjs +0 -107
  85. package/codemods/list-grammar.mjs +0 -923
  86. package/codemods/object-form-only.mjs +0 -39
  87. package/codemods/platform-namespace.mjs +0 -83
  88. package/codemods/process-builders.mjs +0 -198
  89. package/codemods/reads-replace-reconcile.mjs +0 -285
  90. package/codemods/registry-keys-only.mjs +0 -113
  91. package/codemods/slot-object.mjs +0 -1097
  92. package/codemods/steps/content-object-fields.mjs +0 -324
  93. package/codemods/steps/list-object-form.mjs +0 -686
  94. package/codemods/steps/registry-key-reads.mjs +0 -276
  95. package/codemods/steps/select-object-form.mjs +0 -210
  96. package/codemods/table-rows.mjs +0 -568
  97. package/codemods/theme-collapse.mjs +0 -396
  98. package/codemods/unlayer-author-css.mjs +0 -194
  99. package/codemods/unwrap-object-fields.mjs +0 -310
  100. package/codemods/viewer-slot-document.mjs +0 -131
  101. package/codemods/write-property-as-facts-document.mjs +0 -716
  102. package/codemods/write-the-address-line.mjs +0 -255
  103. package/codemods/write-the-registry-members.mjs +0 -653
  104. package/codemods/write-the-select-from.mjs +0 -141
  105. package/codemods/write-the-sole-from.mjs +0 -369
  106. package/codemods/write-the-table-from.mjs +0 -267
  107. package/codemods/write-the-whole-item.mjs +0 -512
  108. package/codemods/writeback-drop.mjs +0 -168
  109. package/codemods/written-contact-address.mjs +0 -162
  110. package/codemods/written-media-category.mjs +0 -227
  111. package/codemods/written-ref-kinds-name-the-layer.mjs +0 -172
  112. package/codemods/written-uploads-replace-pool-reads.mjs +0 -454
  113. package/codemods/written-uploads-sort-into-lists.mjs +0 -405
  114. package/codemods/written-uploads-stated-in-sorted-lists.mjs +0 -295
  115. package/codemods/written-video-sources-drop.mjs +0 -144
  116. package/codemods/written-without-pick-none.mjs +0 -146
  117. package/codemods/written-without-retired-knowledge.mjs +0 -223
  118. package/codemods/written-without-the-media-key.mjs +0 -202
  119. package/codemods/written-without-the-property-type.mjs +0 -249
  120. package/dist/artifact/playground/client/assets/index-BFNHB7VM.css +0 -1
  121. 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
- }