vexflow 5.0.0-alpha.2 → 5.0.0-alpha.4

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 (157) hide show
  1. package/build/cjs/vexflow-bravura.js +2 -2
  2. package/build/cjs/vexflow-bravura.js.map +1 -1
  3. package/build/cjs/vexflow-core.js +2 -2
  4. package/build/cjs/vexflow-core.js.map +1 -1
  5. package/build/cjs/vexflow-debug-with-tests.js +528 -492
  6. package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
  7. package/build/cjs/vexflow-debug.js +460 -452
  8. package/build/cjs/vexflow-debug.js.map +1 -1
  9. package/build/cjs/vexflow.js +2 -2
  10. package/build/cjs/vexflow.js.map +1 -1
  11. package/build/esm/src/accidental.js +22 -28
  12. package/build/esm/src/beam.js +24 -42
  13. package/build/esm/src/clefnote.js +6 -1
  14. package/build/esm/src/element.js +83 -101
  15. package/build/esm/src/fonts/gonville.js +1 -1
  16. package/build/esm/src/formatter.js +9 -17
  17. package/build/esm/src/fraction.js +15 -22
  18. package/build/esm/src/glyphnote.js +3 -2
  19. package/build/esm/src/metrics.js +3 -0
  20. package/build/esm/src/modifier.js +6 -21
  21. package/build/esm/src/multimeasurerest.js +16 -25
  22. package/build/esm/src/note.js +7 -0
  23. package/build/esm/src/registry.js +5 -19
  24. package/build/esm/src/stave.js +4 -6
  25. package/build/esm/src/stavenote.js +26 -40
  26. package/build/esm/src/stavetempo.js +4 -11
  27. package/build/esm/src/stavetie.js +82 -36
  28. package/build/esm/src/svgcontext.js +5 -12
  29. package/build/esm/src/tickable.js +13 -26
  30. package/build/esm/src/tickcontext.js +20 -2
  31. package/build/esm/src/version.js +3 -3
  32. package/build/esm/src/vibrato.js +6 -1
  33. package/build/esm/tests/clef_tests.js +5 -1
  34. package/build/esm/tests/glyphnote_tests.js +6 -0
  35. package/build/esm/tests/stavetie_tests.js +29 -0
  36. package/build/esm/tests/tabstave_tests.js +1 -0
  37. package/build/esm/tests/vexflow_test_helpers.js +25 -39
  38. package/build/types/src/accidental.d.ts +19 -1
  39. package/build/types/src/annotation.d.ts +1 -1
  40. package/build/types/src/beam.d.ts +12 -1
  41. package/build/types/src/clefnote.d.ts +2 -0
  42. package/build/types/src/element.d.ts +13 -3
  43. package/build/types/src/fonts/gonville.d.ts +1 -1
  44. package/build/types/src/formatter.d.ts +5 -3
  45. package/build/types/src/fraction.d.ts +12 -7
  46. package/build/types/src/modifier.d.ts +2 -1
  47. package/build/types/src/multimeasurerest.d.ts +4 -1
  48. package/build/types/src/note.d.ts +2 -0
  49. package/build/types/src/registry.d.ts +1 -1
  50. package/build/types/src/stavenote.d.ts +2 -1
  51. package/build/types/src/stavetempo.d.ts +3 -3
  52. package/build/types/src/stavetie.d.ts +39 -2
  53. package/build/types/src/svgcontext.d.ts +1 -1
  54. package/build/types/src/tickable.d.ts +2 -1
  55. package/build/types/src/tickcontext.d.ts +30 -0
  56. package/package.json +2 -4
  57. package/tests/flow.html +2 -2
  58. package/entry/vexflow-bravura.ts +0 -25
  59. package/entry/vexflow-core.ts +0 -16
  60. package/entry/vexflow-debug-with-tests.ts +0 -64
  61. package/entry/vexflow-debug.ts +0 -54
  62. package/entry/vexflow.ts +0 -47
  63. package/src/accidental.ts +0 -570
  64. package/src/annotation.ts +0 -294
  65. package/src/articulation.ts +0 -383
  66. package/src/barnote.ts +0 -95
  67. package/src/beam.ts +0 -999
  68. package/src/bend.ts +0 -268
  69. package/src/boundingbox.ts +0 -108
  70. package/src/canvascontext.ts +0 -348
  71. package/src/chordsymbol.ts +0 -473
  72. package/src/clef.ts +0 -164
  73. package/src/clefnote.ts +0 -50
  74. package/src/crescendo.ts +0 -132
  75. package/src/curve.ts +0 -195
  76. package/src/dot.ts +0 -171
  77. package/src/easyscore.ts +0 -538
  78. package/src/element.ts +0 -692
  79. package/src/factory.ts +0 -694
  80. package/src/font.ts +0 -343
  81. package/src/fonts/academico.ts +0 -2
  82. package/src/fonts/academicobold.ts +0 -2
  83. package/src/fonts/bravura.ts +0 -2
  84. package/src/fonts/gonville.ts +0 -2
  85. package/src/fonts/petaluma.ts +0 -2
  86. package/src/fonts/petalumascript.ts +0 -2
  87. package/src/formatter.ts +0 -1107
  88. package/src/fraction.ts +0 -245
  89. package/src/frethandfinger.ts +0 -180
  90. package/src/ghostnote.ts +0 -75
  91. package/src/glyphnote.ts +0 -68
  92. package/src/glyphs.ts +0 -5880
  93. package/src/gracenote.ts +0 -146
  94. package/src/gracenotegroup.ts +0 -194
  95. package/src/gracetabnote.ts +0 -30
  96. package/src/index.ts +0 -90
  97. package/src/keymanager.ts +0 -153
  98. package/src/keysignature.ts +0 -272
  99. package/src/keysignote.ts +0 -46
  100. package/src/metrics.ts +0 -222
  101. package/src/modifier.ts +0 -216
  102. package/src/modifiercontext.ts +0 -177
  103. package/src/multimeasurerest.ts +0 -229
  104. package/src/music.ts +0 -443
  105. package/src/note.ts +0 -690
  106. package/src/notehead.ts +0 -158
  107. package/src/notesubgroup.ts +0 -88
  108. package/src/ornament.ts +0 -301
  109. package/src/parenthesis.ts +0 -89
  110. package/src/parser.ts +0 -263
  111. package/src/pedalmarking.ts +0 -273
  112. package/src/registry.ts +0 -146
  113. package/src/rendercontext.ts +0 -98
  114. package/src/renderer.ts +0 -166
  115. package/src/repeatnote.ts +0 -25
  116. package/src/stave.ts +0 -885
  117. package/src/stavebarline.ts +0 -231
  118. package/src/staveconnector.ts +0 -281
  119. package/src/stavehairpin.ts +0 -209
  120. package/src/staveline.ts +0 -343
  121. package/src/stavemodifier.ts +0 -93
  122. package/src/stavenote.ts +0 -1230
  123. package/src/staverepetition.ts +0 -148
  124. package/src/stavesection.ts +0 -54
  125. package/src/stavetempo.ts +0 -162
  126. package/src/stavetext.ts +0 -69
  127. package/src/stavetie.ts +0 -235
  128. package/src/stavevolta.ts +0 -66
  129. package/src/stem.ts +0 -225
  130. package/src/stemmablenote.ts +0 -248
  131. package/src/stringnumber.ts +0 -286
  132. package/src/strokes.ts +0 -214
  133. package/src/svgcontext.ts +0 -639
  134. package/src/system.ts +0 -327
  135. package/src/tables.ts +0 -796
  136. package/src/tabnote.ts +0 -449
  137. package/src/tabslide.ts +0 -115
  138. package/src/tabstave.ts +0 -31
  139. package/src/tabtie.ts +0 -44
  140. package/src/textbracket.ts +0 -231
  141. package/src/textdynamics.ts +0 -101
  142. package/src/textnote.ts +0 -175
  143. package/src/tickable.ts +0 -374
  144. package/src/tickcontext.ts +0 -280
  145. package/src/timesignature.ts +0 -229
  146. package/src/timesignote.ts +0 -45
  147. package/src/tremolo.ts +0 -51
  148. package/src/tuning.ts +0 -90
  149. package/src/tuplet.ts +0 -349
  150. package/src/typeguard.ts +0 -136
  151. package/src/util.ts +0 -169
  152. package/src/version.ts +0 -4
  153. package/src/vexflow.ts +0 -378
  154. package/src/vibrato.ts +0 -99
  155. package/src/vibratobracket.ts +0 -81
  156. package/src/voice.ts +0 -302
  157. package/src/web.ts +0 -35
@@ -1,9 +1,3 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
- };
6
- var _a, _Fraction_fractionA, _Fraction_fractionB;
7
1
  import { RuntimeError } from './util.js';
8
2
  export class Fraction {
9
3
  static get CATEGORY() {
@@ -22,7 +16,7 @@ export class Fraction {
22
16
  return a;
23
17
  }
24
18
  static LCM(a, b) {
25
- return (a * b) / _a.GCD(a, b);
19
+ return (a * b) / Fraction.GCD(a, b);
26
20
  }
27
21
  static LCMM(args) {
28
22
  if (args.length === 0) {
@@ -32,10 +26,10 @@ export class Fraction {
32
26
  return args[0];
33
27
  }
34
28
  else if (args.length === 2) {
35
- return _a.LCM(args[0], args[1]);
29
+ return Fraction.LCM(args[0], args[1]);
36
30
  }
37
31
  else {
38
- return _a.LCM(args.shift(), _a.LCMM(args));
32
+ return Fraction.LCM(args.shift(), Fraction.LCMM(args));
39
33
  }
40
34
  }
41
35
  constructor(numerator, denominator) {
@@ -54,7 +48,7 @@ export class Fraction {
54
48
  simplify() {
55
49
  let u = this.numerator;
56
50
  let d = this.denominator;
57
- const gcd = _a.GCD(u, d);
51
+ const gcd = Fraction.GCD(u, d);
58
52
  u /= gcd;
59
53
  d /= gcd;
60
54
  if (d < 0) {
@@ -65,7 +59,7 @@ export class Fraction {
65
59
  }
66
60
  add(param1 = 0, param2 = 1) {
67
61
  const [otherNumerator, otherDenominator] = getNumeratorAndDenominator(param1, param2);
68
- const lcm = _a.LCM(this.denominator, otherDenominator);
62
+ const lcm = Fraction.LCM(this.denominator, otherDenominator);
69
63
  const a = lcm / this.denominator;
70
64
  const b = lcm / otherDenominator;
71
65
  const u = this.numerator * a + otherNumerator * b;
@@ -73,7 +67,7 @@ export class Fraction {
73
67
  }
74
68
  subtract(param1 = 0, param2 = 1) {
75
69
  const [otherNumerator, otherDenominator] = getNumeratorAndDenominator(param1, param2);
76
- const lcm = _a.LCM(this.denominator, otherDenominator);
70
+ const lcm = Fraction.LCM(this.denominator, otherDenominator);
77
71
  const a = lcm / this.denominator;
78
72
  const b = lcm / otherDenominator;
79
73
  const u = this.numerator * a - otherNumerator * b;
@@ -88,17 +82,17 @@ export class Fraction {
88
82
  return this.set(this.numerator * otherDenominator, this.denominator * otherNumerator);
89
83
  }
90
84
  equals(compare) {
91
- const a = __classPrivateFieldGet(_a, _a, "f", _Fraction_fractionA).copy(compare).simplify();
92
- const b = __classPrivateFieldGet(_a, _a, "f", _Fraction_fractionB).copy(this).simplify();
85
+ const a = Fraction.fractionA.copy(compare).simplify();
86
+ const b = Fraction.fractionB.copy(this).simplify();
93
87
  return a.numerator === b.numerator && a.denominator === b.denominator;
94
88
  }
95
89
  greaterThan(compare) {
96
- const a = __classPrivateFieldGet(_a, _a, "f", _Fraction_fractionA).copy(this);
90
+ const a = Fraction.fractionA.copy(this);
97
91
  a.subtract(compare);
98
92
  return a.numerator > 0;
99
93
  }
100
94
  greaterThanEquals(compare) {
101
- const a = __classPrivateFieldGet(_a, _a, "f", _Fraction_fractionA).copy(this);
95
+ const a = Fraction.fractionA.copy(this);
102
96
  a.subtract(compare);
103
97
  return a.numerator >= 0;
104
98
  }
@@ -109,7 +103,7 @@ export class Fraction {
109
103
  return !this.greaterThan(compare);
110
104
  }
111
105
  clone() {
112
- return new _a(this.numerator, this.denominator);
106
+ return new Fraction(this.numerator, this.denominator);
113
107
  }
114
108
  copy(other) {
115
109
  if (typeof other === 'number') {
@@ -134,12 +128,12 @@ export class Fraction {
134
128
  return `${this.numerator}/${this.denominator}`;
135
129
  }
136
130
  toSimplifiedString() {
137
- return __classPrivateFieldGet(_a, _a, "f", _Fraction_fractionA).copy(this).simplify().toString();
131
+ return Fraction.fractionA.copy(this).simplify().toString();
138
132
  }
139
133
  toMixedString() {
140
134
  let s = '';
141
135
  const q = this.quotient();
142
- const f = __classPrivateFieldGet(_a, _a, "f", _Fraction_fractionA).copy(this);
136
+ const f = Fraction.fractionA.copy(this);
143
137
  if (q < 0) {
144
138
  f.makeAbs();
145
139
  }
@@ -164,9 +158,8 @@ export class Fraction {
164
158
  return this.set(n, d);
165
159
  }
166
160
  }
167
- _a = Fraction;
168
- _Fraction_fractionA = { value: new _a() };
169
- _Fraction_fractionB = { value: new _a() };
161
+ Fraction.fractionA = new Fraction();
162
+ Fraction.fractionB = new Fraction();
170
163
  function getNumeratorAndDenominator(n, d = 1) {
171
164
  if (typeof n === 'number') {
172
165
  return [n, d];
@@ -34,8 +34,9 @@ export class GlyphNote extends Note {
34
34
  this.setRendered();
35
35
  this.applyStyle(ctx);
36
36
  ctx.openGroup('glyphNote', this.getAttribute('id'));
37
- const x = this.isCenterAligned() ? this.getAbsoluteX() - this.getWidth() / 2 : this.getAbsoluteX();
38
- this.renderText(ctx, x, stave.getYForLine(this.options.line));
37
+ this.x = this.isCenterAligned() ? this.getAbsoluteX() - this.getWidth() / 2 : this.getAbsoluteX();
38
+ this.y = stave.getYForLine(this.options.line);
39
+ this.renderText(ctx, 0, 0);
39
40
  this.drawModifiers();
40
41
  ctx.closeGroup();
41
42
  this.restoreStyle(ctx);
@@ -149,6 +149,9 @@ export const MetricsDefaults = {
149
149
  fontStyle: 'italic',
150
150
  fontWeight: 'bold',
151
151
  },
152
+ TabStave: {
153
+ fontSize: 8,
154
+ },
152
155
  TabTie: {
153
156
  fontSize: 10,
154
157
  },
@@ -1,15 +1,3 @@
1
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
- if (kind === "m") throw new TypeError("Private method is not writable");
3
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
- };
7
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
- };
12
- var _Modifier_spacingFromNextModifier, _Modifier_modifierContext;
13
1
  import { Element } from './element.js';
14
2
  import { defined, RuntimeError } from './util.js';
15
3
  export var ModifierPosition;
@@ -38,12 +26,10 @@ export class Modifier extends Element {
38
26
  }
39
27
  constructor() {
40
28
  super();
41
- _Modifier_spacingFromNextModifier.set(this, void 0);
42
- _Modifier_modifierContext.set(this, void 0);
43
29
  this.width = 0;
44
30
  this.textLine = 0;
45
31
  this.position = Modifier.Position.LEFT;
46
- __classPrivateFieldSet(this, _Modifier_spacingFromNextModifier, 0, "f");
32
+ this.spacingFromNextModifier = 0;
47
33
  }
48
34
  reset() {
49
35
  }
@@ -70,13 +56,13 @@ export class Modifier extends Element {
70
56
  return this;
71
57
  }
72
58
  getModifierContext() {
73
- return __classPrivateFieldGet(this, _Modifier_modifierContext, "f");
59
+ return this.modifierContext;
74
60
  }
75
61
  checkModifierContext() {
76
- return defined(__classPrivateFieldGet(this, _Modifier_modifierContext, "f"), 'NoModifierContext', 'Modifier Context Required');
62
+ return defined(this.modifierContext, 'NoModifierContext', 'Modifier Context Required');
77
63
  }
78
64
  setModifierContext(c) {
79
- __classPrivateFieldSet(this, _Modifier_modifierContext, c, "f");
65
+ this.modifierContext = c;
80
66
  return this;
81
67
  }
82
68
  getPosition() {
@@ -96,10 +82,10 @@ export class Modifier extends Element {
96
82
  return this;
97
83
  }
98
84
  setSpacingFromNextModifier(x) {
99
- __classPrivateFieldSet(this, _Modifier_spacingFromNextModifier, x, "f");
85
+ this.spacingFromNextModifier = x;
100
86
  }
101
87
  getSpacingFromNextModifier() {
102
- return __classPrivateFieldGet(this, _Modifier_spacingFromNextModifier, "f");
88
+ return this.spacingFromNextModifier;
103
89
  }
104
90
  setXShift(x) {
105
91
  this.xShift = 0;
@@ -131,4 +117,3 @@ export class Modifier extends Element {
131
117
  });
132
118
  }
133
119
  }
134
- _Modifier_spacingFromNextModifier = new WeakMap(), _Modifier_modifierContext = new WeakMap();
@@ -1,22 +1,10 @@
1
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
- if (kind === "m") throw new TypeError("Private method is not writable");
3
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
- };
7
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
- };
12
- var _MultiMeasureRest_hasPaddingLeft, _MultiMeasureRest_hasPaddingRight, _MultiMeasureRest_hasLineThickness, _MultiMeasureRest_hasSymbolSpacing;
13
1
  import { Element } from './element.js';
14
2
  import { Glyphs } from './glyphs.js';
15
3
  import { Metrics } from './metrics.js';
16
4
  import { StaveModifierPosition } from './stavemodifier.js';
17
5
  import { Tables } from './tables.js';
18
6
  import { isBarline } from './typeguard.js';
19
- import { defined } from './util.js';
7
+ import { defined, RuntimeError } from './util.js';
20
8
  export class MultiMeasureRest extends Element {
21
9
  static get CATEGORY() {
22
10
  return "MultiMeasureRest";
@@ -25,10 +13,10 @@ export class MultiMeasureRest extends Element {
25
13
  var _a;
26
14
  super();
27
15
  this.xs = { left: NaN, right: NaN };
28
- _MultiMeasureRest_hasPaddingLeft.set(this, false);
29
- _MultiMeasureRest_hasPaddingRight.set(this, false);
30
- _MultiMeasureRest_hasLineThickness.set(this, false);
31
- _MultiMeasureRest_hasSymbolSpacing.set(this, false);
16
+ this.hasPaddingLeft = false;
17
+ this.hasPaddingRight = false;
18
+ this.hasLineThickness = false;
19
+ this.hasSymbolSpacing = false;
32
20
  const fontSize = (_a = options.numberGlyphPoint) !== null && _a !== void 0 ? _a : Metrics.get('MultiMeasureRest.fontSize');
33
21
  this.fontInfo.size = fontSize;
34
22
  this.numberOfMeasures = numberOfMeasures;
@@ -37,10 +25,10 @@ export class MultiMeasureRest extends Element {
37
25
  for (const digit of t) {
38
26
  this.text += String.fromCodePoint(0xe080 + Number(digit));
39
27
  }
40
- __classPrivateFieldSet(this, _MultiMeasureRest_hasPaddingLeft, typeof options.paddingLeft === 'number', "f");
41
- __classPrivateFieldSet(this, _MultiMeasureRest_hasPaddingRight, typeof options.paddingRight === 'number', "f");
42
- __classPrivateFieldSet(this, _MultiMeasureRest_hasLineThickness, typeof options.lineThickness === 'number', "f");
43
- __classPrivateFieldSet(this, _MultiMeasureRest_hasSymbolSpacing, typeof options.symbolSpacing === 'number', "f");
28
+ this.hasPaddingLeft = typeof options.paddingLeft === 'number';
29
+ this.hasPaddingRight = typeof options.paddingRight === 'number';
30
+ this.hasLineThickness = typeof options.lineThickness === 'number';
31
+ this.hasSymbolSpacing = typeof options.symbolSpacing === 'number';
44
32
  this.renderOptions = Object.assign({ useSymbols: false, showNumber: true, numberLine: -0.5, numberGlyphPoint: fontSize, line: 2, spacingBetweenLinesPx: Tables.STAVE_LINE_DISTANCE, serifThickness: 2, semibreveRestGlyphScale: Metrics.get('fontSize'), paddingLeft: 0, paddingRight: 0, lineThickness: 5, symbolSpacing: 0 }, options);
45
33
  }
46
34
  getXs() {
@@ -65,7 +53,11 @@ export class MultiMeasureRest extends Element {
65
53
  let txt = '\ue4ef';
66
54
  const el = new Element();
67
55
  el.setText(txt);
68
- for (let i = 1; (i + 2) * el.getWidth() + left <= right; i++) {
56
+ const elWidth = el.getWidth();
57
+ if (!elWidth) {
58
+ throw new RuntimeError('Cannot drawLine if width is 0');
59
+ }
60
+ for (let i = 1; (i + 2) * elWidth + left <= right; i++) {
69
61
  txt += '\ue4f0';
70
62
  }
71
63
  txt += '\ue4f1';
@@ -114,10 +106,10 @@ export class MultiMeasureRest extends Element {
114
106
  left -= begModifiers[0].getWidth();
115
107
  }
116
108
  const options = this.renderOptions;
117
- if (__classPrivateFieldGet(this, _MultiMeasureRest_hasPaddingLeft, "f")) {
109
+ if (this.hasPaddingLeft) {
118
110
  left = stave.getX() + options.paddingLeft;
119
111
  }
120
- if (__classPrivateFieldGet(this, _MultiMeasureRest_hasPaddingRight, "f")) {
112
+ if (this.hasPaddingRight) {
121
113
  right = stave.getX() + stave.getWidth() - options.paddingRight;
122
114
  }
123
115
  this.xs.left = left;
@@ -133,4 +125,3 @@ export class MultiMeasureRest extends Element {
133
125
  }
134
126
  }
135
127
  }
136
- _MultiMeasureRest_hasPaddingLeft = new WeakMap(), _MultiMeasureRest_hasPaddingRight = new WeakMap(), _MultiMeasureRest_hasLineThickness = new WeakMap(), _MultiMeasureRest_hasSymbolSpacing = new WeakMap();
@@ -373,4 +373,11 @@ export class Note extends Tickable {
373
373
  getKeyProps() {
374
374
  return this.keyProps;
375
375
  }
376
+ getBoundingBox() {
377
+ const boundingBox = super.getBoundingBox();
378
+ for (let i = 0; i < this.modifiers.length; i++) {
379
+ boundingBox.mergeWith(this.modifiers[i].getBoundingBox());
380
+ }
381
+ return boundingBox;
382
+ }
376
383
  }
@@ -1,15 +1,3 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
- };
6
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
7
- if (kind === "m") throw new TypeError("Private method is not writable");
8
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
9
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
10
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11
- };
12
- var _a, _Registry_defaultRegistry;
13
1
  import { RuntimeError } from './util.js';
14
2
  class Index {
15
3
  constructor() {
@@ -20,13 +8,13 @@ class Index {
20
8
  }
21
9
  export class Registry {
22
10
  static getDefaultRegistry() {
23
- return __classPrivateFieldGet(_a, _a, "f", _Registry_defaultRegistry);
11
+ return Registry.defaultRegistry;
24
12
  }
25
13
  static enableDefaultRegistry(registry) {
26
- __classPrivateFieldSet(_a, _a, registry, "f", _Registry_defaultRegistry);
14
+ Registry.defaultRegistry = registry;
27
15
  }
28
16
  static disableDefaultRegistry() {
29
- __classPrivateFieldSet(_a, _a, undefined, "f", _Registry_defaultRegistry);
17
+ Registry.defaultRegistry = undefined;
30
18
  }
31
19
  constructor() {
32
20
  this.index = new Index();
@@ -63,8 +51,8 @@ export class Registry {
63
51
  return this;
64
52
  }
65
53
  getElementById(id) {
66
- var _b, _c;
67
- return (_c = (_b = this.index.id) === null || _b === void 0 ? void 0 : _b[id]) === null || _c === void 0 ? void 0 : _c[id];
54
+ var _a, _b;
55
+ return (_b = (_a = this.index.id) === null || _a === void 0 ? void 0 : _a[id]) === null || _b === void 0 ? void 0 : _b[id];
68
56
  }
69
57
  getElementsByAttribute(attribute, value) {
70
58
  const indexAttr = this.index[attribute];
@@ -91,5 +79,3 @@ export class Registry {
91
79
  return this;
92
80
  }
93
81
  }
94
- _a = Registry;
95
- _Registry_defaultRegistry = { value: void 0 };
@@ -425,7 +425,7 @@ export class Stave extends Element {
425
425
  widths.right = (_a = layoutMetrics.xMax) !== null && _a !== void 0 ? _a : 0;
426
426
  widths.paddingRight = (_b = layoutMetrics.paddingRight) !== null && _b !== void 0 ? _b : 0;
427
427
  }
428
- widths.left = (_c = -layoutMetrics.xMin) !== null && _c !== void 0 ? _c : 0;
428
+ widths.left = -((_c = layoutMetrics.xMin) !== null && _c !== void 0 ? _c : 0);
429
429
  widths.paddingLeft = (_d = layoutMetrics.paddingLeft) !== null && _d !== void 0 ? _d : 0;
430
430
  if (i === endModifiers.length - 1) {
431
431
  widths.paddingLeft = 0;
@@ -473,11 +473,9 @@ export class Stave extends Element {
473
473
  this.restoreStyle();
474
474
  for (let i = 0; i < this.modifiers.length; i++) {
475
475
  const modifier = this.modifiers[i];
476
- if (typeof modifier.draw === 'function') {
477
- modifier.applyStyle(ctx);
478
- modifier.draw(this, this.getModifierXShift(i));
479
- modifier.restoreStyle(ctx);
480
- }
476
+ modifier.applyStyle(ctx);
477
+ modifier.draw(this, this.getModifierXShift(i));
478
+ modifier.restoreStyle(ctx);
481
479
  }
482
480
  if (this.measure > 0) {
483
481
  ctx.save();
@@ -1,15 +1,3 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
- };
6
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
7
- if (kind === "m") throw new TypeError("Private method is not writable");
8
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
9
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
10
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11
- };
12
- var _StaveNote_noteHeads, _StaveNote_sortedKeyProps;
13
1
  import { BoundingBox } from './boundingbox.js';
14
2
  import { Glyphs } from './glyphs.js';
15
3
  import { Metrics } from './metrics.js';
@@ -54,7 +42,7 @@ export class StaveNote extends StemmableNote {
54
42
  return false;
55
43
  const notesList = [];
56
44
  for (let i = 0; i < notes.length; i++) {
57
- const props = __classPrivateFieldGet(notes[i], _StaveNote_sortedKeyProps, "f");
45
+ const props = notes[i].sortedKeyProps;
58
46
  const line = props[0].keyProps.line;
59
47
  let minL = props[props.length - 1].keyProps.line;
60
48
  const stemDirection = notes[i].getStemDirection();
@@ -64,10 +52,10 @@ export class StaveNote extends StemmableNote {
64
52
  if (notes[i].isRest()) {
65
53
  maxL =
66
54
  line +
67
- Math.ceil(__classPrivateFieldGet(notes[i], _StaveNote_noteHeads, "f")[0].getTextMetrics().actualBoundingBoxAscent / Tables.STAVE_LINE_DISTANCE);
55
+ Math.ceil(notes[i]._noteHeads[0].getTextMetrics().actualBoundingBoxAscent / Tables.STAVE_LINE_DISTANCE);
68
56
  minL =
69
57
  line -
70
- Math.ceil(__classPrivateFieldGet(notes[i], _StaveNote_noteHeads, "f")[0].getTextMetrics().actualBoundingBoxDescent / Tables.STAVE_LINE_DISTANCE);
58
+ Math.ceil(notes[i]._noteHeads[0].getTextMetrics().actualBoundingBoxDescent / Tables.STAVE_LINE_DISTANCE);
71
59
  }
72
60
  else {
73
61
  maxL =
@@ -140,8 +128,8 @@ export class StaveNote extends StemmableNote {
140
128
  else {
141
129
  const lineDiff = Math.abs(noteU.line - noteL.line);
142
130
  if (noteU.note.hasStem() && noteL.note.hasStem()) {
143
- const noteUHead = __classPrivateFieldGet(noteU.note, _StaveNote_sortedKeyProps, "f")[0].keyProps.code;
144
- const noteLHead = __classPrivateFieldGet(noteL.note, _StaveNote_sortedKeyProps, "f")[__classPrivateFieldGet(noteL.note, _StaveNote_sortedKeyProps, "f").length - 1].keyProps.code;
131
+ const noteUHead = noteU.note.sortedKeyProps[0].keyProps.code;
132
+ const noteLHead = noteL.note.sortedKeyProps[noteL.note.sortedKeyProps.length - 1].keyProps.code;
145
133
  if (!Tables.UNISON ||
146
134
  noteUHead !== noteLHead ||
147
135
  noteU.note.getModifiers().filter((item) => item.getCategory() === "Dot" && item.getIndex() === 0)
@@ -264,8 +252,7 @@ export class StaveNote extends StemmableNote {
264
252
  super(noteStruct);
265
253
  this.minLine = 0;
266
254
  this.maxLine = 0;
267
- _StaveNote_noteHeads.set(this, void 0);
268
- _StaveNote_sortedKeyProps.set(this, []);
255
+ this.sortedKeyProps = [];
269
256
  this.ledgerLineStyle = {};
270
257
  this.clef = (_a = noteStruct.clef) !== null && _a !== void 0 ? _a : 'treble';
271
258
  this.octaveShift = (_b = noteStruct.octaveShift) !== null && _b !== void 0 ? _b : 0;
@@ -274,7 +261,7 @@ export class StaveNote extends StemmableNote {
274
261
  this.displaced = false;
275
262
  this.dotShiftY = 0;
276
263
  this.useDefaultHeadX = false;
277
- __classPrivateFieldSet(this, _StaveNote_noteHeads, [], "f");
264
+ this._noteHeads = [];
278
265
  this.modifiers = [];
279
266
  this.renderOptions = Object.assign(Object.assign({}, this.renderOptions), { strokePx: noteStruct.strokePx || StaveNote.LEDGER_LINE_OFFSET });
280
267
  this.calculateKeyProps();
@@ -290,9 +277,9 @@ export class StaveNote extends StemmableNote {
290
277
  }
291
278
  reset() {
292
279
  super.reset();
293
- const noteHeadStyles = __classPrivateFieldGet(this, _StaveNote_noteHeads, "f").map((noteHead) => noteHead.getStyle());
280
+ const noteHeadStyles = this._noteHeads.map((noteHead) => noteHead.getStyle());
294
281
  this.buildNoteHeads();
295
- __classPrivateFieldGet(this, _StaveNote_noteHeads, "f").forEach((noteHead, index) => {
282
+ this._noteHeads.forEach((noteHead, index) => {
296
283
  const noteHeadStyle = noteHeadStyles[index];
297
284
  if (noteHeadStyle)
298
285
  noteHead.setStyle(noteHeadStyle);
@@ -317,7 +304,7 @@ export class StaveNote extends StemmableNote {
317
304
  return this;
318
305
  }
319
306
  buildNoteHeads() {
320
- __classPrivateFieldSet(this, _StaveNote_noteHeads, [], "f");
307
+ this._noteHeads = [];
321
308
  const stemDirection = this.getStemDirection();
322
309
  const keys = this.getKeys();
323
310
  let lastLine = undefined;
@@ -337,7 +324,7 @@ export class StaveNote extends StemmableNote {
337
324
  step = -1;
338
325
  }
339
326
  for (let i = start; i !== end; i += step) {
340
- const noteProps = __classPrivateFieldGet(this, _StaveNote_sortedKeyProps, "f")[i].keyProps;
327
+ const noteProps = this.sortedKeyProps[i].keyProps;
341
328
  const line = noteProps.line;
342
329
  if (lastLine === undefined) {
343
330
  lastLine = line;
@@ -363,16 +350,16 @@ export class StaveNote extends StemmableNote {
363
350
  });
364
351
  notehead.fontInfo = this.fontInfo;
365
352
  this.addChildElement(notehead);
366
- __classPrivateFieldGet(this, _StaveNote_noteHeads, "f")[__classPrivateFieldGet(this, _StaveNote_sortedKeyProps, "f")[i].index] = notehead;
353
+ this._noteHeads[this.sortedKeyProps[i].index] = notehead;
367
354
  }
368
- return __classPrivateFieldGet(this, _StaveNote_noteHeads, "f");
355
+ return this._noteHeads;
369
356
  }
370
357
  autoStem() {
371
358
  this.setStemDirection(this.calculateOptimalStemDirection());
372
359
  }
373
360
  calculateOptimalStemDirection() {
374
- this.minLine = __classPrivateFieldGet(this, _StaveNote_sortedKeyProps, "f")[0].keyProps.line;
375
- this.maxLine = __classPrivateFieldGet(this, _StaveNote_sortedKeyProps, "f")[this.keyProps.length - 1].keyProps.line;
361
+ this.minLine = this.sortedKeyProps[0].keyProps.line;
362
+ this.maxLine = this.sortedKeyProps[this.keyProps.length - 1].keyProps.line;
376
363
  const MIDDLE_LINE = 3;
377
364
  const decider = (this.minLine + this.maxLine) / 2;
378
365
  const stemDirection = decider < MIDDLE_LINE ? Stem.UP : Stem.DOWN;
@@ -413,13 +400,13 @@ export class StaveNote extends StemmableNote {
413
400
  this.keyProps.push(props);
414
401
  }
415
402
  this.keyProps.forEach((keyProps, index) => {
416
- __classPrivateFieldGet(this, _StaveNote_sortedKeyProps, "f").push({ keyProps, index });
403
+ this.sortedKeyProps.push({ keyProps, index });
417
404
  });
418
- __classPrivateFieldGet(this, _StaveNote_sortedKeyProps, "f").sort((a, b) => a.keyProps.line - b.keyProps.line);
405
+ this.sortedKeyProps.sort((a, b) => a.keyProps.line - b.keyProps.line);
419
406
  }
420
407
  getBoundingBox() {
421
408
  const boundingBox = new BoundingBox(this.getAbsoluteX(), this.ys[0], 0, 0);
422
- __classPrivateFieldGet(this, _StaveNote_noteHeads, "f").forEach((notehead) => {
409
+ this._noteHeads.forEach((notehead) => {
423
410
  boundingBox.mergeWith(notehead.getBoundingBox());
424
411
  });
425
412
  const { yTop, yBottom } = this.getNoteHeadBounds();
@@ -489,7 +476,7 @@ export class StaveNote extends StemmableNote {
489
476
  }
490
477
  setStave(stave) {
491
478
  super.setStave(stave);
492
- const ys = __classPrivateFieldGet(this, _StaveNote_noteHeads, "f").map((notehead) => {
479
+ const ys = this._noteHeads.map((notehead) => {
493
480
  notehead.setStave(stave);
494
481
  return notehead.getY();
495
482
  });
@@ -553,7 +540,7 @@ export class StaveNote extends StemmableNote {
553
540
  x = this.getGlyphWidth() / 2;
554
541
  }
555
542
  let restShift = 0;
556
- switch (__classPrivateFieldGet(this, _StaveNote_noteHeads, "f")[index].getText()) {
543
+ switch (this._noteHeads[index].getText()) {
557
544
  case Glyphs.restDoubleWhole:
558
545
  case Glyphs.restWhole:
559
546
  restShift += 0.5;
@@ -606,7 +593,7 @@ export class StaveNote extends StemmableNote {
606
593
  return this.noteHeads[0].getWidth();
607
594
  }
608
595
  setKeyStyle(index, style) {
609
- __classPrivateFieldGet(this, _StaveNote_noteHeads, "f")[index].setStyle(style);
596
+ this._noteHeads[index].setStyle(style);
610
597
  return this;
611
598
  }
612
599
  setKeyLine(index, line) {
@@ -652,7 +639,7 @@ export class StaveNote extends StemmableNote {
652
639
  let lowestDisplacedLine;
653
640
  let highestNonDisplacedLine = highestLine;
654
641
  let lowestNonDisplacedLine = lowestLine;
655
- __classPrivateFieldGet(this, _StaveNote_noteHeads, "f").forEach((notehead) => {
642
+ this._noteHeads.forEach((notehead) => {
656
643
  const line = notehead.getLine();
657
644
  const y = notehead.getY();
658
645
  yTop = Math.min(y, yTop);
@@ -695,7 +682,7 @@ export class StaveNote extends StemmableNote {
695
682
  return xBegin + this.getGlyphWidth();
696
683
  }
697
684
  get noteHeads() {
698
- return __classPrivateFieldGet(this, _StaveNote_noteHeads, "f").slice();
685
+ return this._noteHeads.slice();
699
686
  }
700
687
  drawLedgerLines() {
701
688
  const stave = this.checkStave();
@@ -745,7 +732,7 @@ export class StaveNote extends StemmableNote {
745
732
  for (let i = 0; i < this.modifiers.length; i++) {
746
733
  const modifier = this.modifiers[i];
747
734
  const index = modifier.checkIndex();
748
- const notehead = __classPrivateFieldGet(this, _StaveNote_noteHeads, "f")[index];
735
+ const notehead = this._noteHeads[index];
749
736
  if (notehead === noteheadParam) {
750
737
  const noteheadStyle = notehead.getStyle();
751
738
  notehead.applyStyle(ctx, noteheadStyle);
@@ -782,7 +769,7 @@ export class StaveNote extends StemmableNote {
782
769
  }
783
770
  drawNoteHeads() {
784
771
  const ctx = this.checkContext();
785
- __classPrivateFieldGet(this, _StaveNote_noteHeads, "f").forEach((notehead) => {
772
+ this._noteHeads.forEach((notehead) => {
786
773
  notehead.applyStyle(ctx);
787
774
  ctx.openGroup('notehead', notehead.getAttribute('id'));
788
775
  notehead.setContext(ctx).draw();
@@ -840,7 +827,7 @@ export class StaveNote extends StemmableNote {
840
827
  const ctx = this.checkContext();
841
828
  const xBegin = this.getNoteHeadBeginX();
842
829
  const shouldRenderStem = this.hasStem() && !this.beam;
843
- __classPrivateFieldGet(this, _StaveNote_noteHeads, "f").forEach((notehead) => notehead.setX(xBegin));
830
+ this._noteHeads.forEach((notehead) => notehead.setX(xBegin));
844
831
  if (this.stem) {
845
832
  const stemX = this.getStemX();
846
833
  this.stem.setNoteHeadXBounds(stemX, stemX);
@@ -860,5 +847,4 @@ export class StaveNote extends StemmableNote {
860
847
  this.setRendered();
861
848
  }
862
849
  }
863
- _StaveNote_noteHeads = new WeakMap(), _StaveNote_sortedKeyProps = new WeakMap();
864
850
  StaveNote.DEBUG = false;
@@ -1,9 +1,3 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
- };
6
- var _StaveTempo_durationToCode;
7
1
  import { Element } from './element.js';
8
2
  import { Glyphs } from './glyphs.js';
9
3
  import { Metrics } from './metrics.js';
@@ -14,7 +8,7 @@ export class StaveTempo extends StaveModifier {
14
8
  }
15
9
  constructor(tempo, x, shiftY) {
16
10
  super();
17
- _StaveTempo_durationToCode.set(this, {
11
+ this.durationToCode = {
18
12
  '1/4': Glyphs.metNoteDoubleWholeSquare,
19
13
  long: Glyphs.metNoteDoubleWholeSquare,
20
14
  '1/2': Glyphs.metNoteDoubleWhole,
@@ -44,7 +38,7 @@ export class StaveTempo extends StaveModifier {
44
38
  '512th': Glyphs.metNote512thUp,
45
39
  1024: Glyphs.metNote1024thUp,
46
40
  '1024th': Glyphs.metNote1024thUp,
47
- });
41
+ };
48
42
  this.tempo = tempo;
49
43
  this.position = StaveModifierPosition.ABOVE;
50
44
  this.x = x;
@@ -75,7 +69,7 @@ export class StaveTempo extends StaveModifier {
75
69
  x += elText.getWidth() + 3;
76
70
  }
77
71
  if (duration) {
78
- el.setText(__classPrivateFieldGet(this, _StaveTempo_durationToCode, "f")[duration]);
72
+ el.setText(this.durationToCode[duration]);
79
73
  el.renderText(ctx, x + this.xShift, y + this.yShift);
80
74
  x += el.getWidth() + 3;
81
75
  if (dots) {
@@ -89,7 +83,7 @@ export class StaveTempo extends StaveModifier {
89
83
  elText.renderText(ctx, x + this.xShift, y + this.yShift);
90
84
  x += elText.getWidth() + 3;
91
85
  if (duration2) {
92
- el.setText(__classPrivateFieldGet(this, _StaveTempo_durationToCode, "f")[duration2]);
86
+ el.setText(this.durationToCode[duration2]);
93
87
  el.renderText(ctx, x + this.xShift, y + this.yShift);
94
88
  x += el.getWidth() + 3;
95
89
  if (dots2) {
@@ -113,4 +107,3 @@ export class StaveTempo extends StaveModifier {
113
107
  return this;
114
108
  }
115
109
  }
116
- _StaveTempo_durationToCode = new WeakMap();