@jam-overture/loom 0.1.0 → 0.2.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 (290) 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/cli/templates.js +19 -0
  11. package/dist/data/plan.js +0 -0
  12. package/dist/data/resolution.d.ts +23 -1
  13. package/dist/data/resolve.d.ts +30 -3
  14. package/dist/data/resolve.js +11 -3
  15. package/dist/ids.d.ts +10 -0
  16. package/dist/ids.js +11 -1
  17. package/dist/index.d.ts +1 -0
  18. package/dist/index.js +1 -0
  19. package/dist/patch.d.ts +54 -0
  20. package/dist/patch.js +44 -0
  21. package/dist/project/closing.d.ts +51 -0
  22. package/dist/project/closing.js +53 -0
  23. package/dist/project/memory.d.ts +20 -0
  24. package/dist/project/memory.js +97 -0
  25. package/dist/project/project.d.ts +90 -0
  26. package/dist/project/project.js +91 -0
  27. package/dist/project/store.d.ts +135 -0
  28. package/dist/project/store.js +41 -0
  29. package/dist/registered.d.ts +64 -0
  30. package/dist/registered.js +118 -0
  31. package/dist/render/behaviour-adjust.d.ts +11 -19
  32. package/dist/render/behaviour-adjust.js +75 -21
  33. package/dist/render/behaviour-present.d.ts +8 -0
  34. package/dist/render/behaviour-present.js +57 -6
  35. package/dist/render/behaviour.d.ts +98 -17
  36. package/dist/render/behaviour.js +91 -26
  37. package/dist/render/control-name.d.ts +68 -0
  38. package/dist/render/control-name.js +37 -0
  39. package/dist/render/diagnostics.d.ts +72 -0
  40. package/dist/render/diagnostics.js +7 -0
  41. package/dist/render/index.d.ts +2 -0
  42. package/dist/render/index.js +2 -0
  43. package/dist/render/reads.d.ts +11 -0
  44. package/dist/render/reads.js +12 -1
  45. package/dist/render/render.js +102 -7
  46. package/dist/render/slots.d.ts +52 -0
  47. package/dist/render/slots.js +24 -0
  48. package/dist/render/theme.d.ts +54 -1
  49. package/dist/render/theme.js +23 -1
  50. package/dist/render/unshown.d.ts +152 -0
  51. package/dist/render/unshown.js +80 -0
  52. package/dist/runtime/analysis.d.ts +94 -9
  53. package/dist/runtime/analysis.js +54 -9
  54. package/dist/runtime/assessment.d.ts +36 -2
  55. package/dist/runtime/assessment.js +27 -2
  56. package/dist/runtime/checks.d.ts +148 -0
  57. package/dist/runtime/checks.js +112 -0
  58. package/dist/runtime/disposition.d.ts +96 -0
  59. package/dist/runtime/disposition.js +46 -0
  60. package/dist/runtime/gate.js +22 -0
  61. package/dist/runtime/index.d.ts +3 -0
  62. package/dist/runtime/index.js +3 -0
  63. package/dist/runtime/irreversibility.d.ts +64 -0
  64. package/dist/runtime/irreversibility.js +45 -0
  65. package/dist/runtime/pipeline.d.ts +43 -0
  66. package/dist/runtime/pipeline.js +10 -2
  67. package/dist/runtime/policy-change.d.ts +93 -0
  68. package/dist/runtime/policy-change.js +299 -0
  69. package/dist/runtime/policy-log.d.ts +406 -0
  70. package/dist/runtime/policy-log.js +285 -0
  71. package/dist/runtime/reversibility.d.ts +11 -9
  72. package/dist/runtime/stakes.d.ts +129 -1
  73. package/dist/runtime/stakes.js +240 -26
  74. package/dist/runtime/vocabulary.d.ts +164 -7
  75. package/dist/runtime/vocabulary.js +181 -8
  76. package/dist/sdk/audit.d.ts +174 -3
  77. package/dist/sdk/audit.js +176 -17
  78. package/dist/sdk/catalogue.d.ts +9 -1
  79. package/dist/sdk/conformance.d.ts +37 -3
  80. package/dist/sdk/conformance.js +25 -4
  81. package/dist/sdk/definition.d.ts +65 -0
  82. package/dist/sdk/definition.js +22 -0
  83. package/dist/sdk/registry.d.ts +29 -2
  84. package/dist/sdk/registry.js +63 -1
  85. package/dist/signals/action-change.d.ts +507 -0
  86. package/dist/signals/action-change.js +265 -0
  87. package/dist/signals/action.d.ts +331 -0
  88. package/dist/signals/action.js +182 -0
  89. package/dist/signals/applied-window.contract.d.ts +23 -0
  90. package/dist/signals/applied-window.contract.js +160 -0
  91. package/dist/signals/arriving.d.ts +210 -0
  92. package/dist/signals/arriving.js +133 -0
  93. package/dist/signals/audiences.d.ts +528 -0
  94. package/dist/signals/audiences.js +255 -0
  95. package/dist/signals/broadcast.d.ts +8 -2
  96. package/dist/signals/broadcast.js +58 -8
  97. package/dist/signals/change.d.ts +378 -0
  98. package/dist/signals/change.js +327 -0
  99. package/dist/signals/collect.d.ts +41 -0
  100. package/dist/signals/collect.js +88 -7
  101. package/dist/signals/copy-change.d.ts +553 -0
  102. package/dist/signals/copy-change.js +377 -0
  103. package/dist/signals/copy.d.ts +337 -0
  104. package/dist/signals/copy.js +211 -0
  105. package/dist/signals/counters.d.ts +46 -0
  106. package/dist/signals/counters.js +102 -0
  107. package/dist/signals/deliver.d.ts +23 -4
  108. package/dist/signals/deliver.js +34 -6
  109. package/dist/signals/deployment-change.d.ts +371 -0
  110. package/dist/signals/deployment-change.js +268 -0
  111. package/dist/signals/deployment.d.ts +265 -0
  112. package/dist/signals/deployment.js +152 -0
  113. package/dist/signals/door.d.ts +92 -0
  114. package/dist/signals/door.js +53 -0
  115. package/dist/signals/fold.d.ts +10 -0
  116. package/dist/signals/fold.js +5 -1
  117. package/dist/signals/form-action.d.ts +302 -0
  118. package/dist/signals/form-action.js +169 -0
  119. package/dist/signals/form-copy.d.ts +523 -0
  120. package/dist/signals/form-copy.js +346 -0
  121. package/dist/signals/forms.d.ts +247 -0
  122. package/dist/signals/forms.js +147 -0
  123. package/dist/signals/funnel-change.d.ts +548 -0
  124. package/dist/signals/funnel-change.js +361 -0
  125. package/dist/signals/funnel.d.ts +532 -0
  126. package/dist/signals/funnel.js +216 -0
  127. package/dist/signals/health.d.ts +497 -0
  128. package/dist/signals/health.js +361 -0
  129. package/dist/signals/index.d.ts +41 -0
  130. package/dist/signals/index.js +41 -0
  131. package/dist/signals/ingest.d.ts +56 -1
  132. package/dist/signals/ingest.js +91 -1
  133. package/dist/signals/journal.d.ts +11 -0
  134. package/dist/signals/kinds.d.ts +8 -6
  135. package/dist/signals/kinds.js +14 -6
  136. package/dist/signals/library-action.d.ts +430 -0
  137. package/dist/signals/library-action.js +336 -0
  138. package/dist/signals/library-change.d.ts +477 -0
  139. package/dist/signals/library-change.js +335 -0
  140. package/dist/signals/library-copy-change.d.ts +498 -0
  141. package/dist/signals/library-copy-change.js +476 -0
  142. package/dist/signals/library-pace.d.ts +319 -0
  143. package/dist/signals/library-pace.js +305 -0
  144. package/dist/signals/library-reach-change.d.ts +636 -0
  145. package/dist/signals/library-reach-change.js +534 -0
  146. package/dist/signals/library-reach.d.ts +377 -0
  147. package/dist/signals/library-reach.js +227 -0
  148. package/dist/signals/library-word-reach-change.d.ts +567 -0
  149. package/dist/signals/library-word-reach-change.js +568 -0
  150. package/dist/signals/library.d.ts +306 -0
  151. package/dist/signals/library.js +178 -0
  152. package/dist/signals/memory.d.ts +9 -0
  153. package/dist/signals/memory.js +105 -14
  154. package/dist/signals/migrate.d.ts +17 -2
  155. package/dist/signals/migrate.js +122 -5
  156. package/dist/signals/notice.d.ts +334 -0
  157. package/dist/signals/notice.js +228 -0
  158. package/dist/signals/pace-change.d.ts +501 -0
  159. package/dist/signals/pace-change.js +310 -0
  160. package/dist/signals/pace.d.ts +296 -0
  161. package/dist/signals/pace.js +291 -0
  162. package/dist/signals/page-views.d.ts +365 -0
  163. package/dist/signals/page-views.js +218 -0
  164. package/dist/signals/parts.d.ts +344 -0
  165. package/dist/signals/parts.js +273 -0
  166. package/dist/signals/postgres.d.ts +16 -2
  167. package/dist/signals/postgres.js +390 -87
  168. package/dist/signals/progress.d.ts +212 -0
  169. package/dist/signals/progress.js +150 -0
  170. package/dist/signals/ratios.d.ts +108 -0
  171. package/dist/signals/ratios.js +40 -0
  172. package/dist/signals/reach.d.ts +309 -0
  173. package/dist/signals/reach.js +93 -0
  174. package/dist/signals/readable.d.ts +34 -0
  175. package/dist/signals/readable.js +34 -0
  176. package/dist/signals/readership.d.ts +381 -0
  177. package/dist/signals/readership.js +308 -0
  178. package/dist/signals/region-pages.d.ts +173 -0
  179. package/dist/signals/region-pages.js +62 -0
  180. package/dist/signals/region.d.ts +287 -0
  181. package/dist/signals/region.js +198 -0
  182. package/dist/signals/retention.d.ts +141 -0
  183. package/dist/signals/retention.js +58 -0
  184. package/dist/signals/rollup.d.ts +67 -3
  185. package/dist/signals/rollup.js +0 -0
  186. package/dist/signals/schema.d.ts +432 -1
  187. package/dist/signals/schema.js +157 -3
  188. package/dist/signals/signal.d.ts +237 -11
  189. package/dist/signals/signal.js +70 -10
  190. package/dist/signals/silence-census.d.ts +205 -0
  191. package/dist/signals/silence-census.js +87 -0
  192. package/dist/signals/silences.d.ts +848 -0
  193. package/dist/signals/silences.js +753 -0
  194. package/dist/signals/tally.d.ts +140 -11
  195. package/dist/signals/window-figures.d.ts +148 -0
  196. package/dist/signals/window-figures.js +42 -0
  197. package/dist/signals/window.d.ts +866 -0
  198. package/dist/signals/window.js +693 -0
  199. package/dist/signals/words.d.ts +24 -0
  200. package/dist/signals/words.js +24 -0
  201. package/dist/store/index.d.ts +19 -0
  202. package/dist/store/index.js +19 -0
  203. package/dist/store/memory.d.ts +2 -1
  204. package/dist/store/memory.js +48 -12
  205. package/dist/store/migrate.d.ts +80 -0
  206. package/dist/store/migrate.js +259 -7
  207. package/dist/store/postgres-applications.d.ts +4 -0
  208. package/dist/store/postgres-applications.js +197 -0
  209. package/dist/store/postgres-holds.d.ts +10 -1
  210. package/dist/store/postgres-holds.js +116 -101
  211. package/dist/store/postgres-policy-log.d.ts +14 -0
  212. package/dist/store/postgres-policy-log.js +240 -0
  213. package/dist/store/postgres-projects.d.ts +4 -0
  214. package/dist/store/postgres-projects.js +217 -0
  215. package/dist/store/postgres.d.ts +16 -1
  216. package/dist/store/postgres.js +59 -9
  217. package/dist/store/replay.d.ts +102 -1
  218. package/dist/store/replay.js +190 -19
  219. package/dist/store/reseed.d.ts +238 -0
  220. package/dist/store/reseed.js +308 -0
  221. package/dist/store/schema.d.ts +450 -2
  222. package/dist/store/schema.js +141 -5
  223. package/dist/store/store.d.ts +29 -6
  224. package/dist/submit/resolve.js +2 -1
  225. package/dist/telemetry/calibration.d.ts +25 -0
  226. package/dist/telemetry/calibration.js +27 -1
  227. package/dist/telemetry/event.d.ts +391 -33
  228. package/dist/telemetry/event.js +84 -20
  229. package/dist/telemetry/index.d.ts +1 -0
  230. package/dist/telemetry/index.js +1 -0
  231. package/dist/telemetry/journal.d.ts +72 -3
  232. package/dist/telemetry/journal.js +9 -0
  233. package/dist/telemetry/lookup.d.ts +27 -0
  234. package/dist/telemetry/lookup.js +18 -0
  235. package/dist/telemetry/memory.js +23 -0
  236. package/dist/telemetry/migrate.js +22 -1
  237. package/dist/telemetry/postgres.d.ts +10 -1
  238. package/dist/telemetry/postgres.js +172 -90
  239. package/dist/telemetry/remeasure.d.ts +78 -0
  240. package/dist/telemetry/remeasure.js +83 -0
  241. package/dist/telemetry/retention.d.ts +2 -2
  242. package/dist/telemetry/schema.d.ts +17 -0
  243. package/dist/telemetry/schema.js +27 -1
  244. package/dist/telemetry/sink.d.ts +2 -2
  245. package/dist/testing/application-contract.d.ts +14 -0
  246. package/dist/testing/application-contract.js +270 -0
  247. package/dist/testing/contracts.d.ts +12 -7
  248. package/dist/testing/contracts.js +12 -7
  249. package/dist/testing/definitions.d.ts +78 -0
  250. package/dist/testing/definitions.js +134 -9
  251. package/dist/testing/doubles.d.ts +103 -0
  252. package/dist/testing/doubles.js +143 -0
  253. package/dist/testing/index.d.ts +2 -2
  254. package/dist/testing/index.js +2 -2
  255. package/dist/testing/journal-contract.js +140 -2
  256. package/dist/testing/model-contract.d.ts +110 -0
  257. package/dist/testing/model-contract.js +150 -0
  258. package/dist/testing/policy-log-contract.d.ts +26 -0
  259. package/dist/testing/policy-log-contract.js +344 -0
  260. package/dist/testing/project-contract.d.ts +14 -0
  261. package/dist/testing/project-contract.js +266 -0
  262. package/dist/testing/reader-signal-contract.d.ts +27 -2
  263. package/dist/testing/reader-signal-contract.js +475 -5
  264. package/dist/testing/store-contract.d.ts +7 -1
  265. package/dist/testing/store-contract.js +84 -3
  266. package/dist/theme/apply.d.ts +20 -1
  267. package/dist/theme/apply.js +5 -3
  268. package/dist/theme/derive.d.ts +22 -0
  269. package/dist/theme/derive.js +54 -1
  270. package/dist/theme/library.js +1 -1
  271. package/dist/theme/measure.d.ts +34 -0
  272. package/dist/theme/measure.js +30 -1
  273. package/dist/theme/palettes.js +7 -7
  274. package/dist/theme/ramp.d.ts +64 -0
  275. package/dist/theme/ramp.js +114 -0
  276. package/dist/theme/registry.d.ts +9 -0
  277. package/dist/theme/registry.js +11 -1
  278. package/dist/theme/separation.d.ts +97 -3
  279. package/dist/theme/separation.js +75 -0
  280. package/dist/tree/compare.d.ts +9 -0
  281. package/dist/tree/compare.js +18 -0
  282. package/dist/write/computed.d.ts +60 -0
  283. package/dist/write/computed.js +61 -0
  284. package/dist/write/held.d.ts +59 -0
  285. package/dist/write/index.d.ts +5 -2
  286. package/dist/write/index.js +5 -2
  287. package/dist/write/reseed.d.ts +151 -0
  288. package/dist/write/reseed.js +184 -0
  289. package/dist/write/revert.js +2 -16
  290. package/package.json +98 -19
@@ -0,0 +1,636 @@
1
+ import type { PrimitiveType } from "../primitive-type.js";
2
+ import { type PrimitiveRole } from "../role.js";
3
+ import { type ComparedPopulations, type PageForm } from "./audiences.js";
4
+ import { type PageDoor } from "./door.js";
5
+ import { type KindKey } from "./library.js";
6
+ import { type PairedWindow } from "./library-change.js";
7
+ import type { UnscaledPage } from "./library-reach.js";
8
+ import { type StoredPageViews } from "./page-views.js";
9
+ import { type PageReading } from "./parts.js";
10
+ /**
11
+ * Of the readers who met a kind of part, the share that read it — before and
12
+ * after.
13
+ *
14
+ * [`library-change.ts`](library-change.ts) compares a kind of part over the
15
+ * places both windows bore, and is explicit about what that is: a share of
16
+ * **places**, with no reader in the denominator, which is what lets a verdict be
17
+ * the sign of a subtraction of two whole numbers
18
+ * ([0266](../../decisions/0266-a-change-to-a-kind-of-part-is-read-over-the-places-both-windows-bore.md)).
19
+ * It answers *in how many of the places this kind stands has it gained or lost
20
+ * its reading*, which is the question an author replacing a primitive has.
21
+ *
22
+ * The figure everybody asks for next is the other one, and this lane filed its
23
+ * shape the day 0266 landed rather than shipping a corrected number beside an
24
+ * uncorrected one on the same type: *of the readers who met your testimonial
25
+ * band, the share that read it has gone from four in ten to seven.*
26
+ *
27
+ * This is that figure. It is the **twentieth** thing taken out of what this
28
+ * subsystem already knows rather than collected: **nothing is added to a
29
+ * payload, a browser, a column, a store or the vocabulary of kinds**, and the
30
+ * broadcaster is not touched.
31
+ *
32
+ * ## Two things are held still, and they are held still for different reasons
33
+ *
34
+ * **The places**, which is 0266's method unchanged: every figure is taken over
35
+ * the placements that stand in both windows — the same node of the same page, of
36
+ * the same kind on both sides — and a placement only one side bears is counted
37
+ * in {@link KindReachChange.gained} or {@link KindReachChange.lost} and is in no
38
+ * share. A kind whose places all moved has no comparison and says so.
39
+ *
40
+ * **Each side's own scale**, which is
41
+ * [0256](../../decisions/0256-a-kinds-share-of-the-readers-who-met-it-is-a-weighted-mean-of-sound-shares-at-the-doors-scale.md)'s
42
+ * method unchanged: a placement's share of its own page's readers is
43
+ * `reached ÷ appearances` off that page's own row, weighted by
44
+ * `min(appearances, opened)` — the page views a rollup folded, at the door's
45
+ * scale. The straddle over-count (0147) is in both terms of each per-page share
46
+ * and very nearly divides out there, which is the only place it can:
47
+ * **the straddle rate is each page's own**, so it does not divide out across
48
+ * pages and it does not divide out across windows either.
49
+ *
50
+ * So the door is needed on **both** sides, which is why this is a second unit
51
+ * and not a field on 0266's type: one reading cannot hold a figure that needs
52
+ * four numbers per page and one that needs none, with nothing but prose to tell
53
+ * a surface which is which.
54
+ *
55
+ * ## The weights move, and that is the whole of what is hard here
56
+ *
57
+ * A weighted mean over the same places still moves when one page's traffic
58
+ * grows and another's shrinks. *The testimonial band is read by seven readers in
59
+ * ten now* can be true because readers read it more, or because the pages where
60
+ * it is read well got busier — and the second is a fact about a deployment's
61
+ * traffic wearing a sentence about its library. It is the counterfactual problem
62
+ * [0251](../../decisions/0251-a-change-to-what-readers-did-is-a-ratio-of-two-shares-and-an-inside-a-change-gave-a-part-is-not-a-reader.md)
63
+ * wrote down, one level across.
64
+ *
65
+ * It is answered the way a pace comparison answers which side of a division
66
+ * moved ([0244](../../decisions/0244-a-pace-moved-because-the-words-moved-or-the-readers-did-and-a-counterfactual-says-which.md)):
67
+ * by **sufficiency** rather than by magnitude, because *which moved more* needs a
68
+ * threshold on what counts as a move and sufficiency needs none.
69
+ *
70
+ * - {@link KindReachChange.ifTrafficHeld} is the later window's per-place shares
71
+ * at the **earlier** window's weights — the share this kind would have had if
72
+ * no page's traffic had moved. It isolates the readers.
73
+ * - {@link KindReachChange.ifReadingHeld} is the earlier window's per-place
74
+ * shares at the **later** window's weights — the share it would have had if no
75
+ * reader had read differently. It isolates the mix of pages.
76
+ *
77
+ * Each is asked the one question that matters — *does this carry the movement's
78
+ * own direction* — and {@link ReaderShareCause} says whether the readers alone
79
+ * were enough, the pages alone were, either was, or only the two together.
80
+ *
81
+ * **The additive split is deliberately not published**, and the reason is
82
+ * arithmetic rather than taste. `shift` is exactly
83
+ * `(ifTrafficHeld − shareWas) + (shareNow − ifTrafficHeld)` and exactly
84
+ * `(ifReadingHeld − shareWas) + (shareNow − ifReadingHeld)`, and the two
85
+ * decompositions differ by the interaction term `Σ (bₚ − aₚ)(sₚⁿᵒʷ − sₚʷᵃˢ)` —
86
+ * weight moving toward the places whose reading moved. Publishing one pair of
87
+ * terms would put a number on *how much of this was traffic* that another
88
+ * equally valid ordering contradicts. The two counterfactuals are published
89
+ * instead, the cause is a sufficiency verdict over them, and
90
+ * {@link KindReachChange.weightMoved} says how far the weights moved at all.
91
+ *
92
+ * ## What it refuses to publish
93
+ *
94
+ * **A ceiling.** A kind's share of the readers who met it is published with
95
+ * `atMost` beside it, which is the same numerator taken of the exact openings
96
+ * (0229, 0256). Two ceilings do not bound a difference — subtracting them gives
97
+ * a number that is not a bound on anything — and a surface handed two of them
98
+ * would print `atMostNow − atMostWas` as a movement nobody measured. So neither
99
+ * is here, and the evidence behind the two estimates travels instead as each
100
+ * side's {@link KindReachChange.pendingWas} and
101
+ * {@link KindReachChange.driftWas}.
102
+ *
103
+ * **A headcount.** `met` is a count of page views at the door's scale and is
104
+ * deliberately not rounded into people (0256), so neither is
105
+ * {@link KindReachChange.readersMoved}: it is the movement stated at the later
106
+ * window's scale, which is the number a surface ranks by and never a number of
107
+ * humans.
108
+ *
109
+ * **A share over a subset.** A kind standing on one page the door cannot scale,
110
+ * on either side, has no share at all — not a share over the pages that could be
111
+ * scaled, which is 0256's refusal for the reason 0256 gives: *of the places we
112
+ * could price* is not a sentence a surface prints, it prints the number. The
113
+ * pages that caused it are published once for the reading with the side they are
114
+ * on and **their own** vocabulary's reason on them.
115
+ *
116
+ * **Anything added across kinds.** No reading-wide share and no reading-wide
117
+ * movement, for the reason a census has none (0257): a figure over every kind at
118
+ * once counts a page once per element node, so it measures how finely the pages
119
+ * were written as much as how they are read.
120
+ *
121
+ * ## What it inherits without restating
122
+ *
123
+ * The two keys answer differently about one change and both are published, which
124
+ * is 0266's point: a node whose **type** changed is a place one kind left and
125
+ * another took, while the role rows hold it still wherever the two types play
126
+ * the same part. A tree held at two revisions in one window is excluded and
127
+ * named, because a comparison pairs by page. The same reading handed in twice is
128
+ * the ordinary double count and is dropped (0158). And the role rows are thin
129
+ * today for the reason every role figure in this subsystem is thin — nothing in
130
+ * `src/primitives/` declares one (0114) — so the join being at read time (0212)
131
+ * is what makes them start answering with no migration.
132
+ *
133
+ * Pure. It reaches no store, no clock and no DOM, it is linear in the parts of
134
+ * the readings times the rows handed in, and nothing in it survives into a
135
+ * browser bundle.
136
+ */
137
+ /** One window of a library: the pages read, and the door rows to put them on one scale. */
138
+ export type LibraryWindow = {
139
+ readonly readings: readonly PageReading[];
140
+ /**
141
+ * The whole window of page-view rows a deployment holds.
142
+ *
143
+ * Each page's own row is picked out of them by the published matching rule
144
+ * (`pageViewsFor`) rather than by a hand-written copy of it, because the
145
+ * pairing is the part of every join here that fails quietly when it is got
146
+ * wrong.
147
+ */
148
+ readonly rows: readonly StoredPageViews[];
149
+ };
150
+ /** Which of the two windows a fact is about. */
151
+ export type ReadingSide = "was" | "now";
152
+ export declare const READING_SIDES: readonly ReadingSide[];
153
+ /** One line per side, for a surface naming the window a page's reason came from. */
154
+ export declare const describeReadingSide: (side: ReadingSide) => string;
155
+ /**
156
+ * A page bearing a comparable placement that the door could not scale, with the
157
+ * side it is on and the reason in the vocabulary a page's own reading
158
+ * publishes.
159
+ *
160
+ * The side is the field 0256's version could not have: one page can be scalable
161
+ * in one window and not in the other, and *which window* is the whole of the
162
+ * remedy — a missing row in the earlier window is retention, and a missing row
163
+ * in the later one is a collection that has stopped.
164
+ */
165
+ export type UnscaledSide = UnscaledPage & {
166
+ readonly side: ReadingSide;
167
+ /** The revision read on the other side, which is the page this one is paired with. */
168
+ readonly against: number;
169
+ };
170
+ /** Why a kind of part has no before and after among the readers who met it. */
171
+ export type KindReachChangeSilence =
172
+ /**
173
+ * Nothing in the pages read, on either side, is of this kind.
174
+ *
175
+ * Only ever a role row, and the census's own reason (0257): *nothing in this
176
+ * library is a heading* is a fact about the library rather than a missing row.
177
+ */
178
+ "unplaced"
179
+ /**
180
+ * It stands in both windows and in no place that is in both.
181
+ *
182
+ * Every placement was gained or lost, so there is nothing held still to
183
+ * compare — which is an answer about the **library** rather than about its
184
+ * readers, and the places comparison's own reason (0266).
185
+ */
186
+ | "unpaired"
187
+ /**
188
+ * No place of it that stands in both windows can be spoken for in both.
189
+ *
190
+ * Every paired placement is `unknown` in one window or the other, and a
191
+ * standing of `unknown` is *nothing can be said* and never *nobody read it*
192
+ * (0212).
193
+ */
194
+ | "unread"
195
+ /**
196
+ * A page bearing a comparable place of it has no page-view row at the door, on
197
+ * one of the two sides.
198
+ *
199
+ * The page's own reading stands whole; what is missing is the one number that
200
+ * makes two pages' shares comparable. {@link LibraryReachChange.unscaled}
201
+ * says which page and which side.
202
+ */
203
+ | "unscaled"
204
+ /**
205
+ * A page bearing a comparable place of it has a row and nothing in it says a
206
+ * page view began.
207
+ *
208
+ * Kept apart from `unscaled` because the remedy is the opposite: a missing row
209
+ * is retention or an upgrade, and this is **senders that are not marking their
210
+ * openings**.
211
+ */
212
+ | "unopened"
213
+ /**
214
+ * A page bearing a comparable place of it has openings and no rollup has
215
+ * folded a window of them yet.
216
+ *
217
+ * The one reason here that resolves itself, and on a comparison it is the
218
+ * commonest honest state of the later window: a window whose readers have
219
+ * arrived and whose reading has not been counted.
220
+ */
221
+ | "uncounted";
222
+ export declare const KIND_REACH_CHANGE_SILENCES: readonly KindReachChangeSilence[];
223
+ /** One line per silence, for a surface saying why a kind has no before and after. */
224
+ export declare const describeKindReachChangeSilence: (silence: KindReachChangeSilence) => string;
225
+ /**
226
+ * What happened to the share of the readers who met a kind of part.
227
+ *
228
+ * The same five names 0266 publishes over the places a kind stands, because
229
+ * they are the same five states at a different unit — and the unit is the
230
+ * difference worth knowing: these are readers and those are places, so a kind
231
+ * can be `taken-up` here and `held` there, which is a kind read better by the
232
+ * readers it already had.
233
+ */
234
+ export type KindReachMovement =
235
+ /** A larger share of the readers who met it read it now. */
236
+ "taken-up"
237
+ /** A smaller share does. */
238
+ | "abandoned"
239
+ /**
240
+ * Exactly the same share does.
241
+ *
242
+ * Two weighted means that are the same number, which is the state a window
243
+ * compared against itself is in. A movement smaller than the last bit of a
244
+ * float is reported as a movement rather than as this, and no threshold is
245
+ * invented to prevent it: {@link KindReachChange.shift} is the number, and the
246
+ * comparison with no division in it is the count of places (0266).
247
+ */
248
+ | "held"
249
+ /**
250
+ * No reader reached any comparable place of it in either window.
251
+ *
252
+ * Kept apart from `held` for the reason the comparison of places and the
253
+ * comparison of what readers did keep their own version of it apart
254
+ * (0266, 0251): *met everywhere and read nowhere, and still read nowhere* is
255
+ * the one state here that is an instruction.
256
+ */
257
+ | "still-unread"
258
+ /** {@link KindReachChange.silence} says why nothing can be said. */
259
+ | "unknown";
260
+ export declare const KIND_REACH_MOVEMENTS: readonly KindReachMovement[];
261
+ /** One line per movement, for a surface putting a kind's before and after in front of a person. */
262
+ export declare const describeKindReachMovement: (movement: KindReachMovement) => string;
263
+ /**
264
+ * Which side of the weighted mean the movement came from.
265
+ *
266
+ * Answered by sufficiency rather than by magnitude: *would this movement have
267
+ * arrived anyway, if only one of the two had moved*. `null` on a kind whose
268
+ * share did not move, because there is nothing to attribute.
269
+ */
270
+ export type ReaderShareCause =
271
+ /**
272
+ * The readers alone were enough: the later window's per-place shares at the
273
+ * earlier window's traffic would have moved it the same way.
274
+ */
275
+ "readers"
276
+ /**
277
+ * The pages alone were enough: the earlier window's per-place shares at the
278
+ * later window's traffic would have moved it the same way.
279
+ *
280
+ * The attribution worth leading with, and the one a single weighted figure
281
+ * hides. *This kind is read better because the pages it is read well on got
282
+ * busier, and not because anybody read it differently.*
283
+ */
284
+ | "pages"
285
+ /** Either alone would have been enough, so the movement is over-determined. */
286
+ | "either"
287
+ /**
288
+ * Neither alone would have been enough and the two together were.
289
+ *
290
+ * The interaction: traffic moved toward the places whose reading moved. It is
291
+ * reachable rather than theoretical — two pages swapping their traffic, where
292
+ * the busy one is the one now read — and it is why no additive split is
293
+ * published.
294
+ */
295
+ | "together";
296
+ export declare const READER_SHARE_CAUSES: readonly ReaderShareCause[];
297
+ /** One line per cause, for a surface saying what moved a share of readers. */
298
+ export declare const describeReaderShareCause: (cause: ReaderShareCause) => string;
299
+ /**
300
+ * One kind of part, held against itself across two windows, among the readers
301
+ * who met it.
302
+ *
303
+ * The same shape for a type row and a role row, because they are one comparison
304
+ * asked of two keys. The place counts are 0266's and are repeated here rather
305
+ * than fetched, so that a surface drawing this row never holds two lists side by
306
+ * side to find out how much is behind a share.
307
+ */
308
+ export type KindReachChange = {
309
+ readonly kind: KindKey;
310
+ /**
311
+ * What part a type plays (0114), or `null`. Always `null` on a role row, which
312
+ * carries it as its key.
313
+ *
314
+ * The later window's answer where it stands there, so that a surface reading a
315
+ * row and the role beside it is reading today's library.
316
+ */
317
+ readonly role: PrimitiveRole | null;
318
+ /** Places of this kind that stand in both windows: the same node of the same page, of this kind on both sides. */
319
+ readonly places: number;
320
+ /** Places of it in the later window with no counterpart in the earlier one. */
321
+ readonly gained: number;
322
+ /** Places of it in the earlier window with no counterpart in the later one. */
323
+ readonly lost: number;
324
+ /**
325
+ * Of {@link places}, those with a verdict on **both** sides, which is the set
326
+ * every figure below is taken over.
327
+ *
328
+ * One number and not two, which is what makes the two shares comparable: a
329
+ * place nothing can be said about in either window is in neither term, so the
330
+ * two sides are read over exactly the same set of places.
331
+ */
332
+ readonly comparable: number;
333
+ /**
334
+ * Pages bearing a comparable place of it, which is **forms** and not
335
+ * revisions.
336
+ *
337
+ * A page served in two forms (0263) is two of them, for the reason the
338
+ * pairing counts it as two: the two have separate counters, separate doors
339
+ * and separate readers, and a kind standing in both stands in both.
340
+ */
341
+ readonly pages: number;
342
+ /**
343
+ * Page views that met a page bearing a comparable place of it in the earlier
344
+ * window, at the door's scale, counted once per place it stands there.
345
+ *
346
+ * The denominator of {@link shareWas} and the weight behind it.
347
+ */
348
+ readonly countedWas: number | null;
349
+ /** The same for the later window. */
350
+ readonly countedNow: number | null;
351
+ /**
352
+ * Page views that reached a comparable place of it in the earlier window, at
353
+ * the door's scale: `reached × counted ÷ appearances`, added over the places.
354
+ *
355
+ * **Not a count of people and deliberately not rounded into one** (0256).
356
+ */
357
+ readonly metWas: number | null;
358
+ /** The same for the later window. */
359
+ readonly metNow: number | null;
360
+ /**
361
+ * `metWas ÷ countedWas` — the share of the readers who met it that read it, in
362
+ * the earlier window.
363
+ *
364
+ * A weighted mean of each page's own sound share with that page's folded
365
+ * arrivals behind it. `null` where {@link silence} says why not.
366
+ */
367
+ readonly shareWas: number | null;
368
+ /** The same share in the later window, over the same places. */
369
+ readonly shareNow: number | null;
370
+ /** `shareNow − shareWas`, and `null` with the two shares. */
371
+ readonly shift: number | null;
372
+ /**
373
+ * The movement stated at the later window's scale: `shift × countedNow`.
374
+ *
375
+ * What the movement is worth in page views — the number this reading ranks by,
376
+ * for the reason a page's falls are ranked by the readers they lose (0221).
377
+ * Page views at the door's scale and never people, exactly as {@link metNow}
378
+ * is.
379
+ */
380
+ readonly readersMoved: number | null;
381
+ /**
382
+ * The later window's per-place shares at the earlier window's weights: the
383
+ * share there would have been if no page's traffic had moved.
384
+ *
385
+ * Isolates the readers. See the module documentation.
386
+ */
387
+ readonly ifTrafficHeld: number | null;
388
+ /**
389
+ * The earlier window's per-place shares at the later window's weights: the
390
+ * share there would have been if no reader had read differently.
391
+ *
392
+ * Isolates the mix of pages.
393
+ */
394
+ readonly ifReadingHeld: number | null;
395
+ readonly movement: KindReachMovement;
396
+ /** Which side was sufficient, or `null` where the share did not move. */
397
+ readonly cause: ReaderShareCause | null;
398
+ /**
399
+ * How far the weights moved: half the sum of the absolute movements in each
400
+ * comparable place's share of its side's total weight, in `[0, 1]`.
401
+ *
402
+ * The share of the weight that would have to be somewhere else for the two
403
+ * sides to be weighted alike — the arithmetic a comparison of two readerships
404
+ * uses (0247), over places rather than regions. 0 is a comparison weighted
405
+ * identically on both sides, and 1 is two sides with no weight in common.
406
+ *
407
+ * **Published and never judged.** A weighted mean whose weights barely moved
408
+ * is a comparison of readers; one whose weights moved a long way may still be
409
+ * a comparison of readers, and {@link cause} is what says so without a
410
+ * threshold.
411
+ */
412
+ readonly weightMoved: number | null;
413
+ /** Appearances in excess of openings in the earlier window, over the comparable places: the straddle that divided out of each page's share. */
414
+ readonly driftWas: number;
415
+ /** The same for the later window. */
416
+ readonly driftNow: number;
417
+ /** Openings in the earlier window, over the comparable places, whose reading no rollup has folded. */
418
+ readonly pendingWas: number;
419
+ /** The same for the later window. */
420
+ readonly pendingNow: number;
421
+ /**
422
+ * Comparable places reporting more reach than their page had appearances, on
423
+ * either side, which no rollup produces.
424
+ *
425
+ * Node counters older than the page-view column, or a caller that
426
+ * concatenated two reads. It is the one thing that can put a share above 1,
427
+ * and a surface should show the places comparison (0266) instead where it is
428
+ * non-nought.
429
+ */
430
+ readonly unreconciled: number;
431
+ /**
432
+ * Nobody's visit spanned a window on either side, nothing is waiting to be
433
+ * folded, and nothing is unreconciled — so both shares are exact.
434
+ *
435
+ * False under a silence. It says nothing about the weights: a comparison can
436
+ * be exact on both sides and still be weighted differently, which is what
437
+ * {@link weightMoved} is for.
438
+ */
439
+ readonly exact: boolean;
440
+ /**
441
+ * Why the figures are not there, and `null` where they are.
442
+ *
443
+ * About the comparison and not about the row: {@link places}, {@link gained}
444
+ * and {@link lost} are counts of parts of trees and are true whatever any
445
+ * window measured, which is how a census publishes a standing beside a
446
+ * withheld share (0212).
447
+ */
448
+ readonly silence: KindReachChangeSilence | null;
449
+ };
450
+ /** What a change did to a deployment's library among the readers who met it, by kind of part. */
451
+ export type LibraryReachChange = {
452
+ /**
453
+ * Every type that stands in either window, most readers lost first.
454
+ *
455
+ * Then the lower share in the later window, then by type, so two kinds that
456
+ * lost the same do not reorder on a refresh.
457
+ */
458
+ readonly byType: readonly KindReachChange[];
459
+ /**
460
+ * Every role in the vocabulary, then the row for parts whose type declared
461
+ * none, in the same order as {@link byType}.
462
+ */
463
+ readonly byRole: readonly KindReachChange[];
464
+ /** Forms read in both windows: a page in one of its forms, never a revision. */
465
+ readonly pages: number;
466
+ /** Forms read in the later window only, which is not pages published. */
467
+ readonly pagesGained: number;
468
+ /** Of {@link pagesGained}, forms whose page the earlier window already held. */
469
+ readonly formsGained: number;
470
+ /** Forms read in the earlier window only, which is not pages withdrawn. */
471
+ readonly pagesLost: number;
472
+ /** Of {@link pagesLost}, forms whose page the later window still holds. */
473
+ readonly formsLost: number;
474
+ /** The audiences each window's forms named, published and never refused. */
475
+ readonly audiences: ComparedPopulations;
476
+ /**
477
+ * Paired pages whose revision moved between the windows.
478
+ *
479
+ * The comparison still stands — a placement is paired by node — but it says
480
+ * the pages changed as well as the window, which is the difference between
481
+ * *your readers behave differently* and *you changed your pages*.
482
+ */
483
+ readonly republished: number;
484
+ /** Places that stand in both windows, which is the sum of every type row's {@link KindReachChange.places}. */
485
+ readonly placements: number;
486
+ /** Places in the later window only. */
487
+ readonly gained: number;
488
+ /** Places in the earlier window only. */
489
+ readonly lost: number;
490
+ /** Paired nodes whose primitive type changed: a place one kind left and another took (0266). */
491
+ readonly recast: number;
492
+ /**
493
+ * Page views counted at the door across the paired pages in the earlier
494
+ * window, added **once per page**.
495
+ *
496
+ * Addable for the reason no other count here is: a page view began on one
497
+ * revision of one tree and was counted once (0219). It is the weight behind
498
+ * the whole comparison — *this moved among six hundred readers rather than
499
+ * six* — and is the denominator of nothing.
500
+ */
501
+ readonly arrivalsWas: number;
502
+ /** The same for the later window. */
503
+ readonly arrivalsNow: number;
504
+ /** Paired pages the door could scale in **both** windows, which is where every share here comes from. */
505
+ readonly scaled: number;
506
+ /**
507
+ * The paired pages bearing a comparable placement that the door could not
508
+ * scale, by tree, newest revision first, with the side they are on.
509
+ *
510
+ * The actionable half of every door silence on a row above: one of these pages
511
+ * is why. Empty is the healthy state.
512
+ */
513
+ readonly unscaled: readonly UnscaledSide[];
514
+ /**
515
+ * The type that lost the most readers, which is the kind to look at first.
516
+ *
517
+ * By {@link KindReachChange.readersMoved} and not by the share, which is this
518
+ * subsystem's ranking rule everywhere (0221, 0257): a kind abandoned by two
519
+ * readers out of three is a worse rate and a smaller problem than one
520
+ * abandoned by four hundred out of a thousand. A type and never a role,
521
+ * because a type is the thing an author can replace.
522
+ */
523
+ readonly mostAbandoned: KindReachChange | null;
524
+ /** The type that gained the most readers, by the same rule. */
525
+ readonly mostTakenUp: KindReachChange | null;
526
+ /**
527
+ * Forms read at two revisions in one window, which are in nothing above.
528
+ *
529
+ * A page that is two live revisions in one window has no single counterpart in
530
+ * the other, and the comparison pairs by page in its form (0266): excluded and
531
+ * named rather than picked between. A form and not a tree, because two forms
532
+ * of a page (0263) are two paired pages and one of them being ambiguous says
533
+ * nothing about the other.
534
+ */
535
+ readonly ambiguous: readonly PageForm[];
536
+ /** Readings of a revision beyond the first, on either side, which were dropped (0158). */
537
+ readonly duplicated: number;
538
+ /**
539
+ * Door rows for one revision beyond the first, across the pages of both
540
+ * windows, which were ignored.
541
+ *
542
+ * A store keeps one row per revision, so this is a caller's two reads — and
543
+ * adding them would double a page's arrivals and halve every share taken
544
+ * against it. Counted over every page read rather than only the paired ones,
545
+ * because it is an alarm about the caller and not a term in any figure.
546
+ */
547
+ readonly duplicatedRows: number;
548
+ /** Types the two windows disagree about the role of, where the later window's answer stands (0114). */
549
+ readonly roleDisagreed: readonly PrimitiveType[];
550
+ };
551
+ /**
552
+ * Which side was sufficient, by the direction each counterfactual carries.
553
+ *
554
+ * `null` where nothing moved: a verdict that did not move has nothing to
555
+ * attribute, which is `PaceCause`'s rule (0244).
556
+ */
557
+ export declare const readerShareCauseOf: (shareWas: number, shareNow: number, ifTrafficHeld: number, ifReadingHeld: number) => ReaderShareCause | null;
558
+ /**
559
+ * Half the sum of the absolute movements in each place's share of its side's
560
+ * weight, which is the figure a comparison of two readerships publishes
561
+ * (0247), over places rather than regions.
562
+ *
563
+ * **`null` where either side has no weight at all**, because there is no
564
+ * distance between a mix and nothing to have one
565
+ * ([0307](../../decisions/0307-a-distance-between-a-mix-and-nothing-is-withheld-and-the-invariant-both-rolls-rest-on-is-asserted.md)).
566
+ * A nought here is the one value a surface reads as *the weights did not move*,
567
+ * which is the opposite sentence; 0247's own reading withholds `moved` in the
568
+ * same state for the same reason.
569
+ *
570
+ * **Neither roll can reach it**, and that is asserted rather than described:
571
+ * both compute this only where their silence is `null`, and a door that can
572
+ * scale a page has counted at least one page view at it ([`door.ts`](door.ts)),
573
+ * so a measured row has a weight behind it. The guard is here because the
574
+ * helper is exported and a caller outside the two rolls would otherwise divide
575
+ * by nought.
576
+ */
577
+ export declare const weightMovedOver: (weights: readonly {
578
+ readonly was: number;
579
+ readonly now: number;
580
+ }[], totals: {
581
+ readonly was: number;
582
+ readonly now: number;
583
+ }) => number | null;
584
+ /**
585
+ * One side's pages, each with the door that scales it, worked out once per
586
+ * page.
587
+ *
588
+ * Published rather than private because a second reading needs the same window
589
+ * — the words the typical reader of a kind of part reached, which is weighted
590
+ * by the same doors on the same pairing (0280). Two spellings of one rule that
591
+ * agree today are what moved the door's own scale into its own module, so the
592
+ * window is written once here, in the module whose record owns it.
593
+ */
594
+ export type ScaledPage = {
595
+ readonly reading: PageReading;
596
+ readonly door: PageDoor;
597
+ readonly duplicatedRows: number;
598
+ };
599
+ /** One page with its door, picked out of the window's rows by the published matching rule. */
600
+ export declare const scaledPageOf: (reading: PageReading, rows: readonly StoredPageViews[]) => ScaledPage;
601
+ /** One whole side: its pages keyed by form, each page's door, and the rows a caller handed in twice. */
602
+ export type LibrarySide = {
603
+ readonly pages: PairedWindow;
604
+ /**
605
+ * Each paired page's door, under the same key the pairing uses.
606
+ *
607
+ * Keyed by the form rather than by the tree because the door is per form too:
608
+ * `pageViewsFor` scopes a page-view row to the reading's own audience (0290),
609
+ * so two forms of one page have two doors and a map keyed by the tree would
610
+ * hold one of them and scale both sides of the other against it.
611
+ */
612
+ readonly scaled: ReadonlyMap<string, ScaledPage>;
613
+ readonly duplicatedRows: number;
614
+ };
615
+ /** The pages of one window, keyed by form, with each page's door already worked out. */
616
+ export declare const librarySideOf: (window: LibraryWindow) => LibrarySide;
617
+ /**
618
+ * Of the readers who met a kind of part, the share that read it — before and
619
+ * after.
620
+ *
621
+ * Takes each window as its readings and the whole window of door rows a
622
+ * deployment holds for it, because the figure needs the door on both sides: the
623
+ * pages are paired by 0266's rule and each side's terms are put on its own
624
+ * door's scale by 0256's.
625
+ *
626
+ * The labels are the caller's. Two readings of one window and one library come
627
+ * back as every place held, every share identical and nothing gained or lost; a
628
+ * caller who holds the two sides backwards gets a comparison with every movement
629
+ * reversed rather than a refusal, exactly as a before-and-after reading of one
630
+ * page does.
631
+ *
632
+ * Linear in the parts of the readings times the rows, with one pass per window
633
+ * that fills both groupings.
634
+ */
635
+ export declare const libraryReachChangeOf: (was: LibraryWindow, now: LibraryWindow) => LibraryReachChange;
636
+ //# sourceMappingURL=library-reach-change.d.ts.map