@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,4 +1,3 @@
1
- import { type ChangeEvent } from "react";
2
1
  /**
3
2
  * The third control that runs on the client, and the first that hands a value
4
3
  * back to the primitive that placed it.
@@ -20,11 +19,20 @@ import { type ChangeEvent } from "react";
20
19
  *
21
20
  * **It renders nothing until it knows scripting runs**, for the reason the other
22
21
  * two give, and here the fallback is the whole point rather than a consolation.
23
- * A primitive reads the value as `var(--loom-adjust, 50)` with its own declared
22
+ * A primitive reads the value as `var(--loom-adjust, 35)` with its own declared
24
23
  * position as the fallback, so a page served with scripting off shows the still
25
24
  * comparison at the position the tree asked for — which is what most pages using
26
25
  * this actually are. Nothing is hidden behind a control that never arrives.
27
26
  *
27
+ * **And it publishes nothing until the reader moves it**, which is the half that
28
+ * had to be learned from a photograph. Appearing is not an instruction: a
29
+ * control that wrote its own resting value the moment it mounted overwrote the
30
+ * fallback it was built to defend, so a band authored at 35 rendered at 35 and
31
+ * jumped to the runtime's midpoint as hydration landed. Where it starts is the
32
+ * primitive's to declare — {@link ADJUST_RESTING_PROPERTY}, read off the
33
+ * element it was placed in — and what it publishes is the reader's alone. See
34
+ * [0226](../../decisions/0226-a-primitive-declares-where-its-control-rests-and-the-control-publishes-nothing-until-the-reader-moves-it.md).
35
+ *
28
36
  * **A range input rather than a hand-built handle.** Dragging, arrow keys, Home
29
37
  * and End, the announced role and the announced value are all a browser's to get
30
38
  * right, and a `role="slider"` div reimplements every one of them worse. The
@@ -42,21 +50,5 @@ export type AdjustControlProps = {
42
50
  */
43
51
  readonly label: string;
44
52
  };
45
- export declare const AdjustControl: ({ label }: AdjustControlProps) => import("react").DetailedReactHTMLElement<{
46
- ref: import("react").RefObject<HTMLInputElement | null>;
47
- type: string;
48
- className: string;
49
- min: number;
50
- max: number;
51
- value: number;
52
- "aria-label": string;
53
- onChange: (event: ChangeEvent<HTMLInputElement>) => void;
54
- style: {
55
- readonly accentColor: "var(--loom-accent, currentColor)";
56
- readonly display: string;
57
- readonly cursor: "grab";
58
- readonly margin: 0;
59
- readonly verticalAlign: "middle";
60
- };
61
- }, HTMLInputElement> | null;
53
+ export declare const AdjustControl: ({ label }: AdjustControlProps) => import("react").FunctionComponentElement<AdjustControlProps> | null;
62
54
  //# sourceMappingURL=behaviour-adjust.d.ts.map
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { createElement, useCallback, useEffect, useRef, useState } from "react";
3
- import { ADJUST_MAXIMUM, ADJUST_MINIMUM, ADJUST_PROPERTY, ADJUST_RESTING } from "./behaviour.js";
2
+ import { createElement, useCallback, useEffect, useLayoutEffect, useRef, useState, } from "react";
3
+ import { ADJUST_MAXIMUM, ADJUST_MINIMUM, ADJUST_PROPERTY, ADJUST_RESTING, ADJUST_RESTING_PROPERTY, } from "./behaviour.js";
4
4
  import { controlClass, controlDisplay } from "./control.js";
5
5
  /**
6
6
  * `var()` with a fallback rather than the `tokens.ts` helpers, for the reason
@@ -26,22 +26,65 @@ const INPUT_STYLE = {
26
26
  margin: 0,
27
27
  verticalAlign: "middle",
28
28
  };
29
- export const AdjustControl = ({ label }) => {
30
- const [usable, setUsable] = useState(false);
31
- const [value, setValue] = useState(ADJUST_RESTING);
29
+ /**
30
+ * Where the primitive asked its control to start, read off the element the
31
+ * control was placed in.
32
+ *
33
+ * The **computed** value rather than the inline one, because a custom property
34
+ * is a cascaded value and a primitive may declare it in a rule as readily as in
35
+ * a style attribute. It inherits, like any custom property, which is the same
36
+ * reach `ADJUST_PROPERTY` has in the other direction.
37
+ *
38
+ * Clamped and rounded rather than trusted. The range is the runtime's (0096), so
39
+ * a number outside it is not a position this control can take, and a fractional
40
+ * one is not a position a step-1 input can hold — state and thumb would disagree
41
+ * from the first frame. Anything unreadable falls back to {@link ADJUST_RESTING},
42
+ * which is also what a primitive declaring nothing gets: a control that refused
43
+ * to render because a stylesheet said `--loom-adjust-resting: thirty` would be a
44
+ * missing comparison, and the still version is right there in the `var()`
45
+ * fallback.
46
+ */
47
+ const restingIn = (element) => {
48
+ const declared = getComputedStyle(element).getPropertyValue(ADJUST_RESTING_PROPERTY).trim();
49
+ if (declared === "")
50
+ return ADJUST_RESTING;
51
+ const value = Number(declared);
52
+ if (!Number.isFinite(value))
53
+ return ADJUST_RESTING;
54
+ return Math.min(ADJUST_MAXIMUM, Math.max(ADJUST_MINIMUM, Math.round(value)));
55
+ };
56
+ /**
57
+ * The input itself, split from the capability check so that the two things that
58
+ * must happen in a browser are not conditioned on each other.
59
+ *
60
+ * It exists for the adoption below. Reading the parent needs the input mounted,
61
+ * which needs the check to have passed — so the read cannot share an effect with
62
+ * the check, and a `useLayoutEffect` in the component that also renders on the
63
+ * server is a warning about a hook that does nothing there. A component that
64
+ * mounts only once scripting is proved has no server render to warn about.
65
+ */
66
+ const AdjustSlider = ({ label }) => {
32
67
  const input = useRef(null);
68
+ const [position, setPosition] = useState(ADJUST_RESTING);
69
+ const [moved, setMoved] = useState(false);
33
70
  /**
34
- * Deliberately an effect rather than a render-time check, for the reason the
35
- * other two controls give: anything read while rendering would make the
36
- * server's markup and the browser's first render disagree, and React resolves
37
- * that by keeping the server's — so the control would be missing exactly where
38
- * it works. That the effect ran is the whole of the capability check.
71
+ * Before the first paint, not after it. A passive effect here would let the
72
+ * browser paint one frame with the thumb at the runtime's midpoint on a page
73
+ * that declared something else — the whole defect in miniature, a sixtieth of
74
+ * a second long. A layout effect's `setPosition` re-renders synchronously, so
75
+ * the first frame the reader sees is already the declared one.
39
76
  */
40
- useEffect(() => setUsable(true), []);
77
+ useLayoutEffect(() => {
78
+ const parent = input.current?.parentElement;
79
+ if (parent)
80
+ setPosition(restingIn(parent));
81
+ }, []);
41
82
  /**
42
- * `usable` is a dependency and not a redundant one: the first run happens
43
- * while the control is still rendering nothing, so the ref is empty and there
44
- * is no parent to write to. The write has to happen again once there is.
83
+ * `moved` is the whole of the contract this effect keeps: until the reader has
84
+ * moved the control there is nothing to publish, because the primitive's own
85
+ * `var()` fallback already says where the divider is and this agrees with it.
86
+ * Writing the same number anyway would be indistinguishable on a page whose
87
+ * fallback matches and wrong on every page whose fallback does not.
45
88
  *
46
89
  * The cleanup removes the property rather than leaving the last value behind.
47
90
  * A primitive that unmounts its control — a media query that stops offering
@@ -51,28 +94,39 @@ export const AdjustControl = ({ label }) => {
51
94
  */
52
95
  useEffect(() => {
53
96
  const parent = input.current?.parentElement;
54
- if (!parent)
97
+ if (!parent || !moved)
55
98
  return undefined;
56
- parent.style.setProperty(ADJUST_PROPERTY, String(value));
99
+ parent.style.setProperty(ADJUST_PROPERTY, String(position));
57
100
  return () => {
58
101
  parent.style.removeProperty(ADJUST_PROPERTY);
59
102
  };
60
- }, [value, usable]);
103
+ }, [moved, position]);
61
104
  const change = useCallback((event) => {
62
- setValue(Number(event.target.value));
105
+ setPosition(Number(event.target.value));
106
+ setMoved(true);
63
107
  }, []);
64
- if (!usable)
65
- return null;
66
108
  return createElement("input", {
67
109
  ref: input,
68
110
  type: "range",
69
111
  className: controlClass("adjust"),
70
112
  min: ADJUST_MINIMUM,
71
113
  max: ADJUST_MAXIMUM,
72
- value,
114
+ value: position,
73
115
  "aria-label": label,
74
116
  onChange: change,
75
117
  style: INPUT_STYLE,
76
118
  });
77
119
  };
120
+ export const AdjustControl = ({ label }) => {
121
+ const [usable, setUsable] = useState(false);
122
+ /**
123
+ * Deliberately an effect rather than a render-time check, for the reason the
124
+ * other two controls give: anything read while rendering would make the
125
+ * server's markup and the browser's first render disagree, and React resolves
126
+ * that by keeping the server's — so the control would be missing exactly where
127
+ * it works. That the effect ran is the whole of the capability check.
128
+ */
129
+ useEffect(() => setUsable(true), []);
130
+ return usable ? createElement(AdjustSlider, { label }) : null;
131
+ };
78
132
  //# sourceMappingURL=behaviour-adjust.js.map
@@ -22,6 +22,14 @@ import { type MouseEvent } from "react";
22
22
  * facts about the region and the page around it, which is the half the primitive
23
23
  * owns. A primitive that presents a *modal* region has to arrange them and this
24
24
  * seam neither helps nor hinders it.
25
+ *
26
+ * **What is here, and is not any of those three.** The trigger's button is this
27
+ * control's, so where a reader is left when the region closes is this control's
28
+ * too ([0237](../../decisions/0237-a-presentation-returns-the-reader-to-its-trigger-and-only-from-inside-the-region-it-closed.md)).
29
+ * A region hidden while a reader stood inside it leaves them on nothing, and the
30
+ * fix is one `focus()` onto a button this file rendered — not a fact about any
31
+ * element the primitive laid out. The three a modal needs are unchanged and
32
+ * still absent.
25
33
  */
26
34
  export type PresentControlProps = {
27
35
  /**
@@ -76,6 +76,13 @@ export const PresentControl = ({ label }) => {
76
76
  * works.
77
77
  */
78
78
  useEffect(() => setUsable(true), []);
79
+ /**
80
+ * Whether the close now in flight should put the reader back on the trigger.
81
+ * A ref rather than state because nothing renders from it: it is set by the
82
+ * handler that decided to close and read by the effect that runs after the
83
+ * attribute has been written, which is one render apart and never two.
84
+ */
85
+ const returning = useRef(false);
79
86
  const toggle = useCallback(() => setOpen((was) => !was), []);
80
87
  /**
81
88
  * The published state, on the parent. `adjust` writes a custom property on the
@@ -105,26 +112,70 @@ export const PresentControl = ({ label }) => {
105
112
  const parent = trigger.current?.parentElement;
106
113
  if (!parent)
107
114
  return;
108
- const close = () => setOpen(false);
115
+ const close = (returnFocus) => {
116
+ returning.current = returnFocus;
117
+ setOpen(false);
118
+ };
119
+ /**
120
+ * Escape is heard on the document, so the reader may be anywhere — including
121
+ * the page behind an open region, because nothing traps focus there at all
122
+ * (0176). Returning them only when they are still inside the box is the same
123
+ * fact as that limit rather than a separate rule.
124
+ */
109
125
  const onKeyDown = (event) => {
110
- if (event.key === "Escape")
111
- close();
126
+ if (event.key !== "Escape")
127
+ return;
128
+ close(parent.contains(document.activeElement));
112
129
  };
130
+ /**
131
+ * A press outside is itself a destination, so it never moves the reader. The
132
+ * ordering is the reason this cannot be settled by reading `activeElement`
133
+ * like Escape does: `pointerdown` fires *before* the browser moves focus to
134
+ * what was pressed, so at this instant focus is still inside the region the
135
+ * press is closing, and a control that read it here would pull the reader
136
+ * off the thing they had just clicked.
137
+ */
113
138
  const onPointerDown = (event) => {
114
139
  const target = event.target;
115
140
  if (target instanceof Node && parent.contains(target))
116
141
  return;
117
- close();
142
+ close(false);
118
143
  };
144
+ /**
145
+ * Always, and without asking where focus is. The cross is inside the region
146
+ * by construction — it is the one control whose placement the seam refuses
147
+ * to register anywhere else — so pressing it is a reader asking to leave,
148
+ * whatever the browser did about focusing a button on click. That disagreement
149
+ * is real: Safari does not focus one, every other engine does, and a keyboard
150
+ * press focuses it everywhere. Reading focus here would make the keyboard
151
+ * case work and the Safari case silently not.
152
+ */
153
+ const onDismiss = () => close(true);
119
154
  document.addEventListener("keydown", onKeyDown);
120
155
  document.addEventListener("pointerdown", onPointerDown);
121
- parent.addEventListener(DISMISS_EVENT, close);
156
+ parent.addEventListener(DISMISS_EVENT, onDismiss);
122
157
  return () => {
123
158
  document.removeEventListener("keydown", onKeyDown);
124
159
  document.removeEventListener("pointerdown", onPointerDown);
125
- parent.removeEventListener(DISMISS_EVENT, close);
160
+ parent.removeEventListener(DISMISS_EVENT, onDismiss);
126
161
  };
127
162
  }, [open]);
163
+ /**
164
+ * The return itself, in its own effect and after the one that writes the
165
+ * attribute, so the region is already hidden when the reader arrives on the
166
+ * button. Declaration order is what guarantees that: React runs an element's
167
+ * effects in the order they were written.
168
+ *
169
+ * The trigger is never the element that gets hidden — it is a child of the box
170
+ * the attribute lands on and the region is another — so there is nothing here
171
+ * that depends on how the primitive wrote its rule.
172
+ */
173
+ useEffect(() => {
174
+ if (open || !returning.current)
175
+ return;
176
+ returning.current = false;
177
+ trigger.current?.focus();
178
+ }, [open]);
128
179
  if (!usable)
129
180
  return null;
130
181
  return createElement("button", {
@@ -1,8 +1,10 @@
1
1
  import { type ReactNode } from "react";
2
2
  import type { PrimitiveType } from "../primitive-type.js";
3
+ import { type ControlNameProps, type ControlNames } from "./control-name.js";
3
4
  import type { PrimitiveText } from "./text.js";
4
5
  export { DISCLOSED_ATTRIBUTE } from "./disclosed.js";
5
6
  export { DISMISS_EVENT, PRESENTED_ATTRIBUTE } from "./presented.js";
7
+ export { NO_CONTROL_NAME_PROPS, NO_CONTROL_NAMES, resolveControlNames, type ControlNameProps, type ControlNames, } from "./control-name.js";
6
8
  /**
7
9
  * The behaviour seam: the things a primitive *does* that its props cannot carry.
8
10
  *
@@ -79,6 +81,19 @@ export { DISMISS_EVENT, PRESENTED_ATTRIBUTE } from "./presented.js";
79
81
  * carries why, and [0176](../../decisions/0176-a-control-may-be-answerable-to-another-control-and-they-agree-through-the-dom.md)
80
82
  * records what was rejected.
81
83
  *
84
+ * A fifth axis arrived with the first control whose word is not the framework's:
85
+ * **where a control's name comes from.** Every member's name is a string its
86
+ * primitive declared, per type, so every code panel's button reads *Copy* and a
87
+ * dictionary can translate all of them at once. That is right for an affordance
88
+ * and wrong for a trigger whose words are the page's own — *Watch the demo* is
89
+ * content, and a dialog opened by a chip reading *Open* is a worse page than no
90
+ * dialog. So a primitive may name one of its own props as where a control takes
91
+ * its name from, the runtime reads it off the node, and the declared string stays
92
+ * underneath as the floor; `control-name.ts` carries why that is narrower than a
93
+ * reserved prop, and
94
+ * [0234](../../decisions/0234-a-primitive-may-name-a-control-from-the-tree-and-its-declared-string-is-the-floor.md)
95
+ * records what was rejected.
96
+ *
82
97
  * What a control hands back is not the same question as what a primitive may say
83
98
  * about it, and the second one lives in `control.ts`: the class every control
84
99
  * carries, and the custom property that decides whether it is displayed. Both
@@ -114,14 +129,26 @@ export type BehaviourName = (typeof BEHAVIOUR_NAMES)[number];
114
129
  * .after { clip-path: inset(0 calc(100% - var(--loom-adjust, 50) * 1%) 0 0) }
115
130
  * ```
116
131
  *
117
- * **The fallback is not optional and not decoration.** The property is absent
118
- * until the control has mounted and proved scripting runs, and absent again the
119
- * moment it unmounts — so the second argument to `var()` is what a page served
120
- * with scripting off renders, and it should be the position the primitive's own
121
- * props declared. That is what keeps the still version of a comparison the thing
122
- * that ships, rather than a blank waiting on a control that may never arrive.
132
+ * **The fallback is not optional and not decoration**, and it holds for longer
133
+ * than it first appeared to. The property is absent until **the reader has
134
+ * moved the control**, and absent again the moment it unmounts — so the second
135
+ * argument to `var()` is what a page renders both with scripting off and with
136
+ * scripting on and nobody having touched it yet. It should be the position the
137
+ * primitive's own props declared.
138
+ *
139
+ * It was written as absent until the control *mounted*, which made a declared
140
+ * position visible only on an unscripted page: the control published the
141
+ * runtime's midpoint in its mount effect, so a band authored at 35 rendered at
142
+ * 35 and jumped to 50 as hydration landed. A control now publishes nothing it
143
+ * was not asked for, and says where it starts through
144
+ * {@link ADJUST_RESTING_PROPERTY} instead. Every taker was already required to
145
+ * write a fallback, so the narrower contract takes nothing away from one that
146
+ * followed it.
123
147
  *
124
- * See [0096](../../decisions/0096-a-behaviour-publishes-a-value-on-the-element-the-primitive-placed-it-in.md).
148
+ * See [0096](../../decisions/0096-a-behaviour-publishes-a-value-on-the-element-the-primitive-placed-it-in.md)
149
+ * for where the property goes and
150
+ * [0226](../../decisions/0226-a-primitive-declares-where-its-control-rests-and-the-control-publishes-nothing-until-the-reader-moves-it.md)
151
+ * for when it is written.
125
152
  */
126
153
  export declare const ADJUST_PROPERTY = "--loom-adjust";
127
154
  /** The bottom of an adjust control's range. */
@@ -136,14 +163,45 @@ export declare const ADJUST_MINIMUM = 0;
136
163
  */
137
164
  export declare const ADJUST_MAXIMUM = 100;
138
165
  /**
139
- * Where the control sits before anybody moves it.
140
- *
141
- * The midpoint, and it is the control's rather than the primitive's on purpose.
142
- * `build` receives the node's text and its content, not its props, so there is
143
- * nothing here that could read a declared position — and nothing that needs to:
144
- * the primitive supplies its own position as the `var()` fallback, which covers
145
- * the case that actually matters, the page where the control never mounts. Once
146
- * a reader has a slider in front of them, where it started is theirs to change.
166
+ * The property a primitive declares to say **where its control should start**,
167
+ * on the element it places the control in. Read once, at mount, and never
168
+ * again — where the slider goes after that is the reader's.
169
+ *
170
+ * It exists because the obvious route to the same number is closed. `build`
171
+ * receives a node's text and its content, not its props, and that is 0086's
172
+ * shape rather than an omission: props are AI-authored, and a control a model
173
+ * configures is the thing the behaviour seam exists to prevent. So the number
174
+ * does not come through the seam. It comes the way `present` and `dismiss`
175
+ * agree (0176) — **through the DOM**, off the one element the primitive already
176
+ * chose by deciding where the control goes.
177
+ *
178
+ * Nothing new is exposed by that. A primitive taking `adjust` already renders
179
+ * its declared position into the page, as the `var()` fallback the still
180
+ * version is built on; this is the same number written where the control can
181
+ * read it, so the control starts where the page already is:
182
+ *
183
+ * ```ts
184
+ * const wipe = `var(${ADJUST_PROPERTY}, ${position})`
185
+ * // on the element the control is placed in:
186
+ * style: { [ADJUST_RESTING_PROPERTY]: position, ... }
187
+ * ```
188
+ *
189
+ * Declaring it is optional and a primitive that leaves it out gets
190
+ * {@link ADJUST_RESTING}. What it may not do is declare one number here and a
191
+ * different one as the `var()` fallback — the first is where the control
192
+ * starts, the second is what a page with no scripting shows, and a page where
193
+ * those disagree is a page that moves on hydration. See
194
+ * [0226](../../decisions/0226-a-primitive-declares-where-its-control-rests-and-the-control-publishes-nothing-until-the-reader-moves-it.md).
195
+ */
196
+ export declare const ADJUST_RESTING_PROPERTY = "--loom-adjust-resting";
197
+ /**
198
+ * Where the control sits when nothing declared otherwise.
199
+ *
200
+ * The midpoint, and it is the runtime's floor rather than the answer: a
201
+ * primitive that has a position of its own says so with
202
+ * {@link ADJUST_RESTING_PROPERTY}, and this is what a primitive with no opinion
203
+ * gets. Fixed rather than declarable per node, for the reason the range is
204
+ * fixed — what a control rests at is not a model's to write.
147
205
  */
148
206
  export declare const ADJUST_RESTING = 50;
149
207
  type Behaviour = {
@@ -174,7 +232,19 @@ type Behaviour = {
174
232
  * judgement the seam already makes about a control with no accessible name.
175
233
  */
176
234
  readonly requires?: BehaviourName;
177
- readonly build: (content: string, text: PrimitiveText<string>) => ReactNode;
235
+ /**
236
+ * Builds the control.
237
+ *
238
+ * Three arguments, and each is a different answer to *where does a control's
239
+ * word come from*. `content` is the node's own text, which is what a copy
240
+ * button acts on. `text` is the primitive's declared strings, laid over by
241
+ * whatever dictionary the deployment supplied. `name` is the word this node
242
+ * named its control with, or `undefined` where its primitive named no prop or
243
+ * the node filled none in — so every member decides for itself which of its
244
+ * strings a tree is allowed to replace, and `copy` lets a tree rename the
245
+ * button without touching what it says once it has copied.
246
+ */
247
+ readonly build: (content: string, text: PrimitiveText<string>, name: string | undefined) => ReactNode;
178
248
  };
179
249
  export declare const BEHAVIOURS: Readonly<Record<BehaviourName, Behaviour>>;
180
250
  export declare const isBehaviourName: (value: string) => value is BehaviourName;
@@ -210,6 +280,17 @@ export declare const NO_BEHAVIOURS: PrimitiveBehaviours<BehaviourName>;
210
280
  */
211
281
  export interface BehaviourResolver {
212
282
  readonly behavioursFor: (type: PrimitiveType) => readonly BehaviourName[];
283
+ /**
284
+ * The prop each of this type's controls takes its name from, where its author
285
+ * said so.
286
+ *
287
+ * Optional on the interface, and that is the only concession this seam makes
288
+ * to compatibility: a resolver written before a control could be named from a
289
+ * tree answers nothing here and is read as a library whose primitives all name
290
+ * their controls themselves, which is what it is. A registry built by the SDK
291
+ * always answers.
292
+ */
293
+ readonly controlNamePropsFor?: (type: PrimitiveType) => ControlNameProps;
213
294
  }
214
295
  export declare const isBehaviourResolver: (value: object) => value is BehaviourResolver;
215
296
  /** A declared behaviour whose control could not be given a name. */
@@ -239,5 +320,5 @@ export declare const NO_RESOLVED_BEHAVIOURS: ResolvedBehaviours;
239
320
  * button, in exactly the way the finding that asked for this said a fake one
240
321
  * would be.
241
322
  */
242
- export declare const resolveBehaviours: (names: readonly BehaviourName[], content: string, text: PrimitiveText<string>) => ResolvedBehaviours;
323
+ export declare const resolveBehaviours: (names: readonly BehaviourName[], content: string, text: PrimitiveText<string>, named?: ControlNames) => ResolvedBehaviours;
243
324
  //# sourceMappingURL=behaviour.d.ts.map