vexflow-native 1.8.0 → 2.0.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 +71 -403
- package/lib/module/base/FontManager.js +5 -5
- package/lib/module/base/FontManager.js.map +1 -1
- package/lib/module/base/VexflowCanvas.js +1 -1
- package/lib/module/base/VexflowCanvas.js.map +1 -1
- package/lib/module/base/VexflowRecordingContext.js +2 -0
- package/lib/module/base/VexflowRecordingContext.js.map +1 -1
- package/lib/module/base/VexflowRecordingReplay.js +1 -1
- package/lib/module/base/VexflowRecordingReplay.js.map +1 -1
- package/lib/module/base/index.js +1 -0
- package/lib/module/base/index.js.map +1 -1
- package/lib/module/musicxml/MusicXmlParser/MeasureParser.js +24 -7
- package/lib/module/musicxml/MusicXmlParser/MeasureParser.js.map +1 -1
- package/lib/module/musicxml/MusicXmlParser/MusicXmlDirections.js +11 -3
- package/lib/module/musicxml/MusicXmlParser/MusicXmlDirections.js.map +1 -1
- package/lib/module/musicxml/MusicXmlParser/Spanners.js +21 -5
- package/lib/module/musicxml/MusicXmlParser/Spanners.js.map +1 -1
- package/lib/module/musicxml/MusicXmlParser/mappers.js +1 -1
- package/lib/module/musicxml/MusicXmlParser/mappers.js.map +1 -1
- package/lib/module/{state/constants.js → percussion/index.js} +3 -3
- package/lib/module/percussion/index.js.map +1 -0
- package/lib/module/renderer/ScoreRenderer/ScoreOverlayPicture.js +4 -3
- package/lib/module/renderer/ScoreRenderer/ScoreOverlayPicture.js.map +1 -1
- package/lib/module/renderer/ScoreRenderer/ScorePlayhead.js +1 -1
- package/lib/module/renderer/ScoreRenderer/ScorePlayhead.js.map +1 -1
- package/lib/module/renderer/ScoreRenderer/ScoreRenderer.js +5 -1
- package/lib/module/renderer/ScoreRenderer/ScoreRenderer.js.map +1 -1
- package/lib/module/renderer/ScoreRenderer/utils.js +1 -1
- package/lib/module/renderer/ScoreRenderer/utils.js.map +1 -1
- package/lib/module/renderer/fixedNoteSpacing.js +56 -0
- package/lib/module/renderer/fixedNoteSpacing.js.map +1 -0
- package/lib/module/renderer/index.js +1 -0
- package/lib/module/renderer/index.js.map +1 -1
- package/lib/module/renderer/itemLayout.js +108 -0
- package/lib/module/renderer/itemLayout.js.map +1 -0
- package/lib/module/renderer/measure.js +30 -106
- package/lib/module/renderer/measure.js.map +1 -1
- package/lib/module/renderer/measureBounds.js +73 -0
- package/lib/module/renderer/measureBounds.js.map +1 -0
- package/lib/module/renderer/measureModifiers.js +99 -0
- package/lib/module/renderer/measureModifiers.js.map +1 -0
- package/lib/module/renderer/noteModifiers.js +212 -0
- package/lib/module/renderer/noteModifiers.js.map +1 -0
- package/lib/module/renderer/render.js +33 -116
- package/lib/module/renderer/render.js.map +1 -1
- package/lib/module/renderer/scale.js +16 -2
- package/lib/module/renderer/scale.js.map +1 -1
- package/lib/module/renderer/scoreParsing.js +37 -199
- package/lib/module/renderer/scoreParsing.js.map +1 -1
- package/lib/module/renderer/stave.js +19 -3
- package/lib/module/renderer/stave.js.map +1 -1
- package/lib/module/renderer/useScoreRecording.js +10 -3
- package/lib/module/renderer/useScoreRecording.js.map +1 -1
- package/lib/module/renderer/vfKeys.js +72 -0
- package/lib/module/renderer/vfKeys.js.map +1 -0
- package/lib/module/state/index.js +1 -1
- package/lib/module/state/index.js.map +1 -1
- package/lib/typescript/src/base/FontManager.d.ts +3 -2
- package/lib/typescript/src/base/FontManager.d.ts.map +1 -1
- package/lib/typescript/src/base/VexflowRecordingContext.d.ts +2 -1
- package/lib/typescript/src/base/VexflowRecordingContext.d.ts.map +1 -1
- package/lib/typescript/src/base/VexflowRecordingReplay.d.ts +1 -1
- package/lib/typescript/src/base/VexflowRecordingReplay.d.ts.map +1 -1
- package/lib/typescript/src/base/index.d.ts +1 -0
- package/lib/typescript/src/base/index.d.ts.map +1 -1
- package/lib/typescript/src/base/types.d.ts +1 -1
- package/lib/typescript/src/base/types.d.ts.map +1 -1
- package/lib/typescript/src/musicxml/MusicXmlParser/InternalTypes.d.ts +4 -2
- package/lib/typescript/src/musicxml/MusicXmlParser/InternalTypes.d.ts.map +1 -1
- package/lib/typescript/src/musicxml/MusicXmlParser/MeasureParser.d.ts.map +1 -1
- package/lib/typescript/src/musicxml/MusicXmlParser/MusicXmlDirections.d.ts +6 -1
- package/lib/typescript/src/musicxml/MusicXmlParser/MusicXmlDirections.d.ts.map +1 -1
- package/lib/typescript/src/musicxml/MusicXmlParser/Spanners.d.ts +6 -1
- package/lib/typescript/src/musicxml/MusicXmlParser/Spanners.d.ts.map +1 -1
- package/lib/typescript/src/musicxml/MusicXmlParser/mappers.d.ts.map +1 -1
- package/lib/typescript/src/musicxml/index.d.ts +1 -0
- package/lib/typescript/src/musicxml/index.d.ts.map +1 -1
- package/lib/typescript/src/percussion/index.d.ts +4 -0
- package/lib/typescript/src/percussion/index.d.ts.map +1 -0
- package/lib/typescript/src/renderer/ScoreRenderer/ScoreOverlayPicture.d.ts +1 -1
- package/lib/typescript/src/renderer/ScoreRenderer/ScoreOverlayPicture.d.ts.map +1 -1
- package/lib/typescript/src/renderer/ScoreRenderer/ScorePlayhead.d.ts +1 -1
- package/lib/typescript/src/renderer/ScoreRenderer/ScorePlayhead.d.ts.map +1 -1
- package/lib/typescript/src/renderer/ScoreRenderer/ScoreRenderer.d.ts.map +1 -1
- package/lib/typescript/src/renderer/ScoreRenderer/types.d.ts +1 -1
- package/lib/typescript/src/renderer/ScoreRenderer/types.d.ts.map +1 -1
- package/lib/typescript/src/renderer/ScoreRenderer/utils.d.ts +1 -1
- package/lib/typescript/src/renderer/ScoreRenderer/utils.d.ts.map +1 -1
- package/lib/typescript/src/renderer/fixedNoteSpacing.d.ts +17 -0
- package/lib/typescript/src/renderer/fixedNoteSpacing.d.ts.map +1 -0
- package/lib/typescript/src/renderer/index.d.ts +2 -0
- package/lib/typescript/src/renderer/index.d.ts.map +1 -1
- package/lib/typescript/src/renderer/itemLayout.d.ts +23 -0
- package/lib/typescript/src/renderer/itemLayout.d.ts.map +1 -0
- package/lib/typescript/src/renderer/layout.d.ts +1 -1
- package/lib/typescript/src/renderer/layout.d.ts.map +1 -1
- package/lib/typescript/src/renderer/measure.d.ts +3 -6
- package/lib/typescript/src/renderer/measure.d.ts.map +1 -1
- package/lib/typescript/src/renderer/measureBounds.d.ts +13 -0
- package/lib/typescript/src/renderer/measureBounds.d.ts.map +1 -0
- package/lib/typescript/src/renderer/measureModifiers.d.ts +20 -0
- package/lib/typescript/src/renderer/measureModifiers.d.ts.map +1 -0
- package/lib/typescript/src/renderer/noteModifiers.d.ts +29 -0
- package/lib/typescript/src/renderer/noteModifiers.d.ts.map +1 -0
- package/lib/typescript/src/renderer/render.d.ts +2 -27
- package/lib/typescript/src/renderer/render.d.ts.map +1 -1
- package/lib/typescript/src/renderer/scale.d.ts.map +1 -1
- package/lib/typescript/src/renderer/scoreParsing.d.ts +14 -42
- package/lib/typescript/src/renderer/scoreParsing.d.ts.map +1 -1
- package/lib/typescript/src/renderer/stave.d.ts +2 -0
- package/lib/typescript/src/renderer/stave.d.ts.map +1 -1
- package/lib/typescript/src/renderer/types.d.ts +52 -3
- package/lib/typescript/src/renderer/types.d.ts.map +1 -1
- package/lib/typescript/src/renderer/useScoreRecording.d.ts +3 -3
- package/lib/typescript/src/renderer/useScoreRecording.d.ts.map +1 -1
- package/lib/typescript/src/renderer/vfKeys.d.ts +17 -0
- package/lib/typescript/src/renderer/vfKeys.d.ts.map +1 -0
- package/lib/typescript/src/state/index.d.ts +1 -1
- package/lib/typescript/src/state/index.d.ts.map +1 -1
- package/lib/typescript/src/state/types.d.ts +23 -5
- package/lib/typescript/src/state/types.d.ts.map +1 -1
- package/package.json +31 -17
- package/src/base/FontManager.ts +5 -11
- package/src/base/TextMeasureContext.ts +1 -1
- package/src/base/VexflowCanvas.tsx +1 -1
- package/src/base/VexflowRecordingContext.ts +2 -4
- package/src/base/VexflowRecordingReplay.ts +1 -1
- package/src/base/index.ts +1 -0
- package/src/base/types.ts +1 -1
- package/src/musicxml/MusicXmlParser/InternalTypes.ts +5 -2
- package/src/musicxml/MusicXmlParser/MeasureParser.ts +36 -7
- package/src/musicxml/MusicXmlParser/MusicXmlDirections.ts +25 -8
- package/src/musicxml/MusicXmlParser/Spanners.ts +27 -4
- package/src/musicxml/MusicXmlParser/mappers.ts +7 -0
- package/src/musicxml/index.ts +1 -0
- package/src/percussion/index.ts +7 -0
- package/src/renderer/Layout/VerticalSpacing.ts +1 -1
- package/src/renderer/ScoreRenderer/ScoreOverlayPicture.tsx +4 -7
- package/src/renderer/ScoreRenderer/ScorePlayhead.tsx +1 -1
- package/src/renderer/ScoreRenderer/ScoreRenderer.tsx +5 -7
- package/src/renderer/ScoreRenderer/types.ts +1 -4
- package/src/renderer/ScoreRenderer/utils.ts +1 -1
- package/src/renderer/fixedNoteSpacing.ts +78 -0
- package/src/renderer/index.ts +8 -0
- package/src/renderer/itemLayout.ts +137 -0
- package/src/renderer/layout.ts +1 -1
- package/src/renderer/measure.tsx +84 -186
- package/src/renderer/measureBounds.ts +109 -0
- package/src/renderer/measureModifiers.ts +133 -0
- package/src/renderer/noteModifiers.ts +298 -0
- package/src/renderer/render.tsx +59 -169
- package/src/renderer/scale.ts +21 -1
- package/src/renderer/scoreParsing.tsx +77 -288
- package/src/renderer/stave.ts +22 -3
- package/src/renderer/types.ts +66 -3
- package/src/renderer/useScoreRecording.ts +12 -4
- package/src/renderer/vfKeys.ts +88 -0
- package/src/state/index.ts +1 -1
- package/src/state/types.ts +30 -5
- package/lib/module/musicxml/testfiles/lg-8102429.xml +0 -79620
- package/lib/module/state/constants.js.map +0 -1
- package/lib/typescript/src/state/constants.d.ts +0 -4
- package/lib/typescript/src/state/constants.d.ts.map +0 -1
- package/src/musicxml/testfiles/lg-8102429.xml +0 -79620
- package/src/state/constants.ts +0 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scoreParsing.d.ts","sourceRoot":"","sources":["../../../../src/renderer/scoreParsing.tsx"],"names":[],"mappings":"AAAA,OA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W,EAAE,CAAC;IACrB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAkFA;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,KAAK,GAAG,gBAAgB,EAAE,CAwBvE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,gBAAgB,GACtB,KAAK,EAAE,CAIT"}
|
|
@@ -6,4 +6,6 @@ import type { StaffLines } from '../state';
|
|
|
6
6
|
* config.
|
|
7
7
|
*/
|
|
8
8
|
export declare function applyStaffLines(stave: Stave, lines?: StaffLines): Stave;
|
|
9
|
+
/** Stroke centre y of every drawn line of a rendered stave, top to bottom. */
|
|
10
|
+
export declare function visibleLineYs(stave: Stave, lines?: StaffLines): number[];
|
|
9
11
|
//# sourceMappingURL=stave.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stave.d.ts","sourceRoot":"","sources":["../../../../src/renderer/stave.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"stave.d.ts","sourceRoot":"","sources":["../../../../src/renderer/stave.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAe3C;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,UAAU,GAAG,KAAK,CAcvE;AAED,8EAA8E;AAC9E,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,UAAU,GAAG,MAAM,EAAE,CAIxE"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { SkTypefaceFontProvider } from '
|
|
1
|
+
import type { SkTypefaceFontProvider } from 'react-native-skia';
|
|
2
2
|
import type { SharedValue } from 'react-native-reanimated';
|
|
3
|
+
import type { RenderContext, StaveNote } from 'vexflow';
|
|
3
4
|
import type { VexflowStyleOverride } from '../base';
|
|
4
|
-
import type { Score } from '../state';
|
|
5
|
+
import type { Clef, NoteAttachment, Score, Staff, VoiceItem } from '../state';
|
|
5
6
|
import type { ScoreColorScheme } from './colorScheme';
|
|
6
7
|
export type RendererType = 'infiniteScore' | 'document' | 'documentEven';
|
|
7
8
|
export type ScoreItemStyleOverride = VexflowStyleOverride;
|
|
@@ -40,7 +41,35 @@ export interface ScoreScrollGeometry {
|
|
|
40
41
|
contentSize: RendererSize;
|
|
41
42
|
maxScroll: number;
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
+
/** Where a voice item sits when its VexFlow note is built. */
|
|
45
|
+
export interface ScoreItemContext {
|
|
46
|
+
clef: Clef;
|
|
47
|
+
staff: Staff;
|
|
48
|
+
measureIndex: number;
|
|
49
|
+
/** For rests, the rest-eligible subset (everything but grace). */
|
|
50
|
+
attachments: readonly NoteAttachment[];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Called once per drawable item (not hidden/spacer rests) in BOTH the
|
|
54
|
+
* measurement and the drawing pass, after the item's own attachments are
|
|
55
|
+
* applied, before measure directions and before formatting, so added
|
|
56
|
+
* modifiers count in width and vertical bounds. Must be deterministic in its
|
|
57
|
+
* inputs; `note` is rebuilt on every pass.
|
|
58
|
+
*/
|
|
59
|
+
export type DecorateItem = (item: VoiceItem, note: StaveNote, context: ScoreItemContext) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Called in the drawing pass only, right after the note and its modifiers
|
|
62
|
+
* are drawn, inside the item's color group. `layout` is the item's geometry
|
|
63
|
+
* in content space — the space `ctx` draws in (VexFlow units before
|
|
64
|
+
* `render.scale`); `onItemsLayout` receives the same entry scaled to view
|
|
65
|
+
* space.
|
|
66
|
+
*/
|
|
67
|
+
export type DrawItem = (ctx: RenderContext, item: VoiceItem, note: StaveNote, layout: Readonly<ScoreItemLayout>) => void;
|
|
68
|
+
export interface ScoreItemHooks {
|
|
69
|
+
decorateItem?: DecorateItem;
|
|
70
|
+
onDrawItem?: DrawItem;
|
|
71
|
+
}
|
|
72
|
+
export interface ScoreRendererProps extends ScoreItemHooks {
|
|
44
73
|
score: Score;
|
|
45
74
|
defaultFont: string;
|
|
46
75
|
fontManager: SkTypefaceFontProvider;
|
|
@@ -144,6 +173,18 @@ export interface ScoreItemLayout {
|
|
|
144
173
|
*/
|
|
145
174
|
headCenterX: number;
|
|
146
175
|
measureIndex: number;
|
|
176
|
+
/**
|
|
177
|
+
* Union box of the item's drawn modifiers (articulations, annotations,
|
|
178
|
+
* dynamics, lyrics, grace notes, parentheses, accidentals, dots), in the
|
|
179
|
+
* same space as `x`. undefined when the item has no modifiers.
|
|
180
|
+
*/
|
|
181
|
+
modifierBounds?: ScoreItemBounds;
|
|
182
|
+
}
|
|
183
|
+
export interface ScoreItemBounds {
|
|
184
|
+
left: number;
|
|
185
|
+
right: number;
|
|
186
|
+
top: number;
|
|
187
|
+
bottom: number;
|
|
147
188
|
}
|
|
148
189
|
/**
|
|
149
190
|
* Geometry of one rendered stave of a measure. Entries of the same measure
|
|
@@ -171,6 +212,14 @@ export interface ScoreMeasureItemsLayout {
|
|
|
171
212
|
staveLineTopY: number;
|
|
172
213
|
/** Bottom edge of this stave's bottom staff line (hidden lines included). */
|
|
173
214
|
staveLineBottomY: number;
|
|
215
|
+
/**
|
|
216
|
+
* Stroke centre y of each drawn line, top to bottom (5, 3 or 1 entries).
|
|
217
|
+
* On a five-line staff `visibleLineYs[0] === staveLineTopY` and the last
|
|
218
|
+
* entry is `staveLineBottomY - lineWidth`; with hidden lines
|
|
219
|
+
* `staveLineTopY`/`staveLineBottomY` still span the five-line geometry, so
|
|
220
|
+
* read the drawn line from here. Always emitted by the renderer.
|
|
221
|
+
*/
|
|
222
|
+
visibleLineYs?: number[];
|
|
174
223
|
}
|
|
175
224
|
/**
|
|
176
225
|
* Geometry of all rendered items keyed by item id, plus per-stave measure
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/renderer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/renderer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAExD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,MAAM,MAAM,YAAY,GAAG,eAAe,GAAG,UAAU,GAAG,cAAc,CAAC;AACzE,MAAM,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AAC1D,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;AAE7E;2CAC2C;AAC3C,MAAM,MAAM,UAAU,GAAG,YAAY,GAAG,UAAU,CAAC;AAEnD;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,8EAA8E;AAC9E,MAAM,WAAW,kBAAkB;IACjC,0DAA0D;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,k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EAAE,CAAC;IACpC,WAAW,EAAE,YAAY,CAAC;CAC3B;AAED,MAAM,WAAW,aAAa;IAC5B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,YAAa,SAAQ,aAAa,EAAE,YAAY;CAAG;AAEpE,MAAM,WAAW,eAAgB,SAAQ,YAAY;CAAG"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { SkTypefaceFontProvider } from '
|
|
1
|
+
import type { SkTypefaceFontProvider } from 'react-native-skia';
|
|
2
2
|
import type { VexflowRecordingCommand } from '../base';
|
|
3
3
|
import { type VexflowRecordingGroupIndex } from '../base/VexflowRecordingIndex';
|
|
4
4
|
import type { Score } from '../state';
|
|
5
5
|
import { type ScoreLayoutPlan } from './layout';
|
|
6
6
|
import type { ResolvedScoreColorScheme } from './colorScheme';
|
|
7
|
-
import type { RendererRect, RendererType, ScoreItemsLayout, ScoreOptions } from './types';
|
|
7
|
+
import type { RendererRect, RendererType, ScoreItemHooks, ScoreItemsLayout, ScoreOptions } from './types';
|
|
8
8
|
export interface ScoreRecording {
|
|
9
9
|
/** Recorded draw commands, content-space coordinates. */
|
|
10
10
|
commands: readonly VexflowRecordingCommand[];
|
|
@@ -21,7 +21,7 @@ export interface ScoreRecording {
|
|
|
21
21
|
/** Emitted geometry, already converted to view space. */
|
|
22
22
|
itemsLayout: ScoreItemsLayout;
|
|
23
23
|
}
|
|
24
|
-
export declare function useScoreRecording({ defaultFont, enabled, fontManager, colorScheme, options, rendererType, score, viewport, }: {
|
|
24
|
+
export declare function useScoreRecording({ decorateItem, defaultFont, enabled, fontManager, colorScheme, onDrawItem, options, rendererType, score, viewport, }: ScoreItemHooks & {
|
|
25
25
|
defaultFont: string;
|
|
26
26
|
enabled?: boolean;
|
|
27
27
|
fontManager: SkTypefaceFontProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScoreRecording.d.ts","sourceRoot":"","sources":["../../../../src/renderer/useScoreRecording.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useScoreRecording.d.ts","sourceRoot":"","sources":["../../../../src/renderer/useScoreRecording.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAEhE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEvD,OAAO,EAEL,KAAK,0BAA0B,EAChC,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,EAAe,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAQ7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,YAAY,EACb,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,cAAc;IAC7B,yDAAyD;IACzD,QAAQ,EAAE,SAAS,uBAAuB,EAAE,CAAC;IAC7C;;;OAGG;IACH,UAAU,EAAE,0BAA0B,CAAC;IACvC;;;OAGG;IACH,UAAU,EAAE,eAAe,CAAC;IAC5B,yDAAyD;IACzD,WAAW,EAAE,gBAAgB,CAAC;CAC/B;AAED,wBAAgB,iBAAiB,CAAC,EAChC,YAAY,EACZ,WAAW,EACX,OAAc,EACd,WAAW,EACX,WAAW,EACX,UAAU,EACV,OAAO,EACP,YAAY,EACZ,KAAK,EACL,QAAQ,GACT,EAAE,cAAc,GAAG;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,sBAAsB,CAAC;IACpC,WAAW,EAAE,wBAAwB,CAAC;IACtC,OAAO,EAAE,YAAY,CAAC;IACtB,YAAY,EAAE,YAAY,CAAC;IAC3B,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,YAAY,CAAC;CACxB,GAAG,cAAc,CAmFjB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Clef, DurationValue, Pitch, Rest } from '../state';
|
|
2
|
+
/**
|
|
3
|
+
* Converts an internal pitch into the VexFlow key string format.
|
|
4
|
+
*/
|
|
5
|
+
export declare function pitchToVFKey(pitch: Pitch): string;
|
|
6
|
+
/**
|
|
7
|
+
* VexFlow key placing a rest on `staffLine` (0 = bottom line … 4 = top line,
|
|
8
|
+
* undefined = middle line) under `clef`. VexFlow lines are pitch-based per
|
|
9
|
+
* clef, so the key is the treble pitch of the line minus the clef's shift,
|
|
10
|
+
* counting diatonic steps from c/4 (the ledger line below a treble staff).
|
|
11
|
+
*/
|
|
12
|
+
export declare function restKeyForStaffLine(clef: Clef, staffLine: Rest['staffLine']): string;
|
|
13
|
+
/**
|
|
14
|
+
* Converts a duration into the VexFlow duration token, including rests.
|
|
15
|
+
*/
|
|
16
|
+
export declare function durationToVF(duration: DurationValue, isRest?: boolean): string;
|
|
17
|
+
//# sourceMappingURL=vfKeys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vfKeys.d.ts","sourceRoot":"","sources":["../../../../src/renderer/vfKeys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,EAAY,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAgB3E;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAejD;AAqBD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC,GAC3B,MAAM,CAOR;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,UAAQ,GAAG,MAAM,CAW5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/state/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/state/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,cAAc,SAAS,CAAC"}
|
|
@@ -7,7 +7,7 @@ export type StemDirection = 'up' | 'down' | 'auto';
|
|
|
7
7
|
export type Notehead = 'x' | 'circle-x' | 'diamond' | 'circle' | 'square' | 'triangle' | 'triangle-down' | 'slash';
|
|
8
8
|
export type Barline = 'single' | 'double' | 'end' | 'repeat-begin' | 'repeat-end' | 'final';
|
|
9
9
|
export type Articulation = 'staccato' | 'tenuto' | 'accent' | 'marcato' | 'staccatissimo' | 'fermata' | 'open' | 'stopped';
|
|
10
|
-
export type Dynamic = 'ppp' | 'pp' | 'p' | 'mp' | 'mf' | 'f' | 'ff' | 'fff' | 'sfz';
|
|
10
|
+
export type Dynamic = 'ppp' | 'pp' | 'p' | 'mp' | 'mf' | 'f' | 'ff' | 'fff' | 'fp' | 'sf' | 'sfp' | 'sfz' | 'rf' | 'rfz' | 'fz' | 'n';
|
|
11
11
|
export type KeyMode = 'major' | 'minor' | 'dorian' | 'phrygian' | 'lydian' | 'mixolydian' | 'locrian';
|
|
12
12
|
export type VoiceTimingMode = 'strict' | 'soft' | 'free';
|
|
13
13
|
export type StaffGroupRole = 'grandStaff' | 'choir' | 'section' | 'custom';
|
|
@@ -21,9 +21,8 @@ export interface Pitch {
|
|
|
21
21
|
octave: number;
|
|
22
22
|
accidental?: Accidental;
|
|
23
23
|
notehead?: Notehead;
|
|
24
|
-
ghost
|
|
25
|
-
|
|
26
|
-
accent?: boolean;
|
|
24
|
+
/** Draws the notehead in parentheses (a ghost note). */
|
|
25
|
+
parenthesized?: boolean;
|
|
27
26
|
}
|
|
28
27
|
export interface DurationValue {
|
|
29
28
|
length: NoteLength;
|
|
@@ -37,6 +36,7 @@ export interface KeySignature {
|
|
|
37
36
|
export interface Meter {
|
|
38
37
|
beats: number;
|
|
39
38
|
beatUnit: number;
|
|
39
|
+
/** Omitted = VexFlow's default for the meter: numerators divisible by 3 group in threes, else 2/beatUnit above a quarter (5/8 → 2/8), else 1/beatUnit (5/4 → 1/4). */
|
|
40
40
|
beamGroups?: Fraction[];
|
|
41
41
|
}
|
|
42
42
|
export interface Tempo {
|
|
@@ -60,7 +60,11 @@ export interface Rest {
|
|
|
60
60
|
voiceId: Id;
|
|
61
61
|
targetStaffId?: Id;
|
|
62
62
|
kind?: 'visible' | 'spacer' | 'hidden';
|
|
63
|
-
|
|
63
|
+
/**
|
|
64
|
+
* 0 = bottom line … 4 = top line of the five-line geometry; undefined = the
|
|
65
|
+
* middle line.
|
|
66
|
+
*/
|
|
67
|
+
staffLine?: 0 | 1 | 2 | 3 | 4;
|
|
64
68
|
}
|
|
65
69
|
export interface Chord {
|
|
66
70
|
id: Id;
|
|
@@ -88,19 +92,26 @@ export interface MeasureState {
|
|
|
88
92
|
export interface MeasureLeftModifiers {
|
|
89
93
|
/** undefined = shown on the first measure only; false hides it there too. */
|
|
90
94
|
showClef?: boolean;
|
|
95
|
+
/** undefined = hidden. */
|
|
91
96
|
showMeter?: boolean;
|
|
97
|
+
/** undefined = hidden; never drawn on a percussion clef. */
|
|
92
98
|
showKeySignature?: boolean;
|
|
99
|
+
/** undefined = 'single'; only 'single' and 'repeat-begin' render here. */
|
|
93
100
|
startBarline?: Barline;
|
|
94
101
|
}
|
|
95
102
|
export interface MeasureRightModifiers {
|
|
103
|
+
/** undefined = 'single'; 'repeat-begin' draws as a single line. */
|
|
96
104
|
endBarline?: Barline;
|
|
97
105
|
}
|
|
98
106
|
export interface TextDirection {
|
|
99
107
|
id: Id;
|
|
100
108
|
type: 'text';
|
|
101
109
|
text: string;
|
|
110
|
+
/** undefined = 'above'; drawn on the measure's first drawn item of its
|
|
111
|
+
* first voice. */
|
|
102
112
|
placement?: 'above' | 'below';
|
|
103
113
|
}
|
|
114
|
+
/** Not drawn; the tempo reaches the renderer through `MeasureState`. */
|
|
104
115
|
export interface TempoDirection {
|
|
105
116
|
id: Id;
|
|
106
117
|
type: 'tempo';
|
|
@@ -159,16 +170,23 @@ export interface AttachmentBase {
|
|
|
159
170
|
export interface ArticulationAttachment extends AttachmentBase {
|
|
160
171
|
type: 'articulation';
|
|
161
172
|
articulation: Articulation;
|
|
173
|
+
/** undefined = 'above'. */
|
|
162
174
|
placement?: 'above' | 'below';
|
|
175
|
+
/** Chord pitches the mark belongs to, as indices into `Chord.pitches`;
|
|
176
|
+
* undefined = the whole owner. Engraved once per owner either way; indices
|
|
177
|
+
* on a `note` owner or out of range are tolerated and ignored. */
|
|
178
|
+
pitchIndices?: number[];
|
|
163
179
|
}
|
|
164
180
|
export interface DynamicAttachment extends AttachmentBase {
|
|
165
181
|
type: 'dynamic';
|
|
166
182
|
dynamic: Dynamic;
|
|
183
|
+
/** undefined = 'below'. */
|
|
167
184
|
placement?: 'above' | 'below';
|
|
168
185
|
}
|
|
169
186
|
export interface LyricAttachment extends AttachmentBase {
|
|
170
187
|
type: 'lyric';
|
|
171
188
|
text: string;
|
|
189
|
+
/** Verse order below the owner, ascending; undefined sorts first. */
|
|
172
190
|
verse?: number;
|
|
173
191
|
}
|
|
174
192
|
/** Free text drawn above or below the owner (a note, chord or rest), e.g. a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/state/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,EAAE,GAAG,MAAM,CAAC;AAExB,MAAM,MAAM,IAAI,GACZ,QAAQ,GACR,MAAM,GACN,MAAM,GACN,OAAO,GACP,SAAS,GACT,eAAe,GACf,YAAY,GACZ,YAAY,GACZ,SAAS,GACT,QAAQ,G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AAE,CAAC;IACf,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;CACzB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vexflow-native",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "React
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "React Native backend for rendering music notation using react-native-skia",
|
|
5
5
|
"main": "./lib/module/base/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/base/index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -25,6 +25,11 @@
|
|
|
25
25
|
"types": "./lib/typescript/src/musicxml/index.d.ts",
|
|
26
26
|
"default": "./lib/module/musicxml/index.js"
|
|
27
27
|
},
|
|
28
|
+
"./percussion": {
|
|
29
|
+
"source": "./src/percussion/index.ts",
|
|
30
|
+
"types": "./lib/typescript/src/percussion/index.d.ts",
|
|
31
|
+
"default": "./lib/module/percussion/index.js"
|
|
32
|
+
},
|
|
28
33
|
"./package.json": "./package.json"
|
|
29
34
|
},
|
|
30
35
|
"files": [
|
|
@@ -49,8 +54,9 @@
|
|
|
49
54
|
"typecheck": "tsc",
|
|
50
55
|
"lint": "eslint src example --ext .js,.ts,.tsx",
|
|
51
56
|
"lint:fix": "yarn lint --fix",
|
|
52
|
-
"format": "prettier --write README.md package.json \"src/**/*.{ts,tsx}\"",
|
|
57
|
+
"format": "prettier --write README.md package.json \"docs/*.md\" \"src/**/*.{ts,tsx}\"",
|
|
53
58
|
"test": "jest",
|
|
59
|
+
"docs:api": "typedoc",
|
|
54
60
|
"release": "release-it --only-version"
|
|
55
61
|
},
|
|
56
62
|
"keywords": [
|
|
@@ -76,12 +82,12 @@
|
|
|
76
82
|
"@eslint/compat": "^1.3.2",
|
|
77
83
|
"@eslint/eslintrc": "^3.3.1",
|
|
78
84
|
"@eslint/js": "^9.35.0",
|
|
79
|
-
"@react-native/babel-preset": "0.
|
|
80
|
-
"@react-native/eslint-config": "0.
|
|
85
|
+
"@react-native/babel-preset": "0.86.3",
|
|
86
|
+
"@react-native/eslint-config": "0.86.3",
|
|
87
|
+
"@react-native/jest-preset": "0.86.3",
|
|
81
88
|
"@release-it/conventional-changelog": "^10.0.1",
|
|
82
|
-
"@shopify/react-native-skia": "2.6.2",
|
|
83
89
|
"@types/jest": "^29.5.14",
|
|
84
|
-
"@types/react": "
|
|
90
|
+
"@types/react": "~19.2.2",
|
|
85
91
|
"commitlint": "^19.8.1",
|
|
86
92
|
"del-cli": "^6.0.0",
|
|
87
93
|
"eslint": "^9.35.0",
|
|
@@ -90,24 +96,26 @@
|
|
|
90
96
|
"jest": "^29.7.0",
|
|
91
97
|
"lefthook": "^2.0.3",
|
|
92
98
|
"prettier": "^2.8.8",
|
|
93
|
-
"react": "19.
|
|
94
|
-
"react-native": "0.
|
|
99
|
+
"react": "19.2.3",
|
|
100
|
+
"react-native": "0.86.3",
|
|
95
101
|
"react-native-builder-bob": "^0.40.18",
|
|
96
|
-
"react-native-gesture-handler": "
|
|
97
|
-
"react-native-reanimated": "
|
|
98
|
-
"react-native-
|
|
102
|
+
"react-native-gesture-handler": "~2.32.0",
|
|
103
|
+
"react-native-reanimated": "4.5.1",
|
|
104
|
+
"react-native-skia": "3.0.3",
|
|
105
|
+
"react-native-worklets": "0.10.1",
|
|
99
106
|
"release-it": "^19.0.4",
|
|
100
107
|
"turbo": "^2.5.6",
|
|
108
|
+
"typedoc": "0.28.20",
|
|
101
109
|
"typescript": "^5.9.2",
|
|
102
110
|
"vexflow": "^5.0.0"
|
|
103
111
|
},
|
|
104
112
|
"peerDependencies": {
|
|
105
|
-
"@shopify/react-native-skia": "*",
|
|
106
113
|
"react": "*",
|
|
107
114
|
"react-native": "*",
|
|
108
115
|
"react-native-gesture-handler": "*",
|
|
109
|
-
"react-native-reanimated": "
|
|
110
|
-
"react-native-
|
|
116
|
+
"react-native-reanimated": ">=4.0.0",
|
|
117
|
+
"react-native-skia": ">=3.0.0",
|
|
118
|
+
"react-native-worklets": ">=0.7.0",
|
|
111
119
|
"vexflow": "*"
|
|
112
120
|
},
|
|
113
121
|
"workspaces": [
|
|
@@ -140,14 +148,20 @@
|
|
|
140
148
|
"useTabs": false
|
|
141
149
|
},
|
|
142
150
|
"jest": {
|
|
143
|
-
"preset": "react-native",
|
|
151
|
+
"preset": "@react-native/jest-preset",
|
|
152
|
+
"testMatch": [
|
|
153
|
+
"**/__tests__/**/*.test.[jt]s?(x)"
|
|
154
|
+
],
|
|
155
|
+
"moduleNameMapper": {
|
|
156
|
+
"^react-native-skia$": "<rootDir>/src/__tests__/skiaMock"
|
|
157
|
+
},
|
|
144
158
|
"modulePathIgnorePatterns": [
|
|
145
159
|
"<rootDir>/example/node_modules",
|
|
146
160
|
"<rootDir>/lib/",
|
|
147
161
|
"<rootDir>/prev-implementation/"
|
|
148
162
|
],
|
|
149
163
|
"testPathIgnorePatterns": [
|
|
150
|
-
"<rootDir>/example/",
|
|
164
|
+
"<rootDir>/example/(?!src/benchmark/)",
|
|
151
165
|
"<rootDir>/prev-implementation/"
|
|
152
166
|
]
|
|
153
167
|
},
|
package/src/base/FontManager.ts
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import type { FontInfo } from 'vexflow';
|
|
2
|
-
import {
|
|
3
|
-
FontWeight,
|
|
4
|
-
FontSlant,
|
|
5
|
-
FontWidth,
|
|
6
|
-
Skia,
|
|
7
|
-
} from '@shopify/react-native-skia';
|
|
2
|
+
import { FontWeight, FontSlant, FontWidth, Skia } from 'react-native-skia';
|
|
8
3
|
import type {
|
|
9
4
|
SkFont,
|
|
10
5
|
SkFontMgr,
|
|
11
6
|
SkTypeface,
|
|
12
7
|
SkTypefaceFontProvider,
|
|
13
|
-
} from '
|
|
8
|
+
} from 'react-native-skia';
|
|
14
9
|
|
|
15
10
|
// import Logger, { LogCategory } from '../shared/Logger';
|
|
16
11
|
|
|
@@ -99,10 +94,8 @@ export default class FontManager {
|
|
|
99
94
|
private fontProvider: SkTypefaceFontProvider;
|
|
100
95
|
private defaultFontName: string;
|
|
101
96
|
private familiesLower: string[];
|
|
102
|
-
//
|
|
103
|
-
//
|
|
104
|
-
// Skia host objects, which are shareable across reanimated runtimes (the
|
|
105
|
-
// provider itself already crosses the same way).
|
|
97
|
+
// Instances never cross runtimes; each runtime builds its own, so these
|
|
98
|
+
// caches are runtime-local.
|
|
106
99
|
private familyMatchCache: Record<string, string> = {};
|
|
107
100
|
private skFontCache: Record<string, SkFont> = {};
|
|
108
101
|
private systemFontMgr: SkFontMgr | null | undefined;
|
|
@@ -209,6 +202,7 @@ export default class FontManager {
|
|
|
209
202
|
return null;
|
|
210
203
|
}
|
|
211
204
|
|
|
205
|
+
/** @internal */
|
|
212
206
|
resolveFontDescriptor(
|
|
213
207
|
font?: string | FontInfo,
|
|
214
208
|
size?: string | number,
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type SkFont,
|
|
3
|
-
type SkTypefaceFontProvider,
|
|
4
|
-
} from '@shopify/react-native-skia';
|
|
1
|
+
import { type SkFont, type SkTypefaceFontProvider } from 'react-native-skia';
|
|
5
2
|
import { Platform } from 'react-native';
|
|
6
3
|
import { Element, RenderContext as VexflowRenderContext } from 'vexflow';
|
|
7
4
|
import type { FontInfo } from 'vexflow';
|
|
@@ -94,6 +91,7 @@ export default class VexflowRecordingContext implements VexflowRenderContext {
|
|
|
94
91
|
return this.textFont;
|
|
95
92
|
}
|
|
96
93
|
|
|
94
|
+
/** @internal */
|
|
97
95
|
getMeasurementContext() {
|
|
98
96
|
return this.textMeasurementContext;
|
|
99
97
|
}
|
package/src/base/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as VexflowCanvas } from './VexflowCanvas';
|
|
2
|
+
export { default as FontManager } from './FontManager';
|
|
2
3
|
export { default as VexflowRecordingContext } from './VexflowRecordingContext';
|
|
3
4
|
export { renderVexflowRecordingCommands } from './VexflowRecordingReplay';
|
|
4
5
|
export {
|
package/src/base/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
2
|
+
DynamicAttachment,
|
|
3
3
|
GraceNote,
|
|
4
4
|
Measure,
|
|
5
5
|
NoteAttachment,
|
|
@@ -32,6 +32,8 @@ export type PendingGraceNotes = {
|
|
|
32
32
|
slash: boolean;
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
+
export type PendingDynamic = Pick<DynamicAttachment, 'dynamic' | 'placement'>;
|
|
36
|
+
|
|
35
37
|
export type ParserState = {
|
|
36
38
|
scoreId: string;
|
|
37
39
|
divisions: number;
|
|
@@ -40,7 +42,8 @@ export type ParserState = {
|
|
|
40
42
|
ties: Tie[];
|
|
41
43
|
slurs: Slur[];
|
|
42
44
|
tuplets: TupletGroup[];
|
|
43
|
-
|
|
45
|
+
/** Keyed by MusicXML staff number; consumed by that staff's next note. */
|
|
46
|
+
pendingDynamics: Map<string, PendingDynamic[]>;
|
|
44
47
|
/** Keyed by MusicXML voice name; consumed by that voice's next note. */
|
|
45
48
|
pendingGraceNotes: Map<string, PendingGraceNotes>;
|
|
46
49
|
activeTies: Map<string, ActiveSpanner>;
|
|
@@ -60,7 +60,7 @@ export function parseMeasure(
|
|
|
60
60
|
);
|
|
61
61
|
const voiceMapsByStaff = staves.map(() => new Map<string, Voice>());
|
|
62
62
|
const voiceCursors = new Map<string, VoiceCursor>();
|
|
63
|
-
const
|
|
63
|
+
const directionsByStaff = new Map<number, Direction[]>();
|
|
64
64
|
let currentPosition = 0;
|
|
65
65
|
|
|
66
66
|
measure.children.forEach((child) => {
|
|
@@ -68,9 +68,21 @@ export function parseMeasure(
|
|
|
68
68
|
case 'attributes':
|
|
69
69
|
applyAttributes(child, measures, staves, state);
|
|
70
70
|
break;
|
|
71
|
-
case 'direction':
|
|
72
|
-
directions
|
|
71
|
+
case 'direction': {
|
|
72
|
+
const { staffIndex, directions } = parseDirection(child, state);
|
|
73
|
+
|
|
74
|
+
if (!measures[staffIndex]) {
|
|
75
|
+
throw new MusicXmlParseError(
|
|
76
|
+
`Direction references unknown staff ${(staffIndex + 1).toString()}`
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
directionsByStaff.set(staffIndex, [
|
|
81
|
+
...(directionsByStaff.get(staffIndex) ?? []),
|
|
82
|
+
...directions,
|
|
83
|
+
]);
|
|
73
84
|
break;
|
|
85
|
+
}
|
|
74
86
|
case 'note':
|
|
75
87
|
currentPosition = parseNote(
|
|
76
88
|
child,
|
|
@@ -114,8 +126,10 @@ export function parseMeasure(
|
|
|
114
126
|
finalizeMeasureVoices(measures[0]!, voiceCursors, state);
|
|
115
127
|
|
|
116
128
|
measures.forEach((staffMeasure, index) => {
|
|
117
|
-
|
|
118
|
-
|
|
129
|
+
const directions = directionsByStaff.get(index);
|
|
130
|
+
|
|
131
|
+
if (directions?.length) {
|
|
132
|
+
staffMeasure.directions = directions;
|
|
119
133
|
}
|
|
120
134
|
|
|
121
135
|
staffMeasure.voices = [...voiceMapsByStaff[index]!.values()].sort(
|
|
@@ -246,9 +260,14 @@ function parseNote(
|
|
|
246
260
|
const itemId = isChordTone
|
|
247
261
|
? mergeChordTone(voice, item, note)
|
|
248
262
|
: pushItem(voice, item);
|
|
263
|
+
const owner = voice.items[voice.items.length - 1];
|
|
264
|
+
const pitchIndex =
|
|
265
|
+
isChordTone && owner?.type === 'chord'
|
|
266
|
+
? owner.pitches.length - 1
|
|
267
|
+
: undefined;
|
|
249
268
|
|
|
250
269
|
attachPendingGraceNotes(itemId, voiceName, state);
|
|
251
|
-
applyNoteAttachments(note, itemId, staffNumber, voice.id, state);
|
|
270
|
+
applyNoteAttachments(note, itemId, staffNumber, voice.id, state, pitchIndex);
|
|
252
271
|
|
|
253
272
|
if (isChordTone) {
|
|
254
273
|
return currentPosition;
|
|
@@ -383,7 +402,17 @@ function parseDuration(note: XmlElement, state: ParserState): DurationValue {
|
|
|
383
402
|
}
|
|
384
403
|
|
|
385
404
|
function parsePitch(note: XmlElement): Pitch {
|
|
386
|
-
|
|
405
|
+
const pitch = mapPitch(
|
|
406
|
+
firstChild(note, 'pitch'),
|
|
407
|
+
childText(note, 'accidental')
|
|
408
|
+
);
|
|
409
|
+
const notehead = optionalChild(note, 'notehead');
|
|
410
|
+
|
|
411
|
+
if (notehead && attr(notehead, 'parentheses') === 'yes') {
|
|
412
|
+
pitch.parenthesized = true;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
return pitch;
|
|
387
416
|
}
|
|
388
417
|
|
|
389
418
|
/**
|