vexflow 5.0.0-alpha.3 → 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.
Files changed (152) hide show
  1. package/README.md +6 -6
  2. package/build/cjs/vexflow-bravura.js +2 -2
  3. package/build/cjs/vexflow-bravura.js.map +1 -1
  4. package/build/cjs/vexflow-core.js +2 -2
  5. package/build/cjs/vexflow-core.js.map +1 -1
  6. package/build/cjs/vexflow-debug-with-tests.js +2066 -1877
  7. package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
  8. package/build/cjs/vexflow-debug.js +1052 -993
  9. package/build/cjs/vexflow-debug.js.map +1 -1
  10. package/build/cjs/vexflow.js +2 -2
  11. package/build/cjs/vexflow.js.map +1 -1
  12. package/build/esm/src/accidental.js +22 -28
  13. package/build/esm/src/annotation.js +0 -2
  14. package/build/esm/src/barnote.js +3 -3
  15. package/build/esm/src/beam.js +26 -46
  16. package/build/esm/src/bend.js +11 -3
  17. package/build/esm/src/chordsymbol.js +0 -4
  18. package/build/esm/src/clef.js +0 -2
  19. package/build/esm/src/clefnote.js +6 -1
  20. package/build/esm/src/curve.js +8 -5
  21. package/build/esm/src/element.js +94 -118
  22. package/build/esm/src/factory.js +4 -4
  23. package/build/esm/src/flag.js +20 -0
  24. package/build/esm/src/fonts/gonville.js +1 -1
  25. package/build/esm/src/formatter.js +13 -21
  26. package/build/esm/src/fraction.js +15 -22
  27. package/build/esm/src/glyphnote.js +3 -4
  28. package/build/esm/src/gracenote.js +0 -2
  29. package/build/esm/src/gracenotegroup.js +17 -8
  30. package/build/esm/src/index.js +1 -0
  31. package/build/esm/src/keysignature.js +38 -31
  32. package/build/esm/src/keysignote.js +1 -1
  33. package/build/esm/src/metrics.js +58 -7
  34. package/build/esm/src/modifier.js +10 -23
  35. package/build/esm/src/multimeasurerest.js +16 -25
  36. package/build/esm/src/note.js +7 -0
  37. package/build/esm/src/notehead.js +6 -1
  38. package/build/esm/src/ornament.js +0 -2
  39. package/build/esm/src/pedalmarking.js +33 -41
  40. package/build/esm/src/registry.js +5 -19
  41. package/build/esm/src/stave.js +11 -19
  42. package/build/esm/src/stavebarline.js +2 -3
  43. package/build/esm/src/stavehairpin.js +1 -1
  44. package/build/esm/src/staveline.js +0 -4
  45. package/build/esm/src/stavemodifier.js +0 -2
  46. package/build/esm/src/stavenote.js +42 -68
  47. package/build/esm/src/staverepetition.js +3 -2
  48. package/build/esm/src/stavesection.js +13 -15
  49. package/build/esm/src/stavetempo.js +7 -13
  50. package/build/esm/src/stavetext.js +2 -2
  51. package/build/esm/src/stavetie.js +82 -40
  52. package/build/esm/src/stavevolta.js +3 -2
  53. package/build/esm/src/stem.js +0 -4
  54. package/build/esm/src/stemmablenote.js +5 -6
  55. package/build/esm/src/stringnumber.js +0 -2
  56. package/build/esm/src/svgcontext.js +5 -13
  57. package/build/esm/src/tabnote.js +2 -8
  58. package/build/esm/src/textbracket.js +0 -3
  59. package/build/esm/src/textnote.js +0 -2
  60. package/build/esm/src/tickable.js +13 -26
  61. package/build/esm/src/tickcontext.js +20 -2
  62. package/build/esm/src/timesignature.js +2 -4
  63. package/build/esm/src/timesignote.js +2 -0
  64. package/build/esm/src/tuplet.js +37 -30
  65. package/build/esm/src/version.js +3 -3
  66. package/build/esm/src/vexflow.js +6 -2
  67. package/build/esm/src/vibrato.js +6 -1
  68. package/build/esm/tests/accidental_tests.js +30 -17
  69. package/build/esm/tests/annotation_tests.js +12 -12
  70. package/build/esm/tests/articulation_tests.js +13 -13
  71. package/build/esm/tests/auto_beam_formatting_tests.js +33 -33
  72. package/build/esm/tests/beam_tests.js +1 -1
  73. package/build/esm/tests/bend_tests.js +7 -7
  74. package/build/esm/tests/chordsymbol_tests.js +8 -8
  75. package/build/esm/tests/clef_tests.js +5 -1
  76. package/build/esm/tests/curve_tests.js +34 -0
  77. package/build/esm/tests/{bach_tests.js → demo_petzold_tests.js} +7 -7
  78. package/build/esm/tests/dot_tests.js +4 -4
  79. package/build/esm/tests/formatter_tests.js +25 -25
  80. package/build/esm/tests/glyphnote_tests.js +6 -0
  81. package/build/esm/tests/gracenote_tests.js +2 -1
  82. package/build/esm/tests/gracetabnote_tests.js +1 -1
  83. package/build/esm/tests/index.js +1 -1
  84. package/build/esm/tests/key_clef_tests.js +6 -6
  85. package/build/esm/tests/keysignature_tests.js +20 -17
  86. package/build/esm/tests/notehead_tests.js +10 -7
  87. package/build/esm/tests/offscreencanvas_tests.js +1 -1
  88. package/build/esm/tests/ornament_tests.js +8 -8
  89. package/build/esm/tests/pedalmarking_tests.js +27 -0
  90. package/build/esm/tests/percussion_tests.js +6 -3
  91. package/build/esm/tests/renderer_tests.js +1 -1
  92. package/build/esm/tests/rests_tests.js +26 -26
  93. package/build/esm/tests/rhythm_tests.js +15 -15
  94. package/build/esm/tests/stave_tests.js +44 -43
  95. package/build/esm/tests/staveconnector_tests.js +73 -73
  96. package/build/esm/tests/stavehairpin_tests.js +1 -1
  97. package/build/esm/tests/stavemodifier_tests.js +3 -3
  98. package/build/esm/tests/stavenote_tests.js +29 -29
  99. package/build/esm/tests/stavetie_tests.js +29 -0
  100. package/build/esm/tests/stringnumber_tests.js +1 -1
  101. package/build/esm/tests/strokes_tests.js +1 -1
  102. package/build/esm/tests/style_tests.js +1 -1
  103. package/build/esm/tests/tabnote_tests.js +7 -7
  104. package/build/esm/tests/tabslide_tests.js +6 -6
  105. package/build/esm/tests/tabstave_tests.js +2 -1
  106. package/build/esm/tests/tabtie_tests.js +8 -8
  107. package/build/esm/tests/textnote_tests.js +1 -1
  108. package/build/esm/tests/threevoice_tests.js +2 -2
  109. package/build/esm/tests/timesignature_tests.js +23 -13
  110. package/build/esm/tests/vexflow_test_helpers.js +25 -39
  111. package/build/esm/tests/vibrato_tests.js +3 -3
  112. package/build/esm/tests/voice_tests.js +1 -1
  113. package/build/types/src/accidental.d.ts +19 -1
  114. package/build/types/src/annotation.d.ts +1 -1
  115. package/build/types/src/beam.d.ts +12 -1
  116. package/build/types/src/bend.d.ts +6 -0
  117. package/build/types/src/clefnote.d.ts +2 -0
  118. package/build/types/src/curve.d.ts +5 -4
  119. package/build/types/src/element.d.ts +23 -14
  120. package/build/types/src/factory.d.ts +2 -2
  121. package/build/types/src/flag.d.ts +12 -0
  122. package/build/types/src/fonts/gonville.d.ts +1 -1
  123. package/build/types/src/formatter.d.ts +5 -3
  124. package/build/types/src/fraction.d.ts +12 -7
  125. package/build/types/src/frethandfinger.d.ts +1 -1
  126. package/build/types/src/index.d.ts +1 -0
  127. package/build/types/src/keysignature.d.ts +7 -7
  128. package/build/types/src/metrics.d.ts +5 -0
  129. package/build/types/src/modifier.d.ts +3 -2
  130. package/build/types/src/multimeasurerest.d.ts +4 -1
  131. package/build/types/src/note.d.ts +2 -0
  132. package/build/types/src/pedalmarking.d.ts +2 -2
  133. package/build/types/src/registry.d.ts +1 -1
  134. package/build/types/src/stave.d.ts +1 -3
  135. package/build/types/src/stavebarline.d.ts +1 -1
  136. package/build/types/src/staveline.d.ts +1 -1
  137. package/build/types/src/stavemodifier.d.ts +0 -1
  138. package/build/types/src/stavenote.d.ts +2 -1
  139. package/build/types/src/staverepetition.d.ts +1 -1
  140. package/build/types/src/stavesection.d.ts +3 -4
  141. package/build/types/src/stavetempo.d.ts +4 -5
  142. package/build/types/src/stavetext.d.ts +1 -2
  143. package/build/types/src/stavetie.d.ts +39 -2
  144. package/build/types/src/stavevolta.d.ts +1 -2
  145. package/build/types/src/stemmablenote.d.ts +2 -3
  146. package/build/types/src/svgcontext.d.ts +1 -1
  147. package/build/types/src/tickable.d.ts +2 -1
  148. package/build/types/src/tickcontext.d.ts +30 -0
  149. package/build/types/src/tuplet.d.ts +2 -12
  150. package/build/types/src/typeguard.d.ts +1 -0
  151. package/package.json +33 -29
  152. package/tests/flow.html +2 -2
@@ -9,6 +9,7 @@ import { Stave } from '../src/stave.js';
9
9
  import { Barline, BarlineType } from '../src/stavebarline.js';
10
10
  import { StaveNote } from '../src/stavenote.js';
11
11
  import { Repetition } from '../src/staverepetition.js';
12
+ import { StaveSection } from '../src/stavesection.js';
12
13
  import { VoltaType } from '../src/stavevolta.js';
13
14
  import { TextJustification } from '../src/textnote.js';
14
15
  import { TimeSignature } from '../src/timesignature.js';
@@ -73,7 +74,7 @@ function draw(options, contextBuilder) {
73
74
  const ctx = contextBuilder(options.elementId, 400, 150);
74
75
  const stave = new Stave(10, 10, 300);
75
76
  stave.setContext(ctx);
76
- stave.draw();
77
+ stave.drawWithStyle();
77
78
  options.assert.equal(stave.getYForNote(0), 100, 'getYForNote(0)');
78
79
  options.assert.equal(stave.getYForLine(5), 100, 'getYForLine(5)');
79
80
  options.assert.equal(stave.getYForLine(0), 50, 'getYForLine(0) - Top Line');
@@ -84,10 +85,10 @@ function drawOpenStave(options, contextBuilder) {
84
85
  const ctx = contextBuilder(options.elementId, 400, 350);
85
86
  let stave = new Stave(10, 10, 300, { leftBar: false });
86
87
  stave.setContext(ctx);
87
- stave.draw();
88
+ stave.drawWithStyle();
88
89
  stave = new Stave(10, 150, 300, { rightBar: false });
89
90
  stave.setContext(ctx);
90
- stave.draw();
91
+ stave.drawWithStyle();
91
92
  options.assert.ok(true, 'all pass');
92
93
  }
93
94
  function drawMultipleMeasures(options, contextBuilder) {
@@ -98,7 +99,7 @@ function drawMultipleMeasures(options, contextBuilder) {
98
99
  staveBar1.setBegBarType(BarlineType.REPEAT_BEGIN);
99
100
  staveBar1.setEndBarType(BarlineType.DOUBLE);
100
101
  staveBar1.setSection('A', 0, 0, (_a = options.params) === null || _a === void 0 ? void 0 : _a.fontSize, false);
101
- staveBar1.addClef('treble').setContext(ctx).draw();
102
+ staveBar1.addClef('treble').setContext(ctx).drawWithStyle();
102
103
  const notesBar1 = [
103
104
  new StaveNote({ keys: ['c/4'], duration: 'q' }),
104
105
  new StaveNote({ keys: ['d/4'], duration: 'q' }),
@@ -107,9 +108,9 @@ function drawMultipleMeasures(options, contextBuilder) {
107
108
  ];
108
109
  Formatter.FormatAndDraw(ctx, staveBar1, notesBar1);
109
110
  const staveBar2 = new Stave(staveBar1.getWidth() + staveBar1.getX(), staveBar1.getY(), 300);
110
- staveBar2.setSection('B', 0, 0, (_b = options.params) === null || _b === void 0 ? void 0 : _b.fontSize);
111
+ staveBar2.addModifier(new StaveSection('B').setFontSize((_b = options.params) === null || _b === void 0 ? void 0 : _b.fontSize));
111
112
  staveBar2.setEndBarType(BarlineType.END);
112
- staveBar2.setContext(ctx).draw();
113
+ staveBar2.setContext(ctx).drawWithStyle();
113
114
  const notesBar2Part1 = [
114
115
  new StaveNote({ keys: ['c/4'], duration: '8' }),
115
116
  new StaveNote({ keys: ['d/4'], duration: '8' }),
@@ -126,8 +127,8 @@ function drawMultipleMeasures(options, contextBuilder) {
126
127
  const beam2 = new Beam(notesBar2Part2);
127
128
  const notesBar2 = notesBar2Part1.concat(notesBar2Part2);
128
129
  Formatter.FormatAndDraw(ctx, staveBar2, notesBar2);
129
- beam1.setContext(ctx).draw();
130
- beam2.setContext(ctx).draw();
130
+ beam1.setContext(ctx).drawWithStyle();
131
+ beam2.setContext(ctx).drawWithStyle();
131
132
  }
132
133
  function drawRepeats(options, contextBuilder) {
133
134
  options.assert.expect(0);
@@ -137,7 +138,7 @@ function drawRepeats(options, contextBuilder) {
137
138
  staveBar1.setEndBarType(BarlineType.REPEAT_END);
138
139
  staveBar1.addClef('treble');
139
140
  staveBar1.addKeySignature('A');
140
- staveBar1.setContext(ctx).draw();
141
+ staveBar1.setContext(ctx).drawWithStyle();
141
142
  const notesBar1 = [
142
143
  new StaveNote({ keys: ['c/4'], duration: 'q' }),
143
144
  new StaveNote({ keys: ['d/4'], duration: 'q' }),
@@ -148,7 +149,7 @@ function drawRepeats(options, contextBuilder) {
148
149
  const staveBar2 = new Stave(staveBar1.getWidth() + staveBar1.getX(), staveBar1.getY(), 250);
149
150
  staveBar2.setBegBarType(BarlineType.REPEAT_BEGIN);
150
151
  staveBar2.setEndBarType(BarlineType.REPEAT_END);
151
- staveBar2.setContext(ctx).draw();
152
+ staveBar2.setContext(ctx).drawWithStyle();
152
153
  const notesBar2Part1 = [
153
154
  new StaveNote({ keys: ['c/4'], duration: '8' }),
154
155
  new StaveNote({ keys: ['d/4'], duration: '8' }),
@@ -168,16 +169,16 @@ function drawRepeats(options, contextBuilder) {
168
169
  const beam2 = new Beam(notesBar2Part2);
169
170
  const notesBar2 = notesBar2Part1.concat(notesBar2Part2);
170
171
  Formatter.FormatAndDraw(ctx, staveBar2, notesBar2);
171
- beam1.setContext(ctx).draw();
172
- beam2.setContext(ctx).draw();
172
+ beam1.setContext(ctx).drawWithStyle();
173
+ beam2.setContext(ctx).drawWithStyle();
173
174
  const staveBar3 = new Stave(staveBar2.getWidth() + staveBar2.getX(), staveBar2.getY(), 50);
174
- staveBar3.setContext(ctx).draw();
175
+ staveBar3.setContext(ctx).drawWithStyle();
175
176
  const notesBar3 = [new StaveNote({ keys: ['d/5'], duration: 'wr' })];
176
177
  Formatter.FormatAndDraw(ctx, staveBar3, notesBar3);
177
178
  const staveBar4 = new Stave(staveBar3.getWidth() + staveBar3.getX(), staveBar3.getY(), 250 - staveBar1.getModifierXShift());
178
179
  staveBar4.setBegBarType(BarlineType.REPEAT_BEGIN);
179
180
  staveBar4.setEndBarType(BarlineType.REPEAT_END);
180
- staveBar4.setContext(ctx).draw();
181
+ staveBar4.setContext(ctx).drawWithStyle();
181
182
  const notesBar4 = [
182
183
  new StaveNote({ keys: ['c/4'], duration: 'q' }),
183
184
  new StaveNote({ keys: ['d/4'], duration: 'q' }),
@@ -224,7 +225,7 @@ function drawEndModifiers(options, contextBuilder) {
224
225
  staveBar.setEndTimeSignature(endMods.timeSig);
225
226
  }
226
227
  }
227
- staveBar.setContext(ctx).draw();
228
+ staveBar.setContext(ctx).drawWithStyle();
228
229
  const notesBar = [
229
230
  new StaveNote({ keys: ['c/4'], duration: 'q' }),
230
231
  new StaveNote({ keys: ['d/4'], duration: 'q' }),
@@ -268,7 +269,7 @@ function drawStaveRepetition(options, contextBuilder) {
268
269
  mm1.addClef('treble');
269
270
  mm1.setRepetitionType(Repetition.type.DS_AL_FINE, options.params.yShift);
270
271
  mm1.setMeasure(1);
271
- mm1.setContext(ctx).draw();
272
+ mm1.setContext(ctx).drawWithStyle();
272
273
  const notesmm1 = [
273
274
  new StaveNote({ keys: ['a/4'], duration: 'q' }),
274
275
  new StaveNote({ keys: ['f/4'], duration: 'q' }),
@@ -279,7 +280,7 @@ function drawStaveRepetition(options, contextBuilder) {
279
280
  const mm2 = new Stave(mm1.getWidth() + mm1.getX(), mm1.getY(), 150);
280
281
  mm2.setRepetitionType(Repetition.type.TO_CODA, options.params.yShift);
281
282
  mm2.setMeasure(2);
282
- mm2.setContext(ctx).draw();
283
+ mm2.setContext(ctx).drawWithStyle();
283
284
  const notesmm2 = [
284
285
  new StaveNote({ keys: ['a/4'], duration: 'q' }),
285
286
  new StaveNote({ keys: ['f/4'], duration: 'q' }),
@@ -290,7 +291,7 @@ function drawStaveRepetition(options, contextBuilder) {
290
291
  const mm3 = new Stave(mm2.getWidth() + mm2.getX(), mm1.getY(), 150);
291
292
  mm3.setRepetitionType(Repetition.type.DS_AL_CODA, options.params.yShift);
292
293
  mm3.setMeasure(3);
293
- mm3.setContext(ctx).draw();
294
+ mm3.setContext(ctx).drawWithStyle();
294
295
  const notesmm3 = [
295
296
  new StaveNote({ keys: ['a/4'], duration: 'q' }),
296
297
  new StaveNote({ keys: ['f/4'], duration: 'q' }),
@@ -301,7 +302,7 @@ function drawStaveRepetition(options, contextBuilder) {
301
302
  const mm4 = new Stave(mm3.getWidth() + mm3.getX(), mm1.getY(), 150);
302
303
  mm4.setRepetitionType(Repetition.type.CODA_LEFT, options.params.yShift);
303
304
  mm4.setMeasure(4);
304
- mm4.setContext(ctx).draw();
305
+ mm4.setContext(ctx).drawWithStyle();
305
306
  const notesmm4 = [
306
307
  new StaveNote({ keys: ['a/4'], duration: 'q' }),
307
308
  new StaveNote({ keys: ['f/4'], duration: 'q' }),
@@ -319,53 +320,53 @@ function drawVolta(options, contextBuilder) {
319
320
  mm1.addClef('treble');
320
321
  mm1.addKeySignature('A');
321
322
  mm1.setMeasure(1);
322
- mm1.setSection('A', 0);
323
- mm1.setContext(ctx).draw();
323
+ mm1.addModifier(new StaveSection('A'));
324
+ mm1.setContext(ctx).drawWithStyle();
324
325
  const notesmm1 = [new StaveNote({ keys: ['c/4'], duration: 'w' })];
325
326
  Formatter.FormatAndDraw(ctx, mm1, notesmm1);
326
327
  const mm2 = new Stave(mm1.getWidth() + mm1.getX(), mm1.getY(), 60);
327
328
  mm2.setRepetitionType(Repetition.type.CODA_RIGHT);
328
329
  mm2.setMeasure(2);
329
- mm2.setContext(ctx).draw();
330
+ mm2.setContext(ctx).drawWithStyle();
330
331
  const notesmm2 = [new StaveNote({ keys: ['d/4'], duration: 'w' })];
331
332
  Formatter.FormatAndDraw(ctx, mm2, notesmm2);
332
333
  const mm3 = new Stave(mm2.getWidth() + mm2.getX(), mm1.getY(), 60);
333
334
  mm3.setVoltaType(VoltaType.BEGIN, '1.', -5);
334
335
  mm3.setMeasure(3);
335
- mm3.setContext(ctx).draw();
336
+ mm3.setContext(ctx).drawWithStyle();
336
337
  const notesmm3 = [new StaveNote({ keys: ['e/4'], duration: 'w' })];
337
338
  Formatter.FormatAndDraw(ctx, mm3, notesmm3);
338
339
  const mm4 = new Stave(mm3.getWidth() + mm3.getX(), mm1.getY(), 60);
339
340
  mm4.setVoltaType(VoltaType.MID, '', -5);
340
341
  mm4.setMeasure(4);
341
- mm4.setContext(ctx).draw();
342
+ mm4.setContext(ctx).drawWithStyle();
342
343
  const notesmm4 = [new StaveNote({ keys: ['f/4'], duration: 'w' })];
343
344
  Formatter.FormatAndDraw(ctx, mm4, notesmm4);
344
345
  const mm5 = new Stave(mm4.getWidth() + mm4.getX(), mm1.getY(), 60);
345
346
  mm5.setEndBarType(BarlineType.REPEAT_END);
346
347
  mm5.setVoltaType(VoltaType.END, '', -5);
347
348
  mm5.setMeasure(5);
348
- mm5.setContext(ctx).draw();
349
+ mm5.setContext(ctx).drawWithStyle();
349
350
  const notesmm5 = [new StaveNote({ keys: ['g/4'], duration: 'w' })];
350
351
  Formatter.FormatAndDraw(ctx, mm5, notesmm5);
351
352
  const mm6 = new Stave(mm5.getWidth() + mm5.getX(), mm1.getY(), 60);
352
353
  mm6.setVoltaType(VoltaType.BEGIN_END, '2.', -5);
353
354
  mm6.setEndBarType(BarlineType.DOUBLE);
354
355
  mm6.setMeasure(6);
355
- mm6.setContext(ctx).draw();
356
+ mm6.setContext(ctx).drawWithStyle();
356
357
  const notesmm6 = [new StaveNote({ keys: ['a/4'], duration: 'w' })];
357
358
  Formatter.FormatAndDraw(ctx, mm6, notesmm6);
358
359
  const mm7 = new Stave(mm6.getWidth() + mm6.getX(), mm1.getY(), 60);
359
360
  mm7.setMeasure(7);
360
- mm7.setSection('B', 0);
361
- mm7.setContext(ctx).draw();
361
+ mm7.addModifier(new StaveSection('B').setPadding(4));
362
+ mm7.setContext(ctx).drawWithStyle();
362
363
  const notesmm7 = [new StaveNote({ keys: ['b/4'], duration: 'w' })];
363
364
  Formatter.FormatAndDraw(ctx, mm7, notesmm7);
364
365
  const mm8 = new Stave(mm7.getWidth() + mm7.getX(), mm1.getY(), 60);
365
366
  mm8.setEndBarType(BarlineType.DOUBLE);
366
367
  mm8.setRepetitionType(Repetition.type.DS_AL_CODA);
367
368
  mm8.setMeasure(8);
368
- mm8.setContext(ctx).draw();
369
+ mm8.setContext(ctx).drawWithStyle();
369
370
  const notesmm8 = [new StaveNote({ keys: ['c/5'], duration: 'w' })];
370
371
  Formatter.FormatAndDraw(ctx, mm8, notesmm8);
371
372
  const mm9 = new Stave(mm8.getWidth() + mm8.getX() + 20, mm1.getY(), 125);
@@ -374,7 +375,7 @@ function drawVolta(options, contextBuilder) {
374
375
  mm9.addClef('treble');
375
376
  mm9.addKeySignature('A');
376
377
  mm9.setMeasure(9);
377
- mm9.setContext(ctx).draw();
378
+ mm9.setContext(ctx).drawWithStyle();
378
379
  const notesmm9 = [new StaveNote({ keys: ['d/5'], duration: 'w' })];
379
380
  Formatter.FormatAndDraw(ctx, mm9, notesmm9);
380
381
  }
@@ -388,7 +389,7 @@ function drawVoltaModifier(options, contextBuilder) {
388
389
  mm1.addKeySignature('A');
389
390
  mm1.setMeasure(1);
390
391
  mm1.setSection('A', 0);
391
- mm1.setContext(ctx).draw();
392
+ mm1.setContext(ctx).drawWithStyle();
392
393
  const notesmm1 = [new StaveNote({ keys: ['c/4'], duration: 'w' })];
393
394
  Formatter.FormatAndDraw(ctx, mm1, notesmm1);
394
395
  const mm2 = new Stave(mm1.getX() + mm1.getWidth(), mm1.getY(), 175);
@@ -398,7 +399,7 @@ function drawVoltaModifier(options, contextBuilder) {
398
399
  mm2.addClef('treble');
399
400
  mm2.addKeySignature('A');
400
401
  mm2.setMeasure(2);
401
- mm2.setContext(ctx).draw();
402
+ mm2.setContext(ctx).drawWithStyle();
402
403
  const notesmm2 = [new StaveNote({ keys: ['c/4'], duration: 'w' })];
403
404
  Formatter.FormatAndDraw(ctx, mm2, notesmm2);
404
405
  const mm3 = new Stave(mm2.getX() + mm2.getWidth(), mm2.getY(), 175);
@@ -408,7 +409,7 @@ function drawVoltaModifier(options, contextBuilder) {
408
409
  mm3.addKeySignature('B');
409
410
  mm3.setMeasure(3);
410
411
  mm3.setSection('B', 0);
411
- mm3.setContext(ctx).draw();
412
+ mm3.setContext(ctx).drawWithStyle();
412
413
  const notesmm3 = [new StaveNote({ keys: ['c/4'], duration: 'w' })];
413
414
  Formatter.FormatAndDraw(ctx, mm3, notesmm3);
414
415
  const mm4 = new Stave(mm3.getX() + mm3.getWidth(), mm3.getY(), 175);
@@ -418,7 +419,7 @@ function drawVoltaModifier(options, contextBuilder) {
418
419
  mm4.addKeySignature('A');
419
420
  mm4.setMeasure(4);
420
421
  mm4.setSection('C', 0);
421
- mm4.setContext(ctx).draw();
422
+ mm4.setContext(ctx).drawWithStyle();
422
423
  const notesmm4 = [new StaveNote({ keys: ['c/4'], duration: 'w' })];
423
424
  Formatter.FormatAndDraw(ctx, mm4, notesmm4);
424
425
  const mm5 = new Stave(mm4.getX() + mm4.getWidth(), mm4.getY(), 175);
@@ -427,15 +428,15 @@ function drawVoltaModifier(options, contextBuilder) {
427
428
  mm5.addClef('treble');
428
429
  mm5.addKeySignature('A');
429
430
  mm5.setMeasure(5);
430
- mm5.setSection('D', 0);
431
- mm5.setContext(ctx).draw();
431
+ mm5.addModifier(new StaveSection('D'));
432
+ mm5.setContext(ctx).drawWithStyle();
432
433
  const notesmm5 = [new StaveNote({ keys: ['c/4'], duration: 'w' })];
433
434
  Formatter.FormatAndDraw(ctx, mm5, notesmm5);
434
435
  const mm6 = new Stave(mm5.getX() + mm5.getWidth(), mm5.getY(), 175);
435
436
  mm6.setRepetitionType(Repetition.type.DS);
436
437
  mm6.setMeasure(6);
437
- mm6.setSection('E', 0);
438
- mm6.setContext(ctx).draw();
438
+ mm6.addModifier(new StaveSection('E'));
439
+ mm6.setContext(ctx).drawWithStyle();
439
440
  const notesmm6 = [new StaveNote({ keys: ['c/4'], duration: 'w' })];
440
441
  Formatter.FormatAndDraw(ctx, mm6, notesmm6);
441
442
  }
@@ -450,7 +451,7 @@ function drawTempo(options, contextBuilder) {
450
451
  if (x === 0)
451
452
  staveBar.addClef('treble');
452
453
  staveBar.setTempo(tempo, tempoY);
453
- staveBar.setContext(ctx).draw();
454
+ staveBar.setContext(ctx).drawWithStyle();
454
455
  const notesBar = notes || [
455
456
  new StaveNote({ keys: ['c/4'], duration: 'q' }),
456
457
  new StaveNote({ keys: ['d/4'], duration: 'q' }),
@@ -500,7 +501,7 @@ function configureSingleLine(options, contextBuilder) {
500
501
  .setConfigForLine(2, { visible: true })
501
502
  .setConfigForLine(3, { visible: false })
502
503
  .setConfigForLine(4, { visible: true });
503
- stave.setContext(ctx).draw();
504
+ stave.setContext(ctx).drawWithStyle();
504
505
  const config = stave.getConfigForLines();
505
506
  options.assert.equal(config[0].visible, true, 'getLinesConfiguration() - Line 0');
506
507
  options.assert.equal(config[1].visible, false, 'getLinesConfiguration() - Line 1');
@@ -515,7 +516,7 @@ function configureAllLines(options, contextBuilder) {
515
516
  stave
516
517
  .setConfigForLines([{ visible: false }, {}, { visible: false }, { visible: true }, { visible: false }])
517
518
  .setContext(ctx)
518
- .draw();
519
+ .drawWithStyle();
519
520
  const config = stave.getConfigForLines();
520
521
  options.assert.equal(config[0].visible, false, 'getLinesConfiguration() - Line 0');
521
522
  options.assert.equal(config[1].visible, true, 'getLinesConfiguration() - Line 1');
@@ -531,7 +532,7 @@ function drawStaveText(options, contextBuilder) {
531
532
  stave.setStaveText('Right Text', Modifier.Position.RIGHT);
532
533
  stave.setStaveText('Above Text', Modifier.Position.ABOVE);
533
534
  stave.setStaveText('Below Text', Modifier.Position.BELOW);
534
- stave.setContext(ctx).draw();
535
+ stave.setContext(ctx).drawWithStyle();
535
536
  options.assert.ok(true, 'all pass');
536
537
  }
537
538
  function drawStaveTextMultiLine(options, contextBuilder) {
@@ -551,7 +552,7 @@ function drawStaveTextMultiLine(options, contextBuilder) {
551
552
  shiftY: 10,
552
553
  justification: TextJustification.RIGHT,
553
554
  });
554
- stave.setContext(ctx).draw();
555
+ stave.setContext(ctx).drawWithStyle();
555
556
  options.assert.ok(true, 'all pass');
556
557
  }
557
558
  function factoryAPI(options) {
@@ -33,9 +33,9 @@ function drawSingle(options, contextBuilder) {
33
33
  const connector = new StaveConnector(stave1, stave2);
34
34
  connector.setType(StaveConnector.type.SINGLE);
35
35
  connector.setContext(ctx);
36
- stave1.draw();
37
- stave2.draw();
38
- connector.draw();
36
+ stave1.drawWithStyle();
37
+ stave2.drawWithStyle();
38
+ connector.drawWithStyle();
39
39
  options.assert.ok(true, 'all pass');
40
40
  }
41
41
  function drawSingle4pxStaveLines(options, contextBuilder) {
@@ -49,9 +49,9 @@ function drawSingle4pxStaveLines(options, contextBuilder) {
49
49
  const connector = new StaveConnector(stave1, stave2);
50
50
  connector.setType(StaveConnector.type.SINGLE);
51
51
  connector.setContext(ctx);
52
- stave1.draw();
53
- stave2.draw();
54
- connector.draw();
52
+ stave1.drawWithStyle();
53
+ stave2.drawWithStyle();
54
+ connector.drawWithStyle();
55
55
  VexFlow.STAVE_LINE_THICKNESS = oldThickness;
56
56
  options.assert.ok(true, 'all pass');
57
57
  }
@@ -67,10 +67,10 @@ function drawSingleBoth(options, contextBuilder) {
67
67
  const connector2 = new StaveConnector(stave1, stave2);
68
68
  connector2.setType(StaveConnector.type.SINGLE_RIGHT);
69
69
  connector2.setContext(ctx);
70
- stave1.draw();
71
- stave2.draw();
72
- connector1.draw();
73
- connector2.draw();
70
+ stave1.drawWithStyle();
71
+ stave2.drawWithStyle();
72
+ connector1.drawWithStyle();
73
+ connector2.drawWithStyle();
74
74
  options.assert.ok(true, 'all pass');
75
75
  }
76
76
  function drawDouble(options, contextBuilder) {
@@ -86,10 +86,10 @@ function drawDouble(options, contextBuilder) {
86
86
  line.setType(StaveConnector.type.SINGLE);
87
87
  connector.setContext(ctx);
88
88
  line.setContext(ctx);
89
- stave1.draw();
90
- stave2.draw();
91
- connector.draw();
92
- line.draw();
89
+ stave1.drawWithStyle();
90
+ stave2.drawWithStyle();
91
+ connector.drawWithStyle();
92
+ line.drawWithStyle();
93
93
  options.assert.ok(true, 'all pass');
94
94
  }
95
95
  function drawBrace(options, contextBuilder) {
@@ -106,10 +106,10 @@ function drawBrace(options, contextBuilder) {
106
106
  line.setType(StaveConnector.type.SINGLE);
107
107
  connector.setContext(ctx);
108
108
  line.setContext(ctx);
109
- stave1.draw();
110
- stave2.draw();
111
- connector.draw();
112
- line.draw();
109
+ stave1.drawWithStyle();
110
+ stave2.drawWithStyle();
111
+ connector.drawWithStyle();
112
+ line.drawWithStyle();
113
113
  options.assert.ok(true, 'all pass');
114
114
  }
115
115
  function drawBraceWide(options, contextBuilder) {
@@ -125,10 +125,10 @@ function drawBraceWide(options, contextBuilder) {
125
125
  line.setType(StaveConnector.type.SINGLE);
126
126
  connector.setContext(ctx);
127
127
  line.setContext(ctx);
128
- stave1.draw();
129
- stave2.draw();
130
- connector.draw();
131
- line.draw();
128
+ stave1.drawWithStyle();
129
+ stave2.drawWithStyle();
130
+ connector.drawWithStyle();
131
+ line.drawWithStyle();
132
132
  options.assert.ok(true, 'all pass');
133
133
  }
134
134
  function drawBracket(options, contextBuilder) {
@@ -144,10 +144,10 @@ function drawBracket(options, contextBuilder) {
144
144
  line.setType(StaveConnector.type.SINGLE);
145
145
  connector.setContext(ctx);
146
146
  line.setContext(ctx);
147
- stave1.draw();
148
- stave2.draw();
149
- connector.draw();
150
- line.draw();
147
+ stave1.drawWithStyle();
148
+ stave2.drawWithStyle();
149
+ connector.drawWithStyle();
150
+ line.drawWithStyle();
151
151
  options.assert.ok(true, 'all pass');
152
152
  }
153
153
  function drawRepeatBegin(options, contextBuilder) {
@@ -161,9 +161,9 @@ function drawRepeatBegin(options, contextBuilder) {
161
161
  const line = new StaveConnector(stave1, stave2);
162
162
  line.setType(StaveConnector.type.BOLD_DOUBLE_LEFT);
163
163
  line.setContext(ctx);
164
- stave1.draw();
165
- stave2.draw();
166
- line.draw();
164
+ stave1.drawWithStyle();
165
+ stave2.drawWithStyle();
166
+ line.drawWithStyle();
167
167
  options.assert.ok(true, 'all pass');
168
168
  }
169
169
  function drawRepeatEnd(options, contextBuilder) {
@@ -177,9 +177,9 @@ function drawRepeatEnd(options, contextBuilder) {
177
177
  const line = new StaveConnector(stave1, stave2);
178
178
  line.setType(StaveConnector.type.BOLD_DOUBLE_RIGHT);
179
179
  line.setContext(ctx);
180
- stave1.draw();
181
- stave2.draw();
182
- line.draw();
180
+ stave1.drawWithStyle();
181
+ stave2.drawWithStyle();
182
+ line.drawWithStyle();
183
183
  options.assert.ok(true, 'all pass');
184
184
  }
185
185
  function drawThinDouble(options, contextBuilder) {
@@ -193,9 +193,9 @@ function drawThinDouble(options, contextBuilder) {
193
193
  const line = new StaveConnector(stave1, stave2);
194
194
  line.setType(StaveConnector.type.THIN_DOUBLE);
195
195
  line.setContext(ctx);
196
- stave1.draw();
197
- stave2.draw();
198
- line.draw();
196
+ stave1.drawWithStyle();
197
+ stave2.drawWithStyle();
198
+ line.drawWithStyle();
199
199
  options.assert.ok(true, 'all pass');
200
200
  }
201
201
  function drawRepeatAdjacent(options, contextBuilder) {
@@ -228,14 +228,14 @@ function drawRepeatAdjacent(options, contextBuilder) {
228
228
  connector2.setType(StaveConnector.type.BOLD_DOUBLE_RIGHT);
229
229
  connector3.setType(StaveConnector.type.BOLD_DOUBLE_LEFT);
230
230
  connector4.setType(StaveConnector.type.BOLD_DOUBLE_RIGHT);
231
- stave1.draw();
232
- stave2.draw();
233
- stave3.draw();
234
- stave4.draw();
235
- connector1.draw();
236
- connector2.draw();
237
- connector3.draw();
238
- connector4.draw();
231
+ stave1.drawWithStyle();
232
+ stave2.drawWithStyle();
233
+ stave3.drawWithStyle();
234
+ stave4.drawWithStyle();
235
+ connector1.drawWithStyle();
236
+ connector2.drawWithStyle();
237
+ connector3.drawWithStyle();
238
+ connector4.drawWithStyle();
239
239
  options.assert.ok(true, 'all pass');
240
240
  }
241
241
  function drawRepeatOffset2(options, contextBuilder) {
@@ -281,15 +281,15 @@ function drawRepeatOffset2(options, contextBuilder) {
281
281
  connector5.setType(StaveConnector.type.SINGLE_LEFT);
282
282
  connector1.setXShift(stave1.getModifierXShift());
283
283
  connector3.setXShift(stave3.getModifierXShift());
284
- stave1.draw();
285
- stave2.draw();
286
- stave3.draw();
287
- stave4.draw();
288
- connector1.draw();
289
- connector2.draw();
290
- connector3.draw();
291
- connector4.draw();
292
- connector5.draw();
284
+ stave1.drawWithStyle();
285
+ stave2.drawWithStyle();
286
+ stave3.drawWithStyle();
287
+ stave4.drawWithStyle();
288
+ connector1.drawWithStyle();
289
+ connector2.drawWithStyle();
290
+ connector3.drawWithStyle();
291
+ connector4.drawWithStyle();
292
+ connector5.drawWithStyle();
293
293
  options.assert.ok(true, 'all pass');
294
294
  }
295
295
  function drawRepeatOffset(options, contextBuilder) {
@@ -337,15 +337,15 @@ function drawRepeatOffset(options, contextBuilder) {
337
337
  connector5.setType(StaveConnector.type.SINGLE_LEFT);
338
338
  connector1.setXShift(stave1.getModifierXShift());
339
339
  connector3.setXShift(stave3.getModifierXShift());
340
- stave1.draw();
341
- stave2.draw();
342
- stave3.draw();
343
- stave4.draw();
344
- connector1.draw();
345
- connector2.draw();
346
- connector3.draw();
347
- connector4.draw();
348
- connector5.draw();
340
+ stave1.drawWithStyle();
341
+ stave2.drawWithStyle();
342
+ stave3.drawWithStyle();
343
+ stave4.drawWithStyle();
344
+ connector1.drawWithStyle();
345
+ connector2.drawWithStyle();
346
+ connector3.drawWithStyle();
347
+ connector4.drawWithStyle();
348
+ connector5.drawWithStyle();
349
349
  options.assert.ok(true, 'all pass');
350
350
  }
351
351
  function drawCombined(options, contextBuilder) {
@@ -384,18 +384,18 @@ function drawCombined(options, contextBuilder) {
384
384
  connBracket.setContext(ctx);
385
385
  connNone.setContext(ctx);
386
386
  connBrace.setContext(ctx);
387
- stave1.draw();
388
- stave2.draw();
389
- stave3.draw();
390
- stave4.draw();
391
- stave5.draw();
392
- stave6.draw();
393
- stave7.draw();
394
- connSingle.draw();
395
- connDouble.draw();
396
- connBracket.draw();
397
- connNone.draw();
398
- connBrace.draw();
387
+ stave1.drawWithStyle();
388
+ stave2.drawWithStyle();
389
+ stave3.drawWithStyle();
390
+ stave4.drawWithStyle();
391
+ stave5.drawWithStyle();
392
+ stave6.drawWithStyle();
393
+ stave7.drawWithStyle();
394
+ connSingle.drawWithStyle();
395
+ connDouble.drawWithStyle();
396
+ connBracket.drawWithStyle();
397
+ connNone.drawWithStyle();
398
+ connBrace.drawWithStyle();
399
399
  options.assert.ok(true, 'all pass');
400
400
  }
401
401
  VexFlowTests.register(StaveConnectorTests);
@@ -17,7 +17,7 @@ function drawHairpin(firstNote, lastNote, ctx, type, position, options) {
17
17
  if (options) {
18
18
  hairpin.setRenderOptions(options);
19
19
  }
20
- hairpin.draw();
20
+ hairpin.drawWithStyle();
21
21
  }
22
22
  function createTest(drawTwoHairpins) {
23
23
  return (options) => {
@@ -14,7 +14,7 @@ function draw(options, contextBuilder) {
14
14
  const ctx = contextBuilder(options.elementId, 400, 120);
15
15
  const stave = new Stave(10, 10, 300);
16
16
  stave.setContext(ctx);
17
- stave.draw();
17
+ stave.drawWithStyle();
18
18
  options.assert.equal(stave.getYForNote(0), 100, 'getYForNote(0)');
19
19
  options.assert.equal(stave.getYForLine(5), 100, 'getYForLine(5)');
20
20
  options.assert.equal(stave.getYForLine(0), 50, 'getYForLine(0) - Top Line');
@@ -33,7 +33,7 @@ function drawBeginAndEnd(options, contextBuilder) {
33
33
  stave.setEndTimeSignature('9/8');
34
34
  stave.setEndKeySignature('G', 'C#');
35
35
  stave.setEndBarType(BarlineType.DOUBLE);
36
- stave.draw();
36
+ stave.drawWithStyle();
37
37
  const END = StaveModifierPosition.END;
38
38
  stave.setY(100);
39
39
  stave.setTimeSignature('3/4');
@@ -44,7 +44,7 @@ function drawBeginAndEnd(options, contextBuilder) {
44
44
  stave.setTimeSignature('C', undefined, END);
45
45
  stave.setKeySignature('F', undefined, END);
46
46
  stave.setEndBarType(BarlineType.SINGLE);
47
- stave.draw();
47
+ stave.drawWithStyle();
48
48
  options.assert.ok(true, 'all pass');
49
49
  }
50
50
  VexFlowTests.register(StaveModifierTests);