vexflow 4.0.1-beta.2 → 4.0.2

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 (94) hide show
  1. package/README.md +48 -65
  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 +729 -698
  7. package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
  8. package/build/cjs/vexflow-debug.js +553 -614
  9. package/build/cjs/vexflow-debug.js.map +1 -1
  10. package/build/cjs/vexflow-gonville.js +2 -2
  11. package/build/cjs/vexflow-gonville.js.map +1 -1
  12. package/build/cjs/vexflow-petaluma.js +2 -2
  13. package/build/cjs/vexflow-petaluma.js.map +1 -1
  14. package/build/cjs/vexflow.js +2 -2
  15. package/build/cjs/vexflow.js.map +1 -1
  16. package/build/esm/entry/vexflow-bravura.js +1 -2
  17. package/build/esm/entry/vexflow-core.js +1 -2
  18. package/build/esm/entry/vexflow-debug-with-tests.js +9 -2
  19. package/build/esm/entry/vexflow-debug.js +7 -2
  20. package/build/esm/entry/vexflow-gonville.js +1 -2
  21. package/build/esm/entry/vexflow-petaluma.js +1 -2
  22. package/build/esm/entry/vexflow.js +1 -2
  23. package/build/esm/src/annotation.js +10 -4
  24. package/build/esm/src/beam.js +20 -6
  25. package/build/esm/src/factory.js +6 -1
  26. package/build/esm/src/flow.js +27 -14
  27. package/build/esm/src/font.js +0 -2
  28. package/build/esm/src/formatter.js +21 -4
  29. package/build/esm/src/glyph.js +6 -0
  30. package/build/esm/src/index.js +1 -3
  31. package/build/esm/src/note.js +1 -1
  32. package/build/esm/src/stave.js +2 -2
  33. package/build/esm/src/staveconnector.js +6 -3
  34. package/build/esm/src/staveline.js +2 -5
  35. package/build/esm/src/stavenote.js +19 -6
  36. package/build/esm/src/stavesection.js +9 -6
  37. package/build/esm/src/stavetext.js +3 -3
  38. package/build/esm/src/system.js +1 -8
  39. package/build/esm/src/textnote.js +12 -14
  40. package/build/esm/src/version.js +3 -3
  41. package/build/esm/tests/annotation_tests.js +14 -1
  42. package/build/esm/tests/beam_tests.js +19 -0
  43. package/build/esm/tests/easyscore_tests.js +5 -2
  44. package/build/esm/tests/formatter_tests.js +62 -10
  45. package/build/esm/tests/stave_tests.js +4 -4
  46. package/build/types/entry/vexflow-bravura.d.ts +1 -2
  47. package/build/types/entry/vexflow-core.d.ts +1 -2
  48. package/build/types/entry/vexflow-debug.d.ts +1 -2
  49. package/build/types/entry/vexflow-gonville.d.ts +1 -2
  50. package/build/types/entry/vexflow-petaluma.d.ts +1 -2
  51. package/build/types/entry/vexflow.d.ts +1 -2
  52. package/build/types/src/annotation.d.ts +1 -0
  53. package/build/types/src/beam.d.ts +30 -1
  54. package/build/types/src/easyscore.d.ts +4 -0
  55. package/build/types/src/factory.d.ts +6 -3
  56. package/build/types/src/flow.d.ts +27 -12
  57. package/build/types/src/font.d.ts +0 -1
  58. package/build/types/src/glyph.d.ts +2 -0
  59. package/build/types/src/index.d.ts +1 -3
  60. package/build/types/src/note.d.ts +1 -0
  61. package/build/types/src/stave.d.ts +1 -1
  62. package/build/types/src/staveconnector.d.ts +13 -15
  63. package/build/types/src/staveline.d.ts +2 -5
  64. package/build/types/src/stavesection.d.ts +2 -1
  65. package/build/types/src/system.d.ts +2 -2
  66. package/build/types/src/textnote.d.ts +4 -4
  67. package/entry/vexflow-bravura.ts +3 -3
  68. package/entry/vexflow-core.ts +3 -3
  69. package/entry/vexflow-debug-with-tests.ts +16 -2
  70. package/entry/vexflow-debug.ts +11 -3
  71. package/entry/vexflow-gonville.ts +3 -3
  72. package/entry/vexflow-petaluma.ts +3 -3
  73. package/entry/vexflow.ts +3 -3
  74. package/package.json +3 -1
  75. package/releases/vexflow-debug.js +30441 -0
  76. package/releases/vexflow-min.js +6 -0
  77. package/src/annotation.ts +15 -4
  78. package/src/beam.ts +55 -6
  79. package/src/easyscore.ts +11 -1
  80. package/src/factory.ts +18 -4
  81. package/src/flow.ts +35 -20
  82. package/src/font.ts +0 -4
  83. package/src/formatter.ts +24 -8
  84. package/src/glyph.ts +8 -0
  85. package/src/index.ts +2 -7
  86. package/src/note.ts +2 -1
  87. package/src/stave.ts +2 -2
  88. package/src/staveconnector.ts +43 -9
  89. package/src/staveline.ts +2 -5
  90. package/src/stavenote.ts +20 -10
  91. package/src/stavesection.ts +10 -6
  92. package/src/stavetext.ts +3 -3
  93. package/src/system.ts +3 -9
  94. package/src/textnote.ts +9 -11
@@ -2,12 +2,12 @@ import { Font, FontStyle, FontWeight } from './font.js';
2
2
  import { Glyph } from './glyph.js';
3
3
  import { Note } from './note.js';
4
4
  import { RuntimeError } from './util.js';
5
- export var Justification;
6
- (function (Justification) {
7
- Justification[Justification["LEFT"] = 1] = "LEFT";
8
- Justification[Justification["CENTER"] = 2] = "CENTER";
9
- Justification[Justification["RIGHT"] = 3] = "RIGHT";
10
- })(Justification || (Justification = {}));
5
+ export var TextJustification;
6
+ (function (TextJustification) {
7
+ TextJustification[TextJustification["LEFT"] = 1] = "LEFT";
8
+ TextJustification[TextJustification["CENTER"] = 2] = "CENTER";
9
+ TextJustification[TextJustification["RIGHT"] = 3] = "RIGHT";
10
+ })(TextJustification || (TextJustification = {}));
11
11
  export class TextNote extends Note {
12
12
  constructor(noteStruct) {
13
13
  super(noteStruct);
@@ -18,7 +18,7 @@ export class TextNote extends Note {
18
18
  this.line = noteStruct.line || 0;
19
19
  this.smooth = noteStruct.smooth || false;
20
20
  this.ignore_ticks = noteStruct.ignore_ticks || false;
21
- this.justification = Justification.LEFT;
21
+ this.justification = TextJustification.LEFT;
22
22
  if (noteStruct.glyph) {
23
23
  const struct = TextNote.GLYPHS[noteStruct.glyph];
24
24
  if (!struct)
@@ -33,9 +33,6 @@ export class TextNote extends Note {
33
33
  static get CATEGORY() {
34
34
  return "TextNote";
35
35
  }
36
- static get Justification() {
37
- return Justification;
38
- }
39
36
  static get GLYPHS() {
40
37
  return {
41
38
  segno: {
@@ -121,10 +118,10 @@ export class TextNote extends Note {
121
118
  this.setWidth(ctx.measureText(this.text).width);
122
119
  }
123
120
  }
124
- if (this.justification === Justification.CENTER) {
121
+ if (this.justification === TextJustification.CENTER) {
125
122
  this.leftDisplacedHeadPx = this.width / 2;
126
123
  }
127
- else if (this.justification === Justification.RIGHT) {
124
+ else if (this.justification === TextJustification.RIGHT) {
128
125
  this.leftDisplacedHeadPx = this.width;
129
126
  }
130
127
  this.rightDisplacedHeadPx = tickContext.getMetrics().glyphPx / 2;
@@ -137,10 +134,10 @@ export class TextNote extends Note {
137
134
  this.setRendered();
138
135
  let x = this.getAbsoluteX() + tickContext.getMetrics().glyphPx / 2;
139
136
  const width = this.getWidth();
140
- if (this.justification === Justification.CENTER) {
137
+ if (this.justification === TextJustification.CENTER) {
141
138
  x -= width / 2;
142
139
  }
143
- else if (this.justification === Justification.RIGHT) {
140
+ else if (this.justification === TextJustification.RIGHT) {
144
141
  x -= width;
145
142
  }
146
143
  let y;
@@ -174,3 +171,4 @@ TextNote.TEXT_FONT = {
174
171
  weight: FontWeight.NORMAL,
175
172
  style: FontStyle.NORMAL,
176
173
  };
174
+ TextNote.Justification = TextJustification;
@@ -1,3 +1,3 @@
1
- export const VERSION = '4.0.1-beta.2';
2
- export const ID = '567ba80618390639c170a60de47ab4d1f2eabbff';
3
- export const DATE = '2022-02-27T01:14:47.524Z';
1
+ export const VERSION = '4.0.2';
2
+ export const ID = 'a968cfa5453a34ff0f8bb8bc882d08ef44f62cea';
3
+ export const DATE = '2022-04-28T00:14:05.094Z';
@@ -22,6 +22,7 @@ const AnnotationTests = {
22
22
  run('Placement', placement);
23
23
  run('Lyrics', lyrics);
24
24
  run('Simple Annotation', simple);
25
+ run('Styled Annotation', styling);
25
26
  run('Standard Notation Annotation', standard);
26
27
  run('Harmonics', harmonic);
27
28
  run('Fingerpicking', picking);
@@ -49,7 +50,7 @@ function lyrics(options) {
49
50
  const system = f.System({ width, x });
50
51
  system.addStave({
51
52
  voices: [
52
- score.voice(score.notes('(C4 F4)/2[id="n0"]').concat(score.beam(score.notes('(C4 A4)/8[id="n1"], (C#4 A4)/8[id="n2"]')))),
53
+ score.voice(score.notes('(C4 F4)/2[id="n0"]').concat(score.beam(score.notes('(C4 A4)/8[id="n1"], (C4 A4)/8[id="n2"]')))),
53
54
  ],
54
55
  });
55
56
  ['hand,', 'and', 'me', 'pears', 'lead', 'the'].forEach((text, ix) => {
@@ -108,6 +109,18 @@ function standard(options, contextBuilder) {
108
109
  Formatter.FormatAndDraw(ctx, stave, notes);
109
110
  ok(true, 'Standard Notation Annotation');
110
111
  }
112
+ function styling(options, contextBuilder) {
113
+ const ctx = contextBuilder(options.elementId, 500, 240);
114
+ ctx.scale(1.5, 1.5);
115
+ const stave = new Stave(10, 10, 450).addClef('treble').setContext(ctx).draw();
116
+ const annotation = (text, style) => new Annotation(text).setFont(Font.SERIF, FONT_SIZE, 'normal', 'italic').setStyle(style);
117
+ const notes = [
118
+ staveNote({ keys: ['c/4', 'e/4'], duration: 'h' }).addModifier(annotation('quiet', { fillStyle: '#0F0' }), 0),
119
+ staveNote({ keys: ['c/4', 'e/4', 'c/5'], duration: 'h' }).addModifier(annotation('Allegro', { fillStyle: '#00F' }), 2),
120
+ ];
121
+ Formatter.FormatAndDraw(ctx, stave, notes);
122
+ ok(true, 'Standard Notation Annotation');
123
+ }
111
124
  function harmonic(options, contextBuilder) {
112
125
  const ctx = contextBuilder(options.elementId, 500, 240);
113
126
  ctx.scale(1.5, 1.5);
@@ -18,6 +18,7 @@ const BeamTests = {
18
18
  run('Lengthy Beam', lenghty);
19
19
  run('Outlier Beam', outlier);
20
20
  run('Break Secondary Beams', breakSecondaryBeams);
21
+ run('Partial Beam Direction', partialBeamDirection);
21
22
  run('TabNote Beams Up', tabBeamsUp);
22
23
  run('TabNote Beams Down', tabBeamsDown);
23
24
  run('TabNote Auto Create Beams', autoTabBeams);
@@ -101,6 +102,24 @@ function breakSecondaryBeams(options) {
101
102
  f.draw();
102
103
  ok(true, 'Breaking Secondary Beams Test');
103
104
  }
105
+ function partialBeamDirection(options) {
106
+ const f = VexFlowTests.makeFactory(options, 600, 200);
107
+ const stave = f.Stave({ y: 20 });
108
+ const score = f.EasyScore();
109
+ const voice = score.voice.bind(score);
110
+ const beam = score.beam.bind(score);
111
+ const notes = score.notes.bind(score);
112
+ const voices = [
113
+ voice([
114
+ beam(notes('f4/8, f4/16, f4/8, f4/16', { stem: 'up' })),
115
+ beam(notes('f4/8, f4/16, f4/8, f4/16', { stem: 'up' }), { partialBeamDirections: { '1': 'R' } }),
116
+ beam(notes('f4/8, f4/16, f4/8, f4/16', { stem: 'up' }), { partialBeamDirections: { '1': 'L' } }),
117
+ ].reduce(concat), { time: '9/8' }),
118
+ ];
119
+ f.Formatter().joinVoices(voices).formatToStave(voices, stave);
120
+ f.draw();
121
+ ok(true, 'Partial beam direction test');
122
+ }
104
123
  function slopey(options) {
105
124
  const f = VexFlowTests.makeFactory(options, 350, 140);
106
125
  const stave = f.Stave({ y: 20 });
@@ -443,9 +443,12 @@ function drawFingeringsTest(options) {
443
443
  equal(note3_modifier2.getPosition(), Modifier.Position.LEFT);
444
444
  }
445
445
  function keys(options) {
446
- const f = VexFlowTests.makeFactory(options, 500, 200);
446
+ const f = VexFlowTests.makeFactory(options, 700, 200);
447
447
  const score = f.EasyScore();
448
- const notes = score.notes('c#3/q, c##3, cb3, cbb3, cn3, c3, cbbs3, cbss3, cbs3, cdb3, cd3, c++-3, c++3, c+-3, c+3, co3, ck3');
448
+ const system = f.System();
449
+ const notes = score.notes('c#3/q, c##3, cb3, cbb3, cn3, c3, cbbs3, cbss3, cbs3, cdb3, cd3, c++-3, c++3, c+-3, c+3, co3, ck3', { clef: 'bass' });
450
+ system.addStave({ voices: [f.Voice().setStrict(false).addTickables(notes)] }).addClef('bass');
451
+ f.draw();
449
452
  equal(notes[0].keys, 'c#/3');
450
453
  equal(notes[1].keys, 'c##/3');
451
454
  equal(notes[2].keys, 'cb/3');
@@ -26,6 +26,7 @@ const FormatterTests = {
26
26
  QUnit.module('Formatter');
27
27
  test('TickContext Building', buildTickContexts);
28
28
  const run = VexFlowTests.runTests;
29
+ run('Penultimate Note Padding', penultimateNote);
29
30
  run('Whitespace and justify', rightJustify);
30
31
  run('Notehead padding', noteHeadPadding);
31
32
  run('Justification and alignment with accidentals', accidentalJustification);
@@ -85,27 +86,76 @@ function buildTickContexts() {
85
86
  ok(tickables1[1].getX() < tickables2[1].getX(), 'Second note of voice 2 is to the right of the second note of voice 1');
86
87
  }
87
88
  function rightJustify(options) {
88
- const f = VexFlowTests.makeFactory(options, 1200, 300);
89
- const getTickables = (time, n, duration) => {
89
+ const f = VexFlowTests.makeFactory(options, 1200, 150);
90
+ const getTickables = (time, n, duration, duration2) => {
90
91
  const tickar = [];
91
92
  let i = 0;
92
93
  for (i = 0; i < n; ++i) {
93
- tickar.push(new StaveNote({ keys: ['f/4'], duration }));
94
+ const dd = i === n - 1 ? duration2 : duration;
95
+ tickar.push(new StaveNote({ keys: ['f/4'], duration: dd }));
94
96
  }
95
97
  return new Voice(time).addTickables(tickar);
96
98
  };
97
- const renderTest = (time, n, duration, x, width) => {
99
+ const renderTest = (time, n, duration, duration2, x, width) => {
98
100
  const formatter = f.Formatter();
99
- const stave = f.Stave({ x, y: 40, width });
100
- const voice = getTickables(time, n, duration);
101
+ const stave = f.Stave({ x, y: 20, width });
102
+ const voice = getTickables(time, n, duration, duration2);
101
103
  formatter.joinVoices([voice]).formatToStave([voice], stave);
102
104
  stave.draw();
103
105
  voice.draw(f.getContext(), stave);
104
106
  };
105
- renderTest({ num_beats: 4, beat_value: 4, resolution: 4 * 4096 }, 2, '2', 10, 300);
106
- renderTest({ num_beats: 4, beat_value: 4, resolution: 4 * 4096 }, 1, 'w', 310, 300);
107
- renderTest({ num_beats: 4, beat_value: 4, resolution: 4 * 4096 }, 4, '4', 610, 300);
108
- renderTest({ num_beats: 4, beat_value: 4, resolution: 4 * 4096 }, 8, '8', 910, 300);
107
+ renderTest({ num_beats: 4, beat_value: 4, resolution: 4 * 4096 }, 3, '4', '2', 10, 300);
108
+ renderTest({ num_beats: 4, beat_value: 4, resolution: 4 * 4096 }, 1, 'w', 'w', 310, 300);
109
+ renderTest({ num_beats: 3, beat_value: 4, resolution: 4 * 4096 }, 3, '4', '4', 610, 300);
110
+ renderTest({ num_beats: 3, beat_value: 4, resolution: 4 * 4096 }, 6, '8', '8', 910, 300);
111
+ ok(true);
112
+ }
113
+ function penultimateNote(options) {
114
+ const f = VexFlowTests.makeFactory(options, 500, 550);
115
+ const score = f.EasyScore();
116
+ const staffWidth = 310;
117
+ let system = undefined;
118
+ let voices = [];
119
+ let notes = [];
120
+ let note = undefined;
121
+ let stave = undefined;
122
+ let y = 10;
123
+ const draw = (softmax) => {
124
+ system = f.System({
125
+ width: staffWidth,
126
+ y,
127
+ formatOptions: { align_rests: true },
128
+ details: { softmaxFactor: softmax },
129
+ });
130
+ notes = [];
131
+ voices = [];
132
+ note = score.notes('C4/8/r', { clef: 'bass' })[0];
133
+ notes.push(note);
134
+ note = score.notes('A3/8', { stem: 'up', clef: 'bass' })[0];
135
+ notes.push(note);
136
+ note = score.notes('C4/4', { stem: 'up', clef: 'bass' })[0];
137
+ notes.push(note);
138
+ voices.push(score.voice(notes).setMode(2));
139
+ notes = [];
140
+ note = score.notes('( F3 A3 )/4', { stem: 'down', clef: 'bass' })[0];
141
+ notes.push(note);
142
+ note = score.notes('B4/4/r', {})[0];
143
+ notes.push(note);
144
+ voices.push(score.voice(notes).setMode(2));
145
+ notes = [];
146
+ stave = system.addStave({ voices: voices });
147
+ stave.addClef('bass');
148
+ stave.addTimeSignature('2/4');
149
+ voices = [];
150
+ f.draw();
151
+ f.getContext().fillText(`softmax: ${softmax.toString()}`, staffWidth + 20, y + 50);
152
+ y += 100;
153
+ };
154
+ draw(100);
155
+ draw(10);
156
+ draw(5);
157
+ draw(2);
158
+ draw(1.5);
109
159
  ok(true);
110
160
  }
111
161
  function noteHeadPadding(options) {
@@ -473,6 +523,7 @@ function proportional(options) {
473
523
  }
474
524
  function softMax(options) {
475
525
  const f = VexFlowTests.makeFactory(options, 550, 500);
526
+ const textX = 450 / 0.8;
476
527
  f.getContext().scale(0.8, 0.8);
477
528
  function draw(y, factor) {
478
529
  const score = f.EasyScore();
@@ -494,6 +545,7 @@ function softMax(options) {
494
545
  .addClef('treble')
495
546
  .addTimeSignature('5/4');
496
547
  f.draw();
548
+ f.getContext().fillText(`softmax: ${factor.toString()}`, textX, y + 50);
497
549
  ok(true);
498
550
  }
499
551
  draw(50, 1);
@@ -10,7 +10,7 @@ import { Barline, BarlineType } from '../src/stavebarline.js';
10
10
  import { StaveNote } from '../src/stavenote.js';
11
11
  import { Repetition } from '../src/staverepetition.js';
12
12
  import { VoltaType } from '../src/stavevolta.js';
13
- import { Justification } from '../src/textnote.js';
13
+ import { TextJustification } from '../src/textnote.js';
14
14
  import { TimeSignature } from '../src/timesignature.js';
15
15
  const StaveTests = {
16
16
  Start() {
@@ -97,7 +97,7 @@ function drawMultipleMeasures(options, contextBuilder) {
97
97
  const staveBar1 = new Stave(10, 50, 200);
98
98
  staveBar1.setBegBarType(BarlineType.REPEAT_BEGIN);
99
99
  staveBar1.setEndBarType(BarlineType.DOUBLE);
100
- staveBar1.setSection('A', 0, 0, (_a = options.params) === null || _a === void 0 ? void 0 : _a.fontSize);
100
+ staveBar1.setSection('A', 0, 0, (_a = options.params) === null || _a === void 0 ? void 0 : _a.fontSize, false);
101
101
  staveBar1.addClef('treble').setContext(ctx).draw();
102
102
  const notesBar1 = [
103
103
  new StaveNote({ keys: ['c/4'], duration: 'q' }),
@@ -543,8 +543,8 @@ function drawStaveTextMultiLine(options, contextBuilder) {
543
543
  stave.setText('2nd line', Modifier.Position.RIGHT, { shift_y: 10 });
544
544
  stave.setText('Above Text', Modifier.Position.ABOVE, { shift_y: -10 });
545
545
  stave.setText('2nd line', Modifier.Position.ABOVE, { shift_y: 10 });
546
- stave.setText('Left Below Text', Modifier.Position.BELOW, { shift_y: -10, justification: Justification.LEFT });
547
- stave.setText('Right Below Text', Modifier.Position.BELOW, { shift_y: 10, justification: Justification.RIGHT });
546
+ stave.setText('Left Below Text', Modifier.Position.BELOW, { shift_y: -10, justification: TextJustification.LEFT });
547
+ stave.setText('Right Below Text', Modifier.Position.BELOW, { shift_y: 10, justification: TextJustification.RIGHT });
548
548
  stave.setContext(ctx).draw();
549
549
  ok(true, 'all pass');
550
550
  }
@@ -1,3 +1,2 @@
1
- import { Vex } from '../src/vex';
2
1
  export * from '../src/index';
3
- export default Vex;
2
+ export * as default from '../src/index';
@@ -1,3 +1,2 @@
1
- import { Vex } from '../src/vex';
2
1
  export * from '../src/index';
3
- export default Vex;
2
+ export * as default from '../src/index';
@@ -1,3 +1,2 @@
1
- import { Vex } from './vexflow';
2
1
  export * from '../src/index';
3
- export default Vex;
2
+ export * as default from '../src/index';
@@ -1,3 +1,2 @@
1
- import { Vex } from '../src/vex';
2
1
  export * from '../src/index';
3
- export default Vex;
2
+ export * as default from '../src/index';
@@ -1,3 +1,2 @@
1
- import { Vex } from '../src/vex';
2
1
  export * from '../src/index';
3
- export default Vex;
2
+ export * as default from '../src/index';
@@ -1,3 +1,2 @@
1
- import { Vex } from '../src/vex';
2
1
  export * from '../src/index';
3
- export default Vex;
2
+ export * as default from '../src/index';
@@ -30,6 +30,7 @@ export declare class Annotation extends Modifier {
30
30
  static HorizontalJustifyString: Record<string, number>;
31
31
  static VerticalJustify: typeof AnnotationVerticalJustify;
32
32
  static VerticalJustifyString: Record<string, number>;
33
+ static get minAnnotationPadding(): number;
33
34
  /** Arrange annotations within a `ModifierContext` */
34
35
  static format(annotations: Annotation[], state: ModifierContextState): boolean;
35
36
  protected horizontalJustification: AnnotationHorizontalJustify;
@@ -3,6 +3,10 @@ import { Fraction } from './fraction';
3
3
  import { RenderContext } from './rendercontext';
4
4
  import { StemmableNote } from './stemmablenote';
5
5
  import { Voice } from './voice';
6
+ export declare const BEAM_LEFT = "L";
7
+ export declare const BEAM_RIGHT = "R";
8
+ export declare const BEAM_BOTH = "B";
9
+ export declare type PartialBeamDirection = typeof BEAM_LEFT | typeof BEAM_RIGHT | typeof BEAM_BOTH;
6
10
  /** `Beams` span over a set of `StemmableNotes`. */
7
11
  export declare class Beam extends Element {
8
12
  static get CATEGORY(): string;
@@ -29,6 +33,12 @@ export declare class Beam extends Element {
29
33
  private break_on_indices;
30
34
  private beam_count;
31
35
  private unbeamable?;
36
+ /**
37
+ * Overrides to default beam directions for secondary-level beams that do not
38
+ * connect to any other note. See further explanation at
39
+ * `setPartialBeamSideAt`
40
+ */
41
+ private forcedPartialDirections;
32
42
  /** Get the direction of the beam */
33
43
  getStemDirection(): number;
34
44
  /**
@@ -88,6 +98,25 @@ export declare class Beam extends Element {
88
98
  getBeamCount(): number;
89
99
  /** Set which note `indices` to break the secondary beam at. */
90
100
  breakSecondaryAt(indices: number[]): this;
101
+ /**
102
+ * Forces the direction of a partial beam (a secondary-level beam that exists
103
+ * on one note only of the beam group). This is useful in rhythms such as 6/8
104
+ * eighth-sixteenth-eighth-sixteenth, where the direction of the beam on the
105
+ * first sixteenth note can help imply whether the rhythm is to be felt as
106
+ * three groups of eighth notes (typical) or as two groups of three-sixteenths
107
+ * (less common):
108
+ * ```
109
+ * ┌───┬──┬──┐ ┌──┬──┬──┐
110
+ * │ ├─ │ ─┤ vs │ ─┤ │ ─┤
111
+ * │ │ │ │ │ │ │ │
112
+ * ```
113
+ */
114
+ setPartialBeamSideAt(noteIndex: number, side: PartialBeamDirection): this;
115
+ /**
116
+ * Restore the default direction of a partial beam (a secondary-level beam
117
+ * that does not connect to any other notes).
118
+ */
119
+ unsetPartialBeamSideAt(noteIndex: number): this;
91
120
  /** Return the y coordinate for linear function. */
92
121
  getSlopeY(x: number, first_x_px: number, first_y_px: number, slope: number): number;
93
122
  /** Calculate the best possible slope for the provided notes. */
@@ -102,7 +131,7 @@ export declare class Beam extends Element {
102
131
  */
103
132
  applyStemExtensions(): void;
104
133
  /** Return upper level beam direction. */
105
- lookupBeamDirection(duration: string, prev_tick: number, tick: number, next_tick: number): string;
134
+ lookupBeamDirection(duration: string, prev_tick: number, tick: number, next_tick: number, noteIndex: number): PartialBeamDirection;
106
135
  /** Get the x coordinates for the beam lines of specific `duration`. */
107
136
  getBeamLines(duration: string): {
108
137
  start: number;
@@ -1,4 +1,5 @@
1
1
  import { Accidental } from './accidental';
2
+ import { PartialBeamDirection } from './beam';
2
3
  import { Factory } from './factory';
3
4
  import { Note } from './note';
4
5
  import { Grammar, Match, Parser, Result, Rule, RuleFunction } from './parser';
@@ -135,6 +136,9 @@ export declare class EasyScore {
135
136
  beam(notes: StemmableNote[], options?: {
136
137
  autoStem?: boolean;
137
138
  secondaryBeamBreaks?: number[];
139
+ partialBeamDirections?: {
140
+ [noteIndex: number]: PartialBeamDirection;
141
+ };
138
142
  }): StemmableNote[];
139
143
  tuplet(notes: StemmableNote[], options?: TupletOptions): StemmableNote[];
140
144
  notes(line: string, options?: BuilderOptions): StemmableNote[];
@@ -2,7 +2,7 @@ import { Accidental } from './accidental';
2
2
  import { Annotation, AnnotationHorizontalJustify, AnnotationVerticalJustify } from './annotation';
3
3
  import { Articulation } from './articulation';
4
4
  import { BarNote } from './barnote';
5
- import { Beam } from './beam';
5
+ import { Beam, PartialBeamDirection } from './beam';
6
6
  import { ChordSymbol } from './chordsymbol';
7
7
  import { ClefNote } from './clefnote';
8
8
  import { Curve, CurveOptions } from './curve';
@@ -26,7 +26,7 @@ import { RenderContext } from './rendercontext';
26
26
  import { RepeatNote } from './repeatnote';
27
27
  import { Stave, StaveOptions } from './stave';
28
28
  import { BarlineType } from './stavebarline';
29
- import { StaveConnector } from './staveconnector';
29
+ import { StaveConnector, StaveConnectorType } from './staveconnector';
30
30
  import { StaveLine } from './staveline';
31
31
  import { StaveNote, StaveNoteStruct } from './stavenote';
32
32
  import { StaveTie } from './stavetie';
@@ -186,7 +186,7 @@ export declare class Factory {
186
186
  StaveConnector(params: {
187
187
  top_stave: Stave;
188
188
  bottom_stave: Stave;
189
- type: string;
189
+ type: StaveConnectorType;
190
190
  }): StaveConnector;
191
191
  Formatter(options?: FormatterOptions): Formatter;
192
192
  Tuplet(params?: {
@@ -198,6 +198,9 @@ export declare class Factory {
198
198
  options?: {
199
199
  autoStem?: boolean;
200
200
  secondaryBeamBreaks?: number[];
201
+ partialBeamDirections?: {
202
+ [noteIndex: number]: PartialBeamDirection;
203
+ };
201
204
  };
202
205
  }): Beam;
203
206
  Curve(params: {
@@ -1,5 +1,5 @@
1
1
  import { Accidental } from './accidental';
2
- import { Annotation } from './annotation';
2
+ import { Annotation, AnnotationHorizontalJustify, AnnotationVerticalJustify } from './annotation';
3
3
  import { Articulation } from './articulation';
4
4
  import { BarNote } from './barnote';
5
5
  import { Beam } from './beam';
@@ -7,16 +7,16 @@ import { Bend } from './bend';
7
7
  import { BoundingBox } from './boundingbox';
8
8
  import { BoundingBoxComputation } from './boundingboxcomputation';
9
9
  import { CanvasContext } from './canvascontext';
10
- import { ChordSymbol } from './chordsymbol';
10
+ import { ChordSymbol, ChordSymbolHorizontalJustify, ChordSymbolVerticalJustify, SymbolModifiers, SymbolTypes } from './chordsymbol';
11
11
  import { Clef } from './clef';
12
12
  import { ClefNote } from './clefnote';
13
13
  import { Crescendo } from './crescendo';
14
- import { Curve } from './curve';
14
+ import { Curve, CurvePosition } from './curve';
15
15
  import { Dot } from './dot';
16
16
  import { EasyScore } from './easyscore';
17
17
  import { Element } from './element';
18
18
  import { Factory } from './factory';
19
- import { Font, FontModule } from './font';
19
+ import { Font, FontModule, FontStyle, FontWeight } from './font';
20
20
  import { Formatter } from './formatter';
21
21
  import { Fraction } from './fraction';
22
22
  import { FretHandFinger } from './frethandfinger';
@@ -42,20 +42,20 @@ import { Parser } from './parser';
42
42
  import { PedalMarking } from './pedalmarking';
43
43
  import { Registry } from './registry';
44
44
  import { RenderContext } from './rendercontext';
45
- import { Renderer } from './renderer';
45
+ import { Renderer, RendererBackends, RendererLineEndType } from './renderer';
46
46
  import { RepeatNote } from './repeatnote';
47
47
  import { Stave } from './stave';
48
48
  import { Barline, BarlineType } from './stavebarline';
49
49
  import { StaveConnector } from './staveconnector';
50
50
  import { StaveHairpin } from './stavehairpin';
51
51
  import { StaveLine } from './staveline';
52
- import { StaveModifier } from './stavemodifier';
52
+ import { StaveModifier, StaveModifierPosition } from './stavemodifier';
53
53
  import { StaveNote } from './stavenote';
54
54
  import { Repetition } from './staverepetition';
55
55
  import { StaveTempo } from './stavetempo';
56
56
  import { StaveText } from './stavetext';
57
57
  import { StaveTie } from './stavetie';
58
- import { Volta } from './stavevolta';
58
+ import { Volta, VoltaType } from './stavevolta';
59
59
  import { Stem } from './stem';
60
60
  import { StringNumber } from './stringnumber';
61
61
  import { Stroke } from './strokes';
@@ -65,10 +65,10 @@ import { TabNote } from './tabnote';
65
65
  import { TabSlide } from './tabslide';
66
66
  import { TabStave } from './tabstave';
67
67
  import { TabTie } from './tabtie';
68
- import { TextBracket } from './textbracket';
68
+ import { TextBracket, TextBracketPosition } from './textbracket';
69
69
  import { TextDynamics } from './textdynamics';
70
70
  import { TextFormatter } from './textformatter';
71
- import { TextNote } from './textnote';
71
+ import { TextJustification, TextNote } from './textnote';
72
72
  import { TickContext } from './tickcontext';
73
73
  import { TimeSignature } from './timesignature';
74
74
  import { TimeSigNote } from './timesignote';
@@ -77,7 +77,7 @@ import { Tuning } from './tuning';
77
77
  import { Tuplet } from './tuplet';
78
78
  import { Vibrato } from './vibrato';
79
79
  import { VibratoBracket } from './vibratobracket';
80
- import { Voice } from './voice';
80
+ import { Voice, VoiceMode } from './voice';
81
81
  export declare class Flow {
82
82
  static get BUILD(): {
83
83
  /** version number. */
@@ -106,7 +106,6 @@ export declare class Flow {
106
106
  static EasyScore: typeof EasyScore;
107
107
  static Element: typeof Element;
108
108
  static Factory: typeof Factory;
109
- static get Flow(): typeof Flow;
110
109
  static Font: typeof Font;
111
110
  static Formatter: typeof Formatter;
112
111
  static Fraction: typeof Fraction;
@@ -168,8 +167,24 @@ export declare class Flow {
168
167
  static VibratoBracket: typeof VibratoBracket;
169
168
  static Voice: typeof Voice;
170
169
  static Volta: typeof Volta;
171
- static BarlineType: typeof BarlineType;
170
+ static AnnotationHorizontalJustify: typeof AnnotationHorizontalJustify;
171
+ static AnnotationVerticalJustify: typeof AnnotationVerticalJustify;
172
+ static ChordSymbolHorizontalJustify: typeof ChordSymbolHorizontalJustify;
173
+ static ChordSymbolVerticalJustify: typeof ChordSymbolVerticalJustify;
174
+ static SymbolTypes: typeof SymbolTypes;
175
+ static SymbolModifiers: typeof SymbolModifiers;
176
+ static CurvePosition: typeof CurvePosition;
177
+ static FontWeight: typeof FontWeight;
178
+ static FontStyle: typeof FontStyle;
172
179
  static ModifierPosition: typeof ModifierPosition;
180
+ static RendererBackends: typeof RendererBackends;
181
+ static RendererLineEndType: typeof RendererLineEndType;
182
+ static BarlineType: typeof BarlineType;
183
+ static StaveModifierPosition: typeof StaveModifierPosition;
184
+ static VoltaType: typeof VoltaType;
185
+ static TextBracketPosition: typeof TextBracketPosition;
186
+ static TextJustification: typeof TextJustification;
187
+ static VoiceMode: typeof VoiceMode;
173
188
  /**
174
189
  * Examples:
175
190
  * ```
@@ -142,7 +142,6 @@ export declare class Font {
142
142
  * for your app.
143
143
  */
144
144
  static loadWebFonts(): Promise<void>;
145
- static loadTextFonts(): void;
146
145
  /**
147
146
  * @param fontName
148
147
  * @param data optionally set the Font object's `.data` property.
@@ -124,7 +124,9 @@ export declare class Glyph extends Element {
124
124
  setOptions(options: any): void;
125
125
  setPoint(point: number): this;
126
126
  setStave(stave: Stave): this;
127
+ getXShift(): number;
127
128
  setXShift(x_shift: number): this;
129
+ getYshift(): number;
128
130
  setYShift(y_shift: number): this;
129
131
  reset(): void;
130
132
  checkMetrics(): GlyphMetrics;
@@ -1,4 +1,3 @@
1
- import { Vex } from './vex';
2
1
  export * from './accidental';
3
2
  export * from './annotation';
4
3
  export * from './articulation';
@@ -83,9 +82,8 @@ export * from './tuning';
83
82
  export * from './tuplet';
84
83
  export * from './typeguard';
85
84
  export * from './util';
85
+ export * from './vex';
86
86
  export * from './vibrato';
87
87
  export * from './vibratobracket';
88
88
  export * from './voice';
89
89
  export * from './web';
90
- export { Vex };
91
- export default Vex;
@@ -83,6 +83,7 @@ export declare abstract class Note extends Tickable {
83
83
  protected stave?: Stave;
84
84
  render_options: {
85
85
  draw_stem_through_stave?: boolean;
86
+ draw?: boolean;
86
87
  draw_dots?: boolean;
87
88
  draw_stem?: boolean;
88
89
  y_shift: number;
@@ -73,7 +73,7 @@ export declare class Stave extends Element {
73
73
  /** Coda & Segno Symbol functions */
74
74
  setRepetitionType(type: number, yShift?: number): this;
75
75
  setVoltaType(type: number, number_t: string, y: number): this;
76
- setSection(section: string, y: number, xOffset?: number, fontSize?: number): this;
76
+ setSection(section: string, y: number, xOffset?: number, fontSize?: number, drawRect?: boolean): this;
77
77
  setTempo(tempo: StaveTempoOptions, y: number): this;
78
78
  setText(text: string, position: number, options?: {
79
79
  shift_x?: number;