@tspro/web-music-score 4.0.0 → 4.1.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 (51) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +18 -9
  3. package/dist/audio/index.d.mts +40 -1
  4. package/dist/audio/index.d.ts +40 -1
  5. package/dist/audio/index.js +1 -1
  6. package/dist/audio/index.mjs +2 -2
  7. package/dist/audio-cg/index.d.mts +3 -0
  8. package/dist/audio-cg/index.d.ts +3 -0
  9. package/dist/audio-cg/index.js +1 -1
  10. package/dist/audio-cg/index.mjs +2 -2
  11. package/dist/{chunk-D643HZHM.mjs → chunk-MHNTJ6FU.mjs} +2 -2
  12. package/dist/core/index.d.mts +12 -0
  13. package/dist/core/index.d.ts +12 -0
  14. package/dist/core/index.js +3 -2
  15. package/dist/core/index.mjs +4 -3
  16. package/dist/guitar-CaZJDA05.d.ts +35 -0
  17. package/dist/guitar-DdexKdN6.d.mts +35 -0
  18. package/dist/iife/index.global.js +11 -11
  19. package/dist/{interface-XoKiryoV.d.mts → music-objects-DIaqNPjs.d.mts} +616 -114
  20. package/dist/{interface-7k8qGG44.d.ts → music-objects-xJJNlFwK.d.ts} +616 -114
  21. package/dist/note-eA2xPPiG.d.mts +294 -0
  22. package/dist/note-eA2xPPiG.d.ts +294 -0
  23. package/dist/pieces/index.d.mts +22 -3
  24. package/dist/pieces/index.d.ts +22 -3
  25. package/dist/pieces/index.js +5 -2
  26. package/dist/pieces/index.mjs +6 -3
  27. package/dist/react-ui/index.d.mts +166 -17
  28. package/dist/react-ui/index.d.ts +166 -17
  29. package/dist/react-ui/index.js +78 -1
  30. package/dist/react-ui/index.mjs +79 -2
  31. package/dist/scale-DQNA-YLD.d.ts +230 -0
  32. package/dist/scale-bnD0WnMV.d.mts +230 -0
  33. package/dist/score/index.d.mts +315 -47
  34. package/dist/score/index.d.ts +315 -47
  35. package/dist/score/index.js +684 -173
  36. package/dist/score/index.mjs +683 -174
  37. package/dist/tempo-Bp1UzsrZ.d.ts +399 -0
  38. package/dist/tempo-S85Q7uJA.d.mts +399 -0
  39. package/dist/theory/index.d.mts +29 -13
  40. package/dist/theory/index.d.ts +29 -13
  41. package/dist/theory/index.js +433 -42
  42. package/dist/theory/index.mjs +432 -43
  43. package/package.json +3 -2
  44. package/dist/guitar-DggbM2UL.d.mts +0 -17
  45. package/dist/guitar-cNmE-EvH.d.ts +0 -17
  46. package/dist/note-BFa43I86.d.mts +0 -85
  47. package/dist/note-CcVdUFqS.d.ts +0 -85
  48. package/dist/scale-C2pCNxdE.d.mts +0 -75
  49. package/dist/scale-CvPbJvfN.d.ts +0 -75
  50. package/dist/tempo-BAYoZ_Li.d.mts +0 -187
  51. package/dist/tempo-r2sb6Ku2.d.ts +0 -187
@@ -1,4 +1,4 @@
1
- /* WebMusicScore v4.0.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v4.1.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;
@@ -39,6 +39,7 @@ __export(score_exports, {
39
39
  Connective: () => Connective,
40
40
  DivRect: () => DivRect,
41
41
  DocumentBuilder: () => DocumentBuilder,
42
+ DynamicsAnnotation: () => DynamicsAnnotation,
42
43
  Fermata: () => Fermata,
43
44
  Label: () => Label,
44
45
  MAccidental: () => MAccidental,
@@ -80,6 +81,7 @@ __export(score_exports, {
80
81
  ScoreStaffPosEvent: () => ScoreStaffPosEvent,
81
82
  StaffPreset: () => StaffPreset,
82
83
  Stem: () => Stem,
84
+ TempoAnnotation: () => TempoAnnotation,
83
85
  TieType: () => TieType,
84
86
  VerticalPosition: () => VerticalPosition,
85
87
  getStringNumbers: () => getStringNumbers,
@@ -122,11 +124,11 @@ var DivRect = class _DivRect {
122
124
  /**
123
125
  * Create rect from basic left, top, width and height arguments.
124
126
  *
125
- * @param left -
126
- * @param top -
127
- * @param width -
128
- * @param height -
129
- * @returns
127
+ * @param left - Left coordinate.
128
+ * @param top - Top coordinate.
129
+ * @param width - With.
130
+ * @param height - Height.
131
+ * @returns - DivRect.
130
132
  */
131
133
  static create(left, top, width, height) {
132
134
  return new _DivRect(left, left + width, top, top + height);
@@ -136,9 +138,9 @@ var DivRect = class _DivRect {
136
138
  *
137
139
  * @param centerX - Center x-coordinate.
138
140
  * @param centerY - Center y-coordinate.
139
- * @param width -
140
- * @param height -
141
- * @returns
141
+ * @param width - Width.
142
+ * @param height - Height.
143
+ * @returns - DivRect.
142
144
  */
143
145
  static createCentered(centerX, centerY, width, height) {
144
146
  return new _DivRect(centerX - width / 2, centerX + width / 2, centerY - height / 2, centerY + height / 2);
@@ -150,43 +152,43 @@ var DivRect = class _DivRect {
150
152
  * @param rightw - Right section width.
151
153
  * @param toph - Top section height.
152
154
  * @param bottomh - Bottomsection height.
153
- * @returns
155
+ * @returns - DivRect.
154
156
  */
155
157
  static createSections(leftw, rightw, toph, bottomh) {
156
158
  return new _DivRect(-leftw, 0, rightw, -toph, 0, bottomh);
157
159
  }
158
160
  /**
159
- * Width.
161
+ * Width getter.
160
162
  */
161
163
  get width() {
162
164
  return this.right - this.left;
163
165
  }
164
166
  /**
165
- * Height.
167
+ * Height getter.
166
168
  */
167
169
  get height() {
168
170
  return this.bottom - this.top;
169
171
  }
170
172
  /**
171
- * Left section width.
173
+ * Left section width getter.
172
174
  */
173
175
  get leftw() {
174
176
  return this.centerX - this.left;
175
177
  }
176
178
  /**
177
- * Right section width.
179
+ * Right section width getter.
178
180
  */
179
181
  get rightw() {
180
182
  return this.right - this.centerX;
181
183
  }
182
184
  /**
183
- * Top section height.
185
+ * Top section height getter.
184
186
  */
185
187
  get toph() {
186
188
  return this.centerY - this.top;
187
189
  }
188
190
  /**
189
- * Bottom section height.
191
+ * Bottom section height getter.
190
192
  */
191
193
  get bottomh() {
192
194
  return this.bottom - this.centerY;
@@ -194,9 +196,9 @@ var DivRect = class _DivRect {
194
196
  /**
195
197
  * Does this Rect contain given (x, y)-point?
196
198
  *
197
- * @param x -
198
- * @param y -
199
- * @returns
199
+ * @param x - X-coordinate.
200
+ * @param y - Y-coordinate.
201
+ * @returns - True/false.
200
202
  */
201
203
  contains(x, y) {
202
204
  return x >= this.left && x <= this.right && y >= this.top && y <= this.bottom;
@@ -204,9 +206,9 @@ var DivRect = class _DivRect {
204
206
  /**
205
207
  * Do a and b rects overlap?
206
208
  *
207
- * @param a -
208
- * @param b -
209
- * @returns
209
+ * @param a - DivRect a.
210
+ * @param b - DivRect b.
211
+ * @returns - True/false.
210
212
  */
211
213
  static overlap(a, b) {
212
214
  return a.right > b.left && a.left < b.right && a.bottom > b.top && a.top < b.bottom;
@@ -214,17 +216,18 @@ var DivRect = class _DivRect {
214
216
  /**
215
217
  * Do horizontal measures of a and b rects overlap?
216
218
  *
217
- * @param a -
218
- * @param b -
219
- * @returns
219
+ * @param a - DivRect a.
220
+ * @param b - DivRect b.
221
+ * @returns - True/false.
220
222
  */
221
223
  static overlapX(a, b) {
222
224
  return a.right > b.left && a.left < b.right;
223
225
  }
224
226
  /**
225
227
  * Check if this Rect equals with given Rect.
226
- * @param b -
227
- * @returns
228
+ * @param a - DivRect a.
229
+ * @param b - DivRect b.
230
+ * @returns - True/false.
228
231
  */
229
232
  static equals(a, b) {
230
233
  if (a == null && b == null) {
@@ -236,10 +239,11 @@ var DivRect = class _DivRect {
236
239
  }
237
240
  }
238
241
  /**
239
- * Check if frame (ignoring centerX/Y) of this Rect equals with given Rect, ignoring centerX and centerY.
242
+ * Check if frame of this Rect equals with given Rect, ignoring center x- and center y-coordinates.
240
243
  *
241
- * @param b -
242
- * @returns
244
+ * @param a - DivRect a.
245
+ * @param b - DivRect b.
246
+ * @returns - True/false.
243
247
  */
244
248
  static equalsFrame(a, b) {
245
249
  if (a == null && b == null) {
@@ -253,7 +257,7 @@ var DivRect = class _DivRect {
253
257
  /**
254
258
  * Created duplicate of this Rect.
255
259
  *
256
- * @returns
260
+ * @returns - Duplicate.
257
261
  */
258
262
  copy() {
259
263
  return new _DivRect(this.left, this.centerX, this.right, this.top, this.centerY, this.bottom);
@@ -261,9 +265,9 @@ var DivRect = class _DivRect {
261
265
  /**
262
266
  * Move this rect by (dx, dy). Modifies this Rect.
263
267
  *
264
- * @param dx -
265
- * @param dy -
266
- * @returns
268
+ * @param dx - Offset amount in x-direction.
269
+ * @param dy - Offset amount in y-direction.
270
+ * @returns - This DivRect instance.
267
271
  */
268
272
  offsetInPlace(dx, dy) {
269
273
  this.left += dx;
@@ -277,9 +281,9 @@ var DivRect = class _DivRect {
277
281
  /**
278
282
  * Move this rect by (dx, dy). Immutable, returns modified copy.
279
283
  *
280
- * @param dx -
281
- * @param dy -
282
- * @returns
284
+ * @param dx - Offset amount in x-direction.
285
+ * @param dy - Offset amount in y-direction.
286
+ * @returns - DivRect copy with applied offset.
283
287
  */
284
288
  offsetCopy(dx, dy) {
285
289
  return this.copy().offsetInPlace(dx, dy);
@@ -287,8 +291,8 @@ var DivRect = class _DivRect {
287
291
  /**
288
292
  * Expand this Rect by given Rect. Modifies this Rect.
289
293
  *
290
- * @param rect -
291
- * @returns
294
+ * @param rect - DivRect to expand this instance with.
295
+ * @returns - This DivRect instance.
292
296
  */
293
297
  expandInPlace(rect) {
294
298
  this.left = Math.min(this.left, rect.left);
@@ -300,8 +304,8 @@ var DivRect = class _DivRect {
300
304
  /**
301
305
  * Expand this Rect by given Rect. Immutable, returns modified copy.
302
306
  *
303
- * @param rect -
304
- * @returns
307
+ * @param rect - DivRect to expand this instance with.
308
+ * @returns - Expanded copy of this DivRect.
305
309
  */
306
310
  expandCopy(rect) {
307
311
  return this.copy().expandInPlace(rect);
@@ -309,8 +313,8 @@ var DivRect = class _DivRect {
309
313
  /**
310
314
  * Clip this Rect by given Rect. Mmodifies this Rect.
311
315
  *
312
- * @param clipRect -
313
- * @returns
316
+ * @param clipRect - DivRect to clip this instance with.
317
+ * @returns - This DivRect instance.
314
318
  */
315
319
  clipInPlace(clipRect) {
316
320
  this.left = Math.max(this.left, clipRect.left);
@@ -324,8 +328,8 @@ var DivRect = class _DivRect {
324
328
  /**
325
329
  * Clip this Rect by given Rect. Immutable, return modified copy.
326
330
  *
327
- * @param clipRect -
328
- * @returns
331
+ * @param clipRect - DivRecto to clip this instance with.
332
+ * @returns - Clipped DivRect copy.
329
333
  */
330
334
  clipCopy(clipRect) {
331
335
  return this.copy().clipInPlace(clipRect);
@@ -333,9 +337,9 @@ var DivRect = class _DivRect {
333
337
  /**
334
338
  * Scale Rect. Anchor pos is (centerX, centerY). Modifies this Rect.
335
339
  *
336
- * @param scaleX -
337
- * @param scaleY -
338
- * @returns Copy of scaled Rect.
340
+ * @param scaleX - Scale x-amount.
341
+ * @param scaleY - Scale y-amount. If undefined then scale x-amount is used.
342
+ * @returns This DivRect instance.
339
343
  */
340
344
  scaleInPlace(scaleX, scaleY) {
341
345
  scaleY = scaleY != null ? scaleY : scaleX;
@@ -348,13 +352,17 @@ var DivRect = class _DivRect {
348
352
  /**
349
353
  * Scale Rect. Anchor pos is (centerX, centerY). Immutable, returns modified copy.
350
354
  *
351
- * @param scaleX -
352
- * @param scaleY -
353
- * @returns Copy of scaled Rect.
355
+ * @param scaleX - Scale x-amount.
356
+ * @param scaleY - Scale y-amount. If undefined then scale x-amount is used.
357
+ * @returns Scaled copy of this DivRect.
354
358
  */
355
359
  scaleCopy(scaleX, scaleY) {
356
360
  return this.copy().scaleInPlace(scaleX, scaleY);
357
361
  }
362
+ /**
363
+ * Get this DivRect instance.
364
+ * @returns - This DivRect instance.
365
+ */
358
366
  getRect() {
359
367
  return this;
360
368
  }
@@ -445,6 +453,27 @@ var Annotation = /* @__PURE__ */ ((Annotation2) => {
445
453
  Annotation2["Tempo"] = "tempo";
446
454
  return Annotation2;
447
455
  })(Annotation || {});
456
+ var DynamicsAnnotation = /* @__PURE__ */ ((DynamicsAnnotation2) => {
457
+ DynamicsAnnotation2["cresc"] = "cresc.";
458
+ DynamicsAnnotation2["decresc"] = "decresc.";
459
+ DynamicsAnnotation2["dim"] = "dim.";
460
+ DynamicsAnnotation2["ppp"] = "ppp";
461
+ DynamicsAnnotation2["pp"] = "pp";
462
+ DynamicsAnnotation2["p"] = "p";
463
+ DynamicsAnnotation2["mp"] = "mp";
464
+ DynamicsAnnotation2["m"] = "m";
465
+ DynamicsAnnotation2["mf"] = "mf";
466
+ DynamicsAnnotation2["f"] = "f";
467
+ DynamicsAnnotation2["ff"] = "ff";
468
+ DynamicsAnnotation2["fff"] = "fff";
469
+ return DynamicsAnnotation2;
470
+ })(DynamicsAnnotation || {});
471
+ var TempoAnnotation = /* @__PURE__ */ ((TempoAnnotation2) => {
472
+ TempoAnnotation2["accel"] = "accel.";
473
+ TempoAnnotation2["rit"] = "rit.";
474
+ TempoAnnotation2["a_tempo"] = "a tempo";
475
+ return TempoAnnotation2;
476
+ })(TempoAnnotation || {});
448
477
  var Label = /* @__PURE__ */ ((Label2) => {
449
478
  Label2["Note"] = "note";
450
479
  Label2["Chord"] = "chord";
@@ -1342,9 +1371,9 @@ var ObjSignature = class extends MusicObject {
1342
1371
  if (showTimeSignature) {
1343
1372
  let timeSignature = this.measure.getTimeSignature();
1344
1373
  let beatCount = timeSignature.beatCount.toString();
1345
- this.beatCountText = new ObjText(this, { text: beatCount, scale: 1.4 }, 0, 0.5);
1374
+ this.beatCountText = new ObjText(this, { text: beatCount, scale: 1.4 }, 0.5, 0.5);
1346
1375
  let beatSize = timeSignature.beatSize.toString();
1347
- this.beatSizeText = new ObjText(this, { text: beatSize, scale: 1.4 }, 0, 0.5);
1376
+ this.beatSizeText = new ObjText(this, { text: beatSize, scale: 1.4 }, 0.5, 0.5);
1348
1377
  } else {
1349
1378
  this.beatCountText = this.beatSizeText = void 0;
1350
1379
  }
@@ -1434,6 +1463,7 @@ var ObjSignature = class extends MusicObject {
1434
1463
  return [this];
1435
1464
  }
1436
1465
  layout(renderer) {
1466
+ var _a, _b, _c, _d, _e, _f;
1437
1467
  let { unitSize } = renderer;
1438
1468
  let { staff } = this;
1439
1469
  let paddingX = unitSize;
@@ -1478,15 +1508,16 @@ var ObjSignature = class extends MusicObject {
1478
1508
  });
1479
1509
  }
1480
1510
  let right = x;
1511
+ (_a = this.beatCountText) == null ? void 0 : _a.layout(renderer);
1512
+ (_b = this.beatSizeText) == null ? void 0 : _b.layout(renderer);
1513
+ let tsWidth = Math.max((_d = (_c = this.beatCountText) == null ? void 0 : _c.getRect().width) != null ? _d : 0, (_f = (_e = this.beatSizeText) == null ? void 0 : _e.getRect().width) != null ? _f : 0);
1481
1514
  if (this.beatCountText) {
1482
- this.beatCountText.layout(renderer);
1483
- this.beatCountText.offset(x + paddingX, staff.getDiatonicIdY(staff.middleLineDiatonicId + 2));
1515
+ this.beatCountText.offset(x + tsWidth / 2 + paddingX, staff.getDiatonicIdY(staff.middleLineDiatonicId + 2));
1484
1516
  this.rect.expandInPlace(this.beatCountText.getRect());
1485
1517
  right = Math.max(right, this.rect.right);
1486
1518
  }
1487
1519
  if (this.beatSizeText) {
1488
- this.beatSizeText.layout(renderer);
1489
- this.beatSizeText.offset(x + paddingX, staff.getDiatonicIdY(staff.bottomLineDiatonicId + 2));
1520
+ this.beatSizeText.offset(x + tsWidth / 2 + paddingX, staff.getDiatonicIdY(staff.bottomLineDiatonicId + 2));
1490
1521
  this.rect.expandInPlace(this.beatSizeText.getRect());
1491
1522
  right = Math.max(right, this.rect.right);
1492
1523
  }
@@ -2875,11 +2906,10 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
2875
2906
  }
2876
2907
  setStemTipY(staff, stemTipY) {
2877
2908
  let obj = this.staffObjects.find((obj2) => obj2.staff === staff);
2878
- if (!(obj == null ? void 0 : obj.stemTip) || stemTipY === obj.stemTip.centerY) {
2879
- return;
2909
+ if (this.hasBeamCount() && (obj == null ? void 0 : obj.stemTip) && stemTipY !== obj.stemTip.centerY) {
2910
+ obj.stemTip.top = obj.stemTip.centerY = obj.stemTip.bottom = stemTipY;
2911
+ this.requestRectUpdate();
2880
2912
  }
2881
- obj.stemTip.top = obj.stemTip.centerY = obj.stemTip.bottom = stemTipY;
2882
- this.requestRectUpdate();
2883
2913
  }
2884
2914
  offset(dx, dy) {
2885
2915
  this.staffObjects.forEach((obj) => obj.offset(dx, 0));
@@ -3408,6 +3438,9 @@ var ObjRhythmColumn = class extends MusicObject {
3408
3438
  }
3409
3439
  };
3410
3440
 
3441
+ // src/score/engine/extension.ts
3442
+ var import_core9 = require("@tspro/web-music-score/core");
3443
+
3411
3444
  // src/score/engine/element-data.ts
3412
3445
  var import_ts_utils_lib5 = require("@tspro/ts-utils-lib");
3413
3446
 
@@ -3530,29 +3563,8 @@ function getNavigationString(navigation) {
3530
3563
  return navigation[0].toUpperCase() + navigation.substring(1);
3531
3564
  }
3532
3565
  }
3533
- var DynamicsAnnotations = /* @__PURE__ */ ((DynamicsAnnotations2) => {
3534
- DynamicsAnnotations2["cresc"] = "cresc.";
3535
- DynamicsAnnotations2["decresc"] = "decresc.";
3536
- DynamicsAnnotations2["dim"] = "dim.";
3537
- DynamicsAnnotations2["ppp"] = "ppp";
3538
- DynamicsAnnotations2["pp"] = "pp";
3539
- DynamicsAnnotations2["p"] = "p";
3540
- DynamicsAnnotations2["mp"] = "mp";
3541
- DynamicsAnnotations2["m"] = "m";
3542
- DynamicsAnnotations2["mf"] = "mf";
3543
- DynamicsAnnotations2["f"] = "f";
3544
- DynamicsAnnotations2["ff"] = "ff";
3545
- DynamicsAnnotations2["fff"] = "fff";
3546
- return DynamicsAnnotations2;
3547
- })(DynamicsAnnotations || {});
3548
- var TempoAnnotations = /* @__PURE__ */ ((TempoAnnotations2) => {
3549
- TempoAnnotations2["accel"] = "accel.";
3550
- TempoAnnotations2["rit"] = "rit.";
3551
- TempoAnnotations2["a_tempo"] = "a tempo";
3552
- return TempoAnnotations2;
3553
- })(TempoAnnotations || {});
3554
3566
  function isDynamicsText(text) {
3555
- return import_ts_utils_lib5.Utils.Is.isEnumValue(text, DynamicsAnnotations);
3567
+ return import_ts_utils_lib5.Utils.Is.isEnumValue(text, DynamicsAnnotation);
3556
3568
  }
3557
3569
  function getDynamicsVolume(text) {
3558
3570
  if (/^(p+|f+|m|mp|mf)$/.test(text)) {
@@ -3563,12 +3575,12 @@ function getDynamicsVolume(text) {
3563
3575
  }
3564
3576
  }
3565
3577
  function isTempoText(text) {
3566
- return import_ts_utils_lib5.Utils.Is.isEnumValue(text, TempoAnnotations);
3578
+ return import_ts_utils_lib5.Utils.Is.isEnumValue(text, TempoAnnotation);
3567
3579
  }
3568
3580
  function getAnnotation(text) {
3569
- if (import_ts_utils_lib5.Utils.Is.isEnumValue(text, DynamicsAnnotations)) {
3581
+ if (import_ts_utils_lib5.Utils.Is.isEnumValue(text, DynamicsAnnotation)) {
3570
3582
  return "dynamics" /* Dynamics */;
3571
- } else if (import_ts_utils_lib5.Utils.Is.isEnumValue(text, TempoAnnotations)) {
3583
+ } else if (import_ts_utils_lib5.Utils.Is.isEnumValue(text, TempoAnnotation)) {
3572
3584
  return "tempo" /* Tempo */;
3573
3585
  } else {
3574
3586
  return void 0;
@@ -3576,7 +3588,6 @@ function getAnnotation(text) {
3576
3588
  }
3577
3589
 
3578
3590
  // src/score/engine/extension.ts
3579
- var import_core9 = require("@tspro/web-music-score/core");
3580
3591
  function getTextAnchorY(linePos) {
3581
3592
  switch (linePos) {
3582
3593
  case "bottom":
@@ -5107,7 +5118,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5107
5118
  setTimeSignature(timeSignature) {
5108
5119
  var _a;
5109
5120
  (_a = this.getPrevMeasure()) == null ? void 0 : _a.endSection();
5110
- this.alterTimeSignature = timeSignature instanceof import_theory10.TimeSignature ? timeSignature : new import_theory10.TimeSignature(timeSignature);
5121
+ this.alterTimeSignature = timeSignature;
5111
5122
  this.updateTimeSignature();
5112
5123
  }
5113
5124
  updateTimeSignature() {
@@ -5637,52 +5648,77 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5637
5648
  return false;
5638
5649
  }
5639
5650
  });
5651
+ let ts = this.getTimeSignature();
5652
+ if (!this.needBeamsUpdate || ts.beamGroupSizes.length === 0) {
5653
+ return;
5654
+ }
5640
5655
  getVoiceIds().forEach((voiceId) => {
5641
- let symbols = this.getVoiceSymbols(voiceId);
5642
- if (symbols.length <= 2) {
5643
- return;
5644
- }
5645
- if (!DebugSettings.DisableBeams) {
5646
- let groupSymbols = [];
5656
+ let symbols = this.getVoiceSymbols(voiceId).slice();
5657
+ if (symbols.length >= 2) {
5658
+ let symbolsStartTicks = this.isUpBeat() ? Math.max(0, this.getMeasureTicks() - this.getConsumedTicks()) : 0;
5647
5659
  let groupStartTicks = 0;
5648
- let groupEndTicks = 0;
5649
- if (this.isUpBeat()) {
5650
- let startTicks = Math.max(0, this.getMeasureTicks() - this.getConsumedTicks());
5651
- groupStartTicks = groupEndTicks = startTicks;
5652
- }
5653
- let ts = this.getTimeSignature();
5654
- symbols.forEach((symbol) => {
5655
- groupSymbols.push(symbol);
5656
- groupEndTicks += symbol.rhythmProps.ticks;
5657
- if (groupStartTicks === 0 && groupEndTicks === ts.beamGroupLength) {
5658
- _ObjMeasure.setupBeamGroup(groupSymbols);
5659
- }
5660
- while (groupEndTicks >= ts.beamGroupLength) {
5661
- groupSymbols = [];
5662
- groupStartTicks = groupEndTicks = groupEndTicks - ts.beamGroupLength;
5660
+ for (let groupId = 0; groupId < ts.beamGroupSizes.length; groupId++) {
5661
+ let beamGroupSize = ts.beamGroupSizes[groupId];
5662
+ let groupSizeSum = 0;
5663
+ beamGroupSize.forEach((s) => groupSizeSum += s);
5664
+ let groupLength = groupSizeSum * import_theory9.NoteLengthProps.get("8n").ticks;
5665
+ let groupSymbols = [];
5666
+ let groupSymbolsLength = 0;
5667
+ while (symbols.length > 0 && groupSymbolsLength < groupLength) {
5668
+ let symbol = symbols[0];
5669
+ if (symbol.col.positionTicks >= groupStartTicks) {
5670
+ groupSymbols.push(symbol);
5671
+ groupSymbolsLength += symbol.rhythmProps.ticks;
5672
+ symbols.shift();
5673
+ } else {
5674
+ break;
5675
+ }
5663
5676
  }
5664
- });
5677
+ _ObjMeasure.setupBeamGroup(groupSymbols, beamGroupSize);
5678
+ symbolsStartTicks += groupSymbolsLength;
5679
+ groupStartTicks += groupLength;
5680
+ }
5665
5681
  }
5666
5682
  });
5667
5683
  this.needBeamsUpdate = false;
5668
5684
  this.requestLayout();
5669
5685
  }
5670
- static setupBeamGroup(groupSymbols) {
5686
+ static setupBeamGroup(groupSymbols, mainBeamGroupSizeArr) {
5687
+ if (mainBeamGroupSizeArr.length === 0) {
5688
+ return false;
5689
+ }
5671
5690
  let groupNotes = groupSymbols.map((s) => {
5672
5691
  var _a;
5673
5692
  return s instanceof ObjNoteGroup && ((_a = s.getBeamGroup()) == null ? void 0 : _a.isTuplet()) !== true ? s : void 0;
5674
5693
  });
5675
5694
  ObjNoteGroup.setBeamCounts(groupNotes);
5676
- let beamNotes = [];
5677
- groupNotes.forEach((noteGroup) => {
5678
- if (noteGroup && noteGroup.hasBeamCount()) {
5679
- beamNotes.push(noteGroup);
5680
- } else {
5681
- ObjBeamGroup.createBeam(beamNotes);
5682
- beamNotes = [];
5683
- }
5684
- });
5685
- ObjBeamGroup.createBeam(beamNotes);
5695
+ let beamGroupSizeArrList = [mainBeamGroupSizeArr];
5696
+ if (mainBeamGroupSizeArr.length > 1) {
5697
+ let sum = 0;
5698
+ mainBeamGroupSizeArr.forEach((s) => sum += s);
5699
+ beamGroupSizeArrList.unshift([sum]);
5700
+ }
5701
+ let beamsCreated = false;
5702
+ while (beamGroupSizeArrList.length > 0 && !beamsCreated) {
5703
+ let beamGroupSizeArr = beamGroupSizeArrList.shift();
5704
+ let groupSymbolsCopy = groupSymbols.slice();
5705
+ beamGroupSizeArr.forEach((beamGroupSize) => {
5706
+ var _a;
5707
+ let beamGroupLength = beamGroupSize * import_theory9.NoteLengthProps.get("8n").ticks;
5708
+ let beamNotesLength = 0;
5709
+ let beamNotes = [];
5710
+ while (beamNotesLength < beamGroupLength && groupSymbolsCopy.length > 0) {
5711
+ let symbol = groupSymbolsCopy.shift();
5712
+ beamNotesLength += symbol.rhythmProps.ticks;
5713
+ beamNotes.push(symbol instanceof ObjNoteGroup && ((_a = symbol.getBeamGroup()) == null ? void 0 : _a.isTuplet()) !== true ? symbol : void 0);
5714
+ }
5715
+ if (beamNotesLength === beamGroupLength && beamNotes.every((n) => n !== void 0) && (beamNotes.every((n) => n.rhythmProps.flagCount === 1) || beamGroupSizeArrList.length === 0)) {
5716
+ ObjBeamGroup.createBeam(beamNotes);
5717
+ beamsCreated = true;
5718
+ }
5719
+ });
5720
+ }
5721
+ return beamsCreated;
5686
5722
  }
5687
5723
  getBarLineLeft() {
5688
5724
  return this.barLineLeft;
@@ -7119,6 +7155,9 @@ function isTupletRatio(tupletRatio) {
7119
7155
  }
7120
7156
  }
7121
7157
  var DocumentBuilder = class {
7158
+ /**
7159
+ * Create new document builder instance.
7160
+ */
7122
7161
  constructor() {
7123
7162
  __publicField(this, "doc");
7124
7163
  this.doc = new ObjDocument();
@@ -7152,9 +7191,20 @@ var DocumentBuilder = class {
7152
7191
  var _a;
7153
7192
  return (_a = this.doc.getLastMeasure()) != null ? _a : this.doc.addMeasure();
7154
7193
  }
7194
+ /**
7195
+ * Get music document after finished building.
7196
+ * @returns - Music document.
7197
+ */
7155
7198
  getDocument() {
7156
7199
  return this.doc.getMusicInterface();
7157
7200
  }
7201
+ /**
7202
+ * Set header texts.
7203
+ * @param title - Title of this docmument/musical piece.
7204
+ * @param composer - Composer of this document/musical piece.
7205
+ * @param arranger - Arranger of this document/musical piece.
7206
+ * @returns - This document builder instance.
7207
+ */
7158
7208
  setHeader(title, composer, arranger) {
7159
7209
  assertArg(import_ts_utils_lib13.Utils.Is.isStringOrUndefined(title), "title", title);
7160
7210
  assertArg(import_ts_utils_lib13.Utils.Is.isStringOrUndefined(composer), "composer", composer);
@@ -7162,11 +7212,20 @@ var DocumentBuilder = class {
7162
7212
  this.doc.setHeader(title, composer, arranger);
7163
7213
  return this;
7164
7214
  }
7215
+ /**
7216
+ * Automatically limit number of measures per score row.
7217
+ * @param measuresPerRow - Number of measures per row. Must be integer >=1 or Infinity.
7218
+ * @returns - This document builder instance.
7219
+ */
7165
7220
  setMeasuresPerRow(measuresPerRow) {
7166
7221
  assertArg(import_ts_utils_lib13.Utils.Is.isIntegerGte(measuresPerRow, 1) || import_ts_utils_lib13.Utils.Is.isPosInfinity(measuresPerRow), "measuresPerRow", measuresPerRow);
7167
7222
  this.doc.setMeasuresPerRow(measuresPerRow);
7168
7223
  return this;
7169
7224
  }
7225
+ /**
7226
+ * Add new measure.
7227
+ * @returns - This document builder instance.
7228
+ */
7170
7229
  addMeasure() {
7171
7230
  this.doc.addMeasure();
7172
7231
  return this;
@@ -7176,9 +7235,16 @@ var DocumentBuilder = class {
7176
7235
  this.getMeasure().setKeySignature(...args);
7177
7236
  return this;
7178
7237
  }
7179
- setTimeSignature(timeSignature) {
7180
- assertArg(timeSignature instanceof import_theory13.TimeSignature || import_ts_utils_lib13.Utils.Is.isNonEmptyString(timeSignature), "timeSignature", timeSignature);
7181
- this.getMeasure().setTimeSignature(timeSignature);
7238
+ setTimeSignature(...args) {
7239
+ if (args[0] instanceof import_theory13.TimeSignature) {
7240
+ this.getMeasure().setTimeSignature(args[0]);
7241
+ } else if (import_ts_utils_lib13.Utils.Is.isEnumValue(args[0], import_theory13.TimeSignatures) && import_ts_utils_lib13.Utils.Is.isEnumValueOrUndefined(args[1], import_theory13.BeamGrouping)) {
7242
+ this.getMeasure().setTimeSignature(new import_theory13.TimeSignature(args[0], args[1]));
7243
+ } else if (import_ts_utils_lib13.Utils.Is.isIntegerGte(args[0], 1) && import_ts_utils_lib13.Utils.Is.isIntegerGte(args[1], 1) && import_ts_utils_lib13.Utils.Is.isEnumValueOrUndefined(args[2], import_theory13.BeamGrouping)) {
7244
+ this.getMeasure().setTimeSignature(new import_theory13.TimeSignature(args[0], args[1], args[2]));
7245
+ } else {
7246
+ assertArg(false, "timeSignature args", args);
7247
+ }
7182
7248
  return this;
7183
7249
  }
7184
7250
  setTempo(beatsPerMinute, beatLength, dotted) {
@@ -7192,6 +7258,14 @@ var DocumentBuilder = class {
7192
7258
  this.getMeasure().setTempo(beatsPerMinute, beatLength, dotted);
7193
7259
  return this;
7194
7260
  }
7261
+ /**
7262
+ * Add note o current measure.
7263
+ * @param voiceId - Voice id to add note to.
7264
+ * @param note - Note instance of Note or string (e.g. "D4").
7265
+ * @param noteLength - Note length (e.g. "4n").
7266
+ * @param options - Note options.
7267
+ * @returns - This document builder instance.
7268
+ */
7195
7269
  addNote(voiceId, note, noteLength, options) {
7196
7270
  assertArg(isVoiceId(voiceId), "voiceId", voiceId);
7197
7271
  assertArg(note instanceof import_theory13.Note || import_ts_utils_lib13.Utils.Is.isNonEmptyString(note), "note", note);
@@ -7202,6 +7276,13 @@ var DocumentBuilder = class {
7202
7276
  this.getMeasure().addNoteGroup(voiceId, [note], noteLength, options);
7203
7277
  return this;
7204
7278
  }
7279
+ /**
7280
+ * @param voiceId - Voice id to add chord to.
7281
+ * @param notes - Array of notes, each instance of Note or string (e.g. "D4").
7282
+ * @param noteLength - Note length (e.g. "4n").
7283
+ * @param options - Note options.
7284
+ * @returns - This document builder instance.
7285
+ */
7205
7286
  addChord(voiceId, notes, noteLength, options) {
7206
7287
  assertArg(isVoiceId(voiceId), "voiceId", voiceId);
7207
7288
  assertArg(import_ts_utils_lib13.Utils.Is.isNonEmptyArray(notes) && notes.every((note) => note instanceof import_theory13.Note || import_ts_utils_lib13.Utils.Is.isNonEmptyString(note)), "notes", notes);
@@ -7212,6 +7293,13 @@ var DocumentBuilder = class {
7212
7293
  this.getMeasure().addNoteGroup(voiceId, notes, noteLength, options);
7213
7294
  return this;
7214
7295
  }
7296
+ /**
7297
+ *
7298
+ * @param voiceId - Voice id to add rest to.
7299
+ * @param restLength - Rest length (e.g. "4n").
7300
+ * @param options - Rest options.
7301
+ * @returns - This document builder instance.
7302
+ */
7215
7303
  addRest(voiceId, restLength, options) {
7216
7304
  assertArg(isVoiceId(voiceId), "voiceId", voiceId);
7217
7305
  assertArg(import_ts_utils_lib13.Utils.Is.isEnumValue(restLength, import_theory13.NoteLength) || isNoteLength(restLength), "restLength", restLength);
@@ -7231,10 +7319,10 @@ var DocumentBuilder = class {
7231
7319
  * });
7232
7320
  * </pre>
7233
7321
  *
7234
- * @param voiceId
7322
+ * @param voiceId - Voice id to add tuplet to.
7235
7323
  * @param tupletRatio - You can also use Theory.Tuplet presets (e.g. Theory.Tuplet.Triplet).
7236
- * @param tupletBuilder
7237
- * @returns
7324
+ * @param tupletBuilder - Tuplet builder function to build tuplet.
7325
+ * @returns - This document builder instance.
7238
7326
  */
7239
7327
  addTuplet(voiceId, tupletRatio, tupletBuilder) {
7240
7328
  assertArg(isVoiceId(voiceId), "voiceId", voiceId);
@@ -7285,10 +7373,20 @@ var DocumentBuilder = class {
7285
7373
  this.getMeasure().addFermata(staffTabOrGroups, fermata);
7286
7374
  return this;
7287
7375
  }
7376
+ /**
7377
+ * Add fermata to current measure.
7378
+ * @param fermata - Fermata type (e.g. "atNote" or Fermata.AtrNote).
7379
+ * @returns - This document builder instance.
7380
+ */
7288
7381
  addFermata(fermata = "atNote" /* AtNote */) {
7289
7382
  return this.addFermataInternal(void 0, fermata);
7290
7383
  }
7291
- /** @param staffTabOrGroups - staff/tab index (0=top), staff/tab name, or staff group name. */
7384
+ /**
7385
+ * Add Fermata to current measure to given staff/tab/group.
7386
+ * @param staffTabOrGroups - staff/tab index (0=top), staff/tab name, or staff group name.
7387
+ * @param fermata - Fermata type (e.g. "atNote" or Fermata.AtrNote).
7388
+ * @returns - This document builder instance.
7389
+ */
7292
7390
  addFermataTo(staffTabOrGroups, fermata = "atNote" /* AtNote */) {
7293
7391
  return this.addFermataInternal(staffTabOrGroups, fermata);
7294
7392
  }
@@ -7341,10 +7439,22 @@ var DocumentBuilder = class {
7341
7439
  this.getMeasure().addLabel(staffTabOrGroups, label, text);
7342
7440
  return this;
7343
7441
  }
7442
+ /**
7443
+ * Add label text to column of last added note/chord/rest in current measure.
7444
+ * @param label - Label type (e.g. "chord" or Label.Chord).
7445
+ * @param text - label text (e.g. "Am").
7446
+ * @returns - This document builder instance.
7447
+ */
7344
7448
  addLabel(label, text) {
7345
7449
  return this.addLabelInternal(void 0, label, text);
7346
7450
  }
7347
- /** @param staffTabOrGroups - staff/tab index (0=top), staff/tab name, or staff group name. */
7451
+ /**
7452
+ * Add label text to column of last added note/chord/rest in current measure to given staff/tab/group.
7453
+ * @param staffTabOrGroups - staff/tab index (0=top), staff/tab name, or staff group name.
7454
+ * @param label - Label type (e.g. "chord" or Label.Chord).
7455
+ * @param text - label text (e.g. "Am").
7456
+ * @returns - This document builder instance.
7457
+ */
7348
7458
  addLabelTo(staffTabOrGroups, label, text) {
7349
7459
  return this.addLabelInternal(staffTabOrGroups, label, text);
7350
7460
  }
@@ -7370,16 +7480,16 @@ var DocumentBuilder = class {
7370
7480
  return this;
7371
7481
  }
7372
7482
  /**
7373
- * Extension length example:
7483
+ * Add extension line to previously added annotation or label element.
7374
7484
  * <pre>
7485
+ * // Example
7375
7486
  * addExtension(ext => ext.notes("1n", 2)) // length is 2 whole notes
7376
7487
  * addExtension(ext => ext.measures(3).hide()) // length is 3 measures, hidden
7377
7488
  * addExtension(ext => ext.measures(1).notes("8n")) // length is 1 measure + 1 eigth note
7378
7489
  * addExtension(ext => ext.infinity()) // length is as long as possible
7379
7490
  * </pre>
7380
- * @param extensionLength
7381
- * @param extensionVisible
7382
- * @returns
7491
+ * @param extensionBuilder - Extension builder function used to build exstension.
7492
+ * @returns - This document builder instance.
7383
7493
  */
7384
7494
  addExtension(extensionBuilder) {
7385
7495
  assertArg(import_ts_utils_lib13.Utils.Is.isFunctionOrUndefined(extensionBuilder), "addExtension() has new usage, for e.g. addExtension(ext => ext.measures(2)). Please refer to README or API Reference.", extensionBuilder);
@@ -7415,11 +7525,11 @@ var DocumentBuilder = class {
7415
7525
  return this;
7416
7526
  }
7417
7527
  /**
7418
- *
7528
+ * Add staff group.
7419
7529
  * @param groupName - Name of staff group.
7420
7530
  * @param staffsTabsAndGroups - staff/tab index (0=top), staff/tab name, or staff group name. Single value or array.
7421
7531
  * @param verticalPosition - Vertical position, are elements added above, below or both.
7422
- * @returns
7532
+ * @returns - This document builder instance.
7423
7533
  */
7424
7534
  addStaffGroup(groupName, staffsTabsAndGroups, verticalPosition = "auto" /* Auto */) {
7425
7535
  assertArg(import_ts_utils_lib13.Utils.Is.isNonEmptyString(groupName), "groupName", groupName);
@@ -7432,24 +7542,48 @@ var DocumentBuilder = class {
7432
7542
  this.doc.addStaffGroup(groupName, staffsTabsAndGroups, verticalPosition);
7433
7543
  return this;
7434
7544
  }
7545
+ /**
7546
+ * Add song end. Adds certain bar line at the end of measure.
7547
+ * @returns - This document builder instance.
7548
+ */
7435
7549
  endSong() {
7436
7550
  this.getMeasure().endSong();
7437
7551
  return this;
7438
7552
  }
7553
+ /**
7554
+ * Add section end. Adds certain bar line at the end of measure.
7555
+ * @returns - This document builder instance.
7556
+ */
7439
7557
  endSection() {
7440
7558
  this.getMeasure().endSection();
7441
7559
  return this;
7442
7560
  }
7561
+ /**
7562
+ * End current score row. Next measure will start new row.
7563
+ * @returns - This document builder instance.
7564
+ */
7443
7565
  endRow() {
7444
7566
  var _a;
7445
7567
  (_a = this.doc.getLastMeasure()) == null ? void 0 : _a.endRow();
7446
7568
  return this;
7447
7569
  }
7570
+ /**
7571
+ * Add rests to fill current measure.
7572
+ * @param voiceId - Voice id to add rests to. Single value, array or all if omitted.
7573
+ * @returns - This document builder instance.
7574
+ */
7448
7575
  completeRests(voiceId) {
7449
7576
  assertArg(import_ts_utils_lib13.Utils.Is.isUndefined(voiceId) || isVoiceId(voiceId) || import_ts_utils_lib13.Utils.Is.isArray(voiceId) && voiceId.every((id) => isVoiceId(id)), "voiceId", voiceId);
7450
7577
  this.getMeasure().completeRests(voiceId);
7451
7578
  return this;
7452
7579
  }
7580
+ /**
7581
+ * Add notes of given scale in ascending order.
7582
+ * @param scale - Scale.
7583
+ * @param bottomNote - Scale starts from note >= bottom note.
7584
+ * @param numOctaves - Number of octaves to add.
7585
+ * @returns - This document builder instance.
7586
+ */
7453
7587
  addScaleArpeggio(scale, bottomNote, numOctaves) {
7454
7588
  assertArg(import_ts_utils_lib13.Utils.Is.isNonEmptyString(bottomNote), "bottomNote", bottomNote);
7455
7589
  assertArg(import_ts_utils_lib13.Utils.Is.isIntegerGte(numOctaves, 1), "numOctaves", numOctaves);
@@ -7470,11 +7604,22 @@ var DocumentBuilder = class {
7470
7604
  // src/score/pub/event.ts
7471
7605
  var import_core18 = require("@tspro/web-music-score/core");
7472
7606
  var ScoreEvent = class {
7607
+ /**
7608
+ * Create new score event instance.
7609
+ * @param type - Score event type.
7610
+ */
7473
7611
  constructor(type) {
7474
7612
  this.type = type;
7475
7613
  }
7476
7614
  };
7477
7615
  var ScoreStaffPosEvent = class extends ScoreEvent {
7616
+ /**
7617
+ * Create new score staff position event.
7618
+ * @param type - Score event type.
7619
+ * @param renderer - Renderer.
7620
+ * @param scoreRow - Score row.
7621
+ * @param diatonicId - Diatonic id that was clicked/entered/left.
7622
+ */
7478
7623
  constructor(type, renderer, scoreRow, diatonicId) {
7479
7624
  super(type);
7480
7625
  this.renderer = renderer;
@@ -7483,6 +7628,12 @@ var ScoreStaffPosEvent = class extends ScoreEvent {
7483
7628
  }
7484
7629
  };
7485
7630
  var ScoreObjectEvent = class extends ScoreEvent {
7631
+ /**
7632
+ * Create new score object event.
7633
+ * @param type - Score event type.
7634
+ * @param renderer - Renderer.
7635
+ * @param objects - Array of objects, last object in this array is the top object that was clicked/entered/left, previous objects are it's parent objects.
7636
+ */
7486
7637
  constructor(type, renderer, objects) {
7487
7638
  super(type);
7488
7639
  this.renderer = renderer;
@@ -7491,16 +7642,25 @@ var ScoreObjectEvent = class extends ScoreEvent {
7491
7642
  throw new import_core18.MusicError(import_core18.MusicErrorType.Score, "Empty array in score object event!");
7492
7643
  }
7493
7644
  }
7645
+ /** Top object getter. */
7494
7646
  get topObject() {
7495
7647
  return this.objects[this.objects.length - 1];
7496
7648
  }
7649
+ /**
7650
+ * Find object.
7651
+ * @param fn - Compare function.
7652
+ * @returns - First object that matched compare function, or undefined if no match.
7653
+ */
7497
7654
  findObject(fn) {
7498
7655
  return this.objects.find((obj) => fn(obj));
7499
7656
  }
7500
7657
  };
7501
7658
 
7502
- // src/score/pub/interface.ts
7659
+ // src/score/pub/music-interface.ts
7503
7660
  var Audio2 = __toESM(require("@tspro/web-music-score/audio"));
7661
+ var import_ts_utils_lib15 = require("@tspro/ts-utils-lib");
7662
+
7663
+ // src/score/pub/music-objects.ts
7504
7664
  var import_ts_utils_lib14 = require("@tspro/ts-utils-lib");
7505
7665
  var import_core19 = require("@tspro/web-music-score/core");
7506
7666
  function assertArg2(condition, argName, argValue) {
@@ -7508,13 +7668,6 @@ function assertArg2(condition, argName, argValue) {
7508
7668
  throw new import_core19.MusicError(import_core19.MusicErrorType.Score, `Invalid arg: ${argName} = ${argValue}`);
7509
7669
  }
7510
7670
  }
7511
- function require_t(t, message) {
7512
- if (t === void 0 || t === null) {
7513
- throw new TypeError(message);
7514
- } else {
7515
- return t;
7516
- }
7517
- }
7518
7671
  function isVoiceId2(value) {
7519
7672
  return import_ts_utils_lib14.Utils.Is.isNumber(value) && getVoiceIds().indexOf(value) >= 0;
7520
7673
  }
@@ -7526,9 +7679,17 @@ function getNotationLine(line) {
7526
7679
  }
7527
7680
  }
7528
7681
  var MusicInterface6 = class {
7682
+ /**
7683
+ * Create new music interface object.
7684
+ * @param name - OBject name.
7685
+ */
7529
7686
  constructor(name) {
7530
7687
  this.name = name;
7531
7688
  }
7689
+ /**
7690
+ * Get parent object.
7691
+ * @returns - Parent object or undefined.
7692
+ */
7532
7693
  getParent() {
7533
7694
  var _a;
7534
7695
  return (_a = this.getMusicObject().getParent()) == null ? void 0 : _a.getMusicInterface();
@@ -7544,10 +7705,15 @@ var _MAccidental = class _MAccidental extends MusicInterface6 {
7544
7705
  getMusicObject() {
7545
7706
  return this.obj;
7546
7707
  }
7708
+ /**
7709
+ * Get accidental.
7710
+ * @returns - Accidental (e.g. 1 = #).
7711
+ */
7547
7712
  getAccidental() {
7548
7713
  return this.obj.accidental;
7549
7714
  }
7550
7715
  };
7716
+ /** Object name. */
7551
7717
  __publicField(_MAccidental, "Name", "Accidental");
7552
7718
  var MAccidental = _MAccidental;
7553
7719
  var _MConnective = class _MConnective extends MusicInterface6 {
@@ -7561,6 +7727,7 @@ var _MConnective = class _MConnective extends MusicInterface6 {
7561
7727
  return this.obj;
7562
7728
  }
7563
7729
  };
7730
+ /** Object name. */
7564
7731
  __publicField(_MConnective, "Name", "Connective");
7565
7732
  var MConnective = _MConnective;
7566
7733
  var _MArpeggio = class _MArpeggio extends MusicInterface6 {
@@ -7573,13 +7740,22 @@ var _MArpeggio = class _MArpeggio extends MusicInterface6 {
7573
7740
  getMusicObject() {
7574
7741
  return this.obj;
7575
7742
  }
7743
+ /**
7744
+ * Get rhythm column this arpeggio is in.
7745
+ * @returns - Rhythm column.
7746
+ */
7576
7747
  getRhythmColumn() {
7577
7748
  return this.obj.col.getMusicInterface();
7578
7749
  }
7750
+ /**
7751
+ * Get notation line this arpeggio is in.
7752
+ * @returns - Staff or tab object.
7753
+ */
7579
7754
  getNotationLine() {
7580
7755
  return getNotationLine(this.obj.line);
7581
7756
  }
7582
7757
  };
7758
+ /** Object name. */
7583
7759
  __publicField(_MArpeggio, "Name", "Arpeggio");
7584
7760
  var MArpeggio = _MArpeggio;
7585
7761
  var _MBeamGroup = class _MBeamGroup extends MusicInterface6 {
@@ -7593,6 +7769,7 @@ var _MBeamGroup = class _MBeamGroup extends MusicInterface6 {
7593
7769
  return this.obj;
7594
7770
  }
7595
7771
  };
7772
+ /** OBject name. */
7596
7773
  __publicField(_MBeamGroup, "Name", "BeamGroup");
7597
7774
  var MBeamGroup = _MBeamGroup;
7598
7775
  var _MStaffBeamGroup = class _MStaffBeamGroup extends MusicInterface6 {
@@ -7605,10 +7782,15 @@ var _MStaffBeamGroup = class _MStaffBeamGroup extends MusicInterface6 {
7605
7782
  getMusicObject() {
7606
7783
  return this.obj;
7607
7784
  }
7785
+ /**
7786
+ * Get staff this beam group is in.
7787
+ * @returns - Staff object.
7788
+ */
7608
7789
  getStaff() {
7609
7790
  return this.obj.staff.getMusicInterface();
7610
7791
  }
7611
7792
  };
7793
+ /** Object name. */
7612
7794
  __publicField(_MStaffBeamGroup, "Name", "StaffBeamGroup");
7613
7795
  var MStaffBeamGroup = _MStaffBeamGroup;
7614
7796
  var _MDocument = class _MDocument extends MusicInterface6 {
@@ -7621,27 +7803,53 @@ var _MDocument = class _MDocument extends MusicInterface6 {
7621
7803
  getMusicObject() {
7622
7804
  return this.obj;
7623
7805
  }
7806
+ /**
7807
+ * Get title.
7808
+ * @returns - Title string or undefined.
7809
+ */
7624
7810
  getTitle() {
7625
7811
  return this.obj.getTitle();
7626
7812
  }
7813
+ /**
7814
+ * Get composer.
7815
+ * @returns - Composer string or undefined.
7816
+ */
7627
7817
  getComposer() {
7628
7818
  return this.obj.getComposer();
7629
7819
  3;
7630
7820
  }
7821
+ /**
7822
+ * Get arranger.
7823
+ * @returns - Arranger string or undefined.
7824
+ */
7631
7825
  getArranger() {
7632
7826
  return this.obj.getArranger();
7633
7827
  }
7828
+ /**
7829
+ * Get score rows.
7830
+ * @returns - Array or score rows.
7831
+ */
7634
7832
  getRows() {
7635
7833
  return this.obj.getRows().map((r) => r.getMusicInterface());
7636
7834
  }
7835
+ /**
7836
+ * Get measures.
7837
+ * @returns - Array of measures.
7838
+ */
7637
7839
  getMeasures() {
7638
7840
  return this.obj.getMeasures().map((m) => m.getMusicInterface());
7639
7841
  }
7640
- play(fn) {
7641
- assertArg2(import_ts_utils_lib14.Utils.Is.isFunctionOrUndefined(fn), "playStateChangeListener", fn);
7642
- return new MPlayer(this, fn).play();
7842
+ /**
7843
+ * Play this document.
7844
+ * @param playStateChangeListener - Play state change listener function or undefined.
7845
+ * @returns - Player instance.
7846
+ */
7847
+ play(playStateChangeListener) {
7848
+ assertArg2(import_ts_utils_lib14.Utils.Is.isFunctionOrUndefined(playStateChangeListener), "playStateChangeListener", playStateChangeListener);
7849
+ return new MPlayer(this, playStateChangeListener).play();
7643
7850
  }
7644
7851
  };
7852
+ /** Object name. */
7645
7853
  __publicField(_MDocument, "Name", "Document");
7646
7854
  var MDocument2 = _MDocument;
7647
7855
  var _MEnding = class _MEnding extends MusicInterface6 {
@@ -7654,14 +7862,24 @@ var _MEnding = class _MEnding extends MusicInterface6 {
7654
7862
  getMusicObject() {
7655
7863
  return this.obj;
7656
7864
  }
7865
+ /**
7866
+ * Get passages.
7867
+ * @returns - Array of passage numbers, e.g. passage number 1 means that this ending is played on first pass.
7868
+ */
7657
7869
  getPassages() {
7658
7870
  return this.obj.passages;
7659
7871
  }
7872
+ /**
7873
+ * Has passage number?
7874
+ * @param passage - Passage number to find out.
7875
+ * @returns - Boolean whether this ending has asked passage number.
7876
+ */
7660
7877
  hasPassage(passage) {
7661
7878
  assertArg2(import_ts_utils_lib14.Utils.Is.isIntegerGte(passage, 1), "passage", passage);
7662
7879
  return this.obj.hasPassage(passage);
7663
7880
  }
7664
7881
  };
7882
+ /** Object name. */
7665
7883
  __publicField(_MEnding, "Name", "Ending");
7666
7884
  var MEnding = _MEnding;
7667
7885
  var _MFermata = class _MFermata extends MusicInterface6 {
@@ -7675,6 +7893,7 @@ var _MFermata = class _MFermata extends MusicInterface6 {
7675
7893
  return this.obj;
7676
7894
  }
7677
7895
  };
7896
+ /** OBject name. */
7678
7897
  __publicField(_MFermata, "Name", "Fermata");
7679
7898
  var MFermata = _MFermata;
7680
7899
  var _MHeader = class _MHeader extends MusicInterface6 {
@@ -7687,16 +7906,29 @@ var _MHeader = class _MHeader extends MusicInterface6 {
7687
7906
  getMusicObject() {
7688
7907
  return this.obj;
7689
7908
  }
7909
+ /**
7910
+ * Get title.
7911
+ * @returns - Title string or undefined.
7912
+ */
7690
7913
  getTitle() {
7691
7914
  return this.obj.title;
7692
7915
  }
7916
+ /**
7917
+ * Get composer.
7918
+ * @returns - Composer string or undefined.
7919
+ */
7693
7920
  getComposer() {
7694
7921
  return this.obj.composer;
7695
7922
  }
7923
+ /**
7924
+ * Get arranger.
7925
+ * @returns - Arranger string or undefined.
7926
+ */
7696
7927
  getArranger() {
7697
7928
  return this.obj.arranger;
7698
7929
  }
7699
7930
  };
7931
+ /** OBject name. */
7700
7932
  __publicField(_MHeader, "Name", "Header");
7701
7933
  var MHeader = _MHeader;
7702
7934
  var _MImage = class _MImage extends MusicInterface6 {
@@ -7710,6 +7942,7 @@ var _MImage = class _MImage extends MusicInterface6 {
7710
7942
  return this.obj;
7711
7943
  }
7712
7944
  };
7945
+ /** Object name. */
7713
7946
  __publicField(_MImage, "Name", "Image");
7714
7947
  var MImage = _MImage;
7715
7948
  var _MMeasure = class _MMeasure extends MusicInterface6 {
@@ -7722,16 +7955,29 @@ var _MMeasure = class _MMeasure extends MusicInterface6 {
7722
7955
  getMusicObject() {
7723
7956
  return this.obj;
7724
7957
  }
7958
+ /**
7959
+ * Get measure number.
7960
+ * @returns - Measure number starting from 1, or 0 if upbeat.
7961
+ */
7725
7962
  getMeasureNumber() {
7726
7963
  return this.obj.getMeasureNumber();
7727
7964
  }
7965
+ /**
7966
+ * Get rhythm columns.
7967
+ * @returns - Array of rhythm columns.
7968
+ */
7728
7969
  getRhythmColumns() {
7729
7970
  return this.obj.getColumns().map((col) => col.getMusicInterface());
7730
7971
  }
7972
+ /**
7973
+ * Get score row that this measure is in.
7974
+ * @returns - Score row.
7975
+ */
7731
7976
  getRow() {
7732
7977
  return this.obj.row.getMusicInterface();
7733
7978
  }
7734
7979
  };
7980
+ /** OBject name. */
7735
7981
  __publicField(_MMeasure, "Name", "Measure");
7736
7982
  var MMeasure = _MMeasure;
7737
7983
  var _MBarLineRight = class _MBarLineRight extends MusicInterface6 {
@@ -7745,6 +7991,7 @@ var _MBarLineRight = class _MBarLineRight extends MusicInterface6 {
7745
7991
  return this.obj;
7746
7992
  }
7747
7993
  };
7994
+ /** OBject name. */
7748
7995
  __publicField(_MBarLineRight, "Name", "BarLineRight");
7749
7996
  var MBarLineRight = _MBarLineRight;
7750
7997
  var _MBarLineLeft = class _MBarLineLeft extends MusicInterface6 {
@@ -7758,6 +8005,7 @@ var _MBarLineLeft = class _MBarLineLeft extends MusicInterface6 {
7758
8005
  return this.obj;
7759
8006
  }
7760
8007
  };
8008
+ /** Object name. */
7761
8009
  __publicField(_MBarLineLeft, "Name", "BarLineLeft");
7762
8010
  var MBarLineLeft = _MBarLineLeft;
7763
8011
  var _MStaffTabBarLine = class _MStaffTabBarLine extends MusicInterface6 {
@@ -7770,6 +8018,10 @@ var _MStaffTabBarLine = class _MStaffTabBarLine extends MusicInterface6 {
7770
8018
  getMusicObject() {
7771
8019
  return this.obj;
7772
8020
  }
8021
+ /**
8022
+ * Get parent bar line object.
8023
+ * @returns - Parent bar line object.
8024
+ */
7773
8025
  getBarLine() {
7774
8026
  let barLine = this.obj.barLine;
7775
8027
  if (barLine instanceof ObjBarLineLeft || barLine instanceof ObjBarLineRight) {
@@ -7778,10 +8030,15 @@ var _MStaffTabBarLine = class _MStaffTabBarLine extends MusicInterface6 {
7778
8030
  throw new import_core19.MusicError(import_core19.MusicErrorType.Score, `Bar line not let nor right.`);
7779
8031
  }
7780
8032
  }
8033
+ /**
8034
+ * Get staff or tab this bar lien object is in.
8035
+ * @returns - Staff or tab.
8036
+ */
7781
8037
  getNotationLine() {
7782
8038
  return getNotationLine(this.obj.line);
7783
8039
  }
7784
8040
  };
8041
+ /** Object name. */
7785
8042
  __publicField(_MStaffTabBarLine, "Name", "StaffTabBarLine");
7786
8043
  var MStaffTabBarLine = _MStaffTabBarLine;
7787
8044
  var _MNoteGroup = class _MNoteGroup extends MusicInterface6 {
@@ -7794,19 +8051,36 @@ var _MNoteGroup = class _MNoteGroup extends MusicInterface6 {
7794
8051
  getMusicObject() {
7795
8052
  return this.obj;
7796
8053
  }
8054
+ /**
8055
+ * Get notes of this note group.
8056
+ * @returns - Array of Note instances.
8057
+ */
7797
8058
  getNotes() {
7798
8059
  return this.obj.notes;
7799
8060
  }
8061
+ /**
8062
+ * Get rhythm props of this note group.
8063
+ * @returns - Rhythm props.
8064
+ */
7800
8065
  getRhythmProps() {
7801
8066
  return this.obj.rhythmProps;
7802
8067
  }
8068
+ /**
8069
+ * Get rhythm column this note group is in.
8070
+ * @returns - Rhythm column.
8071
+ */
7803
8072
  getRhythmColumn() {
7804
8073
  return this.obj.col.getMusicInterface();
7805
8074
  }
8075
+ /**
8076
+ * Get the measure this note group is in.
8077
+ * @returns - Measure.
8078
+ */
7806
8079
  getMeasure() {
7807
8080
  return this.obj.measure.getMusicInterface();
7808
8081
  }
7809
8082
  };
8083
+ /** Object name. */
7810
8084
  __publicField(_MNoteGroup, "Name", "NoteGroup");
7811
8085
  var MNoteGroup = _MNoteGroup;
7812
8086
  var _MStaffNoteGroup = class _MStaffNoteGroup extends MusicInterface6 {
@@ -7819,19 +8093,36 @@ var _MStaffNoteGroup = class _MStaffNoteGroup extends MusicInterface6 {
7819
8093
  getMusicObject() {
7820
8094
  return this.obj;
7821
8095
  }
8096
+ /**
8097
+ * Get parent note group.
8098
+ * @returns - Parent note group.
8099
+ */
7822
8100
  getNoteGroup() {
7823
8101
  return this.obj.noteGroup.getMusicInterface();
7824
8102
  }
8103
+ /**
8104
+ * Get rhythm column this note group is in.
8105
+ * @returns - Rhythm column.
8106
+ */
7825
8107
  getRhythmColumn() {
7826
8108
  return this.getNoteGroup().getRhythmColumn();
7827
8109
  }
8110
+ /**
8111
+ * Get the measure this note group is in.
8112
+ * @returns - Measure.
8113
+ */
7828
8114
  getMeasure() {
7829
8115
  return this.getNoteGroup().getMeasure();
7830
8116
  }
8117
+ /**
8118
+ * Get staff notation line this note group is in.
8119
+ * @returns - Staff object.
8120
+ */
7831
8121
  getStaff() {
7832
8122
  return this.obj.staff.getMusicInterface();
7833
8123
  }
7834
8124
  };
8125
+ /** Object name. */
7835
8126
  __publicField(_MStaffNoteGroup, "Name", "StaffNoteGroup");
7836
8127
  var MStaffNoteGroup = _MStaffNoteGroup;
7837
8128
  var _MTabNoteGroup = class _MTabNoteGroup extends MusicInterface6 {
@@ -7844,19 +8135,36 @@ var _MTabNoteGroup = class _MTabNoteGroup extends MusicInterface6 {
7844
8135
  getMusicObject() {
7845
8136
  return this.obj;
7846
8137
  }
8138
+ /**
8139
+ * Get parent note group.
8140
+ * @returns - Parent note group.
8141
+ */
7847
8142
  getNoteGroup() {
7848
8143
  return this.obj.noteGroup.getMusicInterface();
7849
8144
  }
8145
+ /**
8146
+ * Get rhythm column this note group is in.
8147
+ * @returns - Rhythm column.
8148
+ */
7850
8149
  getRhythmColumn() {
7851
8150
  return this.getNoteGroup().getRhythmColumn();
7852
8151
  }
8152
+ /**
8153
+ * Get the measure this note group is in.
8154
+ * @returns - Measure.
8155
+ */
7853
8156
  getMeasure() {
7854
8157
  return this.getNoteGroup().getMeasure();
7855
8158
  }
8159
+ /**
8160
+ * Get guitar tab this note group is in.
8161
+ * @returns - Tab object.
8162
+ */
7856
8163
  getTab() {
7857
8164
  return this.obj.tab.getMusicInterface();
7858
8165
  }
7859
8166
  };
8167
+ /** OBject name. */
7860
8168
  __publicField(_MTabNoteGroup, "Name", "TabNoteGroup");
7861
8169
  var MTabNoteGroup = _MTabNoteGroup;
7862
8170
  var _MRest = class _MRest extends MusicInterface6 {
@@ -7869,16 +8177,29 @@ var _MRest = class _MRest extends MusicInterface6 {
7869
8177
  getMusicObject() {
7870
8178
  return this.obj;
7871
8179
  }
8180
+ /**
8181
+ * Get rhythm props of this rest.
8182
+ * @returns - Rhythm props.
8183
+ */
7872
8184
  getRhythmProps() {
7873
8185
  return this.obj.rhythmProps;
7874
8186
  }
8187
+ /**
8188
+ * Get rhythm column this rest is in.
8189
+ * @returns - Rhythm column.
8190
+ */
7875
8191
  getRhythmColumn() {
7876
8192
  return this.obj.col.getMusicInterface();
7877
8193
  }
8194
+ /**
8195
+ * Get the measure this rest is in.
8196
+ * @returns - Measure.
8197
+ */
7878
8198
  getMeasure() {
7879
8199
  return this.obj.measure.getMusicInterface();
7880
8200
  }
7881
8201
  };
8202
+ /** OBject name. */
7882
8203
  __publicField(_MRest, "Name", "Rest");
7883
8204
  var MRest = _MRest;
7884
8205
  var _MStaffRest = class _MStaffRest extends MusicInterface6 {
@@ -7891,19 +8212,36 @@ var _MStaffRest = class _MStaffRest extends MusicInterface6 {
7891
8212
  getMusicObject() {
7892
8213
  return this.obj;
7893
8214
  }
8215
+ /**
8216
+ * Get parent rest object.
8217
+ * @returns - Parent rest object.
8218
+ */
7894
8219
  getRest() {
7895
8220
  return this.obj.rest.getMusicInterface();
7896
8221
  }
8222
+ /**
8223
+ * Get rhythm column this rest is in.
8224
+ * @returns - Rhythm column.
8225
+ */
7897
8226
  getRhythmColumn() {
7898
8227
  return this.getRest().getRhythmColumn();
7899
8228
  }
8229
+ /**
8230
+ * Get the measure this rest is in.
8231
+ * @returns - Measure.
8232
+ */
7900
8233
  getMeasure() {
7901
8234
  return this.getRest().getMeasure();
7902
8235
  }
8236
+ /**
8237
+ * Get staff notation line this rest is in.
8238
+ * @returns - Staff object.
8239
+ */
7903
8240
  getStaff() {
7904
8241
  return this.obj.staff.getMusicInterface();
7905
8242
  }
7906
8243
  };
8244
+ /** Object name. */
7907
8245
  __publicField(_MStaffRest, "Name", "StaffRest");
7908
8246
  var MStaffRest = _MStaffRest;
7909
8247
  var _MRhythmColumn = class _MRhythmColumn extends MusicInterface6 {
@@ -7916,19 +8254,36 @@ var _MRhythmColumn = class _MRhythmColumn extends MusicInterface6 {
7916
8254
  getMusicObject() {
7917
8255
  return this.obj;
7918
8256
  }
8257
+ /**
8258
+ * Get symbol (note group or rest) of this column for given voice id.
8259
+ * @param voiceId - Voice id.
8260
+ * @returns - Note group, rest or undefined.
8261
+ */
7919
8262
  getRhythmSymbol(voiceId) {
7920
8263
  var _a;
7921
8264
  assertArg2(isVoiceId2(voiceId), "voiceId", voiceId);
7922
8265
  return (_a = this.obj.getVoiceSymbol(voiceId)) == null ? void 0 : _a.getMusicInterface();
7923
8266
  }
8267
+ /**
8268
+ * Get symbol (note group or rest) of this column for given voice id.
8269
+ * @deprecated - Use getRhythmSymbol(voiceId) instead.
8270
+ * @param voiceId - Voice id.
8271
+ * @returns - Note group, rest or undefined.
8272
+ */
8273
+ getVoiceSymbol(voiceId) {
8274
+ var _a;
8275
+ assertArg2(isVoiceId2(voiceId), "voiceId", voiceId);
8276
+ return (_a = this.obj.getVoiceSymbol(voiceId)) == null ? void 0 : _a.getMusicInterface();
8277
+ }
8278
+ /**
8279
+ * Get the measure this rhythm column is in.
8280
+ * @returns - Measure.
8281
+ */
7924
8282
  getMeasure() {
7925
8283
  return this.obj.measure.getMusicInterface();
7926
8284
  }
7927
- getVoiceSymbol(voiceId) {
7928
- let s = this.obj.getVoiceSymbol(voiceId);
7929
- return s instanceof ObjNoteGroup || s instanceof ObjRest ? s.getMusicInterface() : void 0;
7930
- }
7931
8285
  };
8286
+ /** OBject name. */
7932
8287
  __publicField(_MRhythmColumn, "Name", "RhythmColumn");
7933
8288
  var MRhythmColumn = _MRhythmColumn;
7934
8289
  var _MScoreRow = class _MScoreRow extends MusicInterface6 {
@@ -7941,16 +8296,29 @@ var _MScoreRow = class _MScoreRow extends MusicInterface6 {
7941
8296
  getMusicObject() {
7942
8297
  return this.obj;
7943
8298
  }
8299
+ /**
8300
+ * Parent music document.
8301
+ * @returns - Parent music document.
8302
+ */
7944
8303
  getDocument() {
7945
8304
  return this.obj.doc.getMusicInterface();
7946
8305
  }
8306
+ /**
8307
+ * Get measures of this score row.
8308
+ * @returns - Array of measures.
8309
+ */
7947
8310
  getMeasures() {
7948
8311
  return this.obj.getMeasures().map((m) => m.getMusicInterface());
7949
8312
  }
8313
+ /**
8314
+ * Get notation lines (staves and tabs) of this score row.
8315
+ * @returns - Array of staves and tabs.
8316
+ */
7950
8317
  getNotationLines() {
7951
8318
  return this.obj.getNotationLines().map((line) => getNotationLine(line));
7952
8319
  }
7953
8320
  };
8321
+ /** Object name. */
7954
8322
  __publicField(_MScoreRow, "Name", "ScoreRow");
7955
8323
  var MScoreRow = _MScoreRow;
7956
8324
  var _MStaff = class _MStaff extends MusicInterface6 {
@@ -7963,16 +8331,29 @@ var _MStaff = class _MStaff extends MusicInterface6 {
7963
8331
  getMusicObject() {
7964
8332
  return this.obj;
7965
8333
  }
8334
+ /**
8335
+ * Get index of this staff in score row.
8336
+ * @returns - Index (0=top notation line).
8337
+ */
7966
8338
  getId() {
7967
8339
  return this.obj.id;
7968
8340
  }
8341
+ /**
8342
+ * Get name of this staff.
8343
+ * @returns - Staff name.
8344
+ */
7969
8345
  getName() {
7970
8346
  return this.obj.name.length > 0 ? this.obj.name : void 0;
7971
8347
  }
8348
+ /**
8349
+ * Get the score row this staff is in.
8350
+ * @returns - Score row.
8351
+ */
7972
8352
  getRow() {
7973
8353
  return this.obj.row.getMusicInterface();
7974
8354
  }
7975
8355
  };
8356
+ /** Object name. */
7976
8357
  __publicField(_MStaff, "Name", "Staff");
7977
8358
  var MStaff = _MStaff;
7978
8359
  var _MTab = class _MTab extends MusicInterface6 {
@@ -7985,16 +8366,29 @@ var _MTab = class _MTab extends MusicInterface6 {
7985
8366
  getMusicObject() {
7986
8367
  return this.obj;
7987
8368
  }
8369
+ /**
8370
+ * Get index of this guitar tab in score row.
8371
+ * @returns - Index (0=top notation line).
8372
+ */
7988
8373
  getId() {
7989
8374
  return this.obj.id;
7990
8375
  }
8376
+ /**
8377
+ * Get name of this guitar tab.
8378
+ * @returns - Staff name.
8379
+ */
7991
8380
  getName() {
7992
8381
  return this.obj.name.length > 0 ? this.obj.name : void 0;
7993
8382
  }
8383
+ /**
8384
+ * Get the score row this guitar tab is in.
8385
+ * @returns - Score row.
8386
+ */
7994
8387
  getRow() {
7995
8388
  return this.obj.row.getMusicInterface();
7996
8389
  }
7997
8390
  };
8391
+ /** Object name. */
7998
8392
  __publicField(_MTab, "Name", "Tab");
7999
8393
  var MTab = _MTab;
8000
8394
  var _MSignature = class _MSignature extends MusicInterface6 {
@@ -8007,10 +8401,15 @@ var _MSignature = class _MSignature extends MusicInterface6 {
8007
8401
  getMusicObject() {
8008
8402
  return this.obj;
8009
8403
  }
8404
+ /**
8405
+ * Get staff notation line this signature is in.
8406
+ * @returns - Staff object.
8407
+ */
8010
8408
  getStaff() {
8011
8409
  return this.obj.staff.getMusicInterface();
8012
8410
  }
8013
8411
  };
8412
+ /** Object name. */
8014
8413
  __publicField(_MSignature, "Name", "Signature");
8015
8414
  var MSignature = _MSignature;
8016
8415
  var _MSpecialText = class _MSpecialText extends MusicInterface6 {
@@ -8023,10 +8422,15 @@ var _MSpecialText = class _MSpecialText extends MusicInterface6 {
8023
8422
  getMusicObject() {
8024
8423
  return this.obj;
8025
8424
  }
8425
+ /**
8426
+ * Get text content.
8427
+ * @returns - Text content.
8428
+ */
8026
8429
  getText() {
8027
8430
  return this.obj.getText();
8028
8431
  }
8029
8432
  };
8433
+ /** Object name. */
8030
8434
  __publicField(_MSpecialText, "Name", "SpecialText");
8031
8435
  var MSpecialText = _MSpecialText;
8032
8436
  var _MText = class _MText extends MusicInterface6 {
@@ -8039,10 +8443,15 @@ var _MText = class _MText extends MusicInterface6 {
8039
8443
  getMusicObject() {
8040
8444
  return this.obj;
8041
8445
  }
8446
+ /**
8447
+ * Get text content.
8448
+ * @returns - Text content.
8449
+ */
8042
8450
  getText() {
8043
8451
  return this.obj.getText();
8044
8452
  }
8045
8453
  };
8454
+ /** Object name. */
8046
8455
  __publicField(_MText, "Name", "Text");
8047
8456
  var MText = _MText;
8048
8457
  var _MExtensionLine = class _MExtensionLine extends MusicInterface6 {
@@ -8056,33 +8465,69 @@ var _MExtensionLine = class _MExtensionLine extends MusicInterface6 {
8056
8465
  return this.obj;
8057
8466
  }
8058
8467
  };
8468
+ /** OBject name. */
8059
8469
  __publicField(_MExtensionLine, "Name", "ExtensionLine");
8060
8470
  var MExtensionLine = _MExtensionLine;
8471
+
8472
+ // src/score/pub/music-interface.ts
8473
+ var import_core20 = require("@tspro/web-music-score/core");
8474
+ function assertArg3(condition, argName, argValue) {
8475
+ if (!condition) {
8476
+ throw new import_core20.MusicError(import_core20.MusicErrorType.Score, `Invalid arg: ${argName} = ${argValue}`);
8477
+ }
8478
+ }
8479
+ function require_t(t, message) {
8480
+ if (t === void 0 || t === null) {
8481
+ throw new TypeError(message);
8482
+ } else {
8483
+ return t;
8484
+ }
8485
+ }
8061
8486
  var _MPlayer = class _MPlayer {
8062
- constructor(doc, fn) {
8487
+ /**
8488
+ * Create new music player.
8489
+ * @param doc - Music document to play.
8490
+ * @param playStateChangeListener - Play state change listener.
8491
+ */
8492
+ constructor(doc, playStateChangeListener) {
8063
8493
  __publicField(this, "player");
8064
- assertArg2(doc instanceof MDocument2, "doc", doc);
8065
- assertArg2(import_ts_utils_lib14.Utils.Is.isFunctionOrUndefined(fn), "playStateChangeListener", fn);
8494
+ assertArg3(doc instanceof MDocument2, "doc", doc);
8495
+ assertArg3(import_ts_utils_lib15.Utils.Is.isFunctionOrUndefined(playStateChangeListener), "playStateChangeListener", playStateChangeListener);
8066
8496
  this.player = new Player();
8067
8497
  this.player.setDocument(doc.getMusicObject());
8068
8498
  this.player.setCursorPositionChangeListener((cursorRect) => doc.getMusicObject().updateCursorRect(cursorRect));
8069
- if (fn) {
8070
- this.player.setPlayStateChnageListener(fn);
8499
+ if (playStateChangeListener) {
8500
+ this.player.setPlayStateChnageListener(playStateChangeListener);
8071
8501
  }
8072
8502
  }
8503
+ /**
8504
+ * Stop all playing.
8505
+ */
8073
8506
  static stopAll() {
8074
8507
  this.currentlyPlaying.forEach((p) => p.stop());
8075
8508
  Audio2.stop();
8076
8509
  }
8510
+ /**
8511
+ * Playe attached document.
8512
+ * @returns - This player instance.
8513
+ */
8077
8514
  play() {
8078
8515
  _MPlayer.currentlyPlaying.add(this);
8079
8516
  this.player.play();
8080
8517
  return this;
8081
8518
  }
8519
+ /**
8520
+ * Pause playback of attached document.
8521
+ * @returns - This player instance.
8522
+ */
8082
8523
  pause() {
8083
8524
  this.player.pause();
8084
8525
  return this;
8085
8526
  }
8527
+ /**
8528
+ * Stop playback of attached document.
8529
+ * @returns - This player instance.
8530
+ */
8086
8531
  stop() {
8087
8532
  this.player.stop();
8088
8533
  _MPlayer.currentlyPlaying.delete(this);
@@ -8092,33 +8537,61 @@ var _MPlayer = class _MPlayer {
8092
8537
  __publicField(_MPlayer, "currentlyPlaying", /* @__PURE__ */ new Set());
8093
8538
  var MPlayer = _MPlayer;
8094
8539
  var MRenderer2 = class {
8540
+ /**
8541
+ * Create new renderer instance.
8542
+ */
8095
8543
  constructor() {
8096
8544
  __publicField(this, "renderer");
8097
8545
  this.renderer = new Renderer(this);
8098
8546
  }
8547
+ /**
8548
+ * Attach music document to this renderer.
8549
+ * @param doc - Music document.
8550
+ * @returns - This renderer instance.
8551
+ */
8099
8552
  setDocument(doc) {
8100
- assertArg2(import_ts_utils_lib14.Utils.Is.isUndefined(doc) || doc instanceof MDocument2, "doc", doc);
8553
+ assertArg3(import_ts_utils_lib15.Utils.Is.isUndefined(doc) || doc instanceof MDocument2, "doc", doc);
8101
8554
  this.renderer.setDocument(doc);
8102
8555
  return this;
8103
8556
  }
8557
+ /**
8558
+ * Set target canvas html element for this renderer.
8559
+ * @param canvas - HTML canvas element or element id.
8560
+ * @returns - This renderer instance.
8561
+ */
8104
8562
  setCanvas(canvas) {
8105
- canvas = require_t(import_ts_utils_lib14.Utils.Dom.getCanvas(canvas), typeof canvas === "string" ? "Cannot set renderer canvas because invalid canvas id: " + canvas : "Cannot set renderer canvas because given canvas is undefined.");
8563
+ canvas = require_t(import_ts_utils_lib15.Utils.Dom.getCanvas(canvas), typeof canvas === "string" ? "Cannot set renderer canvas because invalid canvas id: " + canvas : "Cannot set renderer canvas because given canvas is undefined.");
8106
8564
  this.renderer.setCanvas(canvas);
8107
8565
  return this;
8108
8566
  }
8109
- setScoreEventListener(fn) {
8110
- assertArg2(import_ts_utils_lib14.Utils.Is.isFunctionOrUndefined(fn), "scoreEventListener", fn);
8111
- this.renderer.setScoreEventListener(fn);
8567
+ /**
8568
+ * Set score event listener.
8569
+ * @param scoreEventListener - Score event listener.
8570
+ */
8571
+ setScoreEventListener(scoreEventListener) {
8572
+ assertArg3(import_ts_utils_lib15.Utils.Is.isFunctionOrUndefined(scoreEventListener), "scoreEventListener", scoreEventListener);
8573
+ this.renderer.setScoreEventListener(scoreEventListener);
8112
8574
  }
8575
+ /**
8576
+ * Draw given music object hilighted.
8577
+ * @param obj - Music object or undefined to remove hilighting.
8578
+ */
8113
8579
  hilightObject(obj) {
8114
8580
  this.renderer.hilightObject(obj == null ? void 0 : obj.getMusicObject());
8115
8581
  }
8582
+ /**
8583
+ * Draw given staff position hilighted.
8584
+ * @param staffPos - Staff position (score row and diatonic id) or undefined to remove hilighting.
8585
+ */
8116
8586
  hilightStaffPos(staffPos) {
8117
8587
  this.renderer.hilightStaffPos(staffPos ? {
8118
8588
  scoreRow: staffPos.scoreRow.getMusicObject(),
8119
8589
  diatonicId: staffPos.diatonicId
8120
8590
  } : void 0);
8121
8591
  }
8592
+ /**
8593
+ * Draw contents of attached music document to attached canvas.
8594
+ */
8122
8595
  draw() {
8123
8596
  try {
8124
8597
  this.renderer.draw();
@@ -8129,6 +8602,9 @@ var MRenderer2 = class {
8129
8602
  }
8130
8603
  };
8131
8604
  var _MPlaybackButtons = class _MPlaybackButtons {
8605
+ /**
8606
+ * Create new playback buttons helper class instance.
8607
+ */
8132
8608
  constructor() {
8133
8609
  __publicField(this, "playButton");
8134
8610
  __publicField(this, "stopButton");
@@ -8161,8 +8637,13 @@ var _MPlaybackButtons = class _MPlaybackButtons {
8161
8637
  };
8162
8638
  this.updateButtons();
8163
8639
  }
8640
+ /**
8641
+ * Attach music document whose playcak will be controlled by this playback buttons helper class instance.
8642
+ * @param doc - Music document.
8643
+ * @returns
8644
+ */
8164
8645
  setDocument(doc) {
8165
- assertArg2(import_ts_utils_lib14.Utils.Is.isUndefined(doc) || doc instanceof MDocument2, "doc", doc);
8646
+ assertArg3(import_ts_utils_lib15.Utils.Is.isUndefined(doc) || doc instanceof MDocument2, "doc", doc);
8166
8647
  this.onStop();
8167
8648
  if (doc) {
8168
8649
  this.player = new MPlayer(doc, (playState) => {
@@ -8175,6 +8656,9 @@ var _MPlaybackButtons = class _MPlaybackButtons {
8175
8656
  this.updateButtons();
8176
8657
  return this;
8177
8658
  }
8659
+ /**
8660
+ * Detach attached music document.
8661
+ */
8178
8662
  detachDocument() {
8179
8663
  this.setDocument(void 0);
8180
8664
  }
@@ -8196,31 +8680,50 @@ var _MPlaybackButtons = class _MPlaybackButtons {
8196
8680
  this.pauseButton.innerText = this.pauseLabel;
8197
8681
  }
8198
8682
  }
8683
+ /**
8684
+ * Set play button.
8685
+ * @param btn - HTML button element or element id.
8686
+ * @param btnLabel - Custom button label (e.g. "Play").
8687
+ * @returns - This playback buttons class instance.
8688
+ */
8199
8689
  setPlayButton(btn, btnLabel) {
8200
- assertArg2(import_ts_utils_lib14.Utils.Is.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
8690
+ assertArg3(import_ts_utils_lib15.Utils.Is.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
8201
8691
  _MPlaybackButtons.removeOnClickListeners(this.playButton, this.onPlay);
8202
- this.playButton = require_t(import_ts_utils_lib14.Utils.Dom.getButton(btn), "Play button required!");
8692
+ this.playButton = require_t(import_ts_utils_lib15.Utils.Dom.getButton(btn), "Play button required!");
8203
8693
  this.playLabel = btnLabel != null ? btnLabel : "Play";
8204
8694
  _MPlaybackButtons.removeOnClickListeners(this.playButton, "all");
8205
8695
  _MPlaybackButtons.addOnClickListener(this.playButton, this.onPlay);
8206
8696
  this.updateButtons();
8207
8697
  return this;
8208
8698
  }
8699
+ /**
8700
+ * Set stop button.
8701
+ * @param btn - HTML button element or element id.
8702
+ * @param btnLabel - Custom button label (e.g. "Stop").
8703
+ * @returns - This playback buttons class instance.
8704
+ */
8209
8705
  setStopButton(btn, btnLabel) {
8210
- assertArg2(import_ts_utils_lib14.Utils.Is.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
8706
+ assertArg3(import_ts_utils_lib15.Utils.Is.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
8211
8707
  _MPlaybackButtons.removeOnClickListeners(this.stopButton, this.onStop);
8212
- this.stopButton = require_t(import_ts_utils_lib14.Utils.Dom.getButton(btn), "Stop button required!");
8708
+ this.stopButton = require_t(import_ts_utils_lib15.Utils.Dom.getButton(btn), "Stop button required!");
8213
8709
  this.stopLabel = btnLabel != null ? btnLabel : "Stop";
8214
8710
  _MPlaybackButtons.removeOnClickListeners(this.stopButton, "all");
8215
8711
  _MPlaybackButtons.addOnClickListener(this.stopButton, this.onStop);
8216
8712
  this.updateButtons();
8217
8713
  return this;
8218
8714
  }
8715
+ /**
8716
+ * Set play/stop button.
8717
+ * @param btn - HTML button element or element id.
8718
+ * @param playLabel - Custom button label for play action (e.g. "Play").
8719
+ * @param stopLabel - Custom button label for stop action (e.g. "Stop").
8720
+ * @returns - This playback buttons class instance.
8721
+ */
8219
8722
  setPlayStopButton(btn, playLabel, stopLabel) {
8220
- assertArg2(import_ts_utils_lib14.Utils.Is.isStringOrUndefined(playLabel), "playLabel", playLabel);
8221
- assertArg2(import_ts_utils_lib14.Utils.Is.isStringOrUndefined(stopLabel), "stopLabel", stopLabel);
8723
+ assertArg3(import_ts_utils_lib15.Utils.Is.isStringOrUndefined(playLabel), "playLabel", playLabel);
8724
+ assertArg3(import_ts_utils_lib15.Utils.Is.isStringOrUndefined(stopLabel), "stopLabel", stopLabel);
8222
8725
  _MPlaybackButtons.removeOnClickListeners(this.playStopButton, this.onPlayStop);
8223
- this.playStopButton = require_t(import_ts_utils_lib14.Utils.Dom.getButton(btn), "Play/stop button required!");
8726
+ this.playStopButton = require_t(import_ts_utils_lib15.Utils.Dom.getButton(btn), "Play/stop button required!");
8224
8727
  this.playLabel = playLabel != null ? playLabel : "Play";
8225
8728
  this.stopLabel = stopLabel != null ? stopLabel : "Stop";
8226
8729
  _MPlaybackButtons.removeOnClickListeners(this.playStopButton, "all");
@@ -8228,10 +8731,16 @@ var _MPlaybackButtons = class _MPlaybackButtons {
8228
8731
  this.updateButtons();
8229
8732
  return this;
8230
8733
  }
8734
+ /**
8735
+ * Set pause button.
8736
+ * @param btn - HTML button element or element id.
8737
+ * @param btnLabel - Custom button label (e.g. "Pause").
8738
+ * @returns - This playback buttons class instance.
8739
+ */
8231
8740
  setPauseButton(btn, btnLabel) {
8232
- assertArg2(import_ts_utils_lib14.Utils.Is.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
8741
+ assertArg3(import_ts_utils_lib15.Utils.Is.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
8233
8742
  _MPlaybackButtons.removeOnClickListeners(this.pauseButton, this.onPause);
8234
- this.pauseButton = require_t(import_ts_utils_lib14.Utils.Dom.getButton(btn), "Pause button required!");
8743
+ this.pauseButton = require_t(import_ts_utils_lib15.Utils.Dom.getButton(btn), "Pause button required!");
8235
8744
  this.pauseLabel = btnLabel != null ? btnLabel : "Pause";
8236
8745
  _MPlaybackButtons.removeOnClickListeners(this.pauseButton, "all");
8237
8746
  _MPlaybackButtons.addOnClickListener(this.pauseButton, this.onPause);
@@ -8253,7 +8762,7 @@ var _MPlaybackButtons = class _MPlaybackButtons {
8253
8762
  }
8254
8763
  }
8255
8764
  static addOnClickListener(btn, onClick) {
8256
- assertArg2(import_ts_utils_lib14.Utils.Is.isFunction(onClick), "onClick", onClick);
8765
+ assertArg3(import_ts_utils_lib15.Utils.Is.isFunction(onClick), "onClick", onClick);
8257
8766
  btn.addEventListener("click", onClick);
8258
8767
  let clickListeners = this.savedOnClickListeners.get(btn) || [];
8259
8768
  this.savedOnClickListeners.set(btn, [...clickListeners, onClick]);
@@ -8263,8 +8772,8 @@ __publicField(_MPlaybackButtons, "savedOnClickListeners", /* @__PURE__ */ new Ma
8263
8772
  var MPlaybackButtons = _MPlaybackButtons;
8264
8773
 
8265
8774
  // src/score/index.ts
8266
- var import_core20 = require("@tspro/web-music-score/core");
8267
- (0, import_core20.init)();
8775
+ var import_core21 = require("@tspro/web-music-score/core");
8776
+ (0, import_core21.init)();
8268
8777
  // Annotate the CommonJS export names for ESM import in node:
8269
8778
  0 && (module.exports = {
8270
8779
  Annotation,
@@ -8273,6 +8782,7 @@ var import_core20 = require("@tspro/web-music-score/core");
8273
8782
  Connective,
8274
8783
  DivRect,
8275
8784
  DocumentBuilder,
8785
+ DynamicsAnnotation,
8276
8786
  Fermata,
8277
8787
  Label,
8278
8788
  MAccidental,
@@ -8314,6 +8824,7 @@ var import_core20 = require("@tspro/web-music-score/core");
8314
8824
  ScoreStaffPosEvent,
8315
8825
  StaffPreset,
8316
8826
  Stem,
8827
+ TempoAnnotation,
8317
8828
  TieType,
8318
8829
  VerticalPosition,
8319
8830
  getStringNumbers,