linked-rolls 0.67.0 → 0.68.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/lib/analysis/text.d.ts +6 -1
- package/lib/analysis/text.js +11 -8
- package/package.json +1 -1
package/lib/analysis/text.d.ts
CHANGED
|
@@ -10,6 +10,11 @@ export declare const placedCarriersOf: (edition: Pick<Edition, 'copies'>, symbol
|
|
|
10
10
|
* Where along the roll the symbol lies, as its carriers put it, or
|
|
11
11
|
* nothing for a symbol no copy carries.
|
|
12
12
|
*
|
|
13
|
+
* Either end is the median of the carriers' rather than their mean, so
|
|
14
|
+
* that a copy which puts the symbol well away from the rest, torn,
|
|
15
|
+
* stretched or badly aligned there, does not draw it away from where
|
|
16
|
+
* the others agree it lies. Two carriers have the two alike.
|
|
17
|
+
*
|
|
13
18
|
* Only the place is measured. Which track the symbol sits on is not
|
|
14
19
|
* a measurement but a question for a tracker bar, since a note of
|
|
15
20
|
* one pitch sits on exactly one position of a given bar: ask
|
|
@@ -20,7 +25,7 @@ export declare const placedCarriersOf: (edition: Pick<Edition, 'copies'>, symbol
|
|
|
20
25
|
* position a semitone away on either bar.
|
|
21
26
|
*/
|
|
22
27
|
export declare const placeOf: (edition: Pick<Edition, 'copies'>, symbol: AnySymbol) => Readonly<HorizontalSpan> | undefined;
|
|
23
|
-
/** Where the symbol begins, as the
|
|
28
|
+
/** Where the symbol begins, as the median onset of its carriers, or nothing for a symbol without a place. */
|
|
24
29
|
export declare const onsetOf: (edition: Pick<Edition, 'copies'>, symbol: AnySymbol) => Millimeters | undefined;
|
|
25
30
|
/**
|
|
26
31
|
* The symbols the version shows: what it and its ancestors insert,
|
package/lib/analysis/text.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isPlaced } from "../model/Feature.js";
|
|
2
2
|
import { deletedBy, insertedBy } from "../model/Version.js";
|
|
3
3
|
import { idsOf } from "../model/Assumption.js";
|
|
4
|
-
import {
|
|
4
|
+
import { medianOf } from "../collation/statistics.js";
|
|
5
5
|
import { featuresIn } from "../lookup/lookup.js";
|
|
6
6
|
import { perState } from "../lookup/perState.js";
|
|
7
7
|
import { lineageOf } from "./stemma.js";
|
|
@@ -12,6 +12,11 @@ export const placedCarriersOf = (edition, symbol) => carriersOf(edition, symbol)
|
|
|
12
12
|
* Where along the roll the symbol lies, as its carriers put it, or
|
|
13
13
|
* nothing for a symbol no copy carries.
|
|
14
14
|
*
|
|
15
|
+
* Either end is the median of the carriers' rather than their mean, so
|
|
16
|
+
* that a copy which puts the symbol well away from the rest, torn,
|
|
17
|
+
* stretched or badly aligned there, does not draw it away from where
|
|
18
|
+
* the others agree it lies. Two carriers have the two alike.
|
|
19
|
+
*
|
|
15
20
|
* Only the place is measured. Which track the symbol sits on is not
|
|
16
21
|
* a measurement but a question for a tracker bar, since a note of
|
|
17
22
|
* one pitch sits on exactly one position of a given bar: ask
|
|
@@ -23,15 +28,13 @@ export const placedCarriersOf = (edition, symbol) => carriersOf(edition, symbol)
|
|
|
23
28
|
*/
|
|
24
29
|
export const placeOf = (edition, symbol) => {
|
|
25
30
|
const carriers = placedCarriersOf(edition, symbol);
|
|
26
|
-
|
|
31
|
+
const from = medianOf(carriers.map(carrier => carrier.horizontal.from));
|
|
32
|
+
const to = medianOf(carriers.map(carrier => carrier.horizontal.to));
|
|
33
|
+
if (from === undefined || to === undefined)
|
|
27
34
|
return;
|
|
28
|
-
return {
|
|
29
|
-
unit: 'mm',
|
|
30
|
-
from: mean(carriers.map(carrier => carrier.horizontal.from)),
|
|
31
|
-
to: mean(carriers.map(carrier => carrier.horizontal.to))
|
|
32
|
-
};
|
|
35
|
+
return { unit: 'mm', from, to };
|
|
33
36
|
};
|
|
34
|
-
/** Where the symbol begins, as the
|
|
37
|
+
/** Where the symbol begins, as the median onset of its carriers, or nothing for a symbol without a place. */
|
|
35
38
|
export const onsetOf = (edition, symbol) => placeOf(edition, symbol)?.from;
|
|
36
39
|
/** The symbols by onset, those without a place first; symbols at one place keep their order. */
|
|
37
40
|
const inOrderOfPlace = (edition, symbols) => symbols
|
package/package.json
CHANGED