vexflow 5.0.0-alpha.4 → 5.0.0-beta.1

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 (123) 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 +1582 -1397
  7. package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
  8. package/build/cjs/vexflow-debug.js +636 -553
  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/annotation.js +0 -2
  13. package/build/esm/src/articulation.js +2 -2
  14. package/build/esm/src/barnote.js +3 -3
  15. package/build/esm/src/beam.js +2 -4
  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/curve.js +8 -5
  20. package/build/esm/src/element.js +11 -17
  21. package/build/esm/src/factory.js +4 -4
  22. package/build/esm/src/flag.js +20 -0
  23. package/build/esm/src/formatter.js +4 -4
  24. package/build/esm/src/glyphnote.js +0 -2
  25. package/build/esm/src/gracenote.js +0 -2
  26. package/build/esm/src/gracenotegroup.js +17 -8
  27. package/build/esm/src/index.js +2 -0
  28. package/build/esm/src/keysignature.js +48 -32
  29. package/build/esm/src/keysignote.js +1 -1
  30. package/build/esm/src/metrics.js +55 -7
  31. package/build/esm/src/modifier.js +4 -2
  32. package/build/esm/src/notehead.js +6 -1
  33. package/build/esm/src/ornament.js +0 -2
  34. package/build/esm/src/pedalmarking.js +33 -41
  35. package/build/esm/src/stave.js +15 -19
  36. package/build/esm/src/stavebarline.js +2 -3
  37. package/build/esm/src/stavehairpin.js +1 -1
  38. package/build/esm/src/staveline.js +0 -4
  39. package/build/esm/src/stavemodifier.js +0 -2
  40. package/build/esm/src/stavenote.js +16 -28
  41. package/build/esm/src/staverepetition.js +3 -2
  42. package/build/esm/src/stavesection.js +13 -15
  43. package/build/esm/src/stavetempo.js +3 -2
  44. package/build/esm/src/stavetext.js +2 -2
  45. package/build/esm/src/stavetie.js +0 -4
  46. package/build/esm/src/stavevolta.js +3 -2
  47. package/build/esm/src/stem.js +0 -4
  48. package/build/esm/src/stemmablenote.js +5 -6
  49. package/build/esm/src/stringnumber.js +0 -2
  50. package/build/esm/src/svgcontext.js +0 -1
  51. package/build/esm/src/tabnote.js +2 -8
  52. package/build/esm/src/textbracket.js +0 -3
  53. package/build/esm/src/textnote.js +0 -2
  54. package/build/esm/src/timesignature.js +2 -4
  55. package/build/esm/src/timesignote.js +2 -0
  56. package/build/esm/src/tuplet.js +42 -31
  57. package/build/esm/src/version.js +3 -3
  58. package/build/esm/src/vexflow.js +6 -2
  59. package/build/esm/tests/accidental_tests.js +30 -17
  60. package/build/esm/tests/annotation_tests.js +12 -12
  61. package/build/esm/tests/articulation_tests.js +13 -13
  62. package/build/esm/tests/auto_beam_formatting_tests.js +33 -33
  63. package/build/esm/tests/beam_tests.js +1 -1
  64. package/build/esm/tests/bend_tests.js +7 -7
  65. package/build/esm/tests/chordsymbol_tests.js +8 -8
  66. package/build/esm/tests/curve_tests.js +34 -0
  67. package/build/esm/tests/{bach_tests.js → demo_petzold_tests.js} +7 -7
  68. package/build/esm/tests/dot_tests.js +4 -4
  69. package/build/esm/tests/formatter_tests.js +25 -25
  70. package/build/esm/tests/gracenote_tests.js +2 -1
  71. package/build/esm/tests/gracetabnote_tests.js +1 -1
  72. package/build/esm/tests/index.js +1 -1
  73. package/build/esm/tests/key_clef_tests.js +6 -6
  74. package/build/esm/tests/keysignature_tests.js +20 -17
  75. package/build/esm/tests/notehead_tests.js +10 -7
  76. package/build/esm/tests/offscreencanvas_tests.js +1 -1
  77. package/build/esm/tests/ornament_tests.js +8 -8
  78. package/build/esm/tests/pedalmarking_tests.js +27 -0
  79. package/build/esm/tests/percussion_tests.js +6 -3
  80. package/build/esm/tests/renderer_tests.js +1 -1
  81. package/build/esm/tests/rests_tests.js +26 -26
  82. package/build/esm/tests/rhythm_tests.js +15 -15
  83. package/build/esm/tests/stave_tests.js +44 -43
  84. package/build/esm/tests/staveconnector_tests.js +73 -73
  85. package/build/esm/tests/stavehairpin_tests.js +1 -1
  86. package/build/esm/tests/stavemodifier_tests.js +3 -3
  87. package/build/esm/tests/stavenote_tests.js +29 -29
  88. package/build/esm/tests/stringnumber_tests.js +1 -1
  89. package/build/esm/tests/strokes_tests.js +1 -1
  90. package/build/esm/tests/style_tests.js +1 -1
  91. package/build/esm/tests/tabnote_tests.js +7 -7
  92. package/build/esm/tests/tabslide_tests.js +6 -6
  93. package/build/esm/tests/tabstave_tests.js +1 -1
  94. package/build/esm/tests/tabtie_tests.js +8 -8
  95. package/build/esm/tests/textnote_tests.js +1 -1
  96. package/build/esm/tests/threevoice_tests.js +2 -2
  97. package/build/esm/tests/timesignature_tests.js +23 -13
  98. package/build/esm/tests/vibrato_tests.js +3 -3
  99. package/build/esm/tests/voice_tests.js +1 -1
  100. package/build/types/src/bend.d.ts +6 -0
  101. package/build/types/src/curve.d.ts +5 -4
  102. package/build/types/src/element.d.ts +10 -11
  103. package/build/types/src/factory.d.ts +2 -2
  104. package/build/types/src/flag.d.ts +12 -0
  105. package/build/types/src/frethandfinger.d.ts +1 -1
  106. package/build/types/src/index.d.ts +2 -0
  107. package/build/types/src/keysignature.d.ts +12 -7
  108. package/build/types/src/metrics.d.ts +5 -0
  109. package/build/types/src/modifier.d.ts +1 -1
  110. package/build/types/src/pedalmarking.d.ts +2 -2
  111. package/build/types/src/stave.d.ts +1 -3
  112. package/build/types/src/stavebarline.d.ts +1 -1
  113. package/build/types/src/staveline.d.ts +1 -1
  114. package/build/types/src/stavemodifier.d.ts +0 -1
  115. package/build/types/src/staverepetition.d.ts +1 -1
  116. package/build/types/src/stavesection.d.ts +3 -4
  117. package/build/types/src/stavetempo.d.ts +1 -2
  118. package/build/types/src/stavetext.d.ts +1 -2
  119. package/build/types/src/stavevolta.d.ts +1 -2
  120. package/build/types/src/stemmablenote.d.ts +2 -3
  121. package/build/types/src/tuplet.d.ts +2 -12
  122. package/build/types/src/typeguard.d.ts +1 -0
  123. package/package.json +34 -30
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * VexFlow 5.0.0-alpha.4 2024-06-24T05:25:46.334Z b71510759a0805f5a61170a47ec293256833eb35
2
+ * VexFlow 5.0.0-beta.1 2025-02-25T13:07:56.120Z ba0b36b343aa5f7fe28e66e7e58c6dabe8f728ec
3
3
  * Copyright (c) 2023-present VexFlow contributors (see https://github.com/vexflow/vexflow/blob/main/AUTHORS.md).
4
4
  */
5
5
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -29,9 +29,9 @@ __webpack_require__.r(__webpack_exports__);
29
29
  /* harmony export */ VERSION: () => (/* binding */ VERSION)
30
30
  /* harmony export */ });
31
31
  // Gruntfile.js uses string-replace-loader to replace these values during build time.
32
- const VERSION = '5.0.0-alpha.4';
33
- const ID = 'b71510759a0805f5a61170a47ec293256833eb35';
34
- const DATE = '2024-06-24T05:25:46.334Z';
32
+ const VERSION = '5.0.0-beta.1';
33
+ const ID = 'ba0b36b343aa5f7fe28e66e7e58c6dabe8f728ec';
34
+ const DATE = '2025-02-25T13:07:56.120Z';
35
35
 
36
36
 
37
37
  /***/ }),
@@ -721,7 +721,6 @@ class Annotation extends _modifier__WEBPACK_IMPORTED_MODULE_2__.Modifier {
721
721
  const stemDirection = note.hasStem() ? note.getStemDirection() : _stem__WEBPACK_IMPORTED_MODULE_3__.Stem.UP;
722
722
  const start = note.getModifierStartXY(_modifier__WEBPACK_IMPORTED_MODULE_2__.ModifierPosition.ABOVE, this.index);
723
723
  this.setRendered();
724
- this.applyStyle();
725
724
  ctx.openGroup('annotation', this.getAttribute('id'));
726
725
  const textWidth = this.getWidth();
727
726
  const textHeight = _font__WEBPACK_IMPORTED_MODULE_0__.Font.convertSizeToPixelValue(this.fontInfo.size);
@@ -782,7 +781,6 @@ class Annotation extends _modifier__WEBPACK_IMPORTED_MODULE_2__.Modifier {
782
781
  this.y = y;
783
782
  this.renderText(ctx, 0, 0);
784
783
  ctx.closeGroup();
785
- this.restoreStyle();
786
784
  }
787
785
  }
788
786
  /** To enable logging for this class. Set `VexFlow.Annotation.DEBUG` to `true`. */
@@ -1041,6 +1039,7 @@ class Articulation extends _modifier__WEBPACK_IMPORTED_MODULE_1__.Modifier {
1041
1039
  }
1042
1040
  articulation.setTextLine(state.topTextLine);
1043
1041
  state.topTextLine += increment;
1042
+ articulation.setOrigin(0.5, 1);
1044
1043
  }
1045
1044
  else if (articulation.getPosition() === BELOW) {
1046
1045
  let noteLine = Math.max(lines - note.getLineNumber(), 0);
@@ -1055,6 +1054,7 @@ class Articulation extends _modifier__WEBPACK_IMPORTED_MODULE_1__.Modifier {
1055
1054
  }
1056
1055
  articulation.setTextLine(state.textLine);
1057
1056
  state.textLine += increment;
1057
+ articulation.setOrigin(0.5, 0);
1058
1058
  }
1059
1059
  });
1060
1060
  const width = articulations
@@ -1140,12 +1140,10 @@ class Articulation extends _modifier__WEBPACK_IMPORTED_MODULE_1__.Modifier {
1140
1140
  const initialOffset = getInitialOffset(note, position);
1141
1141
  let y = {
1142
1142
  [ABOVE]: () => {
1143
- this.setOrigin(0.5, 1);
1144
1143
  const y = getTopY(note, textLine) - (textLine + initialOffset) * staffSpace;
1145
1144
  return shouldSitOutsideStaff ? Math.min(stave.getYForTopText(Articulation.INITIAL_OFFSET), y) : y;
1146
1145
  },
1147
1146
  [BELOW]: () => {
1148
- this.setOrigin(0.5, 0);
1149
1147
  const y = getBottomY(note, textLine) + (textLine + initialOffset) * staffSpace;
1150
1148
  return shouldSitOutsideStaff ? Math.max(stave.getYForBottomText(Articulation.INITIAL_OFFSET), y) : y;
1151
1149
  },
@@ -1254,11 +1252,11 @@ class BarNote extends _note__WEBPACK_IMPORTED_MODULE_0__.Note {
1254
1252
  draw() {
1255
1253
  const ctx = this.checkContext();
1256
1254
  L('Rendering bar line at: ', this.getAbsoluteX());
1257
- this.applyStyle(ctx);
1258
1255
  const barline = new _stavebarline__WEBPACK_IMPORTED_MODULE_1__.Barline(this.type);
1259
1256
  barline.setX(this.getAbsoluteX());
1260
- barline.draw(this.checkStave());
1261
- this.restoreStyle(ctx);
1257
+ barline.setStave(this.checkStave());
1258
+ barline.setContext(ctx);
1259
+ barline.drawWithStyle();
1262
1260
  this.setRendered();
1263
1261
  }
1264
1262
  }
@@ -2044,7 +2042,7 @@ class Beam extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
2044
2042
  if (stem) {
2045
2043
  const stemX = note.getStemX();
2046
2044
  stem.setNoteHeadXBounds(stemX, stemX);
2047
- stem.setContext(ctx).draw();
2045
+ stem.setContext(ctx).drawWithStyle();
2048
2046
  }
2049
2047
  }, this);
2050
2048
  }
@@ -2112,12 +2110,10 @@ class Beam extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
2112
2110
  if (!this.postFormatted) {
2113
2111
  this.postFormat();
2114
2112
  }
2115
- this.drawStems(ctx);
2116
- this.applyStyle();
2117
2113
  ctx.openGroup('beam', this.getAttribute('id'));
2114
+ this.drawStems(ctx);
2118
2115
  this.drawBeamLines(ctx);
2119
2116
  ctx.closeGroup();
2120
- this.restoreStyle();
2121
2117
  }
2122
2118
  }
2123
2119
 
@@ -2135,19 +2131,21 @@ __webpack_require__.r(__webpack_exports__);
2135
2131
  /* harmony export */ Bend: () => (/* binding */ Bend)
2136
2132
  /* harmony export */ });
2137
2133
  /* harmony import */ var _element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./element */ "./src/element.ts");
2138
- /* harmony import */ var _modifier__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./modifier */ "./src/modifier.ts");
2139
- /* harmony import */ var _typeguard__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./typeguard */ "./src/typeguard.ts");
2140
- /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./util */ "./src/util.ts");
2134
+ /* harmony import */ var _metrics__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./metrics */ "./src/metrics.ts");
2135
+ /* harmony import */ var _modifier__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./modifier */ "./src/modifier.ts");
2136
+ /* harmony import */ var _typeguard__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./typeguard */ "./src/typeguard.ts");
2137
+ /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./util */ "./src/util.ts");
2141
2138
  // Copyright (c) 2023-present VexFlow contributors: https://github.com/vexflow/vexflow/graphs/contributors
2142
2139
  // MIT License
2143
2140
 
2144
2141
 
2145
2142
 
2146
2143
 
2144
+
2147
2145
  /** Bend implements tablature bends. */
2148
- class Bend extends _modifier__WEBPACK_IMPORTED_MODULE_1__.Modifier {
2146
+ class Bend extends _modifier__WEBPACK_IMPORTED_MODULE_2__.Modifier {
2149
2147
  static get CATEGORY() {
2150
- return _typeguard__WEBPACK_IMPORTED_MODULE_2__.Category.Bend;
2148
+ return _typeguard__WEBPACK_IMPORTED_MODULE_3__.Category.Bend;
2151
2149
  }
2152
2150
  static get UP() {
2153
2151
  return 0;
@@ -2164,7 +2162,7 @@ class Bend extends _modifier__WEBPACK_IMPORTED_MODULE_1__.Modifier {
2164
2162
  for (let i = 0; i < bends.length; ++i) {
2165
2163
  const bend = bends[i];
2166
2164
  const note = bend.checkAttachedNote();
2167
- if ((0,_typeguard__WEBPACK_IMPORTED_MODULE_2__.isTabNote)(note)) {
2165
+ if ((0,_typeguard__WEBPACK_IMPORTED_MODULE_3__.isTabNote)(note)) {
2168
2166
  const stringPos = note.leastString() - 1;
2169
2167
  if (state.topTextLine < stringPos) {
2170
2168
  state.topTextLine = stringPos;
@@ -2178,6 +2176,15 @@ class Bend extends _modifier__WEBPACK_IMPORTED_MODULE_1__.Modifier {
2178
2176
  state.topTextLine += 1;
2179
2177
  return true;
2180
2178
  }
2179
+ /** Set the element style used for rendering the lines. */
2180
+ setStyleLine(style) {
2181
+ this.styleLine = style;
2182
+ return this;
2183
+ }
2184
+ /** Get the element style used for rendering the lines. */
2185
+ getStyleLine() {
2186
+ return this.styleLine;
2187
+ }
2181
2188
  /**
2182
2189
  * Example of a phrase:
2183
2190
  * ```
@@ -2210,13 +2217,13 @@ class Bend extends _modifier__WEBPACK_IMPORTED_MODULE_1__.Modifier {
2210
2217
  */
2211
2218
  constructor(phrase) {
2212
2219
  super();
2220
+ this.styleLine = _metrics__WEBPACK_IMPORTED_MODULE_1__.Metrics.getStyle('Bend.line');
2213
2221
  this.xShift = 0;
2214
2222
  this.tap = '';
2215
2223
  this.renderOptions = {
2216
2224
  bendWidth: 8,
2217
2225
  releaseWidth: 8,
2218
2226
  };
2219
- this.setStyle({ lineWidth: 1.0, strokeStyle: 'black', fillStyle: 'black' });
2220
2227
  this.phrase = phrase;
2221
2228
  this.updateWidth();
2222
2229
  }
@@ -2231,14 +2238,14 @@ class Bend extends _modifier__WEBPACK_IMPORTED_MODULE_1__.Modifier {
2231
2238
  return this;
2232
2239
  }
2233
2240
  getTextHeight() {
2234
- const element = new _element__WEBPACK_IMPORTED_MODULE_0__.Element(_typeguard__WEBPACK_IMPORTED_MODULE_2__.Category.Bend);
2241
+ const element = new _element__WEBPACK_IMPORTED_MODULE_0__.Element(_typeguard__WEBPACK_IMPORTED_MODULE_3__.Category.Bend);
2235
2242
  element.setText(this.phrase[0].text);
2236
2243
  return element.getHeight();
2237
2244
  }
2238
2245
  /** Recalculate width. */
2239
2246
  updateWidth() {
2240
2247
  const measureText = (text) => {
2241
- const element = new _element__WEBPACK_IMPORTED_MODULE_0__.Element(_typeguard__WEBPACK_IMPORTED_MODULE_2__.Category.Bend);
2248
+ const element = new _element__WEBPACK_IMPORTED_MODULE_0__.Element(_typeguard__WEBPACK_IMPORTED_MODULE_3__.Category.Bend);
2242
2249
  element.setText(text);
2243
2250
  return element.getWidth();
2244
2251
  };
@@ -2264,8 +2271,7 @@ class Bend extends _modifier__WEBPACK_IMPORTED_MODULE_1__.Modifier {
2264
2271
  const ctx = this.checkContext();
2265
2272
  const note = this.checkAttachedNote();
2266
2273
  this.setRendered();
2267
- this.applyStyle();
2268
- const start = note.getModifierStartXY(_modifier__WEBPACK_IMPORTED_MODULE_1__.Modifier.Position.RIGHT, this.index);
2274
+ const start = note.getModifierStartXY(_modifier__WEBPACK_IMPORTED_MODULE_2__.Modifier.Position.RIGHT, this.index);
2269
2275
  start.x += 3;
2270
2276
  start.y += 0.5;
2271
2277
  const xShift = this.xShift;
@@ -2278,12 +2284,14 @@ class Bend extends _modifier__WEBPACK_IMPORTED_MODULE_1__.Modifier {
2278
2284
  const renderBend = (x, y, width, height) => {
2279
2285
  const cpX = x + width;
2280
2286
  const cpY = y;
2287
+ this.applyStyle(ctx, this.styleLine);
2281
2288
  ctx.beginPath();
2282
2289
  ctx.moveTo(x, y);
2283
2290
  ctx.quadraticCurveTo(cpX, cpY, x + width, height);
2284
2291
  ctx.stroke();
2285
2292
  };
2286
2293
  const renderRelease = (x, y, width, height) => {
2294
+ this.applyStyle(ctx, this.styleLine);
2287
2295
  ctx.beginPath();
2288
2296
  ctx.moveTo(x, height);
2289
2297
  ctx.quadraticCurveTo(x + width, height, x + width, y);
@@ -2308,7 +2316,7 @@ class Bend extends _modifier__WEBPACK_IMPORTED_MODULE_1__.Modifier {
2308
2316
  let lastBendDrawWidth = 0;
2309
2317
  let lastDrawnWidth = 0;
2310
2318
  if ((_a = this.tap) === null || _a === void 0 ? void 0 : _a.length) {
2311
- const tapStart = note.getModifierStartXY(_modifier__WEBPACK_IMPORTED_MODULE_1__.Modifier.Position.CENTER, this.index);
2319
+ const tapStart = note.getModifierStartXY(_modifier__WEBPACK_IMPORTED_MODULE_2__.Modifier.Position.CENTER, this.index);
2312
2320
  renderText(tapStart.x, this.tap);
2313
2321
  }
2314
2322
  for (let i = 0; i < this.phrase.length; ++i) {
@@ -2344,7 +2352,7 @@ class Bend extends _modifier__WEBPACK_IMPORTED_MODULE_1__.Modifier {
2344
2352
  start.x += lastDrawnWidth;
2345
2353
  }
2346
2354
  if (!lastBend || lastBend.x === undefined) {
2347
- throw new _util__WEBPACK_IMPORTED_MODULE_3__.RuntimeError('NoLastBendForBend', 'Internal error.');
2355
+ throw new _util__WEBPACK_IMPORTED_MODULE_4__.RuntimeError('NoLastBendForBend', 'Internal error.');
2348
2356
  }
2349
2357
  // Final arrowhead and text
2350
2358
  if (lastBend.type === Bend.UP) {
@@ -2353,7 +2361,6 @@ class Bend extends _modifier__WEBPACK_IMPORTED_MODULE_1__.Modifier {
2353
2361
  else if (lastBend.type === Bend.DOWN) {
2354
2362
  renderArrowHead(lastBend.x + lastDrawnWidth, start.y, -1);
2355
2363
  }
2356
- this.restoreStyle();
2357
2364
  }
2358
2365
  }
2359
2366
 
@@ -3032,9 +3039,6 @@ class ChordSymbol extends _modifier__WEBPACK_IMPORTED_MODULE_4__.Modifier {
3032
3039
  const ctx = this.checkContext();
3033
3040
  const note = this.checkAttachedNote();
3034
3041
  this.setRendered();
3035
- // We're changing context parameters. Save current state.
3036
- ctx.save();
3037
- this.applyStyle();
3038
3042
  ctx.openGroup('chordsymbol', this.getAttribute('id'));
3039
3043
  const start = note.getModifierStartXY(_modifier__WEBPACK_IMPORTED_MODULE_4__.Modifier.Position.ABOVE, this.index);
3040
3044
  ctx.setFont(this.fontInfo);
@@ -3085,8 +3089,6 @@ class ChordSymbol extends _modifier__WEBPACK_IMPORTED_MODULE_4__.Modifier {
3085
3089
  symbol.renderText(ctx, 0, 0);
3086
3090
  });
3087
3091
  ctx.closeGroup();
3088
- this.restoreStyle();
3089
- ctx.restore();
3090
3092
  }
3091
3093
  // Get the `BoundingBox` for the entire chord
3092
3094
  getBoundingBox() {
@@ -3292,12 +3294,10 @@ class Clef extends _stavemodifier__WEBPACK_IMPORTED_MODULE_2__.StaveModifier {
3292
3294
  const stave = this.checkStave();
3293
3295
  const ctx = stave.checkContext();
3294
3296
  this.setRendered();
3295
- this.applyStyle(ctx);
3296
3297
  ctx.openGroup('clef', this.getAttribute('id'));
3297
3298
  this.y = stave.getYForLine(this.line);
3298
3299
  this.renderText(ctx, 0, 0);
3299
3300
  ctx.closeGroup();
3300
- this.restoreStyle(ctx);
3301
3301
  }
3302
3302
  }
3303
3303
  /** To enable logging for this class, set `VexFlow.Clef.DEBUG` to `true`. */
@@ -3535,9 +3535,8 @@ class Curve extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
3535
3535
  this.renderOptions = Object.assign({ thickness: 2, xShift: 0, yShift: 10, position: CurvePosition.NEAR_HEAD, positionEnd: CurvePosition.NEAR_HEAD, invert: false, cps: [
3536
3536
  { x: 0, y: 10 },
3537
3537
  { x: 0, y: 10 },
3538
- ] }, options);
3539
- this.from = from;
3540
- this.to = to;
3538
+ ], openingDirection: 'auto' }, options);
3539
+ this.setNotes(from, to);
3541
3540
  }
3542
3541
  setNotes(from, to) {
3543
3542
  if (!from && !to) {
@@ -3556,7 +3555,6 @@ class Curve extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
3556
3555
  renderCurve(params) {
3557
3556
  var _a, _b;
3558
3557
  const ctx = this.checkContext();
3559
- this.applyStyle();
3560
3558
  const xShift = this.renderOptions.xShift;
3561
3559
  const yShift = this.renderOptions.yShift * params.direction;
3562
3560
  const firstX = params.firstX + xShift;
@@ -3577,7 +3575,6 @@ class Curve extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
3577
3575
  ctx.closePath();
3578
3576
  if (!((_b = this.style) === null || _b === void 0 ? void 0 : _b.lineDash))
3579
3577
  ctx.fill();
3580
- this.restoreStyle();
3581
3578
  }
3582
3579
  draw() {
3583
3580
  this.checkContext();
@@ -3626,6 +3623,12 @@ class Curve extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
3626
3623
  lastX = stave.getTieEndX();
3627
3624
  lastY = firstNote.getStemExtents()[endMetric];
3628
3625
  }
3626
+ if (this.renderOptions.openingDirection === 'up') {
3627
+ stemDirection = 1;
3628
+ }
3629
+ if (this.renderOptions.openingDirection === 'down') {
3630
+ stemDirection = -1;
3631
+ }
3629
3632
  this.renderCurve({
3630
3633
  firstX,
3631
3634
  lastX,
@@ -3877,7 +3880,6 @@ class EasyScoreGrammar {
3877
3880
  CHORD() {
3878
3881
  return {
3879
3882
  expect: [this.LPAREN, this.NOTES, this.RPAREN],
3880
- // eslint-disable-next-line
3881
3883
  run: (state) => this.builder.addChord(state.matches[1]),
3882
3884
  };
3883
3885
  }
@@ -3896,7 +3898,6 @@ class EasyScoreGrammar {
3896
3898
  return {
3897
3899
  expect: [this.NOTENAME, this.ACCIDENTAL, this.OCTAVE],
3898
3900
  run: (state) => {
3899
- // eslint-disable-next-line
3900
3901
  const s = state;
3901
3902
  this.builder.addSingleNote(s.matches[0], s.matches[1], s.matches[2]);
3902
3903
  },
@@ -3913,7 +3914,6 @@ class EasyScoreGrammar {
3913
3914
  return {
3914
3915
  expect: [this.DOT],
3915
3916
  zeroOrMore: true,
3916
- // eslint-disable-next-line
3917
3917
  run: (state) => this.builder.setNoteDots(state.matches),
3918
3918
  };
3919
3919
  }
@@ -3921,7 +3921,6 @@ class EasyScoreGrammar {
3921
3921
  return {
3922
3922
  expect: [this.SLASH, this.MAYBESLASH, this.TYPES],
3923
3923
  maybe: true,
3924
- // eslint-disable-next-line
3925
3924
  run: (state) => this.builder.setNoteType(state.matches[2]),
3926
3925
  };
3927
3926
  }
@@ -3929,7 +3928,6 @@ class EasyScoreGrammar {
3929
3928
  return {
3930
3929
  expect: [this.SLASH, this.DURATIONS],
3931
3930
  maybe: true,
3932
- // eslint-disable-next-line
3933
3931
  run: (state) => this.builder.setNoteDuration(state.matches[1]),
3934
3932
  };
3935
3933
  }
@@ -3949,7 +3947,6 @@ class EasyScoreGrammar {
3949
3947
  const unquote = (str) => str.slice(1, -1);
3950
3948
  return {
3951
3949
  expect: [this.KEY, this.EQUALS, this.VAL],
3952
- // eslint-disable-next-line
3953
3950
  run: (state) => this.builder.addNoteOption(state.matches[0], unquote(state.matches[2])),
3954
3951
  };
3955
3952
  }
@@ -4194,7 +4191,6 @@ class EasyScore {
4194
4191
  */
4195
4192
  setOptions(options) {
4196
4193
  var _a, _b;
4197
- // eslint-disable-next-line
4198
4194
  const factory = options.factory; // ! operator, because options.factory was set in Factory.EasyScore().
4199
4195
  const builder = (_a = options.builder) !== null && _a !== void 0 ? _a : new Builder(factory);
4200
4196
  this.options = Object.assign(Object.assign({ commitHooks: [setId, setClass, _articulation__WEBPACK_IMPORTED_MODULE_0__.Articulation.easyScoreHook, _frethandfinger__WEBPACK_IMPORTED_MODULE_2__.FretHandFinger.easyScoreHook], throwOnError: false }, options), { factory,
@@ -4312,9 +4308,8 @@ class Element {
4312
4308
  }
4313
4309
  constructor(category) {
4314
4310
  var _a;
4315
- // Element objects keep a list of children that they are responsible for.
4316
- // Children inherit the style from their parents (see: setGroupStyle(s)).
4317
4311
  this.children = [];
4312
+ this.style = {};
4318
4313
  this._text = '';
4319
4314
  this.metricsValid = false;
4320
4315
  this._textMetrics = {
@@ -4344,12 +4339,13 @@ class Element {
4344
4339
  };
4345
4340
  this.rendered = false;
4346
4341
  this._fontInfo = _metrics__WEBPACK_IMPORTED_MODULE_2__.Metrics.getFontInfo(this.attrs.type);
4342
+ this.style = _metrics__WEBPACK_IMPORTED_MODULE_2__.Metrics.getStyle(this.attrs.type);
4347
4343
  this.fontScale = _metrics__WEBPACK_IMPORTED_MODULE_2__.Metrics.get(`${this.attrs.type}.fontScale`);
4348
4344
  // If a default registry exist, then register with it right away.
4349
4345
  (_a = _registry__WEBPACK_IMPORTED_MODULE_3__.Registry.getDefaultRegistry()) === null || _a === void 0 ? void 0 : _a.register(this);
4350
4346
  }
4351
4347
  /**
4352
- * Adds a child Element to the Element, which lets it inherit the
4348
+ * Adds a child to the Element, which lets it inherit the
4353
4349
  * same style as the parent when setGroupStyle() is called.
4354
4350
  *
4355
4351
  * Examples of children are noteheads and stems. Modifiers such
@@ -4357,7 +4353,10 @@ class Element {
4357
4353
  *
4358
4354
  * Note that StaveNote calls setGroupStyle() when setStyle() is called.
4359
4355
  */
4360
- addChildElement(child) {
4356
+ addChild(child) {
4357
+ if (child.parent)
4358
+ throw new _util__WEBPACK_IMPORTED_MODULE_5__.RuntimeError('Element', 'Parent already defined');
4359
+ child.parent = this;
4361
4360
  this.children.push(child);
4362
4361
  return this;
4363
4362
  }
@@ -4370,7 +4369,7 @@ class Element {
4370
4369
  * Example:
4371
4370
  * ```typescript
4372
4371
  * element.setStyle({ fillStyle: 'red', strokeStyle: 'red' });
4373
- * element.draw();
4372
+ * element.drawWithStyle();
4374
4373
  * ```
4375
4374
  * Note: If the element draws additional sub-elements (i.e.: Modifiers in a Stave),
4376
4375
  * the style can be applied to all of them by means of the context:
@@ -4378,7 +4377,7 @@ class Element {
4378
4377
  * element.setStyle({ fillStyle: 'red', strokeStyle: 'red' });
4379
4378
  * element.getContext().setFillStyle('red');
4380
4379
  * element.getContext().setStrokeStyle('red');
4381
- * element.draw();
4380
+ * element.drawWithStyle();
4382
4381
  * ```
4383
4382
  * or using drawWithStyle:
4384
4383
  * ```typescript
@@ -4402,11 +4401,8 @@ class Element {
4402
4401
  }
4403
4402
  /** Apply the element style to `context`. */
4404
4403
  applyStyle(context = this.context, style = this.getStyle()) {
4405
- if (!style)
4406
- return this;
4407
4404
  if (!context)
4408
4405
  return this;
4409
- context.save();
4410
4406
  if (style.shadowColor)
4411
4407
  context.setShadowColor(style.shadowColor);
4412
4408
  if (style.shadowBlur)
@@ -4421,24 +4417,17 @@ class Element {
4421
4417
  context.setLineDash(style.lineDash.split(' ').map(Number));
4422
4418
  return this;
4423
4419
  }
4424
- /** Restore the style of `context`. */
4425
- restoreStyle(context = this.context, style = this.getStyle()) {
4426
- if (!style)
4427
- return this;
4428
- if (!context)
4429
- return this;
4430
- context.restore();
4431
- return this;
4432
- }
4433
4420
  /**
4434
4421
  * Draw the element and all its sub-elements (i.e.: Modifiers in a Stave)
4435
4422
  * with the element's style (see `getStyle()` and `setStyle()`)
4436
4423
  */
4437
4424
  drawWithStyle() {
4438
- this.checkContext();
4439
- this.applyStyle();
4425
+ const ctx = this.checkContext();
4426
+ ctx.save();
4427
+ this.applyStyle(ctx);
4440
4428
  this.draw();
4441
- this.restoreStyle();
4429
+ ctx.restore();
4430
+ return this;
4442
4431
  }
4443
4432
  /** Draw an element. */
4444
4433
  draw() {
@@ -4744,7 +4733,6 @@ class Element {
4744
4733
  }
4745
4734
  /** Render the element text. */
4746
4735
  renderText(ctx, xPos, yPos) {
4747
- ctx.save();
4748
4736
  ctx.setFont(this._fontInfo);
4749
4737
  ctx.fillText(this._text, xPos + this.x + this.xShift, yPos + this.y + this.yShift);
4750
4738
  this.children.forEach((child) => {
@@ -4752,7 +4740,6 @@ class Element {
4752
4740
  ctx.setFont(child.fontInfo);
4753
4741
  ctx.fillText(child.text, xPos + child.x + child.xShift, yPos + child.y + child.yShift);
4754
4742
  });
4755
- ctx.restore();
4756
4743
  }
4757
4744
  /** Measure the text using the textFont. */
4758
4745
  measureText() {
@@ -5376,13 +5363,13 @@ class Factory {
5376
5363
  draw() {
5377
5364
  const ctx = this.context;
5378
5365
  this.systems.forEach((s) => s.setContext(ctx).format());
5379
- this.staves.forEach((s) => s.setContext(ctx).draw());
5380
- this.voices.forEach((v) => v.setContext(ctx).draw());
5366
+ this.staves.forEach((s) => s.setContext(ctx).drawWithStyle());
5367
+ this.voices.forEach((v) => v.setContext(ctx).drawWithStyle());
5381
5368
  this.renderQ.forEach((e) => {
5382
5369
  if (!e.isRendered())
5383
- e.setContext(ctx).draw();
5370
+ e.setContext(ctx).drawWithStyle();
5384
5371
  });
5385
- this.systems.forEach((s) => s.setContext(ctx).draw());
5372
+ this.systems.forEach((s) => s.setContext(ctx).drawWithStyle());
5386
5373
  this.reset();
5387
5374
  }
5388
5375
  }
@@ -5390,6 +5377,53 @@ class Factory {
5390
5377
  Factory.DEBUG = false;
5391
5378
 
5392
5379
 
5380
+ /***/ }),
5381
+
5382
+ /***/ "./src/flag.ts":
5383
+ /*!*********************!*\
5384
+ !*** ./src/flag.ts ***!
5385
+ \*********************/
5386
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
5387
+
5388
+ __webpack_require__.r(__webpack_exports__);
5389
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5390
+ /* harmony export */ Flag: () => (/* binding */ Flag)
5391
+ /* harmony export */ });
5392
+ /* harmony import */ var _element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./element */ "./src/element.ts");
5393
+ /* harmony import */ var _typeguard__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./typeguard */ "./src/typeguard.ts");
5394
+ /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./util */ "./src/util.ts");
5395
+ // Copyright (c) 2023-present VexFlow contributors: https://github.com/vexflow/vexflow/graphs/contributors
5396
+ // MIT License
5397
+
5398
+
5399
+
5400
+ // eslint-disable-next-line
5401
+ function L(...args) {
5402
+ if (Flag.DEBUG)
5403
+ (0,_util__WEBPACK_IMPORTED_MODULE_2__.log)('VexFlow.Flag', args);
5404
+ }
5405
+ /**
5406
+ * `Flags` are typically not manipulated
5407
+ * directly, but used internally in `StaveNote`.
5408
+ */
5409
+ class Flag extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
5410
+ static get CATEGORY() {
5411
+ return _typeguard__WEBPACK_IMPORTED_MODULE_1__.Category.Flag;
5412
+ }
5413
+ /** Draw the notehead. */
5414
+ draw() {
5415
+ const ctx = this.checkContext();
5416
+ this.setRendered();
5417
+ ctx.openGroup('flag', this.getAttribute('id'));
5418
+ L("Drawing flag '", this.text, "' at", this.x, this.y);
5419
+ this.renderText(ctx, 0, 0);
5420
+ ctx.closeGroup();
5421
+ }
5422
+ }
5423
+ /** To enable logging for this class. Set `VexFlow.NoteHead.DEBUG` to `true`. */
5424
+ Flag.DEBUG = false;
5425
+
5426
+
5393
5427
  /***/ }),
5394
5428
 
5395
5429
  /***/ "./src/font.ts":
@@ -6019,8 +6053,8 @@ class Formatter {
6019
6053
  .joinVoices([voice]) // , { alignRests: options.alignRests })
6020
6054
  .formatToStave([voice], stave, { alignRests: options.alignRests, stave });
6021
6055
  // Render the voice and beams to the stave.
6022
- voice.setStave(stave).draw(ctx, stave);
6023
- beams.forEach((beam) => beam.setContext(ctx).draw());
6056
+ voice.setContext(ctx).setStave(stave).drawWithStyle();
6057
+ beams.forEach((beam) => beam.setContext(ctx).drawWithStyle());
6024
6058
  // Return the bounding box of the voice.
6025
6059
  return voice.getBoundingBox();
6026
6060
  }
@@ -6062,9 +6096,9 @@ class Formatter {
6062
6096
  // Render voices and beams to staves.
6063
6097
  notevoice.draw(ctx, stave);
6064
6098
  tabvoice.draw(ctx, tabstave);
6065
- beams.forEach((beam) => beam.setContext(ctx).draw());
6099
+ beams.forEach((beam) => beam.setContext(ctx).drawWithStyle());
6066
6100
  // Draw a connector between tab and note staves.
6067
- new _staveconnector__WEBPACK_IMPORTED_MODULE_5__.StaveConnector(stave, tabstave).setContext(ctx).draw();
6101
+ new _staveconnector__WEBPACK_IMPORTED_MODULE_5__.StaveConnector(stave, tabstave).setContext(ctx).drawWithStyle();
6068
6102
  }
6069
6103
  /**
6070
6104
  * Automatically set the vertical position of rests based on previous/next note positions.
@@ -6184,7 +6218,6 @@ class Formatter {
6184
6218
  throw new _util__WEBPACK_IMPORTED_MODULE_9__.RuntimeError('BadArgument', "'voices' required to run preCalculateMinTotalWidth");
6185
6219
  }
6186
6220
  this.createTickContexts(voices);
6187
- // eslint-disable-next-line
6188
6221
  const { list: contextList, map: contextMap } = this.tickContexts;
6189
6222
  this.minTotalWidth = 0;
6190
6223
  // Go through each tick context and calculate total width,
@@ -6272,11 +6305,9 @@ class Formatter {
6272
6305
  if (!(staveTickToContextMap ? staveTickToContextMap[integerTicks] : undefined)) {
6273
6306
  const newContext = new _modifiercontext__WEBPACK_IMPORTED_MODULE_3__.ModifierContext();
6274
6307
  contexts.push(newContext);
6275
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
6276
6308
  staveTickToContextMap[integerTicks] = newContext;
6277
6309
  }
6278
6310
  // Add this tickable to the TickContext.
6279
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
6280
6311
  tickable.addToModifierContext(staveTickToContextMap[integerTicks]);
6281
6312
  ticksUsed.add(tickable.getTicks());
6282
6313
  });
@@ -6690,7 +6721,6 @@ class Formatter {
6690
6721
  // This method is just like `format` except that the `justifyWidth` is inferred from the `stave`.
6691
6722
  formatToStave(voices, stave, optionsParam) {
6692
6723
  const options = Object.assign({ context: stave.getContext() }, optionsParam);
6693
- // eslint-disable-next-line
6694
6724
  const justifyWidth = stave.getNoteEndX() - stave.getNoteStartX() - _stave__WEBPACK_IMPORTED_MODULE_4__.Stave.defaultPadding;
6695
6725
  L('Formatting voices to width: ', justifyWidth);
6696
6726
  return this.format(voices, justifyWidth, options);
@@ -7234,14 +7264,12 @@ class GlyphNote extends _note__WEBPACK_IMPORTED_MODULE_0__.Note {
7234
7264
  const stave = this.checkStave();
7235
7265
  const ctx = stave.checkContext();
7236
7266
  this.setRendered();
7237
- this.applyStyle(ctx);
7238
7267
  ctx.openGroup('glyphNote', this.getAttribute('id'));
7239
7268
  this.x = this.isCenterAligned() ? this.getAbsoluteX() - this.getWidth() / 2 : this.getAbsoluteX();
7240
7269
  this.y = stave.getYForLine(this.options.line);
7241
7270
  this.renderText(ctx, 0, 0);
7242
7271
  this.drawModifiers();
7243
7272
  ctx.closeGroup();
7244
- this.restoreStyle(ctx);
7245
7273
  }
7246
7274
  }
7247
7275
 
@@ -13229,14 +13257,12 @@ class GraceNote extends _stavenote__WEBPACK_IMPORTED_MODULE_0__.StaveNote {
13229
13257
  }
13230
13258
  // FIXME: avoid staff lines, ledger lines or others.
13231
13259
  const ctx = this.checkContext();
13232
- ctx.save();
13233
13260
  ctx.setLineWidth(1 * scale); // FIXME: use more appropriate value.
13234
13261
  ctx.beginPath();
13235
13262
  ctx.moveTo(slashBBox.x1, slashBBox.y1);
13236
13263
  ctx.lineTo(slashBBox.x2, slashBBox.y2);
13237
13264
  ctx.closePath();
13238
13265
  ctx.stroke();
13239
- ctx.restore();
13240
13266
  }
13241
13267
  }
13242
13268
  calcBeamedNotesSlashBBox(slashStemOffset, slashBeamOffset, protrusions) {
@@ -13329,7 +13355,7 @@ class GraceNoteGroup extends _modifier__WEBPACK_IMPORTED_MODULE_2__.Modifier {
13329
13355
  return false;
13330
13356
  const groupList = [];
13331
13357
  let prevNote = null;
13332
- let shiftL = 0;
13358
+ let shift = 0;
13333
13359
  for (let i = 0; i < gracenoteGroups.length; ++i) {
13334
13360
  const gracenoteGroup = gracenoteGroups[i];
13335
13361
  const note = gracenoteGroup.getNote();
@@ -13338,17 +13364,23 @@ class GraceNoteGroup extends _modifier__WEBPACK_IMPORTED_MODULE_2__.Modifier {
13338
13364
  if (isStavenote && note !== prevNote) {
13339
13365
  // Iterate through all notes to get the displaced pixels
13340
13366
  for (let n = 0; n < note.keys.length; ++n) {
13341
- shiftL = Math.max(note.getLeftDisplacedHeadPx(), shiftL);
13367
+ shift = Math.max(note.getLeftDisplacedHeadPx(), shift);
13342
13368
  }
13343
13369
  prevNote = note;
13344
13370
  }
13345
- groupList.push({ shift: shiftL, gracenoteGroup, spacing });
13371
+ groupList.push({ shift: shift, gracenoteGroup, spacing });
13346
13372
  }
13347
13373
  // If first note left shift in case it is displaced
13348
13374
  let groupShift = groupList[0].shift;
13349
13375
  let formatWidth;
13376
+ let right = false;
13377
+ let left = false;
13350
13378
  for (let i = 0; i < groupList.length; ++i) {
13351
13379
  const gracenoteGroup = groupList[i].gracenoteGroup;
13380
+ if (gracenoteGroup.position === _modifier__WEBPACK_IMPORTED_MODULE_2__.Modifier.Position.RIGHT)
13381
+ right = true;
13382
+ else
13383
+ left = true;
13352
13384
  gracenoteGroup.preFormat();
13353
13385
  formatWidth = gracenoteGroup.getWidth() + groupList[i].spacing;
13354
13386
  groupShift = Math.max(formatWidth, groupShift);
@@ -13358,7 +13390,10 @@ class GraceNoteGroup extends _modifier__WEBPACK_IMPORTED_MODULE_2__.Modifier {
13358
13390
  formatWidth = gracenoteGroup.getWidth() + groupList[i].spacing;
13359
13391
  gracenoteGroup.setSpacingFromNextModifier(groupShift - Math.min(formatWidth, groupShift) + _stavenote__WEBPACK_IMPORTED_MODULE_3__.StaveNote.minNoteheadPadding);
13360
13392
  }
13361
- state.leftShift += groupShift;
13393
+ if (right)
13394
+ state.rightShift += groupShift;
13395
+ if (left)
13396
+ state.leftShift += groupShift;
13362
13397
  return true;
13363
13398
  }
13364
13399
  //** `GraceNoteGroup` inherits from `Modifier` and is placed inside a `ModifierContext`. */
@@ -13417,11 +13452,11 @@ class GraceNoteGroup extends _modifier__WEBPACK_IMPORTED_MODULE_2__.Modifier {
13417
13452
  const note = this.checkAttachedNote();
13418
13453
  this.setRendered();
13419
13454
  L('Drawing grace note group for:', note);
13420
- this.alignSubNotesWithNote(this.getGraceNotes(), note); // Modifier function
13455
+ this.alignSubNotesWithNote(this.getGraceNotes(), note, this.position); // Modifier function
13421
13456
  // Draw grace notes.
13422
- this.graceNotes.forEach((graceNote) => graceNote.setContext(ctx).draw());
13457
+ this.graceNotes.forEach((graceNote) => graceNote.setContext(ctx).drawWithStyle());
13423
13458
  // Draw beams.
13424
- this.beams.forEach((beam) => beam.setContext(ctx).draw());
13459
+ this.beams.forEach((beam) => beam.setContext(ctx).drawWithStyle());
13425
13460
  if (this.showSlur) {
13426
13461
  // Create and draw slur.
13427
13462
  const isStavenote = (0,_typeguard__WEBPACK_IMPORTED_MODULE_7__.isStaveNote)(note);
@@ -13434,7 +13469,7 @@ class GraceNoteGroup extends _modifier__WEBPACK_IMPORTED_MODULE_2__.Modifier {
13434
13469
  });
13435
13470
  this.slur.renderOptions.cp2 = 12;
13436
13471
  this.slur.renderOptions.yShift = (isStavenote ? 7 : 5) + this.renderOptions.slurYShift;
13437
- this.slur.setContext(ctx).draw();
13472
+ this.slur.setContext(ctx).drawWithStyle();
13438
13473
  }
13439
13474
  }
13440
13475
  }
@@ -13499,14 +13534,14 @@ __webpack_require__.r(__webpack_exports__);
13499
13534
  /* harmony export */ BEAM_LEFT: () => (/* reexport safe */ _beam__WEBPACK_IMPORTED_MODULE_4__.BEAM_LEFT),
13500
13535
  /* harmony export */ BEAM_RIGHT: () => (/* reexport safe */ _beam__WEBPACK_IMPORTED_MODULE_4__.BEAM_RIGHT),
13501
13536
  /* harmony export */ BarNote: () => (/* reexport safe */ _barnote__WEBPACK_IMPORTED_MODULE_3__.BarNote),
13502
- /* harmony export */ Barline: () => (/* reexport safe */ _stavebarline__WEBPACK_IMPORTED_MODULE_45__.Barline),
13503
- /* harmony export */ BarlineType: () => (/* reexport safe */ _stavebarline__WEBPACK_IMPORTED_MODULE_45__.BarlineType),
13537
+ /* harmony export */ Barline: () => (/* reexport safe */ _stavebarline__WEBPACK_IMPORTED_MODULE_47__.Barline),
13538
+ /* harmony export */ BarlineType: () => (/* reexport safe */ _stavebarline__WEBPACK_IMPORTED_MODULE_47__.BarlineType),
13504
13539
  /* harmony export */ Beam: () => (/* reexport safe */ _beam__WEBPACK_IMPORTED_MODULE_4__.Beam),
13505
13540
  /* harmony export */ Bend: () => (/* reexport safe */ _bend__WEBPACK_IMPORTED_MODULE_5__.Bend),
13506
13541
  /* harmony export */ BoundingBox: () => (/* reexport safe */ _boundingbox__WEBPACK_IMPORTED_MODULE_6__.BoundingBox),
13507
13542
  /* harmony export */ Builder: () => (/* reexport safe */ _easyscore__WEBPACK_IMPORTED_MODULE_14__.Builder),
13508
13543
  /* harmony export */ CanvasContext: () => (/* reexport safe */ _canvascontext__WEBPACK_IMPORTED_MODULE_7__.CanvasContext),
13509
- /* harmony export */ Category: () => (/* reexport safe */ _typeguard__WEBPACK_IMPORTED_MODULE_77__.Category),
13544
+ /* harmony export */ Category: () => (/* reexport safe */ _typeguard__WEBPACK_IMPORTED_MODULE_79__.Category),
13510
13545
  /* harmony export */ ChordSymbol: () => (/* reexport safe */ _chordsymbol__WEBPACK_IMPORTED_MODULE_8__.ChordSymbol),
13511
13546
  /* harmony export */ ChordSymbolBlock: () => (/* reexport safe */ _chordsymbol__WEBPACK_IMPORTED_MODULE_8__.ChordSymbolBlock),
13512
13547
  /* harmony export */ ChordSymbolHorizontalJustify: () => (/* reexport safe */ _chordsymbol__WEBPACK_IMPORTED_MODULE_8__.ChordSymbolHorizontalJustify),
@@ -13521,110 +13556,113 @@ __webpack_require__.r(__webpack_exports__);
13521
13556
  /* harmony export */ EasyScoreGrammar: () => (/* reexport safe */ _easyscore__WEBPACK_IMPORTED_MODULE_14__.EasyScoreGrammar),
13522
13557
  /* harmony export */ Element: () => (/* reexport safe */ _element__WEBPACK_IMPORTED_MODULE_15__.Element),
13523
13558
  /* harmony export */ Factory: () => (/* reexport safe */ _factory__WEBPACK_IMPORTED_MODULE_16__.Factory),
13559
+ /* harmony export */ Flag: () => (/* reexport safe */ _flag__WEBPACK_IMPORTED_MODULE_18__.Flag),
13524
13560
  /* harmony export */ Font: () => (/* reexport safe */ _font__WEBPACK_IMPORTED_MODULE_17__.Font),
13525
13561
  /* harmony export */ FontStyle: () => (/* reexport safe */ _font__WEBPACK_IMPORTED_MODULE_17__.FontStyle),
13526
13562
  /* harmony export */ FontWeight: () => (/* reexport safe */ _font__WEBPACK_IMPORTED_MODULE_17__.FontWeight),
13527
- /* harmony export */ Formatter: () => (/* reexport safe */ _formatter__WEBPACK_IMPORTED_MODULE_18__.Formatter),
13528
- /* harmony export */ Fraction: () => (/* reexport safe */ _fraction__WEBPACK_IMPORTED_MODULE_19__.Fraction),
13529
- /* harmony export */ FretHandFinger: () => (/* reexport safe */ _frethandfinger__WEBPACK_IMPORTED_MODULE_20__.FretHandFinger),
13530
- /* harmony export */ GhostNote: () => (/* reexport safe */ _ghostnote__WEBPACK_IMPORTED_MODULE_21__.GhostNote),
13531
- /* harmony export */ GlyphNote: () => (/* reexport safe */ _glyphnote__WEBPACK_IMPORTED_MODULE_22__.GlyphNote),
13532
- /* harmony export */ GraceNote: () => (/* reexport safe */ _gracenote__WEBPACK_IMPORTED_MODULE_23__.GraceNote),
13533
- /* harmony export */ GraceNoteGroup: () => (/* reexport safe */ _gracenotegroup__WEBPACK_IMPORTED_MODULE_24__.GraceNoteGroup),
13534
- /* harmony export */ GraceTabNote: () => (/* reexport safe */ _gracetabnote__WEBPACK_IMPORTED_MODULE_25__.GraceTabNote),
13535
- /* harmony export */ KeyManager: () => (/* reexport safe */ _keymanager__WEBPACK_IMPORTED_MODULE_26__.KeyManager),
13536
- /* harmony export */ KeySigNote: () => (/* reexport safe */ _keysignote__WEBPACK_IMPORTED_MODULE_28__.KeySigNote),
13537
- /* harmony export */ KeySignature: () => (/* reexport safe */ _keysignature__WEBPACK_IMPORTED_MODULE_27__.KeySignature),
13538
- /* harmony export */ Modifier: () => (/* reexport safe */ _modifier__WEBPACK_IMPORTED_MODULE_29__.Modifier),
13539
- /* harmony export */ ModifierContext: () => (/* reexport safe */ _modifiercontext__WEBPACK_IMPORTED_MODULE_30__.ModifierContext),
13540
- /* harmony export */ ModifierPosition: () => (/* reexport safe */ _modifier__WEBPACK_IMPORTED_MODULE_29__.ModifierPosition),
13541
- /* harmony export */ MultiMeasureRest: () => (/* reexport safe */ _multimeasurerest__WEBPACK_IMPORTED_MODULE_31__.MultiMeasureRest),
13542
- /* harmony export */ Music: () => (/* reexport safe */ _music__WEBPACK_IMPORTED_MODULE_32__.Music),
13543
- /* harmony export */ Note: () => (/* reexport safe */ _note__WEBPACK_IMPORTED_MODULE_33__.Note),
13544
- /* harmony export */ NoteHead: () => (/* reexport safe */ _notehead__WEBPACK_IMPORTED_MODULE_34__.NoteHead),
13545
- /* harmony export */ NoteSubGroup: () => (/* reexport safe */ _notesubgroup__WEBPACK_IMPORTED_MODULE_35__.NoteSubGroup),
13546
- /* harmony export */ Ornament: () => (/* reexport safe */ _ornament__WEBPACK_IMPORTED_MODULE_36__.Ornament),
13547
- /* harmony export */ Parenthesis: () => (/* reexport safe */ _parenthesis__WEBPACK_IMPORTED_MODULE_37__.Parenthesis),
13548
- /* harmony export */ Parser: () => (/* reexport safe */ _parser__WEBPACK_IMPORTED_MODULE_38__.Parser),
13549
- /* harmony export */ PedalMarking: () => (/* reexport safe */ _pedalmarking__WEBPACK_IMPORTED_MODULE_39__.PedalMarking),
13563
+ /* harmony export */ Formatter: () => (/* reexport safe */ _formatter__WEBPACK_IMPORTED_MODULE_19__.Formatter),
13564
+ /* harmony export */ Fraction: () => (/* reexport safe */ _fraction__WEBPACK_IMPORTED_MODULE_20__.Fraction),
13565
+ /* harmony export */ FretHandFinger: () => (/* reexport safe */ _frethandfinger__WEBPACK_IMPORTED_MODULE_21__.FretHandFinger),
13566
+ /* harmony export */ GhostNote: () => (/* reexport safe */ _ghostnote__WEBPACK_IMPORTED_MODULE_22__.GhostNote),
13567
+ /* harmony export */ GlyphNote: () => (/* reexport safe */ _glyphnote__WEBPACK_IMPORTED_MODULE_23__.GlyphNote),
13568
+ /* harmony export */ GraceNote: () => (/* reexport safe */ _gracenote__WEBPACK_IMPORTED_MODULE_24__.GraceNote),
13569
+ /* harmony export */ GraceNoteGroup: () => (/* reexport safe */ _gracenotegroup__WEBPACK_IMPORTED_MODULE_25__.GraceNoteGroup),
13570
+ /* harmony export */ GraceTabNote: () => (/* reexport safe */ _gracetabnote__WEBPACK_IMPORTED_MODULE_26__.GraceTabNote),
13571
+ /* harmony export */ KeyManager: () => (/* reexport safe */ _keymanager__WEBPACK_IMPORTED_MODULE_27__.KeyManager),
13572
+ /* harmony export */ KeySigNote: () => (/* reexport safe */ _keysignote__WEBPACK_IMPORTED_MODULE_29__.KeySigNote),
13573
+ /* harmony export */ KeySignature: () => (/* reexport safe */ _keysignature__WEBPACK_IMPORTED_MODULE_28__.KeySignature),
13574
+ /* harmony export */ Metrics: () => (/* reexport safe */ _metrics__WEBPACK_IMPORTED_MODULE_30__.Metrics),
13575
+ /* harmony export */ MetricsDefaults: () => (/* reexport safe */ _metrics__WEBPACK_IMPORTED_MODULE_30__.MetricsDefaults),
13576
+ /* harmony export */ Modifier: () => (/* reexport safe */ _modifier__WEBPACK_IMPORTED_MODULE_31__.Modifier),
13577
+ /* harmony export */ ModifierContext: () => (/* reexport safe */ _modifiercontext__WEBPACK_IMPORTED_MODULE_32__.ModifierContext),
13578
+ /* harmony export */ ModifierPosition: () => (/* reexport safe */ _modifier__WEBPACK_IMPORTED_MODULE_31__.ModifierPosition),
13579
+ /* harmony export */ MultiMeasureRest: () => (/* reexport safe */ _multimeasurerest__WEBPACK_IMPORTED_MODULE_33__.MultiMeasureRest),
13580
+ /* harmony export */ Music: () => (/* reexport safe */ _music__WEBPACK_IMPORTED_MODULE_34__.Music),
13581
+ /* harmony export */ Note: () => (/* reexport safe */ _note__WEBPACK_IMPORTED_MODULE_35__.Note),
13582
+ /* harmony export */ NoteHead: () => (/* reexport safe */ _notehead__WEBPACK_IMPORTED_MODULE_36__.NoteHead),
13583
+ /* harmony export */ NoteSubGroup: () => (/* reexport safe */ _notesubgroup__WEBPACK_IMPORTED_MODULE_37__.NoteSubGroup),
13584
+ /* harmony export */ Ornament: () => (/* reexport safe */ _ornament__WEBPACK_IMPORTED_MODULE_38__.Ornament),
13585
+ /* harmony export */ Parenthesis: () => (/* reexport safe */ _parenthesis__WEBPACK_IMPORTED_MODULE_39__.Parenthesis),
13586
+ /* harmony export */ Parser: () => (/* reexport safe */ _parser__WEBPACK_IMPORTED_MODULE_40__.Parser),
13587
+ /* harmony export */ PedalMarking: () => (/* reexport safe */ _pedalmarking__WEBPACK_IMPORTED_MODULE_41__.PedalMarking),
13550
13588
  /* harmony export */ Piece: () => (/* reexport safe */ _easyscore__WEBPACK_IMPORTED_MODULE_14__.Piece),
13551
- /* harmony export */ Registry: () => (/* reexport safe */ _registry__WEBPACK_IMPORTED_MODULE_40__.Registry),
13552
- /* harmony export */ RenderContext: () => (/* reexport safe */ _rendercontext__WEBPACK_IMPORTED_MODULE_41__.RenderContext),
13553
- /* harmony export */ Renderer: () => (/* reexport safe */ _renderer__WEBPACK_IMPORTED_MODULE_42__.Renderer),
13554
- /* harmony export */ RendererBackends: () => (/* reexport safe */ _renderer__WEBPACK_IMPORTED_MODULE_42__.RendererBackends),
13555
- /* harmony export */ RendererLineEndType: () => (/* reexport safe */ _renderer__WEBPACK_IMPORTED_MODULE_42__.RendererLineEndType),
13556
- /* harmony export */ RepeatNote: () => (/* reexport safe */ _repeatnote__WEBPACK_IMPORTED_MODULE_43__.RepeatNote),
13557
- /* harmony export */ Repetition: () => (/* reexport safe */ _staverepetition__WEBPACK_IMPORTED_MODULE_51__.Repetition),
13558
- /* harmony export */ RuntimeError: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_78__.RuntimeError),
13559
- /* harmony export */ SVGContext: () => (/* reexport safe */ _svgcontext__WEBPACK_IMPORTED_MODULE_61__.SVGContext),
13560
- /* harmony export */ Stave: () => (/* reexport safe */ _stave__WEBPACK_IMPORTED_MODULE_44__.Stave),
13561
- /* harmony export */ StaveConnector: () => (/* reexport safe */ _staveconnector__WEBPACK_IMPORTED_MODULE_46__.StaveConnector),
13562
- /* harmony export */ StaveHairpin: () => (/* reexport safe */ _stavehairpin__WEBPACK_IMPORTED_MODULE_47__.StaveHairpin),
13563
- /* harmony export */ StaveLine: () => (/* reexport safe */ _staveline__WEBPACK_IMPORTED_MODULE_48__.StaveLine),
13564
- /* harmony export */ StaveModifier: () => (/* reexport safe */ _stavemodifier__WEBPACK_IMPORTED_MODULE_49__.StaveModifier),
13565
- /* harmony export */ StaveModifierPosition: () => (/* reexport safe */ _stavemodifier__WEBPACK_IMPORTED_MODULE_49__.StaveModifierPosition),
13566
- /* harmony export */ StaveNote: () => (/* reexport safe */ _stavenote__WEBPACK_IMPORTED_MODULE_50__.StaveNote),
13567
- /* harmony export */ StaveSection: () => (/* reexport safe */ _stavesection__WEBPACK_IMPORTED_MODULE_52__.StaveSection),
13568
- /* harmony export */ StaveTempo: () => (/* reexport safe */ _stavetempo__WEBPACK_IMPORTED_MODULE_53__.StaveTempo),
13569
- /* harmony export */ StaveText: () => (/* reexport safe */ _stavetext__WEBPACK_IMPORTED_MODULE_54__.StaveText),
13570
- /* harmony export */ StaveTie: () => (/* reexport safe */ _stavetie__WEBPACK_IMPORTED_MODULE_55__.StaveTie),
13571
- /* harmony export */ Stem: () => (/* reexport safe */ _stem__WEBPACK_IMPORTED_MODULE_57__.Stem),
13572
- /* harmony export */ StemmableNote: () => (/* reexport safe */ _stemmablenote__WEBPACK_IMPORTED_MODULE_58__.StemmableNote),
13573
- /* harmony export */ StringNumber: () => (/* reexport safe */ _stringnumber__WEBPACK_IMPORTED_MODULE_59__.StringNumber),
13574
- /* harmony export */ Stroke: () => (/* reexport safe */ _strokes__WEBPACK_IMPORTED_MODULE_60__.Stroke),
13589
+ /* harmony export */ Registry: () => (/* reexport safe */ _registry__WEBPACK_IMPORTED_MODULE_42__.Registry),
13590
+ /* harmony export */ RenderContext: () => (/* reexport safe */ _rendercontext__WEBPACK_IMPORTED_MODULE_43__.RenderContext),
13591
+ /* harmony export */ Renderer: () => (/* reexport safe */ _renderer__WEBPACK_IMPORTED_MODULE_44__.Renderer),
13592
+ /* harmony export */ RendererBackends: () => (/* reexport safe */ _renderer__WEBPACK_IMPORTED_MODULE_44__.RendererBackends),
13593
+ /* harmony export */ RendererLineEndType: () => (/* reexport safe */ _renderer__WEBPACK_IMPORTED_MODULE_44__.RendererLineEndType),
13594
+ /* harmony export */ RepeatNote: () => (/* reexport safe */ _repeatnote__WEBPACK_IMPORTED_MODULE_45__.RepeatNote),
13595
+ /* harmony export */ Repetition: () => (/* reexport safe */ _staverepetition__WEBPACK_IMPORTED_MODULE_53__.Repetition),
13596
+ /* harmony export */ RuntimeError: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_80__.RuntimeError),
13597
+ /* harmony export */ SVGContext: () => (/* reexport safe */ _svgcontext__WEBPACK_IMPORTED_MODULE_63__.SVGContext),
13598
+ /* harmony export */ Stave: () => (/* reexport safe */ _stave__WEBPACK_IMPORTED_MODULE_46__.Stave),
13599
+ /* harmony export */ StaveConnector: () => (/* reexport safe */ _staveconnector__WEBPACK_IMPORTED_MODULE_48__.StaveConnector),
13600
+ /* harmony export */ StaveHairpin: () => (/* reexport safe */ _stavehairpin__WEBPACK_IMPORTED_MODULE_49__.StaveHairpin),
13601
+ /* harmony export */ StaveLine: () => (/* reexport safe */ _staveline__WEBPACK_IMPORTED_MODULE_50__.StaveLine),
13602
+ /* harmony export */ StaveModifier: () => (/* reexport safe */ _stavemodifier__WEBPACK_IMPORTED_MODULE_51__.StaveModifier),
13603
+ /* harmony export */ StaveModifierPosition: () => (/* reexport safe */ _stavemodifier__WEBPACK_IMPORTED_MODULE_51__.StaveModifierPosition),
13604
+ /* harmony export */ StaveNote: () => (/* reexport safe */ _stavenote__WEBPACK_IMPORTED_MODULE_52__.StaveNote),
13605
+ /* harmony export */ StaveSection: () => (/* reexport safe */ _stavesection__WEBPACK_IMPORTED_MODULE_54__.StaveSection),
13606
+ /* harmony export */ StaveTempo: () => (/* reexport safe */ _stavetempo__WEBPACK_IMPORTED_MODULE_55__.StaveTempo),
13607
+ /* harmony export */ StaveText: () => (/* reexport safe */ _stavetext__WEBPACK_IMPORTED_MODULE_56__.StaveText),
13608
+ /* harmony export */ StaveTie: () => (/* reexport safe */ _stavetie__WEBPACK_IMPORTED_MODULE_57__.StaveTie),
13609
+ /* harmony export */ Stem: () => (/* reexport safe */ _stem__WEBPACK_IMPORTED_MODULE_59__.Stem),
13610
+ /* harmony export */ StemmableNote: () => (/* reexport safe */ _stemmablenote__WEBPACK_IMPORTED_MODULE_60__.StemmableNote),
13611
+ /* harmony export */ StringNumber: () => (/* reexport safe */ _stringnumber__WEBPACK_IMPORTED_MODULE_61__.StringNumber),
13612
+ /* harmony export */ Stroke: () => (/* reexport safe */ _strokes__WEBPACK_IMPORTED_MODULE_62__.Stroke),
13575
13613
  /* harmony export */ SymbolModifiers: () => (/* reexport safe */ _chordsymbol__WEBPACK_IMPORTED_MODULE_8__.SymbolModifiers),
13576
- /* harmony export */ System: () => (/* reexport safe */ _system__WEBPACK_IMPORTED_MODULE_62__.System),
13577
- /* harmony export */ TabNote: () => (/* reexport safe */ _tabnote__WEBPACK_IMPORTED_MODULE_63__.TabNote),
13578
- /* harmony export */ TabSlide: () => (/* reexport safe */ _tabslide__WEBPACK_IMPORTED_MODULE_64__.TabSlide),
13579
- /* harmony export */ TabStave: () => (/* reexport safe */ _tabstave__WEBPACK_IMPORTED_MODULE_65__.TabStave),
13580
- /* harmony export */ TabTie: () => (/* reexport safe */ _tabtie__WEBPACK_IMPORTED_MODULE_66__.TabTie),
13581
- /* harmony export */ TextBracket: () => (/* reexport safe */ _textbracket__WEBPACK_IMPORTED_MODULE_67__.TextBracket),
13582
- /* harmony export */ TextBracketPosition: () => (/* reexport safe */ _textbracket__WEBPACK_IMPORTED_MODULE_67__.TextBracketPosition),
13583
- /* harmony export */ TextDynamics: () => (/* reexport safe */ _textdynamics__WEBPACK_IMPORTED_MODULE_68__.TextDynamics),
13584
- /* harmony export */ TextJustification: () => (/* reexport safe */ _textnote__WEBPACK_IMPORTED_MODULE_69__.TextJustification),
13585
- /* harmony export */ TextNote: () => (/* reexport safe */ _textnote__WEBPACK_IMPORTED_MODULE_69__.TextNote),
13586
- /* harmony export */ TickContext: () => (/* reexport safe */ _tickcontext__WEBPACK_IMPORTED_MODULE_71__.TickContext),
13587
- /* harmony export */ Tickable: () => (/* reexport safe */ _tickable__WEBPACK_IMPORTED_MODULE_70__.Tickable),
13588
- /* harmony export */ TimeSigNote: () => (/* reexport safe */ _timesignote__WEBPACK_IMPORTED_MODULE_73__.TimeSigNote),
13589
- /* harmony export */ TimeSignature: () => (/* reexport safe */ _timesignature__WEBPACK_IMPORTED_MODULE_72__.TimeSignature),
13590
- /* harmony export */ Tremolo: () => (/* reexport safe */ _tremolo__WEBPACK_IMPORTED_MODULE_74__.Tremolo),
13591
- /* harmony export */ Tuning: () => (/* reexport safe */ _tuning__WEBPACK_IMPORTED_MODULE_75__.Tuning),
13592
- /* harmony export */ Tuplet: () => (/* reexport safe */ _tuplet__WEBPACK_IMPORTED_MODULE_76__.Tuplet),
13593
- /* harmony export */ TupletLocation: () => (/* reexport safe */ _tuplet__WEBPACK_IMPORTED_MODULE_76__.TupletLocation),
13594
- /* harmony export */ VexFlow: () => (/* reexport safe */ _vexflow__WEBPACK_IMPORTED_MODULE_79__.VexFlow),
13595
- /* harmony export */ Vibrato: () => (/* reexport safe */ _vibrato__WEBPACK_IMPORTED_MODULE_80__.Vibrato),
13596
- /* harmony export */ VibratoBracket: () => (/* reexport safe */ _vibratobracket__WEBPACK_IMPORTED_MODULE_81__.VibratoBracket),
13597
- /* harmony export */ Voice: () => (/* reexport safe */ _voice__WEBPACK_IMPORTED_MODULE_82__.Voice),
13598
- /* harmony export */ VoiceMode: () => (/* reexport safe */ _voice__WEBPACK_IMPORTED_MODULE_82__.VoiceMode),
13599
- /* harmony export */ Volta: () => (/* reexport safe */ _stavevolta__WEBPACK_IMPORTED_MODULE_56__.Volta),
13600
- /* harmony export */ VoltaType: () => (/* reexport safe */ _stavevolta__WEBPACK_IMPORTED_MODULE_56__.VoltaType),
13601
- /* harmony export */ defined: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_78__.defined),
13602
- /* harmony export */ drawDot: () => (/* reexport safe */ _rendercontext__WEBPACK_IMPORTED_MODULE_41__.drawDot),
13614
+ /* harmony export */ System: () => (/* reexport safe */ _system__WEBPACK_IMPORTED_MODULE_64__.System),
13615
+ /* harmony export */ TabNote: () => (/* reexport safe */ _tabnote__WEBPACK_IMPORTED_MODULE_65__.TabNote),
13616
+ /* harmony export */ TabSlide: () => (/* reexport safe */ _tabslide__WEBPACK_IMPORTED_MODULE_66__.TabSlide),
13617
+ /* harmony export */ TabStave: () => (/* reexport safe */ _tabstave__WEBPACK_IMPORTED_MODULE_67__.TabStave),
13618
+ /* harmony export */ TabTie: () => (/* reexport safe */ _tabtie__WEBPACK_IMPORTED_MODULE_68__.TabTie),
13619
+ /* harmony export */ TextBracket: () => (/* reexport safe */ _textbracket__WEBPACK_IMPORTED_MODULE_69__.TextBracket),
13620
+ /* harmony export */ TextBracketPosition: () => (/* reexport safe */ _textbracket__WEBPACK_IMPORTED_MODULE_69__.TextBracketPosition),
13621
+ /* harmony export */ TextDynamics: () => (/* reexport safe */ _textdynamics__WEBPACK_IMPORTED_MODULE_70__.TextDynamics),
13622
+ /* harmony export */ TextJustification: () => (/* reexport safe */ _textnote__WEBPACK_IMPORTED_MODULE_71__.TextJustification),
13623
+ /* harmony export */ TextNote: () => (/* reexport safe */ _textnote__WEBPACK_IMPORTED_MODULE_71__.TextNote),
13624
+ /* harmony export */ TickContext: () => (/* reexport safe */ _tickcontext__WEBPACK_IMPORTED_MODULE_73__.TickContext),
13625
+ /* harmony export */ Tickable: () => (/* reexport safe */ _tickable__WEBPACK_IMPORTED_MODULE_72__.Tickable),
13626
+ /* harmony export */ TimeSigNote: () => (/* reexport safe */ _timesignote__WEBPACK_IMPORTED_MODULE_75__.TimeSigNote),
13627
+ /* harmony export */ TimeSignature: () => (/* reexport safe */ _timesignature__WEBPACK_IMPORTED_MODULE_74__.TimeSignature),
13628
+ /* harmony export */ Tremolo: () => (/* reexport safe */ _tremolo__WEBPACK_IMPORTED_MODULE_76__.Tremolo),
13629
+ /* harmony export */ Tuning: () => (/* reexport safe */ _tuning__WEBPACK_IMPORTED_MODULE_77__.Tuning),
13630
+ /* harmony export */ Tuplet: () => (/* reexport safe */ _tuplet__WEBPACK_IMPORTED_MODULE_78__.Tuplet),
13631
+ /* harmony export */ TupletLocation: () => (/* reexport safe */ _tuplet__WEBPACK_IMPORTED_MODULE_78__.TupletLocation),
13632
+ /* harmony export */ VexFlow: () => (/* reexport safe */ _vexflow__WEBPACK_IMPORTED_MODULE_81__.VexFlow),
13633
+ /* harmony export */ Vibrato: () => (/* reexport safe */ _vibrato__WEBPACK_IMPORTED_MODULE_82__.Vibrato),
13634
+ /* harmony export */ VibratoBracket: () => (/* reexport safe */ _vibratobracket__WEBPACK_IMPORTED_MODULE_83__.VibratoBracket),
13635
+ /* harmony export */ Voice: () => (/* reexport safe */ _voice__WEBPACK_IMPORTED_MODULE_84__.Voice),
13636
+ /* harmony export */ VoiceMode: () => (/* reexport safe */ _voice__WEBPACK_IMPORTED_MODULE_84__.VoiceMode),
13637
+ /* harmony export */ Volta: () => (/* reexport safe */ _stavevolta__WEBPACK_IMPORTED_MODULE_58__.Volta),
13638
+ /* harmony export */ VoltaType: () => (/* reexport safe */ _stavevolta__WEBPACK_IMPORTED_MODULE_58__.VoltaType),
13639
+ /* harmony export */ defined: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_80__.defined),
13640
+ /* harmony export */ drawDot: () => (/* reexport safe */ _rendercontext__WEBPACK_IMPORTED_MODULE_43__.drawDot),
13603
13641
  /* harmony export */ getBottomY: () => (/* reexport safe */ _articulation__WEBPACK_IMPORTED_MODULE_2__.getBottomY),
13604
13642
  /* harmony export */ getInitialOffset: () => (/* reexport safe */ _articulation__WEBPACK_IMPORTED_MODULE_2__.getInitialOffset),
13605
13643
  /* harmony export */ getTopY: () => (/* reexport safe */ _articulation__WEBPACK_IMPORTED_MODULE_2__.getTopY),
13606
- /* harmony export */ globalObject: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_78__.globalObject),
13607
- /* harmony export */ isAccidental: () => (/* reexport safe */ _typeguard__WEBPACK_IMPORTED_MODULE_77__.isAccidental),
13608
- /* harmony export */ isAnnotation: () => (/* reexport safe */ _typeguard__WEBPACK_IMPORTED_MODULE_77__.isAnnotation),
13609
- /* harmony export */ isBarline: () => (/* reexport safe */ _typeguard__WEBPACK_IMPORTED_MODULE_77__.isBarline),
13610
- /* harmony export */ isCategory: () => (/* reexport safe */ _typeguard__WEBPACK_IMPORTED_MODULE_77__.isCategory),
13611
- /* harmony export */ isDot: () => (/* reexport safe */ _typeguard__WEBPACK_IMPORTED_MODULE_77__.isDot),
13612
- /* harmony export */ isGraceNote: () => (/* reexport safe */ _typeguard__WEBPACK_IMPORTED_MODULE_77__.isGraceNote),
13613
- /* harmony export */ isGraceNoteGroup: () => (/* reexport safe */ _typeguard__WEBPACK_IMPORTED_MODULE_77__.isGraceNoteGroup),
13614
- /* harmony export */ isHTMLCanvas: () => (/* reexport safe */ _web__WEBPACK_IMPORTED_MODULE_83__.isHTMLCanvas),
13615
- /* harmony export */ isHTMLDiv: () => (/* reexport safe */ _web__WEBPACK_IMPORTED_MODULE_83__.isHTMLDiv),
13616
- /* harmony export */ isNote: () => (/* reexport safe */ _typeguard__WEBPACK_IMPORTED_MODULE_77__.isNote),
13617
- /* harmony export */ isRenderContext: () => (/* reexport safe */ _typeguard__WEBPACK_IMPORTED_MODULE_77__.isRenderContext),
13618
- /* harmony export */ isStaveNote: () => (/* reexport safe */ _typeguard__WEBPACK_IMPORTED_MODULE_77__.isStaveNote),
13619
- /* harmony export */ isStemmableNote: () => (/* reexport safe */ _typeguard__WEBPACK_IMPORTED_MODULE_77__.isStemmableNote),
13620
- /* harmony export */ isTabNote: () => (/* reexport safe */ _typeguard__WEBPACK_IMPORTED_MODULE_77__.isTabNote),
13621
- /* harmony export */ log: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_78__.log),
13622
- /* harmony export */ midLine: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_78__.midLine),
13623
- /* harmony export */ normalizeAngle: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_78__.normalizeAngle),
13624
- /* harmony export */ prefix: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_78__.prefix),
13625
- /* harmony export */ sumArray: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_78__.sumArray),
13626
- /* harmony export */ upperFirst: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_78__.upperFirst),
13627
- /* harmony export */ warn: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_78__.warn)
13644
+ /* harmony export */ globalObject: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_80__.globalObject),
13645
+ /* harmony export */ isAccidental: () => (/* reexport safe */ _typeguard__WEBPACK_IMPORTED_MODULE_79__.isAccidental),
13646
+ /* harmony export */ isAnnotation: () => (/* reexport safe */ _typeguard__WEBPACK_IMPORTED_MODULE_79__.isAnnotation),
13647
+ /* harmony export */ isBarline: () => (/* reexport safe */ _typeguard__WEBPACK_IMPORTED_MODULE_79__.isBarline),
13648
+ /* harmony export */ isCategory: () => (/* reexport safe */ _typeguard__WEBPACK_IMPORTED_MODULE_79__.isCategory),
13649
+ /* harmony export */ isDot: () => (/* reexport safe */ _typeguard__WEBPACK_IMPORTED_MODULE_79__.isDot),
13650
+ /* harmony export */ isGraceNote: () => (/* reexport safe */ _typeguard__WEBPACK_IMPORTED_MODULE_79__.isGraceNote),
13651
+ /* harmony export */ isGraceNoteGroup: () => (/* reexport safe */ _typeguard__WEBPACK_IMPORTED_MODULE_79__.isGraceNoteGroup),
13652
+ /* harmony export */ isHTMLCanvas: () => (/* reexport safe */ _web__WEBPACK_IMPORTED_MODULE_85__.isHTMLCanvas),
13653
+ /* harmony export */ isHTMLDiv: () => (/* reexport safe */ _web__WEBPACK_IMPORTED_MODULE_85__.isHTMLDiv),
13654
+ /* harmony export */ isNote: () => (/* reexport safe */ _typeguard__WEBPACK_IMPORTED_MODULE_79__.isNote),
13655
+ /* harmony export */ isRenderContext: () => (/* reexport safe */ _typeguard__WEBPACK_IMPORTED_MODULE_79__.isRenderContext),
13656
+ /* harmony export */ isStaveNote: () => (/* reexport safe */ _typeguard__WEBPACK_IMPORTED_MODULE_79__.isStaveNote),
13657
+ /* harmony export */ isStemmableNote: () => (/* reexport safe */ _typeguard__WEBPACK_IMPORTED_MODULE_79__.isStemmableNote),
13658
+ /* harmony export */ isTabNote: () => (/* reexport safe */ _typeguard__WEBPACK_IMPORTED_MODULE_79__.isTabNote),
13659
+ /* harmony export */ log: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_80__.log),
13660
+ /* harmony export */ midLine: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_80__.midLine),
13661
+ /* harmony export */ normalizeAngle: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_80__.normalizeAngle),
13662
+ /* harmony export */ prefix: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_80__.prefix),
13663
+ /* harmony export */ sumArray: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_80__.sumArray),
13664
+ /* harmony export */ upperFirst: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_80__.upperFirst),
13665
+ /* harmony export */ warn: () => (/* reexport safe */ _util__WEBPACK_IMPORTED_MODULE_80__.warn)
13628
13666
  /* harmony export */ });
13629
13667
  /* harmony import */ var _accidental__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./accidental */ "./src/accidental.ts");
13630
13668
  /* harmony import */ var _annotation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./annotation */ "./src/annotation.ts");
@@ -13644,72 +13682,74 @@ __webpack_require__.r(__webpack_exports__);
13644
13682
  /* harmony import */ var _element__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./element */ "./src/element.ts");
13645
13683
  /* harmony import */ var _factory__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./factory */ "./src/factory.ts");
13646
13684
  /* harmony import */ var _font__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./font */ "./src/font.ts");
13647
- /* harmony import */ var _formatter__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./formatter */ "./src/formatter.ts");
13648
- /* harmony import */ var _fraction__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./fraction */ "./src/fraction.ts");
13649
- /* harmony import */ var _frethandfinger__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./frethandfinger */ "./src/frethandfinger.ts");
13650
- /* harmony import */ var _ghostnote__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./ghostnote */ "./src/ghostnote.ts");
13651
- /* harmony import */ var _glyphnote__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./glyphnote */ "./src/glyphnote.ts");
13652
- /* harmony import */ var _gracenote__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./gracenote */ "./src/gracenote.ts");
13653
- /* harmony import */ var _gracenotegroup__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./gracenotegroup */ "./src/gracenotegroup.ts");
13654
- /* harmony import */ var _gracetabnote__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./gracetabnote */ "./src/gracetabnote.ts");
13655
- /* harmony import */ var _keymanager__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./keymanager */ "./src/keymanager.ts");
13656
- /* harmony import */ var _keysignature__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./keysignature */ "./src/keysignature.ts");
13657
- /* harmony import */ var _keysignote__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./keysignote */ "./src/keysignote.ts");
13658
- /* harmony import */ var _modifier__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./modifier */ "./src/modifier.ts");
13659
- /* harmony import */ var _modifiercontext__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./modifiercontext */ "./src/modifiercontext.ts");
13660
- /* harmony import */ var _multimeasurerest__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./multimeasurerest */ "./src/multimeasurerest.ts");
13661
- /* harmony import */ var _music__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./music */ "./src/music.ts");
13662
- /* harmony import */ var _note__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./note */ "./src/note.ts");
13663
- /* harmony import */ var _notehead__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./notehead */ "./src/notehead.ts");
13664
- /* harmony import */ var _notesubgroup__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./notesubgroup */ "./src/notesubgroup.ts");
13665
- /* harmony import */ var _ornament__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./ornament */ "./src/ornament.ts");
13666
- /* harmony import */ var _parenthesis__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./parenthesis */ "./src/parenthesis.ts");
13667
- /* harmony import */ var _parser__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ./parser */ "./src/parser.ts");
13668
- /* harmony import */ var _pedalmarking__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ./pedalmarking */ "./src/pedalmarking.ts");
13669
- /* harmony import */ var _registry__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./registry */ "./src/registry.ts");
13670
- /* harmony import */ var _rendercontext__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./rendercontext */ "./src/rendercontext.ts");
13671
- /* harmony import */ var _renderer__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ./renderer */ "./src/renderer.ts");
13672
- /* harmony import */ var _repeatnote__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ./repeatnote */ "./src/repeatnote.ts");
13673
- /* harmony import */ var _stave__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ./stave */ "./src/stave.ts");
13674
- /* harmony import */ var _stavebarline__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! ./stavebarline */ "./src/stavebarline.ts");
13675
- /* harmony import */ var _staveconnector__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(/*! ./staveconnector */ "./src/staveconnector.ts");
13676
- /* harmony import */ var _stavehairpin__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(/*! ./stavehairpin */ "./src/stavehairpin.ts");
13677
- /* harmony import */ var _staveline__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(/*! ./staveline */ "./src/staveline.ts");
13678
- /* harmony import */ var _stavemodifier__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__(/*! ./stavemodifier */ "./src/stavemodifier.ts");
13679
- /* harmony import */ var _stavenote__WEBPACK_IMPORTED_MODULE_50__ = __webpack_require__(/*! ./stavenote */ "./src/stavenote.ts");
13680
- /* harmony import */ var _staverepetition__WEBPACK_IMPORTED_MODULE_51__ = __webpack_require__(/*! ./staverepetition */ "./src/staverepetition.ts");
13681
- /* harmony import */ var _stavesection__WEBPACK_IMPORTED_MODULE_52__ = __webpack_require__(/*! ./stavesection */ "./src/stavesection.ts");
13682
- /* harmony import */ var _stavetempo__WEBPACK_IMPORTED_MODULE_53__ = __webpack_require__(/*! ./stavetempo */ "./src/stavetempo.ts");
13683
- /* harmony import */ var _stavetext__WEBPACK_IMPORTED_MODULE_54__ = __webpack_require__(/*! ./stavetext */ "./src/stavetext.ts");
13684
- /* harmony import */ var _stavetie__WEBPACK_IMPORTED_MODULE_55__ = __webpack_require__(/*! ./stavetie */ "./src/stavetie.ts");
13685
- /* harmony import */ var _stavevolta__WEBPACK_IMPORTED_MODULE_56__ = __webpack_require__(/*! ./stavevolta */ "./src/stavevolta.ts");
13686
- /* harmony import */ var _stem__WEBPACK_IMPORTED_MODULE_57__ = __webpack_require__(/*! ./stem */ "./src/stem.ts");
13687
- /* harmony import */ var _stemmablenote__WEBPACK_IMPORTED_MODULE_58__ = __webpack_require__(/*! ./stemmablenote */ "./src/stemmablenote.ts");
13688
- /* harmony import */ var _stringnumber__WEBPACK_IMPORTED_MODULE_59__ = __webpack_require__(/*! ./stringnumber */ "./src/stringnumber.ts");
13689
- /* harmony import */ var _strokes__WEBPACK_IMPORTED_MODULE_60__ = __webpack_require__(/*! ./strokes */ "./src/strokes.ts");
13690
- /* harmony import */ var _svgcontext__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(/*! ./svgcontext */ "./src/svgcontext.ts");
13691
- /* harmony import */ var _system__WEBPACK_IMPORTED_MODULE_62__ = __webpack_require__(/*! ./system */ "./src/system.ts");
13692
- /* harmony import */ var _tabnote__WEBPACK_IMPORTED_MODULE_63__ = __webpack_require__(/*! ./tabnote */ "./src/tabnote.ts");
13693
- /* harmony import */ var _tabslide__WEBPACK_IMPORTED_MODULE_64__ = __webpack_require__(/*! ./tabslide */ "./src/tabslide.ts");
13694
- /* harmony import */ var _tabstave__WEBPACK_IMPORTED_MODULE_65__ = __webpack_require__(/*! ./tabstave */ "./src/tabstave.ts");
13695
- /* harmony import */ var _tabtie__WEBPACK_IMPORTED_MODULE_66__ = __webpack_require__(/*! ./tabtie */ "./src/tabtie.ts");
13696
- /* harmony import */ var _textbracket__WEBPACK_IMPORTED_MODULE_67__ = __webpack_require__(/*! ./textbracket */ "./src/textbracket.ts");
13697
- /* harmony import */ var _textdynamics__WEBPACK_IMPORTED_MODULE_68__ = __webpack_require__(/*! ./textdynamics */ "./src/textdynamics.ts");
13698
- /* harmony import */ var _textnote__WEBPACK_IMPORTED_MODULE_69__ = __webpack_require__(/*! ./textnote */ "./src/textnote.ts");
13699
- /* harmony import */ var _tickable__WEBPACK_IMPORTED_MODULE_70__ = __webpack_require__(/*! ./tickable */ "./src/tickable.ts");
13700
- /* harmony import */ var _tickcontext__WEBPACK_IMPORTED_MODULE_71__ = __webpack_require__(/*! ./tickcontext */ "./src/tickcontext.ts");
13701
- /* harmony import */ var _timesignature__WEBPACK_IMPORTED_MODULE_72__ = __webpack_require__(/*! ./timesignature */ "./src/timesignature.ts");
13702
- /* harmony import */ var _timesignote__WEBPACK_IMPORTED_MODULE_73__ = __webpack_require__(/*! ./timesignote */ "./src/timesignote.ts");
13703
- /* harmony import */ var _tremolo__WEBPACK_IMPORTED_MODULE_74__ = __webpack_require__(/*! ./tremolo */ "./src/tremolo.ts");
13704
- /* harmony import */ var _tuning__WEBPACK_IMPORTED_MODULE_75__ = __webpack_require__(/*! ./tuning */ "./src/tuning.ts");
13705
- /* harmony import */ var _tuplet__WEBPACK_IMPORTED_MODULE_76__ = __webpack_require__(/*! ./tuplet */ "./src/tuplet.ts");
13706
- /* harmony import */ var _typeguard__WEBPACK_IMPORTED_MODULE_77__ = __webpack_require__(/*! ./typeguard */ "./src/typeguard.ts");
13707
- /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_78__ = __webpack_require__(/*! ./util */ "./src/util.ts");
13708
- /* harmony import */ var _vexflow__WEBPACK_IMPORTED_MODULE_79__ = __webpack_require__(/*! ./vexflow */ "./src/vexflow.ts");
13709
- /* harmony import */ var _vibrato__WEBPACK_IMPORTED_MODULE_80__ = __webpack_require__(/*! ./vibrato */ "./src/vibrato.ts");
13710
- /* harmony import */ var _vibratobracket__WEBPACK_IMPORTED_MODULE_81__ = __webpack_require__(/*! ./vibratobracket */ "./src/vibratobracket.ts");
13711
- /* harmony import */ var _voice__WEBPACK_IMPORTED_MODULE_82__ = __webpack_require__(/*! ./voice */ "./src/voice.ts");
13712
- /* harmony import */ var _web__WEBPACK_IMPORTED_MODULE_83__ = __webpack_require__(/*! ./web */ "./src/web.ts");
13685
+ /* harmony import */ var _flag__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./flag */ "./src/flag.ts");
13686
+ /* harmony import */ var _formatter__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./formatter */ "./src/formatter.ts");
13687
+ /* harmony import */ var _fraction__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./fraction */ "./src/fraction.ts");
13688
+ /* harmony import */ var _frethandfinger__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./frethandfinger */ "./src/frethandfinger.ts");
13689
+ /* harmony import */ var _ghostnote__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./ghostnote */ "./src/ghostnote.ts");
13690
+ /* harmony import */ var _glyphnote__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./glyphnote */ "./src/glyphnote.ts");
13691
+ /* harmony import */ var _gracenote__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./gracenote */ "./src/gracenote.ts");
13692
+ /* harmony import */ var _gracenotegroup__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./gracenotegroup */ "./src/gracenotegroup.ts");
13693
+ /* harmony import */ var _gracetabnote__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./gracetabnote */ "./src/gracetabnote.ts");
13694
+ /* harmony import */ var _keymanager__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./keymanager */ "./src/keymanager.ts");
13695
+ /* harmony import */ var _keysignature__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./keysignature */ "./src/keysignature.ts");
13696
+ /* harmony import */ var _keysignote__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./keysignote */ "./src/keysignote.ts");
13697
+ /* harmony import */ var _metrics__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./metrics */ "./src/metrics.ts");
13698
+ /* harmony import */ var _modifier__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./modifier */ "./src/modifier.ts");
13699
+ /* harmony import */ var _modifiercontext__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./modifiercontext */ "./src/modifiercontext.ts");
13700
+ /* harmony import */ var _multimeasurerest__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./multimeasurerest */ "./src/multimeasurerest.ts");
13701
+ /* harmony import */ var _music__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./music */ "./src/music.ts");
13702
+ /* harmony import */ var _note__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./note */ "./src/note.ts");
13703
+ /* harmony import */ var _notehead__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./notehead */ "./src/notehead.ts");
13704
+ /* harmony import */ var _notesubgroup__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./notesubgroup */ "./src/notesubgroup.ts");
13705
+ /* harmony import */ var _ornament__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ./ornament */ "./src/ornament.ts");
13706
+ /* harmony import */ var _parenthesis__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ./parenthesis */ "./src/parenthesis.ts");
13707
+ /* harmony import */ var _parser__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./parser */ "./src/parser.ts");
13708
+ /* harmony import */ var _pedalmarking__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./pedalmarking */ "./src/pedalmarking.ts");
13709
+ /* harmony import */ var _registry__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ./registry */ "./src/registry.ts");
13710
+ /* harmony import */ var _rendercontext__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ./rendercontext */ "./src/rendercontext.ts");
13711
+ /* harmony import */ var _renderer__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ./renderer */ "./src/renderer.ts");
13712
+ /* harmony import */ var _repeatnote__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! ./repeatnote */ "./src/repeatnote.ts");
13713
+ /* harmony import */ var _stave__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(/*! ./stave */ "./src/stave.ts");
13714
+ /* harmony import */ var _stavebarline__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(/*! ./stavebarline */ "./src/stavebarline.ts");
13715
+ /* harmony import */ var _staveconnector__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(/*! ./staveconnector */ "./src/staveconnector.ts");
13716
+ /* harmony import */ var _stavehairpin__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__(/*! ./stavehairpin */ "./src/stavehairpin.ts");
13717
+ /* harmony import */ var _staveline__WEBPACK_IMPORTED_MODULE_50__ = __webpack_require__(/*! ./staveline */ "./src/staveline.ts");
13718
+ /* harmony import */ var _stavemodifier__WEBPACK_IMPORTED_MODULE_51__ = __webpack_require__(/*! ./stavemodifier */ "./src/stavemodifier.ts");
13719
+ /* harmony import */ var _stavenote__WEBPACK_IMPORTED_MODULE_52__ = __webpack_require__(/*! ./stavenote */ "./src/stavenote.ts");
13720
+ /* harmony import */ var _staverepetition__WEBPACK_IMPORTED_MODULE_53__ = __webpack_require__(/*! ./staverepetition */ "./src/staverepetition.ts");
13721
+ /* harmony import */ var _stavesection__WEBPACK_IMPORTED_MODULE_54__ = __webpack_require__(/*! ./stavesection */ "./src/stavesection.ts");
13722
+ /* harmony import */ var _stavetempo__WEBPACK_IMPORTED_MODULE_55__ = __webpack_require__(/*! ./stavetempo */ "./src/stavetempo.ts");
13723
+ /* harmony import */ var _stavetext__WEBPACK_IMPORTED_MODULE_56__ = __webpack_require__(/*! ./stavetext */ "./src/stavetext.ts");
13724
+ /* harmony import */ var _stavetie__WEBPACK_IMPORTED_MODULE_57__ = __webpack_require__(/*! ./stavetie */ "./src/stavetie.ts");
13725
+ /* harmony import */ var _stavevolta__WEBPACK_IMPORTED_MODULE_58__ = __webpack_require__(/*! ./stavevolta */ "./src/stavevolta.ts");
13726
+ /* harmony import */ var _stem__WEBPACK_IMPORTED_MODULE_59__ = __webpack_require__(/*! ./stem */ "./src/stem.ts");
13727
+ /* harmony import */ var _stemmablenote__WEBPACK_IMPORTED_MODULE_60__ = __webpack_require__(/*! ./stemmablenote */ "./src/stemmablenote.ts");
13728
+ /* harmony import */ var _stringnumber__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(/*! ./stringnumber */ "./src/stringnumber.ts");
13729
+ /* harmony import */ var _strokes__WEBPACK_IMPORTED_MODULE_62__ = __webpack_require__(/*! ./strokes */ "./src/strokes.ts");
13730
+ /* harmony import */ var _svgcontext__WEBPACK_IMPORTED_MODULE_63__ = __webpack_require__(/*! ./svgcontext */ "./src/svgcontext.ts");
13731
+ /* harmony import */ var _system__WEBPACK_IMPORTED_MODULE_64__ = __webpack_require__(/*! ./system */ "./src/system.ts");
13732
+ /* harmony import */ var _tabnote__WEBPACK_IMPORTED_MODULE_65__ = __webpack_require__(/*! ./tabnote */ "./src/tabnote.ts");
13733
+ /* harmony import */ var _tabslide__WEBPACK_IMPORTED_MODULE_66__ = __webpack_require__(/*! ./tabslide */ "./src/tabslide.ts");
13734
+ /* harmony import */ var _tabstave__WEBPACK_IMPORTED_MODULE_67__ = __webpack_require__(/*! ./tabstave */ "./src/tabstave.ts");
13735
+ /* harmony import */ var _tabtie__WEBPACK_IMPORTED_MODULE_68__ = __webpack_require__(/*! ./tabtie */ "./src/tabtie.ts");
13736
+ /* harmony import */ var _textbracket__WEBPACK_IMPORTED_MODULE_69__ = __webpack_require__(/*! ./textbracket */ "./src/textbracket.ts");
13737
+ /* harmony import */ var _textdynamics__WEBPACK_IMPORTED_MODULE_70__ = __webpack_require__(/*! ./textdynamics */ "./src/textdynamics.ts");
13738
+ /* harmony import */ var _textnote__WEBPACK_IMPORTED_MODULE_71__ = __webpack_require__(/*! ./textnote */ "./src/textnote.ts");
13739
+ /* harmony import */ var _tickable__WEBPACK_IMPORTED_MODULE_72__ = __webpack_require__(/*! ./tickable */ "./src/tickable.ts");
13740
+ /* harmony import */ var _tickcontext__WEBPACK_IMPORTED_MODULE_73__ = __webpack_require__(/*! ./tickcontext */ "./src/tickcontext.ts");
13741
+ /* harmony import */ var _timesignature__WEBPACK_IMPORTED_MODULE_74__ = __webpack_require__(/*! ./timesignature */ "./src/timesignature.ts");
13742
+ /* harmony import */ var _timesignote__WEBPACK_IMPORTED_MODULE_75__ = __webpack_require__(/*! ./timesignote */ "./src/timesignote.ts");
13743
+ /* harmony import */ var _tremolo__WEBPACK_IMPORTED_MODULE_76__ = __webpack_require__(/*! ./tremolo */ "./src/tremolo.ts");
13744
+ /* harmony import */ var _tuning__WEBPACK_IMPORTED_MODULE_77__ = __webpack_require__(/*! ./tuning */ "./src/tuning.ts");
13745
+ /* harmony import */ var _tuplet__WEBPACK_IMPORTED_MODULE_78__ = __webpack_require__(/*! ./tuplet */ "./src/tuplet.ts");
13746
+ /* harmony import */ var _typeguard__WEBPACK_IMPORTED_MODULE_79__ = __webpack_require__(/*! ./typeguard */ "./src/typeguard.ts");
13747
+ /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_80__ = __webpack_require__(/*! ./util */ "./src/util.ts");
13748
+ /* harmony import */ var _vexflow__WEBPACK_IMPORTED_MODULE_81__ = __webpack_require__(/*! ./vexflow */ "./src/vexflow.ts");
13749
+ /* harmony import */ var _vibrato__WEBPACK_IMPORTED_MODULE_82__ = __webpack_require__(/*! ./vibrato */ "./src/vibrato.ts");
13750
+ /* harmony import */ var _vibratobracket__WEBPACK_IMPORTED_MODULE_83__ = __webpack_require__(/*! ./vibratobracket */ "./src/vibratobracket.ts");
13751
+ /* harmony import */ var _voice__WEBPACK_IMPORTED_MODULE_84__ = __webpack_require__(/*! ./voice */ "./src/voice.ts");
13752
+ /* harmony import */ var _web__WEBPACK_IMPORTED_MODULE_85__ = __webpack_require__(/*! ./web */ "./src/web.ts");
13713
13753
  // Copyright (c) 2023-present VexFlow contributors: https://github.com/vexflow/vexflow/graphs/contributors
13714
13754
  // MIT License
13715
13755
 
@@ -13773,6 +13813,8 @@ __webpack_require__.r(__webpack_exports__);
13773
13813
 
13774
13814
 
13775
13815
 
13816
+
13817
+
13776
13818
 
13777
13819
 
13778
13820
 
@@ -13938,11 +13980,14 @@ __webpack_require__.r(__webpack_exports__);
13938
13980
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13939
13981
  /* harmony export */ KeySignature: () => (/* binding */ KeySignature)
13940
13982
  /* harmony export */ });
13941
- /* harmony import */ var _element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./element */ "./src/element.ts");
13942
- /* harmony import */ var _stavemodifier__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./stavemodifier */ "./src/stavemodifier.ts");
13943
- /* harmony import */ var _tables__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./tables */ "./src/tables.ts");
13944
- /* harmony import */ var _typeguard__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./typeguard */ "./src/typeguard.ts");
13945
- /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./util */ "./src/util.ts");
13983
+ /* harmony import */ var _boundingbox__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./boundingbox */ "./src/boundingbox.ts");
13984
+ /* harmony import */ var _element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./element */ "./src/element.ts");
13985
+ /* harmony import */ var _glyphs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./glyphs */ "./src/glyphs.ts");
13986
+ /* harmony import */ var _stave__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./stave */ "./src/stave.ts");
13987
+ /* harmony import */ var _stavemodifier__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./stavemodifier */ "./src/stavemodifier.ts");
13988
+ /* harmony import */ var _tables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./tables */ "./src/tables.ts");
13989
+ /* harmony import */ var _typeguard__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./typeguard */ "./src/typeguard.ts");
13990
+ /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./util */ "./src/util.ts");
13946
13991
  // Copyright (c) 2023-present VexFlow contributors: https://github.com/vexflow/vexflow/graphs/contributors
13947
13992
  // @author Cyril Silverman
13948
13993
  //
@@ -13955,35 +14000,43 @@ __webpack_require__.r(__webpack_exports__);
13955
14000
 
13956
14001
 
13957
14002
 
13958
- class KeySignature extends _stavemodifier__WEBPACK_IMPORTED_MODULE_1__.StaveModifier {
14003
+
14004
+
14005
+
14006
+ class KeySignature extends _stavemodifier__WEBPACK_IMPORTED_MODULE_4__.StaveModifier {
13959
14007
  static get CATEGORY() {
13960
- return _typeguard__WEBPACK_IMPORTED_MODULE_3__.Category.KeySignature;
14008
+ return _typeguard__WEBPACK_IMPORTED_MODULE_6__.Category.KeySignature;
13961
14009
  }
13962
14010
  // Create a new Key Signature based on a `keySpec`
13963
14011
  constructor(keySpec, cancelKeySpec, alterKeySpec) {
13964
14012
  super();
13965
14013
  this.accList = [];
13966
14014
  this.setKeySig(keySpec, cancelKeySpec, alterKeySpec);
13967
- this.setPosition(_stavemodifier__WEBPACK_IMPORTED_MODULE_1__.StaveModifierPosition.BEGIN);
13968
- this.glyphs = [];
14015
+ this.setPosition(_stavemodifier__WEBPACK_IMPORTED_MODULE_4__.StaveModifierPosition.BEGIN);
14016
+ this.children = [];
13969
14017
  this.paddingForced = false;
13970
14018
  }
13971
14019
  // Add an accidental glyph to the `KeySignature` instance which represents
13972
14020
  // the provided `acc`. If `nextAcc` is also provided, the appropriate
13973
14021
  // spacing will be included in the glyph's position
13974
14022
  convertToGlyph(acc, nextAcc, stave) {
13975
- const code = _tables__WEBPACK_IMPORTED_MODULE_2__.Tables.accidentalCodes(acc.type);
13976
- const glyph = new _element__WEBPACK_IMPORTED_MODULE_0__.Element(_typeguard__WEBPACK_IMPORTED_MODULE_3__.Category.KeySignature);
14023
+ const code = _tables__WEBPACK_IMPORTED_MODULE_5__.Tables.accidentalCodes(acc.type);
14024
+ const glyph = new _element__WEBPACK_IMPORTED_MODULE_1__.Element(_typeguard__WEBPACK_IMPORTED_MODULE_6__.Category.KeySignature);
13977
14025
  glyph.setText(code);
13978
14026
  // Determine spacing between current accidental and the next accidental
13979
- const extraWidth = 1;
14027
+ let extraWidth = 1;
13980
14028
  // Place the glyph on the stave
13981
14029
  glyph.setYShift(stave.getYForLine(acc.line));
13982
- if (this.glyphs.length > 0) {
13983
- const prevGlyph = this.glyphs[this.glyphs.length - 1];
14030
+ if (this.children.length > 0) {
14031
+ const prevGlyph = this.children[this.children.length - 1];
14032
+ const isNatural = (el) => el.getText() === _glyphs__WEBPACK_IMPORTED_MODULE_2__.Glyphs.accidentalNatural;
14033
+ const yShiftDiff = (el1, el2) => Math.abs(el2.getYShift() - el1.getYShift());
14034
+ if ((isNatural(prevGlyph) || isNatural(glyph)) && yShiftDiff(prevGlyph, glyph) < 10) {
14035
+ extraWidth = 2;
14036
+ }
13984
14037
  glyph.setXShift(prevGlyph.getXShift() + prevGlyph.getWidth() + extraWidth);
13985
14038
  }
13986
- this.glyphs.push(glyph);
14039
+ this.children.push(glyph);
13987
14040
  // Expand size of key signature
13988
14041
  this.width += glyph.getWidth() + extraWidth;
13989
14042
  }
@@ -13994,9 +14047,10 @@ class KeySignature extends _stavemodifier__WEBPACK_IMPORTED_MODULE_1__.StaveModi
13994
14047
  this.cancelKeySpec = spec;
13995
14048
  return this;
13996
14049
  }
14050
+ // Convert the `cancelKeySpec` into a list of naturals to be displayed
13997
14051
  convertToCancelAccList(spec) {
13998
14052
  // Get the accidental list for the cancelled key signature
13999
- const cancelAccList = _tables__WEBPACK_IMPORTED_MODULE_2__.Tables.keySignature(spec);
14053
+ const cancelAccList = _tables__WEBPACK_IMPORTED_MODULE_5__.Tables.keySignature(spec);
14000
14054
  // If the cancelled key has a different accidental type, ie: # vs b
14001
14055
  const differentTypes = this.accList.length > 0 && cancelAccList.length > 0 && cancelAccList[0].type !== this.accList[0].type;
14002
14056
  // Determine how many naturals needed to add
@@ -14021,11 +14075,39 @@ class KeySignature extends _stavemodifier__WEBPACK_IMPORTED_MODULE_1__.StaveModi
14021
14075
  type: cancelAccList[0].type,
14022
14076
  };
14023
14077
  }
14078
+ // Add this key signature to the start of a stave.
14024
14079
  addToStave(stave) {
14025
14080
  this.paddingForced = true;
14026
14081
  stave.addModifier(this);
14027
14082
  return this;
14028
14083
  }
14084
+ // Add this key signature to a stave.
14085
+ setStave(stave) {
14086
+ this.formatted = false;
14087
+ return super.setStave(stave);
14088
+ }
14089
+ // Get the `BoundingBox`
14090
+ getBoundingBox() {
14091
+ if (!this.formatted)
14092
+ this.format();
14093
+ return super.getBoundingBox();
14094
+ }
14095
+ // Calculate the width and height for the entire signature
14096
+ calculateDimensions() {
14097
+ let boundingBox;
14098
+ if (this.children.length > 0) {
14099
+ boundingBox = this.children[0].getBoundingBox();
14100
+ }
14101
+ else {
14102
+ boundingBox = new _boundingbox__WEBPACK_IMPORTED_MODULE_0__.BoundingBox(this.x + this.xShift, this.y + this.yShift, 0, 0);
14103
+ }
14104
+ this.children.forEach((glyph) => {
14105
+ boundingBox.mergeWith(glyph.getBoundingBox());
14106
+ });
14107
+ this.width = boundingBox.getW();
14108
+ this.height = boundingBox.getH();
14109
+ this.y = boundingBox.getY();
14110
+ }
14029
14111
  // Apply the accidental staff line placement based on the `clef` and
14030
14112
  // the accidental `type` for the key signature ('# or 'b').
14031
14113
  convertAccLines(clef, type, accList = this.accList) {
@@ -14081,16 +14163,19 @@ class KeySignature extends _stavemodifier__WEBPACK_IMPORTED_MODULE_1__.StaveModi
14081
14163
  }
14082
14164
  }
14083
14165
  }
14166
+ // Get the padding required for this modifier
14084
14167
  getPadding(index) {
14085
14168
  if (!this.formatted)
14086
14169
  this.format();
14087
- return this.glyphs.length === 0 || (!this.paddingForced && index < 2) ? 0 : this.padding;
14170
+ return this.children.length === 0 || (!this.paddingForced && index < 2) ? 0 : this.padding;
14088
14171
  }
14172
+ // Get the width of the modifier
14089
14173
  getWidth() {
14090
14174
  if (!this.formatted)
14091
- this.calculateWidth();
14175
+ this.format();
14092
14176
  return this.width;
14093
14177
  }
14178
+ // Set the key signature to a specific key, ie: 'C' or 'Gm'
14094
14179
  setKeySig(keySpec, cancelKeySpec, alterKeySpec) {
14095
14180
  this.formatted = false;
14096
14181
  this.keySpec = keySpec;
@@ -14106,6 +14191,7 @@ class KeySignature extends _stavemodifier__WEBPACK_IMPORTED_MODULE_1__.StaveModi
14106
14191
  this.alterKeySpec = alterKeySpec;
14107
14192
  return this;
14108
14193
  }
14194
+ // Convert the `alterKeySpec` into a list of accidentals to be displayed
14109
14195
  convertToAlterAccList(alterKeySpec) {
14110
14196
  const max = Math.min(alterKeySpec.length, this.accList.length);
14111
14197
  for (let i = 0; i < max; ++i) {
@@ -14114,11 +14200,19 @@ class KeySignature extends _stavemodifier__WEBPACK_IMPORTED_MODULE_1__.StaveModi
14114
14200
  }
14115
14201
  }
14116
14202
  }
14203
+ /**
14204
+ * Format and position the modifier.
14205
+ * If no stave is set, a dummy stave is created.
14206
+ */
14117
14207
  format() {
14118
- const stave = this.checkStave();
14208
+ let stave = this.getStave();
14209
+ if (!stave) {
14210
+ stave = new _stave__WEBPACK_IMPORTED_MODULE_3__.Stave(0, 0, 100);
14211
+ this.setStave(stave);
14212
+ }
14119
14213
  this.width = 0;
14120
- this.glyphs = [];
14121
- this.accList = _tables__WEBPACK_IMPORTED_MODULE_2__.Tables.keySignature((0,_util__WEBPACK_IMPORTED_MODULE_4__.defined)(this.keySpec));
14214
+ this.children = [];
14215
+ this.accList = _tables__WEBPACK_IMPORTED_MODULE_5__.Tables.keySignature((0,_util__WEBPACK_IMPORTED_MODULE_7__.defined)(this.keySpec));
14122
14216
  const accList = this.accList;
14123
14217
  const firstAccidentalType = accList.length > 0 ? accList[0].type : undefined;
14124
14218
  let cancelAccList;
@@ -14129,7 +14223,7 @@ class KeySignature extends _stavemodifier__WEBPACK_IMPORTED_MODULE_1__.StaveModi
14129
14223
  this.convertToAlterAccList(this.alterKeySpec);
14130
14224
  }
14131
14225
  if (this.accList.length > 0) {
14132
- const clef = (this.position === _stavemodifier__WEBPACK_IMPORTED_MODULE_1__.StaveModifierPosition.END ? stave.getEndClef() : stave.getClef()) || stave.getClef();
14226
+ const clef = (this.position === _stavemodifier__WEBPACK_IMPORTED_MODULE_4__.StaveModifierPosition.END ? stave.getEndClef() : stave.getClef()) || stave.getClef();
14133
14227
  if (cancelAccList) {
14134
14228
  this.convertAccLines(clef, cancelAccList.type, cancelAccList.accList);
14135
14229
  }
@@ -14138,43 +14232,22 @@ class KeySignature extends _stavemodifier__WEBPACK_IMPORTED_MODULE_1__.StaveModi
14138
14232
  this.convertToGlyph(this.accList[i], this.accList[i + 1], stave);
14139
14233
  }
14140
14234
  }
14235
+ this.calculateDimensions();
14141
14236
  this.formatted = true;
14142
14237
  }
14143
- calculateWidth() {
14144
- this.width = 0;
14145
- this.accList = _tables__WEBPACK_IMPORTED_MODULE_2__.Tables.keySignature((0,_util__WEBPACK_IMPORTED_MODULE_4__.defined)(this.keySpec));
14146
- if (this.cancelKeySpec) {
14147
- this.convertToCancelAccList(this.cancelKeySpec);
14148
- }
14149
- if (this.alterKeySpec) {
14150
- this.convertToAlterAccList(this.alterKeySpec);
14151
- }
14152
- if (this.accList.length > 0) {
14153
- for (let i = 0; i < this.accList.length; ++i) {
14154
- const code = _tables__WEBPACK_IMPORTED_MODULE_2__.Tables.accidentalCodes(this.accList[i].type);
14155
- const glyph = new _element__WEBPACK_IMPORTED_MODULE_0__.Element(_typeguard__WEBPACK_IMPORTED_MODULE_3__.Category.KeySignature);
14156
- glyph.setText(code);
14157
- // Determine spacing between current accidental and the next accidental
14158
- const extraWidth = 1;
14159
- // Expand size of key signature
14160
- this.width += glyph.getWidth() + extraWidth;
14161
- }
14162
- }
14163
- }
14238
+ // Render the key signature
14164
14239
  draw() {
14165
14240
  const stave = this.checkStave();
14166
14241
  const ctx = stave.checkContext();
14167
14242
  if (!this.formatted)
14168
14243
  this.format();
14169
14244
  this.setRendered();
14170
- this.applyStyle(ctx);
14171
14245
  ctx.openGroup('keysignature', this.getAttribute('id'));
14172
- for (let i = 0; i < this.glyphs.length; i++) {
14173
- const glyph = this.glyphs[i];
14246
+ for (let i = 0; i < this.children.length; i++) {
14247
+ const glyph = this.children[i];
14174
14248
  glyph.renderText(ctx, this.x, 0);
14175
14249
  }
14176
14250
  ctx.closeGroup();
14177
- this.restoreStyle(ctx);
14178
14251
  }
14179
14252
  }
14180
14253
 
@@ -14226,7 +14299,7 @@ class KeySigNote extends _note__WEBPACK_IMPORTED_MODULE_1__.Note {
14226
14299
  this.setRendered();
14227
14300
  this.keySignature.setX(this.getAbsoluteX());
14228
14301
  this.keySignature.setContext(ctx);
14229
- this.keySignature.draw();
14302
+ this.keySignature.drawWithStyle();
14230
14303
  }
14231
14304
  }
14232
14305
 
@@ -14247,13 +14320,43 @@ __webpack_require__.r(__webpack_exports__);
14247
14320
  // Copyright (c) 2023-present VexFlow contributors: https://github.com/vexflow/vexflow/graphs/contributors
14248
14321
  class Metrics {
14249
14322
  /** Use the provided key to look up a FontInfo in CommonMetrics. **/
14323
+ static clear(key) {
14324
+ if (key) {
14325
+ this.cacheFont.delete(key);
14326
+ this.cacheStyle.delete(key);
14327
+ }
14328
+ else {
14329
+ this.cacheFont.clear();
14330
+ this.cacheStyle.clear();
14331
+ }
14332
+ }
14250
14333
  static getFontInfo(key) {
14251
- return {
14252
- family: Metrics.get(`${key}.fontFamily`),
14253
- size: Metrics.get(`${key}.fontSize`) * Metrics.get(`${key}.fontScale`),
14254
- weight: Metrics.get(`${key}.fontWeight`),
14255
- style: Metrics.get(`${key}.fontStyle`),
14256
- };
14334
+ let font = this.cacheFont.get(key);
14335
+ if (!font) {
14336
+ font = {
14337
+ family: Metrics.get(`${key}.fontFamily`),
14338
+ size: Metrics.get(`${key}.fontSize`) * Metrics.get(`${key}.fontScale`),
14339
+ weight: Metrics.get(`${key}.fontWeight`),
14340
+ style: Metrics.get(`${key}.fontStyle`),
14341
+ };
14342
+ this.cacheFont.set(key, font);
14343
+ }
14344
+ return structuredClone(font);
14345
+ }
14346
+ static getStyle(key) {
14347
+ let style = this.cacheStyle.get(key);
14348
+ if (!style) {
14349
+ style = {
14350
+ fillStyle: Metrics.get(`${key}.fillStyle`),
14351
+ strokeStyle: Metrics.get(`${key}.strokeStyle`),
14352
+ lineWidth: Metrics.get(`${key}.lineWidth`),
14353
+ lineDash: Metrics.get(`${key}.lineDash`),
14354
+ shadowBlur: Metrics.get(`${key}.shadowBlur`),
14355
+ shadowColor: Metrics.get(`${key}.shadowColor`),
14356
+ };
14357
+ this.cacheStyle.set(key, style);
14358
+ }
14359
+ return structuredClone(style);
14257
14360
  }
14258
14361
  /**
14259
14362
  * Use the provided key to look up a value in CommonMetrics.
@@ -14290,6 +14393,8 @@ class Metrics {
14290
14393
  return retVal;
14291
14394
  }
14292
14395
  }
14396
+ Metrics.cacheStyle = new Map();
14397
+ Metrics.cacheFont = new Map();
14293
14398
  // eslint-disable-next-line
14294
14399
  const MetricsDefaults = {
14295
14400
  fontFamily: 'Bravura,Academico',
@@ -14302,7 +14407,7 @@ const MetricsDefaults = {
14302
14407
  fontSize: 20,
14303
14408
  },
14304
14409
  grace: {
14305
- fontSize: 25,
14410
+ fontSize: 20,
14306
14411
  },
14307
14412
  noteheadAccidentalPadding: 1,
14308
14413
  leftPadding: 2,
@@ -14313,6 +14418,10 @@ const MetricsDefaults = {
14313
14418
  },
14314
14419
  Bend: {
14315
14420
  fontSize: 10,
14421
+ line: {
14422
+ strokeStyle: '#777777',
14423
+ lineWidth: 1,
14424
+ },
14316
14425
  },
14317
14426
  ChordSymbol: {
14318
14427
  fontSize: 12,
@@ -14356,6 +14465,7 @@ const MetricsDefaults = {
14356
14465
  },
14357
14466
  },
14358
14467
  Stave: {
14468
+ strokeStyle: '#999999',
14359
14469
  fontSize: 8,
14360
14470
  padding: 12,
14361
14471
  endPaddingMax: 10,
@@ -14373,6 +14483,9 @@ const MetricsDefaults = {
14373
14483
  StaveSection: {
14374
14484
  fontSize: 10,
14375
14485
  fontWeight: 'bold',
14486
+ lineWidth: 2,
14487
+ padding: 2,
14488
+ strokeStyle: 'black',
14376
14489
  },
14377
14490
  StaveTempo: {
14378
14491
  fontSize: 14,
@@ -14389,6 +14502,9 @@ const MetricsDefaults = {
14389
14502
  StaveTie: {
14390
14503
  fontSize: 10,
14391
14504
  },
14505
+ Stem: {
14506
+ strokeStyle: 'black',
14507
+ },
14392
14508
  StringNumber: {
14393
14509
  fontSize: 10,
14394
14510
  fontWeight: 'bold',
@@ -14415,6 +14531,7 @@ const MetricsDefaults = {
14415
14531
  fontWeight: 'bold',
14416
14532
  },
14417
14533
  TabStave: {
14534
+ strokeStyle: '#999999',
14418
14535
  fontSize: 8,
14419
14536
  },
14420
14537
  TabTie: {
@@ -14432,6 +14549,10 @@ const MetricsDefaults = {
14432
14549
  Tremolo: {
14433
14550
  spacing: 7,
14434
14551
  },
14552
+ Tuplet: {
14553
+ yOffset: 0,
14554
+ textYOffset: 2,
14555
+ },
14435
14556
  Volta: {
14436
14557
  fontSize: 9,
14437
14558
  fontWeight: 'bold',
@@ -14617,12 +14738,14 @@ class Modifier extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
14617
14738
  throw new _util__WEBPACK_IMPORTED_MODULE_2__.RuntimeError('NotImplemented', 'draw() not implemented for this modifier.');
14618
14739
  }
14619
14740
  // aligns sub notes of NoteSubGroup (or GraceNoteGroup) to the main note with correct x-offset
14620
- alignSubNotesWithNote(subNotes, note) {
14741
+ alignSubNotesWithNote(subNotes, note, position = Modifier.Position.LEFT) {
14621
14742
  // Shift over the tick contexts of each note
14622
14743
  const tickContext = note.getTickContext();
14623
14744
  const metrics = tickContext.getMetrics();
14624
14745
  const stave = note.getStave();
14625
- const subNoteXOffset = tickContext.getX() - metrics.modLeftPx - metrics.modRightPx + this.getSpacingFromNextModifier();
14746
+ const subNoteXOffset = position === Modifier.Position.RIGHT
14747
+ ? tickContext.getX() + this.getSpacingFromNextModifier() * subNotes.length + 10
14748
+ : tickContext.getX() - metrics.modLeftPx - metrics.modRightPx + this.getSpacingFromNextModifier();
14626
14749
  subNotes.forEach((subNote) => {
14627
14750
  const subTickContext = subNote.getTickContext();
14628
14751
  if (stave)
@@ -15925,6 +16048,7 @@ class NoteHead extends _note__WEBPACK_IMPORTED_MODULE_0__.Note {
15925
16048
  return _typeguard__WEBPACK_IMPORTED_MODULE_2__.Category.NoteHead;
15926
16049
  }
15927
16050
  constructor(noteStruct) {
16051
+ var _a;
15928
16052
  super(noteStruct);
15929
16053
  this.customGlyph = false;
15930
16054
  // map notehead SMuFL codes to the corresponding SMuFL code with ledger line
@@ -15953,7 +16077,7 @@ class NoteHead extends _note__WEBPACK_IMPORTED_MODULE_0__.Note {
15953
16077
  this.customGlyph = true;
15954
16078
  this.text = noteStruct.customGlyphCode;
15955
16079
  }
15956
- this.setStyle(noteStruct.style);
16080
+ this.setStyle((_a = noteStruct.style) !== null && _a !== void 0 ? _a : {});
15957
16081
  this.slashed = noteStruct.slashed || false;
15958
16082
  this.renderOptions = Object.assign({}, this.renderOptions);
15959
16083
  }
@@ -16004,11 +16128,15 @@ class NoteHead extends _note__WEBPACK_IMPORTED_MODULE_0__.Note {
16004
16128
  }
16005
16129
  /** Draw the notehead. */
16006
16130
  draw() {
16131
+ var _a;
16007
16132
  const ctx = this.checkContext();
16008
16133
  this.setRendered();
16134
+ ctx.openGroup('notehead', this.getAttribute('id'));
16009
16135
  L("Drawing note head '", this.noteType, this.duration, "' at", this.x, this.y);
16010
16136
  this.x = this.getAbsoluteX();
16011
16137
  this.renderText(ctx, 0, 0);
16138
+ (_a = this.parent) === null || _a === void 0 ? void 0 : _a.drawModifiers(this);
16139
+ ctx.closeGroup();
16012
16140
  }
16013
16141
  }
16014
16142
  /** To enable logging for this class. Set `VexFlow.NoteHead.DEBUG` to `true`. */
@@ -16309,7 +16437,6 @@ class Ornament extends _modifier__WEBPACK_IMPORTED_MODULE_3__.Modifier {
16309
16437
  const note = this.checkAttachedNote();
16310
16438
  this.setRendered();
16311
16439
  const stave = note.checkStave();
16312
- this.applyStyle();
16313
16440
  ctx.openGroup('ornament', this.getAttribute('id'));
16314
16441
  // Get initial coordinates for the modifier position
16315
16442
  const start = note.getModifierStartXY(this.position, this.index);
@@ -16365,7 +16492,6 @@ class Ornament extends _modifier__WEBPACK_IMPORTED_MODULE_3__.Modifier {
16365
16492
  this.accidentalUpper.renderText(ctx, glyphX + this.xShift - this.accidentalUpper.getWidth() * 0.5, glyphY + this.yShift - this.accidentalUpper.getTextMetrics().actualBoundingBoxDescent);
16366
16493
  }
16367
16494
  ctx.closeGroup();
16368
- this.restoreStyle();
16369
16495
  }
16370
16496
  }
16371
16497
  /** To enable logging for this class. Set `VexFlow.Ornament.DEBUG` to `true`. */
@@ -16705,9 +16831,8 @@ __webpack_require__.r(__webpack_exports__);
16705
16831
  /* harmony import */ var _element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./element */ "./src/element.ts");
16706
16832
  /* harmony import */ var _glyphs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./glyphs */ "./src/glyphs.ts");
16707
16833
  /* harmony import */ var _metrics__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./metrics */ "./src/metrics.ts");
16708
- /* harmony import */ var _tables__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./tables */ "./src/tables.ts");
16709
- /* harmony import */ var _typeguard__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./typeguard */ "./src/typeguard.ts");
16710
- /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./util */ "./src/util.ts");
16834
+ /* harmony import */ var _typeguard__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./typeguard */ "./src/typeguard.ts");
16835
+ /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./util */ "./src/util.ts");
16711
16836
  // Copyright (c) 2023-present VexFlow contributors: https://github.com/vexflow/vexflow/graphs/contributors
16712
16837
  // MIT License
16713
16838
 
@@ -16715,22 +16840,10 @@ __webpack_require__.r(__webpack_exports__);
16715
16840
 
16716
16841
 
16717
16842
 
16718
-
16719
16843
  // eslint-disable-next-line
16720
16844
  function L(...args) {
16721
16845
  if (PedalMarking.DEBUG)
16722
- (0,_util__WEBPACK_IMPORTED_MODULE_5__.log)('VexFlow.PedalMarking', args);
16723
- }
16724
- /**
16725
- * Draws a pedal glyph with the provided `name` on a rendering `context`
16726
- * at the coordinates `x` and `y. Takes into account the glyph data
16727
- * coordinate shifts.
16728
- */
16729
- function drawPedalGlyph(name, ctx, x, y) {
16730
- var _a;
16731
- const glyph = new _element__WEBPACK_IMPORTED_MODULE_0__.Element(PedalMarking.CATEGORY);
16732
- glyph.setText((_a = PedalMarking.GLYPHS[name]) !== null && _a !== void 0 ? _a : name);
16733
- glyph.renderText(ctx, x - (glyph.getWidth() - _tables__WEBPACK_IMPORTED_MODULE_3__.Tables.STAVE_LINE_DISTANCE) / 2, y);
16846
+ (0,_util__WEBPACK_IMPORTED_MODULE_4__.log)('VexFlow.PedalMarking', args);
16734
16847
  }
16735
16848
  /**
16736
16849
  * PedalMarking implements different types of pedal markings. These notation
@@ -16741,7 +16854,7 @@ function drawPedalGlyph(name, ctx, x, y) {
16741
16854
  */
16742
16855
  class PedalMarking extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
16743
16856
  static get CATEGORY() {
16744
- return _typeguard__WEBPACK_IMPORTED_MODULE_4__.Category.PedalMarking;
16857
+ return _typeguard__WEBPACK_IMPORTED_MODULE_3__.Category.PedalMarking;
16745
16858
  }
16746
16859
  /**
16747
16860
  * Create a sustain pedal marking. Returns the defaults PedalMarking.
@@ -16770,9 +16883,9 @@ class PedalMarking extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
16770
16883
  this.notes = notes;
16771
16884
  this.type = PedalMarking.type.TEXT;
16772
16885
  this.line = 0;
16773
- // Custom text for the release/depress markings
16774
- this.customDepressText = '';
16775
- this.customReleaseText = '';
16886
+ // Text for the release/depress markings
16887
+ this.depressText = PedalMarking.GLYPHS.pedalDepress;
16888
+ this.releaseText = PedalMarking.GLYPHS.pedalRelease;
16776
16889
  this.renderOptions = {
16777
16890
  bracketHeight: 10,
16778
16891
  textMarginRight: 6,
@@ -16793,8 +16906,9 @@ class PedalMarking extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
16793
16906
  * set if the parameter is falsy.
16794
16907
  */
16795
16908
  setCustomText(depress, release) {
16796
- this.customDepressText = depress || '';
16797
- this.customReleaseText = release || '';
16909
+ this.depressText = depress || '';
16910
+ this.releaseText = release || '';
16911
+ this.setFont(_metrics__WEBPACK_IMPORTED_MODULE_2__.Metrics.getFontInfo('PedalMarking.text'));
16798
16912
  return this;
16799
16913
  }
16800
16914
  /** Set the staff line to render the markings on. */
@@ -16808,8 +16922,10 @@ class PedalMarking extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
16808
16922
  let isPedalDepressed = false;
16809
16923
  let prevX;
16810
16924
  let prevY;
16925
+ let textWidth = 0;
16811
16926
  // Iterate through each note
16812
16927
  this.notes.forEach((note, index, notes) => {
16928
+ var _a, _b, _c, _d;
16813
16929
  // Each note triggers the opposite pedal action
16814
16930
  isPedalDepressed = !isPedalDepressed;
16815
16931
  // Get the initial coordinates for the note
@@ -16817,7 +16933,7 @@ class PedalMarking extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
16817
16933
  const y = note.checkStave().getYForBottomText(this.line + 3);
16818
16934
  // Throw if current note is positioned before the previous note
16819
16935
  if (x < prevX) {
16820
- throw new _util__WEBPACK_IMPORTED_MODULE_5__.RuntimeError('InvalidConfiguration', 'The notes provided must be in order of ascending x positions');
16936
+ throw new _util__WEBPACK_IMPORTED_MODULE_4__.RuntimeError('InvalidConfiguration', 'The notes provided must be in order of ascending x positions');
16821
16937
  }
16822
16938
  // Determine if the previous or next note are the same
16823
16939
  // as the current note. We need to keep track of this for
@@ -16830,17 +16946,10 @@ class PedalMarking extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
16830
16946
  xShift = prevNoteIsSame ? 5 : 0;
16831
16947
  if (this.type === PedalMarking.type.MIXED && !prevNoteIsSame) {
16832
16948
  // For MIXED style, start with text instead of bracket
16833
- if (this.customDepressText) {
16834
- // If we have custom text, use instead of the default "Ped" glyph
16835
- const textWidth = ctx.measureText(this.customDepressText).width;
16836
- ctx.fillText(this.customDepressText, x - textWidth / 2, y);
16837
- xShift = textWidth / 2 + this.renderOptions.textMarginRight;
16838
- }
16839
- else {
16840
- // Render the Ped glyph in position
16841
- drawPedalGlyph('pedalDepress', ctx, x, y);
16842
- xShift = 20 + this.renderOptions.textMarginRight;
16843
- }
16949
+ textWidth = ctx.measureText(this.depressText).width;
16950
+ ctx.fillText(this.depressText, x, y);
16951
+ // Adjust the xShift for the next note
16952
+ xShift = textWidth + this.renderOptions.textMarginRight;
16844
16953
  }
16845
16954
  else {
16846
16955
  // Draw start bracket
@@ -16852,13 +16961,21 @@ class PedalMarking extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
16852
16961
  }
16853
16962
  }
16854
16963
  else {
16855
- // Adjustment for release+depress
16856
- xShift = nextNoteIsSame ? -5 : 0;
16964
+ // Get the current note index and the total notes in the associated voice
16965
+ const noteNdx = note.getVoice().getTickables().indexOf(note);
16966
+ const voiceNotes = note.getVoice().getTickables().length;
16967
+ // Get the absolute x position of the end of the current note
16968
+ const noteEndX = noteNdx + 1 < voiceNotes
16969
+ ? // If the next note is in the same voice, use the x position of the next note
16970
+ note.getVoice().getTickables()[noteNdx + 1].getAbsoluteX()
16971
+ : // If this is the last note is the voice, use the x position of the next stave
16972
+ ((_b = (_a = note.getStave()) === null || _a === void 0 ? void 0 : _a.getX()) !== null && _b !== void 0 ? _b : 0) + ((_d = (_c = note.getStave()) === null || _c === void 0 ? void 0 : _c.getWidth()) !== null && _d !== void 0 ? _d : 0);
16857
16973
  // Draw end bracket
16858
16974
  ctx.beginPath();
16859
16975
  ctx.moveTo(prevX, prevY);
16860
- ctx.lineTo(x + xShift, y);
16861
- ctx.lineTo(x, y - this.renderOptions.bracketHeight);
16976
+ ctx.lineTo(nextNoteIsSame ? x - 5 : noteEndX - 5, y);
16977
+ // No shift if next note is the same
16978
+ ctx.lineTo(nextNoteIsSame ? x : noteEndX - 5, y - this.renderOptions.bracketHeight);
16862
16979
  ctx.stroke();
16863
16980
  ctx.closePath();
16864
16981
  }
@@ -16874,30 +16991,29 @@ class PedalMarking extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
16874
16991
  drawText() {
16875
16992
  const ctx = this.checkContext();
16876
16993
  let isPedalDepressed = false;
16994
+ let textWidth = 0;
16877
16995
  // Iterate through each note, placing glyphs or custom text accordingly
16878
16996
  this.notes.forEach((note) => {
16997
+ var _a, _b, _c, _d;
16879
16998
  isPedalDepressed = !isPedalDepressed;
16880
16999
  const stave = note.checkStave();
16881
17000
  const x = note.getAbsoluteX();
16882
17001
  const y = stave.getYForBottomText(this.line + 3);
16883
- let textWidth = 0;
16884
17002
  if (isPedalDepressed) {
16885
- if (this.customDepressText) {
16886
- textWidth = ctx.measureText(this.customDepressText).width;
16887
- ctx.fillText(this.customDepressText, x - textWidth / 2, y);
16888
- }
16889
- else {
16890
- drawPedalGlyph('pedalDepress', ctx, x, y);
16891
- }
17003
+ textWidth = ctx.measureText(this.depressText).width;
17004
+ ctx.fillText(this.depressText, x, y);
16892
17005
  }
16893
17006
  else {
16894
- if (this.customReleaseText) {
16895
- textWidth = ctx.measureText(this.customReleaseText).width;
16896
- ctx.fillText(this.customReleaseText, x - textWidth / 2, y);
16897
- }
16898
- else {
16899
- drawPedalGlyph('pedalRelease', ctx, x, y);
16900
- }
17007
+ const noteNdx = note.getVoice().getTickables().indexOf(note);
17008
+ const voiceNotes = note.getVoice().getTickables().length;
17009
+ // Get the shift for the next note
17010
+ const noteEndX = noteNdx + 1 < voiceNotes
17011
+ ? // If the next note is in the same voice, use the x position of the next note
17012
+ note.getVoice().getTickables()[noteNdx + 1].getAbsoluteX()
17013
+ : // If this is the last note is the voice, use the x position of the next stave
17014
+ ((_b = (_a = note.getStave()) === null || _a === void 0 ? void 0 : _a.getX()) !== null && _b !== void 0 ? _b : 0) + ((_d = (_c = note.getStave()) === null || _c === void 0 ? void 0 : _c.getWidth()) !== null && _d !== void 0 ? _d : 0);
17015
+ textWidth = ctx.measureText(this.releaseText).width;
17016
+ ctx.fillText(this.releaseText, noteEndX - textWidth, y);
16901
17017
  }
16902
17018
  });
16903
17019
  }
@@ -16905,10 +17021,9 @@ class PedalMarking extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
16905
17021
  draw() {
16906
17022
  const ctx = this.checkContext();
16907
17023
  this.setRendered();
16908
- ctx.save();
16909
17024
  ctx.setStrokeStyle(this.renderOptions.color);
16910
17025
  ctx.setFillStyle(this.renderOptions.color);
16911
- ctx.setFont(_metrics__WEBPACK_IMPORTED_MODULE_2__.Metrics.getFontInfo('PedalMarking.text'));
17026
+ ctx.setFont(this.font);
16912
17027
  L('Rendering Pedal Marking');
16913
17028
  if (this.type === PedalMarking.type.BRACKET || this.type === PedalMarking.type.MIXED) {
16914
17029
  ctx.setLineWidth(this.renderOptions.bracketLineWidth);
@@ -16917,7 +17032,6 @@ class PedalMarking extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
16917
17032
  else if (this.type === PedalMarking.type.TEXT) {
16918
17033
  this.drawText();
16919
17034
  }
16920
- ctx.restore();
16921
17035
  }
16922
17036
  }
16923
17037
  /** To enable logging for this class. Set `VexFlow.PedalMarking.DEBUG` to `true`. */
@@ -17391,9 +17505,9 @@ class Stave extends _element__WEBPACK_IMPORTED_MODULE_2__.Element {
17391
17505
  this.measure = 0;
17392
17506
  this.clef = 'treble';
17393
17507
  this.endClef = undefined;
17394
- this.options = Object.assign({ verticalBarWidth: 10, numLines: 5, fillStyle: '#999999', leftBar: true, rightBar: true, spacingBetweenLinesPx: _tables__WEBPACK_IMPORTED_MODULE_12__.Tables.STAVE_LINE_DISTANCE, spaceAboveStaffLn: 4, spaceBelowStaffLn: 4, topTextPosition: 1, bottomTextPosition: 4, lineConfig: [] }, options);
17508
+ this.options = Object.assign({ verticalBarWidth: 10, numLines: 5, leftBar: true, rightBar: true, spacingBetweenLinesPx: _tables__WEBPACK_IMPORTED_MODULE_12__.Tables.STAVE_LINE_DISTANCE, spaceAboveStaffLn: 4, spaceBelowStaffLn: 4, topTextPosition: 1, bottomTextPosition: 4, lineConfig: [] }, options);
17395
17509
  this.bounds = { x: this.x, y: this.y, w: this.width, h: 0 };
17396
- this.defaultLedgerLineStyle = { strokeStyle: '#444', lineWidth: 1.4 };
17510
+ this.defaultLedgerLineStyle = { strokeStyle: '#444', lineWidth: 2 };
17397
17511
  this.resetLines();
17398
17512
  // beg bar
17399
17513
  this.addModifier(new _stavebarline__WEBPACK_IMPORTED_MODULE_5__.Barline(this.options.leftBar ? _stavebarline__WEBPACK_IMPORTED_MODULE_5__.BarlineType.SINGLE : _stavebarline__WEBPACK_IMPORTED_MODULE_5__.BarlineType.NONE));
@@ -17450,10 +17564,11 @@ class Stave extends _element__WEBPACK_IMPORTED_MODULE_2__.Element {
17450
17564
  return this;
17451
17565
  }
17452
17566
  getTopLineTopY() {
17453
- return this.getYForLine(0) - _tables__WEBPACK_IMPORTED_MODULE_12__.Tables.STAVE_LINE_THICKNESS / 2;
17567
+ return this.getYForLine(0);
17454
17568
  }
17455
17569
  getBottomLineBottomY() {
17456
- return this.getYForLine(this.getNumLines() - 1) + _tables__WEBPACK_IMPORTED_MODULE_12__.Tables.STAVE_LINE_THICKNESS / 2;
17570
+ var _a;
17571
+ return this.getYForLine(this.getNumLines() - 1) + ((_a = this.getStyle().lineWidth) !== null && _a !== void 0 ? _a : 1);
17457
17572
  }
17458
17573
  setX(x) {
17459
17574
  const shift = x - this.x;
@@ -17475,9 +17590,6 @@ class Stave extends _element__WEBPACK_IMPORTED_MODULE_2__.Element {
17475
17590
  // this.modifiers[1].setX(this.endX);
17476
17591
  return this;
17477
17592
  }
17478
- getStyle() {
17479
- return Object.assign({ fillStyle: this.options.fillStyle, strokeStyle: this.options.fillStyle, lineWidth: _tables__WEBPACK_IMPORTED_MODULE_12__.Tables.STAVE_LINE_THICKNESS }, super.getStyle());
17480
- }
17481
17593
  /**
17482
17594
  * Set the measure number of this Stave.
17483
17595
  */
@@ -17529,11 +17641,11 @@ class Stave extends _element__WEBPACK_IMPORTED_MODULE_2__.Element {
17529
17641
  }
17530
17642
  // Section functions
17531
17643
  setSection(section, y, xOffset = 0, fontSize, drawRect = true) {
17532
- const staveSection = new _stavesection__WEBPACK_IMPORTED_MODULE_8__.StaveSection(section, this.x + xOffset, y, drawRect);
17644
+ const staveSection = new _stavesection__WEBPACK_IMPORTED_MODULE_8__.StaveSection(section).setYShift(y).setXShift(xOffset).setDrawRect(drawRect);
17533
17645
  if (fontSize) {
17534
17646
  staveSection.setFontSize(fontSize);
17535
17647
  }
17536
- this.modifiers.push(staveSection);
17648
+ this.addModifier(staveSection);
17537
17649
  return this;
17538
17650
  }
17539
17651
  // Tempo functions
@@ -17875,9 +17987,9 @@ class Stave extends _element__WEBPACK_IMPORTED_MODULE_2__.Element {
17875
17987
  * All drawing functions below need the context to be set.
17876
17988
  */
17877
17989
  draw() {
17990
+ var _a;
17878
17991
  const ctx = this.checkContext();
17879
17992
  this.setRendered();
17880
- this.applyStyle();
17881
17993
  ctx.openGroup('stave', this.getAttribute('id'));
17882
17994
  if (!this.formatted)
17883
17995
  this.format();
@@ -17885,35 +17997,33 @@ class Stave extends _element__WEBPACK_IMPORTED_MODULE_2__.Element {
17885
17997
  const width = this.width;
17886
17998
  const x = this.x;
17887
17999
  let y;
18000
+ const lineWidth = (_a = this.getStyle().lineWidth) !== null && _a !== void 0 ? _a : 1;
18001
+ const lineWidthCorrection = lineWidth % 2 === 0 ? 0 : 0.5;
17888
18002
  // Render lines
17889
18003
  for (let line = 0; line < numLines; line++) {
17890
18004
  y = this.getYForLine(line);
17891
18005
  if (this.options.lineConfig[line].visible) {
17892
18006
  ctx.beginPath();
17893
- ctx.moveTo(x, y);
17894
- ctx.lineTo(x + width, y);
18007
+ ctx.moveTo(x, y + lineWidthCorrection);
18008
+ ctx.lineTo(x + width, y + lineWidthCorrection);
17895
18009
  ctx.stroke();
17896
18010
  }
17897
18011
  }
17898
18012
  ctx.closeGroup();
17899
- this.restoreStyle();
17900
18013
  // Draw the modifiers (bar lines, coda, segno, repeat brackets, etc.)
17901
18014
  for (let i = 0; i < this.modifiers.length; i++) {
17902
18015
  const modifier = this.modifiers[i];
17903
- modifier.applyStyle(ctx);
17904
- modifier.draw(this, this.getModifierXShift(i));
17905
- modifier.restoreStyle(ctx);
18016
+ modifier.setContext(ctx);
18017
+ modifier.setStave(this);
18018
+ modifier.drawWithStyle();
17906
18019
  }
17907
18020
  // Render measure numbers
17908
18021
  if (this.measure > 0) {
17909
- ctx.save();
17910
18022
  ctx.setFont(this.fontInfo);
17911
18023
  const textWidth = ctx.measureText('' + this.measure).width;
17912
18024
  y = this.getYForTopText(0) + 3;
17913
18025
  ctx.fillText('' + this.measure, this.x - textWidth / 2, y);
17914
- ctx.restore();
17915
18026
  }
17916
- return this;
17917
18027
  }
17918
18028
  getVerticalBarWidth() {
17919
18029
  return this.options.verticalBarWidth;
@@ -17960,7 +18070,6 @@ class Stave extends _element__WEBPACK_IMPORTED_MODULE_2__.Element {
17960
18070
  }
17961
18071
  // Make sure the defaults are present in case an incomplete set of
17962
18072
  // configuration options were supplied.
17963
- // eslint-disable-next-line
17964
18073
  for (const lineConfig in linesConfiguration) {
17965
18074
  // Allow '{}' to be used if the caller just wants the default for a particular node.
17966
18075
  if (linesConfiguration[lineConfig].visible === undefined) {
@@ -18171,10 +18280,10 @@ class Barline extends _stavemodifier__WEBPACK_IMPORTED_MODULE_0__.StaveModifier
18171
18280
  return this;
18172
18281
  }
18173
18282
  // Draw barlines
18174
- draw(stave) {
18283
+ draw() {
18284
+ const stave = this.checkStave();
18175
18285
  const ctx = stave.checkContext();
18176
18286
  this.setRendered();
18177
- this.applyStyle(ctx);
18178
18287
  ctx.openGroup('stavebarline', this.getAttribute('id'));
18179
18288
  switch (this.type) {
18180
18289
  case BarlineType.SINGLE:
@@ -18206,7 +18315,6 @@ class Barline extends _stavemodifier__WEBPACK_IMPORTED_MODULE_0__.StaveModifier
18206
18315
  break;
18207
18316
  }
18208
18317
  ctx.closeGroup();
18209
- this.restoreStyle(ctx);
18210
18318
  }
18211
18319
  drawVerticalBar(stave, x, doubleBar) {
18212
18320
  const staveCtx = stave.checkContext();
@@ -18567,7 +18675,7 @@ class StaveHairpin extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
18567
18675
  .setContext(ctx)
18568
18676
  .setRenderOptions(hairpinOptions)
18569
18677
  .setPosition(position)
18570
- .draw();
18678
+ .drawWithStyle();
18571
18679
  }
18572
18680
  /**
18573
18681
  * Create a new hairpin from the specified notes.
@@ -18880,7 +18988,6 @@ class StaveLine extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
18880
18988
  const firstNote = this.firstNote;
18881
18989
  const lastNote = this.lastNote;
18882
18990
  const renderOptions = this.renderOptions;
18883
- ctx.save();
18884
18991
  this.applyLineStyle();
18885
18992
  // Cycle through each set of indexes and draw lines
18886
18993
  let startPosition = { x: 0, y: 0 };
@@ -18910,7 +19017,6 @@ class StaveLine extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
18910
19017
  endPosition.y += upwardsSlope ? 2 : 0;
18911
19018
  this.drawArrowLine(ctx, startPosition, endPosition);
18912
19019
  });
18913
- ctx.restore();
18914
19020
  // Determine the x coordinate where to start the text
18915
19021
  const textWidth = this.width;
18916
19022
  const justification = renderOptions.textJustification;
@@ -18939,8 +19045,6 @@ class StaveLine extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
18939
19045
  const color = renderOptions.color;
18940
19046
  this.applyStyle(ctx, { fillStyle: color, strokeStyle: color });
18941
19047
  this.renderText(ctx, x, y);
18942
- this.restoreStyle(ctx);
18943
- return this;
18944
19048
  }
18945
19049
  }
18946
19050
  // Text Positioning
@@ -19027,10 +19131,6 @@ class StaveModifier extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
19027
19131
  getLayoutMetrics() {
19028
19132
  return this.layoutMetrics;
19029
19133
  }
19030
- // eslint-disable-next-line
19031
- draw(...args) {
19032
- // DO NOTHING.
19033
- }
19034
19134
  }
19035
19135
 
19036
19136
 
@@ -19432,7 +19532,7 @@ class StaveNote extends _stemmablenote__WEBPACK_IMPORTED_MODULE_7__.StemmableNot
19432
19532
  }
19433
19533
  // Builds a `Stem` for the note
19434
19534
  buildStem() {
19435
- this.setStem(new _stem__WEBPACK_IMPORTED_MODULE_6__.Stem({ hide: !!this.isRest() }));
19535
+ this.setStem(new _stem__WEBPACK_IMPORTED_MODULE_6__.Stem({ hide: this.isRest() }));
19436
19536
  return this;
19437
19537
  }
19438
19538
  // Builds a `NoteHead` for each key in the note
@@ -19487,7 +19587,7 @@ class StaveNote extends _stemmablenote__WEBPACK_IMPORTED_MODULE_7__.StemmableNot
19487
19587
  line: noteProps.line,
19488
19588
  });
19489
19589
  notehead.fontInfo = this.fontInfo;
19490
- this.addChildElement(notehead);
19590
+ this.addChild(notehead);
19491
19591
  this._noteHeads[this.sortedKeyProps[i].index] = notehead;
19492
19592
  }
19493
19593
  return this._noteHeads;
@@ -19532,7 +19632,8 @@ class StaveNote extends _stemmablenote__WEBPACK_IMPORTED_MODULE_7__.StemmableNot
19532
19632
  lastLine = line;
19533
19633
  }
19534
19634
  else {
19535
- if (Math.abs(lastLine - line) === 0.5) {
19635
+ // < 1 means == 0.5 (second) or 0.0 (unison)
19636
+ if (Math.abs(lastLine - line) < 1) {
19536
19637
  this.displaced = true;
19537
19638
  props.displaced = true;
19538
19639
  // Have to mark the previous note as
@@ -19559,18 +19660,16 @@ class StaveNote extends _stemmablenote__WEBPACK_IMPORTED_MODULE_7__.StemmableNot
19559
19660
  boundingBox.mergeWith(notehead.getBoundingBox());
19560
19661
  });
19561
19662
  const { yTop, yBottom } = this.getNoteHeadBounds();
19562
- // eslint-disable-next-line
19563
- const noteStemHeight = this.stem.getHeight();
19564
- const flagX = this.getStemX() - _tables__WEBPACK_IMPORTED_MODULE_8__.Tables.STEM_WIDTH / 2;
19565
- const flagY = this.getStemDirection() === _stem__WEBPACK_IMPORTED_MODULE_6__.Stem.DOWN
19566
- ? yTop - noteStemHeight - this.flag.getTextMetrics().actualBoundingBoxDescent
19567
- : yBottom - noteStemHeight + this.flag.getTextMetrics().actualBoundingBoxAscent;
19568
19663
  if (!this.isRest() && this.hasStem()) {
19569
- boundingBox.mergeWith(new _boundingbox__WEBPACK_IMPORTED_MODULE_0__.BoundingBox(this.getAbsoluteX(), flagY, 0, 0));
19664
+ const noteStemHeight = this.stem.getHeight();
19665
+ const stemY = this.getStemDirection() === _stem__WEBPACK_IMPORTED_MODULE_6__.Stem.DOWN
19666
+ ? yTop - noteStemHeight - this.flag.getTextMetrics().actualBoundingBoxDescent
19667
+ : yBottom - noteStemHeight + this.flag.getTextMetrics().actualBoundingBoxAscent;
19668
+ boundingBox.mergeWith(new _boundingbox__WEBPACK_IMPORTED_MODULE_0__.BoundingBox(this.getAbsoluteX(), stemY, 0, 0));
19570
19669
  }
19571
19670
  if (this.hasFlag()) {
19572
19671
  const bbFlag = this.flag.getBoundingBox();
19573
- boundingBox.mergeWith(bbFlag.move(flagX, flagY));
19672
+ boundingBox.mergeWith(bbFlag);
19574
19673
  }
19575
19674
  for (let i = 0; i < this.modifiers.length; i++) {
19576
19675
  boundingBox.mergeWith(this.modifiers[i].getBoundingBox());
@@ -19760,10 +19859,10 @@ class StaveNote extends _stemmablenote__WEBPACK_IMPORTED_MODULE_7__.StemmableNot
19760
19859
  return this.ledgerLineStyle;
19761
19860
  }
19762
19861
  setFlagStyle(style) {
19763
- this.flagStyle = style;
19862
+ this.flag.setStyle(style);
19764
19863
  }
19765
19864
  getFlagStyle() {
19766
- return this.flagStyle;
19865
+ return this.flag.getStyle();
19767
19866
  }
19768
19867
  /** Get the glyph width. */
19769
19868
  getGlyphWidth() {
@@ -19931,6 +20030,7 @@ class StaveNote extends _stemmablenote__WEBPACK_IMPORTED_MODULE_7__.StemmableNot
19931
20030
  ctx.stroke();
19932
20031
  };
19933
20032
  const style = Object.assign(Object.assign({}, stave.getDefaultLedgerLineStyle()), this.getLedgerLineStyle());
20033
+ ctx.save();
19934
20034
  this.applyStyle(ctx, style);
19935
20035
  // Draw ledger lines below the staff:
19936
20036
  for (let line = 6; line <= highestLine; ++line) {
@@ -19944,7 +20044,7 @@ class StaveNote extends _stemmablenote__WEBPACK_IMPORTED_MODULE_7__.StemmableNot
19944
20044
  const displaced = lowestDisplacedLine !== undefined && line >= lowestDisplacedLine;
19945
20045
  drawLedgerLine(stave.getYForNote(line), normal, displaced);
19946
20046
  }
19947
- this.restoreStyle(ctx, style);
20047
+ ctx.restore();
19948
20048
  }
19949
20049
  // Draw all key modifiers
19950
20050
  drawModifiers(noteheadParam) {
@@ -19954,11 +20054,8 @@ class StaveNote extends _stemmablenote__WEBPACK_IMPORTED_MODULE_7__.StemmableNot
19954
20054
  const index = modifier.checkIndex();
19955
20055
  const notehead = this._noteHeads[index];
19956
20056
  if (notehead === noteheadParam) {
19957
- const noteheadStyle = notehead.getStyle();
19958
- notehead.applyStyle(ctx, noteheadStyle);
19959
20057
  modifier.setContext(ctx);
19960
20058
  modifier.drawWithStyle();
19961
- notehead.restoreStyle(ctx, noteheadStyle);
19962
20059
  }
19963
20060
  }
19964
20061
  }
@@ -19976,7 +20073,6 @@ class StaveNote extends _stemmablenote__WEBPACK_IMPORTED_MODULE_7__.StemmableNot
19976
20073
  }
19977
20074
  if (this.shouldDrawFlag()) {
19978
20075
  const { yTop, yBottom } = this.getNoteHeadBounds();
19979
- // eslint-disable-next-line
19980
20076
  const noteStemHeight = this.stem.getHeight();
19981
20077
  const flagX = this.getStemX() - _tables__WEBPACK_IMPORTED_MODULE_8__.Tables.STEM_WIDTH / 2;
19982
20078
  const flagY = this.getStemDirection() === _stem__WEBPACK_IMPORTED_MODULE_6__.Stem.DOWN
@@ -19985,21 +20081,14 @@ class StaveNote extends _stemmablenote__WEBPACK_IMPORTED_MODULE_7__.StemmableNot
19985
20081
  : // Up stems are above the note head and have flags on the right.
19986
20082
  yBottom - noteStemHeight + this.flag.getTextMetrics().actualBoundingBoxAscent;
19987
20083
  // Draw the Flag
19988
- this.applyStyle(ctx, this.flagStyle);
19989
- this.flag.renderText(ctx, flagX, flagY);
19990
- this.restoreStyle(ctx, this.flagStyle);
20084
+ this.flag.setContext(ctx).setX(flagX).setY(flagY).drawWithStyle();
19991
20085
  }
19992
20086
  }
19993
20087
  // Draw the NoteHeads
19994
20088
  drawNoteHeads() {
19995
20089
  const ctx = this.checkContext();
19996
20090
  this._noteHeads.forEach((notehead) => {
19997
- notehead.applyStyle(ctx);
19998
- ctx.openGroup('notehead', notehead.getAttribute('id'));
19999
- notehead.setContext(ctx).draw();
20000
- this.drawModifiers(notehead);
20001
- ctx.closeGroup();
20002
- notehead.restoreStyle(ctx);
20091
+ notehead.setContext(ctx).drawWithStyle();
20003
20092
  });
20004
20093
  }
20005
20094
  drawStem(stemOptions) {
@@ -20016,7 +20105,7 @@ class StaveNote extends _stemmablenote__WEBPACK_IMPORTED_MODULE_7__.StemmableNot
20016
20105
  this.stem.adjustHeightForFlag();
20017
20106
  }
20018
20107
  if (this.stem) {
20019
- this.stem.setContext(ctx).draw();
20108
+ this.stem.setContext(ctx).drawWithStyle();
20020
20109
  }
20021
20110
  }
20022
20111
  /**
@@ -20077,7 +20166,6 @@ class StaveNote extends _stemmablenote__WEBPACK_IMPORTED_MODULE_7__.StemmableNot
20077
20166
  }
20078
20167
  L('Rendering ', this.isChord() ? 'chord :' : 'note :', this.keys);
20079
20168
  // Apply the overall style -- may be contradicted by local settings:
20080
- this.applyStyle();
20081
20169
  ctx.openGroup('stavenote', this.getAttribute('id'));
20082
20170
  this.drawLedgerLines();
20083
20171
  if (shouldRenderStem)
@@ -20087,7 +20175,6 @@ class StaveNote extends _stemmablenote__WEBPACK_IMPORTED_MODULE_7__.StemmableNot
20087
20175
  const bb = this.getBoundingBox();
20088
20176
  ctx.pointerRect(bb.getX(), bb.getY(), bb.getW(), bb.getH());
20089
20177
  ctx.closeGroup();
20090
- this.restoreStyle();
20091
20178
  this.setRendered();
20092
20179
  }
20093
20180
  }
@@ -20135,7 +20222,9 @@ class Repetition extends _stavemodifier__WEBPACK_IMPORTED_MODULE_2__.StaveModifi
20135
20222
  this.yShift = y;
20136
20223
  return this;
20137
20224
  }
20138
- draw(stave, x) {
20225
+ draw() {
20226
+ const stave = this.checkStave();
20227
+ const x = stave.getModifierXShift(this.getPosition());
20139
20228
  this.setRendered();
20140
20229
  switch (this.symbolType) {
20141
20230
  case Repetition.type.CODA_RIGHT:
@@ -20177,7 +20266,6 @@ class Repetition extends _stavemodifier__WEBPACK_IMPORTED_MODULE_2__.StaveModifi
20177
20266
  default:
20178
20267
  break;
20179
20268
  }
20180
- return this;
20181
20269
  }
20182
20270
  drawCodaFixed(stave, x) {
20183
20271
  const y = stave.getYForTopText(stave.getNumLines());
@@ -20249,48 +20337,47 @@ __webpack_require__.r(__webpack_exports__);
20249
20337
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
20250
20338
  /* harmony export */ StaveSection: () => (/* binding */ StaveSection)
20251
20339
  /* harmony export */ });
20252
- /* harmony import */ var _stavemodifier__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./stavemodifier */ "./src/stavemodifier.ts");
20253
- /* harmony import */ var _typeguard__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./typeguard */ "./src/typeguard.ts");
20340
+ /* harmony import */ var _metrics__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./metrics */ "./src/metrics.ts");
20341
+ /* harmony import */ var _stavemodifier__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./stavemodifier */ "./src/stavemodifier.ts");
20342
+ /* harmony import */ var _typeguard__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./typeguard */ "./src/typeguard.ts");
20254
20343
  // Copyright (c) 2023-present VexFlow contributors: https://github.com/vexflow/vexflow/graphs/contributors
20255
20344
  // @author: Larry Kuhns 2011
20256
20345
 
20257
20346
 
20258
- class StaveSection extends _stavemodifier__WEBPACK_IMPORTED_MODULE_0__.StaveModifier {
20347
+
20348
+ class StaveSection extends _stavemodifier__WEBPACK_IMPORTED_MODULE_1__.StaveModifier {
20259
20349
  static get CATEGORY() {
20260
- return _typeguard__WEBPACK_IMPORTED_MODULE_1__.Category.StaveSection;
20350
+ return _typeguard__WEBPACK_IMPORTED_MODULE_2__.Category.StaveSection;
20261
20351
  }
20262
- constructor(section, x, yShift, drawRect = true) {
20352
+ constructor(section, x = 0, yShift = 0, drawRect = true) {
20263
20353
  super();
20264
- this.setStaveSection(section);
20354
+ this.setText(section);
20265
20355
  this.x = x;
20266
20356
  this.yShift = yShift;
20267
20357
  this.drawRect = drawRect;
20358
+ this.padding = _metrics__WEBPACK_IMPORTED_MODULE_0__.Metrics.get('StaveSection.padding');
20268
20359
  }
20269
- setStaveSection(section) {
20270
- this.text = section;
20360
+ setDrawRect(drawRect) {
20361
+ this.drawRect = drawRect;
20271
20362
  return this;
20272
20363
  }
20273
- draw(stave, xShift) {
20274
- const borderWidth = 2;
20275
- const padding = 2;
20364
+ draw() {
20365
+ const stave = this.checkStave();
20276
20366
  const ctx = stave.checkContext();
20277
20367
  this.setRendered();
20278
- ctx.save();
20279
- ctx.setLineWidth(borderWidth);
20368
+ this.x = stave.getX() + stave.getModifierXShift(this.getPosition());
20280
20369
  const headroom = -1 * this.textMetrics.actualBoundingBoxDescent;
20281
- const width = this.width + 2 * padding; // add left & right padding
20282
- const height = this.height + 2 * padding; // add top & bottom padding
20370
+ const width = this.width + 2 * this.padding; // add left & right padding
20371
+ const height = this.height + 2 * this.padding; // add top & bottom padding
20283
20372
  // Seems to be a good default y
20284
20373
  const y = stave.getYForTopText(1.5) + this.yShift;
20285
- const x = this.x + xShift;
20374
+ const x = this.x + this.xShift;
20286
20375
  if (this.drawRect) {
20287
20376
  ctx.beginPath();
20288
20377
  ctx.rect(x, y - height + headroom, width, height);
20289
20378
  ctx.stroke();
20290
20379
  }
20291
- this.renderText(ctx, xShift + padding, y - padding);
20292
- ctx.restore();
20293
- return this;
20380
+ this.renderText(ctx, this.xShift + this.padding, y - this.padding);
20294
20381
  }
20295
20382
  }
20296
20383
 
@@ -20366,7 +20453,9 @@ class StaveTempo extends _stavemodifier__WEBPACK_IMPORTED_MODULE_3__.StaveModifi
20366
20453
  this.tempo = tempo;
20367
20454
  return this;
20368
20455
  }
20369
- draw(stave, shiftX) {
20456
+ draw() {
20457
+ const stave = this.checkStave();
20458
+ const shiftX = stave.getModifierXShift(this.getPosition());
20370
20459
  const ctx = stave.checkContext();
20371
20460
  this.setRendered();
20372
20461
  const { name, duration, dots, bpm, duration2, dots2, parenthesis } = this.tempo;
@@ -20423,7 +20512,6 @@ class StaveTempo extends _stavemodifier__WEBPACK_IMPORTED_MODULE_3__.StaveModifi
20423
20512
  elText.renderText(ctx, x + this.xShift, y + this.yShift);
20424
20513
  }
20425
20514
  }
20426
- return this;
20427
20515
  }
20428
20516
  }
20429
20517
 
@@ -20463,7 +20551,8 @@ class StaveText extends _stavemodifier__WEBPACK_IMPORTED_MODULE_0__.StaveModifie
20463
20551
  this.position = position;
20464
20552
  this.justification = (_c = options.justification) !== null && _c !== void 0 ? _c : _textnote__WEBPACK_IMPORTED_MODULE_1__.TextNote.Justification.CENTER;
20465
20553
  }
20466
- draw(stave) {
20554
+ draw() {
20555
+ const stave = this.checkStave();
20467
20556
  const ctx = stave.checkContext();
20468
20557
  this.setRendered();
20469
20558
  let x;
@@ -20499,7 +20588,6 @@ class StaveText extends _stavemodifier__WEBPACK_IMPORTED_MODULE_0__.StaveModifie
20499
20588
  throw new _util__WEBPACK_IMPORTED_MODULE_3__.RuntimeError('InvalidPosition', 'Value Must be in Modifier.Position.');
20500
20589
  }
20501
20590
  this.renderText(ctx, x, y + 4);
20502
- return this;
20503
20591
  }
20504
20592
  }
20505
20593
 
@@ -20629,11 +20717,8 @@ class StaveTie extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
20629
20717
  const yShift = this.renderOptions.yShift * params.direction;
20630
20718
  // setNotes(...) verified that firstIndexes and lastIndexes are not undefined.
20631
20719
  // As a result, we use the ! non-null assertion operator here.
20632
- // eslint-disable-next-line
20633
20720
  const firstIndexes = this.notes.firstIndexes;
20634
- // eslint-disable-next-line
20635
20721
  const lastIndexes = this.notes.lastIndexes;
20636
- this.applyStyle();
20637
20722
  ctx.openGroup('stavetie', this.getAttribute('id'));
20638
20723
  for (let i = 0; i < firstIndexes.length; ++i) {
20639
20724
  const cpX = (params.lastX + lastXShift + (params.firstX + firstXShift)) / 2;
@@ -20653,7 +20738,6 @@ class StaveTie extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
20653
20738
  ctx.fill();
20654
20739
  }
20655
20740
  ctx.closeGroup();
20656
- this.restoreStyle();
20657
20741
  }
20658
20742
  /**
20659
20743
  * @param firstX specified in pixels
@@ -20666,10 +20750,8 @@ class StaveTie extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
20666
20750
  centerX -= ctx.measureText(this.text).width / 2;
20667
20751
  const stave = (_b = (_a = this.notes.firstNote) === null || _a === void 0 ? void 0 : _a.checkStave()) !== null && _b !== void 0 ? _b : (_c = this.notes.lastNote) === null || _c === void 0 ? void 0 : _c.checkStave();
20668
20752
  if (stave) {
20669
- ctx.save();
20670
20753
  ctx.setFont(this.fontInfo);
20671
20754
  ctx.fillText(this.text, centerX + this.renderOptions.textShiftX, stave.getYForTopText() - 1);
20672
- ctx.restore();
20673
20755
  }
20674
20756
  }
20675
20757
  /**
@@ -20821,7 +20903,9 @@ class Volta extends _stavemodifier__WEBPACK_IMPORTED_MODULE_0__.StaveModifier {
20821
20903
  this.yShift = yShift;
20822
20904
  this.text = label;
20823
20905
  }
20824
- draw(stave, x) {
20906
+ draw() {
20907
+ const stave = this.checkStave();
20908
+ const x = stave.getModifierXShift(this.getPosition());
20825
20909
  const ctx = stave.checkContext();
20826
20910
  this.setRendered();
20827
20911
  let width = stave.getWidth() - x; // don't include x (offset) for width
@@ -20848,7 +20932,6 @@ class Volta extends _stavemodifier__WEBPACK_IMPORTED_MODULE_0__.StaveModifier {
20848
20932
  this.renderText(ctx, x + 5, topY - this.yShift + 15);
20849
20933
  }
20850
20934
  ctx.fillRect(this.x + x, topY, width, 1);
20851
- return this;
20852
20935
  }
20853
20936
  }
20854
20937
 
@@ -21021,8 +21104,6 @@ class Stem extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
21021
21104
  // The offset from the stem's base which is required fo satisfy the stemlet height
21022
21105
  const stemletYOffset = this.isStemlet ? stemHeight - this.stemletHeight * this.stemDirection : 0;
21023
21106
  // Draw the stem
21024
- ctx.save();
21025
- this.applyStyle();
21026
21107
  ctx.openGroup('stem', this.getAttribute('id'));
21027
21108
  ctx.beginPath();
21028
21109
  ctx.setLineWidth(Stem.WIDTH);
@@ -21030,8 +21111,6 @@ class Stem extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
21030
21111
  ctx.lineTo(stemX, stemY - stemHeight - this.renderHeightAdjustment * stemDirection);
21031
21112
  ctx.stroke();
21032
21113
  ctx.closeGroup();
21033
- this.restoreStyle();
21034
- ctx.restore();
21035
21114
  }
21036
21115
  }
21037
21116
  /** To enable logging for this class. Set `VexFlow.Stem.DEBUG` to `true`. */
@@ -21050,7 +21129,7 @@ __webpack_require__.r(__webpack_exports__);
21050
21129
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
21051
21130
  /* harmony export */ StemmableNote: () => (/* binding */ StemmableNote)
21052
21131
  /* harmony export */ });
21053
- /* harmony import */ var _element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./element */ "./src/element.ts");
21132
+ /* harmony import */ var _flag__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./flag */ "./src/flag.ts");
21054
21133
  /* harmony import */ var _glyphs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./glyphs */ "./src/glyphs.ts");
21055
21134
  /* harmony import */ var _note__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./note */ "./src/note.ts");
21056
21135
  /* harmony import */ var _stem__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./stem */ "./src/stem.ts");
@@ -21075,8 +21154,7 @@ class StemmableNote extends _note__WEBPACK_IMPORTED_MODULE_2__.Note {
21075
21154
  }
21076
21155
  constructor(noteStruct) {
21077
21156
  super(noteStruct);
21078
- this.flag = new _element__WEBPACK_IMPORTED_MODULE_0__.Element();
21079
- this.flagStyle = {};
21157
+ this.flag = new _flag__WEBPACK_IMPORTED_MODULE_0__.Flag();
21080
21158
  }
21081
21159
  // Get and set the note's `Stem`
21082
21160
  getStem() {
@@ -21090,7 +21168,7 @@ class StemmableNote extends _note__WEBPACK_IMPORTED_MODULE_2__.Note {
21090
21168
  }
21091
21169
  setStem(stem) {
21092
21170
  this.stem = stem;
21093
- this.addChildElement(stem);
21171
+ this.addChild(stem);
21094
21172
  return this;
21095
21173
  }
21096
21174
  // Builds and sets a new stem
@@ -21108,7 +21186,7 @@ class StemmableNote extends _note__WEBPACK_IMPORTED_MODULE_2__.Note {
21108
21186
  // if codeFlagUp is undefined, codePoint will be 0
21109
21187
  this.getStemDirection() === _stem__WEBPACK_IMPORTED_MODULE_3__.Stem.DOWN
21110
21188
  ? String.fromCodePoint(((_b = (_a = glyphProps.codeFlagUp) === null || _a === void 0 ? void 0 : _a.codePointAt(0)) !== null && _b !== void 0 ? _b : -1) + 1)
21111
- : (_c = glyphProps.codeFlagUp) !== null && _c !== void 0 ? _c : _glyphs__WEBPACK_IMPORTED_MODULE_1__.Glyphs.null;
21189
+ : ((_c = glyphProps.codeFlagUp) !== null && _c !== void 0 ? _c : _glyphs__WEBPACK_IMPORTED_MODULE_1__.Glyphs.null);
21112
21190
  this.flag.setText(flagCode);
21113
21191
  this.flag.fontInfo = this.fontInfo;
21114
21192
  }
@@ -21269,7 +21347,7 @@ class StemmableNote extends _note__WEBPACK_IMPORTED_MODULE_2__.Note {
21269
21347
  this.checkContext();
21270
21348
  this.setRendered();
21271
21349
  this.setStem(new _stem__WEBPACK_IMPORTED_MODULE_3__.Stem(stemOptions));
21272
- (_a = this.stem) === null || _a === void 0 ? void 0 : _a.setContext(this.getContext()).draw();
21350
+ (_a = this.stem) === null || _a === void 0 ? void 0 : _a.setContext(this.getContext()).drawWithStyle();
21273
21351
  }
21274
21352
  }
21275
21353
 
@@ -21496,7 +21574,6 @@ class StringNumber extends _modifier__WEBPACK_IMPORTED_MODULE_1__.Modifier {
21496
21574
  default:
21497
21575
  throw new _util__WEBPACK_IMPORTED_MODULE_6__.RuntimeError('InvalidPosition', `The position ${this.position} is invalid`);
21498
21576
  }
21499
- ctx.save();
21500
21577
  if (this.drawCircle) {
21501
21578
  ctx.beginPath();
21502
21579
  ctx.arc(dotX, dotY, this.radius, 0, Math.PI * 2, false);
@@ -21536,7 +21613,6 @@ class StringNumber extends _modifier__WEBPACK_IMPORTED_MODULE_1__.Modifier {
21536
21613
  break;
21537
21614
  }
21538
21615
  }
21539
- ctx.restore();
21540
21616
  }
21541
21617
  }
21542
21618
 
@@ -21996,8 +22072,6 @@ class SVGContext extends _rendercontext__WEBPACK_IMPORTED_MODULE_3__.RenderConte
21996
22072
  while (this.svg.lastChild) {
21997
22073
  this.svg.removeChild(this.svg.lastChild);
21998
22074
  }
21999
- // Replace the viewbox attribute we just removed.
22000
- this.scale(this.state.scaleX, this.state.scaleY);
22001
22075
  }
22002
22076
  // ## Rectangles:
22003
22077
  rect(x, y, width, height, attributes) {
@@ -23511,9 +23585,7 @@ class TabNote extends _stemmablenote__WEBPACK_IMPORTED_MODULE_5__.StemmableNote
23511
23585
  : // Up stems are above the note head and have flags on the right.
23512
23586
  this.getStemY() - this.checkStem().getHeight() + this.getStemExtension();
23513
23587
  // Draw the Flag
23514
- this.applyStyle(context, this.flagStyle);
23515
- this.flag.renderText(context, flagX, flagY);
23516
- this.restoreStyle(context, this.flagStyle);
23588
+ this.flag.setContext(context).setX(flagX).setY(flagY).drawWithStyle();
23517
23589
  }
23518
23590
  }
23519
23591
  // Render the modifiers onto the context.
@@ -23539,7 +23611,6 @@ class TabNote extends _stemmablenote__WEBPACK_IMPORTED_MODULE_5__.StemmableNote
23539
23611
  const stringsUsed = this.positions.map((position) => Number(position.str));
23540
23612
  const unusedStrings = getUnusedStringGroups(numLines, stringsUsed);
23541
23613
  const stemLines = getPartialStemLines(stemY, unusedStrings, this.checkStave(), this.getStemDirection());
23542
- ctx.save();
23543
23614
  ctx.setLineWidth(_stem__WEBPACK_IMPORTED_MODULE_4__.Stem.WIDTH);
23544
23615
  stemLines.forEach((bounds) => {
23545
23616
  if (bounds.length === 0)
@@ -23550,7 +23621,6 @@ class TabNote extends _stemmablenote__WEBPACK_IMPORTED_MODULE_5__.StemmableNote
23550
23621
  ctx.stroke();
23551
23622
  ctx.closePath();
23552
23623
  });
23553
- ctx.restore();
23554
23624
  }
23555
23625
  }
23556
23626
  // Render the fret positions onto the context
@@ -23576,19 +23646,17 @@ class TabNote extends _stemmablenote__WEBPACK_IMPORTED_MODULE_5__.StemmableNote
23576
23646
  }
23577
23647
  this.setRendered();
23578
23648
  const renderStem = this.beam === undefined && this.renderOptions.drawStem;
23579
- this.applyStyle();
23580
23649
  ctx.openGroup('tabnote', this.getAttribute('id'));
23581
23650
  this.drawPositions();
23582
23651
  this.drawStemThrough();
23583
23652
  if (this.stem && renderStem) {
23584
23653
  const stemX = this.getStemX();
23585
23654
  this.stem.setNoteHeadXBounds(stemX, stemX);
23586
- this.stem.setContext(ctx).draw();
23655
+ this.stem.setContext(ctx).drawWithStyle();
23587
23656
  }
23588
23657
  this.drawFlag();
23589
23658
  this.drawModifiers();
23590
23659
  ctx.closeGroup();
23591
- this.restoreStyle();
23592
23660
  }
23593
23661
  }
23594
23662
 
@@ -23689,7 +23757,6 @@ class TabSlide extends _tabtie__WEBPACK_IMPORTED_MODULE_0__.TabTie {
23689
23757
  if (direction !== TabSlide.SLIDE_UP && direction !== TabSlide.SLIDE_DOWN) {
23690
23758
  throw new _util__WEBPACK_IMPORTED_MODULE_2__.RuntimeError('BadSlide', 'Invalid slide direction');
23691
23759
  }
23692
- // eslint-disable-next-line
23693
23760
  const firstIndexes = this.notes.firstIndexes;
23694
23761
  for (let i = 0; i < firstIndexes.length; ++i) {
23695
23762
  const slideY = firstYs[firstIndexes[i]] + this.renderOptions.yShift;
@@ -23926,8 +23993,6 @@ class TextBracket extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
23926
23993
  const stop = { x: this.stop.getAbsoluteX(), y };
23927
23994
  L('Rendering TextBracket: start:', start, 'stop:', stop, 'y:', y);
23928
23995
  const bracketHeight = this.renderOptions.bracketHeight * this.position;
23929
- ctx.save();
23930
- this.applyStyle(ctx);
23931
23996
  // Draw text
23932
23997
  this.textElement.renderText(ctx, start.x, start.y);
23933
23998
  // Get the width and height for the octave number
@@ -23976,7 +24041,6 @@ class TextBracket extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
23976
24041
  ctx.stroke();
23977
24042
  ctx.closePath();
23978
24043
  }
23979
- ctx.restore();
23980
24044
  }
23981
24045
  }
23982
24046
  TextBracket.DEBUG = false;
@@ -24230,7 +24294,6 @@ class TextNote extends _note__WEBPACK_IMPORTED_MODULE_4__.Note {
24230
24294
  x -= width;
24231
24295
  }
24232
24296
  const y = stave.getYForLine(this.line + -3);
24233
- this.applyStyle(ctx);
24234
24297
  this.renderText(ctx, x, y);
24235
24298
  const height = this.getHeight();
24236
24299
  if (this.superscript) {
@@ -24239,7 +24302,6 @@ class TextNote extends _note__WEBPACK_IMPORTED_MODULE_4__.Note {
24239
24302
  if (this.subscript) {
24240
24303
  this.subscript.renderText(ctx, x + this.width + 2, y + height / 2.2 - 1);
24241
24304
  }
24242
- this.restoreStyle(ctx);
24243
24305
  }
24244
24306
  }
24245
24307
  TextNote.Justification = TextJustification;
@@ -24983,12 +25045,12 @@ class TimeSignature extends _stavemodifier__WEBPACK_IMPORTED_MODULE_2__.StaveMod
24983
25045
  const stave = this.checkStave();
24984
25046
  const ctx = stave.checkContext();
24985
25047
  this.setRendered();
25048
+ ctx.openGroup('timesignature', this.getAttribute('id'));
24986
25049
  this.drawAt(ctx, stave, this.x);
25050
+ ctx.closeGroup();
24987
25051
  }
24988
25052
  drawAt(ctx, stave, x) {
24989
25053
  this.setRendered();
24990
- this.applyStyle(ctx);
24991
- ctx.openGroup('timesignature', this.getAttribute('id'));
24992
25054
  if (this.isNumeric) {
24993
25055
  let startX = x + this.topStartX;
24994
25056
  let y = 0;
@@ -25004,8 +25066,6 @@ class TimeSignature extends _stavemodifier__WEBPACK_IMPORTED_MODULE_2__.StaveMod
25004
25066
  else {
25005
25067
  this.renderText(ctx, x - this.x, stave.getYForLine(this.line));
25006
25068
  }
25007
- ctx.closeGroup();
25008
- this.restoreStyle(ctx);
25009
25069
  }
25010
25070
  }
25011
25071
 
@@ -25055,7 +25115,9 @@ class TimeSigNote extends _note__WEBPACK_IMPORTED_MODULE_0__.Note {
25055
25115
  const stave = this.checkStave();
25056
25116
  const ctx = this.checkContext();
25057
25117
  this.setRendered();
25118
+ ctx.openGroup('timesignote', this.getAttribute('id'));
25058
25119
  this.timeSig.drawAt(ctx, stave, this.getAbsoluteX());
25120
+ ctx.closeGroup();
25059
25121
  }
25060
25122
  }
25061
25123
 
@@ -25221,10 +25283,11 @@ __webpack_require__.r(__webpack_exports__);
25221
25283
  /* harmony import */ var _element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./element */ "./src/element.ts");
25222
25284
  /* harmony import */ var _formatter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./formatter */ "./src/formatter.ts");
25223
25285
  /* harmony import */ var _glyphs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./glyphs */ "./src/glyphs.ts");
25224
- /* harmony import */ var _stem__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./stem */ "./src/stem.ts");
25225
- /* harmony import */ var _tables__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./tables */ "./src/tables.ts");
25226
- /* harmony import */ var _typeguard__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./typeguard */ "./src/typeguard.ts");
25227
- /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./util */ "./src/util.ts");
25286
+ /* harmony import */ var _metrics__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./metrics */ "./src/metrics.ts");
25287
+ /* harmony import */ var _stem__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./stem */ "./src/stem.ts");
25288
+ /* harmony import */ var _tables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./tables */ "./src/tables.ts");
25289
+ /* harmony import */ var _typeguard__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./typeguard */ "./src/typeguard.ts");
25290
+ /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./util */ "./src/util.ts");
25228
25291
  // Copyright (c) 2023-present VexFlow contributors: https://github.com/vexflow/vexflow/graphs/contributors
25229
25292
  /**
25230
25293
  * ## Description
@@ -25276,6 +25339,7 @@ __webpack_require__.r(__webpack_exports__);
25276
25339
 
25277
25340
 
25278
25341
 
25342
+
25279
25343
  var TupletLocation;
25280
25344
  (function (TupletLocation) {
25281
25345
  TupletLocation[TupletLocation["BOTTOM"] = -1] = "BOTTOM";
@@ -25283,7 +25347,7 @@ var TupletLocation;
25283
25347
  })(TupletLocation || (TupletLocation = {}));
25284
25348
  class Tuplet extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
25285
25349
  static get CATEGORY() {
25286
- return _typeguard__WEBPACK_IMPORTED_MODULE_5__.Category.Tuplet;
25350
+ return _typeguard__WEBPACK_IMPORTED_MODULE_6__.Category.Tuplet;
25287
25351
  }
25288
25352
  static get LOCATION_TOP() {
25289
25353
  return TupletLocation.TOP;
@@ -25297,22 +25361,27 @@ class Tuplet extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
25297
25361
  constructor(notes, options = {}) {
25298
25362
  super();
25299
25363
  if (!notes || !notes.length) {
25300
- throw new _util__WEBPACK_IMPORTED_MODULE_6__.RuntimeError('BadArguments', 'No notes provided for tuplet.');
25364
+ throw new _util__WEBPACK_IMPORTED_MODULE_7__.RuntimeError('BadArguments', 'No notes provided for tuplet.');
25301
25365
  }
25302
- this.options = options;
25303
25366
  this.notes = notes;
25304
- this.numNotes = this.options.numNotes !== undefined ? this.options.numNotes : notes.length;
25305
- this.notesOccupied = this.options.notesOccupied || 2;
25306
- if (this.options.bracketed !== undefined) {
25307
- this.bracketed = this.options.bracketed;
25308
- }
25309
- else {
25310
- this.bracketed = notes.some((note) => !note.hasBeam());
25311
- }
25312
- this.ratioed =
25313
- this.options.ratioed !== undefined ? this.options.ratioed : Math.abs(this.notesOccupied - this.numNotes) > 1;
25367
+ const numNotes = options.numNotes !== undefined ? options.numNotes : notes.length;
25368
+ const notesOccupied = options.notesOccupied || 2;
25369
+ const bracketed = options.bracketed !== undefined ? options.bracketed : notes.some((note) => !note.hasBeam());
25370
+ const ratioed = options.ratioed !== undefined ? options.ratioed : Math.abs(notesOccupied - numNotes) > 1;
25371
+ const location = options.location || Tuplet.LOCATION_TOP;
25372
+ const yOffset = options.yOffset || _metrics__WEBPACK_IMPORTED_MODULE_3__.Metrics.get('Tuplet.yOffset');
25373
+ const textYOffset = options.textYOffset || _metrics__WEBPACK_IMPORTED_MODULE_3__.Metrics.get('Tuplet.textYOffset');
25374
+ this.options = {
25375
+ bracketed,
25376
+ location,
25377
+ notesOccupied,
25378
+ numNotes,
25379
+ ratioed,
25380
+ yOffset,
25381
+ textYOffset,
25382
+ };
25314
25383
  this.textElement = new _element__WEBPACK_IMPORTED_MODULE_0__.Element('Tuplet');
25315
- this.setTupletLocation(this.options.location || Tuplet.LOCATION_TOP);
25384
+ this.setTupletLocation(location || Tuplet.LOCATION_TOP);
25316
25385
  _formatter__WEBPACK_IMPORTED_MODULE_1__.Formatter.AlignRestsToNotes(notes, true, true);
25317
25386
  this.resolveGlyphs();
25318
25387
  this.attach();
@@ -25333,14 +25402,14 @@ class Tuplet extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
25333
25402
  * Set whether or not the bracket is drawn.
25334
25403
  */
25335
25404
  setBracketed(bracketed) {
25336
- this.bracketed = !!bracketed;
25405
+ this.options.bracketed = bracketed;
25337
25406
  return this;
25338
25407
  }
25339
25408
  /**
25340
25409
  * Set whether or not the ratio is shown.
25341
25410
  */
25342
25411
  setRatioed(ratioed) {
25343
- this.ratioed = !!ratioed;
25412
+ this.options.ratioed = ratioed;
25344
25413
  return this;
25345
25414
  }
25346
25415
  /**
@@ -25352,34 +25421,34 @@ class Tuplet extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
25352
25421
  console.warn(`Invalid tuplet location [${location}]. Using Tuplet.LOCATION_TOP.`);
25353
25422
  location = Tuplet.LOCATION_TOP;
25354
25423
  }
25355
- this.location = location;
25424
+ this.options.location = location;
25356
25425
  return this;
25357
25426
  }
25358
25427
  getNotes() {
25359
25428
  return this.notes;
25360
25429
  }
25361
25430
  getNoteCount() {
25362
- return this.numNotes;
25431
+ return this.options.numNotes;
25363
25432
  }
25364
25433
  getNotesOccupied() {
25365
- return this.notesOccupied;
25434
+ return this.options.notesOccupied;
25366
25435
  }
25367
25436
  setNotesOccupied(notes) {
25368
25437
  this.detach();
25369
- this.notesOccupied = notes;
25438
+ this.options.notesOccupied = notes;
25370
25439
  this.resolveGlyphs();
25371
25440
  this.attach();
25372
25441
  }
25373
25442
  resolveGlyphs() {
25374
25443
  let numerator = '';
25375
25444
  let denominator = '';
25376
- let n = this.numNotes;
25445
+ let n = this.options.numNotes;
25377
25446
  while (n >= 1) {
25378
25447
  numerator = String.fromCharCode(0xe880 /* tuplet0 */ + (n % 10)) + numerator;
25379
25448
  n = Math.floor(n / 10);
25380
25449
  }
25381
- if (this.ratioed) {
25382
- n = this.notesOccupied;
25450
+ if (this.options.ratioed) {
25451
+ n = this.options.notesOccupied;
25383
25452
  while (n >= 1) {
25384
25453
  denominator = String.fromCharCode(0xe880 /* tuplet0 */ + (n % 10)) + denominator;
25385
25454
  n = Math.floor(n / 10);
@@ -25392,14 +25461,14 @@ class Tuplet extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
25392
25461
  // on the same side (above/below), to calculate a y
25393
25462
  // offset for this tuplet:
25394
25463
  getNestedTupletCount() {
25395
- const location = this.location;
25464
+ const { location } = this.options;
25396
25465
  const firstNote = this.notes[0];
25397
25466
  let maxTupletCount = countTuplets(firstNote, location);
25398
25467
  let minTupletCount = countTuplets(firstNote, location);
25399
25468
  // Count the tuplets that are on the same side (above/below)
25400
25469
  // as this tuplet:
25401
25470
  function countTuplets(note, location) {
25402
- return note.getTupletStack().filter((tuplet) => tuplet.location === location).length;
25471
+ return note.getTupletStack().filter((tuplet) => tuplet.options.location === location).length;
25403
25472
  }
25404
25473
  this.notes.forEach((note) => {
25405
25474
  const tupletCount = countTuplets(note, location);
@@ -25413,15 +25482,15 @@ class Tuplet extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
25413
25482
  var _a;
25414
25483
  // offset the tuplet for any nested tuplets between
25415
25484
  // it and the notes:
25416
- const nestedTupletYOffset = this.getNestedTupletCount() * Tuplet.NESTING_OFFSET * -this.location;
25485
+ const nestedTupletYOffset = this.getNestedTupletCount() * Tuplet.NESTING_OFFSET * -this.options.location;
25417
25486
  // offset the tuplet for any manual yOffset:
25418
25487
  const yOffset = (_a = this.options.yOffset) !== null && _a !== void 0 ? _a : 0;
25419
25488
  // now iterate through the notes and find our highest
25420
25489
  // or lowest locations, to form a base yPosition
25421
25490
  const firstNote = this.notes[0];
25422
25491
  let yPosition;
25423
- if (this.location === Tuplet.LOCATION_TOP) {
25424
- yPosition = firstNote.checkStave().getYForLine(0) - 1.5 * _tables__WEBPACK_IMPORTED_MODULE_4__.Tables.STAVE_LINE_DISTANCE;
25492
+ if (this.options.location === Tuplet.LOCATION_TOP) {
25493
+ yPosition = firstNote.checkStave().getYForLine(0) - 1.5 * _tables__WEBPACK_IMPORTED_MODULE_5__.Tables.STAVE_LINE_DISTANCE;
25425
25494
  // check modifiers above note to see if they will collide with tuplet beam
25426
25495
  for (let i = 0; i < this.notes.length; ++i) {
25427
25496
  const note = this.notes[i];
@@ -25430,11 +25499,11 @@ class Tuplet extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
25430
25499
  if (mc) {
25431
25500
  modLines = Math.max(modLines, mc.getState().topTextLine);
25432
25501
  }
25433
- const modY = note.getYForTopText(modLines) - 2 * _tables__WEBPACK_IMPORTED_MODULE_4__.Tables.STAVE_LINE_DISTANCE;
25502
+ const modY = note.getYForTopText(modLines) - 2 * _tables__WEBPACK_IMPORTED_MODULE_5__.Tables.STAVE_LINE_DISTANCE;
25434
25503
  if (note.hasStem() || note.isRest()) {
25435
- const topY = note.getStemDirection() === _stem__WEBPACK_IMPORTED_MODULE_3__.Stem.UP
25436
- ? note.getStemExtents().topY - _tables__WEBPACK_IMPORTED_MODULE_4__.Tables.STAVE_LINE_DISTANCE
25437
- : note.getStemExtents().baseY - 2 * _tables__WEBPACK_IMPORTED_MODULE_4__.Tables.STAVE_LINE_DISTANCE;
25504
+ const topY = note.getStemDirection() === _stem__WEBPACK_IMPORTED_MODULE_4__.Stem.UP
25505
+ ? note.getStemExtents().topY - _tables__WEBPACK_IMPORTED_MODULE_5__.Tables.STAVE_LINE_DISTANCE
25506
+ : note.getStemExtents().baseY - 2 * _tables__WEBPACK_IMPORTED_MODULE_5__.Tables.STAVE_LINE_DISTANCE;
25438
25507
  yPosition = Math.min(topY, yPosition);
25439
25508
  if (modLines > 0) {
25440
25509
  yPosition = Math.min(modY, yPosition);
@@ -25451,12 +25520,12 @@ class Tuplet extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
25451
25520
  lineCheck = Math.max(lineCheck, mc.getState().textLine + 1);
25452
25521
  }
25453
25522
  });
25454
- yPosition = firstNote.checkStave().getYForLine(lineCheck) + 2 * _tables__WEBPACK_IMPORTED_MODULE_4__.Tables.STAVE_LINE_DISTANCE;
25523
+ yPosition = firstNote.checkStave().getYForLine(lineCheck) + 2 * _tables__WEBPACK_IMPORTED_MODULE_5__.Tables.STAVE_LINE_DISTANCE;
25455
25524
  for (let i = 0; i < this.notes.length; ++i) {
25456
25525
  if (this.notes[i].hasStem() || this.notes[i].isRest()) {
25457
- const bottomY = this.notes[i].getStemDirection() === _stem__WEBPACK_IMPORTED_MODULE_3__.Stem.UP
25458
- ? this.notes[i].getStemExtents().baseY + 2 * _tables__WEBPACK_IMPORTED_MODULE_4__.Tables.STAVE_LINE_DISTANCE
25459
- : this.notes[i].getStemExtents().topY + _tables__WEBPACK_IMPORTED_MODULE_4__.Tables.STAVE_LINE_DISTANCE;
25526
+ const bottomY = this.notes[i].getStemDirection() === _stem__WEBPACK_IMPORTED_MODULE_4__.Stem.UP
25527
+ ? this.notes[i].getStemExtents().baseY + 2 * _tables__WEBPACK_IMPORTED_MODULE_5__.Tables.STAVE_LINE_DISTANCE
25528
+ : this.notes[i].getStemExtents().topY + _tables__WEBPACK_IMPORTED_MODULE_5__.Tables.STAVE_LINE_DISTANCE;
25460
25529
  if (bottomY > yPosition) {
25461
25530
  yPosition = bottomY;
25462
25531
  }
@@ -25466,14 +25535,14 @@ class Tuplet extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
25466
25535
  return yPosition + nestedTupletYOffset + yOffset;
25467
25536
  }
25468
25537
  draw() {
25538
+ const { location, bracketed, textYOffset } = this.options;
25469
25539
  const ctx = this.checkContext();
25470
25540
  let xPos = 0;
25471
25541
  let yPos = 0;
25472
- this.setRendered();
25473
25542
  // determine x value of left bound of tuplet
25474
25543
  const firstNote = this.notes[0];
25475
25544
  const lastNote = this.notes[this.notes.length - 1];
25476
- if (!this.bracketed) {
25545
+ if (!bracketed) {
25477
25546
  xPos = firstNote.getStemX();
25478
25547
  this.width = lastNote.getStemX() - xPos;
25479
25548
  }
@@ -25485,19 +25554,26 @@ class Tuplet extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
25485
25554
  yPos = this.getYPosition();
25486
25555
  const notationCenterX = xPos + this.width / 2;
25487
25556
  const notationStartX = notationCenterX - this.textElement.getWidth() / 2;
25557
+ // start grouping
25558
+ ctx.openGroup('tuplet', this.getAttribute('id'));
25488
25559
  // draw bracket if the tuplet is not beamed
25489
- if (this.bracketed) {
25560
+ if (bracketed) {
25490
25561
  const lineWidth = this.width / 2 - this.textElement.getWidth() / 2 - 5;
25491
25562
  // only draw the bracket if it has positive length
25492
25563
  if (lineWidth > 0) {
25493
25564
  ctx.fillRect(xPos, yPos, lineWidth, 1);
25494
25565
  ctx.fillRect(xPos + this.width / 2 + this.textElement.getWidth() / 2 + 5, yPos, lineWidth, 1);
25495
- ctx.fillRect(xPos, yPos + (this.location === Tuplet.LOCATION_BOTTOM ? 1 : 0), 1, this.location * 10);
25496
- ctx.fillRect(xPos + this.width, yPos + (this.location === Tuplet.LOCATION_BOTTOM ? 1 : 0), 1, this.location * 10);
25566
+ ctx.fillRect(xPos, yPos + (location === Tuplet.LOCATION_BOTTOM ? 1 : 0), 1, location * 10);
25567
+ ctx.fillRect(xPos + this.width, yPos + (location === Tuplet.LOCATION_BOTTOM ? 1 : 0), 1, location * 10);
25497
25568
  }
25498
25569
  }
25499
25570
  // draw text
25500
- this.textElement.renderText(ctx, notationStartX, yPos + this.textElement.getHeight() / 2);
25571
+ this.textElement.renderText(ctx, notationStartX, yPos + this.textElement.getHeight() / 2 + (location === Tuplet.LOCATION_TOP ? -1 : 1) * textYOffset);
25572
+ // Set up an interactive bounding box and finalize the tuplet rendering
25573
+ const bb = this.getBoundingBox();
25574
+ ctx.pointerRect(bb.getX(), bb.getY(), bb.getW(), bb.getH());
25575
+ ctx.closeGroup();
25576
+ this.setRendered();
25501
25577
  }
25502
25578
  }
25503
25579
 
@@ -25592,6 +25668,7 @@ var Category;
25592
25668
  Category["Curve"] = "Curve";
25593
25669
  Category["Dot"] = "Dot";
25594
25670
  Category["Element"] = "Element";
25671
+ Category["Flag"] = "Flag";
25595
25672
  Category["Fraction"] = "Fraction";
25596
25673
  Category["FretHandFinger"] = "FretHandFinger";
25597
25674
  Category["GhostNote"] = "GhostNote";
@@ -25768,7 +25845,6 @@ function sumArray(arr) {
25768
25845
  * Take `arr` and return a new array consisting of the sorted, unique'd,
25769
25846
  * contents of arr. Does not modify `arr`.
25770
25847
  */
25771
- // eslint-disable-next-line
25772
25848
  /*
25773
25849
  static sortAndUnique(arr: any[], cmp: any, eq: any): any[] {
25774
25850
  if (arr.length > 1) {
@@ -26058,6 +26134,7 @@ class VexFlow {
26058
26134
  static setFonts(...fontNames) {
26059
26135
  // Convert the array of font names into an array of Font objects.
26060
26136
  _metrics__WEBPACK_IMPORTED_MODULE_30__.MetricsDefaults.fontFamily = fontNames.join(',');
26137
+ _metrics__WEBPACK_IMPORTED_MODULE_30__.Metrics.clear();
26061
26138
  }
26062
26139
  static getFonts() {
26063
26140
  return _metrics__WEBPACK_IMPORTED_MODULE_30__.Metrics.get('fontFamily').split(',');
@@ -26111,10 +26188,13 @@ class VexFlow {
26111
26188
  _tables__WEBPACK_IMPORTED_MODULE_63__.Tables.STAVE_LINE_DISTANCE = value;
26112
26189
  }
26113
26190
  static get STAVE_LINE_THICKNESS() {
26114
- return _tables__WEBPACK_IMPORTED_MODULE_63__.Tables.STAVE_LINE_THICKNESS;
26191
+ return _metrics__WEBPACK_IMPORTED_MODULE_30__.MetricsDefaults.Stave.lineWidth;
26115
26192
  }
26116
26193
  static set STAVE_LINE_THICKNESS(value) {
26117
- _tables__WEBPACK_IMPORTED_MODULE_63__.Tables.STAVE_LINE_THICKNESS = value;
26194
+ _metrics__WEBPACK_IMPORTED_MODULE_30__.MetricsDefaults.Stave.lineWidth = value;
26195
+ _metrics__WEBPACK_IMPORTED_MODULE_30__.MetricsDefaults.TabStave.lineWidth = value;
26196
+ _metrics__WEBPACK_IMPORTED_MODULE_30__.Metrics.clear('Stave');
26197
+ _metrics__WEBPACK_IMPORTED_MODULE_30__.Metrics.clear('TabStave');
26118
26198
  }
26119
26199
  static get STEM_HEIGHT() {
26120
26200
  return _tables__WEBPACK_IMPORTED_MODULE_63__.Tables.STEM_HEIGHT;
@@ -26825,7 +26905,7 @@ function isHTMLDiv(element) {
26825
26905
  /******/
26826
26906
  /************************************************************************/
26827
26907
  var __webpack_exports__ = {};
26828
- // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
26908
+ // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
26829
26909
  (() => {
26830
26910
  /*!********************************!*\
26831
26911
  !*** ./entry/vexflow-debug.ts ***!
@@ -26863,6 +26943,7 @@ __webpack_require__.r(__webpack_exports__);
26863
26943
  /* harmony export */ EasyScoreGrammar: () => (/* reexport safe */ _src_index__WEBPACK_IMPORTED_MODULE_8__.EasyScoreGrammar),
26864
26944
  /* harmony export */ Element: () => (/* reexport safe */ _src_index__WEBPACK_IMPORTED_MODULE_8__.Element),
26865
26945
  /* harmony export */ Factory: () => (/* reexport safe */ _src_index__WEBPACK_IMPORTED_MODULE_8__.Factory),
26946
+ /* harmony export */ Flag: () => (/* reexport safe */ _src_index__WEBPACK_IMPORTED_MODULE_8__.Flag),
26866
26947
  /* harmony export */ Font: () => (/* reexport safe */ _src_index__WEBPACK_IMPORTED_MODULE_8__.Font),
26867
26948
  /* harmony export */ FontStyle: () => (/* reexport safe */ _src_index__WEBPACK_IMPORTED_MODULE_8__.FontStyle),
26868
26949
  /* harmony export */ FontWeight: () => (/* reexport safe */ _src_index__WEBPACK_IMPORTED_MODULE_8__.FontWeight),
@@ -26877,6 +26958,8 @@ __webpack_require__.r(__webpack_exports__);
26877
26958
  /* harmony export */ KeyManager: () => (/* reexport safe */ _src_index__WEBPACK_IMPORTED_MODULE_8__.KeyManager),
26878
26959
  /* harmony export */ KeySigNote: () => (/* reexport safe */ _src_index__WEBPACK_IMPORTED_MODULE_8__.KeySigNote),
26879
26960
  /* harmony export */ KeySignature: () => (/* reexport safe */ _src_index__WEBPACK_IMPORTED_MODULE_8__.KeySignature),
26961
+ /* harmony export */ Metrics: () => (/* reexport safe */ _src_index__WEBPACK_IMPORTED_MODULE_8__.Metrics),
26962
+ /* harmony export */ MetricsDefaults: () => (/* reexport safe */ _src_index__WEBPACK_IMPORTED_MODULE_8__.MetricsDefaults),
26880
26963
  /* harmony export */ Modifier: () => (/* reexport safe */ _src_index__WEBPACK_IMPORTED_MODULE_8__.Modifier),
26881
26964
  /* harmony export */ ModifierContext: () => (/* reexport safe */ _src_index__WEBPACK_IMPORTED_MODULE_8__.ModifierContext),
26882
26965
  /* harmony export */ ModifierPosition: () => (/* reexport safe */ _src_index__WEBPACK_IMPORTED_MODULE_8__.ModifierPosition),