vexflow 5.0.0-alpha.4 → 5.0.0-beta.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 +6 -6
- package/build/cjs/vexflow-bravura.js +2 -2
- package/build/cjs/vexflow-bravura.js.map +1 -1
- package/build/cjs/vexflow-core.js +2 -2
- package/build/cjs/vexflow-core.js.map +1 -1
- package/build/cjs/vexflow-debug-with-tests.js +1546 -1393
- package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
- package/build/cjs/vexflow-debug.js +600 -549
- package/build/cjs/vexflow-debug.js.map +1 -1
- package/build/cjs/vexflow.js +2 -2
- package/build/cjs/vexflow.js.map +1 -1
- package/build/esm/src/annotation.js +0 -2
- package/build/esm/src/barnote.js +3 -3
- package/build/esm/src/beam.js +2 -4
- package/build/esm/src/bend.js +11 -3
- package/build/esm/src/chordsymbol.js +0 -4
- package/build/esm/src/clef.js +0 -2
- package/build/esm/src/curve.js +8 -5
- package/build/esm/src/element.js +11 -17
- package/build/esm/src/factory.js +4 -4
- package/build/esm/src/flag.js +20 -0
- package/build/esm/src/formatter.js +4 -4
- package/build/esm/src/glyphnote.js +0 -2
- package/build/esm/src/gracenote.js +0 -2
- package/build/esm/src/gracenotegroup.js +17 -8
- package/build/esm/src/index.js +1 -0
- package/build/esm/src/keysignature.js +38 -31
- package/build/esm/src/keysignote.js +1 -1
- package/build/esm/src/metrics.js +55 -7
- package/build/esm/src/modifier.js +4 -2
- package/build/esm/src/notehead.js +6 -1
- package/build/esm/src/ornament.js +0 -2
- package/build/esm/src/pedalmarking.js +33 -41
- package/build/esm/src/stave.js +10 -16
- package/build/esm/src/stavebarline.js +2 -3
- package/build/esm/src/stavehairpin.js +1 -1
- package/build/esm/src/staveline.js +0 -4
- package/build/esm/src/stavemodifier.js +0 -2
- package/build/esm/src/stavenote.js +16 -28
- package/build/esm/src/staverepetition.js +3 -2
- package/build/esm/src/stavesection.js +13 -15
- package/build/esm/src/stavetempo.js +3 -2
- package/build/esm/src/stavetext.js +2 -2
- package/build/esm/src/stavetie.js +0 -4
- package/build/esm/src/stavevolta.js +3 -2
- package/build/esm/src/stem.js +0 -4
- package/build/esm/src/stemmablenote.js +5 -6
- package/build/esm/src/stringnumber.js +0 -2
- package/build/esm/src/svgcontext.js +0 -1
- package/build/esm/src/tabnote.js +2 -8
- package/build/esm/src/textbracket.js +0 -3
- package/build/esm/src/textnote.js +0 -2
- package/build/esm/src/timesignature.js +2 -4
- package/build/esm/src/timesignote.js +2 -0
- package/build/esm/src/tuplet.js +37 -30
- package/build/esm/src/version.js +3 -3
- package/build/esm/src/vexflow.js +6 -2
- package/build/esm/tests/accidental_tests.js +30 -17
- package/build/esm/tests/annotation_tests.js +12 -12
- package/build/esm/tests/articulation_tests.js +13 -13
- package/build/esm/tests/auto_beam_formatting_tests.js +33 -33
- package/build/esm/tests/beam_tests.js +1 -1
- package/build/esm/tests/bend_tests.js +7 -7
- package/build/esm/tests/chordsymbol_tests.js +8 -8
- package/build/esm/tests/curve_tests.js +34 -0
- package/build/esm/tests/{bach_tests.js → demo_petzold_tests.js} +7 -7
- package/build/esm/tests/dot_tests.js +4 -4
- package/build/esm/tests/formatter_tests.js +25 -25
- package/build/esm/tests/gracenote_tests.js +2 -1
- package/build/esm/tests/gracetabnote_tests.js +1 -1
- package/build/esm/tests/index.js +1 -1
- package/build/esm/tests/key_clef_tests.js +6 -6
- package/build/esm/tests/keysignature_tests.js +20 -17
- package/build/esm/tests/notehead_tests.js +10 -7
- package/build/esm/tests/offscreencanvas_tests.js +1 -1
- package/build/esm/tests/ornament_tests.js +8 -8
- package/build/esm/tests/pedalmarking_tests.js +27 -0
- package/build/esm/tests/percussion_tests.js +6 -3
- package/build/esm/tests/renderer_tests.js +1 -1
- package/build/esm/tests/rests_tests.js +26 -26
- package/build/esm/tests/rhythm_tests.js +15 -15
- package/build/esm/tests/stave_tests.js +44 -43
- package/build/esm/tests/staveconnector_tests.js +73 -73
- package/build/esm/tests/stavehairpin_tests.js +1 -1
- package/build/esm/tests/stavemodifier_tests.js +3 -3
- package/build/esm/tests/stavenote_tests.js +29 -29
- package/build/esm/tests/stringnumber_tests.js +1 -1
- package/build/esm/tests/strokes_tests.js +1 -1
- package/build/esm/tests/style_tests.js +1 -1
- package/build/esm/tests/tabnote_tests.js +7 -7
- package/build/esm/tests/tabslide_tests.js +6 -6
- package/build/esm/tests/tabstave_tests.js +1 -1
- package/build/esm/tests/tabtie_tests.js +8 -8
- package/build/esm/tests/textnote_tests.js +1 -1
- package/build/esm/tests/threevoice_tests.js +2 -2
- package/build/esm/tests/timesignature_tests.js +23 -13
- package/build/esm/tests/vibrato_tests.js +3 -3
- package/build/esm/tests/voice_tests.js +1 -1
- package/build/types/src/bend.d.ts +6 -0
- package/build/types/src/curve.d.ts +5 -4
- package/build/types/src/element.d.ts +10 -11
- package/build/types/src/factory.d.ts +2 -2
- package/build/types/src/flag.d.ts +12 -0
- package/build/types/src/frethandfinger.d.ts +1 -1
- package/build/types/src/index.d.ts +1 -0
- package/build/types/src/keysignature.d.ts +7 -7
- package/build/types/src/metrics.d.ts +5 -0
- package/build/types/src/modifier.d.ts +1 -1
- package/build/types/src/pedalmarking.d.ts +2 -2
- package/build/types/src/stave.d.ts +1 -3
- package/build/types/src/stavebarline.d.ts +1 -1
- package/build/types/src/staveline.d.ts +1 -1
- package/build/types/src/stavemodifier.d.ts +0 -1
- package/build/types/src/staverepetition.d.ts +1 -1
- package/build/types/src/stavesection.d.ts +3 -4
- package/build/types/src/stavetempo.d.ts +1 -2
- package/build/types/src/stavetext.d.ts +1 -2
- package/build/types/src/stavevolta.d.ts +1 -2
- package/build/types/src/stemmablenote.d.ts +2 -3
- package/build/types/src/tuplet.d.ts +2 -12
- package/build/types/src/typeguard.d.ts +1 -0
- package/package.json +32 -28
|
@@ -21,7 +21,7 @@ const tabNote = (noteStruct) => new TabNote(noteStruct);
|
|
|
21
21
|
function setupContext(options, w = 0, h = 0) {
|
|
22
22
|
const context = options.contextBuilder(options.elementId, w || 350, h || 160);
|
|
23
23
|
context.setFont('Arial', VexFlowTests.Font.size);
|
|
24
|
-
const stave = new TabStave(10, 10, w || 350).addTabGlyph().setContext(context).
|
|
24
|
+
const stave = new TabStave(10, 10, w || 350).addTabGlyph().setContext(context).drawWithStyle();
|
|
25
25
|
return { context, stave };
|
|
26
26
|
}
|
|
27
27
|
function tieNotes(notes, indexes, stave, ctx, text) {
|
|
@@ -36,7 +36,7 @@ function tieNotes(notes, indexes, stave, ctx, text) {
|
|
|
36
36
|
lastIndexes: indexes,
|
|
37
37
|
}, text !== null && text !== void 0 ? text : 'Annotation');
|
|
38
38
|
tie.setContext(ctx);
|
|
39
|
-
tie.
|
|
39
|
+
tie.drawWithStyle();
|
|
40
40
|
}
|
|
41
41
|
function simple(options, contextBuilder) {
|
|
42
42
|
options.contextBuilder = contextBuilder;
|
|
@@ -100,7 +100,7 @@ function multiTest(options, createTabTie) {
|
|
|
100
100
|
lastIndexes: [0],
|
|
101
101
|
})
|
|
102
102
|
.setContext(context)
|
|
103
|
-
.
|
|
103
|
+
.drawWithStyle();
|
|
104
104
|
options.assert.ok(true, 'Single note');
|
|
105
105
|
createTabTie({
|
|
106
106
|
firstNote: notes[2],
|
|
@@ -109,7 +109,7 @@ function multiTest(options, createTabTie) {
|
|
|
109
109
|
lastIndexes: [0, 1],
|
|
110
110
|
})
|
|
111
111
|
.setContext(context)
|
|
112
|
-
.
|
|
112
|
+
.drawWithStyle();
|
|
113
113
|
options.assert.ok(true, 'Chord');
|
|
114
114
|
createTabTie({
|
|
115
115
|
firstNote: notes[4],
|
|
@@ -118,7 +118,7 @@ function multiTest(options, createTabTie) {
|
|
|
118
118
|
lastIndexes: [0],
|
|
119
119
|
})
|
|
120
120
|
.setContext(context)
|
|
121
|
-
.
|
|
121
|
+
.drawWithStyle();
|
|
122
122
|
options.assert.ok(true, 'Single note high-fret');
|
|
123
123
|
createTabTie({
|
|
124
124
|
firstNote: notes[6],
|
|
@@ -127,7 +127,7 @@ function multiTest(options, createTabTie) {
|
|
|
127
127
|
lastIndexes: [0, 1],
|
|
128
128
|
})
|
|
129
129
|
.setContext(context)
|
|
130
|
-
.
|
|
130
|
+
.drawWithStyle();
|
|
131
131
|
options.assert.ok(true, 'Chord high-fret');
|
|
132
132
|
}
|
|
133
133
|
function tap(options, contextBuilder) {
|
|
@@ -156,7 +156,7 @@ function continuous(options, contextBuilder) {
|
|
|
156
156
|
lastIndexes: [0],
|
|
157
157
|
})
|
|
158
158
|
.setContext(context)
|
|
159
|
-
.
|
|
159
|
+
.drawWithStyle();
|
|
160
160
|
TabTie.createPulloff({
|
|
161
161
|
firstNote: notes[1],
|
|
162
162
|
lastNote: notes[2],
|
|
@@ -164,7 +164,7 @@ function continuous(options, contextBuilder) {
|
|
|
164
164
|
lastIndexes: [0],
|
|
165
165
|
})
|
|
166
166
|
.setContext(context)
|
|
167
|
-
.
|
|
167
|
+
.drawWithStyle();
|
|
168
168
|
options.assert.ok(true, 'Continuous Hammeron');
|
|
169
169
|
}
|
|
170
170
|
VexFlowTests.register(TabTieTests);
|
|
@@ -208,7 +208,7 @@ function textDynamics(options) {
|
|
|
208
208
|
const width = formatter.preCalculateMinTotalWidth([voice]);
|
|
209
209
|
formatter.format([voice]);
|
|
210
210
|
const stave = f.Stave({ y: 40, width: width + Stave.defaultPadding });
|
|
211
|
-
stave.
|
|
211
|
+
stave.drawWithStyle();
|
|
212
212
|
voice.draw(f.getContext(), stave);
|
|
213
213
|
options.assert.ok(true);
|
|
214
214
|
}
|
|
@@ -28,7 +28,7 @@ function createThreeVoicesTest(noteGroup1, noteGroup2, noteGroup3, setup) {
|
|
|
28
28
|
factory.Formatter().joinVoices(voices).formatToStave(voices, stave);
|
|
29
29
|
factory.draw();
|
|
30
30
|
for (let i = 0; i < beams.length; i++) {
|
|
31
|
-
beams[i].setContext(factory.getContext()).
|
|
31
|
+
beams[i].setContext(factory.getContext()).drawWithStyle();
|
|
32
32
|
}
|
|
33
33
|
options.assert.ok(true);
|
|
34
34
|
};
|
|
@@ -81,7 +81,7 @@ function autoRestTwoVoices(options) {
|
|
|
81
81
|
createMeasure('Rests Repositioned To Avoid Collisions', 400, true);
|
|
82
82
|
f.draw();
|
|
83
83
|
for (let i = 0; i < beams.length; i++) {
|
|
84
|
-
beams[i].setContext(f.getContext()).
|
|
84
|
+
beams[i].setContext(f.getContext()).drawWithStyle();
|
|
85
85
|
}
|
|
86
86
|
options.assert.ok(true, 'Auto Adjust Rests - Two Voices');
|
|
87
87
|
}
|
|
@@ -54,7 +54,7 @@ function basic(options, contextBuilder) {
|
|
|
54
54
|
.addEndTimeSignature('C')
|
|
55
55
|
.addEndTimeSignature('C|')
|
|
56
56
|
.setContext(ctx)
|
|
57
|
-
.
|
|
57
|
+
.drawWithStyle();
|
|
58
58
|
options.assert.ok(true, 'all pass');
|
|
59
59
|
}
|
|
60
60
|
function big(options, contextBuilder) {
|
|
@@ -65,22 +65,32 @@ function big(options, contextBuilder) {
|
|
|
65
65
|
.addTimeSignature('1234567/890')
|
|
66
66
|
.addTimeSignature('987/654321')
|
|
67
67
|
.setContext(ctx)
|
|
68
|
-
.
|
|
68
|
+
.drawWithStyle();
|
|
69
69
|
options.assert.ok(true, 'all pass');
|
|
70
70
|
}
|
|
71
71
|
function additive(options, contextBuilder) {
|
|
72
72
|
const ctx = contextBuilder(options.elementId, 400, 120);
|
|
73
|
-
new Stave(10, 10, 300).addTimeSignature('2+3+2/8').setContext(ctx).
|
|
73
|
+
new Stave(10, 10, 300).addTimeSignature('2+3+2/8').setContext(ctx).drawWithStyle();
|
|
74
74
|
options.assert.ok(true, 'all pass');
|
|
75
75
|
}
|
|
76
76
|
function alternating(options, contextBuilder) {
|
|
77
77
|
const ctx = contextBuilder(options.elementId, 400, 120);
|
|
78
|
-
new Stave(10, 10, 300)
|
|
78
|
+
new Stave(10, 10, 300)
|
|
79
|
+
.addTimeSignature('6/8')
|
|
80
|
+
.addTimeSignature('+')
|
|
81
|
+
.addTimeSignature('3/4')
|
|
82
|
+
.setContext(ctx)
|
|
83
|
+
.drawWithStyle();
|
|
79
84
|
options.assert.ok(true, 'all pass');
|
|
80
85
|
}
|
|
81
86
|
function interchangeable(options, contextBuilder) {
|
|
82
87
|
const ctx = contextBuilder(options.elementId, 400, 120);
|
|
83
|
-
new Stave(10, 10, 300)
|
|
88
|
+
new Stave(10, 10, 300)
|
|
89
|
+
.addTimeSignature('3/4')
|
|
90
|
+
.addTimeSignature('-')
|
|
91
|
+
.addTimeSignature('2/4')
|
|
92
|
+
.setContext(ctx)
|
|
93
|
+
.drawWithStyle();
|
|
84
94
|
options.assert.ok(true, 'all pass');
|
|
85
95
|
}
|
|
86
96
|
function agregate(options, contextBuilder) {
|
|
@@ -92,7 +102,7 @@ function agregate(options, contextBuilder) {
|
|
|
92
102
|
.addTimeSignature('+')
|
|
93
103
|
.addTimeSignature('5/4')
|
|
94
104
|
.setContext(ctx)
|
|
95
|
-
.
|
|
105
|
+
.drawWithStyle();
|
|
96
106
|
options.assert.ok(true, 'all pass');
|
|
97
107
|
}
|
|
98
108
|
function complex(options, contextBuilder) {
|
|
@@ -102,7 +112,7 @@ function complex(options, contextBuilder) {
|
|
|
102
112
|
.addTimeSignature('+')
|
|
103
113
|
.addTimeSignature('3/8')
|
|
104
114
|
.setContext(ctx)
|
|
105
|
-
.
|
|
115
|
+
.drawWithStyle();
|
|
106
116
|
options.assert.ok(true, 'all pass');
|
|
107
117
|
}
|
|
108
118
|
function multiple(options, contextBuilder) {
|
|
@@ -113,13 +123,13 @@ function multiple(options, contextBuilder) {
|
|
|
113
123
|
.addClef('percussion')
|
|
114
124
|
.addTimeSignature('4/4', 25)
|
|
115
125
|
.setContext(ctx)
|
|
116
|
-
.
|
|
117
|
-
const stave2 = new Stave(15, 110, 300).addClef('treble').addTimeSignature('4/4').setContext(ctx).
|
|
118
|
-
const stave3 = new Stave(15, 220, 300).addClef('bass').addTimeSignature('4/4').setContext(ctx).
|
|
126
|
+
.drawWithStyle();
|
|
127
|
+
const stave2 = new Stave(15, 110, 300).addClef('treble').addTimeSignature('4/4').setContext(ctx).drawWithStyle();
|
|
128
|
+
const stave3 = new Stave(15, 220, 300).addClef('bass').addTimeSignature('4/4').setContext(ctx).drawWithStyle();
|
|
119
129
|
Stave.formatBegModifiers([stave1, stave2, stave3]);
|
|
120
|
-
new StaveConnector(stave1, stave2).setType('single').setContext(ctx).
|
|
121
|
-
new StaveConnector(stave2, stave3).setType('single').setContext(ctx).
|
|
122
|
-
new StaveConnector(stave2, stave3).setType('brace').setContext(ctx).
|
|
130
|
+
new StaveConnector(stave1, stave2).setType('single').setContext(ctx).drawWithStyle();
|
|
131
|
+
new StaveConnector(stave2, stave3).setType('single').setContext(ctx).drawWithStyle();
|
|
132
|
+
new StaveConnector(stave2, stave3).setType('brace').setContext(ctx).drawWithStyle();
|
|
123
133
|
options.assert.ok(true, 'all pass');
|
|
124
134
|
}
|
|
125
135
|
function change(options) {
|
|
@@ -15,7 +15,7 @@ function simple(options, contextBuilder) {
|
|
|
15
15
|
const ctx = contextBuilder(options.elementId, 500, 240);
|
|
16
16
|
ctx.scale(1.5, 1.5);
|
|
17
17
|
ctx.font = '10pt Arial';
|
|
18
|
-
const stave = new TabStave(10, 10, 450).addTabGlyph().setContext(ctx).
|
|
18
|
+
const stave = new TabStave(10, 10, 450).addTabGlyph().setContext(ctx).drawWithStyle();
|
|
19
19
|
const notes = [
|
|
20
20
|
tabNote({
|
|
21
21
|
positions: [
|
|
@@ -36,7 +36,7 @@ function harsh(options, contextBuilder) {
|
|
|
36
36
|
const ctx = contextBuilder(options.elementId, 500, 240);
|
|
37
37
|
ctx.scale(1.5, 1.5);
|
|
38
38
|
ctx.font = '10pt Arial';
|
|
39
|
-
const stave = new TabStave(10, 10, 450).addTabGlyph().setContext(ctx).
|
|
39
|
+
const stave = new TabStave(10, 10, 450).addTabGlyph().setContext(ctx).drawWithStyle();
|
|
40
40
|
const notes = [
|
|
41
41
|
tabNote({
|
|
42
42
|
positions: [
|
|
@@ -57,7 +57,7 @@ function withBend(options, contextBuilder) {
|
|
|
57
57
|
const ctx = contextBuilder(options.elementId, 500, 240);
|
|
58
58
|
ctx.scale(1.3, 1.3);
|
|
59
59
|
ctx.setFont(Metrics.get('fontFamily'), VexFlowTests.Font.size);
|
|
60
|
-
const stave = new TabStave(10, 10, 450).addTabGlyph().setContext(ctx).
|
|
60
|
+
const stave = new TabStave(10, 10, 450).addTabGlyph().setContext(ctx).drawWithStyle();
|
|
61
61
|
const notes = [
|
|
62
62
|
tabNote({
|
|
63
63
|
positions: [
|
|
@@ -56,7 +56,7 @@ function full(options, contextBuilder) {
|
|
|
56
56
|
notes.forEach((note) => note.setStave(stave));
|
|
57
57
|
const voice = new Voice(VexFlow.TIME4_4).setMode(Voice.Mode.FULL).addTickables(notes);
|
|
58
58
|
new Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
59
|
-
stave.setContext(ctx).
|
|
59
|
+
stave.setContext(ctx).drawWithStyle();
|
|
60
60
|
voice.draw(ctx);
|
|
61
61
|
const bb = voice.getBoundingBox();
|
|
62
62
|
if (bb) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ElementStyle } from './element';
|
|
1
2
|
import { Modifier } from './modifier';
|
|
2
3
|
import { ModifierContextState } from './modifiercontext';
|
|
3
4
|
export interface BendPhrase {
|
|
@@ -15,6 +16,11 @@ export declare class Bend extends Modifier {
|
|
|
15
16
|
static format(bends: Bend[], state: ModifierContextState): boolean;
|
|
16
17
|
protected tap: string;
|
|
17
18
|
protected phrase: BendPhrase[];
|
|
19
|
+
protected styleLine: ElementStyle;
|
|
20
|
+
/** Set the element style used for rendering the lines. */
|
|
21
|
+
setStyleLine(style: ElementStyle): this;
|
|
22
|
+
/** Get the element style used for rendering the lines. */
|
|
23
|
+
getStyleLine(): ElementStyle;
|
|
18
24
|
renderOptions: {
|
|
19
25
|
releaseWidth: number;
|
|
20
26
|
bendWidth: number;
|
|
@@ -12,6 +12,7 @@ export interface CurveOptions {
|
|
|
12
12
|
position?: string | number;
|
|
13
13
|
positionEnd?: string | number;
|
|
14
14
|
invert?: boolean;
|
|
15
|
+
openingDirection?: 'up' | 'down' | 'auto';
|
|
15
16
|
}
|
|
16
17
|
export declare enum CurvePosition {
|
|
17
18
|
NEAR_HEAD = 1,
|
|
@@ -20,12 +21,12 @@ export declare enum CurvePosition {
|
|
|
20
21
|
export declare class Curve extends Element {
|
|
21
22
|
static get CATEGORY(): string;
|
|
22
23
|
renderOptions: Required<CurveOptions>;
|
|
23
|
-
protected from
|
|
24
|
-
protected to
|
|
24
|
+
protected from?: Note;
|
|
25
|
+
protected to?: Note;
|
|
25
26
|
static get Position(): typeof CurvePosition;
|
|
26
27
|
static get PositionString(): Record<string, number>;
|
|
27
|
-
constructor(from: Note, to: Note, options: CurveOptions);
|
|
28
|
-
setNotes(from: Note, to: Note): this;
|
|
28
|
+
constructor(from: Note | undefined, to: Note | undefined, options: CurveOptions);
|
|
29
|
+
setNotes(from: Note | undefined, to: Note | undefined): this;
|
|
29
30
|
/**
|
|
30
31
|
* @return {boolean} Returns true if this is a partial bar.
|
|
31
32
|
*/
|
|
@@ -66,6 +66,7 @@ export interface ElementStyle {
|
|
|
66
66
|
*/
|
|
67
67
|
export declare class Element {
|
|
68
68
|
static get CATEGORY(): string;
|
|
69
|
+
protected parent?: Element;
|
|
69
70
|
protected children: Element[];
|
|
70
71
|
protected static ID: number;
|
|
71
72
|
protected static newID(): string;
|
|
@@ -76,7 +77,7 @@ export declare class Element {
|
|
|
76
77
|
private context?;
|
|
77
78
|
protected attrs: ElementAttributes;
|
|
78
79
|
protected rendered: boolean;
|
|
79
|
-
protected style
|
|
80
|
+
protected style: ElementStyle;
|
|
80
81
|
protected registry?: Registry;
|
|
81
82
|
protected _fontInfo: Required<FontInfo>;
|
|
82
83
|
protected fontScale: number;
|
|
@@ -91,7 +92,7 @@ export declare class Element {
|
|
|
91
92
|
protected y: number;
|
|
92
93
|
constructor(category?: string);
|
|
93
94
|
/**
|
|
94
|
-
* Adds a child
|
|
95
|
+
* Adds a child to the Element, which lets it inherit the
|
|
95
96
|
* same style as the parent when setGroupStyle() is called.
|
|
96
97
|
*
|
|
97
98
|
* Examples of children are noteheads and stems. Modifiers such
|
|
@@ -99,7 +100,7 @@ export declare class Element {
|
|
|
99
100
|
*
|
|
100
101
|
* Note that StaveNote calls setGroupStyle() when setStyle() is called.
|
|
101
102
|
*/
|
|
102
|
-
|
|
103
|
+
addChild(child: Element): this;
|
|
103
104
|
getCategory(): string;
|
|
104
105
|
/**
|
|
105
106
|
* Set the element style used to render.
|
|
@@ -107,7 +108,7 @@ export declare class Element {
|
|
|
107
108
|
* Example:
|
|
108
109
|
* ```typescript
|
|
109
110
|
* element.setStyle({ fillStyle: 'red', strokeStyle: 'red' });
|
|
110
|
-
* element.
|
|
111
|
+
* element.drawWithStyle();
|
|
111
112
|
* ```
|
|
112
113
|
* Note: If the element draws additional sub-elements (i.e.: Modifiers in a Stave),
|
|
113
114
|
* the style can be applied to all of them by means of the context:
|
|
@@ -115,7 +116,7 @@ export declare class Element {
|
|
|
115
116
|
* element.setStyle({ fillStyle: 'red', strokeStyle: 'red' });
|
|
116
117
|
* element.getContext().setFillStyle('red');
|
|
117
118
|
* element.getContext().setStrokeStyle('red');
|
|
118
|
-
* element.
|
|
119
|
+
* element.drawWithStyle();
|
|
119
120
|
* ```
|
|
120
121
|
* or using drawWithStyle:
|
|
121
122
|
* ```typescript
|
|
@@ -123,20 +124,18 @@ export declare class Element {
|
|
|
123
124
|
* element.drawWithStyle();
|
|
124
125
|
* ```
|
|
125
126
|
*/
|
|
126
|
-
setStyle(style: ElementStyle
|
|
127
|
+
setStyle(style: ElementStyle): this;
|
|
127
128
|
/** Set the element & associated children style used for rendering. */
|
|
128
129
|
setGroupStyle(style: ElementStyle): this;
|
|
129
130
|
/** Get the element style used for rendering. */
|
|
130
|
-
getStyle(): ElementStyle
|
|
131
|
+
getStyle(): ElementStyle;
|
|
131
132
|
/** Apply the element style to `context`. */
|
|
132
|
-
applyStyle(context?: RenderContext | undefined, style?: ElementStyle
|
|
133
|
-
/** Restore the style of `context`. */
|
|
134
|
-
restoreStyle(context?: RenderContext | undefined, style?: ElementStyle | undefined): this;
|
|
133
|
+
applyStyle(context?: RenderContext | undefined, style?: ElementStyle): this;
|
|
135
134
|
/**
|
|
136
135
|
* Draw the element and all its sub-elements (i.e.: Modifiers in a Stave)
|
|
137
136
|
* with the element's style (see `getStyle()` and `setStyle()`)
|
|
138
137
|
*/
|
|
139
|
-
drawWithStyle():
|
|
138
|
+
drawWithStyle(): this;
|
|
140
139
|
/** Draw an element. */
|
|
141
140
|
draw(): void;
|
|
142
141
|
/** Check if it has a class label (An element can have multiple class labels). */
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Element } from './element';
|
|
2
|
+
/**
|
|
3
|
+
* `Flags` are typically not manipulated
|
|
4
|
+
* directly, but used internally in `StaveNote`.
|
|
5
|
+
*/
|
|
6
|
+
export declare class Flag extends Element {
|
|
7
|
+
/** To enable logging for this class. Set `VexFlow.NoteHead.DEBUG` to `true`. */
|
|
8
|
+
static DEBUG: boolean;
|
|
9
|
+
static get CATEGORY(): string;
|
|
10
|
+
/** Draw the notehead. */
|
|
11
|
+
draw(): void;
|
|
12
|
+
}
|
|
@@ -6,7 +6,7 @@ export declare class FretHandFinger extends Modifier {
|
|
|
6
6
|
static get CATEGORY(): string;
|
|
7
7
|
static format(nums: FretHandFinger[], state: ModifierContextState): boolean;
|
|
8
8
|
static easyScoreHook({ fingerings }: {
|
|
9
|
-
fingerings?: string
|
|
9
|
+
fingerings?: string;
|
|
10
10
|
} | undefined, note: StemmableNote, builder: Builder): void;
|
|
11
11
|
protected xOffset: number;
|
|
12
12
|
protected yOffset: number;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BoundingBox } from './boundingbox';
|
|
2
2
|
import { Stave } from './stave';
|
|
3
3
|
import { StaveModifier } from './stavemodifier';
|
|
4
4
|
export declare class KeySignature extends StaveModifier {
|
|
5
5
|
static get CATEGORY(): string;
|
|
6
|
-
protected glyphs: Element[];
|
|
7
6
|
protected paddingForced: boolean;
|
|
8
7
|
protected formatted?: boolean;
|
|
9
8
|
protected cancelKeySpec?: string;
|
|
@@ -14,7 +13,7 @@ export declare class KeySignature extends StaveModifier {
|
|
|
14
13
|
protected keySpec?: string;
|
|
15
14
|
protected alterKeySpec?: string[];
|
|
16
15
|
constructor(keySpec: string, cancelKeySpec?: string, alterKeySpec?: string[]);
|
|
17
|
-
convertToGlyph(acc: {
|
|
16
|
+
protected convertToGlyph(acc: {
|
|
18
17
|
type: string;
|
|
19
18
|
line: number;
|
|
20
19
|
}, nextAcc: {
|
|
@@ -22,7 +21,7 @@ export declare class KeySignature extends StaveModifier {
|
|
|
22
21
|
line: number;
|
|
23
22
|
}, stave: Stave): void;
|
|
24
23
|
cancelKey(spec: string): this;
|
|
25
|
-
convertToCancelAccList(spec: string): {
|
|
24
|
+
protected convertToCancelAccList(spec: string): {
|
|
26
25
|
type: string;
|
|
27
26
|
accList: {
|
|
28
27
|
type: string;
|
|
@@ -30,7 +29,9 @@ export declare class KeySignature extends StaveModifier {
|
|
|
30
29
|
}[];
|
|
31
30
|
} | undefined;
|
|
32
31
|
addToStave(stave: Stave): this;
|
|
33
|
-
|
|
32
|
+
getBoundingBox(): BoundingBox;
|
|
33
|
+
protected calculateDimensions(): void;
|
|
34
|
+
protected convertAccLines(clef: string, type?: string, accList?: {
|
|
34
35
|
type: string;
|
|
35
36
|
line: number;
|
|
36
37
|
}[]): void;
|
|
@@ -38,8 +39,7 @@ export declare class KeySignature extends StaveModifier {
|
|
|
38
39
|
getWidth(): number;
|
|
39
40
|
setKeySig(keySpec: string, cancelKeySpec?: string, alterKeySpec?: string[]): this;
|
|
40
41
|
alterKey(alterKeySpec: string[]): this;
|
|
41
|
-
convertToAlterAccList(alterKeySpec: string[]): void;
|
|
42
|
+
protected convertToAlterAccList(alterKeySpec: string[]): void;
|
|
42
43
|
format(): void;
|
|
43
|
-
protected calculateWidth(): void;
|
|
44
44
|
draw(): void;
|
|
45
45
|
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import { ElementStyle } from './element';
|
|
1
2
|
import { FontInfo } from './font';
|
|
2
3
|
export declare class Metrics {
|
|
4
|
+
protected static cacheStyle: Map<string, ElementStyle>;
|
|
5
|
+
protected static cacheFont: Map<string, Required<FontInfo>>;
|
|
3
6
|
/** Use the provided key to look up a FontInfo in CommonMetrics. **/
|
|
7
|
+
static clear(key?: string): void;
|
|
4
8
|
static getFontInfo(key: string): Required<FontInfo>;
|
|
9
|
+
static getStyle(key: string): ElementStyle;
|
|
5
10
|
/**
|
|
6
11
|
* Use the provided key to look up a value in CommonMetrics.
|
|
7
12
|
*
|
|
@@ -86,5 +86,5 @@ export declare class Modifier extends Element {
|
|
|
86
86
|
getXShift(): number;
|
|
87
87
|
/** Render the modifier onto the canvas. */
|
|
88
88
|
draw(): void;
|
|
89
|
-
alignSubNotesWithNote(subNotes: Note[], note: Note): void;
|
|
89
|
+
alignSubNotesWithNote(subNotes: Note[], note: Note, position?: ModifierPosition): void;
|
|
90
90
|
}
|
|
@@ -13,8 +13,8 @@ export declare class PedalMarking extends Element {
|
|
|
13
13
|
static get CATEGORY(): string;
|
|
14
14
|
protected line: number;
|
|
15
15
|
protected type: number;
|
|
16
|
-
protected
|
|
17
|
-
protected
|
|
16
|
+
protected depressText: string;
|
|
17
|
+
protected releaseText: string;
|
|
18
18
|
renderOptions: {
|
|
19
19
|
color: string;
|
|
20
20
|
bracketHeight: number;
|
|
@@ -12,7 +12,6 @@ export interface StaveOptions {
|
|
|
12
12
|
spaceBelowStaffLn?: number;
|
|
13
13
|
spaceAboveStaffLn?: number;
|
|
14
14
|
verticalBarWidth?: number;
|
|
15
|
-
fillStyle?: string;
|
|
16
15
|
leftBar?: boolean;
|
|
17
16
|
rightBar?: boolean;
|
|
18
17
|
spacingBetweenLinesPx?: number;
|
|
@@ -51,7 +50,6 @@ export declare class Stave extends Element {
|
|
|
51
50
|
getBottomLineBottomY(): number;
|
|
52
51
|
setX(x: number): this;
|
|
53
52
|
setWidth(width: number): this;
|
|
54
|
-
getStyle(): ElementStyle;
|
|
55
53
|
/**
|
|
56
54
|
* Set the measure number of this Stave.
|
|
57
55
|
*/
|
|
@@ -154,7 +152,7 @@ export declare class Stave extends Element {
|
|
|
154
152
|
/**
|
|
155
153
|
* All drawing functions below need the context to be set.
|
|
156
154
|
*/
|
|
157
|
-
draw():
|
|
155
|
+
draw(): void;
|
|
158
156
|
getVerticalBarWidth(): number;
|
|
159
157
|
/**
|
|
160
158
|
* Get the current configuration for the Stave.
|
|
@@ -21,7 +21,7 @@ export declare class Barline extends StaveModifier {
|
|
|
21
21
|
constructor(type: BarlineType | string);
|
|
22
22
|
getType(): number;
|
|
23
23
|
setType(type: string | number): this;
|
|
24
|
-
draw(
|
|
24
|
+
draw(): void;
|
|
25
25
|
drawVerticalBar(stave: Stave, x: number, doubleBar?: boolean): void;
|
|
26
26
|
drawVerticalEndBar(stave: Stave, x: number): void;
|
|
27
27
|
drawRepeatBar(stave: Stave, x: number, begin: boolean): void;
|
|
@@ -23,7 +23,7 @@ export declare class Repetition extends StaveModifier {
|
|
|
23
23
|
constructor(type: number, x: number, yShift: number);
|
|
24
24
|
setShiftX(x: number): this;
|
|
25
25
|
setShiftY(y: number): this;
|
|
26
|
-
draw(
|
|
26
|
+
draw(): void;
|
|
27
27
|
drawCodaFixed(stave: Stave, x: number): this;
|
|
28
28
|
drawSegnoFixed(stave: Stave, x: number): this;
|
|
29
29
|
drawSymbolText(stave: Stave, x: number, text: string, drawCoda: boolean): this;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { Stave } from './stave';
|
|
2
1
|
import { StaveModifier } from './stavemodifier';
|
|
3
2
|
export declare class StaveSection extends StaveModifier {
|
|
4
3
|
static get CATEGORY(): string;
|
|
5
4
|
protected drawRect: boolean;
|
|
6
|
-
constructor(section: string, x
|
|
7
|
-
|
|
8
|
-
draw(
|
|
5
|
+
constructor(section: string, x?: number, yShift?: number, drawRect?: boolean);
|
|
6
|
+
setDrawRect(drawRect: boolean): this;
|
|
7
|
+
draw(): void;
|
|
9
8
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Stave } from './stave';
|
|
2
1
|
import { StaveModifier } from './stavemodifier';
|
|
3
2
|
export interface StaveTempoOptions {
|
|
4
3
|
/** free text i.e.: 'Adagio', 'Andate grazioso', ... */
|
|
@@ -40,5 +39,5 @@ export declare class StaveTempo extends StaveModifier {
|
|
|
40
39
|
constructor(tempo: StaveTempoOptions, x: number, shiftY: number);
|
|
41
40
|
protected durationToCode: Record<string, string>;
|
|
42
41
|
setTempo(tempo: StaveTempoOptions): this;
|
|
43
|
-
draw(
|
|
42
|
+
draw(): void;
|
|
44
43
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Stave } from './stave';
|
|
2
1
|
import { StaveModifier } from './stavemodifier';
|
|
3
2
|
export declare class StaveText extends StaveModifier {
|
|
4
3
|
static get CATEGORY(): string;
|
|
@@ -8,5 +7,5 @@ export declare class StaveText extends StaveModifier {
|
|
|
8
7
|
shiftY?: number;
|
|
9
8
|
justification?: number;
|
|
10
9
|
});
|
|
11
|
-
draw(
|
|
10
|
+
draw(): void;
|
|
12
11
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Stave } from './stave';
|
|
2
1
|
import { StaveModifier } from './stavemodifier';
|
|
3
2
|
export declare enum VoltaType {
|
|
4
3
|
NONE = 1,
|
|
@@ -12,5 +11,5 @@ export declare class Volta extends StaveModifier {
|
|
|
12
11
|
static get type(): typeof VoltaType;
|
|
13
12
|
protected type: number;
|
|
14
13
|
constructor(type: number, label: string, x: number, yShift: number);
|
|
15
|
-
draw(
|
|
14
|
+
draw(): void;
|
|
16
15
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Flag } from './flag';
|
|
2
2
|
import { GlyphProps, Note, NoteStruct } from './note';
|
|
3
3
|
import { Stem, StemOptions } from './stem';
|
|
4
4
|
export declare abstract class StemmableNote extends Note {
|
|
5
5
|
static get CATEGORY(): string;
|
|
6
6
|
stemDirection?: number;
|
|
7
7
|
stem?: Stem;
|
|
8
|
-
protected flag:
|
|
9
|
-
protected flagStyle: ElementStyle;
|
|
8
|
+
protected flag: Flag;
|
|
10
9
|
protected stemExtensionOverride?: number;
|
|
11
10
|
constructor(noteStruct: NoteStruct);
|
|
12
11
|
getStem(): Stem | undefined;
|
|
@@ -50,12 +50,7 @@ export interface TupletOptions {
|
|
|
50
50
|
numNotes?: number;
|
|
51
51
|
ratioed?: boolean;
|
|
52
52
|
yOffset?: number;
|
|
53
|
-
|
|
54
|
-
export interface TupletMetrics {
|
|
55
|
-
noteHeadOffset: number;
|
|
56
|
-
stemOffset: number;
|
|
57
|
-
bottomLine: number;
|
|
58
|
-
topModifierOffset: number;
|
|
53
|
+
textYOffset?: number;
|
|
59
54
|
}
|
|
60
55
|
export declare const enum TupletLocation {
|
|
61
56
|
BOTTOM = -1,
|
|
@@ -64,13 +59,8 @@ export declare const enum TupletLocation {
|
|
|
64
59
|
export declare class Tuplet extends Element {
|
|
65
60
|
static get CATEGORY(): string;
|
|
66
61
|
notes: Note[];
|
|
67
|
-
protected options: TupletOptions
|
|
68
|
-
protected numNotes: number;
|
|
69
|
-
protected bracketed: boolean;
|
|
62
|
+
protected options: Required<TupletOptions>;
|
|
70
63
|
protected textElement: Element;
|
|
71
|
-
protected location: number;
|
|
72
|
-
protected notesOccupied: number;
|
|
73
|
-
protected ratioed: boolean;
|
|
74
64
|
static get LOCATION_TOP(): number;
|
|
75
65
|
static get LOCATION_BOTTOM(): number;
|
|
76
66
|
static get NESTING_OFFSET(): number;
|