@tspro/web-music-score 5.3.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 (46) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/LICENSE +1 -1
  3. package/README.md +6 -4
  4. package/dist/audio/index.d.mts +1 -1
  5. package/dist/audio/index.d.ts +1 -1
  6. package/dist/audio/index.js +3 -3
  7. package/dist/audio/index.mjs +6 -6
  8. package/dist/audio-cg/index.js +1 -1
  9. package/dist/audio-cg/index.mjs +3 -3
  10. package/dist/audio-synth/index.js +1 -1
  11. package/dist/audio-synth/index.mjs +3 -3
  12. package/dist/{chunk-PMDIUO22.mjs → chunk-5I5KENEC.mjs} +2 -2
  13. package/dist/chunk-6P4ECBUH.mjs +37 -0
  14. package/dist/{chunk-ZBA5XLYR.mjs → chunk-A5SMODAT.mjs} +21 -21
  15. package/dist/{chunk-C6UQDKWU.mjs → chunk-U2ACCEHX.mjs} +2 -2
  16. package/dist/core/index.js +2 -2
  17. package/dist/core/index.mjs +6 -31
  18. package/dist/{guitar-BsSayRsH.d.ts → guitar-CNOxM4ZK.d.ts} +1 -1
  19. package/dist/{guitar-DdexKdN6.d.mts → guitar-DXlB-9vK.d.mts} +1 -1
  20. package/dist/iife/audio-cg.global.js +1 -1
  21. package/dist/iife/index.global.js +18 -11
  22. package/dist/{music-objects-BGiRQIXW.d.mts → music-objects-DYMqx839.d.mts} +66 -260
  23. package/dist/{music-objects-Ih9vCl4p.d.ts → music-objects-DumXKWJp.d.ts} +66 -260
  24. package/dist/{note-eA2xPPiG.d.mts → note-RVXvpfyV.d.mts} +13 -1
  25. package/dist/{note-CgCIBwvR.d.ts → note-RVXvpfyV.d.ts} +14 -2
  26. package/dist/pieces/index.d.mts +3 -3
  27. package/dist/pieces/index.d.ts +3 -3
  28. package/dist/pieces/index.js +1 -1
  29. package/dist/pieces/index.mjs +2 -2
  30. package/dist/react-ui/index.d.mts +9 -9
  31. package/dist/react-ui/index.d.ts +9 -9
  32. package/dist/react-ui/index.js +12 -14
  33. package/dist/react-ui/index.mjs +14 -16
  34. package/dist/{scale-CBW4eTz7.d.ts → scale-C8gHC448.d.mts} +3 -3
  35. package/dist/{scale-DQP3b9Zx.d.mts → scale-CUYFBo-8.d.ts} +3 -3
  36. package/dist/score/index.d.mts +232 -6
  37. package/dist/score/index.d.ts +232 -6
  38. package/dist/score/index.js +1122 -975
  39. package/dist/score/index.mjs +978 -861
  40. package/dist/{tempo-dkctPkCS.d.mts → tempo-BlCGZuYg.d.mts} +14 -2
  41. package/dist/{tempo-DMt3iwz9.d.ts → tempo-DwuZsv2T.d.ts} +14 -2
  42. package/dist/theory/index.d.mts +6 -6
  43. package/dist/theory/index.d.ts +6 -6
  44. package/dist/theory/index.js +88 -86
  45. package/dist/theory/index.mjs +85 -81
  46. package/package.json +5 -4
@@ -1,207 +1,6 @@
1
- import { N as Note, A as Accidental } from './note-CgCIBwvR.js';
2
- import { R as RhythmProps, N as NoteLength, i as NoteLengthStr, k as TupletRatio, d as Tempo, K as KeySignature, b as TimeSignature } from './tempo-DMt3iwz9.js';
3
- import { Vec2 } from '@tspro/ts-utils-lib';
4
-
5
- /**
6
- * DivRect class, left, top, right, bottom rectangle divided into four sections by centerX, centerY.
7
- */
8
- declare class DivRect {
9
- left: number;
10
- centerX: number;
11
- right: number;
12
- top: number;
13
- centerY: number;
14
- bottom: number;
15
- /**
16
- * Create rectangle with all zero values.
17
- */
18
- constructor();
19
- /**
20
- * Create rectangle with left, right, top, bottom.
21
- * Properties centerX and centerY will be centered in the middle.
22
- *
23
- * @param left - Left coordinate.
24
- * @param right - Right coordinate.
25
- * @param top - Top coordinate.
26
- * @param bottom - Bottom coordinate.
27
- */
28
- constructor(left: number, right: number, top: number, bottom: number);
29
- /**
30
- * Create rectangle with full arguments.
31
- *
32
- * @param left - Left coordinate.
33
- * @param centerX - Center x-coordinate.
34
- * @param right - Right coordinate.
35
- * @param top - Top coordinate.
36
- * @param centerY - Center y-coordinate.
37
- * @param bottom - Bottom coordinate.
38
- */
39
- constructor(left: number, centerX: number, right: number, top: number, centerY: number, bottom: number);
40
- /**
41
- * Create rect from basic left, top, width and height arguments.
42
- *
43
- * @param left - Left coordinate.
44
- * @param top - Top coordinate.
45
- * @param width - With.
46
- * @param height - Height.
47
- * @returns - DivRect.
48
- */
49
- static create(left: number, top: number, width: number, height: number): DivRect;
50
- /**
51
- * Create rect from centerX, centerY, width, height arguments.
52
- *
53
- * @param centerX - Center x-coordinate.
54
- * @param centerY - Center y-coordinate.
55
- * @param width - Width.
56
- * @param height - Height.
57
- * @returns - DivRect.
58
- */
59
- static createCentered(centerX: number, centerY: number, width: number, height: number): DivRect;
60
- /**
61
- * Create rect from sections.
62
- *
63
- * @param leftw - Left section width.
64
- * @param rightw - Right section width.
65
- * @param toph - Top section height.
66
- * @param bottomh - Bottomsection height.
67
- * @returns - DivRect.
68
- */
69
- static createSections(leftw: number, rightw: number, toph: number, bottomh: number): DivRect;
70
- /**
71
- * Width getter.
72
- */
73
- get width(): number;
74
- /**
75
- * Height getter.
76
- */
77
- get height(): number;
78
- /**
79
- * Left section width getter.
80
- */
81
- get leftw(): number;
82
- /**
83
- * Right section width getter.
84
- */
85
- get rightw(): number;
86
- /**
87
- * Top section height getter.
88
- */
89
- get toph(): number;
90
- /**
91
- * Bottom section height getter.
92
- */
93
- get bottomh(): number;
94
- /**
95
- * Does this Rect contain given (x, y)-point?
96
- *
97
- * @param x - X-coordinate.
98
- * @param y - Y-coordinate.
99
- * @returns - True/false.
100
- */
101
- contains(x: number, y: number): boolean;
102
- /**
103
- * Do a and b rects overlap?
104
- *
105
- * @param a - DivRect a.
106
- * @param b - DivRect b.
107
- * @returns - True/false.
108
- */
109
- static overlap(a: DivRect, b: DivRect): boolean;
110
- /**
111
- * Do horizontal measures of a and b rects overlap?
112
- *
113
- * @param a - DivRect a.
114
- * @param b - DivRect b.
115
- * @returns - True/false.
116
- */
117
- static overlapX(a: DivRect, b: DivRect): boolean;
118
- /**
119
- * Check if this Rect equals with given Rect.
120
- * @param a - DivRect a.
121
- * @param b - DivRect b.
122
- * @returns - True/false.
123
- */
124
- static equals(a: DivRect | null | undefined, b: DivRect | null | undefined): boolean;
125
- /**
126
- * Check if frame of this Rect equals with given Rect, ignoring center x- and center y-coordinates.
127
- *
128
- * @param a - DivRect a.
129
- * @param b - DivRect b.
130
- * @returns - True/false.
131
- */
132
- static equalsFrame(a: DivRect | null | undefined, b: DivRect | null | undefined): boolean;
133
- /**
134
- * Created duplicate of this Rect.
135
- *
136
- * @returns - Duplicate.
137
- */
138
- copy(): DivRect;
139
- /**
140
- * Move this rect by (dx, dy). Modifies this Rect.
141
- *
142
- * @param dx - Offset amount in x-direction.
143
- * @param dy - Offset amount in y-direction.
144
- * @returns - This DivRect instance.
145
- */
146
- offsetInPlace(dx: number, dy: number): DivRect;
147
- /**
148
- * Move this rect by (dx, dy). Immutable, returns modified copy.
149
- *
150
- * @param dx - Offset amount in x-direction.
151
- * @param dy - Offset amount in y-direction.
152
- * @returns - DivRect copy with applied offset.
153
- */
154
- offsetCopy(dx: number, dy: number): DivRect;
155
- /**
156
- * Expand this Rect by given Rect. Modifies this Rect.
157
- *
158
- * @param rect - DivRect to expand this instance with.
159
- * @returns - This DivRect instance.
160
- */
161
- expandInPlace(rect: DivRect): DivRect;
162
- /**
163
- * Expand this Rect by given Rect. Immutable, returns modified copy.
164
- *
165
- * @param rect - DivRect to expand this instance with.
166
- * @returns - Expanded copy of this DivRect.
167
- */
168
- expandCopy(rect: DivRect): DivRect;
169
- /**
170
- * Clip this Rect by given Rect. Mmodifies this Rect.
171
- *
172
- * @param clipRect - DivRect to clip this instance with.
173
- * @returns - This DivRect instance.
174
- */
175
- clipInPlace(clipRect: DivRect): DivRect;
176
- /**
177
- * Clip this Rect by given Rect. Immutable, return modified copy.
178
- *
179
- * @param clipRect - DivRecto to clip this instance with.
180
- * @returns - Clipped DivRect copy.
181
- */
182
- clipCopy(clipRect: DivRect): DivRect;
183
- /**
184
- * Scale Rect. Anchor pos is (centerX, centerY). Modifies this Rect.
185
- *
186
- * @param scaleX - Scale x-amount.
187
- * @param scaleY - Scale y-amount. If undefined then scale x-amount is used.
188
- * @returns This DivRect instance.
189
- */
190
- scaleInPlace(scaleX: number, scaleY?: number): DivRect;
191
- /**
192
- * Scale Rect. Anchor pos is (centerX, centerY). Immutable, returns modified copy.
193
- *
194
- * @param scaleX - Scale x-amount.
195
- * @param scaleY - Scale y-amount. If undefined then scale x-amount is used.
196
- * @returns Scaled copy of this DivRect.
197
- */
198
- scaleCopy(scaleX: number, scaleY?: number): DivRect;
199
- /**
200
- * Get this DivRect instance.
201
- * @returns - This DivRect instance.
202
- */
203
- getRect(): DivRect;
204
- }
1
+ import { N as Note, A as Accidental } from './note-RVXvpfyV.js';
2
+ import { R as RhythmProps, N as NoteLength, i as NoteLengthStr, l as TupletRatio, d as Tempo, K as KeySignature, b as TimeSignature } from './tempo-DwuZsv2T.js';
3
+ import { AnchoredRect, Rect, Vec } from '@tspro/ts-utils-lib';
205
4
 
206
5
  /** Staff preset values for score configuration. */
207
6
  declare enum StaffPreset {
@@ -269,14 +68,20 @@ type ScoreConfiguration = StaffConfig | TabConfig | (StaffConfig | TabConfig)[];
269
68
  type VoiceId = 0 | 1 | 2 | 3;
270
69
  /** Get supported voice ids. Returns [0, 1, 2, 3]. */
271
70
  declare function getVoiceIds(): ReadonlyArray<VoiceId>;
71
+ declare function isVoiceId(voiceId: unknown): voiceId is VoiceId;
72
+ declare function validateVoiceId(voiceId: unknown): VoiceId;
272
73
  /** Strng number. */
273
74
  type StringNumber = 1 | 2 | 3 | 4 | 5 | 6;
274
75
  /** Get string numbers. Returns [0, 1, 2, 3, 4, 5]. */
275
76
  declare function getStringNumbers(): ReadonlyArray<StringNumber>;
77
+ declare function isStringNumber(stringNum: unknown): stringNum is VerseNumber;
78
+ declare function validateStringNumber(stringNum: unknown): VerseNumber;
276
79
  /** Verse number. */
277
80
  type VerseNumber = 1 | 2 | 3;
278
81
  /** Get supported verse numbers. Returns [1, 2, 3]. */
279
82
  declare function getVerseNumbers(): ReadonlyArray<VerseNumber>;
83
+ declare function isVerseNumber(verse: unknown): verse is VerseNumber;
84
+ declare function validateVerseNumber(verseNum: unknown): VerseNumber;
280
85
  /** Stem direction enum. */
281
86
  declare enum Stem {
282
87
  /** Auto stem direction. */
@@ -566,7 +371,7 @@ declare class ObjText extends MusicObject {
566
371
  }
567
372
 
568
373
  type NotationLineObject = {
569
- getRect: () => DivRect;
374
+ getRect: () => AnchoredRect;
570
375
  offset?: (dx: number, dy: number) => void;
571
376
  offsetInPlace?: (dx: number, dy: number) => void;
572
377
  };
@@ -675,12 +480,12 @@ declare class ObjTab extends ObjNotationLine {
675
480
  declare class ObjStaffNoteGroup extends MusicObject {
676
481
  readonly staff: ObjStaff;
677
482
  readonly noteGroup: ObjNoteGroup;
678
- noteHeadRects: DivRect[];
679
- dotRects: DivRect[];
483
+ noteHeadRects: AnchoredRect[];
484
+ dotRects: AnchoredRect[];
680
485
  accidentals: ObjAccidental[];
681
- stemTip?: DivRect;
682
- stemBase?: DivRect;
683
- flagRects: DivRect[];
486
+ stemTip?: AnchoredRect;
487
+ stemBase?: AnchoredRect;
488
+ flagRects: AnchoredRect[];
684
489
  private prevTopNoteY;
685
490
  private prevBottomNoteY;
686
491
  readonly mi: MStaffNoteGroup;
@@ -688,7 +493,7 @@ declare class ObjStaffNoteGroup extends MusicObject {
688
493
  getMusicInterface(): MusicInterface;
689
494
  pick(x: number, y: number): MusicObject[];
690
495
  updateRect(): void;
691
- getRect(): DivRect;
496
+ getRect(): AnchoredRect;
692
497
  offset(dx: number, dy: number): void;
693
498
  }
694
499
  declare class ObjTabNoteGroup extends MusicObject {
@@ -725,6 +530,7 @@ declare class ObjNoteGroup extends MusicObject {
725
530
  private beamGroup?;
726
531
  private readonly staffObjects;
727
532
  private readonly tabObjects;
533
+ private isNoteDisplaced;
728
534
  readonly mi: MNoteGroup;
729
535
  constructor(col: ObjRhythmColumn, voiceId: VoiceId, notes: ReadonlyArray<Note>, noteLength: NoteLength | NoteLengthStr, options?: NoteOptions | undefined, tupletRatio?: TupletRatio);
730
536
  getMusicInterface(): MNoteGroup;
@@ -735,10 +541,10 @@ declare class ObjNoteGroup extends MusicObject {
735
541
  get maxDiatonicId(): number;
736
542
  getDiatonicId(staff?: ObjStaff): number;
737
543
  get stemDir(): Stem.Up | Stem.Down;
544
+ setNoteDisplacement(note: Note, isDisplaced: boolean): void;
738
545
  enableConnective(line: ObjNotationLine): boolean;
739
546
  startConnective(connectiveProps: ConnectiveProps): void;
740
547
  updateRunningArguments(diatonicId: number, stemDir: Stem.Up | Stem.Down, stringNumbers: StringNumber[]): void;
741
- getStaticObjects(line: ObjNotationLine): ReadonlyArray<MusicObject>;
742
548
  pick(x: number, y: number): MusicObject[];
743
549
  getTopNote(): Note;
744
550
  getBottomNote(): Note;
@@ -777,7 +583,7 @@ declare class ObjNoteGroup extends MusicObject {
777
583
  setStemTipY(staff: ObjStaff, stemTipY: number): void;
778
584
  offset(dx: number, dy: number): void;
779
585
  draw(ctx: RenderContext): void;
780
- getDotVerticalDisplacement(staff: ObjStaff, diatonicId: number, stemDir: Stem): 1 | 0 | -1;
586
+ getDotVerticalDisplacement(staff: ObjStaff, diatonicId: number, stemDir: Stem): 0 | 1 | -1;
781
587
  static hasSameNotes(ng1: ObjNoteGroup, ng2: ObjNoteGroup): boolean;
782
588
  }
783
589
 
@@ -796,7 +602,7 @@ declare class BeamPoint {
796
602
  bottomBeamsHeight: number;
797
603
  constructor(staff: ObjStaff, beamGroup: ObjBeamGroup, symbol: RhythmSymbol, x: number, y: number);
798
604
  offset(dx: number, dy: number): void;
799
- getRect(): DivRect;
605
+ getRect(): AnchoredRect;
800
606
  }
801
607
  declare class ObjStaffBeamGroup extends MusicObject {
802
608
  readonly staff: ObjStaff;
@@ -846,8 +652,8 @@ declare class ObjBeamGroup extends MusicObject {
846
652
  declare class ObjStaffRest extends MusicObject {
847
653
  readonly staff: ObjStaff;
848
654
  readonly rest: ObjRest;
849
- restRect: DivRect;
850
- dotRects: DivRect[];
655
+ restRect: AnchoredRect;
656
+ dotRects: AnchoredRect[];
851
657
  readonly mi: MStaffRest;
852
658
  constructor(staff: ObjStaff, rest: ObjRest);
853
659
  getMusicInterface(): MusicInterface;
@@ -941,7 +747,6 @@ declare class ObjRhythmColumn extends MusicObject {
941
747
  private staffMaxDiatonicId;
942
748
  private arpeggioDir;
943
749
  private arpeggios;
944
- private noteHeadDisplacements;
945
750
  private readonly playerProps;
946
751
  private needLayout;
947
752
  private shapeRects;
@@ -961,8 +766,7 @@ declare class ObjRhythmColumn extends MusicObject {
961
766
  */
962
767
  getNextColumn(): ObjRhythmColumn | undefined;
963
768
  getTicksToNextColumn(): number;
964
- getShapeRects(): DivRect[];
965
- getStaticObjects(line: ObjNotationLine): ReadonlyArray<MusicObject>;
769
+ getShapeRects(): AnchoredRect[];
966
770
  get doc(): ObjDocument;
967
771
  get row(): ObjScoreRow;
968
772
  pick(x: number, y: number): MusicObject[];
@@ -972,13 +776,12 @@ declare class ObjRhythmColumn extends MusicObject {
972
776
  getVoiceSymbol(voiceId: VoiceId): RhythmSymbol | undefined;
973
777
  getLyricsObject(verse: VerseNumber, line: ObjNotationLine, vpos: VerticalPos): ObjLyrics | undefined;
974
778
  addLyricsObject(lyricsObj: ObjLyrics): void;
975
- getMinWidth(): number;
976
- setupNoteHeadDisplacements(): void;
977
- getNoteHeadDisplacement(noteGroup: ObjNoteGroup, note: Note): -1 | 0 | 1;
779
+ updateNoteDisplacements(): void;
978
780
  isEmpty(): boolean;
979
781
  getPlayerNotes(): ScorePlayerNote[];
980
782
  requestLayout(): void;
981
783
  layout(ctx: RenderContext, accState: AccidentalState): void;
784
+ layoutReserveSpace(ctx: RenderContext): void;
982
785
  layoutDone(): void;
983
786
  updateRect(): void;
984
787
  offset(dx: number, dy: number): void;
@@ -1027,7 +830,7 @@ declare class ObjStaffTabBarLine extends MusicObject {
1027
830
  constructor(barLine: ObjBarLine, line: ObjNotationLine);
1028
831
  getMusicInterface(): MusicInterface;
1029
832
  pick(x: number, y: number): MusicObject[];
1030
- setRect(r: DivRect): void;
833
+ setRect(r: AnchoredRect): void;
1031
834
  offset(dx: number, dy: number): void;
1032
835
  }
1033
836
  declare abstract class ObjBarLine extends MusicObject {
@@ -1090,7 +893,6 @@ declare class ObjConnective extends MusicObject {
1090
893
  declare class ObjMeasure extends MusicObject {
1091
894
  readonly row: ObjScoreRow;
1092
895
  private readonly options;
1093
- static readonly MinFlexContentWidth = 10;
1094
896
  private prevMeasure;
1095
897
  private nextMeasure;
1096
898
  private keySignature;
@@ -1106,12 +908,9 @@ declare class ObjMeasure extends MusicObject {
1106
908
  private barLineRight;
1107
909
  private connectives;
1108
910
  private beamGroups;
1109
- private tabStringNotesWidth;
1110
911
  private measureId;
912
+ private regions;
1111
913
  private needLayout;
1112
- private leftSolidAreaWidth;
1113
- private minColumnsAreaWidth;
1114
- private rightSolidAreaWidth;
1115
914
  private voiceSymbols;
1116
915
  private lastAddedRhythmColumn?;
1117
916
  private lastAddedRhythmSymbol?;
@@ -1194,17 +993,17 @@ declare class ObjMeasure extends MusicObject {
1194
993
  private getRhythmColumn;
1195
994
  getMeasureTicks(): number;
1196
995
  getConsumedTicks(voiceId?: VoiceId): number;
1197
- getColumnsContentRect(): DivRect;
1198
- getLeftSolidAreaWidth(): number;
1199
- getMinColumnsAreaWidth(): number;
1200
- getRightSolidAreaWidth(): number;
1201
- getSolidAreaWidth(): number;
996
+ getColumnsContentRect(): AnchoredRect;
997
+ getLeftSolidWidth(): number;
998
+ getMinColumnsWidth(): number;
999
+ getRightSolidWidth(): number;
1000
+ getTotalSolidWidth(): number;
1202
1001
  getMinWidth(): number;
1203
1002
  getStaffLineLeft(): number;
1204
1003
  getStaffLineRight(): number;
1205
- private getLyricsObjects;
1206
1004
  getPrevLyricsObject(lyricsObj: ObjLyrics): ObjLyrics | undefined;
1207
1005
  getStaticObjects(line: ObjNotationLine): ReadonlyArray<MusicObject>;
1006
+ addStaticObject(line: ObjNotationLine, staticObj: MusicObject): void;
1208
1007
  removeLayoutObjects(musicObj: MusicObject): void;
1209
1008
  addConnectiveObject(connective: ObjConnective): void;
1210
1009
  removeConnectiveObjects(): void;
@@ -1260,7 +1059,7 @@ declare class ObjScoreRow extends MusicObject {
1260
1059
  resetLayoutGroups(ctx: RenderContext): void;
1261
1060
  layoutLayoutGroups(ctx: RenderContext): void;
1262
1061
  pick(x: number, y: number): MusicObject[];
1263
- getConnectivesContentRect(): DivRect;
1062
+ getConnectivesContentRect(): AnchoredRect;
1264
1063
  getDiatonicIdAt(y: number): number | undefined;
1265
1064
  addMeasure(m: ObjMeasure): void;
1266
1065
  getMeasures(): ReadonlyArray<ObjMeasure>;
@@ -1285,6 +1084,15 @@ declare class ObjScoreRow extends MusicObject {
1285
1084
  draw(ctx: RenderContext): void;
1286
1085
  }
1287
1086
 
1087
+ declare class InstrumentGroupRegions {
1088
+ nameLeft: number;
1089
+ nameRight: number;
1090
+ braceLeft: number;
1091
+ braceRight: number;
1092
+ get left(): number;
1093
+ get right(): number;
1094
+ get width(): number;
1095
+ }
1288
1096
  declare class ObjDocument extends MusicObject {
1289
1097
  private needLayout;
1290
1098
  private ctx?;
@@ -1296,6 +1104,7 @@ declare class ObjDocument extends MusicObject {
1296
1104
  private newRowRequested;
1297
1105
  private allConnectiveProps;
1298
1106
  private staffGroups;
1107
+ private instrumentGroupRegions;
1299
1108
  private readonly mi;
1300
1109
  constructor();
1301
1110
  getMusicInterface(): MDocument;
@@ -1323,13 +1132,8 @@ declare class ObjDocument extends MusicObject {
1323
1132
  removeLayoutObjects(musicObj: MusicObject): void;
1324
1133
  private forEachMeasure;
1325
1134
  resetMeasures(): void;
1326
- updateCursorRect(cursorRect?: DivRect): void;
1327
- getInstrumentGroupSize(ctx: RenderContext): {
1328
- nameLeft: number;
1329
- nameRight: number;
1330
- braceLeft: number;
1331
- braceRight: number;
1332
- };
1135
+ updateCursorRect(cursorRect?: Rect): void;
1136
+ getInstrumentGroupRegions(ctx: RenderContext): InstrumentGroupRegions;
1333
1137
  requestLayout(): void;
1334
1138
  requestFullLayout(): void;
1335
1139
  layout(): void;
@@ -1375,7 +1179,7 @@ declare class RenderContext {
1375
1179
  setCanvas(canvas: HTMLCanvasElement): void;
1376
1180
  setScoreEventListener(fn: ScoreEventListener): void;
1377
1181
  needMouseInput(): boolean;
1378
- getMousePos(e: MouseEvent): Vec2;
1182
+ getMousePos(e: MouseEvent): Vec;
1379
1183
  private updateCurStaffPos;
1380
1184
  private updateCurObjects;
1381
1185
  onClick(e: MouseEvent): void;
@@ -1388,20 +1192,20 @@ declare class RenderContext {
1388
1192
  scoreRow: ObjScoreRow;
1389
1193
  diatonicId: number;
1390
1194
  }): void;
1391
- updateCursorRect(cursorRect: DivRect | undefined): void;
1195
+ updateCursorRect(cursorRect: Rect | undefined): void;
1392
1196
  updateCanvasSize(): void;
1393
1197
  draw(): void;
1394
1198
  drawHilightStaffPosRect(): void;
1395
1199
  drawHilightObjectRect(): void;
1396
1200
  drawPlayCursor(): void;
1397
- txFromScreenCoord(screenCoord: Vec2): Vec2;
1398
- txToScreenCoord(coord: Vec2): Vec2;
1201
+ txFromScreenCoord(screenCoord: Vec): Vec;
1202
+ txToScreenCoord(coord: Vec): Vec;
1399
1203
  clearCanvas(): void;
1400
- drawDebugRect(r: DivRect): void;
1204
+ drawDebugRect(r: AnchoredRect | Rect): void;
1401
1205
  drawLedgerLines(staff: ObjStaff, diatonicId: number, x: number): void;
1402
- getRestRect(restSize: number): DivRect;
1206
+ getRestRect(restSize: number): AnchoredRect;
1403
1207
  drawRest(restSize: number, x: number, y: number): void;
1404
- drawFlag(rect: DivRect, dir: "up" | "down"): void;
1208
+ drawFlag(rect: Rect | AnchoredRect, dir: "up" | "down"): void;
1405
1209
  color(color: string): RenderContext;
1406
1210
  lineColor(color: string): RenderContext;
1407
1211
  fillColor(color: string): RenderContext;
@@ -1430,7 +1234,7 @@ declare class RenderContext {
1430
1234
  fillCircle(x: number, y: number, radius: number): void;
1431
1235
  strokeLine(startX: number, startY: number, endX: number, endY: number): void;
1432
1236
  strokePartialLine(startX: number, startY: number, endX: number, endY: number, startT: number, endT: number): void;
1433
- drawBrace(rect: DivRect, side: "left" | "right"): void;
1237
+ drawBrace(rect: AnchoredRect, side: "left" | "right"): void;
1434
1238
  }
1435
1239
 
1436
1240
  declare class ObjEnding extends MusicObject {
@@ -1441,7 +1245,7 @@ declare class ObjEnding extends MusicObject {
1441
1245
  readonly mi: MEnding;
1442
1246
  constructor(measure: ObjMeasure, passages: number[]);
1443
1247
  getMusicInterface(): MEnding;
1444
- getShapeRects(): DivRect[];
1248
+ getShapeRects(): AnchoredRect[];
1445
1249
  isSingleMeasureEnding(): boolean;
1446
1250
  hasPassage(pass: number): boolean;
1447
1251
  getHighestPassage(): number;
@@ -1576,25 +1380,27 @@ declare class LayoutObjectWrapper {
1576
1380
  readonly layoutGroup: LayoutGroup;
1577
1381
  private positionResolved;
1578
1382
  constructor(musicObj: LayoutableMusicObject, line: ObjNotationLine, layoutGroupId: LayoutGroupId, verticalPos: VerticalPos);
1579
- clearPositionResolved(): void;
1383
+ resetPositionResolved(): void;
1580
1384
  setPositionResolved(): void;
1581
1385
  isPositionResolved(): boolean;
1582
1386
  resolveClosestToStaffY(ctx: RenderContext): number;
1583
1387
  getTextContent(): string | undefined;
1584
1388
  layout(ctx: RenderContext): void;
1585
1389
  offset(dx: number, dy: number): void;
1586
- getRect(): DivRect;
1390
+ getRect(): AnchoredRect;
1587
1391
  }
1588
1392
  declare class LayoutGroup {
1589
1393
  readonly layoutGroupId: number;
1590
- private readonly layoutObjectTable;
1394
+ private readonly layoutObject;
1591
1395
  readonly rowAlign: boolean;
1592
- readonly widensColumn: boolean;
1396
+ readonly reserveSpace: boolean;
1397
+ readonly padding: number;
1593
1398
  constructor(layoutGroupId: number);
1594
1399
  getLayoutObjects(verticalPos: VerticalPos): Readonly<LayoutObjectWrapper[]>;
1595
1400
  add(layoutObj: LayoutObjectWrapper): void;
1596
1401
  remove(layoutObj: LayoutObjectWrapper): void;
1597
- clearPositionAndLayout(ctx: RenderContext): void;
1402
+ layout(ctx: RenderContext): void;
1403
+ getPadding(ctx: RenderContext): number;
1598
1404
  }
1599
1405
 
1600
1406
  declare class MusicObjectLink {
@@ -1613,11 +1419,11 @@ declare abstract class MusicObject {
1613
1419
  constructor(parent: MusicObject | undefined);
1614
1420
  abstract getMusicInterface(): MusicInterface;
1615
1421
  getParent(): MusicObject | undefined;
1616
- protected rect: DivRect;
1422
+ protected rect: AnchoredRect;
1617
1423
  private needRectUpdate;
1618
1424
  requestRectUpdate(): void;
1619
1425
  updateRect(): void;
1620
- getRect(): DivRect;
1426
+ getRect(): AnchoredRect;
1621
1427
  /**
1622
1428
  * Most objects are simple rects in shape.
1623
1429
  * Some objects might be more complex consisting of multiple rects.
@@ -1625,7 +1431,7 @@ declare abstract class MusicObject {
1625
1431
  *
1626
1432
  * @returns Array of rects.
1627
1433
  */
1628
- getShapeRects(): DivRect[];
1434
+ getShapeRects(): AnchoredRect[];
1629
1435
  /**
1630
1436
  * Pick objects.
1631
1437
  *
@@ -2543,4 +2349,4 @@ declare class MExtensionLine extends MusicInterface {
2543
2349
  getMusicObject(): ObjExtensionLine;
2544
2350
  }
2545
2351
 
2546
- export { MStaffSignature as $, type AnnotationText as A, MFermata as B, Connective as C, DivRect as D, MHeader as E, Fermata as F, MImage as G, MMeasure as H, MBarLineRight as I, MBarLineLeft as J, MStaffTabBarLine as K, type LyricsOptions as L, MDocument as M, type NoteOptions as N, MNoteGroup as O, MStaffNoteGroup as P, MTabNoteGroup as Q, type RestOptions as R, StaffPreset as S, type TupletOptions as T, MRest as U, type VoiceId as V, MStaffRest as W, MRhythmColumn as X, MScoreRow as Y, MStaff as Z, MTab as _, type ScoreConfiguration as a, MTabSignature as a0, MTabRhythm as a1, MSpecialText as a2, MText as a3, MLyrics as a4, MExtensionLine as a5, Clef as a6, type BaseConfig as a7, type StaffConfig as a8, type TabConfig as a9, getVoiceIds as aa, type StringNumber as ab, getStringNumbers as ac, getVerseNumbers as ad, Stem as ae, Arpeggio as af, type StaffTabOrGroup as ag, LyricsAlign as ah, LyricsHyphen as ai, DynamicsAnnotation as aj, TempoAnnotation as ak, PlayState as al, type PlayStateChangeListener as am, type MeasureOptions as b, type VerseNumber as c, type StaffTabOrGroups as d, Navigation as e, Annotation as f, Label as g, TieType as h, NoteAnchor as i, VerticalPosition as j, type ScoreEventType as k, ScoreEvent as l, ScoreStaffPosEvent as m, ScoreObjectEvent as n, type ScoreEventListener as o, MPlayer as p, MRenderContext as q, MRenderer as r, MPlaybackButtons as s, MusicInterface as t, MAccidental as u, MConnective as v, MArpeggio as w, MBeamGroup as x, MStaffBeamGroup as y, MEnding as z };
2352
+ export { MTabSignature as $, type AnnotationText as A, MFermata as B, Connective as C, MHeader as D, MImage as E, Fermata as F, MMeasure as G, MBarLineRight as H, MBarLineLeft as I, MStaffTabBarLine as J, MNoteGroup as K, type LyricsOptions as L, MDocument as M, type NoteOptions as N, MStaffNoteGroup as O, MTabNoteGroup as P, MRest as Q, type RestOptions as R, StaffPreset as S, type TupletOptions as T, MStaffRest as U, type VoiceId as V, MRhythmColumn as W, MScoreRow as X, MStaff as Y, MTab as Z, MStaffSignature as _, type ScoreConfiguration as a, MTabRhythm as a0, MSpecialText as a1, MText as a2, MLyrics as a3, MExtensionLine as a4, Clef as a5, type BaseConfig as a6, type StaffConfig as a7, type TabConfig as a8, getVoiceIds as a9, isVoiceId as aa, validateVoiceId as ab, type StringNumber as ac, getStringNumbers as ad, isStringNumber as ae, validateStringNumber as af, getVerseNumbers as ag, isVerseNumber as ah, validateVerseNumber as ai, Stem as aj, Arpeggio as ak, type StaffTabOrGroup as al, LyricsAlign as am, LyricsHyphen as an, DynamicsAnnotation as ao, TempoAnnotation as ap, PlayState as aq, type PlayStateChangeListener as ar, type MeasureOptions as b, type VerseNumber as c, type StaffTabOrGroups as d, Navigation as e, Annotation as f, Label as g, TieType as h, NoteAnchor as i, VerticalPosition as j, type ScoreEventType as k, ScoreEvent as l, ScoreStaffPosEvent as m, ScoreObjectEvent as n, type ScoreEventListener as o, MPlayer as p, MRenderContext as q, MRenderer as r, MPlaybackButtons as s, MusicInterface as t, MAccidental as u, MConnective as v, MArpeggio as w, MBeamGroup as x, MStaffBeamGroup as y, MEnding as z };
@@ -63,7 +63,7 @@ type ParsedNote = {
63
63
  };
64
64
  /** Note class. */
65
65
  declare class Note {
66
- private static noteByNameCache;
66
+ private static noteCache;
67
67
  private static chromaticNoteCache;
68
68
  /** Diatonic class */
69
69
  readonly diatonicClass: number;
@@ -120,6 +120,18 @@ declare class Note {
120
120
  * @returns - Note.
121
121
  */
122
122
  static getNote(noteName: string): Note;
123
+ /**
124
+ * Test if given note name valid.
125
+ * @param noteName - Note name.
126
+ * @returns - True/false.
127
+ */
128
+ static isNote(noteName: string): boolean;
129
+ /**
130
+ * Validate given note name.
131
+ * @param noteName - Note name.
132
+ * @returns - True or throws.
133
+ */
134
+ static validateNote(noteName: string): true;
123
135
  /**
124
136
  * Get chromatic note. There are number of alternatives, this function uses simple logic to choose one.
125
137
  * @param chromaticId - Chromatic id.
@@ -63,7 +63,7 @@ type ParsedNote = {
63
63
  };
64
64
  /** Note class. */
65
65
  declare class Note {
66
- private static noteByNameCache;
66
+ private static noteCache;
67
67
  private static chromaticNoteCache;
68
68
  /** Diatonic class */
69
69
  readonly diatonicClass: number;
@@ -120,6 +120,18 @@ declare class Note {
120
120
  * @returns - Note.
121
121
  */
122
122
  static getNote(noteName: string): Note;
123
+ /**
124
+ * Test if given note name valid.
125
+ * @param noteName - Note name.
126
+ * @returns - True/false.
127
+ */
128
+ static isNote(noteName: string): boolean;
129
+ /**
130
+ * Validate given note name.
131
+ * @param noteName - Note name.
132
+ * @returns - True or throws.
133
+ */
134
+ static validateNote(noteName: string): true;
123
135
  /**
124
136
  * Get chromatic note. There are number of alternatives, this function uses simple logic to choose one.
125
137
  * @param chromaticId - Chromatic id.
@@ -288,7 +300,7 @@ declare class Note {
288
300
  * @param b - Note b.
289
301
  * @returns - -1, 0 or 1.
290
302
  */
291
- static compareFunc(a: Note, b: Note): 1 | -1 | 0;
303
+ static compareFunc(a: Note, b: Note): 1 | 0 | -1;
292
304
  }
293
305
 
294
306
  export { type Accidental as A, DefaultPitchNotation as D, GuitarNoteLabel as G, Note as N, type ParsedNote as P, SymbolSet as S, type NoteLetter as a, PitchNotation as b, PitchNotationList as c, DefaultGuitarNoteLabel as d, GuitarNoteLabelList as e, validateGuitarNoteLabel as f, getPitchNotationName as g, validatePitchNotation as v };
@@ -1,6 +1,6 @@
1
- import { M as MDocument } from '../music-objects-BGiRQIXW.mjs';
2
- import '../note-eA2xPPiG.mjs';
3
- import '../tempo-dkctPkCS.mjs';
1
+ import { M as MDocument } from '../music-objects-DYMqx839.mjs';
2
+ import '../note-RVXvpfyV.mjs';
3
+ import '../tempo-BlCGZuYg.mjs';
4
4
  import '@tspro/ts-utils-lib';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { M as MDocument } from '../music-objects-Ih9vCl4p.js';
2
- import '../note-CgCIBwvR.js';
3
- import '../tempo-DMt3iwz9.js';
1
+ import { M as MDocument } from '../music-objects-DumXKWJp.js';
2
+ import '../note-RVXvpfyV.js';
3
+ import '../tempo-DwuZsv2T.js';
4
4
  import '@tspro/ts-utils-lib';
5
5
 
6
6
  /**
@@ -1,4 +1,4 @@
1
- /* WebMusicScore v5.3.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 __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,5 +1,5 @@
1
- /* WebMusicScore v5.3.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
- import "../chunk-C6UQDKWU.mjs";
1
+ /* WebMusicScore v5.4.1 | (c) 2023-2025 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
+ import "../chunk-U2ACCEHX.mjs";
3
3
 
4
4
  // src/pieces/canon-pachelbel.ts
5
5
  import { DocumentBuilder } from "@tspro/web-music-score/score";