@jam-overture/loom 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/application/application.d.ts +109 -0
- package/dist/application/application.js +97 -0
- package/dist/application/memory.d.ts +20 -0
- package/dist/application/memory.js +79 -0
- package/dist/application/store.d.ts +101 -0
- package/dist/application/store.js +25 -0
- package/dist/audience/audience.d.ts +36 -0
- package/dist/audience/audience.js +41 -0
- package/dist/audience/compose.d.ts +112 -0
- package/dist/audience/compose.js +134 -0
- package/dist/audience/memory.d.ts +14 -0
- package/dist/audience/memory.js +71 -0
- package/dist/audience/overlay-store.d.ts +343 -0
- package/dist/audience/overlay-store.js +217 -0
- package/dist/audience/rule.d.ts +121 -0
- package/dist/audience/rule.js +78 -0
- package/dist/cli/index.d.ts +3 -4
- package/dist/cli/index.js +3 -4
- package/dist/cli/templates.js +19 -0
- package/dist/data/adapter.d.ts +9 -1
- package/dist/data/adapter.js +2 -0
- package/dist/data/plan.js +0 -0
- package/dist/data/resolution.d.ts +23 -1
- package/dist/data/resolve.d.ts +31 -4
- package/dist/data/resolve.js +11 -3
- package/dist/ids.d.ts +10 -0
- package/dist/ids.js +11 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/interpretation/anthropic.d.ts +1 -1
- package/dist/interpretation/anthropic.js +2 -22
- package/dist/interpretation/client.d.ts +1 -1
- package/dist/interpretation/materialize.js +67 -22
- package/dist/interpretation/openai-compatible.d.ts +36 -0
- package/dist/interpretation/openai-compatible.js +79 -0
- package/dist/interpretation/status.d.ts +19 -0
- package/dist/interpretation/status.js +26 -0
- package/dist/live/index.d.ts +73 -0
- package/dist/live/index.js +73 -0
- package/dist/live/pages.d.ts +187 -0
- package/dist/live/pages.js +161 -0
- package/dist/live/pull.d.ts +147 -0
- package/dist/live/pull.js +398 -0
- package/dist/live/pulling.d.ts +79 -0
- package/dist/live/pulling.js +117 -0
- package/dist/live/window.d.ts +129 -0
- package/dist/live/window.js +132 -0
- package/dist/patch.d.ts +54 -0
- package/dist/patch.js +44 -0
- package/dist/project/closing.d.ts +51 -0
- package/dist/project/closing.js +53 -0
- package/dist/project/memory.d.ts +20 -0
- package/dist/project/memory.js +97 -0
- package/dist/project/project.d.ts +90 -0
- package/dist/project/project.js +91 -0
- package/dist/project/store.d.ts +135 -0
- package/dist/project/store.js +41 -0
- package/dist/registered.d.ts +64 -0
- package/dist/registered.js +118 -0
- package/dist/render/addressed.d.ts +35 -0
- package/dist/render/addressed.js +79 -0
- package/dist/render/behaviour-adjust.d.ts +11 -19
- package/dist/render/behaviour-adjust.js +75 -21
- package/dist/render/behaviour-present.d.ts +8 -0
- package/dist/render/behaviour-present.js +57 -6
- package/dist/render/behaviour.d.ts +98 -17
- package/dist/render/behaviour.js +91 -26
- package/dist/render/control-name.d.ts +68 -0
- package/dist/render/control-name.js +37 -0
- package/dist/render/diagnostics.d.ts +72 -0
- package/dist/render/diagnostics.js +7 -0
- package/dist/render/document-theme.d.ts +70 -0
- package/dist/render/document-theme.js +139 -0
- package/dist/render/editable.d.ts +15 -1
- package/dist/render/editable.js +13 -1
- package/dist/render/expected.d.ts +98 -0
- package/dist/render/expected.js +88 -0
- package/dist/render/index.d.ts +4 -0
- package/dist/render/index.js +4 -0
- package/dist/render/reads.d.ts +11 -0
- package/dist/render/reads.js +12 -1
- package/dist/render/render.d.ts +11 -0
- package/dist/render/render.js +294 -53
- package/dist/render/request.d.ts +8 -1
- package/dist/render/request.js +1 -0
- package/dist/render/slots.d.ts +52 -0
- package/dist/render/slots.js +24 -0
- package/dist/render/theme.d.ts +54 -1
- package/dist/render/theme.js +23 -1
- package/dist/render/unshown.d.ts +152 -0
- package/dist/render/unshown.js +80 -0
- package/dist/runtime/analysis.d.ts +94 -9
- package/dist/runtime/analysis.js +54 -9
- package/dist/runtime/assessment.d.ts +36 -2
- package/dist/runtime/assessment.js +27 -2
- package/dist/runtime/auto-apply-ceiling.d.ts +54 -0
- package/dist/runtime/auto-apply-ceiling.js +66 -0
- package/dist/runtime/checks.d.ts +148 -0
- package/dist/runtime/checks.js +112 -0
- package/dist/runtime/disposition.d.ts +96 -0
- package/dist/runtime/disposition.js +46 -0
- package/dist/runtime/gate.js +91 -10
- package/dist/runtime/index.d.ts +4 -0
- package/dist/runtime/index.js +4 -0
- package/dist/runtime/irreversibility.d.ts +64 -0
- package/dist/runtime/irreversibility.js +45 -0
- package/dist/runtime/nesting.d.ts +13 -1
- package/dist/runtime/nesting.js +41 -24
- package/dist/runtime/pipeline.d.ts +43 -0
- package/dist/runtime/pipeline.js +10 -2
- package/dist/runtime/policy-change.d.ts +93 -0
- package/dist/runtime/policy-change.js +305 -0
- package/dist/runtime/policy-log.d.ts +406 -0
- package/dist/runtime/policy-log.js +285 -0
- package/dist/runtime/policy.d.ts +8 -6
- package/dist/runtime/policy.js +5 -2
- package/dist/runtime/repointing.js +0 -0
- package/dist/runtime/reversibility.d.ts +11 -9
- package/dist/runtime/stakes.d.ts +129 -1
- package/dist/runtime/stakes.js +240 -26
- package/dist/runtime/vocabulary.d.ts +164 -7
- package/dist/runtime/vocabulary.js +181 -8
- package/dist/sdk/audit.d.ts +174 -3
- package/dist/sdk/audit.js +176 -17
- package/dist/sdk/catalogue.d.ts +9 -1
- package/dist/sdk/conformance.d.ts +37 -3
- package/dist/sdk/conformance.js +25 -4
- package/dist/sdk/definition.d.ts +129 -5
- package/dist/sdk/definition.js +66 -0
- package/dist/sdk/registry.d.ts +45 -2
- package/dist/sdk/registry.js +102 -1
- package/dist/signals/acted.contract.d.ts +21 -0
- package/dist/signals/acted.contract.js +236 -0
- package/dist/signals/acted.d.ts +359 -0
- package/dist/signals/acted.js +135 -0
- package/dist/signals/action-change.d.ts +507 -0
- package/dist/signals/action-change.js +265 -0
- package/dist/signals/action.d.ts +331 -0
- package/dist/signals/action.js +182 -0
- package/dist/signals/agenda.d.ts +585 -0
- package/dist/signals/agenda.js +295 -0
- package/dist/signals/applied-window.contract.d.ts +23 -0
- package/dist/signals/applied-window.contract.js +160 -0
- package/dist/signals/arrivals.contract.d.ts +21 -0
- package/dist/signals/arrivals.contract.js +180 -0
- package/dist/signals/arrivals.d.ts +375 -0
- package/dist/signals/arrivals.js +254 -0
- package/dist/signals/arriving.d.ts +210 -0
- package/dist/signals/arriving.js +133 -0
- package/dist/signals/audiences.d.ts +528 -0
- package/dist/signals/audiences.js +255 -0
- package/dist/signals/broadcast.d.ts +33 -17
- package/dist/signals/broadcast.js +255 -32
- package/dist/signals/change.d.ts +378 -0
- package/dist/signals/change.js +327 -0
- package/dist/signals/collect.d.ts +169 -34
- package/dist/signals/collect.js +186 -38
- package/dist/signals/conversion.d.ts +348 -0
- package/dist/signals/conversion.js +235 -0
- package/dist/signals/copy-change.d.ts +553 -0
- package/dist/signals/copy-change.js +377 -0
- package/dist/signals/copy.d.ts +337 -0
- package/dist/signals/copy.js +211 -0
- package/dist/signals/correlated.contract.d.ts +24 -0
- package/dist/signals/correlated.contract.js +94 -0
- package/dist/signals/counters.d.ts +97 -0
- package/dist/signals/counters.js +160 -0
- package/dist/signals/deliver.d.ts +23 -4
- package/dist/signals/deliver.js +34 -6
- package/dist/signals/deployment-change.d.ts +395 -0
- package/dist/signals/deployment-change.js +309 -0
- package/dist/signals/deployment.d.ts +278 -0
- package/dist/signals/deployment.js +178 -0
- package/dist/signals/door.d.ts +114 -0
- package/dist/signals/door.js +77 -0
- package/dist/signals/expire.d.ts +192 -0
- package/dist/signals/expire.js +213 -0
- package/dist/signals/fold.d.ts +10 -0
- package/dist/signals/fold.js +5 -1
- package/dist/signals/form-action.d.ts +302 -0
- package/dist/signals/form-action.js +169 -0
- package/dist/signals/form-copy.d.ts +523 -0
- package/dist/signals/form-copy.js +346 -0
- package/dist/signals/forms.d.ts +247 -0
- package/dist/signals/forms.js +147 -0
- package/dist/signals/frontier.d.ts +268 -0
- package/dist/signals/frontier.js +145 -0
- package/dist/signals/funnel-change.d.ts +548 -0
- package/dist/signals/funnel-change.js +361 -0
- package/dist/signals/funnel-hours.contract.d.ts +21 -0
- package/dist/signals/funnel-hours.contract.js +221 -0
- package/dist/signals/funnel-hours.d.ts +293 -0
- package/dist/signals/funnel-hours.js +99 -0
- package/dist/signals/funnel.d.ts +592 -0
- package/dist/signals/funnel.js +231 -0
- package/dist/signals/health.d.ts +694 -0
- package/dist/signals/health.js +573 -0
- package/dist/signals/index.d.ts +60 -0
- package/dist/signals/index.js +60 -0
- package/dist/signals/ingest.d.ts +56 -1
- package/dist/signals/ingest.js +91 -1
- package/dist/signals/inside.d.ts +190 -0
- package/dist/signals/inside.js +263 -0
- package/dist/signals/join.d.ts +56 -0
- package/dist/signals/join.js +60 -0
- package/dist/signals/journal.d.ts +123 -9
- package/dist/signals/kept.contract.d.ts +22 -0
- package/dist/signals/kept.contract.js +111 -0
- package/dist/signals/kinds.d.ts +8 -6
- package/dist/signals/kinds.js +14 -6
- package/dist/signals/library-action.d.ts +430 -0
- package/dist/signals/library-action.js +336 -0
- package/dist/signals/library-agenda-change.d.ts +324 -0
- package/dist/signals/library-agenda-change.js +199 -0
- package/dist/signals/library-agenda.d.ts +258 -0
- package/dist/signals/library-agenda.js +167 -0
- package/dist/signals/library-change.d.ts +477 -0
- package/dist/signals/library-change.js +335 -0
- package/dist/signals/library-copy-change.d.ts +498 -0
- package/dist/signals/library-copy-change.js +476 -0
- package/dist/signals/library-pace.d.ts +319 -0
- package/dist/signals/library-pace.js +305 -0
- package/dist/signals/library-reach-change.d.ts +646 -0
- package/dist/signals/library-reach-change.js +542 -0
- package/dist/signals/library-reach.d.ts +377 -0
- package/dist/signals/library-reach.js +227 -0
- package/dist/signals/library-senders-change.d.ts +457 -0
- package/dist/signals/library-senders-change.js +367 -0
- package/dist/signals/library-senders-reach-change.d.ts +486 -0
- package/dist/signals/library-senders-reach-change.js +538 -0
- package/dist/signals/library-senders-reach.d.ts +340 -0
- package/dist/signals/library-senders-reach.js +252 -0
- package/dist/signals/library-senders.d.ts +271 -0
- package/dist/signals/library-senders.js +180 -0
- package/dist/signals/library-word-reach-change.d.ts +567 -0
- package/dist/signals/library-word-reach-change.js +564 -0
- package/dist/signals/library.d.ts +306 -0
- package/dist/signals/library.js +178 -0
- package/dist/signals/memory.d.ts +9 -0
- package/dist/signals/memory.js +246 -14
- package/dist/signals/migrate.d.ts +20 -4
- package/dist/signals/migrate.js +269 -8
- package/dist/signals/notice.d.ts +389 -0
- package/dist/signals/notice.js +250 -0
- package/dist/signals/pace-change.d.ts +501 -0
- package/dist/signals/pace-change.js +310 -0
- package/dist/signals/pace.d.ts +296 -0
- package/dist/signals/pace.js +291 -0
- package/dist/signals/page-views.d.ts +365 -0
- package/dist/signals/page-views.js +218 -0
- package/dist/signals/part-pace.d.ts +378 -0
- package/dist/signals/part-pace.js +333 -0
- package/dist/signals/parts.d.ts +354 -0
- package/dist/signals/parts.js +232 -0
- package/dist/signals/postgres.d.ts +16 -2
- package/dist/signals/postgres.js +753 -76
- package/dist/signals/progress.d.ts +212 -0
- package/dist/signals/progress.js +150 -0
- package/dist/signals/ratios.d.ts +108 -0
- package/dist/signals/ratios.js +40 -0
- package/dist/signals/reach.d.ts +309 -0
- package/dist/signals/reach.js +93 -0
- package/dist/signals/readable.d.ts +34 -0
- package/dist/signals/readable.js +34 -0
- package/dist/signals/readership.d.ts +381 -0
- package/dist/signals/readership.js +308 -0
- package/dist/signals/region-pages.d.ts +173 -0
- package/dist/signals/region-pages.js +62 -0
- package/dist/signals/region.d.ts +287 -0
- package/dist/signals/region.js +198 -0
- package/dist/signals/retention.d.ts +163 -0
- package/dist/signals/retention.js +75 -0
- package/dist/signals/rhythm.d.ts +302 -0
- package/dist/signals/rhythm.js +262 -0
- package/dist/signals/rollup.d.ts +194 -4
- package/dist/signals/rollup.js +0 -0
- package/dist/signals/schema.d.ts +1069 -1
- package/dist/signals/schema.js +393 -3
- package/dist/signals/signal.d.ts +237 -11
- package/dist/signals/signal.js +70 -10
- package/dist/signals/silence-census.d.ts +205 -0
- package/dist/signals/silence-census.js +87 -0
- package/dist/signals/silences.d.ts +1147 -0
- package/dist/signals/silences.js +996 -0
- package/dist/signals/subtrees.d.ts +123 -0
- package/dist/signals/subtrees.js +102 -0
- package/dist/signals/tally.d.ts +262 -12
- package/dist/signals/unread.d.ts +292 -0
- package/dist/signals/unread.js +137 -0
- package/dist/signals/window-agenda.d.ts +276 -0
- package/dist/signals/window-agenda.js +83 -0
- package/dist/signals/window-figures.d.ts +148 -0
- package/dist/signals/window-figures.js +42 -0
- package/dist/signals/window-funnels.d.ts +88 -0
- package/dist/signals/window-funnels.js +47 -0
- package/dist/signals/window.d.ts +866 -0
- package/dist/signals/window.js +693 -0
- package/dist/signals/words.d.ts +24 -0
- package/dist/signals/words.js +24 -0
- package/dist/store/cache.d.ts +101 -0
- package/dist/store/cache.js +149 -0
- package/dist/store/history.d.ts +82 -0
- package/dist/store/history.js +36 -0
- package/dist/store/index.d.ts +30 -0
- package/dist/store/index.js +30 -0
- package/dist/store/memory.d.ts +2 -1
- package/dist/store/memory.js +48 -12
- package/dist/store/migrate.d.ts +106 -0
- package/dist/store/migrate.js +323 -7
- package/dist/store/postgres-applications.d.ts +4 -0
- package/dist/store/postgres-applications.js +197 -0
- package/dist/store/postgres-audience.d.ts +14 -0
- package/dist/store/postgres-audience.js +272 -0
- package/dist/store/postgres-holds.d.ts +10 -1
- package/dist/store/postgres-holds.js +116 -101
- package/dist/store/postgres-policy-log.d.ts +14 -0
- package/dist/store/postgres-policy-log.js +240 -0
- package/dist/store/postgres-projects.d.ts +4 -0
- package/dist/store/postgres-projects.js +217 -0
- package/dist/store/postgres.d.ts +17 -1
- package/dist/store/postgres.js +60 -9
- package/dist/store/replay.d.ts +102 -1
- package/dist/store/replay.js +190 -19
- package/dist/store/reseed.d.ts +238 -0
- package/dist/store/reseed.js +308 -0
- package/dist/store/schema.d.ts +762 -2
- package/dist/store/schema.js +218 -5
- package/dist/store/source.d.ts +57 -1
- package/dist/store/source.js +65 -1
- package/dist/store/store.d.ts +29 -6
- package/dist/submit/resolve.d.ts +1 -1
- package/dist/submit/resolve.js +2 -1
- package/dist/telemetry/calibration.d.ts +25 -0
- package/dist/telemetry/calibration.js +27 -1
- package/dist/telemetry/event.d.ts +391 -33
- package/dist/telemetry/event.js +84 -20
- package/dist/telemetry/index.d.ts +2 -0
- package/dist/telemetry/index.js +2 -0
- package/dist/telemetry/journal.d.ts +104 -3
- package/dist/telemetry/journal.js +9 -0
- package/dist/telemetry/lookup.d.ts +27 -0
- package/dist/telemetry/lookup.js +18 -0
- package/dist/telemetry/memory.js +33 -1
- package/dist/telemetry/migrate.js +22 -1
- package/dist/telemetry/postgres.d.ts +10 -1
- package/dist/telemetry/postgres.js +188 -90
- package/dist/telemetry/remeasure.d.ts +78 -0
- package/dist/telemetry/remeasure.js +83 -0
- package/dist/telemetry/retention.d.ts +2 -2
- package/dist/telemetry/schema.d.ts +17 -0
- package/dist/telemetry/schema.js +27 -1
- package/dist/telemetry/sink.d.ts +2 -2
- package/dist/telemetry/window.d.ts +135 -0
- package/dist/telemetry/window.js +101 -0
- package/dist/testing/application-contract.d.ts +14 -0
- package/dist/testing/application-contract.js +270 -0
- package/dist/testing/audience-overlay-contract.d.ts +31 -0
- package/dist/testing/audience-overlay-contract.js +354 -0
- package/dist/testing/contracts.d.ts +13 -7
- package/dist/testing/contracts.js +13 -7
- package/dist/testing/definitions.d.ts +78 -0
- package/dist/testing/definitions.js +134 -9
- package/dist/testing/doubles.d.ts +103 -0
- package/dist/testing/doubles.js +143 -0
- package/dist/testing/index.d.ts +2 -2
- package/dist/testing/index.js +2 -2
- package/dist/testing/journal-contract.js +297 -6
- package/dist/testing/model-contract.d.ts +110 -0
- package/dist/testing/model-contract.js +150 -0
- package/dist/testing/policy-log-contract.d.ts +26 -0
- package/dist/testing/policy-log-contract.js +344 -0
- package/dist/testing/project-contract.d.ts +14 -0
- package/dist/testing/project-contract.js +266 -0
- package/dist/testing/reader-signal-contract.d.ts +27 -2
- package/dist/testing/reader-signal-contract.js +475 -5
- package/dist/testing/store-contract.d.ts +7 -1
- package/dist/testing/store-contract.js +84 -3
- package/dist/theme/apply.d.ts +20 -1
- package/dist/theme/apply.js +5 -3
- package/dist/theme/contrast.d.ts +19 -14
- package/dist/theme/contrast.js +181 -17
- package/dist/theme/derive.d.ts +22 -0
- package/dist/theme/derive.js +54 -1
- package/dist/theme/library.js +1 -1
- package/dist/theme/measure.d.ts +34 -0
- package/dist/theme/measure.js +30 -1
- package/dist/theme/palettes.js +7 -7
- package/dist/theme/ramp.d.ts +64 -0
- package/dist/theme/ramp.js +114 -0
- package/dist/theme/registry.d.ts +9 -0
- package/dist/theme/registry.js +11 -1
- package/dist/theme/separation.d.ts +97 -3
- package/dist/theme/separation.js +75 -0
- package/dist/tree/apply.js +13 -0
- package/dist/tree/compare.d.ts +9 -0
- package/dist/tree/compare.js +18 -0
- package/dist/tree/mutation.d.ts +18 -0
- package/dist/tree/mutation.js +24 -12
- package/dist/tree/navigation.d.ts +5 -0
- package/dist/tree/navigation.js +32 -10
- package/dist/tree/outline.d.ts +7 -0
- package/dist/tree/outline.js +9 -5
- package/dist/write/computed.d.ts +60 -0
- package/dist/write/computed.js +61 -0
- package/dist/write/held.d.ts +59 -0
- package/dist/write/index.d.ts +5 -2
- package/dist/write/index.js +5 -2
- package/dist/write/reseed.d.ts +151 -0
- package/dist/write/reseed.js +184 -0
- package/dist/write/revert.js +2 -16
- package/package.json +25 -3
- package/dist/runtime/inverse-interpreter.d.ts +0 -90
- package/dist/runtime/inverse-interpreter.js +0 -56
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
import { everyMemberOf } from "../closed-set.js";
|
|
2
|
+
import { PRIMITIVE_ROLES } from "../role.js";
|
|
3
|
+
import { inFormOrder } from "./audiences.js";
|
|
4
|
+
import { copyReadingOf } from "./copy.js";
|
|
5
|
+
import { copyChangeOf } from "./copy-change.js";
|
|
6
|
+
import { kindKeyOf } from "./library.js";
|
|
7
|
+
import { pairedWindowOf, partsByNodeIn } from "./library-change.js";
|
|
8
|
+
export const KIND_COPY_CHANGE_SILENCES = everyMemberOf()([
|
|
9
|
+
"unplaced",
|
|
10
|
+
"unpaired",
|
|
11
|
+
"wordless",
|
|
12
|
+
"unread",
|
|
13
|
+
"floored",
|
|
14
|
+
]);
|
|
15
|
+
/** One line per silence, for a surface saying why a kind has no before and after. */
|
|
16
|
+
export const describeKindCopyChangeSilence = (silence) => {
|
|
17
|
+
switch (silence) {
|
|
18
|
+
case "unplaced":
|
|
19
|
+
return "nothing in the pages read, in either window, is of this kind";
|
|
20
|
+
case "unpaired":
|
|
21
|
+
return "no place this kind of part stands kept a word between the two windows";
|
|
22
|
+
case "wordless":
|
|
23
|
+
return "the places it keeps say nothing this reading can see";
|
|
24
|
+
case "unread":
|
|
25
|
+
return "no carried word of it can be spoken for in both windows";
|
|
26
|
+
case "floored":
|
|
27
|
+
return "some of its carried words are a floor, so a signed movement in them could have the wrong sign";
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
export const KIND_WORD_MOVEMENTS = everyMemberOf()(["taken-up", "abandoned", "held", "still-unread", "unknown"]);
|
|
31
|
+
/** One line per movement, for a surface putting a kind's words in front of a person. */
|
|
32
|
+
export const describeKindWordMovement = (movement) => {
|
|
33
|
+
switch (movement) {
|
|
34
|
+
case "taken-up":
|
|
35
|
+
return "more of the words it kept are read now";
|
|
36
|
+
case "abandoned":
|
|
37
|
+
return "fewer of the words it kept are read now";
|
|
38
|
+
case "held":
|
|
39
|
+
return "as many of the words it kept are read now as were";
|
|
40
|
+
case "still-unread":
|
|
41
|
+
return "no word it kept was read in either window";
|
|
42
|
+
case "unknown":
|
|
43
|
+
return "nothing can be said about what changed";
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const counting = () => ({
|
|
47
|
+
placements: 0,
|
|
48
|
+
rewritten: 0,
|
|
49
|
+
rewrittenWas: 0,
|
|
50
|
+
rewrittenNow: 0,
|
|
51
|
+
gained: 0,
|
|
52
|
+
lost: 0,
|
|
53
|
+
wordsGained: 0,
|
|
54
|
+
wordsGainedRead: 0,
|
|
55
|
+
wordsLost: 0,
|
|
56
|
+
wordsLostRead: 0,
|
|
57
|
+
flooredPlacements: 0,
|
|
58
|
+
carried: 0,
|
|
59
|
+
unspoken: 0,
|
|
60
|
+
keptRead: 0,
|
|
61
|
+
keptSkipped: 0,
|
|
62
|
+
tookUp: 0,
|
|
63
|
+
fellAway: 0,
|
|
64
|
+
flooredWords: 0,
|
|
65
|
+
});
|
|
66
|
+
const tallying = (kind) => ({ kind, role: null, ...counting() });
|
|
67
|
+
/** The two keys one placement is counted under, which is the pair of questions this answers. */
|
|
68
|
+
const keysOf = (of) => [
|
|
69
|
+
{ by: "type", type: of.type },
|
|
70
|
+
{ by: "role", role: of.role },
|
|
71
|
+
];
|
|
72
|
+
const rowFor = (rows, kind) => {
|
|
73
|
+
const key = kindKeyOf(kind);
|
|
74
|
+
const row = rows.get(key) ?? tallying(kind);
|
|
75
|
+
rows.set(key, row);
|
|
76
|
+
return row;
|
|
77
|
+
};
|
|
78
|
+
const shareOf = (read, comparable) => comparable === 0 ? null : read / comparable;
|
|
79
|
+
/**
|
|
80
|
+
* The silence, with the reasons tried in the order they have to be tried in.
|
|
81
|
+
*
|
|
82
|
+
* Nothing of the kind first, because *there is no such part in this library* is
|
|
83
|
+
* a better answer than anything said about its words. Then nothing held still,
|
|
84
|
+
* because a kind whose every word was rewritten is a fact about the change and
|
|
85
|
+
* would otherwise be reported as nobody having read it. Then the floor, last,
|
|
86
|
+
* because it is the only one of the five that withholds a single figure rather
|
|
87
|
+
* than the comparison.
|
|
88
|
+
*
|
|
89
|
+
* The floor is tried on the **placements** and not on their words. A part that
|
|
90
|
+
* declares no `copy` at all says nought visible words and hides all of them,
|
|
91
|
+
* which is the commonest floor there is — so a trigger counted in words would
|
|
92
|
+
* stay nought for exactly the case it exists for and publish a signed figure
|
|
93
|
+
* nobody can stand behind (0122, 0239).
|
|
94
|
+
*/
|
|
95
|
+
const silenceOf = (of, comparable) => {
|
|
96
|
+
if (of.placements + of.rewritten + of.gained + of.lost === 0)
|
|
97
|
+
return "unplaced";
|
|
98
|
+
if (of.placements === 0)
|
|
99
|
+
return "unpaired";
|
|
100
|
+
if (of.carried === 0)
|
|
101
|
+
return "wordless";
|
|
102
|
+
if (comparable === 0)
|
|
103
|
+
return "unread";
|
|
104
|
+
return of.flooredPlacements > 0 ? "floored" : null;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* The verdict, off the two masses and never off the two shares.
|
|
108
|
+
*
|
|
109
|
+
* The shares have one denominator by construction, so their difference has the
|
|
110
|
+
* sign of `tookUp − fellAway` exactly; taking it from the masses keeps a
|
|
111
|
+
* division out of a verdict.
|
|
112
|
+
*/
|
|
113
|
+
const movementOf = (of, silence) => {
|
|
114
|
+
if (silence !== null)
|
|
115
|
+
return "unknown";
|
|
116
|
+
if (of.tookUp > of.fellAway)
|
|
117
|
+
return "taken-up";
|
|
118
|
+
if (of.fellAway > of.tookUp)
|
|
119
|
+
return "abandoned";
|
|
120
|
+
return of.keptRead === 0 && of.tookUp === 0 ? "still-unread" : "held";
|
|
121
|
+
};
|
|
122
|
+
const carriedOf = (of, signed) => {
|
|
123
|
+
const comparable = of.keptRead + of.keptSkipped + of.tookUp + of.fellAway;
|
|
124
|
+
return {
|
|
125
|
+
carried: of.carried,
|
|
126
|
+
comparable,
|
|
127
|
+
unspoken: of.unspoken,
|
|
128
|
+
keptRead: of.keptRead,
|
|
129
|
+
keptSkipped: of.keptSkipped,
|
|
130
|
+
tookUp: of.tookUp,
|
|
131
|
+
fellAway: of.fellAway,
|
|
132
|
+
readShareWas: shareOf(of.keptRead + of.fellAway, comparable),
|
|
133
|
+
readShareNow: shareOf(of.keptRead + of.tookUp, comparable),
|
|
134
|
+
change: signed ? of.tookUp - of.fellAway : null,
|
|
135
|
+
floored: of.flooredWords,
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
const rowOf = (of) => {
|
|
139
|
+
const comparable = of.keptRead + of.keptSkipped + of.tookUp + of.fellAway;
|
|
140
|
+
const silence = silenceOf(of, comparable);
|
|
141
|
+
return {
|
|
142
|
+
kind: of.kind,
|
|
143
|
+
role: of.kind.by === "type" ? of.role : null,
|
|
144
|
+
placements: of.placements,
|
|
145
|
+
rewritten: of.rewritten,
|
|
146
|
+
rewrittenWords: { was: of.rewrittenWas, now: of.rewrittenNow },
|
|
147
|
+
gained: of.gained,
|
|
148
|
+
lost: of.lost,
|
|
149
|
+
wordsGained: of.wordsGained,
|
|
150
|
+
wordsGainedRead: of.wordsGainedRead,
|
|
151
|
+
wordsLost: of.wordsLost,
|
|
152
|
+
wordsLostRead: of.wordsLostRead,
|
|
153
|
+
flooredPlacements: of.flooredPlacements,
|
|
154
|
+
words: carriedOf(of, of.flooredPlacements === 0 && comparable > 0),
|
|
155
|
+
movement: movementOf(of, silence),
|
|
156
|
+
silence,
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
/** The name a row is ordered by, which is the key's own and never the row's position. */
|
|
160
|
+
const nameOf = (kind) => (kind.by === "type" ? kind.type : (kind.role ?? ""));
|
|
161
|
+
/**
|
|
162
|
+
* The kind to look at first, which is the ranking rule spelled once.
|
|
163
|
+
*
|
|
164
|
+
* Most words fallen away, then the lower read share now, then by name — so a
|
|
165
|
+
* kind with no share at all sorts after one with a share of nought rather than
|
|
166
|
+
* above it, because `null` is *nothing can be said* and not *nobody read it*.
|
|
167
|
+
*/
|
|
168
|
+
const worseOf = (one, other) => other.words.fellAway - one.words.fellAway ||
|
|
169
|
+
(one.words.readShareNow ?? 2) - (other.words.readShareNow ?? 2) ||
|
|
170
|
+
nameOf(one.kind).localeCompare(nameOf(other.kind));
|
|
171
|
+
/**
|
|
172
|
+
* The passages of a page only one window holds, by the published rule for
|
|
173
|
+
* whether a part says anything at all.
|
|
174
|
+
*
|
|
175
|
+
* `copyReadingOf`'s own list rather than a second spelling of its filter: a
|
|
176
|
+
* part that says nothing and hides nothing is in neither reading, and two
|
|
177
|
+
* spellings of that rule that agree today are how two screens come to disagree
|
|
178
|
+
* (0122).
|
|
179
|
+
*/
|
|
180
|
+
const passagesOf = (reading) => copyReadingOf(reading).passages;
|
|
181
|
+
/** A word mass and the part of it that was read, which is the pair every changed-hands figure is. */
|
|
182
|
+
const readOf = (passage) => passage.standing === "read" ? passage.words : 0;
|
|
183
|
+
/**
|
|
184
|
+
* The keys a paired placement is held still under, and the keys it changed
|
|
185
|
+
* hands between.
|
|
186
|
+
*
|
|
187
|
+
* A placement is carried under a key only where it is of that kind on **both**
|
|
188
|
+
* sides, which is where the two keys answer differently: a node recast into
|
|
189
|
+
* another type is a place one type left and another took, while the role rows
|
|
190
|
+
* hold it still wherever the two types play the same part (0266).
|
|
191
|
+
*/
|
|
192
|
+
const pairingOf = (before, after) => {
|
|
193
|
+
const sameType = before.type === after.type;
|
|
194
|
+
const sameRole = before.role === after.role;
|
|
195
|
+
return {
|
|
196
|
+
held: [
|
|
197
|
+
...(sameType ? [{ by: "type", type: after.type }] : []),
|
|
198
|
+
...(sameRole ? [{ by: "role", role: after.role }] : []),
|
|
199
|
+
],
|
|
200
|
+
left: [
|
|
201
|
+
...(sameType ? [] : [{ by: "type", type: before.type }]),
|
|
202
|
+
...(sameRole ? [] : [{ by: "role", role: before.role }]),
|
|
203
|
+
],
|
|
204
|
+
took: [
|
|
205
|
+
...(sameType ? [] : [{ by: "type", type: after.type }]),
|
|
206
|
+
...(sameRole ? [] : [{ by: "role", role: after.role }]),
|
|
207
|
+
],
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
/** Where a carried passage's words go, which is its movement read as two windows' standings. */
|
|
211
|
+
const bucket = (row, passage) => {
|
|
212
|
+
row.placements += 1;
|
|
213
|
+
row.carried += passage.words;
|
|
214
|
+
if (passage.floored) {
|
|
215
|
+
row.flooredPlacements += 1;
|
|
216
|
+
row.flooredWords += passage.words;
|
|
217
|
+
}
|
|
218
|
+
switch (passage.movement) {
|
|
219
|
+
case "held":
|
|
220
|
+
row.keptRead += passage.words;
|
|
221
|
+
return;
|
|
222
|
+
case "unread":
|
|
223
|
+
row.keptSkipped += passage.words;
|
|
224
|
+
return;
|
|
225
|
+
case "gained":
|
|
226
|
+
row.tookUp += passage.words;
|
|
227
|
+
return;
|
|
228
|
+
case "lost":
|
|
229
|
+
row.fellAway += passage.words;
|
|
230
|
+
return;
|
|
231
|
+
case "unknown":
|
|
232
|
+
row.unspoken += passage.words;
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
/** A placement that changed hands between two kinds, counted in both of them. */
|
|
236
|
+
const changedHands = (rows, keys, words) => {
|
|
237
|
+
for (const kind of keys.left) {
|
|
238
|
+
const row = rowFor(rows, kind);
|
|
239
|
+
row.lost += 1;
|
|
240
|
+
row.wordsLost += words.was;
|
|
241
|
+
row.wordsLostRead += words.wasRead;
|
|
242
|
+
}
|
|
243
|
+
for (const kind of keys.took) {
|
|
244
|
+
const row = rowFor(rows, kind);
|
|
245
|
+
row.gained += 1;
|
|
246
|
+
row.wordsGained += words.now;
|
|
247
|
+
row.wordsGainedRead += words.nowRead;
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
/**
|
|
251
|
+
* What a change did to the words of a kind of part, across every page it stands
|
|
252
|
+
* on.
|
|
253
|
+
*
|
|
254
|
+
* Takes the two windows' readings rather than two censuses, and the reason is
|
|
255
|
+
* the method: a census publishes a kind's words added up, and the **text** has
|
|
256
|
+
* to be paired before anything can be held still. Two censuses cannot be
|
|
257
|
+
* subtracted, which is what this module is for.
|
|
258
|
+
*
|
|
259
|
+
* The labels are the caller's. Two readings of one window and one library come
|
|
260
|
+
* back as every word carried and nothing gained, lost or rewritten; a caller
|
|
261
|
+
* who holds the two sides backwards gets a comparison with every movement
|
|
262
|
+
* reversed rather than a refusal, exactly as a before-and-after reading of one
|
|
263
|
+
* page does.
|
|
264
|
+
*
|
|
265
|
+
* Linear in the parts handed in, with one comparison per paired page.
|
|
266
|
+
*/
|
|
267
|
+
export const libraryCopyChangeOf = (was, now) => {
|
|
268
|
+
const earlier = pairedWindowOf(was);
|
|
269
|
+
const later = pairedWindowOf(now);
|
|
270
|
+
const rows = new Map();
|
|
271
|
+
const roleWas = new Map();
|
|
272
|
+
const roleNow = new Map();
|
|
273
|
+
const ambiguous = new Map([...earlier.ambiguous, ...later.ambiguous]);
|
|
274
|
+
const whole = counting();
|
|
275
|
+
let pages = 0;
|
|
276
|
+
let pagesGained = 0;
|
|
277
|
+
let pagesLost = 0;
|
|
278
|
+
let formsGained = 0;
|
|
279
|
+
let formsLost = 0;
|
|
280
|
+
let republished = 0;
|
|
281
|
+
let recast = 0;
|
|
282
|
+
let viewsWas = 0;
|
|
283
|
+
let viewsNow = 0;
|
|
284
|
+
/**
|
|
285
|
+
* Every role in the vocabulary gets a row whether or not anything plays it,
|
|
286
|
+
* as a census's role rows do: a role nothing in the library plays is a fact
|
|
287
|
+
* about the library, and a surface that had to tell a missing row from an
|
|
288
|
+
* empty one would be reading the vocabulary itself.
|
|
289
|
+
*/
|
|
290
|
+
for (const role of [...PRIMITIVE_ROLES, null])
|
|
291
|
+
rowFor(rows, { by: "role", role });
|
|
292
|
+
for (const [form, reading] of earlier.byForm) {
|
|
293
|
+
if (ambiguous.has(form))
|
|
294
|
+
continue;
|
|
295
|
+
for (const part of reading.parts) {
|
|
296
|
+
roleWas.set(part.type, part.role);
|
|
297
|
+
rowFor(rows, { by: "type", type: part.type }).role = part.role;
|
|
298
|
+
}
|
|
299
|
+
if (later.byForm.has(form))
|
|
300
|
+
continue;
|
|
301
|
+
pagesLost += 1;
|
|
302
|
+
/** The page is still served, in the other form: a form left the library and the page did not (0295). */
|
|
303
|
+
if (later.pagesHeld.has(reading.treeId))
|
|
304
|
+
formsLost += 1;
|
|
305
|
+
for (const passage of passagesOf(reading)) {
|
|
306
|
+
whole.lost += 1;
|
|
307
|
+
whole.wordsLost += passage.words;
|
|
308
|
+
whole.wordsLostRead += readOf(passage);
|
|
309
|
+
for (const kind of keysOf(passage)) {
|
|
310
|
+
const row = rowFor(rows, kind);
|
|
311
|
+
row.lost += 1;
|
|
312
|
+
row.wordsLost += passage.words;
|
|
313
|
+
row.wordsLostRead += readOf(passage);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
for (const [form, reading] of later.byForm) {
|
|
318
|
+
if (ambiguous.has(form))
|
|
319
|
+
continue;
|
|
320
|
+
for (const part of reading.parts) {
|
|
321
|
+
roleNow.set(part.type, part.role);
|
|
322
|
+
rowFor(rows, { by: "type", type: part.type }).role = part.role;
|
|
323
|
+
}
|
|
324
|
+
if (earlier.byForm.has(form))
|
|
325
|
+
continue;
|
|
326
|
+
pagesGained += 1;
|
|
327
|
+
/** The page was already served, in the other form: a second form began rather than a page being published. */
|
|
328
|
+
if (earlier.pagesHeld.has(reading.treeId))
|
|
329
|
+
formsGained += 1;
|
|
330
|
+
for (const passage of passagesOf(reading)) {
|
|
331
|
+
whole.gained += 1;
|
|
332
|
+
whole.wordsGained += passage.words;
|
|
333
|
+
whole.wordsGainedRead += readOf(passage);
|
|
334
|
+
for (const kind of keysOf(passage)) {
|
|
335
|
+
const row = rowFor(rows, kind);
|
|
336
|
+
row.gained += 1;
|
|
337
|
+
row.wordsGained += passage.words;
|
|
338
|
+
row.wordsGainedRead += readOf(passage);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
for (const [form, before] of earlier.byForm) {
|
|
343
|
+
const after = later.byForm.get(form);
|
|
344
|
+
if (after === undefined || ambiguous.has(form))
|
|
345
|
+
continue;
|
|
346
|
+
const change = copyChangeOf(before, after);
|
|
347
|
+
const beforeParts = partsByNodeIn(before);
|
|
348
|
+
pages += 1;
|
|
349
|
+
republished += before.revision === after.revision ? 0 : 1;
|
|
350
|
+
viewsWas += before.views;
|
|
351
|
+
viewsNow += after.views;
|
|
352
|
+
for (const passage of change.compared) {
|
|
353
|
+
const part = beforeParts.get(passage.nodeId);
|
|
354
|
+
/**
|
|
355
|
+
* A compared passage is a node both readings hold, so the earlier part is
|
|
356
|
+
* always there. Skipped rather than thrown, as every join in this
|
|
357
|
+
* subsystem is: a row that cannot be built cannot be drawn, and a reading
|
|
358
|
+
* is not worth failing over.
|
|
359
|
+
*/
|
|
360
|
+
if (part === undefined)
|
|
361
|
+
continue;
|
|
362
|
+
const keys = pairingOf(part, passage);
|
|
363
|
+
if (part.type === passage.type)
|
|
364
|
+
bucket(whole, passage);
|
|
365
|
+
else {
|
|
366
|
+
recast += 1;
|
|
367
|
+
whole.lost += 1;
|
|
368
|
+
whole.gained += 1;
|
|
369
|
+
whole.wordsLost += passage.words;
|
|
370
|
+
whole.wordsGained += passage.words;
|
|
371
|
+
whole.wordsLostRead += readOf({ words: passage.words, standing: passage.was.standing });
|
|
372
|
+
whole.wordsGainedRead += readOf({ words: passage.words, standing: passage.now.standing });
|
|
373
|
+
}
|
|
374
|
+
for (const kind of keys.held)
|
|
375
|
+
bucket(rowFor(rows, kind), passage);
|
|
376
|
+
changedHands(rows, keys, {
|
|
377
|
+
was: passage.words,
|
|
378
|
+
wasRead: readOf({ words: passage.words, standing: passage.was.standing }),
|
|
379
|
+
now: passage.words,
|
|
380
|
+
nowRead: readOf({ words: passage.words, standing: passage.now.standing }),
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
for (const passage of change.reworded) {
|
|
384
|
+
const part = beforeParts.get(passage.nodeId);
|
|
385
|
+
if (part === undefined)
|
|
386
|
+
continue;
|
|
387
|
+
const keys = pairingOf(part, passage);
|
|
388
|
+
if (part.type === passage.type) {
|
|
389
|
+
whole.rewritten += 1;
|
|
390
|
+
whole.rewrittenWas += passage.words.was;
|
|
391
|
+
whole.rewrittenNow += passage.words.now;
|
|
392
|
+
}
|
|
393
|
+
else {
|
|
394
|
+
recast += 1;
|
|
395
|
+
whole.lost += 1;
|
|
396
|
+
whole.gained += 1;
|
|
397
|
+
whole.wordsLost += passage.words.was;
|
|
398
|
+
whole.wordsGained += passage.words.now;
|
|
399
|
+
whole.wordsLostRead += readOf({ words: passage.words.was, standing: passage.was.standing });
|
|
400
|
+
whole.wordsGainedRead += readOf({ words: passage.words.now, standing: passage.now.standing });
|
|
401
|
+
}
|
|
402
|
+
for (const kind of keys.held) {
|
|
403
|
+
const row = rowFor(rows, kind);
|
|
404
|
+
row.rewritten += 1;
|
|
405
|
+
row.rewrittenWas += passage.words.was;
|
|
406
|
+
row.rewrittenNow += passage.words.now;
|
|
407
|
+
}
|
|
408
|
+
changedHands(rows, keys, {
|
|
409
|
+
was: passage.words.was,
|
|
410
|
+
wasRead: readOf({ words: passage.words.was, standing: passage.was.standing }),
|
|
411
|
+
now: passage.words.now,
|
|
412
|
+
nowRead: readOf({ words: passage.words.now, standing: passage.now.standing }),
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
for (const passage of change.added) {
|
|
416
|
+
whole.gained += 1;
|
|
417
|
+
whole.wordsGained += passage.words;
|
|
418
|
+
whole.wordsGainedRead += readOf(passage);
|
|
419
|
+
for (const kind of keysOf(passage)) {
|
|
420
|
+
const row = rowFor(rows, kind);
|
|
421
|
+
row.gained += 1;
|
|
422
|
+
row.wordsGained += passage.words;
|
|
423
|
+
row.wordsGainedRead += readOf(passage);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
for (const passage of change.removed) {
|
|
427
|
+
whole.lost += 1;
|
|
428
|
+
whole.wordsLost += passage.words;
|
|
429
|
+
whole.wordsLostRead += readOf(passage);
|
|
430
|
+
for (const kind of keysOf(passage)) {
|
|
431
|
+
const row = rowFor(rows, kind);
|
|
432
|
+
row.lost += 1;
|
|
433
|
+
row.wordsLost += passage.words;
|
|
434
|
+
row.wordsLostRead += readOf(passage);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
const built = [...rows.values()].map(rowOf);
|
|
439
|
+
const byType = built.filter((row) => row.kind.by === "type").sort(worseOf);
|
|
440
|
+
const disagreed = [...roleNow.keys()]
|
|
441
|
+
.filter((type) => roleWas.has(type) && roleWas.get(type) !== roleNow.get(type))
|
|
442
|
+
.sort((one, other) => one.localeCompare(other));
|
|
443
|
+
const comparable = whole.keptRead + whole.keptSkipped + whole.tookUp + whole.fellAway;
|
|
444
|
+
return {
|
|
445
|
+
byType,
|
|
446
|
+
byRole: built.filter((row) => row.kind.by === "role").sort(worseOf),
|
|
447
|
+
words: carriedOf(whole, whole.flooredPlacements === 0 && comparable > 0),
|
|
448
|
+
pages,
|
|
449
|
+
pagesGained,
|
|
450
|
+
formsGained,
|
|
451
|
+
pagesLost,
|
|
452
|
+
formsLost,
|
|
453
|
+
audiences: { was: earlier.audiences, now: later.audiences },
|
|
454
|
+
republished,
|
|
455
|
+
placements: whole.placements,
|
|
456
|
+
rewritten: whole.rewritten,
|
|
457
|
+
gained: whole.gained,
|
|
458
|
+
lost: whole.lost,
|
|
459
|
+
recast,
|
|
460
|
+
wordsGained: whole.wordsGained,
|
|
461
|
+
wordsGainedRead: whole.wordsGainedRead,
|
|
462
|
+
wordsLost: whole.wordsLost,
|
|
463
|
+
wordsLostRead: whole.wordsLostRead,
|
|
464
|
+
viewsWas,
|
|
465
|
+
viewsNow,
|
|
466
|
+
mostAbandoned: byType.find((row) => row.words.fellAway > 0) ?? null,
|
|
467
|
+
mostTakenUp: byType
|
|
468
|
+
.filter((row) => row.words.tookUp > 0)
|
|
469
|
+
.sort((one, other) => other.words.tookUp - one.words.tookUp ||
|
|
470
|
+
nameOf(one.kind).localeCompare(nameOf(other.kind)))[0] ?? null,
|
|
471
|
+
ambiguous: [...ambiguous.values()].sort(inFormOrder),
|
|
472
|
+
duplicated: earlier.duplicated + later.duplicated,
|
|
473
|
+
roleDisagreed: disagreed,
|
|
474
|
+
};
|
|
475
|
+
};
|
|
476
|
+
//# sourceMappingURL=library-copy-change.js.map
|