@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,4 +1,4 @@
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
  "use strict";
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
@@ -364,19 +364,19 @@ var DivRect = class _DivRect {
364
364
  var import_ts_utils_lib11 = require("@tspro/ts-utils-lib");
365
365
 
366
366
  // src/score/pub/types.ts
367
- var StaffPreset = /* @__PURE__ */ ((StaffPreset4) => {
368
- StaffPreset4[StaffPreset4["Treble"] = 1] = "Treble";
369
- StaffPreset4[StaffPreset4["Bass"] = 2] = "Bass";
370
- StaffPreset4[StaffPreset4["Grand"] = 3] = "Grand";
371
- StaffPreset4[StaffPreset4["GuitarTreble"] = 4] = "GuitarTreble";
372
- StaffPreset4[StaffPreset4["GuitarTab"] = 8] = "GuitarTab";
373
- StaffPreset4[StaffPreset4["GuitarCombined"] = 12] = "GuitarCombined";
374
- return StaffPreset4;
367
+ var StaffPreset = /* @__PURE__ */ ((StaffPreset3) => {
368
+ StaffPreset3[StaffPreset3["Treble"] = 1] = "Treble";
369
+ StaffPreset3[StaffPreset3["Bass"] = 2] = "Bass";
370
+ StaffPreset3[StaffPreset3["Grand"] = 3] = "Grand";
371
+ StaffPreset3[StaffPreset3["GuitarTreble"] = 4] = "GuitarTreble";
372
+ StaffPreset3[StaffPreset3["GuitarTab"] = 8] = "GuitarTab";
373
+ StaffPreset3[StaffPreset3["GuitarCombined"] = 12] = "GuitarCombined";
374
+ return StaffPreset3;
375
375
  })(StaffPreset || {});
376
- var Clef = /* @__PURE__ */ ((Clef3) => {
377
- Clef3["G"] = "G";
378
- Clef3["F"] = "F";
379
- return Clef3;
376
+ var Clef = /* @__PURE__ */ ((Clef2) => {
377
+ Clef2["G"] = "G";
378
+ Clef2["F"] = "F";
379
+ return Clef2;
380
380
  })(Clef || {});
381
381
  function getVoiceIds() {
382
382
  return [0, 1, 2, 3];
@@ -384,21 +384,21 @@ function getVoiceIds() {
384
384
  function getStringNumbers() {
385
385
  return [1, 2, 3, 4, 5, 6];
386
386
  }
387
- var Stem = /* @__PURE__ */ ((Stem3) => {
388
- Stem3[Stem3["Auto"] = 0] = "Auto";
389
- Stem3[Stem3["Up"] = 1] = "Up";
390
- Stem3[Stem3["Down"] = 2] = "Down";
391
- return Stem3;
387
+ var Stem = /* @__PURE__ */ ((Stem2) => {
388
+ Stem2[Stem2["Auto"] = 0] = "Auto";
389
+ Stem2[Stem2["Up"] = 1] = "Up";
390
+ Stem2[Stem2["Down"] = 2] = "Down";
391
+ return Stem2;
392
392
  })(Stem || {});
393
393
  var Arpeggio = /* @__PURE__ */ ((Arpeggio2) => {
394
394
  Arpeggio2[Arpeggio2["Up"] = 0] = "Up";
395
395
  Arpeggio2[Arpeggio2["Down"] = 1] = "Down";
396
396
  return Arpeggio2;
397
397
  })(Arpeggio || {});
398
- var TieType = /* @__PURE__ */ ((TieType3) => {
399
- TieType3[TieType3["Stub"] = -1] = "Stub";
400
- TieType3[TieType3["ToMeasureEnd"] = -2] = "ToMeasureEnd";
401
- return TieType3;
398
+ var TieType = /* @__PURE__ */ ((TieType2) => {
399
+ TieType2[TieType2["Stub"] = -1] = "Stub";
400
+ TieType2[TieType2["ToMeasureEnd"] = -2] = "ToMeasureEnd";
401
+ return TieType2;
402
402
  })(TieType || {});
403
403
  var NoteAnchor = /* @__PURE__ */ ((NoteAnchor2) => {
404
404
  NoteAnchor2[NoteAnchor2["Auto"] = 0] = "Auto";
@@ -408,11 +408,11 @@ var NoteAnchor = /* @__PURE__ */ ((NoteAnchor2) => {
408
408
  NoteAnchor2[NoteAnchor2["StemTip"] = 4] = "StemTip";
409
409
  return NoteAnchor2;
410
410
  })(NoteAnchor || {});
411
- var Connective = /* @__PURE__ */ ((Connective3) => {
412
- Connective3[Connective3["Tie"] = 0] = "Tie";
413
- Connective3[Connective3["Slur"] = 1] = "Slur";
414
- Connective3[Connective3["Slide"] = 2] = "Slide";
415
- return Connective3;
411
+ var Connective = /* @__PURE__ */ ((Connective2) => {
412
+ Connective2[Connective2["Tie"] = 0] = "Tie";
413
+ Connective2[Connective2["Slur"] = 1] = "Slur";
414
+ Connective2[Connective2["Slide"] = 2] = "Slide";
415
+ return Connective2;
416
416
  })(Connective || {});
417
417
  var VerticalPosition = /* @__PURE__ */ ((VerticalPosition4) => {
418
418
  VerticalPosition4[VerticalPosition4["Above"] = 0] = "Above";
@@ -427,34 +427,34 @@ var PlayState = /* @__PURE__ */ ((PlayState2) => {
427
427
  PlayState2[PlayState2["Stopped"] = 2] = "Stopped";
428
428
  return PlayState2;
429
429
  })(PlayState || {});
430
- var Fermata = /* @__PURE__ */ ((Fermata3) => {
431
- Fermata3[Fermata3["AtNote"] = 0] = "AtNote";
432
- Fermata3[Fermata3["AtMeasureEnd"] = 1] = "AtMeasureEnd";
433
- return Fermata3;
430
+ var Fermata = /* @__PURE__ */ ((Fermata2) => {
431
+ Fermata2[Fermata2["AtNote"] = 0] = "AtNote";
432
+ Fermata2[Fermata2["AtMeasureEnd"] = 1] = "AtMeasureEnd";
433
+ return Fermata2;
434
434
  })(Fermata || {});
435
- var Navigation = /* @__PURE__ */ ((Navigation3) => {
436
- Navigation3[Navigation3["DC_al_Fine"] = 0] = "DC_al_Fine";
437
- Navigation3[Navigation3["DC_al_Coda"] = 1] = "DC_al_Coda";
438
- Navigation3[Navigation3["DS_al_Fine"] = 2] = "DS_al_Fine";
439
- Navigation3[Navigation3["DS_al_Coda"] = 3] = "DS_al_Coda";
440
- Navigation3[Navigation3["Coda"] = 4] = "Coda";
441
- Navigation3[Navigation3["toCoda"] = 5] = "toCoda";
442
- Navigation3[Navigation3["Segno"] = 6] = "Segno";
443
- Navigation3[Navigation3["Fine"] = 7] = "Fine";
444
- Navigation3[Navigation3["StartRepeat"] = 8] = "StartRepeat";
445
- Navigation3[Navigation3["EndRepeat"] = 9] = "EndRepeat";
446
- Navigation3[Navigation3["Ending"] = 10] = "Ending";
447
- return Navigation3;
435
+ var Navigation = /* @__PURE__ */ ((Navigation2) => {
436
+ Navigation2[Navigation2["DC_al_Fine"] = 0] = "DC_al_Fine";
437
+ Navigation2[Navigation2["DC_al_Coda"] = 1] = "DC_al_Coda";
438
+ Navigation2[Navigation2["DS_al_Fine"] = 2] = "DS_al_Fine";
439
+ Navigation2[Navigation2["DS_al_Coda"] = 3] = "DS_al_Coda";
440
+ Navigation2[Navigation2["Coda"] = 4] = "Coda";
441
+ Navigation2[Navigation2["toCoda"] = 5] = "toCoda";
442
+ Navigation2[Navigation2["Segno"] = 6] = "Segno";
443
+ Navigation2[Navigation2["Fine"] = 7] = "Fine";
444
+ Navigation2[Navigation2["StartRepeat"] = 8] = "StartRepeat";
445
+ Navigation2[Navigation2["EndRepeat"] = 9] = "EndRepeat";
446
+ Navigation2[Navigation2["Ending"] = 10] = "Ending";
447
+ return Navigation2;
448
448
  })(Navigation || {});
449
- var Annotation = /* @__PURE__ */ ((Annotation3) => {
450
- Annotation3[Annotation3["Dynamics"] = 0] = "Dynamics";
451
- Annotation3[Annotation3["Tempo"] = 1] = "Tempo";
452
- return Annotation3;
449
+ var Annotation = /* @__PURE__ */ ((Annotation2) => {
450
+ Annotation2[Annotation2["Dynamics"] = 0] = "Dynamics";
451
+ Annotation2[Annotation2["Tempo"] = 1] = "Tempo";
452
+ return Annotation2;
453
453
  })(Annotation || {});
454
- var Label = /* @__PURE__ */ ((Label3) => {
455
- Label3[Label3["Note"] = 0] = "Note";
456
- Label3[Label3["Chord"] = 1] = "Chord";
457
- return Label3;
454
+ var Label = /* @__PURE__ */ ((Label2) => {
455
+ Label2[Label2["Note"] = 0] = "Note";
456
+ Label2[Label2["Chord"] = 1] = "Chord";
457
+ return Label2;
458
458
  })(Label || {});
459
459
 
460
460
  // src/score/engine/music-object.ts
@@ -1747,7 +1747,7 @@ var ObjRest = class extends MusicObject {
1747
1747
  return [this, ...arr];
1748
1748
  }
1749
1749
  }
1750
- return [this];
1750
+ return [];
1751
1751
  }
1752
1752
  getBeamGroup() {
1753
1753
  return this.beamGroup;
@@ -2063,9 +2063,6 @@ var ObjBeamGroup = class _ObjBeamGroup extends MusicObject {
2063
2063
  }
2064
2064
  }
2065
2065
  static createTriplet(symbols) {
2066
- if (!symbols.every((s) => s.triplet)) {
2067
- return false;
2068
- }
2069
2066
  let MaxTripletNoteLenght = import_theory4.NoteLength.Half;
2070
2067
  let len = symbols.map((s) => s.rhythmProps.noteLength);
2071
2068
  if (symbols.length == 2) {
@@ -2371,7 +2368,16 @@ var ObjStaffNoteGroup = class extends MusicObject {
2371
2368
  return this.mi;
2372
2369
  }
2373
2370
  pick(x, y) {
2374
- return this.getRect().contains(x, y) ? [this] : [];
2371
+ if (!this.getRect().contains(x, y)) {
2372
+ return [];
2373
+ }
2374
+ for (let i = 0; i < this.accidentals.length; i++) {
2375
+ let arr = this.accidentals[i].pick(x, y);
2376
+ if (arr.length > 0) {
2377
+ return [this, ...arr];
2378
+ }
2379
+ }
2380
+ return [this];
2375
2381
  }
2376
2382
  updateRect() {
2377
2383
  this.rect = this.noteHeadRects[0].copy();
@@ -2533,7 +2539,7 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
2533
2539
  return [this, ...arr];
2534
2540
  }
2535
2541
  }
2536
- return [this];
2542
+ return [];
2537
2543
  }
2538
2544
  getTopNote() {
2539
2545
  return this.notes[this.notes.length - 1];
@@ -3161,7 +3167,7 @@ var ObjRhythmColumn = class extends MusicObject {
3161
3167
  return [this, ...arr];
3162
3168
  }
3163
3169
  }
3164
- return [this];
3170
+ return [];
3165
3171
  }
3166
3172
  hasArpeggio() {
3167
3173
  return this.arpeggioDir !== void 0;
@@ -4057,8 +4063,9 @@ var Player = class _Player {
4057
4063
 
4058
4064
  // src/score/engine/obj-bar-line.ts
4059
4065
  var ObjStaffTabBarLine = class extends MusicObject {
4060
- constructor(line) {
4066
+ constructor(barLine, line) {
4061
4067
  super(line);
4068
+ this.barLine = barLine;
4062
4069
  this.line = line;
4063
4070
  __publicField(this, "lineRects", []);
4064
4071
  __publicField(this, "dotRects", []);
@@ -4113,7 +4120,7 @@ var ObjBarLine = class extends MusicObject {
4113
4120
  let dotW = DocumentSettings.DotSize * unitSize;
4114
4121
  let dotRadius = dotW / 2;
4115
4122
  row.getNotationLines().forEach((line) => {
4116
- let obj = new ObjStaffTabBarLine(line);
4123
+ let obj = new ObjStaffTabBarLine(this, line);
4117
4124
  let lineCenterY;
4118
4125
  let lineDotOff;
4119
4126
  let top, bottom;
@@ -4415,9 +4422,10 @@ var ObjFermata = class extends MusicObject {
4415
4422
 
4416
4423
  // src/score/engine/obj-extension-line.ts
4417
4424
  var ObjExtensionLine = class extends MusicObject {
4418
- constructor(measure, extension, leftObj, rightObj) {
4425
+ constructor(measure, line, extension, leftObj, rightObj) {
4419
4426
  super(measure);
4420
4427
  this.measure = measure;
4428
+ this.line = line;
4421
4429
  this.extension = extension;
4422
4430
  this.leftObj = leftObj;
4423
4431
  this.rightObj = rightObj;
@@ -4480,7 +4488,7 @@ var ObjExtensionLine = class extends MusicObject {
4480
4488
  ctx.setLineDash([]);
4481
4489
  let tails = this.extension.getTails();
4482
4490
  if (tails.length > 0 && this === tails[tails.length - 1]) {
4483
- let tipH = rect.centerY > this.measure.row.getRect().centerY ? -renderer.unitSize : renderer.unitSize;
4491
+ let tipH = rect.centerY > this.line.getRect().centerY ? -renderer.unitSize : renderer.unitSize;
4484
4492
  renderer.drawLine(rect.right, rect.centerY, rect.right, rect.centerY + tipH, "black", renderer.lineWidth);
4485
4493
  }
4486
4494
  }
@@ -5111,12 +5119,59 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5111
5119
  this.requestLayout();
5112
5120
  this.requestRectUpdate();
5113
5121
  }
5114
- addFermata(staffTabOrGroup, fermata) {
5122
+ forEachStaffGroup(staffTabOrGroups, defaultVerticalPos, addFn) {
5123
+ const lines = this.row.getNotationLines();
5124
+ const addToStaffTabOrGroup = (staffTabOrGroup, vpos, prevGroups = []) => {
5125
+ if (typeof staffTabOrGroup === "number") {
5126
+ if (lines[staffTabOrGroup]) {
5127
+ addFn(lines[staffTabOrGroup], vpos);
5128
+ }
5129
+ } else if (typeof staffTabOrGroup === "string" && staffTabOrGroup.length > 0) {
5130
+ let stavesAndTabs = lines.filter((l) => l.name === staffTabOrGroup);
5131
+ stavesAndTabs.forEach((line) => addFn(line, vpos));
5132
+ if (stavesAndTabs.length === 0) {
5133
+ let grp = this.doc.getStaffGroup(staffTabOrGroup);
5134
+ if (grp && !prevGroups.includes(staffTabOrGroup)) {
5135
+ let curGroups = [...prevGroups, staffTabOrGroup];
5136
+ (import_ts_utils_lib8.Utils.Is.isArray(grp.staffsTabsAndGroups) ? grp.staffsTabsAndGroups : [grp.staffsTabsAndGroups]).forEach((staffTabOrGroup2) => {
5137
+ switch (grp.verticalPosition) {
5138
+ case 0 /* Above */:
5139
+ addToStaffTabOrGroup(staffTabOrGroup2, 0 /* Above */, curGroups);
5140
+ break;
5141
+ case 1 /* Below */:
5142
+ addToStaffTabOrGroup(staffTabOrGroup2, 1 /* Below */, curGroups);
5143
+ break;
5144
+ case 2 /* Both */:
5145
+ addToStaffTabOrGroup(staffTabOrGroup2, 0 /* Above */, curGroups);
5146
+ addToStaffTabOrGroup(staffTabOrGroup2, 1 /* Below */, curGroups);
5147
+ break;
5148
+ case 3 /* Auto */:
5149
+ addToStaffTabOrGroup(staffTabOrGroup2, defaultVerticalPos, curGroups);
5150
+ break;
5151
+ }
5152
+ });
5153
+ }
5154
+ }
5155
+ }
5156
+ };
5157
+ if (staffTabOrGroups === void 0) {
5158
+ 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()) {
5159
+ addToStaffTabOrGroup(defaultVerticalPos === 1 /* Below */ ? 1 : 0, defaultVerticalPos);
5160
+ } else {
5161
+ addToStaffTabOrGroup(0, defaultVerticalPos);
5162
+ }
5163
+ } else if (import_ts_utils_lib8.Utils.Is.isArray(staffTabOrGroups)) {
5164
+ staffTabOrGroups.forEach((staffTabOrGroup) => addToStaffTabOrGroup(staffTabOrGroup, defaultVerticalPos));
5165
+ } else {
5166
+ addToStaffTabOrGroup(staffTabOrGroups, defaultVerticalPos);
5167
+ }
5168
+ }
5169
+ addFermata(staffTabOrGroups, fermata) {
5115
5170
  let anchor = fermata === 1 /* AtMeasureEnd */ ? this.barLineRight : this.lastAddedRhythmColumn;
5116
5171
  if (!anchor) {
5117
5172
  throw new import_core13.MusicError(import_core13.MusicErrorType.Score, "Cannot add Fermata because anchor is undefined.");
5118
5173
  }
5119
- this.forEachStaffGroup(staffTabOrGroup, 0 /* Above */, (line, vpos) => {
5174
+ this.forEachStaffGroup(staffTabOrGroups, 0 /* Above */, (line, vpos) => {
5120
5175
  this.addLayoutObject(new ObjFermata(anchor, vpos), line, 0 /* Fermata */, vpos);
5121
5176
  });
5122
5177
  this.disableExtension();
@@ -5125,7 +5180,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5125
5180
  hasFermata(anchor) {
5126
5181
  return this.layoutObjects.some((layoutObj) => layoutObj.musicObj instanceof ObjFermata && layoutObj.anchor === anchor);
5127
5182
  }
5128
- addNavigation(staffTabOrGroup, navigation, ...args) {
5183
+ addNavigation(staffTabOrGroups, navigation, ...args) {
5129
5184
  let addLayoutObjectProps = void 0;
5130
5185
  switch (navigation) {
5131
5186
  case 10 /* Ending */:
@@ -5151,7 +5206,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5151
5206
  layoutGroupId: 2 /* Navigation */,
5152
5207
  defaultVerticalPos: 0 /* Above */
5153
5208
  };
5154
- this.addNavigation(staffTabOrGroup, 9 /* EndRepeat */);
5209
+ this.addNavigation(staffTabOrGroups, 9 /* EndRepeat */);
5155
5210
  this.endSong();
5156
5211
  break;
5157
5212
  }
@@ -5204,7 +5259,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5204
5259
  break;
5205
5260
  }
5206
5261
  if (addLayoutObjectProps) {
5207
- this.forEachStaffGroup(staffTabOrGroup, addLayoutObjectProps.defaultVerticalPos, (line, vpos) => {
5262
+ this.forEachStaffGroup(staffTabOrGroups, addLayoutObjectProps.defaultVerticalPos, (line, vpos) => {
5208
5263
  this.addLayoutObject(addLayoutObjectProps.createObj(), line, addLayoutObjectProps.layoutGroupId, vpos);
5209
5264
  });
5210
5265
  }
@@ -5214,135 +5269,108 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5214
5269
  hasNavigation(n) {
5215
5270
  return this.navigationSet.has(n);
5216
5271
  }
5217
- getEnding() {
5218
- return this.layoutObjects.map((layoutObj) => layoutObj.musicObj).find((musicObj) => musicObj instanceof ObjEnding);
5219
- }
5220
- getEndRepeatPlayCount() {
5221
- return this.endRepeatPlayCount;
5222
- }
5223
- addConnective(connective, ...args) {
5224
- let anchor = this.lastAddedRhythmSymbol;
5225
- if (!(anchor instanceof ObjNoteGroup)) {
5226
- throw new import_core13.MusicError(import_core13.MusicErrorType.Score, "Connective can be added to note group only.");
5227
- }
5228
- if (connective === 0 /* Tie */) {
5229
- let tieSpan = import_ts_utils_lib8.Utils.Is.isInteger(args[0]) || import_ts_utils_lib8.Utils.Is.isEnumValue(args[0], TieType) ? args[0] : 2;
5230
- let noteAnchor = import_ts_utils_lib8.Utils.Is.isEnumValue(args[1], NoteAnchor) ? args[1] : 0 /* Auto */;
5231
- anchor.startConnective(new ConnectiveProps(0 /* Tie */, tieSpan, noteAnchor, anchor));
5232
- } else if (connective === 1 /* Slur */) {
5233
- let slurSpan = import_ts_utils_lib8.Utils.Is.isInteger(args[0]) ? args[0] : 2;
5234
- let noteAnchor = import_ts_utils_lib8.Utils.Is.isEnumValue(args[1], NoteAnchor) ? args[1] : 0 /* Auto */;
5235
- anchor.startConnective(new ConnectiveProps(1 /* Slur */, slurSpan, noteAnchor, anchor));
5236
- } else if (connective === 2 /* Slide */) {
5237
- let noteAnchor = import_ts_utils_lib8.Utils.Is.isEnumValue(args[0], NoteAnchor) ? args[0] : 0 /* Auto */;
5238
- anchor.startConnective(new ConnectiveProps(2 /* Slide */, 2, noteAnchor, anchor));
5239
- }
5240
- }
5241
- forEachStaffGroup(staffTabOrGroup, defaultVerticalPos, add) {
5242
- const lines = this.row.getNotationLines();
5243
- const performAdd = (lineId, vpos, depth) => {
5244
- if (depth >= 5) {
5245
- return;
5246
- }
5247
- let success = false;
5248
- if (typeof lineId === "number") {
5249
- if (lines[lineId]) {
5250
- add(lines[lineId], vpos);
5251
- success = true;
5252
- }
5253
- } else if (typeof lineId === "string" && lineId.length > 0) {
5254
- lines.filter((l) => l.name === lineId).forEach((line) => {
5255
- add(line, vpos);
5256
- success = true;
5257
- });
5258
- }
5259
- if (typeof lineId === "string" && !success) {
5260
- let grp = this.doc.getStaffGroup(lineId);
5261
- if (grp) {
5262
- (import_ts_utils_lib8.Utils.Is.isArray(grp.staffsTabsAndGroups) ? grp.staffsTabsAndGroups : [grp.staffsTabsAndGroups]).forEach((lineId2) => {
5263
- switch (grp.verticalPosition) {
5264
- case 0 /* Above */:
5265
- performAdd(lineId2, 0 /* Above */, depth + 1);
5266
- break;
5267
- case 1 /* Below */:
5268
- performAdd(lineId2, 1 /* Below */, depth + 1);
5269
- break;
5270
- case 2 /* Both */:
5271
- performAdd(lineId2, 0 /* Above */, depth + 1);
5272
- performAdd(lineId2, 1 /* Below */, depth + 1);
5273
- break;
5274
- case 3 /* Auto */:
5275
- performAdd(lineId2, defaultVerticalPos, depth + 1);
5276
- break;
5277
- }
5278
- });
5279
- }
5280
- }
5281
- };
5282
- if (staffTabOrGroup === void 0) {
5283
- 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()) {
5284
- performAdd(defaultVerticalPos === 1 /* Below */ ? 1 : 0, defaultVerticalPos, 0);
5285
- } else {
5286
- performAdd(0, defaultVerticalPos, 0);
5287
- }
5288
- } else {
5289
- performAdd(staffTabOrGroup, defaultVerticalPos, 0);
5290
- }
5291
- }
5292
- addLabel(staffTabOrGroup, label, text) {
5272
+ addAnnotation(staffTabOrGroups, annotation, text) {
5293
5273
  let anchor = this.lastAddedRhythmColumn;
5294
5274
  if (!anchor) {
5295
- throw new import_core13.MusicError(import_core13.MusicErrorType.Score, "Cannot add label because anchor is undefined.");
5275
+ throw new import_core13.MusicError(import_core13.MusicErrorType.Score, "Cannot add annotation because anchor is undefined.");
5296
5276
  } else if (text.length === 0) {
5297
- throw new import_core13.MusicError(import_core13.MusicErrorType.Score, "Cannot add label because label text is empty.");
5277
+ throw new import_core13.MusicError(import_core13.MusicErrorType.Score, "Cannot add annotation because annotation text is empty.");
5298
5278
  }
5299
5279
  let textProps = { text };
5300
5280
  let layoutGroupId;
5301
5281
  let defaultVerticalPos;
5302
- switch (label) {
5303
- case 0 /* Note */:
5304
- layoutGroupId = 1 /* NoteLabel */;
5305
- defaultVerticalPos = 1 /* Below */;
5282
+ switch (annotation) {
5283
+ case 0 /* Dynamics */:
5284
+ layoutGroupId = 5 /* DynamicsAnnotation */;
5285
+ defaultVerticalPos = 0 /* Above */;
5286
+ textProps.italic = true;
5306
5287
  break;
5307
- case 1 /* Chord */:
5308
- layoutGroupId = 6 /* ChordLabel */;
5288
+ case 1 /* Tempo */:
5289
+ layoutGroupId = 4 /* TempoAnnotation */;
5309
5290
  defaultVerticalPos = 0 /* Above */;
5291
+ textProps.italic = true;
5310
5292
  break;
5311
5293
  }
5312
- this.forEachStaffGroup(staffTabOrGroup, defaultVerticalPos, (line, vpos) => {
5294
+ this.forEachStaffGroup(staffTabOrGroups, defaultVerticalPos, (line, vpos) => {
5313
5295
  let textObj = new ObjText(anchor, textProps, 0.5, 1);
5314
5296
  this.addLayoutObject(textObj, line, layoutGroupId, vpos);
5315
5297
  this.enableExtension(textObj);
5316
5298
  });
5317
5299
  }
5318
- addAnnotation(staffTabOrGroup, annotation, text) {
5300
+ addLabel(staffTabOrGroups, label, text) {
5319
5301
  let anchor = this.lastAddedRhythmColumn;
5320
5302
  if (!anchor) {
5321
- throw new import_core13.MusicError(import_core13.MusicErrorType.Score, "Cannot add annotation because anchor is undefined.");
5303
+ throw new import_core13.MusicError(import_core13.MusicErrorType.Score, "Cannot add label because anchor is undefined.");
5322
5304
  } else if (text.length === 0) {
5323
- throw new import_core13.MusicError(import_core13.MusicErrorType.Score, "Cannot add annotation because annotation text is empty.");
5305
+ throw new import_core13.MusicError(import_core13.MusicErrorType.Score, "Cannot add label because label text is empty.");
5324
5306
  }
5325
5307
  let textProps = { text };
5326
5308
  let layoutGroupId;
5327
5309
  let defaultVerticalPos;
5328
- switch (annotation) {
5329
- case 0 /* Dynamics */:
5330
- layoutGroupId = 5 /* DynamicsAnnotation */;
5331
- defaultVerticalPos = 0 /* Above */;
5332
- textProps.italic = true;
5310
+ switch (label) {
5311
+ case 0 /* Note */:
5312
+ layoutGroupId = 1 /* NoteLabel */;
5313
+ defaultVerticalPos = 1 /* Below */;
5333
5314
  break;
5334
- case 1 /* Tempo */:
5335
- layoutGroupId = 4 /* TempoAnnotation */;
5315
+ case 1 /* Chord */:
5316
+ layoutGroupId = 6 /* ChordLabel */;
5336
5317
  defaultVerticalPos = 0 /* Above */;
5337
- textProps.italic = true;
5338
5318
  break;
5339
5319
  }
5340
- this.forEachStaffGroup(staffTabOrGroup, defaultVerticalPos, (line, vpos) => {
5320
+ this.forEachStaffGroup(staffTabOrGroups, defaultVerticalPos, (line, vpos) => {
5341
5321
  let textObj = new ObjText(anchor, textProps, 0.5, 1);
5342
5322
  this.addLayoutObject(textObj, line, layoutGroupId, vpos);
5343
5323
  this.enableExtension(textObj);
5344
5324
  });
5345
5325
  }
5326
+ addConnective(connective, ...args) {
5327
+ let anchor = this.lastAddedRhythmSymbol;
5328
+ if (!(anchor instanceof ObjNoteGroup)) {
5329
+ throw new import_core13.MusicError(import_core13.MusicErrorType.Score, "Connective can be added to note group only.");
5330
+ }
5331
+ if (connective === 0 /* Tie */) {
5332
+ let tieSpan = import_ts_utils_lib8.Utils.Is.isInteger(args[0]) || import_ts_utils_lib8.Utils.Is.isEnumValue(args[0], TieType) ? args[0] : 2;
5333
+ let noteAnchor = import_ts_utils_lib8.Utils.Is.isEnumValue(args[1], NoteAnchor) ? args[1] : 0 /* Auto */;
5334
+ anchor.startConnective(new ConnectiveProps(0 /* Tie */, tieSpan, noteAnchor, anchor));
5335
+ } else if (connective === 1 /* Slur */) {
5336
+ let slurSpan = import_ts_utils_lib8.Utils.Is.isInteger(args[0]) ? args[0] : 2;
5337
+ let noteAnchor = import_ts_utils_lib8.Utils.Is.isEnumValue(args[1], NoteAnchor) ? args[1] : 0 /* Auto */;
5338
+ anchor.startConnective(new ConnectiveProps(1 /* Slur */, slurSpan, noteAnchor, anchor));
5339
+ } else if (connective === 2 /* Slide */) {
5340
+ let noteAnchor = import_ts_utils_lib8.Utils.Is.isEnumValue(args[0], NoteAnchor) ? args[0] : 0 /* Auto */;
5341
+ anchor.startConnective(new ConnectiveProps(2 /* Slide */, 2, noteAnchor, anchor));
5342
+ }
5343
+ }
5344
+ addExtension(extensionLength, extensionVisible) {
5345
+ this.addExtensionToMusicObjects.forEach((musicObj) => {
5346
+ let anchor = musicObj.getParent();
5347
+ if (musicObj instanceof ObjText && anchor instanceof ObjRhythmColumn) {
5348
+ let lineStyle = "dashed";
5349
+ let linePos = "bottom";
5350
+ let extension = new Extension(musicObj, anchor, extensionLength, extensionVisible, lineStyle, linePos);
5351
+ musicObj.setLink(extension);
5352
+ } else {
5353
+ throw new import_core13.MusicError(import_core13.MusicErrorType.Score, "Cannot add extension becaue no compatible music object to attach it to.");
5354
+ }
5355
+ });
5356
+ if (this.addExtensionToMusicObjects.length === 0) {
5357
+ throw new import_core13.MusicError(import_core13.MusicErrorType.Score, "Cannot add extension because music object to attach it to is undefined.");
5358
+ }
5359
+ this.disableExtension();
5360
+ this.requestLayout();
5361
+ }
5362
+ enableExtension(musicObject) {
5363
+ this.addExtensionToMusicObjects.push(musicObject);
5364
+ }
5365
+ disableExtension() {
5366
+ this.addExtensionToMusicObjects = [];
5367
+ }
5368
+ getEnding() {
5369
+ return this.layoutObjects.map((layoutObj) => layoutObj.musicObj).find((musicObj) => musicObj instanceof ObjEnding);
5370
+ }
5371
+ getEndRepeatPlayCount() {
5372
+ return this.endRepeatPlayCount;
5373
+ }
5346
5374
  endSong() {
5347
5375
  this.isEndSong = true;
5348
5376
  this.requestLayout();
@@ -5363,35 +5391,14 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5363
5391
  this.doc.requestNewRow();
5364
5392
  this.disableExtension();
5365
5393
  }
5366
- enableExtension(musicObject) {
5367
- this.addExtensionToMusicObjects.push(musicObject);
5368
- }
5369
- disableExtension() {
5370
- this.addExtensionToMusicObjects = [];
5371
- }
5372
- addExtension(extensionLength, extensionVisible) {
5373
- this.addExtensionToMusicObjects.forEach((musicObj) => {
5374
- let anchor = musicObj.getParent();
5375
- if (musicObj instanceof ObjText && anchor instanceof ObjRhythmColumn) {
5376
- let lineStyle = "dashed";
5377
- let linePos = "bottom";
5378
- let extension = new Extension(musicObj, anchor, extensionLength, extensionVisible, lineStyle, linePos);
5379
- musicObj.setLink(extension);
5380
- } else {
5381
- throw new import_core13.MusicError(import_core13.MusicErrorType.Score, "Cannot add extension becaue no compatible music object to attach it to.");
5382
- }
5383
- });
5384
- if (this.addExtensionToMusicObjects.length === 0) {
5385
- throw new import_core13.MusicError(import_core13.MusicErrorType.Score, "Cannot add extension because music object to attach it to is undefined.");
5386
- }
5387
- this.disableExtension();
5388
- this.requestLayout();
5389
- }
5390
5394
  addRhythmSymbol(voiceId, symbol) {
5391
5395
  let { col } = symbol;
5392
5396
  col.setVoiceSymbol(voiceId, symbol);
5393
5397
  this.getVoiceSymbols(voiceId);
5394
5398
  this.voiceSymbols[voiceId].push(symbol);
5399
+ if (symbol.triplet) {
5400
+ this.createOldStyleTriplets(voiceId);
5401
+ }
5395
5402
  this.requestBeamsUpdate();
5396
5403
  this.lastAddedRhythmColumn = col;
5397
5404
  this.lastAddedRhythmSymbol = symbol;
@@ -5531,7 +5538,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5531
5538
  const lines = m.row.getNotationLines();
5532
5539
  let line2 = (_a = lines.find((l) => l.name !== "" && l.name === line.name)) != null ? _a : lines[line.id];
5533
5540
  if (line2) {
5534
- m.addLayoutObject(new ObjExtensionLine(m, extension, leftObj, rightObj), line2, layoutGroupId, verticalPos);
5541
+ m.addLayoutObject(new ObjExtensionLine(m, line2, extension, leftObj, rightObj), line2, layoutGroupId, verticalPos);
5535
5542
  }
5536
5543
  }
5537
5544
  }
@@ -5545,28 +5552,41 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5545
5552
  requestBeamsUpdate() {
5546
5553
  this.needBeamsUpdate = true;
5547
5554
  }
5555
+ createOldStyleTriplets(voiceId) {
5556
+ let symbols = this.getVoiceSymbols(voiceId);
5557
+ if (symbols.length <= 2) {
5558
+ return;
5559
+ }
5560
+ for (let i = 0; i < symbols.length; ) {
5561
+ let s2 = symbols.slice(i, i + 2);
5562
+ let s3 = symbols.slice(i, i + 3);
5563
+ if (s2.length === 2 && s2.every((s) => s.triplet) && s2.every((s) => s.getBeamGroup() === void 0) && ObjBeamGroup.createTriplet(s2)) {
5564
+ i += 2;
5565
+ } else if (s3.length === 3 && s3.every((s) => s.triplet) && s3.every((s) => s.getBeamGroup() === void 0) && ObjBeamGroup.createTriplet(s3)) {
5566
+ i += 3;
5567
+ } else {
5568
+ i++;
5569
+ }
5570
+ }
5571
+ this.requestLayout();
5572
+ }
5548
5573
  createBeams() {
5549
- if (!this.needBeamsUpdate || !this.row.hasStaff) {
5574
+ if (!this.needBeamsUpdate) {
5550
5575
  return;
5551
5576
  }
5552
- this.beamGroups.forEach((beamGroup) => beamGroup.detach());
5553
- this.beamGroups.length = 0;
5577
+ this.beamGroups = this.beamGroups.filter((beamGroup) => {
5578
+ if (beamGroup.getType() === 0 /* RegularBeam */) {
5579
+ beamGroup.detach();
5580
+ return false;
5581
+ } else {
5582
+ return true;
5583
+ }
5584
+ });
5554
5585
  getVoiceIds().forEach((voiceId) => {
5555
5586
  let symbols = this.getVoiceSymbols(voiceId);
5556
5587
  if (symbols.length <= 2) {
5557
5588
  return;
5558
5589
  }
5559
- for (let i = 0; i < symbols.length; ) {
5560
- let s2 = symbols.slice(i, i + 2);
5561
- let s3 = symbols.slice(i, i + 3);
5562
- if (s2.length === 2 && ObjBeamGroup.createTriplet(s2)) {
5563
- i += 2;
5564
- } else if (s3.length === 3 && ObjBeamGroup.createTriplet(s3)) {
5565
- i += 3;
5566
- } else {
5567
- i++;
5568
- }
5569
- }
5570
5590
  if (!DebugSettings.DisableBeams) {
5571
5591
  let groupSymbols = [];
5572
5592
  let groupStartTicks = 0;
@@ -6519,8 +6539,8 @@ var ObjScoreRow = class extends MusicObject {
6519
6539
  updateRect() {
6520
6540
  let left = this.measures.length > 0 ? this.measures[0].getRect().left : 0;
6521
6541
  let right = this.measures.length > 0 ? this.measures[this.measures.length - 1].getRect().right : 0;
6522
- let top = Math.min(0, ...this.measures.map((m) => m.getRect().top));
6523
- let bottom = Math.max(0, ...this.measures.map((m) => m.getRect().bottom));
6542
+ let top = this.measures.length > 0 ? Math.min(...this.measures.map((m) => m.getRect().top)) : 0;
6543
+ let bottom = this.measures.length > 0 ? Math.max(...this.measures.map((m) => m.getRect().bottom)) : 0;
6524
6544
  this.rect = new DivRect(left, right, top, bottom);
6525
6545
  }
6526
6546
  alignStemsToBeams() {
@@ -6812,6 +6832,12 @@ var ObjDocument = class extends MusicObject {
6812
6832
  getLastRow() {
6813
6833
  return this.rows.length === 0 ? this.addNewRow(void 0) : this.rows[this.rows.length - 1];
6814
6834
  }
6835
+ getRows() {
6836
+ return this.rows;
6837
+ }
6838
+ getMeasures() {
6839
+ return this.measures;
6840
+ }
6815
6841
  requestNewRow() {
6816
6842
  this.newRowRequested = true;
6817
6843
  }
@@ -7012,6 +7038,15 @@ function assertRestOptions(options) {
7012
7038
  assertArg(import_ts_utils_lib11.Utils.Is.isBooleanOrUndefined(options.hide), "restOptions.hide", options.hide);
7013
7039
  assertArg(import_ts_utils_lib11.Utils.Is.isBooleanOrUndefined(options.triplet), "restOptions.triplet", options.triplet);
7014
7040
  }
7041
+ function assertStaffTabOrGRoups(staffTabOrGroups) {
7042
+ assertArg(
7043
+ import_ts_utils_lib11.Utils.Is.isStringOrUndefined(staffTabOrGroups) || import_ts_utils_lib11.Utils.Is.isIntegerGte(staffTabOrGroups, 0) || import_ts_utils_lib11.Utils.Is.isArray(staffTabOrGroups) && staffTabOrGroups.every(
7044
+ (staffTabOrGroup) => import_ts_utils_lib11.Utils.Is.isString(staffTabOrGroup) || import_ts_utils_lib11.Utils.Is.isIntegerGte(staffTabOrGroup, 0)
7045
+ ),
7046
+ "staffTabOrGroup",
7047
+ staffTabOrGroups
7048
+ );
7049
+ }
7015
7050
  var DocumentBuilder = class {
7016
7051
  constructor() {
7017
7052
  __publicField(this, "doc");
@@ -7113,63 +7148,63 @@ var DocumentBuilder = class {
7113
7148
  this.getMeasure().addRest(voiceId, restLength, options);
7114
7149
  return this;
7115
7150
  }
7116
- addFermataInternal(staffTabOrGroup, fermata) {
7117
- assertArg(import_ts_utils_lib11.Utils.Is.isStringOrUndefined(staffTabOrGroup) || import_ts_utils_lib11.Utils.Is.isIntegerGte(staffTabOrGroup, 0), "staffTabOrGroup", staffTabOrGroup);
7151
+ addFermataInternal(staffTabOrGroups, fermata) {
7152
+ assertStaffTabOrGRoups(staffTabOrGroups);
7118
7153
  assertArg(import_ts_utils_lib11.Utils.Is.isEnumValue(fermata, Fermata), "fermata", fermata);
7119
- this.getMeasure().addFermata(staffTabOrGroup, fermata);
7154
+ this.getMeasure().addFermata(staffTabOrGroups, fermata);
7120
7155
  return this;
7121
7156
  }
7122
7157
  addFermata(fermata = 0 /* AtNote */) {
7123
7158
  return this.addFermataInternal(void 0, fermata);
7124
7159
  }
7125
- /** @param staffTabOrGroup - staff/tab index (0=top), staff/tab name, or staff group name. */
7126
- addFermataTo(staffTabOrGroup, fermata = 0 /* AtNote */) {
7127
- return this.addFermataInternal(staffTabOrGroup, fermata);
7160
+ /** @param staffTabOrGroups - staff/tab index (0=top), staff/tab name, or staff group name. */
7161
+ addFermataTo(staffTabOrGroups, fermata = 0 /* AtNote */) {
7162
+ return this.addFermataInternal(staffTabOrGroups, fermata);
7128
7163
  }
7129
- addNavigationInternal(staffTabOrGroup, navigation, ...args) {
7130
- assertArg(import_ts_utils_lib11.Utils.Is.isStringOrUndefined(staffTabOrGroup) || import_ts_utils_lib11.Utils.Is.isIntegerGte(staffTabOrGroup, 0), "staffTabOrGroup", staffTabOrGroup);
7164
+ addNavigationInternal(staffTabOrGroups, navigation, ...args) {
7165
+ assertStaffTabOrGRoups(staffTabOrGroups);
7131
7166
  assertArg(import_ts_utils_lib11.Utils.Is.isEnumValue(navigation, Navigation), "navigation", navigation);
7132
7167
  if (navigation === 9 /* EndRepeat */ && args.length > 0) {
7133
7168
  assertArg(import_ts_utils_lib11.Utils.Is.isIntegerGte(args[0], 1), "playCount", args[0]);
7134
7169
  } else if (navigation === 10 /* Ending */ && args.length > 0) {
7135
7170
  assertArg(args.every((passage) => import_ts_utils_lib11.Utils.Is.isIntegerGte(passage, 1)), "passages", args);
7136
7171
  }
7137
- this.getMeasure().addNavigation(staffTabOrGroup, navigation, ...args);
7172
+ this.getMeasure().addNavigation(staffTabOrGroups, navigation, ...args);
7138
7173
  return this;
7139
7174
  }
7140
7175
  addNavigation(navigation, ...args) {
7141
7176
  return this.addNavigationInternal(void 0, navigation, ...args);
7142
7177
  }
7143
- addNavigationTo(staffTabOrGroup, navigation, ...args) {
7144
- return this.addNavigationInternal(staffTabOrGroup, navigation, ...args);
7178
+ addNavigationTo(staffTabOrGroups, navigation, ...args) {
7179
+ return this.addNavigationInternal(staffTabOrGroups, navigation, ...args);
7145
7180
  }
7146
- addLabelInternal(staffTabOrGroup, label, text) {
7147
- assertArg(import_ts_utils_lib11.Utils.Is.isStringOrUndefined(staffTabOrGroup) || import_ts_utils_lib11.Utils.Is.isIntegerGte(staffTabOrGroup, 0), "staffTabOrGroup", staffTabOrGroup);
7181
+ addLabelInternal(staffTabOrGroups, label, text) {
7182
+ assertStaffTabOrGRoups(staffTabOrGroups);
7148
7183
  assertArg(import_ts_utils_lib11.Utils.Is.isEnumValue(label, Label), "label", label);
7149
7184
  assertArg(import_ts_utils_lib11.Utils.Is.isString(text), "text", text);
7150
- this.getMeasure().addLabel(staffTabOrGroup, label, text);
7185
+ this.getMeasure().addLabel(staffTabOrGroups, label, text);
7151
7186
  return this;
7152
7187
  }
7153
7188
  addLabel(label, text) {
7154
7189
  return this.addLabelInternal(void 0, label, text);
7155
7190
  }
7156
- /** @param staffTabOrGroup - staff/tab index (0=top), staff/tab name, or staff group name. */
7157
- addLabelTo(staffTabOrGroup, label, text) {
7158
- return this.addLabelInternal(staffTabOrGroup, label, text);
7191
+ /** @param staffTabOrGroups - staff/tab index (0=top), staff/tab name, or staff group name. */
7192
+ addLabelTo(staffTabOrGroups, label, text) {
7193
+ return this.addLabelInternal(staffTabOrGroups, label, text);
7159
7194
  }
7160
- addAnnotationInternal(staffTabOrGroup, annotation, text) {
7161
- assertArg(import_ts_utils_lib11.Utils.Is.isStringOrUndefined(staffTabOrGroup) || import_ts_utils_lib11.Utils.Is.isIntegerGte(staffTabOrGroup, 0), "staffTabOrGroup", staffTabOrGroup);
7195
+ addAnnotationInternal(staffTabOrGroups, annotation, text) {
7196
+ assertStaffTabOrGRoups(staffTabOrGroups);
7162
7197
  assertArg(import_ts_utils_lib11.Utils.Is.isEnumValue(annotation, Annotation), "annotation", annotation);
7163
7198
  assertArg(import_ts_utils_lib11.Utils.Is.isString(text), "text", text);
7164
- this.getMeasure().addAnnotation(staffTabOrGroup, annotation, text);
7199
+ this.getMeasure().addAnnotation(staffTabOrGroups, annotation, text);
7165
7200
  return this;
7166
7201
  }
7167
7202
  addAnnotation(annotation, text) {
7168
7203
  return this.addAnnotationInternal(void 0, annotation, text);
7169
7204
  }
7170
- /** @param staffTabOrGroup - staff/tab index (0=top), staff/tab name, or staff group name. */
7171
- addAnnotationTo(staffTabOrGroup, annotation, text) {
7172
- return this.addAnnotationInternal(staffTabOrGroup, annotation, text);
7205
+ /** @param staffTabOrGroups - staff/tab index (0=top), staff/tab name, or staff group name. */
7206
+ addAnnotationTo(staffTabOrGroups, annotation, text) {
7207
+ return this.addAnnotationInternal(staffTabOrGroups, annotation, text);
7173
7208
  }
7174
7209
  addConnective(connective, ...args) {
7175
7210
  assertArg(import_ts_utils_lib11.Utils.Is.isEnumValue(connective, Connective), "connective", connective);
@@ -7302,6 +7337,13 @@ function require_t(t, message) {
7302
7337
  function isVoiceId2(value) {
7303
7338
  return import_ts_utils_lib12.Utils.Is.isNumber(value) && getVoiceIds().indexOf(value) >= 0;
7304
7339
  }
7340
+ function getNotationLine(line) {
7341
+ if (line instanceof ObjStaff || line instanceof ObjTab) {
7342
+ return line.getMusicInterface();
7343
+ } else {
7344
+ throw new import_core19.MusicError(import_core19.MusicErrorType.Score, `Notation line not staff nor tab.`);
7345
+ }
7346
+ }
7305
7347
  var MusicInterface6 = class {
7306
7348
  constructor(name) {
7307
7349
  this.name = name;
@@ -7350,6 +7392,12 @@ var _MArpeggio = class _MArpeggio extends MusicInterface6 {
7350
7392
  getMusicObject() {
7351
7393
  return this.obj;
7352
7394
  }
7395
+ getRhythmColumn() {
7396
+ return this.obj.col.getMusicInterface();
7397
+ }
7398
+ getNotationLine() {
7399
+ return getNotationLine(this.obj.line);
7400
+ }
7353
7401
  };
7354
7402
  __publicField(_MArpeggio, "Name", "Arpeggio");
7355
7403
  var MArpeggio = _MArpeggio;
@@ -7376,6 +7424,9 @@ var _MStaffBeamGroup = class _MStaffBeamGroup extends MusicInterface6 {
7376
7424
  getMusicObject() {
7377
7425
  return this.obj;
7378
7426
  }
7427
+ getStaff() {
7428
+ return this.obj.staff.getMusicInterface();
7429
+ }
7379
7430
  };
7380
7431
  __publicField(_MStaffBeamGroup, "Name", "StaffBeamGroup");
7381
7432
  var MStaffBeamGroup = _MStaffBeamGroup;
@@ -7399,6 +7450,12 @@ var _MDocument = class _MDocument extends MusicInterface6 {
7399
7450
  getArranger() {
7400
7451
  return this.obj.getArranger();
7401
7452
  }
7453
+ getRows() {
7454
+ return this.obj.getRows().map((r) => r.getMusicInterface());
7455
+ }
7456
+ getMeasures() {
7457
+ return this.obj.getMeasures().map((m) => m.getMusicInterface());
7458
+ }
7402
7459
  play(fn) {
7403
7460
  assertArg2(import_ts_utils_lib12.Utils.Is.isFunctionOrUndefined(fn), "playStateChangeListener", fn);
7404
7461
  return new MPlayer(this, fn).play();
@@ -7490,6 +7547,9 @@ var _MMeasure = class _MMeasure extends MusicInterface6 {
7490
7547
  getRhythmColumns() {
7491
7548
  return this.obj.getColumns().map((col) => col.getMusicInterface());
7492
7549
  }
7550
+ getRow() {
7551
+ return this.obj.row.getMusicInterface();
7552
+ }
7493
7553
  };
7494
7554
  __publicField(_MMeasure, "Name", "Measure");
7495
7555
  var MMeasure = _MMeasure;
@@ -7529,6 +7589,17 @@ var _MStaffTabBarLine = class _MStaffTabBarLine extends MusicInterface6 {
7529
7589
  getMusicObject() {
7530
7590
  return this.obj;
7531
7591
  }
7592
+ getBarLine() {
7593
+ let barLine = this.obj.barLine;
7594
+ if (barLine instanceof ObjBarLineLeft || barLine instanceof ObjBarLineRight) {
7595
+ return barLine.getMusicInterface();
7596
+ } else {
7597
+ throw new import_core19.MusicError(import_core19.MusicErrorType.Score, `Bar line not let nor right.`);
7598
+ }
7599
+ }
7600
+ getNotationLine() {
7601
+ return getNotationLine(this.obj.line);
7602
+ }
7532
7603
  };
7533
7604
  __publicField(_MStaffTabBarLine, "Name", "StaffTabBarLine");
7534
7605
  var MStaffTabBarLine = _MStaffTabBarLine;
@@ -7548,6 +7619,12 @@ var _MNoteGroup = class _MNoteGroup extends MusicInterface6 {
7548
7619
  getRhythmProps() {
7549
7620
  return this.obj.rhythmProps;
7550
7621
  }
7622
+ getRhythmColumn() {
7623
+ return this.obj.col.getMusicInterface();
7624
+ }
7625
+ getMeasure() {
7626
+ return this.obj.measure.getMusicInterface();
7627
+ }
7551
7628
  };
7552
7629
  __publicField(_MNoteGroup, "Name", "NoteGroup");
7553
7630
  var MNoteGroup = _MNoteGroup;
@@ -7564,6 +7641,15 @@ var _MStaffNoteGroup = class _MStaffNoteGroup extends MusicInterface6 {
7564
7641
  getNoteGroup() {
7565
7642
  return this.obj.noteGroup.getMusicInterface();
7566
7643
  }
7644
+ getRhythmColumn() {
7645
+ return this.getNoteGroup().getRhythmColumn();
7646
+ }
7647
+ getMeasure() {
7648
+ return this.getNoteGroup().getMeasure();
7649
+ }
7650
+ getStaff() {
7651
+ return this.obj.staff.getMusicInterface();
7652
+ }
7567
7653
  };
7568
7654
  __publicField(_MStaffNoteGroup, "Name", "StaffNoteGroup");
7569
7655
  var MStaffNoteGroup = _MStaffNoteGroup;
@@ -7580,6 +7666,15 @@ var _MTabNoteGroup = class _MTabNoteGroup extends MusicInterface6 {
7580
7666
  getNoteGroup() {
7581
7667
  return this.obj.noteGroup.getMusicInterface();
7582
7668
  }
7669
+ getRhythmColumn() {
7670
+ return this.getNoteGroup().getRhythmColumn();
7671
+ }
7672
+ getMeasure() {
7673
+ return this.getNoteGroup().getMeasure();
7674
+ }
7675
+ getTab() {
7676
+ return this.obj.tab.getMusicInterface();
7677
+ }
7583
7678
  };
7584
7679
  __publicField(_MTabNoteGroup, "Name", "TabNoteGroup");
7585
7680
  var MTabNoteGroup = _MTabNoteGroup;
@@ -7596,6 +7691,12 @@ var _MRest = class _MRest extends MusicInterface6 {
7596
7691
  getRhythmProps() {
7597
7692
  return this.obj.rhythmProps;
7598
7693
  }
7694
+ getRhythmColumn() {
7695
+ return this.obj.col.getMusicInterface();
7696
+ }
7697
+ getMeasure() {
7698
+ return this.obj.measure.getMusicInterface();
7699
+ }
7599
7700
  };
7600
7701
  __publicField(_MRest, "Name", "Rest");
7601
7702
  var MRest = _MRest;
@@ -7612,6 +7713,15 @@ var _MStaffRest = class _MStaffRest extends MusicInterface6 {
7612
7713
  getRest() {
7613
7714
  return this.obj.rest.getMusicInterface();
7614
7715
  }
7716
+ getRhythmColumn() {
7717
+ return this.getRest().getRhythmColumn();
7718
+ }
7719
+ getMeasure() {
7720
+ return this.getRest().getMeasure();
7721
+ }
7722
+ getStaff() {
7723
+ return this.obj.staff.getMusicInterface();
7724
+ }
7615
7725
  };
7616
7726
  __publicField(_MStaffRest, "Name", "StaffRest");
7617
7727
  var MStaffRest = _MStaffRest;
@@ -7630,6 +7740,13 @@ var _MRhythmColumn = class _MRhythmColumn extends MusicInterface6 {
7630
7740
  assertArg2(isVoiceId2(voiceId), "voiceId", voiceId);
7631
7741
  return (_a = this.obj.getVoiceSymbol(voiceId)) == null ? void 0 : _a.getMusicInterface();
7632
7742
  }
7743
+ getMeasure() {
7744
+ return this.obj.measure.getMusicInterface();
7745
+ }
7746
+ getVoiceSymbol(voiceId) {
7747
+ let s = this.obj.getVoiceSymbol(voiceId);
7748
+ return s instanceof ObjNoteGroup || s instanceof ObjRest ? s.getMusicInterface() : void 0;
7749
+ }
7633
7750
  };
7634
7751
  __publicField(_MRhythmColumn, "Name", "RhythmColumn");
7635
7752
  var MRhythmColumn = _MRhythmColumn;
@@ -7643,9 +7760,15 @@ var _MScoreRow = class _MScoreRow extends MusicInterface6 {
7643
7760
  getMusicObject() {
7644
7761
  return this.obj;
7645
7762
  }
7763
+ getDocument() {
7764
+ return this.obj.doc.getMusicInterface();
7765
+ }
7646
7766
  getMeasures() {
7647
7767
  return this.obj.getMeasures().map((m) => m.getMusicInterface());
7648
7768
  }
7769
+ getNotationLines() {
7770
+ return this.obj.getNotationLines().map((line) => getNotationLine(line));
7771
+ }
7649
7772
  };
7650
7773
  __publicField(_MScoreRow, "Name", "ScoreRow");
7651
7774
  var MScoreRow = _MScoreRow;
@@ -7659,6 +7782,15 @@ var _MStaff = class _MStaff extends MusicInterface6 {
7659
7782
  getMusicObject() {
7660
7783
  return this.obj;
7661
7784
  }
7785
+ getId() {
7786
+ return this.obj.id;
7787
+ }
7788
+ getName() {
7789
+ return this.obj.name.length > 0 ? this.obj.name : void 0;
7790
+ }
7791
+ getRow() {
7792
+ return this.obj.row.getMusicInterface();
7793
+ }
7662
7794
  };
7663
7795
  __publicField(_MStaff, "Name", "Staff");
7664
7796
  var MStaff = _MStaff;
@@ -7672,6 +7804,15 @@ var _MTab = class _MTab extends MusicInterface6 {
7672
7804
  getMusicObject() {
7673
7805
  return this.obj;
7674
7806
  }
7807
+ getId() {
7808
+ return this.obj.id;
7809
+ }
7810
+ getName() {
7811
+ return this.obj.name.length > 0 ? this.obj.name : void 0;
7812
+ }
7813
+ getRow() {
7814
+ return this.obj.row.getMusicInterface();
7815
+ }
7675
7816
  };
7676
7817
  __publicField(_MTab, "Name", "Tab");
7677
7818
  var MTab = _MTab;
@@ -7685,6 +7826,9 @@ var _MSignature = class _MSignature extends MusicInterface6 {
7685
7826
  getMusicObject() {
7686
7827
  return this.obj;
7687
7828
  }
7829
+ getStaff() {
7830
+ return this.obj.staff.getMusicInterface();
7831
+ }
7688
7832
  };
7689
7833
  __publicField(_MSignature, "Name", "Signature");
7690
7834
  var MSignature = _MSignature;
@@ -7698,6 +7842,9 @@ var _MSpecialText = class _MSpecialText extends MusicInterface6 {
7698
7842
  getMusicObject() {
7699
7843
  return this.obj;
7700
7844
  }
7845
+ getText() {
7846
+ return this.obj.getText();
7847
+ }
7701
7848
  };
7702
7849
  __publicField(_MSpecialText, "Name", "SpecialText");
7703
7850
  var MSpecialText = _MSpecialText;