@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
@@ -1,5 +1,6 @@
1
1
  import { THEME_PROP_KEY } from "../reserved-props.js";
2
2
  import { themeVariables } from "../theme/apply.js";
3
+ import { paletteScheme } from "../theme/measure.js";
3
4
  /**
4
5
  * The theme read out of the runtime's own props.
5
6
  *
@@ -48,5 +49,26 @@ export const resolveTheme = (reserved, registry) => {
48
49
  * types-only step, and it happens once here rather than in every primitive that
49
50
  * has to apply it.
50
51
  */
51
- export const themeStyle = (theme) => themeVariables(theme);
52
+ export const themeStyle = (theme, ramp = "fluid") => themeVariables(theme, { ramp });
53
+ /**
54
+ * A resolved theme as the three declarations a host's own frame applies.
55
+ *
56
+ * Takes a `ResolvedTheme` and not a `ThemeResolution`, which is the same bargain
57
+ * `themeStyle` makes: there is no fallback theme, so *the tree names no theme* is
58
+ * a case the host has to answer for its own chrome and not one the runtime can
59
+ * answer by handing back a ground. An unthemed excerpt inherits the same nothing
60
+ * an unthemed page does.
61
+ *
62
+ * `undefined` is the other case and a narrower one — a palette whose pair cannot
63
+ * be read. Both ends come from the palette either way, so a frame re-themes with
64
+ * everything else and cannot be legible under one palette and not another.
65
+ */
66
+ export const themeGround = (theme) => {
67
+ const backgroundColor = theme.palette.slots["bg-canvas"];
68
+ const color = theme.palette.slots["fg-default"];
69
+ if (backgroundColor === undefined || color === undefined)
70
+ return undefined;
71
+ const colorScheme = paletteScheme(theme.palette);
72
+ return { backgroundColor, color, ...(colorScheme === undefined ? {} : { colorScheme }) };
73
+ };
52
74
  //# sourceMappingURL=theme.js.map
@@ -0,0 +1,152 @@
1
+ import type { NodeData } from "../data/resolution.js";
2
+ import type { JsonObject } from "../json.js";
3
+ import type { PrimitiveType } from "../primitive-type.js";
4
+ import { type Result } from "../result.js";
5
+ /**
6
+ * What a primitive could not show of an answer it was given, and how the walk
7
+ * is told.
8
+ *
9
+ * Every other way a binding can be wrong is visible from outside the primitive:
10
+ * an unregistered source is `data-unavailable`, a malformed declaration is
11
+ * `data-misdeclared`, a name nothing reads is `data-unread` (0181). One is not.
12
+ * A source can answer perfectly, under a name the primitive reads, with rows the
13
+ * primitive then declines row by row — because each row has a shape only the
14
+ * primitive knows, and eleven of twelve failing it is the author's problem and
15
+ * nobody else's.
16
+ *
17
+ * `loom.feed` is the case that made this cost something. 0175 says a listing
18
+ * skips the row it cannot read and names it, and the feed does say so — *"Some
19
+ * entries could not be shown."*, drawn on the page, deliberately without a
20
+ * count, because a number there is a plural this library cannot form in every
21
+ * language it may be served in. The count is not useless. It is useful to
22
+ * exactly one person and that person is not the reader: the author whose source
23
+ * started returning a column under a new name wants to know that eleven of
24
+ * twelve rows stopped reading. Every comparable finding in the walk is a
25
+ * diagnostic, and a primitive had no way to raise one.
26
+ *
27
+ * **The primitive returns a reading; the runtime decides whether to report it.**
28
+ * Nothing here hands a component a way to write into the walk's output, and that
29
+ * is the point rather than an omission — see 0206. A component body runs when
30
+ * React renders the element, which is *after* `renderLoomTree` has returned its
31
+ * diagnostics, as many times as React likes and sometimes not at all. A
32
+ * diagnostic pushed from there lands in an array the caller may have read
33
+ * already, twice under `StrictMode`, and never in a medium that renders the
34
+ * element some other way. A declaration the walk *calls* has none of that: once
35
+ * per node, inside the walk, before anybody sees the array.
36
+ */
37
+ /**
38
+ * What a primitive made of one answer: the rows it was given, and the rows it
39
+ * placed.
40
+ *
41
+ * Both numbers rather than the difference, because the sentence the author needs
42
+ * is *eleven of twelve* and a lone `11` cannot say it. Numbers rather than the
43
+ * rows themselves, because a diagnostic is logged and a row is the host's data —
44
+ * the same line `data-unavailable` holds, which names the source and not what it
45
+ * answered.
46
+ *
47
+ * A reading is owed for every answer the primitive read, including the ones it
48
+ * read whole. Whether `shown === given` is worth saying out loud is the walk's
49
+ * call and not the primitive's, the way every other diagnostic in this package
50
+ * is the walk's call.
51
+ */
52
+ export type UnshownReading = {
53
+ /** The binding name the answer arrived under. */
54
+ readonly name: string;
55
+ /** Rows in the answer as the primitive found it. */
56
+ readonly given: number;
57
+ /** Rows the primitive placed on the page. */
58
+ readonly shown: number;
59
+ };
60
+ /**
61
+ * What a primitive declares: its own reading of this node's answers.
62
+ *
63
+ * A function, where every other declaration on a definition is data, and the
64
+ * asymmetry is the honest one. `reads` is a list of *names*, and a name is data
65
+ * — which is why 0184 could give it a `fromProp` form rather than a callback.
66
+ * How many rows survived a schema is not data about a primitive; it is the
67
+ * primitive reading an answer, which is code by nature and is code the primitive
68
+ * already contains, because it had to decide what to skip in order to skip it.
69
+ *
70
+ * It receives exactly what the component receives of the same two things — the
71
+ * node's props as the tree wrote them, and the host's answers — so it can be
72
+ * the same function the component calls, which is the only way the count and the
73
+ * page cannot disagree. It receives nothing it could not already touch: the
74
+ * component is handed both objects too.
75
+ *
76
+ * Called once per node, inside the walk. It must be pure and it must not wait:
77
+ * there is nothing to wait for, every answer having been resolved before the
78
+ * walk began.
79
+ */
80
+ export type UnshownDeclaration = (props: JsonObject, data: NodeData) => readonly UnshownReading[];
81
+ /**
82
+ * Which primitive declares a reading, asked per type.
83
+ *
84
+ * Structural, and detected the way `BindingReader`, `FrameResolver` and
85
+ * `BehaviourResolver` are: a registry built by the SDK satisfies it, and a host
86
+ * resolving from a plain map has registered nothing that could have declared
87
+ * one — so there is nothing here for a host to wire and nothing that can go
88
+ * missing.
89
+ */
90
+ export interface UnshownReader {
91
+ readonly unshownBy: (type: PrimitiveType) => UnshownDeclaration | undefined;
92
+ }
93
+ export declare const isUnshownReader: (value: object) => value is UnshownReader;
94
+ /**
95
+ * Why a declaration's readings could not be believed.
96
+ *
97
+ * Both kinds are faults in the primitive rather than in the tree or the
98
+ * deployment, which is why they are one shape reported to one person: whoever
99
+ * wrote the component. A tree cannot cause either.
100
+ */
101
+ export type UnshownFault = {
102
+ /**
103
+ * The declaration threw. Rendering is total (see `diagnostics.ts`) and a
104
+ * declaration is not a licence to make it otherwise — a page lost to a
105
+ * primitive's *bookkeeping* would be the worst trade in this package.
106
+ */
107
+ readonly kind: "threw";
108
+ readonly detail: string;
109
+ } | {
110
+ /**
111
+ * A reading that cannot describe anything: an unnamed answer, a count that
112
+ * is not a whole number of rows, or more rows shown than given. Refused
113
+ * rather than clamped, because a diagnostic saying *thirteen of twelve*
114
+ * sends the author to look for a defect that is in the primitive telling
115
+ * them about it.
116
+ */
117
+ readonly kind: "impossible";
118
+ readonly detail: string;
119
+ };
120
+ export declare const describeUnshownFault: (fault: UnshownFault) => string;
121
+ /**
122
+ * The readings one declaration makes of this node, or the fault that means there
123
+ * are none to be had.
124
+ *
125
+ * Guarded, because the declaration is another author's code running inside a
126
+ * walk whose whole contract is that it always returns an element. A throw here
127
+ * would take a page down over a count nobody asked to be told, so a throw is
128
+ * caught and becomes the thing it was trying to report.
129
+ *
130
+ * Validated for the same reason, one step further on: a reading that says more
131
+ * rows were shown than arrived is not a small inaccuracy in a diagnostic, it is
132
+ * a diagnostic that sends its reader hunting the wrong defect. The whole batch
133
+ * is refused rather than the bad reading dropped — a declaration that miscounted
134
+ * one answer has not earned belief about the others, and a partial report is
135
+ * indistinguishable from a complete one once it is in a log.
136
+ *
137
+ * A declaration returning something that is not an array at all reaches
138
+ * `impossible` too: the type says otherwise and a host's JavaScript need not
139
+ * agree with it.
140
+ */
141
+ export declare const readUnshown: (declaration: UnshownDeclaration, props: JsonObject, data: NodeData) => Result<readonly UnshownReading[], UnshownFault>;
142
+ /**
143
+ * The readings worth reporting, in the order the walk reports them.
144
+ *
145
+ * An answer the primitive read whole is not a diagnostic — it is the ordinary
146
+ * case, and a walk that reported it would put one line per bound region into
147
+ * every log on every page. Name-sorted for the reason `unreadBindings` sorts:
148
+ * the caller emits one diagnostic per reading, and a list whose order follows a
149
+ * declaration's own array order is one a test can only assert loosely.
150
+ */
151
+ export declare const unshownRows: (readings: readonly UnshownReading[]) => readonly UnshownReading[];
152
+ //# sourceMappingURL=unshown.d.ts.map
@@ -0,0 +1,80 @@
1
+ import { err, ok } from "../result.js";
2
+ export const isUnshownReader = (value) => typeof value.unshownBy === "function";
3
+ export const describeUnshownFault = (fault) => fault.kind === "threw"
4
+ ? `the declaration threw — ${fault.detail}`
5
+ : `the declaration returned a reading that cannot describe an answer — ${fault.detail}`;
6
+ const countable = (value) => Number.isSafeInteger(value) && value >= 0;
7
+ const faultIn = (reading, index) => {
8
+ const at = `reading ${index}`;
9
+ if (typeof reading.name !== "string" || reading.name === "") {
10
+ return `${at} names no binding`;
11
+ }
12
+ if (!countable(reading.given)) {
13
+ return `${at} ("${reading.name}") was given ${String(reading.given)} rows`;
14
+ }
15
+ if (!countable(reading.shown)) {
16
+ return `${at} ("${reading.name}") showed ${String(reading.shown)} rows`;
17
+ }
18
+ if (reading.shown > reading.given) {
19
+ return `${at} ("${reading.name}") showed ${reading.shown} of ${reading.given} rows`;
20
+ }
21
+ return undefined;
22
+ };
23
+ /**
24
+ * The readings one declaration makes of this node, or the fault that means there
25
+ * are none to be had.
26
+ *
27
+ * Guarded, because the declaration is another author's code running inside a
28
+ * walk whose whole contract is that it always returns an element. A throw here
29
+ * would take a page down over a count nobody asked to be told, so a throw is
30
+ * caught and becomes the thing it was trying to report.
31
+ *
32
+ * Validated for the same reason, one step further on: a reading that says more
33
+ * rows were shown than arrived is not a small inaccuracy in a diagnostic, it is
34
+ * a diagnostic that sends its reader hunting the wrong defect. The whole batch
35
+ * is refused rather than the bad reading dropped — a declaration that miscounted
36
+ * one answer has not earned belief about the others, and a partial report is
37
+ * indistinguishable from a complete one once it is in a log.
38
+ *
39
+ * A declaration returning something that is not an array at all reaches
40
+ * `impossible` too: the type says otherwise and a host's JavaScript need not
41
+ * agree with it.
42
+ */
43
+ export const readUnshown = (declaration, props, data) => {
44
+ let readings;
45
+ try {
46
+ readings = declaration(props, data);
47
+ }
48
+ catch (thrown) {
49
+ return err({
50
+ kind: "threw",
51
+ detail: thrown instanceof Error ? thrown.message : String(thrown),
52
+ });
53
+ }
54
+ if (!Array.isArray(readings)) {
55
+ return err({ kind: "impossible", detail: "the declaration returned no readings at all" });
56
+ }
57
+ for (const [index, reading] of readings.entries()) {
58
+ if (typeof reading !== "object" || reading === null) {
59
+ return err({ kind: "impossible", detail: `reading ${index} is not a reading` });
60
+ }
61
+ const fault = faultIn(reading, index);
62
+ if (fault !== undefined)
63
+ return err({ kind: "impossible", detail: fault });
64
+ }
65
+ return ok(readings);
66
+ };
67
+ /**
68
+ * The readings worth reporting, in the order the walk reports them.
69
+ *
70
+ * An answer the primitive read whole is not a diagnostic — it is the ordinary
71
+ * case, and a walk that reported it would put one line per bound region into
72
+ * every log on every page. Name-sorted for the reason `unreadBindings` sorts:
73
+ * the caller emits one diagnostic per reading, and a list whose order follows a
74
+ * declaration's own array order is one a test can only assert loosely.
75
+ */
76
+ export const unshownRows = (readings) => readings
77
+ /** `filter` copies, so the sort below never reaches the declaration's own array. */
78
+ .filter((reading) => reading.shown < reading.given)
79
+ .sort((left, right) => (left.name < right.name ? -1 : left.name > right.name ? 1 : 0));
80
+ //# sourceMappingURL=unshown.js.map
@@ -1,5 +1,7 @@
1
1
  import type { NodeId } from "../ids.js";
2
2
  import type { PrimitiveType } from "../primitive-type.js";
3
+ import type { BindingReader } from "../render/reads.js";
4
+ import type { SlotPlacer } from "../render/slots.js";
3
5
  import { type Result } from "../result.js";
4
6
  import type { TreeDelta } from "../tree/delta.js";
5
7
  import type { TreeError } from "../tree/errors.js";
@@ -7,7 +9,7 @@ import type { LoomTree } from "../tree/tree.js";
7
9
  import { type InteractivePredicate, type NestedTarget } from "./nesting.js";
8
10
  import { type RedirectedSubmission } from "./redirection.js";
9
11
  import { type RepointedBinding } from "./repointing.js";
10
- import { type InvalidProps, type PrimitiveVocabulary, type PropsVocabulary, type UnknownPrimitive } from "./vocabulary.js";
12
+ import { type InvalidProps, type PrimitiveVocabulary, type PropsVocabulary, type UnknownPrimitive, type UnplacedSlot, type UnreadBinding } from "./vocabulary.js";
11
13
  /**
12
14
  * Facts about what a delta does, extracted before anyone judges it.
13
15
  *
@@ -105,6 +107,55 @@ export type ChangeAnalysis = {
105
107
  * Empty for every host that wires no props vocabulary, which is the default.
106
108
  */
107
109
  readonly invalidProps: readonly InvalidProps[];
110
+ /**
111
+ * Questions this change would leave on the page that no primitive will look
112
+ * at — a node asking under a name its own primitive says it does not read.
113
+ *
114
+ * The one fact in this record about a change that *works*. The page draws,
115
+ * every node is registered, every schema is satisfied; the host pays a round
116
+ * trip to its own source on every render and the region shows its empty state,
117
+ * because the answer arrives under a name nobody opens (0181).
118
+ *
119
+ * Measured on both trees, like `invalidProps` and unlike `unknownPrimitives`,
120
+ * and for that factor's reason twice over: a `configure` can put `loom:data` on
121
+ * a node that had none, and a `configure` can rename the *prop* that names the
122
+ * binding (0184), so two operations in one delta can argue about it and only
123
+ * the tree at the end says what a reader will be served.
124
+ *
125
+ * Keyed by node **and name** where `invalidProps` is keyed by node alone, and
126
+ * the difference is the harm rather than an oversight. A node whose props fail
127
+ * is a hole, and a page has one hole there however many ways it is wrong; a
128
+ * node asking three questions nothing reads is three wasted round trips, and a
129
+ * change that adds the third is answerable for the third.
130
+ *
131
+ * Empty for every host that hands no reader, which is the default.
132
+ */
133
+ readonly unreadBindings: readonly UnreadBinding[];
134
+ /**
135
+ * Content this change would put in a region of a primitive that places no
136
+ * region of that name, so the content and everything under it is dropped.
137
+ *
138
+ * The second fact in this record about a change that *works*, beside
139
+ * `unreadBindings` and quieter than it. The page draws, every node is
140
+ * registered, every schema is satisfied, nothing is fetched and wasted — and
141
+ * a paragraph the author wrote is not on the page, with nothing anywhere
142
+ * saying so until the render seam gained a diagnostic for it (0249).
143
+ *
144
+ * Measured on both trees, like `unreadBindings` and unlike
145
+ * `unknownPrimitives`, and for the reason that factor's comment gives twice
146
+ * over. A `move` can carry a slot child under a new parent that places no
147
+ * such region, which is the case `unknownPrimitives` has no analogue of: a
148
+ * type cannot be changed, and a region's fate depends on the parent it ends
149
+ * up under rather than on the node itself.
150
+ *
151
+ * Keyed by node **and name** where `invalidProps` is keyed by node alone, for
152
+ * `unreadBindings`' reason: a node that drops two regions has dropped two
153
+ * pieces of content, and a change that adds the second is answerable for the
154
+ * second.
155
+ *
156
+ * Empty for every host that hands no placer, which is the default.
157
+ */
158
+ readonly unplacedSlots: readonly UnplacedSlot[];
108
159
  /**
109
160
  * Forms this change points somewhere else — a node that posted to one
110
161
  * registered endpoint before and posts to another after.
@@ -132,18 +183,52 @@ export type ChangeAnalysis = {
132
183
  */
133
184
  readonly shallowestAffectedDepth: number;
134
185
  };
186
+ /**
187
+ * What a host's primitives are, in the five senses the write path can ask about.
188
+ *
189
+ * Every member is optional and every default is the no-op a deployment that has
190
+ * wired nothing already got, so `analyzeDelta(tree, delta)` measures exactly
191
+ * what it measured before this record existed.
192
+ *
193
+ * **A record rather than trailing parameters, which is a change of shape and
194
+ * not of behaviour.** Until 0252 these were four positional optionals, and the
195
+ * function's own comment had predicted each of the last three arriving to find
196
+ * the shape at its limit. The argument for leaving them positional was that
197
+ * collecting them is a breaking change to a published function; the argument
198
+ * that won is `StakeInput`'s, one module over — *an input that can be left off
199
+ * the end is one that will be* — and a fifth made the order something no caller
200
+ * could hold in their head. There is no middle shape: four positional optionals
201
+ * and a record of the fifth would be the worst of both.
202
+ *
203
+ * The names are the parameters' own, so a caller that passed them positionally
204
+ * reaches the same answers by writing down which one it meant.
205
+ *
206
+ * `| undefined` on each member rather than optionality alone, for
207
+ * `WriteCheckSeams`' reason: a caller holding an `X | undefined` at an optional
208
+ * seam is the ordinary case — `assessChange` is one — and making it rebuild the
209
+ * record to say so would put the presence test in two places.
210
+ */
211
+ export type ChangeVocabulary = {
212
+ /** Which primitives render a target, so a target inside one is reachable (0068). */
213
+ readonly isInteractive?: InteractivePredicate | undefined;
214
+ /** Which primitive types this deployment can draw at all (0173). */
215
+ readonly isRegistered?: PrimitiveVocabulary | undefined;
216
+ /** What each primitive accepts, as its own schema's verdict (0179). */
217
+ readonly checkProps?: PropsVocabulary | undefined;
218
+ /** What each primitive reads an answer under (0208). */
219
+ readonly reads?: BindingReader | undefined;
220
+ /** What each primitive places a named region for (0252). */
221
+ readonly places?: SlotPlacer | undefined;
222
+ };
135
223
  /**
136
224
  * Walks the delta forward so each operation is measured against the tree it
137
225
  * actually observes — an operation may target a node an earlier operation in
138
226
  * the same delta inserted.
139
227
  *
140
- * The three vocabularies are separate trailing parameters rather than one
141
- * record, which is not the shape `StakeInput` argues for. This function is
142
- * published and a lesson calls it by hand, so collecting them would be a
143
- * breaking change to teach nothing, and a third one arriving is the second time
144
- * that has been true; what keeps them from being forgotten is that
145
- * `assessChange` is the only caller that assembles them, and it passes all
146
- * three in one expression.
228
+ * The vocabularies arrive as one optional record (`ChangeVocabulary`, above).
229
+ * What keeps any of them from being forgotten is unchanged by that: `assessChange`
230
+ * is still the only caller that assembles them, and it still does it in one
231
+ * expression.
147
232
  */
148
- export declare const analyzeDelta: (tree: LoomTree, delta: TreeDelta, isInteractive?: InteractivePredicate, isRegistered?: PrimitiveVocabulary, checkProps?: PropsVocabulary) => Result<ChangeAnalysis, TreeError>;
233
+ export declare const analyzeDelta: (tree: LoomTree, delta: TreeDelta, vocabulary?: ChangeVocabulary) => Result<ChangeAnalysis, TreeError>;
149
234
  //# sourceMappingURL=analysis.d.ts.map
@@ -4,7 +4,7 @@ import { findNode, pathToNode, walkTree } from "../tree/navigation.js";
4
4
  import { nestedTargetsIn, NOTHING_INTERACTIVE, } from "./nesting.js";
5
5
  import { redirectedSubmissionsBetween } from "./redirection.js";
6
6
  import { repointedBindingsBetween } from "./repointing.js";
7
- import { EVERY_TYPE_REGISTERED, EVERY_TYPE_UNDECLARED, invalidPropsIn, unknownPrimitivesIn, } from "./vocabulary.js";
7
+ import { EVERY_TYPE_REGISTERED, EVERY_TYPE_UNDECLARED, invalidPropsIn, NOTHING_DECLARED, NOTHING_PLACED, unknownPrimitivesIn, unplacedSlotsIn, unreadBindingsIn, } from "./vocabulary.js";
8
8
  const elementTypesIn = (node) => Array.from(walkTree(node)).flatMap((current) => current.kind === "element" ? [current.type] : []);
9
9
  const nodeCount = (node) => Array.from(walkTree(node)).length;
10
10
  const depthOf = (root, nodeId) => {
@@ -139,20 +139,63 @@ const introducedInvalidProps = (before, after, checkProps) => {
139
139
  const inherited = new Set(invalidPropsIn(before, checkProps).map((invalid) => invalid.nodeId));
140
140
  return produced.filter((invalid) => !inherited.has(invalid.nodeId));
141
141
  };
142
+ /** Node and name together; a name is only unique within the node that asks it. */
143
+ const unreadKey = (unread) => `${unread.nodeId} ${unread.name}`;
144
+ /**
145
+ * The wasted questions this delta is answerable for: the ones unread in the tree
146
+ * it produces, less the ones already unread in the tree it started from.
147
+ *
148
+ * Keyed on both halves, unlike `introducedInvalidProps` and for the reason the
149
+ * field's own comment gives: two unread names on one node are two round trips,
150
+ * so a change that adds the second inherits the first and answers for the
151
+ * second. `questionsIn` in `repointing.ts` keys the same pair the same way, and
152
+ * for the same reason — a name means nothing without the node asking it.
153
+ *
154
+ * The before-walk is skipped when the result has none, which is the ordinary
155
+ * case and — with `NOTHING_DECLARED` — the only case on a deployment that has
156
+ * handed no reader.
157
+ */
158
+ const introducedUnreadBindings = (before, after, reads) => {
159
+ const produced = unreadBindingsIn(after, reads);
160
+ if (produced.length === 0)
161
+ return produced;
162
+ const inherited = new Set(unreadBindingsIn(before, reads).map(unreadKey));
163
+ return produced.filter((unread) => !inherited.has(unreadKey(unread)));
164
+ };
165
+ /** Node and name together, for the reason `unreadKey` gives one module over. */
166
+ const unplacedKey = (unplaced) => `${unplaced.nodeId} ${unplaced.name}`;
167
+ /**
168
+ * The dropped content this delta is answerable for: the regions unplaced in the
169
+ * tree it produces, less the ones already unplaced in the tree it started from.
170
+ *
171
+ * Keyed on both halves, like `introducedUnreadBindings` and unlike
172
+ * `introducedInvalidProps`: a node filling two regions nothing places loses two
173
+ * pieces of content, so a change that adds the second inherits the first and
174
+ * answers for the second.
175
+ *
176
+ * The before-walk is skipped when the result has none, which is the ordinary
177
+ * case and — with `NOTHING_PLACED` — the only case on a deployment that has
178
+ * handed no placer.
179
+ */
180
+ const introducedUnplacedSlots = (before, after, places) => {
181
+ const produced = unplacedSlotsIn(after, places);
182
+ if (produced.length === 0)
183
+ return produced;
184
+ const inherited = new Set(unplacedSlotsIn(before, places).map(unplacedKey));
185
+ return produced.filter((unplaced) => !inherited.has(unplacedKey(unplaced)));
186
+ };
142
187
  /**
143
188
  * Walks the delta forward so each operation is measured against the tree it
144
189
  * actually observes — an operation may target a node an earlier operation in
145
190
  * the same delta inserted.
146
191
  *
147
- * The three vocabularies are separate trailing parameters rather than one
148
- * record, which is not the shape `StakeInput` argues for. This function is
149
- * published and a lesson calls it by hand, so collecting them would be a
150
- * breaking change to teach nothing, and a third one arriving is the second time
151
- * that has been true; what keeps them from being forgotten is that
152
- * `assessChange` is the only caller that assembles them, and it passes all
153
- * three in one expression.
192
+ * The vocabularies arrive as one optional record (`ChangeVocabulary`, above).
193
+ * What keeps any of them from being forgotten is unchanged by that: `assessChange`
194
+ * is still the only caller that assembles them, and it still does it in one
195
+ * expression.
154
196
  */
155
- export const analyzeDelta = (tree, delta, isInteractive = NOTHING_INTERACTIVE, isRegistered = EVERY_TYPE_REGISTERED, checkProps = EVERY_TYPE_UNDECLARED) => {
197
+ export const analyzeDelta = (tree, delta, vocabulary = {}) => {
198
+ const { isInteractive = NOTHING_INTERACTIVE, isRegistered = EVERY_TYPE_REGISTERED, checkProps = EVERY_TYPE_UNDECLARED, reads = NOTHING_DECLARED, places = NOTHING_PLACED, } = vocabulary;
156
199
  const tally = emptyTally();
157
200
  let state = tree.root;
158
201
  for (const operation of delta.operations) {
@@ -179,6 +222,8 @@ export const analyzeDelta = (tree, delta, isInteractive = NOTHING_INTERACTIVE, i
179
222
  nestedTargets: introducedNestedTargets(tree.root, state, isInteractive),
180
223
  unknownPrimitives: tally.unknown,
181
224
  invalidProps: introducedInvalidProps(tree.root, state, checkProps),
225
+ unreadBindings: introducedUnreadBindings(tree.root, state, reads),
226
+ unplacedSlots: introducedUnplacedSlots(tree.root, state, places),
182
227
  redirectedSubmissions: redirectedSubmissionsBetween(tree.root, state),
183
228
  repointedBindings: repointedBindingsBetween(tree.root, state),
184
229
  shallowestAffectedDepth: Number.isFinite(tally.shallowest) ? tally.shallowest : 0,
@@ -3,11 +3,11 @@ import { type Result } from "../result.js";
3
3
  import type { TreeError } from "../tree/errors.js";
4
4
  import type { LoomTree } from "../tree/tree.js";
5
5
  import { type ChangeAnalysis } from "./analysis.js";
6
+ import { type WriteCheck, type WriteCheckSeams } from "./checks.js";
6
7
  import type { GatePolicy } from "./policy.js";
7
8
  import type { ProposedChange } from "./proposal.js";
8
9
  import { type Reversibility } from "./reversibility.js";
9
10
  import { type StakeAssessment } from "./stakes.js";
10
- import { type PropsVocabulary } from "./vocabulary.js";
11
11
  /**
12
12
  * Everything the Gate is allowed to look at, gathered in one pass. Assembling
13
13
  * this is the last step that touches the tree; the Gate itself sees only this
@@ -17,6 +17,13 @@ import { type PropsVocabulary } from "./vocabulary.js";
17
17
  * rather than a rejected one. That distinction matters downstream: an
18
18
  * inapplicable proposal is an interpreter bug, not a policy decision.
19
19
  *
20
+ * It is also where *which* of the write path's optional checks were in place is
21
+ * written down, because this is the last function that can know: a seam reaches
22
+ * the decision as an argument here and is a closure by the time anything else
23
+ * sees it. `wiredChecks` is a fact this function holds about its own call rather
24
+ * than a claim relayed from a caller, which is what lets the Gate stamp it on a
25
+ * disposition the same way it stamps the policy it consulted.
26
+ *
20
27
  * This is also where a proposal's own declaration about what it writes over is
21
28
  * folded into the damage estimate (0035), so the Gate keeps seeing two axes and
22
29
  * a policy rather than growing a third input. The policy's vocabulary — which
@@ -30,6 +37,33 @@ export type ChangeAssessment = {
30
37
  readonly analysis: ChangeAnalysis;
31
38
  readonly stakes: StakeAssessment;
32
39
  readonly reversibility: Reversibility;
40
+ /**
41
+ * Which optional checks the caller handed this assessment, in canonical order.
42
+ *
43
+ * Always present and empty when none were, rather than omitted: a measurement
44
+ * is being recorded here, and an assessment that left the field out would be
45
+ * one a reader could not distinguish from a deployment that checks nothing.
46
+ * The disposition this ends up on is where absence means something else, and
47
+ * says so.
48
+ */
49
+ readonly wiredChecks: readonly WriteCheck[];
33
50
  };
34
- export declare const assessChange: (tree: LoomTree, proposal: ProposedChange, policy: GatePolicy, inverseDeltaId: DeltaId, checkProps?: PropsVocabulary) => Result<ChangeAssessment, TreeError>;
51
+ export declare const assessChange: (tree: LoomTree, proposal: ProposedChange, policy: GatePolicy, inverseDeltaId: DeltaId,
52
+ /**
53
+ * The optional seams, as one record and with each member absent rather than
54
+ * defaulted, so that *handed nothing* and *handed the sentinel* stay two
55
+ * different calls. The analysis below falls back to the same no-ops a default
56
+ * would have supplied, so nothing about a decision changes; what changes is
57
+ * that `wiredChecks` can report what arrived instead of reporting what the
58
+ * signature filled in.
59
+ *
60
+ * `WriteCheckSeams` itself rather than a shape of this function's own, which
61
+ * is what makes the two uses below one fact read twice: what is passed to the
62
+ * analysis is, by construction, what is recorded as having been wired. These
63
+ * were two trailing parameters until the collection (0252), and the third
64
+ * would have been the one nobody could order — the same pressure that
65
+ * collected `analyzeDelta`'s vocabularies, arriving at the caller that
66
+ * assembles them.
67
+ */
68
+ seams?: WriteCheckSeams) => Result<ChangeAssessment, TreeError>;
35
69
  //# sourceMappingURL=assessment.d.ts.map
@@ -1,13 +1,38 @@
1
1
  import { flatMapResult, mapResult } from "../result.js";
2
2
  import { analyzeDelta } from "./analysis.js";
3
+ import { wiredChecksOf } from "./checks.js";
3
4
  import { interactivePredicateFor } from "./nesting.js";
4
5
  import { assessReversibility } from "./reversibility.js";
5
6
  import { assessStakes } from "./stakes.js";
6
- import { EVERY_TYPE_UNDECLARED, primitiveVocabularyFor } from "./vocabulary.js";
7
- export const assessChange = (tree, proposal, policy, inverseDeltaId, checkProps = EVERY_TYPE_UNDECLARED) => flatMapResult(analyzeDelta(tree, proposal.delta, interactivePredicateFor(policy.interactiveTypes), primitiveVocabularyFor(policy.registeredPrimitiveTypes), checkProps), (analysis) => mapResult(assessReversibility(tree, proposal.delta, analysis, policy, inverseDeltaId), (reversibility) => ({
7
+ import { primitiveVocabularyFor } from "./vocabulary.js";
8
+ export const assessChange = (tree, proposal, policy, inverseDeltaId,
9
+ /**
10
+ * The optional seams, as one record and with each member absent rather than
11
+ * defaulted, so that *handed nothing* and *handed the sentinel* stay two
12
+ * different calls. The analysis below falls back to the same no-ops a default
13
+ * would have supplied, so nothing about a decision changes; what changes is
14
+ * that `wiredChecks` can report what arrived instead of reporting what the
15
+ * signature filled in.
16
+ *
17
+ * `WriteCheckSeams` itself rather than a shape of this function's own, which
18
+ * is what makes the two uses below one fact read twice: what is passed to the
19
+ * analysis is, by construction, what is recorded as having been wired. These
20
+ * were two trailing parameters until the collection (0252), and the third
21
+ * would have been the one nobody could order — the same pressure that
22
+ * collected `analyzeDelta`'s vocabularies, arriving at the caller that
23
+ * assembles them.
24
+ */
25
+ seams = {}) => flatMapResult(analyzeDelta(tree, proposal.delta, {
26
+ isInteractive: interactivePredicateFor(policy.interactiveTypes),
27
+ isRegistered: primitiveVocabularyFor(policy.registeredPrimitiveTypes),
28
+ checkProps: seams.propsVocabulary,
29
+ reads: seams.bindingReader,
30
+ places: seams.slotPlacer,
31
+ }), (analysis) => mapResult(assessReversibility(tree, proposal.delta, analysis, policy, inverseDeltaId), (reversibility) => ({
8
32
  proposal,
9
33
  analysis,
10
34
  stakes: assessStakes({ analysis, discards: proposal.discards ?? [] }, policy),
11
35
  reversibility,
36
+ wiredChecks: wiredChecksOf(seams),
12
37
  })));
13
38
  //# sourceMappingURL=assessment.js.map
@@ -0,0 +1,54 @@
1
+ import { z } from "zod";
2
+ import { type StakeLevel } from "./stake-level.js";
3
+ /**
4
+ * How much a policy lets an origin apply unattended, including none of it.
5
+ *
6
+ * A ceiling used to be a stake level, which made the strictest thing a
7
+ * deployment could say about an origin *low-stakes changes go live*. There is
8
+ * no level beneath `low`, so *nothing goes live, every change waits for a
9
+ * person* was not expressible at all — not by a lower ceiling, which does not
10
+ * exist, and not by `refusalFloor`, which throws the change away instead of
11
+ * holding it for somebody to look at.
12
+ *
13
+ * So the ceiling is its own scale: the four stake levels with one more rung
14
+ * below them. It lives beside the levels rather than among them because
15
+ * `nothing` is not a measure of damage — nothing is ever assessed at `nothing`
16
+ * stakes — and putting it in `STAKE_ORDER` would offer it to every reader of a
17
+ * level, `refusalFloor` and a role's acceptance ceiling included (0285).
18
+ */
19
+ /**
20
+ * The rung below `low`: this origin applies nothing on its own.
21
+ *
22
+ * Spelled as a word rather than as an absent entry, because an absent entry
23
+ * already means something — `ceilingFor` reads it as `low` — and a policy
24
+ * cannot say *I thought about this origin and decided none of it* by leaving it
25
+ * out.
26
+ */
27
+ export declare const NOTHING_AUTO_APPLIES = "nothing";
28
+ export declare const autoApplyCeilingSchema: z.ZodUnion<[z.ZodLiteral<"nothing">, z.ZodEnum<["low", "medium", "high", "critical"]>]>;
29
+ /** A stake level, or the rung below all of them. */
30
+ export type AutoApplyCeiling = z.infer<typeof autoApplyCeilingSchema>;
31
+ /**
32
+ * The ceiling scale in order, which like `STAKE_ORDER` is the order and not
33
+ * merely the set.
34
+ *
35
+ * Built from the stake order rather than written out again, so a level added to
36
+ * the scale the Gate weighs on arrives here in the same edit and cannot be
37
+ * ranked by accident.
38
+ */
39
+ export declare const CEILING_ORDER: readonly AutoApplyCeiling[];
40
+ /**
41
+ * Two ceilings compared. Only the sign is meaningful: negative is stricter,
42
+ * positive is looser, zero is the same latitude.
43
+ */
44
+ export declare const compareCeilings: (left: AutoApplyCeiling, right: AutoApplyCeiling) => number;
45
+ /**
46
+ * Whether a change assessed at this level is above what the origin may apply
47
+ * unattended — which, at `nothing`, every change is.
48
+ *
49
+ * A stake level is a ceiling, so this is one comparison on one scale rather
50
+ * than a branch on the sentinel. `low` stakes against a `low` ceiling is *at*
51
+ * it and applies; `low` stakes against `nothing` is above it and waits.
52
+ */
53
+ export declare const isAboveCeiling: (level: StakeLevel, ceiling: AutoApplyCeiling) => boolean;
54
+ //# sourceMappingURL=auto-apply-ceiling.d.ts.map