@jam-overture/loom 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (401) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +743 -0
  3. package/dist/catalogue.d.ts +70 -0
  4. package/dist/catalogue.js +88 -0
  5. package/dist/cli/args.d.ts +17 -0
  6. package/dist/cli/args.js +83 -0
  7. package/dist/cli/filesystem.d.ts +15 -0
  8. package/dist/cli/filesystem.js +31 -0
  9. package/dist/cli/index.d.ts +12 -0
  10. package/dist/cli/index.js +12 -0
  11. package/dist/cli/main.d.ts +3 -0
  12. package/dist/cli/main.js +30 -0
  13. package/dist/cli/namespace.d.ts +40 -0
  14. package/dist/cli/namespace.js +40 -0
  15. package/dist/cli/plan.d.ts +84 -0
  16. package/dist/cli/plan.js +113 -0
  17. package/dist/cli/run.d.ts +17 -0
  18. package/dist/cli/run.js +75 -0
  19. package/dist/cli/templates.d.ts +43 -0
  20. package/dist/cli/templates.js +134 -0
  21. package/dist/closed-set.d.ts +34 -0
  22. package/dist/closed-set.js +34 -0
  23. package/dist/data/adapter.d.ts +123 -0
  24. package/dist/data/adapter.js +91 -0
  25. package/dist/data/binding.d.ts +48 -0
  26. package/dist/data/binding.js +39 -0
  27. package/dist/data/catalogue.d.ts +26 -0
  28. package/dist/data/catalogue.js +6 -0
  29. package/dist/data/index.d.ts +14 -0
  30. package/dist/data/index.js +14 -0
  31. package/dist/data/plan.d.ts +58 -0
  32. package/dist/data/plan.js +0 -0
  33. package/dist/data/resolution.d.ts +91 -0
  34. package/dist/data/resolution.js +96 -0
  35. package/dist/data/resolve.d.ts +46 -0
  36. package/dist/data/resolve.js +37 -0
  37. package/dist/data/source.d.ts +40 -0
  38. package/dist/data/source.js +45 -0
  39. package/dist/deadline.d.ts +57 -0
  40. package/dist/deadline.js +78 -0
  41. package/dist/frame/catalogue.d.ts +24 -0
  42. package/dist/frame/catalogue.js +5 -0
  43. package/dist/frame/index.d.ts +12 -0
  44. package/dist/frame/index.js +12 -0
  45. package/dist/frame/origin.d.ts +87 -0
  46. package/dist/frame/origin.js +114 -0
  47. package/dist/frame/resolution.d.ts +85 -0
  48. package/dist/frame/resolution.js +79 -0
  49. package/dist/grammar.d.ts +26 -0
  50. package/dist/grammar.js +28 -0
  51. package/dist/ids.d.ts +57 -0
  52. package/dist/ids.js +104 -0
  53. package/dist/index.d.ts +26 -0
  54. package/dist/index.js +26 -0
  55. package/dist/interactivity.d.ts +50 -0
  56. package/dist/interactivity.js +22 -0
  57. package/dist/interpretation/anthropic.d.ts +22 -0
  58. package/dist/interpretation/anthropic.js +76 -0
  59. package/dist/interpretation/client.d.ts +83 -0
  60. package/dist/interpretation/client.js +2 -0
  61. package/dist/interpretation/draft.d.ts +234 -0
  62. package/dist/interpretation/draft.js +84 -0
  63. package/dist/interpretation/index.d.ts +15 -0
  64. package/dist/interpretation/index.js +15 -0
  65. package/dist/interpretation/interpreter.d.ts +62 -0
  66. package/dist/interpretation/interpreter.js +151 -0
  67. package/dist/interpretation/materialize.d.ts +42 -0
  68. package/dist/interpretation/materialize.js +107 -0
  69. package/dist/interpretation/prompt.d.ts +229 -0
  70. package/dist/interpretation/prompt.js +285 -0
  71. package/dist/interpretation/render.d.ts +76 -0
  72. package/dist/interpretation/render.js +272 -0
  73. package/dist/interpretation/schema.d.ts +49 -0
  74. package/dist/interpretation/schema.js +131 -0
  75. package/dist/json.d.ts +35 -0
  76. package/dist/json.js +11 -0
  77. package/dist/paging.d.ts +60 -0
  78. package/dist/paging.js +49 -0
  79. package/dist/primitive-type.d.ts +32 -0
  80. package/dist/primitive-type.js +39 -0
  81. package/dist/render/addressing.d.ts +59 -0
  82. package/dist/render/addressing.js +60 -0
  83. package/dist/render/anchor.d.ts +105 -0
  84. package/dist/render/anchor.js +84 -0
  85. package/dist/render/behaviour-adjust.d.ts +62 -0
  86. package/dist/render/behaviour-adjust.js +78 -0
  87. package/dist/render/behaviour-copy.d.ts +53 -0
  88. package/dist/render/behaviour-copy.js +75 -0
  89. package/dist/render/behaviour-disclose.d.ts +74 -0
  90. package/dist/render/behaviour-disclose.js +77 -0
  91. package/dist/render/behaviour-present.d.ts +123 -0
  92. package/dist/render/behaviour-present.js +173 -0
  93. package/dist/render/behaviour.d.ts +243 -0
  94. package/dist/render/behaviour.js +284 -0
  95. package/dist/render/control.d.ts +81 -0
  96. package/dist/render/control.js +80 -0
  97. package/dist/render/decorative.d.ts +62 -0
  98. package/dist/render/decorative.js +2 -0
  99. package/dist/render/diagnostics.d.ts +260 -0
  100. package/dist/render/diagnostics.js +61 -0
  101. package/dist/render/disclosed.d.ts +37 -0
  102. package/dist/render/disclosed.js +37 -0
  103. package/dist/render/editable.d.ts +34 -0
  104. package/dist/render/editable.js +35 -0
  105. package/dist/render/frame.d.ts +42 -0
  106. package/dist/render/frame.js +31 -0
  107. package/dist/render/index.d.ts +35 -0
  108. package/dist/render/index.js +35 -0
  109. package/dist/render/inline-variables.d.ts +77 -0
  110. package/dist/render/inline-variables.js +220 -0
  111. package/dist/render/presented.d.ts +82 -0
  112. package/dist/render/presented.js +82 -0
  113. package/dist/render/primitive.d.ts +228 -0
  114. package/dist/render/primitive.js +36 -0
  115. package/dist/render/props.d.ts +48 -0
  116. package/dist/render/props.js +2 -0
  117. package/dist/render/reads.d.ts +73 -0
  118. package/dist/render/reads.js +45 -0
  119. package/dist/render/render.d.ts +164 -0
  120. package/dist/render/render.js +571 -0
  121. package/dist/render/request.d.ts +111 -0
  122. package/dist/render/request.js +60 -0
  123. package/dist/render/text.d.ts +91 -0
  124. package/dist/render/text.js +44 -0
  125. package/dist/render/theme.d.ts +61 -0
  126. package/dist/render/theme.js +52 -0
  127. package/dist/reserved-props.d.ts +35 -0
  128. package/dist/reserved-props.js +45 -0
  129. package/dist/result.d.ts +27 -0
  130. package/dist/result.js +30 -0
  131. package/dist/role.d.ts +71 -0
  132. package/dist/role.js +22 -0
  133. package/dist/runtime/analysis.d.ts +149 -0
  134. package/dist/runtime/analysis.js +187 -0
  135. package/dist/runtime/assessment.d.ts +35 -0
  136. package/dist/runtime/assessment.js +13 -0
  137. package/dist/runtime/disposition.d.ts +102 -0
  138. package/dist/runtime/disposition.js +59 -0
  139. package/dist/runtime/events.d.ts +187 -0
  140. package/dist/runtime/events.js +7 -0
  141. package/dist/runtime/gate.d.ts +43 -0
  142. package/dist/runtime/gate.js +169 -0
  143. package/dist/runtime/index.d.ts +27 -0
  144. package/dist/runtime/index.js +27 -0
  145. package/dist/runtime/intent.d.ts +60 -0
  146. package/dist/runtime/intent.js +36 -0
  147. package/dist/runtime/interpreter.d.ts +117 -0
  148. package/dist/runtime/interpreter.js +46 -0
  149. package/dist/runtime/inverse-interpreter.d.ts +90 -0
  150. package/dist/runtime/inverse-interpreter.js +56 -0
  151. package/dist/runtime/inverse.d.ts +87 -0
  152. package/dist/runtime/inverse.js +48 -0
  153. package/dist/runtime/narration.d.ts +24 -0
  154. package/dist/runtime/narration.js +36 -0
  155. package/dist/runtime/nesting.d.ts +31 -0
  156. package/dist/runtime/nesting.js +46 -0
  157. package/dist/runtime/pipeline.d.ts +124 -0
  158. package/dist/runtime/pipeline.js +178 -0
  159. package/dist/runtime/policy-fingerprint.d.ts +29 -0
  160. package/dist/runtime/policy-fingerprint.js +119 -0
  161. package/dist/runtime/policy-source.d.ts +42 -0
  162. package/dist/runtime/policy-source.js +8 -0
  163. package/dist/runtime/policy.d.ts +156 -0
  164. package/dist/runtime/policy.js +107 -0
  165. package/dist/runtime/proposal.d.ts +423 -0
  166. package/dist/runtime/proposal.js +109 -0
  167. package/dist/runtime/redirection.d.ts +53 -0
  168. package/dist/runtime/redirection.js +38 -0
  169. package/dist/runtime/repointing.d.ts +71 -0
  170. package/dist/runtime/repointing.js +0 -0
  171. package/dist/runtime/reversibility.d.ts +36 -0
  172. package/dist/runtime/reversibility.js +39 -0
  173. package/dist/runtime/stake-level.d.ts +33 -0
  174. package/dist/runtime/stake-level.js +58 -0
  175. package/dist/runtime/stakes.d.ts +47 -0
  176. package/dist/runtime/stakes.js +305 -0
  177. package/dist/runtime/vocabulary.d.ts +122 -0
  178. package/dist/runtime/vocabulary.js +87 -0
  179. package/dist/sdk/audit.d.ts +195 -0
  180. package/dist/sdk/audit.js +128 -0
  181. package/dist/sdk/catalogue.d.ts +37 -0
  182. package/dist/sdk/catalogue.js +16 -0
  183. package/dist/sdk/conformance.d.ts +342 -0
  184. package/dist/sdk/conformance.js +494 -0
  185. package/dist/sdk/copy.d.ts +105 -0
  186. package/dist/sdk/copy.js +90 -0
  187. package/dist/sdk/definition.d.ts +242 -0
  188. package/dist/sdk/definition.js +64 -0
  189. package/dist/sdk/index.d.ts +19 -0
  190. package/dist/sdk/index.js +19 -0
  191. package/dist/sdk/interactivity.d.ts +29 -0
  192. package/dist/sdk/interactivity.js +34 -0
  193. package/dist/sdk/pairings.d.ts +124 -0
  194. package/dist/sdk/pairings.js +81 -0
  195. package/dist/sdk/registry.d.ts +162 -0
  196. package/dist/sdk/registry.js +329 -0
  197. package/dist/sdk/selection.d.ts +46 -0
  198. package/dist/sdk/selection.js +24 -0
  199. package/dist/sdk/text.d.ts +100 -0
  200. package/dist/sdk/text.js +105 -0
  201. package/dist/sdk/vocabulary.d.ts +39 -0
  202. package/dist/sdk/vocabulary.js +36 -0
  203. package/dist/signals/broadcast.d.ts +134 -0
  204. package/dist/signals/broadcast.js +451 -0
  205. package/dist/signals/collect.d.ts +184 -0
  206. package/dist/signals/collect.js +196 -0
  207. package/dist/signals/deliver.d.ts +64 -0
  208. package/dist/signals/deliver.js +85 -0
  209. package/dist/signals/fold.d.ts +112 -0
  210. package/dist/signals/fold.js +76 -0
  211. package/dist/signals/index.d.ts +31 -0
  212. package/dist/signals/index.js +31 -0
  213. package/dist/signals/ingest.d.ts +51 -0
  214. package/dist/signals/ingest.js +70 -0
  215. package/dist/signals/intake.d.ts +149 -0
  216. package/dist/signals/intake.js +154 -0
  217. package/dist/signals/journal.d.ts +94 -0
  218. package/dist/signals/journal.js +11 -0
  219. package/dist/signals/kinds.d.ts +22 -0
  220. package/dist/signals/kinds.js +22 -0
  221. package/dist/signals/ledger.d.ts +46 -0
  222. package/dist/signals/ledger.js +81 -0
  223. package/dist/signals/memory.d.ts +17 -0
  224. package/dist/signals/memory.js +99 -0
  225. package/dist/signals/migrate.d.ts +27 -0
  226. package/dist/signals/migrate.js +78 -0
  227. package/dist/signals/postgres.d.ts +7 -0
  228. package/dist/signals/postgres.js +295 -0
  229. package/dist/signals/rollup.d.ts +142 -0
  230. package/dist/signals/rollup.js +0 -0
  231. package/dist/signals/schema.d.ts +534 -0
  232. package/dist/signals/schema.js +92 -0
  233. package/dist/signals/signal.d.ts +381 -0
  234. package/dist/signals/signal.js +150 -0
  235. package/dist/signals/tally.d.ts +70 -0
  236. package/dist/signals/tally.js +2 -0
  237. package/dist/signals/view.d.ts +51 -0
  238. package/dist/signals/view.js +54 -0
  239. package/dist/store/attribution.d.ts +125 -0
  240. package/dist/store/attribution.js +116 -0
  241. package/dist/store/database.d.ts +14 -0
  242. package/dist/store/database.js +2 -0
  243. package/dist/store/driver.d.ts +29 -0
  244. package/dist/store/driver.js +39 -0
  245. package/dist/store/errors.d.ts +56 -0
  246. package/dist/store/errors.js +37 -0
  247. package/dist/store/index.d.ts +16 -0
  248. package/dist/store/index.js +16 -0
  249. package/dist/store/memory.d.ts +3 -0
  250. package/dist/store/memory.js +115 -0
  251. package/dist/store/migrate.d.ts +54 -0
  252. package/dist/store/migrate.js +122 -0
  253. package/dist/store/postgres-holds.d.ts +4 -0
  254. package/dist/store/postgres-holds.js +192 -0
  255. package/dist/store/postgres.d.ts +8 -0
  256. package/dist/store/postgres.js +262 -0
  257. package/dist/store/replay.d.ts +94 -0
  258. package/dist/store/replay.js +82 -0
  259. package/dist/store/revert.d.ts +116 -0
  260. package/dist/store/revert.js +243 -0
  261. package/dist/store/schema.d.ts +371 -0
  262. package/dist/store/schema.js +78 -0
  263. package/dist/store/source.d.ts +23 -0
  264. package/dist/store/source.js +37 -0
  265. package/dist/store/store.d.ts +231 -0
  266. package/dist/store/store.js +52 -0
  267. package/dist/store/undone.d.ts +18 -0
  268. package/dist/store/undone.js +89 -0
  269. package/dist/submit/catalogue.d.ts +20 -0
  270. package/dist/submit/catalogue.js +5 -0
  271. package/dist/submit/declaration.d.ts +39 -0
  272. package/dist/submit/declaration.js +30 -0
  273. package/dist/submit/endpoint.d.ts +131 -0
  274. package/dist/submit/endpoint.js +160 -0
  275. package/dist/submit/index.d.ts +13 -0
  276. package/dist/submit/index.js +13 -0
  277. package/dist/submit/plan.d.ts +49 -0
  278. package/dist/submit/plan.js +47 -0
  279. package/dist/submit/resolution.d.ts +61 -0
  280. package/dist/submit/resolution.js +64 -0
  281. package/dist/submit/resolve.d.ts +45 -0
  282. package/dist/submit/resolve.js +36 -0
  283. package/dist/telemetry/calibration.d.ts +132 -0
  284. package/dist/telemetry/calibration.js +151 -0
  285. package/dist/telemetry/episode.d.ts +140 -0
  286. package/dist/telemetry/episode.js +272 -0
  287. package/dist/telemetry/event.d.ts +2310 -0
  288. package/dist/telemetry/event.js +405 -0
  289. package/dist/telemetry/index.d.ts +15 -0
  290. package/dist/telemetry/index.js +15 -0
  291. package/dist/telemetry/journal.d.ts +116 -0
  292. package/dist/telemetry/journal.js +11 -0
  293. package/dist/telemetry/memory.d.ts +24 -0
  294. package/dist/telemetry/memory.js +75 -0
  295. package/dist/telemetry/migrate.d.ts +26 -0
  296. package/dist/telemetry/migrate.js +40 -0
  297. package/dist/telemetry/postgres.d.ts +6 -0
  298. package/dist/telemetry/postgres.js +139 -0
  299. package/dist/telemetry/retention.d.ts +131 -0
  300. package/dist/telemetry/retention.js +217 -0
  301. package/dist/telemetry/schema.d.ts +113 -0
  302. package/dist/telemetry/schema.js +33 -0
  303. package/dist/telemetry/sink.d.ts +42 -0
  304. package/dist/telemetry/sink.js +61 -0
  305. package/dist/testing/contracts.d.ts +34 -0
  306. package/dist/testing/contracts.js +34 -0
  307. package/dist/testing/definitions.d.ts +15 -0
  308. package/dist/testing/definitions.js +48 -0
  309. package/dist/testing/doubles.d.ts +94 -0
  310. package/dist/testing/doubles.js +141 -0
  311. package/dist/testing/episode-harness.d.ts +49 -0
  312. package/dist/testing/episode-harness.js +65 -0
  313. package/dist/testing/filesystem.d.ts +17 -0
  314. package/dist/testing/filesystem.js +17 -0
  315. package/dist/testing/fixtures.d.ts +57 -0
  316. package/dist/testing/fixtures.js +84 -0
  317. package/dist/testing/hold-contract.d.ts +19 -0
  318. package/dist/testing/hold-contract.js +374 -0
  319. package/dist/testing/index.d.ts +41 -0
  320. package/dist/testing/index.js +41 -0
  321. package/dist/testing/journal-contract.d.ts +17 -0
  322. package/dist/testing/journal-contract.js +353 -0
  323. package/dist/testing/model-replies.d.ts +34 -0
  324. package/dist/testing/model-replies.js +101 -0
  325. package/dist/testing/primitives.d.ts +7 -0
  326. package/dist/testing/primitives.js +29 -0
  327. package/dist/testing/reader-signal-contract.d.ts +38 -0
  328. package/dist/testing/reader-signal-contract.js +318 -0
  329. package/dist/testing/row-security.d.ts +17 -0
  330. package/dist/testing/row-security.js +21 -0
  331. package/dist/testing/store-contract.d.ts +25 -0
  332. package/dist/testing/store-contract.js +500 -0
  333. package/dist/theme/apply.d.ts +17 -0
  334. package/dist/theme/apply.js +60 -0
  335. package/dist/theme/contrast.d.ts +197 -0
  336. package/dist/theme/contrast.js +259 -0
  337. package/dist/theme/derive.d.ts +77 -0
  338. package/dist/theme/derive.js +167 -0
  339. package/dist/theme/faces.d.ts +73 -0
  340. package/dist/theme/faces.js +119 -0
  341. package/dist/theme/font-packs.d.ts +25 -0
  342. package/dist/theme/font-packs.js +257 -0
  343. package/dist/theme/index.d.ts +20 -0
  344. package/dist/theme/index.js +20 -0
  345. package/dist/theme/lab.d.ts +30 -0
  346. package/dist/theme/lab.js +46 -0
  347. package/dist/theme/library.d.ts +114 -0
  348. package/dist/theme/library.js +300 -0
  349. package/dist/theme/measure.d.ts +144 -0
  350. package/dist/theme/measure.js +145 -0
  351. package/dist/theme/palettes.d.ts +64 -0
  352. package/dist/theme/palettes.js +497 -0
  353. package/dist/theme/registry.d.ts +59 -0
  354. package/dist/theme/registry.js +60 -0
  355. package/dist/theme/separation.d.ts +177 -0
  356. package/dist/theme/separation.js +203 -0
  357. package/dist/theme/style-presets.d.ts +60 -0
  358. package/dist/theme/style-presets.js +124 -0
  359. package/dist/theme/theme.d.ts +253 -0
  360. package/dist/theme/theme.js +171 -0
  361. package/dist/tree/apply.d.ts +16 -0
  362. package/dist/tree/apply.js +104 -0
  363. package/dist/tree/builders.d.ts +19 -0
  364. package/dist/tree/builders.js +20 -0
  365. package/dist/tree/compare.d.ts +68 -0
  366. package/dist/tree/compare.js +75 -0
  367. package/dist/tree/configuration.d.ts +25 -0
  368. package/dist/tree/configuration.js +108 -0
  369. package/dist/tree/delta.d.ts +288 -0
  370. package/dist/tree/delta.js +88 -0
  371. package/dist/tree/errors.d.ts +69 -0
  372. package/dist/tree/errors.js +34 -0
  373. package/dist/tree/identity.d.ts +117 -0
  374. package/dist/tree/identity.js +145 -0
  375. package/dist/tree/index.d.ts +21 -0
  376. package/dist/tree/index.js +21 -0
  377. package/dist/tree/inverse.d.ts +24 -0
  378. package/dist/tree/inverse.js +112 -0
  379. package/dist/tree/mutation.d.ts +18 -0
  380. package/dist/tree/mutation.js +49 -0
  381. package/dist/tree/naming.d.ts +4 -0
  382. package/dist/tree/naming.js +35 -0
  383. package/dist/tree/navigation.d.ts +38 -0
  384. package/dist/tree/navigation.js +83 -0
  385. package/dist/tree/node.d.ts +103 -0
  386. package/dist/tree/node.js +46 -0
  387. package/dist/tree/outline.d.ts +28 -0
  388. package/dist/tree/outline.js +10 -0
  389. package/dist/tree/tree.d.ts +83 -0
  390. package/dist/tree/tree.js +62 -0
  391. package/dist/write/commit.d.ts +124 -0
  392. package/dist/write/commit.js +234 -0
  393. package/dist/write/held.d.ts +674 -0
  394. package/dist/write/held.js +185 -0
  395. package/dist/write/index.d.ts +11 -0
  396. package/dist/write/index.js +11 -0
  397. package/dist/write/liveness.d.ts +132 -0
  398. package/dist/write/liveness.js +91 -0
  399. package/dist/write/revert.d.ts +79 -0
  400. package/dist/write/revert.js +134 -0
  401. package/package.json +160 -0
@@ -0,0 +1,20 @@
1
+ /**
2
+ * What a page looks like, as something a tree can name.
3
+ *
4
+ * A palette, a font pack and a style preset, registered by a deployment and
5
+ * selected by id on the root node, resolved into the variables a stylesheet reads.
6
+ */
7
+ export * from "./apply.js";
8
+ export * from "./contrast.js";
9
+ export * from "./derive.js";
10
+ export * from "./faces.js";
11
+ export * from "./font-packs.js";
12
+ export * from "./lab.js";
13
+ export * from "./library.js";
14
+ export * from "./measure.js";
15
+ export * from "./palettes.js";
16
+ export * from "./separation.js";
17
+ export * from "./style-presets.js";
18
+ export * from "./registry.js";
19
+ export * from "./theme.js";
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,30 @@
1
+ /**
2
+ * A colour in CIELAB, which is where every perceptual question about a palette
3
+ * gets answered.
4
+ *
5
+ * Two modules ask one: `separation.ts` asks *how far apart are these two*, and
6
+ * `measure.ts` asks *how much colour is in this one*. Both are distances in the
7
+ * same space, so the conversion lives here rather than twice — the rule
8
+ * `channelsOf` already set, where two parsers would have been two answers to
9
+ * whether a colour can be measured at all.
10
+ *
11
+ * Nothing here decides anything. It converts, and declines the forms
12
+ * `channelsOf` declines.
13
+ */
14
+ /**
15
+ * sRGB channel, linearised.
16
+ *
17
+ * The knee is 0.04045, the sRGB specification's own value, where `contrast.ts`
18
+ * uses WCAG's 0.03928 for the same curve. The two differ in the fourth decimal
19
+ * of a rounding and each module keeps the constant its own standard publishes,
20
+ * rather than one of them citing a standard it is not following.
21
+ */
22
+ export declare const linearise: (value: number) => number;
23
+ /** Lightness, green–red, blue–yellow. */
24
+ export type Lab = readonly [number, number, number];
25
+ /**
26
+ * L*a*b* under D65, the white point sRGB is defined against, or `undefined`
27
+ * when the colour is a form `channelsOf` declines to guess at.
28
+ */
29
+ export declare const labOf: (colour: string) => Lab | undefined;
30
+ //# sourceMappingURL=lab.d.ts.map
@@ -0,0 +1,46 @@
1
+ import { channelsOf } from "./contrast.js";
2
+ /**
3
+ * A colour in CIELAB, which is where every perceptual question about a palette
4
+ * gets answered.
5
+ *
6
+ * Two modules ask one: `separation.ts` asks *how far apart are these two*, and
7
+ * `measure.ts` asks *how much colour is in this one*. Both are distances in the
8
+ * same space, so the conversion lives here rather than twice — the rule
9
+ * `channelsOf` already set, where two parsers would have been two answers to
10
+ * whether a colour can be measured at all.
11
+ *
12
+ * Nothing here decides anything. It converts, and declines the forms
13
+ * `channelsOf` declines.
14
+ */
15
+ /**
16
+ * sRGB channel, linearised.
17
+ *
18
+ * The knee is 0.04045, the sRGB specification's own value, where `contrast.ts`
19
+ * uses WCAG's 0.03928 for the same curve. The two differ in the fourth decimal
20
+ * of a rounding and each module keeps the constant its own standard publishes,
21
+ * rather than one of them citing a standard it is not following.
22
+ */
23
+ export const linearise = (value) => {
24
+ const c = value / 255;
25
+ return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
26
+ };
27
+ /** CIE's cube-root transfer, with the linear segment near black. */
28
+ const transfer = (t) => (t > 216 / 24389 ? Math.cbrt(t) : (841 / 108) * t + 4 / 29);
29
+ /**
30
+ * L*a*b* under D65, the white point sRGB is defined against, or `undefined`
31
+ * when the colour is a form `channelsOf` declines to guess at.
32
+ */
33
+ export const labOf = (colour) => {
34
+ const channels = channelsOf(colour);
35
+ if (!channels)
36
+ return undefined;
37
+ const [red, green, blue] = channels;
38
+ const r = linearise(red);
39
+ const g = linearise(green);
40
+ const b = linearise(blue);
41
+ const x = transfer((0.4124 * r + 0.3576 * g + 0.1805 * b) / 0.95047);
42
+ const y = transfer(0.2126 * r + 0.7152 * g + 0.0722 * b);
43
+ const z = transfer((0.0193 * r + 0.1192 * g + 0.9505 * b) / 1.08883);
44
+ return [116 * y - 16, 500 * (x - y), 200 * (y - z)];
45
+ };
46
+ //# sourceMappingURL=lab.js.map
@@ -0,0 +1,114 @@
1
+ import { type FontPack, type Palette, type StylePreset } from "./theme.js";
2
+ /**
3
+ * The starter vocabulary, ported from the Hermes registry.
4
+ *
5
+ * Two palettes rather than one, deliberately: a single palette cannot show
6
+ * whether a primitive reads its colours from the slots or hard-codes them, and
7
+ * the port of the remaining twenty-seven is only safe once something proves a
8
+ * primitive survives being re-themed.
9
+ *
10
+ * A third arrived on 19 August, and it is the first not ported from Hermes:
11
+ * `minimal` / `minimal-sans` / `precise` is a house theme the maintainer
12
+ * specified, and it is registered here rather than in a surface because all four
13
+ * surfaces build their registry with `createThemeRegistry()` and no arguments.
14
+ * One entry in this list is what makes it reachable from every one of them.
15
+ */
16
+ export declare const editorialPalette: Palette;
17
+ export declare const boldPalette: Palette;
18
+ /**
19
+ * Families are declared with their own fallback stacks and no loader. Loom does
20
+ * not fetch fonts: a host that wants a webfont links it, and a primitive renders
21
+ * correctly in the fallback until it arrives. Hermes emitted a Google Fonts URL
22
+ * here, which put a network dependency inside a pure function.
23
+ */
24
+ export declare const editorialSerifFontPack: FontPack;
25
+ export declare const boldSansFontPack: FontPack;
26
+ export declare const comfortableStylePreset: StylePreset;
27
+ export declare const airyModernStylePreset: StylePreset;
28
+ /**
29
+ * The third palette, and the first one specified by the maintainer rather than
30
+ * ported: white paper, black ink, and one green.
31
+ *
32
+ * The green is **Hyperion's**, taken from the one colour that codebase holds
33
+ * constant. Every other token in Hyperion changes with its six themes; the
34
+ * positive-action button does not:
35
+ *
36
+ * ```css
37
+ * --btn-positive-bg: #72e3ad;
38
+ * --btn-positive-text: #0d3d26;
39
+ * ```
40
+ *
41
+ * Those two are the same hue at two lightnesses — H 151.2° and 151.3°, S 65%
42
+ * and 67%, L 14.5% and 67% — so they are not two greens, they are two stops of
43
+ * one ramp. The stops between them here are computed on that hue and
44
+ * saturation, which is why this palette can fill every slot without inventing a
45
+ * second green.
46
+ *
47
+ * **Where each stop lands is decided by how the library reads the slot, not by
48
+ * how the colour looks in isolation**, and getting that backwards is the whole
49
+ * trap. `accent` is read as *text* far more often than as a fill — a section's
50
+ * eyebrow, an article's kicker, a disclosure marker, the current page in a nav —
51
+ * and the mint at 1.58:1 on white is unreadable at every one of them. So the
52
+ * mint cannot be `accent`, however much it is the colour someone pictures. It
53
+ * goes to `border-accent`, where a hairline, a pill's ring, a quote's rule and a
54
+ * featured tier's border are exactly the "subtle highlight" the brief asks for
55
+ * and where 1.58:1 is a soft mark rather than a failure.
56
+ *
57
+ * **`accent` is black, and that is the maintainer's call after seeing it green.**
58
+ * The first cut gave it the deep stop, `#0d3d26`, on the reasoning that a
59
+ * near-black button with a green cast was the restrained reading. Rendered, it
60
+ * was neither: too dark to read as green and too green to read as black — the
61
+ * review called it "dark hunter green black", which is exactly what it looked
62
+ * like. The brief names three colours, whites, black *and* green, and a black
63
+ * button is the one that leaves the green to be a highlight rather than the
64
+ * largest element on the page.
65
+ *
66
+ * So the green now lives entirely in the places a highlight belongs:
67
+ * `border-accent` for hairlines and rings, `accent-subtle` for a tinted tile,
68
+ * and `accent-strong` — a mid stop rather than the darkest — for the glyph or
69
+ * label sitting on that tile, where being *visibly* green matters more than
70
+ * maximising contrast it already has in hand at 5.91:1.
71
+ */
72
+ export declare const minimalPalette: Palette;
73
+ /**
74
+ * One grotesque at two weights, which is the typographic half of minimalism.
75
+ *
76
+ * `editorial-serif` pairs two families and `bold-sans` pairs two more, because
77
+ * contrast between headline and body is how most pages establish hierarchy.
78
+ * This one refuses that: heading and body are the same family, and the only
79
+ * difference is weight and size. It is what the reference the maintainer gave —
80
+ * `nextjs.org` — does, and it is why that page reads as a single object rather
81
+ * than as a document with a masthead.
82
+ *
83
+ * **Geist is named first and is not loaded here.** Loom does not fetch fonts
84
+ * (see the note above `editorialSerifFontPack`), so this renders in the system
85
+ * grotesque until a surface links Geist itself, and the stack is ordered so that
86
+ * the fallback is a near-neighbour rather than a lurch — `ui-sans-serif` and the
87
+ * platform faces are all neo-grotesques of the same temperature. A page that
88
+ * never loads Geist still looks like this palette's page.
89
+ */
90
+ export declare const minimalSansFontPack: FontPack;
91
+ /**
92
+ * Small radii, wide gutters, quick motion.
93
+ *
94
+ * The other two presets vary radius and spacing together on the assumption that
95
+ * a softer page is also a looser one. Minimalism separates them: corners get
96
+ * *tighter* than either existing preset while spacing gets **wider** than both.
97
+ * Space is what does the work when there is no ornament, and a 24px radius is
98
+ * ornament.
99
+ *
100
+ * `full` stays 9999 and is not a style choice — `loom.person`'s avatar and
101
+ * `loom.milestone`'s rail dot are circles, and a preset that set it to a real
102
+ * length would turn them into squircles in every theme that used it.
103
+ */
104
+ export declare const preciseStylePreset: StylePreset;
105
+ /**
106
+ * The three palettes this file authors by hand, then the eighteen derived ones
107
+ * (`palettes.ts`). The three come first because they are the ones the four
108
+ * surfaces wear and the ones the re-theme tests are written against; the rest
109
+ * are range.
110
+ */
111
+ export declare const STARTER_PALETTES: readonly Palette[];
112
+ export declare const STARTER_FONT_PACKS: readonly FontPack[];
113
+ export declare const STARTER_STYLE_PRESETS: readonly StylePreset[];
114
+ //# sourceMappingURL=library.d.ts.map
@@ -0,0 +1,300 @@
1
+ import { ADDITIONAL_FONT_PACKS } from "./font-packs.js";
2
+ import { DERIVED_PALETTES } from "./palettes.js";
3
+ import { ADDITIONAL_STYLE_PRESETS } from "./style-presets.js";
4
+ import { fontPackSchema, paletteSchema, stylePresetSchema, } from "./theme.js";
5
+ /**
6
+ * The starter vocabulary, ported from the Hermes registry.
7
+ *
8
+ * Two palettes rather than one, deliberately: a single palette cannot show
9
+ * whether a primitive reads its colours from the slots or hard-codes them, and
10
+ * the port of the remaining twenty-seven is only safe once something proves a
11
+ * primitive survives being re-themed.
12
+ *
13
+ * A third arrived on 19 August, and it is the first not ported from Hermes:
14
+ * `minimal` / `minimal-sans` / `precise` is a house theme the maintainer
15
+ * specified, and it is registered here rather than in a surface because all four
16
+ * surfaces build their registry with `createThemeRegistry()` and no arguments.
17
+ * One entry in this list is what makes it reachable from every one of them.
18
+ */
19
+ export const editorialPalette = paletteSchema.parse({
20
+ id: "editorial",
21
+ name: "Editorial",
22
+ description: "Restrained, high-contrast magazine palette with a single muted accent.",
23
+ slots: {
24
+ "bg-canvas": "#fafaf7",
25
+ "bg-surface": "#ffffff",
26
+ "bg-surface-muted": "#f0eee9",
27
+ "bg-overlay": "#ffffff",
28
+ "fg-default": "#0a0a0a",
29
+ "fg-muted": "#525252",
30
+ /** Third step of the ink ramp, and it still has to be readable (0074). */
31
+ "fg-subtle": "#6a6a6a",
32
+ "fg-on-accent": "#ffffff",
33
+ accent: "#4a5b78",
34
+ "accent-strong": "#34425a",
35
+ "accent-subtle": "#e6ebf2",
36
+ "brand-secondary": "#4a5b78",
37
+ "brand-secondary-strong": "#34425a",
38
+ "border-default": "#e5e5e5",
39
+ "border-strong": "#0a0a0a",
40
+ "border-subtle": "#efefe9",
41
+ "border-accent": "#4a5b78",
42
+ },
43
+ });
44
+ export const boldPalette = paletteSchema.parse({
45
+ id: "bold",
46
+ name: "Bold",
47
+ description: "Black canvas with bright yellow and red accents. High-energy, graphic.",
48
+ slots: {
49
+ "bg-canvas": "#0a0a0a",
50
+ "bg-surface": "#1a1a1a",
51
+ "bg-surface-muted": "#0f0f0f",
52
+ "bg-overlay": "#1a1a1a",
53
+ "fg-default": "#f5f5f5",
54
+ "fg-muted": "#a3a3a3",
55
+ /** Third step of the ink ramp, and it still has to be readable (0074). */
56
+ "fg-subtle": "#8a8a8a",
57
+ "fg-on-accent": "#0a0a0a",
58
+ accent: "#ffd400",
59
+ "accent-strong": "#e0b800",
60
+ "accent-subtle": "#3a3000",
61
+ "brand-secondary": "#ff3344",
62
+ "brand-secondary-strong": "#d81f2f",
63
+ "border-default": "#2a2a2a",
64
+ "border-strong": "#f5f5f5",
65
+ "border-subtle": "#1f1f1f",
66
+ "border-accent": "#ffd400",
67
+ },
68
+ });
69
+ /**
70
+ * Families are declared with their own fallback stacks and no loader. Loom does
71
+ * not fetch fonts: a host that wants a webfont links it, and a primitive renders
72
+ * correctly in the fallback until it arrives. Hermes emitted a Google Fonts URL
73
+ * here, which put a network dependency inside a pure function.
74
+ */
75
+ export const editorialSerifFontPack = fontPackSchema.parse({
76
+ id: "editorial-serif",
77
+ name: "Editorial Serif",
78
+ description: "Serif headlines over a humanist sans body. Reads as considered rather than loud.",
79
+ headingFamily: 'Georgia, "Iowan Old Style", "Times New Roman", serif',
80
+ bodyFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
81
+ headingWeight: 600,
82
+ bodyWeight: 400,
83
+ scaleRamp: [12, 14, 16, 18, 24, 32, 48, 72],
84
+ });
85
+ export const boldSansFontPack = fontPackSchema.parse({
86
+ id: "bold-sans",
87
+ name: "Bold Sans",
88
+ description: "Compressed display headlines over a clean body. Leans on weight rather than ornament.",
89
+ headingFamily: 'Impact, "Haettenschweiler", "Arial Narrow Bold", sans-serif',
90
+ bodyFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
91
+ headingWeight: 400,
92
+ bodyWeight: 400,
93
+ scaleRamp: [12, 14, 16, 18, 24, 32, 56, 88],
94
+ });
95
+ export const comfortableStylePreset = stylePresetSchema.parse({
96
+ id: "comfortable",
97
+ name: "Comfortable",
98
+ description: "Moderate radii and generous spacing. The safe default for reading-led pages.",
99
+ radii: { sm: 6, md: 12, lg: 24, full: 9999 },
100
+ spacingScale: [4, 8, 12, 20, 32, 48, 64, 96],
101
+ motion: { fast: 150, medium: 250, slow: 400 },
102
+ density: "comfortable",
103
+ });
104
+ export const airyModernStylePreset = stylePresetSchema.parse({
105
+ id: "airy-modern",
106
+ name: "Airy Modern",
107
+ description: "Larger radii and looser spacing. Pairs with vibrant palettes.",
108
+ radii: { sm: 8, md: 16, lg: 32, full: 9999 },
109
+ spacingScale: [4, 8, 14, 22, 32, 48, 72, 96],
110
+ motion: { fast: 180, medium: 280, slow: 450 },
111
+ density: "comfortable",
112
+ });
113
+ /**
114
+ * The third palette, and the first one specified by the maintainer rather than
115
+ * ported: white paper, black ink, and one green.
116
+ *
117
+ * The green is **Hyperion's**, taken from the one colour that codebase holds
118
+ * constant. Every other token in Hyperion changes with its six themes; the
119
+ * positive-action button does not:
120
+ *
121
+ * ```css
122
+ * --btn-positive-bg: #72e3ad;
123
+ * --btn-positive-text: #0d3d26;
124
+ * ```
125
+ *
126
+ * Those two are the same hue at two lightnesses — H 151.2° and 151.3°, S 65%
127
+ * and 67%, L 14.5% and 67% — so they are not two greens, they are two stops of
128
+ * one ramp. The stops between them here are computed on that hue and
129
+ * saturation, which is why this palette can fill every slot without inventing a
130
+ * second green.
131
+ *
132
+ * **Where each stop lands is decided by how the library reads the slot, not by
133
+ * how the colour looks in isolation**, and getting that backwards is the whole
134
+ * trap. `accent` is read as *text* far more often than as a fill — a section's
135
+ * eyebrow, an article's kicker, a disclosure marker, the current page in a nav —
136
+ * and the mint at 1.58:1 on white is unreadable at every one of them. So the
137
+ * mint cannot be `accent`, however much it is the colour someone pictures. It
138
+ * goes to `border-accent`, where a hairline, a pill's ring, a quote's rule and a
139
+ * featured tier's border are exactly the "subtle highlight" the brief asks for
140
+ * and where 1.58:1 is a soft mark rather than a failure.
141
+ *
142
+ * **`accent` is black, and that is the maintainer's call after seeing it green.**
143
+ * The first cut gave it the deep stop, `#0d3d26`, on the reasoning that a
144
+ * near-black button with a green cast was the restrained reading. Rendered, it
145
+ * was neither: too dark to read as green and too green to read as black — the
146
+ * review called it "dark hunter green black", which is exactly what it looked
147
+ * like. The brief names three colours, whites, black *and* green, and a black
148
+ * button is the one that leaves the green to be a highlight rather than the
149
+ * largest element on the page.
150
+ *
151
+ * So the green now lives entirely in the places a highlight belongs:
152
+ * `border-accent` for hairlines and rings, `accent-subtle` for a tinted tile,
153
+ * and `accent-strong` — a mid stop rather than the darkest — for the glyph or
154
+ * label sitting on that tile, where being *visibly* green matters more than
155
+ * maximising contrast it already has in hand at 5.91:1.
156
+ */
157
+ export const minimalPalette = paletteSchema.parse({
158
+ id: "minimal",
159
+ name: "Minimal",
160
+ description: "White paper, black ink, one green. Components are outlined rather than filled; the green appears only as rules, rings and tinted marks.",
161
+ slots: {
162
+ /**
163
+ * **`bg-surface` is the canvas white, and that is the whole outline-first
164
+ * decision.** It is the fill behind a card, a nav, a footer, a hero panel
165
+ * and a `tone: "surface"` section — so setting it to the page colour means
166
+ * every one of those is defined by its border instead of by a change of
167
+ * background, without a single primitive being touched. The instruction was
168
+ * to prefer outlined components and use fills sparingly; this is the one
169
+ * slot that turns the entire library over.
170
+ *
171
+ * It also means `border-subtle` is now load-bearing rather than decorative,
172
+ * which is why it is a step darker here than the palettes that back their
173
+ * borders with a fill.
174
+ */
175
+ "bg-canvas": "#ffffff",
176
+ "bg-surface": "#ffffff",
177
+ /**
178
+ * The one fill left, and it stays a real one because it is *functional*
179
+ * rather than structural: the well behind an image that has not loaded, a
180
+ * person's monogram, a neutral badge. Nine primitives read it, and a
181
+ * placeholder the same colour as the page is a placeholder nobody can see.
182
+ */
183
+ "bg-surface-muted": "#f4f4f5",
184
+ "bg-overlay": "#ffffff",
185
+ /** Never pure black. #000 on #fff is a glare a printed page never produces. */
186
+ "fg-default": "#0a0a0a",
187
+ "fg-muted": "#52525b",
188
+ /** Third step of the ink ramp, keeping this palette's cool cast (0074). */
189
+ "fg-subtle": "#6e6e78",
190
+ "fg-on-accent": "#ffffff",
191
+ /** Black, so the green is a highlight and not the biggest thing on the page. */
192
+ accent: "#0a0a0a",
193
+ /** A mid stop on Hyperion's ramp: the glyph on a tinted tile, visibly green at 5.91:1. */
194
+ "accent-strong": "#176e44",
195
+ "accent-subtle": "#effbf5",
196
+ "brand-secondary": "#72e3ad",
197
+ "brand-secondary-strong": "#1f985e",
198
+ /** Carrying structure now, so a step darker than a fill-backed palette needs. */
199
+ "border-default": "#d4d4d9",
200
+ "border-strong": "#0a0a0a",
201
+ "border-subtle": "#e6e6ea",
202
+ /** Hyperion's `--btn-positive-bg`, exactly. The green you actually see. */
203
+ "border-accent": "#72e3ad",
204
+ },
205
+ });
206
+ /**
207
+ * One grotesque at two weights, which is the typographic half of minimalism.
208
+ *
209
+ * `editorial-serif` pairs two families and `bold-sans` pairs two more, because
210
+ * contrast between headline and body is how most pages establish hierarchy.
211
+ * This one refuses that: heading and body are the same family, and the only
212
+ * difference is weight and size. It is what the reference the maintainer gave —
213
+ * `nextjs.org` — does, and it is why that page reads as a single object rather
214
+ * than as a document with a masthead.
215
+ *
216
+ * **Geist is named first and is not loaded here.** Loom does not fetch fonts
217
+ * (see the note above `editorialSerifFontPack`), so this renders in the system
218
+ * grotesque until a surface links Geist itself, and the stack is ordered so that
219
+ * the fallback is a near-neighbour rather than a lurch — `ui-sans-serif` and the
220
+ * platform faces are all neo-grotesques of the same temperature. A page that
221
+ * never loads Geist still looks like this palette's page.
222
+ */
223
+ export const minimalSansFontPack = fontPackSchema.parse({
224
+ id: "minimal-sans",
225
+ name: "Minimal Sans",
226
+ description: "One neo-grotesque for headings and body, separated by weight alone. Prefers Geist; falls back to the system grotesque.",
227
+ headingFamily: 'Geist, "Geist Sans", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
228
+ bodyFamily: 'Geist, "Geist Sans", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
229
+ /**
230
+ * The one face in this pack a surface already serves and the library could
231
+ * not previously ask for. `(docs)` links Geist Mono for its own chrome, so a
232
+ * `loom.code` panel on that site rendered in the system stack beside prose
233
+ * set in Geist and a `<pre>` set in Geist Mono — three faces where the pack
234
+ * describes one pairing. Ordered like the other two: the served face first,
235
+ * a real stack behind it (0085).
236
+ */
237
+ monoFamily: '"Geist Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace',
238
+ headingWeight: 700,
239
+ bodyWeight: 400,
240
+ /**
241
+ * A gentle middle and a decisive top. Steps 1–5 are the reading sizes and move
242
+ * in small increments; 6–8 are display sizes and jump, because a headline that
243
+ * is merely larger than its body copy reads as emphasis rather than as a
244
+ * headline.
245
+ *
246
+ * Step 8 is 72 and not more. `loom.heading` maps level 1 to the top step and
247
+ * `loom.hero` holds its text to a 44rem measure, so an ambitious top step does
248
+ * not produce a bigger headline — it produces the same headline on four lines.
249
+ * Tuned against a render rather than against the numbers.
250
+ */
251
+ scaleRamp: [12, 14, 16, 20, 26, 32, 44, 72],
252
+ });
253
+ /**
254
+ * Small radii, wide gutters, quick motion.
255
+ *
256
+ * The other two presets vary radius and spacing together on the assumption that
257
+ * a softer page is also a looser one. Minimalism separates them: corners get
258
+ * *tighter* than either existing preset while spacing gets **wider** than both.
259
+ * Space is what does the work when there is no ornament, and a 24px radius is
260
+ * ornament.
261
+ *
262
+ * `full` stays 9999 and is not a style choice — `loom.person`'s avatar and
263
+ * `loom.milestone`'s rail dot are circles, and a preset that set it to a real
264
+ * length would turn them into squircles in every theme that used it.
265
+ */
266
+ export const preciseStylePreset = stylePresetSchema.parse({
267
+ id: "precise",
268
+ name: "Precise",
269
+ description: "Tight radii and wide gutters. Space does the work where ornament is not wanted.",
270
+ radii: { sm: 4, md: 8, lg: 12, full: 9999 },
271
+ spacingScale: [4, 8, 12, 20, 32, 48, 72, 112],
272
+ /** Faster than either other preset. Restraint applies to duration as well. */
273
+ motion: { fast: 120, medium: 200, slow: 320 },
274
+ density: "comfortable",
275
+ });
276
+ /**
277
+ * The three palettes this file authors by hand, then the eighteen derived ones
278
+ * (`palettes.ts`). The three come first because they are the ones the four
279
+ * surfaces wear and the ones the re-theme tests are written against; the rest
280
+ * are range.
281
+ */
282
+ export const STARTER_PALETTES = [
283
+ minimalPalette,
284
+ editorialPalette,
285
+ boldPalette,
286
+ ...DERIVED_PALETTES,
287
+ ];
288
+ export const STARTER_FONT_PACKS = [
289
+ minimalSansFontPack,
290
+ editorialSerifFontPack,
291
+ boldSansFontPack,
292
+ ...ADDITIONAL_FONT_PACKS,
293
+ ];
294
+ export const STARTER_STYLE_PRESETS = [
295
+ preciseStylePreset,
296
+ comfortableStylePreset,
297
+ airyModernStylePreset,
298
+ ...ADDITIONAL_STYLE_PRESETS,
299
+ ];
300
+ //# sourceMappingURL=library.js.map
@@ -0,0 +1,144 @@
1
+ import type { Palette, PaletteSlot, ThemeId } from "./theme.js";
2
+ /**
3
+ * What a palette *is*, as numbers a stylesheet can use.
4
+ *
5
+ * A palette hands a primitive seventeen strings. `var(--loom-accent-strong)` is
6
+ * a colour to a reader and an opaque token to everything else: CSS cannot ask
7
+ * how much colour is in it, and a primitive that spreads it over half a band has
8
+ * no way to find out before it does.
9
+ *
10
+ * Two things the library builds needed exactly that and could not have it, both
11
+ * filed on 11 September by the lane that builds the primitives:
12
+ *
13
+ * - **A paint assumes there is chroma to spend.** The same aurora that is
14
+ * luminous behind `bold`'s gold and red is a grey blob behind `editorial`'s
15
+ * two slates, because a low-chroma tint spread over a light canvas is
16
+ * indistinguishable from dirt. One opacity was serving both, and no primitive
17
+ * could know which palette it was in.
18
+ * - **A dark wash is not expressible.** `bg-overlay` is a *surface* — white
19
+ * under most of the starter palettes — so reading it as a scrim gives white
20
+ * text on a white veil. A hard-coded black would render one page correctly and
21
+ * break re-theming for every other palette (0049).
22
+ *
23
+ * Both are answered here, and answered the same way: **measured from the
24
+ * palette, never declared on it.** A declared field would have to be added to
25
+ * `paletteSchema`, which every palette must satisfy in full — so every host
26
+ * palette in existence would stop validating, and a host that did fill it in
27
+ * could fill it in wrongly. Nothing checks a claim about how much colour a
28
+ * colour has. Measuring it cannot be wrong and costs a host nothing (0131).
29
+ *
30
+ * It reports; it does not decide — the bargain `auditPalette` and
31
+ * `auditSeparation` both make, for the same reason (0076). How strong a wash to
32
+ * draw with these numbers is the primitive's call, and which pair to hand a
33
+ * reader is the palette's.
34
+ */
35
+ /**
36
+ * The greatest chroma sRGB can reach: pure blue, `#0000ff`, at C* 133.82.
37
+ *
38
+ * Chroma is reported as a fraction of it, so `1` means *as saturated as a screen
39
+ * goes* and the scale does not depend on which palettes happen to be registered.
40
+ * A normalisation against the library's own maximum would be a number that moved
41
+ * whenever somebody added a palette.
42
+ */
43
+ export declare const MAX_SRGB_CHROMA = 133.82;
44
+ /**
45
+ * The slots a palette puts its colour in, and the only ones whose chroma tells
46
+ * anybody anything.
47
+ *
48
+ * The neutral tiers are near-grey **on purpose** — `derivePalette` builds every
49
+ * background, ink and rule from the canvas hue at a saturation it caps in the
50
+ * teens, so measuring them would report the tint of the paper rather than what a
51
+ * paint has to work with. The accent tier and the brand tier are where a palette
52
+ * spends its chroma, and they are what a band spreads behind content.
53
+ *
54
+ * Declared rather than derived, for the reason `PALETTE_TEXT_GROUNDS` is: which
55
+ * slots mean *colour* rather than *paper* is what the vocabulary means, not
56
+ * something a probe can read off a component.
57
+ */
58
+ export declare const PALETTE_CHROMA_SLOTS: readonly PaletteSlot[];
59
+ /**
60
+ * Relative luminance at or under which a wash genuinely darkens what is beneath
61
+ * it.
62
+ *
63
+ * Derived rather than chosen. A wash drawn at full strength brings what is under
64
+ * it to its own luminance `L`; for the ink it carries to clear the body-text bar
65
+ * against that, the ink needs a luminance of at least `4.5 × (L + 0.05) − 0.05`,
66
+ * which at `L = 0.15` is 0.85 — a near-white and nothing else. Above this a
67
+ * "dark" scrim is dark in name only, so the pair is reported as one that does not
68
+ * darken rather than silently offered as one that does.
69
+ *
70
+ * Every starter palette's scrim sits under 0.015, two orders of magnitude
71
+ * inside it; the ceiling exists for host palettes, where it is a real question.
72
+ */
73
+ export declare const SCRIM_DARK_CEILING = 0.15;
74
+ /**
75
+ * A ground that darkens what is under it, and the ink that is guaranteed to read
76
+ * on it.
77
+ *
78
+ * A pair rather than a colour, because the guarantee is the point: the two are
79
+ * the palette's **own body-copy pair, whichever way round is darker**. Under a
80
+ * light palette that is the ink used as the ground and the page used as the ink;
81
+ * under a dark one it is the page used as the ground and the ink left where it
82
+ * is. Either way both ends come from the palette, so a scrim re-themes like
83
+ * everything else, and its contrast is one the palette already owes a reader —
84
+ * `fg-default` on `bg-canvas` is a painted pairing the contrast bar asserts
85
+ * (0074), so a scrim cannot be legible in one palette and not in another.
86
+ *
87
+ * Inverting is what makes it free. The alternative — deriving a new dark colour
88
+ * from the palette's hue — invents a colour nobody approved, and then owes the
89
+ * reader a foreground that has never been measured against it.
90
+ */
91
+ export type Scrim = {
92
+ readonly ground: PaletteSlot;
93
+ readonly foreground: PaletteSlot;
94
+ /** Of the ground. How much this wash can actually darken. */
95
+ readonly luminance: number;
96
+ /** Of the pair, which is the palette's own body-copy ratio. */
97
+ readonly ratio: number;
98
+ /** Whether the ground is under `SCRIM_DARK_CEILING`. */
99
+ readonly darkens: boolean;
100
+ };
101
+ /**
102
+ * How much colour is in one slot, as a fraction of the most sRGB can hold, or
103
+ * `undefined` when the colour is a form `channelsOf` declines to guess at.
104
+ *
105
+ * CIELAB chroma rather than HSL saturation: a palette is judged by eye, and
106
+ * `hsl()`'s saturation says a pale mint and a deep forest hold the same amount
107
+ * of colour when a reader can see that one of them is grey. This is the space
108
+ * `separation.ts` already measures difference in, for the same reason.
109
+ */
110
+ export declare const slotChroma: (colour: string) => number | undefined;
111
+ /**
112
+ * The palette's scrim pair, or `undefined` when either end is a colour this
113
+ * cannot measure — `undefined` rather than a guess, so a host whose palette is
114
+ * written in `hsl()` is told the wash is unavailable instead of being handed a
115
+ * pair that might be the wrong way round.
116
+ */
117
+ export declare const paletteScrim: (palette: Palette) => Scrim | undefined;
118
+ /** Everything measurable about one palette that its slots do not say. */
119
+ export type PaletteMeasures = {
120
+ readonly palette: ThemeId;
121
+ /**
122
+ * Chroma per slot, normalised, for the slots that carry colour. A slot whose
123
+ * colour could not be measured is **absent** rather than zero: zero is a real
124
+ * answer meaning grey, and `graphite`'s accent really is 0.000.
125
+ */
126
+ readonly chroma: Readonly<Partial<Record<PaletteSlot, number>>>;
127
+ readonly scrim: Scrim | undefined;
128
+ };
129
+ /** Measures one palette. Refuses nothing, and reports what it could not measure by leaving it out. */
130
+ export declare const paletteMeasures: (palette: Palette) => PaletteMeasures;
131
+ /**
132
+ * The decimal places a chroma is emitted to.
133
+ *
134
+ * Fixed rather than trimmed, and the reason is not tidiness: a variable whose
135
+ * text length varied with the palette would make the page describing a tree a
136
+ * few bytes longer in one palette than in another, and *the same tree in every
137
+ * palette, byte for byte* is a promise the theme model makes and a marketing
138
+ * page now measures and prints (0049). Three places resolve a step of 0.4 in
139
+ * C*, finer than the 1/255 a hex can express.
140
+ */
141
+ export declare const CHROMA_PLACES = 3;
142
+ /** A chroma as a stylesheet reads it: unitless, so `calc()` can multiply by it. */
143
+ export declare const chromaValue: (chroma: number) => string;
144
+ //# sourceMappingURL=measure.d.ts.map