linked-rolls 0.59.0 → 0.60.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/collation/Collation.d.ts +8 -4
- package/lib/collation/Collation.js +10 -6
- package/lib/io/migrate.js +8 -1
- package/lib/model/Edit.d.ts +8 -1
- package/lib/model/Edit.js +7 -1
- package/lib/ops/collation.js +1 -1
- package/lib/ops/edits.js +15 -9
- package/lib/schema.json +1 -1
- package/package.json +1 -1
|
@@ -108,19 +108,23 @@ export declare const uncheckedMotivation: {
|
|
|
108
108
|
};
|
|
109
109
|
/**
|
|
110
110
|
* Whether the edit is one a collation writes by itself: a bare
|
|
111
|
-
* insertion or a bare deletion saying nothing further, or
|
|
112
|
-
*
|
|
111
|
+
* insertion or a bare deletion saying nothing further, or a recoding
|
|
112
|
+
* that exchanges two systems' spellings for one command.
|
|
113
113
|
*
|
|
114
114
|
* Collating again rewrites these and keeps the rest. An edit that says
|
|
115
115
|
* what the change is, or why it was made, or what it rests on, is an
|
|
116
116
|
* editor's reading of the difference between two texts, and collating
|
|
117
117
|
* the two again is no reason to discard it.
|
|
118
118
|
*
|
|
119
|
-
*
|
|
119
|
+
* Such an exchange counts as the collation's own even where an editor
|
|
120
120
|
* added a motivation to it, because it is derived rather than read:
|
|
121
121
|
* freezing it would leave the transfers, where nearly every edit is
|
|
122
122
|
* one, unable to be collated again at all. What an editor wrote on it
|
|
123
|
-
* is not lost by that, since `connectVersions` keeps an
|
|
123
|
+
* is not lost by that, since `connectVersions` keeps an exchange it
|
|
124
124
|
* draws a second time over the very same symbols.
|
|
125
|
+
*
|
|
126
|
+
* A recoding that only inserts or only deletes is the editor's: a
|
|
127
|
+
* collation types no one-sided edit, so one typed so is a reading of
|
|
128
|
+
* the transfer that collating again must not undo.
|
|
125
129
|
*/
|
|
126
130
|
export declare const isCollationsOwn: (edit: Readonly<Edit>) => boolean;
|
|
@@ -88,7 +88,7 @@ export const collationsOf = (own, inherited, locate, tolerance = defaultCollatio
|
|
|
88
88
|
.map(({ symbol: counterpart }) => ({ symbol, counterpart })));
|
|
89
89
|
};
|
|
90
90
|
/** The edit type a collation draws by itself, from the two systems' vocabularies rather than off the paper. */
|
|
91
|
-
const drawnByCollation = '
|
|
91
|
+
const drawnByCollation = 'recoding';
|
|
92
92
|
/**
|
|
93
93
|
* The motivation a collation writes on what it makes, saying that
|
|
94
94
|
* nobody has read it yet.
|
|
@@ -112,22 +112,26 @@ export const uncheckedMotivation = {
|
|
|
112
112
|
};
|
|
113
113
|
/**
|
|
114
114
|
* Whether the edit is one a collation writes by itself: a bare
|
|
115
|
-
* insertion or a bare deletion saying nothing further, or
|
|
116
|
-
*
|
|
115
|
+
* insertion or a bare deletion saying nothing further, or a recoding
|
|
116
|
+
* that exchanges two systems' spellings for one command.
|
|
117
117
|
*
|
|
118
118
|
* Collating again rewrites these and keeps the rest. An edit that says
|
|
119
119
|
* what the change is, or why it was made, or what it rests on, is an
|
|
120
120
|
* editor's reading of the difference between two texts, and collating
|
|
121
121
|
* the two again is no reason to discard it.
|
|
122
122
|
*
|
|
123
|
-
*
|
|
123
|
+
* Such an exchange counts as the collation's own even where an editor
|
|
124
124
|
* added a motivation to it, because it is derived rather than read:
|
|
125
125
|
* freezing it would leave the transfers, where nearly every edit is
|
|
126
126
|
* one, unable to be collated again at all. What an editor wrote on it
|
|
127
|
-
* is not lost by that, since `connectVersions` keeps an
|
|
127
|
+
* is not lost by that, since `connectVersions` keeps an exchange it
|
|
128
128
|
* draws a second time over the very same symbols.
|
|
129
|
+
*
|
|
130
|
+
* A recoding that only inserts or only deletes is the editor's: a
|
|
131
|
+
* collation types no one-sided edit, so one typed so is a reading of
|
|
132
|
+
* the transfer that collating again must not undo.
|
|
129
133
|
*/
|
|
130
|
-
export const isCollationsOwn = (edit) => edit.editType === drawnByCollation
|
|
134
|
+
export const isCollationsOwn = (edit) => (edit.editType === drawnByCollation && !!edit.insert?.length && !!edit.delete?.length)
|
|
131
135
|
|| (edit.editType === undefined
|
|
132
136
|
&& (edit.motivation === undefined || edit.motivation === unchecked)
|
|
133
137
|
&& edit['@annotation'] === undefined);
|
package/lib/io/migrate.js
CHANGED
|
@@ -54,6 +54,13 @@ const withTypology = (node) => {
|
|
|
54
54
|
}
|
|
55
55
|
return node;
|
|
56
56
|
};
|
|
57
|
+
/** Edit types renamed since: an exchange of two systems' spellings is one kind of recoding. */
|
|
58
|
+
const renamedEditTypes = {
|
|
59
|
+
'replace-with-equivalent': 'recoding'
|
|
60
|
+
};
|
|
61
|
+
const withRenamedEditType = (node) => typeof node.editType === 'string' && Object.hasOwn(renamedEditTypes, node.editType)
|
|
62
|
+
? { ...node, editType: renamedEditTypes[node.editType] }
|
|
63
|
+
: node;
|
|
57
64
|
const withRenamedType = (node) => Object.hasOwn(renamedTypes, node['@type']) ? { ...node, '@type': renamedTypes[node['@type']] } : node;
|
|
58
65
|
/** Whether the feature is of the class under either name, since a node is migrated before its children are. */
|
|
59
66
|
const isOfType = (type) => (feature) => feature?.['@type'] === type || renamedTypes[feature?.['@type']] === type;
|
|
@@ -371,7 +378,7 @@ const withTimeSpanDates = (node) => {
|
|
|
371
378
|
const { '@value': within, '@type': _typed, ...rest } = node;
|
|
372
379
|
return { ...rest, within };
|
|
373
380
|
};
|
|
374
|
-
const migrateNode = (node) => [withRenamedKeys, withTypology, withRenamedType, withoutVersionType, withoutVersionSiglum, withLowerCaseTerms, withSplitMethod, withReferences, withKeeper, withoutEmptyKeeper,
|
|
381
|
+
const migrateNode = (node) => [withRenamedKeys, withRenamedEditType, withTypology, withRenamedType, withoutVersionType, withoutVersionSiglum, withLowerCaseTerms, withSplitMethod, withReferences, withKeeper, withoutEmptyKeeper,
|
|
375
382
|
withPerforator, withProductionNodes, withTypedPerforator, withScale, withoutOps, withDerivationList, withReadingKind, withTimeSpanDates,
|
|
376
383
|
withoutFeatureKind, withBorneFeaturesNamed, withFeaturesInActs, withDriveOfStaggering, withoutPattern, withoutBearings, withoutEntailedType]
|
|
377
384
|
.reduce((result, step) => step(result), node);
|
package/lib/model/Edit.d.ts
CHANGED
|
@@ -7,7 +7,14 @@ export declare const editTypes: readonly [
|
|
|
7
7
|
* sforzando on/off due to the short space left between
|
|
8
8
|
* the notes to be differentiated.
|
|
9
9
|
*/
|
|
10
|
-
'short-dynamic-differentation', 'additional-accent', 'add-redundancy', 'remove-redundancy',
|
|
10
|
+
'short-dynamic-differentation', 'additional-accent', 'add-redundancy', 'remove-redundancy',
|
|
11
|
+
/**
|
|
12
|
+
* Carries the text into another reproducing system's coding: a
|
|
13
|
+
* latched pair of one system giving way to the other's held command,
|
|
14
|
+
* a command the other system cannot read struck, or one of its own
|
|
15
|
+
* put in where the first had no word for it.
|
|
16
|
+
*/
|
|
17
|
+
'recoding', 'shift', 'correct-error', 'shorten', 'prolong'];
|
|
11
18
|
/**
|
|
12
19
|
* The type of editorial change applied to a symbol or set of symbols.
|
|
13
20
|
* Classifies the nature of the edit, e.g. whether it corrects an error,
|
package/lib/model/Edit.js
CHANGED
|
@@ -8,7 +8,13 @@ export const editTypes = [
|
|
|
8
8
|
'additional-accent',
|
|
9
9
|
'add-redundancy',
|
|
10
10
|
'remove-redundancy',
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Carries the text into another reproducing system's coding: a
|
|
13
|
+
* latched pair of one system giving way to the other's held command,
|
|
14
|
+
* a command the other system cannot read struck, or one of its own
|
|
15
|
+
* put in where the first had no word for it.
|
|
16
|
+
*/
|
|
17
|
+
'recoding',
|
|
12
18
|
'shift',
|
|
13
19
|
'correct-error',
|
|
14
20
|
'shorten',
|
package/lib/ops/collation.js
CHANGED
|
@@ -98,7 +98,7 @@ export const connectVersions = (given, childId, parentId, tolerance = defaultCol
|
|
|
98
98
|
return alreadyStated.get(exchangeKey(inserted, deleted)) ?? {
|
|
99
99
|
type: 'edit',
|
|
100
100
|
id: v4(),
|
|
101
|
-
editType: '
|
|
101
|
+
editType: 'recoding',
|
|
102
102
|
motivation: unchecked,
|
|
103
103
|
insert: [...by],
|
|
104
104
|
delete: deleted
|
package/lib/ops/edits.js
CHANGED
|
@@ -31,18 +31,24 @@ const guessEditType = (view, versionId, edit) => {
|
|
|
31
31
|
const bar = trackerBarOf(view.version(versionId)?.system);
|
|
32
32
|
const parentBar = trackerBarOf(view.predecessorOf(versionId)?.system);
|
|
33
33
|
/**
|
|
34
|
-
* Where the version is coded for another system than its parent,
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* SforzandoForte says the same thing in the other system's words,
|
|
38
|
-
*
|
|
39
|
-
*
|
|
34
|
+
* Where the version is coded for another system than its parent,
|
|
35
|
+
* expression matter changed is the transfer being carried out: a red
|
|
36
|
+
* ForzandoOn and ForzandoOff pair giving way to one held green
|
|
37
|
+
* SforzandoForte says the same thing in the other system's words, and
|
|
38
|
+
* a red command the green bar cannot read struck, or a green hold put
|
|
39
|
+
* in where the red had no word for it, belongs to the same act. That
|
|
40
|
+
* is a recoding. Calling it a corrected error would say the editor
|
|
41
|
+
* made a mistake. Only an insertion spelling the bar's own accent
|
|
42
|
+
* reads more narrowly, as the accent it spells.
|
|
40
43
|
*/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
const transferred = bar && parentBar && bar.id !== parentBar.id;
|
|
45
|
+
if (transferred && inserted.length > 0 && deleted.length > 0)
|
|
46
|
+
return 'recoding';
|
|
44
47
|
if (deleted.length === 0 && accentsOn(bar).some(accent => sameSequence(inserted, accent)))
|
|
45
48
|
return 'additional-accent';
|
|
49
|
+
const onlyExpressions = [...inserts, ...deletes].every(symbol => symbol.type === 'expression');
|
|
50
|
+
if (transferred && onlyExpressions && inserted.length + deleted.length > 0)
|
|
51
|
+
return 'recoding';
|
|
46
52
|
if (inserted.length > 1 && sameSequence(inserted, deleted))
|
|
47
53
|
return 'shift';
|
|
48
54
|
if (inserted.length === 0 && deleted.length === 1)
|
package/lib/schema.json
CHANGED
package/package.json
CHANGED