@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
package/dist/index.js ADDED
@@ -0,0 +1,37 @@
1
+ import { version } from "./packages/external/concrete/package.js";
2
+ import { ATTR_ISLAND_FRAMELESS, ATTR_ISLAND_ID, ATTR_ISLAND_KEY, ATTR_ISLAND_PROPS, EDITOR_BRIDGE_PROP, EDITOR_BRIDGE_PROTOCOL, ISLAND_CAPTURE_HOLDS_GLOBAL, ISLAND_ELEMENT, IslandPropsError, deserializeIslandProps, islandId, serializeIslandProps } from "./packages/internal/island-runtime/dist/contract.js";
3
+ import { useEditor } from "./packages/internal/island-runtime/dist/use-editor.js";
4
+ import { useCaptureReady } from "./packages/internal/island-runtime/dist/use-capture-ready.js";
5
+ import { IslandMarker } from "./islands/marker.js";
6
+ import { bindItems } from "./primitives/slot-bindings.js";
7
+ import { compute } from "./schema/compute.js";
8
+ import { section } from "./section/section.js";
9
+ import { defineTemplate } from "./template/define-template.js";
10
+ import { rule, set } from "./template/reconcile.js";
11
+ import { FrameShell } from "./primitives/FrameShell.js";
12
+ import { ATTR_SECTION_INSTANCE_ID, ATTR_SLOT_FIELD, ATTR_SLOT_GROUP, ATTR_SLOT_ID, ATTR_SLOT_ITEM, ATTR_SLOT_TEXT_LEAF, ATTR_SLOT_UNSELECTABLE, ATTR_TR_ENHANCE } from "./packages/internal/template-contracts/dist/markers.js";
13
+ import { Image } from "./primitives/Image.js";
14
+ import { Section } from "./primitives/Section.js";
15
+ import { SlotGroup } from "./primitives/slot-group.js";
16
+ import { Tour } from "./primitives/Tour.js";
17
+ import { Video } from "./primitives/Video.js";
18
+ import { Slot } from "./primitives/slot.js";
19
+ import { document, image, list, number, poi, select, text, tour, url, video } from "./schema/slot-builders.js";
20
+ import { fact } from "./schema/fact.js";
21
+ import { chooseFrom, contactAssign, documentAssign, imageAssign, listFill, nameRows, textBlock, tourAssign, videoAssign } from "./schema/fill-builders.js";
22
+ import { presets } from "./schema/format-presets.js";
23
+ import { a4Landscape, a4Portrait, deck16x9, facebookPost, halfLetterFlyer, instagramPortrait, instagramSquare, instagramStory, letterLandscape, letterPortrait, linkedinPost, postcard6x4, postcard7x5, website, xPost } from "./schema/formats.js";
24
+
25
+ //#region src/index.ts
26
+ /**
27
+ * The published version of this package.
28
+ *
29
+ * Read from package.json and inlined at build time, so it cannot drift: changesets
30
+ * owns package.json's version, and a hardcoded constant would have to be hand-edited
31
+ * on every release. src/index.test.ts asserts it against package.json to prove the
32
+ * inlining actually happened.
33
+ */
34
+ const CONCRETE_VERSION = version;
35
+
36
+ //#endregion
37
+ export { ATTR_ISLAND_FRAMELESS, ATTR_ISLAND_ID, ATTR_ISLAND_KEY, ATTR_ISLAND_PROPS, ATTR_SECTION_INSTANCE_ID, ATTR_SLOT_FIELD, ATTR_SLOT_GROUP, ATTR_SLOT_ID, ATTR_SLOT_ITEM, ATTR_SLOT_TEXT_LEAF, ATTR_SLOT_UNSELECTABLE, ATTR_TR_ENHANCE, CONCRETE_VERSION, EDITOR_BRIDGE_PROP, EDITOR_BRIDGE_PROTOCOL, FrameShell, ISLAND_CAPTURE_HOLDS_GLOBAL, ISLAND_ELEMENT, Image, IslandMarker, IslandPropsError, Section, Slot, SlotGroup, Tour, Video, a4Landscape, a4Portrait, bindItems, chooseFrom, compute, contactAssign, deck16x9, defineTemplate, deserializeIslandProps, document, documentAssign, facebookPost, fact, halfLetterFlyer, image, imageAssign, instagramPortrait, instagramSquare, instagramStory, islandId, letterLandscape, letterPortrait, linkedinPost, list, listFill, nameRows, number, poi, postcard6x4, postcard7x5, presets, rule, section, select, serializeIslandProps, set, text, textBlock, tour, tourAssign, url, useCaptureReady, useEditor, video, videoAssign, website, xPost };
@@ -0,0 +1,97 @@
1
+ import { createPathsResolver } from "../cli/dev/tsconfig-paths.js";
2
+ import { readFileSync, statSync } from "node:fs";
3
+ import { dirname, resolve } from "node:path";
4
+ import ts from "typescript";
5
+
6
+ //#region src/islands/client-module.ts
7
+ /**
8
+ * Whether source text opens with a `"use client"` directive — among the leading
9
+ * string-literal statements (the directive prologue). Anything else ends the prologue.
10
+ */
11
+ function hasClientDirective(text) {
12
+ let i = 0;
13
+ while (i < text.length) {
14
+ const rest = text.slice(i);
15
+ const ws = /^\s+/.exec(rest);
16
+ if (ws) {
17
+ i += ws[0].length;
18
+ continue;
19
+ }
20
+ const line = /^\/\/[^\n]*/.exec(rest);
21
+ if (line) {
22
+ i += line[0].length;
23
+ continue;
24
+ }
25
+ const block = /^\/\*[\s\S]*?\*\//.exec(rest);
26
+ if (block) {
27
+ i += block[0].length;
28
+ continue;
29
+ }
30
+ const directive = /^(["'])([^"']*)\1\s*;?/.exec(rest);
31
+ if (!directive) return false;
32
+ if (directive[2] === "use client") return true;
33
+ i += directive[0].length;
34
+ }
35
+ return false;
36
+ }
37
+ const clientFiles = /* @__PURE__ */ new Map();
38
+ const pathsResolvers = /* @__PURE__ */ new Map();
39
+ function mtimeOf(path) {
40
+ try {
41
+ const stat = statSync(path);
42
+ return stat.isFile() ? stat.mtimeMs : void 0;
43
+ } catch {
44
+ return;
45
+ }
46
+ }
47
+ /** Whether the file at `path` opens with a `"use client"` directive. An unreadable or missing file is not a client module. */
48
+ function isClientFile(path) {
49
+ const absolute = resolve(path);
50
+ const mtime = mtimeOf(absolute);
51
+ if (mtime === void 0) return false;
52
+ const key = `${absolute}:${mtime}`;
53
+ const hit = clientFiles.get(key);
54
+ if (hit !== void 0) return hit;
55
+ let answer;
56
+ try {
57
+ answer = hasClientDirective(readFileSync(absolute, "utf8"));
58
+ } catch {
59
+ answer = false;
60
+ }
61
+ clientFiles.set(key, answer);
62
+ return answer;
63
+ }
64
+ const SOURCE_EXTS = [
65
+ ".tsx",
66
+ ".ts",
67
+ ".jsx",
68
+ ".js"
69
+ ];
70
+ function firstFile(base) {
71
+ const candidates = [];
72
+ const emitted = /\.(js|jsx)$/.exec(base);
73
+ if (emitted) candidates.push(...SOURCE_EXTS.map((ext) => base.slice(0, -emitted[0].length) + ext));
74
+ candidates.push(base, ...SOURCE_EXTS.map((ext) => base + ext), ...SOURCE_EXTS.map((ext) => `${base}/index${ext}`));
75
+ return candidates.find((candidate) => mtimeOf(candidate) !== void 0) ?? null;
76
+ }
77
+ /** The tsconfig `paths` resolver of the nearest tsconfig.json above `fromFile`, or `null`. */
78
+ function pathsResolverFor(fromFile) {
79
+ const config = ts.findConfigFile(dirname(fromFile), (file) => ts.sys.fileExists(file));
80
+ if (config === void 0) return null;
81
+ const key = `${config}:${mtimeOf(config)}`;
82
+ if (!pathsResolvers.has(key)) pathsResolvers.set(key, createPathsResolver(ts, dirname(config)));
83
+ return pathsResolvers.get(key) ?? null;
84
+ }
85
+ /**
86
+ * The workspace file an import specifier, written in `fromFile`, names: a relative
87
+ * specifier, or one mapped by the workspace tsconfig's `paths` (the scaffold's `@/*`).
88
+ * `null` for a package specifier, or when no candidate is a real file.
89
+ */
90
+ function resolveImportedFile(specifier, fromFile) {
91
+ if (specifier.startsWith(".")) return firstFile(resolve(dirname(fromFile), specifier));
92
+ const mapped = pathsResolverFor(resolve(fromFile))?.(specifier);
93
+ return mapped === void 0 ? null : firstFile(mapped);
94
+ }
95
+
96
+ //#endregion
97
+ export { hasClientDirective, isClientFile, resolveImportedFile };
@@ -0,0 +1,43 @@
1
+ import { IslandProps } from "../packages/internal/island-runtime/dist/contract.js";
2
+ import { ReactNode } from "react";
3
+ //#region src/islands/marker.d.ts
4
+ /** Props for {@link IslandMarker}. */
5
+ interface IslandMarkerProps {
6
+ /** `<section-key>:<ComponentName>` — the key the browser loader resolves the module by. */
7
+ islandKey: string;
8
+ /** Unique in the document, stable across re-renders of this island. Compose with `islandId()`. */
9
+ islandId: string;
10
+ /** Strictly JSON-serializable. A bad prop throws IslandPropsError here, at render time. */
11
+ props: IslandProps;
12
+ /**
13
+ * The client component, server-rendered. Omitted for an island with no server-rendered
14
+ * first frame — the marker then declares itself frameless (see {@link IslandMarker}).
15
+ */
16
+ children?: ReactNode;
17
+ }
18
+ /**
19
+ * Wrap a client component's server-rendered output in the island DOM shape: a
20
+ * layout-invisible custom element carrying the island's key and id, plus a sibling
21
+ * `<script type="application/json">` payload the browser runtime reads the props
22
+ * back out of. This is the one place that shape is written — every renderer and
23
+ * every "use client" wrapping goes through it.
24
+ *
25
+ * Both nodes set `suppressHydrationWarning`, scoped to themselves (it does not
26
+ * descend, so a real mismatch inside the island still reports). A NESTED island's
27
+ * marker is rendered on the client as well as the server — that is what lets its
28
+ * parent island's client render match the markup SSR produced — and `islandId` comes
29
+ * from `useId`, which counts from the root of the tree being rendered. The server
30
+ * renders a whole section under an `identifierPrefix`; the client hydrates a subtree
31
+ * rooted at one marker, with no prefix. The two ids therefore diverge by construction
32
+ * and cannot be reconciled by passing a prefix. That divergence is inert: React leaves
33
+ * the server's ids in the DOM, the marker and its payload come from the same `islandId`
34
+ * in one render so they stay paired under either outcome, and a nested marker's id is
35
+ * never read — `hydrateIslands` skips nested markers, leaving them to their parent.
36
+ *
37
+ * No children means no server-rendered output, and the marker says so on itself with
38
+ * `data-tr-island-frameless` — the browser loader mounts such an island fresh rather
39
+ * than hydrating it against markup that was never emitted.
40
+ */
41
+ declare function IslandMarker({ islandKey, islandId, props, children }: IslandMarkerProps): ReactNode;
42
+ //#endregion
43
+ export { IslandMarker, IslandMarkerProps };
@@ -0,0 +1,44 @@
1
+ import { ATTR_ISLAND_FRAMELESS, ATTR_ISLAND_ID, ATTR_ISLAND_KEY, ATTR_ISLAND_PROPS, ISLAND_ELEMENT, serializeIslandProps } from "../packages/internal/island-runtime/dist/contract.js";
2
+ import { Fragment, createElement } from "react";
3
+
4
+ //#region src/islands/marker.tsx
5
+ /**
6
+ * Wrap a client component's server-rendered output in the island DOM shape: a
7
+ * layout-invisible custom element carrying the island's key and id, plus a sibling
8
+ * `<script type="application/json">` payload the browser runtime reads the props
9
+ * back out of. This is the one place that shape is written — every renderer and
10
+ * every "use client" wrapping goes through it.
11
+ *
12
+ * Both nodes set `suppressHydrationWarning`, scoped to themselves (it does not
13
+ * descend, so a real mismatch inside the island still reports). A NESTED island's
14
+ * marker is rendered on the client as well as the server — that is what lets its
15
+ * parent island's client render match the markup SSR produced — and `islandId` comes
16
+ * from `useId`, which counts from the root of the tree being rendered. The server
17
+ * renders a whole section under an `identifierPrefix`; the client hydrates a subtree
18
+ * rooted at one marker, with no prefix. The two ids therefore diverge by construction
19
+ * and cannot be reconciled by passing a prefix. That divergence is inert: React leaves
20
+ * the server's ids in the DOM, the marker and its payload come from the same `islandId`
21
+ * in one render so they stay paired under either outcome, and a nested marker's id is
22
+ * never read — `hydrateIslands` skips nested markers, leaving them to their parent.
23
+ *
24
+ * No children means no server-rendered output, and the marker says so on itself with
25
+ * `data-tr-island-frameless` — the browser loader mounts such an island fresh rather
26
+ * than hydrating it against markup that was never emitted.
27
+ */
28
+ function IslandMarker({ islandKey, islandId, props, children }) {
29
+ return createElement(Fragment, null, createElement(ISLAND_ELEMENT, {
30
+ style: { display: "contents" },
31
+ [ATTR_ISLAND_KEY]: islandKey,
32
+ [ATTR_ISLAND_ID]: islandId,
33
+ [ATTR_ISLAND_FRAMELESS]: children == null ? "" : void 0,
34
+ suppressHydrationWarning: true
35
+ }, children), createElement("script", {
36
+ type: "application/json",
37
+ [ATTR_ISLAND_PROPS]: islandId,
38
+ suppressHydrationWarning: true,
39
+ dangerouslySetInnerHTML: { __html: serializeIslandProps(props) }
40
+ }));
41
+ }
42
+
43
+ //#endregion
44
+ export { IslandMarker };