@tspro/web-music-score 5.4.0 → 5.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/LICENSE +1 -1
  3. package/README.md +4 -4
  4. package/dist/audio/index.d.ts +1 -1
  5. package/dist/audio/index.js +1 -1
  6. package/dist/audio/index.mjs +3 -3
  7. package/dist/audio-cg/index.js +1 -1
  8. package/dist/audio-cg/index.mjs +3 -3
  9. package/dist/audio-synth/index.js +1 -1
  10. package/dist/audio-synth/index.mjs +3 -3
  11. package/dist/{chunk-QGMOI7AP.mjs → chunk-5I5KENEC.mjs} +2 -2
  12. package/dist/{chunk-ZWUBO5EW.mjs → chunk-6P4ECBUH.mjs} +3 -3
  13. package/dist/{chunk-MHDBTCVG.mjs → chunk-A5SMODAT.mjs} +3 -3
  14. package/dist/{chunk-AUT4C6TY.mjs → chunk-U2ACCEHX.mjs} +2 -2
  15. package/dist/core/index.js +2 -2
  16. package/dist/core/index.mjs +4 -4
  17. package/dist/{guitar-CarHGDAt.d.ts → guitar-CNOxM4ZK.d.ts} +1 -1
  18. package/dist/iife/audio-cg.global.js +1 -1
  19. package/dist/iife/index.global.js +11 -11
  20. package/dist/{music-objects-ONIuVUgs.d.mts → music-objects-DYMqx839.d.mts} +18 -17
  21. package/dist/{music-objects-3Esbz7ij.d.ts → music-objects-DumXKWJp.d.ts} +20 -19
  22. package/dist/{note-CJuq5aBy.d.ts → note-RVXvpfyV.d.ts} +1 -1
  23. package/dist/pieces/index.d.mts +1 -1
  24. package/dist/pieces/index.d.ts +3 -3
  25. package/dist/pieces/index.js +1 -1
  26. package/dist/pieces/index.mjs +2 -2
  27. package/dist/react-ui/index.d.mts +1 -1
  28. package/dist/react-ui/index.d.ts +5 -5
  29. package/dist/react-ui/index.js +1 -1
  30. package/dist/react-ui/index.mjs +2 -2
  31. package/dist/{scale-DulPFco_.d.ts → scale-CUYFBo-8.d.ts} +2 -2
  32. package/dist/score/index.d.mts +2 -2
  33. package/dist/score/index.d.ts +5 -5
  34. package/dist/score/index.js +162 -113
  35. package/dist/score/index.mjs +187 -138
  36. package/dist/{tempo-BnUjm25M.d.ts → tempo-DwuZsv2T.d.ts} +1 -1
  37. package/dist/theory/index.d.ts +6 -6
  38. package/dist/theory/index.js +1 -1
  39. package/dist/theory/index.mjs +3 -3
  40. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- /* WebMusicScore v5.4.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v5.4.1 | (c) 2023-2025 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
2
  "use strict";
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
@@ -708,6 +708,8 @@ var DebugSettings = {
708
708
  var DocumentSettings = {
709
709
  DocumentScale: 1,
710
710
  DocumentMinWidth: 75,
711
+ MinColumnsWidth: 10,
712
+ ColumnWidthScale: 1.7,
711
713
  PostMeasureBreakWidth: 10,
712
714
  NoteDotSpace: 0.5,
713
715
  NoteAccSpace: 0.5,
@@ -3315,23 +3317,6 @@ var ObjRhythmColumn = class extends MusicObject {
3315
3317
  addLyricsObject(lyricsObj) {
3316
3318
  this.lyricsObject.set(lyricsObj.verse, lyricsObj.line, lyricsObj.vpos, lyricsObj);
3317
3319
  }
3318
- getMinWidth() {
3319
- let maxNoteSize = Math.max(...this.voiceSymbol.mapToArray((s) => s.rhythmProps.noteSize));
3320
- let w = DocumentSettings.NoteHeadWidth;
3321
- switch (maxNoteSize) {
3322
- case 1:
3323
- return w * 5;
3324
- // whole note
3325
- case 2:
3326
- return w * 3;
3327
- // half note
3328
- case 4:
3329
- return w * 2;
3330
- // quarter note
3331
- default:
3332
- return w;
3333
- }
3334
- }
3335
3320
  updateNoteDisplacements() {
3336
3321
  let data = [];
3337
3322
  this.voiceSymbol.forEach((symbol) => {
@@ -3422,13 +3407,9 @@ var ObjRhythmColumn = class extends MusicObject {
3422
3407
  if (!this.needLayout) {
3423
3408
  return;
3424
3409
  }
3425
- this.requestRectUpdate();
3426
- this.rect = new import_ts_utils_lib13.AnchoredRect();
3427
3410
  let { row } = this;
3428
- let { unitSize } = ctx;
3429
- let halfMinWidth = this.getMinWidth() * unitSize / 2;
3430
- let leftw = halfMinWidth;
3431
- let rightw = halfMinWidth;
3411
+ let leftw = 0;
3412
+ let rightw = 0;
3432
3413
  this.voiceSymbol.forEach((symbol) => {
3433
3414
  symbol.layout(ctx, accState);
3434
3415
  let r = symbol.getRect();
@@ -3436,31 +3417,28 @@ var ObjRhythmColumn = class extends MusicObject {
3436
3417
  rightw = Math.max(rightw, r.rightw);
3437
3418
  });
3438
3419
  if (this.arpeggioDir !== void 0) {
3439
- let arpeggioWidth = 0;
3440
- this.arpeggios = row.getNotationLines().map((line) => {
3441
- let arpeggio = new ObjArpeggio(this, line, this.getArpeggioDir());
3442
- arpeggio.layout(ctx);
3443
- arpeggio.offset(-leftw - arpeggio.getRect().right, line.getRect().anchorY - arpeggio.getRect().anchorY);
3444
- arpeggioWidth = Math.max(arpeggioWidth, arpeggio.getRect().width);
3445
- line.addObject(arpeggio);
3446
- this.measure.addStaticObject(line, arpeggio);
3447
- return arpeggio;
3420
+ this.arpeggios = row.getNotationLines().map((line) => new ObjArpeggio(this, line, this.getArpeggioDir()));
3421
+ this.arpeggios.forEach((a) => a.layout(ctx));
3422
+ const arpeggioWidth = this.arpeggios.map((a) => a.getRect().width).reduce((accState2, cur) => Math.max(accState2, cur)) + ctx.unitSize;
3423
+ this.arpeggios.forEach((a) => {
3424
+ a.offset(-leftw - arpeggioWidth + a.getRect().leftw, a.line.getRect().anchorY - a.getRect().anchorY);
3425
+ a.line.addObject(a);
3426
+ this.measure.addStaticObject(a.line, a);
3448
3427
  });
3449
3428
  leftw += arpeggioWidth;
3450
3429
  } else {
3451
3430
  this.arpeggios = [];
3452
3431
  }
3453
- let widenColumnObjs = this.getAnchoredLayoutObjects().filter((layoutObj) => layoutObj.layoutGroup.widensColumn);
3454
- if (widenColumnObjs.length > 0) {
3455
- widenColumnObjs.forEach((layoutObj) => {
3456
- leftw = Math.max(leftw, layoutObj.musicObj.getRect().leftw);
3457
- rightw = Math.max(rightw, layoutObj.musicObj.getRect().rightw);
3458
- });
3459
- }
3432
+ const noteSizes = this.voiceSymbol.mapToArray((s) => s.rhythmProps.noteSize);
3433
+ const maxNoteSize = Math.min(8, Math.max(1, ...noteSizes));
3434
+ const MinColumnWidth = Math.ceil(8 / maxNoteSize) * DocumentSettings.NoteHeadWidth * ctx.unitSize * 0.75;
3435
+ leftw = Math.max(leftw, MinColumnWidth / 2);
3436
+ rightw = Math.max(rightw, MinColumnWidth / 2);
3437
+ leftw *= DocumentSettings.ColumnWidthScale;
3438
+ rightw *= DocumentSettings.ColumnWidthScale;
3439
+ this.rect = new import_ts_utils_lib13.AnchoredRect(-leftw, 0, rightw, 0, 0, 0);
3440
+ this.requestRectUpdate();
3460
3441
  this.voiceSymbol.forEach((symbol) => symbol.updateAccidentalState(accState));
3461
- this.rect.left = -leftw;
3462
- this.rect.anchorX = 0;
3463
- this.rect.right = rightw;
3464
3442
  this.row.getStaves().forEach((staff) => {
3465
3443
  let minDiatonicId = void 0;
3466
3444
  let maxDiatonicId = void 0;
@@ -3488,12 +3466,48 @@ var ObjRhythmColumn = class extends MusicObject {
3488
3466
  }
3489
3467
  });
3490
3468
  }
3469
+ layoutReserveSpace(ctx) {
3470
+ const columns = this.measure.getColumns();
3471
+ const extraSpace = ctx.unitSize;
3472
+ this.getAnchoredLayoutObjects().forEach((obj) => {
3473
+ if (obj.layoutGroup.reserveSpace) {
3474
+ const i = columns.indexOf(this);
3475
+ if (i < 0) return;
3476
+ const leftOverflow = obj.getRect().leftw - this.getRect().leftw;
3477
+ if (leftOverflow > 0) {
3478
+ const prevCol = columns[i - 1];
3479
+ if (prevCol) {
3480
+ prevCol.getAnchoredLayoutObjects().forEach((prevObj) => {
3481
+ if (prevObj.layoutGroupId === obj.layoutGroupId) {
3482
+ const rightOverflow2 = prevObj.getRect().rightw - prevCol.getRect().rightw;
3483
+ this.rect.left -= Math.max(rightOverflow2 + leftOverflow, 0) + extraSpace;
3484
+ this.requestRectUpdate();
3485
+ }
3486
+ });
3487
+ }
3488
+ }
3489
+ const rightOverflow = obj.getRect().rightw - this.getRect().rightw;
3490
+ if (rightOverflow > 0) {
3491
+ const nextCol = columns[i + 1];
3492
+ if (nextCol) {
3493
+ nextCol.getAnchoredLayoutObjects().forEach((nextObj) => {
3494
+ if (nextObj.layoutGroupId === obj.layoutGroupId) {
3495
+ const leftOverflow2 = nextObj.getRect().leftw - nextCol.getRect().leftw;
3496
+ this.rect.right += Math.max(rightOverflow + leftOverflow2, 0) + extraSpace;
3497
+ this.requestRectUpdate();
3498
+ }
3499
+ });
3500
+ }
3501
+ }
3502
+ }
3503
+ });
3504
+ }
3491
3505
  layoutDone() {
3492
3506
  this.needLayout = false;
3493
3507
  }
3494
3508
  updateRect() {
3495
3509
  this.shapeRects = [
3496
- ...this.voiceSymbol.filter((s) => !!s).mapToArray((s) => s.getRect().clone()),
3510
+ ...this.voiceSymbol.filter((s) => s !== void 0).mapToArray((s) => s.getRect().clone()),
3497
3511
  ...this.arpeggios.map((a) => a.getRect().clone())
3498
3512
  ];
3499
3513
  this.rect.top = Math.min(...this.shapeRects.map((r) => r.top));
@@ -5461,7 +5475,7 @@ var ObjLyrics = class extends MusicObject {
5461
5475
  let halign = (lyricsOptions == null ? void 0 : lyricsOptions.align) === "left" /* Left */ ? 0 : (lyricsOptions == null ? void 0 : lyricsOptions.align) === "right" /* Right */ ? 1 : 0.5;
5462
5476
  this.hyphen = import_ts_utils_lib24.Guard.isEnumValue(lyricsOptions == null ? void 0 : lyricsOptions.hyphen, LyricsHyphen) ? lyricsOptions == null ? void 0 : lyricsOptions.hyphen : void 0;
5463
5477
  this.text = new ObjText(this, { text: lyricsText, color: this.color, scale: 0.8 }, halign, 0);
5464
- this.rect = new import_ts_utils_lib24.AnchoredRect();
5478
+ this.rect = this.text.getRect().clone();
5465
5479
  this.mi = new MLyrics(this);
5466
5480
  }
5467
5481
  getMusicInterface() {
@@ -5477,7 +5491,7 @@ var ObjLyrics = class extends MusicObject {
5477
5491
  this.nextLyricsObject = lyricsObj;
5478
5492
  }
5479
5493
  pick(x, y) {
5480
- return this.rect.contains(x, y) ? [this] : [];
5494
+ return this.getRect().contains(x, y) ? [this] : [];
5481
5495
  }
5482
5496
  layout(ctx) {
5483
5497
  this.text.layout(ctx);
@@ -5498,8 +5512,8 @@ var ObjLyrics = class extends MusicObject {
5498
5512
  let maxw = r ? (r.left - l.right) * 0.85 : hyphenw;
5499
5513
  let w = this.hyphen === "-" /* Hyphen */ ? Math.min(hyphenw, maxw) : maxw;
5500
5514
  if (w > 0) {
5501
- let cx = r ? (r.left + l.right) / 2 : l.right + w / 0.85;
5502
- let cy = l.centerY / 2;
5515
+ let cx = r ? (l.right + r.left) / 2 : l.right + w / 0.85;
5516
+ let cy = l.centerY;
5503
5517
  ctx.moveTo(cx - w / 2, cy);
5504
5518
  ctx.lineTo(cx + w / 2, cy);
5505
5519
  ctx.stroke();
@@ -5687,7 +5701,27 @@ function getVerseLayoutGroupId(verse) {
5687
5701
  throw new import_core13.MusicError(import_core13.MusicErrorType.Unknown, "VerseNumber is not 1, 2 or 3.");
5688
5702
  }
5689
5703
  }
5690
- var _ObjMeasure = class _ObjMeasure extends MusicObject {
5704
+ var MeasureRegions = class {
5705
+ constructor() {
5706
+ __publicField(this, "tabTuning_0", 0);
5707
+ __publicField(this, "signature_1", 0);
5708
+ __publicField(this, "leftBarLine_2", 0);
5709
+ __publicField(this, "padding_3", 0);
5710
+ __publicField(this, "columnsMin_4", 0);
5711
+ __publicField(this, "padding_5", 0);
5712
+ __publicField(this, "rightBarLine_6", 0);
5713
+ }
5714
+ get leftSolid() {
5715
+ return this.tabTuning_0 + this.signature_1 + this.leftBarLine_2 + this.padding_3;
5716
+ }
5717
+ get columnsMin() {
5718
+ return this.columnsMin_4;
5719
+ }
5720
+ get rightSolid() {
5721
+ return this.padding_5 + this.rightBarLine_6;
5722
+ }
5723
+ };
5724
+ var ObjMeasure = class extends MusicObject {
5691
5725
  constructor(row, options) {
5692
5726
  super(row);
5693
5727
  this.row = row;
@@ -5707,12 +5741,9 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5707
5741
  __publicField(this, "barLineRight");
5708
5742
  __publicField(this, "connectives", []);
5709
5743
  __publicField(this, "beamGroups", []);
5710
- __publicField(this, "tabStringNotesWidth", 0);
5711
5744
  __publicField(this, "measureId");
5745
+ __publicField(this, "regions", new MeasureRegions());
5712
5746
  __publicField(this, "needLayout", true);
5713
- __publicField(this, "leftSolidAreaWidth", 0);
5714
- __publicField(this, "minColumnsAreaWidth", 0);
5715
- __publicField(this, "rightSolidAreaWidth", 0);
5716
5747
  __publicField(this, "voiceSymbols", (0, import_ts_utils_lib26.asMulti)(new import_ts_utils_lib26.IndexArray()));
5717
5748
  __publicField(this, "lastAddedRhythmColumn");
5718
5749
  __publicField(this, "lastAddedRhythmSymbol");
@@ -6388,27 +6419,27 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
6388
6419
  this.getRect().bottom
6389
6420
  );
6390
6421
  }
6391
- getLeftSolidAreaWidth() {
6392
- return this.leftSolidAreaWidth;
6422
+ getLeftSolidWidth() {
6423
+ return this.regions.leftSolid;
6393
6424
  }
6394
- getMinColumnsAreaWidth() {
6395
- return this.minColumnsAreaWidth;
6425
+ getMinColumnsWidth() {
6426
+ return this.regions.columnsMin;
6396
6427
  }
6397
- getRightSolidAreaWidth() {
6398
- return this.rightSolidAreaWidth;
6428
+ getRightSolidWidth() {
6429
+ return this.regions.rightSolid;
6399
6430
  }
6400
- getSolidAreaWidth() {
6401
- return this.leftSolidAreaWidth + this.rightSolidAreaWidth;
6431
+ getTotalSolidWidth() {
6432
+ return this.getLeftSolidWidth() + this.getRightSolidWidth();
6402
6433
  }
6403
6434
  getMinWidth() {
6404
- return this.leftSolidAreaWidth + this.minColumnsAreaWidth + this.rightSolidAreaWidth;
6435
+ return this.getLeftSolidWidth() + this.getMinColumnsWidth() + this.getRightSolidWidth();
6405
6436
  }
6406
6437
  getStaffLineLeft() {
6407
6438
  let prev = this.getPrevMeasure();
6408
6439
  if (prev && prev.row === this.row && !prev.hasPostMeasureBreak()) {
6409
6440
  return prev.getStaffLineRight();
6410
6441
  } else {
6411
- return this.getRect().left + this.tabStringNotesWidth;
6442
+ return this.getRect().left + this.regions.tabTuning_0;
6412
6443
  }
6413
6444
  }
6414
6445
  getStaffLineRight() {
@@ -6622,7 +6653,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
6622
6653
  this.postMeasureBreakWidth = this.hasPostMeasureBreak() ? DocumentSettings.PostMeasureBreakWidth * unitSize : 0;
6623
6654
  let isFirstMeasureInRow = this === this.row.getFirstMeasure();
6624
6655
  let isAfterMeasureBreak = ((_a = this.getPrevMeasure()) == null ? void 0 : _a.hasPostMeasureBreak()) === true;
6625
- this.tabStringNotesWidth = isFirstMeasureInRow && this.row.hasTab ? unitSize * 4 : 0;
6656
+ this.regions.tabTuning_0 = isFirstMeasureInRow && this.row.hasTab ? unitSize * 4 : 0;
6626
6657
  let showClef = isFirstMeasureInRow || isAfterMeasureBreak;
6627
6658
  let showMeasureNumber = this.options.showNumber === false ? false : this.options.showNumber === true || isFirstMeasureInRow && !this.row.isFirstRow();
6628
6659
  let showKeySignature = isFirstMeasureInRow || isAfterMeasureBreak || !!this.alterKeySignature;
@@ -6659,7 +6690,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
6659
6690
  let note = tab.getTuningStrings()[stringId].format(import_theory9.PitchNotation.Helmholtz, import_theory9.SymbolSet.Unicode);
6660
6691
  let obj = new ObjText(this, { text: note, scale: 0.8 }, 1, 0.5);
6661
6692
  obj.layout(ctx);
6662
- obj.offset(this.tabStringNotesWidth * 0.8, tab.getStringY(stringId));
6693
+ obj.offset(this.regions.tabTuning_0 * 0.8, tab.getStringY(stringId));
6663
6694
  this.tabStringNotes.push(obj);
6664
6695
  tab.addObject(obj);
6665
6696
  }
@@ -6668,19 +6699,24 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
6668
6699
  this.barLineLeft.layout(ctx);
6669
6700
  const accState = new AccidentalState(this);
6670
6701
  this.columns.forEach((col) => col.layout(ctx, accState));
6702
+ this.columns.forEach((col) => col.layoutReserveSpace(ctx));
6671
6703
  this.barLineRight.layout(ctx);
6672
- if (this.endRepeatPlayCountText) {
6704
+ if (this.endRepeatPlayCountText)
6673
6705
  this.endRepeatPlayCountText.layout(ctx);
6674
- }
6675
- this.layoutObjects.forEach((layoutObj) => layoutObj.layout(ctx));
6706
+ this.layoutObjects.forEach((obj) => obj.layout(ctx));
6676
6707
  let padding = ctx.unitSize;
6677
- this.leftSolidAreaWidth = this.tabStringNotesWidth + Math.max(0, ...this.signatures.map((signature) => signature.getRect().width)) + this.barLineLeft.getRect().width + padding;
6678
- this.rightSolidAreaWidth = padding + this.barLineRight.getRect().width;
6679
- this.minColumnsAreaWidth = 0;
6680
- this.columns.forEach((col) => this.minColumnsAreaWidth += col.getRect().width);
6681
- this.minColumnsAreaWidth = Math.max(this.minColumnsAreaWidth, _ObjMeasure.MinFlexContentWidth * unitSize);
6708
+ this.regions.signature_1 = Math.max(0, ...this.signatures.map((signature) => signature.getRect().width));
6709
+ this.regions.leftBarLine_2 = this.barLineLeft.getRect().width;
6710
+ this.regions.padding_3 = padding;
6711
+ this.regions.columnsMin_4 = Math.max(
6712
+ DocumentSettings.MinColumnsWidth * unitSize,
6713
+ this.columns.map((col) => col.getRect().width).reduce((acc, cur) => acc + cur)
6714
+ );
6715
+ this.regions.padding_5 = padding;
6716
+ this.regions.rightBarLine_6 = this.barLineRight.getRect().width;
6682
6717
  }
6683
6718
  layoutWidth(ctx, width) {
6719
+ var _a;
6684
6720
  if (!this.needLayout) {
6685
6721
  return;
6686
6722
  }
@@ -6691,27 +6727,25 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
6691
6727
  let rect;
6692
6728
  this.signatures.forEach((signature) => {
6693
6729
  rect = signature.getRect();
6694
- signature.offset(this.rect.left + this.tabStringNotesWidth - rect.left, -rect.anchorY);
6730
+ signature.offset(this.rect.left + this.regions.tabTuning_0 - rect.left, -rect.anchorY);
6695
6731
  });
6696
6732
  let signaturesWidth = Math.max(0, ...this.signatures.map((signature) => signature.getRect().width));
6697
6733
  rect = this.barLineLeft.getRect();
6698
- this.barLineLeft.offset(this.rect.left + this.tabStringNotesWidth + signaturesWidth - rect.left, -rect.anchorY);
6734
+ this.barLineLeft.offset(this.rect.left + this.regions.tabTuning_0 + signaturesWidth - rect.left, -rect.anchorY);
6699
6735
  rect = this.barLineRight.getRect();
6700
6736
  this.barLineRight.offset(this.rect.right - rect.right, -rect.anchorY);
6701
- if (this.endRepeatPlayCountText) {
6702
- this.endRepeatPlayCountText.offset(this.barLineRight.getRect().left, this.barLineRight.getRect().top);
6703
- }
6704
- let columnsAreaLeft = this.rect.left + this.leftSolidAreaWidth;
6705
- let columnsAreaRight = this.rect.right - this.rightSolidAreaWidth;
6706
- let columnsAreaWidth = columnsAreaRight - columnsAreaLeft;
6707
- let columnsWidth = import_ts_utils_lib26.Utils.Math.sum(this.columns.map((col) => col.getRect().width));
6708
- let columnScale = columnsAreaWidth / columnsWidth;
6709
- let columnLeft = columnsAreaLeft;
6737
+ (_a = this.endRepeatPlayCountText) == null ? void 0 : _a.offset(this.barLineRight.getRect().left, this.barLineRight.getRect().top);
6738
+ let columnsLeft = this.rect.left + this.regions.leftSolid;
6739
+ let columnsRight = this.rect.right - this.regions.rightSolid;
6740
+ let columnsWidth = columnsRight - columnsLeft;
6741
+ let columnsMinWidth = this.regions.columnsMin;
6742
+ let columnScale = columnsWidth / columnsMinWidth;
6743
+ let curColumnLeft = columnsLeft;
6710
6744
  this.columns.forEach((col) => {
6711
6745
  rect = col.getRect();
6712
- let columnAnchorX = columnLeft + rect.leftw * columnScale;
6746
+ let columnAnchorX = curColumnLeft + rect.leftw * columnScale;
6713
6747
  col.offset(columnAnchorX - rect.anchorX, -rect.anchorY);
6714
- columnLeft += rect.width * columnScale;
6748
+ curColumnLeft += rect.width * columnScale;
6715
6749
  });
6716
6750
  getVoiceIds().forEach((voiceId) => {
6717
6751
  const symbols = this.getVoiceSymbols(voiceId);
@@ -6828,8 +6862,6 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
6828
6862
  this.beamGroups.forEach((beam) => beam.draw(ctx));
6829
6863
  }
6830
6864
  };
6831
- __publicField(_ObjMeasure, "MinFlexContentWidth", 10);
6832
- var ObjMeasure = _ObjMeasure;
6833
6865
 
6834
6866
  // src/score/engine/layout-object.ts
6835
6867
  var import_core14 = require("@tspro/web-music-score/core");
@@ -6850,16 +6882,16 @@ var LayoutGroupId = /* @__PURE__ */ ((LayoutGroupId2) => {
6850
6882
  })(LayoutGroupId || {});
6851
6883
  var LayoutGroupIdAttrs = new import_ts_utils_lib27.UniMap([
6852
6884
  [0 /* TabRhythm */, { rowAlign: true }],
6853
- [1 /* Fermata */, {}],
6854
- [2 /* NoteLabel */, { widen: true }],
6885
+ [1 /* Fermata */, { reserveSpace: true }],
6886
+ [2 /* NoteLabel */, { reserveSpace: true }],
6855
6887
  [3 /* Navigation */, { rowAlign: true }],
6856
6888
  [4 /* Ending */, { rowAlign: true, padding: 2 }],
6857
6889
  [5 /* TempoAnnotation */, { rowAlign: true, padding: 2 }],
6858
6890
  [6 /* DynamicsAnnotation */, { rowAlign: true, padding: 2 }],
6859
- [7 /* ChordLabel */, { widen: true, rowAlign: true }],
6860
- [8 /* LyricsVerse1 */, { rowAlign: true }],
6861
- [9 /* LyricsVerse2 */, { rowAlign: true }],
6862
- [10 /* LyricsVerse3 */, { rowAlign: true }]
6891
+ [7 /* ChordLabel */, { reserveSpace: true, rowAlign: true }],
6892
+ [8 /* LyricsVerse1 */, { reserveSpace: true, rowAlign: true }],
6893
+ [9 /* LyricsVerse2 */, { reserveSpace: true, rowAlign: true }],
6894
+ [10 /* LyricsVerse3 */, { reserveSpace: true, rowAlign: true }]
6863
6895
  ]);
6864
6896
  function requireParentMeasure(p) {
6865
6897
  while (p) {
@@ -6951,11 +6983,11 @@ var LayoutGroup = class {
6951
6983
  // key = VerticalPos
6952
6984
  __publicField(this, "layoutObject", (0, import_ts_utils_lib27.asMulti)(new import_ts_utils_lib27.IndexArray()));
6953
6985
  __publicField(this, "rowAlign");
6954
- __publicField(this, "widensColumn");
6986
+ __publicField(this, "reserveSpace");
6955
6987
  __publicField(this, "padding");
6956
6988
  var _a, _b, _c, _d;
6957
6989
  this.rowAlign = ((_a = LayoutGroupIdAttrs.get(layoutGroupId)) == null ? void 0 : _a.rowAlign) === true;
6958
- this.widensColumn = ((_b = LayoutGroupIdAttrs.get(layoutGroupId)) == null ? void 0 : _b.widen) === true;
6990
+ this.reserveSpace = ((_b = LayoutGroupIdAttrs.get(layoutGroupId)) == null ? void 0 : _b.reserveSpace) === true;
6959
6991
  this.padding = (_d = (_c = LayoutGroupIdAttrs.get(layoutGroupId)) == null ? void 0 : _c.padding) != null ? _d : 0;
6960
6992
  }
6961
6993
  getLayoutObjects(verticalPos) {
@@ -7540,13 +7572,13 @@ var ObjScoreRow = class extends MusicObject {
7540
7572
  let targetColumnsAreaWidth = right - left;
7541
7573
  let minColumnsAreaWidth = 0;
7542
7574
  this.measures.forEach((m) => {
7543
- targetColumnsAreaWidth -= m.getSolidAreaWidth() + m.getPostMeasureBreakWidth();
7544
- minColumnsAreaWidth += m.getMinColumnsAreaWidth();
7575
+ targetColumnsAreaWidth -= m.getTotalSolidWidth() + m.getPostMeasureBreakWidth();
7576
+ minColumnsAreaWidth += m.getMinColumnsWidth();
7545
7577
  });
7546
7578
  let columnsAreaScale = targetColumnsAreaWidth / minColumnsAreaWidth;
7547
- let x = this.doc.getInstrumentGroupSize(ctx).braceRight;
7579
+ let x = this.doc.getInstrumentGroupRegions(ctx).braceRight;
7548
7580
  this.measures.forEach((m) => {
7549
- let newMeasureWidth = m.getSolidAreaWidth() + m.getMinColumnsAreaWidth() * columnsAreaScale;
7581
+ let newMeasureWidth = m.getTotalSolidWidth() + m.getMinColumnsWidth() * columnsAreaScale;
7550
7582
  m.layoutWidth(ctx, newMeasureWidth);
7551
7583
  let r = m.getRect();
7552
7584
  m.offset(x - r.left, -r.anchorY);
@@ -7637,7 +7669,7 @@ var ObjScoreRow = class extends MusicObject {
7637
7669
  }
7638
7670
  this.measures.forEach((m) => m.draw(ctx));
7639
7671
  this.notationLines.forEach((m) => m.draw(ctx));
7640
- let grpSize = this.doc.getInstrumentGroupSize(ctx);
7672
+ let grpSize = this.doc.getInstrumentGroupRegions(ctx);
7641
7673
  this.instrumentNames.forEach((obj, i) => {
7642
7674
  let grp = this.instrumentLineGroups[i];
7643
7675
  if (grp.length > 1) {
@@ -7751,6 +7783,23 @@ var ObjHeader = class extends MusicObject {
7751
7783
  // src/score/engine/obj-document.ts
7752
7784
  var import_ts_utils_lib31 = require("@tspro/ts-utils-lib");
7753
7785
  var import_core17 = require("@tspro/web-music-score/core");
7786
+ var InstrumentGroupRegions = class {
7787
+ constructor() {
7788
+ __publicField(this, "nameLeft", 0);
7789
+ __publicField(this, "nameRight", 0);
7790
+ __publicField(this, "braceLeft", 0);
7791
+ __publicField(this, "braceRight", 0);
7792
+ }
7793
+ get left() {
7794
+ return this.nameLeft;
7795
+ }
7796
+ get right() {
7797
+ return this.braceRight;
7798
+ }
7799
+ get width() {
7800
+ return this.right - this.left;
7801
+ }
7802
+ };
7754
7803
  var ObjDocument = class extends MusicObject {
7755
7804
  constructor() {
7756
7805
  super(void 0);
@@ -7764,6 +7813,7 @@ var ObjDocument = class extends MusicObject {
7764
7813
  __publicField(this, "newRowRequested", false);
7765
7814
  __publicField(this, "allConnectiveProps", []);
7766
7815
  __publicField(this, "staffGroups", new import_ts_utils_lib31.UniMap());
7816
+ __publicField(this, "instrumentGroupRegions", new InstrumentGroupRegions());
7767
7817
  __publicField(this, "mi");
7768
7818
  this.mi = new MDocument2(this);
7769
7819
  }
@@ -7960,17 +8010,16 @@ var ObjDocument = class extends MusicObject {
7960
8010
  this.ctx.updateCursorRect(cursorRect);
7961
8011
  }
7962
8012
  }
7963
- getInstrumentGroupSize(ctx) {
8013
+ getInstrumentGroupRegions(ctx) {
7964
8014
  let nameWidth = Math.max(0, ...this.rows.map((row) => row.getInstrumentNameWidth(ctx)));
7965
8015
  let hasName = nameWidth > 0;
7966
8016
  let padding = hasName ? ctx.unitSize : 0;
7967
8017
  let braceWidth = hasName ? ctx.unitSize * 5 : 0;
7968
- return {
7969
- nameLeft: 0,
7970
- nameRight: nameWidth,
7971
- braceLeft: nameWidth + padding,
7972
- braceRight: nameWidth + padding + braceWidth + padding
7973
- };
8018
+ this.instrumentGroupRegions.nameLeft = 0;
8019
+ this.instrumentGroupRegions.nameRight = nameWidth;
8020
+ this.instrumentGroupRegions.braceLeft = nameWidth + padding;
8021
+ this.instrumentGroupRegions.braceRight = nameWidth + padding + braceWidth + padding;
8022
+ return this.instrumentGroupRegions;
7974
8023
  }
7975
8024
  requestLayout() {
7976
8025
  this.needLayout = true;
@@ -8000,18 +8049,18 @@ var ObjDocument = class extends MusicObject {
8000
8049
  this.allConnectiveProps.forEach((props) => props.createConnectives());
8001
8050
  this.rows.forEach((row) => row.resetLayoutGroups(ctx));
8002
8051
  this.rows.forEach((row) => row.layout(ctx));
8003
- let left = this.getInstrumentGroupSize(ctx).braceRight;
8004
- let right = Math.max(
8052
+ let rowLeft = this.getInstrumentGroupRegions(ctx).right;
8053
+ let rowRight = rowLeft + Math.max(
8005
8054
  DocumentSettings.DocumentMinWidth * unitSize,
8006
- ...this.rows.map((row) => 1.4 * row.getMinWidth())
8055
+ ...this.rows.map((row) => row.getMinWidth())
8007
8056
  );
8008
- this.rows.forEach((row) => row.layoutWidth(ctx, left, right));
8057
+ this.rows.forEach((row) => row.layoutWidth(ctx, rowLeft, rowRight));
8009
8058
  this.rows.forEach((row) => row.layoutLayoutGroups(ctx));
8010
8059
  this.rows.forEach((row) => row.layoutSetNotationLines(ctx));
8011
8060
  this.rows.forEach((row) => row.layoutPadding(ctx));
8012
8061
  this.rect = new import_ts_utils_lib31.AnchoredRect();
8013
8062
  if (this.header) {
8014
- this.header.layoutWidth(ctx, left, right);
8063
+ this.header.layoutWidth(ctx, rowLeft, rowRight);
8015
8064
  this.rect.expandInPlace(this.header.getRect());
8016
8065
  }
8017
8066
  this.rows.forEach((row) => {