@tspro/web-music-score 3.1.0 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +5 -3
  3. package/dist/audio/index.d.mts +1 -8
  4. package/dist/audio/index.d.ts +1 -8
  5. package/dist/audio/index.js +1 -1
  6. package/dist/audio/index.mjs +2 -2
  7. package/dist/audio-cg/index.d.mts +0 -1
  8. package/dist/audio-cg/index.d.ts +0 -1
  9. package/dist/audio-cg/index.js +1 -1
  10. package/dist/audio-cg/index.mjs +2 -2
  11. package/dist/{chunk-B4J3KED2.mjs → chunk-LCTM7BID.mjs} +2 -2
  12. package/dist/core/index.d.mts +0 -3
  13. package/dist/core/index.d.ts +0 -3
  14. package/dist/core/index.js +2 -2
  15. package/dist/core/index.mjs +3 -3
  16. package/dist/{guitar-BIFwFT31.d.ts → guitar-C2Cp71NZ.d.ts} +1 -8
  17. package/dist/{guitar-zASF7B1g.d.mts → guitar-DggbM2UL.d.mts} +1 -8
  18. package/dist/iife/index.global.js +11 -11
  19. package/dist/{interface-DprVf__B.d.ts → interface-BlNl69uT.d.ts} +57 -77
  20. package/dist/{interface-BedxdQDE.d.mts → interface-Bn5HFt_U.d.mts} +57 -77
  21. package/dist/{note-B5ZtlHc8.d.mts → note-BFa43I86.d.mts} +0 -14
  22. package/dist/{note-B5ZtlHc8.d.ts → note-BFa43I86.d.ts} +0 -14
  23. package/dist/pieces/index.d.mts +3 -6
  24. package/dist/pieces/index.d.ts +3 -6
  25. package/dist/pieces/index.js +1 -1
  26. package/dist/pieces/index.mjs +2 -2
  27. package/dist/react-ui/index.d.mts +5 -23
  28. package/dist/react-ui/index.d.ts +5 -23
  29. package/dist/react-ui/index.js +1 -1
  30. package/dist/react-ui/index.mjs +2 -2
  31. package/dist/{scale-B_2MZaT9.d.ts → scale-DRR-t4Kr.d.mts} +2 -15
  32. package/dist/{scale-C-YS5iVG.d.mts → scale-ebJm37q1.d.ts} +2 -15
  33. package/dist/score/index.d.mts +18 -18
  34. package/dist/score/index.d.ts +18 -18
  35. package/dist/score/index.js +376 -229
  36. package/dist/score/index.mjs +377 -230
  37. package/dist/{tempo-TjQKn46X.d.mts → tempo-B4h5Ktob.d.mts} +1 -17
  38. package/dist/{tempo-DoJd-UYT.d.ts → tempo-DgqDEsn0.d.ts} +1 -17
  39. package/dist/theory/index.d.mts +6 -8
  40. package/dist/theory/index.d.ts +6 -8
  41. package/dist/theory/index.js +1 -1
  42. package/dist/theory/index.mjs +2 -2
  43. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
- /* WebMusicScore v3.1.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v3.2.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
2
  import {
3
3
  __publicField
4
- } from "../chunk-B4J3KED2.mjs";
4
+ } from "../chunk-LCTM7BID.mjs";
5
5
 
6
6
  // src/score/pub/div-rect.ts
7
7
  import { Utils } from "@tspro/ts-utils-lib";
@@ -280,19 +280,19 @@ var DivRect = class _DivRect {
280
280
  import { Utils as Utils11 } from "@tspro/ts-utils-lib";
281
281
 
282
282
  // src/score/pub/types.ts
283
- var StaffPreset = /* @__PURE__ */ ((StaffPreset4) => {
284
- StaffPreset4[StaffPreset4["Treble"] = 1] = "Treble";
285
- StaffPreset4[StaffPreset4["Bass"] = 2] = "Bass";
286
- StaffPreset4[StaffPreset4["Grand"] = 3] = "Grand";
287
- StaffPreset4[StaffPreset4["GuitarTreble"] = 4] = "GuitarTreble";
288
- StaffPreset4[StaffPreset4["GuitarTab"] = 8] = "GuitarTab";
289
- StaffPreset4[StaffPreset4["GuitarCombined"] = 12] = "GuitarCombined";
290
- return StaffPreset4;
283
+ var StaffPreset = /* @__PURE__ */ ((StaffPreset3) => {
284
+ StaffPreset3[StaffPreset3["Treble"] = 1] = "Treble";
285
+ StaffPreset3[StaffPreset3["Bass"] = 2] = "Bass";
286
+ StaffPreset3[StaffPreset3["Grand"] = 3] = "Grand";
287
+ StaffPreset3[StaffPreset3["GuitarTreble"] = 4] = "GuitarTreble";
288
+ StaffPreset3[StaffPreset3["GuitarTab"] = 8] = "GuitarTab";
289
+ StaffPreset3[StaffPreset3["GuitarCombined"] = 12] = "GuitarCombined";
290
+ return StaffPreset3;
291
291
  })(StaffPreset || {});
292
- var Clef = /* @__PURE__ */ ((Clef3) => {
293
- Clef3["G"] = "G";
294
- Clef3["F"] = "F";
295
- return Clef3;
292
+ var Clef = /* @__PURE__ */ ((Clef2) => {
293
+ Clef2["G"] = "G";
294
+ Clef2["F"] = "F";
295
+ return Clef2;
296
296
  })(Clef || {});
297
297
  function getVoiceIds() {
298
298
  return [0, 1, 2, 3];
@@ -300,21 +300,21 @@ function getVoiceIds() {
300
300
  function getStringNumbers() {
301
301
  return [1, 2, 3, 4, 5, 6];
302
302
  }
303
- var Stem = /* @__PURE__ */ ((Stem3) => {
304
- Stem3[Stem3["Auto"] = 0] = "Auto";
305
- Stem3[Stem3["Up"] = 1] = "Up";
306
- Stem3[Stem3["Down"] = 2] = "Down";
307
- return Stem3;
303
+ var Stem = /* @__PURE__ */ ((Stem2) => {
304
+ Stem2[Stem2["Auto"] = 0] = "Auto";
305
+ Stem2[Stem2["Up"] = 1] = "Up";
306
+ Stem2[Stem2["Down"] = 2] = "Down";
307
+ return Stem2;
308
308
  })(Stem || {});
309
309
  var Arpeggio = /* @__PURE__ */ ((Arpeggio2) => {
310
310
  Arpeggio2[Arpeggio2["Up"] = 0] = "Up";
311
311
  Arpeggio2[Arpeggio2["Down"] = 1] = "Down";
312
312
  return Arpeggio2;
313
313
  })(Arpeggio || {});
314
- var TieType = /* @__PURE__ */ ((TieType3) => {
315
- TieType3[TieType3["Stub"] = -1] = "Stub";
316
- TieType3[TieType3["ToMeasureEnd"] = -2] = "ToMeasureEnd";
317
- return TieType3;
314
+ var TieType = /* @__PURE__ */ ((TieType2) => {
315
+ TieType2[TieType2["Stub"] = -1] = "Stub";
316
+ TieType2[TieType2["ToMeasureEnd"] = -2] = "ToMeasureEnd";
317
+ return TieType2;
318
318
  })(TieType || {});
319
319
  var NoteAnchor = /* @__PURE__ */ ((NoteAnchor2) => {
320
320
  NoteAnchor2[NoteAnchor2["Auto"] = 0] = "Auto";
@@ -324,11 +324,11 @@ var NoteAnchor = /* @__PURE__ */ ((NoteAnchor2) => {
324
324
  NoteAnchor2[NoteAnchor2["StemTip"] = 4] = "StemTip";
325
325
  return NoteAnchor2;
326
326
  })(NoteAnchor || {});
327
- var Connective = /* @__PURE__ */ ((Connective3) => {
328
- Connective3[Connective3["Tie"] = 0] = "Tie";
329
- Connective3[Connective3["Slur"] = 1] = "Slur";
330
- Connective3[Connective3["Slide"] = 2] = "Slide";
331
- return Connective3;
327
+ var Connective = /* @__PURE__ */ ((Connective2) => {
328
+ Connective2[Connective2["Tie"] = 0] = "Tie";
329
+ Connective2[Connective2["Slur"] = 1] = "Slur";
330
+ Connective2[Connective2["Slide"] = 2] = "Slide";
331
+ return Connective2;
332
332
  })(Connective || {});
333
333
  var VerticalPosition = /* @__PURE__ */ ((VerticalPosition4) => {
334
334
  VerticalPosition4[VerticalPosition4["Above"] = 0] = "Above";
@@ -343,34 +343,34 @@ var PlayState = /* @__PURE__ */ ((PlayState2) => {
343
343
  PlayState2[PlayState2["Stopped"] = 2] = "Stopped";
344
344
  return PlayState2;
345
345
  })(PlayState || {});
346
- var Fermata = /* @__PURE__ */ ((Fermata3) => {
347
- Fermata3[Fermata3["AtNote"] = 0] = "AtNote";
348
- Fermata3[Fermata3["AtMeasureEnd"] = 1] = "AtMeasureEnd";
349
- return Fermata3;
346
+ var Fermata = /* @__PURE__ */ ((Fermata2) => {
347
+ Fermata2[Fermata2["AtNote"] = 0] = "AtNote";
348
+ Fermata2[Fermata2["AtMeasureEnd"] = 1] = "AtMeasureEnd";
349
+ return Fermata2;
350
350
  })(Fermata || {});
351
- var Navigation = /* @__PURE__ */ ((Navigation3) => {
352
- Navigation3[Navigation3["DC_al_Fine"] = 0] = "DC_al_Fine";
353
- Navigation3[Navigation3["DC_al_Coda"] = 1] = "DC_al_Coda";
354
- Navigation3[Navigation3["DS_al_Fine"] = 2] = "DS_al_Fine";
355
- Navigation3[Navigation3["DS_al_Coda"] = 3] = "DS_al_Coda";
356
- Navigation3[Navigation3["Coda"] = 4] = "Coda";
357
- Navigation3[Navigation3["toCoda"] = 5] = "toCoda";
358
- Navigation3[Navigation3["Segno"] = 6] = "Segno";
359
- Navigation3[Navigation3["Fine"] = 7] = "Fine";
360
- Navigation3[Navigation3["StartRepeat"] = 8] = "StartRepeat";
361
- Navigation3[Navigation3["EndRepeat"] = 9] = "EndRepeat";
362
- Navigation3[Navigation3["Ending"] = 10] = "Ending";
363
- return Navigation3;
351
+ var Navigation = /* @__PURE__ */ ((Navigation2) => {
352
+ Navigation2[Navigation2["DC_al_Fine"] = 0] = "DC_al_Fine";
353
+ Navigation2[Navigation2["DC_al_Coda"] = 1] = "DC_al_Coda";
354
+ Navigation2[Navigation2["DS_al_Fine"] = 2] = "DS_al_Fine";
355
+ Navigation2[Navigation2["DS_al_Coda"] = 3] = "DS_al_Coda";
356
+ Navigation2[Navigation2["Coda"] = 4] = "Coda";
357
+ Navigation2[Navigation2["toCoda"] = 5] = "toCoda";
358
+ Navigation2[Navigation2["Segno"] = 6] = "Segno";
359
+ Navigation2[Navigation2["Fine"] = 7] = "Fine";
360
+ Navigation2[Navigation2["StartRepeat"] = 8] = "StartRepeat";
361
+ Navigation2[Navigation2["EndRepeat"] = 9] = "EndRepeat";
362
+ Navigation2[Navigation2["Ending"] = 10] = "Ending";
363
+ return Navigation2;
364
364
  })(Navigation || {});
365
- var Annotation = /* @__PURE__ */ ((Annotation3) => {
366
- Annotation3[Annotation3["Dynamics"] = 0] = "Dynamics";
367
- Annotation3[Annotation3["Tempo"] = 1] = "Tempo";
368
- return Annotation3;
365
+ var Annotation = /* @__PURE__ */ ((Annotation2) => {
366
+ Annotation2[Annotation2["Dynamics"] = 0] = "Dynamics";
367
+ Annotation2[Annotation2["Tempo"] = 1] = "Tempo";
368
+ return Annotation2;
369
369
  })(Annotation || {});
370
- var Label = /* @__PURE__ */ ((Label3) => {
371
- Label3[Label3["Note"] = 0] = "Note";
372
- Label3[Label3["Chord"] = 1] = "Chord";
373
- return Label3;
370
+ var Label = /* @__PURE__ */ ((Label2) => {
371
+ Label2[Label2["Note"] = 0] = "Note";
372
+ Label2[Label2["Chord"] = 1] = "Chord";
373
+ return Label2;
374
374
  })(Label || {});
375
375
 
376
376
  // src/score/engine/music-object.ts
@@ -1663,7 +1663,7 @@ var ObjRest = class extends MusicObject {
1663
1663
  return [this, ...arr];
1664
1664
  }
1665
1665
  }
1666
- return [this];
1666
+ return [];
1667
1667
  }
1668
1668
  getBeamGroup() {
1669
1669
  return this.beamGroup;
@@ -1979,9 +1979,6 @@ var ObjBeamGroup = class _ObjBeamGroup extends MusicObject {
1979
1979
  }
1980
1980
  }
1981
1981
  static createTriplet(symbols) {
1982
- if (!symbols.every((s) => s.triplet)) {
1983
- return false;
1984
- }
1985
1982
  let MaxTripletNoteLenght = NoteLength2.Half;
1986
1983
  let len = symbols.map((s) => s.rhythmProps.noteLength);
1987
1984
  if (symbols.length == 2) {
@@ -2287,7 +2284,16 @@ var ObjStaffNoteGroup = class extends MusicObject {
2287
2284
  return this.mi;
2288
2285
  }
2289
2286
  pick(x, y) {
2290
- return this.getRect().contains(x, y) ? [this] : [];
2287
+ if (!this.getRect().contains(x, y)) {
2288
+ return [];
2289
+ }
2290
+ for (let i = 0; i < this.accidentals.length; i++) {
2291
+ let arr = this.accidentals[i].pick(x, y);
2292
+ if (arr.length > 0) {
2293
+ return [this, ...arr];
2294
+ }
2295
+ }
2296
+ return [this];
2291
2297
  }
2292
2298
  updateRect() {
2293
2299
  this.rect = this.noteHeadRects[0].copy();
@@ -2449,7 +2455,7 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
2449
2455
  return [this, ...arr];
2450
2456
  }
2451
2457
  }
2452
- return [this];
2458
+ return [];
2453
2459
  }
2454
2460
  getTopNote() {
2455
2461
  return this.notes[this.notes.length - 1];
@@ -3077,7 +3083,7 @@ var ObjRhythmColumn = class extends MusicObject {
3077
3083
  return [this, ...arr];
3078
3084
  }
3079
3085
  }
3080
- return [this];
3086
+ return [];
3081
3087
  }
3082
3088
  hasArpeggio() {
3083
3089
  return this.arpeggioDir !== void 0;
@@ -3973,8 +3979,9 @@ var Player = class _Player {
3973
3979
 
3974
3980
  // src/score/engine/obj-bar-line.ts
3975
3981
  var ObjStaffTabBarLine = class extends MusicObject {
3976
- constructor(line) {
3982
+ constructor(barLine, line) {
3977
3983
  super(line);
3984
+ this.barLine = barLine;
3978
3985
  this.line = line;
3979
3986
  __publicField(this, "lineRects", []);
3980
3987
  __publicField(this, "dotRects", []);
@@ -4029,7 +4036,7 @@ var ObjBarLine = class extends MusicObject {
4029
4036
  let dotW = DocumentSettings.DotSize * unitSize;
4030
4037
  let dotRadius = dotW / 2;
4031
4038
  row.getNotationLines().forEach((line) => {
4032
- let obj = new ObjStaffTabBarLine(line);
4039
+ let obj = new ObjStaffTabBarLine(this, line);
4033
4040
  let lineCenterY;
4034
4041
  let lineDotOff;
4035
4042
  let top, bottom;
@@ -4331,9 +4338,10 @@ var ObjFermata = class extends MusicObject {
4331
4338
 
4332
4339
  // src/score/engine/obj-extension-line.ts
4333
4340
  var ObjExtensionLine = class extends MusicObject {
4334
- constructor(measure, extension, leftObj, rightObj) {
4341
+ constructor(measure, line, extension, leftObj, rightObj) {
4335
4342
  super(measure);
4336
4343
  this.measure = measure;
4344
+ this.line = line;
4337
4345
  this.extension = extension;
4338
4346
  this.leftObj = leftObj;
4339
4347
  this.rightObj = rightObj;
@@ -4396,7 +4404,7 @@ var ObjExtensionLine = class extends MusicObject {
4396
4404
  ctx.setLineDash([]);
4397
4405
  let tails = this.extension.getTails();
4398
4406
  if (tails.length > 0 && this === tails[tails.length - 1]) {
4399
- let tipH = rect.centerY > this.measure.row.getRect().centerY ? -renderer.unitSize : renderer.unitSize;
4407
+ let tipH = rect.centerY > this.line.getRect().centerY ? -renderer.unitSize : renderer.unitSize;
4400
4408
  renderer.drawLine(rect.right, rect.centerY, rect.right, rect.centerY + tipH, "black", renderer.lineWidth);
4401
4409
  }
4402
4410
  }
@@ -5027,12 +5035,59 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5027
5035
  this.requestLayout();
5028
5036
  this.requestRectUpdate();
5029
5037
  }
5030
- addFermata(staffTabOrGroup, fermata) {
5038
+ forEachStaffGroup(staffTabOrGroups, defaultVerticalPos, addFn) {
5039
+ const lines = this.row.getNotationLines();
5040
+ const addToStaffTabOrGroup = (staffTabOrGroup, vpos, prevGroups = []) => {
5041
+ if (typeof staffTabOrGroup === "number") {
5042
+ if (lines[staffTabOrGroup]) {
5043
+ addFn(lines[staffTabOrGroup], vpos);
5044
+ }
5045
+ } else if (typeof staffTabOrGroup === "string" && staffTabOrGroup.length > 0) {
5046
+ let stavesAndTabs = lines.filter((l) => l.name === staffTabOrGroup);
5047
+ stavesAndTabs.forEach((line) => addFn(line, vpos));
5048
+ if (stavesAndTabs.length === 0) {
5049
+ let grp = this.doc.getStaffGroup(staffTabOrGroup);
5050
+ if (grp && !prevGroups.includes(staffTabOrGroup)) {
5051
+ let curGroups = [...prevGroups, staffTabOrGroup];
5052
+ (Utils8.Is.isArray(grp.staffsTabsAndGroups) ? grp.staffsTabsAndGroups : [grp.staffsTabsAndGroups]).forEach((staffTabOrGroup2) => {
5053
+ switch (grp.verticalPosition) {
5054
+ case 0 /* Above */:
5055
+ addToStaffTabOrGroup(staffTabOrGroup2, 0 /* Above */, curGroups);
5056
+ break;
5057
+ case 1 /* Below */:
5058
+ addToStaffTabOrGroup(staffTabOrGroup2, 1 /* Below */, curGroups);
5059
+ break;
5060
+ case 2 /* Both */:
5061
+ addToStaffTabOrGroup(staffTabOrGroup2, 0 /* Above */, curGroups);
5062
+ addToStaffTabOrGroup(staffTabOrGroup2, 1 /* Below */, curGroups);
5063
+ break;
5064
+ case 3 /* Auto */:
5065
+ addToStaffTabOrGroup(staffTabOrGroup2, defaultVerticalPos, curGroups);
5066
+ break;
5067
+ }
5068
+ });
5069
+ }
5070
+ }
5071
+ }
5072
+ };
5073
+ if (staffTabOrGroups === void 0) {
5074
+ if (lines.length >= 2 && lines[0] instanceof ObjStaff && lines[0].staffConfig.clef === "G" /* G */ && lines[0].isGrand() && lines[1] instanceof ObjStaff && lines[1].staffConfig.clef === "F" /* F */ && lines[1].isGrand()) {
5075
+ addToStaffTabOrGroup(defaultVerticalPos === 1 /* Below */ ? 1 : 0, defaultVerticalPos);
5076
+ } else {
5077
+ addToStaffTabOrGroup(0, defaultVerticalPos);
5078
+ }
5079
+ } else if (Utils8.Is.isArray(staffTabOrGroups)) {
5080
+ staffTabOrGroups.forEach((staffTabOrGroup) => addToStaffTabOrGroup(staffTabOrGroup, defaultVerticalPos));
5081
+ } else {
5082
+ addToStaffTabOrGroup(staffTabOrGroups, defaultVerticalPos);
5083
+ }
5084
+ }
5085
+ addFermata(staffTabOrGroups, fermata) {
5031
5086
  let anchor = fermata === 1 /* AtMeasureEnd */ ? this.barLineRight : this.lastAddedRhythmColumn;
5032
5087
  if (!anchor) {
5033
5088
  throw new MusicError13(MusicErrorType13.Score, "Cannot add Fermata because anchor is undefined.");
5034
5089
  }
5035
- this.forEachStaffGroup(staffTabOrGroup, 0 /* Above */, (line, vpos) => {
5090
+ this.forEachStaffGroup(staffTabOrGroups, 0 /* Above */, (line, vpos) => {
5036
5091
  this.addLayoutObject(new ObjFermata(anchor, vpos), line, 0 /* Fermata */, vpos);
5037
5092
  });
5038
5093
  this.disableExtension();
@@ -5041,7 +5096,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5041
5096
  hasFermata(anchor) {
5042
5097
  return this.layoutObjects.some((layoutObj) => layoutObj.musicObj instanceof ObjFermata && layoutObj.anchor === anchor);
5043
5098
  }
5044
- addNavigation(staffTabOrGroup, navigation, ...args) {
5099
+ addNavigation(staffTabOrGroups, navigation, ...args) {
5045
5100
  let addLayoutObjectProps = void 0;
5046
5101
  switch (navigation) {
5047
5102
  case 10 /* Ending */:
@@ -5067,7 +5122,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5067
5122
  layoutGroupId: 2 /* Navigation */,
5068
5123
  defaultVerticalPos: 0 /* Above */
5069
5124
  };
5070
- this.addNavigation(staffTabOrGroup, 9 /* EndRepeat */);
5125
+ this.addNavigation(staffTabOrGroups, 9 /* EndRepeat */);
5071
5126
  this.endSong();
5072
5127
  break;
5073
5128
  }
@@ -5120,7 +5175,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5120
5175
  break;
5121
5176
  }
5122
5177
  if (addLayoutObjectProps) {
5123
- this.forEachStaffGroup(staffTabOrGroup, addLayoutObjectProps.defaultVerticalPos, (line, vpos) => {
5178
+ this.forEachStaffGroup(staffTabOrGroups, addLayoutObjectProps.defaultVerticalPos, (line, vpos) => {
5124
5179
  this.addLayoutObject(addLayoutObjectProps.createObj(), line, addLayoutObjectProps.layoutGroupId, vpos);
5125
5180
  });
5126
5181
  }
@@ -5130,135 +5185,108 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5130
5185
  hasNavigation(n) {
5131
5186
  return this.navigationSet.has(n);
5132
5187
  }
5133
- getEnding() {
5134
- return this.layoutObjects.map((layoutObj) => layoutObj.musicObj).find((musicObj) => musicObj instanceof ObjEnding);
5135
- }
5136
- getEndRepeatPlayCount() {
5137
- return this.endRepeatPlayCount;
5138
- }
5139
- addConnective(connective, ...args) {
5140
- let anchor = this.lastAddedRhythmSymbol;
5141
- if (!(anchor instanceof ObjNoteGroup)) {
5142
- throw new MusicError13(MusicErrorType13.Score, "Connective can be added to note group only.");
5143
- }
5144
- if (connective === 0 /* Tie */) {
5145
- let tieSpan = Utils8.Is.isInteger(args[0]) || Utils8.Is.isEnumValue(args[0], TieType) ? args[0] : 2;
5146
- let noteAnchor = Utils8.Is.isEnumValue(args[1], NoteAnchor) ? args[1] : 0 /* Auto */;
5147
- anchor.startConnective(new ConnectiveProps(0 /* Tie */, tieSpan, noteAnchor, anchor));
5148
- } else if (connective === 1 /* Slur */) {
5149
- let slurSpan = Utils8.Is.isInteger(args[0]) ? args[0] : 2;
5150
- let noteAnchor = Utils8.Is.isEnumValue(args[1], NoteAnchor) ? args[1] : 0 /* Auto */;
5151
- anchor.startConnective(new ConnectiveProps(1 /* Slur */, slurSpan, noteAnchor, anchor));
5152
- } else if (connective === 2 /* Slide */) {
5153
- let noteAnchor = Utils8.Is.isEnumValue(args[0], NoteAnchor) ? args[0] : 0 /* Auto */;
5154
- anchor.startConnective(new ConnectiveProps(2 /* Slide */, 2, noteAnchor, anchor));
5155
- }
5156
- }
5157
- forEachStaffGroup(staffTabOrGroup, defaultVerticalPos, add) {
5158
- const lines = this.row.getNotationLines();
5159
- const performAdd = (lineId, vpos, depth) => {
5160
- if (depth >= 5) {
5161
- return;
5162
- }
5163
- let success = false;
5164
- if (typeof lineId === "number") {
5165
- if (lines[lineId]) {
5166
- add(lines[lineId], vpos);
5167
- success = true;
5168
- }
5169
- } else if (typeof lineId === "string" && lineId.length > 0) {
5170
- lines.filter((l) => l.name === lineId).forEach((line) => {
5171
- add(line, vpos);
5172
- success = true;
5173
- });
5174
- }
5175
- if (typeof lineId === "string" && !success) {
5176
- let grp = this.doc.getStaffGroup(lineId);
5177
- if (grp) {
5178
- (Utils8.Is.isArray(grp.staffsTabsAndGroups) ? grp.staffsTabsAndGroups : [grp.staffsTabsAndGroups]).forEach((lineId2) => {
5179
- switch (grp.verticalPosition) {
5180
- case 0 /* Above */:
5181
- performAdd(lineId2, 0 /* Above */, depth + 1);
5182
- break;
5183
- case 1 /* Below */:
5184
- performAdd(lineId2, 1 /* Below */, depth + 1);
5185
- break;
5186
- case 2 /* Both */:
5187
- performAdd(lineId2, 0 /* Above */, depth + 1);
5188
- performAdd(lineId2, 1 /* Below */, depth + 1);
5189
- break;
5190
- case 3 /* Auto */:
5191
- performAdd(lineId2, defaultVerticalPos, depth + 1);
5192
- break;
5193
- }
5194
- });
5195
- }
5196
- }
5197
- };
5198
- if (staffTabOrGroup === void 0) {
5199
- if (lines.length >= 2 && lines[0] instanceof ObjStaff && lines[0].staffConfig.clef === "G" /* G */ && lines[0].isGrand() && lines[1] instanceof ObjStaff && lines[1].staffConfig.clef === "F" /* F */ && lines[1].isGrand()) {
5200
- performAdd(defaultVerticalPos === 1 /* Below */ ? 1 : 0, defaultVerticalPos, 0);
5201
- } else {
5202
- performAdd(0, defaultVerticalPos, 0);
5203
- }
5204
- } else {
5205
- performAdd(staffTabOrGroup, defaultVerticalPos, 0);
5206
- }
5207
- }
5208
- addLabel(staffTabOrGroup, label, text) {
5188
+ addAnnotation(staffTabOrGroups, annotation, text) {
5209
5189
  let anchor = this.lastAddedRhythmColumn;
5210
5190
  if (!anchor) {
5211
- throw new MusicError13(MusicErrorType13.Score, "Cannot add label because anchor is undefined.");
5191
+ throw new MusicError13(MusicErrorType13.Score, "Cannot add annotation because anchor is undefined.");
5212
5192
  } else if (text.length === 0) {
5213
- throw new MusicError13(MusicErrorType13.Score, "Cannot add label because label text is empty.");
5193
+ throw new MusicError13(MusicErrorType13.Score, "Cannot add annotation because annotation text is empty.");
5214
5194
  }
5215
5195
  let textProps = { text };
5216
5196
  let layoutGroupId;
5217
5197
  let defaultVerticalPos;
5218
- switch (label) {
5219
- case 0 /* Note */:
5220
- layoutGroupId = 1 /* NoteLabel */;
5221
- defaultVerticalPos = 1 /* Below */;
5198
+ switch (annotation) {
5199
+ case 0 /* Dynamics */:
5200
+ layoutGroupId = 5 /* DynamicsAnnotation */;
5201
+ defaultVerticalPos = 0 /* Above */;
5202
+ textProps.italic = true;
5222
5203
  break;
5223
- case 1 /* Chord */:
5224
- layoutGroupId = 6 /* ChordLabel */;
5204
+ case 1 /* Tempo */:
5205
+ layoutGroupId = 4 /* TempoAnnotation */;
5225
5206
  defaultVerticalPos = 0 /* Above */;
5207
+ textProps.italic = true;
5226
5208
  break;
5227
5209
  }
5228
- this.forEachStaffGroup(staffTabOrGroup, defaultVerticalPos, (line, vpos) => {
5210
+ this.forEachStaffGroup(staffTabOrGroups, defaultVerticalPos, (line, vpos) => {
5229
5211
  let textObj = new ObjText(anchor, textProps, 0.5, 1);
5230
5212
  this.addLayoutObject(textObj, line, layoutGroupId, vpos);
5231
5213
  this.enableExtension(textObj);
5232
5214
  });
5233
5215
  }
5234
- addAnnotation(staffTabOrGroup, annotation, text) {
5216
+ addLabel(staffTabOrGroups, label, text) {
5235
5217
  let anchor = this.lastAddedRhythmColumn;
5236
5218
  if (!anchor) {
5237
- throw new MusicError13(MusicErrorType13.Score, "Cannot add annotation because anchor is undefined.");
5219
+ throw new MusicError13(MusicErrorType13.Score, "Cannot add label because anchor is undefined.");
5238
5220
  } else if (text.length === 0) {
5239
- throw new MusicError13(MusicErrorType13.Score, "Cannot add annotation because annotation text is empty.");
5221
+ throw new MusicError13(MusicErrorType13.Score, "Cannot add label because label text is empty.");
5240
5222
  }
5241
5223
  let textProps = { text };
5242
5224
  let layoutGroupId;
5243
5225
  let defaultVerticalPos;
5244
- switch (annotation) {
5245
- case 0 /* Dynamics */:
5246
- layoutGroupId = 5 /* DynamicsAnnotation */;
5247
- defaultVerticalPos = 0 /* Above */;
5248
- textProps.italic = true;
5226
+ switch (label) {
5227
+ case 0 /* Note */:
5228
+ layoutGroupId = 1 /* NoteLabel */;
5229
+ defaultVerticalPos = 1 /* Below */;
5249
5230
  break;
5250
- case 1 /* Tempo */:
5251
- layoutGroupId = 4 /* TempoAnnotation */;
5231
+ case 1 /* Chord */:
5232
+ layoutGroupId = 6 /* ChordLabel */;
5252
5233
  defaultVerticalPos = 0 /* Above */;
5253
- textProps.italic = true;
5254
5234
  break;
5255
5235
  }
5256
- this.forEachStaffGroup(staffTabOrGroup, defaultVerticalPos, (line, vpos) => {
5236
+ this.forEachStaffGroup(staffTabOrGroups, defaultVerticalPos, (line, vpos) => {
5257
5237
  let textObj = new ObjText(anchor, textProps, 0.5, 1);
5258
5238
  this.addLayoutObject(textObj, line, layoutGroupId, vpos);
5259
5239
  this.enableExtension(textObj);
5260
5240
  });
5261
5241
  }
5242
+ addConnective(connective, ...args) {
5243
+ let anchor = this.lastAddedRhythmSymbol;
5244
+ if (!(anchor instanceof ObjNoteGroup)) {
5245
+ throw new MusicError13(MusicErrorType13.Score, "Connective can be added to note group only.");
5246
+ }
5247
+ if (connective === 0 /* Tie */) {
5248
+ let tieSpan = Utils8.Is.isInteger(args[0]) || Utils8.Is.isEnumValue(args[0], TieType) ? args[0] : 2;
5249
+ let noteAnchor = Utils8.Is.isEnumValue(args[1], NoteAnchor) ? args[1] : 0 /* Auto */;
5250
+ anchor.startConnective(new ConnectiveProps(0 /* Tie */, tieSpan, noteAnchor, anchor));
5251
+ } else if (connective === 1 /* Slur */) {
5252
+ let slurSpan = Utils8.Is.isInteger(args[0]) ? args[0] : 2;
5253
+ let noteAnchor = Utils8.Is.isEnumValue(args[1], NoteAnchor) ? args[1] : 0 /* Auto */;
5254
+ anchor.startConnective(new ConnectiveProps(1 /* Slur */, slurSpan, noteAnchor, anchor));
5255
+ } else if (connective === 2 /* Slide */) {
5256
+ let noteAnchor = Utils8.Is.isEnumValue(args[0], NoteAnchor) ? args[0] : 0 /* Auto */;
5257
+ anchor.startConnective(new ConnectiveProps(2 /* Slide */, 2, noteAnchor, anchor));
5258
+ }
5259
+ }
5260
+ addExtension(extensionLength, extensionVisible) {
5261
+ this.addExtensionToMusicObjects.forEach((musicObj) => {
5262
+ let anchor = musicObj.getParent();
5263
+ if (musicObj instanceof ObjText && anchor instanceof ObjRhythmColumn) {
5264
+ let lineStyle = "dashed";
5265
+ let linePos = "bottom";
5266
+ let extension = new Extension(musicObj, anchor, extensionLength, extensionVisible, lineStyle, linePos);
5267
+ musicObj.setLink(extension);
5268
+ } else {
5269
+ throw new MusicError13(MusicErrorType13.Score, "Cannot add extension becaue no compatible music object to attach it to.");
5270
+ }
5271
+ });
5272
+ if (this.addExtensionToMusicObjects.length === 0) {
5273
+ throw new MusicError13(MusicErrorType13.Score, "Cannot add extension because music object to attach it to is undefined.");
5274
+ }
5275
+ this.disableExtension();
5276
+ this.requestLayout();
5277
+ }
5278
+ enableExtension(musicObject) {
5279
+ this.addExtensionToMusicObjects.push(musicObject);
5280
+ }
5281
+ disableExtension() {
5282
+ this.addExtensionToMusicObjects = [];
5283
+ }
5284
+ getEnding() {
5285
+ return this.layoutObjects.map((layoutObj) => layoutObj.musicObj).find((musicObj) => musicObj instanceof ObjEnding);
5286
+ }
5287
+ getEndRepeatPlayCount() {
5288
+ return this.endRepeatPlayCount;
5289
+ }
5262
5290
  endSong() {
5263
5291
  this.isEndSong = true;
5264
5292
  this.requestLayout();
@@ -5279,35 +5307,14 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5279
5307
  this.doc.requestNewRow();
5280
5308
  this.disableExtension();
5281
5309
  }
5282
- enableExtension(musicObject) {
5283
- this.addExtensionToMusicObjects.push(musicObject);
5284
- }
5285
- disableExtension() {
5286
- this.addExtensionToMusicObjects = [];
5287
- }
5288
- addExtension(extensionLength, extensionVisible) {
5289
- this.addExtensionToMusicObjects.forEach((musicObj) => {
5290
- let anchor = musicObj.getParent();
5291
- if (musicObj instanceof ObjText && anchor instanceof ObjRhythmColumn) {
5292
- let lineStyle = "dashed";
5293
- let linePos = "bottom";
5294
- let extension = new Extension(musicObj, anchor, extensionLength, extensionVisible, lineStyle, linePos);
5295
- musicObj.setLink(extension);
5296
- } else {
5297
- throw new MusicError13(MusicErrorType13.Score, "Cannot add extension becaue no compatible music object to attach it to.");
5298
- }
5299
- });
5300
- if (this.addExtensionToMusicObjects.length === 0) {
5301
- throw new MusicError13(MusicErrorType13.Score, "Cannot add extension because music object to attach it to is undefined.");
5302
- }
5303
- this.disableExtension();
5304
- this.requestLayout();
5305
- }
5306
5310
  addRhythmSymbol(voiceId, symbol) {
5307
5311
  let { col } = symbol;
5308
5312
  col.setVoiceSymbol(voiceId, symbol);
5309
5313
  this.getVoiceSymbols(voiceId);
5310
5314
  this.voiceSymbols[voiceId].push(symbol);
5315
+ if (symbol.triplet) {
5316
+ this.createOldStyleTriplets(voiceId);
5317
+ }
5311
5318
  this.requestBeamsUpdate();
5312
5319
  this.lastAddedRhythmColumn = col;
5313
5320
  this.lastAddedRhythmSymbol = symbol;
@@ -5447,7 +5454,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5447
5454
  const lines = m.row.getNotationLines();
5448
5455
  let line2 = (_a = lines.find((l) => l.name !== "" && l.name === line.name)) != null ? _a : lines[line.id];
5449
5456
  if (line2) {
5450
- m.addLayoutObject(new ObjExtensionLine(m, extension, leftObj, rightObj), line2, layoutGroupId, verticalPos);
5457
+ m.addLayoutObject(new ObjExtensionLine(m, line2, extension, leftObj, rightObj), line2, layoutGroupId, verticalPos);
5451
5458
  }
5452
5459
  }
5453
5460
  }
@@ -5461,28 +5468,41 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5461
5468
  requestBeamsUpdate() {
5462
5469
  this.needBeamsUpdate = true;
5463
5470
  }
5471
+ createOldStyleTriplets(voiceId) {
5472
+ let symbols = this.getVoiceSymbols(voiceId);
5473
+ if (symbols.length <= 2) {
5474
+ return;
5475
+ }
5476
+ for (let i = 0; i < symbols.length; ) {
5477
+ let s2 = symbols.slice(i, i + 2);
5478
+ let s3 = symbols.slice(i, i + 3);
5479
+ if (s2.length === 2 && s2.every((s) => s.triplet) && s2.every((s) => s.getBeamGroup() === void 0) && ObjBeamGroup.createTriplet(s2)) {
5480
+ i += 2;
5481
+ } else if (s3.length === 3 && s3.every((s) => s.triplet) && s3.every((s) => s.getBeamGroup() === void 0) && ObjBeamGroup.createTriplet(s3)) {
5482
+ i += 3;
5483
+ } else {
5484
+ i++;
5485
+ }
5486
+ }
5487
+ this.requestLayout();
5488
+ }
5464
5489
  createBeams() {
5465
- if (!this.needBeamsUpdate || !this.row.hasStaff) {
5490
+ if (!this.needBeamsUpdate) {
5466
5491
  return;
5467
5492
  }
5468
- this.beamGroups.forEach((beamGroup) => beamGroup.detach());
5469
- this.beamGroups.length = 0;
5493
+ this.beamGroups = this.beamGroups.filter((beamGroup) => {
5494
+ if (beamGroup.getType() === 0 /* RegularBeam */) {
5495
+ beamGroup.detach();
5496
+ return false;
5497
+ } else {
5498
+ return true;
5499
+ }
5500
+ });
5470
5501
  getVoiceIds().forEach((voiceId) => {
5471
5502
  let symbols = this.getVoiceSymbols(voiceId);
5472
5503
  if (symbols.length <= 2) {
5473
5504
  return;
5474
5505
  }
5475
- for (let i = 0; i < symbols.length; ) {
5476
- let s2 = symbols.slice(i, i + 2);
5477
- let s3 = symbols.slice(i, i + 3);
5478
- if (s2.length === 2 && ObjBeamGroup.createTriplet(s2)) {
5479
- i += 2;
5480
- } else if (s3.length === 3 && ObjBeamGroup.createTriplet(s3)) {
5481
- i += 3;
5482
- } else {
5483
- i++;
5484
- }
5485
- }
5486
5506
  if (!DebugSettings.DisableBeams) {
5487
5507
  let groupSymbols = [];
5488
5508
  let groupStartTicks = 0;
@@ -6435,8 +6455,8 @@ var ObjScoreRow = class extends MusicObject {
6435
6455
  updateRect() {
6436
6456
  let left = this.measures.length > 0 ? this.measures[0].getRect().left : 0;
6437
6457
  let right = this.measures.length > 0 ? this.measures[this.measures.length - 1].getRect().right : 0;
6438
- let top = Math.min(0, ...this.measures.map((m) => m.getRect().top));
6439
- let bottom = Math.max(0, ...this.measures.map((m) => m.getRect().bottom));
6458
+ let top = this.measures.length > 0 ? Math.min(...this.measures.map((m) => m.getRect().top)) : 0;
6459
+ let bottom = this.measures.length > 0 ? Math.max(...this.measures.map((m) => m.getRect().bottom)) : 0;
6440
6460
  this.rect = new DivRect(left, right, top, bottom);
6441
6461
  }
6442
6462
  alignStemsToBeams() {
@@ -6728,6 +6748,12 @@ var ObjDocument = class extends MusicObject {
6728
6748
  getLastRow() {
6729
6749
  return this.rows.length === 0 ? this.addNewRow(void 0) : this.rows[this.rows.length - 1];
6730
6750
  }
6751
+ getRows() {
6752
+ return this.rows;
6753
+ }
6754
+ getMeasures() {
6755
+ return this.measures;
6756
+ }
6731
6757
  requestNewRow() {
6732
6758
  this.newRowRequested = true;
6733
6759
  }
@@ -6928,6 +6954,15 @@ function assertRestOptions(options) {
6928
6954
  assertArg(Utils11.Is.isBooleanOrUndefined(options.hide), "restOptions.hide", options.hide);
6929
6955
  assertArg(Utils11.Is.isBooleanOrUndefined(options.triplet), "restOptions.triplet", options.triplet);
6930
6956
  }
6957
+ function assertStaffTabOrGRoups(staffTabOrGroups) {
6958
+ assertArg(
6959
+ Utils11.Is.isStringOrUndefined(staffTabOrGroups) || Utils11.Is.isIntegerGte(staffTabOrGroups, 0) || Utils11.Is.isArray(staffTabOrGroups) && staffTabOrGroups.every(
6960
+ (staffTabOrGroup) => Utils11.Is.isString(staffTabOrGroup) || Utils11.Is.isIntegerGte(staffTabOrGroup, 0)
6961
+ ),
6962
+ "staffTabOrGroup",
6963
+ staffTabOrGroups
6964
+ );
6965
+ }
6931
6966
  var DocumentBuilder = class {
6932
6967
  constructor() {
6933
6968
  __publicField(this, "doc");
@@ -7029,63 +7064,63 @@ var DocumentBuilder = class {
7029
7064
  this.getMeasure().addRest(voiceId, restLength, options);
7030
7065
  return this;
7031
7066
  }
7032
- addFermataInternal(staffTabOrGroup, fermata) {
7033
- assertArg(Utils11.Is.isStringOrUndefined(staffTabOrGroup) || Utils11.Is.isIntegerGte(staffTabOrGroup, 0), "staffTabOrGroup", staffTabOrGroup);
7067
+ addFermataInternal(staffTabOrGroups, fermata) {
7068
+ assertStaffTabOrGRoups(staffTabOrGroups);
7034
7069
  assertArg(Utils11.Is.isEnumValue(fermata, Fermata), "fermata", fermata);
7035
- this.getMeasure().addFermata(staffTabOrGroup, fermata);
7070
+ this.getMeasure().addFermata(staffTabOrGroups, fermata);
7036
7071
  return this;
7037
7072
  }
7038
7073
  addFermata(fermata = 0 /* AtNote */) {
7039
7074
  return this.addFermataInternal(void 0, fermata);
7040
7075
  }
7041
- /** @param staffTabOrGroup - staff/tab index (0=top), staff/tab name, or staff group name. */
7042
- addFermataTo(staffTabOrGroup, fermata = 0 /* AtNote */) {
7043
- return this.addFermataInternal(staffTabOrGroup, fermata);
7076
+ /** @param staffTabOrGroups - staff/tab index (0=top), staff/tab name, or staff group name. */
7077
+ addFermataTo(staffTabOrGroups, fermata = 0 /* AtNote */) {
7078
+ return this.addFermataInternal(staffTabOrGroups, fermata);
7044
7079
  }
7045
- addNavigationInternal(staffTabOrGroup, navigation, ...args) {
7046
- assertArg(Utils11.Is.isStringOrUndefined(staffTabOrGroup) || Utils11.Is.isIntegerGte(staffTabOrGroup, 0), "staffTabOrGroup", staffTabOrGroup);
7080
+ addNavigationInternal(staffTabOrGroups, navigation, ...args) {
7081
+ assertStaffTabOrGRoups(staffTabOrGroups);
7047
7082
  assertArg(Utils11.Is.isEnumValue(navigation, Navigation), "navigation", navigation);
7048
7083
  if (navigation === 9 /* EndRepeat */ && args.length > 0) {
7049
7084
  assertArg(Utils11.Is.isIntegerGte(args[0], 1), "playCount", args[0]);
7050
7085
  } else if (navigation === 10 /* Ending */ && args.length > 0) {
7051
7086
  assertArg(args.every((passage) => Utils11.Is.isIntegerGte(passage, 1)), "passages", args);
7052
7087
  }
7053
- this.getMeasure().addNavigation(staffTabOrGroup, navigation, ...args);
7088
+ this.getMeasure().addNavigation(staffTabOrGroups, navigation, ...args);
7054
7089
  return this;
7055
7090
  }
7056
7091
  addNavigation(navigation, ...args) {
7057
7092
  return this.addNavigationInternal(void 0, navigation, ...args);
7058
7093
  }
7059
- addNavigationTo(staffTabOrGroup, navigation, ...args) {
7060
- return this.addNavigationInternal(staffTabOrGroup, navigation, ...args);
7094
+ addNavigationTo(staffTabOrGroups, navigation, ...args) {
7095
+ return this.addNavigationInternal(staffTabOrGroups, navigation, ...args);
7061
7096
  }
7062
- addLabelInternal(staffTabOrGroup, label, text) {
7063
- assertArg(Utils11.Is.isStringOrUndefined(staffTabOrGroup) || Utils11.Is.isIntegerGte(staffTabOrGroup, 0), "staffTabOrGroup", staffTabOrGroup);
7097
+ addLabelInternal(staffTabOrGroups, label, text) {
7098
+ assertStaffTabOrGRoups(staffTabOrGroups);
7064
7099
  assertArg(Utils11.Is.isEnumValue(label, Label), "label", label);
7065
7100
  assertArg(Utils11.Is.isString(text), "text", text);
7066
- this.getMeasure().addLabel(staffTabOrGroup, label, text);
7101
+ this.getMeasure().addLabel(staffTabOrGroups, label, text);
7067
7102
  return this;
7068
7103
  }
7069
7104
  addLabel(label, text) {
7070
7105
  return this.addLabelInternal(void 0, label, text);
7071
7106
  }
7072
- /** @param staffTabOrGroup - staff/tab index (0=top), staff/tab name, or staff group name. */
7073
- addLabelTo(staffTabOrGroup, label, text) {
7074
- return this.addLabelInternal(staffTabOrGroup, label, text);
7107
+ /** @param staffTabOrGroups - staff/tab index (0=top), staff/tab name, or staff group name. */
7108
+ addLabelTo(staffTabOrGroups, label, text) {
7109
+ return this.addLabelInternal(staffTabOrGroups, label, text);
7075
7110
  }
7076
- addAnnotationInternal(staffTabOrGroup, annotation, text) {
7077
- assertArg(Utils11.Is.isStringOrUndefined(staffTabOrGroup) || Utils11.Is.isIntegerGte(staffTabOrGroup, 0), "staffTabOrGroup", staffTabOrGroup);
7111
+ addAnnotationInternal(staffTabOrGroups, annotation, text) {
7112
+ assertStaffTabOrGRoups(staffTabOrGroups);
7078
7113
  assertArg(Utils11.Is.isEnumValue(annotation, Annotation), "annotation", annotation);
7079
7114
  assertArg(Utils11.Is.isString(text), "text", text);
7080
- this.getMeasure().addAnnotation(staffTabOrGroup, annotation, text);
7115
+ this.getMeasure().addAnnotation(staffTabOrGroups, annotation, text);
7081
7116
  return this;
7082
7117
  }
7083
7118
  addAnnotation(annotation, text) {
7084
7119
  return this.addAnnotationInternal(void 0, annotation, text);
7085
7120
  }
7086
- /** @param staffTabOrGroup - staff/tab index (0=top), staff/tab name, or staff group name. */
7087
- addAnnotationTo(staffTabOrGroup, annotation, text) {
7088
- return this.addAnnotationInternal(staffTabOrGroup, annotation, text);
7121
+ /** @param staffTabOrGroups - staff/tab index (0=top), staff/tab name, or staff group name. */
7122
+ addAnnotationTo(staffTabOrGroups, annotation, text) {
7123
+ return this.addAnnotationInternal(staffTabOrGroups, annotation, text);
7089
7124
  }
7090
7125
  addConnective(connective, ...args) {
7091
7126
  assertArg(Utils11.Is.isEnumValue(connective, Connective), "connective", connective);
@@ -7218,6 +7253,13 @@ function require_t(t, message) {
7218
7253
  function isVoiceId2(value) {
7219
7254
  return Utils12.Is.isNumber(value) && getVoiceIds().indexOf(value) >= 0;
7220
7255
  }
7256
+ function getNotationLine(line) {
7257
+ if (line instanceof ObjStaff || line instanceof ObjTab) {
7258
+ return line.getMusicInterface();
7259
+ } else {
7260
+ throw new MusicError19(MusicErrorType19.Score, `Notation line not staff nor tab.`);
7261
+ }
7262
+ }
7221
7263
  var MusicInterface6 = class {
7222
7264
  constructor(name) {
7223
7265
  this.name = name;
@@ -7266,6 +7308,12 @@ var _MArpeggio = class _MArpeggio extends MusicInterface6 {
7266
7308
  getMusicObject() {
7267
7309
  return this.obj;
7268
7310
  }
7311
+ getRhythmColumn() {
7312
+ return this.obj.col.getMusicInterface();
7313
+ }
7314
+ getNotationLine() {
7315
+ return getNotationLine(this.obj.line);
7316
+ }
7269
7317
  };
7270
7318
  __publicField(_MArpeggio, "Name", "Arpeggio");
7271
7319
  var MArpeggio = _MArpeggio;
@@ -7292,6 +7340,9 @@ var _MStaffBeamGroup = class _MStaffBeamGroup extends MusicInterface6 {
7292
7340
  getMusicObject() {
7293
7341
  return this.obj;
7294
7342
  }
7343
+ getStaff() {
7344
+ return this.obj.staff.getMusicInterface();
7345
+ }
7295
7346
  };
7296
7347
  __publicField(_MStaffBeamGroup, "Name", "StaffBeamGroup");
7297
7348
  var MStaffBeamGroup = _MStaffBeamGroup;
@@ -7315,6 +7366,12 @@ var _MDocument = class _MDocument extends MusicInterface6 {
7315
7366
  getArranger() {
7316
7367
  return this.obj.getArranger();
7317
7368
  }
7369
+ getRows() {
7370
+ return this.obj.getRows().map((r) => r.getMusicInterface());
7371
+ }
7372
+ getMeasures() {
7373
+ return this.obj.getMeasures().map((m) => m.getMusicInterface());
7374
+ }
7318
7375
  play(fn) {
7319
7376
  assertArg2(Utils12.Is.isFunctionOrUndefined(fn), "playStateChangeListener", fn);
7320
7377
  return new MPlayer(this, fn).play();
@@ -7406,6 +7463,9 @@ var _MMeasure = class _MMeasure extends MusicInterface6 {
7406
7463
  getRhythmColumns() {
7407
7464
  return this.obj.getColumns().map((col) => col.getMusicInterface());
7408
7465
  }
7466
+ getRow() {
7467
+ return this.obj.row.getMusicInterface();
7468
+ }
7409
7469
  };
7410
7470
  __publicField(_MMeasure, "Name", "Measure");
7411
7471
  var MMeasure = _MMeasure;
@@ -7445,6 +7505,17 @@ var _MStaffTabBarLine = class _MStaffTabBarLine extends MusicInterface6 {
7445
7505
  getMusicObject() {
7446
7506
  return this.obj;
7447
7507
  }
7508
+ getBarLine() {
7509
+ let barLine = this.obj.barLine;
7510
+ if (barLine instanceof ObjBarLineLeft || barLine instanceof ObjBarLineRight) {
7511
+ return barLine.getMusicInterface();
7512
+ } else {
7513
+ throw new MusicError19(MusicErrorType19.Score, `Bar line not let nor right.`);
7514
+ }
7515
+ }
7516
+ getNotationLine() {
7517
+ return getNotationLine(this.obj.line);
7518
+ }
7448
7519
  };
7449
7520
  __publicField(_MStaffTabBarLine, "Name", "StaffTabBarLine");
7450
7521
  var MStaffTabBarLine = _MStaffTabBarLine;
@@ -7464,6 +7535,12 @@ var _MNoteGroup = class _MNoteGroup extends MusicInterface6 {
7464
7535
  getRhythmProps() {
7465
7536
  return this.obj.rhythmProps;
7466
7537
  }
7538
+ getRhythmColumn() {
7539
+ return this.obj.col.getMusicInterface();
7540
+ }
7541
+ getMeasure() {
7542
+ return this.obj.measure.getMusicInterface();
7543
+ }
7467
7544
  };
7468
7545
  __publicField(_MNoteGroup, "Name", "NoteGroup");
7469
7546
  var MNoteGroup = _MNoteGroup;
@@ -7480,6 +7557,15 @@ var _MStaffNoteGroup = class _MStaffNoteGroup extends MusicInterface6 {
7480
7557
  getNoteGroup() {
7481
7558
  return this.obj.noteGroup.getMusicInterface();
7482
7559
  }
7560
+ getRhythmColumn() {
7561
+ return this.getNoteGroup().getRhythmColumn();
7562
+ }
7563
+ getMeasure() {
7564
+ return this.getNoteGroup().getMeasure();
7565
+ }
7566
+ getStaff() {
7567
+ return this.obj.staff.getMusicInterface();
7568
+ }
7483
7569
  };
7484
7570
  __publicField(_MStaffNoteGroup, "Name", "StaffNoteGroup");
7485
7571
  var MStaffNoteGroup = _MStaffNoteGroup;
@@ -7496,6 +7582,15 @@ var _MTabNoteGroup = class _MTabNoteGroup extends MusicInterface6 {
7496
7582
  getNoteGroup() {
7497
7583
  return this.obj.noteGroup.getMusicInterface();
7498
7584
  }
7585
+ getRhythmColumn() {
7586
+ return this.getNoteGroup().getRhythmColumn();
7587
+ }
7588
+ getMeasure() {
7589
+ return this.getNoteGroup().getMeasure();
7590
+ }
7591
+ getTab() {
7592
+ return this.obj.tab.getMusicInterface();
7593
+ }
7499
7594
  };
7500
7595
  __publicField(_MTabNoteGroup, "Name", "TabNoteGroup");
7501
7596
  var MTabNoteGroup = _MTabNoteGroup;
@@ -7512,6 +7607,12 @@ var _MRest = class _MRest extends MusicInterface6 {
7512
7607
  getRhythmProps() {
7513
7608
  return this.obj.rhythmProps;
7514
7609
  }
7610
+ getRhythmColumn() {
7611
+ return this.obj.col.getMusicInterface();
7612
+ }
7613
+ getMeasure() {
7614
+ return this.obj.measure.getMusicInterface();
7615
+ }
7515
7616
  };
7516
7617
  __publicField(_MRest, "Name", "Rest");
7517
7618
  var MRest = _MRest;
@@ -7528,6 +7629,15 @@ var _MStaffRest = class _MStaffRest extends MusicInterface6 {
7528
7629
  getRest() {
7529
7630
  return this.obj.rest.getMusicInterface();
7530
7631
  }
7632
+ getRhythmColumn() {
7633
+ return this.getRest().getRhythmColumn();
7634
+ }
7635
+ getMeasure() {
7636
+ return this.getRest().getMeasure();
7637
+ }
7638
+ getStaff() {
7639
+ return this.obj.staff.getMusicInterface();
7640
+ }
7531
7641
  };
7532
7642
  __publicField(_MStaffRest, "Name", "StaffRest");
7533
7643
  var MStaffRest = _MStaffRest;
@@ -7546,6 +7656,13 @@ var _MRhythmColumn = class _MRhythmColumn extends MusicInterface6 {
7546
7656
  assertArg2(isVoiceId2(voiceId), "voiceId", voiceId);
7547
7657
  return (_a = this.obj.getVoiceSymbol(voiceId)) == null ? void 0 : _a.getMusicInterface();
7548
7658
  }
7659
+ getMeasure() {
7660
+ return this.obj.measure.getMusicInterface();
7661
+ }
7662
+ getVoiceSymbol(voiceId) {
7663
+ let s = this.obj.getVoiceSymbol(voiceId);
7664
+ return s instanceof ObjNoteGroup || s instanceof ObjRest ? s.getMusicInterface() : void 0;
7665
+ }
7549
7666
  };
7550
7667
  __publicField(_MRhythmColumn, "Name", "RhythmColumn");
7551
7668
  var MRhythmColumn = _MRhythmColumn;
@@ -7559,9 +7676,15 @@ var _MScoreRow = class _MScoreRow extends MusicInterface6 {
7559
7676
  getMusicObject() {
7560
7677
  return this.obj;
7561
7678
  }
7679
+ getDocument() {
7680
+ return this.obj.doc.getMusicInterface();
7681
+ }
7562
7682
  getMeasures() {
7563
7683
  return this.obj.getMeasures().map((m) => m.getMusicInterface());
7564
7684
  }
7685
+ getNotationLines() {
7686
+ return this.obj.getNotationLines().map((line) => getNotationLine(line));
7687
+ }
7565
7688
  };
7566
7689
  __publicField(_MScoreRow, "Name", "ScoreRow");
7567
7690
  var MScoreRow = _MScoreRow;
@@ -7575,6 +7698,15 @@ var _MStaff = class _MStaff extends MusicInterface6 {
7575
7698
  getMusicObject() {
7576
7699
  return this.obj;
7577
7700
  }
7701
+ getId() {
7702
+ return this.obj.id;
7703
+ }
7704
+ getName() {
7705
+ return this.obj.name.length > 0 ? this.obj.name : void 0;
7706
+ }
7707
+ getRow() {
7708
+ return this.obj.row.getMusicInterface();
7709
+ }
7578
7710
  };
7579
7711
  __publicField(_MStaff, "Name", "Staff");
7580
7712
  var MStaff = _MStaff;
@@ -7588,6 +7720,15 @@ var _MTab = class _MTab extends MusicInterface6 {
7588
7720
  getMusicObject() {
7589
7721
  return this.obj;
7590
7722
  }
7723
+ getId() {
7724
+ return this.obj.id;
7725
+ }
7726
+ getName() {
7727
+ return this.obj.name.length > 0 ? this.obj.name : void 0;
7728
+ }
7729
+ getRow() {
7730
+ return this.obj.row.getMusicInterface();
7731
+ }
7591
7732
  };
7592
7733
  __publicField(_MTab, "Name", "Tab");
7593
7734
  var MTab = _MTab;
@@ -7601,6 +7742,9 @@ var _MSignature = class _MSignature extends MusicInterface6 {
7601
7742
  getMusicObject() {
7602
7743
  return this.obj;
7603
7744
  }
7745
+ getStaff() {
7746
+ return this.obj.staff.getMusicInterface();
7747
+ }
7604
7748
  };
7605
7749
  __publicField(_MSignature, "Name", "Signature");
7606
7750
  var MSignature = _MSignature;
@@ -7614,6 +7758,9 @@ var _MSpecialText = class _MSpecialText extends MusicInterface6 {
7614
7758
  getMusicObject() {
7615
7759
  return this.obj;
7616
7760
  }
7761
+ getText() {
7762
+ return this.obj.getText();
7763
+ }
7617
7764
  };
7618
7765
  __publicField(_MSpecialText, "Name", "SpecialText");
7619
7766
  var MSpecialText = _MSpecialText;