@homepages/concrete 5.0.0 → 6.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 (269) hide show
  1. package/CHANGELOG.md +336 -0
  2. package/README.md +28 -17
  3. package/codemods/fill-is-a-source.mjs +533 -0
  4. package/codemods/manifest.json +12 -0
  5. package/codemods/reads-replace-reconcile.mjs +285 -0
  6. package/dist/artifact/playground/client/assets/{index-D1fwOGVK.js → index-u3T7DiSN.js} +96 -96
  7. package/dist/artifact/playground/client/index.html +1 -1
  8. package/dist/artifact/playground/host.mjs +23 -23
  9. package/dist/base.css +3 -8
  10. package/dist/browser/site-config.js +1 -16
  11. package/dist/browser/submit-lead.js +0 -31
  12. package/dist/cli/build/artifact.js +16 -23
  13. package/dist/cli/build/captures.js +0 -6
  14. package/dist/cli/build/esbuild.js +0 -17
  15. package/dist/cli/build/fixtures.js +15 -30
  16. package/dist/cli/build/icons.js +0 -3
  17. package/dist/cli/build/index.js +1 -1
  18. package/dist/cli/build/playground.js +4 -8
  19. package/dist/cli/build/sections.js +9 -30
  20. package/dist/cli/build/source.js +52 -27
  21. package/dist/cli/build/static.js +4 -25
  22. package/dist/cli/capture/bundle.js +0 -9
  23. package/dist/cli/capture/capture-browser.js +0 -14
  24. package/dist/cli/capture/capture.js +1 -8
  25. package/dist/cli/check/analyze.js +2 -5
  26. package/dist/cli/check/index.js +1 -1
  27. package/dist/cli/check/line-endings.js +52 -0
  28. package/dist/cli/check/load-workspace.js +3 -8
  29. package/dist/cli/check/portable-names.js +48 -0
  30. package/dist/cli/check/render/class-conflicts.js +0 -5
  31. package/dist/cli/check/render/html.js +0 -1
  32. package/dist/cli/check/render/invariants.js +0 -5
  33. package/dist/cli/check/render/island-frames.js +0 -25
  34. package/dist/cli/check/render/marker-coverage.js +0 -20
  35. package/dist/cli/check/render/nav.js +0 -33
  36. package/dist/cli/check/report.js +0 -3
  37. package/dist/cli/check/stages/bundles.js +1 -9
  38. package/dist/cli/check/stages/composition.js +3 -2
  39. package/dist/cli/check/stages/dependencies.js +7 -38
  40. package/dist/cli/check/stages/fixtures.js +3 -31
  41. package/dist/cli/check/stages/lint.js +2 -2
  42. package/dist/cli/check/stages/logic.js +3 -34
  43. package/dist/cli/check/stages/relations.js +46 -0
  44. package/dist/cli/check/stages/render.js +0 -1
  45. package/dist/cli/check/stages/sections.js +3 -3
  46. package/dist/cli/check/stages/stylesheet.js +1 -1
  47. package/dist/cli/check/stages/typecheck.js +5 -11
  48. package/dist/cli/check/stages/workspace.js +36 -14
  49. package/dist/cli/commands.js +9 -56
  50. package/dist/cli/currency/cache.js +4 -17
  51. package/dist/cli/currency/decide.js +0 -14
  52. package/dist/cli/currency/opt-out.js +0 -7
  53. package/dist/cli/currency/preamble.js +3 -24
  54. package/dist/cli/currency/prompt.js +0 -1
  55. package/dist/cli/currency/refresh.js +5 -12
  56. package/dist/cli/currency/resolve-latest.js +3 -64
  57. package/dist/cli/currency/version-order.js +0 -12
  58. package/dist/cli/dev/crop.js +0 -2
  59. package/dist/cli/dev/http.js +0 -13
  60. package/dist/cli/dev/index.js +3 -4
  61. package/dist/cli/dev/islands.js +25 -70
  62. package/dist/cli/dev/listen.js +26 -0
  63. package/dist/cli/dev/load-template.js +0 -1
  64. package/dist/cli/dev/request-error.js +0 -4
  65. package/dist/cli/dev/server.js +46 -52
  66. package/dist/cli/dev/tsconfig-paths.js +0 -13
  67. package/dist/cli/dev/vite.js +9 -38
  68. package/dist/cli/dev/workspace-reader.js +4 -34
  69. package/dist/cli/media/cache.js +4 -51
  70. package/dist/cli/media/derive.js +2 -94
  71. package/dist/cli/media/deriver-plugin.js +0 -2
  72. package/dist/cli/media/frame-rung-floor.js +0 -6
  73. package/dist/cli/property/index.js +0 -4
  74. package/dist/cli/property/library.js +6 -24
  75. package/dist/cli/publish/client.js +0 -1
  76. package/dist/cli/publish/freshness.js +0 -2
  77. package/dist/cli/publish/git.js +2 -8
  78. package/dist/cli/publish/index.js +8 -15
  79. package/dist/cli/publish/pack.js +5 -6
  80. package/dist/cli/publish/report.js +0 -6
  81. package/dist/cli/publish/target.js +16 -13
  82. package/dist/cli/publish/wire.js +0 -6
  83. package/dist/cli/tar.js +2 -9
  84. package/dist/cli/upgrade/codemod.js +0 -8
  85. package/dist/cli/upgrade/index.js +0 -24
  86. package/dist/cli/upgrade/manifest.js +0 -12
  87. package/dist/cli/upgrade/plan.js +0 -17
  88. package/dist/cli/upgrade/stage.js +12 -15
  89. package/dist/cli/version.js +0 -8
  90. package/dist/cli/workspace.js +2 -34
  91. package/dist/cli.js +4 -21
  92. package/dist/css/compile.js +25 -28
  93. package/dist/css/graph.js +3 -10
  94. package/dist/css/inline.js +3 -13
  95. package/dist/css/rules.js +6 -43
  96. package/dist/design-system/format-variants.js +0 -22
  97. package/dist/eslint/authoring.js +0 -2
  98. package/dist/eslint/correctness.js +0 -7
  99. package/dist/eslint/rules/editor-reason.js +0 -11
  100. package/dist/eslint/rules/island-ids.js +0 -1
  101. package/dist/eslint/rules/jsx-visitor.js +0 -13
  102. package/dist/eslint/rules/no-editor-globals.js +0 -2
  103. package/dist/eslint/rules/no-raw-values.js +0 -1
  104. package/dist/fixtures/brand.js +0 -1
  105. package/dist/fixtures/bundle-rule.js +4 -9
  106. package/dist/fixtures/canonical.d.ts +20 -0
  107. package/dist/fixtures/image-dimensions.js +0 -1
  108. package/dist/fixtures/load.js +8 -17
  109. package/dist/fixtures/media-plugin.js +4 -31
  110. package/dist/fixtures/media.js +0 -21
  111. package/dist/fixtures/package-stylesheets.js +0 -6
  112. package/dist/fixtures/property.js +16 -15
  113. package/dist/fixtures/resolve.js +102 -29
  114. package/dist/fixtures/rows.js +12 -11
  115. package/dist/fixtures/synthesize-empties.js +0 -4
  116. package/dist/fixtures.d.ts +19 -4
  117. package/dist/fixtures.js +0 -18
  118. package/dist/index.d.ts +8 -9
  119. package/dist/index.js +2 -11
  120. package/dist/islands/client-module.js +0 -11
  121. package/dist/islands/marker.js +0 -33
  122. package/dist/node_modules/.pnpm/fflate@0.8.3/node_modules/fflate/esm/browser.js +0 -20
  123. package/dist/packages/external/concrete/package.js +1 -1
  124. package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +21 -35
  125. package/dist/packages/internal/fill-bake/dist/compute-reads.js +4 -0
  126. package/dist/packages/internal/fill-bake/dist/derive-source.js +40 -0
  127. package/dist/packages/internal/fill-bake/dist/display.js +0 -1
  128. package/dist/packages/internal/fill-bake/dist/index.js +4 -4
  129. package/dist/packages/internal/fill-vocabulary/dist/origination.js +106 -0
  130. package/dist/packages/internal/fill-vocabulary/dist/row-planners.js +1 -49
  131. package/dist/packages/internal/format-geometry/dist/capture.js +10 -240
  132. package/dist/packages/internal/format-geometry/dist/geometry.js +0 -6
  133. package/dist/packages/internal/image-ladder/dist/crop.js +0 -12
  134. package/dist/packages/internal/image-ladder/dist/policy.js +0 -14
  135. package/dist/packages/internal/island-runtime/dist/capture-holds.js +0 -13
  136. package/dist/packages/internal/island-runtime/dist/contract.js +0 -34
  137. package/dist/packages/internal/island-runtime/dist/editor-instance-context.js +0 -1
  138. package/dist/packages/internal/island-runtime/dist/index.js +0 -34
  139. package/dist/packages/internal/island-runtime/dist/island-id-context.js +0 -1
  140. package/dist/packages/internal/island-runtime/dist/use-capture-ready.js +0 -15
  141. package/dist/packages/internal/island-runtime/dist/use-editor.js +0 -10
  142. package/dist/packages/internal/island-runtime/dist/use-island-id.js +0 -32
  143. package/dist/packages/internal/property-facts/dist/derive-facts-view.js +2 -17
  144. package/dist/packages/internal/property-facts/dist/index.js +1 -1
  145. package/dist/packages/internal/property-facts/dist/{property-facts-CSdkSuD7.js → property-facts-5pxZnlkh.js} +13 -2
  146. package/dist/packages/internal/section-contracts/dist/cap-contract.js +1 -18
  147. package/dist/packages/internal/section-contracts/dist/catalog.js +16 -8
  148. package/dist/packages/internal/section-contracts/dist/choose-select-contract.js +12 -16
  149. package/dist/packages/internal/section-contracts/dist/count-bounds-contract.js +5 -11
  150. package/dist/packages/internal/section-contracts/dist/display-contract.js +2 -0
  151. package/dist/packages/internal/section-contracts/dist/display-evidence-contract.js +2 -8
  152. package/dist/packages/internal/section-contracts/dist/fill-spec-view.js +13 -0
  153. package/dist/packages/internal/section-contracts/dist/index.js +2 -1
  154. package/dist/packages/internal/section-contracts/dist/interpolation-contract.js +16 -42
  155. package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +24 -43
  156. package/dist/packages/internal/section-contracts/dist/name-title-contract.js +11 -18
  157. package/dist/packages/internal/section-contracts/dist/poi-curation-contract.js +10 -12
  158. package/dist/packages/internal/section-contracts/dist/pooling-field-contract.js +3 -13
  159. package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +6 -18
  160. package/dist/packages/internal/section-contracts/dist/runners.js +21 -13
  161. package/dist/packages/internal/section-contracts/dist/source-contract.js +13 -2
  162. package/dist/packages/internal/section-contracts/dist/writer-reads-fact-contract.js +31 -0
  163. package/dist/packages/internal/source-resolution/dist/index.js +1 -9
  164. package/dist/packages/internal/template-artifact/dist/hash.js +0 -8
  165. package/dist/packages/internal/template-artifact/dist/index.js +1 -1
  166. package/dist/packages/internal/template-artifact/dist/layout.js +0 -39
  167. package/dist/packages/internal/template-artifact/dist/manifest.js +1 -9
  168. package/dist/packages/internal/template-artifact/dist/sha256.js +0 -1
  169. package/dist/packages/internal/template-artifact/dist/verify.js +2 -4
  170. package/dist/packages/internal/template-contracts/dist/collection-editing.js +0 -16
  171. package/dist/packages/internal/template-contracts/dist/content-categories.js +0 -4
  172. package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +16 -10
  173. package/dist/packages/internal/template-contracts/dist/facts-view.js +15 -28
  174. package/dist/packages/internal/template-contracts/dist/layout.js +0 -7
  175. package/dist/packages/internal/template-contracts/dist/markers.js +0 -29
  176. package/dist/packages/internal/template-contracts/dist/select-key.js +0 -6
  177. package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +56 -34
  178. package/dist/packages/internal/template-contracts/dist/slot-catalog.js +22 -389
  179. package/dist/platform/file-url.js +8 -0
  180. package/dist/platform/fs.js +73 -0
  181. package/dist/platform/names.js +63 -0
  182. package/dist/platform/order.js +7 -0
  183. package/dist/platform/paths.js +62 -0
  184. package/dist/platform/process.js +97 -0
  185. package/dist/playground/host/page-state.js +0 -2
  186. package/dist/playground/host/paths.js +0 -1
  187. package/dist/playground/layout.js +0 -7
  188. package/dist/playground/wire.js +0 -8
  189. package/dist/primitives/FrameShell.js +0 -18
  190. package/dist/primitives/Image.d.ts +5 -1
  191. package/dist/primitives/Image.js +2 -68
  192. package/dist/primitives/Section.js +0 -13
  193. package/dist/primitives/Tour.js +0 -26
  194. package/dist/primitives/Video.js +0 -32
  195. package/dist/primitives/embed-playback.js +0 -1
  196. package/dist/primitives/marker-attrs.js +0 -17
  197. package/dist/primitives/picture-sources.js +6 -1
  198. package/dist/primitives/probe-context.js +0 -7
  199. package/dist/primitives/slot-bindings.js +0 -46
  200. package/dist/primitives/slot-document.js +0 -11
  201. package/dist/primitives/slot-group.js +0 -9
  202. package/dist/primitives/slot-media.js +0 -27
  203. package/dist/primitives/slot-scalar.js +0 -4
  204. package/dist/primitives/slot.js +0 -6
  205. package/dist/rules/registry.js +42 -24
  206. package/dist/schema/compute.d.ts +46 -8
  207. package/dist/schema/compute.js +21 -15
  208. package/dist/schema/define-schema.d.ts +1 -1
  209. package/dist/schema/define-schema.js +37 -17
  210. package/dist/schema/extract-fill-spec.js +93 -180
  211. package/dist/schema/extract-used-facts.js +16 -158
  212. package/dist/schema/fact.d.ts +25 -12
  213. package/dist/schema/fact.js +7 -11
  214. package/dist/schema/fill-builders.d.ts +91 -366
  215. package/dist/schema/fill-builders.js +21 -259
  216. package/dist/schema/fill-declaration.d.ts +7 -69
  217. package/dist/schema/fill-declaration.js +5 -34
  218. package/dist/schema/fill-spec.js +59 -148
  219. package/dist/schema/format-presets.js +0 -12
  220. package/dist/schema/format.js +0 -7
  221. package/dist/schema/layout.js +0 -10
  222. package/dist/schema/manifest.js +0 -39
  223. package/dist/schema/property-facts.d.ts +20 -0
  224. package/dist/schema/section-nav.js +0 -15
  225. package/dist/schema/section-schema.d.ts +0 -1
  226. package/dist/schema/section-schema.js +4 -20
  227. package/dist/schema/slot-builders.d.ts +128 -117
  228. package/dist/schema/slot-builders.js +18 -201
  229. package/dist/schema/slot-ref.d.ts +63 -0
  230. package/dist/schema/slot-ref.js +33 -0
  231. package/dist/schema/slot-types.d.ts +3 -2
  232. package/dist/schema/slot-types.js +11 -20
  233. package/dist/section/declare.d.ts +14 -10
  234. package/dist/section/declare.js +13 -2
  235. package/dist/section/discovery.js +6 -21
  236. package/dist/section/groups.js +0 -6
  237. package/dist/section/materialize.js +0 -5
  238. package/dist/section/placements.js +0 -4
  239. package/dist/section/section.d.ts +8 -5
  240. package/dist/section/section.js +7 -29
  241. package/dist/styles.css +5 -0
  242. package/dist/template/define-template.d.ts +0 -4
  243. package/dist/template/define-template.js +1 -15
  244. package/dist/template/logic-build.js +8 -35
  245. package/dist/template/logic-shim.d.ts +4 -5
  246. package/dist/template/logic-shim.js +2 -6
  247. package/dist/template/logic-transform.js +0 -6
  248. package/dist/template/materialize.js +52 -43
  249. package/dist/template/mirror-types.js +43 -0
  250. package/dist/template/running-copy.js +5 -20
  251. package/dist/template/section-reads.js +83 -0
  252. package/guide/reference/cli/INDEX.md +12 -6
  253. package/guide/reference/cli/build.md +1 -1
  254. package/guide/reference/cli/check.md +1 -1
  255. package/guide/reference/cli/dev.md +3 -3
  256. package/guide/reference/cli/property-add.md +1 -1
  257. package/guide/reference/cli/property-list.md +1 -1
  258. package/guide/reference/cli/publish.md +4 -2
  259. package/guide/reference/cli/upgrade.md +1 -1
  260. package/guide/reference/rules/INDEX.md +26 -13
  261. package/package.json +4 -2
  262. package/dist/packages/internal/fact-interpolation/dist/index.js +0 -22
  263. package/dist/packages/internal/fill-bake/dist/reconcile-cross-section.js +0 -170
  264. package/dist/packages/internal/fill-vocabulary/dist/facts.d.ts +0 -32
  265. package/dist/packages/internal/fill-vocabulary/dist/facts.js +0 -131
  266. package/dist/packages/internal/template-contracts/dist/slot-overrides.js +0 -11
  267. package/dist/schema/fill-spec.d.ts +0 -18
  268. package/dist/template/reconcile.d.ts +0 -67
  269. package/dist/template/reconcile.js +0 -25
@@ -0,0 +1,8 @@
1
+ //#region src/platform/file-url.ts
2
+ function filePathOfUrl(url) {
3
+ const path = decodeURIComponent(url.slice(7));
4
+ return /^\/[A-Za-z]:\//.test(path) ? path.slice(1).replaceAll("/", "\\") : path;
5
+ }
6
+
7
+ //#endregion
8
+ export { filePathOfUrl };
@@ -0,0 +1,73 @@
1
+ import { byCodeUnit } from "./order.js";
2
+ import { readdirSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ import { readdir, rename, rm, stat, writeFile } from "node:fs/promises";
5
+ import { homedir } from "node:os";
6
+
7
+ //#region src/platform/fs.ts
8
+ const TRANSIENT_LOCKS = /* @__PURE__ */ new Set([
9
+ "EPERM",
10
+ "EACCES",
11
+ "EBUSY"
12
+ ]);
13
+ function locksAreTransient(platform) {
14
+ return platform === "win32";
15
+ }
16
+ function removeTreeOptions(platform = process.platform) {
17
+ return {
18
+ recursive: true,
19
+ force: true,
20
+ maxRetries: locksAreTransient(platform) ? 10 : 0,
21
+ retryDelay: 100
22
+ };
23
+ }
24
+ async function removeTree(path, platform = process.platform) {
25
+ await rm(path, removeTreeOptions(platform));
26
+ }
27
+ async function isDirectory(path) {
28
+ try {
29
+ return (await stat(path)).isDirectory();
30
+ } catch {
31
+ return false;
32
+ }
33
+ }
34
+ async function renameSettled(from, to, platform = process.platform, move = rename) {
35
+ for (let attempt = 0;; attempt++) try {
36
+ await move(from, to);
37
+ return;
38
+ } catch (cause) {
39
+ const code = cause.code;
40
+ if (!locksAreTransient(platform) || !TRANSIENT_LOCKS.has(code) || attempt >= 10 || await isDirectory(to)) throw cause;
41
+ await new Promise((settle) => setTimeout(settle, 100 * (attempt + 1)));
42
+ }
43
+ }
44
+ async function writeFileReplacing(temporary, file, data, platform = process.platform, move = rename) {
45
+ try {
46
+ await writeFile(temporary, data);
47
+ await renameSettled(temporary, file, platform, move);
48
+ } catch (cause) {
49
+ await rm(temporary, { force: true }).catch(() => void 0);
50
+ throw cause;
51
+ }
52
+ }
53
+ function listed(dir, entries) {
54
+ return entries.map((entry) => ({
55
+ name: entry.name.normalize("NFC"),
56
+ path: join(dir, entry.name),
57
+ isFile: () => entry.isFile(),
58
+ isDirectory: () => entry.isDirectory()
59
+ })).sort((a, b) => byCodeUnit(a.name, b.name));
60
+ }
61
+ async function listDir(dir) {
62
+ return listed(dir, await readdir(dir, { withFileTypes: true }));
63
+ }
64
+ function listDirSync(dir) {
65
+ return listed(dir, readdirSync(dir, { withFileTypes: true }));
66
+ }
67
+ function cacheRoot(env) {
68
+ const xdg = env.XDG_CACHE_HOME;
69
+ return xdg !== void 0 && xdg !== "" ? xdg : join(homedir(), ".cache");
70
+ }
71
+
72
+ //#endregion
73
+ export { byCodeUnit, cacheRoot, listDir, listDirSync, removeTree, removeTreeOptions, renameSettled, writeFileReplacing };
@@ -0,0 +1,63 @@
1
+ //#region src/platform/names.ts
2
+ const URL_SAFE_NAME = /^[A-Za-z0-9._-]+$/;
3
+ const WINDOWS_ILLEGAL = /[\u0000-\u001f<>:"\\|?*]/;
4
+ const WINDOWS_RESERVED = /* @__PURE__ */ new Set([
5
+ "CON",
6
+ "PRN",
7
+ "AUX",
8
+ "NUL",
9
+ "CONIN$",
10
+ "CONOUT$",
11
+ ...["COM", "LPT"].flatMap((device) => [..."0123456789¹²³"].map((digit) => `${device}${digit}`))
12
+ ]);
13
+ function unportableName(name, origin = {}) {
14
+ const illegal = WINDOWS_ILLEGAL.exec(name)?.[0];
15
+ if (illegal !== void 0) return `contains ${illegal < " " ? `control character U+${illegal.charCodeAt(0).toString(16).toUpperCase().padStart(4, "0")}` : `"${illegal}"`}, which Windows refuses in a file name`;
16
+ if (/[. ]$/.test(name)) return `ends in ${name.endsWith(".") ? "a dot" : "a space"}, which Windows strips, naming a different file`;
17
+ const base = name.split(".")[0].trimEnd().toUpperCase();
18
+ if (WINDOWS_RESERVED.has(base)) return `is ${base}, a device name Windows reserves with any extension`;
19
+ if (origin.hostSpelled !== true && name !== name.normalize("NFC")) return "is not in composed (NFC) form: macOS names it the same file as its composed spelling, which Linux and git keep apart";
20
+ return null;
21
+ }
22
+ function foldName(name) {
23
+ return name.normalize("NFC").toLowerCase();
24
+ }
25
+ function caseCollisions(names) {
26
+ const byFold = /* @__PURE__ */ new Map();
27
+ for (const name of names) {
28
+ const fold = foldName(name);
29
+ const group = byFold.get(fold);
30
+ if (group === void 0) byFold.set(fold, [name]);
31
+ else if (!group.includes(name)) group.push(name);
32
+ }
33
+ return [...byFold.values()].filter((group) => group.length > 1);
34
+ }
35
+ function unportablePaths(paths, origin = {}) {
36
+ const found = [];
37
+ const graded = /* @__PURE__ */ new Set();
38
+ const children = /* @__PURE__ */ new Map();
39
+ for (const path of paths) {
40
+ const segments = path.split("/");
41
+ for (let i = 0; i < segments.length; i++) {
42
+ const parent = segments.slice(0, i).join("/");
43
+ const here = segments.slice(0, i + 1).join("/");
44
+ if (graded.has(here)) continue;
45
+ graded.add(here);
46
+ const siblings = children.get(parent) ?? /* @__PURE__ */ new Set();
47
+ children.set(parent, siblings.add(segments[i]));
48
+ const reason = unportableName(segments[i], origin);
49
+ if (reason !== null) found.push({
50
+ paths: [here],
51
+ reason
52
+ });
53
+ }
54
+ }
55
+ for (const [parent, names] of children) for (const group of caseCollisions(names)) found.push({
56
+ paths: group.map((name) => parent === "" ? name : `${parent}/${name}`),
57
+ reason: "differ only by case or Unicode form, so Windows and macOS hold them as one file"
58
+ });
59
+ return found;
60
+ }
61
+
62
+ //#endregion
63
+ export { URL_SAFE_NAME, caseCollisions, foldName, unportableName, unportablePaths };
@@ -0,0 +1,7 @@
1
+ //#region src/platform/order.ts
2
+ function byCodeUnit(a, b) {
3
+ return a < b ? -1 : a > b ? 1 : 0;
4
+ }
5
+
6
+ //#endregion
7
+ export { byCodeUnit };
@@ -0,0 +1,62 @@
1
+ import { filePathOfUrl } from "./file-url.js";
2
+ import { realpathSync } from "node:fs";
3
+ import nodePath from "node:path";
4
+ import { fileURLToPath, pathToFileURL } from "node:url";
5
+
6
+ //#region src/platform/paths.ts
7
+ function toPosix(path, paths = nodePath) {
8
+ return paths.sep === "\\" ? path.replaceAll("\\", "/") : path;
9
+ }
10
+ function workspacePath(root, file, paths = nodePath) {
11
+ return toPosix(paths.relative(root, file), paths).normalize("NFC");
12
+ }
13
+ function isInsideRoot(root, file, paths = nodePath) {
14
+ const rel = paths.relative(root, file);
15
+ return rel !== "" && rel !== ".." && !rel.startsWith(`..${paths.sep}`) && !paths.isAbsolute(rel);
16
+ }
17
+ function underNodeModules(file, paths = nodePath) {
18
+ return toPosix(file, paths).split("/").includes("node_modules");
19
+ }
20
+ function isWorkspaceFile(root, file, paths = nodePath) {
21
+ return isInsideRoot(root, file, paths) && !underNodeModules(paths.relative(root, file), paths);
22
+ }
23
+ function replaceRoot(text, root, replacement, paths = nodePath) {
24
+ return text.split(root).join(replacement).split(toPosix(root, paths)).join(replacement);
25
+ }
26
+ function withoutRoot(text, root, paths = nodePath) {
27
+ return replaceRoot(text, root.endsWith(paths.sep) ? root : root + paths.sep, "", paths);
28
+ }
29
+ function normalizePosix(path) {
30
+ return nodePath.posix.normalize(path);
31
+ }
32
+ function externalFile(file) {
33
+ return {
34
+ path: pathToFileURL(file).href,
35
+ external: true
36
+ };
37
+ }
38
+ function externalSpecifier(specifier) {
39
+ return {
40
+ path: specifier,
41
+ external: true
42
+ };
43
+ }
44
+ function resolveRoot(cwd) {
45
+ try {
46
+ return realpathSync.native(cwd);
47
+ } catch {
48
+ return cwd;
49
+ }
50
+ }
51
+ const THIS_FILE = fileURLToPath(import.meta.url);
52
+ const RUNNING_FROM_SOURCE = nodePath.extname(THIS_FILE) === ".ts";
53
+ function packageRoot() {
54
+ return nodePath.join(nodePath.dirname(THIS_FILE), "..", "..");
55
+ }
56
+ function packageFile(source, built) {
57
+ const [dir, rel] = RUNNING_FROM_SOURCE ? ["src", source] : ["dist", built];
58
+ return nodePath.join(packageRoot(), dir, ...rel.split("/"));
59
+ }
60
+
61
+ //#endregion
62
+ export { RUNNING_FROM_SOURCE, externalFile, externalSpecifier, isInsideRoot, isWorkspaceFile, normalizePosix, packageFile, packageRoot, replaceRoot, resolveRoot, toPosix, underNodeModules, withoutRoot, workspacePath };
@@ -0,0 +1,97 @@
1
+ import { realpathSync } from "node:fs";
2
+ import { fileURLToPath } from "node:url";
3
+ import { execFile, spawn } from "node:child_process";
4
+
5
+ //#region src/platform/process.ts
6
+ function npmNeedsShell(platform = process.platform) {
7
+ return platform === "win32";
8
+ }
9
+ function spawnNpm(args, options) {
10
+ return spawn("npm", [...args], {
11
+ ...options,
12
+ shell: npmNeedsShell()
13
+ });
14
+ }
15
+ function killTree(child, platform = process.platform, start = spawn) {
16
+ if (child.pid === void 0 || child.exitCode !== null) return;
17
+ if (platform !== "win32") {
18
+ child.kill();
19
+ return;
20
+ }
21
+ start("taskkill", [
22
+ "/pid",
23
+ String(child.pid),
24
+ "/T",
25
+ "/F"
26
+ ], {
27
+ stdio: "ignore",
28
+ windowsHide: true,
29
+ shell: false
30
+ }).once("error", () => child.kill());
31
+ }
32
+ function execBounded(file, args, shell, options, platform = process.platform, stop = killTree) {
33
+ const { timeout, ...rest } = options;
34
+ return new Promise((resolve, reject) => {
35
+ const child = execFile(file, [...args], {
36
+ ...rest,
37
+ encoding: "utf8",
38
+ shell
39
+ }, (error, stdout, stderr) => {
40
+ clearTimeout(deadline);
41
+ if (error === null) {
42
+ resolve({
43
+ stdout,
44
+ stderr
45
+ });
46
+ return;
47
+ }
48
+ reject(Object.assign(error, {
49
+ stdout,
50
+ stderr
51
+ }));
52
+ });
53
+ const deadline = timeout === void 0 || timeout <= 0 ? void 0 : setTimeout(() => {
54
+ stop(child, platform);
55
+ child.stdout?.destroy();
56
+ child.stderr?.destroy();
57
+ reject(Object.assign(/* @__PURE__ */ new Error(`${file} ${args.join(" ")} did not finish within ${String(timeout)} ms`), {
58
+ code: "ETIMEDOUT",
59
+ killed: true
60
+ }));
61
+ }, timeout);
62
+ });
63
+ }
64
+ async function execNpm(args, options) {
65
+ return execBounded("npm", args, npmNeedsShell(), options);
66
+ }
67
+ async function execGit(args, options) {
68
+ return execBounded("git", args, false, options);
69
+ }
70
+ const SHUTDOWN_SIGNALS = [
71
+ "SIGINT",
72
+ "SIGTERM",
73
+ "SIGHUP",
74
+ "SIGBREAK"
75
+ ];
76
+ function onShutdown(stop, source = process) {
77
+ const release = () => {
78
+ for (const signal of SHUTDOWN_SIGNALS) source.off(signal, fire);
79
+ };
80
+ function fire() {
81
+ release();
82
+ stop();
83
+ }
84
+ for (const signal of SHUTDOWN_SIGNALS) source.on(signal, fire);
85
+ return release;
86
+ }
87
+ function invokedAsBin(moduleUrl, argv1 = process.argv[1]) {
88
+ if (argv1 === void 0) return false;
89
+ try {
90
+ return realpathSync.native(argv1) === realpathSync.native(fileURLToPath(moduleUrl));
91
+ } catch {
92
+ return false;
93
+ }
94
+ }
95
+
96
+ //#endregion
97
+ export { SHUTDOWN_SIGNALS, execBounded, execGit, execNpm, invokedAsBin, killTree, npmNeedsShell, onShutdown, spawnNpm };
@@ -1,9 +1,7 @@
1
1
  //#region src/playground/host/page-state.ts
2
- /** Whether the fixture leaves the page on. A page its page state does not name is. */
3
2
  function pageEnabled(fixture, pageId) {
4
3
  return fixture.pages?.[pageId]?.enabled !== false;
5
4
  }
6
- /** The pages the fixture leaves on, in the order given. */
7
5
  function enabledPages(fixture, pages) {
8
6
  return pages.filter((page) => pageEnabled(fixture, page.id));
9
7
  }
@@ -1,5 +1,4 @@
1
1
  //#region src/playground/host/paths.ts
2
- /** The frames' two stylesheets, in cascade order, as a reader names them. */
3
2
  const STYLESHEET_PATHS = {
4
3
  base: "stylesheets/base.css",
5
4
  template: "stylesheets/template.css"
@@ -3,19 +3,12 @@ import "../packages/internal/template-artifact/dist/index.js";
3
3
  import { resolve } from "node:path";
4
4
 
5
5
  //#region src/playground/layout.ts
6
- /**
7
- * The built playground inside the package. Under `dist/artifact/`, never `dist/playground/`:
8
- * tsdown emits the playground's own library modules there, and this directory must hold
9
- * exactly what an artifact carries.
10
- */
11
6
  function playgroundDistDir(packageRoot) {
12
7
  return resolve(packageRoot, "dist", "artifact", PLAYGROUND_DIR);
13
8
  }
14
- /** The built client, which `concrete dev` serves. */
15
9
  function playgroundClientOutDir(packageRoot) {
16
10
  return resolve(playgroundDistDir(packageRoot), PLAYGROUND_CLIENT_DIR);
17
11
  }
18
- /** The built host module, which `concrete dev` loads. */
19
12
  function playgroundHostFile(packageRoot) {
20
13
  return resolve(playgroundDistDir(packageRoot), PLAYGROUND_FILES.host);
21
14
  }
@@ -5,30 +5,22 @@ function query(params) {
5
5
  const text = search.toString();
6
6
  return text === "" ? "" : `?${text}`;
7
7
  }
8
- /** Every route of the wire, relative to the playground's base. */
9
8
  const ROUTES = {
10
9
  catalog: "api/catalog",
11
10
  render: "api/render",
12
11
  media: (fixture) => `api/media${query({ fixture })}`,
13
- /** An attachment over the fixture as authored: a PNG, a zip of a canvas's pages, or a PDF. */
14
12
  capture: (kind, target) => `api/capture/${kind}${query({
15
13
  fixture: target.fixture,
16
14
  format: target.format,
17
15
  page: target.page,
18
16
  canvas: target.canvas
19
17
  })}`,
20
- /** A website page as it would publish, over the fixture as authored. `pagePath` is the declared path. */
21
18
  live: (fixture, pagePath) => `fixtures/${encodeURIComponent(fixture)}/live${pagePath === "/" ? "/" : `${pagePath}/`}`,
22
- /** The change channel (server-sent events), present only with `capabilities.hmr`. */
23
19
  hmr: "__hmr"
24
20
  };
25
- /** The change events the channel carries. */
26
21
  const HMR_EVENTS = {
27
- /** A section or template module changed: re-render what is on screen. */
28
22
  source: "source:changed",
29
- /** The stylesheet recompiled: re-link it. */
30
23
  stylesheet: "stylesheet:changed",
31
- /** A fixture module changed: reload the catalog. */
32
24
  fixtures: "fixtures:changed"
33
25
  };
34
26
 
@@ -3,24 +3,6 @@ import "../packages/internal/format-geometry/dist/index.js";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
 
5
5
  //#region src/primitives/FrameShell.tsx
6
- /**
7
- * The frame shell — the rendered-class page root, the frame analog of the
8
- * website page shell. The frame is a viewport: every host owes a frame
9
- * document a window that is exactly the format's bleed box, and the static
10
- * half of the contract (`.concrete-frame`, from the base stylesheet) fills
11
- * that window, clips at the shell's own edge, and lays sections out as a
12
- * rigid flex column (`flex-shrink: 0` on every direct child, so an
13
- * overflowing stack overflows measurably instead of being silently
14
- * compressed). The shell sets the three geometry tokens
15
- * (`--frame-w`/`--frame-h`/`--frame-bleed`) — the declared geometry, for
16
- * hosts and diagnostics to read — and stamps `data-format`, which the derived
17
- * per-format variants (destination identity, never size) select on.
18
- *
19
- * Children must be the page's sections, direct — a wrapper element between
20
- * shell and section would become the flex child instead of the section. The
21
- * shell draws nothing: trim and bleed guides are host chrome, never markup, so
22
- * rendered bytes are identical in every host.
23
- */
24
6
  function FrameShell({ format, children }) {
25
7
  return /* @__PURE__ */ jsx("div", {
26
8
  className: FRAME_ROOT_CLASS,
@@ -18,7 +18,11 @@ type ImageOptions = Omit<ImgHTMLAttributes<HTMLImageElement>, "src" | "alt" | "w
18
18
  frame?: boolean;
19
19
  /** Object-fit for the rendered image. Framed mode defaults to `cover`. */
20
20
  fit?: "cover" | "contain";
21
- /** Slot `sizes` (e.g. "(min-width:1024px) 1200px, 100vw"); applied to every candidate. */
21
+ /** How wide the image renders, per viewport (e.g. "(min-width:1024px) 40rem, 100vw"),
22
+ * applied to every candidate. Optional: a lazy image (the default) emits `auto`, which
23
+ * sizes it from its laid-out box, and this becomes the fallback for a browser without
24
+ * `auto` (absent: `100vw`). An eager image cannot use `auto` — set this when one is
25
+ * not full-width, or it fetches a rung for the whole viewport. */
22
26
  sizes?: string;
23
27
  /** Per-section srcset ceiling (px). Rungs wider than this are dropped (≥1 always kept). */
24
28
  maxRungWidth?: number;
@@ -1,5 +1,5 @@
1
1
  import { objectFitClass } from "./object-fit.js";
2
- import { buildPictureSources } from "./picture-sources.js";
2
+ import { buildPictureSources, resolveSizes } from "./picture-sources.js";
3
3
  import { splitMarkerAttrs } from "./marker-attrs.js";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
 
@@ -14,72 +14,6 @@ function resolveRendition(value, rendition) {
14
14
  mobile: null
15
15
  };
16
16
  }
17
- /**
18
- * Image — the responsive-image primitive.
19
- *
20
- * Takes the whole slot value; `url`, `alt`, `mobile` and `responsive` are read off it,
21
- * so a call site cannot unpack four fields and forget the fifth. A raw `<img>` is legal
22
- * where you do not want this machinery — the component is worth using, not mandatory.
23
- *
24
- * **Two kinds of image.** `value` takes either a resolved slot value (the user's own
25
- * photo) or an `AuthorImage` — a raster the template ships, from
26
- * `import photo from "./assets/photo.jpg"`. Both get the same `<picture>`/`srcset`
27
- * treatment; the only difference at the call site is that an `AuthorImage` REQUIRES the
28
- * `alt` prop, having no alt of its own to fall back on.
29
- *
30
- * **The box is always yours.** Cropping is baked upstream — the platform delivers a
31
- * pre-cropped asset — and the kit paints no geometry: no aspect, no size, no position.
32
- * Whatever box your classes establish is the box, and `object-position` on the `<img>`
33
- * is yours to set where a design wants the cover nudged.
34
- *
35
- * **Framed** (default): a wrapper — `relative`, clipped, tinted via `.concrete-image-frame`
36
- * when the value is absent — that your `className` lands on and the `<img>` absolutely
37
- * fills as an `object-cover`. Size the wrapper with your own classes (an aspect utility,
38
- * a height, an absolute inset) and the image covers it. `className` is the ONLY prop that
39
- * lands there: every other prop you pass — a `data-*` state flag, an `id`, an ARIA
40
- * attribute — rides the inner `<img>` one element below it, `style` is applied unframed
41
- * only (so framed it reaches neither), and the empty-state box spreads no passthrough at
42
- * all. An element that must carry a styled class and a selector-addressed attribute
43
- * together therefore takes `frame={false}`, with a wrapping element owning the box.
44
- *
45
- * **Unframed** (`frame={false}`): no wrapper — the `<img>` itself takes your `className`,
46
- * for a logo, a slide whose parent already establishes the box, or an image that needs
47
- * its own `object-position`. Pair with `fit="contain"` where the whole asset must stay
48
- * visible. An absent value renders a placeholder box here too — never an `<img>` with
49
- * an empty `src`.
50
- *
51
- * **Do not write markup or browser-side code against a particular rendered root.** Framed,
52
- * the root is always the wrapper. Unframed, it is the `<img>` itself, the placeholder box
53
- * for a blank value, or a generated `<picture>` — which is emitted only when the source
54
- * plan produced a `<source>` to put in it.
55
- *
56
- * **The `<picture>` is `display: contents`.** It exists for `<source>` selection and
57
- * nothing else: it generates no box of its own, so the `<img>` is always your layout
58
- * child — a flex or grid cell, a percentage `max-height` against your fixed-height well —
59
- * whether or not the value's ladder produced a `<picture>` to wrap it. Size the `<img>`
60
- * (or, framed, the wrapper) and never the picture. Taking the picture out of layout
61
- * would otherwise hand its `<source>` elements to YOUR box as items of their own, so
62
- * base.css resets them (`source { display: none }`) — which is what makes "the `<img>`
63
- * is your layout child" mean the `<img>` and nothing else.
64
- *
65
- * **The mobile crop.** A value carrying a distinct mobile crop is served it below
66
- * `mobileBreakpoint` through a media-gated `<picture>` `<source>`; the number is the
67
- * slot's `crop.mobile.breakpoint`, which `Slot.Image` reads off the slot and a raw
68
- * `<Image>` (a list item, which has no def) is handed explicitly. No breakpoint, no
69
- * device switch.
70
- *
71
- * **Committing to a rendition.** Two elements at different DOM positions rendering the
72
- * SAME slot value (a mobile card and a desktop aside) cannot share one `<picture>` —
73
- * `rendition="mobile"` on the one that must render the mobile crop resolves the value to
74
- * it before anything else runs, so that element's whole output is that one rendition.
75
- *
76
- * **The marker is never dropped.** `{...slot.x}` arrives through the prop bag and every
77
- * branch applies it — the framed wrapper, the unframed `<img>`, or the empty-state
78
- * placeholder box that renders no `<img>` at all. It does NOT always ride the branch's
79
- * outermost element: an unframed value that generates a `<picture>` keeps the marker on
80
- * the `<img>` inside it. Find it by querying the rendered markup for the attribute
81
- * rather than by reading any one element's attributes.
82
- */
83
17
  function Image({ value, alt, frame, fit, sizes, maxRungWidth, mobileBreakpoint, rendition, className, loading, style, ...rest }) {
84
18
  const { markerAttrs, rest: imgAttrs } = splitMarkerAttrs(rest);
85
19
  const resolved = resolveRendition(value, rendition);
@@ -91,7 +25,7 @@ function Image({ value, alt, frame, fit, sizes, maxRungWidth, mobileBreakpoint,
91
25
  const plan = responsive ? buildPictureSources({
92
26
  responsive,
93
27
  responsiveMobile,
94
- sizes,
28
+ sizes: resolveSizes(sizes, loading),
95
29
  maxRungWidth,
96
30
  mobileBreakpoint
97
31
  }) : null;
@@ -1,19 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
 
3
3
  //#region src/primitives/Section.tsx
4
- /**
5
- * The section root. Every section renderer roots at exactly one `<Section>`.
6
- *
7
- * Full-bleed by contract: 100% width with zero margin (`.concrete-section`, from the
8
- * framework's base stylesheet), so consecutive sections butt edge-to-edge and a page composes as
9
- * a vertical stack with no framework-injected whitespace. A margin utility on this
10
- * root would re-open those gaps — `concrete check` reports it
11
- * (section-root-margin). Padding is yours: on this root or on a child, the section's
12
- * background still paints edge-to-edge under it.
13
- *
14
- * When content needs a centered, max-width well, write it as JSX on a child:
15
- * `w-full max-w-page mx-auto px-gutter`, spending tokens your own `@theme` declares.
16
- */
17
4
  function Section({ as = "section", children, className, ...rest }) {
18
5
  return /* @__PURE__ */ jsx(as, {
19
6
  className: ["concrete-section", className].filter(Boolean).join(" "),
@@ -2,32 +2,6 @@ import { splitMarkerAttrs } from "./marker-attrs.js";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
 
4
4
  //#region src/primitives/Tour.tsx
5
- /**
6
- * Tour — the 3D-walkthrough primitive.
7
- *
8
- * Takes the whole slot value; the embed `url` and `alt` are read off it. There is one
9
- * branch, not two: a tour is always a provider embed, so this is `<Video>`'s link half
10
- * with the `<video>` half — and with it `playback`, `sources`, `fit` and the intrinsic
11
- * dimensions — gone rather than left inert. `url` is the FINISHED embed src, rewritten
12
- * once at resolve by `tourEmbedUrl`, so this component is a pure read.
13
- *
14
- * **Framed** (default): a wrapper — `relative`, clipped, tinted via `.concrete-image-frame` —
15
- * that your `className` lands on and the iframe absolutely fills. The kit paints no
16
- * geometry: size the wrapper with your own classes and the embed fills it, same as
17
- * `<Image>`/`<Video>`.
18
- *
19
- * **Empty is a neutral rect, not a poster facade.** With no embed url the framed
20
- * wrapper renders alone — the same `role="img"` placeholder `<Video>` leaves. The
21
- * tour's THUMBNAIL is a separate rendering: bind the same slot to `<Slot.Image>`,
22
- * which renders the poster under this slot's own identity.
23
- *
24
- * **The marker is never dropped**: `{...slot.x}` lands on the outermost element in
25
- * every branch — framed, unframed, and empty — so a tour rendered twice on one slot is
26
- * selectable from either.
27
- *
28
- * `object-fit` is not offered: it has no effect on a replaced-element iframe, and the
29
- * provider's own player letterboxes inside whatever box it is given.
30
- */
31
5
  function Tour({ value, alt, frame, className, ...rest }) {
32
6
  const { markerAttrs, rest: hostAttrs } = splitMarkerAttrs(rest);
33
7
  const src = value?.url ? value.url : null;
@@ -13,38 +13,6 @@ const PREVIEW_PLAYBACK = {
13
13
  controls: false,
14
14
  preload: "metadata"
15
15
  };
16
- /**
17
- * Video — the video primitive, whoever hosts the bytes.
18
- *
19
- * Takes the whole slot value; `url`, `poster`, `alt` and the intrinsic dimensions are
20
- * read off it. There is no cropping, no editing, and no responsive ladder: one
21
- * progressive MP4 is served per hosted video and the poster is baked upstream.
22
- *
23
- * **Two branches, discriminated by `value.source`.** An upload renders a `<video>`
24
- * element over its transcoded rendition; a link renders a lazy provider `<iframe>` over
25
- * an embed src the resolver already finished. Absent `source` is an upload. Both share
26
- * one frame container, one poster-only fallback, and one marker spread.
27
- *
28
- * **Framed** (default): a wrapper — `relative`, clipped, tinted via `.concrete-image-frame` —
29
- * that your `className` lands on and the player absolutely fills. The kit paints no
30
- * geometry: size the wrapper with your own classes (an aspect utility, a height) and the
31
- * player covers it. `frame={false}` hands your classes to the media element itself.
32
- * Framed, `className` is the only prop that lands on the wrapper — the rest of the bag
33
- * rides the inner `<video>` one element below it, a link's provider `<iframe>` takes none
34
- * of it in either mode, and the empty-state box spreads none either — so an element that
35
- * must carry a styled class and a selector-addressed attribute together takes
36
- * `frame={false}`, with a wrapping element owning the box.
37
- *
38
- * **Playback is author-declared**, from the slot's `playback` config, except under
39
- * `preview`: a hosted video takes it as `<video>` attributes verbatim, a link as the
40
- * provider's own player params, as far as that player allows. `autoplay` requires
41
- * `muted` — enforced on the schema at `check` time, so a video reaching here with
42
- * `autoplay` is already muted.
43
- *
44
- * **The marker is never dropped**: `{...slot.x}` is applied to the outermost element in
45
- * every branch, so two `<Video>` on one slot (a preview and the real player) are both
46
- * selectable in the editor.
47
- */
48
16
  function Video({ value, alt, frame, fit, playback, preview, className, ...rest }) {
49
17
  const { markerAttrs, rest: videoAttrs } = splitMarkerAttrs(rest);
50
18
  const src = value?.url ? value.url : null;
@@ -5,7 +5,6 @@ function providerOf(url, declared) {
5
5
  if (hint.includes("vimeo")) return "vimeo";
6
6
  return "other";
7
7
  }
8
- /** The embed src with `playback` written onto it as the provider's player params. */
9
8
  function playbackEmbedSrc(src, provider, playback) {
10
9
  let url;
11
10
  try {
@@ -1,11 +1,6 @@
1
1
  import { ATTR_SLOT_FIELD, ATTR_SLOT_GROUP, ATTR_SLOT_ID, ATTR_SLOT_ITEM, ATTR_SLOT_TEXT_LEAF, ATTR_SLOT_UNSELECTABLE } from "../packages/internal/template-contracts/dist/markers.js";
2
2
 
3
3
  //#region src/primitives/marker-attrs.ts
4
- /**
5
- * The marker attribute a binding's identity derives to: `data-slot-id` for a slot
6
- * binding (it carries `id`), `data-slot-field` for a row-field binding (it carries
7
- * `field`). Structural discrimination — only a slot binding has `id`.
8
- */
9
4
  function identityMarkerAttrs(binding) {
10
5
  return "id" in binding ? { [ATTR_SLOT_ID]: binding.id } : { [ATTR_SLOT_FIELD]: binding.field };
11
6
  }
@@ -17,18 +12,6 @@ const MARKER_ATTRS = [
17
12
  ATTR_SLOT_GROUP,
18
13
  ATTR_SLOT_UNSELECTABLE
19
14
  ];
20
- /**
21
- * Splits spread marker attributes off a component's remaining props.
22
- *
23
- * `Slot.Image`/`Slot.Video` deliver the marker through the same prop bag as `className`
24
- * and `loading`, but the marker belongs on the element the component makes its own: the
25
- * framed wrapper, the bare `<img>`/`<video>`, or the empty-state box that renders no
26
- * media element at all. Every branch applies `markerAttrs`, which is what makes the
27
- * marker impossible to drop — though not always to the branch's ROOT. `<Image>` unframed
28
- * keeps it on the `<img>` inside any `<picture>` it generates (a `display: contents`
29
- * wrapper, so the `<img>` is still the element that owns the layout), so a consumer
30
- * looking for it must query descendants too.
31
- */
32
15
  function splitMarkerAttrs(props) {
33
16
  const markerAttrs = {};
34
17
  const rest = {};
@@ -1,4 +1,9 @@
1
1
  //#region src/primitives/picture-sources.ts
2
+ function resolveSizes(sizes, loading) {
3
+ if (loading === "eager") return sizes;
4
+ if (sizes && /^\s*auto\s*(,|$)/i.test(sizes)) return sizes;
5
+ return `auto, ${sizes ?? "100vw"}`;
6
+ }
2
7
  function capSrcset(srcset, maxRungWidth) {
3
8
  const entries = srcset.split(",").map((s) => s.trim()).filter(Boolean).map((cand) => {
4
9
  const m = cand.match(/(\d+)w\s*$/);
@@ -49,4 +54,4 @@ function buildPictureSources(args) {
49
54
  }
50
55
 
51
56
  //#endregion
52
- export { buildPictureSources };
57
+ export { buildPictureSources, resolveSizes };