@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,523 @@
1
+ import type { AudienceId } from "../audience/audience.js";
2
+ import type { NodeId, TreeId } from "../ids.js";
3
+ import type { PrimitiveType } from "../primitive-type.js";
4
+ import type { PrimitiveRole } from "../role.js";
5
+ import { type FormPairRefusal } from "./audiences.js";
6
+ import { type PassageSide } from "./copy-change.js";
7
+ import { type CopyReading, type Passage } from "./copy.js";
8
+ import { type PageReading, type PartStanding } from "./parts.js";
9
+ /**
10
+ * What two forms of one page *say*, and how much of what each says gets read.
11
+ *
12
+ * The third and last of the readings over a pair of forms. The first holds two
13
+ * forms against each other on each part's reach — did this audience's readers
14
+ * get here (0302). The second asks what they did once they had (0303). This one
15
+ * asks the question the deltas answer most directly: **what does each form say,
16
+ * and of the words the two forms share, which audience's readers reach more of
17
+ * them.** *The pro form says four hundred words in this band and the free form
18
+ * says ninety, and the words both of them say are read twice as far by the
19
+ * riders.*
20
+ *
21
+ * Nothing is collected for it. Two readings go in and a comparison comes out,
22
+ * which makes it the thirty-sixth thing taken out of the server-side join
23
+ * rather than added to a payload, a browser, a column or the vocabulary of
24
+ * kinds.
25
+ *
26
+ * ## What it borrows, which is everything about the pair
27
+ *
28
+ * `FormPairRefusal` and `formPairOf` in [`audiences.ts`](audiences.ts) settle
29
+ * which side is {@link FormCopyComparison.one} and refuse the five pairs that
30
+ * are not two forms of one page. They are imported here exactly as
31
+ * [`form-action.ts`](form-action.ts) imports them, for the reason
32
+ * [0303](../../decisions/0303-what-two-forms-readers-do-is-the-same-pair-at-a-different-counter-and-the-page-has-one-honest-figure.md)
33
+ * published them: every clause of 0302 is about the **pair** — one page, one
34
+ * revision, two provable populations, neither of them earlier — and a third
35
+ * spelling of them would be a third thing for two of them to disagree with.
36
+ * {@link PassageSide} and `passageSideOf` come from
37
+ * [`copy-change.ts`](copy-change.ts) by the same argument, one level down: a
38
+ * passage read by one window is one projection and not two.
39
+ *
40
+ * So what is this module's own is one unit of comparison, one figure over it,
41
+ * and a census.
42
+ *
43
+ * ## The unit: the words both forms say the same way
44
+ *
45
+ * Two forms differ in their text **by construction**, because a form is a base
46
+ * tree plus the deltas an audience earns
47
+ * ([0263](../../decisions/0263-a-page-is-a-base-tree-and-the-deltas-an-audience-earns.md)),
48
+ * so this reading cannot do what its two siblings do and compare every shared
49
+ * part. A band the deltas reworded is two different pieces of text with two
50
+ * different word counts, and a word-weighted figure over it would be reading
51
+ * two populations and two passages at once.
52
+ *
53
+ * So the comparable unit is the **shared** passage — a node both forms have,
54
+ * saying the same words in the same order — which is `copyChangeOf`'s *carried*
55
+ * text with the tree held still and the readership varied instead of the other
56
+ * way round. Identical text on both sides means the only thing that can differ
57
+ * is the reading of it. Everything else is reported rather than compared:
58
+ * {@link FormCopyComparison.reworded} is every shared node the two forms word
59
+ * differently, with both word counts and the form that says more, and
60
+ * {@link FormCopyComparison.onlyIn} is every passage exactly one form has.
61
+ *
62
+ * That census is the half worth having on its own, and unlike every reader
63
+ * figure here it is **exact**: no reader is in it, so neither is the straddle
64
+ * ([0147](../../decisions/0147-a-rollup-is-added-to-what-is-stored-and-a-distinct-view-count-is-therefore-approximate.md)),
65
+ * the view floor or anything a sender could get wrong. *The pro form says three
66
+ * hundred words the free form never sees* is read off two composed trees and no
67
+ * counter at all, which is why it survives a window nobody read.
68
+ *
69
+ * ## The figure, and the direction that is not read off it
70
+ *
71
+ * {@link ComparedFormPassage.gap} is `words × |one.reach − other.reach|` — the
72
+ * words this passage puts in front of one form's average reader over and above
73
+ * the other's. Each side's `reach` is `readers ÷ views` off that side's own
74
+ * rows, so each form's straddle has very nearly divided out before the two
75
+ * populations meet (0221, 0224), and the weighting by words is `copyChangeOf`'s:
76
+ * a long passage a tenth of readers newly reach is worth more than a three-word
77
+ * label all of them do.
78
+ *
79
+ * **The direction is read off the two reaches and not off the gap**, which is
80
+ * this module's one departure from its siblings and is about floors rather than
81
+ * about readers. A type that declares no `copy` leaves a passage short of words
82
+ * nothing here can see
83
+ * ([0122](../../decisions/0122-a-primitive-says-which-of-its-props-a-reader-reads.md)),
84
+ * so {@link ComparedFormPassage.words} is a floor and the gap is a floor with
85
+ * it: the same understatement is on both sides, so it scales the gap toward
86
+ * nought and can report nought where the hidden words differ. The two reaches
87
+ * are exact whatever a library has declared. So *which* form's readers get more
88
+ * of a passage is answered from them, and *how much more* from the words — and
89
+ * {@link ComparedFormPassage.favours} is therefore the field a surface under a
90
+ * floor should trust.
91
+ *
92
+ * ## The page figure, which is a third argument and not either sibling's
93
+ *
94
+ * There are three readings of one pair of forms now and each has a different
95
+ * answer about whether the page as a whole has a figure, which is worth being
96
+ * exact about because the three look alike and are not.
97
+ *
98
+ * - **Reach refuses one** (0302 clause 5). A mean over parts charges one reader
99
+ * once per part they got through, and two forms do not have the same parts.
100
+ * - **What readers did has one from a single row** (0303). Every action
101
+ * anywhere is strictly inside the root
102
+ * ([0242](../../decisions/0242-what-readers-did-is-a-share-off-one-row-and-a-leaf-has-no-inside.md)),
103
+ * so the root's own row is one division per side and no addition at all.
104
+ * - **Words have one because words partition the page**
105
+ * ([0235](../../decisions/0235-how-much-of-a-page-gets-read-is-a-share-of-words-that-partition-it-and-the-typical-reader-is-a-ceiling.md)).
106
+ * A passage's words are its own and never its subtree's, so summing over
107
+ * passages counts each word exactly once and no reader more than the words
108
+ * they reached. {@link FormCopyComparison.typical} is each side's
109
+ * `Σ(readers × words) ÷ views` over the shared passages **both** windows can
110
+ * speak for — one set of words, so the two means are of the same page.
111
+ *
112
+ * **The page's gap is not the sum of the rows' gaps**, and nothing here pretends
113
+ * otherwise. Every row's gap is unsigned, so two passages that favour opposite
114
+ * forms both add to the total of the rows and cancel in the difference of the
115
+ * means. The sum of the rows is *how far apart the two forms are read, passage
116
+ * by passage*; the page figure is *how much of the shared page each form's
117
+ * reader gets to*. A screen that adds the rows up and calls it the page would be
118
+ * reporting the first and labelling it the second.
119
+ *
120
+ * Pure, linear in the parts of the two readings, and reaches no store, clock or
121
+ * DOM. A caller checks `PageReading.orphaned` on both readings before trusting
122
+ * either, exactly as it must before trusting either on its own.
123
+ */
124
+ /** Why a comparison of what two forms say answered nothing, or less than all of it. */
125
+ export type FormCopySilence =
126
+ /**
127
+ * The five states in which two readings are not two forms of one page.
128
+ *
129
+ * Imported from {@link FormPairRefusal} rather than restated, for the reason
130
+ * the module documentation gives: every one of them is a fact about the pair
131
+ * and none of them is about the counter.
132
+ */
133
+ FormPairRefusal
134
+ /**
135
+ * Neither form says anything that could have been read.
136
+ *
137
+ * Checked before the view floor, as the comparison of two windows checks it
138
+ * (0235): a page that says nothing goes on saying nothing after a sender is
139
+ * fixed, so reporting it first loses nothing and names the half somebody can
140
+ * do something about. A single pair can be in both states and this is the
141
+ * sharper of the two.
142
+ */
143
+ | "wordless"
144
+ /**
145
+ * One of the two windows held no page views.
146
+ *
147
+ * Every standing on that side is `unknown` and that side has no `reach`
148
+ * (`parts.ts`), so there is nothing to compare. **The census still answers**,
149
+ * which is what this member has in common with its spelling everywhere else:
150
+ * *the pro form says three hundred words the free form does not, and nothing
151
+ * has been measured on either* is true and is worth saying.
152
+ */
153
+ | "nothing-measured"
154
+ /**
155
+ * A passage reports more readers than its side of the page has views.
156
+ *
157
+ * Carried through from whichever copy reading said it (0235), where it is the
158
+ * alarm for a reading assembled by hand or by a sender that is not one. The
159
+ * per-passage figures are left in place rather than hidden, because a `reach`
160
+ * above 1 is the visible evidence and withholding it would hide the fault
161
+ * while leaving the screen drawable.
162
+ */
163
+ | "inconsistent"
164
+ /**
165
+ * The two forms say no passage the same way.
166
+ *
167
+ * Every passage is reworded, or is in one form only, so there is no shared
168
+ * text for a reader figure to be about. The census answers in full and is the
169
+ * whole of what can be said: two forms that share a tree and no sentence are
170
+ * two pages the deltas made, and *that* is the answer rather than a silence
171
+ * about readers.
172
+ *
173
+ * Checked before {@link FormCopySilence.unspoken}, which it implies — no
174
+ * shared word at all is no shared word either window can speak for — because
175
+ * a fact about the deltas is the stronger thing to say and the only one of the
176
+ * two with a remedy a deployment holds.
177
+ */
178
+ | "unshared"
179
+ /**
180
+ * No shared word of the page can be spoken for in both windows.
181
+ *
182
+ * Every shared passage is `unknown` on one side or the other, so not one of
183
+ * them has two reaches that are both a measurement. `unknown` is *nothing can
184
+ * be said* and never *nobody reached it* (0212), so a figure over nought
185
+ * spoken-for words would publish two forms reading alike where the honest
186
+ * answer is that the pair cannot say.
187
+ *
188
+ * The words are in {@link FormCopyComparison.wordsCounted} under `unknown`,
189
+ * which is where a surface sees how much of the shared page is in this state
190
+ * without acting on it.
191
+ */
192
+ | "unspoken"
193
+ /**
194
+ * Some shared passage's words are a floor, so the page figures are neither
195
+ * counts nor ceilings.
196
+ *
197
+ * The reason is the module documentation's and it is about the **page** and
198
+ * not the rows: each side's mean is understated by the hidden words of each
199
+ * passage weighted by that side's own readers, which is a different amount per
200
+ * side, so the difference between the two means can read the wrong way round.
201
+ * Each row's own gap and the form it favours are unaffected and stay
202
+ * published, which is the same split `copyChangeOf` makes under a floor and
203
+ * for the same arithmetic.
204
+ */
205
+ | "floored";
206
+ /** The closed set, for a surface that has to account for every absent figure. */
207
+ export declare const FORM_COPY_SILENCES: readonly FormCopySilence[];
208
+ /** One line per silence, for a surface saying why a figure is not there. */
209
+ export declare const describeFormCopySilence: (silence: FormCopySilence) => string;
210
+ /** One side of the comparison, as the copy reading of that form leaves it. */
211
+ export type FormCopySide = {
212
+ readonly treeId: TreeId;
213
+ readonly revision: number;
214
+ /** `null` where the window named none, or named two with neither asked for. */
215
+ readonly audienceId: AudienceId | null;
216
+ /**
217
+ * That side's page-view floor, which is the denominator of every reach below.
218
+ *
219
+ * A floor rather than a count, for the reason `parts.ts` gives: distinct view
220
+ * counts cannot be added across rows (0147), so the largest row is the most
221
+ * that can be said from counters alone.
222
+ */
223
+ readonly views: number;
224
+ /**
225
+ * Every word this form says, counted once.
226
+ *
227
+ * {@link WordsOfForms} accounts for all of them: this side's share of
228
+ * `shared`, of `only` and of `reworded` add to it exactly, which is the
229
+ * property that makes the census a census rather than three lists.
230
+ */
231
+ readonly words: number;
232
+ /** Passages this form has that say something, which two forms need not share. */
233
+ readonly passages: number;
234
+ /** Words this form says in parts its own window can speak for (0287). */
235
+ readonly spoken: number;
236
+ };
237
+ /** A passage exactly one of the two forms has, with the form that has it named. */
238
+ export type PassageOfForm = {
239
+ readonly nodeId: NodeId;
240
+ readonly type: PrimitiveType;
241
+ readonly role: PrimitiveRole | null;
242
+ /** The form this passage is in. The other form does not have this node at all. */
243
+ readonly audienceId: AudienceId;
244
+ /** The passage itself, as that form's own window read it. */
245
+ readonly passage: Passage;
246
+ /** What that form's window said about reaching it. */
247
+ readonly side: PassageSide;
248
+ };
249
+ /**
250
+ * One passage both forms say, word for word, as each form's own readers read it.
251
+ *
252
+ * The comparable unit of this module. The text is identical on both sides, so
253
+ * nothing here is about the deltas having said something different and
254
+ * everything is about which readership gets to it.
255
+ */
256
+ export type ComparedFormPassage = {
257
+ readonly nodeId: NodeId;
258
+ /** The type {@link FormCopyComparison.one} gives it; `disagreed` names the pair if the other differs. */
259
+ readonly type: PrimitiveType;
260
+ readonly role: PrimitiveRole | null;
261
+ /** The words, the same number on both sides because they are the same words. */
262
+ readonly words: number;
263
+ /** The text itself, so a passage can be quoted back without a second join. */
264
+ readonly text: readonly string[];
265
+ /**
266
+ * Whether either form's part declares no `copy`, so {@link words} is a floor.
267
+ *
268
+ * The visible words are the same on both sides; what a floor withholds is
269
+ * whether there are more. A form may be floored where the other is not, when
270
+ * a prop no type declares holds something for one audience and nothing for
271
+ * the other — so this is either side, and the figures it qualifies are
272
+ * qualified for both.
273
+ */
274
+ readonly floored: boolean;
275
+ readonly one: PassageSide;
276
+ readonly other: PassageSide;
277
+ /**
278
+ * The form whose readers reached this passage more often, or `null` where no
279
+ * claim stands.
280
+ *
281
+ * **Read off the two reaches rather than off {@link gap}**, which is the
282
+ * module documentation's one departure from the two sibling comparisons: a
283
+ * reach is exact where a word count is a floor (0122), so the direction
284
+ * survives an undeclared `copy` prop and the magnitude does not.
285
+ *
286
+ * `null` with a `gap` of nought is the two forms reaching it alike; `null`
287
+ * with a `gap` of `null` is nothing being sayable. The two are a long way
288
+ * apart and are deliberately not one value.
289
+ */
290
+ readonly favours: AudienceId | null;
291
+ /**
292
+ * The words this passage puts in front of one form's average reader over and
293
+ * above the other's: `words × |one.reach − other.reach|`.
294
+ *
295
+ * Never signed — the direction is in {@link favours}, because a sign is read
296
+ * against an order and the order here is the alphabet of two audience names
297
+ * and means nothing (0302).
298
+ *
299
+ * `null` where either side held no views **or** either side's standing is
300
+ * `unknown` (0282): a reach of nought that is a missing counter is not a
301
+ * reader who did not arrive, and subtracting against it would publish the
302
+ * other form's whole reach as a difference between two populations.
303
+ *
304
+ * A floor on {@link words} scales it toward nought and cannot change the form
305
+ * it is about, so it is published where the page figures are withheld.
306
+ */
307
+ readonly gap: number | null;
308
+ };
309
+ /**
310
+ * One passage both forms have and neither says the same way.
311
+ *
312
+ * Kept and reported rather than dropped, for the reason `copyChangeOf` keeps a
313
+ * reworded passage: *the two forms say different things here* is the answer
314
+ * somebody most needs, and a comparison that silently kept only the text the
315
+ * deltas left alone would be quietest about the passages the deltas were
316
+ * actually aimed at.
317
+ *
318
+ * No {@link ComparedFormPassage.gap}, because a word-weighted figure needs one
319
+ * word count and there are two. The standings and the reaches are each true of
320
+ * their own form and are carried, with the rewording as the confound a reader
321
+ * of them has to hold: a passage that is shorter for one audience is easier for
322
+ * that audience to finish, so a difference here is not attributable the way a
323
+ * shared passage's is.
324
+ */
325
+ export type RewordedFormPassage = {
326
+ readonly nodeId: NodeId;
327
+ /** The type {@link FormCopyComparison.one} gives it. */
328
+ readonly type: PrimitiveType;
329
+ readonly role: PrimitiveRole | null;
330
+ /** The two word counts, which is why there is no single one. */
331
+ readonly words: {
332
+ readonly one: number;
333
+ readonly other: number;
334
+ };
335
+ /** Whether either form declares no `copy`, so its word count is a floor. */
336
+ readonly floored: boolean;
337
+ readonly one: PassageSide;
338
+ readonly other: PassageSide;
339
+ /**
340
+ * The form that says more words here, or `null` where the two say as many
341
+ * words differently.
342
+ *
343
+ * The sentence this whole reading was asked for — *the pro form says four
344
+ * hundred words in this band and the free form says ninety* — published
345
+ * rather than left to a surface to subtract, so that two screens cannot
346
+ * disagree about which way round it is. It is a fact about the deltas and
347
+ * about no reader, and under a floor it is the one claim here that can be
348
+ * wrong: an undeclared `copy` prop understates one side only.
349
+ */
350
+ readonly wordier: AudienceId | null;
351
+ };
352
+ /**
353
+ * What the two forms say, and what the deltas gave only one of them.
354
+ *
355
+ * **Exact.** No reader is in any of these figures, so none of them carries the
356
+ * straddle (0147), the view floor (0212) or the traffic sensitivity a standing
357
+ * has. The two composed trees say this between them, and a window with no views
358
+ * at all reports it in full.
359
+ *
360
+ * Deliberately not spelled as a change's census: there is no `added` and no
361
+ * `removed`, because neither form is earlier and one audience's extra band is
362
+ * not a band anybody wrote last. What a change wrote is `CopyChange.wrote`, and
363
+ * the two are different questions with the same arithmetic underneath.
364
+ */
365
+ export type WordsOfForms = {
366
+ /** Words both forms say, word for word, in a node both forms have. */
367
+ readonly shared: number;
368
+ /** Words of passages exactly one form has, by form. */
369
+ readonly only: {
370
+ readonly one: number;
371
+ readonly other: number;
372
+ };
373
+ /**
374
+ * Those words, by what each form's own window said about reaching them. Each
375
+ * form's three add to its own {@link only}.
376
+ *
377
+ * *Of the three hundred words the pro form says and the free form never sees,
378
+ * forty have been reached.* It is the one figure here about words the other
379
+ * form's readers could not have read, so it has no comparison and needs none.
380
+ */
381
+ readonly onlyByStanding: {
382
+ readonly one: Readonly<Record<PartStanding, number>>;
383
+ readonly other: Readonly<Record<PartStanding, number>>;
384
+ };
385
+ /** Words of passages both forms have and neither says the same way, by form. */
386
+ readonly reworded: {
387
+ readonly one: number;
388
+ readonly other: number;
389
+ };
390
+ };
391
+ /** How the shared passages fell, as a count over one set and never a mean. */
392
+ export type FormCopyCounted = {
393
+ /** Passages {@link FormCopyComparison.one}'s readers reached more often. */
394
+ readonly one: number;
395
+ /** Passages {@link FormCopyComparison.other}'s readers reached more often. */
396
+ readonly other: number;
397
+ /** Passages the two forms reached alike. */
398
+ readonly alike: number;
399
+ /** Passages where one form or the other cannot say. */
400
+ readonly unknown: number;
401
+ };
402
+ /**
403
+ * The shared words each form's average reader got to, and the distance between
404
+ * them.
405
+ *
406
+ * The one page-level claim this reading makes, sound because a passage's words
407
+ * are its own and partition the page exactly once (0235). Both sides are over
408
+ * **one** set of passages — the shared ones both windows can speak for — so the
409
+ * two means are of the same words and are comparable in the way two whole-page
410
+ * means over two forms' own parts would not be.
411
+ */
412
+ export type SharedWordsRead = {
413
+ /** `Σ(readers × words) ÷ views` for {@link FormCopyComparison.one}. */
414
+ readonly one: number;
415
+ /** The same for {@link FormCopyComparison.other}. */
416
+ readonly other: number;
417
+ /**
418
+ * `|one − other|`, with the direction in {@link favours}.
419
+ *
420
+ * **Not the sum of the rows' gaps**, and the difference is the module
421
+ * documentation's: a row's gap is unsigned, so two passages favouring opposite
422
+ * forms add there and cancel here.
423
+ */
424
+ readonly gap: number;
425
+ /** The form whose average reader got to more of the shared words. */
426
+ readonly favours: AudienceId | null;
427
+ };
428
+ /**
429
+ * What two forms of one page say, and how much of the shared text each one's
430
+ * readers reach.
431
+ *
432
+ * There is no `treeId` or `revision` at the top, where every reading of one
433
+ * page has one, for the reason 0302 gives: this is a reading of two sides
434
+ * rather than of one page, and the two refusals that matter most are exactly
435
+ * the two where picking one side's would be picking one of two answers.
436
+ */
437
+ export type FormCopyComparison = {
438
+ /** The side whose audience id sorts lower, or the first argument where no pair of names stands. */
439
+ readonly one: FormCopySide;
440
+ readonly other: FormCopySide;
441
+ /** The two copy readings this comparison was taken from, so nothing downstream derives them twice. */
442
+ readonly readings: {
443
+ readonly one: CopyReading;
444
+ readonly other: CopyReading;
445
+ };
446
+ /** The census of what each form says, with no reader in it. */
447
+ readonly says: WordsOfForms;
448
+ /** Passages both forms say the same way, in the reading order of {@link one}. */
449
+ readonly compared: readonly ComparedFormPassage[];
450
+ /** Passages both forms have and neither says the same way, in the same order. */
451
+ readonly reworded: readonly RewordedFormPassage[];
452
+ /** Passages exactly one form has, by audience and then by node. */
453
+ readonly onlyIn: readonly PassageOfForm[];
454
+ /**
455
+ * Shared nodes the two forms give different primitive types.
456
+ *
457
+ * Reported and not dropped, as both sibling comparisons report it: the two
458
+ * reaches are each their own form's and stay comparable, while a node that is
459
+ * a band on one side and a card on the other is a fact about the deltas
460
+ * nobody would otherwise see.
461
+ */
462
+ readonly disagreed: readonly NodeId[];
463
+ /** Shared passages by which form's readers reached them more often. */
464
+ readonly counted: FormCopyCounted;
465
+ /**
466
+ * The words those passages say, falling the same way. The four add to
467
+ * {@link WordsOfForms.shared}.
468
+ *
469
+ * Published beside {@link counted} because the two survive different things:
470
+ * a count of passages is right under a floor — a part that declares no `copy`
471
+ * is one part whatever it is hiding — and a count of words is not. A surface
472
+ * that has to be right about mass reads this row and a surface that has to be
473
+ * right under a floor reads the other.
474
+ */
475
+ readonly wordsCounted: FormCopyCounted;
476
+ /** Shared passages whose words are a floor. */
477
+ readonly floored: number;
478
+ /**
479
+ * The shared passages neither form's readers reached, most words first and
480
+ * then in reading order.
481
+ *
482
+ * The words the deltas have not managed to put in front of anybody, which is
483
+ * the list a person can act on without reading anything else. Ranked by words
484
+ * for the reason one window's reading ranks them (0235): the passage nobody
485
+ * saw that costs the page most is the long one, not the first one.
486
+ *
487
+ * `skipped` on **both** sides only. A passage `unknown` on either side is in
488
+ * {@link wordsCounted} where it can be seen and not acted on, because putting
489
+ * it here would turn *nothing can be said* into *nobody read this*.
490
+ */
491
+ readonly unseenByEither: readonly ComparedFormPassage[];
492
+ /** The shared words each form's average reader got to; `null` where {@link silence} says why not. */
493
+ readonly typical: SharedWordsRead | null;
494
+ /**
495
+ * The shared passage the two forms read most differently, by node id where
496
+ * two tie.
497
+ *
498
+ * By {@link ComparedFormPassage.gap} — words weighted by readers — rather than
499
+ * by the difference in reach, which is the ranking rule a fall between two
500
+ * siblings already uses (0221). There is no page row to exclude here, which
501
+ * both siblings have: a passage's words are its own and never its subtree's,
502
+ * so the root's passage is one row among the others and contains none of them.
503
+ */
504
+ readonly sharpest: ComparedFormPassage | null;
505
+ readonly silence: FormCopySilence | null;
506
+ };
507
+ /**
508
+ * Hold what two forms of one page say, and the reading of what they share,
509
+ * against each other.
510
+ *
511
+ * Takes two page readings, each of one audience, of one tree at one revision,
512
+ * and derives a copy reading of each — handed two readings rather than two
513
+ * finished `CopyReading`s for the reason `copyChangeOf` is: one input per side
514
+ * cannot be a mismatched pair, the census needs the parts a copy reading leaves
515
+ * out, and the two it derives travel on the comparison so nothing downstream
516
+ * pays for them twice.
517
+ *
518
+ * The labels are not `was` and `now` and the order of the arguments does not
519
+ * reach the answer: see `formPairOf`, and {@link FormCopySilence} for the eleven
520
+ * states in which there is no figure.
521
+ */
522
+ export declare const formCopyComparisonOf: (one: PageReading, other: PageReading) => FormCopyComparison;
523
+ //# sourceMappingURL=form-copy.d.ts.map