@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
@@ -56,7 +56,7 @@ export const paperPalette = paletteSchema.parse({
56
56
  "brand-secondary-strong": "#ac7515",
57
57
  "border-default": "#e7dbcf",
58
58
  "border-strong": "#291f14",
59
- "border-subtle": "#f1ebe4",
59
+ "border-subtle": "#efe8e0",
60
60
  "border-accent": "#d67551",
61
61
  },
62
62
  });
@@ -104,7 +104,7 @@ export const sagePalette = paletteSchema.parse({
104
104
  "brand-secondary-strong": "#56952d",
105
105
  "border-default": "#d5e2d5",
106
106
  "border-strong": "#192419",
107
- "border-subtle": "#e7eee7",
107
+ "border-subtle": "#e4ece4",
108
108
  "border-accent": "#5ccc90",
109
109
  },
110
110
  });
@@ -176,7 +176,7 @@ export const citrusPalette = paletteSchema.parse({
176
176
  "brand-secondary-strong": "#b6830c",
177
177
  "border-default": "#e9e6ce",
178
178
  "border-strong": "#2a2813",
179
- "border-subtle": "#f2f1e3",
179
+ "border-subtle": "#f0efde",
180
180
  "border-accent": "#b4d058",
181
181
  },
182
182
  });
@@ -224,7 +224,7 @@ export const graphitePalette = paletteSchema.parse({
224
224
  "brand-secondary-strong": "#675b5b",
225
225
  "border-default": "#dddada",
226
226
  "border-strong": "#201d1d",
227
- "border-subtle": "#ebeaea",
227
+ "border-subtle": "#e8e6e6",
228
228
  "border-accent": "#949494",
229
229
  },
230
230
  });
@@ -248,7 +248,7 @@ export const clayPalette = paletteSchema.parse({
248
248
  "brand-secondary-strong": "#348d6a",
249
249
  "border-default": "#e6ddd1",
250
250
  "border-strong": "#282015",
251
- "border-subtle": "#f1ece5",
251
+ "border-subtle": "#ebe4db",
252
252
  "border-accent": "#d27356",
253
253
  },
254
254
  });
@@ -272,7 +272,7 @@ export const linenPalette = paletteSchema.parse({
272
272
  "brand-secondary-strong": "#32708f",
273
273
  "border-default": "#e5dfd1",
274
274
  "border-strong": "#272216",
275
- "border-subtle": "#f0ede5",
275
+ "border-subtle": "#eae6da",
276
276
  "border-accent": "#b49274",
277
277
  },
278
278
  });
@@ -416,7 +416,7 @@ export const duskPalette = paletteSchema.parse({
416
416
  "brand-secondary-strong": "#752acb",
417
417
  "border-default": "#2d2c44",
418
418
  "border-strong": "#e1e0eb",
419
- "border-subtle": "#232234",
419
+ "border-subtle": "#252437",
420
420
  "border-accent": "#de5e73",
421
421
  },
422
422
  });
@@ -0,0 +1,64 @@
1
+ /**
2
+ * A ramp step as a CSS length, and the width at which it is what the pack said.
3
+ *
4
+ * A font pack declares eight type sizes and a style preset eight spacing steps,
5
+ * both as plain numbers, and `apply.ts` mounted them as pixels. That is the
6
+ * whole of why a page built in Loom did not fit a phone: `--loom-scale-8` was
7
+ * 72px at every width, so a hero headline on a 390px screen was given three
8
+ * characters a line, and `--loom-spacing-4` plus `--loom-spacing-6` took 35% of
9
+ * that screen in gutter before a word was set. Filed by `Loom marketing` on
10
+ * 13 October against the one surface built entirely in the framework — measured
11
+ * there, because the only instrument that sees it is a camera.
12
+ *
13
+ * **A tree cannot fix it and must not be able to.** There is no prop, no theme
14
+ * and no node that means *smaller on a phone*, and there is not going to be
15
+ * one: a render is a pure function of one node
16
+ * ([0008](../../decisions/0008-the-renderer-is-a-total-pure-projection.md)), so
17
+ * a primitive handed a viewport would make the same tree a different page. The
18
+ * surface's own stylesheet cannot fix it either — a second source of truth for
19
+ * type and spacing is exactly what the re-theme guarantee
20
+ * ([0049](../../decisions/0049-a-theme-is-three-ids-in-the-tree.md)) cannot
21
+ * have.
22
+ *
23
+ * So the width is read where this repository already reads it: in CSS.
24
+ * [0079](../../decisions/0079-a-layout-css-alone-can-express-belongs-in-the-stylesheet.md)
25
+ * drew that line for `loom.mosaic` and drew it in the right place — *no
26
+ * viewport in the render function*, and a rule in a stylesheet is not in the
27
+ * render function. A `clamp()` is the same bargain one step earlier: the markup
28
+ * is unchanged, nothing is interpolated, `themeVariables` is as pure as it was
29
+ * — the same theme yields the same strings — and the browser rather than the
30
+ * render function is what knows how wide the page is.
31
+ *
32
+ * ## What a declared number now means
33
+ *
34
+ * **A maximum, reached at `48rem` and held above it.** Below that a step is
35
+ * compressed toward the largest value its quantity can hold on a phone, and a
36
+ * step already that small is emitted as the plain pixel length it always was.
37
+ * The consequence worth stating is the one that is easy to miss: **nothing
38
+ * changes at or above 768px.** A reader on a laptop sees the ramp the pack
39
+ * declared, to the pixel.
40
+ */
41
+ /** Which ramp a step belongs to. They differ only in what a phone can hold. */
42
+ export type RampKind = "type" | "space";
43
+ /**
44
+ * Whether the emitted length may read the width.
45
+ *
46
+ * `"fixed"` is for a medium with no cascade and no viewport — an image renderer
47
+ * or an email body, which `inline-variables.ts` substitutes values into. A
48
+ * `clamp()` in container units is not a literal length: it is strictly worse
49
+ * there than the pixel it replaced, because nothing in that medium resolves it.
50
+ * A caller asking for literals gets the pack's declared numbers.
51
+ */
52
+ export type RampMode = "fluid" | "fixed";
53
+ /**
54
+ * One ramp step, as the length `apply.ts` mounts.
55
+ *
56
+ * The preferred value is `cqi` rather than `vw` for the reason `loom.heading`
57
+ * learned in the same place: with no ancestor declaring containment `cqi` is
58
+ * the small viewport width, so a step on the open page behaves as it always
59
+ * did, and a step inside a `loom.card` or one half of a `loom.split` is held to
60
+ * the column it is actually in because those declare the containment for it to
61
+ * read.
62
+ */
63
+ export declare const rampLength: (step: number, kind: RampKind, mode: RampMode) => string;
64
+ //# sourceMappingURL=ramp.d.ts.map
@@ -0,0 +1,114 @@
1
+ /**
2
+ * A ramp step as a CSS length, and the width at which it is what the pack said.
3
+ *
4
+ * A font pack declares eight type sizes and a style preset eight spacing steps,
5
+ * both as plain numbers, and `apply.ts` mounted them as pixels. That is the
6
+ * whole of why a page built in Loom did not fit a phone: `--loom-scale-8` was
7
+ * 72px at every width, so a hero headline on a 390px screen was given three
8
+ * characters a line, and `--loom-spacing-4` plus `--loom-spacing-6` took 35% of
9
+ * that screen in gutter before a word was set. Filed by `Loom marketing` on
10
+ * 13 October against the one surface built entirely in the framework — measured
11
+ * there, because the only instrument that sees it is a camera.
12
+ *
13
+ * **A tree cannot fix it and must not be able to.** There is no prop, no theme
14
+ * and no node that means *smaller on a phone*, and there is not going to be
15
+ * one: a render is a pure function of one node
16
+ * ([0008](../../decisions/0008-the-renderer-is-a-total-pure-projection.md)), so
17
+ * a primitive handed a viewport would make the same tree a different page. The
18
+ * surface's own stylesheet cannot fix it either — a second source of truth for
19
+ * type and spacing is exactly what the re-theme guarantee
20
+ * ([0049](../../decisions/0049-a-theme-is-three-ids-in-the-tree.md)) cannot
21
+ * have.
22
+ *
23
+ * So the width is read where this repository already reads it: in CSS.
24
+ * [0079](../../decisions/0079-a-layout-css-alone-can-express-belongs-in-the-stylesheet.md)
25
+ * drew that line for `loom.mosaic` and drew it in the right place — *no
26
+ * viewport in the render function*, and a rule in a stylesheet is not in the
27
+ * render function. A `clamp()` is the same bargain one step earlier: the markup
28
+ * is unchanged, nothing is interpolated, `themeVariables` is as pure as it was
29
+ * — the same theme yields the same strings — and the browser rather than the
30
+ * render function is what knows how wide the page is.
31
+ *
32
+ * ## What a declared number now means
33
+ *
34
+ * **A maximum, reached at `48rem` and held above it.** Below that a step is
35
+ * compressed toward the largest value its quantity can hold on a phone, and a
36
+ * step already that small is emitted as the plain pixel length it always was.
37
+ * The consequence worth stating is the one that is easy to miss: **nothing
38
+ * changes at or above 768px.** A reader on a laptop sees the ramp the pack
39
+ * declared, to the pixel.
40
+ */
41
+ /**
42
+ * The width at which a ramp is exactly what its pack declared.
43
+ *
44
+ * `48rem` is the library's one width and 0079 set the bar for a second high on
45
+ * purpose. This is not a second one — a `clamp()` has no breakpoint in it, and
46
+ * naming the width the library already switches `loom.mosaic` on is the whole
47
+ * reason to prefer this number to a better-looking one.
48
+ */
49
+ const FULL_WIDTH_PX = 768;
50
+ /**
51
+ * How much of the distance between the hold and the declared number survives on
52
+ * a narrow screen.
53
+ *
54
+ * **It is not a taste.** `loom.primitives` capped `loom.heading`'s top step at
55
+ * `11cqi` on 20 August, found by measuring which words lost their last letter
56
+ * in a 390px screen. `0.46` is the ratio that reproduces that cap from the
57
+ * pack's own number — a 72px step floors at 42.84px where `11cqi` is 42.90px —
58
+ * so the figure a lane arrived at by photographing one pack is now derived for
59
+ * every step of every pack, including the ones nothing has photographed.
60
+ */
61
+ const COMPRESSION = 0.46;
62
+ /**
63
+ * The value each ramp is compressed toward, and the reason the two differ.
64
+ *
65
+ * Type holds at 18px because step 3 is body copy in every registered pack and
66
+ * step 4 is 17–20: a ramp that shrank those would be trading a headline that
67
+ * does not fit for paragraphs nobody can read. Space holds at 8px because
68
+ * whitespace has no legibility floor — only a floor at which a gap stops
69
+ * reading as one — and a phone wants less of it, not a little less.
70
+ */
71
+ const HOLD_PX = { type: 18, space: 8 };
72
+ /**
73
+ * Two decimal places, rounded **up**.
74
+ *
75
+ * Up rather than to nearest, and the preferred value is why. A coefficient
76
+ * rounded down reaches the declared size a little *after* `48rem` rather than
77
+ * at it — `20px` resolved to 19.97 at 768 before this was `ceil`, which is the
78
+ * one property the whole construction promises and the kind of defect only
79
+ * arithmetic over every registered pack finds. On a floor a hundredth of a
80
+ * pixel is beneath anything a reader or a camera can see.
81
+ */
82
+ const round = (value) => Math.ceil(value * 100) / 100;
83
+ /**
84
+ * The smallest this step is ever rendered.
85
+ *
86
+ * Monotone in `step` by construction — the identity at or below the hold, and
87
+ * affine with a positive slope above it — which is what keeps a ramp a ramp. A
88
+ * narrow screen reorders nothing: if the declared steps ascend, so do these,
89
+ * and so does every width between the two bounds.
90
+ */
91
+ const rampFloor = (step, kind) => {
92
+ const hold = HOLD_PX[kind];
93
+ return step <= hold ? step : hold + (step - hold) * COMPRESSION;
94
+ };
95
+ /**
96
+ * One ramp step, as the length `apply.ts` mounts.
97
+ *
98
+ * The preferred value is `cqi` rather than `vw` for the reason `loom.heading`
99
+ * learned in the same place: with no ancestor declaring containment `cqi` is
100
+ * the small viewport width, so a step on the open page behaves as it always
101
+ * did, and a step inside a `loom.card` or one half of a `loom.split` is held to
102
+ * the column it is actually in because those declare the containment for it to
103
+ * read.
104
+ */
105
+ export const rampLength = (step, kind, mode) => {
106
+ if (mode === "fixed")
107
+ return `${step}px`;
108
+ const floor = round(rampFloor(step, kind));
109
+ /** A step a phone already holds is the plain length it has always been. */
110
+ if (floor >= step)
111
+ return `${step}px`;
112
+ return `clamp(${floor}px, ${round((step / FULL_WIDTH_PX) * 100)}cqi, ${step}px)`;
113
+ };
114
+ //# sourceMappingURL=ramp.js.map
@@ -24,6 +24,15 @@ export type ThemeError = {
24
24
  readonly code: "malformed-selection";
25
25
  readonly detail: string;
26
26
  };
27
+ /**
28
+ * Why a theme did not resolve, and what could have.
29
+ *
30
+ * `available` holds every registered id and this prints the few nearest the one
31
+ * that was asked for, because the sentence lands in a log line whose length is
32
+ * not the deployment's to set. A caller that wants the whole list has it on the
33
+ * error, and a caller that wants it with names and descriptions has
34
+ * `catalogue()`.
35
+ */
27
36
  export declare const describeThemeError: (error: ThemeError) => string;
28
37
  export type ThemeCatalogueEntry = {
29
38
  readonly id: string;
@@ -1,9 +1,19 @@
1
+ import { describeRegistered } from "../registered.js";
1
2
  import { err, ok } from "../result.js";
2
3
  import { STARTER_FONT_PACKS, STARTER_PALETTES, STARTER_STYLE_PRESETS, } from "./library.js";
3
4
  import { themeSelectionSchema, } from "./theme.js";
5
+ /**
6
+ * Why a theme did not resolve, and what could have.
7
+ *
8
+ * `available` holds every registered id and this prints the few nearest the one
9
+ * that was asked for, because the sentence lands in a log line whose length is
10
+ * not the deployment's to set. A caller that wants the whole list has it on the
11
+ * error, and a caller that wants it with names and descriptions has
12
+ * `catalogue()`.
13
+ */
4
14
  export const describeThemeError = (error) => error.code === "malformed-selection"
5
15
  ? `Theme selection is malformed: ${error.detail}`
6
- : `No ${error.code.replace("unknown-", "").replace("-", " ")} "${error.id}". Registered: ${error.available.join(", ") || "none"}.`;
16
+ : `No ${error.code.replace("unknown-", "").replace("-", " ")} "${error.id}". Registered: ${describeRegistered(error.id, error.available)}.`;
7
17
  const entryOf = (item) => ({
8
18
  id: item.id,
9
19
  name: item.name,
@@ -30,6 +30,19 @@ import type { Palette, PaletteSlot, ThemeId } from "./theme.js";
30
30
  * the just-noticeable difference is a published property of human vision, not a
31
31
  * number chosen to fit these palettes.
32
32
  *
33
+ * ## The two questions in here
34
+ *
35
+ * **`auditSeparation`** asks whether two slots a reader is meant to tell apart
36
+ * can be told apart, and lets either the fills or a mark between them answer.
37
+ *
38
+ * **`auditMarkGroundings`** asks whether a line the library declares is a line a
39
+ * reader can find, against every ground it is drawn on. It was added on
40
+ * 29 September, five weeks after the module, because the first question cannot
41
+ * reach it: a mark is only measured there when the pair it separates has
42
+ * collapsed, so eight starter palettes were drawing a `border-subtle` edge
43
+ * within a just-noticeable difference of the fill it contained — one of them at
44
+ * ΔE 0.00 — with every test in this file green.
45
+ *
33
46
  * It reports; it does not decide — the bargain `auditPalette` and
34
47
  * `auditRegistry` both make, for the same reason (0076).
35
48
  */
@@ -69,9 +82,15 @@ export declare const colourDifference: (a: string, b: string) => number | undefi
69
82
  * **`also-marked`** — a rule, a border or an outline separates them as well, so
70
83
  * the two colours are free to be equal. `minimal` is the argument for this
71
84
  * basis existing: its `bg-surface` *is* its `bg-canvas`, deliberately, because
72
- * every card in that palette is defined by its border. What is asserted for
73
- * these is the weaker and still real claim — the mark itself has to be visible
74
- * against both.
85
+ * every card in that palette is defined by its border.
86
+ *
87
+ * What an `also-marked` row asserts is that **one** of the two signals works:
88
+ * the fills differ, or the mark between them does. That is the right question
89
+ * for *can a reader tell these two regions apart*, and it is weaker than it
90
+ * reads — a palette whose fills differ is never asked about its mark at all, so
91
+ * a border that draws nothing passes here. Whether each line the library
92
+ * declares can be seen at all is `auditMarkGroundings`, which asks it of every
93
+ * ground the slot lands on and does not take a fill difference as an answer.
75
94
  */
76
95
  export type PeerBasis = "colour-only" | "also-marked";
77
96
  type PeerBase = {
@@ -122,6 +141,81 @@ export type PeerPairing = (PeerBase & {
122
141
  * pair anybody is being asked to tell apart.
123
142
  */
124
143
  export declare const PALETTE_PEER_PAIRINGS: readonly PeerPairing[];
144
+ /**
145
+ * A slot the library draws as a line, and the grounds it is drawn against.
146
+ *
147
+ * The question a `PeerPairing` cannot ask. A pairing names two things a reader
148
+ * tells apart and treats a mark as a *defence* — something that may carry the
149
+ * pair when the two colours will not. So a mark is only ever measured when the
150
+ * colours it separates have collapsed, and a mark that draws nothing on a
151
+ * palette whose two fills happen to differ is never looked at.
152
+ *
153
+ * That is not a second way of asking the same thing. A border is a promise in
154
+ * its own right: the library declares an edge, and a palette that puts the edge
155
+ * within a just-noticeable difference of the fill behind it has erased a line
156
+ * the component says is there. Nothing else in the repository would say so —
157
+ * the region is still distinguishable, so `auditSeparation` passes, and every
158
+ * test that asks whether the token is real passes too, because the token is
159
+ * real. It is the module's own lesson at one turn further out: **a token is a
160
+ * promise about provenance, not about difference**, and a border tier is a
161
+ * promise about difference from whatever it lands on.
162
+ *
163
+ * `grounds` is every ground the library draws this slot against, not the one it
164
+ * was designed for. A line is judged against its nearest ground, because a rule
165
+ * that disappears into one of the three fills it is used on has disappeared.
166
+ */
167
+ export type MarkGrounding = {
168
+ readonly mark: PaletteSlot;
169
+ readonly grounds: readonly PaletteSlot[];
170
+ /** Where the library draws it, so a failure names a primitive. */
171
+ readonly where: string;
172
+ };
173
+ /**
174
+ * Every slot the library draws as a line, with the grounds it lands on.
175
+ *
176
+ * Declared for the reason `PALETTE_PEER_PAIRINGS` is: a probe can see that
177
+ * `.loom-card` sets `border-color`, and nothing in the rule says the border is
178
+ * *meant to be seen* rather than to be the far side of a fill.
179
+ *
180
+ * The three tiers and what each is for is
181
+ * [0204](../../decisions/0204-a-rule-with-no-fill-beside-it-is-measured-in-delta-e.md)'s
182
+ * split, and the grounds are the three fills every one of them is drawn on:
183
+ * a page, a card, and a muted well. `border-accent` is not here — it is a ring
184
+ * a component draws to mean *this one*, and what it answers to is being
185
+ * different from the other tiers rather than from the ground.
186
+ */
187
+ export declare const PALETTE_MARK_GROUNDINGS: readonly MarkGrounding[];
188
+ /** One slot against one of the grounds it is drawn on. */
189
+ export type MeasuredMark = {
190
+ readonly grounding: MarkGrounding;
191
+ readonly ground: PaletteSlot;
192
+ /** `undefined` when either colour is a form `channelsOf` declines to guess at. */
193
+ readonly difference: number | undefined;
194
+ /** False for a difference this could not measure: an undefended line is not a defended one. */
195
+ readonly visible: boolean;
196
+ };
197
+ /** What one palette does with the lines the library draws in it. */
198
+ export type MarkAudit = {
199
+ readonly palette: ThemeId;
200
+ readonly measured: readonly MeasuredMark[];
201
+ /**
202
+ * The lines a reader cannot find. A border the library declares and the
203
+ * palette does not draw — the list a host asserts empty.
204
+ */
205
+ readonly invisible: readonly MeasuredMark[];
206
+ };
207
+ /**
208
+ * Measures every declared mark against every ground it is drawn on. Refuses
209
+ * nothing, decides nothing — the same bargain `auditSeparation` makes.
210
+ *
211
+ * Separate from `auditSeparation` rather than a fourth bucket inside it,
212
+ * because the two ask different questions of different shapes of declaration
213
+ * and a host may reasonably assert one and not the other: a palette may want
214
+ * two fills to be equal, and no palette wants a line it cannot see.
215
+ */
216
+ export declare const auditMarkGroundings: (palette: Palette, groundings?: readonly MarkGrounding[]) => MarkAudit;
217
+ /** One line per invisible mark, for a CLI or a failing test's message. Empty when clean. */
218
+ export declare const describeMarkAudit: (audit: MarkAudit) => string;
125
219
  /** A peer that was measured, whether or not it came apart. */
126
220
  export type MeasuredPeer = {
127
221
  readonly pairing: PeerPairing;
@@ -30,6 +30,19 @@ import { labOf } from "./lab.js";
30
30
  * the just-noticeable difference is a published property of human vision, not a
31
31
  * number chosen to fit these palettes.
32
32
  *
33
+ * ## The two questions in here
34
+ *
35
+ * **`auditSeparation`** asks whether two slots a reader is meant to tell apart
36
+ * can be told apart, and lets either the fills or a mark between them answer.
37
+ *
38
+ * **`auditMarkGroundings`** asks whether a line the library declares is a line a
39
+ * reader can find, against every ground it is drawn on. It was added on
40
+ * 29 September, five weeks after the module, because the first question cannot
41
+ * reach it: a mark is only measured there when the pair it separates has
42
+ * collapsed, so eight starter palettes were drawing a `border-subtle` edge
43
+ * within a just-noticeable difference of the fill it contained — one of them at
44
+ * ΔE 0.00 — with every test in this file green.
45
+ *
33
46
  * It reports; it does not decide — the bargain `auditPalette` and
34
47
  * `auditRegistry` both make, for the same reason (0076).
35
48
  */
@@ -145,6 +158,68 @@ export const PALETTE_PEER_PAIRINGS = [
145
158
  where: "loom.code panel on a page; loom.callout marks the same pair harder",
146
159
  },
147
160
  ];
161
+ /**
162
+ * Every slot the library draws as a line, with the grounds it lands on.
163
+ *
164
+ * Declared for the reason `PALETTE_PEER_PAIRINGS` is: a probe can see that
165
+ * `.loom-card` sets `border-color`, and nothing in the rule says the border is
166
+ * *meant to be seen* rather than to be the far side of a fill.
167
+ *
168
+ * The three tiers and what each is for is
169
+ * [0204](../../decisions/0204-a-rule-with-no-fill-beside-it-is-measured-in-delta-e.md)'s
170
+ * split, and the grounds are the three fills every one of them is drawn on:
171
+ * a page, a card, and a muted well. `border-accent` is not here — it is a ring
172
+ * a component draws to mean *this one*, and what it answers to is being
173
+ * different from the other tiers rather than from the ground.
174
+ */
175
+ export const PALETTE_MARK_GROUNDINGS = [
176
+ {
177
+ mark: "border-subtle",
178
+ grounds: ["bg-canvas", "bg-surface", "bg-surface-muted"],
179
+ where: "the four-sided edge of a box: loom.card, loom.badge, loom.tier, loom.code's well",
180
+ },
181
+ {
182
+ mark: "border-default",
183
+ grounds: ["bg-canvas", "bg-surface", "bg-surface-muted"],
184
+ where: "hairline(): a rule between table rows, a timeline rail, the line under a nav",
185
+ },
186
+ {
187
+ mark: "border-strong",
188
+ grounds: ["bg-canvas", "bg-surface"],
189
+ where: "loom.table and loom.comparison-table, the one rule under a header",
190
+ },
191
+ ];
192
+ /**
193
+ * Measures every declared mark against every ground it is drawn on. Refuses
194
+ * nothing, decides nothing — the same bargain `auditSeparation` makes.
195
+ *
196
+ * Separate from `auditSeparation` rather than a fourth bucket inside it,
197
+ * because the two ask different questions of different shapes of declaration
198
+ * and a host may reasonably assert one and not the other: a palette may want
199
+ * two fills to be equal, and no palette wants a line it cannot see.
200
+ */
201
+ export const auditMarkGroundings = (palette, groundings = PALETTE_MARK_GROUNDINGS) => {
202
+ const measured = groundings.flatMap((grounding) => grounding.grounds.map((ground) => {
203
+ const difference = colourDifference(palette.slots[grounding.mark] ?? "", palette.slots[ground] ?? "");
204
+ return {
205
+ grounding,
206
+ ground,
207
+ difference,
208
+ visible: difference !== undefined && difference >= JUST_NOTICEABLE_DIFFERENCE,
209
+ };
210
+ }));
211
+ return {
212
+ palette: palette.id,
213
+ measured,
214
+ invisible: measured.filter((entry) => !entry.visible),
215
+ };
216
+ };
217
+ /** One line per invisible mark, for a CLI or a failing test's message. Empty when clean. */
218
+ export const describeMarkAudit = (audit) => audit.invisible
219
+ .map((entry) => entry.difference === undefined
220
+ ? `${audit.palette}: ${entry.grounding.mark} on ${entry.ground} could not be measured (${entry.grounding.where})`
221
+ : `${audit.palette}: ${entry.grounding.mark} differs from ${entry.ground} by ${entry.difference.toFixed(2)}, under ${JUST_NOTICEABLE_DIFFERENCE} — the line is not there (${entry.grounding.where})`)
222
+ .join("\n");
148
223
  const markOf = (pairing) => pairing.basis === "also-marked" ? pairing.mark : undefined;
149
224
  /**
150
225
  * How far a mark is from the *nearer* of the two it separates.
@@ -5,6 +5,19 @@ import { detachNode, insertChild, replaceNode } from "./mutation.js";
5
5
  import { collectNodeIds, duplicateNodeIds, isDescendantOf, walkTree } from "./navigation.js";
6
6
  import { withRoot } from "./tree.js";
7
7
  const withRetired = (applied, retired) => mapResult(applied, (root) => ({ root, retired }));
8
+ /**
9
+ * **This is where the only structural invariant a tree has is enforced, and
10
+ * that it is the only one is the part worth writing down.**
11
+ * `validateTreeInvariants` checks unique ids and nothing else, so anything that
12
+ * composes operations from two sources — a composition per audience (0359,
13
+ * 0376), a merge of two proposals, anything that replays two logs — does not
14
+ * need a defensive check over what it produced: the second `insert` of an id
15
+ * the tree already holds fails here, long before there is a tree to invalidate.
16
+ *
17
+ * Written here because a run that reaches for that check reaches for it out of a
18
+ * fear this answers, and the answer took a planted mutation to settle. The
19
+ * fear, and the removal, are recorded in `audience/compose.ts`.
20
+ */
8
21
  const rejectIdCollisions = (root, incoming) => {
9
22
  const [internalDuplicate] = duplicateNodeIds(incoming);
10
23
  if (internalDuplicate)
@@ -33,6 +33,15 @@ import type { LoomTree } from "./tree.js";
33
33
  * primitive.
34
34
  */
35
35
  export type NodeFacet = "kind" | "type" | "name" | "props" | "text" | "parent" | "position";
36
+ /**
37
+ * Every facet, for the things that have to walk them rather than react to one.
38
+ *
39
+ * `reseed.ts` is the caller that needs it: which facets a `configure` can close
40
+ * decides whether a page can be put back to its authored shape at all, and that
41
+ * list is only trustworthy if a facet added here cannot be left out of it. With
42
+ * this, it cannot — the subset is checked against this list where it is written.
43
+ */
44
+ export declare const NODE_FACETS: readonly NodeFacet[];
36
45
  export type TreeDifference =
37
46
  /** Present in the base tree, absent from the compared one. */
38
47
  {
@@ -1,5 +1,23 @@
1
+ import { everyMemberOf } from "../closed-set.js";
1
2
  import { nodeLabel } from "./node.js";
2
3
  import { outlineTree } from "./outline.js";
4
+ /**
5
+ * Every facet, for the things that have to walk them rather than react to one.
6
+ *
7
+ * `reseed.ts` is the caller that needs it: which facets a `configure` can close
8
+ * decides whether a page can be put back to its authored shape at all, and that
9
+ * list is only trustworthy if a facet added here cannot be left out of it. With
10
+ * this, it cannot — the subset is checked against this list where it is written.
11
+ */
12
+ export const NODE_FACETS = everyMemberOf()([
13
+ "kind",
14
+ "type",
15
+ "name",
16
+ "props",
17
+ "text",
18
+ "parent",
19
+ "position",
20
+ ]);
3
21
  /**
4
22
  * Props are compared by their serialisation rather than key by key.
5
23
  *
@@ -6,8 +6,26 @@ import { type LoomNode } from "./node.js";
6
6
  * Structural edits on an immutable tree. Each returns a new root; nodes off the
7
7
  * edited path keep their identity, so a renderer can rely on reference equality
8
8
  * to skip untouched subtrees.
9
+ *
10
+ * **Nothing here recurses into the tree, and nothing rebuilds a list of
11
+ * children one child at a time**, for the same reason the reads in
12
+ * `navigation.ts` do not (0372, 0373): a page's shape is data, and an edit that
13
+ * spends a call frame per level or copies the accumulated siblings per sibling
14
+ * stops answering at a shape a page is allowed to have.
9
15
  */
10
16
  export type NodeTransform = (node: LoomNode) => Result<LoomNode, TreeError>;
17
+ /**
18
+ * The addressed node, transformed, and every ancestor rebuilt around it.
19
+ *
20
+ * It descends by the **path** rather than by a search. `nodePath` names the
21
+ * chain from the root to the node in one walk, so the rebuild touches one node
22
+ * per level and asks nothing: no `containsNode` per level, no frame per level.
23
+ *
24
+ * Where a tree holds the same id twice — which `duplicateNodeIds` exists to
25
+ * find and no valid tree has — the node this edits is the first in tree order,
26
+ * because that is the one `nodePath` addresses. The search this replaced edited
27
+ * every copy.
28
+ */
11
29
  export declare const replaceNode: (root: LoomNode, nodeId: NodeId, transform: NodeTransform) => Result<LoomNode, TreeError>;
12
30
  export declare const insertChild: (root: LoomNode, parentId: NodeId, index: number, node: LoomNode) => Result<LoomNode, TreeError>;
13
31
  export type DetachedTree = {
@@ -1,21 +1,33 @@
1
- import { err, mapResult, ok, reduceResult } from "../result.js";
2
- import { containsNode, findNode, findParent } from "./navigation.js";
1
+ import { err, flatMapResult, mapResult, ok } from "../result.js";
2
+ import { findNode, findParent, nodePath } from "./navigation.js";
3
3
  import { isContainerNode, withChildren, } from "./node.js";
4
4
  const requireContainer = (node) => isContainerNode(node)
5
5
  ? ok(node)
6
6
  : err({ code: "not-a-container", nodeId: node.id, nodeKind: node.kind });
7
+ /** One child swapped for its rebuilt self, by reference, in one pass. */
8
+ const withChildSwapped = (parent, previous, next) => mapResult(requireContainer(parent), (container) => withChildren(container, container.children.map((child) => (child === previous ? next : child))));
9
+ /**
10
+ * The addressed node, transformed, and every ancestor rebuilt around it.
11
+ *
12
+ * It descends by the **path** rather than by a search. `nodePath` names the
13
+ * chain from the root to the node in one walk, so the rebuild touches one node
14
+ * per level and asks nothing: no `containsNode` per level, no frame per level.
15
+ *
16
+ * Where a tree holds the same id twice — which `duplicateNodeIds` exists to
17
+ * find and no valid tree has — the node this edits is the first in tree order,
18
+ * because that is the one `nodePath` addresses. The search this replaced edited
19
+ * every copy.
20
+ */
7
21
  export const replaceNode = (root, nodeId, transform) => {
8
- if (!containsNode(root, nodeId))
22
+ const path = nodePath(root, nodeId);
23
+ const [target, ...ancestorsNearestFirst] = path ? [...path].reverse() : [];
24
+ if (!target)
9
25
  return err({ code: "node-not-found", nodeId });
10
- const rebuild = (node) => {
11
- if (node.id === nodeId)
12
- return transform(node);
13
- if (!isContainerNode(node) || !containsNode(node, nodeId))
14
- return ok(node);
15
- const rebuiltChildren = reduceResult(node.children, [], (accumulated, child) => mapResult(rebuild(child), (next) => [...accumulated, next]));
16
- return mapResult(rebuiltChildren, (children) => withChildren(node, children));
17
- };
18
- return rebuild(root);
26
+ const rebuilt = ancestorsNearestFirst.reduce((carried, ancestor) => flatMapResult(carried, (below) => mapResult(withChildSwapped(ancestor, below.was, below.now), (next) => ({
27
+ was: ancestor,
28
+ now: next,
29
+ }))), mapResult(transform(target), (now) => ({ was: target, now })));
30
+ return mapResult(rebuilt, (top) => top.now);
19
31
  };
20
32
  export const insertChild = (root, parentId, index, node) => {
21
33
  const parent = findNode(root, parentId);
@@ -4,6 +4,11 @@ import { type LoomNode } from "./node.js";
4
4
  * Read-only traversal. Every function here takes a root and derives a view;
5
5
  * nothing caches, because a cache would be a second source of truth about a
6
6
  * structure that changes on every accepted delta.
7
+ *
8
+ * **Nothing here recurses into the tree**, which is a correctness requirement
9
+ * rather than a preference (0372): a page's depth is data, so a walk that
10
+ * spends a call frame per level stops answering at a depth a tree is allowed to
11
+ * reach. Every walk below carries an explicit stack and is linear in nodes.
7
12
  */
8
13
  export declare function walkTree(root: LoomNode): Generator<LoomNode>;
9
14
  export declare const collectNodeIds: (root: LoomNode) => readonly NodeId[];