@jam-overture/loom 0.1.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 (401) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +743 -0
  3. package/dist/catalogue.d.ts +70 -0
  4. package/dist/catalogue.js +88 -0
  5. package/dist/cli/args.d.ts +17 -0
  6. package/dist/cli/args.js +83 -0
  7. package/dist/cli/filesystem.d.ts +15 -0
  8. package/dist/cli/filesystem.js +31 -0
  9. package/dist/cli/index.d.ts +12 -0
  10. package/dist/cli/index.js +12 -0
  11. package/dist/cli/main.d.ts +3 -0
  12. package/dist/cli/main.js +30 -0
  13. package/dist/cli/namespace.d.ts +40 -0
  14. package/dist/cli/namespace.js +40 -0
  15. package/dist/cli/plan.d.ts +84 -0
  16. package/dist/cli/plan.js +113 -0
  17. package/dist/cli/run.d.ts +17 -0
  18. package/dist/cli/run.js +75 -0
  19. package/dist/cli/templates.d.ts +43 -0
  20. package/dist/cli/templates.js +134 -0
  21. package/dist/closed-set.d.ts +34 -0
  22. package/dist/closed-set.js +34 -0
  23. package/dist/data/adapter.d.ts +123 -0
  24. package/dist/data/adapter.js +91 -0
  25. package/dist/data/binding.d.ts +48 -0
  26. package/dist/data/binding.js +39 -0
  27. package/dist/data/catalogue.d.ts +26 -0
  28. package/dist/data/catalogue.js +6 -0
  29. package/dist/data/index.d.ts +14 -0
  30. package/dist/data/index.js +14 -0
  31. package/dist/data/plan.d.ts +58 -0
  32. package/dist/data/plan.js +0 -0
  33. package/dist/data/resolution.d.ts +91 -0
  34. package/dist/data/resolution.js +96 -0
  35. package/dist/data/resolve.d.ts +46 -0
  36. package/dist/data/resolve.js +37 -0
  37. package/dist/data/source.d.ts +40 -0
  38. package/dist/data/source.js +45 -0
  39. package/dist/deadline.d.ts +57 -0
  40. package/dist/deadline.js +78 -0
  41. package/dist/frame/catalogue.d.ts +24 -0
  42. package/dist/frame/catalogue.js +5 -0
  43. package/dist/frame/index.d.ts +12 -0
  44. package/dist/frame/index.js +12 -0
  45. package/dist/frame/origin.d.ts +87 -0
  46. package/dist/frame/origin.js +114 -0
  47. package/dist/frame/resolution.d.ts +85 -0
  48. package/dist/frame/resolution.js +79 -0
  49. package/dist/grammar.d.ts +26 -0
  50. package/dist/grammar.js +28 -0
  51. package/dist/ids.d.ts +57 -0
  52. package/dist/ids.js +104 -0
  53. package/dist/index.d.ts +26 -0
  54. package/dist/index.js +26 -0
  55. package/dist/interactivity.d.ts +50 -0
  56. package/dist/interactivity.js +22 -0
  57. package/dist/interpretation/anthropic.d.ts +22 -0
  58. package/dist/interpretation/anthropic.js +76 -0
  59. package/dist/interpretation/client.d.ts +83 -0
  60. package/dist/interpretation/client.js +2 -0
  61. package/dist/interpretation/draft.d.ts +234 -0
  62. package/dist/interpretation/draft.js +84 -0
  63. package/dist/interpretation/index.d.ts +15 -0
  64. package/dist/interpretation/index.js +15 -0
  65. package/dist/interpretation/interpreter.d.ts +62 -0
  66. package/dist/interpretation/interpreter.js +151 -0
  67. package/dist/interpretation/materialize.d.ts +42 -0
  68. package/dist/interpretation/materialize.js +107 -0
  69. package/dist/interpretation/prompt.d.ts +229 -0
  70. package/dist/interpretation/prompt.js +285 -0
  71. package/dist/interpretation/render.d.ts +76 -0
  72. package/dist/interpretation/render.js +272 -0
  73. package/dist/interpretation/schema.d.ts +49 -0
  74. package/dist/interpretation/schema.js +131 -0
  75. package/dist/json.d.ts +35 -0
  76. package/dist/json.js +11 -0
  77. package/dist/paging.d.ts +60 -0
  78. package/dist/paging.js +49 -0
  79. package/dist/primitive-type.d.ts +32 -0
  80. package/dist/primitive-type.js +39 -0
  81. package/dist/render/addressing.d.ts +59 -0
  82. package/dist/render/addressing.js +60 -0
  83. package/dist/render/anchor.d.ts +105 -0
  84. package/dist/render/anchor.js +84 -0
  85. package/dist/render/behaviour-adjust.d.ts +62 -0
  86. package/dist/render/behaviour-adjust.js +78 -0
  87. package/dist/render/behaviour-copy.d.ts +53 -0
  88. package/dist/render/behaviour-copy.js +75 -0
  89. package/dist/render/behaviour-disclose.d.ts +74 -0
  90. package/dist/render/behaviour-disclose.js +77 -0
  91. package/dist/render/behaviour-present.d.ts +123 -0
  92. package/dist/render/behaviour-present.js +173 -0
  93. package/dist/render/behaviour.d.ts +243 -0
  94. package/dist/render/behaviour.js +284 -0
  95. package/dist/render/control.d.ts +81 -0
  96. package/dist/render/control.js +80 -0
  97. package/dist/render/decorative.d.ts +62 -0
  98. package/dist/render/decorative.js +2 -0
  99. package/dist/render/diagnostics.d.ts +260 -0
  100. package/dist/render/diagnostics.js +61 -0
  101. package/dist/render/disclosed.d.ts +37 -0
  102. package/dist/render/disclosed.js +37 -0
  103. package/dist/render/editable.d.ts +34 -0
  104. package/dist/render/editable.js +35 -0
  105. package/dist/render/frame.d.ts +42 -0
  106. package/dist/render/frame.js +31 -0
  107. package/dist/render/index.d.ts +35 -0
  108. package/dist/render/index.js +35 -0
  109. package/dist/render/inline-variables.d.ts +77 -0
  110. package/dist/render/inline-variables.js +220 -0
  111. package/dist/render/presented.d.ts +82 -0
  112. package/dist/render/presented.js +82 -0
  113. package/dist/render/primitive.d.ts +228 -0
  114. package/dist/render/primitive.js +36 -0
  115. package/dist/render/props.d.ts +48 -0
  116. package/dist/render/props.js +2 -0
  117. package/dist/render/reads.d.ts +73 -0
  118. package/dist/render/reads.js +45 -0
  119. package/dist/render/render.d.ts +164 -0
  120. package/dist/render/render.js +571 -0
  121. package/dist/render/request.d.ts +111 -0
  122. package/dist/render/request.js +60 -0
  123. package/dist/render/text.d.ts +91 -0
  124. package/dist/render/text.js +44 -0
  125. package/dist/render/theme.d.ts +61 -0
  126. package/dist/render/theme.js +52 -0
  127. package/dist/reserved-props.d.ts +35 -0
  128. package/dist/reserved-props.js +45 -0
  129. package/dist/result.d.ts +27 -0
  130. package/dist/result.js +30 -0
  131. package/dist/role.d.ts +71 -0
  132. package/dist/role.js +22 -0
  133. package/dist/runtime/analysis.d.ts +149 -0
  134. package/dist/runtime/analysis.js +187 -0
  135. package/dist/runtime/assessment.d.ts +35 -0
  136. package/dist/runtime/assessment.js +13 -0
  137. package/dist/runtime/disposition.d.ts +102 -0
  138. package/dist/runtime/disposition.js +59 -0
  139. package/dist/runtime/events.d.ts +187 -0
  140. package/dist/runtime/events.js +7 -0
  141. package/dist/runtime/gate.d.ts +43 -0
  142. package/dist/runtime/gate.js +169 -0
  143. package/dist/runtime/index.d.ts +27 -0
  144. package/dist/runtime/index.js +27 -0
  145. package/dist/runtime/intent.d.ts +60 -0
  146. package/dist/runtime/intent.js +36 -0
  147. package/dist/runtime/interpreter.d.ts +117 -0
  148. package/dist/runtime/interpreter.js +46 -0
  149. package/dist/runtime/inverse-interpreter.d.ts +90 -0
  150. package/dist/runtime/inverse-interpreter.js +56 -0
  151. package/dist/runtime/inverse.d.ts +87 -0
  152. package/dist/runtime/inverse.js +48 -0
  153. package/dist/runtime/narration.d.ts +24 -0
  154. package/dist/runtime/narration.js +36 -0
  155. package/dist/runtime/nesting.d.ts +31 -0
  156. package/dist/runtime/nesting.js +46 -0
  157. package/dist/runtime/pipeline.d.ts +124 -0
  158. package/dist/runtime/pipeline.js +178 -0
  159. package/dist/runtime/policy-fingerprint.d.ts +29 -0
  160. package/dist/runtime/policy-fingerprint.js +119 -0
  161. package/dist/runtime/policy-source.d.ts +42 -0
  162. package/dist/runtime/policy-source.js +8 -0
  163. package/dist/runtime/policy.d.ts +156 -0
  164. package/dist/runtime/policy.js +107 -0
  165. package/dist/runtime/proposal.d.ts +423 -0
  166. package/dist/runtime/proposal.js +109 -0
  167. package/dist/runtime/redirection.d.ts +53 -0
  168. package/dist/runtime/redirection.js +38 -0
  169. package/dist/runtime/repointing.d.ts +71 -0
  170. package/dist/runtime/repointing.js +0 -0
  171. package/dist/runtime/reversibility.d.ts +36 -0
  172. package/dist/runtime/reversibility.js +39 -0
  173. package/dist/runtime/stake-level.d.ts +33 -0
  174. package/dist/runtime/stake-level.js +58 -0
  175. package/dist/runtime/stakes.d.ts +47 -0
  176. package/dist/runtime/stakes.js +305 -0
  177. package/dist/runtime/vocabulary.d.ts +122 -0
  178. package/dist/runtime/vocabulary.js +87 -0
  179. package/dist/sdk/audit.d.ts +195 -0
  180. package/dist/sdk/audit.js +128 -0
  181. package/dist/sdk/catalogue.d.ts +37 -0
  182. package/dist/sdk/catalogue.js +16 -0
  183. package/dist/sdk/conformance.d.ts +342 -0
  184. package/dist/sdk/conformance.js +494 -0
  185. package/dist/sdk/copy.d.ts +105 -0
  186. package/dist/sdk/copy.js +90 -0
  187. package/dist/sdk/definition.d.ts +242 -0
  188. package/dist/sdk/definition.js +64 -0
  189. package/dist/sdk/index.d.ts +19 -0
  190. package/dist/sdk/index.js +19 -0
  191. package/dist/sdk/interactivity.d.ts +29 -0
  192. package/dist/sdk/interactivity.js +34 -0
  193. package/dist/sdk/pairings.d.ts +124 -0
  194. package/dist/sdk/pairings.js +81 -0
  195. package/dist/sdk/registry.d.ts +162 -0
  196. package/dist/sdk/registry.js +329 -0
  197. package/dist/sdk/selection.d.ts +46 -0
  198. package/dist/sdk/selection.js +24 -0
  199. package/dist/sdk/text.d.ts +100 -0
  200. package/dist/sdk/text.js +105 -0
  201. package/dist/sdk/vocabulary.d.ts +39 -0
  202. package/dist/sdk/vocabulary.js +36 -0
  203. package/dist/signals/broadcast.d.ts +134 -0
  204. package/dist/signals/broadcast.js +451 -0
  205. package/dist/signals/collect.d.ts +184 -0
  206. package/dist/signals/collect.js +196 -0
  207. package/dist/signals/deliver.d.ts +64 -0
  208. package/dist/signals/deliver.js +85 -0
  209. package/dist/signals/fold.d.ts +112 -0
  210. package/dist/signals/fold.js +76 -0
  211. package/dist/signals/index.d.ts +31 -0
  212. package/dist/signals/index.js +31 -0
  213. package/dist/signals/ingest.d.ts +51 -0
  214. package/dist/signals/ingest.js +70 -0
  215. package/dist/signals/intake.d.ts +149 -0
  216. package/dist/signals/intake.js +154 -0
  217. package/dist/signals/journal.d.ts +94 -0
  218. package/dist/signals/journal.js +11 -0
  219. package/dist/signals/kinds.d.ts +22 -0
  220. package/dist/signals/kinds.js +22 -0
  221. package/dist/signals/ledger.d.ts +46 -0
  222. package/dist/signals/ledger.js +81 -0
  223. package/dist/signals/memory.d.ts +17 -0
  224. package/dist/signals/memory.js +99 -0
  225. package/dist/signals/migrate.d.ts +27 -0
  226. package/dist/signals/migrate.js +78 -0
  227. package/dist/signals/postgres.d.ts +7 -0
  228. package/dist/signals/postgres.js +295 -0
  229. package/dist/signals/rollup.d.ts +142 -0
  230. package/dist/signals/rollup.js +0 -0
  231. package/dist/signals/schema.d.ts +534 -0
  232. package/dist/signals/schema.js +92 -0
  233. package/dist/signals/signal.d.ts +381 -0
  234. package/dist/signals/signal.js +150 -0
  235. package/dist/signals/tally.d.ts +70 -0
  236. package/dist/signals/tally.js +2 -0
  237. package/dist/signals/view.d.ts +51 -0
  238. package/dist/signals/view.js +54 -0
  239. package/dist/store/attribution.d.ts +125 -0
  240. package/dist/store/attribution.js +116 -0
  241. package/dist/store/database.d.ts +14 -0
  242. package/dist/store/database.js +2 -0
  243. package/dist/store/driver.d.ts +29 -0
  244. package/dist/store/driver.js +39 -0
  245. package/dist/store/errors.d.ts +56 -0
  246. package/dist/store/errors.js +37 -0
  247. package/dist/store/index.d.ts +16 -0
  248. package/dist/store/index.js +16 -0
  249. package/dist/store/memory.d.ts +3 -0
  250. package/dist/store/memory.js +115 -0
  251. package/dist/store/migrate.d.ts +54 -0
  252. package/dist/store/migrate.js +122 -0
  253. package/dist/store/postgres-holds.d.ts +4 -0
  254. package/dist/store/postgres-holds.js +192 -0
  255. package/dist/store/postgres.d.ts +8 -0
  256. package/dist/store/postgres.js +262 -0
  257. package/dist/store/replay.d.ts +94 -0
  258. package/dist/store/replay.js +82 -0
  259. package/dist/store/revert.d.ts +116 -0
  260. package/dist/store/revert.js +243 -0
  261. package/dist/store/schema.d.ts +371 -0
  262. package/dist/store/schema.js +78 -0
  263. package/dist/store/source.d.ts +23 -0
  264. package/dist/store/source.js +37 -0
  265. package/dist/store/store.d.ts +231 -0
  266. package/dist/store/store.js +52 -0
  267. package/dist/store/undone.d.ts +18 -0
  268. package/dist/store/undone.js +89 -0
  269. package/dist/submit/catalogue.d.ts +20 -0
  270. package/dist/submit/catalogue.js +5 -0
  271. package/dist/submit/declaration.d.ts +39 -0
  272. package/dist/submit/declaration.js +30 -0
  273. package/dist/submit/endpoint.d.ts +131 -0
  274. package/dist/submit/endpoint.js +160 -0
  275. package/dist/submit/index.d.ts +13 -0
  276. package/dist/submit/index.js +13 -0
  277. package/dist/submit/plan.d.ts +49 -0
  278. package/dist/submit/plan.js +47 -0
  279. package/dist/submit/resolution.d.ts +61 -0
  280. package/dist/submit/resolution.js +64 -0
  281. package/dist/submit/resolve.d.ts +45 -0
  282. package/dist/submit/resolve.js +36 -0
  283. package/dist/telemetry/calibration.d.ts +132 -0
  284. package/dist/telemetry/calibration.js +151 -0
  285. package/dist/telemetry/episode.d.ts +140 -0
  286. package/dist/telemetry/episode.js +272 -0
  287. package/dist/telemetry/event.d.ts +2310 -0
  288. package/dist/telemetry/event.js +405 -0
  289. package/dist/telemetry/index.d.ts +15 -0
  290. package/dist/telemetry/index.js +15 -0
  291. package/dist/telemetry/journal.d.ts +116 -0
  292. package/dist/telemetry/journal.js +11 -0
  293. package/dist/telemetry/memory.d.ts +24 -0
  294. package/dist/telemetry/memory.js +75 -0
  295. package/dist/telemetry/migrate.d.ts +26 -0
  296. package/dist/telemetry/migrate.js +40 -0
  297. package/dist/telemetry/postgres.d.ts +6 -0
  298. package/dist/telemetry/postgres.js +139 -0
  299. package/dist/telemetry/retention.d.ts +131 -0
  300. package/dist/telemetry/retention.js +217 -0
  301. package/dist/telemetry/schema.d.ts +113 -0
  302. package/dist/telemetry/schema.js +33 -0
  303. package/dist/telemetry/sink.d.ts +42 -0
  304. package/dist/telemetry/sink.js +61 -0
  305. package/dist/testing/contracts.d.ts +34 -0
  306. package/dist/testing/contracts.js +34 -0
  307. package/dist/testing/definitions.d.ts +15 -0
  308. package/dist/testing/definitions.js +48 -0
  309. package/dist/testing/doubles.d.ts +94 -0
  310. package/dist/testing/doubles.js +141 -0
  311. package/dist/testing/episode-harness.d.ts +49 -0
  312. package/dist/testing/episode-harness.js +65 -0
  313. package/dist/testing/filesystem.d.ts +17 -0
  314. package/dist/testing/filesystem.js +17 -0
  315. package/dist/testing/fixtures.d.ts +57 -0
  316. package/dist/testing/fixtures.js +84 -0
  317. package/dist/testing/hold-contract.d.ts +19 -0
  318. package/dist/testing/hold-contract.js +374 -0
  319. package/dist/testing/index.d.ts +41 -0
  320. package/dist/testing/index.js +41 -0
  321. package/dist/testing/journal-contract.d.ts +17 -0
  322. package/dist/testing/journal-contract.js +353 -0
  323. package/dist/testing/model-replies.d.ts +34 -0
  324. package/dist/testing/model-replies.js +101 -0
  325. package/dist/testing/primitives.d.ts +7 -0
  326. package/dist/testing/primitives.js +29 -0
  327. package/dist/testing/reader-signal-contract.d.ts +38 -0
  328. package/dist/testing/reader-signal-contract.js +318 -0
  329. package/dist/testing/row-security.d.ts +17 -0
  330. package/dist/testing/row-security.js +21 -0
  331. package/dist/testing/store-contract.d.ts +25 -0
  332. package/dist/testing/store-contract.js +500 -0
  333. package/dist/theme/apply.d.ts +17 -0
  334. package/dist/theme/apply.js +60 -0
  335. package/dist/theme/contrast.d.ts +197 -0
  336. package/dist/theme/contrast.js +259 -0
  337. package/dist/theme/derive.d.ts +77 -0
  338. package/dist/theme/derive.js +167 -0
  339. package/dist/theme/faces.d.ts +73 -0
  340. package/dist/theme/faces.js +119 -0
  341. package/dist/theme/font-packs.d.ts +25 -0
  342. package/dist/theme/font-packs.js +257 -0
  343. package/dist/theme/index.d.ts +20 -0
  344. package/dist/theme/index.js +20 -0
  345. package/dist/theme/lab.d.ts +30 -0
  346. package/dist/theme/lab.js +46 -0
  347. package/dist/theme/library.d.ts +114 -0
  348. package/dist/theme/library.js +300 -0
  349. package/dist/theme/measure.d.ts +144 -0
  350. package/dist/theme/measure.js +145 -0
  351. package/dist/theme/palettes.d.ts +64 -0
  352. package/dist/theme/palettes.js +497 -0
  353. package/dist/theme/registry.d.ts +59 -0
  354. package/dist/theme/registry.js +60 -0
  355. package/dist/theme/separation.d.ts +177 -0
  356. package/dist/theme/separation.js +203 -0
  357. package/dist/theme/style-presets.d.ts +60 -0
  358. package/dist/theme/style-presets.js +124 -0
  359. package/dist/theme/theme.d.ts +253 -0
  360. package/dist/theme/theme.js +171 -0
  361. package/dist/tree/apply.d.ts +16 -0
  362. package/dist/tree/apply.js +104 -0
  363. package/dist/tree/builders.d.ts +19 -0
  364. package/dist/tree/builders.js +20 -0
  365. package/dist/tree/compare.d.ts +68 -0
  366. package/dist/tree/compare.js +75 -0
  367. package/dist/tree/configuration.d.ts +25 -0
  368. package/dist/tree/configuration.js +108 -0
  369. package/dist/tree/delta.d.ts +288 -0
  370. package/dist/tree/delta.js +88 -0
  371. package/dist/tree/errors.d.ts +69 -0
  372. package/dist/tree/errors.js +34 -0
  373. package/dist/tree/identity.d.ts +117 -0
  374. package/dist/tree/identity.js +145 -0
  375. package/dist/tree/index.d.ts +21 -0
  376. package/dist/tree/index.js +21 -0
  377. package/dist/tree/inverse.d.ts +24 -0
  378. package/dist/tree/inverse.js +112 -0
  379. package/dist/tree/mutation.d.ts +18 -0
  380. package/dist/tree/mutation.js +49 -0
  381. package/dist/tree/naming.d.ts +4 -0
  382. package/dist/tree/naming.js +35 -0
  383. package/dist/tree/navigation.d.ts +38 -0
  384. package/dist/tree/navigation.js +83 -0
  385. package/dist/tree/node.d.ts +103 -0
  386. package/dist/tree/node.js +46 -0
  387. package/dist/tree/outline.d.ts +28 -0
  388. package/dist/tree/outline.js +10 -0
  389. package/dist/tree/tree.d.ts +83 -0
  390. package/dist/tree/tree.js +62 -0
  391. package/dist/write/commit.d.ts +124 -0
  392. package/dist/write/commit.js +234 -0
  393. package/dist/write/held.d.ts +674 -0
  394. package/dist/write/held.js +185 -0
  395. package/dist/write/index.d.ts +11 -0
  396. package/dist/write/index.js +11 -0
  397. package/dist/write/liveness.d.ts +132 -0
  398. package/dist/write/liveness.js +91 -0
  399. package/dist/write/revert.d.ts +79 -0
  400. package/dist/write/revert.js +134 -0
  401. package/package.json +160 -0
@@ -0,0 +1,228 @@
1
+ import type { ComponentType, CSSProperties, ReactNode } from "react";
2
+ import { type Result } from "../result.js";
3
+ import type { NodeData } from "../data/resolution.js";
4
+ import type { NodeFrames } from "../frame/resolution.js";
5
+ import type { NodeId } from "../ids.js";
6
+ import type { JsonObject, JsonObjectView } from "../json.js";
7
+ import type { PrimitiveType } from "../primitive-type.js";
8
+ import type { SubmissionOutcome } from "../submit/resolution.js";
9
+ import type { AnchorAttributes } from "./anchor.js";
10
+ import type { BehaviourName, PrimitiveBehaviours } from "./behaviour.js";
11
+ import type { DecorativeChildren } from "./decorative.js";
12
+ import type { EditableAttributes } from "./editable.js";
13
+ import type { PrimitiveText } from "./text.js";
14
+ /**
15
+ * The primitive contract — what a registered component receives, and the only
16
+ * thing the renderer needs from a registry.
17
+ *
18
+ * Node props arrive as one bag rather than spread across the component's own
19
+ * props. Props in a Loom tree are AI-authored and arrive from storage, so
20
+ * spreading them would let a proposal reach `dangerouslySetInnerHTML`, `ref`,
21
+ * or any other React-reserved name that a primitive forwards to a DOM element.
22
+ * A bag means a primitive reads what it declares and nothing else can be
23
+ * smuggled past it.
24
+ */
25
+ export type LoomRenderContext<TText extends string = never, TBehaviour extends BehaviourName = never> = {
26
+ readonly nodeId: NodeId;
27
+ readonly type: PrimitiveType;
28
+ /**
29
+ * Present only when the tree was rendered in edit mode. Spread onto the
30
+ * primitive's own root element; a primitive that drops it renders correctly
31
+ * but becomes invisible to the portal.
32
+ */
33
+ readonly editable?: EditableAttributes;
34
+ /**
35
+ * The `id` this node answers to, so a link on the same page can point at it.
36
+ *
37
+ * Present only when the tree named an anchor that is usable and that no
38
+ * earlier node claimed; absent otherwise, including inside a decorative copy,
39
+ * which carries no identity. Spread onto the primitive's own root element,
40
+ * beside `editable` — a primitive that drops it renders correctly and cannot
41
+ * be linked to.
42
+ *
43
+ * There is nothing here to distinguish "the tree named none" from "the tree
44
+ * named one and it was refused", which every other seam on this context takes
45
+ * care to keep apart. The difference is real and it is in the diagnostics; it
46
+ * is not here because a primitive would do the same thing with both, and a
47
+ * shape that offers a choice nobody can act on invites one to be invented.
48
+ */
49
+ readonly anchor?: AnchorAttributes;
50
+ /**
51
+ * The tree's theme, flattened into CSS custom properties. Present on the
52
+ * **root node only**, and only when the tree names a theme the render could
53
+ * resolve; apply it as `style` on the primitive's own root element.
54
+ *
55
+ * It arrives here rather than on a wrapper the renderer emits for the reason
56
+ * `editable.ts` gives for the same choice: a wrapper changes what `>`,
57
+ * `:first-child` and `:nth-child` select, and a page that only lays out
58
+ * correctly when it is unthemed is not a page anyone reviewed. The cost is
59
+ * that a root primitive which drops it renders unstyled — which is what the
60
+ * two starter palettes exist to catch.
61
+ */
62
+ readonly theme?: CSSProperties;
63
+ /**
64
+ * The content of this element's own `slot` children, keyed by slot name — the
65
+ * named regions the primitive declared and is responsible for placing.
66
+ *
67
+ * Always present, empty when the node has no slot children, so a primitive
68
+ * reads `loom.slots.aside` without first proving the map exists. A slot the
69
+ * primitive does not place renders nothing: that is what makes a region a
70
+ * region rather than a position in `children` (0051).
71
+ */
72
+ readonly slots: SlotChildren;
73
+ /**
74
+ * What the host answered for this node's bindings, by binding name (0058).
75
+ *
76
+ * Always present, empty when the node binds nothing, so a primitive reads
77
+ * `loom.data.services` without first proving the map exists. Each answer is
78
+ * `ready` or `unavailable` with a reason — never merely absent — because a
79
+ * primitive shows different things for "you have no services yet" and "we
80
+ * could not reach your services", and a shape that cannot tell them apart
81
+ * guarantees it eventually shows the wrong one.
82
+ *
83
+ * It arrives beside `props` rather than merged into them because the two have
84
+ * different authors. Props are in the tree, proposed by a model and weighed by
85
+ * the Gate; data is the host's answer to a question the tree asked, and it
86
+ * belongs to whoever runs the deployment.
87
+ */
88
+ readonly data: NodeData;
89
+ /**
90
+ * Where this node's form posts, if it declared a submission (0065).
91
+ *
92
+ * Absent — not `unavailable` — when the node declared none: the three states
93
+ * are distinct and a form primitive acts differently on each. Absent is a
94
+ * tree that never said where to post, which is an authoring gap; `unavailable`
95
+ * is a deployment that could not answer right now, which is not.
96
+ *
97
+ * Unlike `data`, `text` and `slots` there is at most one per node, because a
98
+ * form posts to one place. Everything on a `ready` target is host-authored:
99
+ * nothing about the address is in the tree, so nothing about it survives into
100
+ * a delta, a revision, or the diff a reviewer reads.
101
+ */
102
+ readonly submit?: SubmissionOutcome;
103
+ /**
104
+ * Whether the URLs this primitive said it frames may be framed (0095), by the
105
+ * prop name that carried each one.
106
+ *
107
+ * Always present, empty for the primitive that declared no framable prop —
108
+ * which is all but one of them — so a primitive reads `loom.frames.src`
109
+ * without first proving the map exists. An entry appears for every declared
110
+ * prop the node actually carries, so a primitive that has a `src` to frame
111
+ * always has an answer about it, and one whose optional `src` was left out
112
+ * has nothing to frame and no entry.
113
+ *
114
+ * Unlike `data` and `submit`, no part of this waits on anything: an allowlist
115
+ * is a static fact about a deployment, so the check happens inside the walk
116
+ * and there is nothing for a host to resolve first. What a host *does* have
117
+ * to wire is the allowlist itself — absent, every frame is refused, because a
118
+ * deployment that has not said whose documents it will run has not agreed to
119
+ * run anybody's.
120
+ */
121
+ readonly frames: NodeFrames;
122
+ /**
123
+ * The strings this primitive declared, resolved for this deployment.
124
+ *
125
+ * Always present and always complete: every key the primitive declared is
126
+ * here, carrying the host's translation where there is one and the declared
127
+ * string where there is not. A primitive reads `loom.text.excluded` and gets a
128
+ * string, never `undefined` — a control whose accessible name went missing
129
+ * because nobody translated it is the failure this seam exists to prevent.
130
+ *
131
+ * Empty for a primitive that declared none, and typed as such: `TText` is the
132
+ * union of declared keys, so reading one that was never declared does not
133
+ * compile.
134
+ */
135
+ readonly text: PrimitiveText<TText>;
136
+ /**
137
+ * The controls this primitive declared, built and ready to place.
138
+ *
139
+ * Always present, empty for the primitive that declared none, so a primitive
140
+ * reads `loom.behaviours.copy` without first proving the map exists — and
141
+ * typed by what it declared, so reading one it did not ask for does not
142
+ * compile.
143
+ *
144
+ * A behaviour is the one thing a primitive receives that **runs**: a copy
145
+ * button is a click handler, and a click handler is not expressible in the
146
+ * JSON a primitive's props are. It arrives already built rather than as a
147
+ * component to configure, because there is nothing here for a tree, a model
148
+ * or a primitive to get right or wrong — the strings came from the
149
+ * primitive's own declarations and the content came from the tree. See
150
+ * `behaviour.ts`.
151
+ */
152
+ readonly behaviours: PrimitiveBehaviours<TBehaviour>;
153
+ /**
154
+ * This node's children again, rendered as a copy nothing resolves to a node —
155
+ * for the arrangements that have to say the same content twice (see
156
+ * `decorative.ts`).
157
+ *
158
+ * Always present, and cheap to ignore: nothing is rendered until it is
159
+ * called, so the primitives that will never want a copy pay one closure for
160
+ * it. Calling it twice within one render returns the same elements.
161
+ *
162
+ * The copy is not marked and is not inert. It carries no identity, which is
163
+ * the half the primitive could not arrange for itself; announcing it as
164
+ * decoration — `aria-hidden`, `inert` — is the half the seam cannot.
165
+ */
166
+ readonly decorative: DecorativeChildren;
167
+ };
168
+ /**
169
+ * Rendered slot content, by slot name.
170
+ *
171
+ * The map has a null prototype. Slot names are lowercase identifiers and
172
+ * `constructor`, `toString` and `valueOf` are all valid ones, so an ordinary
173
+ * object would answer `loom.slots.constructor` with a function off
174
+ * `Object.prototype` — the same hazard `staticPrimitiveResolver` guards, and
175
+ * the same fix.
176
+ */
177
+ export type SlotChildren = Readonly<Record<string, ReactNode>>;
178
+ export declare const NO_SLOTS: SlotChildren;
179
+ /**
180
+ * `TProps` is what a primitive's declared schema accepts. It defaults to the
181
+ * whole JSON object space, so a primitive that declares nothing — or a host
182
+ * that registers without §4's SDK — is still a `LoomPrimitive`. A narrower
183
+ * `TProps` is a claim about what the bag contains, and the only thing that
184
+ * makes the claim true is the render seam validating against the same schema
185
+ * the type came from; that pairing is the registry's job (see `sdk/registry.ts`).
186
+ */
187
+ export type LoomPrimitiveProps<TProps extends JsonObjectView = JsonObject, TText extends string = never, TBehaviour extends BehaviourName = never> = {
188
+ readonly loom: LoomRenderContext<TText, TBehaviour>;
189
+ /** The node's props, exactly as they appear in the tree. */
190
+ readonly props: TProps;
191
+ /** Rendered children in tree order, or null when the node has none. */
192
+ readonly children: ReactNode;
193
+ };
194
+ export type LoomPrimitive<TProps extends JsonObjectView = JsonObject, TText extends string = never, TBehaviour extends BehaviourName = never> = ComponentType<LoomPrimitiveProps<TProps, TText, TBehaviour>>;
195
+ /** A primitive called as the plain function of its props, rather than mounted. */
196
+ export type CallablePrimitive = (props: LoomPrimitiveProps) => ReactNode;
197
+ /**
198
+ * A `LoomPrimitive` is either a function component or a class, and only the
199
+ * first can be called as a plain function. `typeof` cannot tell them apart — a
200
+ * class is a function too — so the marker React puts on a class component's
201
+ * prototype is what decides it.
202
+ *
203
+ * Two things in this package want to call a primitive rather than mount one, for
204
+ * unrelated reasons — the conformance probes ask what a primitive does with what
205
+ * it is handed, and the literal-theme render resolves what one painted — and
206
+ * both have to decline the same case in the same way. It lives beside the type
207
+ * because that is what it is about.
208
+ */
209
+ export declare const asCallablePrimitive: (primitive: LoomPrimitive) => Result<CallablePrimitive, string>;
210
+ /**
211
+ * The renderer's whole dependency on the registry: one lookup. §4 owns
212
+ * registration — declared prop schemas, packaging, scaffolding — and whatever
213
+ * it grows into has to satisfy no more than this to be renderable.
214
+ */
215
+ export interface PrimitiveResolver {
216
+ readonly resolve: (type: PrimitiveType) => LoomPrimitive | undefined;
217
+ }
218
+ /**
219
+ * A resolver over a fixed map, for hosts that register at module scope.
220
+ *
221
+ * The lookup is own-property only. A primitive type is a lowercase identifier
222
+ * and `constructor`, `toString`, and `valueOf` are all valid ones, so a plain
223
+ * index would answer a tree that names them with a function off
224
+ * `Object.prototype` — an AI-authored type resolving to a native function is
225
+ * not a lookup miss anyone would debug quickly.
226
+ */
227
+ export declare const staticPrimitiveResolver: (primitives: Readonly<Record<string, LoomPrimitive>>) => PrimitiveResolver;
228
+ //# sourceMappingURL=primitive.d.ts.map
@@ -0,0 +1,36 @@
1
+ import { err, ok } from "../result.js";
2
+ export const NO_SLOTS = Object.freeze(Object.create(null));
3
+ /**
4
+ * A `LoomPrimitive` is either a function component or a class, and only the
5
+ * first can be called as a plain function. `typeof` cannot tell them apart — a
6
+ * class is a function too — so the marker React puts on a class component's
7
+ * prototype is what decides it.
8
+ *
9
+ * Two things in this package want to call a primitive rather than mount one, for
10
+ * unrelated reasons — the conformance probes ask what a primitive does with what
11
+ * it is handed, and the literal-theme render resolves what one painted — and
12
+ * both have to decline the same case in the same way. It lives beside the type
13
+ * because that is what it is about.
14
+ */
15
+ export const asCallablePrimitive = (primitive) => {
16
+ if (typeof primitive !== "function")
17
+ return err("not a function component");
18
+ const prototype = primitive.prototype;
19
+ if (typeof prototype === "object" && prototype !== null && "isReactComponent" in prototype) {
20
+ return err("class components cannot be called outside a renderer");
21
+ }
22
+ return ok(primitive);
23
+ };
24
+ /**
25
+ * A resolver over a fixed map, for hosts that register at module scope.
26
+ *
27
+ * The lookup is own-property only. A primitive type is a lowercase identifier
28
+ * and `constructor`, `toString`, and `valueOf` are all valid ones, so a plain
29
+ * index would answer a tree that names them with a function off
30
+ * `Object.prototype` — an AI-authored type resolving to a native function is
31
+ * not a lookup miss anyone would debug quickly.
32
+ */
33
+ export const staticPrimitiveResolver = (primitives) => ({
34
+ resolve: (type) => (Object.hasOwn(primitives, type) ? primitives[type] : undefined),
35
+ });
36
+ //# sourceMappingURL=primitive.js.map
@@ -0,0 +1,48 @@
1
+ import type { JsonObject } from "../json.js";
2
+ import type { PrimitiveType } from "../primitive-type.js";
3
+ /**
4
+ * The prop-validation seam (0009).
5
+ *
6
+ * A primitive declares what its props must look like; something has to check
7
+ * that the tree's props match, and this is where it happens — once, at the
8
+ * boundary the renderer already crosses, rather than inside every primitive.
9
+ *
10
+ * It is a **separate interface** from `PrimitiveResolver` rather than an
11
+ * optional method on it, for the same reason `ChangeRepairer` is separate from
12
+ * `ChangeInterpreter`: a renderer handed no validator cannot validate, so
13
+ * "this deployment checks AI-authored props against declared schemas" is a
14
+ * visible choice at the composition root instead of a property of whichever
15
+ * resolver got wired in.
16
+ *
17
+ * Validation is a **predicate, not a codec**. The verdict says whether the
18
+ * props are acceptable; it never returns replacement props, and the renderer
19
+ * always hands the primitive the props exactly as they appear in the tree. A
20
+ * schema that defaults or coerces would make the rendered page a function of
21
+ * the deployment's schema version as well as the tree, and a tree that no
22
+ * longer describes the page it produces is the one thing Loom cannot afford.
23
+ * Defaults belong inside the primitive, which is where presentation lives.
24
+ */
25
+ export type PropsIssue = {
26
+ /** Dotted path within the props object; `props` when the whole bag is wrong. */
27
+ readonly path: string;
28
+ /**
29
+ * Developer-facing text from the declaring schema. Zod's own messages can
30
+ * name a rejected value (an enum mismatch quotes what it received), so a
31
+ * consumer must treat this as content rather than as a safe-to-log constant.
32
+ */
33
+ readonly message: string;
34
+ };
35
+ export type PropsVerdict = {
36
+ readonly outcome: "valid";
37
+ } | {
38
+ readonly outcome: "invalid";
39
+ readonly issues: readonly PropsIssue[];
40
+ }
41
+ /** The validator has no schema for this type — see `render.ts` for what that means. */
42
+ | {
43
+ readonly outcome: "undeclared";
44
+ };
45
+ export interface PropsValidator {
46
+ readonly validateProps: (type: PrimitiveType, props: JsonObject) => PropsVerdict;
47
+ }
48
+ //# sourceMappingURL=props.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=props.js.map
@@ -0,0 +1,73 @@
1
+ import type { JsonObject } from "../json.js";
2
+ import type { PrimitiveType } from "../primitive-type.js";
3
+ /**
4
+ * What a primitive says it reads, and what a tree asked for that nothing will
5
+ * look at.
6
+ *
7
+ * A binding is a question the tree asks under a *name*, and the name is how the
8
+ * primitive reading the answer finds it (0058). Two of the three ways that
9
+ * declaration can be wrong are refused at the seam — an unregistered source, a
10
+ * param the source did not declare — and the third was silent: a name nothing
11
+ * reads resolves cleanly, costs a round trip, and is then dropped on the floor.
12
+ *
13
+ * This module is the half that makes the third one visible. It holds the seam
14
+ * the walk asks, the two forms a declaration may take, and the comparison it
15
+ * makes; what a primitive declares is `reads` on its definition, and what the
16
+ * walk *calls* the mismatch is the diagnostic vocabulary's business (0181).
17
+ */
18
+ /**
19
+ * The name a primitive reads one answer under: a fixed one, or the one a prop
20
+ * gives.
21
+ *
22
+ * Two forms because there are two kinds of bound primitive and the first form
23
+ * can only describe one of them (0184). A primitive that always looks under
24
+ * `rows` declares the string. A primitive that looks under whatever its
25
+ * `binding` prop says — which is both primitives in the library that read a
26
+ * binding at all — declares the prop and the name it falls back to, and a fixed
27
+ * list could only have said something untrue about it.
28
+ *
29
+ * `Name` is the brand: an author writes plain strings, and what a registry
30
+ * hands back has been through `bindingNameSchema`.
31
+ */
32
+ export type BindingDeclaration<Name extends string = string> = Name | {
33
+ /** The prop whose value is the name. Declared by the primitive's schema. */
34
+ readonly fromProp: string;
35
+ /** The name read when that prop is absent, which is the common case. */
36
+ readonly default: Name;
37
+ };
38
+ /**
39
+ * Which binding names a primitive says it reads, asked per type.
40
+ *
41
+ * Structural, and detected the way `FrameResolver` and `BehaviourResolver` are:
42
+ * a registry built by the SDK satisfies it, and a host resolving from a plain
43
+ * map has registered nothing that could declare a binding name in the first
44
+ * place — so there is nothing here to wire and nothing that can go missing.
45
+ *
46
+ * It answers the *declaration* rather than the names, because half of a
47
+ * declaration is a question about one node's props and a registry is asked
48
+ * about a type. Resolving it is `unreadBindings`' job, which is the one caller
49
+ * holding both.
50
+ */
51
+ export interface BindingReader {
52
+ readonly bindingsReadBy: (type: PrimitiveType) => readonly BindingDeclaration[] | undefined;
53
+ }
54
+ export declare const isBindingReader: (value: object) => value is BindingReader;
55
+ /**
56
+ * The names this node asked under that its primitive says it does not read.
57
+ *
58
+ * `undefined` from the reader means nobody has said, and nothing is reported:
59
+ * the whole point of the declaration is that absence and emptiness are
60
+ * different answers, and treating "unknown" as "reads none" would report every
61
+ * binding on every primitive that has not been declared yet.
62
+ *
63
+ * The node's own props are the second half of the answer, because a prop-named
64
+ * declaration means something different on every node that carries it. A node
65
+ * that renamed its binding to `rows` and said so in the prop reads `rows`, and
66
+ * a node beside it that said nothing reads the default.
67
+ *
68
+ * Name-sorted, because the caller reports one diagnostic per name and a
69
+ * diagnostic list whose order depends on object key order is one a test can
70
+ * only assert loosely.
71
+ */
72
+ export declare const unreadBindings: (asked: Iterable<string>, declared: readonly BindingDeclaration[] | undefined, props: JsonObject) => readonly string[];
73
+ //# sourceMappingURL=reads.d.ts.map
@@ -0,0 +1,45 @@
1
+ export const isBindingReader = (value) => typeof value.bindingsReadBy === "function";
2
+ /**
3
+ * The name one declaration resolves to on a node carrying these props.
4
+ *
5
+ * A prop-named declaration falls back to its default for anything that is not a
6
+ * non-empty string, which covers the two cases that reach here: the prop was
7
+ * left off, which is what a node binding one thing does and is why the default
8
+ * exists, and a prop whose value the schema would refuse. The second cannot
9
+ * happen on a rendered node — props are validated before the walk asks — and
10
+ * guarding it is cheaper than reasoning about whether it stays that way.
11
+ */
12
+ const nameRead = (declaration, props) => {
13
+ if (typeof declaration === "string")
14
+ return declaration;
15
+ const named = props[declaration.fromProp];
16
+ return typeof named === "string" && named !== "" ? named : declaration.default;
17
+ };
18
+ /**
19
+ * The names this node asked under that its primitive says it does not read.
20
+ *
21
+ * `undefined` from the reader means nobody has said, and nothing is reported:
22
+ * the whole point of the declaration is that absence and emptiness are
23
+ * different answers, and treating "unknown" as "reads none" would report every
24
+ * binding on every primitive that has not been declared yet.
25
+ *
26
+ * The node's own props are the second half of the answer, because a prop-named
27
+ * declaration means something different on every node that carries it. A node
28
+ * that renamed its binding to `rows` and said so in the prop reads `rows`, and
29
+ * a node beside it that said nothing reads the default.
30
+ *
31
+ * Name-sorted, because the caller reports one diagnostic per name and a
32
+ * diagnostic list whose order depends on object key order is one a test can
33
+ * only assert loosely.
34
+ */
35
+ export const unreadBindings = (asked, declared, props) => {
36
+ if (declared === undefined)
37
+ return [];
38
+ const reads = new Set(declared.map((declaration) => nameRead(declaration, props)));
39
+ const unread = [];
40
+ for (const name of asked)
41
+ if (!reads.has(name))
42
+ unread.push(name);
43
+ return unread.sort();
44
+ };
45
+ //# sourceMappingURL=reads.js.map
@@ -0,0 +1,164 @@
1
+ import { type ReactNode } from "react";
2
+ import { type DataResolution } from "../data/resolution.js";
3
+ import type { FrameOriginRegistry } from "../frame/origin.js";
4
+ import type { NodeId } from "../ids.js";
5
+ import type { ThemeRegistry } from "../theme/registry.js";
6
+ import type { ResolvedTheme } from "../theme/theme.js";
7
+ import type { SubmissionResolution } from "../submit/resolution.js";
8
+ import type { LoomTree } from "../tree/tree.js";
9
+ import type { RenderDiagnostic } from "./diagnostics.js";
10
+ import { type PrimitiveResolver } from "./primitive.js";
11
+ import type { PropsValidator } from "./props.js";
12
+ import { type TextResolver } from "./text.js";
13
+ /**
14
+ * The tree, projected into React.
15
+ *
16
+ * The projection is a pure function of the tree, the resolver, and the render
17
+ * options: no hooks, no state, no IO, no module-level cache. That is what lets
18
+ * it run per request on an edge runtime or inside a Server Component, and it is
19
+ * why two requests for the same revision cannot disagree about what the page
20
+ * is.
21
+ *
22
+ * Node ids do double duty as React keys. They are stable across move and
23
+ * configure by construction (see `ids.ts`), so React reconciles a moved subtree
24
+ * as a move rather than as a delete and an insert — the property §1 minted ids
25
+ * for, collected here.
26
+ */
27
+ /**
28
+ * Content the host projects into named slots. A slot the host does not name
29
+ * falls back to the node's own children; to project nothing into one, name it
30
+ * with `null`.
31
+ */
32
+ export type SlotContent = Readonly<Record<string, ReactNode>>;
33
+ export type RenderOptions = {
34
+ readonly resolver: PrimitiveResolver;
35
+ /**
36
+ * Absent means props are not checked against declared schemas. A registry
37
+ * built by §4's SDK satisfies both this and `resolver`, so wiring the same
38
+ * object into both is the ordinary case.
39
+ */
40
+ readonly validator?: PropsValidator;
41
+ /**
42
+ * Absent means the tree's theme is not resolved and nothing is mounted, and
43
+ * a tree that names one says so in a diagnostic. Supplying a registry is what
44
+ * bounds the palettes, font packs and style presets a proposal may name (0049).
45
+ */
46
+ readonly themes?: ThemeRegistry;
47
+ /**
48
+ * Absent means the tree's bindings are not answered, and a tree that declares
49
+ * one says so in a diagnostic. Resolution is async and rendering is not, so it
50
+ * happens before the walk — `renderRequest` does it, and a caller driving
51
+ * `renderLoomTree` itself resolves with `resolveTreeData` first (0058).
52
+ */
53
+ readonly data?: DataResolution;
54
+ /**
55
+ * Absent means the tree's submissions are not answered, and a tree that names
56
+ * an endpoint says so in a diagnostic. Resolution may do IO — minting a token
57
+ * usually does — so it happens before the walk, the same way data does;
58
+ * `renderRequest` does it, and a caller driving `renderLoomTree` itself
59
+ * resolves with `resolveTreeSubmissions` first (0065).
60
+ */
61
+ readonly submissions?: SubmissionResolution;
62
+ /**
63
+ * The origins this deployment is willing to frame (0095). Absent means every
64
+ * framable prop is refused, and each one says so in a diagnostic — the seam
65
+ * fails closed, because the registry *is* the allowlist and a deployment that
66
+ * has not written one has not agreed to run anybody's script inside its
67
+ * pages.
68
+ *
69
+ * Unlike `data` and `submissions` there is nothing to resolve first: an
70
+ * allowlist is static, so the check happens in the walk.
71
+ */
72
+ readonly origins?: FrameOriginRegistry;
73
+ /**
74
+ * The host's answer for the strings primitives declared — a dictionary, in the
75
+ * language this deployment serves. Absent means the declared strings render as
76
+ * their authors wrote them, which is what an untranslated deployment wants and
77
+ * needs no wiring: the renderer reads declarations off `resolver` when that
78
+ * resolver is a registry (0063). `textResolverFor` builds one of these from a
79
+ * registry and a dictionary.
80
+ *
81
+ * A key this does not answer keeps its declared string, so a partial
82
+ * dictionary is a partial translation rather than a missing accessible name.
83
+ * There is deliberately no wiring that suppresses a declared string: a control
84
+ * with no accessible name is the failure the seam exists to prevent, and it
85
+ * should not be reachable by leaving something out.
86
+ */
87
+ readonly text?: TextResolver;
88
+ /** Off by default: decoration is opt-in per request, never ambient. */
89
+ readonly editMode?: boolean;
90
+ /**
91
+ * Stamp each element's identity on the markup without anything else edit mode
92
+ * means, so a published page can say which node a reader saw or clicked.
93
+ *
94
+ * Off by default, and the markup is byte-identical when it is off. It writes
95
+ * exactly the attributes edit mode writes — node id and type on every
96
+ * decorated element, the tree id and revision on the root — because those are
97
+ * the addresses an event about a reader has to carry (0136).
98
+ */
99
+ readonly addressed?: boolean;
100
+ readonly slots?: SlotContent;
101
+ /**
102
+ * How the mounted theme reaches the elements: as the `var()` references
103
+ * primitives write, or as the values those references stand for.
104
+ *
105
+ * `"variables"` is the default and is what a browser wants — one mount on the
106
+ * root, the cascade underneath it, and a re-theme that touches no node (0049,
107
+ * 0050). `"literals"` is for a medium with no cascade to read them: an image
108
+ * renderer takes inline styles and literal values, and resolves no custom
109
+ * properties, so a share card or an email built out of a real tree needs the
110
+ * substitution done before it leaves here. See `inline-variables.ts` for what
111
+ * this reaches and what it cannot.
112
+ */
113
+ readonly themeValues?: "variables" | "literals";
114
+ };
115
+ export type RenderOutput = {
116
+ readonly element: ReactNode;
117
+ readonly diagnostics: readonly RenderDiagnostic[];
118
+ /**
119
+ * What the root is wearing, absent when the tree named no theme or the render
120
+ * could not resolve it. The variables are already mounted; this is here so a
121
+ * caller can *say* which palette it served without resolving the ids again.
122
+ */
123
+ readonly theme?: ResolvedTheme;
124
+ };
125
+ export declare const renderLoomTree: (tree: LoomTree, options: RenderOptions) => RenderOutput;
126
+ export type ExcerptOutput = RenderOutput & {
127
+ /**
128
+ * Whether the tree holds the node asked for. `false` comes with a null
129
+ * element and an `excerpt-absent` diagnostic; it is here because it is the
130
+ * one thing every caller branches on, and scanning a diagnostic array to
131
+ * decide whether to render a fallback is worse than being told.
132
+ */
133
+ readonly found: boolean;
134
+ };
135
+ /**
136
+ * Part of a tree, rendered on its own and wearing the tree's theme.
137
+ *
138
+ * A preview, an inspector and a side-by-side are all the same shape: one node of
139
+ * a page, shown somewhere that is not the page. Rendering one by hand loses the
140
+ * theme silently. 0049 mounts a theme on the *root primitive* — `loom.page` puts
141
+ * the variables on its own element — so a walk that starts anywhere else hands
142
+ * `var(--loom-…)` to a subtree with nothing above it to resolve them, and
143
+ * `resolveTheme` is right to call that node unthemed. Nothing is wrong; there is
144
+ * simply no theme, and no diagnostic says so because none is owed.
145
+ *
146
+ * So the seam mounts it, on an element of its own around the excerpt:
147
+ *
148
+ * - **The excerpt is self-contained.** It carries the variables it references,
149
+ * whichever node it starts from, and can be dropped into a page that owns a
150
+ * different theme or none at all.
151
+ * - **The wrapper is always there and always carries the theme**, the root
152
+ * included. An excerpt of the root then mounts the same variables twice, on
153
+ * nested elements, which is the same values by construction — and the rule a
154
+ * caller can hold is *the excerpt carries its theme* rather than *the excerpt
155
+ * carries its theme unless you asked for the node that carries it already*.
156
+ *
157
+ * Everything else is the page render: the same walk, the same resolvers, the
158
+ * same diagnostics. The excerpt's root is not the tree's root, so it does not
159
+ * receive the root's `theme` prop, its editable attributes name no tree, and a
160
+ * `loom:theme` sitting on it is `theme-misplaced` — all of which is what those
161
+ * rules already say, applied to a node that is not the root.
162
+ */
163
+ export declare const renderLoomExcerpt: (tree: LoomTree, nodeId: NodeId, options: RenderOptions) => ExcerptOutput;
164
+ //# sourceMappingURL=render.d.ts.map