linked-rolls 0.51.0 → 0.52.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 CHANGED
@@ -80,6 +80,16 @@ sigla off the stemma as it stands, so a label never outlives the
80
80
  arrangement it describes, and nothing should cite one without saying
81
81
  which state of the edition it belongs to.
82
82
 
83
+ Handed an `EditionView`, which knows the copies as well, `siglaOf`
84
+ lowercases the versions no copy's features carry at first hand, as
85
+ editions mark a state nothing surviving shows: r3 stands to R3 as a
86
+ reconstructed state stands to a witnessed one. A version reached only
87
+ through the versions derived from it is lowercased, and so is one a
88
+ copy does no more than state it carries, since a statement gives no
89
+ readings. `attestedVersions` reports the same fact on its own. Handed
90
+ the versions alone, `siglaOf` cannot tell and leaves every siglum in
91
+ capitals.
92
+
83
93
  ## The tolerance a derivation was collated at
84
94
 
85
95
  `collationTolerance` on a derivation is the window two readings of one
@@ -125,7 +125,7 @@ const witnessedAtFirstHand = (view, version) => {
125
125
  const carriers = witnessesOf(view, version.id).filter(({ by }) => by === 'carriers');
126
126
  return carriers.length > 0 && carriers.every(({ through }) => through !== undefined) ? {
127
127
  type: 'no-direct-witness',
128
- note: 'No copy carries it at first hand; it is attested only through the versions derived from it.'
128
+ note: 'No copy carries it at first hand; its text is a reconstruction from the versions derived from it.'
129
129
  } : undefined;
130
130
  };
131
131
  const versionChecks = [textStated, witnessedByFeatures, witnessedAtFirstHand];
package/lib/sigla.d.ts CHANGED
@@ -1,19 +1,24 @@
1
1
  import { Edition } from './Edition.js';
2
+ import { EditionView } from './EditionView.js';
2
3
  /**
3
- * The siglum of every version, as the stemma stands. The letter names the
4
- * reproducing system a version is coded for, the number counts the
5
- * generations within that system, and a number after a dot marks a branch
6
- * that leaves a generation. A version coded for another system than the
7
- * one it derives from starts that system's next number, since nothing in
8
- * that system precedes it.
4
+ * What the sigla are read off: the versions alone, or a view, which knows
5
+ * the copies as well and so can tell which versions a witness shows.
6
+ */
7
+ export type Stemma = Pick<Edition, 'versions'> | EditionView;
8
+ /**
9
+ * The siglum of every version, as the stemma stands: where it sits
10
+ * (`alongTheStemma`) and, given a view, whether any copy shows it.
11
+ *
12
+ * A version no copy's features carry at first hand is inferred, whether
13
+ * it is reached only through the versions derived from it or a copy does
14
+ * no more than state that it carries it. Its siglum is lowercased, so
15
+ * that r3 stands to R3 as a reconstructed state stands to a witnessed
16
+ * one. Handed the versions alone, the sigla cannot tell and stay in
17
+ * capitals throughout.
9
18
  *
10
- * The main line runs through the child that has descendants of its own;
11
- * where several have, the one with the most, and where none has, the line
12
- * ends and the children hang off it as branches. So a siglum says where a
13
- * version sits in this stemma, and it is computed anew when the stemma
14
- * changes. Nothing should cite one without saying which state it belongs
15
- * to.
19
+ * A siglum is computed anew when the stemma or the copies change, so
20
+ * nothing should cite one without saying which state it belongs to.
16
21
  */
17
- export declare const siglaOf: (edition: Pick<Edition, 'versions'>) => ReadonlyMap<string, string>;
22
+ export declare const siglaOf: (stemma: Stemma) => ReadonlyMap<string, string>;
18
23
  /** The siglum of one version as the stemma stands, or nothing where the edition holds no such version. */
19
- export declare const siglumOf: (edition: Pick<Edition, 'versions'>, versionId: string) => string | undefined;
24
+ export declare const siglumOf: (stemma: Stemma, versionId: string) => string | undefined;
package/lib/sigla.js CHANGED
@@ -2,6 +2,7 @@ import { idOf } from './Assumption.js';
2
2
  import { systemIdOf } from './TrackerBar.js';
3
3
  import { trackerBarOf } from './systems/index.js';
4
4
  import { principalDerivationOf } from './Version.js';
5
+ import { attestedVersions } from './witnesses.js';
5
6
  /** The letter the versions of a system are labelled with. */
6
7
  const letters = new Map([
7
8
  ['welte-t100', 'R'],
@@ -27,13 +28,9 @@ const letterOf = (version) => {
27
28
  *
28
29
  * The main line runs through the child that has descendants of its own;
29
30
  * where several have, the one with the most, and where none has, the line
30
- * ends and the children hang off it as branches. So a siglum says where a
31
- * version sits in this stemma, and it is computed anew when the stemma
32
- * changes. Nothing should cite one without saying which state it belongs
33
- * to.
31
+ * ends and the children hang off it as branches.
34
32
  */
35
- export const siglaOf = (edition) => {
36
- const versions = edition.versions;
33
+ const alongTheStemma = (versions) => {
37
34
  const byId = new Map(versions.map(version => [version.id, version]));
38
35
  const parentOf = (version) => {
39
36
  const principal = principalDerivationOf(version);
@@ -94,5 +91,29 @@ export const siglaOf = (edition) => {
94
91
  }
95
92
  return sigla;
96
93
  };
94
+ const isView = (stemma) => !('versions' in stemma);
95
+ /**
96
+ * The sigla with the inferred versions in lowercase, as editions mark a
97
+ * state nothing surviving shows. The letter still names the system and
98
+ * the number still counts the generation.
99
+ */
100
+ const marking = (sigla, attested) => new Map([...sigla].map(([id, siglum]) => [id, attested.has(id) ? siglum : siglum.toLowerCase()]));
101
+ /**
102
+ * The siglum of every version, as the stemma stands: where it sits
103
+ * (`alongTheStemma`) and, given a view, whether any copy shows it.
104
+ *
105
+ * A version no copy's features carry at first hand is inferred, whether
106
+ * it is reached only through the versions derived from it or a copy does
107
+ * no more than state that it carries it. Its siglum is lowercased, so
108
+ * that r3 stands to R3 as a reconstructed state stands to a witnessed
109
+ * one. Handed the versions alone, the sigla cannot tell and stay in
110
+ * capitals throughout.
111
+ *
112
+ * A siglum is computed anew when the stemma or the copies change, so
113
+ * nothing should cite one without saying which state it belongs to.
114
+ */
115
+ export const siglaOf = (stemma) => isView(stemma)
116
+ ? marking(alongTheStemma(stemma.edition.versions), attestedVersions(stemma))
117
+ : alongTheStemma(stemma.versions);
97
118
  /** The siglum of one version as the stemma stands, or nothing where the edition holds no such version. */
98
- export const siglumOf = (edition, versionId) => siglaOf(edition).get(versionId);
119
+ export const siglumOf = (stemma, versionId) => siglaOf(stemma).get(versionId);
@@ -19,6 +19,13 @@ export interface Witness {
19
19
  /** The belief a statement rests on, where it states one. */
20
20
  belief?: Belief;
21
21
  }
22
+ /**
23
+ * The versions a copy's features carry at first hand: for every copy,
24
+ * the latest state it bears. A version left out is reached only through
25
+ * the versions derived from it, or is attested by statement alone, and
26
+ * its text is a reconstruction rather than a reading.
27
+ */
28
+ export declare const attestedVersions: (view: EditionView) => ReadonlySet<string>;
22
29
  /**
23
30
  * The copies that bear witness to the version: those whose features carry
24
31
  * a symbol the version's own edits insert, and those that state they carry
package/lib/witnesses.js CHANGED
@@ -28,6 +28,13 @@ const carriersIn = (view) => {
28
28
  .map(carriage => [carriage.copy, carriage.version]))
29
29
  };
30
30
  };
31
+ /**
32
+ * The versions a copy's features carry at first hand: for every copy,
33
+ * the latest state it bears. A version left out is reached only through
34
+ * the versions derived from it, or is attested by statement alone, and
35
+ * its text is a reconstruction rather than a reading.
36
+ */
37
+ export const attestedVersions = (view) => new Set(carriersIn(view).latestOf.values());
31
38
  const witnessesIn = (carriers, view, versionId) => {
32
39
  const carrying = carriers.copiesOf.get(versionId) ?? [];
33
40
  const byCarriers = carrying.map((copy) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linked-rolls",
3
- "version": "0.51.0",
3
+ "version": "0.52.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": {