linked-rolls 0.50.0 → 0.51.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.
@@ -2,7 +2,7 @@ import { EditionView } from "./EditionView.js";
2
2
  export type ConstraintProblem = {
3
3
  version: string;
4
4
  symbol: string;
5
- problem: 'alignment-reference-missing' | 'before-reference-missing' | 'after-reference-missing' | 'placed-relative-to-itself' | 'placed-several-ways' | 'partner-missing' | 'paired-with-itself' | 'in-several-pairs' | 'pair-placed-on-both-sides' | 'type-not-on-the-bar' | 'carrier-on-another-track' | 'copies-disagree-on-the-paper';
5
+ problem: 'alignment-reference-missing' | 'before-reference-missing' | 'after-reference-missing' | 'placed-relative-to-itself' | 'placed-several-ways' | 'partner-missing' | 'paired-with-itself' | 'in-several-pairs' | 'pair-placed-on-both-sides' | 'type-not-on-the-bar' | 'carrier-on-another-track' | 'copies-disagree-on-the-paper' | 'strike-bites-nothing';
6
6
  };
7
7
  /**
8
8
  * Where the edition cannot hold as stated, version by version: a
@@ -10,7 +10,8 @@ export type ConstraintProblem = {
10
10
  * placed relative to itself or in several ways at once, one claimed by
11
11
  * several pairs, a pair whose members are both placed and so cannot
12
12
  * keep their distance and follow their references at once, an
13
- * expression the version's own bar cannot read, and a carrier sitting
14
- * on a track that does not say what its symbol says.
13
+ * expression the version's own bar cannot read, a carrier sitting on a
14
+ * track that does not say what its symbol says, and a strike that takes
15
+ * nothing out.
15
16
  */
16
17
  export declare const constraintProblems: (view: EditionView) => ConstraintProblem[];
@@ -3,6 +3,7 @@ import { isCommand, pairsAmong, placementsOf } from "./Symbol.js";
3
3
  import { keyOf } from "./TrackerBar.js";
4
4
  import { trackerBarOf } from "./systems/index.js";
5
5
  import { barOf } from "./RollCopy.js";
6
+ import { deletedBy, insertedBy } from "./Version.js";
6
7
  const missingReference = {
7
8
  alignedWith: 'alignment-reference-missing',
8
9
  before: 'before-reference-missing',
@@ -100,14 +101,37 @@ const carriersOffTheirMeaning = (view, version, commands) => {
100
101
  const paperDisagreed = (view, version) => view.speedScalesIn(version).length > 1
101
102
  ? [{ version: version.id, symbol: version.id, problem: 'copies-disagree-on-the-paper' }]
102
103
  : [];
104
+ /**
105
+ * A version's strikes that take nothing out of its text: each deleted
106
+ * symbol has to be one the parent hands down, or one the version put
107
+ * there itself, or the strike says nothing.
108
+ *
109
+ * It is the check for what happens when a symbol two versions shared is
110
+ * parted in two. The strike still names a symbol that exists, so
111
+ * nothing dangles and nothing looks wrong, but the reading it meant to
112
+ * reject has passed to the symbol standing in its place and comes back
113
+ * into the text unstruck. Nothing else in the edition shows it: the
114
+ * counts move, and only by a handful.
115
+ */
116
+ const strikesBitingNothing = (view, version) => {
117
+ const parent = view.predecessorOf(version.id);
118
+ const reachable = new Set([
119
+ ...(parent ? view.snapshot(parent.id).map(symbol => symbol.id) : []),
120
+ ...insertedBy(version).map(symbol => symbol.id)
121
+ ]);
122
+ return deletedBy(version)
123
+ .filter(id => !reachable.has(id))
124
+ .map(id => ({ version: version.id, symbol: id, problem: 'strike-bites-nothing' }));
125
+ };
103
126
  /**
104
127
  * Where the edition cannot hold as stated, version by version: a
105
128
  * placement or pairing reference absent from the version, a command
106
129
  * placed relative to itself or in several ways at once, one claimed by
107
130
  * several pairs, a pair whose members are both placed and so cannot
108
131
  * keep their distance and follow their references at once, an
109
- * expression the version's own bar cannot read, and a carrier sitting
110
- * on a track that does not say what its symbol says.
132
+ * expression the version's own bar cannot read, a carrier sitting on a
133
+ * track that does not say what its symbol says, and a strike that takes
134
+ * nothing out.
111
135
  */
112
136
  export const constraintProblems = (view) => view.edition.versions.flatMap(version => {
113
137
  const snapshot = view.snapshot(version.id);
@@ -116,6 +140,7 @@ export const constraintProblems = (view) => view.edition.versions.flatMap(versio
116
140
  ...problemsIn(version.id, commands),
117
141
  ...typesNotOnTheBar(version, snapshot),
118
142
  ...carriersOffTheirMeaning(view, version.id, commands),
119
- ...paperDisagreed(view, version)
143
+ ...paperDisagreed(view, version),
144
+ ...strikesBitingNothing(view, version)
120
145
  ];
121
146
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linked-rolls",
3
- "version": "0.50.0",
3
+ "version": "0.51.0",
4
4
  "description": "Digital editions of piano rolls: import, collation, editorial assumptions, JSON-LD export, and emulation through a reproducing system",
5
5
  "license": "MIT",
6
6
  "repository": {