linked-rolls 0.69.0 → 0.71.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 (125) hide show
  1. package/README.md +20 -5
  2. package/lib/analysis/constraints.d.ts +7 -0
  3. package/lib/analysis/constraints.js +1 -0
  4. package/lib/analysis/ownPaper.d.ts +5 -1
  5. package/lib/analysis/ownPaper.js +5 -1
  6. package/lib/analysis/paper.d.ts +22 -4
  7. package/lib/analysis/paper.js +6 -0
  8. package/lib/analysis/reservations.d.ts +24 -1
  9. package/lib/analysis/reservations.js +15 -1
  10. package/lib/analysis/sigla.d.ts +6 -1
  11. package/lib/analysis/sigla.js +5 -1
  12. package/lib/analysis/stemma.d.ts +6 -1
  13. package/lib/analysis/stemma.js +6 -1
  14. package/lib/analysis/text.d.ts +16 -2
  15. package/lib/analysis/text.js +16 -2
  16. package/lib/analysis/witnesses.d.ts +20 -1
  17. package/lib/analysis/witnesses.js +4 -0
  18. package/lib/collation/Collation.d.ts +47 -8
  19. package/lib/collation/Collation.js +29 -5
  20. package/lib/collation/alignment.d.ts +16 -3
  21. package/lib/collation/alignment.js +15 -3
  22. package/lib/collation/scatter.d.ts +50 -9
  23. package/lib/collation/scatter.js +11 -1
  24. package/lib/collation/statistics.d.ts +39 -9
  25. package/lib/collation/statistics.js +27 -6
  26. package/lib/collation/substitution.d.ts +5 -0
  27. package/lib/collation/substitution.js +4 -0
  28. package/lib/emulation/Emulation.d.ts +16 -1
  29. package/lib/emulation/Emulation.js +10 -0
  30. package/lib/emulation/negotiation.d.ts +1 -0
  31. package/lib/emulation/negotiation.js +1 -0
  32. package/lib/index.d.ts +33 -2
  33. package/lib/index.js +2 -1
  34. package/lib/io/asJsonLd.d.ts +10 -0
  35. package/lib/io/asJsonLd.js +10 -0
  36. package/lib/io/context.d.ts +16 -2
  37. package/lib/io/context.js +16 -2
  38. package/lib/io/importJsonLd.d.ts +1 -0
  39. package/lib/io/importJsonLd.js +1 -0
  40. package/lib/io/migrate.d.ts +8 -0
  41. package/lib/io/migrate.js +8 -0
  42. package/lib/lookup/lookup.d.ts +29 -5
  43. package/lib/lookup/lookup.js +29 -5
  44. package/lib/lookup/paths.d.ts +23 -3
  45. package/lib/lookup/paths.js +17 -3
  46. package/lib/model/Agent.d.ts +28 -2
  47. package/lib/model/Agent.js +15 -1
  48. package/lib/model/Assumption.d.ts +96 -7
  49. package/lib/model/Assumption.js +65 -7
  50. package/lib/model/ConditionState.d.ts +1 -0
  51. package/lib/model/Edit.d.ts +10 -0
  52. package/lib/model/Edit.js +8 -0
  53. package/lib/model/Edition.d.ts +12 -1
  54. package/lib/model/Edition.js +1 -0
  55. package/lib/model/Feature.d.ts +74 -7
  56. package/lib/model/Feature.js +41 -3
  57. package/lib/model/FeatureSource.d.ts +14 -1
  58. package/lib/model/FeatureSource.js +7 -1
  59. package/lib/model/Perforator.d.ts +10 -0
  60. package/lib/model/Perforator.js +1 -0
  61. package/lib/model/Quantity.d.ts +160 -13
  62. package/lib/model/Quantity.js +110 -6
  63. package/lib/model/RollCopy.d.ts +74 -12
  64. package/lib/model/RollCopy.js +53 -10
  65. package/lib/model/Symbol.d.ts +38 -1
  66. package/lib/model/Symbol.js +16 -0
  67. package/lib/model/TrackCalibration.d.ts +10 -2
  68. package/lib/model/TrackCalibration.js +9 -2
  69. package/lib/model/Version.d.ts +24 -4
  70. package/lib/model/Version.js +19 -4
  71. package/lib/model/notes.d.ts +15 -2
  72. package/lib/model/notes.js +9 -2
  73. package/lib/model/procedures.d.ts +5 -1
  74. package/lib/model/procedures.js +5 -1
  75. package/lib/model/vocabulary.d.ts +6 -1
  76. package/lib/model/vocabulary.js +6 -1
  77. package/lib/ops/beliefs.d.ts +23 -1
  78. package/lib/ops/beliefs.js +23 -1
  79. package/lib/ops/collation.d.ts +3 -0
  80. package/lib/ops/collation.js +3 -0
  81. package/lib/ops/commands.d.ts +17 -2
  82. package/lib/ops/commands.js +17 -2
  83. package/lib/ops/copies.d.ts +37 -6
  84. package/lib/ops/copies.js +37 -6
  85. package/lib/ops/draft.d.ts +2 -0
  86. package/lib/ops/draft.js +1 -0
  87. package/lib/ops/edits.d.ts +5 -1
  88. package/lib/ops/edits.js +5 -1
  89. package/lib/ops/features.d.ts +12 -1
  90. package/lib/ops/features.js +7 -0
  91. package/lib/ops/versions.d.ts +15 -3
  92. package/lib/ops/versions.js +15 -3
  93. package/lib/readers/phillipsEroll.d.ts +12 -1
  94. package/lib/readers/phillipsEroll.js +6 -1
  95. package/lib/readers/spencerBar.d.ts +12 -1
  96. package/lib/readers/spencerBar.js +7 -1
  97. package/lib/readers/stanfordAton.d.ts +15 -0
  98. package/lib/readers/stanfordAton.js +9 -0
  99. package/lib/schema.json +13 -2
  100. package/lib/shared/utils.d.ts +12 -0
  101. package/lib/spec/context.json +8 -1
  102. package/lib/systems/ReproducingSystem.d.ts +46 -3
  103. package/lib/systems/TrackerBar.d.ts +45 -4
  104. package/lib/systems/TrackerBar.js +20 -3
  105. package/lib/systems/index.d.ts +9 -2
  106. package/lib/systems/index.js +9 -2
  107. package/lib/systems/velocity.d.ts +1 -0
  108. package/lib/systems/velocity.js +1 -0
  109. package/lib/systems/welte.d.ts +18 -3
  110. package/lib/systems/welte.js +9 -2
  111. package/lib/systems/welteLicensee/bar.d.ts +1 -0
  112. package/lib/systems/welteLicensee/bar.js +1 -0
  113. package/lib/systems/welteLicensee/system.d.ts +18 -0
  114. package/lib/systems/welteLicensee/system.js +17 -0
  115. package/lib/systems/welteT100/bar.d.ts +8 -0
  116. package/lib/systems/welteT100/bar.js +4 -0
  117. package/lib/systems/welteT100/system.d.ts +46 -5
  118. package/lib/systems/welteT100/system.js +29 -3
  119. package/lib/systems/welteT98/bar.d.ts +6 -0
  120. package/lib/systems/welteT98/bar.js +2 -0
  121. package/lib/systems/welteT98/system.d.ts +58 -5
  122. package/lib/systems/welteT98/system.js +42 -3
  123. package/lib/validate.d.ts +16 -0
  124. package/lib/validate.js +15 -0
  125. package/package.json +2 -1
@@ -1,42 +1,146 @@
1
- /** Names a number in a unit. Partially apply it to make a constructor. */
1
+ /**
2
+ * Names a number in a unit. Partially apply it to make a constructor.
3
+ * @category Units
4
+ */
2
5
  export const quantity = (value) => value;
6
+ /**
7
+ * Names a number in millimetres.
8
+ * @category Units
9
+ */
3
10
  export const mm = quantity;
11
+ /**
12
+ * Names a number in centimetres.
13
+ * @category Units
14
+ */
4
15
  export const cm = quantity;
16
+ /**
17
+ * Names a number in pixels of a scan.
18
+ * @category Units
19
+ */
5
20
  export const px = quantity;
21
+ /**
22
+ * Names a number as a position across the roll, as the tracker bar
23
+ * numbers it.
24
+ * @category Units
25
+ */
6
26
  export const track = quantity;
27
+ /**
28
+ * Names a number in seconds.
29
+ * @category Units
30
+ */
7
31
  export const seconds = quantity;
32
+ /**
33
+ * Names a number in milliseconds.
34
+ * @category Units
35
+ */
8
36
  export const milliseconds = quantity;
37
+ /**
38
+ * Names a number as a paper speed in feet per minute.
39
+ * @category Units
40
+ */
9
41
  export const feetPerMinute = quantity;
42
+ /**
43
+ * Names a number as a paper speed in metres per minute.
44
+ * @category Units
45
+ */
10
46
  export const metersPerMinute = quantity;
47
+ /**
48
+ * Names a number as the resolution of a scan, in pixels per inch.
49
+ * @category Units
50
+ */
11
51
  export const pixelsPerInch = quantity;
52
+ /**
53
+ * Names a number as an angle in degrees.
54
+ * @category Units
55
+ */
12
56
  export const degrees = quantity;
57
+ /**
58
+ * Names a number as a share in per cent.
59
+ * @category Units
60
+ */
13
61
  export const percent = quantity;
14
62
  // The second operand takes its unit from the first. Inferred from both,
15
63
  // TypeScript would unite two units rather than reject them.
64
+ /**
65
+ * The sum of two quantities in one unit.
66
+ * @internal
67
+ */
16
68
  export const add = (a, b) => quantity(a + b);
69
+ /**
70
+ * The first quantity less the second, in their unit.
71
+ * @internal
72
+ */
17
73
  export const subtract = (a, b) => quantity(a - b);
74
+ /**
75
+ * How far apart two quantities in one unit lie, whichever is the
76
+ * larger.
77
+ * @internal
78
+ */
18
79
  export const distance = (a, b) => quantity(Math.abs(a - b));
19
- /** A quantity times a plain factor, such as a stretch. */
80
+ /**
81
+ * A quantity times a plain factor, such as a stretch.
82
+ * @internal
83
+ */
20
84
  export const scale = (a, factor) => quantity(a * factor);
21
85
  // Math.min and Math.max are declared over plain numbers, so a quantity
22
86
  // passed through them comes back without its unit.
87
+ /**
88
+ * The smaller of two quantities in one unit.
89
+ * @internal
90
+ */
23
91
  export const min = (a, b) => quantity(Math.min(a, b));
92
+ /**
93
+ * The larger of two quantities in one unit.
94
+ * @internal
95
+ */
24
96
  export const max = (a, b) => quantity(Math.max(a, b));
25
- /** The value brought inside the bounds, which must not be the wrong way round. */
97
+ /**
98
+ * The value brought inside the bounds, which must not be the wrong way round.
99
+ * @internal
100
+ */
26
101
  export const clamp = (value, low, high) => quantity(Math.min(high, Math.max(low, value)));
27
102
  // A list is taken at its element type, so one that mixes units yields a
28
103
  // union unit rather than an error; only the binary operations reject a mix.
104
+ /**
105
+ * The quantities added up, zero where there are none.
106
+ * @internal
107
+ */
29
108
  export const sum = (values) => quantity(values.reduce((total, value) => total + value, 0));
109
+ /**
110
+ * The mean of the quantities.
111
+ * @internal
112
+ */
30
113
  export const mean = (values) => quantity(sum(values) / values.length);
31
114
  const MM_PER_INCH = 25.4;
32
- /** A place in a scan taken at `dpi` dots per inch, on the paper. */
115
+ /**
116
+ * A place in a scan taken at `dpi` dots per inch, on the paper.
117
+ * @internal
118
+ */
33
119
  export const inMillimeters = (place, dpi) => mm(place / dpi * MM_PER_INCH);
34
- /** A place on the paper, in a scan taken at `dpi` dots per inch. */
120
+ /**
121
+ * A place on the paper, in a scan taken at `dpi` dots per inch.
122
+ * @internal
123
+ */
35
124
  export const inPixels = (place, dpi) => px(place / MM_PER_INCH * dpi);
125
+ /**
126
+ * A length in millimetres, in centimetres.
127
+ * @internal
128
+ */
36
129
  export const inCentimeters = (length) => cm(length / 10);
37
130
  const MS_PER_SECOND = 1000;
131
+ /**
132
+ * A time in milliseconds, in seconds.
133
+ * @internal
134
+ */
38
135
  export const inSeconds = (time) => seconds(time / MS_PER_SECOND);
136
+ /**
137
+ * A time in seconds, in milliseconds.
138
+ * @internal
139
+ */
39
140
  export const inMilliseconds = (time) => milliseconds(time * MS_PER_SECOND);
40
141
  const METERS_PER_FOOT = 0.3048;
41
- /** A speed in metres per minute, whichever unit it was stated in. */
142
+ /**
143
+ * A speed in metres per minute, whichever unit it was stated in.
144
+ * @category Units
145
+ */
42
146
  export const inMetersPerMinute = (speed) => speed.unit === 'm/min' ? speed.value : metersPerMinute(speed.value * METERS_PER_FOOT);
@@ -17,6 +17,7 @@ import { Perforator } from "./Perforator.js";
17
17
  * tenths of one. It is taken in one direction, along the roll or across
18
18
  * it, since machine-made paper does not stretch the same way in both.
19
19
  * @see crm:E54 Dimension
20
+ * @category Format types
20
21
  */
21
22
  export interface Strain extends Measure<'percent'> {
22
23
  /**
@@ -35,6 +36,7 @@ export interface Strain extends Measure<'percent'> {
35
36
  * stated here, so that a condition stands only where something was
36
37
  * measured. A strain along the roll goes into that working out.
37
38
  * @see crm:E3 Condition State
39
+ * @category Format types
38
40
  */
39
41
  export interface PaperStretch extends ConditionState<'paper-stretch'> {
40
42
  /**
@@ -53,6 +55,7 @@ export interface PaperStretch extends ConditionState<'paper-stretch'> {
53
55
  * A general condition description for a roll copy, e.g.
54
56
  * overall wear, discoloration, or other observations.
55
57
  * @see crm:E3 Condition State
58
+ * @category Format types
56
59
  */
57
60
  export interface GeneralRollCondition extends ConditionState<'general'> {
58
61
  }
@@ -63,6 +66,7 @@ export interface GeneralRollCondition extends ConditionState<'general'> {
63
66
  * that runs into a chain of holes damages the chain as well, which is
64
67
  * then stated of the chain as `partially-torn`.
65
68
  * @see crm:E3 Condition State
69
+ * @category Format types
66
70
  */
67
71
  export interface Tear extends ConditionState<'torn'> {
68
72
  /**
@@ -92,18 +96,25 @@ export interface Tear extends ConditionState<'torn'> {
92
96
  /**
93
97
  * An assignment of a condition (general, paper-stretch or a tear)
94
98
  * to a roll copy, annotatable with a belief about its certainty.
99
+ * @category Format types
95
100
  */
96
101
  export type RollConditionAssignment = ObjectAssumption<GeneralRollCondition | PaperStretch | Tear>;
97
102
  /**
98
103
  * The keeper a copy is held by, as an object assumption, so that the
99
104
  * statement can carry the belief it rests on and the reasons for it.
105
+ * @category Format types
100
106
  */
101
107
  export type KeeperAssignment = ObjectAssumption<Agent>;
108
+ /**
109
+ * The kinds of condition a copy may be stated to be in.
110
+ * @category Vocabulary
111
+ */
102
112
  export declare const rollConditions: readonly ['general', 'paper-stretch', 'torn'];
103
113
  /**
104
114
  * How far an alignment moves a copy's places before it scales them:
105
115
  * along the roll, in the copy's own millimetres, and across it, in
106
116
  * tracks.
117
+ * @category Format types
107
118
  */
108
119
  export interface Shift {
109
120
  /** Along the roll. */
@@ -128,6 +139,7 @@ export interface Shift {
128
139
  * What the scale is put down to, the paper or the speed the copy was
129
140
  * cut for, is worked out from all the alignments together (`paperOf`).
130
141
  * Not exported to RDF.
142
+ * @category Format types
131
143
  */
132
144
  export interface Alignment {
133
145
  /**
@@ -165,6 +177,7 @@ export interface Alignment {
165
177
  * The width and length of a roll copy's paper, as they were measured on
166
178
  * it or on its scan.
167
179
  * @see crm:E54 Dimension
180
+ * @category Format types
168
181
  */
169
182
  export interface RollDimensions {
170
183
  /**
@@ -183,7 +196,10 @@ export interface RollDimensions {
183
196
  */
184
197
  unit: 'mm';
185
198
  }
186
- /** The margins on the treble and bass sides of the roll, in the unit the scan was measured in. */
199
+ /**
200
+ * The margins on the treble and bass sides of the roll, in the unit the scan was measured in.
201
+ * @category Format types
202
+ */
187
203
  export interface Margins<U extends 'px' | 'mm'> {
188
204
  treble: Quantity<U>;
189
205
  bass: Quantity<U>;
@@ -193,6 +209,7 @@ export interface Margins<U extends 'px' | 'mm'> {
193
209
  * A paper speed, as a roll's label, its catalogue or its format
194
210
  * states it.
195
211
  * @see crm:E54 Dimension
212
+ * @category Format types
196
213
  */
197
214
  export type PaperSpeed = Measure<'ft/min'> | Measure<'m/min'>;
198
215
  /**
@@ -200,6 +217,7 @@ export type PaperSpeed = Measure<'ft/min'> | Measure<'m/min'>;
200
217
  * the paper used, the date, and the system and paper speed the
201
218
  * copy was cut for.
202
219
  * @see lrmoo:F32 Item Production Event
220
+ * @category Format types
203
221
  */
204
222
  export interface ProductionEvent {
205
223
  /**
@@ -260,8 +278,15 @@ export interface ProductionEvent {
260
278
  */
261
279
  produced?: AnyFeature[];
262
280
  }
281
+ /**
282
+ * What a modification of a copy may have been for.
283
+ * @category Vocabulary
284
+ */
263
285
  export declare const modificationPurposes: readonly ['musical-improvement', 'technical-improvement', 'repair', 'labeling', 'control', 'dating', 'glossing'];
264
- /** What a modification of a copy was for, as far as it can be told. */
286
+ /**
287
+ * What a modification of a copy was for, as far as it can be told.
288
+ * @category Format types
289
+ */
265
290
  export type ModificationPurpose = typeof modificationPurposes[number];
266
291
  /**
267
292
  * An identifiable act that changed the roll copy after it was punched.
@@ -271,6 +296,7 @@ export type ModificationPurpose = typeof modificationPurposes[number];
271
296
  * is not: drawing, writing and punching bring a feature into being and
272
297
  * are productions.
273
298
  * @see crm:E79 Part Addition, crm:E80 Part Removal, crm:E12 Production
299
+ * @category Format types
274
300
  */
275
301
  export type Modification = Partial<{
276
302
  /**
@@ -329,6 +355,7 @@ export type Modification = Partial<{
329
355
  * Multiple copies of the same roll may exist across different archives
330
356
  * or collections.
331
357
  * @see reo:RollCopy
358
+ * @category Format types
332
359
  */
333
360
  export interface RollCopy extends WithType<'RollCopy'>, WithId {
334
361
  /**
@@ -471,37 +498,69 @@ export interface RollCopy extends WithType<'RollCopy'>, WithId {
471
498
  */
472
499
  carries?: ReferenceAssumption[];
473
500
  }
474
- /** What an act brought onto the copy: what it produced or glued on, a removal nothing. */
501
+ /**
502
+ * What an act brought onto the copy: what it produced or glued on, a removal nothing.
503
+ * @category Lookups
504
+ */
475
505
  export declare const featuresMadeBy: (modification: Modification) => FeatureOrPatch[];
476
- /** Whether the act is one that modified the copy, rather than the production that punched it. */
506
+ /**
507
+ * Whether the act is one that modified the copy, rather than the production that punched it.
508
+ * @category Lookups
509
+ */
477
510
  export declare const isModification: (act: ProductionEvent | Modification) => act is Modification;
478
- /** Whether the act is left stating nothing: it produced, added or removed nothing. */
511
+ /**
512
+ * Whether the act is left stating nothing: it produced, added or removed nothing.
513
+ * @category Lookups
514
+ */
479
515
  export declare const statesNothing: (modification: Modification) => boolean;
480
516
  /**
481
517
  * The features of the copy act by act: what the punching produced
482
518
  * first, then what each modification produced or glued on. A feature a
483
519
  * patch bears states no place of its own and is not among them;
484
520
  * `withBorneFeatures` reaches those.
521
+ * @category Lookups
485
522
  */
486
523
  export declare const featuresByAct: (copy: Pick<RollCopy, 'production' | 'modifications'>) => FeatureOrPatch[][];
487
- /** Every feature the copy states at a place of its own, whichever act made it. */
524
+ /**
525
+ * Every feature the copy states at a place of its own, whichever act made it.
526
+ * @category Lookups
527
+ */
488
528
  export declare const featuresOf: (copy: Pick<RollCopy, 'production' | 'modifications'>) => FeatureOrPatch[];
489
- /** The programs the measurements of a copy name as having taken them, each once, as far as they name any. */
529
+ /**
530
+ * The programs the measurements of a copy name as having taken them, each once, as far as they name any.
531
+ * @category Lookups
532
+ */
490
533
  export declare const measuringSoftwareOf: (copy: Pick<RollCopy, 'measurements'>) => Software[];
491
- /** Whether the condition is the stretch or shrinkage of the paper, as measured on the copy. */
534
+ /**
535
+ * Whether the condition is the stretch or shrinkage of the paper, as measured on the copy.
536
+ * @category Lookups
537
+ */
492
538
  export declare const isPaperStretch: (condition: RollConditionAssignment) => condition is ObjectAssumption<PaperStretch>;
493
- /** What the copy's paper was measured to have done, where anything was measured. */
539
+ /**
540
+ * What the copy's paper was measured to have done, where anything was measured.
541
+ * @category Lookups
542
+ */
494
543
  export declare const paperStretchOf: (copy: Pick<RollCopy, 'conditions'>) => ObjectAssumption<PaperStretch> | undefined;
495
- /** Whether the condition is a tear in the paper. */
544
+ /**
545
+ * Whether the condition is a tear in the paper.
546
+ * @category Lookups
547
+ */
496
548
  export declare const isTear: (condition: RollConditionAssignment) => condition is ObjectAssumption<Tear>;
497
- /** The tears the copy is stated to have. */
549
+ /**
550
+ * The tears the copy is stated to have.
551
+ * @category Lookups
552
+ */
498
553
  export declare const tearsOf: (copy: Pick<RollCopy, 'conditions'>) => ObjectAssumption<Tear>[];
499
554
  /**
500
555
  * The bar a copy is read by, which is the one it was cut for. A copy
501
556
  * that names no system falls back to `defaultTrackerBar`.
557
+ * @category Systems and emulation
502
558
  */
503
559
  export declare const barOf: (copy: Pick<RollCopy, 'production'>) => TrackerBar;
504
- /** The diameter of the punch the copy was cut with, where the edition holds it true or likely. */
560
+ /**
561
+ * The diameter of the punch the copy was cut with, where the edition holds it true or likely.
562
+ * @category Lookups
563
+ */
505
564
  export declare const punchDiameterOf: (copy: Pick<RollCopy, 'production'>) => Millimeters | undefined;
506
565
  /**
507
566
  * Reads the features of a copy as the tracker bar would read them.
@@ -518,6 +577,7 @@ export declare const punchDiameterOf: (copy: Pick<RollCopy, 'production'>) => Mi
518
577
  * would be 318 notes nobody played. The features stay on the copy,
519
578
  * since they are really on the paper and are his calibration of his own
520
579
  * scan; it is the reading that stops.
580
+ * @category Sources
521
581
  */
522
582
  export declare function asSymbols(features: readonly FeatureOrPatch[], bar: TrackerBar): AnySymbol[];
523
583
  /**
@@ -525,6 +585,7 @@ export declare function asSymbols(features: readonly FeatureOrPatch[], bar: Trac
525
585
  * A non-empty result usually means the scan is calibrated wrongly. A chain
526
586
  * lying across several positions is counted against each one the bar
527
587
  * cannot read, and not at all where it reads them all.
588
+ * @category Sources
528
589
  */
529
590
  export declare function unreadTracks(features: readonly FeatureOrPatch[], bar: TrackerBar): Map<Track, number>;
530
591
  /**
@@ -536,5 +597,6 @@ export declare function unreadTracks(features: readonly FeatureOrPatch[], bar: T
536
597
  * were laid out with, and on the rolls measured so far it comes within
537
598
  * about a quarter of a track. It is kept for copies imported before the
538
599
  * calibration was written down; anything read since carries its own.
600
+ * @internal
539
601
  */
540
602
  export declare const calibrationOf: (copy: RollCopy) => TrackCalibration | undefined;
@@ -2,11 +2,19 @@ import { v4 } from "uuid";
2
2
  import { defaultTrackerBar, trackerBarOf } from "../systems/index.js";
3
3
  import { assignReference, certaintyOf, isAsserted } from "./Assumption.js";
4
4
  import { px, track } from "./Quantity.js";
5
+ /**
6
+ * The kinds of condition a copy may be stated to be in.
7
+ * @category Vocabulary
8
+ */
5
9
  export const rollConditions = [
6
10
  'general',
7
11
  'paper-stretch',
8
12
  'torn'
9
13
  ];
14
+ /**
15
+ * What a modification of a copy may have been for.
16
+ * @category Vocabulary
17
+ */
10
18
  export const modificationPurposes = [
11
19
  'musical-improvement',
12
20
  'technical-improvement',
@@ -16,49 +24,81 @@ export const modificationPurposes = [
16
24
  'dating',
17
25
  'glossing'
18
26
  ];
19
- /** What an act brought onto the copy: what it produced or glued on, a removal nothing. */
27
+ /**
28
+ * What an act brought onto the copy: what it produced or glued on, a removal nothing.
29
+ * @category Lookups
30
+ */
20
31
  export const featuresMadeBy = (modification) => {
21
32
  if (modification.type === 'Alteration')
22
33
  return modification.produced;
23
34
  return modification.type === 'Attachment' ? modification.added : [];
24
35
  };
25
- /** Whether the act is one that modified the copy, rather than the production that punched it. */
36
+ /**
37
+ * Whether the act is one that modified the copy, rather than the production that punched it.
38
+ * @category Lookups
39
+ */
26
40
  export const isModification = (act) => 'type' in act;
27
- /** Whether the act is left stating nothing: it produced, added or removed nothing. */
41
+ /**
42
+ * Whether the act is left stating nothing: it produced, added or removed nothing.
43
+ * @category Lookups
44
+ */
28
45
  export const statesNothing = (modification) => modification.type === 'Removal' ? modification.removed.length === 0 : featuresMadeBy(modification).length === 0;
29
46
  /**
30
47
  * The features of the copy act by act: what the punching produced
31
48
  * first, then what each modification produced or glued on. A feature a
32
49
  * patch bears states no place of its own and is not among them;
33
50
  * `withBorneFeatures` reaches those.
51
+ * @category Lookups
34
52
  */
35
53
  export const featuresByAct = (copy) => [copy.production?.produced ?? [], ...copy.modifications.map(featuresMadeBy)];
36
- /** Every feature the copy states at a place of its own, whichever act made it. */
54
+ /**
55
+ * Every feature the copy states at a place of its own, whichever act made it.
56
+ * @category Lookups
57
+ */
37
58
  export const featuresOf = (copy) => featuresByAct(copy).flat();
38
59
  /** The measurements of a copy the edition exports, each of which can say what took it. */
39
60
  const exportedMeasurementsOf = (copy) => [copy.measurements.dimensions, copy.measurements.holeSeparation, copy.measurements.scanResolution]
40
61
  .filter(value => value !== undefined);
41
- /** The programs the measurements of a copy name as having taken them, each once, as far as they name any. */
62
+ /**
63
+ * The programs the measurements of a copy name as having taken them, each once, as far as they name any.
64
+ * @category Lookups
65
+ */
42
66
  export const measuringSoftwareOf = (copy) => {
43
67
  const named = exportedMeasurementsOf(copy)
44
68
  .flatMap(value => value['@annotation']?.belief.reasons ?? [])
45
69
  .flatMap(reason => reason.type === 'measurement' ? reason.software ?? [] : []);
46
70
  return [...new Map(named.map(software => [`${software.name}\u0000${software.version ?? ''}`, software])).values()];
47
71
  };
48
- /** Whether the condition is the stretch or shrinkage of the paper, as measured on the copy. */
72
+ /**
73
+ * Whether the condition is the stretch or shrinkage of the paper, as measured on the copy.
74
+ * @category Lookups
75
+ */
49
76
  export const isPaperStretch = (condition) => condition.conditionType === 'paper-stretch';
50
- /** What the copy's paper was measured to have done, where anything was measured. */
77
+ /**
78
+ * What the copy's paper was measured to have done, where anything was measured.
79
+ * @category Lookups
80
+ */
51
81
  export const paperStretchOf = (copy) => copy.conditions.find(isPaperStretch);
52
- /** Whether the condition is a tear in the paper. */
82
+ /**
83
+ * Whether the condition is a tear in the paper.
84
+ * @category Lookups
85
+ */
53
86
  export const isTear = (condition) => condition.conditionType === 'torn';
54
- /** The tears the copy is stated to have. */
87
+ /**
88
+ * The tears the copy is stated to have.
89
+ * @category Lookups
90
+ */
55
91
  export const tearsOf = (copy) => copy.conditions.filter(isTear);
56
92
  /**
57
93
  * The bar a copy is read by, which is the one it was cut for. A copy
58
94
  * that names no system falls back to `defaultTrackerBar`.
95
+ * @category Systems and emulation
59
96
  */
60
97
  export const barOf = (copy) => trackerBarOf(copy.production?.system) ?? defaultTrackerBar;
61
- /** The diameter of the punch the copy was cut with, where the edition holds it true or likely. */
98
+ /**
99
+ * The diameter of the punch the copy was cut with, where the edition holds it true or likely.
100
+ * @category Lookups
101
+ */
62
102
  export const punchDiameterOf = (copy) => {
63
103
  const diameter = copy.production?.perforator?.condition?.punchDiameter;
64
104
  return diameter && isAsserted(certaintyOf(diameter)) ? diameter.value : undefined;
@@ -78,6 +118,7 @@ export const punchDiameterOf = (copy) => {
78
118
  * would be 318 notes nobody played. The features stay on the copy,
79
119
  * since they are really on the paper and are his calibration of his own
80
120
  * scan; it is the reading that stops.
121
+ * @category Sources
81
122
  */
82
123
  export function asSymbols(features, bar) {
83
124
  const chains = features.filter(feature => feature.type === 'HoleChain');
@@ -97,6 +138,7 @@ export function asSymbols(features, bar) {
97
138
  * A non-empty result usually means the scan is calibrated wrongly. A chain
98
139
  * lying across several positions is counted against each one the bar
99
140
  * cannot read, and not at all where it reads them all.
141
+ * @category Sources
100
142
  */
101
143
  export function unreadTracks(features, bar) {
102
144
  const counts = new Map();
@@ -116,6 +158,7 @@ export function unreadTracks(features, bar) {
116
158
  * were laid out with, and on the rolls measured so far it comes within
117
159
  * about a quarter of a track. It is kept for copies imported before the
118
160
  * calibration was written down; anything read since carries its own.
161
+ * @internal
119
162
  */
120
163
  export const calibrationOf = (copy) => {
121
164
  if (copy.measurements.trackCalibration) {
@@ -5,6 +5,7 @@ import { WithId } from "../shared/utils.js";
5
5
  * physical features on the roll. Symbols are the result of interpreting
6
6
  * the physical features (chains of holes, writings, etc.) on the roll copies.
7
7
  * @see crm:E90 Symbolic Object
8
+ * @category Format types
8
9
  */
9
10
  export interface Symbol<T extends string> extends WithId {
10
11
  type: T;
@@ -18,7 +19,16 @@ export interface Symbol<T extends string> extends WithId {
18
19
  */
19
20
  carriers: ReferenceAssumption[];
20
21
  }
22
+ /**
23
+ * Whether the object is a symbol: a note, an expression or a text.
24
+ * @category Lookups
25
+ */
21
26
  export declare const isSymbol: (object: any) => object is AnySymbol;
27
+ /**
28
+ * Whether the symbol is a command, a note or an expression, rather than
29
+ * a text.
30
+ * @category Lookups
31
+ */
22
32
  export declare const isCommand: (symbol: object | undefined) => symbol is AnyCommand;
23
33
  /**
24
34
  * A command is what the tracker bar reads from a chain of holes: the
@@ -26,6 +36,7 @@ export declare const isCommand: (symbol: object | undefined) => symbol is AnyCom
26
36
  * by such a chain, but it might also have different physical
27
37
  * appearances.
28
38
  * @see reo:Command
39
+ * @category Format types
29
40
  */
30
41
  export interface Command<T extends string> extends Symbol<T> {
31
42
  /**
@@ -63,10 +74,24 @@ export interface Command<T extends string> extends Symbol<T> {
63
74
  */
64
75
  pairedWith?: ReferenceAssumption;
65
76
  }
77
+ /**
78
+ * The ways a command may be placed relative to another, in the order
79
+ * `placementsOf` reports them.
80
+ * @category Vocabulary
81
+ */
66
82
  export declare const placementRelations: readonly ['alignedWith', 'before', 'after'];
67
- /** The ways a command may be placed relative to another. */
83
+ /**
84
+ * The ways a command may be placed relative to another.
85
+ * @category Format types
86
+ */
68
87
  export type PlacementRelation = typeof placementRelations[number];
88
+ /** @inline */
69
89
  type Placeable = Partial<Record<PlacementRelation, ReferenceAssumption>>;
90
+ /**
91
+ * A statement placing a command relative to another: how, and relative
92
+ * to which.
93
+ * @category Format types
94
+ */
70
95
  export type Placement = {
71
96
  relation: PlacementRelation;
72
97
  reference: ReferenceAssumption;
@@ -75,20 +100,24 @@ export type Placement = {
75
100
  * The statements placing a command relative to others, alignment first.
76
101
  * A command is meant to make one at most; the first is the one a
77
102
  * performance applies.
103
+ * @category Lookups
78
104
  */
79
105
  export declare const placementsOf: (command: Placeable) => Placement[];
106
+ /** @inline */
80
107
  type Pairable = WithId & {
81
108
  pairedWith?: ReferenceAssumption;
82
109
  };
83
110
  /**
84
111
  * The pairs among the given commands, each once and in the order the
85
112
  * pairing is stated. A pair whose partner is absent is left out.
113
+ * @category Lookups
86
114
  */
87
115
  export declare const pairsAmong: <S extends Pairable>(commands: readonly S[]) => [S, S][];
88
116
  /**
89
117
  * A note symbol, representing a single pitched musical event on the roll.
90
118
  * The pitch is encoded via the tracker bar position (track number).
91
119
  * @see reo:Note
120
+ * @category Format types
92
121
  */
93
122
  export interface Note extends Command<'note'> {
94
123
  /**
@@ -101,6 +130,7 @@ export interface Note extends Command<'note'> {
101
130
  * The scope of an expression command, indicating whether it applies to
102
131
  * the bass or treble register of the piano.
103
132
  * @see reo:scope
133
+ * @category Format types
104
134
  */
105
135
  export type ExpressionScope = 'bass' | 'treble';
106
136
  /**
@@ -109,6 +139,7 @@ export type ExpressionScope = 'bass' | 'treble';
109
139
  * than sounding a note. Each expression has a scope (bass or treble)
110
140
  * and a specific expression type.
111
141
  * @see reo:Expression
142
+ * @category Format types
112
143
  */
113
144
  export interface Expression extends Command<'expression'> {
114
145
  /**
@@ -128,6 +159,7 @@ export interface Expression extends Command<'expression'> {
128
159
  /**
129
160
  * A textual symbol, e.g. a label or annotation found on the roll.
130
161
  * @see crm:E33 Linguistic Object
162
+ * @category Format types
131
163
  */
132
164
  export interface Text extends Symbol<'text'> {
133
165
  type: 'text';
@@ -140,7 +172,12 @@ export interface Text extends Symbol<'text'> {
140
172
  /**
141
173
  * A symbol can be either a note, an expression, or a text.
142
174
  * Notes and expressions are commands; texts are carried by writings.
175
+ * @category Format types
143
176
  */
144
177
  export type AnySymbol = Note | Expression | Text;
178
+ /**
179
+ * A command: a note or an expression.
180
+ * @category Format types
181
+ */
145
182
  export type AnyCommand = Note | Expression;
146
183
  export {};
@@ -1,14 +1,29 @@
1
1
  import { idOf } from "./Assumption.js";
2
+ /**
3
+ * Whether the object is a symbol: a note, an expression or a text.
4
+ * @category Lookups
5
+ */
2
6
  export const isSymbol = (object) => {
3
7
  return ('type' in object
4
8
  && (object.type === 'note' || object.type === 'expression' || object.type === 'text'));
5
9
  };
10
+ /**
11
+ * Whether the symbol is a command, a note or an expression, rather than
12
+ * a text.
13
+ * @category Lookups
14
+ */
6
15
  export const isCommand = (symbol) => symbol !== undefined && 'type' in symbol && (symbol.type === 'note' || symbol.type === 'expression');
16
+ /**
17
+ * The ways a command may be placed relative to another, in the order
18
+ * `placementsOf` reports them.
19
+ * @category Vocabulary
20
+ */
7
21
  export const placementRelations = ['alignedWith', 'before', 'after'];
8
22
  /**
9
23
  * The statements placing a command relative to others, alignment first.
10
24
  * A command is meant to make one at most; the first is the one a
11
25
  * performance applies.
26
+ * @category Lookups
12
27
  */
13
28
  export const placementsOf = (command) => placementRelations.flatMap(relation => {
14
29
  const reference = command[relation];
@@ -17,6 +32,7 @@ export const placementsOf = (command) => placementRelations.flatMap(relation =>
17
32
  /**
18
33
  * The pairs among the given commands, each once and in the order the
19
34
  * pairing is stated. A pair whose partner is absent is left out.
35
+ * @category Lookups
20
36
  */
21
37
  export const pairsAmong = (commands) => {
22
38
  const byId = new Map(commands.map(p => [p.id, p]));