@jam-overture/loom 0.1.0 → 0.3.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 (414) hide show
  1. package/README.md +3 -1
  2. package/dist/application/application.d.ts +109 -0
  3. package/dist/application/application.js +97 -0
  4. package/dist/application/memory.d.ts +20 -0
  5. package/dist/application/memory.js +79 -0
  6. package/dist/application/store.d.ts +101 -0
  7. package/dist/application/store.js +25 -0
  8. package/dist/audience/audience.d.ts +36 -0
  9. package/dist/audience/audience.js +41 -0
  10. package/dist/audience/compose.d.ts +112 -0
  11. package/dist/audience/compose.js +134 -0
  12. package/dist/audience/memory.d.ts +14 -0
  13. package/dist/audience/memory.js +71 -0
  14. package/dist/audience/overlay-store.d.ts +343 -0
  15. package/dist/audience/overlay-store.js +217 -0
  16. package/dist/audience/rule.d.ts +121 -0
  17. package/dist/audience/rule.js +78 -0
  18. package/dist/cli/index.d.ts +3 -4
  19. package/dist/cli/index.js +3 -4
  20. package/dist/cli/templates.js +19 -0
  21. package/dist/data/adapter.d.ts +9 -1
  22. package/dist/data/adapter.js +2 -0
  23. package/dist/data/plan.js +0 -0
  24. package/dist/data/resolution.d.ts +23 -1
  25. package/dist/data/resolve.d.ts +31 -4
  26. package/dist/data/resolve.js +11 -3
  27. package/dist/ids.d.ts +10 -0
  28. package/dist/ids.js +11 -1
  29. package/dist/index.d.ts +1 -0
  30. package/dist/index.js +1 -0
  31. package/dist/interpretation/anthropic.d.ts +1 -1
  32. package/dist/interpretation/anthropic.js +2 -22
  33. package/dist/interpretation/client.d.ts +1 -1
  34. package/dist/interpretation/materialize.js +67 -22
  35. package/dist/interpretation/openai-compatible.d.ts +36 -0
  36. package/dist/interpretation/openai-compatible.js +79 -0
  37. package/dist/interpretation/status.d.ts +19 -0
  38. package/dist/interpretation/status.js +26 -0
  39. package/dist/live/index.d.ts +73 -0
  40. package/dist/live/index.js +73 -0
  41. package/dist/live/pages.d.ts +187 -0
  42. package/dist/live/pages.js +161 -0
  43. package/dist/live/pull.d.ts +147 -0
  44. package/dist/live/pull.js +398 -0
  45. package/dist/live/pulling.d.ts +79 -0
  46. package/dist/live/pulling.js +117 -0
  47. package/dist/live/window.d.ts +129 -0
  48. package/dist/live/window.js +132 -0
  49. package/dist/patch.d.ts +54 -0
  50. package/dist/patch.js +44 -0
  51. package/dist/project/closing.d.ts +51 -0
  52. package/dist/project/closing.js +53 -0
  53. package/dist/project/memory.d.ts +20 -0
  54. package/dist/project/memory.js +97 -0
  55. package/dist/project/project.d.ts +90 -0
  56. package/dist/project/project.js +91 -0
  57. package/dist/project/store.d.ts +135 -0
  58. package/dist/project/store.js +41 -0
  59. package/dist/registered.d.ts +64 -0
  60. package/dist/registered.js +118 -0
  61. package/dist/render/addressed.d.ts +35 -0
  62. package/dist/render/addressed.js +79 -0
  63. package/dist/render/behaviour-adjust.d.ts +11 -19
  64. package/dist/render/behaviour-adjust.js +75 -21
  65. package/dist/render/behaviour-present.d.ts +8 -0
  66. package/dist/render/behaviour-present.js +57 -6
  67. package/dist/render/behaviour.d.ts +98 -17
  68. package/dist/render/behaviour.js +91 -26
  69. package/dist/render/control-name.d.ts +68 -0
  70. package/dist/render/control-name.js +37 -0
  71. package/dist/render/diagnostics.d.ts +72 -0
  72. package/dist/render/diagnostics.js +7 -0
  73. package/dist/render/document-theme.d.ts +70 -0
  74. package/dist/render/document-theme.js +139 -0
  75. package/dist/render/editable.d.ts +15 -1
  76. package/dist/render/editable.js +13 -1
  77. package/dist/render/expected.d.ts +98 -0
  78. package/dist/render/expected.js +88 -0
  79. package/dist/render/index.d.ts +4 -0
  80. package/dist/render/index.js +4 -0
  81. package/dist/render/reads.d.ts +11 -0
  82. package/dist/render/reads.js +12 -1
  83. package/dist/render/render.d.ts +11 -0
  84. package/dist/render/render.js +294 -53
  85. package/dist/render/request.d.ts +8 -1
  86. package/dist/render/request.js +1 -0
  87. package/dist/render/slots.d.ts +52 -0
  88. package/dist/render/slots.js +24 -0
  89. package/dist/render/theme.d.ts +54 -1
  90. package/dist/render/theme.js +23 -1
  91. package/dist/render/unshown.d.ts +152 -0
  92. package/dist/render/unshown.js +80 -0
  93. package/dist/runtime/analysis.d.ts +94 -9
  94. package/dist/runtime/analysis.js +54 -9
  95. package/dist/runtime/assessment.d.ts +36 -2
  96. package/dist/runtime/assessment.js +27 -2
  97. package/dist/runtime/auto-apply-ceiling.d.ts +54 -0
  98. package/dist/runtime/auto-apply-ceiling.js +66 -0
  99. package/dist/runtime/checks.d.ts +148 -0
  100. package/dist/runtime/checks.js +112 -0
  101. package/dist/runtime/disposition.d.ts +96 -0
  102. package/dist/runtime/disposition.js +46 -0
  103. package/dist/runtime/gate.js +91 -10
  104. package/dist/runtime/index.d.ts +4 -0
  105. package/dist/runtime/index.js +4 -0
  106. package/dist/runtime/irreversibility.d.ts +64 -0
  107. package/dist/runtime/irreversibility.js +45 -0
  108. package/dist/runtime/nesting.d.ts +13 -1
  109. package/dist/runtime/nesting.js +41 -24
  110. package/dist/runtime/pipeline.d.ts +43 -0
  111. package/dist/runtime/pipeline.js +10 -2
  112. package/dist/runtime/policy-change.d.ts +93 -0
  113. package/dist/runtime/policy-change.js +305 -0
  114. package/dist/runtime/policy-log.d.ts +406 -0
  115. package/dist/runtime/policy-log.js +285 -0
  116. package/dist/runtime/policy.d.ts +8 -6
  117. package/dist/runtime/policy.js +5 -2
  118. package/dist/runtime/repointing.js +0 -0
  119. package/dist/runtime/reversibility.d.ts +11 -9
  120. package/dist/runtime/stakes.d.ts +129 -1
  121. package/dist/runtime/stakes.js +240 -26
  122. package/dist/runtime/vocabulary.d.ts +164 -7
  123. package/dist/runtime/vocabulary.js +181 -8
  124. package/dist/sdk/audit.d.ts +174 -3
  125. package/dist/sdk/audit.js +176 -17
  126. package/dist/sdk/catalogue.d.ts +9 -1
  127. package/dist/sdk/conformance.d.ts +37 -3
  128. package/dist/sdk/conformance.js +25 -4
  129. package/dist/sdk/definition.d.ts +129 -5
  130. package/dist/sdk/definition.js +66 -0
  131. package/dist/sdk/registry.d.ts +45 -2
  132. package/dist/sdk/registry.js +102 -1
  133. package/dist/signals/acted.contract.d.ts +21 -0
  134. package/dist/signals/acted.contract.js +236 -0
  135. package/dist/signals/acted.d.ts +359 -0
  136. package/dist/signals/acted.js +135 -0
  137. package/dist/signals/action-change.d.ts +507 -0
  138. package/dist/signals/action-change.js +265 -0
  139. package/dist/signals/action.d.ts +331 -0
  140. package/dist/signals/action.js +182 -0
  141. package/dist/signals/agenda.d.ts +585 -0
  142. package/dist/signals/agenda.js +295 -0
  143. package/dist/signals/applied-window.contract.d.ts +23 -0
  144. package/dist/signals/applied-window.contract.js +160 -0
  145. package/dist/signals/arrivals.contract.d.ts +21 -0
  146. package/dist/signals/arrivals.contract.js +180 -0
  147. package/dist/signals/arrivals.d.ts +375 -0
  148. package/dist/signals/arrivals.js +254 -0
  149. package/dist/signals/arriving.d.ts +210 -0
  150. package/dist/signals/arriving.js +133 -0
  151. package/dist/signals/audiences.d.ts +528 -0
  152. package/dist/signals/audiences.js +255 -0
  153. package/dist/signals/broadcast.d.ts +33 -17
  154. package/dist/signals/broadcast.js +255 -32
  155. package/dist/signals/change.d.ts +378 -0
  156. package/dist/signals/change.js +327 -0
  157. package/dist/signals/collect.d.ts +169 -34
  158. package/dist/signals/collect.js +186 -38
  159. package/dist/signals/conversion.d.ts +348 -0
  160. package/dist/signals/conversion.js +235 -0
  161. package/dist/signals/copy-change.d.ts +553 -0
  162. package/dist/signals/copy-change.js +377 -0
  163. package/dist/signals/copy.d.ts +337 -0
  164. package/dist/signals/copy.js +211 -0
  165. package/dist/signals/correlated.contract.d.ts +24 -0
  166. package/dist/signals/correlated.contract.js +94 -0
  167. package/dist/signals/counters.d.ts +97 -0
  168. package/dist/signals/counters.js +160 -0
  169. package/dist/signals/deliver.d.ts +23 -4
  170. package/dist/signals/deliver.js +34 -6
  171. package/dist/signals/deployment-change.d.ts +395 -0
  172. package/dist/signals/deployment-change.js +309 -0
  173. package/dist/signals/deployment.d.ts +278 -0
  174. package/dist/signals/deployment.js +178 -0
  175. package/dist/signals/door.d.ts +114 -0
  176. package/dist/signals/door.js +77 -0
  177. package/dist/signals/expire.d.ts +192 -0
  178. package/dist/signals/expire.js +213 -0
  179. package/dist/signals/fold.d.ts +10 -0
  180. package/dist/signals/fold.js +5 -1
  181. package/dist/signals/form-action.d.ts +302 -0
  182. package/dist/signals/form-action.js +169 -0
  183. package/dist/signals/form-copy.d.ts +523 -0
  184. package/dist/signals/form-copy.js +346 -0
  185. package/dist/signals/forms.d.ts +247 -0
  186. package/dist/signals/forms.js +147 -0
  187. package/dist/signals/frontier.d.ts +268 -0
  188. package/dist/signals/frontier.js +145 -0
  189. package/dist/signals/funnel-change.d.ts +548 -0
  190. package/dist/signals/funnel-change.js +361 -0
  191. package/dist/signals/funnel-hours.contract.d.ts +21 -0
  192. package/dist/signals/funnel-hours.contract.js +221 -0
  193. package/dist/signals/funnel-hours.d.ts +293 -0
  194. package/dist/signals/funnel-hours.js +99 -0
  195. package/dist/signals/funnel.d.ts +592 -0
  196. package/dist/signals/funnel.js +231 -0
  197. package/dist/signals/health.d.ts +694 -0
  198. package/dist/signals/health.js +573 -0
  199. package/dist/signals/index.d.ts +60 -0
  200. package/dist/signals/index.js +60 -0
  201. package/dist/signals/ingest.d.ts +56 -1
  202. package/dist/signals/ingest.js +91 -1
  203. package/dist/signals/inside.d.ts +190 -0
  204. package/dist/signals/inside.js +263 -0
  205. package/dist/signals/join.d.ts +56 -0
  206. package/dist/signals/join.js +60 -0
  207. package/dist/signals/journal.d.ts +123 -9
  208. package/dist/signals/kept.contract.d.ts +22 -0
  209. package/dist/signals/kept.contract.js +111 -0
  210. package/dist/signals/kinds.d.ts +8 -6
  211. package/dist/signals/kinds.js +14 -6
  212. package/dist/signals/library-action.d.ts +430 -0
  213. package/dist/signals/library-action.js +336 -0
  214. package/dist/signals/library-agenda-change.d.ts +324 -0
  215. package/dist/signals/library-agenda-change.js +199 -0
  216. package/dist/signals/library-agenda.d.ts +258 -0
  217. package/dist/signals/library-agenda.js +167 -0
  218. package/dist/signals/library-change.d.ts +477 -0
  219. package/dist/signals/library-change.js +335 -0
  220. package/dist/signals/library-copy-change.d.ts +498 -0
  221. package/dist/signals/library-copy-change.js +476 -0
  222. package/dist/signals/library-pace.d.ts +319 -0
  223. package/dist/signals/library-pace.js +305 -0
  224. package/dist/signals/library-reach-change.d.ts +646 -0
  225. package/dist/signals/library-reach-change.js +542 -0
  226. package/dist/signals/library-reach.d.ts +377 -0
  227. package/dist/signals/library-reach.js +227 -0
  228. package/dist/signals/library-senders-change.d.ts +457 -0
  229. package/dist/signals/library-senders-change.js +367 -0
  230. package/dist/signals/library-senders-reach-change.d.ts +486 -0
  231. package/dist/signals/library-senders-reach-change.js +538 -0
  232. package/dist/signals/library-senders-reach.d.ts +340 -0
  233. package/dist/signals/library-senders-reach.js +252 -0
  234. package/dist/signals/library-senders.d.ts +271 -0
  235. package/dist/signals/library-senders.js +180 -0
  236. package/dist/signals/library-word-reach-change.d.ts +567 -0
  237. package/dist/signals/library-word-reach-change.js +564 -0
  238. package/dist/signals/library.d.ts +306 -0
  239. package/dist/signals/library.js +178 -0
  240. package/dist/signals/memory.d.ts +9 -0
  241. package/dist/signals/memory.js +246 -14
  242. package/dist/signals/migrate.d.ts +20 -4
  243. package/dist/signals/migrate.js +269 -8
  244. package/dist/signals/notice.d.ts +389 -0
  245. package/dist/signals/notice.js +250 -0
  246. package/dist/signals/pace-change.d.ts +501 -0
  247. package/dist/signals/pace-change.js +310 -0
  248. package/dist/signals/pace.d.ts +296 -0
  249. package/dist/signals/pace.js +291 -0
  250. package/dist/signals/page-views.d.ts +365 -0
  251. package/dist/signals/page-views.js +218 -0
  252. package/dist/signals/part-pace.d.ts +378 -0
  253. package/dist/signals/part-pace.js +333 -0
  254. package/dist/signals/parts.d.ts +354 -0
  255. package/dist/signals/parts.js +232 -0
  256. package/dist/signals/postgres.d.ts +16 -2
  257. package/dist/signals/postgres.js +753 -76
  258. package/dist/signals/progress.d.ts +212 -0
  259. package/dist/signals/progress.js +150 -0
  260. package/dist/signals/ratios.d.ts +108 -0
  261. package/dist/signals/ratios.js +40 -0
  262. package/dist/signals/reach.d.ts +309 -0
  263. package/dist/signals/reach.js +93 -0
  264. package/dist/signals/readable.d.ts +34 -0
  265. package/dist/signals/readable.js +34 -0
  266. package/dist/signals/readership.d.ts +381 -0
  267. package/dist/signals/readership.js +308 -0
  268. package/dist/signals/region-pages.d.ts +173 -0
  269. package/dist/signals/region-pages.js +62 -0
  270. package/dist/signals/region.d.ts +287 -0
  271. package/dist/signals/region.js +198 -0
  272. package/dist/signals/retention.d.ts +163 -0
  273. package/dist/signals/retention.js +75 -0
  274. package/dist/signals/rhythm.d.ts +302 -0
  275. package/dist/signals/rhythm.js +262 -0
  276. package/dist/signals/rollup.d.ts +194 -4
  277. package/dist/signals/rollup.js +0 -0
  278. package/dist/signals/schema.d.ts +1069 -1
  279. package/dist/signals/schema.js +393 -3
  280. package/dist/signals/signal.d.ts +237 -11
  281. package/dist/signals/signal.js +70 -10
  282. package/dist/signals/silence-census.d.ts +205 -0
  283. package/dist/signals/silence-census.js +87 -0
  284. package/dist/signals/silences.d.ts +1147 -0
  285. package/dist/signals/silences.js +996 -0
  286. package/dist/signals/subtrees.d.ts +123 -0
  287. package/dist/signals/subtrees.js +102 -0
  288. package/dist/signals/tally.d.ts +262 -12
  289. package/dist/signals/unread.d.ts +292 -0
  290. package/dist/signals/unread.js +137 -0
  291. package/dist/signals/window-agenda.d.ts +276 -0
  292. package/dist/signals/window-agenda.js +83 -0
  293. package/dist/signals/window-figures.d.ts +148 -0
  294. package/dist/signals/window-figures.js +42 -0
  295. package/dist/signals/window-funnels.d.ts +88 -0
  296. package/dist/signals/window-funnels.js +47 -0
  297. package/dist/signals/window.d.ts +866 -0
  298. package/dist/signals/window.js +693 -0
  299. package/dist/signals/words.d.ts +24 -0
  300. package/dist/signals/words.js +24 -0
  301. package/dist/store/cache.d.ts +101 -0
  302. package/dist/store/cache.js +149 -0
  303. package/dist/store/history.d.ts +82 -0
  304. package/dist/store/history.js +36 -0
  305. package/dist/store/index.d.ts +30 -0
  306. package/dist/store/index.js +30 -0
  307. package/dist/store/memory.d.ts +2 -1
  308. package/dist/store/memory.js +48 -12
  309. package/dist/store/migrate.d.ts +106 -0
  310. package/dist/store/migrate.js +323 -7
  311. package/dist/store/postgres-applications.d.ts +4 -0
  312. package/dist/store/postgres-applications.js +197 -0
  313. package/dist/store/postgres-audience.d.ts +14 -0
  314. package/dist/store/postgres-audience.js +272 -0
  315. package/dist/store/postgres-holds.d.ts +10 -1
  316. package/dist/store/postgres-holds.js +116 -101
  317. package/dist/store/postgres-policy-log.d.ts +14 -0
  318. package/dist/store/postgres-policy-log.js +240 -0
  319. package/dist/store/postgres-projects.d.ts +4 -0
  320. package/dist/store/postgres-projects.js +217 -0
  321. package/dist/store/postgres.d.ts +17 -1
  322. package/dist/store/postgres.js +60 -9
  323. package/dist/store/replay.d.ts +102 -1
  324. package/dist/store/replay.js +190 -19
  325. package/dist/store/reseed.d.ts +238 -0
  326. package/dist/store/reseed.js +308 -0
  327. package/dist/store/schema.d.ts +762 -2
  328. package/dist/store/schema.js +218 -5
  329. package/dist/store/source.d.ts +57 -1
  330. package/dist/store/source.js +65 -1
  331. package/dist/store/store.d.ts +29 -6
  332. package/dist/submit/resolve.d.ts +1 -1
  333. package/dist/submit/resolve.js +2 -1
  334. package/dist/telemetry/calibration.d.ts +25 -0
  335. package/dist/telemetry/calibration.js +27 -1
  336. package/dist/telemetry/event.d.ts +391 -33
  337. package/dist/telemetry/event.js +84 -20
  338. package/dist/telemetry/index.d.ts +2 -0
  339. package/dist/telemetry/index.js +2 -0
  340. package/dist/telemetry/journal.d.ts +104 -3
  341. package/dist/telemetry/journal.js +9 -0
  342. package/dist/telemetry/lookup.d.ts +27 -0
  343. package/dist/telemetry/lookup.js +18 -0
  344. package/dist/telemetry/memory.js +33 -1
  345. package/dist/telemetry/migrate.js +22 -1
  346. package/dist/telemetry/postgres.d.ts +10 -1
  347. package/dist/telemetry/postgres.js +188 -90
  348. package/dist/telemetry/remeasure.d.ts +78 -0
  349. package/dist/telemetry/remeasure.js +83 -0
  350. package/dist/telemetry/retention.d.ts +2 -2
  351. package/dist/telemetry/schema.d.ts +17 -0
  352. package/dist/telemetry/schema.js +27 -1
  353. package/dist/telemetry/sink.d.ts +2 -2
  354. package/dist/telemetry/window.d.ts +135 -0
  355. package/dist/telemetry/window.js +101 -0
  356. package/dist/testing/application-contract.d.ts +14 -0
  357. package/dist/testing/application-contract.js +270 -0
  358. package/dist/testing/audience-overlay-contract.d.ts +31 -0
  359. package/dist/testing/audience-overlay-contract.js +354 -0
  360. package/dist/testing/contracts.d.ts +13 -7
  361. package/dist/testing/contracts.js +13 -7
  362. package/dist/testing/definitions.d.ts +78 -0
  363. package/dist/testing/definitions.js +134 -9
  364. package/dist/testing/doubles.d.ts +103 -0
  365. package/dist/testing/doubles.js +143 -0
  366. package/dist/testing/index.d.ts +2 -2
  367. package/dist/testing/index.js +2 -2
  368. package/dist/testing/journal-contract.js +297 -6
  369. package/dist/testing/model-contract.d.ts +110 -0
  370. package/dist/testing/model-contract.js +150 -0
  371. package/dist/testing/policy-log-contract.d.ts +26 -0
  372. package/dist/testing/policy-log-contract.js +344 -0
  373. package/dist/testing/project-contract.d.ts +14 -0
  374. package/dist/testing/project-contract.js +266 -0
  375. package/dist/testing/reader-signal-contract.d.ts +27 -2
  376. package/dist/testing/reader-signal-contract.js +475 -5
  377. package/dist/testing/store-contract.d.ts +7 -1
  378. package/dist/testing/store-contract.js +84 -3
  379. package/dist/theme/apply.d.ts +20 -1
  380. package/dist/theme/apply.js +5 -3
  381. package/dist/theme/contrast.d.ts +19 -14
  382. package/dist/theme/contrast.js +181 -17
  383. package/dist/theme/derive.d.ts +22 -0
  384. package/dist/theme/derive.js +54 -1
  385. package/dist/theme/library.js +1 -1
  386. package/dist/theme/measure.d.ts +34 -0
  387. package/dist/theme/measure.js +30 -1
  388. package/dist/theme/palettes.js +7 -7
  389. package/dist/theme/ramp.d.ts +64 -0
  390. package/dist/theme/ramp.js +114 -0
  391. package/dist/theme/registry.d.ts +9 -0
  392. package/dist/theme/registry.js +11 -1
  393. package/dist/theme/separation.d.ts +97 -3
  394. package/dist/theme/separation.js +75 -0
  395. package/dist/tree/apply.js +13 -0
  396. package/dist/tree/compare.d.ts +9 -0
  397. package/dist/tree/compare.js +18 -0
  398. package/dist/tree/mutation.d.ts +18 -0
  399. package/dist/tree/mutation.js +24 -12
  400. package/dist/tree/navigation.d.ts +5 -0
  401. package/dist/tree/navigation.js +32 -10
  402. package/dist/tree/outline.d.ts +7 -0
  403. package/dist/tree/outline.js +9 -5
  404. package/dist/write/computed.d.ts +60 -0
  405. package/dist/write/computed.js +61 -0
  406. package/dist/write/held.d.ts +59 -0
  407. package/dist/write/index.d.ts +5 -2
  408. package/dist/write/index.js +5 -2
  409. package/dist/write/reseed.d.ts +151 -0
  410. package/dist/write/reseed.js +184 -0
  411. package/dist/write/revert.js +2 -16
  412. package/package.json +25 -3
  413. package/dist/runtime/inverse-interpreter.d.ts +0 -90
  414. package/dist/runtime/inverse-interpreter.js +0 -56
@@ -3,8 +3,10 @@ import { AdjustControl } from "./behaviour-adjust.js";
3
3
  import { CopyControl } from "./behaviour-copy.js";
4
4
  import { DiscloseControl } from "./behaviour-disclose.js";
5
5
  import { DismissControl, PresentControl } from "./behaviour-present.js";
6
+ import { NO_CONTROL_NAMES } from "./control-name.js";
6
7
  export { DISCLOSED_ATTRIBUTE } from "./disclosed.js";
7
8
  export { DISMISS_EVENT, PRESENTED_ATTRIBUTE } from "./presented.js";
9
+ export { NO_CONTROL_NAME_PROPS, NO_CONTROL_NAMES, resolveControlNames, } from "./control-name.js";
8
10
  /**
9
11
  * The behaviour seam: the things a primitive *does* that its props cannot carry.
10
12
  *
@@ -81,6 +83,19 @@ export { DISMISS_EVENT, PRESENTED_ATTRIBUTE } from "./presented.js";
81
83
  * carries why, and [0176](../../decisions/0176-a-control-may-be-answerable-to-another-control-and-they-agree-through-the-dom.md)
82
84
  * records what was rejected.
83
85
  *
86
+ * A fifth axis arrived with the first control whose word is not the framework's:
87
+ * **where a control's name comes from.** Every member's name is a string its
88
+ * primitive declared, per type, so every code panel's button reads *Copy* and a
89
+ * dictionary can translate all of them at once. That is right for an affordance
90
+ * and wrong for a trigger whose words are the page's own — *Watch the demo* is
91
+ * content, and a dialog opened by a chip reading *Open* is a worse page than no
92
+ * dialog. So a primitive may name one of its own props as where a control takes
93
+ * its name from, the runtime reads it off the node, and the declared string stays
94
+ * underneath as the floor; `control-name.ts` carries why that is narrower than a
95
+ * reserved prop, and
96
+ * [0234](../../decisions/0234-a-primitive-may-name-a-control-from-the-tree-and-its-declared-string-is-the-floor.md)
97
+ * records what was rejected.
98
+ *
84
99
  * What a control hands back is not the same question as what a primitive may say
85
100
  * about it, and the second one lives in `control.ts`: the class every control
86
101
  * carries, and the custom property that decides whether it is displayed. Both
@@ -115,14 +130,26 @@ export const BEHAVIOUR_NAMES = ["copy", "disclose", "adjust", "present", "dismis
115
130
  * .after { clip-path: inset(0 calc(100% - var(--loom-adjust, 50) * 1%) 0 0) }
116
131
  * ```
117
132
  *
118
- * **The fallback is not optional and not decoration.** The property is absent
119
- * until the control has mounted and proved scripting runs, and absent again the
120
- * moment it unmounts — so the second argument to `var()` is what a page served
121
- * with scripting off renders, and it should be the position the primitive's own
122
- * props declared. That is what keeps the still version of a comparison the thing
123
- * that ships, rather than a blank waiting on a control that may never arrive.
133
+ * **The fallback is not optional and not decoration**, and it holds for longer
134
+ * than it first appeared to. The property is absent until **the reader has
135
+ * moved the control**, and absent again the moment it unmounts — so the second
136
+ * argument to `var()` is what a page renders both with scripting off and with
137
+ * scripting on and nobody having touched it yet. It should be the position the
138
+ * primitive's own props declared.
139
+ *
140
+ * It was written as absent until the control *mounted*, which made a declared
141
+ * position visible only on an unscripted page: the control published the
142
+ * runtime's midpoint in its mount effect, so a band authored at 35 rendered at
143
+ * 35 and jumped to 50 as hydration landed. A control now publishes nothing it
144
+ * was not asked for, and says where it starts through
145
+ * {@link ADJUST_RESTING_PROPERTY} instead. Every taker was already required to
146
+ * write a fallback, so the narrower contract takes nothing away from one that
147
+ * followed it.
124
148
  *
125
- * See [0096](../../decisions/0096-a-behaviour-publishes-a-value-on-the-element-the-primitive-placed-it-in.md).
149
+ * See [0096](../../decisions/0096-a-behaviour-publishes-a-value-on-the-element-the-primitive-placed-it-in.md)
150
+ * for where the property goes and
151
+ * [0226](../../decisions/0226-a-primitive-declares-where-its-control-rests-and-the-control-publishes-nothing-until-the-reader-moves-it.md)
152
+ * for when it is written.
126
153
  */
127
154
  export const ADJUST_PROPERTY = "--loom-adjust";
128
155
  /** The bottom of an adjust control's range. */
@@ -137,14 +164,45 @@ export const ADJUST_MINIMUM = 0;
137
164
  */
138
165
  export const ADJUST_MAXIMUM = 100;
139
166
  /**
140
- * Where the control sits before anybody moves it.
167
+ * The property a primitive declares to say **where its control should start**,
168
+ * on the element it places the control in. Read once, at mount, and never
169
+ * again — where the slider goes after that is the reader's.
170
+ *
171
+ * It exists because the obvious route to the same number is closed. `build`
172
+ * receives a node's text and its content, not its props, and that is 0086's
173
+ * shape rather than an omission: props are AI-authored, and a control a model
174
+ * configures is the thing the behaviour seam exists to prevent. So the number
175
+ * does not come through the seam. It comes the way `present` and `dismiss`
176
+ * agree (0176) — **through the DOM**, off the one element the primitive already
177
+ * chose by deciding where the control goes.
178
+ *
179
+ * Nothing new is exposed by that. A primitive taking `adjust` already renders
180
+ * its declared position into the page, as the `var()` fallback the still
181
+ * version is built on; this is the same number written where the control can
182
+ * read it, so the control starts where the page already is:
183
+ *
184
+ * ```ts
185
+ * const wipe = `var(${ADJUST_PROPERTY}, ${position})`
186
+ * // on the element the control is placed in:
187
+ * style: { [ADJUST_RESTING_PROPERTY]: position, ... }
188
+ * ```
189
+ *
190
+ * Declaring it is optional and a primitive that leaves it out gets
191
+ * {@link ADJUST_RESTING}. What it may not do is declare one number here and a
192
+ * different one as the `var()` fallback — the first is where the control
193
+ * starts, the second is what a page with no scripting shows, and a page where
194
+ * those disagree is a page that moves on hydration. See
195
+ * [0226](../../decisions/0226-a-primitive-declares-where-its-control-rests-and-the-control-publishes-nothing-until-the-reader-moves-it.md).
196
+ */
197
+ export const ADJUST_RESTING_PROPERTY = "--loom-adjust-resting";
198
+ /**
199
+ * Where the control sits when nothing declared otherwise.
141
200
  *
142
- * The midpoint, and it is the control's rather than the primitive's on purpose.
143
- * `build` receives the node's text and its content, not its props, so there is
144
- * nothing here that could read a declared position — and nothing that needs to:
145
- * the primitive supplies its own position as the `var()` fallback, which covers
146
- * the case that actually matters, the page where the control never mounts. Once
147
- * a reader has a slider in front of them, where it started is theirs to change.
201
+ * The midpoint, and it is the runtime's floor rather than the answer: a
202
+ * primitive that has a position of its own says so with
203
+ * {@link ADJUST_RESTING_PROPERTY}, and this is what a primitive with no opinion
204
+ * gets. Fixed rather than declarable per node, for the reason the range is
205
+ * fixed — what a control rests at is not a model's to write.
148
206
  */
149
207
  export const ADJUST_RESTING = 50;
150
208
  export const BEHAVIOURS = {
@@ -152,9 +210,9 @@ export const BEHAVIOURS = {
152
210
  description: "A control that puts the node's own text on the clipboard, and shows itself only where the clipboard is actually available.",
153
211
  text: ["copy", "copied"],
154
212
  rendersControl: true,
155
- build: (content, text) => createElement(CopyControl, {
213
+ build: (content, text, name) => createElement(CopyControl, {
156
214
  value: content,
157
- label: text.copy ?? "",
215
+ label: name ?? text.copy ?? "",
158
216
  copiedLabel: text.copied ?? "",
159
217
  }),
160
218
  },
@@ -173,8 +231,8 @@ export const BEHAVIOURS = {
173
231
  description: "A control that opens and closes a region the primitive lays out beside it, and shows itself only where scripting actually runs.",
174
232
  text: ["disclose"],
175
233
  rendersControl: true,
176
- build: (_content, text) => createElement(DiscloseControl, {
177
- label: text.disclose ?? "",
234
+ build: (_content, text, name) => createElement(DiscloseControl, {
235
+ label: name ?? text.disclose ?? "",
178
236
  }),
179
237
  },
180
238
  /**
@@ -195,8 +253,8 @@ export const BEHAVIOURS = {
195
253
  description: "A control the reader drags to choose a number, published to the primitive as a CSS custom property so a stylesheet can compute a length from it.",
196
254
  text: ["adjust"],
197
255
  rendersControl: true,
198
- build: (_content, text) => createElement(AdjustControl, {
199
- label: text.adjust ?? "",
256
+ build: (_content, text, name) => createElement(AdjustControl, {
257
+ label: name ?? text.adjust ?? "",
200
258
  }),
201
259
  },
202
260
  /**
@@ -214,8 +272,8 @@ export const BEHAVIOURS = {
214
272
  description: "A control that opens a region the primitive lays out inside it and closes again on Escape, on a press outside, or on a dismiss control within it.",
215
273
  text: ["present"],
216
274
  rendersControl: true,
217
- build: (_content, text) => createElement(PresentControl, {
218
- label: text.present ?? "",
275
+ build: (_content, text, name) => createElement(PresentControl, {
276
+ label: name ?? text.present ?? "",
219
277
  }),
220
278
  },
221
279
  /**
@@ -232,8 +290,8 @@ export const BEHAVIOURS = {
232
290
  text: ["dismiss"],
233
291
  rendersControl: true,
234
292
  requires: "present",
235
- build: (_content, text) => createElement(DismissControl, {
236
- label: text.dismiss ?? "",
293
+ build: (_content, text, name) => createElement(DismissControl, {
294
+ label: name ?? text.dismiss ?? "",
237
295
  }),
238
296
  },
239
297
  };
@@ -262,7 +320,7 @@ export const NO_RESOLVED_BEHAVIOURS = Object.freeze({
262
320
  * button, in exactly the way the finding that asked for this said a fake one
263
321
  * would be.
264
322
  */
265
- export const resolveBehaviours = (names, content, text) => {
323
+ export const resolveBehaviours = (names, content, text, named = NO_CONTROL_NAMES) => {
266
324
  if (names.length === 0)
267
325
  return NO_RESOLVED_BEHAVIOURS;
268
326
  const behaviours = Object.create(null);
@@ -270,11 +328,18 @@ export const resolveBehaviours = (names, content, text) => {
270
328
  for (const name of names) {
271
329
  const behaviour = BEHAVIOURS[name];
272
330
  const missing = behaviour.text.find((key) => (text[key] ?? "").trim() === "");
331
+ /**
332
+ * Checked before the node's own word is considered, and that order is the
333
+ * decision rather than a detail. A primitive declaring no strings is a
334
+ * primitive whose control has no name in a deployment that translates, and
335
+ * one node happening to carry a usable word does not make it translatable —
336
+ * so a tree cannot talk a nameless control onto the page.
337
+ */
273
338
  if (missing !== undefined) {
274
339
  unnamed.push({ behaviour: name, key: missing });
275
340
  continue;
276
341
  }
277
- behaviours[name] = behaviour.build(content, text);
342
+ behaviours[name] = behaviour.build(content, text, named[name]);
278
343
  }
279
344
  return {
280
345
  behaviours: Object.freeze(behaviours),
@@ -0,0 +1,68 @@
1
+ import type { JsonObject } from "../json.js";
2
+ import type { BehaviourName } from "./behaviour.js";
3
+ /**
4
+ * Where a control's name comes from when the primitive's own vocabulary is the
5
+ * wrong place to keep it.
6
+ *
7
+ * Every string a control is announced by arrives through the text seam, per
8
+ * type: one `Copy` for every code panel in a deployment, translatable by a
9
+ * dictionary a host already has. That is right for an affordance — a word that
10
+ * names the *mechanism*, which a reader wants to be the same word everywhere —
11
+ * and it is wrong for the one control whose words are the page's own. A trigger
12
+ * that opens a dialog says *Watch the demo*; the next one on the same page says
13
+ * *Book a call*; neither is a thing a dictionary should hold and neither is a
14
+ * fact about the primitive.
15
+ *
16
+ * So a primitive may name **one of its own props** as where a control takes its
17
+ * name from, and the runtime reads it off the node. Three things make that
18
+ * narrower than it sounds, and they are why this is not a reserved prop:
19
+ *
20
+ * - **The primitive opts in, per control.** Nothing a tree writes turns this on.
21
+ * The declaration lives beside `frames` and `interactive`, in the component a
22
+ * human approved once, and the registry checks it names a prop the schema
23
+ * really declares.
24
+ * - **The declared string is still the floor.** A primitive taking a behaviour
25
+ * must declare its text whether or not it names a prop, so the control has a
26
+ * name in every language before any node is written — and a node that says
27
+ * nothing gets it.
28
+ * - **A string is what crosses the seam**, not the props. What a behaviour's
29
+ * `build` receives is still the node's text, the primitive's strings and now
30
+ * one resolved word; a control that could read props is a control a model
31
+ * configures, which is the thing the seam exists to prevent.
32
+ */
33
+ /**
34
+ * What a primitive declared: the prop each of its controls is named by.
35
+ *
36
+ * Partial on purpose. A primitive naming one control and leaving the others to
37
+ * their declared strings is the ordinary case — a dialog's trigger carries the
38
+ * page's words and its cross is still *Close*.
39
+ */
40
+ export type ControlNameProps = Readonly<Partial<Record<BehaviourName, string>>>;
41
+ /** The answer for a primitive that named none, which is almost all of them. */
42
+ export declare const NO_CONTROL_NAME_PROPS: ControlNameProps;
43
+ /**
44
+ * What one node resolved to: the words each control is announced by here.
45
+ *
46
+ * Partial again, and for a second reason: a prop the primitive named may be
47
+ * absent from this node, or hold something that is not a usable name, and both
48
+ * mean *this node said nothing* rather than *this control has no name*.
49
+ */
50
+ export type ControlNames = Readonly<Partial<Record<BehaviourName, string>>>;
51
+ /** The answer for a node whose primitive named none, or that filled none in. */
52
+ export declare const NO_CONTROL_NAMES: ControlNames;
53
+ /**
54
+ * Reads the named props off one node.
55
+ *
56
+ * A value survives only if it is a string with something in it. Everything else
57
+ * — absent, `null`, a number, an object, whitespace — is dropped, and dropping
58
+ * it is the whole of the error handling here: what it falls back to is the
59
+ * string the primitive declared, which is a real name in the deployment's
60
+ * language rather than a hole.
61
+ *
62
+ * That is deliberately quieter than the frame seam, which reports a URL it
63
+ * refused. A frame that will not render is a thing the tree asked for and did
64
+ * not get; a name that was not written is a tree declining an option, and the
65
+ * page is correct either way. Nothing here is a diagnostic.
66
+ */
67
+ export declare const resolveControlNames: (props: JsonObject, declared: ControlNameProps) => ControlNames;
68
+ //# sourceMappingURL=control-name.d.ts.map
@@ -0,0 +1,37 @@
1
+ /** The answer for a primitive that named none, which is almost all of them. */
2
+ export const NO_CONTROL_NAME_PROPS = Object.freeze(Object.create(null));
3
+ /** The answer for a node whose primitive named none, or that filled none in. */
4
+ export const NO_CONTROL_NAMES = Object.freeze(Object.create(null));
5
+ /**
6
+ * Reads the named props off one node.
7
+ *
8
+ * A value survives only if it is a string with something in it. Everything else
9
+ * — absent, `null`, a number, an object, whitespace — is dropped, and dropping
10
+ * it is the whole of the error handling here: what it falls back to is the
11
+ * string the primitive declared, which is a real name in the deployment's
12
+ * language rather than a hole.
13
+ *
14
+ * That is deliberately quieter than the frame seam, which reports a URL it
15
+ * refused. A frame that will not render is a thing the tree asked for and did
16
+ * not get; a name that was not written is a tree declining an option, and the
17
+ * page is correct either way. Nothing here is a diagnostic.
18
+ */
19
+ export const resolveControlNames = (props, declared) => {
20
+ const names = Object.create(null);
21
+ let found = false;
22
+ for (const [behaviour, prop] of Object.entries(declared)) {
23
+ if (prop === undefined)
24
+ continue;
25
+ /** Own-property only: a prop called `constructor` must read as absent. */
26
+ const value = Object.hasOwn(props, prop) ? props[prop] : undefined;
27
+ if (typeof value !== "string")
28
+ continue;
29
+ const name = value.trim();
30
+ if (name === "")
31
+ continue;
32
+ names[behaviour] = name;
33
+ found = true;
34
+ }
35
+ return found ? Object.freeze(names) : NO_CONTROL_NAMES;
36
+ };
37
+ //# sourceMappingURL=control-name.js.map
@@ -9,6 +9,7 @@ import { type SubmissionError } from "../submit/declaration.js";
9
9
  import { type EndpointId, type SubmissionUnavailable } from "../submit/endpoint.js";
10
10
  import { type ThemeError } from "../theme/registry.js";
11
11
  import type { PropsIssue } from "./props.js";
12
+ import { type UnshownFault } from "./unshown.js";
12
13
  /**
13
14
  * Rendering is total: it always returns an element. Anything it could not
14
15
  * honour comes back beside the element as a diagnostic rather than as a thrown
@@ -76,6 +77,35 @@ export type RenderDiagnostic = {
76
77
  readonly code: "reserved-prop-unrecognised";
77
78
  readonly nodeId: NodeId;
78
79
  readonly key: string;
80
+ } | {
81
+ /**
82
+ * A region the node filled under a name this primitive says it places
83
+ * nowhere. The content was rendered and then mounted by nothing, and it
84
+ * took its whole subtree with it.
85
+ *
86
+ * The sibling of `data-unread`, one node over: there a resolved answer is
87
+ * dropped, and here it is authored content. It is the quieter of the two
88
+ * and the more expensive — a binding nobody reads costs a round trip and
89
+ * draws an empty state, and a region nobody places removes words somebody
90
+ * wrote from a page that still looks finished. The loss is stated where a
91
+ * slot was given its meaning (0051), and until now nothing reported it.
92
+ *
93
+ * Reported per name rather than per slot child: two children sharing a
94
+ * name are both placed, so they are dropped by one mistake.
95
+ *
96
+ * Only ever reported when the resolver can say what a primitive places,
97
+ * which a registry can and a plain map cannot. Not reported for an
98
+ * unknown primitive, whose whole subtree is already omitted and said so.
99
+ *
100
+ * **Not** the conformance probe's *unplaced* (`sdk/conformance.ts`),
101
+ * which is the opposite fault: a region the primitive *declared* and no
102
+ * probed configuration drew. That one is addressed to whoever wrote the
103
+ * component; this one is addressed to whoever wrote the tree.
104
+ */
105
+ readonly code: "slot-unplaced";
106
+ readonly nodeId: NodeId;
107
+ readonly type: PrimitiveType;
108
+ readonly name: string;
79
109
  } | {
80
110
  /**
81
111
  * `loom:data` that is not a map of binding names to registered sources.
@@ -135,6 +165,48 @@ export type RenderDiagnostic = {
135
165
  readonly nodeId: NodeId;
136
166
  readonly type: PrimitiveType;
137
167
  readonly name: string;
168
+ } | {
169
+ /**
170
+ * An answer arrived, under a name the primitive reads, and the primitive
171
+ * placed some of its rows and not the rest.
172
+ *
173
+ * The one way a binding can be wrong that is invisible from outside the
174
+ * component: each row has a shape only the primitive knows, so only the
175
+ * primitive can say that eleven of twelve stopped reading. A listing skips
176
+ * the row it cannot read and names it to the reader without a count
177
+ * (0175). There was nowhere else for it to say the count (0206).
178
+ *
179
+ * Both counts rather than the difference, because the sentence the author
180
+ * needs is *eleven of twelve*. Never the rows: a diagnostic is logged and
181
+ * a row is the host's data, the same line `data-unavailable` holds.
182
+ *
183
+ * Reported only when `shown < given`. An answer read whole is the ordinary
184
+ * case and would be one line per bound region in every log.
185
+ */
186
+ readonly code: "data-unshown";
187
+ readonly nodeId: NodeId;
188
+ readonly type: PrimitiveType;
189
+ readonly name: string;
190
+ readonly given: number;
191
+ readonly shown: number;
192
+ } | {
193
+ /**
194
+ * A primitive declares what it could not show and its declaration could
195
+ * not be believed: it threw, or it returned a reading that cannot describe
196
+ * an answer.
197
+ *
198
+ * The node renders exactly as it would have. A declaration is bookkeeping
199
+ * about an answer, not part of drawing it, and a page lost to bookkeeping
200
+ * is the worst trade available here — so the fault becomes the thing it
201
+ * was trying to report.
202
+ *
203
+ * It is the one diagnostic in this union a tree cannot cause and a
204
+ * deployment cannot cause. It is addressed to whoever wrote the component.
205
+ */
206
+ readonly code: "unshown-unreadable";
207
+ readonly nodeId: NodeId;
208
+ readonly type: PrimitiveType;
209
+ readonly fault: UnshownFault;
138
210
  } | {
139
211
  /**
140
212
  * `loom:submit` that is not an endpoint id under `to`. The node renders —
@@ -5,6 +5,7 @@ import { assertNever } from "../result.js";
5
5
  import { describeSubmissionError } from "../submit/declaration.js";
6
6
  import { describeSubmissionUnavailable, } from "../submit/endpoint.js";
7
7
  import { describeThemeError } from "../theme/registry.js";
8
+ import { describeUnshownFault } from "./unshown.js";
8
9
  const describeIssues = (issues) => issues.map((issue) => `${issue.path}: ${issue.message}`).join("; ");
9
10
  export const describeRenderDiagnostic = (diagnostic) => {
10
11
  switch (diagnostic.code) {
@@ -22,12 +23,18 @@ export const describeRenderDiagnostic = (diagnostic) => {
22
23
  return `node ${diagnostic.nodeId} names a theme and is not the root, so it was ignored — a theme is mounted once, at the render root`;
23
24
  case "reserved-prop-unrecognised":
24
25
  return `node ${diagnostic.nodeId} carries "${diagnostic.key}", which is in the runtime's reserved namespace and is read by nothing, so it was dropped`;
26
+ case "slot-unplaced":
27
+ return `node ${diagnostic.nodeId} fills the region "${diagnostic.name}" and "${diagnostic.type}" places no region of that name, so the content and everything under it was dropped`;
25
28
  case "data-misdeclared":
26
29
  return `node ${diagnostic.nodeId} declares data that is not a map of binding names to sources, so it rendered with none — ${describeBindingError(diagnostic.error)}`;
27
30
  case "data-unavailable":
28
31
  return `node ${diagnostic.nodeId} binds "${diagnostic.name}" to "${diagnostic.source}" and it could not be answered — ${describeDataUnavailable(diagnostic.unavailable)}`;
29
32
  case "data-unread":
30
33
  return `node ${diagnostic.nodeId} binds "${diagnostic.name}" and "${diagnostic.type}" does not read a binding of that name, so the answer was resolved and then read by nobody`;
34
+ case "data-unshown":
35
+ return `node ${diagnostic.nodeId} was answered ${diagnostic.given} row${diagnostic.given === 1 ? "" : "s"} under "${diagnostic.name}" and "${diagnostic.type}" showed ${diagnostic.shown} of them, so the rest arrived and were not drawn`;
36
+ case "unshown-unreadable":
37
+ return `node ${diagnostic.nodeId} is drawn by "${diagnostic.type}", which says what it could not show and could not be believed, so nothing was reported of what it dropped — ${describeUnshownFault(diagnostic.fault)}`;
31
38
  case "data-unresolved":
32
39
  return diagnostic.resolution === "absent"
33
40
  ? `node ${diagnostic.nodeId} asks for data and this render was given no resolution, so it rendered with none`
@@ -0,0 +1,70 @@
1
+ import type { RampMode } from "../theme/apply.js";
2
+ import type { ResolvedTheme } from "../theme/theme.js";
3
+ /**
4
+ * A resolved theme as the `:root` rule a host puts on its own document.
5
+ *
6
+ * Every variable `themeStyle` mounts, and then the ground — `background-color`,
7
+ * `color` and `color-scheme` — so one rule answers both the page's palette and
8
+ * the furniture around it. `:root` **is** the document element, which is what
9
+ * makes the ground reach the overscroll area past the end of a short page; the
10
+ * same declarations on a wrapper inside the document leave the browser's own
11
+ * white there, invisible under a light palette and not under the next one.
12
+ *
13
+ * Takes a `ResolvedTheme` rather than a `ThemeResolution`, the bargain
14
+ * `themeStyle` and `themeGround` both make: there is no fallback theme (0049),
15
+ * so *the tree names no theme* is the host's question about its own document and
16
+ * not one the runtime can answer by handing back a rule.
17
+ *
18
+ * **The ground may be absent and the rule is still returned.** A palette whose
19
+ * body-copy pair cannot be read gets no ground rather than a guessed one, and
20
+ * `ThemeGround` already documents what follows: whatever `color-scheme` the
21
+ * host's own stylesheet sets stands. The variables are unaffected by that and
22
+ * are the half a host cannot write for itself, so withholding the rule over it
23
+ * would cost a page its whole palette to avoid mis-stating one declaration of
24
+ * it. Every registered palette resolves both ends.
25
+ *
26
+ * Nothing is restated here: both halves are derived from the one resolved theme
27
+ * by the two functions a surface uses, so only the serialisation is this
28
+ * function's own and a re-theme has no second source of truth to miss.
29
+ */
30
+ export declare const themeDocumentCss: (theme: ResolvedTheme, ramp?: RampMode) => string;
31
+ /**
32
+ * The ground alone, as the same `:root` rule — for a host whose page is already
33
+ * a tree to its edges.
34
+ *
35
+ * `themeDocumentCss` above answers a host that has no tree: the
36
+ * application shell draws its own frame, mounts nothing, and needs every
37
+ * variable as well as the ground. A *surface* is the other host, and it is not
38
+ * the same host. `(marketing)` composes a tree whose root primitive already
39
+ * mounts every `--loom-*` below it, so the variables in the document rule are
40
+ * read by nothing inside the page — they are a second copy of a mounting that
41
+ * already happened, in the one place no primitive looks. What that page actually
42
+ * needs from the document is the three declarations a tree cannot reach:
43
+ * `background-color`, `color` and `color-scheme`, on the element the scrollbar
44
+ * and the overscroll canvas belong to.
45
+ *
46
+ * `Loom marketing` measured the duplicate at 1,976 bytes on `/?theme=bold` and
47
+ * filed the shape rather than hand-writing the shorter rule, which was the right
48
+ * call twice over: a three-declaration rule written in a surface is a copy of a
49
+ * decision the palette owns, kept where the palette cannot reach it, and that is
50
+ * the hazard [`themeGround`](./theme.ts) and the docblock above both exist to
51
+ * refuse. The answer is to publish the half, not to let a caller rebuild it.
52
+ *
53
+ * **A second export rather than a flag on the first**, because the two differ in
54
+ * their inputs and not only in their output. `ramp` decides how the variables
55
+ * are written and has nothing to say about the ground, so a flag would leave a
56
+ * parameter that is read on one setting and silently ignored on the other —
57
+ * and a caller passing both would have written something that cannot be true.
58
+ * Two functions, one private serialiser, and neither has an argument it
59
+ * disregards.
60
+ *
61
+ * **`undefined` when the palette has no ground**, which mirrors `themeGround`
62
+ * exactly and for its reason: a palette whose body-copy pair cannot be read gets
63
+ * no ground rather than a guessed one. `themeDocumentCss` still returns its rule
64
+ * in that case because the variables are the half the host cannot write for
65
+ * itself and they are unaffected. Here there is no other half, so a rule would
66
+ * be an empty block — and *nothing to say* is a state a caller should have to
67
+ * answer rather than render. Every registered palette resolves both ends.
68
+ */
69
+ export declare const themeGroundCss: (theme: ResolvedTheme) => string | undefined;
70
+ //# sourceMappingURL=document-theme.d.ts.map
@@ -0,0 +1,139 @@
1
+ import { themeGround, themeStyle } from "./theme.js";
2
+ /**
3
+ * Mounting a theme on the **document element** rather than on a tree.
4
+ *
5
+ * ## The boundary a tree has, and what is outside it
6
+ *
7
+ * A root primitive paints `bg-canvas` across the page and mounts every
8
+ * `--loom-*` variable below it ([`themeStyle`](./theme.ts)), and for everything
9
+ * a tree contains that is the whole answer. Three things a reader sees are not
10
+ * in it: the scrollbar the browser draws beside the document, the canvas it
11
+ * paints past the end of a short page, and the rendering it gives a form
12
+ * control that nobody styled. They belong to the document, and **no tree ever
13
+ * contains the document** — the root primitive is an element inside a `<body>`
14
+ * some layout rendered.
15
+ *
16
+ * `color-scheme` is the declaration those three read, and it is inherited, so
17
+ * putting it on the tree's root reaches every primitive below it — which needed
18
+ * it least — and reaches none of them. On a dark palette that is a black page
19
+ * with a light scrollbar beside it and a white band past the end of it: the
20
+ * defect `Loom marketing` measured on `/?theme=bold` on 8 October, where the
21
+ * served document carried `color-scheme` nowhere at all.
22
+ *
23
+ * So the answer to *should the root primitive declare it* is **no**, and it is
24
+ * not a matter of taste: the root primitive cannot reach the surface the
25
+ * declaration is for. A host is handed the rule for its own `<html>` instead,
26
+ * which is the same bargain [`themeGround`](./theme.ts) already makes for a
27
+ * host's own frame — the parts of a page Loom does not draw are answered by
28
+ * giving the host the palette's answer, never by guessing in a stylesheet.
29
+ *
30
+ * ## Why a CSS rule and not a style object
31
+ *
32
+ * A style object is how a *surface* mounts a theme, because there the root
33
+ * primitive is an element inside a document its layout already rendered. The
34
+ * document element is not an element any page may render: a page that renders
35
+ * its own `<html>` gets it **nested inside the real one**, and the variables
36
+ * reach the page only through the HTML parser's error recovery, which merges a
37
+ * stray `<html>`'s attributes onto the real element. It happens to work, and a
38
+ * test can never see that it only happens to — React hoists a rendered
39
+ * `<html>`'s attributes onto the document element under jsdom, so a suite sees
40
+ * the outcome a browser arrives at by accident.
41
+ *
42
+ * A `:root` rule is true where it is written. It goes in a `<style>`, which
43
+ * React hoists into the head, and it needs no element of the host's own.
44
+ *
45
+ * Written by hand once before it was here, in this repository's own application
46
+ * shell, which is the second instance of the rule `themeGround`'s docblock
47
+ * states: a copy of a decision the palette owns, kept somewhere the palette
48
+ * cannot reach, is wrong the moment the palette moves and nothing anywhere can
49
+ * see that it has.
50
+ */
51
+ /**
52
+ * A style object's key as CSS spells it.
53
+ *
54
+ * Custom properties pass through: `--loom-accent` is already CSS, and lowering
55
+ * it would be a no-op that only looked safe. Everything else is a camelCased
56
+ * CSS property, and `backgroundColor: #fff` is not a declaration any browser
57
+ * applies — it is discarded by the parser, with no error anywhere, leaving an
58
+ * element that renders as though nobody had styled it.
59
+ */
60
+ const cssProperty = (key) => key.startsWith("--") ? key : key.replace(/[A-Z]/g, (capital) => `-${capital.toLowerCase()}`);
61
+ /** A declaration pair as CSS text, or nothing when the value is absent. */
62
+ const declaration = (key, value) => value === undefined ? [] : [` ${cssProperty(key)}: ${String(value)};`];
63
+ const declarations = (properties) => Object.entries(properties).flatMap(([key, value]) => declaration(key, value));
64
+ /** The declarations given, as one rule on the document element. */
65
+ const rootRule = (lines) => [":root {", ...lines, "}"].join("\n");
66
+ /**
67
+ * A resolved theme as the `:root` rule a host puts on its own document.
68
+ *
69
+ * Every variable `themeStyle` mounts, and then the ground — `background-color`,
70
+ * `color` and `color-scheme` — so one rule answers both the page's palette and
71
+ * the furniture around it. `:root` **is** the document element, which is what
72
+ * makes the ground reach the overscroll area past the end of a short page; the
73
+ * same declarations on a wrapper inside the document leave the browser's own
74
+ * white there, invisible under a light palette and not under the next one.
75
+ *
76
+ * Takes a `ResolvedTheme` rather than a `ThemeResolution`, the bargain
77
+ * `themeStyle` and `themeGround` both make: there is no fallback theme (0049),
78
+ * so *the tree names no theme* is the host's question about its own document and
79
+ * not one the runtime can answer by handing back a rule.
80
+ *
81
+ * **The ground may be absent and the rule is still returned.** A palette whose
82
+ * body-copy pair cannot be read gets no ground rather than a guessed one, and
83
+ * `ThemeGround` already documents what follows: whatever `color-scheme` the
84
+ * host's own stylesheet sets stands. The variables are unaffected by that and
85
+ * are the half a host cannot write for itself, so withholding the rule over it
86
+ * would cost a page its whole palette to avoid mis-stating one declaration of
87
+ * it. Every registered palette resolves both ends.
88
+ *
89
+ * Nothing is restated here: both halves are derived from the one resolved theme
90
+ * by the two functions a surface uses, so only the serialisation is this
91
+ * function's own and a re-theme has no second source of truth to miss.
92
+ */
93
+ export const themeDocumentCss = (theme, ramp = "fluid") => rootRule([
94
+ ...declarations(themeStyle(theme, ramp)),
95
+ ...declarations(themeGround(theme) ?? {}),
96
+ ]);
97
+ /**
98
+ * The ground alone, as the same `:root` rule — for a host whose page is already
99
+ * a tree to its edges.
100
+ *
101
+ * `themeDocumentCss` above answers a host that has no tree: the
102
+ * application shell draws its own frame, mounts nothing, and needs every
103
+ * variable as well as the ground. A *surface* is the other host, and it is not
104
+ * the same host. `(marketing)` composes a tree whose root primitive already
105
+ * mounts every `--loom-*` below it, so the variables in the document rule are
106
+ * read by nothing inside the page — they are a second copy of a mounting that
107
+ * already happened, in the one place no primitive looks. What that page actually
108
+ * needs from the document is the three declarations a tree cannot reach:
109
+ * `background-color`, `color` and `color-scheme`, on the element the scrollbar
110
+ * and the overscroll canvas belong to.
111
+ *
112
+ * `Loom marketing` measured the duplicate at 1,976 bytes on `/?theme=bold` and
113
+ * filed the shape rather than hand-writing the shorter rule, which was the right
114
+ * call twice over: a three-declaration rule written in a surface is a copy of a
115
+ * decision the palette owns, kept where the palette cannot reach it, and that is
116
+ * the hazard [`themeGround`](./theme.ts) and the docblock above both exist to
117
+ * refuse. The answer is to publish the half, not to let a caller rebuild it.
118
+ *
119
+ * **A second export rather than a flag on the first**, because the two differ in
120
+ * their inputs and not only in their output. `ramp` decides how the variables
121
+ * are written and has nothing to say about the ground, so a flag would leave a
122
+ * parameter that is read on one setting and silently ignored on the other —
123
+ * and a caller passing both would have written something that cannot be true.
124
+ * Two functions, one private serialiser, and neither has an argument it
125
+ * disregards.
126
+ *
127
+ * **`undefined` when the palette has no ground**, which mirrors `themeGround`
128
+ * exactly and for its reason: a palette whose body-copy pair cannot be read gets
129
+ * no ground rather than a guessed one. `themeDocumentCss` still returns its rule
130
+ * in that case because the variables are the half the host cannot write for
131
+ * itself and they are unaffected. Here there is no other half, so a rule would
132
+ * be an empty block — and *nothing to say* is a state a caller should have to
133
+ * answer rather than render. Every registered palette resolves both ends.
134
+ */
135
+ export const themeGroundCss = (theme) => {
136
+ const ground = themeGround(theme);
137
+ return ground === undefined ? undefined : rootRule(declarations(ground));
138
+ };
139
+ //# sourceMappingURL=document-theme.js.map