@homepages/concrete 1.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 (327) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +174 -0
  3. package/codemods/manifest.json +9 -0
  4. package/dist/artifact/playground/client/assets/index-BSA1yutg.css +1 -0
  5. package/dist/artifact/playground/client/assets/index-JloQyj8h.js +1101 -0
  6. package/dist/artifact/playground/client/index.html +13 -0
  7. package/dist/artifact/playground/client/island-canvas-host.mjs +1 -0
  8. package/dist/artifact/playground/host.mjs +127 -0
  9. package/dist/asset-modules.d.ts +99 -0
  10. package/dist/base.css +220 -0
  11. package/dist/browser/site-config.d.ts +18 -0
  12. package/dist/browser/site-config.js +56 -0
  13. package/dist/browser/submit-lead.d.ts +98 -0
  14. package/dist/browser/submit-lead.js +188 -0
  15. package/dist/browser.d.ts +3 -0
  16. package/dist/browser.js +4 -0
  17. package/dist/cli/build/artifact.js +225 -0
  18. package/dist/cli/build/captures.js +67 -0
  19. package/dist/cli/build/esbuild.js +127 -0
  20. package/dist/cli/build/fixtures.js +96 -0
  21. package/dist/cli/build/icons.js +76 -0
  22. package/dist/cli/build/index.js +38 -0
  23. package/dist/cli/build/playground.js +31 -0
  24. package/dist/cli/build/sections.js +236 -0
  25. package/dist/cli/build/source.js +62 -0
  26. package/dist/cli/build/static.js +156 -0
  27. package/dist/cli/capture/bundle.js +37 -0
  28. package/dist/cli/capture/capture-browser.js +51 -0
  29. package/dist/cli/capture/capture.js +121 -0
  30. package/dist/cli/check/analyze.js +95 -0
  31. package/dist/cli/check/index.js +19 -0
  32. package/dist/cli/check/load-workspace.js +119 -0
  33. package/dist/cli/check/messages.js +16 -0
  34. package/dist/cli/check/render/class-conflicts.js +39 -0
  35. package/dist/cli/check/render/html.js +86 -0
  36. package/dist/cli/check/render/inputs.js +53 -0
  37. package/dist/cli/check/render/invariants.js +58 -0
  38. package/dist/cli/check/render/island-frames.js +72 -0
  39. package/dist/cli/check/render/marker-coverage.js +102 -0
  40. package/dist/cli/check/render/nav.js +64 -0
  41. package/dist/cli/check/report.js +73 -0
  42. package/dist/cli/check/stages/bundles.js +129 -0
  43. package/dist/cli/check/stages/composition.js +67 -0
  44. package/dist/cli/check/stages/contracts.js +22 -0
  45. package/dist/cli/check/stages/dependencies.js +261 -0
  46. package/dist/cli/check/stages/fixtures.js +74 -0
  47. package/dist/cli/check/stages/lint.js +41 -0
  48. package/dist/cli/check/stages/logic.js +63 -0
  49. package/dist/cli/check/stages/render.js +144 -0
  50. package/dist/cli/check/stages/sections.js +83 -0
  51. package/dist/cli/check/stages/stylesheet.js +31 -0
  52. package/dist/cli/check/stages/typecheck.js +68 -0
  53. package/dist/cli/check/stages/workspace.js +26 -0
  54. package/dist/cli/commands.js +342 -0
  55. package/dist/cli/currency/cache.js +89 -0
  56. package/dist/cli/currency/decide.js +65 -0
  57. package/dist/cli/currency/opt-out.js +16 -0
  58. package/dist/cli/currency/preamble.js +183 -0
  59. package/dist/cli/currency/prompt.js +28 -0
  60. package/dist/cli/currency/refresh.js +44 -0
  61. package/dist/cli/currency/resolve-latest.js +185 -0
  62. package/dist/cli/currency/version-order.js +38 -0
  63. package/dist/cli/dev/crop.js +22 -0
  64. package/dist/cli/dev/hmr.js +26 -0
  65. package/dist/cli/dev/http.js +129 -0
  66. package/dist/cli/dev/index.js +70 -0
  67. package/dist/cli/dev/islands.js +390 -0
  68. package/dist/cli/dev/load-template.js +46 -0
  69. package/dist/cli/dev/request-error.js +22 -0
  70. package/dist/cli/dev/server.js +307 -0
  71. package/dist/cli/dev/tsconfig-paths.js +95 -0
  72. package/dist/cli/dev/vite.js +85 -0
  73. package/dist/cli/dev/workspace-reader.js +274 -0
  74. package/dist/cli/io.d.ts +14 -0
  75. package/dist/cli/media/cache.js +125 -0
  76. package/dist/cli/media/derive.js +252 -0
  77. package/dist/cli/media/deriver-plugin.js +71 -0
  78. package/dist/cli/property/index.js +180 -0
  79. package/dist/cli/property/library.js +137 -0
  80. package/dist/cli/publish/client.js +119 -0
  81. package/dist/cli/publish/freshness.js +66 -0
  82. package/dist/cli/publish/git.js +43 -0
  83. package/dist/cli/publish/index.js +207 -0
  84. package/dist/cli/publish/pack.js +78 -0
  85. package/dist/cli/publish/report.js +98 -0
  86. package/dist/cli/publish/target.js +87 -0
  87. package/dist/cli/publish/wire.js +29 -0
  88. package/dist/cli/tar.js +87 -0
  89. package/dist/cli/upgrade/codemod.js +56 -0
  90. package/dist/cli/upgrade/index.js +263 -0
  91. package/dist/cli/upgrade/manifest.js +72 -0
  92. package/dist/cli/upgrade/plan.js +68 -0
  93. package/dist/cli/upgrade/stage.js +71 -0
  94. package/dist/cli/version.d.ts +12 -0
  95. package/dist/cli/version.js +15 -0
  96. package/dist/cli/workspace.js +108 -0
  97. package/dist/cli.d.ts +6 -0
  98. package/dist/cli.js +94 -0
  99. package/dist/css/compile.js +77 -0
  100. package/dist/css/graph.js +109 -0
  101. package/dist/css/inline.js +132 -0
  102. package/dist/css/rules.js +65 -0
  103. package/dist/design-system/format-variants.js +127 -0
  104. package/dist/eslint/authoring.js +46 -0
  105. package/dist/eslint/correctness.js +42 -0
  106. package/dist/eslint/rules/editor-declaration.js +103 -0
  107. package/dist/eslint/rules/editor-reason.js +135 -0
  108. package/dist/eslint/rules/island-imports.js +20 -0
  109. package/dist/eslint/rules/jsx-visitor.js +20 -0
  110. package/dist/eslint/rules/no-client-runtime.js +88 -0
  111. package/dist/eslint/rules/no-editor-globals.js +60 -0
  112. package/dist/eslint/rules/no-hard-coded-color.js +183 -0
  113. package/dist/eslint/rules/no-inline-style.js +24 -0
  114. package/dist/eslint/rules/no-marker-literal.js +37 -0
  115. package/dist/eslint/rules/no-nondeterminism.js +44 -0
  116. package/dist/eslint/rules/no-px-breakpoint.js +44 -0
  117. package/dist/eslint/rules/no-raw-values.js +45 -0
  118. package/dist/eslint/rules/serializable-props.js +95 -0
  119. package/dist/eslint.d.ts +6 -0
  120. package/dist/eslint.js +26 -0
  121. package/dist/fixtures/brand.d.ts +4 -0
  122. package/dist/fixtures/brand.js +9 -0
  123. package/dist/fixtures/bundle-rule.js +67 -0
  124. package/dist/fixtures/canonical.d.ts +149 -0
  125. package/dist/fixtures/image-dimensions.js +59 -0
  126. package/dist/fixtures/load.js +154 -0
  127. package/dist/fixtures/media-plugin.js +141 -0
  128. package/dist/fixtures/media.js +165 -0
  129. package/dist/fixtures/property.js +210 -0
  130. package/dist/fixtures/resolve.js +202 -0
  131. package/dist/fixtures/rows.js +108 -0
  132. package/dist/fixtures/synthesize-empties.js +42 -0
  133. package/dist/fixtures.d.ts +213 -0
  134. package/dist/fixtures.js +37 -0
  135. package/dist/index.d.ts +53 -0
  136. package/dist/index.js +37 -0
  137. package/dist/islands/client-module.js +97 -0
  138. package/dist/islands/marker.d.ts +43 -0
  139. package/dist/islands/marker.js +44 -0
  140. package/dist/node_modules/.pnpm/fflate@0.8.3/node_modules/fflate/esm/browser.js +687 -0
  141. package/dist/packages/external/concrete/package.js +5 -0
  142. package/dist/packages/internal/fact-interpolation/dist/index.js +22 -0
  143. package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +111 -0
  144. package/dist/packages/internal/fill-bake/dist/display.js +9 -0
  145. package/dist/packages/internal/fill-bake/dist/index.js +6 -0
  146. package/dist/packages/internal/fill-bake/dist/reconcile-cross-section.js +170 -0
  147. package/dist/packages/internal/fill-vocabulary/dist/facts.d.ts +32 -0
  148. package/dist/packages/internal/fill-vocabulary/dist/facts.js +131 -0
  149. package/dist/packages/internal/fill-vocabulary/dist/row-planners.js +73 -0
  150. package/dist/packages/internal/format-geometry/dist/capture.js +404 -0
  151. package/dist/packages/internal/format-geometry/dist/format.d.ts +41 -0
  152. package/dist/packages/internal/format-geometry/dist/geometry.js +58 -0
  153. package/dist/packages/internal/format-geometry/dist/index.js +4 -0
  154. package/dist/packages/internal/image-descriptor/dist/index.d.ts +35 -0
  155. package/dist/packages/internal/image-ladder/dist/crop.js +82 -0
  156. package/dist/packages/internal/image-ladder/dist/encode.js +23 -0
  157. package/dist/packages/internal/image-ladder/dist/index.js +4 -0
  158. package/dist/packages/internal/image-ladder/dist/policy.js +102 -0
  159. package/dist/packages/internal/island-runtime/dist/capture-holds.d.ts +13 -0
  160. package/dist/packages/internal/island-runtime/dist/capture-holds.js +45 -0
  161. package/dist/packages/internal/island-runtime/dist/contract.d.ts +176 -0
  162. package/dist/packages/internal/island-runtime/dist/contract.js +94 -0
  163. package/dist/packages/internal/island-runtime/dist/editor-instance-context.js +15 -0
  164. package/dist/packages/internal/island-runtime/dist/index.d.ts +103 -0
  165. package/dist/packages/internal/island-runtime/dist/index.js +163 -0
  166. package/dist/packages/internal/island-runtime/dist/use-capture-ready.d.ts +19 -0
  167. package/dist/packages/internal/island-runtime/dist/use-capture-ready.js +39 -0
  168. package/dist/packages/internal/island-runtime/dist/use-editor.d.ts +22 -0
  169. package/dist/packages/internal/island-runtime/dist/use-editor.js +54 -0
  170. package/dist/packages/internal/island-runtime/dist/viewport-schedule.js +105 -0
  171. package/dist/packages/internal/property-facts/dist/derive-facts-view.js +25 -0
  172. package/dist/packages/internal/property-facts/dist/index.js +3 -0
  173. package/dist/packages/internal/property-facts/dist/property-facts-CSdkSuD7.js +181 -0
  174. package/dist/packages/internal/section-contracts/dist/cap-contract.js +59 -0
  175. package/dist/packages/internal/section-contracts/dist/catalog.js +102 -0
  176. package/dist/packages/internal/section-contracts/dist/choose-select-contract.js +24 -0
  177. package/dist/packages/internal/section-contracts/dist/count-bounds-contract.js +48 -0
  178. package/dist/packages/internal/section-contracts/dist/display-contract.js +30 -0
  179. package/dist/packages/internal/section-contracts/dist/display-evidence-contract.js +17 -0
  180. package/dist/packages/internal/section-contracts/dist/group-contract.js +21 -0
  181. package/dist/packages/internal/section-contracts/dist/index.js +26 -0
  182. package/dist/packages/internal/section-contracts/dist/interpolation-contract.js +48 -0
  183. package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +53 -0
  184. package/dist/packages/internal/section-contracts/dist/list-scalar-contract.js +70 -0
  185. package/dist/packages/internal/section-contracts/dist/name-title-contract.js +27 -0
  186. package/dist/packages/internal/section-contracts/dist/nested-slot-contract.js +12 -0
  187. package/dist/packages/internal/section-contracts/dist/option-source-contract.js +22 -0
  188. package/dist/packages/internal/section-contracts/dist/poi-curation-contract.js +18 -0
  189. package/dist/packages/internal/section-contracts/dist/pooling-field-contract.js +30 -0
  190. package/dist/packages/internal/section-contracts/dist/record-collection-contract.js +24 -0
  191. package/dist/packages/internal/section-contracts/dist/row-contract.js +37 -0
  192. package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +38 -0
  193. package/dist/packages/internal/section-contracts/dist/runners.js +181 -0
  194. package/dist/packages/internal/section-contracts/dist/select-contract.js +28 -0
  195. package/dist/packages/internal/section-contracts/dist/source-contract.js +48 -0
  196. package/dist/packages/internal/section-contracts/dist/source-filter-contract.js +15 -0
  197. package/dist/packages/internal/section-contracts/dist/sources-contract.js +28 -0
  198. package/dist/packages/internal/section-contracts/dist/url-contract.js +20 -0
  199. package/dist/packages/internal/source-resolution/dist/index.js +222 -0
  200. package/dist/packages/internal/template-artifact/dist/hash.js +50 -0
  201. package/dist/packages/internal/template-artifact/dist/index.js +7 -0
  202. package/dist/packages/internal/template-artifact/dist/layout.js +165 -0
  203. package/dist/packages/internal/template-artifact/dist/manifest.js +73 -0
  204. package/dist/packages/internal/template-artifact/dist/sha256.js +138 -0
  205. package/dist/packages/internal/template-artifact/dist/verify.js +275 -0
  206. package/dist/packages/internal/template-contracts/dist/collection-editing.js +38 -0
  207. package/dist/packages/internal/template-contracts/dist/content-categories.d.ts +10 -0
  208. package/dist/packages/internal/template-contracts/dist/content-categories.js +17 -0
  209. package/dist/packages/internal/template-contracts/dist/document-value.d.ts +33 -0
  210. package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +81 -0
  211. package/dist/packages/internal/template-contracts/dist/facts-view.js +136 -0
  212. package/dist/packages/internal/template-contracts/dist/layout.js +17 -0
  213. package/dist/packages/internal/template-contracts/dist/markers.d.ts +40 -0
  214. package/dist/packages/internal/template-contracts/dist/markers.js +41 -0
  215. package/dist/packages/internal/template-contracts/dist/poi-row.d.ts +63 -0
  216. package/dist/packages/internal/template-contracts/dist/select-key.js +13 -0
  217. package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +1112 -0
  218. package/dist/packages/internal/template-contracts/dist/slot-catalog.js +1109 -0
  219. package/dist/packages/internal/template-contracts/dist/slot-overrides.js +11 -0
  220. package/dist/packages/internal/template-contracts/dist/tour-value.d.ts +45 -0
  221. package/dist/packages/internal/template-contracts/dist/video-value.d.ts +63 -0
  222. package/dist/playground/host/page-state.js +12 -0
  223. package/dist/playground/host/paths.js +9 -0
  224. package/dist/playground/layout.js +24 -0
  225. package/dist/playground/wire.js +36 -0
  226. package/dist/playground-island-runtime.d.ts +3 -0
  227. package/dist/playground-island-runtime.js +4 -0
  228. package/dist/primitives/FrameShell.d.ts +29 -0
  229. package/dist/primitives/FrameShell.js +34 -0
  230. package/dist/primitives/Image.d.ts +119 -0
  231. package/dist/primitives/Image.js +173 -0
  232. package/dist/primitives/Section.d.ts +22 -0
  233. package/dist/primitives/Section.js +26 -0
  234. package/dist/primitives/Tour.d.ts +43 -0
  235. package/dist/primitives/Tour.js +72 -0
  236. package/dist/primitives/Video.d.ts +57 -0
  237. package/dist/primitives/Video.js +116 -0
  238. package/dist/primitives/embed-playback.js +50 -0
  239. package/dist/primitives/index.d.ts +11 -0
  240. package/dist/primitives/marker-attrs.js +44 -0
  241. package/dist/primitives/object-fit.js +11 -0
  242. package/dist/primitives/picture-sources.d.ts +24 -0
  243. package/dist/primitives/picture-sources.js +52 -0
  244. package/dist/primitives/probe-context.js +24 -0
  245. package/dist/primitives/slot-bindings.d.ts +96 -0
  246. package/dist/primitives/slot-bindings.js +226 -0
  247. package/dist/primitives/slot-document.d.ts +35 -0
  248. package/dist/primitives/slot-document.js +37 -0
  249. package/dist/primitives/slot-group.d.ts +40 -0
  250. package/dist/primitives/slot-group.js +45 -0
  251. package/dist/primitives/slot-list.d.ts +21 -0
  252. package/dist/primitives/slot-list.js +23 -0
  253. package/dist/primitives/slot-media.d.ts +71 -0
  254. package/dist/primitives/slot-media.js +98 -0
  255. package/dist/primitives/slot-scalar.d.ts +53 -0
  256. package/dist/primitives/slot-scalar.js +98 -0
  257. package/dist/primitives/slot.d.ts +26 -0
  258. package/dist/primitives/slot.js +28 -0
  259. package/dist/rules/registry.js +479 -0
  260. package/dist/schema/compute.d.ts +22 -0
  261. package/dist/schema/compute.js +30 -0
  262. package/dist/schema/define-schema.d.ts +27 -0
  263. package/dist/schema/define-schema.js +73 -0
  264. package/dist/schema/extract-fill-spec.js +246 -0
  265. package/dist/schema/extract-used-facts.js +176 -0
  266. package/dist/schema/fact.d.ts +65 -0
  267. package/dist/schema/fact.js +33 -0
  268. package/dist/schema/fill-builders.d.ts +387 -0
  269. package/dist/schema/fill-builders.js +263 -0
  270. package/dist/schema/fill-declaration.d.ts +76 -0
  271. package/dist/schema/fill-declaration.js +43 -0
  272. package/dist/schema/fill-spec.d.ts +18 -0
  273. package/dist/schema/fill-spec.js +170 -0
  274. package/dist/schema/format-presets.d.ts +27 -0
  275. package/dist/schema/format-presets.js +76 -0
  276. package/dist/schema/format.d.ts +22 -0
  277. package/dist/schema/format.js +40 -0
  278. package/dist/schema/formats.d.ts +6 -0
  279. package/dist/schema/formats.js +7 -0
  280. package/dist/schema/layout.d.ts +32 -0
  281. package/dist/schema/layout.js +30 -0
  282. package/dist/schema/manifest.js +300 -0
  283. package/dist/schema/property-facts.d.ts +83 -0
  284. package/dist/schema/runtime-values.d.ts +88 -0
  285. package/dist/schema/section-nav.d.ts +38 -0
  286. package/dist/schema/section-nav.js +29 -0
  287. package/dist/schema/section-props.d.ts +98 -0
  288. package/dist/schema/section-schema.d.ts +53 -0
  289. package/dist/schema/section-schema.js +54 -0
  290. package/dist/schema/slot-builders.d.ts +497 -0
  291. package/dist/schema/slot-builders.js +331 -0
  292. package/dist/schema/slot-types.d.ts +110 -0
  293. package/dist/schema/slot-types.js +187 -0
  294. package/dist/section/declare.d.ts +44 -0
  295. package/dist/section/declare.js +27 -0
  296. package/dist/section/discovery.js +76 -0
  297. package/dist/section/groups.js +74 -0
  298. package/dist/section/materialize.js +28 -0
  299. package/dist/section/placements.js +28 -0
  300. package/dist/section/section.d.ts +69 -0
  301. package/dist/section/section.js +101 -0
  302. package/dist/site-analytics.d.ts +1 -0
  303. package/dist/site-analytics.js +15 -0
  304. package/dist/site-runtime/analytics.js +97 -0
  305. package/dist/site-runtime/site-integrations.js +97 -0
  306. package/dist/styles.css +60 -0
  307. package/dist/template/define-template.d.ts +139 -0
  308. package/dist/template/define-template.js +98 -0
  309. package/dist/template/logic-build.js +191 -0
  310. package/dist/template/logic-shim.d.ts +43 -0
  311. package/dist/template/logic-shim.js +52 -0
  312. package/dist/template/logic-transform.js +92 -0
  313. package/dist/template/materialize.js +107 -0
  314. package/dist/template/reconcile.d.ts +67 -0
  315. package/dist/template/reconcile.js +25 -0
  316. package/dist/template/running-copy.js +58 -0
  317. package/guide/reference/cli/INDEX.md +79 -0
  318. package/guide/reference/cli/build.md +48 -0
  319. package/guide/reference/cli/check.md +49 -0
  320. package/guide/reference/cli/dev.md +46 -0
  321. package/guide/reference/cli/property-add.md +53 -0
  322. package/guide/reference/cli/property-list.md +46 -0
  323. package/guide/reference/cli/publish.md +54 -0
  324. package/guide/reference/cli/upgrade.md +48 -0
  325. package/guide/reference/rules/INDEX.md +190 -0
  326. package/package.json +137 -0
  327. package/tsconfig.base.json +16 -0
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>Playground</title>
7
+ <script type="module" crossorigin src="./assets/index-JloQyj8h.js"></script>
8
+ <link rel="stylesheet" crossorigin href="./assets/index-BSA1yutg.css">
9
+ </head>
10
+ <body>
11
+ <div id="root"></div>
12
+ </body>
13
+ </html>
@@ -0,0 +1 @@
1
+ var m="data-tr-island",H="data-tr-island-id",T="data-tr-island-props",j="data-tr-island-frameless";var x=class extends Error{name="IslandPropsError"};function z(t){let o;try{o=JSON.parse(t)}catch(e){throw new x(`island props payload is not valid JSON: ${String(e)}`)}if(o===null||typeof o!="object"||Array.isArray(o))throw new x("island props payload must be a JSON object");return o}var B=Symbol.for("homepages.tr-island-editor-instance");function J(t){let o=globalThis,e=o[B];return e||(e=t.createContext(null),o[B]=e),e}var X="100%";function N(t){let o=t.getBoundingClientRect();return o.width>0||o.height>0}function Q(t){if(N(t))return t;let o=t.firstElementChild;if(o&&N(o))return o;for(let e=t.previousElementSibling;e;e=e.previousElementSibling)if(N(e))return e;for(let e=t.parentElement;e;e=e.parentElement)if(N(e))return e;return o??t}function Z(t){let o=t.getBoundingClientRect();return o.bottom>0&&o.right>0&&o.top<window.innerHeight&&o.left<window.innerWidth}function tt(){return navigator.connection?.saveData===!0}function et(t){typeof requestIdleCallback=="function"?requestIdleCallback(t):setTimeout(t,1)}async function q(t){let{markers:o,hydrate:e,warm:a,moduleUrl:l}=t,c=n=>n.getAttribute(m)??"",f=new Set,p=n=>f.has(n)?Promise.resolve(null):(f.add(n),e(n)),w=new Map;for(let n of o)w.set(n,Q(n));let b=n=>w.get(n)??n,E=[],h=[];for(let n of o)(Z(b(n))?E:h).push(n);if(l&&!tt()){let n=new Set;for(let i of h){let s=l(c(i));if(s==null||s===""||n.has(s))continue;n.add(s);let d=document.createElement("link");d.rel="modulepreload",d.href=s,d.setAttribute("fetchpriority","low"),document.head.appendChild(d)}}for(let n of E)a(c(n));let I=[];for(let n of E){let i=await p(n);i&&I.push(i)}let y=null,g=new Map,_=n=>{let i=p(n),s=b(n),d=g.get(s);return(!d||d.every(u=>f.has(u)))&&y?.unobserve(s),i};if(typeof IntersectionObserver<"u"){y=new IntersectionObserver(n=>{for(let i of n)if(i.isIntersecting)for(let s of g.get(i.target)??[])_(s)},{rootMargin:X});for(let n of h){let i=b(n),s=g.get(i);s?s.push(n):(g.set(i,[n]),y.observe(i))}}let R=h.slice(),r=()=>{et(()=>{let n=R.shift();for(;n&&f.has(n);)n=R.shift();if(!n){y?.disconnect();return}_(n).then(r,r)})};return r(),I}var U="data-section-instance-id",C=new WeakMap;async function D(t){let o=t.root??document,e=Array.from(o.querySelectorAll(`[${m}]`)).filter(r=>!C.has(r)&&r.parentElement?.closest(`[${m}]`)==null);if(e.length===0)return[];let a=new Map,l=new Set;for(let r of o.querySelectorAll(`script[${T}]`)){let n=r.getAttribute(T);n!==null&&(a.has(n)&&l.add(n),a.set(n,r.textContent??""))}let[c,{createRoot:f,hydrateRoot:p}]=await Promise.all([import("react"),import("react-dom/client")]),{createElement:w}=c,b=J(c),E=({onMounted:r,children:n})=>{let[i,s]=c.useState(0);return c.useEffect(()=>{i===0?s(1):r()},[i,r]),n},h=new Map,I=r=>{let n=h.get(r);return n||(n=t.load(r),h.set(r,n)),n},y=t.schedule!=="eager",g=y?I:t.load,_=async r=>{let n=r.getAttribute(m)??"",i=r.getAttribute(H)??"",s=()=>{},d=new Promise(S=>{s=S}),u={id:i,key:n,element:r,mounted:d};try{if(l.has(i))throw new Error(`island "${i}" (${n}) shares its id with another ${T} payload \u2014 refusing to hydrate either instance rather than guess whose props belong to which marker`);let S=a.get(i);if(S===void 0)throw new Error(`island "${i}" (${n}) has no ${T} payload`);let F=z(S),v=await g(n);if(u.editor=v.editor,t.shouldHydrate&&!t.shouldHydrate(u)||C.has(r)||!r.isConnected)return s(),null;let W=r.closest(`[${U}]`)?.getAttribute(U)??null,M=w(b,{value:W},w(E,{onMounted:s,children:w(v.default,F)})),k={onUncaughtError:L=>{t.onError?.(L,u),s()},onCaughtError:L=>{t.onError?.(L,u),s()}},O;return r.hasAttribute(j)?(O=f(r,k),O.render(M)):O=p(r,M,k),C.set(r,O),t.onHydrated?.(u),u}catch(S){return t.onError?.(S,u),s(),null}};if(y)return q({markers:e,hydrate:_,warm:r=>{I(r).catch(()=>{})},moduleUrl:t.moduleUrl});let R=[];for(let r of e){let n=await _(r);n&&R.push(n)}return R}function P(t=document){let o=t instanceof Element&&t.matches(`[${m}]`)?[t]:[];for(let e of[...o,...t.querySelectorAll(`[${m}]`)]){let a=C.get(e);a&&(C.delete(e),a.unmount())}}import{createElement as ot,useLayoutEffect as rt}from"react";var A="we-enh-shield",Y="we-enh-shield--item",st="data-we-live",it="data-slot-item",at=window.__TR_ISLAND_MAP||{};function lt(t){let o=at[t];return o?import(new URL(o,document.baseURI).href):Promise.reject(new Error("playground: no island module for "+t))}var $=new WeakMap;function ct(t,o){return function(a){return rt(o,[]),ot(t,a)}}function dt(t){return t.__trIslandReal||t.default}async function ut(t){let o=await lt(t),e,a=new Promise(c=>{e=c}),l=o.editor?{...o.editor}:void 0;return l&&$.set(l,{committed:a,signalCommit:e}),{...o,editor:l,default:ct(dt(o),e)}}function ft(t,o){let e=t.createElement("div");return e.className=o?A+" "+Y:A,e.setAttribute("aria-hidden","true"),e}function V(t,o){let e=t.ownerDocument,a=e.defaultView,l=a?a.getComputedStyle(t).position:"";(!l||l==="static")&&(t.style.position="relative"),!Array.from(t.children).some(c=>c.classList.contains(A))&&t.appendChild(ft(e,o))}function pt(t){let o=t.editor;if(!o||o.live!==!0)return;let e=t.element;for(let p of Array.from(e.querySelectorAll("["+it+"]")))V(p,!0);let l=e.ownerDocument.defaultView,f=(l?l.getComputedStyle(e).display:"")==="contents"?Array.from(e.children):[e];for(let p of f)V(p,!1)}var G=!1;function mt(){if(G||document.getElementById("tr-canvas-shield-style"))return;G=!0;let t=document.createElement("style");t.id="tr-canvas-shield-style",t.textContent="."+A+"{position:absolute;inset:0;z-index:1;cursor:pointer;background:transparent;}."+Y+"{z-index:2;}["+st+"] ."+A+"{display:none;}",document.head.appendChild(t)}async function K(t){mt();let o=await D({root:t,load:ut,schedule:"eager",shouldHydrate:e=>e.editor?e.editor.live===!0:!1,onError:(e,a)=>{if(console.error("playground: canvas island failed to hydrate:",a.key,e),a.editor){let l=$.get(a.editor);l&&l.signalCommit()}}});await Promise.all(o.map(e=>e.editor?$.get(e.editor):void 0).filter(e=>e!==void 0).map(e=>e.committed));for(let e of o)pt(e);return o}function ht(t){P(t),t.querySelectorAll("."+A).forEach(o=>o.remove())}window.__trCanvasIslands={hydrateRoot:K,unmountRoot:ht};K(document.body);
@@ -0,0 +1,127 @@
1
+ var Ve=/^(\d+(?:\.\d+)?)(in|mm)$/;function J(e){let t=Ve.exec(e),[,n,o]=t??[];if(n===void 0||o===void 0)throw new Error(`malformed physical length: "${e}"`);let s=Number.parseFloat(n);return o==="mm"?s/25.4:s}function N(e){if(typeof e.width=="number"&&typeof e.height=="number")return{frameWidth:e.width,frameHeight:e.height,bleed:0,viewportWidth:e.width,viewportHeight:e.height,deviceScaleFactor:1,pixelWidth:e.width,pixelHeight:e.height,pointWidth:e.width/96*72,pointHeight:e.height/96*72,bleedPoints:0};let t=e,n=J(t.width),o=J(t.height),s=t.bleed===void 0?0:J(t.bleed),l=n*96,f=o*96,r=s*96,m=l+2*r,v=f+2*r,R=t.dpi/96;return{frameWidth:l,frameHeight:f,bleed:r,viewportWidth:m,viewportHeight:v,deviceScaleFactor:R,pixelWidth:Math.round(m*R),pixelHeight:Math.round(v*R),pointWidth:(n+2*s)*72,pointHeight:(o+2*s)*72,bleedPoints:s*72}}var T="tr-frame";function M(e){let t=N(e);return{"--frame-w":`${t.frameWidth}px`,"--frame-h":`${t.frameHeight}px`,"--frame-bleed":`${t.bleed}px`}}var K=`(function () {
2
+ function CaptureIntersectionObserver(callback, options) {
3
+ var opts = options || {};
4
+ this.root = opts.root || null;
5
+ this.rootMargin = opts.rootMargin || "0px";
6
+ var threshold = opts.threshold;
7
+ this.thresholds = Object.freeze(
8
+ Array.isArray(threshold) ? threshold.slice() : [typeof threshold === "number" ? threshold : 0],
9
+ );
10
+ this._callback = callback;
11
+ this._queued = [];
12
+ this._scheduled = false;
13
+ }
14
+ CaptureIntersectionObserver.prototype._flush = function () {
15
+ this._scheduled = false;
16
+ var entries = this._queued;
17
+ this._queued = [];
18
+ if (entries.length === 0) return;
19
+ this._callback(entries, this);
20
+ };
21
+ CaptureIntersectionObserver.prototype.observe = function (target) {
22
+ var rect = target.getBoundingClientRect();
23
+ this._queued.push({
24
+ target: target,
25
+ isIntersecting: true,
26
+ intersectionRatio: 1,
27
+ boundingClientRect: rect,
28
+ intersectionRect: rect,
29
+ rootBounds: new DOMRectReadOnly(0, 0, window.innerWidth, window.innerHeight),
30
+ time: performance.now(),
31
+ });
32
+ if (this._scheduled) return;
33
+ this._scheduled = true;
34
+ var observer = this;
35
+ Promise.resolve().then(function () {
36
+ observer._flush();
37
+ });
38
+ };
39
+ CaptureIntersectionObserver.prototype.unobserve = function () {};
40
+ CaptureIntersectionObserver.prototype.disconnect = function () {
41
+ this._queued = [];
42
+ };
43
+ CaptureIntersectionObserver.prototype.takeRecords = function () {
44
+ var entries = this._queued;
45
+ this._queued = [];
46
+ return entries;
47
+ };
48
+ window.IntersectionObserver = CaptureIntersectionObserver;
49
+ })();`;var Y="__trIslandsReady",ze=`(async () => {
50
+ const ready = window.${Y};
51
+ if (ready === undefined) {
52
+ throw new Error(
53
+ "capture blocked: the page ships island markers but its host published no " +
54
+ "window.${Y} \u2014 the island runtime never ran",
55
+ );
56
+ }
57
+ await ready;
58
+ })()`;var le=400;var Be=`(async () => {
59
+ await new Promise((resolve) => {
60
+ setTimeout(resolve, ${le});
61
+ });
62
+ await new Promise((resolve) => {
63
+ requestAnimationFrame(() => resolve(undefined));
64
+ });
65
+ })()`,de=5,Ge=`(async () => {
66
+ const frame = () => new Promise((resolve) => {
67
+ requestAnimationFrame(() => resolve(undefined));
68
+ });
69
+ for (let pass = 0; pass < ${de}; pass += 1) {
70
+ const running = document.getAnimations().filter((animation) => {
71
+ if (animation.playState === "finished" || animation.playState === "idle") return false;
72
+ const timing = animation.effect && animation.effect.getComputedTiming();
73
+ return !!timing && Number.isFinite(Number(timing.endTime));
74
+ });
75
+ if (running.length === 0) break;
76
+ for (const animation of running) {
77
+ try {
78
+ animation.finish();
79
+ } catch {
80
+ // Nothing to land on (an infinite or unfinishable animation) \u2014 leave it.
81
+ }
82
+ }
83
+ await frame();
84
+ }
85
+ await frame();
86
+ })()`;function D(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function y(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function ce(e){return ue(e.id,{...M(e)})}function ue(e,t){let n=Object.entries(t).map(([o,s])=>`${o}:${s}`).join(";");return{class:T,dataFormat:e,style:n}}function j(e,t){let n=ce(e);return`<div class="${y(n.class)}" data-format="${y(n.dataFormat)}" style="${y(n.style)}">${t.join("")}</div>`}function k(e){switch(e.destination){case"published":return Xe(e);case"artifact":return Je(e);case"preview":return Ye(e);case"diff":return Ke(e)}}function pe(e){return e.kind==="none"||Object.keys(e.islandMap).length===0?[]:[`<script>${K}</script>`]}var fe="html, body { margin: 0; padding: 0; }";function me(e){let t=[`rel="${e.rel}"`,`href="${y(e.href)}"`];return e.sizes!==void 0&&t.push(`sizes="${y(e.sizes)}"`),e.type!==void 0&&t.push(`type="${y(e.type)}"`),`<link ${t.join(" ")} />`}function Xe(e){let{meta:t}=e,n=['<meta charset="utf-8" />','<meta name="viewport" content="width=device-width, initial-scale=1" />',`<title>${y(t.title)}</title>`,`<meta name="description" content="${y(t.description)}" />`];t.canonical&&n.push(`<link rel="canonical" href="${y(t.canonical)}" />`);for(let s of t.icons??[])n.push(me(s));n.push('<meta property="og:type" content="website" />'),t.siteName&&n.push(`<meta property="og:site_name" content="${y(t.siteName)}" />`),n.push(`<meta property="og:title" content="${y(t.title)}" />`),n.push(`<meta property="og:description" content="${y(t.description)}" />`),t.ogUrl&&n.push(`<meta property="og:url" content="${y(t.ogUrl)}" />`),t.ogImage&&(n.push(`<meta property="og:image" content="${y(t.ogImage)}" />`),t.ogImageWidth&&n.push(`<meta property="og:image:width" content="${t.ogImageWidth}" />`),t.ogImageHeight&&n.push(`<meta property="og:image:height" content="${t.ogImageHeight}" />`),t.ogImageType&&n.push(`<meta property="og:image:type" content="${y(t.ogImageType)}" />`),t.ogImageAlt&&n.push(`<meta property="og:image:alt" content="${y(t.ogImageAlt)}" />`),n.push('<meta name="twitter:card" content="summary_large_image" />'),n.push(`<meta name="twitter:title" content="${y(t.title)}" />`),n.push(`<meta name="twitter:description" content="${y(t.description)}" />`),n.push(`<meta name="twitter:image" content="${y(t.ogImage)}" />`)),n.push(...W(e.stylesheets)),n.push(...Z(e.islands)),e.prefetchUrls&&e.prefetchUrls.length>0&&n.push(`<script type="speculationrules">${D({prefetch:[{source:"list",urls:[...e.prefetchUrls]}]})}</script>`);let o=e.siteConfig?`
87
+ <script type="application/json" id="tr-site-config">${D(e.siteConfig)}</script>`:"";return L({lang:t.lang??"en",head:n,body:` <body class="tr-root">
88
+ ${e.root.bodyHtml}${o}${ee(e.islands,"viewport")}
89
+ <script type="module" src="${y(e.analyticsJs.url)}"></script>
90
+ </body>`})}function Je(e){let t=['<meta charset="utf-8" />'];e.title!==void 0&&t.push(`<title>${y(e.title)}</title>`),t.push(...W(e.stylesheets));let n=[fe,...Ze(e.root)];return t.push(Q(n)),t.push(...pe(e.islands)),t.push(...Z(e.islands)),L({lang:"en",head:t,body:` <body>${Qe(e.root)}${ee(e.islands,"eager")}</body>`})}function Ye(e){let t=['<meta charset="utf-8" />','<meta name="viewport" content="width=device-width, initial-scale=1" />',`<title>${y(e.title)}</title>`,...e.icon===void 0?[]:[me({rel:"icon",href:e.icon})],...W(e.stylesheets),Q([fe,...e.extraCss??[]]),...e.capture===!0?pe(e.islands):[],...Z(e.islands)],n=(e.devScripts??[]).map(o=>`
91
+ ${o}`).join("");return L({lang:"en",head:t,body:` <body>
92
+ ${e.root.bodyHtml}${ee(e.islands,e.capture===!0?"eager":"viewport")}${n}
93
+ </body>`})}function Ke(e){let t=['<meta charset="utf-8" />',`<meta name="viewport" content="width=${e.viewportWidth}, initial-scale=1" />`,`<title>${y(e.title)}</title>`,...W(e.stylesheets),Q([`html, body { margin: 0; padding: 0; width: ${e.viewportWidth}px; }`])];return L({lang:"en",head:t,body:` <body>${e.root.bodyHtml}</body>`})}function L(e){let t=e.head.map(n=>` ${n}`).join(`
94
+ `);return`<!doctype html>
95
+ <html lang="${y(e.lang)}">
96
+ <head>
97
+ ${t}
98
+ </head>
99
+ ${e.body}
100
+ </html>
101
+ `}function Qe(e){return e.kind==="frame"?j(e.format,e.sectionHtml):e.pages.map(t=>j(e.format,t)).join(`
102
+ `)}function Ze(e){return e.kind!=="frameStack"?[]:[`body > .${T} { break-after: page; }`,`body > .${T}:last-child { break-after: auto; }`]}function W(e){return e.kind==="links"?e.hrefs.map(t=>`<link rel="stylesheet" href="${y(t)}" />`):e.css.map(t=>`<style>${t}</style>`)}function Q(e){let[t,...n]=e;return t===void 0?"<style></style>":n.length===0?`<style>${t}</style>`:`<style>${t}
103
+ ${n.join(`
104
+ `)}
105
+ </style>`}function Z(e){if(e.kind!=="bundles")return[];let t=[],n=e.reactVendorMap;if(n&&Object.keys(n).length>0&&t.push(`<script type="importmap">${D({imports:n})}</script>`),Object.keys(e.islandMap).length===0)return t;for(let o of[e.runtime.url,...Object.values(n??{}),...e.reactVendorCore?[e.reactVendorCore.url]:[]])t.push(`<link rel="modulepreload" href="${y(o)}" />`);return t}function ee(e,t){if(e.kind==="none"||Object.keys(e.islandMap).length===0)return"";let n=D(e.islandMap),o=t==="eager"?' window.__TR_ISLAND_SCHEDULE = "eager";':"";return e.kind==="bundles"?`
106
+ <script>window.__TR_ISLAND_MAP=${n};${o}</script>
107
+ <script type="module" src="${y(e.runtime.url)}"></script>`:`
108
+ ${et}
109
+ <script>window.__TR_ISLAND_MAP = ${n};${o}</script>
110
+ <script type="module" src="${y(e.bootstrapUrl)}"></script>`}var et=`<script type="module">
111
+ import RefreshRuntime from "/@react-refresh";
112
+ RefreshRuntime.injectIntoGlobalHook(window);
113
+ window.$RefreshReg$ = () => {};
114
+ window.$RefreshSig$ = () => (type) => type;
115
+ window.__vite_plugin_react_preamble_installed__ = true;
116
+ </script>`;function ge(){let e={};return new Proxy(e,{get:(t,n)=>typeof n!="string"||n in e||n==="then"||n==="toJSON"?e[n]:`#${n}`})}function ye(e){let t=new URLSearchParams;for(let[o,s]of Object.entries(e))s!=null&&s!==""&&t.set(o,s);let n=t.toString();return n===""?"":`?${n}`}var E={catalog:"api/catalog",render:"api/render",media:e=>`api/media${ye({fixture:e})}`,capture:(e,t)=>`api/capture/${e}${ye({fixture:t.fixture,format:t.format,page:t.page,canvas:t.canvas})}`,live:(e,t)=>`fixtures/${encodeURIComponent(e)}/live${t==="/"?"/":`${t}/`}`,hmr:"__hmr"};var g=class extends Error{constructor(n,o){super(o);this.status=n}status};function tt(e){return e.split("-").map(t=>t&&t[0].toUpperCase()+t.slice(1)).join(" ")}function he(e){let{variant:t}=e;return{required:e.required,variant:t===null?null:{cases:t.cases.map(n=>({value:n,label:tt(n)})),locked:t.locked}}}function we(e){return Object.fromEntries(e.map(t=>[t.instance_id,{enabled:t.enabled,...t.variant===void 0?{}:{variant:t.variant}}]))}function Re(e){if(e==null)return{};if(typeof e!="object"||Array.isArray(e))throw new g(400,"A render request's display is an object keyed by instance id.");let t={};for(let[n,o]of Object.entries(e)){if(typeof o!="object"||o===null||Array.isArray(o))throw new g(400,`The display state of "${n}" is not an object.`);let{enabled:s,variant:l}=o;if(s!==void 0&&typeof s!="boolean")throw new g(400,`The display state of "${n}" has a non-boolean enabled.`);if(l!==void 0&&typeof l!="string")throw new g(400,`The display state of "${n}" has a non-string variant.`);t[n]={...s===void 0?{}:{enabled:s},...l===void 0?{}:{variant:l}}}return t}function be(e,t){for(let[n,o]of Object.entries(t)){let s=e.instances.find(f=>f.instanceId===n);if(s===void 0)throw new g(400,`The composition places no instance "${n}".`);if(o.enabled===!1&&s.display.required)throw new g(400,`Section instance "${n}" is required and cannot be hidden.`);if(o.variant===void 0)continue;let l=s.display.variant;if(l===null)throw new g(400,`Section instance "${n}" declares no display variant.`);if(l.locked)throw new g(400,`Section instance "${n}" declares a locked variant, which the user cannot switch.`);if(!l.cases.includes(o.variant))throw new g(400,`"${o.variant}" is not a declared case of section instance "${n}" (declared: ${l.cases.join(", ")}).`)}}function Se(e,t){return new Map(e.instances.map(n=>[n.instance_id,t[n.instance_id]?.enabled??n.enabled]))}function _e(e,t,n){let o=n[e.instance_id]?.variant;if(o===void 0||o===e.variant)return e;let s={...e.slots};for(let[l,f]of Object.entries(t))l in s||(f.variant===void 0||f.variant.cases.includes(o))&&(s[l]=f.type==="list"?[]:null);return{...e,variant:o,slots:s}}function ve(e){return Array.isArray(e)?e.length:0}function xe(e){return typeof e=="string"&&e!==""?e:null}function nt(e){return{propertyType:xe(e.property_type),listingIntent:xe(e.listing_intent),units:ve(e.units),photos:ve(e.photos)}}function rt(e){let t=JSON.stringify(e),n=3735928559,o=1103547991;for(let s=0;s<t.length;s++){let l=t.charCodeAt(s);n=Math.imul(n^l,2654435761),o=Math.imul(o^l,1597334677)}return n=Math.imul(n^n>>>16,2246822507)^Math.imul(o^o>>>13,3266489909),o=Math.imul(o^o>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&o)+(n>>>0)).toString(16).padStart(14,"0")}function Ie(e){return{id:e.id,label:e.label,group:e.synthesized===!0?"empties":"fixtures",summary:nt(e.facts),doc:rt(e.instances),display:we(e.instances)}}function Pe(e,t){let n=e.replace(/\/+$/,"");return t==="/"?`${n}/`:`${n}${t}/`}function $e(e){let{pages:t,currentPageId:n,basePath:o}=e,s=t.find(r=>r.id===n);if(!s)throw new Error(`nav: page "${n}" is not one of the declared pages (${t.map(r=>r.id).join(", ")}).`);let l=[s,...t.filter(r=>r.id!==s.id&&r.enabled!==!1)],f={};for(let r of l)for(let m of r.sections)m.enabled===!1||m.key in f||(f[m.key]=r.id===s.id?`#${m.anchor}`:`${Pe(o,r.path)}#${m.anchor}`);return{anchors:f,pages:t.filter(r=>r.enabled!==!1).map(r=>({id:r.id,label:r.label,href:Pe(o,r.path),current:r.id===s.id}))}}function V(e,t){return e.pages?.[t]?.enabled!==!1}function te(e,t){return t.filter(n=>V(e,n.id))}var O={base:"stylesheets/base.css",template:"stylesheets/template.css"},I={frame:"__capture/frame",print:"__capture/print"};function Ee(e){return new URLSearchParams(e).toString()}function ne(e,t,n){return`${I.frame}?${Ee({fixture:e,page:t,format:n})}`}function Te(e,t){return`${I.print}?${Ee({fixture:e,format:t})}`}var q=e=>e<0?0:e>1?1:e;function F(e){if(typeof e!="object"||e===null)return null;let{nx:t=0,ny:n=0,nw:o=1,nh:s=1}=e;if(![t,n,o,s].every(m=>typeof m=="number"&&Number.isFinite(m)))return null;let l=q(t),f=q(n),r={nx:l,ny:f,nw:Math.min(q(o),1-l),nh:Math.min(q(s),1-f)};return r.nw<=0||r.nh<=0||r.nx===0&&r.ny===0&&r.nw===1&&r.nh===1?null:r}var z={file(e){return typeof e=="string"?{url:e,responsive:null}:{url:e.url,responsive:e.responsive}}};function ot(e){if(typeof e!="object"||e===null)return null;let t=e.asset_id;return typeof t=="string"&&t!==""?t:null}function st(e,t,n){if(e.file===null)return null;let o=n.crop===void 0?null:F(t.rect),s=n.crop===void 0?null:F(t.mobile_rect),l=n.file(e.file),f=o===null?{photo_id:e.id,url:l.url,alt:e.alt,responsive:l.responsive}:{photo_id:e.id,url:n.crop(e.file,o),alt:e.alt,responsive:null,rect:o};return s!==null&&(f.mobile={url:n.crop(e.file,s),responsive:null}),f}function it(e,t){return e.file===null?{video_id:e.id,url:e.url??"",poster:"",alt:e.alt,source:"link",...e.provider===null?{}:{provider:e.provider}}:{video_id:e.id,url:t.file(e.file).url,poster:"",alt:e.alt,source:"upload"}}function at(e){return{tour_id:e.id,url:e.url??"",poster:"",alt:e.alt,...e.provider===null?{}:{provider:e.provider}}}function lt(e,t){return e.file===null?null:{asset_id:e.id,url:t.file(e.file).url,filename:e.filename,content_type:e.mime,size_bytes:0}}function dt(e,t,n,o){let s=ot(t),l=s===null?void 0:n.get(s);if(l===void 0||l.kind!==e)return null;switch(e){case"image":return st(l,t,o);case"video":return it(l,o);case"tour":return at(l);case"document":return lt(l,o);default:return null}}var ct=new Set(["image","video","tour","document"]);function re(e,t,n,o){if(t==null)return t;if(ct.has(e.type))return dt(e.type,t,n,o);if(e.type!=="list"||!Array.isArray(t))return t;let s=t;if(e.fields!==void 0){let l=e.fields;return s.map(f=>{if(typeof f!="object"||f===null)return f;let r={...f};for(let[m,v]of Object.entries(l))r[m]=re(v,r[m],n,o);return r})}if(e.element!==void 0){let l=e.element;return s.map(f=>re(l,f,n,o))}return s}function ke(e,t,n,o=z){let s={};for(let[l,f]of Object.entries(e.slots)){let r=t.schema.slots[l];s[l]=r===void 0?f:re(r,f,n,o)}return s}function ut(e){return typeof e=="string"?e:e.url}function pt(e,t){return e.split(",").map(n=>{let[o="",...s]=n.trim().split(/\s+/);return[t(o),...s].join(" ")}).join(", ")}function ft(e){return{file(t){let n=z.file(t),o=n.responsive===null?null:{...n.responsive,sources:n.responsive.sources.map(s=>({...s,srcset:pt(s.srcset,e)}))};return{url:e(n.url),responsive:o}},crop(t,n){return e(z.file(t).url,{crop:n})}}}function C(e){return Array.isArray(e)?e:[]}function Ce(e,t){let{facts:n}=e,o=r=>e.media[r],s=r=>r?.file===null||r?.file===void 0?"":t(ut(r.file)),l=[];for(let r of C(n.photos)){let m=o(r.id);l.push({id:r.id,kind:"photo",name:m?.filename||r.id,size:"",src:s(m),caption:r.caption??null})}for(let r of C(n.floor_plans)){let m=o(r.id);l.push({id:r.id,kind:"plan",name:m?.filename||r.id,size:"",src:s(m)})}for(let r of C(n.videos)){let m=r.provider??void 0;l.push({id:r.id,kind:"video",name:r.caption??o(r.id)?.filename??r.id,size:"",src:"",caption:r.caption??null,ready:!0,durationMs:r.duration_ms??null,...m===void 0?{}:{provider:m}})}for(let r of C(n.tours))l.push({id:r.id,kind:"tour",name:`${r.provider??"Tour"} ${r.id}`,size:"",src:"",ready:!0,provider:r.provider??""});for(let r of C(n.documents)){let m=o(r.id)?.sizeBytes;l.push({id:r.id,kind:"document",name:r.filename??r.id,size:"",src:"",mime:r.mime??"",...m===void 0?{}:{sizeBytes:m}})}let f=[["avatar_upload_id","headshot"],["logo_dark_upload_id","logo (dark)"],["logo_light_upload_id","logo (light)"]];for(let r of C(n.contacts)){let m=typeof r.name=="string"?r.name:"Contact";for(let[v,R]of f){let x=r[v];typeof x=="string"&&l.push({id:x,kind:"library",name:`${m} \u2014 ${R}`,size:"",src:s(o(x)),caption:m})}}return l}var mt={image:["photo_id","asset_id"],video:["video_id","asset_id"],tour:["tour_id","asset_id"],document:["asset_id"]};function oe(e,t){if(t==null)return t;let n=mt[e.type];if(n!==void 0){if(typeof t!="object")return null;let s=t,l=n.map(m=>s[m]).find(m=>typeof m=="string"&&m!=="");if(typeof l!="string")return null;if(e.type!=="image")return{asset_id:l};let f=F(s.rect),r=typeof s.mobile=="object"&&s.mobile!==null?F(s.mobile.rect):null;return{asset_id:l,...f===null?{}:{rect:f},...r===null?{}:{mobile_rect:r}}}if(e.type!=="list"||!Array.isArray(t))return t;let o=t;if(e.fields!==void 0){let s=e.fields;return o.map(l=>{if(typeof l!="object"||l===null)return l;let f={...l};for(let[r,m]of Object.entries(s))r in f&&(f[r]=oe(m,f[r]));return f})}if(e.element!==void 0){let s=e.element;return o.map(l=>oe(s,l))}return o}function Ae(e){let{instance:t,slots:n,fixture:o,session:s,assetUrl:l}=e,f={...t.slots},r={},m=o.provenance[t.instance_id]??{};for(let R of Object.keys(n))r[R]=m[R]??{kind:"empty"};for(let[R,x]of Object.entries(s??{})){let A=n[R];A!==void 0&&(f[R]=oe(A,x),r[R]={kind:"session"})}let v=new Map(Object.entries(o.media));return{slots:ke({...t,slots:f},{schema:{slots:n}},v,ft(l)),provenance:r}}var He=1024*1024;function yt(e){let t=N(e),n=typeof e.width=="string"?`${e.width} \xD7 ${String(e.height)}`:void 0;return{id:e.id,label:e.label,cssWidth:t.viewportWidth,cssHeight:t.viewportHeight,bleed:t.bleed,pixelWidth:t.pixelWidth,pixelHeight:t.pixelHeight,...n===void 0?{}:{physical:n},tokens:{...M(e)}}}function ht(e,t){return new Response(t,{status:e,headers:{"content-type":"text/plain; charset=utf-8"}})}function se(e){return new Response(JSON.stringify(e),{headers:{"content-type":"application/json; charset=utf-8"}})}function ie(e){return new Response(e,{headers:{"content-type":"text/html; charset=utf-8"}})}function wt(e){if(typeof e!="object"||e===null)return null;let t=e.status;return typeof t=="number"&&Number.isInteger(t)&&t>=400&&t<600?t:null}function U(e,t,n){let o=e.searchParams.get(t);if(o===null||o==="")throw new g(400,`${n} needs a ${t} parameter.`);return o}function Rt(e){return`<script>
117
+ (function () {
118
+ try {
119
+ var src = new EventSource(${JSON.stringify(e)});
120
+ ["source:changed", "stylesheet:changed", "fixtures:changed"].forEach(function (name) {
121
+ src.addEventListener(name, function () { window.location.reload(); });
122
+ });
123
+ } catch (e) { /* no change channel; the page stays as it is */ }
124
+ })();
125
+ </script>`}function bt(e){if(e===E.catalog||e==="api/media"||e.startsWith("api/capture/")||e===I.frame||e===I.print)return!0;let[t,n,o]=e.split("/").filter(Boolean);return t==="fixtures"&&n!==void 0&&o==="live"}function Sn(e){let{reader:t,assetUrl:n,renderer:o}=e,s=(e.base??"/").endsWith("/")?e.base??"/":`${e.base??"/"}/`,l=c=>/^([a-z][a-z0-9+.-]*:|\/)/i.test(c)?c:`${s}${c}`,f=()=>[O.base,O.template].map(c=>l(n(c)));async function r(c){let{fixtures:a}=await t.fixtures(),i=a.find(d=>d.id===c);if(i===void 0){let d=a.filter(h=>h.synthesized!==!0).map(h=>h.id),p=a.length-d.length,u=[d.join(", ")||"none",...p===0?[]:[`${p} synthesized empties`]].join(", and ");throw new g(404,`There is no fixture "${c}" (have: ${u}).`)}return i}function m(c,a){let i=c.instances.find(d=>d.instance_id===a);if(i===void 0)throw new g(400,`The composition places no instance "${a}".`);return i}function v(c,a,i,d,p){if(c.output!=="website")return{selfAnchor:d,anchors:ge(),pages:[]};let u=Se(a,p),h=c.pages.map(_=>({id:_.id,label:_.label,path:_.path??`/${_.id}`,sections:_.sections.map(P=>({key:P.section,anchor:P.section,enabled:u.get(P.instanceId)!==!1}))})),w=`${s}${E.live(a.id,"/").replace(/\/$/,"")}`,b=$e({pages:h,currentPageId:i,basePath:w});return{selfAnchor:d,anchors:b.anchors,pages:b.pages}}async function R(c,a,i,d,p,u){let h=c.instances.find(X=>X.instanceId===d.instance_id);if(h===void 0)throw new Error(`The composition places no section "${d.section_key}".`);let w=_e(d,h.sectionSchema.slots,u),{slots:b,provenance:_}=Ae({instance:w,slots:h.sectionSchema.slots,fixture:a,session:p,assetUrl:n}),P=v(c,a,i,w.section_key,u),S=w.variant,H=await o.section(w.section_key);return{html:o.renderToString(o.createElement(H,{slots:b,nav:P,variant:S??""}),{identifierPrefix:w.instance_id}),resolvedProps:{slots:b,nav:P,variant:S},provenance:_}}async function x(c,a,i){let d=[];for(let p of i.sections){let u=m(a,p.instanceId);u.enabled&&d.push((await R(c,a,i.id,u,void 0,{})).html)}return d}function A(c,a,i){let d=c.pages.find(p=>p.id===a);if(d===void 0)throw new g(i,`The template declares no page "${a}".`);return d}function B(c,a){if(c.output==="website")throw new g(404,`"${c.key}" is a website \u2014 captures are for rendered templates; open its pages live instead.`);let i=a===null?c.formats[0]:c.formats.find(d=>d.id===a);if(i===void 0)throw new g(404,`The template declares no format "${a??""}" (have: ${c.formats.map(d=>d.id).join(", ")}).`);return i}async function Ne(){let c=await t.islands(),a={wire:1,islands:{map:{...c.map},hostScript:c.canvasHost,importMap:{...c.importMap}},stylesheets:[O.base,O.template].map(u=>n(u))},i,d;try{i=await t.template(),d=await t.fixtures()}catch(u){return{...a,template:{key:"",name:"",output:"website",formats:[],pages:[],canvases:[],instances:[]},fixtures:[],capabilities:{hmr:t.live,capture:!1},error:u instanceof Error?u.message:String(u)}}let p=d.problems!==void 0&&d.fixtures.length===0?`No fixture could be rendered:
126
+ ${d.problems}`:void 0;return{...a,template:{key:i.key,name:i.name,output:i.output,formats:i.output==="website"?[]:i.formats.map(yt),pages:i.pages.map(u=>({id:u.id,label:u.label,...u.path===void 0?{}:{path:u.path},instanceIds:u.sections.map(h=>h.instanceId)})),canvases:i.canvases.map(u=>({id:u.id,label:u.label,pages:[...u.pages]})),instances:i.instances.map(u=>({...u,display:he(u.display)}))},fixtures:d.fixtures.map(Ie),capabilities:{hmr:t.live,capture:i.output!=="website"&&t.capture!==void 0},...p===void 0?{}:{error:p}}}async function Me(c){if(c.method!=="POST")throw new g(405,`POST a render request to ${E.render}.`);let a=await c.text();if(new TextEncoder().encode(a).byteLength>He)throw new g(413,`request body exceeds ${He} bytes`);let i;try{i=a===""?void 0:JSON.parse(a)}catch(b){throw new g(400,`request body is not JSON: ${b instanceof Error?b.message:String(b)}`)}if(i===void 0||typeof i.page!="string"||typeof i.instance!="string"||typeof i.fixture!="string")throw new g(400,"A render request names a page, an instance and a fixture.");let d=typeof i.session=="object"&&i.session!==null?i.session:{},p=Re(i.display),u=await t.template(),h=await r(i.fixture),w=A(u,i.page,400);return be(u,p),R(u,h,w.id,m(h,i.instance),d.slots,p)}async function De(c){let a=await r(U(c,"fixture","api/media"));return{items:Ce(a,n)}}async function Oe(c,a){let i=await t.template();if(i.output!=="website")throw new g(404,`"${i.key}" is a rendered ${i.output} template and has no live pages \u2014 preview it on the canvas.`);let d=i.pages.find(h=>h.path===a);if(d===void 0){let h=i.pages.map(w=>w.path??w.id).join(", ");throw new g(404,`The template declares no page at "${a}" (have: ${h}).`)}let p=await r(c),u=await x(i,p,d);return k({destination:"preview",root:{kind:"plain",bodyHtml:u.join(`
127
+ `)},islands:(await t.islands()).documentLoader,stylesheets:{kind:"links",hrefs:f()},title:`${i.name} \u2014 ${d.label}`,extraCss:["html, body { background: #fff; }"],...t.live?{devScripts:[Rt(`${s}${E.hmr}`)]}:{}})}function ae(c,a,i){let d=A(c,i,404);if(!V(a,d.id))throw new g(404,`The fixture "${a.id}" switches the page "${d.id}" off, so it has no capture.`);return d}async function Fe(c){let a=I.frame,i=await t.template(),d=B(i,c.searchParams.get("format")),p=await r(U(c,"fixture",a)),u=ae(i,p,U(c,"page",a));return k({destination:"artifact",root:{kind:"frame",format:d,sectionHtml:await x(i,p,u)},islands:(await t.islands()).documentLoader,stylesheets:{kind:"links",hrefs:f()},title:`${i.name} \u2014 ${u.id}`})}async function Ue(c){let a=await t.template(),i=B(a,c.searchParams.get("format"));if(a.output!=="document")throw new g(404,`"${a.key}" is an ${a.output} template \u2014 a PDF is for the document class; download its pages as a zip.`);let d=await r(U(c,"fixture",I.print)),p=[];for(let u of te(d,a.pages))p.push(await x(a,d,u));if(p.length===0)throw new g(404,`The fixture "${d.id}" switches every page off, so it has no PDF.`);return k({destination:"artifact",root:{kind:"frameStack",format:i,pages:p},islands:(await t.islands()).documentLoader,stylesheets:{kind:"links",hrefs:f()},title:`${a.name} \u2014 print`})}async function je(c,a){let i=c;if(i!=="screenshot"&&i!=="bundle"&&i!=="print")throw new g(404,`There is no capture at ${a.pathname}.`);let d=U(a,"fixture",`api/capture/${i}`),p=await t.template(),u=B(p,a.searchParams.get("format")),h=await r(d),w,b,_;if(i==="screenshot"){let S=a.searchParams.get("page")??te(h,p.pages)[0]?.id;if(S===void 0)throw new g(404,`The fixture "${d}" leaves no page on.`);ae(p,h,S),w={kind:i,fixture:d,format:u,documents:[{path:ne(d,S,u.id),page:S,name:`${S}.png`}]},b="image/png",_=`${p.key}-${S}-${u.id}.png`}else if(i==="bundle"){if(p.output!=="image")throw new g(404,`"${p.key}" is a ${p.output} template \u2014 the zip is for the image class; a document downloads its PDF.`);let S=a.searchParams.get("canvas"),H=S===null?p.canvases[0]:p.canvases.find($=>$.id===S);if(H===void 0)throw new g(404,`The template declares no canvas "${S??""}".`);let G=H.pages.filter($=>V(h,$));if(G.length===0)throw new g(404,`The fixture "${d}" switches every page of the canvas "${H.id}" off, so it has no zip.`);let X=G.map($=>({path:ne(d,$,u.id),page:$,name:`${p.pages.find(We=>We.id===$)?.label||$}.png`}));w={kind:i,fixture:d,format:u,documents:X},b="application/zip",_=`${p.key}-${u.id}.zip`}else{if(p.output!=="document")throw new g(404,`"${p.key}" is an ${p.output} template \u2014 a PDF is for the document class; download its pages as a zip.`);w={kind:i,fixture:d,format:u,documents:[{path:Te(d,u.id),page:null,name:`${p.key}.pdf`}]},b="application/pdf",_=`${p.key}.pdf`}if(t.capture===void 0)throw new g(501,"This playground has no captures to give.");let P=await t.capture(w);return new Response(new Uint8Array(P),{headers:{"content-type":b,"content-disposition":`attachment; filename="${encodeURIComponent(_)}"`}})}async function Le(c,a,i){if(i===E.render)return se(await Me(c));if(c.method!=="GET"&&c.method!=="HEAD"&&bt(i))throw new g(405,`${i} only reads; the playground accepts no uploads and writes nothing.`);if(i===E.catalog)return se(await Ne());if(i==="api/media")return se(await De(a));if(i.startsWith("api/capture/"))return je(i.slice(12),a);if(i===I.frame)return ie(await Fe(a));if(i===I.print)return ie(await Ue(a));let[d,p,u,h,...w]=i.split("/").filter(Boolean);if(d==="fixtures"&&p!==void 0&&u==="live"){if(w.length>0)throw new g(404,`There is no route at ${a.pathname}.`);return ie(await Oe(decodeURIComponent(p),h===void 0?"/":`/${decodeURIComponent(h)}`))}return null}return{async handle(c){let a=new URL(c.url);if(!a.pathname.startsWith(s)&&`${a.pathname}/`!==s)return null;let i=a.pathname.slice(s.length);try{return await Le(c,a,i)}catch(d){let p=wt(d);if(p===null)throw d;return ht(p,d instanceof Error?d.message:String(d))}}}}export{Sn as createHost};
@@ -0,0 +1,99 @@
1
+ //#region src/asset-modules.d.ts
2
+ /**
3
+ * The object a derived raster import yields — structurally identical to the exported
4
+ * `AuthorImage`, which is the name to use in your own code. Declared here because this
5
+ * file cannot import one.
6
+ */
7
+ interface TemplateAuthorImage {
8
+ url: string;
9
+ responsive: {
10
+ sources: {
11
+ type: string;
12
+ srcset: string;
13
+ }[];
14
+ width: number;
15
+ height: number;
16
+ } | null;
17
+ width: number;
18
+ height: number;
19
+ }
20
+ declare module "*.png" {
21
+ const image: TemplateAuthorImage;
22
+ export default image;
23
+ }
24
+ declare module "*.jpg" {
25
+ const image: TemplateAuthorImage;
26
+ export default image;
27
+ }
28
+ declare module "*.jpeg" {
29
+ const image: TemplateAuthorImage;
30
+ export default image;
31
+ }
32
+ declare module "*.webp" {
33
+ const image: TemplateAuthorImage;
34
+ export default image;
35
+ }
36
+ declare module "*.avif" {
37
+ const image: TemplateAuthorImage;
38
+ export default image;
39
+ }
40
+ declare module "*.svg" {
41
+ const src: string;
42
+ export default src;
43
+ }
44
+ declare module "*.gif" {
45
+ const src: string;
46
+ export default src;
47
+ }
48
+ declare module "*.ico" {
49
+ const src: string;
50
+ export default src;
51
+ }
52
+ declare module "*.woff" {
53
+ const src: string;
54
+ export default src;
55
+ }
56
+ declare module "*.woff2" {
57
+ const src: string;
58
+ export default src;
59
+ }
60
+ declare module "*.ttf" {
61
+ const src: string;
62
+ export default src;
63
+ }
64
+ declare module "*.otf" {
65
+ const src: string;
66
+ export default src;
67
+ }
68
+ declare module "*.eot" {
69
+ const src: string;
70
+ export default src;
71
+ }
72
+ declare module "*.mp4" {
73
+ const src: string;
74
+ export default src;
75
+ }
76
+ declare module "*.webm" {
77
+ const src: string;
78
+ export default src;
79
+ }
80
+ declare module "*.mov" {
81
+ const src: string;
82
+ export default src;
83
+ }
84
+ declare module "*.mp3" {
85
+ const src: string;
86
+ export default src;
87
+ }
88
+ declare module "*.wav" {
89
+ const src: string;
90
+ export default src;
91
+ }
92
+ declare module "*.pdf" {
93
+ const src: string;
94
+ export default src;
95
+ }
96
+ declare module "*.zip" {
97
+ const src: string;
98
+ export default src;
99
+ }
package/dist/base.css ADDED
@@ -0,0 +1,220 @@
1
+ @layer theme, base, components, sections, template, utilities;
2
+
3
+ /* @homepages/concrete — the base stylesheet every template's page loads.
4
+ *
5
+ * Exported as `@homepages/concrete/base.css`. It is NOT part of the Tailwind
6
+ * entry (that is styles.css); it ships as its own stylesheet on the page.
7
+ *
8
+ * Contains:
9
+ * - The cascade-layer order declaration above — the one place it is stated
10
+ * - The three reset gaps Tailwind's preflight leaves (below)
11
+ * - The section box model (.tr-section, emitted by the <Section> primitive)
12
+ * - The frame shell's static half (.tr-frame, emitted by the <FrameShell> primitive)
13
+ * and the window witness that holds every host to the geometry it owes that shell
14
+ * - The <Image>/<Video>/<Tour> box's geometry default (.tr-image-block), layered so
15
+ * an author's own width utility beats it
16
+ * - The <Image>/<Video> frame's placeholder fill (.tr-image-frame)
17
+ * - Universal tokens: motion
18
+ *
19
+ * REQUIRES A TAILWIND ENTRY ON THE PAGE. Your entry's `@import "tailwindcss"` brings
20
+ * Tailwind's preflight, and preflight does the reset: box-sizing, margin/padding,
21
+ * list-style, the button and anchor resets, display:block on replaced elements. This
22
+ * file only fills the three gaps preflight leaves. Ship base.css without a Tailwind
23
+ * entry and you get an unreset page.
24
+ *
25
+ * NOT here: anything a template owns. Colors, fonts, type, radii, shadows and layout
26
+ * — and the `body` document defaults that apply them — all come from the template's
27
+ * own CSS. This file references no template token at all.
28
+ */
29
+
30
+ /* ----- Reset gaps ------------------------------------------------------- *
31
+ * The four declarations Tailwind's preflight does NOT make. Each is load-bearing:
32
+ * delete one and your page changes.
33
+ *
34
+ * Wrapped in `@layer base` so Tailwind's utilities (which compile into
35
+ * `@layer utilities`) win over these element defaults. Unlayered, `button { cursor:
36
+ * pointer }` would beat a layered `.cursor-default` utility outright — unlayered
37
+ * always wins over layered in the cascade.
38
+ */
39
+
40
+ @layer base {
41
+ /* preflight carries no font-smoothing rule at all */
42
+ body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
43
+ /* Tailwind v4 deliberately leaves buttons at the UA default `cursor: default` */
44
+ button { cursor: pointer; }
45
+ /* preflight caps max-width on img and video, but not on svg */
46
+ svg { max-width: 100%; }
47
+ /* A <source> carries no content and never renders, but nothing says so: the UA sheet
48
+ * leaves it an ordinary box and preflight does not touch it. That is inert until a
49
+ * `display: contents` <picture> puts its children in someone else's formatting
50
+ * context — which is exactly what <Image> does so the <img> is the caller's own flex
51
+ * or grid child. Without this, every alternate format in the ladder is a real item in
52
+ * that caller's box: a two-column card gets a phantom first row and its row gap, and
53
+ * only on a page whose assets have a multi-format ladder to begin with. */
54
+ source { display: none; }
55
+ }
56
+
57
+ /* ----- Primitives ------------------------------------------------------- *
58
+ * Layered like the reset gaps and for the same reason: these are the primitives'
59
+ * DEFAULTS, and an author's utility on the same element must win over them. What an
60
+ * author may not override is a contract question, and `concrete check` grades it
61
+ * (section-root-margin) — never cascade position, which would discard the author's
62
+ * declaration with no signal.
63
+ */
64
+
65
+ @layer base {
66
+ /* The full-bleed section root, emitted by the <Section> primitive. Zero margin is
67
+ * the contract that lets adjacent sections butt edge-to-edge, so a page composes as
68
+ * a vertical stack with no framework-injected whitespace; padding is the author's —
69
+ * on this root or a child, the background still paints edge-to-edge under it. */
70
+ .tr-section {
71
+ display: block;
72
+ width: 100%;
73
+ padding: 0;
74
+ margin: 0;
75
+ }
76
+
77
+ /* The frame shell's static half, emitted by the <FrameShell> primitive. The frame
78
+ * is a viewport: every host owes a frame document a window that is exactly the
79
+ * format's BLEED box, and the root fills it — viewport units and geometry @media in
80
+ * sections read the window and get frame geometry by construction. No size
81
+ * container here: containers inside sections are ordinary component styling. The
82
+ * root clips at its own edge to match capture, and stacks its direct children —
83
+ * the page's sections — as a rigid flex column.
84
+ *
85
+ * position: relative is for the witness below and nothing else. It positions
86
+ * against a box identical to the one it would otherwise use (the root fills the
87
+ * window exactly), so it moves no author content; what it buys is a stacked print
88
+ * document, where each shell then anchors its own witness on its own sheet. */
89
+ .tr-frame {
90
+ position: relative;
91
+ width: 100vw;
92
+ height: 100vh;
93
+ overflow: clip;
94
+ display: flex;
95
+ flex-direction: column;
96
+
97
+ /* The window the host owes this document: the bleed box, i.e. the trim box
98
+ * extended symmetrically by the bleed. */
99
+ --tr-frame-window-w: calc(var(--frame-w) + 2 * var(--frame-bleed));
100
+ --tr-frame-window-h: calc(var(--frame-h) + 2 * var(--frame-bleed));
101
+
102
+ /* 1 when the real window misses the owed one on either axis, 0 when it does not.
103
+ * max(d, -d) is an absolute difference and `/ 1px` makes it a plain number. The
104
+ * -1 is the tolerance: a browser window is whole CSS px while a physical format's
105
+ * box is fractional, so a capturer rounds and is right to. Multiplying past the
106
+ * tolerance saturates the clamp, so the witness is on or off, never faded. */
107
+ --tr-frame-window-mismatch: clamp(
108
+ 0,
109
+ (
110
+ max(
111
+ (100vw - var(--tr-frame-window-w)) / 1px,
112
+ (var(--tr-frame-window-w) - 100vw) / 1px,
113
+ (100vh - var(--tr-frame-window-h)) / 1px,
114
+ (var(--tr-frame-window-h) - 100vh) / 1px
115
+ ) - 1
116
+ ) * 10000,
117
+ 1
118
+ );
119
+ }
120
+
121
+ /* The window witness. A frame document is the only place that holds both halves of
122
+ * the host's obligation — the geometry the format declares (the tokens) and the
123
+ * window the host actually gave (100vw/100vh) — so it is the only place the
124
+ * obligation can be checked rather than trusted. Stated in CSS, in the base
125
+ * stylesheet every frame document links, so no host opts in and none can forget.
126
+ *
127
+ * Silent when the two agree: fully transparent, absolutely positioned (never a flex
128
+ * item in the rigid stack), so a correctly windowed document renders byte-identical
129
+ * pixels and identical layout to one with no witness at all. On a mismatch it covers
130
+ * the artifact and names both geometries, because a frame measured against the wrong
131
+ * box is not a preview of anything and must not read as one. */
132
+ .tr-frame::after {
133
+ counter-reset:
134
+ tr-frame-owed-w calc(var(--tr-frame-window-w) / 1px)
135
+ tr-frame-owed-h calc(var(--tr-frame-window-h) / 1px)
136
+ tr-frame-got-w calc(100vw / 1px)
137
+ tr-frame-got-h calc(100vh / 1px);
138
+ content: "FRAME WINDOW MISMATCH — this format declares a "
139
+ counter(tr-frame-owed-w) "×" counter(tr-frame-owed-h)
140
+ " window; the host gave " counter(tr-frame-got-w) "×" counter(tr-frame-got-h)
141
+ ". Every viewport unit and geometry query in this frame is resolving against the wrong box.";
142
+ position: absolute;
143
+ inset: 0;
144
+ z-index: 2147483647;
145
+ display: flex;
146
+ align-items: center;
147
+ justify-content: center;
148
+ text-align: center;
149
+ padding: 6%;
150
+ background: #b3261e;
151
+ color: #ffffff;
152
+ font: 700 clamp(11px, 2.2vw, 26px)/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
153
+ opacity: var(--tr-frame-window-mismatch);
154
+ pointer-events: none;
155
+ }
156
+
157
+ /* Imposed from OUTSIDE <Section>, which stays byte-identical across output classes:
158
+ * without it flexbox would compress an overflowing stack to fit, hiding the overflow
159
+ * the author must be able to see. */
160
+ .tr-frame > * {
161
+ flex-shrink: 0;
162
+ }
163
+
164
+ /* The geometry DEFAULT of every <Image>/<Video>/<Tour> box — the unframed element
165
+ * itself, and the framed wrapper. It is a class here rather than the `block w-full` the
166
+ * primitives used to prepend to the caller's className, because a utility cannot serve
167
+ * as a default: both would compile into `@layer utilities` and tie on layer AND on
168
+ * specificity, leaving sheet order to decide — and Tailwind emits `.w-full` after
169
+ * `w-auto`, `size-*` and every arbitrary `w-[…]`, so the author's width lost and the
170
+ * element silently drew at its parent's full width. Three shipped incidents in a month
171
+ * were each fixed by hand with an `!`. Layered, an authored width wins outright and
172
+ * needs none.
173
+ *
174
+ * Deliberately separate from .tr-image-frame below, which templates apply by hand to
175
+ * boxes of their own — flex items, a rail card, a button. Those want the fill and not
176
+ * this geometry, so the two must not be one class.
177
+ *
178
+ * Nothing else belongs here: the box is the caller's. `relative` and `overflow-hidden`
179
+ * stay utilities on the framed wrapper, where the <img> absolutely fills it — those are
180
+ * the frame's contract, not a default an author may replace. */
181
+ .tr-image-block {
182
+ display: block;
183
+ width: 100%;
184
+ }
185
+
186
+ /* The <Image>/<Video> frame's placeholder fill, showing while an asset is absent or
187
+ * loading. It is a plain class rather than a `bg-*` utility on the primitive because a
188
+ * template names its own tokens — there is no colour token these primitives may assume
189
+ * exists. Both frames share this one class (and one token) deliberately: the fill is the
190
+ * same neutral rect, so a template retints it once. Templates also apply it by hand to
191
+ * their own gallery boxes for that fill alone, so it carries no geometry.
192
+ * Retint it by setting --tr-image-frame-bg in your theme's layout tokens. */
193
+ .tr-image-frame {
194
+ background-color: var(--tr-image-frame-bg, oklch(0.97 0 0));
195
+ }
196
+ }
197
+
198
+ /* ----- Universal tokens ------------------------------------------------- */
199
+
200
+ :root {
201
+ /* Motion */
202
+ --tr-duration-fast: 150ms;
203
+ --tr-duration-base: 250ms;
204
+ --tr-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
205
+
206
+ /* The height of the window this page is being viewed in — what `100svh` means
207
+ * on a published page, which is what this resolves to there and in a frame
208
+ * document, whose window is the format's own bleed box.
209
+ *
210
+ * It is a token rather than the unit written in place because an editing
211
+ * canvas has no window to speak of: it lays the page out at a real width but
212
+ * measures the rendered result for its height, so `100svh` inside one names a
213
+ * box the section's own height is what determines, and a section asking for it
214
+ * grows on every pass without ever settling. The canvas kernel redeclares this
215
+ * token as the screen its card stands for — a constant, so one pass settles it
216
+ * — and a box sized from the window therefore writes ONE thing and is honest on
217
+ * both surfaces. Spell it as a floor (`min-height`), never a fixed height, so
218
+ * content taller than a screen still grows the box instead of overflowing it. */
219
+ --tr-window-h: 100svh;
220
+ }
@@ -0,0 +1,18 @@
1
+ //#region src/browser/site-config.d.ts
2
+ /** The per-site config a published page embeds, read back by {@link readSiteConfig}. */
3
+ interface SiteConfig {
4
+ siteId: string;
5
+ siteSecret: string;
6
+ ingestBase: string;
7
+ }
8
+ /** Read the per-site config a published page embeds as `#tr-site-config`. Null when absent or incomplete. */
9
+ declare function readSiteConfig(): SiteConfig | null;
10
+ /** HMAC-SHA256 a message with a hex-encoded secret, returning the signature as lowercase hex. */
11
+ declare function hmacHex(secretHex: string, message: string): Promise<string>;
12
+ /**
13
+ * The signed header set every ingest request carries:
14
+ * `X-Signature` = hex(hmac_sha256(siteSecret, `${unixSeconds}.${body}`)).
15
+ */
16
+ declare function signedIngestHeaders(config: SiteConfig, body: string): Promise<Record<string, string>>;
17
+ //#endregion
18
+ export { SiteConfig, hmacHex, readSiteConfig, signedIngestHeaders };
@@ -0,0 +1,56 @@
1
+ //#region src/browser/site-config.ts
2
+ /** Read the per-site config a published page embeds as `#tr-site-config`. Null when absent or incomplete. */
3
+ function readSiteConfig() {
4
+ const el = document.getElementById("tr-site-config");
5
+ if (!el?.textContent) return null;
6
+ try {
7
+ const config = JSON.parse(el.textContent);
8
+ if (!config.siteId || !config.siteSecret || !config.ingestBase) return null;
9
+ return config;
10
+ } catch {
11
+ return null;
12
+ }
13
+ }
14
+ /**
15
+ * Decode hex to bytes. Always ArrayBuffer-backed (never SharedArrayBuffer), so the
16
+ * result satisfies the BufferSource parameter of crypto.subtle.importKey — but that
17
+ * generic stays out of this public signature: on TypeScript < 5.7, `Uint8Array` isn't
18
+ * generic at all, and writing `Uint8Array<ArrayBuffer>` here would fail every
19
+ * consumer's build below that floor (TS2315) for a detail only this module's own
20
+ * `crypto.subtle.importKey` call needs.
21
+ */
22
+ function hexToBytes(hex) {
23
+ if (hex.length % 2 !== 0) throw new Error("hexToBytes: odd-length hex string");
24
+ if (!/^[0-9a-fA-F]*$/.test(hex)) throw new Error("hexToBytes: invalid hex string");
25
+ const out = new Uint8Array(/* @__PURE__ */ new ArrayBuffer(hex.length / 2));
26
+ for (let i = 0; i < out.length; i++) out[i] = parseInt(hex.slice(i * 2, i * 2 + 2), 16);
27
+ return out;
28
+ }
29
+ function bytesToHex(buf) {
30
+ return Array.from(new Uint8Array(buf)).map((b) => b.toString(16).padStart(2, "0")).join("");
31
+ }
32
+ /** HMAC-SHA256 a message with a hex-encoded secret, returning the signature as lowercase hex. */
33
+ async function hmacHex(secretHex, message) {
34
+ const key = await crypto.subtle.importKey("raw", hexToBytes(secretHex), {
35
+ name: "HMAC",
36
+ hash: "SHA-256"
37
+ }, false, ["sign"]);
38
+ return bytesToHex(await crypto.subtle.sign("HMAC", key, new TextEncoder().encode(message)));
39
+ }
40
+ /**
41
+ * The signed header set every ingest request carries:
42
+ * `X-Signature` = hex(hmac_sha256(siteSecret, `${unixSeconds}.${body}`)).
43
+ */
44
+ async function signedIngestHeaders(config, body) {
45
+ const ts = Math.floor(Date.now() / 1e3).toString();
46
+ const signature = await hmacHex(config.siteSecret, `${ts}.${body}`);
47
+ return {
48
+ "Content-Type": "application/json",
49
+ "X-Site-Id": config.siteId,
50
+ "X-Timestamp": ts,
51
+ "X-Signature": signature
52
+ };
53
+ }
54
+
55
+ //#endregion
56
+ export { bytesToHex, hexToBytes, hmacHex, readSiteConfig, signedIngestHeaders };